From: Kilian Saffran Date: Thu, 5 Nov 2020 13:29:09 +0000 (+0100) Subject: v20201105 X-Git-Url: http://cloud.dks.lu/git/?a=commitdiff_plain;h=29f63fb6ee0ce17230991e4058da96801cf9aa46;p=oldbell_lu.git v20201105 --- diff --git a/.gitignore b/.gitignore index b41cef1..745ab62 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ app/lib/perl5/* -website/lib/vendor/* \ No newline at end of file +website/lib/vendor/* +admin/lib/vendor/* diff --git a/admin/.htaccess b/admin/.htaccess new file mode 100644 index 0000000..0969f29 --- /dev/null +++ b/admin/.htaccess @@ -0,0 +1,9 @@ + +RewriteEngine on +DirectoryIndex index.php index.html +php_flag display_startup_errors on +php_flag display_errors on +php_flag html_errors on +RewriteCond %{REQUEST_FILENAME} !-f +RewriteCond %{REQUEST_FILENAME} !-d +RewriteRule "^(.*)$" "index.php" [NC,L,QSA] \ No newline at end of file diff --git a/admin/css/fonts/pot.svg b/admin/css/fonts/pot.svg new file mode 100644 index 0000000..0858544 --- /dev/null +++ b/admin/css/fonts/pot.svg @@ -0,0 +1,138 @@ + + + +Generated by IcoMoon + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/admin/css/fonts/pot.ttf b/admin/css/fonts/pot.ttf new file mode 100644 index 0000000..2f0e87f Binary files /dev/null and b/admin/css/fonts/pot.ttf differ diff --git a/admin/css/fonts/pot.woff b/admin/css/fonts/pot.woff new file mode 100644 index 0000000..dbc69a9 Binary files /dev/null and b/admin/css/fonts/pot.woff differ diff --git a/admin/css/icons.css b/admin/css/icons.css new file mode 100644 index 0000000..2d6fc0e --- /dev/null +++ b/admin/css/icons.css @@ -0,0 +1,479 @@ +@font-face { + font-family: 'pot'; + src: + url('fonts/pot.ttf?8s8vvb') format('truetype'), + url('fonts/pot.woff?8s8vvb') format('woff'), + url('fonts/pot.svg?8s8vvb#pot') format('svg'); + font-weight: normal; + font-style: normal; + font-display: block; +} + +[class^="icon-"], [class*=" icon-"] { + /* use !important to prevent issues with browser extensions that change fonts */ + font-family: 'pot' !important; + speak: never; + font-style: normal; + font-weight: normal; + font-variant: normal; + text-transform: none; + line-height: 1; + + /* Better Font Rendering =========== */ + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; +} + +.icon-category:before { + content: "\e97d"; +} +.icon-vacancydays:before { + content: "\e97e"; +} +.icon-sector:before { + content: "\e97f"; +} +.icon-lock:before { + content: "\e97b"; +} +.icon-unlock:before { + content: "\e97c"; +} +.icon-entry:before { + content: "\e97a"; +} +.icon-settings:before { + content: "\e974"; +} +.icon-dataset:before { + content: "\e930"; +} +.icon-check:before { + content: "\e931"; +} +.icon-pause:before { + content: "\e900"; +} +.icon-duplicate:before { + content: "\e949"; +} +.icon-finger1:before { + content: "\e955"; +} +.icon-finger2:before { + content: "\e956"; +} +.icon-finger3:before { + content: "\e957"; +} +.icon-finger4:before { + content: "\e958"; +} +.icon-finger5:before { + content: "\e959"; +} +.icon-fingerprint-check:before { + content: "\e95a"; +} +.icon-fingerprint-crosshair:before { + content: "\e95b"; +} +.icon-fingerprint-remove:before { + content: "\e95c"; +} +.icon-fingerprint-scanning:before { + content: "\e95e"; +} +.icon-fingerprint-scanning-index .path1:before { + content: "\e95f"; + color: rgb(0, 0, 0); +} +.icon-fingerprint-scanning-index .path2:before { + content: "\e960"; + margin-left: -1em; + color: rgb(0, 0, 0); +} +.icon-fingerprint-scanning-index .path3:before { + content: "\e961"; + margin-left: -1em; + color: rgb(0, 0, 0); +} +.icon-fingerprint-scanning-index .path4:before { + content: "\e962"; + margin-left: -1em; + color: rgb(0, 0, 0); +} +.icon-fingerprint-scanning-index .path5:before { + content: "\e963"; + margin-left: -1em; + color: rgb(0, 0, 0); +} +.icon-fingerprint-scanning-index .path6:before { + content: "\e964"; + margin-left: -1em; + color: rgb(0, 0, 0); +} +.icon-fingerprint-scanning-index .path7:before { + content: "\e965"; + margin-left: -1em; + color: rgb(0, 0, 0); +} +.icon-fingerprint-scanning-index .path8:before { + content: "\e966"; + margin-left: -1em; + color: rgb(0, 0, 0); +} +.icon-fingerprint-scanning-index .path9:before { + content: "\e967"; + margin-left: -1em; + color: rgb(0, 0, 0); +} +.icon-fingerprint-scanning-index .path10:before { + content: "\e968"; + margin-left: -1em; + color: rgb(0, 0, 0); + opacity: 0.4; +} +.icon-fingerprint-scanning-index .path11:before { + content: "\e969"; + margin-left: -1em; + color: rgb(0, 0, 0); + opacity: 0.4; +} +.icon-fingerprint-scanning-index .path12:before { + content: "\e96a"; + margin-left: -1em; + color: rgb(0, 0, 0); + opacity: 0.4; +} +.icon-fingerprint-scanning-index .path13:before { + content: "\e96b"; + margin-left: -1em; + color: rgb(0, 0, 0); + opacity: 0.4; +} +.icon-fingerprint-scanning-index .path14:before { + content: "\e96c"; + margin-left: -1em; + color: rgb(0, 0, 0); + opacity: 0.4; +} +.icon-fingerprint-scanning-index .path15:before { + content: "\e96d"; + margin-left: -1em; + color: rgb(0, 0, 0); +} +.icon-fingerprint-scanning-index .path16:before { + content: "\e96e"; + margin-left: -1em; + color: rgb(0, 0, 0); +} +.icon-fingerprint-scanning-index .path17:before { + content: "\e96f"; + margin-left: -1em; + color: rgb(0, 0, 0); +} +.icon-fingerprint-scanning-index .path18:before { + content: "\e970"; + margin-left: -1em; + color: rgb(0, 0, 0); +} +.icon-fingerprint-scanning-index .path19:before { + content: "\e971"; + margin-left: -1em; + color: rgb(0, 0, 0); +} +.icon-fingerprint-search:before { + content: "\e972"; +} +.icon-fingerprint-simple:before { + content: "\e973"; +} +.icon-calendar:before { + content: "\e901"; +} +.icon-clocktime:before { + content: "\e902"; +} +.icon-cube:before { + content: "\e903"; +} +.icon-cubelight:before { + content: "\e904"; +} +.icon-dashboard:before { + content: "\e905"; +} +.icon-history:before { + content: "\e906"; +} +.icon-usertime:before { + content: "\e954"; +} +.icon-replace:before { + content: "\e94c"; +} +.icon-week:before { + content: "\e94d"; +} +.icon-baggage:before { + content: "\e94e"; +} +.icon-trash:before { + content: "\e94f"; +} +.icon-erase:before { + content: "\e950"; +} +.icon-paste:before { + content: "\e94a"; +} +.icon-copy:before { + content: "\e94b"; +} +.icon-sendemail:before { + content: "\e946"; +} +.icon-exit:before { + content: "\e947"; +} +.icon-key:before { + content: "\e948"; +} +.icon-back:before { + content: "\e944"; +} +.icon-next:before { + content: "\e945"; +} +.icon-staff:before { + content: "\e943"; +} +.icon-shop:before { + content: "\e907"; +} +.icon-template:before { + content: "\e908"; +} +.icon-remove:before { + content: "\e909"; +} +.icon-access:before { + content: "\e90a"; +} +.icon-address:before { + content: "\e90b"; +} +.icon-apps:before { + content: "\e90c"; +} +.icon-archive:before { + content: "\e90d"; +} +.icon-calendar1:before { + content: "\e90e"; +} +.icon-code:before { + content: "\e90f"; +} +.icon-coin:before { + content: "\e910"; +} +.icon-company:before { + content: "\e911"; +} +.icon-cube1:before { + content: "\e912"; +} +.icon-cubelight1:before { + content: "\e913"; +} +.icon-dashboard1:before { + content: "\e914"; +} +.icon-datarefresh:before { + content: "\e915"; +} +.icon-documentsave:before { + content: "\e916"; +} +.icon-documents:before { + content: "\e917"; +} +.icon-download:before { + content: "\e918"; +} +.icon-duplicate1:before { + content: "\e919"; +} +.icon-edit:before { + content: "\e91a"; +} +.icon-excel:before { + content: "\e91b"; +} +.icon-expand:before { + content: "\e91c"; +} +.icon-file:before { + content: "\e91d"; +} +.icon-Floppy:before { + content: "\e91e"; +} +.icon-folder:before { + content: "\e91f"; +} +.icon-folder_add:before { + content: "\e920"; +} +.icon-folder_delete:before { + content: "\e921"; +} +.icon-folder_find:before { + content: "\e922"; +} +.icon-globe:before { + content: "\e923"; +} +.icon-group:before { + content: "\e924"; +} +.icon-home:before { + content: "\e925"; +} +.icon-inbox:before { + content: "\e926"; +} +.icon-library:before { + content: "\e927"; +} +.icon-license:before { + content: "\e928"; +} +.icon-list:before { + content: "\e929"; +} +.icon-log:before { + content: "\e92a"; +} +.icon-logout:before { + content: "\e92b"; +} +.icon-menu:before { + content: "\e92c"; +} +.icon-newspaper:before { + content: "\e92d"; +} +.icon-numberlist:before { + content: "\e92e"; +} +.icon-package:before { + content: "\e92f"; +} +.icon-pay:before { + content: "\e932"; +} +.icon-pdf:before { + content: "\e933"; +} +.icon-pdfexport:before { + content: "\e934"; +} +.icon-pictures:before { + content: "\e935"; +} +.icon-plus:before { + content: "\e936"; +} +.icon-poticon .path1:before { + content: "\e937"; + color: rgb(0, 50, 104); +} +.icon-poticon .path2:before { + content: "\e938"; + margin-left: -1em; + color: rgb(0, 50, 104); +} +.icon-poticon .path3:before { + content: "\e939"; + margin-left: -1em; + color: rgb(0, 50, 104); +} +.icon-poticon .path4:before { + content: "\e93a"; + margin-left: -1em; + color: rgb(0, 50, 104); +} +.icon-poticon .path5:before { + content: "\e93b"; + margin-left: -1em; + color: rgb(0, 50, 104); +} +.icon-poticon .path6:before { + content: "\e93c"; + margin-left: -1em; + color: rgb(255, 255, 255); +} +.icon-poticon .path7:before { + content: "\e93d"; + margin-left: -1em; + color: rgb(255, 255, 255); +} +.icon-poticon .path8:before { + content: "\e93e"; + margin-left: -1em; + color: rgb(255, 255, 255); +} +.icon-poticon .path9:before { + content: "\e93f"; + margin-left: -1em; + color: rgb(255, 255, 255); +} +.icon-poticon .path10:before { + content: "\e940"; + margin-left: -1em; + color: rgb(255, 255, 255); +} +.icon-poticon .path11:before { + content: "\e941"; + margin-left: -1em; + color: rgb(255, 255, 255); +} +.icon-poticon .path12:before { + content: "\e942"; + margin-left: -1em; + color: rgb(255, 255, 255); +} +.icon-poticon .path13:before { + content: "\e951"; + margin-left: -1em; + color: rgb(0, 91, 206); +} +.icon-poticon .path14:before { + content: "\e952"; + margin-left: -1em; + color: rgb(0, 50, 104); +} +.icon-projects:before { + content: "\e953"; +} +.icon-rename:before { + content: "\e95d"; +} +.icon-Save:before { + content: "\e975"; +} +.icon-squares:before { + content: "\e976"; +} +.icon-table:before { + content: "\e977"; +} +.icon-upload:before { + content: "\e978"; +} +.icon-user:before { + content: "\e979"; +} diff --git a/admin/css/icons.min.css b/admin/css/icons.min.css new file mode 100644 index 0000000..2a1ad1f --- /dev/null +++ b/admin/css/icons.min.css @@ -0,0 +1 @@ +@font-face{font-family:pot;src:url(fonts/pot.ttf?8s8vvb) format('truetype'),url(fonts/pot.woff?8s8vvb) format('woff'),url(fonts/pot.svg?8s8vvb#pot) format('svg');font-weight:400;font-style:normal;font-display:block}[class*=" icon-"],[class^=icon-]{font-family:pot!important;speak:never;font-style:normal;font-weight:400;font-variant:normal;text-transform:none;line-height:1;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.icon-category:before{content:"\e97d"}.icon-vacancydays:before{content:"\e97e"}.icon-sector:before{content:"\e97f"}.icon-lock:before{content:"\e97b"}.icon-unlock:before{content:"\e97c"}.icon-entry:before{content:"\e97a"}.icon-settings:before{content:"\e974"}.icon-dataset:before{content:"\e930"}.icon-check:before{content:"\e931"}.icon-pause:before{content:"\e900"}.icon-duplicate:before{content:"\e949"}.icon-finger1:before{content:"\e955"}.icon-finger2:before{content:"\e956"}.icon-finger3:before{content:"\e957"}.icon-finger4:before{content:"\e958"}.icon-finger5:before{content:"\e959"}.icon-fingerprint-check:before{content:"\e95a"}.icon-fingerprint-crosshair:before{content:"\e95b"}.icon-fingerprint-remove:before{content:"\e95c"}.icon-fingerprint-scanning:before{content:"\e95e"}.icon-fingerprint-scanning-index .path1:before{content:"\e95f";color:#000}.icon-fingerprint-scanning-index .path2:before{content:"\e960";margin-left:-1em;color:#000}.icon-fingerprint-scanning-index .path3:before{content:"\e961";margin-left:-1em;color:#000}.icon-fingerprint-scanning-index .path4:before{content:"\e962";margin-left:-1em;color:#000}.icon-fingerprint-scanning-index .path5:before{content:"\e963";margin-left:-1em;color:#000}.icon-fingerprint-scanning-index .path6:before{content:"\e964";margin-left:-1em;color:#000}.icon-fingerprint-scanning-index .path7:before{content:"\e965";margin-left:-1em;color:#000}.icon-fingerprint-scanning-index .path8:before{content:"\e966";margin-left:-1em;color:#000}.icon-fingerprint-scanning-index .path9:before{content:"\e967";margin-left:-1em;color:#000}.icon-fingerprint-scanning-index .path10:before{content:"\e968";margin-left:-1em;color:#000;opacity:.4}.icon-fingerprint-scanning-index .path11:before{content:"\e969";margin-left:-1em;color:#000;opacity:.4}.icon-fingerprint-scanning-index .path12:before{content:"\e96a";margin-left:-1em;color:#000;opacity:.4}.icon-fingerprint-scanning-index .path13:before{content:"\e96b";margin-left:-1em;color:#000;opacity:.4}.icon-fingerprint-scanning-index .path14:before{content:"\e96c";margin-left:-1em;color:#000;opacity:.4}.icon-fingerprint-scanning-index .path15:before{content:"\e96d";margin-left:-1em;color:#000}.icon-fingerprint-scanning-index .path16:before{content:"\e96e";margin-left:-1em;color:#000}.icon-fingerprint-scanning-index .path17:before{content:"\e96f";margin-left:-1em;color:#000}.icon-fingerprint-scanning-index .path18:before{content:"\e970";margin-left:-1em;color:#000}.icon-fingerprint-scanning-index .path19:before{content:"\e971";margin-left:-1em;color:#000}.icon-fingerprint-search:before{content:"\e972"}.icon-fingerprint-simple:before{content:"\e973"}.icon-calendar:before{content:"\e901"}.icon-clocktime:before{content:"\e902"}.icon-cube:before{content:"\e903"}.icon-cubelight:before{content:"\e904"}.icon-dashboard:before{content:"\e905"}.icon-history:before{content:"\e906"}.icon-usertime:before{content:"\e954"}.icon-replace:before{content:"\e94c"}.icon-week:before{content:"\e94d"}.icon-baggage:before{content:"\e94e"}.icon-trash:before{content:"\e94f"}.icon-erase:before{content:"\e950"}.icon-paste:before{content:"\e94a"}.icon-copy:before{content:"\e94b"}.icon-sendemail:before{content:"\e946"}.icon-exit:before{content:"\e947"}.icon-key:before{content:"\e948"}.icon-back:before{content:"\e944"}.icon-next:before{content:"\e945"}.icon-staff:before{content:"\e943"}.icon-shop:before{content:"\e907"}.icon-template:before{content:"\e908"}.icon-remove:before{content:"\e909"}.icon-access:before{content:"\e90a"}.icon-address:before{content:"\e90b"}.icon-apps:before{content:"\e90c"}.icon-archive:before{content:"\e90d"}.icon-calendar1:before{content:"\e90e"}.icon-code:before{content:"\e90f"}.icon-coin:before{content:"\e910"}.icon-company:before{content:"\e911"}.icon-cube1:before{content:"\e912"}.icon-cubelight1:before{content:"\e913"}.icon-dashboard1:before{content:"\e914"}.icon-datarefresh:before{content:"\e915"}.icon-documentsave:before{content:"\e916"}.icon-documents:before{content:"\e917"}.icon-download:before{content:"\e918"}.icon-duplicate1:before{content:"\e919"}.icon-edit:before{content:"\e91a"}.icon-excel:before{content:"\e91b"}.icon-expand:before{content:"\e91c"}.icon-file:before{content:"\e91d"}.icon-Floppy:before{content:"\e91e"}.icon-folder:before{content:"\e91f"}.icon-folder_add:before{content:"\e920"}.icon-folder_delete:before{content:"\e921"}.icon-folder_find:before{content:"\e922"}.icon-globe:before{content:"\e923"}.icon-group:before{content:"\e924"}.icon-home:before{content:"\e925"}.icon-inbox:before{content:"\e926"}.icon-library:before{content:"\e927"}.icon-license:before{content:"\e928"}.icon-list:before{content:"\e929"}.icon-log:before{content:"\e92a"}.icon-logout:before{content:"\e92b"}.icon-menu:before{content:"\e92c"}.icon-newspaper:before{content:"\e92d"}.icon-numberlist:before{content:"\e92e"}.icon-package:before{content:"\e92f"}.icon-pay:before{content:"\e932"}.icon-pdf:before{content:"\e933"}.icon-pdfexport:before{content:"\e934"}.icon-pictures:before{content:"\e935"}.icon-plus:before{content:"\e936"}.icon-poticon .path1:before{content:"\e937";color:#003268}.icon-poticon .path2:before{content:"\e938";margin-left:-1em;color:#003268}.icon-poticon .path3:before{content:"\e939";margin-left:-1em;color:#003268}.icon-poticon .path4:before{content:"\e93a";margin-left:-1em;color:#003268}.icon-poticon .path5:before{content:"\e93b";margin-left:-1em;color:#003268}.icon-poticon .path6:before{content:"\e93c";margin-left:-1em;color:#fff}.icon-poticon .path7:before{content:"\e93d";margin-left:-1em;color:#fff}.icon-poticon .path8:before{content:"\e93e";margin-left:-1em;color:#fff}.icon-poticon .path9:before{content:"\e93f";margin-left:-1em;color:#fff}.icon-poticon .path10:before{content:"\e940";margin-left:-1em;color:#fff}.icon-poticon .path11:before{content:"\e941";margin-left:-1em;color:#fff}.icon-poticon .path12:before{content:"\e942";margin-left:-1em;color:#fff}.icon-poticon .path13:before{content:"\e951";margin-left:-1em;color:#005bce}.icon-poticon .path14:before{content:"\e952";margin-left:-1em;color:#003268}.icon-projects:before{content:"\e953"}.icon-rename:before{content:"\e95d"}.icon-Save:before{content:"\e975"}.icon-squares:before{content:"\e976"}.icon-table:before{content:"\e977"}.icon-upload:before{content:"\e978"}.icon-user:before{content:"\e979"} \ No newline at end of file diff --git a/admin/css/theme.css b/admin/css/theme.css new file mode 100644 index 0000000..7d36c92 --- /dev/null +++ b/admin/css/theme.css @@ -0,0 +1,1054 @@ +/* W3PRO.CSS 4.13 June 2019 by Jan Egil and Borge Refsnes */ +html{box-sizing:border-box}*,*:before,*:after{box-sizing:inherit} +/* Extract from normalize.css by Nicolas Gallagher and Jonathan Neal git.io/normalize */ +html{-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%}body{margin:0} +html,body {-webkit-user-select: none;-ms-user-select: none;user-select: none;-moz-user-select:none;} +article,aside,details,figcaption,figure,footer,header,main,menu,nav,section{display:block}summary{display:list-item} +audio,canvas,progress,video{display:inline-block}progress{vertical-align:baseline} +audio:not([controls]){display:none;height:0}[hidden],template{display:none} +a{background-color:transparent}a:active,a:hover{outline-width:0} +abbr[title]{border-bottom:none;text-decoration:underline;text-decoration:underline dotted} +b,strong{font-weight:bolder}dfn{font-style:italic}mark{background:#ff0;color:#000} +small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline} +sub{bottom:-0.25em}sup{top:-0.5em}figure{margin:1em 40px}img{border-style:none} +code,kbd,pre,samp{font-family:monospace,monospace;font-size:1em}hr{box-sizing:content-box;height:0;overflow:visible} +button,input,select,textarea,optgroup{font:inherit;margin:0}optgroup{font-weight:bold} +button,input{overflow:visible}button,select{text-transform:none} +button,[type=button],[type=reset],[type=submit]{-webkit-appearance:button} +button::-moz-focus-inner,[type=button]::-moz-focus-inner,[type=reset]::-moz-focus-inner,[type=submit]::-moz-focus-inner{border-style:none;padding:0} +button:-moz-focusring,[type=button]:-moz-focusring,[type=reset]:-moz-focusring,[type=submit]:-moz-focusring{outline:1px dotted ButtonText} +fieldset{border:1px solid #c0c0c0;margin:0 2px;padding:.35em .625em .75em} +legend{color:inherit;display:table;max-width:100%;padding:0;white-space:normal}textarea{overflow:auto} +[type=checkbox],[type=radio]{padding:0} +[type=number]::-webkit-inner-spin-button,[type=number]::-webkit-outer-spin-button{height:auto} +[type=search]{-webkit-appearance:textfield;outline-offset:-2px} +[type=search]::-webkit-search-decoration{-webkit-appearance:none} +::-webkit-file-upload-button{-webkit-appearance:button;font:inherit} +/* End extract */ +/* html,body { + background-color: #52638e; +} */ +html,body{font-family:Verdana,sans-serif;font-size:10pt;line-height:1.5}html{overflow-x:hidden} +h1{font-size:36px}h2{font-size:30px}h3{font-size:24px}h4{font-size:20px}h5{font-size:18px}h6{font-size:16px}.serif{font-family:serif} +h1,h2,h3,h4,h5,h6{font-family:"Segoe UI",Arial,sans-serif;font-weight:400;margin: 0}.wide{letter-spacing:4px} +hr{border:0;border-top:1px solid #eee;margin:20px 0} +.img{max-width:100%;height:auto; vertical-align:middle}a{color:inherit} +.table,.table-all{border-collapse:collapse;border-spacing:0;width:100%;display:table}.table-all{border:1px solid #ccc} +.bordered tr,.table-all tr{border-bottom:1px solid #ddd}.striped tbody tr:nth-child(even){background-color:#f1f1f1} +.table-all tr:nth-child(odd){background-color:#fff}.table-all tr:nth-child(even){background-color:#f1f1f1} +.hoverable tbody tr:hover,.ul.hoverable li:hover{background-color:#ccc}.centered tr th,.centered tr td{text-align:center} +.table td,.table th,.table-all td,.table-all th{padding:8px 8px;display:table-cell;text-align:left;vertical-align:top} +.table th:first-child,.table td:first-child,.table-all th:first-child,.table-all td:first-child{padding-left:16px} +.btn,.button{border:none;display:inline-block;padding:8px 16px;vertical-align:middle;overflow:hidden;text-decoration:none;color:inherit;background-color:inherit;text-align:center;cursor:pointer;white-space:nowrap} +.btn:hover{box-shadow:0 8px 16px 0 rgba(0,0,0,0.2),0 6px 20px 0 rgba(0,0,0,0.19)} +.btn,.button{-webkit-touch-callout:none;-webkit-user-select:none;-khtml-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none} +.disabled,.btn:disabled,.button:disabled{cursor:not-allowed;background-color: #e6e6e6}.disabled *,:disabled *{pointer-events:none} +.btn.disabled:hover,.btn:disabled:hover{box-shadow:none} +.badge,.tag{background-color:#000;color:#fff;display:inline-block;padding-left:8px;padding-right:8px;text-align:center}.badge{border-radius:50%} +.ul{list-style-type:none;padding:0;margin:0}.ul li{padding:8px 16px;border-bottom:1px solid #ddd}.ul li:last-child{border-bottom:none} +.tooltip,.display-container{position:relative}.tooltip .text{display:none}.tooltip:hover .text{display:inline-block} +.ripple:active{opacity:0.5}.ripple{transition:opacity 0s} +.input{padding:6px;display:block;border: 1px solid #ccc;width:100%;background-color: #fff; }/*#e8f0fe*/ +.select{padding:2px 0; display:block;width:100%;border:1px solid #ccc;background-color: #fff;} +.dropdown-click,.dropdown-hover{position:relative;display:inline-block;cursor:pointer} +.dropdown-hover:hover .dropdown-content{display:block; } +.dropdown-hover:first-child,.dropdown-click:hover{background-color:#ccc;color:#000} +.dropdown-hover:hover > .button:first-child,.dropdown-click:hover > .button:first-child{background-color:#ccc;color:#000} +.dropdown-content{cursor:auto;color:#000;background-color:#fff;display:none;position:absolute;min-width:160px;margin:0;padding:0;z-index:1} +.check,.radio{width:24px;height:24px;position:relative;top:6px} +.sidebar{height:100%;width:160px;background-color:#fff;position:fixed!important;z-index:1;overflow:auto} +.bar-block .dropdown-hover,.bar-block .dropdown-click{width:100%} +.bar-block .dropdown-hover .dropdown-content,.bar-block .dropdown-click .dropdown-content{min-width:100%} +.bar-block .dropdown-hover .button,.bar-block .dropdown-click .button{width:100%;text-align:left;padding:8px 16px} +.main,#main{transition:margin-left .4s} +.modal{z-index:3;display:none;padding-top:100px;position:fixed;left:0;top:0;width:100%;height:100%;overflow:auto;background-color:rgb(0,0,0);background-color:rgba(0,0,0,0.4)} +.modal-content{margin:auto;background-color:#fff;position:relative;padding:0;outline:0;width:600px} +.bar{width:100%}.center .bar{display:inline-block;width:auto} +.bar .bar-item{padding:8px 16px;float:left;width:auto;border:none;display:block;outline:0} +.bar .dropdown-hover,.bar .dropdown-click{position:static;float:left} +.bar .button{white-space:normal} +.bar-block .bar-item{width:100%;display:block;padding:8px 16px;text-align:left;border:none;white-space:normal;float:none;outline:0} +.bar-block.center .bar-item{text-align:center}.block{display:block;width:100%} +.responsive{display:block;overflow-x:auto} +.container:after,.container:before,.datapanel:after,.datapanel:before,.row:after,.row:before,.row-padding:after,.row-padding:before, +.cell-row:before,.cell-row:after,.clear:after,.clear:before,.bar:before,.bar:after{content:"";display:table;clear:both} +.col,.half,.third,.twothird,.threequarter,.quarter,.fifth,.twofifth,.threefifth,.fourfifth{float:left;width:100%} +.col.s1{width:8.33333%}.col.s2{width:16.66666%}.col.s3{width:24.99999%}.col.s4{width:33.33333%} +.col.s5{width:41.66666%}.col.s6{width:49.99999%}.col.s7{width:58.33333%}.col.s8{width:66.66666%} +.col.s9{width:74.99999%}.col.s10{width:83.33333%}.col.s11{width:91.66666%}.col.s12{width:99.99999%} +@media (min-width:601px){.col.m1{width:8.33333%}.col.m2{width:16.66666%}.col.m3,.quarter{width:24.99999%}.col.m4,.third{width:33.33333%}.fifth{width:20%;min-width:100px} +.col.m5{width:41.66666%}.col.m6,.half{width:49.99999%}.col.m7{width:58.33333%}.col.m8,.twothird{width:66.66666%} +.col.m9,.threequarter{width:74.99999%}.col.m10{width:83.33333%}.col.m11{width:91.66666%}.col.m12{width:99.99999%}.twofifth{width:40%}.threefifth{width:60%}.fourfifth{width:80%}} +@media (min-width:993px){.col.l1{width:8.33333%}.col.l2{width:16.66666%}.col.l3{width:24.99999%}.col.l4{width:33.33333%} +.col.l5{width:41.66666%}.col.l6{width:49.99999%}.col.l7{width:58.33333%}.col.l8{width:66.66666%} +.col.l9{width:74.99999%}.col.l10{width:83.33333%}.col.l11{width:91.66666%}.col.l12{width:99.99999%}} +.rest{overflow:hidden}.stretch{margin-left:-16px;margin-right:-16px} +.content,.auto{margin-left:auto;margin-right:auto}.content{max-width:980px}.auto{max-width:1140px} +.cell-row{display:table;width:100%}.cell{display:table-cell;vertical-align: top;} +.cell-top{vertical-align:top}.cell-middle{vertical-align:middle}.cell-bottom{vertical-align:bottom} +.hide{display:none!important}.show-block,.show{display:block!important}.show-inline-block{display:inline-block!important} +@media (max-width:1205px){.auto{max-width:95%}} +@media (max-width:600px){.modal-content{margin:0 10px;width:auto!important}.modal{padding-top:30px} +.dropdown-hover.mobile .dropdown-content,.dropdown-click.mobile .dropdown-content{position:relative} +.hide-small{display:none!important}.mobile{display:block;width:100%!important}.bar-item.mobile,.dropdown-hover.mobile,.dropdown-click.mobile{text-align:center} +.dropdown-hover.mobile,.dropdown-hover.mobile .btn,.dropdown-hover.mobile .button,.dropdown-click.mobile,.dropdown-click.mobile .btn,.dropdown-click.mobile .button{width:100%}} +@media (max-width:768px){.modal-content{width:500px}.modal{padding-top:50px}} +@media (min-width:993px){.modal-content{width:900px}.hide-large{display:none!important}.sidebar.collapse{display:block!important}} +@media (max-width:992px) and (min-width:601px){.hide-medium{display:none!important}} +@media (max-width:992px){.sidebar.collapse{display:none}.main{margin-left:0!important;margin-right:0!important}.auto{max-width:100%}} +.top,.bottom{position:fixed;width:100%;z-index:1}.top{top:0}.bottom{bottom:0} +.overlay{position:fixed;display:none;width:100%;height:100%;top:0;left:0;right:0;bottom:0;background-color:rgba(0,0,0,0.5);z-index:2} +.display-topleft{position:absolute;left:0;top:0}.display-topright{position:absolute;right:0;top:0} +.display-bottomleft{position:absolute;left:0;bottom:0}.display-bottomright{position:absolute;right:0;bottom:0} +.display-middle{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);-ms-transform:translate(-50%,-50%)} +.display-left{position:absolute;top:50%;left:0%;transform:translate(0%,-50%);-ms-transform:translate(-0%,-50%)} +.display-right{position:absolute;top:50%;right:0%;transform:translate(0%,-50%);-ms-transform:translate(0%,-50%)} +.display-topmiddle{position:absolute;left:50%;top:0;transform:translate(-50%,0%);-ms-transform:translate(-50%,0%)} +.display-bottommiddle{position:absolute;left:50%;bottom:0;transform:translate(-50%,0%);-ms-transform:translate(-50%,0%)} +.display-container:hover .display-hover{display:block}.display-container:hover span.display-hover{display:inline-block}.display-hover{display:none} +.display-position{position:absolute} +.circle{border-radius:50%} +.round-small{border-radius:2px}.round,.round-medium{border-radius:4px}.round-large{border-radius:8px}.round-xlarge{border-radius:16px}.round-xxlarge{border-radius:32px} +.row-padding,.row-padding>.half,.row-padding>.third,.row-padding>.twothird,.row-padding>.threequarter,.row-padding>.quarter,.row-padding>.col{padding:0 8px} +.container,.datapanel{padding:0.01em 8px}.datapanel{margin-top:8px;margin-bottom:8px} +.code,.codespan{font-family:Consolas,"courier new";font-size:16px} +.code{width:auto;background-color:#fff;padding:8px 12px;border-left:4px solid #4CAF50;word-wrap:break-word} +.codespan{color:crimson;background-color:#f1f1f1;padding-left:4px;padding-right:4px;font-size:110%} +.card,.card-2{box-shadow:0 2px 5px 0 rgba(0,0,0,0.16)} +.card-4,.hover-shadow:hover{box-shadow:0 4px 10px 0 rgba(0,0,0,0.2),0 4px 20px 0 rgba(0,0,0,0.19)} +.spin{animation:spin 2s infinite linear}@keyframes spin{0%{transform:rotate(0deg)}100%{transform:rotate(359deg)}} +.animate-fading{animation:fading 2s infinite}@keyframes fading{0%{opacity:0}50%{opacity:1}100%{opacity:0}} +.animate-opacity{animation:opac 0.8s}@keyframes opac{from{opacity:0} to{opacity:1}} +.animate-top{position:relative;animation:animatetop 1s}@keyframes animatetop{from{top:-300px;opacity:0} to{top:0;opacity:1}} +.animate-left{position:relative;animation:animateleft 0.4s}@keyframes animateleft{from{left:-300px;opacity:0} to{left:0;opacity:1}} +.animate-right{position:relative;animation:animateright 0.4s}@keyframes animateright{from{right:-300px;opacity:0} to{right:0;opacity:1}} +.animate-bottom{position:relative;animation:animatebottom 1s}@keyframes animatebottom{from{bottom:-300px;opacity:0} to{bottom:0;opacity:1}} +.animate-zoom {animation:animatezoom 0.6s}@keyframes animatezoom{from{transform:scale(0)} to{transform:scale(1)}} +.animate-input{transition:width 0.4s ease-in-out}.animate-input:focus{width:100%!important} +.opacity,.hover-opacity:hover{opacity:0.60}.opacity-off,.hover-opacity-off:hover{opacity:1} +.opacity-max{opacity:0.25}.opacity-min{opacity:0.75} +.greyscale-max,.grayscale-max,.hover-greyscale:hover,.hover-grayscale:hover{filter:grayscale(100%)} +.greyscale,.grayscale{filter:grayscale(75%)}.greyscale-min,.grayscale-min{filter:grayscale(50%)} +.sepia{filter:sepia(75%)}.sepia-max,.hover-sepia:hover{filter:sepia(100%)}.sepia-min{filter:sepia(50%)} +.tiny{font-size:10px!important}.small{font-size:12px!important}.medium{font-size:15px!important}.large{font-size:18px!important} +.xlarge{font-size:24px!important}.xxlarge{font-size:36px!important}.xxxlarge{font-size:48px!important}.jumbo{font-size:64px!important} +.left-align{text-align:left!important}.right-align{text-align:right!important}.justify{text-align:justify!important}.center{text-align:center!important} +.border-0{border:0!important}.border{border:1px solid #ccc!important} +.border-top{border-top:1px solid #ccc!important}.border-bottom{border-bottom:1px solid #ccc!important} +.border-left{border-left:1px solid #ccc!important}.border-right{border-right:1px solid #ccc!important} +.topbar{border-top:6px solid #ccc!important}.bottombar{border-bottom:6px solid #ccc!important} +.leftbar{border-left:6px solid #ccc!important}.rightbar{border-right:6px solid #ccc!important} +.section,.code{margin-top:16px!important;margin-bottom:16px!important} +.margin{margin:16px!important}.margin-top{margin-top:16px!important}.margin-bottom{margin-bottom:16px!important} +.margin-left{margin-left:16px!important}.margin-right{margin-right:16px!important} +.padding-small{padding:4px 8px!important}.padding{padding:8px 16px!important}.padding-large{padding:12px 24px!important} +.padding-16{padding-top:16px!important;padding-bottom:16px!important}.padding-24{padding-top:24px!important;padding-bottom:24px!important} +.padding-32{padding-top:32px!important;padding-bottom:32px!important}.padding-48{padding-top:48px!important;padding-bottom:48px!important} +.padding-64{padding-top:64px!important;padding-bottom:64px!important} +.left{float:left!important}.right{float:right!important} +.button:hover{color:#fff!important;background-color:#343434!important} +.transparent,.hover-none:hover{background-color:transparent!important} +.hover-none:hover{box-shadow:none!important} +/* DEFAULT COLORS */ +.amber,.hover-amber:hover{color:#000!important;background-color:#ffc107!important} +.aqua,.hover-aqua:hover{color:#000!important;background-color:#00ffff!important} +.blue,.hover-blue:hover{color:#fff!important;background-color:#2196F3!important} +.light-blue,.hover-light-blue:hover{color:#000!important;background-color:#87CEEB!important} +.brown,.hover-brown:hover{color:#fff!important;background-color:#795548!important} +.cyan,.hover-cyan:hover{color:#000!important;background-color:#00bcd4!important} +.blue-grey,.hover-blue-grey:hover{color:#fff!important;background-color:#607d8b!important} +.green,.hover-green:hover{color:#fff!important;background-color:#4CAF50!important} +.light-green,.hover-light-green:hover{color:#000!important;background-color:#8bc34a!important} +.indigo,.hover-indigo:hover{color:#fff!important;background-color:#3f51b5!important} +.khaki,.hover-khaki:hover{color:#000!important;background-color:#f0e68c!important} +.lime,.hover-lime:hover{color:#000!important;background-color:#cddc39!important} +.orange,.hover-orange:hover{color:#000!important;background-color:#ff9800!important} +.deep-orange,.hover-deep-orange:hover{color:#fff!important;background-color:#ff5722!important} +.pink,.hover-pink:hover{color:#fff!important;background-color:#e91e63!important} +.purple,.hover-purple:hover{color:#fff!important;background-color:#9c27b0!important} +.deep-purple,.hover-deep-purple:hover{color:#fff!important;background-color:#673ab7!important} +.red,.hover-red:hover{color:#fff!important;background-color:#f44336!important} +.sand,.hover-sand:hover{color:#000!important;background-color:#fdf5e6!important} +.teal,.hover-teal:hover{color:#fff!important;background-color:#009688!important} +.yellow,.hover-yellow:hover{color:#000!important;background-color:#ffeb3b!important} +.white,.hover-white:hover{color:#000!important;background-color:#fff!important} +.black,.hover-black:hover{color:#fff!important;background-color:#000!important} +.grey,.hover-grey:hover{color:#000!important;background-color:#9e9e9e!important} +.light-grey,.hover-light-grey:hover{color:#000!important;background-color:#f1f1f1!important} +.dark-grey,.hover-dark-grey:hover{color:#fff!important;background-color:#616161!important} +.pale-red,.hover-pale-red:hover{color:#000!important;background-color:#ffe7e7!important}.pale-green,.hover-pale-green:hover{color:#000!important;background-color:#e7ffe7!important} +.pale-yellow,.hover-pale-yellow:hover{color:#000!important;background-color:#ffffd7!important}.pale-blue,.hover-pale-blue:hover{color:#000!important;background-color:#e7ffff!important} +.text-align-right { text-align: right;} +.text-amber,.hover-text-amber:hover{color:#ffc107!important} +.text-aqua,.hover-text-aqua:hover{color:#00ffff!important} +.text-blue,.hover-text-blue:hover{color:#2196F3!important} +.text-light-blue,.hover-text-light-blue:hover{color:#87CEEB!important} +.text-brown,.hover-text-brown:hover{color:#795548!important} +.text-cyan,.hover-text-cyan:hover{color:#00bcd4!important} +.text-blue-grey,.hover-text-blue-grey:hover{color:#607d8b!important} +.text-green,.hover-text-green:hover{color:#4CAF50!important} +.text-light-green,.hover-text-light-green:hover{color:#8bc34a!important} +.text-indigo,.hover-text-indigo:hover{color:#3f51b5!important} +.text-khaki,.hover-text-khaki:hover{color:#b4aa50!important} +.text-lime,.hover-text-lime:hover{color:#cddc39!important} +.text-orange,.hover-text-orange:hover{color:#ff9800!important} +.text-deep-orange,.hover-text-deep-orange:hover{color:#ff5722!important} +.text-pink,.hover-text-pink:hover{color:#e91e63!important} +.text-purple,.hover-text-purple:hover{color:#9c27b0!important} +.text-deep-purple,.hover-text-deep-purple:hover{color:#673ab7!important} +.text-red,.hover-text-red:hover{color:#f44336!important} +.text-sand,.hover-text-sand:hover{color:#fdf5e6!important} +.text-teal,.hover-text-teal:hover{color:#009688!important} +.text-yellow,.hover-text-yellow:hover{color:#d2be0e!important} +.text-white,.hover-text-white:hover{color:#fff!important} +.text-black,.hover-text-black:hover{color:#000!important} +.text-grey,.hover-text-grey:hover{color:#757575!important} +.text-light-grey,.hover-text-light-grey:hover{color:#f1f1f1!important} +.text-dark-grey,.hover-text-dark-grey:hover{color:#3a3a3a!important} +.border-amber,.hover-border-amber:hover{border-color:#ffc107!important} +.border-aqua,.hover-border-aqua:hover{border-color:#00ffff!important} +.border-blue,.hover-border-blue:hover{border-color:#2196F3!important} +.border-light-blue,.hover-border-light-blue:hover{border-color:#87CEEB!important} +.border-brown,.hover-border-brown:hover{border-color:#795548!important} +.border-cyan,.hover-border-cyan:hover{border-color:#00bcd4!important} +.border-blue-grey,.hover-blue-grey:hover{border-color:#607d8b!important} +.border-green,.hover-border-green:hover{border-color:#4CAF50!important} +.border-light-green,.hover-border-light-green:hover{border-color:#8bc34a!important} +.border-indigo,.hover-border-indigo:hover{border-color:#3f51b5!important} +.border-khaki,.hover-border-khaki:hover{border-color:#f0e68c!important} +.border-lime,.hover-border-lime:hover{border-color:#cddc39!important} +.border-orange,.hover-border-orange:hover{border-color:#ff9800!important} +.border-deep-orange,.hover-border-deep-orange:hover{border-color:#ff5722!important} +.border-pink,.hover-border-pink:hover{border-color:#e91e63!important} +.border-purple,.hover-border-purple:hover{border-color:#9c27b0!important} +.border-deep-purple,.hover-border-deep-purple:hover{border-color:#673ab7!important} +.border-red,.hover-border-red:hover{border-color:#f44336!important} +.border-sand,.hover-border-sand:hover{border-color:#fdf5e6!important} +.border-teal,.hover-border-teal:hover{border-color:#009688!important} +.border-yellow,.hover-border-yellow:hover{border-color:#ffeb3b!important} +.border-white,.hover-border-white:hover{border-color:#fff!important} +.border-black,.hover-border-black:hover{border-color:#000!important} +.border-grey,.hover-border-grey:hover{border-color:#9e9e9e!important} +.border-light-grey,.hover-border-light-grey:hover{border-color:#f1f1f1!important} +.border-dark-grey,.hover-border-dark-grey:hover{border-color:#616161!important} +.border-pale-red,.hover-border-pale-red:hover{border-color:#ffe7e7!important}.border-pale-green,.hover-border-pale-green:hover{border-color:#e7ffe7!important} +.border-pale-yellow,.hover-border-pale-yellow:hover{border-color:#ffffd7!important}.border-pale-blue,.hover-border-pale-blue:hover{border-color:#e7ffff!important} +/* DEFAULT THEME */ +.theme-l5 {color:#000 !important; background-color:#f6f8fc !important} +.theme-l4 {color:#000 !important; background-color:#e1e9f6 !important} +.theme-l3 {color:#000 !important; background-color:#c3d3ed !important} +.theme-l2 {color:#000 !important; background-color:#a5bee4 !important} +.theme-l1 {color:#fff !important; background-color:#88a8db !important} +.theme-d1 {color:#fff !important; background-color:#5180cb !important} +.theme-d2 {color:#fff !important; background-color:#3a6fc3 !important} +.theme-d3 {color:#fff !important; background-color:#3361aa !important} +.theme-d4 {color:#fff !important; background-color:#2c5392 !important} +.theme-d5 {color:#fff !important; background-color:#24457a !important} + +.theme-light {color:#000 !important; background-color:#f6f8fc !important} +.theme-dark {color:#fff !important; background-color:#24457a !important} +.theme-action {color:#fff !important; background-color:#24457a !important} + +.theme {color:#fff !important; background-color:#6a92d3 !important} +.text-theme {color:#6a92d3 !important} +.border-theme {border-color:#6a92d3 !important} + +.hover-theme:hover {color:#fff !important; background-color:#6a92d3 !important} +.hover-text-theme:hover {color:#6a92d3 !important} +.hover-border-theme:hover {border-color:#6a92d3 !important} + +/* .label { color: #000; font-size: 8pt;} */ +/* #main {margin-left: 210px;} */ +/* @media (max-width:768px){ + #sidebar { display: none;} + #main { margin-left: 0px;} +} */ + +.info-panel { + padding: 3px; + color: #ff4500; + border: 1px solid #ff4500; + background-color: #f89774; +} + +.error-panel { + padding: 3px; + color: #ff0000; + border: 1px solid #ff0000; + background-color: #fcb2b2; +} + +.table { + table-layout: fixed; +} + +.text-line-through { text-decoration: line-through; } + +#snackbar { + visibility: hidden; + min-width: 250px; + margin-left: -125px; + background-color: #333; + color: #fff; + text-align: center; + + padding: 16px; + position: fixed; + z-index: 1; + left: 50%; + bottom: 30px; + font-size: 17px; +} + +#snackbar.show { + visibility: visible; + -webkit-animation: fadein 0.5s, fadeout 0.5s 2.5s; + animation: fadein 0.5s, fadeout 0.5s 2.5s; +} + +@-webkit-keyframes fadein { + from {bottom: 0; opacity: 0;} + to {bottom: 30px; opacity: 1;} +} + +@keyframes fadein { + from {bottom: 0; opacity: 0;} + to {bottom: 30px; opacity: 1;} +} + +@-webkit-keyframes fadeout { + from {bottom: 30px; opacity: 1;} + to {bottom: 0; opacity: 0;} +} + +@keyframes fadeout { + from {bottom: 30px; opacity: 1;} + to {bottom: 0; opacity: 0;} +} + +.tabulator-header-filter > input { + background-color: #fff; + border: 1px solid #ccc; + font-weight: normal; +} + +.readonly { + pointer-events:none; + color: #000!important; + background-color: #d3d3d3!important; +} + + + +.right-side-bg { + background: url("../img/bg1.jpg"); + background-size: cover; + min-height: 100vh; +} + + + + +/* .mceContentBody { + background: #fff; + color:#000; +} */ + +/* .tabulator-row-even { + background-color: #757575; +} */ + + +button +{ + background-color: #f4f4f4; + border: 1pt solid #cccccc; + font-size: 10pt; + color: #000; + line-height: 1line; + text-align: center; +} +button:hover +{ + background-color: #343434; +} +button:pressed +{ + background-color: #343434; +} +button:focus +{ + background-color: #343434; +} + + + + +header +{ + background-color: #fff; + box-sizing: border-box; +} + + +.actionbtn { + background-color: #293146; + color: #fff; +} + +::-webkit-input-placeholder +{ + color: rgba(60.3922%,60.3922%,60.3922%,1); +} + + +textarea +{ + background-color: #fff; + border-top-color: rgba(80%,80%,80%,1); + border-right-color: rgba(80%,80%,80%,1); + border-bottom-color: rgba(80%,80%,80%,1); + border-left-color: rgba(80%,80%,80%,1); + border-top-style: solid; + border-right-style: solid; + border-bottom-style: solid; + border-left-style: solid; + border-top-width: 1pt; + border-right-width: 1pt; + border-bottom-width: 1pt; + border-left-width: 1pt; + font-size: 11pt; + color: #000; + line-height: 1line; + text-align: left; + /* margin-top: 0.88em; + margin-right: 0.75em; + margin-bottom: 0.63em; + margin-left: 0.75em; + top: 0pt; + right: 30pt; + bottom: 0pt; + left: 0pt; + position: absolute; + box-sizing: border-box; */ +} +textarea:focus +{ + border-top-color: rgba(0%,43.9216%,81.1765%,1); + border-right-color: rgba(0%,43.9216%,81.1765%,1); + border-bottom-color: rgba(0%,43.9216%,81.1765%,1); + border-left-color: rgba(0%,43.9216%,81.1765%,1); +} +textarea:placeholder +{ + color: rgba(80%,80%,80%,1); +} +/* textarea .text +{ + +} */ +textarea .scrollbar_track +{ + width: 30pt; + top: 0pt; + right: 0pt; + bottom: 0pt; + position: absolute; + box-sizing: border-box; +} + + +footer +{ + background-color: #fff; + box-sizing: border-box; +} + + +div.group_container +{ + background-color: #e3e3e3; + border-top-color: rgba(80%,80%,80%,1); + border-right-color: rgba(80%,80%,80%,1); + border-bottom-color: rgba(80%,80%,80%,1); + border-left-color: rgba(80%,80%,80%,1); + border-top-style: solid; + border-right-style: solid; + border-bottom-style: solid; + border-left-style: solid; + border-top-width: 1pt; + border-right-width: 1pt; + border-bottom-width: 1pt; + border-left-width: 1pt; + padding-top: 4px; + padding-bottom: 8px; +} + +/* Custom Styles */ +.ListView_Default +{ + + background-color: rgba(0%,0%,0%,0); + border-top-style: none; + border-right-style: none; + border-bottom-style: none; + border-left-style: none; + + color: #000; + text-align: left; + margin-top: 2pt; + margin-right: 2pt; + margin-bottom: 2pt; + margin-left: 2pt; +} + + +button.btnNavigation +{ + + background-color: rgba(0%,0%,0%,0); + + font-family: -fm-font-family(Arial,Arial-BoldMT); + font-weight: bold; + font-size: 10pt; + color: #fff; + padding-top: 0pt; + padding-right: 0pt; + padding-bottom: 0pt; + padding-left: 0pt; +} + +div.PageListHeader +{ + border-top-color: rgba(80%,80%,80%,1); + border-right-color: rgba(80%,80%,80%,1); + border-bottom-color: rgba(80%,80%,80%,1); + border-left-color: rgba(80%,80%,80%,1); + border-top-style: solid; + border-right-style: solid; + border-bottom-style: solid; + border-left-style: solid; + border-top-width: 1pt; + border-right-width: 1pt; + border-bottom-width: 1pt; + border-left-width: 1pt; + color: #fff; + -fm-text-vertical-align: center; +} +div.PageListHeader .inner_border +{ + padding-top: 5pt; + padding-right: 5pt; + padding-bottom: 5pt; + padding-left: 5pt; +} + +.moduletoolbar +{ + background-color: #293146; + color: #fff; +} + +div.BodySectionHeader +{ + font-family: -fm-font-family(Arial,Arial-BoldMT); + font-weight: bold; +} + + +div.PageHeadTitle +{ + font-size: 18pt; + color: #fff; +} + +div.SubHeadTitle +{ + font-size: 13pt; + color: #fff; +} + +div.SectionHeader +{ + + background-color: rgba(22.3529%,26.6667%,38.4314%,1); + +} + +button.toolbarbtn +{ + border: 0.5px solid #c6c6c6; + background-color: rgba(0%,0%,0%,0); + color: #fff; +} +button.toolbarbtn:hover +{ + + background-color: #343434; + color: #fff; +} +button.toolbarbtn:pressed +{ + + background-color: rgba(20.3922%,20.3922%,20.3922%,1); + color: #fff; +} +button.toolbarbtn:focus +{ + border-top-color: rgba(80%,80%,80%,1); + border-right-color: rgba(80%,80%,80%,1); + border-bottom-color: rgba(80%,80%,80%,1); + border-left-color: rgba(80%,80%,80%,1); +} + + +a.toolbarbtn +{ + border: 0.5px solid #c6c6c6; + background-color: rgba(0%,0%,0%,0); + color: #fff; + text-align: center; + text-decoration: unset; +} +a.toolbarbtn:hover +{ + + background-color: rgba(20.3922%,20.3922%,20.3922%,1); + color: #fff; +} +a.toolbarbtn:pressed +{ + background-color: rgba(20.3922%,20.3922%,20.3922%,1); + color: #fff; +} +a.toolbarbtn:focus +{ + border-top-color: rgba(80%,80%,80%,1); + border-right-color: rgba(80%,80%,80%,1); + border-bottom-color: rgba(80%,80%,80%,1); + border-left-color: rgba(80%,80%,80%,1); +} + +button.bodybtn +{ + border: 0.5px solid #c6c6c6; + + background-color: rgba(0%,0%,0%,0); + + color: #000; +} +button.bodybtn:hover +{ + + background-color: rgba(20.3922%,20.3922%,20.3922%,1); + color: #fff; +} +button.bodybtn:pressed +{ + + background-color: rgba(20.3922%,20.3922%,20.3922%,1); + color: #fff; +} +button.bodybtn:focus +{ + border-top-color: rgba(80%,80%,80%,1); + border-right-color: rgba(80%,80%,80%,1); + border-bottom-color: rgba(80%,80%,80%,1); + border-left-color: rgba(80%,80%,80%,1); +} + + +a.bodybtn +{ + border: 0.5px solid #c6c6c6; + + background-color: rgba(0%,0%,0%,0); + + color: #000; + text-align: center; + text-decoration: unset; +} +a.bodybtn:hover +{ + + background-color: rgba(20.3922%,20.3922%,20.3922%,1); + color: #fff; +} +a.bodybtn:pressed +{ + background-color: rgba(20.3922%,20.3922%,20.3922%,1); + color: #fff; +} +a.bodybtn:focus +{ + border-top-color: rgba(80%,80%,80%,1); + border-right-color: rgba(80%,80%,80%,1); + border-bottom-color: rgba(80%,80%,80%,1); + border-left-color: rgba(80%,80%,80%,1); +} + + +div.ListView_Header +{ + border-top-color: rgba(80%,80%,80%,1); + border-right-color: rgba(80%,80%,80%,1); + border-bottom-color: rgba(80%,80%,80%,1); + border-left-color: rgba(80%,80%,80%,1); + border-top-style: solid; + border-right-style: solid; + border-bottom-style: solid; + border-left-style: solid; + border-top-width: 1pt; + border-right-width: 1pt; + border-bottom-width: 1pt; + border-left-width: 1pt; + font-weight: normal; + color: #fff; + -fm-text-vertical-align: center; +} +div.ListView_Header .inner_border +{ + padding-top: 2pt; + padding-right: 2pt; + padding-bottom: 2pt; + padding-left: 2pt; +} + +div.toolbar +{ + + background-color: rgba(32.1569%,38.8235%,55.6863%,1); + +} + +div.sectiontoolbar +{ + margin-top: 8px; + margin-bottom: 8px; + background-color: rgb(97, 98, 100); + +} + +div.FooterLabel +{ + color: #fff; +} + +button.Buttom_BodyNav:hover +{ + + background-color: rgb(141, 141, 141); + + /* color: #fff; */ +} + + +::-webkit-scrollbar { +-webkit-appearance: none; +width: 10px; +} + +::-webkit-scrollbar-track { + background-color: rgba(80%, 80%, 80%, .5); +} + +::-webkit-scrollbar-thumb { +border-radius: 0px; +background-color: rgba(0, 0, 0, .5); +-webkit-box-shadow: 0 0 1px rgba(255, 255, 255, .5); +} + +div.portaltextheader { + padding: 2px; + border: 1px solid white; +} + + + + + +select { + /* -webkit-appearance: none; */ + display: block; + color: #000; + line-height: 1line; + text-align: left; + padding: 3.5px; + width: 100%; + max-width: 100%; + box-sizing: border-box; + margin: 0; + border: 1px solid #cccccc; + /* box-shadow: 0 1px 0 1px rgba(0,0,0,.04); */ + border-radius: 0px; + font-weight: normal; + font-size: 11pt; + background-color: #fff; + /* background-image: url('data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%23000%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.5-12.8z%22%2F%3E%3C%2Fsvg%3E'), + linear-gradient(to bottom, #fff 0%,#fff 100%); + background-repeat: no-repeat, repeat; + background-position: right .7em top 50%, 0 0; + background-size: .65em auto, 100%; */ +} + + +/* option { + appearance: none; + border: 1px solid 0070cf; + padding: 2px; +} */ +select:focus +{ + border: 1px solid #3a6fc3; + border-radius: unset; +} + + +::-webkit-select-placeholder +{ + color: #9a9a9a; +} + +div.DataFooter{ + background: #384462; +} +.input-sum{padding:2px;display:block;border: 1px solid #ccc;width:100%;background-color: #4D4D4D; } + + +.currency-sum {padding:2px;display:block;border: 1px solid #ccc;width:100%;background-color: #4D4D4D;} + +.currency-sum,.currency-sum:read-only { + display: block; + color: #fff; + padding: 2px; + padding-right: 12px; + width: 100%; + max-width: 100%; + box-sizing: border-box; + margin: 0; + border: 1px solid #ccc; + border-radius: unset; + -moz-appearance: none; + -webkit-appearance: none; + appearance: none; + background-color: #4D4D4D; + background-image: url('data:image/svg+xml,%3Csvg%20xmlns=%22http://www.w3.org/2000/svg%22%20width=%22225%22%20height=%22300%22%3E%3Cpath%20fill=%22white%22%20stroke=%22none%22%20d=%22m%20224.99996,16.22698%20-8.11342,36.41161%20q%20-24.14255,-19.78892%20-54.61741,-19.78892%20-41.3588,0%20-65.00658,23.74671%20-23.647774,23.7467%20-28.397115,53.23215%20l%20134.960355,0%20-5.14505,26.71508%20-132.981532,0%20-0.395848,7.71771%200.395848,18.20566%20127.242642,0%20-5.14505,26.71508%20-117.941954,0%20q%207.519719,40.17154%2032.552754,59.06997%2025.03303,18.89844%2056.49745,18.89844%2037.20302,0%2057.98149,-19.59107%20l%200,40.9631%20Q%20192.34828,300%20162.26913,300%2053.034301,300%2030.474864,189.18206%20l%20-30.474864,0%205.738751,-26.71508%2020.580475,0%20q%20-0.395708,-4.74934%20-0.395708,-17.80995%20l%200,-8.11342%20-25.923518,0%205.738751,-26.71508%2023.152999,0%20Q%2039.181988,55.21112%2076.583149,27.60556%20113.98417,0%20163.06069,0%20199.868,0%20224.99996,16.22698%20z%22%20/%3E%3C/svg%3E'); + background-repeat: no-repeat, repeat; + background-position: right 2px top 50%, 0 0; + background-size: 9px auto, 100%; +} + + + + +/* input[type=date]::-webkit-inner-spin-button, +input[type=date]::-webkit-outer-spin-button { + display: none; +} */ + +:focus { + outline: unset; +} + +input +{ + background-color: #ffffff; + border: 1px solid #cccccc; + font-weight: normal; + font-size: 11pt; + color: #000000; + line-height: 1line; + text-align: left; + width:100%; + padding:2px; + display:block; + border-radius: unset; +} +/* input:focus +{ + border: #0070cf; +} */ + +input:focus { + border: 1px solid #3a6fc3; + border-radius: unset; +} + +input[readonly=true]{ + color: #000!important; + background-color: #d3d3d3!important; +} + +input[type=number]::-webkit-inner-spin-button, +input[type=number]::-webkit-outer-spin-button { + -webkit-appearance: none; + margin: 0; +} +/* input[type=checkbox]{ + appearance: none; + display:inline-block; + font-size: 24px!important; + border: 1px solid green; +} */ + +input[class=currency] { + padding: 2px; + padding-right: 12px; + text-align: right; + background-image: url('data:image/svg+xml,%3Csvg%20xmlns=%22http://www.w3.org/2000/svg%22%20width=%22225%22%20height=%22300%22%3E%3Cpath%20stroke=%22none%22%20d=%22m%20224.99996,16.22698%20-8.11342,36.41161%20q%20-24.14255,-19.78892%20-54.61741,-19.78892%20-41.3588,0%20-65.00658,23.74671%20-23.647774,23.7467%20-28.397115,53.23215%20l%20134.960355,0%20-5.14505,26.71508%20-132.981532,0%20-0.395848,7.71771%200.395848,18.20566%20127.242642,0%20-5.14505,26.71508%20-117.941954,0%20q%207.519719,40.17154%2032.552754,59.06997%2025.03303,18.89844%2056.49745,18.89844%2037.20302,0%2057.98149,-19.59107%20l%200,40.9631%20Q%20192.34828,300%20162.26913,300%2053.034301,300%2030.474864,189.18206%20l%20-30.474864,0%205.738751,-26.71508%2020.580475,0%20q%20-0.395708,-4.74934%20-0.395708,-17.80995%20l%200,-8.11342%20-25.923518,0%205.738751,-26.71508%2023.152999,0%20Q%2039.181988,55.21112%2076.583149,27.60556%20113.98417,0%20163.06069,0%20199.868,0%20224.99996,16.22698%20z%22%20/%3E%0A%3C/svg%3E'), + linear-gradient(to bottom, #fff 0%,#fff 100%); + background-repeat: no-repeat, repeat; + background-position: right 2px top 50%, 0 0; + background-size: 9px auto, 100%; +} + +input[class=currency]:read-only { + background-image: url('data:image/svg+xml,%3Csvg%20xmlns=%22http://www.w3.org/2000/svg%22%20width=%22225%22%20height=%22300%22%3E%3Cpath%20stroke=%22none%22%20d=%22m%20224.99996,16.22698%20-8.11342,36.41161%20q%20-24.14255,-19.78892%20-54.61741,-19.78892%20-41.3588,0%20-65.00658,23.74671%20-23.647774,23.7467%20-28.397115,53.23215%20l%20134.960355,0%20-5.14505,26.71508%20-132.981532,0%20-0.395848,7.71771%200.395848,18.20566%20127.242642,0%20-5.14505,26.71508%20-117.941954,0%20q%207.519719,40.17154%2032.552754,59.06997%2025.03303,18.89844%2056.49745,18.89844%2037.20302,0%2057.98149,-19.59107%20l%200,40.9631%20Q%20192.34828,300%20162.26913,300%2053.034301,300%2030.474864,189.18206%20l%20-30.474864,0%205.738751,-26.71508%2020.580475,0%20q%20-0.395708,-4.74934%20-0.395708,-17.80995%20l%200,-8.11342%20-25.923518,0%205.738751,-26.71508%2023.152999,0%20Q%2039.181988,55.21112%2076.583149,27.60556%20113.98417,0%20163.06069,0%20199.868,0%20224.99996,16.22698%20z%22%20/%3E%0A%3C/svg%3E'), + linear-gradient(to bottom, #d3d3d3 0%,#d3d3d3 100%); +} + +input[class=percent] { + padding: 2px; + padding-right: 12px; + text-align: right; + background-image: url('data:image/svg+xml,%3Csvg%20xmlns=%22http://www.w3.org/2000/svg%22%20width=%22256%22%20height=%22232%22%20version=%221.0%22%3E%3Cg%20transform=%22translate(-112.3674,-128.3649)%22%3E%3Cpath%20style=%22fill:black;fill-opacity:1;stroke:none%22%20d=%22M%20317.1674,257.53698%20C%20308.53463,257.53708%20301.73774,261.20839%20296.77671,268.55094%20C%20291.91449,275.89365%20289.48349,286.1138%20289.48368,299.2114%20C%20289.48349,312.11067%20291.91449,322.2812%20296.77671,329.72303%20C%20301.73774,337.06568%20308.53463,340.737%20317.1674,340.73698%20C%20325.60128,340.737%20332.24934,337.06568%20337.11159,329.72303%20C%20342.07258,322.2812%20344.5532,312.11067%20344.55345,299.2114%20C%20344.5532,286.21302%20342.07258,276.04249%20337.11159,268.69977%20C%20332.24934,261.25801%20325.60128,257.53708%20317.1674,257.53698%20M%20317.1674,238.63466%20C%20332.84469,238.63477%20345.29739,244.09213%20354.52554,255.00675%20C%20363.75318,265.92157%20368.36713,280.65644%20368.3674,299.2114%20C%20368.36713,317.76648%20363.70357,332.50135%20354.37671,343.41605%20C%20345.14855,354.23156%20332.74546,359.6393%20317.1674,359.63931%20C%20301.29123,359.6393%20288.7393,354.23156%20279.51159,343.41605%20C%20270.28351,332.50135%20265.66956,317.76648%20265.66973,299.2114%20C%20265.66956,280.55721%20270.28351,265.82234%20279.51159,255.00675%20C%20288.83853,244.09213%20301.39045,238.63477%20317.1674,238.63466%20M%20163.5674,147.9928%20C%20155.03401,147.993%20148.28673,151.71393%20143.32554,159.15559%20C%20138.46349,166.49841%20136.03248,176.61933%20136.03252,189.51838%20C%20136.03248,202.61621%20138.46349,212.83635%20143.32554,220.17884%20C%20148.18751,227.52161%20154.93479,231.19292%20163.5674,231.1928%20C%20172.19989,231.19292%20178.94717,227.52161%20183.80926,220.17884%20C%20188.77041,212.83635%20191.25103,202.61621%20191.25113,189.51838%20C%20191.25103,176.71856%20188.77041,166.59764%20183.80926,159.15559%20C%20178.84794,151.71393%20172.10066,147.993%20163.5674,147.9928%20M%20297.9674,129.09047%20L%20321.78136,129.09047%20L%20182.7674,359.63931%20L%20158.95345,359.63931%20L%20297.9674,129.09047%20M%20163.5674,129.09047%20C%20179.24484,129.0907%20191.74715,134.54806%20201.07438,145.46256%20C%20210.4014,156.27827%20215.06496,170.96352%20215.06508,189.51838%20C%20215.06496,208.27201%20210.4014,223.05649%20201.07438,233.87187%20C%20191.84638,244.68748%20179.34406,250.09523%20163.5674,250.09512%20C%20147.79061,250.09523%20135.28829,244.68748%20126.06043,233.87187%20C%20116.93172,222.95727%20112.36739,208.17279%20112.3674,189.51838%20C%20112.36739,171.06275%20116.98134,156.37749%20126.20926,145.46256%20C%20135.43713,134.54806%20147.88983,129.0907%20163.5674,129.09047%22%20/%3E%3C/g%3E%3C/svg%3E'), + linear-gradient(to bottom, #fff 0%,#fff 100%); + background-repeat: no-repeat, repeat; + background-position: right 2px top 50%, 0 0; + background-size: 9px auto, 100%; +} + + +label { + height: 12.8px!important; + color: #000; + font-size: 8pt; +} + + + +input[type="checkbox"] { + display: block; + -webkit-appearance:none;/* Hides the default checkbox style */ + height:29.66px; + width:29.66px; + cursor:pointer; + position:relative; + -webkit-transition: .15s; + border-radius: unset; + border: 1px solid #cccccc; + background-color:#fff; + } + + input[type="checkbox"]:checked { + background-color:#9ABCEA; + } + + input[type="checkbox"]:before, input[type="checkbox"]:checked:before { + position:absolute; + top:0; + left:0; + width:100%; + height:100%; + line-height:2em; + text-align:center; + color:#000; + content: ''; + } + + input[type="checkbox"]:checked:before { + font-size: 11pt; + content: '✔'; + } + + input[type="checkbox"]:hover:before { + background:rgba(255,255,255,0.3); + } + + + body.mceContentBody { + background:#e8f0fe; + color:#000; +} + +/* .mceContentBody { + background: #e8f0fe; + color:#000; +} */ + +/* .tabulator-row-even { + background-color: #757575; +} */ + +:focus { + outline: 1px solid #607d8b; +} + +.modal-content > header { + background-color: #293146; + color: #fff; + padding:8px!important; + margin-bottom: 10px; +} + +.modal-content > header > h2 { + font-size: 13pt; +} + +.modal-content > footer { + + /* padding:0.01em 8px; */ + text-align:right!important; + color:#000!important; + background-color:#c6c6c6!important; + margin-top: 6px; + padding-top:8px!important; + padding-bottom:8px!important; +} + +.modal-content > header:after,.modal-content > header:before,.modal-content > footer:after,.modal-content > footer:before { + content:"";display:table;clear:both +} + +span[class^="icon"]::after { + content: "\A"; + white-space: pre; +} + +.inlinebtn { + position: relative; + height: 28px; + margin-top: -28px; + margin-left: -20px; + padding: 4px 8px; + border: 0!important; + float: right; +} + +#loader { + position: absolute; + left: 50%; + top: 50%; + z-index: 1; + width: 150px; + height: 150px; + margin: -75px 0 0 -75px; + border: 16px solid #f3f3f3; + border-radius: 50%; + border-top: 16px solid #3498db; + width: 120px; + height: 120px; + -webkit-animation: spin 2s linear infinite; + animation: spin 2s linear infinite; +} + +@-webkit-keyframes spin { + 0% { -webkit-transform: rotate(0deg); } + 100% { -webkit-transform: rotate(360deg); } +} + +@keyframes spin { + 0% { transform: rotate(0deg); } + 100% { transform: rotate(360deg); } +} + diff --git a/admin/css/theme.min.css b/admin/css/theme.min.css new file mode 100644 index 0000000..f954084 --- /dev/null +++ b/admin/css/theme.min.css @@ -0,0 +1 @@ +html{box-sizing:border-box}*,:after,:before{box-sizing:inherit}html{-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%}body{margin:0}body,html{-webkit-user-select:none;-ms-user-select:none;user-select:none;-moz-user-select:none}article,aside,details,figcaption,figure,footer,header,main,menu,nav,section{display:block}summary{display:list-item}audio,canvas,progress,video{display:inline-block}progress{vertical-align:baseline}audio:not([controls]){display:none;height:0}[hidden],template{display:none}a{background-color:transparent}a:active,a:hover{outline-width:0}abbr[title]{border-bottom:none;text-decoration:underline;text-decoration:underline dotted}b,strong{font-weight:bolder}dfn{font-style:italic}mark{background:#ff0;color:#000}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}figure{margin:1em 40px}img{border-style:none}code,kbd,pre,samp{font-family:monospace,monospace;font-size:1em}hr{box-sizing:content-box;height:0;overflow:visible}button,input,optgroup,select,textarea{font:inherit;margin:0}optgroup{font-weight:700}button,input{overflow:visible}button,select{text-transform:none}[type=button],[type=reset],[type=submit],button{-webkit-appearance:button}[type=button]::-moz-focus-inner,[type=reset]::-moz-focus-inner,[type=submit]::-moz-focus-inner,button::-moz-focus-inner{border-style:none;padding:0}[type=button]:-moz-focusring,[type=reset]:-moz-focusring,[type=submit]:-moz-focusring,button:-moz-focusring{outline:1px dotted ButtonText}fieldset{border:1px solid silver;margin:0 2px;padding:.35em .625em .75em}legend{color:inherit;display:table;max-width:100%;padding:0;white-space:normal}textarea{overflow:auto}[type=checkbox],[type=radio]{padding:0}[type=number]::-webkit-inner-spin-button,[type=number]::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}[type=search]::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}body,html{font-family:Verdana,sans-serif;font-size:10pt;line-height:1.5}html{overflow-x:hidden}h1{font-size:36px}h2{font-size:30px}h3{font-size:24px}h4{font-size:20px}h5{font-size:18px}h6{font-size:16px}.serif{font-family:serif}h1,h2,h3,h4,h5,h6{font-family:"Segoe UI",Arial,sans-serif;font-weight:400;margin:0}.wide{letter-spacing:4px}hr{border:0;border-top:1px solid #eee;margin:20px 0}.img{max-width:100%;height:auto;vertical-align:middle}a{color:inherit}.table,.table-all{border-collapse:collapse;border-spacing:0;width:100%;display:table}.table-all{border:1px solid #ccc}.bordered tr,.table-all tr{border-bottom:1px solid #ddd}.striped tbody tr:nth-child(even){background-color:#f1f1f1}.table-all tr:nth-child(odd){background-color:#fff}.table-all tr:nth-child(even){background-color:#f1f1f1}.hoverable tbody tr:hover,.ul.hoverable li:hover{background-color:#ccc}.centered tr td,.centered tr th{text-align:center}.table td,.table th,.table-all td,.table-all th{padding:8px 8px;display:table-cell;text-align:left;vertical-align:top}.table td:first-child,.table th:first-child,.table-all td:first-child,.table-all th:first-child{padding-left:16px}.btn,.button{border:none;display:inline-block;padding:8px 16px;vertical-align:middle;overflow:hidden;text-decoration:none;color:inherit;background-color:inherit;text-align:center;cursor:pointer;white-space:nowrap}.btn:hover{box-shadow:0 8px 16px 0 rgba(0,0,0,.2),0 6px 20px 0 rgba(0,0,0,.19)}.btn,.button{-webkit-touch-callout:none;-webkit-user-select:none;-khtml-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.btn:disabled,.button:disabled,.disabled{cursor:not-allowed;background-color:#e6e6e6}.disabled *,:disabled *{pointer-events:none}.btn.disabled:hover,.btn:disabled:hover{box-shadow:none}.badge,.tag{background-color:#000;color:#fff;display:inline-block;padding-left:8px;padding-right:8px;text-align:center}.badge{border-radius:50%}.ul{list-style-type:none;padding:0;margin:0}.ul li{padding:8px 16px;border-bottom:1px solid #ddd}.ul li:last-child{border-bottom:none}.display-container,.tooltip{position:relative}.tooltip .text{display:none}.tooltip:hover .text{display:inline-block}.ripple:active{opacity:.5}.ripple{transition:opacity 0s}.input{padding:6px;display:block;border:1px solid #ccc;width:100%;background-color:#fff}.select{padding:2px 0;display:block;width:100%;border:1px solid #ccc;background-color:#fff}.dropdown-click,.dropdown-hover{position:relative;display:inline-block;cursor:pointer}.dropdown-hover:hover .dropdown-content{display:block}.dropdown-click:hover,.dropdown-hover:first-child{background-color:#ccc;color:#000}.dropdown-click:hover>.button:first-child,.dropdown-hover:hover>.button:first-child{background-color:#ccc;color:#000}.dropdown-content{cursor:auto;color:#000;background-color:#fff;display:none;position:absolute;min-width:160px;margin:0;padding:0;z-index:1}.check,.radio{width:24px;height:24px;position:relative;top:6px}.sidebar{height:100%;width:160px;background-color:#fff;position:fixed!important;z-index:1;overflow:auto}.bar-block .dropdown-click,.bar-block .dropdown-hover{width:100%}.bar-block .dropdown-click .dropdown-content,.bar-block .dropdown-hover .dropdown-content{min-width:100%}.bar-block .dropdown-click .button,.bar-block .dropdown-hover .button{width:100%;text-align:left;padding:8px 16px}#main,.main{transition:margin-left .4s}.modal{z-index:3;display:none;padding-top:100px;position:fixed;left:0;top:0;width:100%;height:100%;overflow:auto;background-color:#000;background-color:rgba(0,0,0,.4)}.modal-content{margin:auto;background-color:#fff;position:relative;padding:0;outline:0;width:600px}.bar{width:100%}.center .bar{display:inline-block;width:auto}.bar .bar-item{padding:8px 16px;float:left;width:auto;border:none;display:block;outline:0}.bar .dropdown-click,.bar .dropdown-hover{position:static;float:left}.bar .button{white-space:normal}.bar-block .bar-item{width:100%;display:block;padding:8px 16px;text-align:left;border:none;white-space:normal;float:none;outline:0}.bar-block.center .bar-item{text-align:center}.block{display:block;width:100%}.responsive{display:block;overflow-x:auto}.bar:after,.bar:before,.cell-row:after,.cell-row:before,.clear:after,.clear:before,.container:after,.container:before,.datapanel:after,.datapanel:before,.row-padding:after,.row-padding:before,.row:after,.row:before{content:"";display:table;clear:both}.col,.fifth,.fourfifth,.half,.quarter,.third,.threefifth,.threequarter,.twofifth,.twothird{float:left;width:100%}.col.s1{width:8.33333%}.col.s2{width:16.66666%}.col.s3{width:24.99999%}.col.s4{width:33.33333%}.col.s5{width:41.66666%}.col.s6{width:49.99999%}.col.s7{width:58.33333%}.col.s8{width:66.66666%}.col.s9{width:74.99999%}.col.s10{width:83.33333%}.col.s11{width:91.66666%}.col.s12{width:99.99999%}@media (min-width:601px){.col.m1{width:8.33333%}.col.m2{width:16.66666%}.col.m3,.quarter{width:24.99999%}.col.m4,.third{width:33.33333%}.fifth{width:20%;min-width:100px}.col.m5{width:41.66666%}.col.m6,.half{width:49.99999%}.col.m7{width:58.33333%}.col.m8,.twothird{width:66.66666%}.col.m9,.threequarter{width:74.99999%}.col.m10{width:83.33333%}.col.m11{width:91.66666%}.col.m12{width:99.99999%}.twofifth{width:40%}.threefifth{width:60%}.fourfifth{width:80%}}@media (min-width:993px){.col.l1{width:8.33333%}.col.l2{width:16.66666%}.col.l3{width:24.99999%}.col.l4{width:33.33333%}.col.l5{width:41.66666%}.col.l6{width:49.99999%}.col.l7{width:58.33333%}.col.l8{width:66.66666%}.col.l9{width:74.99999%}.col.l10{width:83.33333%}.col.l11{width:91.66666%}.col.l12{width:99.99999%}}.rest{overflow:hidden}.stretch{margin-left:-16px;margin-right:-16px}.auto,.content{margin-left:auto;margin-right:auto}.content{max-width:980px}.auto{max-width:1140px}.cell-row{display:table;width:100%}.cell{display:table-cell;vertical-align:top}.cell-top{vertical-align:top}.cell-middle{vertical-align:middle}.cell-bottom{vertical-align:bottom}.hide{display:none!important}.show,.show-block{display:block!important}.show-inline-block{display:inline-block!important}@media (max-width:1205px){.auto{max-width:95%}}@media (max-width:600px){.modal-content{margin:0 10px;width:auto!important}.modal{padding-top:30px}.dropdown-click.mobile .dropdown-content,.dropdown-hover.mobile .dropdown-content{position:relative}.hide-small{display:none!important}.mobile{display:block;width:100%!important}.bar-item.mobile,.dropdown-click.mobile,.dropdown-hover.mobile{text-align:center}.dropdown-click.mobile,.dropdown-click.mobile .btn,.dropdown-click.mobile .button,.dropdown-hover.mobile,.dropdown-hover.mobile .btn,.dropdown-hover.mobile .button{width:100%}}@media (max-width:768px){.modal-content{width:500px}.modal{padding-top:50px}}@media (min-width:993px){.modal-content{width:900px}.hide-large{display:none!important}.sidebar.collapse{display:block!important}}@media (max-width:992px) and (min-width:601px){.hide-medium{display:none!important}}@media (max-width:992px){.sidebar.collapse{display:none}.main{margin-left:0!important;margin-right:0!important}.auto{max-width:100%}}.bottom,.top{position:fixed;width:100%;z-index:1}.top{top:0}.bottom{bottom:0}.overlay{position:fixed;display:none;width:100%;height:100%;top:0;left:0;right:0;bottom:0;background-color:rgba(0,0,0,.5);z-index:2}.display-topleft{position:absolute;left:0;top:0}.display-topright{position:absolute;right:0;top:0}.display-bottomleft{position:absolute;left:0;bottom:0}.display-bottomright{position:absolute;right:0;bottom:0}.display-middle{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);-ms-transform:translate(-50%,-50%)}.display-left{position:absolute;top:50%;left:0;transform:translate(0,-50%);-ms-transform:translate(0,-50%)}.display-right{position:absolute;top:50%;right:0;transform:translate(0,-50%);-ms-transform:translate(0,-50%)}.display-topmiddle{position:absolute;left:50%;top:0;transform:translate(-50%,0);-ms-transform:translate(-50%,0)}.display-bottommiddle{position:absolute;left:50%;bottom:0;transform:translate(-50%,0);-ms-transform:translate(-50%,0)}.display-container:hover .display-hover{display:block}.display-container:hover span.display-hover{display:inline-block}.display-hover{display:none}.display-position{position:absolute}.circle{border-radius:50%}.round-small{border-radius:2px}.round,.round-medium{border-radius:4px}.round-large{border-radius:8px}.round-xlarge{border-radius:16px}.round-xxlarge{border-radius:32px}.row-padding,.row-padding>.col,.row-padding>.half,.row-padding>.quarter,.row-padding>.third,.row-padding>.threequarter,.row-padding>.twothird{padding:0 8px}.container,.datapanel{padding:.01em 8px}.datapanel{margin-top:8px;margin-bottom:8px}.code,.codespan{font-family:Consolas,"courier new";font-size:16px}.code{width:auto;background-color:#fff;padding:8px 12px;border-left:4px solid #4caf50;word-wrap:break-word}.codespan{color:#dc143c;background-color:#f1f1f1;padding-left:4px;padding-right:4px;font-size:110%}.card,.card-2{box-shadow:0 2px 5px 0 rgba(0,0,0,.16)}.card-4,.hover-shadow:hover{box-shadow:0 4px 10px 0 rgba(0,0,0,.2),0 4px 20px 0 rgba(0,0,0,.19)}.spin{animation:spin 2s infinite linear}@keyframes spin{0%{transform:rotate(0)}100%{transform:rotate(359deg)}}.animate-fading{animation:fading 2s infinite}@keyframes fading{0%{opacity:0}50%{opacity:1}100%{opacity:0}}.animate-opacity{animation:opac .8s}@keyframes opac{from{opacity:0}to{opacity:1}}.animate-top{position:relative;animation:animatetop 1s}@keyframes animatetop{from{top:-300px;opacity:0}to{top:0;opacity:1}}.animate-left{position:relative;animation:animateleft .4s}@keyframes animateleft{from{left:-300px;opacity:0}to{left:0;opacity:1}}.animate-right{position:relative;animation:animateright .4s}@keyframes animateright{from{right:-300px;opacity:0}to{right:0;opacity:1}}.animate-bottom{position:relative;animation:animatebottom 1s}@keyframes animatebottom{from{bottom:-300px;opacity:0}to{bottom:0;opacity:1}}.animate-zoom{animation:animatezoom .6s}@keyframes animatezoom{from{transform:scale(0)}to{transform:scale(1)}}.animate-input{transition:width .4s ease-in-out}.animate-input:focus{width:100%!important}.hover-opacity:hover,.opacity{opacity:.6}.hover-opacity-off:hover,.opacity-off{opacity:1}.opacity-max{opacity:.25}.opacity-min{opacity:.75}.grayscale-max,.greyscale-max,.hover-grayscale:hover,.hover-greyscale:hover{filter:grayscale(100%)}.grayscale,.greyscale{filter:grayscale(75%)}.grayscale-min,.greyscale-min{filter:grayscale(50%)}.sepia{filter:sepia(75%)}.hover-sepia:hover,.sepia-max{filter:sepia(100%)}.sepia-min{filter:sepia(50%)}.tiny{font-size:10px!important}.small{font-size:12px!important}.medium{font-size:15px!important}.large{font-size:18px!important}.xlarge{font-size:24px!important}.xxlarge{font-size:36px!important}.xxxlarge{font-size:48px!important}.jumbo{font-size:64px!important}.left-align{text-align:left!important}.right-align{text-align:right!important}.justify{text-align:justify!important}.center{text-align:center!important}.border-0{border:0!important}.border{border:1px solid #ccc!important}.border-top{border-top:1px solid #ccc!important}.border-bottom{border-bottom:1px solid #ccc!important}.border-left{border-left:1px solid #ccc!important}.border-right{border-right:1px solid #ccc!important}.topbar{border-top:6px solid #ccc!important}.bottombar{border-bottom:6px solid #ccc!important}.leftbar{border-left:6px solid #ccc!important}.rightbar{border-right:6px solid #ccc!important}.code,.section{margin-top:16px!important;margin-bottom:16px!important}.margin{margin:16px!important}.margin-top{margin-top:16px!important}.margin-bottom{margin-bottom:16px!important}.margin-left{margin-left:16px!important}.margin-right{margin-right:16px!important}.padding-small{padding:4px 8px!important}.padding{padding:8px 16px!important}.padding-large{padding:12px 24px!important}.padding-16{padding-top:16px!important;padding-bottom:16px!important}.padding-24{padding-top:24px!important;padding-bottom:24px!important}.padding-32{padding-top:32px!important;padding-bottom:32px!important}.padding-48{padding-top:48px!important;padding-bottom:48px!important}.padding-64{padding-top:64px!important;padding-bottom:64px!important}.left{float:left!important}.right{float:right!important}.button:hover{color:#fff!important;background-color:#343434!important}.hover-none:hover,.transparent{background-color:transparent!important}.hover-none:hover{box-shadow:none!important}.amber,.hover-amber:hover{color:#000!important;background-color:#ffc107!important}.aqua,.hover-aqua:hover{color:#000!important;background-color:#0ff!important}.blue,.hover-blue:hover{color:#fff!important;background-color:#2196f3!important}.hover-light-blue:hover,.light-blue{color:#000!important;background-color:#87ceeb!important}.brown,.hover-brown:hover{color:#fff!important;background-color:#795548!important}.cyan,.hover-cyan:hover{color:#000!important;background-color:#00bcd4!important}.blue-grey,.hover-blue-grey:hover{color:#fff!important;background-color:#607d8b!important}.green,.hover-green:hover{color:#fff!important;background-color:#4caf50!important}.hover-light-green:hover,.light-green{color:#000!important;background-color:#8bc34a!important}.hover-indigo:hover,.indigo{color:#fff!important;background-color:#3f51b5!important}.hover-khaki:hover,.khaki{color:#000!important;background-color:khaki!important}.hover-lime:hover,.lime{color:#000!important;background-color:#cddc39!important}.hover-orange:hover,.orange{color:#000!important;background-color:#ff9800!important}.deep-orange,.hover-deep-orange:hover{color:#fff!important;background-color:#ff5722!important}.hover-pink:hover,.pink{color:#fff!important;background-color:#e91e63!important}.hover-purple:hover,.purple{color:#fff!important;background-color:#9c27b0!important}.deep-purple,.hover-deep-purple:hover{color:#fff!important;background-color:#673ab7!important}.hover-red:hover,.red{color:#fff!important;background-color:#f44336!important}.hover-sand:hover,.sand{color:#000!important;background-color:#fdf5e6!important}.hover-teal:hover,.teal{color:#fff!important;background-color:#009688!important}.hover-yellow:hover,.yellow{color:#000!important;background-color:#ffeb3b!important}.hover-white:hover,.white{color:#000!important;background-color:#fff!important}.black,.hover-black:hover{color:#fff!important;background-color:#000!important}.grey,.hover-grey:hover{color:#000!important;background-color:#9e9e9e!important}.hover-light-grey:hover,.light-grey{color:#000!important;background-color:#f1f1f1!important}.dark-grey,.hover-dark-grey:hover{color:#fff!important;background-color:#616161!important}.hover-pale-red:hover,.pale-red{color:#000!important;background-color:#ffe7e7!important}.hover-pale-green:hover,.pale-green{color:#000!important;background-color:#e7ffe7!important}.hover-pale-yellow:hover,.pale-yellow{color:#000!important;background-color:#ffffd7!important}.hover-pale-blue:hover,.pale-blue{color:#000!important;background-color:#e7ffff!important}.text-align-right{text-align:right}.hover-text-amber:hover,.text-amber{color:#ffc107!important}.hover-text-aqua:hover,.text-aqua{color:#0ff!important}.hover-text-blue:hover,.text-blue{color:#2196f3!important}.hover-text-light-blue:hover,.text-light-blue{color:#87ceeb!important}.hover-text-brown:hover,.text-brown{color:#795548!important}.hover-text-cyan:hover,.text-cyan{color:#00bcd4!important}.hover-text-blue-grey:hover,.text-blue-grey{color:#607d8b!important}.hover-text-green:hover,.text-green{color:#4caf50!important}.hover-text-light-green:hover,.text-light-green{color:#8bc34a!important}.hover-text-indigo:hover,.text-indigo{color:#3f51b5!important}.hover-text-khaki:hover,.text-khaki{color:#b4aa50!important}.hover-text-lime:hover,.text-lime{color:#cddc39!important}.hover-text-orange:hover,.text-orange{color:#ff9800!important}.hover-text-deep-orange:hover,.text-deep-orange{color:#ff5722!important}.hover-text-pink:hover,.text-pink{color:#e91e63!important}.hover-text-purple:hover,.text-purple{color:#9c27b0!important}.hover-text-deep-purple:hover,.text-deep-purple{color:#673ab7!important}.hover-text-red:hover,.text-red{color:#f44336!important}.hover-text-sand:hover,.text-sand{color:#fdf5e6!important}.hover-text-teal:hover,.text-teal{color:#009688!important}.hover-text-yellow:hover,.text-yellow{color:#d2be0e!important}.hover-text-white:hover,.text-white{color:#fff!important}.hover-text-black:hover,.text-black{color:#000!important}.hover-text-grey:hover,.text-grey{color:#757575!important}.hover-text-light-grey:hover,.text-light-grey{color:#f1f1f1!important}.hover-text-dark-grey:hover,.text-dark-grey{color:#3a3a3a!important}.border-amber,.hover-border-amber:hover{border-color:#ffc107!important}.border-aqua,.hover-border-aqua:hover{border-color:#0ff!important}.border-blue,.hover-border-blue:hover{border-color:#2196f3!important}.border-light-blue,.hover-border-light-blue:hover{border-color:#87ceeb!important}.border-brown,.hover-border-brown:hover{border-color:#795548!important}.border-cyan,.hover-border-cyan:hover{border-color:#00bcd4!important}.border-blue-grey,.hover-blue-grey:hover{border-color:#607d8b!important}.border-green,.hover-border-green:hover{border-color:#4caf50!important}.border-light-green,.hover-border-light-green:hover{border-color:#8bc34a!important}.border-indigo,.hover-border-indigo:hover{border-color:#3f51b5!important}.border-khaki,.hover-border-khaki:hover{border-color:khaki!important}.border-lime,.hover-border-lime:hover{border-color:#cddc39!important}.border-orange,.hover-border-orange:hover{border-color:#ff9800!important}.border-deep-orange,.hover-border-deep-orange:hover{border-color:#ff5722!important}.border-pink,.hover-border-pink:hover{border-color:#e91e63!important}.border-purple,.hover-border-purple:hover{border-color:#9c27b0!important}.border-deep-purple,.hover-border-deep-purple:hover{border-color:#673ab7!important}.border-red,.hover-border-red:hover{border-color:#f44336!important}.border-sand,.hover-border-sand:hover{border-color:#fdf5e6!important}.border-teal,.hover-border-teal:hover{border-color:#009688!important}.border-yellow,.hover-border-yellow:hover{border-color:#ffeb3b!important}.border-white,.hover-border-white:hover{border-color:#fff!important}.border-black,.hover-border-black:hover{border-color:#000!important}.border-grey,.hover-border-grey:hover{border-color:#9e9e9e!important}.border-light-grey,.hover-border-light-grey:hover{border-color:#f1f1f1!important}.border-dark-grey,.hover-border-dark-grey:hover{border-color:#616161!important}.border-pale-red,.hover-border-pale-red:hover{border-color:#ffe7e7!important}.border-pale-green,.hover-border-pale-green:hover{border-color:#e7ffe7!important}.border-pale-yellow,.hover-border-pale-yellow:hover{border-color:#ffffd7!important}.border-pale-blue,.hover-border-pale-blue:hover{border-color:#e7ffff!important}.theme-l5{color:#000!important;background-color:#f6f8fc!important}.theme-l4{color:#000!important;background-color:#e1e9f6!important}.theme-l3{color:#000!important;background-color:#c3d3ed!important}.theme-l2{color:#000!important;background-color:#a5bee4!important}.theme-l1{color:#fff!important;background-color:#88a8db!important}.theme-d1{color:#fff!important;background-color:#5180cb!important}.theme-d2{color:#fff!important;background-color:#3a6fc3!important}.theme-d3{color:#fff!important;background-color:#3361aa!important}.theme-d4{color:#fff!important;background-color:#2c5392!important}.theme-d5{color:#fff!important;background-color:#24457a!important}.theme-light{color:#000!important;background-color:#f6f8fc!important}.theme-dark{color:#fff!important;background-color:#24457a!important}.theme-action{color:#fff!important;background-color:#24457a!important}.theme{color:#fff!important;background-color:#6a92d3!important}.text-theme{color:#6a92d3!important}.border-theme{border-color:#6a92d3!important}.hover-theme:hover{color:#fff!important;background-color:#6a92d3!important}.hover-text-theme:hover{color:#6a92d3!important}.hover-border-theme:hover{border-color:#6a92d3!important}.info-panel{padding:3px;color:#ff4500;border:1px solid #ff4500;background-color:#f89774}.error-panel{padding:3px;color:red;border:1px solid red;background-color:#fcb2b2}.table{table-layout:fixed}.text-line-through{text-decoration:line-through}#snackbar{visibility:hidden;min-width:250px;margin-left:-125px;background-color:#333;color:#fff;text-align:center;padding:16px;position:fixed;z-index:1;left:50%;bottom:30px;font-size:17px}#snackbar.show{visibility:visible;-webkit-animation:fadein .5s,fadeout .5s 2.5s;animation:fadein .5s,fadeout .5s 2.5s}@-webkit-keyframes fadein{from{bottom:0;opacity:0}to{bottom:30px;opacity:1}}@keyframes fadein{from{bottom:0;opacity:0}to{bottom:30px;opacity:1}}@-webkit-keyframes fadeout{from{bottom:30px;opacity:1}to{bottom:0;opacity:0}}@keyframes fadeout{from{bottom:30px;opacity:1}to{bottom:0;opacity:0}}.tabulator-header-filter>input{background-color:#fff;border:1px solid #ccc;font-weight:400}.readonly{pointer-events:none;color:#000!important;background-color:#d3d3d3!important}.right-side-bg{background:url(../img/bg1.jpg);background-size:cover;min-height:100vh}button{background-color:#f4f4f4;border:1pt solid #ccc;font-size:10pt;color:#000;line-height:1line;text-align:center}button:hover{background-color:#343434}button:pressed{background-color:#343434}button:focus{background-color:#343434}header{background-color:#fff;box-sizing:border-box}.actionbtn{background-color:#293146;color:#fff}::-webkit-input-placeholder{color:rgba(60.3922%,60.3922%,60.3922%,1)}textarea{background-color:#fff;border-top-color:rgba(80%,80%,80%,1);border-right-color:rgba(80%,80%,80%,1);border-bottom-color:rgba(80%,80%,80%,1);border-left-color:rgba(80%,80%,80%,1);border-top-style:solid;border-right-style:solid;border-bottom-style:solid;border-left-style:solid;border-top-width:1pt;border-right-width:1pt;border-bottom-width:1pt;border-left-width:1pt;font-size:11pt;color:#000;line-height:1line;text-align:left}textarea:focus{border-top-color:rgba(0%,43.9216%,81.1765%,1);border-right-color:rgba(0%,43.9216%,81.1765%,1);border-bottom-color:rgba(0%,43.9216%,81.1765%,1);border-left-color:rgba(0%,43.9216%,81.1765%,1)}textarea:placeholder{color:rgba(80%,80%,80%,1)}textarea .scrollbar_track{width:30pt;top:0;right:0;bottom:0;position:absolute;box-sizing:border-box}footer{background-color:#fff;box-sizing:border-box}div.group_container{background-color:#e3e3e3;border-top-color:rgba(80%,80%,80%,1);border-right-color:rgba(80%,80%,80%,1);border-bottom-color:rgba(80%,80%,80%,1);border-left-color:rgba(80%,80%,80%,1);border-top-style:solid;border-right-style:solid;border-bottom-style:solid;border-left-style:solid;border-top-width:1pt;border-right-width:1pt;border-bottom-width:1pt;border-left-width:1pt;padding-top:4px;padding-bottom:8px}.ListView_Default{background-color:rgba(0%,0%,0%,0);border-top-style:none;border-right-style:none;border-bottom-style:none;border-left-style:none;color:#000;text-align:left;margin-top:2pt;margin-right:2pt;margin-bottom:2pt;margin-left:2pt}button.btnNavigation{background-color:rgba(0%,0%,0%,0);font-family:-fm-font-family(Arial,Arial-BoldMT);font-weight:700;font-size:10pt;color:#fff;padding-top:0;padding-right:0;padding-bottom:0;padding-left:0}div.PageListHeader{border-top-color:rgba(80%,80%,80%,1);border-right-color:rgba(80%,80%,80%,1);border-bottom-color:rgba(80%,80%,80%,1);border-left-color:rgba(80%,80%,80%,1);border-top-style:solid;border-right-style:solid;border-bottom-style:solid;border-left-style:solid;border-top-width:1pt;border-right-width:1pt;border-bottom-width:1pt;border-left-width:1pt;color:#fff;-fm-text-vertical-align:center}div.PageListHeader .inner_border{padding-top:5pt;padding-right:5pt;padding-bottom:5pt;padding-left:5pt}.moduletoolbar{background-color:#293146;color:#fff}div.BodySectionHeader{font-family:-fm-font-family(Arial,Arial-BoldMT);font-weight:700}div.PageHeadTitle{font-size:18pt;color:#fff}div.SubHeadTitle{font-size:13pt;color:#fff}div.SectionHeader{background-color:rgba(22.3529%,26.6667%,38.4314%,1)}button.toolbarbtn{border:.5px solid #c6c6c6;background-color:rgba(0%,0%,0%,0);color:#fff}button.toolbarbtn:hover{background-color:#343434;color:#fff}button.toolbarbtn:pressed{background-color:rgba(20.3922%,20.3922%,20.3922%,1);color:#fff}button.toolbarbtn:focus{border-top-color:rgba(80%,80%,80%,1);border-right-color:rgba(80%,80%,80%,1);border-bottom-color:rgba(80%,80%,80%,1);border-left-color:rgba(80%,80%,80%,1)}a.toolbarbtn{border:.5px solid #c6c6c6;background-color:rgba(0%,0%,0%,0);color:#fff;text-align:center;text-decoration:unset}a.toolbarbtn:hover{background-color:rgba(20.3922%,20.3922%,20.3922%,1);color:#fff}a.toolbarbtn:pressed{background-color:rgba(20.3922%,20.3922%,20.3922%,1);color:#fff}a.toolbarbtn:focus{border-top-color:rgba(80%,80%,80%,1);border-right-color:rgba(80%,80%,80%,1);border-bottom-color:rgba(80%,80%,80%,1);border-left-color:rgba(80%,80%,80%,1)}button.bodybtn{border:.5px solid #c6c6c6;background-color:rgba(0%,0%,0%,0);color:#000}button.bodybtn:hover{background-color:rgba(20.3922%,20.3922%,20.3922%,1);color:#fff}button.bodybtn:pressed{background-color:rgba(20.3922%,20.3922%,20.3922%,1);color:#fff}button.bodybtn:focus{border-top-color:rgba(80%,80%,80%,1);border-right-color:rgba(80%,80%,80%,1);border-bottom-color:rgba(80%,80%,80%,1);border-left-color:rgba(80%,80%,80%,1)}a.bodybtn{border:.5px solid #c6c6c6;background-color:rgba(0%,0%,0%,0);color:#000;text-align:center;text-decoration:unset}a.bodybtn:hover{background-color:rgba(20.3922%,20.3922%,20.3922%,1);color:#fff}a.bodybtn:pressed{background-color:rgba(20.3922%,20.3922%,20.3922%,1);color:#fff}a.bodybtn:focus{border-top-color:rgba(80%,80%,80%,1);border-right-color:rgba(80%,80%,80%,1);border-bottom-color:rgba(80%,80%,80%,1);border-left-color:rgba(80%,80%,80%,1)}div.ListView_Header{border-top-color:rgba(80%,80%,80%,1);border-right-color:rgba(80%,80%,80%,1);border-bottom-color:rgba(80%,80%,80%,1);border-left-color:rgba(80%,80%,80%,1);border-top-style:solid;border-right-style:solid;border-bottom-style:solid;border-left-style:solid;border-top-width:1pt;border-right-width:1pt;border-bottom-width:1pt;border-left-width:1pt;font-weight:400;color:#fff;-fm-text-vertical-align:center}div.ListView_Header .inner_border{padding-top:2pt;padding-right:2pt;padding-bottom:2pt;padding-left:2pt}div.toolbar{background-color:rgba(32.1569%,38.8235%,55.6863%,1)}div.sectiontoolbar{margin-top:8px;margin-bottom:8px;background-color:#616264}div.FooterLabel{color:#fff}button.Buttom_BodyNav:hover{background-color:#8d8d8d}::-webkit-scrollbar{-webkit-appearance:none;width:10px}::-webkit-scrollbar-track{background-color:rgba(80%,80%,80%,.5)}::-webkit-scrollbar-thumb{border-radius:0;background-color:rgba(0,0,0,.5);-webkit-box-shadow:0 0 1px rgba(255,255,255,.5)}div.portaltextheader{padding:2px;border:1px solid #fff}select{display:block;color:#000;line-height:1line;text-align:left;padding:3.5px;width:100%;max-width:100%;box-sizing:border-box;margin:0;border:1px solid #ccc;border-radius:0;font-weight:400;font-size:11pt;background-color:#fff}select:focus{border:1px solid #3a6fc3;border-radius:unset}::-webkit-select-placeholder{color:#9a9a9a}div.DataFooter{background:#384462}.input-sum{padding:2px;display:block;border:1px solid #ccc;width:100%;background-color:#4d4d4d}.currency-sum{padding:2px;display:block;border:1px solid #ccc;width:100%;background-color:#4d4d4d}.currency-sum,.currency-sum:read-only{display:block;color:#fff;padding:2px;padding-right:12px;width:100%;max-width:100%;box-sizing:border-box;margin:0;border:1px solid #ccc;border-radius:unset;-moz-appearance:none;-webkit-appearance:none;appearance:none;background-color:#4d4d4d;background-image:url(data:image/svg+xml,%3Csvg%20xmlns=%22http://www.w3.org/2000/svg%22%20width=%22225%22%20height=%22300%22%3E%3Cpath%20fill=%22white%22%20stroke=%22none%22%20d=%22m%20224.99996,16.22698%20-8.11342,36.41161%20q%20-24.14255,-19.78892%20-54.61741,-19.78892%20-41.3588,0%20-65.00658,23.74671%20-23.647774,23.7467%20-28.397115,53.23215%20l%20134.960355,0%20-5.14505,26.71508%20-132.981532,0%20-0.395848,7.71771%200.395848,18.20566%20127.242642,0%20-5.14505,26.71508%20-117.941954,0%20q%207.519719,40.17154%2032.552754,59.06997%2025.03303,18.89844%2056.49745,18.89844%2037.20302,0%2057.98149,-19.59107%20l%200,40.9631%20Q%20192.34828,300%20162.26913,300%2053.034301,300%2030.474864,189.18206%20l%20-30.474864,0%205.738751,-26.71508%2020.580475,0%20q%20-0.395708,-4.74934%20-0.395708,-17.80995%20l%200,-8.11342%20-25.923518,0%205.738751,-26.71508%2023.152999,0%20Q%2039.181988,55.21112%2076.583149,27.60556%20113.98417,0%20163.06069,0%20199.868,0%20224.99996,16.22698%20z%22%20/%3E%3C/svg%3E);background-repeat:no-repeat,repeat;background-position:right 2px top 50%,0 0;background-size:9px auto,100%}:focus{outline:unset}input{background-color:#fff;border:1px solid #ccc;font-weight:400;font-size:11pt;color:#000;line-height:1line;text-align:left;width:100%;padding:2px;display:block;border-radius:unset}input:focus{border:1px solid #3a6fc3;border-radius:unset}input[readonly=true]{color:#000!important;background-color:#d3d3d3!important}input[type=number]::-webkit-inner-spin-button,input[type=number]::-webkit-outer-spin-button{-webkit-appearance:none;margin:0}input[class=currency]{padding:2px;padding-right:12px;text-align:right;background-image:url(data:image/svg+xml,%3Csvg%20xmlns=%22http://www.w3.org/2000/svg%22%20width=%22225%22%20height=%22300%22%3E%3Cpath%20stroke=%22none%22%20d=%22m%20224.99996,16.22698%20-8.11342,36.41161%20q%20-24.14255,-19.78892%20-54.61741,-19.78892%20-41.3588,0%20-65.00658,23.74671%20-23.647774,23.7467%20-28.397115,53.23215%20l%20134.960355,0%20-5.14505,26.71508%20-132.981532,0%20-0.395848,7.71771%200.395848,18.20566%20127.242642,0%20-5.14505,26.71508%20-117.941954,0%20q%207.519719,40.17154%2032.552754,59.06997%2025.03303,18.89844%2056.49745,18.89844%2037.20302,0%2057.98149,-19.59107%20l%200,40.9631%20Q%20192.34828,300%20162.26913,300%2053.034301,300%2030.474864,189.18206%20l%20-30.474864,0%205.738751,-26.71508%2020.580475,0%20q%20-0.395708,-4.74934%20-0.395708,-17.80995%20l%200,-8.11342%20-25.923518,0%205.738751,-26.71508%2023.152999,0%20Q%2039.181988,55.21112%2076.583149,27.60556%20113.98417,0%20163.06069,0%20199.868,0%20224.99996,16.22698%20z%22%20/%3E%0A%3C/svg%3E),linear-gradient(to bottom,#fff 0,#fff 100%);background-repeat:no-repeat,repeat;background-position:right 2px top 50%,0 0;background-size:9px auto,100%}input[class=currency]:read-only{background-image:url(data:image/svg+xml,%3Csvg%20xmlns=%22http://www.w3.org/2000/svg%22%20width=%22225%22%20height=%22300%22%3E%3Cpath%20stroke=%22none%22%20d=%22m%20224.99996,16.22698%20-8.11342,36.41161%20q%20-24.14255,-19.78892%20-54.61741,-19.78892%20-41.3588,0%20-65.00658,23.74671%20-23.647774,23.7467%20-28.397115,53.23215%20l%20134.960355,0%20-5.14505,26.71508%20-132.981532,0%20-0.395848,7.71771%200.395848,18.20566%20127.242642,0%20-5.14505,26.71508%20-117.941954,0%20q%207.519719,40.17154%2032.552754,59.06997%2025.03303,18.89844%2056.49745,18.89844%2037.20302,0%2057.98149,-19.59107%20l%200,40.9631%20Q%20192.34828,300%20162.26913,300%2053.034301,300%2030.474864,189.18206%20l%20-30.474864,0%205.738751,-26.71508%2020.580475,0%20q%20-0.395708,-4.74934%20-0.395708,-17.80995%20l%200,-8.11342%20-25.923518,0%205.738751,-26.71508%2023.152999,0%20Q%2039.181988,55.21112%2076.583149,27.60556%20113.98417,0%20163.06069,0%20199.868,0%20224.99996,16.22698%20z%22%20/%3E%0A%3C/svg%3E),linear-gradient(to bottom,#d3d3d3 0,#d3d3d3 100%)}input[class=percent]{padding:2px;padding-right:12px;text-align:right;background-image:url('data:image/svg+xml,%3Csvg%20xmlns=%22http://www.w3.org/2000/svg%22%20width=%22256%22%20height=%22232%22%20version=%221.0%22%3E%3Cg%20transform=%22translate(-112.3674,-128.3649)%22%3E%3Cpath%20style=%22fill:black;fill-opacity:1;stroke:none%22%20d=%22M%20317.1674,257.53698%20C%20308.53463,257.53708%20301.73774,261.20839%20296.77671,268.55094%20C%20291.91449,275.89365%20289.48349,286.1138%20289.48368,299.2114%20C%20289.48349,312.11067%20291.91449,322.2812%20296.77671,329.72303%20C%20301.73774,337.06568%20308.53463,340.737%20317.1674,340.73698%20C%20325.60128,340.737%20332.24934,337.06568%20337.11159,329.72303%20C%20342.07258,322.2812%20344.5532,312.11067%20344.55345,299.2114%20C%20344.5532,286.21302%20342.07258,276.04249%20337.11159,268.69977%20C%20332.24934,261.25801%20325.60128,257.53708%20317.1674,257.53698%20M%20317.1674,238.63466%20C%20332.84469,238.63477%20345.29739,244.09213%20354.52554,255.00675%20C%20363.75318,265.92157%20368.36713,280.65644%20368.3674,299.2114%20C%20368.36713,317.76648%20363.70357,332.50135%20354.37671,343.41605%20C%20345.14855,354.23156%20332.74546,359.6393%20317.1674,359.63931%20C%20301.29123,359.6393%20288.7393,354.23156%20279.51159,343.41605%20C%20270.28351,332.50135%20265.66956,317.76648%20265.66973,299.2114%20C%20265.66956,280.55721%20270.28351,265.82234%20279.51159,255.00675%20C%20288.83853,244.09213%20301.39045,238.63477%20317.1674,238.63466%20M%20163.5674,147.9928%20C%20155.03401,147.993%20148.28673,151.71393%20143.32554,159.15559%20C%20138.46349,166.49841%20136.03248,176.61933%20136.03252,189.51838%20C%20136.03248,202.61621%20138.46349,212.83635%20143.32554,220.17884%20C%20148.18751,227.52161%20154.93479,231.19292%20163.5674,231.1928%20C%20172.19989,231.19292%20178.94717,227.52161%20183.80926,220.17884%20C%20188.77041,212.83635%20191.25103,202.61621%20191.25113,189.51838%20C%20191.25103,176.71856%20188.77041,166.59764%20183.80926,159.15559%20C%20178.84794,151.71393%20172.10066,147.993%20163.5674,147.9928%20M%20297.9674,129.09047%20L%20321.78136,129.09047%20L%20182.7674,359.63931%20L%20158.95345,359.63931%20L%20297.9674,129.09047%20M%20163.5674,129.09047%20C%20179.24484,129.0907%20191.74715,134.54806%20201.07438,145.46256%20C%20210.4014,156.27827%20215.06496,170.96352%20215.06508,189.51838%20C%20215.06496,208.27201%20210.4014,223.05649%20201.07438,233.87187%20C%20191.84638,244.68748%20179.34406,250.09523%20163.5674,250.09512%20C%20147.79061,250.09523%20135.28829,244.68748%20126.06043,233.87187%20C%20116.93172,222.95727%20112.36739,208.17279%20112.3674,189.51838%20C%20112.36739,171.06275%20116.98134,156.37749%20126.20926,145.46256%20C%20135.43713,134.54806%20147.88983,129.0907%20163.5674,129.09047%22%20/%3E%3C/g%3E%3C/svg%3E'),linear-gradient(to bottom,#fff 0,#fff 100%);background-repeat:no-repeat,repeat;background-position:right 2px top 50%,0 0;background-size:9px auto,100%}label{height:12.8px!important;color:#000;font-size:8pt}input[type=checkbox]{display:block;-webkit-appearance:none;height:29.66px;width:29.66px;cursor:pointer;position:relative;-webkit-transition:.15s;border-radius:unset;border:1px solid #ccc;background-color:#fff}input[type=checkbox]:checked{background-color:#9abcea}input[type=checkbox]:before,input[type=checkbox]:checked:before{position:absolute;top:0;left:0;width:100%;height:100%;line-height:2em;text-align:center;color:#000;content:''}input[type=checkbox]:checked:before{font-size:11pt;content:'✔'}input[type=checkbox]:hover:before{background:rgba(255,255,255,.3)}body.mceContentBody{background:#e8f0fe;color:#000}:focus{outline:1px solid #607d8b}.modal-content>header{background-color:#293146;color:#fff;padding:8px!important;margin-bottom:10px}.modal-content>header>h2{font-size:13pt}.modal-content>footer{text-align:right!important;color:#000!important;background-color:#c6c6c6!important;margin-top:6px;padding-top:8px!important;padding-bottom:8px!important}.modal-content>footer:after,.modal-content>footer:before,.modal-content>header:after,.modal-content>header:before{content:"";display:table;clear:both}span[class^=icon]::after{content:"\A";white-space:pre}.inlinebtn{position:relative;height:28px;margin-top:-28px;margin-left:-20px;padding:4px 8px;border:0!important;float:right}#loader{position:absolute;left:50%;top:50%;z-index:1;width:150px;height:150px;margin:-75px 0 0 -75px;border:16px solid #f3f3f3;border-radius:50%;border-top:16px solid #3498db;width:120px;height:120px;-webkit-animation:spin 2s linear infinite;animation:spin 2s linear infinite}@-webkit-keyframes spin{0%{-webkit-transform:rotate(0)}100%{-webkit-transform:rotate(360deg)}}@keyframes spin{0%{transform:rotate(0)}100%{transform:rotate(360deg)}} \ No newline at end of file diff --git a/admin/db.php b/admin/db.php new file mode 100644 index 0000000..e69de29 diff --git a/admin/img/POT-logo.png b/admin/img/POT-logo.png new file mode 100644 index 0000000..e2c8028 Binary files /dev/null and b/admin/img/POT-logo.png differ diff --git a/admin/img/bg1.jpg b/admin/img/bg1.jpg new file mode 100644 index 0000000..80c5326 Binary files /dev/null and b/admin/img/bg1.jpg differ diff --git a/admin/img/favicon/android-icon-144x144.png b/admin/img/favicon/android-icon-144x144.png new file mode 100644 index 0000000..6aa79d8 Binary files /dev/null and b/admin/img/favicon/android-icon-144x144.png differ diff --git a/admin/img/favicon/android-icon-192x192.png b/admin/img/favicon/android-icon-192x192.png new file mode 100644 index 0000000..f58a3e6 Binary files /dev/null and b/admin/img/favicon/android-icon-192x192.png differ diff --git a/admin/img/favicon/android-icon-36x36.png b/admin/img/favicon/android-icon-36x36.png new file mode 100644 index 0000000..f52eed7 Binary files /dev/null and b/admin/img/favicon/android-icon-36x36.png differ diff --git a/admin/img/favicon/android-icon-48x48.png b/admin/img/favicon/android-icon-48x48.png new file mode 100644 index 0000000..d5beba1 Binary files /dev/null and b/admin/img/favicon/android-icon-48x48.png differ diff --git a/admin/img/favicon/android-icon-72x72.png b/admin/img/favicon/android-icon-72x72.png new file mode 100644 index 0000000..7c7f324 Binary files /dev/null and b/admin/img/favicon/android-icon-72x72.png differ diff --git a/admin/img/favicon/android-icon-96x96.png b/admin/img/favicon/android-icon-96x96.png new file mode 100644 index 0000000..38484ee Binary files /dev/null and b/admin/img/favicon/android-icon-96x96.png differ diff --git a/admin/img/favicon/apple-icon-114x114.png b/admin/img/favicon/apple-icon-114x114.png new file mode 100644 index 0000000..3d448dd Binary files /dev/null and b/admin/img/favicon/apple-icon-114x114.png differ diff --git a/admin/img/favicon/apple-icon-120x120.png b/admin/img/favicon/apple-icon-120x120.png new file mode 100644 index 0000000..99a1a39 Binary files /dev/null and b/admin/img/favicon/apple-icon-120x120.png differ diff --git a/admin/img/favicon/apple-icon-144x144.png b/admin/img/favicon/apple-icon-144x144.png new file mode 100644 index 0000000..6aa79d8 Binary files /dev/null and b/admin/img/favicon/apple-icon-144x144.png differ diff --git a/admin/img/favicon/apple-icon-152x152.png b/admin/img/favicon/apple-icon-152x152.png new file mode 100644 index 0000000..3ee4143 Binary files /dev/null and b/admin/img/favicon/apple-icon-152x152.png differ diff --git a/admin/img/favicon/apple-icon-180x180.png b/admin/img/favicon/apple-icon-180x180.png new file mode 100644 index 0000000..7541cce Binary files /dev/null and b/admin/img/favicon/apple-icon-180x180.png differ diff --git a/admin/img/favicon/apple-icon-57x57.png b/admin/img/favicon/apple-icon-57x57.png new file mode 100644 index 0000000..58d5700 Binary files /dev/null and b/admin/img/favicon/apple-icon-57x57.png differ diff --git a/admin/img/favicon/apple-icon-60x60.png b/admin/img/favicon/apple-icon-60x60.png new file mode 100644 index 0000000..31a3f78 Binary files /dev/null and b/admin/img/favicon/apple-icon-60x60.png differ diff --git a/admin/img/favicon/apple-icon-72x72.png b/admin/img/favicon/apple-icon-72x72.png new file mode 100644 index 0000000..7c7f324 Binary files /dev/null and b/admin/img/favicon/apple-icon-72x72.png differ diff --git a/admin/img/favicon/apple-icon-76x76.png b/admin/img/favicon/apple-icon-76x76.png new file mode 100644 index 0000000..bd28884 Binary files /dev/null and b/admin/img/favicon/apple-icon-76x76.png differ diff --git a/admin/img/favicon/apple-icon-precomposed.png b/admin/img/favicon/apple-icon-precomposed.png new file mode 100644 index 0000000..cd3635a Binary files /dev/null and b/admin/img/favicon/apple-icon-precomposed.png differ diff --git a/admin/img/favicon/apple-icon.png b/admin/img/favicon/apple-icon.png new file mode 100644 index 0000000..cd3635a Binary files /dev/null and b/admin/img/favicon/apple-icon.png differ diff --git a/admin/img/favicon/browserconfig.xml b/admin/img/favicon/browserconfig.xml new file mode 100644 index 0000000..c554148 --- /dev/null +++ b/admin/img/favicon/browserconfig.xml @@ -0,0 +1,2 @@ + +#ffffff \ No newline at end of file diff --git a/admin/img/favicon/favicon-16x16.png b/admin/img/favicon/favicon-16x16.png new file mode 100644 index 0000000..09adf92 Binary files /dev/null and b/admin/img/favicon/favicon-16x16.png differ diff --git a/admin/img/favicon/favicon-32x32.png b/admin/img/favicon/favicon-32x32.png new file mode 100644 index 0000000..3281e25 Binary files /dev/null and b/admin/img/favicon/favicon-32x32.png differ diff --git a/admin/img/favicon/favicon-96x96.png b/admin/img/favicon/favicon-96x96.png new file mode 100644 index 0000000..38484ee Binary files /dev/null and b/admin/img/favicon/favicon-96x96.png differ diff --git a/admin/img/favicon/favicon.ico b/admin/img/favicon/favicon.ico new file mode 100644 index 0000000..bbf93a1 Binary files /dev/null and b/admin/img/favicon/favicon.ico differ diff --git a/admin/img/favicon/manifest.json b/admin/img/favicon/manifest.json new file mode 100644 index 0000000..013d4a6 --- /dev/null +++ b/admin/img/favicon/manifest.json @@ -0,0 +1,41 @@ +{ + "name": "App", + "icons": [ + { + "src": "\/android-icon-36x36.png", + "sizes": "36x36", + "type": "image\/png", + "density": "0.75" + }, + { + "src": "\/android-icon-48x48.png", + "sizes": "48x48", + "type": "image\/png", + "density": "1.0" + }, + { + "src": "\/android-icon-72x72.png", + "sizes": "72x72", + "type": "image\/png", + "density": "1.5" + }, + { + "src": "\/android-icon-96x96.png", + "sizes": "96x96", + "type": "image\/png", + "density": "2.0" + }, + { + "src": "\/android-icon-144x144.png", + "sizes": "144x144", + "type": "image\/png", + "density": "3.0" + }, + { + "src": "\/android-icon-192x192.png", + "sizes": "192x192", + "type": "image\/png", + "density": "4.0" + } + ] +} \ No newline at end of file diff --git a/admin/img/favicon/ms-icon-144x144.png b/admin/img/favicon/ms-icon-144x144.png new file mode 100644 index 0000000..6aa79d8 Binary files /dev/null and b/admin/img/favicon/ms-icon-144x144.png differ diff --git a/admin/img/favicon/ms-icon-150x150.png b/admin/img/favicon/ms-icon-150x150.png new file mode 100644 index 0000000..b08e562 Binary files /dev/null and b/admin/img/favicon/ms-icon-150x150.png differ diff --git a/admin/img/favicon/ms-icon-310x310.png b/admin/img/favicon/ms-icon-310x310.png new file mode 100644 index 0000000..12046d8 Binary files /dev/null and b/admin/img/favicon/ms-icon-310x310.png differ diff --git a/admin/img/favicon/ms-icon-70x70.png b/admin/img/favicon/ms-icon-70x70.png new file mode 100644 index 0000000..5135560 Binary files /dev/null and b/admin/img/favicon/ms-icon-70x70.png differ diff --git a/admin/img/logo_512.png b/admin/img/logo_512.png new file mode 100644 index 0000000..37e2068 Binary files /dev/null and b/admin/img/logo_512.png differ diff --git a/admin/img/logo_512_xx.png b/admin/img/logo_512_xx.png new file mode 100644 index 0000000..b82da90 Binary files /dev/null and b/admin/img/logo_512_xx.png differ diff --git a/admin/img/potbg.jpg b/admin/img/potbg.jpg new file mode 100644 index 0000000..5167072 Binary files /dev/null and b/admin/img/potbg.jpg differ diff --git a/admin/img/poticon512.png b/admin/img/poticon512.png new file mode 100644 index 0000000..bce391c Binary files /dev/null and b/admin/img/poticon512.png differ diff --git a/admin/img/potlogowhite.svg b/admin/img/potlogowhite.svg new file mode 100644 index 0000000..7c2ec3b --- /dev/null +++ b/admin/img/potlogowhite.svg @@ -0,0 +1,133 @@ + +image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/admin/img/pottop.png b/admin/img/pottop.png new file mode 100644 index 0000000..5f159c5 Binary files /dev/null and b/admin/img/pottop.png differ diff --git a/admin/img/toplogo.png b/admin/img/toplogo.png new file mode 100644 index 0000000..37e2068 Binary files /dev/null and b/admin/img/toplogo.png differ diff --git a/admin/index.php b/admin/index.php new file mode 100644 index 0000000..f785fc3 --- /dev/null +++ b/admin/index.php @@ -0,0 +1,108 @@ + 0){ + for ($i=0;$i<$abslen;$i++){ + $vars["abspath"] .= "../"; + } + + } + $vars["contenttype"] = "text/html"; + if (substr($vars["page"],-3) == "css"){ + $vars["contenttype"] = "text/css"; + } elseif (substr($vars["page"],-2) == "js"){ + $vars["contenttype"] = "text/javascript"; + } + header('Content-Type: '.$vars["contenttype"]); + $vars["sid"] = ""; + if (isset($_COOKIE[$cfg["cookie"]])){ + $vars["sid"] = $_COOKIE[$cfg["cookie"]]; + } + $db = new database($cfg["db"]); + $sess = new session($db); + if (count($postdata) > 0){ + if (isset($postdata["btnlogin"])){ + echo "CHECKLOGIN"; + $vars["sid"] = $sess->checkLogin($postdata["login"],$postdata["password"],$cfg["cookie"]); + } + } + if($vars["sid"] == "") { + $vars["skeleton"] = 'login.html'; + if ((!file_exists($cfg["templatepath"].'/pages/'.$vars["filepath"].'.mustache') && + ($vars["filepath"] != 'login/forgotpassword.html') && $vars["filepath"] != 'login/message.html')){ + $vars["page"] = 'login/login.html'; + } + } else{ + + } + + if (($vars["skeleton"] != 'login.html') && (!file_exists($cfg["templatepath"].'/pages/'.$vars["page"].'.mustache'))){ + $vars["origpage"] =$vars["page"]; + $vars["page"] = 'error.html'; + // $vars["skeleton"] = 'login.html'; + // $vars["page"] = 'login/login.html'; + } + if (file_exists($cfg["templatepath"].'/pages/'.$vars["page"].'.json')){ + + $tmpdata = file_get_contents($cfg["templatepath"].'/pages/'.$vars["page"].'.json'); + try { + $vars["data"] = json_decode($tmpdata,true); + foreach ($vars["data"] as $key => $value) { + if ($value["sql"]){ + if ($value["sqltype"] == "query"){ + $vars["data"][$key] = $db->query($value["sql"]); + } elseif ($value["sqltype"] == "queryarray"){ + $vars["data"][$key] = $db->queryarray($value["sql"]); + } + } + } + } catch(JsonException $je){ + fwrite(STDERR, "JSON ERROR: ".$je->getMessage()."\n"); + } + + } + $vars["page"] = 'pages/'.$vars["page"]; + $m = new Mustache_Engine(array( + 'loader' => new Mustache_Loader_FilesystemLoader($cfg["templatepath"]), + 'partials_loader' => new Mustache_Loader_FilesystemLoader($cfg["templatepath"].'/blocks'), + 'escape' => function($value) { + return $value; + }, + 'entity_flags' => ENT_HTML5 + + )); + + + $vars["pagedata"] = $m->render($vars["page"],$vars); + + $mainsite = $m->render($vars['skeleton'],$vars); + echo $mainsite; + $vars["pagedata"]= ""; + echo "
".print_r($vars)."
"; +?> \ No newline at end of file diff --git a/admin/js/app.js b/admin/js/app.js new file mode 100644 index 0000000..fbbb48a --- /dev/null +++ b/admin/js/app.js @@ -0,0 +1,70 @@ +let app = { + loadpage: function(modulepage, modulename) { + location.href=modulepage; + }, + logout: function() { + postData(location.href, { "logout": "1" }).then (data => { location.href = 'login.html';}); + }, + reloadpage() { }, + changedataset: function(){}, + getCurrentSchemata: function(){ + return schemata; + }, + changedataset: function(){ + let csel = document.getElementById("current_schemata").value; + schemata = csel; + postData("db.cgi",{"fn":"setsessiondata","params":{"schemata":csel}}).then(data => { + document.getElementById("current_schemata").dataset.selected = csel; + }); + }, + setschemata(data){ + }, + reload_page: function() { + location.href = location.href; + }, + viewpanel: function(pnlname){ + let panels = document.getElementsByClassName("panel"); + let toolbars = document.getElementsByClassName("paneltoolbar"); + currentview = pnlname; + for (let p=0;p{location.href="login.html"})},reloadpage(){},changedataset:function(){},getCurrentSchemata:function(){return schemata},changedataset:function(){let csel=document.getElementById("current_schemata").value;schemata=csel,postData("db.cgi",{fn:"setsessiondata",params:{schemata:csel}}).then(data=>{document.getElementById("current_schemata").dataset.selected=csel})},setschemata(data){},reload_page:function(){location.href=location.href},viewpanel:function(pnlname){let panels=document.getElementsByClassName("panel"),toolbars=document.getElementsByClassName("paneltoolbar");currentview=pnlname;for(let p=0;p { + if (aftercallback){ + aftercallback(data.result); + form.formsaved({}); + } else { + form.formsaved(data.result); + } + }); + return false; +}, +saveformdata: function(flds,aftercallback,clientschema){ + flds["fn"] ="saveform"; + flds["schemata"]=clientschema; + if (clientschema == null){ + flds["schemata"]=schemata; + } + delete flds["null"]; + postData("db.cgi",flds).then(data => { + if (aftercallback){ + aftercallback(data.result); + form.formsaved({}); + } else { + form.formsaved(data.result); + } + }); + return false; +}, +formsaved: function(data){ + var sb = document.getElementById("snackbar"); + sb.className="show green"; + sb.innerHTML = 'Les données ont été sauvegardées!'; + setTimeout(function(){ sb.className = sb.className.replace("show green", ""); }, 3000); + return false; +}, +getformcontent: function(frmid,dataflds){ + var frm = document.getElementById("frm_" + frmid); + var flds = {}; + // if (dataflds){ + // flds = dataflds; + // } + for (var i = 0; i < frm.elements.length; i++) { + var field = frm.elements[i]; + if ((field.getAttribute("name") != 'null') && (field.tagName == "INPUT" || field.tagName == "SELECT" || field.tagName == "TEXTAREA")){ + if (field.classList.contains("tagedit")){ + var fvalue=field.value.trim(); + var ndata = null; + if (fvalue != ""){ + ndata = fvalue.split(","); + } + flds[field.getAttribute("name")] = ndata; + }else if (field.tagName == "TEXTAREA" ){ + if (field.classList.contains("richeditarea")){ + flds[field.getAttribute("name")] = tinymce.get(field.id).getContent(); + } else { + flds[field.getAttribute("name")] = field.innerHTML; + } + }else if (field.type == "checkbox" ){ + if (field.checked){ + flds[field.getAttribute("name")] = "1"; + } else { + flds[field.getAttribute("name")] = ""; + } + } + else if (field.tagName == "SELECT" && field.multiple == true){ + flds[field.getAttribute("name")] = dataflds[field.getAttribute("id")].selected(); + } + else if (field.tagName == "SELECT"){ + flds[field.getAttribute("name")] = dataflds[field.getAttribute("id")].selected(); + } + else { + flds[field.getAttribute("name")] = field.value; + } + } + } + return flds; +}, +cleanform: function(frmname){ + var frm = document.getElementById("frm_" + frmname); + for (var f in frm){ + if (frm[f] && frm[f].id){ + if (frm[f].tagName == 'INPUT'){ + if (frm[f].type == "checkbox"){ + frm[f].checked = false; + } else if (frm[f].classList.contains("datefield")){ + if (frm[f]._flatpickr){ frm[f]._flatpickr.clear(); } + } + // else if (frm[f].classList.contains("choices__input")){ + // if (choice[frmname][frm[f].id]){ + // choice[frmname][frm[f].id].removeActiveItems(); + // } + // } + else { + frm[f].value = ""; + } + } + if (frm[f].tagName == 'SELECT'){ + if (frm[f].multiple == true){ + if (frm[f].classList.contains("choices__input")){ + choice[frmname][frm[f].id].removeActiveItems(); + } + } else { + frm[f].value = ""; + } + + } + if (frm[f].tagName == 'TEXTAREA'){ + if (frm[f].classList.contains("richeditarea")){ + tinymce.get(frm[f].id).setContent(""); + } else { + frm[f].innerHTML = ""; + } + } + } + } + return false; +}, +cleanform2: function(frmname,choices){ + var frm = document.getElementById("frm_" + frmname); + for (var f in frm){ + if (frm[f] && frm[f].id){ + if (frm[f].tagName == 'INPUT'){ + if (frm[f].type == "checkbox"){ + frm[f].checked = false; + } else if (frm[f].classList.contains("datefield")){ + if (frm[f]._flatpickr){ frm[f]._flatpickr.clear(); } + } + // else if (frm[f].classList.contains("choices__input")){ + // if (choices[frm[f].id]){ + // choices[frm[f].id].removeActiveItems(); + // } + // } + else { + frm[f].value = ""; + } + } + if (frm[f].tagName == 'SELECT'){ + if (frm[f].multiple == true){ + if (frm[f].classList.contains("choices__input")){ + choices[frm[f].id].removeActiveItems(); + } + } else { + frm[f].value = ""; + } + + } + if (frm[f].tagName == 'TEXTAREA'){ + if (frm[f].classList.contains("richeditarea")){ + tinymce.get(frm[f].id).setContent(""); + } else { + frm[f].innerHTML = ""; + } + } + } + } + return false; +}, +fillformbydataclass2: function(dataclass,choices,data,onblur){ + var frm = document.getElementsByClassName('data_'+ dataclass); + //console.log("frmdata",frm); + if (data){ + for (var f in frm){ + //console.log("field",frm[f].id); + if (frm[f].id){ + frm[f].dataset.id=data['id']; + } + if (data[frm[f].id]){ + + if (frm[f].tagName == 'INPUT'){ + if (frm[f].type == "checkbox"){ + if (data[frm[f].id] == "1"){ + frm[f].checked = true; + } else { + frm[f].checked = false; + } + } + else if (frm[f].classList.contains("datefield")){ + frm[f]._flatpickr.setDate(data[frm[f].id]); + } + else if (frm[f].classList.contains("timefield")){ + frm[f].value = timecalc.StringToTime(data[frm[f].id]); + } + else { + frm[f].value=data[frm[f].id]; + } + } + if (frm[f].tagName == 'SELECT'){ + if (frm[f].multiple == true){ + + choices[frm[f].id].set(JSON.parse(data[frm[f].id])); + } else { + frm[f].value=data[frm[f].id]; + } + } + } + } + } +}, +fillselectlist: function(obj,data,vidcol,vvalcol){ + var sellist = []; + let csel = obj.value; + if (data){ + for (var i in data){ + sellist.push({value:data[i][vidcol],text:data[i][vvalcol]}); + } + } + obj.setData(sellist); + if (obj.select.element.dataset.selected && obj.select.element.dataset.selected != ""){ + obj.set(obj.select.element.dataset.selected); + } + return false; +}, +savefield: function(obj,callback){ + fdata = obj.dataset; + fdata["save"] = "field"; + fdata["schemata"] = schemata; + if (obj.tagName == 'INPUT' || obj.tagName == 'SELECT' || obj.tagName == 'TEXTAREA'){ + if (obj.type == 'checkbox' || obj.type == 'radio'){ + if (obj.checked == true){ + fdata["value"] = 1; + } else { + fdata["value"] = null; + } + }else { + fdata["value"] = obj.value; + } + } + postData("db.cgi",fdata).then(data => { if (callback){callback(data);}}); + return false; +}, +saveschemafield: function(obj,schema){ + fdata = obj.dataset; + fdata["save"] = "field"; + fdata["schemata"] = schema; + if (obj.tagName == 'INPUT' || obj.tagName == 'SELECT' || obj.tagName == 'TEXTAREA'){ + if (obj.type == 'checkbox' || obj.type == 'radio'){ + if (obj.checked == true){ + fdata["value"] = 1; + } else { + fdata["value"] = null; + } + }else { + fdata["value"] = obj.value; + } + } + postData("db.cgi",fdata).then(data => { }); + return false; +}, +cleanfield: function(objid){ + document.getElementById(objid).value=''; +} + + +} \ No newline at end of file diff --git a/admin/js/dataform.min.js b/admin/js/dataform.min.js new file mode 100644 index 0000000..5516ad3 --- /dev/null +++ b/admin/js/dataform.min.js @@ -0,0 +1 @@ +let dataform={saveform:function(frmid,aftercallback,clientschema){var flds=form.getformcontent(frmid,null);return flds.fn="saveform",flds.schemata=clientschema,flds.table=frmid,null==clientschema&&(flds.schemata=schemata),delete flds.null,postData("db.cgi",flds).then(data=>{aftercallback?(aftercallback(data.result),form.formsaved({})):form.formsaved(data.result)}),!1},saveformdata:function(flds,aftercallback,clientschema){return flds.fn="saveform",flds.schemata=clientschema,null==clientschema&&(flds.schemata=schemata),delete flds.null,postData("db.cgi",flds).then(data=>{aftercallback?(aftercallback(data.result),form.formsaved({})):form.formsaved(data.result)}),!1},formsaved:function(data){var sb=document.getElementById("snackbar");return sb.className="show green",sb.innerHTML="Les données ont été sauvegardées!",setTimeout((function(){sb.className=sb.className.replace("show green","")}),3e3),!1},getformcontent:function(frmid,dataflds){for(var frm=document.getElementById("frm_"+frmid),flds={},i=0;i{callback&&callback(data)}),!1},saveschemafield:function(obj,schema){return fdata=obj.dataset,fdata.save="field",fdata.schemata=schema,"INPUT"!=obj.tagName&&"SELECT"!=obj.tagName&&"TEXTAREA"!=obj.tagName||("checkbox"==obj.type||"radio"==obj.type?1==obj.checked?fdata.value=1:fdata.value=null:fdata.value=obj.value),postData("db.cgi",fdata).then(data=>{}),!1},cleanfield:function(objid){document.getElementById(objid).value=""}}; \ No newline at end of file diff --git a/admin/js/report.js b/admin/js/report.js new file mode 100644 index 0000000..97733df --- /dev/null +++ b/admin/js/report.js @@ -0,0 +1,13 @@ +var report ={ + generate: function(repname,filename,data){ + showdataloaddlg("Création PDF encours","Attendez s.v.p.");//closedataloaddlg(); + postData("report.cgi",{"generate":repname,"file": filename + ".pdf","data":data}).then(data => {closedataloaddlg();;report.openreport(data.result)}).catch(e => {closedataloaddlg();}); + return false; + }, + openreport(data){ + + if (data && data.file){ + window.open(api + "report.cgi?open=" + encodeURIComponent(data.file)); + } + } +} \ No newline at end of file diff --git a/admin/js/report.min.js b/admin/js/report.min.js new file mode 100644 index 0000000..56cd31e --- /dev/null +++ b/admin/js/report.min.js @@ -0,0 +1 @@ +var report={generate:function(repname,filename,data){return showdataloaddlg("Création PDF encours","Attendez s.v.p."),postData("report.cgi",{generate:repname,file:filename+".pdf",data:data}).then(data=>{closedataloaddlg(),report.openreport(data.result)}).catch(e=>{closedataloaddlg()}),!1},openreport(data){data&&data.file&&window.open(api+"report.cgi?open="+encodeURIComponent(data.file))}}; \ No newline at end of file diff --git a/admin/js/request.js b/admin/js/request.js new file mode 100644 index 0000000..2eba8bb --- /dev/null +++ b/admin/js/request.js @@ -0,0 +1,56 @@ +var api = location.origin + location.pathname.substring(0,location.pathname.lastIndexOf('/')) + '/'; + +var Base64={_keyStr:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",encode:function(e){var t="";var n,r,i,s,o,u,a;var f=0;e=Base64._utf8_encode(e);while(f>2;o=(n&3)<<4|r>>4;u=(r&15)<<2|i>>6;a=i&63;if(isNaN(r)){u=a=64}else if(isNaN(i)){a=64}t=t+this._keyStr.charAt(s)+this._keyStr.charAt(o)+this._keyStr.charAt(u)+this._keyStr.charAt(a)}return t},decode:function(e){var t="";var n,r,i;var s,o,u,a;var f=0;e=e.replace(/[^A-Za-z0-9\+\/\=]/g,"");while(f>4;r=(o&15)<<4|u>>2;i=(u&3)<<6|a;t=t+String.fromCharCode(n);if(u!=64){t=t+String.fromCharCode(r)}if(a!=64){t=t+String.fromCharCode(i)}}t=Base64._utf8_decode(t);return t},_utf8_encode:function(e){e=e.replace(/\r\n/g,"\n");var t="";for(var n=0;n127&&r<2048){t+=String.fromCharCode(r>>6|192);t+=String.fromCharCode(r&63|128)}else{t+=String.fromCharCode(r>>12|224);t+=String.fromCharCode(r>>6&63|128);t+=String.fromCharCode(r&63|128)}}return t},_utf8_decode:function(e){var t="";var n=0;var r=c1=c2=0;while(n191&&r<224){c2=e.charCodeAt(n+1);t+=String.fromCharCode((r&31)<<6|c2&63);n+=2}else{c2=e.charCodeAt(n+1);c3=e.charCodeAt(n+2);t+=String.fromCharCode((r&15)<<12|(c2&63)<<6|c3&63);n+=3}}return t}} + +async function postData(url = '', data = {}) { + const response = await fetch(api + url, { + method: 'POST', + mode: 'same-origin', + cache: 'no-cache', + credentials: 'same-origin', + headers: { + 'Content-Type': 'application/json' + + }, + redirect: 'follow', + referrerPolicy: 'strict-origin', + body: JSON.stringify(data) + }); + + return response.json(); +} + +var report ={ + generate: function(repname,filename,data){ + showdataloaddlg("Création PDF encours","Attendez s.v.p."); + postData("report.cgi",{"generate":repname,"file": filename + ".pdf","data":data}).then (data => {closedataloaddlg();report.openreport(data);}); + return false; + }, + openreport(data){ + if (data && data.file){ + window.open(api + "report.cgi?open=" + encodeURIComponent(data.file)); + } + } +} + +async function syncData(url,username,password, data = {}) { + //var decodedString = Base64.decode(encodedString); + let hh = {}; + hh['Content-Type'] = 'application/json'; + if ((username != null) && (username != '')){ + hh['Authorization'] = Base64.encode(username + ":" + password); + } + const response = await fetch(url, { + method: 'POST', + mode: 'cors', + cache: 'no-cache', + credentials: 'omit', + headers: hh, + redirect: 'follow', + referrerPolicy: 'strict-origin', + body: JSON.stringify(data) + }); + + return response.json(); +} + diff --git a/admin/js/request.min.js b/admin/js/request.min.js new file mode 100644 index 0000000..82b32c6 --- /dev/null +++ b/admin/js/request.min.js @@ -0,0 +1,12 @@ +async function postData(r="",e={}){const t=await fetch(api+r,{method:"POST",mode:"same-origin",cache:"no-cache",credentials:"same-origin",headers:{"Content-Type":"application/json"},redirect:"follow",referrerPolicy:"strict-origin",body:JSON.stringify(e)}) +return t.json()}async function syncData(r,e,t,o={}){let n={"Content-Type":"application/json"} +null!=e&&""!=e&&(n["Authorization"]=Base64.encode(e+":"+t)) +const a=await fetch(r,{method:"POST",mode:"cors",cache:"no-cache",credentials:"omit",headers:n,redirect:"follow",referrerPolicy:"strict-origin",body:JSON.stringify(o)}) +return a.json()}var api=location.origin+location.pathname.substring(0,location.pathname.lastIndexOf("/"))+"/",Base64={_keyStr:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",encode:function(r){var e,t,o,n,a,i,c,d="",h=0 +for(r=Base64._utf8_encode(r);h>2,a=(3&e)<<4|t>>4,i=(15&t)<<2|o>>6,c=63&o,isNaN(t)?i=c=64:isNaN(o)&&(c=64),d=d+this._keyStr.charAt(n)+this._keyStr.charAt(a)+this._keyStr.charAt(i)+this._keyStr.charAt(c) +return d},decode:function(r){var e,t,o,n,a,i,c,d="",h=0 +for(r=r.replace(/[^A-Za-z0-9\+\/\=]/g,"");h>4,t=(15&a)<<4|i>>2,o=(3&i)<<6|c,d+=String.fromCharCode(e),64!=i&&(d+=String.fromCharCode(t)),64!=c&&(d+=String.fromCharCode(o)) +return d=Base64._utf8_decode(d),d},_utf8_encode:function(r){r=r.replace(/\r\n/g,"\n") +for(var e="",t=0;t127&&o<2048?(e+=String.fromCharCode(o>>6|192),e+=String.fromCharCode(63&o|128)):(e+=String.fromCharCode(o>>12|224),e+=String.fromCharCode(o>>6&63|128),e+=String.fromCharCode(63&o|128))}return e},_utf8_decode:function(r){for(var e="",t=0,o=c1=c2=0;t191&&o<224?(c2=r.charCodeAt(t+1),e+=String.fromCharCode((31&o)<<6|63&c2),t+=2):(c2=r.charCodeAt(t+1),c3=r.charCodeAt(t+2),e+=String.fromCharCode((15&o)<<12|(63&c2)<<6|63&c3),t+=3) +return e}},report={generate:function(r,e,t){return showdataloaddlg("Création PDF encours","Attendez s.v.p."),postData("report.cgi",{generate:r,file:e+".pdf",data:t}).then(r=>{closedataloaddlg(),report.openreport(r)}),!1},openreport(r){r&&r.file&&window.open(api+"report.cgi?open="+encodeURIComponent(r.file))}} diff --git a/admin/js/timecalc.js b/admin/js/timecalc.js new file mode 100644 index 0000000..72425a2 --- /dev/null +++ b/admin/js/timecalc.js @@ -0,0 +1,128 @@ +let timecalc = { + MinutesToTime:function (minutes) { + minutes = parseInt(minutes); + if ((minutes == null) || (minutes == 0)){ return "00:00";}; + let hours = parseInt(minutes/60); + + let restminutes = minutes-(hours*60); + // console.log(hours + " : " + restminutes); + return timecalc.lpad(hours,2,'0') + ":"+ timecalc.lpad(restminutes,2,'0'); + }, + TimeToMinutes:function (strtime){ + let hours = parseInt(strtime.substring(0,2)) * 60; + let minutes = parseInt(strtime.substring(3,5)); + return hours+minutes; + }, + lpad: function(str, length,padString) { + let xstr = str.toString(); + while (xstr.length < length){xstr = padString + xstr}; + return xstr; + }, + mondayBefore: function(sdate){ + if (sdate == null){ + sdate=new Date(); + } + let day = sdate.getDay(); + let prevMonday = new Date(); + if(sdate.getDay() == 0){ + prevMonday = new Date().setDate(sdate.getDate() - 0); + } + else{ + prevMonday = new Date().setDate(sdate.getDate() - day); + } + return new Date(prevMonday); + }, + sundayAfter: function(sdate){ + let nextSunday = new Date(); + }, + StringToTime: function(strin){ + strin = strin.toString().substring(0,5); + strin = strin.replace(/\D/g,''); + //console.log("StT:",strin); + if (strin.length == 0){ return "";} + if (strin.length <= 2){ + if (strin > "23") {return ""} else { + //console.log("xtime",timecalc.lpad(strin,2,'0')+":00"); + return timecalc.lpad(strin,2,'0')+":00"; + } + } else if (strin.length == 3){ + let hours = strin.substring(0,1); + let minutes = strin.substring(1,3); + if (minutes > "59"){ return "";} + return timecalc.lpad(hours,2,'0')+ ":"+ timecalc.lpad(minutes,2,'0'); + } else if (strin.length == 4){ + let hours = strin.substring(0,2); + let minutes = strin.substring(2,4); + if ((hours > "23") || (minutes > "59")){return "";} + return timecalc.lpad(hours,2,'0')+ ":"+ timecalc.lpad(minutes,2,'0'); + } + return ""; + }, + StringToInterval: function(strin){ + let minus = ""; + if (strin.startsWith('-')){ + minus = '-'; + } + if (strin.indexOf(":") > 0){ + let spl = strin.split(":"); + hours = spl[0].replace(/\D/g,''); + if (hours == ""){ + hours = "0"; + } + minutes = spl[1].replace(/\D/g,''); + if (minutes > "59"){ + minutes = "0"; + } + return minus + hours + ":" + timecalc.lpad(minutes,2,'0'); + } + if (strin == ""){ return "";} + strin = strin.replace(/\D/g,''); + return minus + strin + ":00"; + + }, + MinutesToInterval: function(minutes){ + if ((minutes == null) || (minutes == "")){ return "0:00";} + let prep =""; + if (minutes < 0){ + prep = "-"; + minutes = minutes * -1; + } + let hours = parseInt(minutes/60); + let restminutes = minutes-(hours*60); + restminutes = Math.round(restminutes); + return prep+hours+ ":"+ timecalc.lpad(restminutes,2,'0'); + }, + IntervalToMinutes: function(strin){ + if (strin == "" || strin == null){ + return 0; + } + let mult = 1; + if (strin.startsWith("-")){ + mult = -1; + strin = strin.replace(/-/g,''); + } + let spl = strin.split(":"); + let hours = parseInt(spl[0]) * 60; + let minutes = parseInt(spl[1]); + return (hours+minutes) * mult; + }, + validateTime(obj){ + obj.value = timecalc.StringToTime(obj.value); + return false; + }, + validateInterval(obj){ + obj.value = timecalc.StringToInterval(obj.value); + return false; + }, + copyInterval(obj,idobjout,factor){ + if (factor){ + let mval = timecalc.IntervalToMinutes(obj.value) * factor; + document.getElementById(idobjout).value = timecalc.MinutesToInterval(mval); + }else { + document.getElementById(idobjout).value=obj.value; + } + if (document.getElementById(idobjout).value == '0:00'){ + document.getElementById(idobjout).value = ''; + } + } +} diff --git a/admin/js/timecalc.min.js b/admin/js/timecalc.min.js new file mode 100644 index 0000000..28aa58e --- /dev/null +++ b/admin/js/timecalc.min.js @@ -0,0 +1,24 @@ +let timecalc={MinutesToTime:function(e){if(e=parseInt(e),null==e||0==e)return"00:00" +let t=parseInt(e/60),n=e-60*t +return timecalc.lpad(t,2,"0")+":"+timecalc.lpad(n,2,"0")},TimeToMinutes:function(e){let t=60*parseInt(e.substring(0,2)),n=parseInt(e.substring(3,5)) +return t+n},lpad:function(e,t,n){let l=e.toString() +for(;l.length"23"?"":timecalc.lpad(e,2,"0")+":00" +if(3==e.length){let t=e.substring(0,1),n=e.substring(1,3) +return n>"59"?"":timecalc.lpad(t,2,"0")+":"+timecalc.lpad(n,2,"0")}if(4==e.length){let t=e.substring(0,2),n=e.substring(2,4) +return t>"23"||n>"59"?"":timecalc.lpad(t,2,"0")+":"+timecalc.lpad(n,2,"0")}return""},StringToInterval:function(e){let t="" +if(e.startsWith("-")&&(t="-"),e.indexOf(":")>0){let n=e.split(":") +return hours=n[0].replace(/\D/g,""),""==hours&&(hours="0"),minutes=n[1].replace(/\D/g,""),minutes>"59"&&(minutes="0"),t+hours+":"+timecalc.lpad(minutes,2,"0")}return""==e?"":(e=e.replace(/\D/g,""),t+e+":00")},MinutesToInterval:function(e){if(null==e||""==e)return"0:00" +let t="" +e<0&&(t="-",e*=-1) +let n=parseInt(e/60),l=e-60*n +return l=Math.round(l),t+n+":"+timecalc.lpad(l,2,"0")},IntervalToMinutes:function(e){if(""==e||null==e)return 0 +let t=1 +e.startsWith("-")&&(t=-1,e=e.replace(/-/g,"")) +let n=e.split(":"),l=60*parseInt(n[0]),a=parseInt(n[1]) +return(l+a)*t},validateTime:e=>(e.value=timecalc.StringToTime(e.value),!1),validateInterval:e=>(e.value=timecalc.StringToInterval(e.value),!1),copyInterval(e,t,n){if(n){let l=timecalc.IntervalToMinutes(e.value)*n +document.getElementById(t).value=timecalc.MinutesToInterval(l)}else document.getElementById(t).value=e.value +"0:00"==document.getElementById(t).value&&(document.getElementById(t).value="")}} diff --git a/admin/js/vendors/flatpickr/flatpickr.css b/admin/js/vendors/flatpickr/flatpickr.css new file mode 100644 index 0000000..4c58f46 --- /dev/null +++ b/admin/js/vendors/flatpickr/flatpickr.css @@ -0,0 +1,791 @@ +.flatpickr-calendar { + background: transparent; + opacity: 0; + display: none; + text-align: center; + visibility: hidden; + padding: 0; + -webkit-animation: none; + animation: none; + direction: ltr; + border: 0; + font-size: 14px; + line-height: 24px; + border-radius: 5px; + position: absolute; + width: 307.875px; + -webkit-box-sizing: border-box; + box-sizing: border-box; + -ms-touch-action: manipulation; + touch-action: manipulation; + background: #fff; + -webkit-box-shadow: 1px 0 0 #e6e6e6, -1px 0 0 #e6e6e6, 0 1px 0 #e6e6e6, 0 -1px 0 #e6e6e6, 0 3px 13px rgba(0,0,0,0.08); + box-shadow: 1px 0 0 #e6e6e6, -1px 0 0 #e6e6e6, 0 1px 0 #e6e6e6, 0 -1px 0 #e6e6e6, 0 3px 13px rgba(0,0,0,0.08); +} +.flatpickr-calendar.open, +.flatpickr-calendar.inline { + opacity: 1; + max-height: 640px; + visibility: visible; +} +.flatpickr-calendar.open { + display: inline-block; + z-index: 99999; +} +.flatpickr-calendar.animate.open { + -webkit-animation: fpFadeInDown 300ms cubic-bezier(0.23, 1, 0.32, 1); + animation: fpFadeInDown 300ms cubic-bezier(0.23, 1, 0.32, 1); +} +.flatpickr-calendar.inline { + display: block; + position: relative; + top: 2px; +} +.flatpickr-calendar.static { + position: absolute; + top: calc(100% + 2px); +} +.flatpickr-calendar.static.open { + z-index: 999; + display: block; +} +.flatpickr-calendar.multiMonth .flatpickr-days .dayContainer:nth-child(n+1) .flatpickr-day.inRange:nth-child(7n+7) { + -webkit-box-shadow: none !important; + box-shadow: none !important; +} +.flatpickr-calendar.multiMonth .flatpickr-days .dayContainer:nth-child(n+2) .flatpickr-day.inRange:nth-child(7n+1) { + -webkit-box-shadow: -2px 0 0 #e6e6e6, 5px 0 0 #e6e6e6; + box-shadow: -2px 0 0 #e6e6e6, 5px 0 0 #e6e6e6; +} +.flatpickr-calendar .hasWeeks .dayContainer, +.flatpickr-calendar .hasTime .dayContainer { + border-bottom: 0; + border-bottom-right-radius: 0; + border-bottom-left-radius: 0; +} +.flatpickr-calendar .hasWeeks .dayContainer { + border-left: 0; +} +.flatpickr-calendar.hasTime .flatpickr-time { + height: 40px; + border-top: 1px solid #e6e6e6; +} +.flatpickr-calendar.noCalendar.hasTime .flatpickr-time { + height: auto; +} +.flatpickr-calendar:before, +.flatpickr-calendar:after { + position: absolute; + display: block; + pointer-events: none; + border: solid transparent; + content: ''; + height: 0; + width: 0; + left: 22px; +} +.flatpickr-calendar.rightMost:before, +.flatpickr-calendar.arrowRight:before, +.flatpickr-calendar.rightMost:after, +.flatpickr-calendar.arrowRight:after { + left: auto; + right: 22px; +} +.flatpickr-calendar.arrowCenter:before, +.flatpickr-calendar.arrowCenter:after { + left: 50%; + right: 50%; +} +.flatpickr-calendar:before { + border-width: 5px; + margin: 0 -5px; +} +.flatpickr-calendar:after { + border-width: 4px; + margin: 0 -4px; +} +.flatpickr-calendar.arrowTop:before, +.flatpickr-calendar.arrowTop:after { + bottom: 100%; +} +.flatpickr-calendar.arrowTop:before { + border-bottom-color: #e6e6e6; +} +.flatpickr-calendar.arrowTop:after { + border-bottom-color: #fff; +} +.flatpickr-calendar.arrowBottom:before, +.flatpickr-calendar.arrowBottom:after { + top: 100%; +} +.flatpickr-calendar.arrowBottom:before { + border-top-color: #e6e6e6; +} +.flatpickr-calendar.arrowBottom:after { + border-top-color: #fff; +} +.flatpickr-calendar:focus { + outline: 0; +} +.flatpickr-wrapper { + position: relative; + display: inline-block; +} +.flatpickr-months { + display: -webkit-box; + display: -webkit-flex; + display: -ms-flexbox; + display: flex; +} +.flatpickr-months .flatpickr-month { + background: transparent; + color: rgba(0,0,0,0.9); + fill: rgba(0,0,0,0.9); + height: 34px; + line-height: 1; + text-align: center; + position: relative; + -webkit-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; + overflow: hidden; + -webkit-box-flex: 1; + -webkit-flex: 1; + -ms-flex: 1; + flex: 1; +} +.flatpickr-months .flatpickr-prev-month, +.flatpickr-months .flatpickr-next-month { + text-decoration: none; + cursor: pointer; + position: absolute; + top: 0; + height: 34px; + padding: 10px; + z-index: 3; + color: rgba(0,0,0,0.9); + fill: rgba(0,0,0,0.9); +} +.flatpickr-months .flatpickr-prev-month.flatpickr-disabled, +.flatpickr-months .flatpickr-next-month.flatpickr-disabled { + display: none; +} +.flatpickr-months .flatpickr-prev-month i, +.flatpickr-months .flatpickr-next-month i { + position: relative; +} +.flatpickr-months .flatpickr-prev-month.flatpickr-prev-month, +.flatpickr-months .flatpickr-next-month.flatpickr-prev-month { +/* + /*rtl:begin:ignore*/ +/* + */ + left: 0; +/* + /*rtl:end:ignore*/ +/* + */ +} +/* + /*rtl:begin:ignore*/ +/* + /*rtl:end:ignore*/ +.flatpickr-months .flatpickr-prev-month.flatpickr-next-month, +.flatpickr-months .flatpickr-next-month.flatpickr-next-month { +/* + /*rtl:begin:ignore*/ +/* + */ + right: 0; +/* + /*rtl:end:ignore*/ +/* + */ +} +/* + /*rtl:begin:ignore*/ +/* + /*rtl:end:ignore*/ +.flatpickr-months .flatpickr-prev-month:hover, +.flatpickr-months .flatpickr-next-month:hover { + color: #959ea9; +} +.flatpickr-months .flatpickr-prev-month:hover svg, +.flatpickr-months .flatpickr-next-month:hover svg { + fill: #f64747; +} +.flatpickr-months .flatpickr-prev-month svg, +.flatpickr-months .flatpickr-next-month svg { + width: 14px; + height: 14px; +} +.flatpickr-months .flatpickr-prev-month svg path, +.flatpickr-months .flatpickr-next-month svg path { + -webkit-transition: fill 0.1s; + transition: fill 0.1s; + fill: inherit; +} +.numInputWrapper { + position: relative; + height: auto; +} +.numInputWrapper input, +.numInputWrapper span { + display: inline-block; +} +.numInputWrapper input { + width: 100%; +} +.numInputWrapper input::-ms-clear { + display: none; +} +.numInputWrapper input::-webkit-outer-spin-button, +.numInputWrapper input::-webkit-inner-spin-button { + margin: 0; + -webkit-appearance: none; +} +.numInputWrapper span { + position: absolute; + right: 0; + width: 14px; + padding: 0 4px 0 2px; + height: 50%; + line-height: 50%; + opacity: 0; + cursor: pointer; + border: 1px solid rgba(57,57,57,0.15); + -webkit-box-sizing: border-box; + box-sizing: border-box; +} +.numInputWrapper span:hover { + background: rgba(0,0,0,0.1); +} +.numInputWrapper span:active { + background: rgba(0,0,0,0.2); +} +.numInputWrapper span:after { + display: block; + content: ""; + position: absolute; +} +.numInputWrapper span.arrowUp { + top: 0; + border-bottom: 0; +} +.numInputWrapper span.arrowUp:after { + border-left: 4px solid transparent; + border-right: 4px solid transparent; + border-bottom: 4px solid rgba(57,57,57,0.6); + top: 26%; +} +.numInputWrapper span.arrowDown { + top: 50%; +} +.numInputWrapper span.arrowDown:after { + border-left: 4px solid transparent; + border-right: 4px solid transparent; + border-top: 4px solid rgba(57,57,57,0.6); + top: 40%; +} +.numInputWrapper span svg { + width: inherit; + height: auto; +} +.numInputWrapper span svg path { + fill: rgba(0,0,0,0.5); +} +.numInputWrapper:hover { + background: rgba(0,0,0,0.05); +} +.numInputWrapper:hover span { + opacity: 1; +} +.flatpickr-current-month { + font-size: 135%; + line-height: inherit; + font-weight: 300; + color: inherit; + position: absolute; + width: 75%; + left: 12.5%; + padding: 7.48px 0 0 0; + line-height: 1; + height: 34px; + display: inline-block; + text-align: center; + -webkit-transform: translate3d(0px, 0px, 0px); + transform: translate3d(0px, 0px, 0px); +} +.flatpickr-current-month span.cur-month { + font-family: inherit; + font-weight: 700; + color: inherit; + display: inline-block; + margin-left: 0.5ch; + padding: 0; +} +.flatpickr-current-month span.cur-month:hover { + background: rgba(0,0,0,0.05); +} +.flatpickr-current-month .numInputWrapper { + width: 6ch; + width: 7ch\0; + display: inline-block; +} +.flatpickr-current-month .numInputWrapper span.arrowUp:after { + border-bottom-color: rgba(0,0,0,0.9); +} +.flatpickr-current-month .numInputWrapper span.arrowDown:after { + border-top-color: rgba(0,0,0,0.9); +} +.flatpickr-current-month input.cur-year { + background: transparent; + -webkit-box-sizing: border-box; + box-sizing: border-box; + color: inherit; + cursor: text; + padding: 0 0 0 0.5ch; + margin: 0; + display: inline-block; + font-size: inherit; + font-family: inherit; + font-weight: 300; + line-height: inherit; + height: auto; + border: 0; + border-radius: 0; + vertical-align: initial; + -webkit-appearance: textfield; + -moz-appearance: textfield; + appearance: textfield; +} +.flatpickr-current-month input.cur-year:focus { + outline: 0; +} +.flatpickr-current-month input.cur-year[disabled], +.flatpickr-current-month input.cur-year[disabled]:hover { + font-size: 100%; + color: rgba(0,0,0,0.5); + background: transparent; + pointer-events: none; +} +.flatpickr-current-month .flatpickr-monthDropdown-months { + appearance: menulist; + background: transparent; + border: none; + border-radius: 0; + box-sizing: border-box; + color: inherit; + cursor: pointer; + font-size: inherit; + font-family: inherit; + font-weight: 300; + height: auto; + line-height: inherit; + margin: -1px 0 0 0; + outline: none; + padding: 0 0 0 0.5ch; + position: relative; + vertical-align: initial; + -webkit-box-sizing: border-box; + -webkit-appearance: menulist; + -moz-appearance: menulist; + width: auto; +} +.flatpickr-current-month .flatpickr-monthDropdown-months:focus, +.flatpickr-current-month .flatpickr-monthDropdown-months:active { + outline: none; +} +.flatpickr-current-month .flatpickr-monthDropdown-months:hover { + background: rgba(0,0,0,0.05); +} +.flatpickr-current-month .flatpickr-monthDropdown-months .flatpickr-monthDropdown-month { + background-color: transparent; + outline: none; + padding: 0; +} +.flatpickr-weekdays { + background: transparent; + text-align: center; + overflow: hidden; + width: 100%; + display: -webkit-box; + display: -webkit-flex; + display: -ms-flexbox; + display: flex; + -webkit-box-align: center; + -webkit-align-items: center; + -ms-flex-align: center; + align-items: center; + height: 28px; +} +.flatpickr-weekdays .flatpickr-weekdaycontainer { + display: -webkit-box; + display: -webkit-flex; + display: -ms-flexbox; + display: flex; + -webkit-box-flex: 1; + -webkit-flex: 1; + -ms-flex: 1; + flex: 1; +} +span.flatpickr-weekday { + cursor: default; + font-size: 90%; + background: transparent; + color: rgba(0,0,0,0.54); + line-height: 1; + margin: 0; + text-align: center; + display: block; + -webkit-box-flex: 1; + -webkit-flex: 1; + -ms-flex: 1; + flex: 1; + font-weight: bolder; +} +.dayContainer, +.flatpickr-weeks { + padding: 1px 0 0 0; +} +.flatpickr-days { + position: relative; + overflow: hidden; + display: -webkit-box; + display: -webkit-flex; + display: -ms-flexbox; + display: flex; + -webkit-box-align: start; + -webkit-align-items: flex-start; + -ms-flex-align: start; + align-items: flex-start; + width: 307.875px; +} +.flatpickr-days:focus { + outline: 0; +} +.dayContainer { + padding: 0; + outline: 0; + text-align: left; + width: 307.875px; + min-width: 307.875px; + max-width: 307.875px; + -webkit-box-sizing: border-box; + box-sizing: border-box; + display: inline-block; + display: -ms-flexbox; + display: -webkit-box; + display: -webkit-flex; + display: flex; + -webkit-flex-wrap: wrap; + flex-wrap: wrap; + -ms-flex-wrap: wrap; + -ms-flex-pack: justify; + -webkit-justify-content: space-around; + justify-content: space-around; + -webkit-transform: translate3d(0px, 0px, 0px); + transform: translate3d(0px, 0px, 0px); + opacity: 1; +} +.dayContainer + .dayContainer { + -webkit-box-shadow: -1px 0 0 #e6e6e6; + box-shadow: -1px 0 0 #e6e6e6; +} +.flatpickr-day { + background: none; + border: 1px solid transparent; + border-radius: 150px; + -webkit-box-sizing: border-box; + box-sizing: border-box; + color: #393939; + cursor: pointer; + font-weight: 400; + width: 14.2857143%; + -webkit-flex-basis: 14.2857143%; + -ms-flex-preferred-size: 14.2857143%; + flex-basis: 14.2857143%; + max-width: 39px; + height: 39px; + line-height: 39px; + margin: 0; + display: inline-block; + position: relative; + -webkit-box-pack: center; + -webkit-justify-content: center; + -ms-flex-pack: center; + justify-content: center; + text-align: center; +} +.flatpickr-day.inRange, +.flatpickr-day.prevMonthDay.inRange, +.flatpickr-day.nextMonthDay.inRange, +.flatpickr-day.today.inRange, +.flatpickr-day.prevMonthDay.today.inRange, +.flatpickr-day.nextMonthDay.today.inRange, +.flatpickr-day:hover, +.flatpickr-day.prevMonthDay:hover, +.flatpickr-day.nextMonthDay:hover, +.flatpickr-day:focus, +.flatpickr-day.prevMonthDay:focus, +.flatpickr-day.nextMonthDay:focus { + cursor: pointer; + outline: 0; + background: #e6e6e6; + border-color: #e6e6e6; +} +.flatpickr-day.today { + border-color: #959ea9; +} +.flatpickr-day.today:hover, +.flatpickr-day.today:focus { + border-color: #959ea9; + background: #959ea9; + color: #fff; +} +.flatpickr-day.selected, +.flatpickr-day.startRange, +.flatpickr-day.endRange, +.flatpickr-day.selected.inRange, +.flatpickr-day.startRange.inRange, +.flatpickr-day.endRange.inRange, +.flatpickr-day.selected:focus, +.flatpickr-day.startRange:focus, +.flatpickr-day.endRange:focus, +.flatpickr-day.selected:hover, +.flatpickr-day.startRange:hover, +.flatpickr-day.endRange:hover, +.flatpickr-day.selected.prevMonthDay, +.flatpickr-day.startRange.prevMonthDay, +.flatpickr-day.endRange.prevMonthDay, +.flatpickr-day.selected.nextMonthDay, +.flatpickr-day.startRange.nextMonthDay, +.flatpickr-day.endRange.nextMonthDay { + background: #569ff7; + -webkit-box-shadow: none; + box-shadow: none; + color: #fff; + border-color: #569ff7; +} +.flatpickr-day.selected.startRange, +.flatpickr-day.startRange.startRange, +.flatpickr-day.endRange.startRange { + border-radius: 50px 0 0 50px; +} +.flatpickr-day.selected.endRange, +.flatpickr-day.startRange.endRange, +.flatpickr-day.endRange.endRange { + border-radius: 0 50px 50px 0; +} +.flatpickr-day.selected.startRange + .endRange:not(:nth-child(7n+1)), +.flatpickr-day.startRange.startRange + .endRange:not(:nth-child(7n+1)), +.flatpickr-day.endRange.startRange + .endRange:not(:nth-child(7n+1)) { + -webkit-box-shadow: -10px 0 0 #569ff7; + box-shadow: -10px 0 0 #569ff7; +} +.flatpickr-day.selected.startRange.endRange, +.flatpickr-day.startRange.startRange.endRange, +.flatpickr-day.endRange.startRange.endRange { + border-radius: 50px; +} +.flatpickr-day.inRange { + border-radius: 0; + -webkit-box-shadow: -5px 0 0 #e6e6e6, 5px 0 0 #e6e6e6; + box-shadow: -5px 0 0 #e6e6e6, 5px 0 0 #e6e6e6; +} +.flatpickr-day.flatpickr-disabled, +.flatpickr-day.flatpickr-disabled:hover, +.flatpickr-day.prevMonthDay, +.flatpickr-day.nextMonthDay, +.flatpickr-day.notAllowed, +.flatpickr-day.notAllowed.prevMonthDay, +.flatpickr-day.notAllowed.nextMonthDay { + color: rgba(57,57,57,0.3); + background: transparent; + border-color: transparent; + cursor: default; +} +.flatpickr-day.flatpickr-disabled, +.flatpickr-day.flatpickr-disabled:hover { + cursor: not-allowed; + color: rgba(57,57,57,0.1); +} +.flatpickr-day.week.selected { + border-radius: 0; + -webkit-box-shadow: -5px 0 0 #569ff7, 5px 0 0 #569ff7; + box-shadow: -5px 0 0 #569ff7, 5px 0 0 #569ff7; +} +.flatpickr-day.hidden { + visibility: hidden; +} +.rangeMode .flatpickr-day { + margin-top: 1px; +} +.flatpickr-weekwrapper { + float: left; +} +.flatpickr-weekwrapper .flatpickr-weeks { + padding: 0 12px; + -webkit-box-shadow: 1px 0 0 #e6e6e6; + box-shadow: 1px 0 0 #e6e6e6; +} +.flatpickr-weekwrapper .flatpickr-weekday { + float: none; + width: 100%; + line-height: 28px; +} +.flatpickr-weekwrapper span.flatpickr-day, +.flatpickr-weekwrapper span.flatpickr-day:hover { + display: block; + width: 100%; + max-width: none; + color: rgba(57,57,57,0.3); + background: transparent; + cursor: default; + border: none; +} +.flatpickr-innerContainer { + display: block; + display: -webkit-box; + display: -webkit-flex; + display: -ms-flexbox; + display: flex; + -webkit-box-sizing: border-box; + box-sizing: border-box; + overflow: hidden; +} +.flatpickr-rContainer { + display: inline-block; + padding: 0; + -webkit-box-sizing: border-box; + box-sizing: border-box; +} +.flatpickr-time { + text-align: center; + outline: 0; + display: block; + height: 0; + line-height: 40px; + max-height: 40px; + -webkit-box-sizing: border-box; + box-sizing: border-box; + overflow: hidden; + display: -webkit-box; + display: -webkit-flex; + display: -ms-flexbox; + display: flex; +} +.flatpickr-time:after { + content: ""; + display: table; + clear: both; +} +.flatpickr-time .numInputWrapper { + -webkit-box-flex: 1; + -webkit-flex: 1; + -ms-flex: 1; + flex: 1; + width: 40%; + height: 40px; + float: left; +} +.flatpickr-time .numInputWrapper span.arrowUp:after { + border-bottom-color: #393939; +} +.flatpickr-time .numInputWrapper span.arrowDown:after { + border-top-color: #393939; +} +.flatpickr-time.hasSeconds .numInputWrapper { + width: 26%; +} +.flatpickr-time.time24hr .numInputWrapper { + width: 49%; +} +.flatpickr-time input { + background: transparent; + -webkit-box-shadow: none; + box-shadow: none; + border: 0; + border-radius: 0; + text-align: center; + margin: 0; + padding: 0; + height: inherit; + line-height: inherit; + color: #393939; + font-size: 14px; + position: relative; + -webkit-box-sizing: border-box; + box-sizing: border-box; + -webkit-appearance: textfield; + -moz-appearance: textfield; + appearance: textfield; +} +.flatpickr-time input.flatpickr-hour { + font-weight: bold; +} +.flatpickr-time input.flatpickr-minute, +.flatpickr-time input.flatpickr-second { + font-weight: 400; +} +.flatpickr-time input:focus { + outline: 0; + border: 0; +} +.flatpickr-time .flatpickr-time-separator, +.flatpickr-time .flatpickr-am-pm { + height: inherit; + float: left; + line-height: inherit; + color: #393939; + font-weight: bold; + width: 2%; + -webkit-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; + -webkit-align-self: center; + -ms-flex-item-align: center; + align-self: center; +} +.flatpickr-time .flatpickr-am-pm { + outline: 0; + width: 18%; + cursor: pointer; + text-align: center; + font-weight: 400; +} +.flatpickr-time input:hover, +.flatpickr-time .flatpickr-am-pm:hover, +.flatpickr-time input:focus, +.flatpickr-time .flatpickr-am-pm:focus { + background: #eee; +} +.flatpickr-input[readonly] { + cursor: pointer; +} +@-webkit-keyframes fpFadeInDown { + from { + opacity: 0; + -webkit-transform: translate3d(0, -20px, 0); + transform: translate3d(0, -20px, 0); + } + to { + opacity: 1; + -webkit-transform: translate3d(0, 0, 0); + transform: translate3d(0, 0, 0); + } +} +@keyframes fpFadeInDown { + from { + opacity: 0; + -webkit-transform: translate3d(0, -20px, 0); + transform: translate3d(0, -20px, 0); + } + to { + opacity: 1; + -webkit-transform: translate3d(0, 0, 0); + transform: translate3d(0, 0, 0); + } +} diff --git a/admin/js/vendors/flatpickr/flatpickr.js b/admin/js/vendors/flatpickr/flatpickr.js new file mode 100644 index 0000000..a94e6ac --- /dev/null +++ b/admin/js/vendors/flatpickr/flatpickr.js @@ -0,0 +1,2658 @@ +/* flatpickr v4.6.6, @license MIT */ +(function (global, factory) { + typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : + typeof define === 'function' && define.amd ? define(factory) : + (global = global || self, global.flatpickr = factory()); +}(this, (function () { 'use strict'; + + /*! ***************************************************************************** + Copyright (c) Microsoft Corporation. + + Permission to use, copy, modify, and/or distribute this software for any + purpose with or without fee is hereby granted. + + THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH + REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY + AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, + INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM + LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR + OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + PERFORMANCE OF THIS SOFTWARE. + ***************************************************************************** */ + + var __assign = function() { + __assign = Object.assign || function __assign(t) { + for (var s, i = 1, n = arguments.length; i < n; i++) { + s = arguments[i]; + for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; + } + return t; + }; + return __assign.apply(this, arguments); + }; + + function __spreadArrays() { + for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length; + for (var r = Array(s), k = 0, i = 0; i < il; i++) + for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) + r[k] = a[j]; + return r; + } + + var HOOKS = [ + "onChange", + "onClose", + "onDayCreate", + "onDestroy", + "onKeyDown", + "onMonthChange", + "onOpen", + "onParseConfig", + "onReady", + "onValueUpdate", + "onYearChange", + "onPreCalendarPosition", + ]; + var defaults = { + _disable: [], + _enable: [], + allowInput: false, + allowInvalidPreload: false, + altFormat: "F j, Y", + altInput: false, + altInputClass: "form-control input", + animate: typeof window === "object" && + window.navigator.userAgent.indexOf("MSIE") === -1, + ariaDateFormat: "F j, Y", + autoFillDefaultTime: true, + clickOpens: true, + closeOnSelect: true, + conjunction: ", ", + dateFormat: "Y-m-d", + defaultHour: 12, + defaultMinute: 0, + defaultSeconds: 0, + disable: [], + disableMobile: false, + enable: [], + enableSeconds: false, + enableTime: false, + errorHandler: function (err) { + return typeof console !== "undefined" && console.warn(err); + }, + getWeek: function (givenDate) { + var date = new Date(givenDate.getTime()); + date.setHours(0, 0, 0, 0); + // Thursday in current week decides the year. + date.setDate(date.getDate() + 3 - ((date.getDay() + 6) % 7)); + // January 4 is always in week 1. + var week1 = new Date(date.getFullYear(), 0, 4); + // Adjust to Thursday in week 1 and count number of weeks from date to week1. + return (1 + + Math.round(((date.getTime() - week1.getTime()) / 86400000 - + 3 + + ((week1.getDay() + 6) % 7)) / + 7)); + }, + hourIncrement: 1, + ignoredFocusElements: [], + inline: false, + locale: "default", + minuteIncrement: 5, + mode: "single", + monthSelectorType: "dropdown", + nextArrow: "", + noCalendar: false, + now: new Date(), + onChange: [], + onClose: [], + onDayCreate: [], + onDestroy: [], + onKeyDown: [], + onMonthChange: [], + onOpen: [], + onParseConfig: [], + onReady: [], + onValueUpdate: [], + onYearChange: [], + onPreCalendarPosition: [], + plugins: [], + position: "auto", + positionElement: undefined, + prevArrow: "", + shorthandCurrentMonth: false, + showMonths: 1, + static: false, + time_24hr: false, + weekNumbers: false, + wrap: false, + }; + + var english = { + weekdays: { + shorthand: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"], + longhand: [ + "Sunday", + "Monday", + "Tuesday", + "Wednesday", + "Thursday", + "Friday", + "Saturday", + ], + }, + months: { + shorthand: [ + "Jan", + "Feb", + "Mar", + "Apr", + "May", + "Jun", + "Jul", + "Aug", + "Sep", + "Oct", + "Nov", + "Dec", + ], + longhand: [ + "January", + "February", + "March", + "April", + "May", + "June", + "July", + "August", + "September", + "October", + "November", + "December", + ], + }, + daysInMonth: [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31], + firstDayOfWeek: 0, + ordinal: function (nth) { + var s = nth % 100; + if (s > 3 && s < 21) + return "th"; + switch (s % 10) { + case 1: + return "st"; + case 2: + return "nd"; + case 3: + return "rd"; + default: + return "th"; + } + }, + rangeSeparator: " to ", + weekAbbreviation: "Wk", + scrollTitle: "Scroll to increment", + toggleTitle: "Click to toggle", + amPM: ["AM", "PM"], + yearAriaLabel: "Year", + monthAriaLabel: "Month", + hourAriaLabel: "Hour", + minuteAriaLabel: "Minute", + time_24hr: false, + }; + + var pad = function (number, length) { + if (length === void 0) { length = 2; } + return ("000" + number).slice(length * -1); + }; + var int = function (bool) { return (bool === true ? 1 : 0); }; + /* istanbul ignore next */ + function debounce(func, wait, immediate) { + if (immediate === void 0) { immediate = false; } + var timeout; + return function () { + var context = this, args = arguments; + timeout !== null && clearTimeout(timeout); + timeout = window.setTimeout(function () { + timeout = null; + if (!immediate) + func.apply(context, args); + }, wait); + if (immediate && !timeout) + func.apply(context, args); + }; + } + var arrayify = function (obj) { + return obj instanceof Array ? obj : [obj]; + }; + + function toggleClass(elem, className, bool) { + if (bool === true) + return elem.classList.add(className); + elem.classList.remove(className); + } + function createElement(tag, className, content) { + var e = window.document.createElement(tag); + className = className || ""; + content = content || ""; + e.className = className; + if (content !== undefined) + e.textContent = content; + return e; + } + function clearNode(node) { + while (node.firstChild) + node.removeChild(node.firstChild); + } + function findParent(node, condition) { + if (condition(node)) + return node; + else if (node.parentNode) + return findParent(node.parentNode, condition); + return undefined; // nothing found + } + function createNumberInput(inputClassName, opts) { + var wrapper = createElement("div", "numInputWrapper"), numInput = createElement("input", "numInput " + inputClassName), arrowUp = createElement("span", "arrowUp"), arrowDown = createElement("span", "arrowDown"); + if (navigator.userAgent.indexOf("MSIE 9.0") === -1) { + numInput.type = "number"; + } + else { + numInput.type = "text"; + numInput.pattern = "\\d*"; + } + if (opts !== undefined) + for (var key in opts) + numInput.setAttribute(key, opts[key]); + wrapper.appendChild(numInput); + wrapper.appendChild(arrowUp); + wrapper.appendChild(arrowDown); + return wrapper; + } + function getEventTarget(event) { + try { + if (typeof event.composedPath === "function") { + var path = event.composedPath(); + return path[0]; + } + return event.target; + } + catch (error) { + return event.target; + } + } + + var doNothing = function () { return undefined; }; + var monthToStr = function (monthNumber, shorthand, locale) { return locale.months[shorthand ? "shorthand" : "longhand"][monthNumber]; }; + var revFormat = { + D: doNothing, + F: function (dateObj, monthName, locale) { + dateObj.setMonth(locale.months.longhand.indexOf(monthName)); + }, + G: function (dateObj, hour) { + dateObj.setHours(parseFloat(hour)); + }, + H: function (dateObj, hour) { + dateObj.setHours(parseFloat(hour)); + }, + J: function (dateObj, day) { + dateObj.setDate(parseFloat(day)); + }, + K: function (dateObj, amPM, locale) { + dateObj.setHours((dateObj.getHours() % 12) + + 12 * int(new RegExp(locale.amPM[1], "i").test(amPM))); + }, + M: function (dateObj, shortMonth, locale) { + dateObj.setMonth(locale.months.shorthand.indexOf(shortMonth)); + }, + S: function (dateObj, seconds) { + dateObj.setSeconds(parseFloat(seconds)); + }, + U: function (_, unixSeconds) { return new Date(parseFloat(unixSeconds) * 1000); }, + W: function (dateObj, weekNum, locale) { + var weekNumber = parseInt(weekNum); + var date = new Date(dateObj.getFullYear(), 0, 2 + (weekNumber - 1) * 7, 0, 0, 0, 0); + date.setDate(date.getDate() - date.getDay() + locale.firstDayOfWeek); + return date; + }, + Y: function (dateObj, year) { + dateObj.setFullYear(parseFloat(year)); + }, + Z: function (_, ISODate) { return new Date(ISODate); }, + d: function (dateObj, day) { + dateObj.setDate(parseFloat(day)); + }, + h: function (dateObj, hour) { + dateObj.setHours(parseFloat(hour)); + }, + i: function (dateObj, minutes) { + dateObj.setMinutes(parseFloat(minutes)); + }, + j: function (dateObj, day) { + dateObj.setDate(parseFloat(day)); + }, + l: doNothing, + m: function (dateObj, month) { + dateObj.setMonth(parseFloat(month) - 1); + }, + n: function (dateObj, month) { + dateObj.setMonth(parseFloat(month) - 1); + }, + s: function (dateObj, seconds) { + dateObj.setSeconds(parseFloat(seconds)); + }, + u: function (_, unixMillSeconds) { + return new Date(parseFloat(unixMillSeconds)); + }, + w: doNothing, + y: function (dateObj, year) { + dateObj.setFullYear(2000 + parseFloat(year)); + }, + }; + var tokenRegex = { + D: "(\\w+)", + F: "(\\w+)", + G: "(\\d\\d|\\d)", + H: "(\\d\\d|\\d)", + J: "(\\d\\d|\\d)\\w+", + K: "", + M: "(\\w+)", + S: "(\\d\\d|\\d)", + U: "(.+)", + W: "(\\d\\d|\\d)", + Y: "(\\d{4})", + Z: "(.+)", + d: "(\\d\\d|\\d)", + h: "(\\d\\d|\\d)", + i: "(\\d\\d|\\d)", + j: "(\\d\\d|\\d)", + l: "(\\w+)", + m: "(\\d\\d|\\d)", + n: "(\\d\\d|\\d)", + s: "(\\d\\d|\\d)", + u: "(.+)", + w: "(\\d\\d|\\d)", + y: "(\\d{2})", + }; + var formats = { + // get the date in UTC + Z: function (date) { return date.toISOString(); }, + // weekday name, short, e.g. Thu + D: function (date, locale, options) { + return locale.weekdays.shorthand[formats.w(date, locale, options)]; + }, + // full month name e.g. January + F: function (date, locale, options) { + return monthToStr(formats.n(date, locale, options) - 1, false, locale); + }, + // padded hour 1-12 + G: function (date, locale, options) { + return pad(formats.h(date, locale, options)); + }, + // hours with leading zero e.g. 03 + H: function (date) { return pad(date.getHours()); }, + // day (1-30) with ordinal suffix e.g. 1st, 2nd + J: function (date, locale) { + return locale.ordinal !== undefined + ? date.getDate() + locale.ordinal(date.getDate()) + : date.getDate(); + }, + // AM/PM + K: function (date, locale) { return locale.amPM[int(date.getHours() > 11)]; }, + // shorthand month e.g. Jan, Sep, Oct, etc + M: function (date, locale) { + return monthToStr(date.getMonth(), true, locale); + }, + // seconds 00-59 + S: function (date) { return pad(date.getSeconds()); }, + // unix timestamp + U: function (date) { return date.getTime() / 1000; }, + W: function (date, _, options) { + return options.getWeek(date); + }, + // full year e.g. 2016, padded (0001-9999) + Y: function (date) { return pad(date.getFullYear(), 4); }, + // day in month, padded (01-30) + d: function (date) { return pad(date.getDate()); }, + // hour from 1-12 (am/pm) + h: function (date) { return (date.getHours() % 12 ? date.getHours() % 12 : 12); }, + // minutes, padded with leading zero e.g. 09 + i: function (date) { return pad(date.getMinutes()); }, + // day in month (1-30) + j: function (date) { return date.getDate(); }, + // weekday name, full, e.g. Thursday + l: function (date, locale) { + return locale.weekdays.longhand[date.getDay()]; + }, + // padded month number (01-12) + m: function (date) { return pad(date.getMonth() + 1); }, + // the month number (1-12) + n: function (date) { return date.getMonth() + 1; }, + // seconds 0-59 + s: function (date) { return date.getSeconds(); }, + // Unix Milliseconds + u: function (date) { return date.getTime(); }, + // number of the day of the week + w: function (date) { return date.getDay(); }, + // last two digits of year e.g. 16 for 2016 + y: function (date) { return String(date.getFullYear()).substring(2); }, + }; + + var createDateFormatter = function (_a) { + var _b = _a.config, config = _b === void 0 ? defaults : _b, _c = _a.l10n, l10n = _c === void 0 ? english : _c, _d = _a.isMobile, isMobile = _d === void 0 ? false : _d; + return function (dateObj, frmt, overrideLocale) { + var locale = overrideLocale || l10n; + if (config.formatDate !== undefined && !isMobile) { + return config.formatDate(dateObj, frmt, locale); + } + return frmt + .split("") + .map(function (c, i, arr) { + return formats[c] && arr[i - 1] !== "\\" + ? formats[c](dateObj, locale, config) + : c !== "\\" + ? c + : ""; + }) + .join(""); + }; + }; + var createDateParser = function (_a) { + var _b = _a.config, config = _b === void 0 ? defaults : _b, _c = _a.l10n, l10n = _c === void 0 ? english : _c; + return function (date, givenFormat, timeless, customLocale) { + if (date !== 0 && !date) + return undefined; + var locale = customLocale || l10n; + var parsedDate; + var dateOrig = date; + if (date instanceof Date) + parsedDate = new Date(date.getTime()); + else if (typeof date !== "string" && + date.toFixed !== undefined // timestamp + ) + // create a copy + parsedDate = new Date(date); + else if (typeof date === "string") { + // date string + var format = givenFormat || (config || defaults).dateFormat; + var datestr = String(date).trim(); + if (datestr === "today") { + parsedDate = new Date(); + timeless = true; + } + else if (/Z$/.test(datestr) || + /GMT$/.test(datestr) // datestrings w/ timezone + ) + parsedDate = new Date(date); + else if (config && config.parseDate) + parsedDate = config.parseDate(date, format); + else { + parsedDate = + !config || !config.noCalendar + ? new Date(new Date().getFullYear(), 0, 1, 0, 0, 0, 0) + : new Date(new Date().setHours(0, 0, 0, 0)); + var matched = void 0, ops = []; + for (var i = 0, matchIndex = 0, regexStr = ""; i < format.length; i++) { + var token_1 = format[i]; + var isBackSlash = token_1 === "\\"; + var escaped = format[i - 1] === "\\" || isBackSlash; + if (tokenRegex[token_1] && !escaped) { + regexStr += tokenRegex[token_1]; + var match = new RegExp(regexStr).exec(date); + if (match && (matched = true)) { + ops[token_1 !== "Y" ? "push" : "unshift"]({ + fn: revFormat[token_1], + val: match[++matchIndex], + }); + } + } + else if (!isBackSlash) + regexStr += "."; // don't really care + ops.forEach(function (_a) { + var fn = _a.fn, val = _a.val; + return (parsedDate = fn(parsedDate, val, locale) || parsedDate); + }); + } + parsedDate = matched ? parsedDate : undefined; + } + } + /* istanbul ignore next */ + if (!(parsedDate instanceof Date && !isNaN(parsedDate.getTime()))) { + config.errorHandler(new Error("Invalid date provided: " + dateOrig)); + return undefined; + } + if (timeless === true) + parsedDate.setHours(0, 0, 0, 0); + return parsedDate; + }; + }; + /** + * Compute the difference in dates, measured in ms + */ + function compareDates(date1, date2, timeless) { + if (timeless === void 0) { timeless = true; } + if (timeless !== false) { + return (new Date(date1.getTime()).setHours(0, 0, 0, 0) - + new Date(date2.getTime()).setHours(0, 0, 0, 0)); + } + return date1.getTime() - date2.getTime(); + } + var isBetween = function (ts, ts1, ts2) { + return ts > Math.min(ts1, ts2) && ts < Math.max(ts1, ts2); + }; + var duration = { + DAY: 86400000, + }; + + if (typeof Object.assign !== "function") { + Object.assign = function (target) { + var args = []; + for (var _i = 1; _i < arguments.length; _i++) { + args[_i - 1] = arguments[_i]; + } + if (!target) { + throw TypeError("Cannot convert undefined or null to object"); + } + var _loop_1 = function (source) { + if (source) { + Object.keys(source).forEach(function (key) { return (target[key] = source[key]); }); + } + }; + for (var _a = 0, args_1 = args; _a < args_1.length; _a++) { + var source = args_1[_a]; + _loop_1(source); + } + return target; + }; + } + + var DEBOUNCED_CHANGE_MS = 300; + function FlatpickrInstance(element, instanceConfig) { + var self = { + config: __assign(__assign({}, defaults), flatpickr.defaultConfig), + l10n: english, + }; + self.parseDate = createDateParser({ config: self.config, l10n: self.l10n }); + self._handlers = []; + self.pluginElements = []; + self.loadedPlugins = []; + self._bind = bind; + self._setHoursFromDate = setHoursFromDate; + self._positionCalendar = positionCalendar; + self.changeMonth = changeMonth; + self.changeYear = changeYear; + self.clear = clear; + self.close = close; + self._createElement = createElement; + self.destroy = destroy; + self.isEnabled = isEnabled; + self.jumpToDate = jumpToDate; + self.open = open; + self.redraw = redraw; + self.set = set; + self.setDate = setDate; + self.toggle = toggle; + function setupHelperFunctions() { + self.utils = { + getDaysInMonth: function (month, yr) { + if (month === void 0) { month = self.currentMonth; } + if (yr === void 0) { yr = self.currentYear; } + if (month === 1 && ((yr % 4 === 0 && yr % 100 !== 0) || yr % 400 === 0)) + return 29; + return self.l10n.daysInMonth[month]; + }, + }; + } + function init() { + self.element = self.input = element; + self.isOpen = false; + parseConfig(); + setupLocale(); + setupInputs(); + setupDates(); + setupHelperFunctions(); + if (!self.isMobile) + build(); + bindEvents(); + if (self.selectedDates.length || self.config.noCalendar) { + if (self.config.enableTime) { + setHoursFromDate(self.config.noCalendar + ? self.latestSelectedDateObj || self.config.minDate + : undefined); + } + updateValue(false); + } + setCalendarWidth(); + var isSafari = /^((?!chrome|android).)*safari/i.test(navigator.userAgent); + /* TODO: investigate this further + + Currently, there is weird positioning behavior in safari causing pages + to scroll up. https://github.com/chmln/flatpickr/issues/563 + + However, most browsers are not Safari and positioning is expensive when used + in scale. https://github.com/chmln/flatpickr/issues/1096 + */ + if (!self.isMobile && isSafari) { + positionCalendar(); + } + triggerEvent("onReady"); + } + function bindToInstance(fn) { + return fn.bind(self); + } + function setCalendarWidth() { + var config = self.config; + if (config.weekNumbers === false && config.showMonths === 1) { + return; + } + else if (config.noCalendar !== true) { + window.requestAnimationFrame(function () { + if (self.calendarContainer !== undefined) { + self.calendarContainer.style.visibility = "hidden"; + self.calendarContainer.style.display = "block"; + } + if (self.daysContainer !== undefined) { + var daysWidth = (self.days.offsetWidth + 1) * config.showMonths; + self.daysContainer.style.width = daysWidth + "px"; + self.calendarContainer.style.width = + daysWidth + + (self.weekWrapper !== undefined + ? self.weekWrapper.offsetWidth + : 0) + + "px"; + self.calendarContainer.style.removeProperty("visibility"); + self.calendarContainer.style.removeProperty("display"); + } + }); + } + } + /** + * The handler for all events targeting the time inputs + */ + function updateTime(e) { + if (self.selectedDates.length === 0) { + var defaultDate = self.config.minDate !== undefined + ? new Date(self.config.minDate.getTime()) + : new Date(); + var _a = getDefaultHours(), hours = _a.hours, minutes = _a.minutes, seconds = _a.seconds; + defaultDate.setHours(hours, minutes, seconds, 0); + self.setDate(defaultDate, false); + } + if (e !== undefined && e.type !== "blur") { + timeWrapper(e); + } + var prevValue = self._input.value; + setHoursFromInputs(); + updateValue(); + if (self._input.value !== prevValue) { + self._debouncedChange(); + } + } + function ampm2military(hour, amPM) { + return (hour % 12) + 12 * int(amPM === self.l10n.amPM[1]); + } + function military2ampm(hour) { + switch (hour % 24) { + case 0: + case 12: + return 12; + default: + return hour % 12; + } + } + /** + * Syncs the selected date object time with user's time input + */ + function setHoursFromInputs() { + if (self.hourElement === undefined || self.minuteElement === undefined) + return; + var hours = (parseInt(self.hourElement.value.slice(-2), 10) || 0) % 24, minutes = (parseInt(self.minuteElement.value, 10) || 0) % 60, seconds = self.secondElement !== undefined + ? (parseInt(self.secondElement.value, 10) || 0) % 60 + : 0; + if (self.amPM !== undefined) { + hours = ampm2military(hours, self.amPM.textContent); + } + var limitMinHours = self.config.minTime !== undefined || + (self.config.minDate && + self.minDateHasTime && + self.latestSelectedDateObj && + compareDates(self.latestSelectedDateObj, self.config.minDate, true) === + 0); + var limitMaxHours = self.config.maxTime !== undefined || + (self.config.maxDate && + self.maxDateHasTime && + self.latestSelectedDateObj && + compareDates(self.latestSelectedDateObj, self.config.maxDate, true) === + 0); + if (limitMaxHours) { + var maxTime = self.config.maxTime !== undefined + ? self.config.maxTime + : self.config.maxDate; + hours = Math.min(hours, maxTime.getHours()); + if (hours === maxTime.getHours()) + minutes = Math.min(minutes, maxTime.getMinutes()); + if (minutes === maxTime.getMinutes()) + seconds = Math.min(seconds, maxTime.getSeconds()); + } + if (limitMinHours) { + var minTime = self.config.minTime !== undefined + ? self.config.minTime + : self.config.minDate; + hours = Math.max(hours, minTime.getHours()); + if (hours === minTime.getHours()) + minutes = Math.max(minutes, minTime.getMinutes()); + if (minutes === minTime.getMinutes()) + seconds = Math.max(seconds, minTime.getSeconds()); + } + setHours(hours, minutes, seconds); + } + /** + * Syncs time input values with a date + */ + function setHoursFromDate(dateObj) { + var date = dateObj || self.latestSelectedDateObj; + if (date) { + setHours(date.getHours(), date.getMinutes(), date.getSeconds()); + } + } + function getDefaultHours() { + var hours = self.config.defaultHour; + var minutes = self.config.defaultMinute; + var seconds = self.config.defaultSeconds; + if (self.config.minDate !== undefined) { + var minHr = self.config.minDate.getHours(); + var minMinutes = self.config.minDate.getMinutes(); + hours = Math.max(hours, minHr); + if (hours === minHr) + minutes = Math.max(minMinutes, minutes); + if (hours === minHr && minutes === minMinutes) + seconds = self.config.minDate.getSeconds(); + } + if (self.config.maxDate !== undefined) { + var maxHr = self.config.maxDate.getHours(); + var maxMinutes = self.config.maxDate.getMinutes(); + hours = Math.min(hours, maxHr); + if (hours === maxHr) + minutes = Math.min(maxMinutes, minutes); + if (hours === maxHr && minutes === maxMinutes) + seconds = self.config.maxDate.getSeconds(); + } + return { hours: hours, minutes: minutes, seconds: seconds }; + } + /** + * Sets the hours, minutes, and optionally seconds + * of the latest selected date object and the + * corresponding time inputs + * @param {Number} hours the hour. whether its military + * or am-pm gets inferred from config + * @param {Number} minutes the minutes + * @param {Number} seconds the seconds (optional) + */ + function setHours(hours, minutes, seconds) { + if (self.latestSelectedDateObj !== undefined) { + self.latestSelectedDateObj.setHours(hours % 24, minutes, seconds || 0, 0); + } + if (!self.hourElement || !self.minuteElement || self.isMobile) + return; + self.hourElement.value = pad(!self.config.time_24hr + ? ((12 + hours) % 12) + 12 * int(hours % 12 === 0) + : hours); + self.minuteElement.value = pad(minutes); + if (self.amPM !== undefined) + self.amPM.textContent = self.l10n.amPM[int(hours >= 12)]; + if (self.secondElement !== undefined) + self.secondElement.value = pad(seconds); + } + /** + * Handles the year input and incrementing events + * @param {Event} event the keyup or increment event + */ + function onYearInput(event) { + var eventTarget = getEventTarget(event); + var year = parseInt(eventTarget.value) + (event.delta || 0); + if (year / 1000 > 1 || + (event.key === "Enter" && !/[^\d]/.test(year.toString()))) { + changeYear(year); + } + } + /** + * Essentially addEventListener + tracking + * @param {Element} element the element to addEventListener to + * @param {String} event the event name + * @param {Function} handler the event handler + */ + function bind(element, event, handler, options) { + if (event instanceof Array) + return event.forEach(function (ev) { return bind(element, ev, handler, options); }); + if (element instanceof Array) + return element.forEach(function (el) { return bind(el, event, handler, options); }); + element.addEventListener(event, handler, options); + self._handlers.push({ + element: element, + event: event, + handler: handler, + options: options, + }); + } + function triggerChange() { + triggerEvent("onChange"); + } + /** + * Adds all the necessary event listeners + */ + function bindEvents() { + if (self.config.wrap) { + ["open", "close", "toggle", "clear"].forEach(function (evt) { + Array.prototype.forEach.call(self.element.querySelectorAll("[data-" + evt + "]"), function (el) { + return bind(el, "click", self[evt]); + }); + }); + } + if (self.isMobile) { + setupMobile(); + return; + } + var debouncedResize = debounce(onResize, 50); + self._debouncedChange = debounce(triggerChange, DEBOUNCED_CHANGE_MS); + if (self.daysContainer && !/iPhone|iPad|iPod/i.test(navigator.userAgent)) + bind(self.daysContainer, "mouseover", function (e) { + if (self.config.mode === "range") + onMouseOver(getEventTarget(e)); + }); + bind(window.document.body, "keydown", onKeyDown); + if (!self.config.inline && !self.config.static) + bind(window, "resize", debouncedResize); + if (window.ontouchstart !== undefined) + bind(window.document, "touchstart", documentClick); + else + bind(window.document, "click", documentClick); + bind(window.document, "focus", documentClick, { capture: true }); + if (self.config.clickOpens === true) { + bind(self._input, "focus", self.open); + bind(self._input, "click", self.open); + } + if (self.daysContainer !== undefined) { + bind(self.monthNav, "click", onMonthNavClick); + bind(self.monthNav, ["keyup", "increment"], onYearInput); + bind(self.daysContainer, "click", selectDate); + } + if (self.timeContainer !== undefined && + self.minuteElement !== undefined && + self.hourElement !== undefined) { + var selText = function (e) { + return getEventTarget(e).select(); + }; + bind(self.timeContainer, ["increment"], updateTime); + bind(self.timeContainer, "blur", updateTime, { capture: true }); + bind(self.timeContainer, "click", timeIncrement); + bind([self.hourElement, self.minuteElement], ["focus", "click"], selText); + if (self.secondElement !== undefined) + bind(self.secondElement, "focus", function () { return self.secondElement && self.secondElement.select(); }); + if (self.amPM !== undefined) { + bind(self.amPM, "click", function (e) { + updateTime(e); + triggerChange(); + }); + } + } + if (self.config.allowInput) + bind(self._input, "blur", onBlur); + } + /** + * Set the calendar view to a particular date. + * @param {Date} jumpDate the date to set the view to + * @param {boolean} triggerChange if change events should be triggered + */ + function jumpToDate(jumpDate, triggerChange) { + var jumpTo = jumpDate !== undefined + ? self.parseDate(jumpDate) + : self.latestSelectedDateObj || + (self.config.minDate && self.config.minDate > self.now + ? self.config.minDate + : self.config.maxDate && self.config.maxDate < self.now + ? self.config.maxDate + : self.now); + var oldYear = self.currentYear; + var oldMonth = self.currentMonth; + try { + if (jumpTo !== undefined) { + self.currentYear = jumpTo.getFullYear(); + self.currentMonth = jumpTo.getMonth(); + } + } + catch (e) { + /* istanbul ignore next */ + e.message = "Invalid date supplied: " + jumpTo; + self.config.errorHandler(e); + } + if (triggerChange && self.currentYear !== oldYear) { + triggerEvent("onYearChange"); + buildMonthSwitch(); + } + if (triggerChange && + (self.currentYear !== oldYear || self.currentMonth !== oldMonth)) { + triggerEvent("onMonthChange"); + } + self.redraw(); + } + /** + * The up/down arrow handler for time inputs + * @param {Event} e the click event + */ + function timeIncrement(e) { + var eventTarget = getEventTarget(e); + if (~eventTarget.className.indexOf("arrow")) + incrementNumInput(e, eventTarget.classList.contains("arrowUp") ? 1 : -1); + } + /** + * Increments/decrements the value of input associ- + * ated with the up/down arrow by dispatching an + * "increment" event on the input. + * + * @param {Event} e the click event + * @param {Number} delta the diff (usually 1 or -1) + * @param {Element} inputElem the input element + */ + function incrementNumInput(e, delta, inputElem) { + var target = e && getEventTarget(e); + var input = inputElem || + (target && target.parentNode && target.parentNode.firstChild); + var event = createEvent("increment"); + event.delta = delta; + input && input.dispatchEvent(event); + } + function build() { + var fragment = window.document.createDocumentFragment(); + self.calendarContainer = createElement("div", "flatpickr-calendar"); + self.calendarContainer.tabIndex = -1; + if (!self.config.noCalendar) { + fragment.appendChild(buildMonthNav()); + self.innerContainer = createElement("div", "flatpickr-innerContainer"); + if (self.config.weekNumbers) { + var _a = buildWeeks(), weekWrapper = _a.weekWrapper, weekNumbers = _a.weekNumbers; + self.innerContainer.appendChild(weekWrapper); + self.weekNumbers = weekNumbers; + self.weekWrapper = weekWrapper; + } + self.rContainer = createElement("div", "flatpickr-rContainer"); + self.rContainer.appendChild(buildWeekdays()); + if (!self.daysContainer) { + self.daysContainer = createElement("div", "flatpickr-days"); + self.daysContainer.tabIndex = -1; + } + buildDays(); + self.rContainer.appendChild(self.daysContainer); + self.innerContainer.appendChild(self.rContainer); + fragment.appendChild(self.innerContainer); + } + if (self.config.enableTime) { + fragment.appendChild(buildTime()); + } + toggleClass(self.calendarContainer, "rangeMode", self.config.mode === "range"); + toggleClass(self.calendarContainer, "animate", self.config.animate === true); + toggleClass(self.calendarContainer, "multiMonth", self.config.showMonths > 1); + self.calendarContainer.appendChild(fragment); + var customAppend = self.config.appendTo !== undefined && + self.config.appendTo.nodeType !== undefined; + if (self.config.inline || self.config.static) { + self.calendarContainer.classList.add(self.config.inline ? "inline" : "static"); + if (self.config.inline) { + if (!customAppend && self.element.parentNode) + self.element.parentNode.insertBefore(self.calendarContainer, self._input.nextSibling); + else if (self.config.appendTo !== undefined) + self.config.appendTo.appendChild(self.calendarContainer); + } + if (self.config.static) { + var wrapper = createElement("div", "flatpickr-wrapper"); + if (self.element.parentNode) + self.element.parentNode.insertBefore(wrapper, self.element); + wrapper.appendChild(self.element); + if (self.altInput) + wrapper.appendChild(self.altInput); + wrapper.appendChild(self.calendarContainer); + } + } + if (!self.config.static && !self.config.inline) + (self.config.appendTo !== undefined + ? self.config.appendTo + : window.document.body).appendChild(self.calendarContainer); + } + function createDay(className, date, dayNumber, i) { + var dateIsEnabled = isEnabled(date, true), dayElement = createElement("span", "flatpickr-day " + className, date.getDate().toString()); + dayElement.dateObj = date; + dayElement.$i = i; + dayElement.setAttribute("aria-label", self.formatDate(date, self.config.ariaDateFormat)); + if (className.indexOf("hidden") === -1 && + compareDates(date, self.now) === 0) { + self.todayDateElem = dayElement; + dayElement.classList.add("today"); + dayElement.setAttribute("aria-current", "date"); + } + if (dateIsEnabled) { + dayElement.tabIndex = -1; + if (isDateSelected(date)) { + dayElement.classList.add("selected"); + self.selectedDateElem = dayElement; + if (self.config.mode === "range") { + toggleClass(dayElement, "startRange", self.selectedDates[0] && + compareDates(date, self.selectedDates[0], true) === 0); + toggleClass(dayElement, "endRange", self.selectedDates[1] && + compareDates(date, self.selectedDates[1], true) === 0); + if (className === "nextMonthDay") + dayElement.classList.add("inRange"); + } + } + } + else { + dayElement.classList.add("flatpickr-disabled"); + } + if (self.config.mode === "range") { + if (isDateInRange(date) && !isDateSelected(date)) + dayElement.classList.add("inRange"); + } + if (self.weekNumbers && + self.config.showMonths === 1 && + className !== "prevMonthDay" && + dayNumber % 7 === 1) { + self.weekNumbers.insertAdjacentHTML("beforeend", "" + self.config.getWeek(date) + ""); + } + triggerEvent("onDayCreate", dayElement); + return dayElement; + } + function focusOnDayElem(targetNode) { + targetNode.focus(); + if (self.config.mode === "range") + onMouseOver(targetNode); + } + function getFirstAvailableDay(delta) { + var startMonth = delta > 0 ? 0 : self.config.showMonths - 1; + var endMonth = delta > 0 ? self.config.showMonths : -1; + for (var m = startMonth; m != endMonth; m += delta) { + var month = self.daysContainer.children[m]; + var startIndex = delta > 0 ? 0 : month.children.length - 1; + var endIndex = delta > 0 ? month.children.length : -1; + for (var i = startIndex; i != endIndex; i += delta) { + var c = month.children[i]; + if (c.className.indexOf("hidden") === -1 && isEnabled(c.dateObj)) + return c; + } + } + return undefined; + } + function getNextAvailableDay(current, delta) { + var givenMonth = current.className.indexOf("Month") === -1 + ? current.dateObj.getMonth() + : self.currentMonth; + var endMonth = delta > 0 ? self.config.showMonths : -1; + var loopDelta = delta > 0 ? 1 : -1; + for (var m = givenMonth - self.currentMonth; m != endMonth; m += loopDelta) { + var month = self.daysContainer.children[m]; + var startIndex = givenMonth - self.currentMonth === m + ? current.$i + delta + : delta < 0 + ? month.children.length - 1 + : 0; + var numMonthDays = month.children.length; + for (var i = startIndex; i >= 0 && i < numMonthDays && i != (delta > 0 ? numMonthDays : -1); i += loopDelta) { + var c = month.children[i]; + if (c.className.indexOf("hidden") === -1 && + isEnabled(c.dateObj) && + Math.abs(current.$i - i) >= Math.abs(delta)) + return focusOnDayElem(c); + } + } + self.changeMonth(loopDelta); + focusOnDay(getFirstAvailableDay(loopDelta), 0); + return undefined; + } + function focusOnDay(current, offset) { + var dayFocused = isInView(document.activeElement || document.body); + var startElem = current !== undefined + ? current + : dayFocused + ? document.activeElement + : self.selectedDateElem !== undefined && isInView(self.selectedDateElem) + ? self.selectedDateElem + : self.todayDateElem !== undefined && isInView(self.todayDateElem) + ? self.todayDateElem + : getFirstAvailableDay(offset > 0 ? 1 : -1); + if (startElem === undefined) { + self._input.focus(); + } + else if (!dayFocused) { + focusOnDayElem(startElem); + } + else { + getNextAvailableDay(startElem, offset); + } + } + function buildMonthDays(year, month) { + var firstOfMonth = (new Date(year, month, 1).getDay() - self.l10n.firstDayOfWeek + 7) % 7; + var prevMonthDays = self.utils.getDaysInMonth((month - 1 + 12) % 12, year); + var daysInMonth = self.utils.getDaysInMonth(month, year), days = window.document.createDocumentFragment(), isMultiMonth = self.config.showMonths > 1, prevMonthDayClass = isMultiMonth ? "prevMonthDay hidden" : "prevMonthDay", nextMonthDayClass = isMultiMonth ? "nextMonthDay hidden" : "nextMonthDay"; + var dayNumber = prevMonthDays + 1 - firstOfMonth, dayIndex = 0; + // prepend days from the ending of previous month + for (; dayNumber <= prevMonthDays; dayNumber++, dayIndex++) { + days.appendChild(createDay(prevMonthDayClass, new Date(year, month - 1, dayNumber), dayNumber, dayIndex)); + } + // Start at 1 since there is no 0th day + for (dayNumber = 1; dayNumber <= daysInMonth; dayNumber++, dayIndex++) { + days.appendChild(createDay("", new Date(year, month, dayNumber), dayNumber, dayIndex)); + } + // append days from the next month + for (var dayNum = daysInMonth + 1; dayNum <= 42 - firstOfMonth && + (self.config.showMonths === 1 || dayIndex % 7 !== 0); dayNum++, dayIndex++) { + days.appendChild(createDay(nextMonthDayClass, new Date(year, month + 1, dayNum % daysInMonth), dayNum, dayIndex)); + } + //updateNavigationCurrentMonth(); + var dayContainer = createElement("div", "dayContainer"); + dayContainer.appendChild(days); + return dayContainer; + } + function buildDays() { + if (self.daysContainer === undefined) { + return; + } + clearNode(self.daysContainer); + // TODO: week numbers for each month + if (self.weekNumbers) + clearNode(self.weekNumbers); + var frag = document.createDocumentFragment(); + for (var i = 0; i < self.config.showMonths; i++) { + var d = new Date(self.currentYear, self.currentMonth, 1); + d.setMonth(self.currentMonth + i); + frag.appendChild(buildMonthDays(d.getFullYear(), d.getMonth())); + } + self.daysContainer.appendChild(frag); + self.days = self.daysContainer.firstChild; + if (self.config.mode === "range" && self.selectedDates.length === 1) { + onMouseOver(); + } + } + function buildMonthSwitch() { + if (self.config.showMonths > 1 || + self.config.monthSelectorType !== "dropdown") + return; + var shouldBuildMonth = function (month) { + if (self.config.minDate !== undefined && + self.currentYear === self.config.minDate.getFullYear() && + month < self.config.minDate.getMonth()) { + return false; + } + return !(self.config.maxDate !== undefined && + self.currentYear === self.config.maxDate.getFullYear() && + month > self.config.maxDate.getMonth()); + }; + self.monthsDropdownContainer.tabIndex = -1; + self.monthsDropdownContainer.innerHTML = ""; + for (var i = 0; i < 12; i++) { + if (!shouldBuildMonth(i)) + continue; + var month = createElement("option", "flatpickr-monthDropdown-month"); + month.value = new Date(self.currentYear, i).getMonth().toString(); + month.textContent = monthToStr(i, self.config.shorthandCurrentMonth, self.l10n); + month.tabIndex = -1; + if (self.currentMonth === i) { + month.selected = true; + } + self.monthsDropdownContainer.appendChild(month); + } + } + function buildMonth() { + var container = createElement("div", "flatpickr-month"); + var monthNavFragment = window.document.createDocumentFragment(); + var monthElement; + if (self.config.showMonths > 1 || + self.config.monthSelectorType === "static") { + monthElement = createElement("span", "cur-month"); + } + else { + self.monthsDropdownContainer = createElement("select", "flatpickr-monthDropdown-months"); + self.monthsDropdownContainer.setAttribute("aria-label", self.l10n.monthAriaLabel); + bind(self.monthsDropdownContainer, "change", function (e) { + var target = getEventTarget(e); + var selectedMonth = parseInt(target.value, 10); + self.changeMonth(selectedMonth - self.currentMonth); + triggerEvent("onMonthChange"); + }); + buildMonthSwitch(); + monthElement = self.monthsDropdownContainer; + } + var yearInput = createNumberInput("cur-year", { tabindex: "-1" }); + var yearElement = yearInput.getElementsByTagName("input")[0]; + yearElement.setAttribute("aria-label", self.l10n.yearAriaLabel); + if (self.config.minDate) { + yearElement.setAttribute("min", self.config.minDate.getFullYear().toString()); + } + if (self.config.maxDate) { + yearElement.setAttribute("max", self.config.maxDate.getFullYear().toString()); + yearElement.disabled = + !!self.config.minDate && + self.config.minDate.getFullYear() === self.config.maxDate.getFullYear(); + } + var currentMonth = createElement("div", "flatpickr-current-month"); + currentMonth.appendChild(monthElement); + currentMonth.appendChild(yearInput); + monthNavFragment.appendChild(currentMonth); + container.appendChild(monthNavFragment); + return { + container: container, + yearElement: yearElement, + monthElement: monthElement, + }; + } + function buildMonths() { + clearNode(self.monthNav); + self.monthNav.appendChild(self.prevMonthNav); + if (self.config.showMonths) { + self.yearElements = []; + self.monthElements = []; + } + for (var m = self.config.showMonths; m--;) { + var month = buildMonth(); + self.yearElements.push(month.yearElement); + self.monthElements.push(month.monthElement); + self.monthNav.appendChild(month.container); + } + self.monthNav.appendChild(self.nextMonthNav); + } + function buildMonthNav() { + self.monthNav = createElement("div", "flatpickr-months"); + self.yearElements = []; + self.monthElements = []; + self.prevMonthNav = createElement("span", "flatpickr-prev-month"); + self.prevMonthNav.innerHTML = self.config.prevArrow; + self.nextMonthNav = createElement("span", "flatpickr-next-month"); + self.nextMonthNav.innerHTML = self.config.nextArrow; + buildMonths(); + Object.defineProperty(self, "_hidePrevMonthArrow", { + get: function () { return self.__hidePrevMonthArrow; }, + set: function (bool) { + if (self.__hidePrevMonthArrow !== bool) { + toggleClass(self.prevMonthNav, "flatpickr-disabled", bool); + self.__hidePrevMonthArrow = bool; + } + }, + }); + Object.defineProperty(self, "_hideNextMonthArrow", { + get: function () { return self.__hideNextMonthArrow; }, + set: function (bool) { + if (self.__hideNextMonthArrow !== bool) { + toggleClass(self.nextMonthNav, "flatpickr-disabled", bool); + self.__hideNextMonthArrow = bool; + } + }, + }); + self.currentYearElement = self.yearElements[0]; + updateNavigationCurrentMonth(); + return self.monthNav; + } + function buildTime() { + self.calendarContainer.classList.add("hasTime"); + if (self.config.noCalendar) + self.calendarContainer.classList.add("noCalendar"); + self.timeContainer = createElement("div", "flatpickr-time"); + self.timeContainer.tabIndex = -1; + var separator = createElement("span", "flatpickr-time-separator", ":"); + var hourInput = createNumberInput("flatpickr-hour", { + "aria-label": self.l10n.hourAriaLabel, + }); + self.hourElement = hourInput.getElementsByTagName("input")[0]; + var minuteInput = createNumberInput("flatpickr-minute", { + "aria-label": self.l10n.minuteAriaLabel, + }); + self.minuteElement = minuteInput.getElementsByTagName("input")[0]; + self.hourElement.tabIndex = self.minuteElement.tabIndex = -1; + self.hourElement.value = pad(self.latestSelectedDateObj + ? self.latestSelectedDateObj.getHours() + : self.config.time_24hr + ? self.config.defaultHour + : military2ampm(self.config.defaultHour)); + self.minuteElement.value = pad(self.latestSelectedDateObj + ? self.latestSelectedDateObj.getMinutes() + : self.config.defaultMinute); + self.hourElement.setAttribute("step", self.config.hourIncrement.toString()); + self.minuteElement.setAttribute("step", self.config.minuteIncrement.toString()); + self.hourElement.setAttribute("min", self.config.time_24hr ? "0" : "1"); + self.hourElement.setAttribute("max", self.config.time_24hr ? "23" : "12"); + self.minuteElement.setAttribute("min", "0"); + self.minuteElement.setAttribute("max", "59"); + self.timeContainer.appendChild(hourInput); + self.timeContainer.appendChild(separator); + self.timeContainer.appendChild(minuteInput); + if (self.config.time_24hr) + self.timeContainer.classList.add("time24hr"); + if (self.config.enableSeconds) { + self.timeContainer.classList.add("hasSeconds"); + var secondInput = createNumberInput("flatpickr-second"); + self.secondElement = secondInput.getElementsByTagName("input")[0]; + self.secondElement.value = pad(self.latestSelectedDateObj + ? self.latestSelectedDateObj.getSeconds() + : self.config.defaultSeconds); + self.secondElement.setAttribute("step", self.minuteElement.getAttribute("step")); + self.secondElement.setAttribute("min", "0"); + self.secondElement.setAttribute("max", "59"); + self.timeContainer.appendChild(createElement("span", "flatpickr-time-separator", ":")); + self.timeContainer.appendChild(secondInput); + } + if (!self.config.time_24hr) { + // add self.amPM if appropriate + self.amPM = createElement("span", "flatpickr-am-pm", self.l10n.amPM[int((self.latestSelectedDateObj + ? self.hourElement.value + : self.config.defaultHour) > 11)]); + self.amPM.title = self.l10n.toggleTitle; + self.amPM.tabIndex = -1; + self.timeContainer.appendChild(self.amPM); + } + return self.timeContainer; + } + function buildWeekdays() { + if (!self.weekdayContainer) + self.weekdayContainer = createElement("div", "flatpickr-weekdays"); + else + clearNode(self.weekdayContainer); + for (var i = self.config.showMonths; i--;) { + var container = createElement("div", "flatpickr-weekdaycontainer"); + self.weekdayContainer.appendChild(container); + } + updateWeekdays(); + return self.weekdayContainer; + } + function updateWeekdays() { + if (!self.weekdayContainer) { + return; + } + var firstDayOfWeek = self.l10n.firstDayOfWeek; + var weekdays = __spreadArrays(self.l10n.weekdays.shorthand); + if (firstDayOfWeek > 0 && firstDayOfWeek < weekdays.length) { + weekdays = __spreadArrays(weekdays.splice(firstDayOfWeek, weekdays.length), weekdays.splice(0, firstDayOfWeek)); + } + for (var i = self.config.showMonths; i--;) { + self.weekdayContainer.children[i].innerHTML = "\n \n " + weekdays.join("") + "\n \n "; + } + } + /* istanbul ignore next */ + function buildWeeks() { + self.calendarContainer.classList.add("hasWeeks"); + var weekWrapper = createElement("div", "flatpickr-weekwrapper"); + weekWrapper.appendChild(createElement("span", "flatpickr-weekday", self.l10n.weekAbbreviation)); + var weekNumbers = createElement("div", "flatpickr-weeks"); + weekWrapper.appendChild(weekNumbers); + return { + weekWrapper: weekWrapper, + weekNumbers: weekNumbers, + }; + } + function changeMonth(value, isOffset) { + if (isOffset === void 0) { isOffset = true; } + var delta = isOffset ? value : value - self.currentMonth; + if ((delta < 0 && self._hidePrevMonthArrow === true) || + (delta > 0 && self._hideNextMonthArrow === true)) + return; + self.currentMonth += delta; + if (self.currentMonth < 0 || self.currentMonth > 11) { + self.currentYear += self.currentMonth > 11 ? 1 : -1; + self.currentMonth = (self.currentMonth + 12) % 12; + triggerEvent("onYearChange"); + buildMonthSwitch(); + } + buildDays(); + triggerEvent("onMonthChange"); + updateNavigationCurrentMonth(); + } + function clear(triggerChangeEvent, toInitial) { + if (triggerChangeEvent === void 0) { triggerChangeEvent = true; } + if (toInitial === void 0) { toInitial = true; } + self.input.value = ""; + if (self.altInput !== undefined) + self.altInput.value = ""; + if (self.mobileInput !== undefined) + self.mobileInput.value = ""; + self.selectedDates = []; + self.latestSelectedDateObj = undefined; + if (toInitial === true) { + self.currentYear = self._initialDate.getFullYear(); + self.currentMonth = self._initialDate.getMonth(); + } + if (self.config.enableTime === true) { + var _a = getDefaultHours(), hours = _a.hours, minutes = _a.minutes, seconds = _a.seconds; + setHours(hours, minutes, seconds); + } + self.redraw(); + if (triggerChangeEvent) + // triggerChangeEvent is true (default) or an Event + triggerEvent("onChange"); + } + function close() { + self.isOpen = false; + if (!self.isMobile) { + if (self.calendarContainer !== undefined) { + self.calendarContainer.classList.remove("open"); + } + if (self._input !== undefined) { + self._input.classList.remove("active"); + } + } + triggerEvent("onClose"); + } + function destroy() { + if (self.config !== undefined) + triggerEvent("onDestroy"); + for (var i = self._handlers.length; i--;) { + var h = self._handlers[i]; + h.element.removeEventListener(h.event, h.handler, h.options); + } + self._handlers = []; + if (self.mobileInput) { + if (self.mobileInput.parentNode) + self.mobileInput.parentNode.removeChild(self.mobileInput); + self.mobileInput = undefined; + } + else if (self.calendarContainer && self.calendarContainer.parentNode) { + if (self.config.static && self.calendarContainer.parentNode) { + var wrapper = self.calendarContainer.parentNode; + wrapper.lastChild && wrapper.removeChild(wrapper.lastChild); + if (wrapper.parentNode) { + while (wrapper.firstChild) + wrapper.parentNode.insertBefore(wrapper.firstChild, wrapper); + wrapper.parentNode.removeChild(wrapper); + } + } + else + self.calendarContainer.parentNode.removeChild(self.calendarContainer); + } + if (self.altInput) { + self.input.type = "text"; + if (self.altInput.parentNode) + self.altInput.parentNode.removeChild(self.altInput); + delete self.altInput; + } + if (self.input) { + self.input.type = self.input._type; + self.input.classList.remove("flatpickr-input"); + self.input.removeAttribute("readonly"); + } + [ + "_showTimeInput", + "latestSelectedDateObj", + "_hideNextMonthArrow", + "_hidePrevMonthArrow", + "__hideNextMonthArrow", + "__hidePrevMonthArrow", + "isMobile", + "isOpen", + "selectedDateElem", + "minDateHasTime", + "maxDateHasTime", + "days", + "daysContainer", + "_input", + "_positionElement", + "innerContainer", + "rContainer", + "monthNav", + "todayDateElem", + "calendarContainer", + "weekdayContainer", + "prevMonthNav", + "nextMonthNav", + "monthsDropdownContainer", + "currentMonthElement", + "currentYearElement", + "navigationCurrentMonth", + "selectedDateElem", + "config", + ].forEach(function (k) { + try { + delete self[k]; + } + catch (_) { } + }); + } + function isCalendarElem(elem) { + if (self.config.appendTo && self.config.appendTo.contains(elem)) + return true; + return self.calendarContainer.contains(elem); + } + function documentClick(e) { + if (self.isOpen && !self.config.inline) { + var eventTarget_1 = getEventTarget(e); + var isCalendarElement = isCalendarElem(eventTarget_1); + var isInput = eventTarget_1 === self.input || + eventTarget_1 === self.altInput || + self.element.contains(eventTarget_1) || + // web components + // e.path is not present in all browsers. circumventing typechecks + (e.path && + e.path.indexOf && + (~e.path.indexOf(self.input) || + ~e.path.indexOf(self.altInput))); + var lostFocus = e.type === "blur" + ? isInput && + e.relatedTarget && + !isCalendarElem(e.relatedTarget) + : !isInput && + !isCalendarElement && + !isCalendarElem(e.relatedTarget); + var isIgnored = !self.config.ignoredFocusElements.some(function (elem) { + return elem.contains(eventTarget_1); + }); + if (lostFocus && isIgnored) { + if (self.timeContainer !== undefined && + self.minuteElement !== undefined && + self.hourElement !== undefined && + self.input.value !== "" && + self.input.value !== undefined) { + updateTime(); + } + self.close(); + if (self.config && + self.config.mode === "range" && + self.selectedDates.length === 1) { + self.clear(false); + self.redraw(); + } + } + } + } + function changeYear(newYear) { + if (!newYear || + (self.config.minDate && newYear < self.config.minDate.getFullYear()) || + (self.config.maxDate && newYear > self.config.maxDate.getFullYear())) + return; + var newYearNum = newYear, isNewYear = self.currentYear !== newYearNum; + self.currentYear = newYearNum || self.currentYear; + if (self.config.maxDate && + self.currentYear === self.config.maxDate.getFullYear()) { + self.currentMonth = Math.min(self.config.maxDate.getMonth(), self.currentMonth); + } + else if (self.config.minDate && + self.currentYear === self.config.minDate.getFullYear()) { + self.currentMonth = Math.max(self.config.minDate.getMonth(), self.currentMonth); + } + if (isNewYear) { + self.redraw(); + triggerEvent("onYearChange"); + buildMonthSwitch(); + } + } + function isEnabled(date, timeless) { + if (timeless === void 0) { timeless = true; } + var dateToCheck = self.parseDate(date, undefined, timeless); // timeless + if ((self.config.minDate && + dateToCheck && + compareDates(dateToCheck, self.config.minDate, timeless !== undefined ? timeless : !self.minDateHasTime) < 0) || + (self.config.maxDate && + dateToCheck && + compareDates(dateToCheck, self.config.maxDate, timeless !== undefined ? timeless : !self.maxDateHasTime) > 0)) + return false; + if (self.config.enable.length === 0 && self.config.disable.length === 0) + return true; + if (dateToCheck === undefined) + return false; + var bool = self.config.enable.length > 0, array = bool ? self.config.enable : self.config.disable; + for (var i = 0, d = void 0; i < array.length; i++) { + d = array[i]; + if (typeof d === "function" && + d(dateToCheck) // disabled by function + ) + return bool; + else if (d instanceof Date && + dateToCheck !== undefined && + d.getTime() === dateToCheck.getTime()) + // disabled by date + return bool; + else if (typeof d === "string" && dateToCheck !== undefined) { + // disabled by date string + var parsed = self.parseDate(d, undefined, true); + return parsed && parsed.getTime() === dateToCheck.getTime() + ? bool + : !bool; + } + else if ( + // disabled by range + typeof d === "object" && + dateToCheck !== undefined && + d.from && + d.to && + dateToCheck.getTime() >= d.from.getTime() && + dateToCheck.getTime() <= d.to.getTime()) + return bool; + } + return !bool; + } + function isInView(elem) { + if (self.daysContainer !== undefined) + return (elem.className.indexOf("hidden") === -1 && + elem.className.indexOf("flatpickr-disabled") === -1 && + self.daysContainer.contains(elem)); + return false; + } + function onBlur(e) { + var isInput = e.target === self._input; + if (isInput && + !(e.relatedTarget && isCalendarElem(e.relatedTarget))) { + self.setDate(self._input.value, true, e.target === self.altInput + ? self.config.altFormat + : self.config.dateFormat); + } + } + function onKeyDown(e) { + // e.key e.keyCode + // "Backspace" 8 + // "Tab" 9 + // "Enter" 13 + // "Escape" (IE "Esc") 27 + // "ArrowLeft" (IE "Left") 37 + // "ArrowUp" (IE "Up") 38 + // "ArrowRight" (IE "Right") 39 + // "ArrowDown" (IE "Down") 40 + // "Delete" (IE "Del") 46 + var eventTarget = getEventTarget(e); + var isInput = self.config.wrap + ? element.contains(eventTarget) + : eventTarget === self._input; + var allowInput = self.config.allowInput; + var allowKeydown = self.isOpen && (!allowInput || !isInput); + var allowInlineKeydown = self.config.inline && isInput && !allowInput; + if (e.keyCode === 13 && isInput) { + if (allowInput) { + self.setDate(self._input.value, true, eventTarget === self.altInput + ? self.config.altFormat + : self.config.dateFormat); + return eventTarget.blur(); + } + else { + self.open(); + } + } + else if (isCalendarElem(eventTarget) || + allowKeydown || + allowInlineKeydown) { + var isTimeObj = !!self.timeContainer && + self.timeContainer.contains(eventTarget); + switch (e.keyCode) { + case 13: + if (isTimeObj) { + e.preventDefault(); + updateTime(); + focusAndClose(); + } + else + selectDate(e); + break; + case 27: // escape + e.preventDefault(); + focusAndClose(); + break; + case 8: + case 46: + if (isInput && !self.config.allowInput) { + e.preventDefault(); + self.clear(); + } + break; + case 37: + case 39: + if (!isTimeObj && !isInput) { + e.preventDefault(); + if (self.daysContainer !== undefined && + (allowInput === false || + (document.activeElement && isInView(document.activeElement)))) { + var delta_1 = e.keyCode === 39 ? 1 : -1; + if (!e.ctrlKey) + focusOnDay(undefined, delta_1); + else { + e.stopPropagation(); + changeMonth(delta_1); + focusOnDay(getFirstAvailableDay(1), 0); + } + } + } + else if (self.hourElement) + self.hourElement.focus(); + break; + case 38: + case 40: + e.preventDefault(); + var delta = e.keyCode === 40 ? 1 : -1; + if ((self.daysContainer && + eventTarget.$i !== undefined) || + eventTarget === self.input || + eventTarget === self.altInput) { + if (e.ctrlKey) { + e.stopPropagation(); + changeYear(self.currentYear - delta); + focusOnDay(getFirstAvailableDay(1), 0); + } + else if (!isTimeObj) + focusOnDay(undefined, delta * 7); + } + else if (eventTarget === self.currentYearElement) { + changeYear(self.currentYear - delta); + } + else if (self.config.enableTime) { + if (!isTimeObj && self.hourElement) + self.hourElement.focus(); + updateTime(e); + self._debouncedChange(); + } + break; + case 9: + if (isTimeObj) { + var elems = [ + self.hourElement, + self.minuteElement, + self.secondElement, + self.amPM, + ] + .concat(self.pluginElements) + .filter(function (x) { return x; }); + var i = elems.indexOf(eventTarget); + if (i !== -1) { + var target = elems[i + (e.shiftKey ? -1 : 1)]; + e.preventDefault(); + (target || self._input).focus(); + } + } + else if (!self.config.noCalendar && + self.daysContainer && + self.daysContainer.contains(eventTarget) && + e.shiftKey) { + e.preventDefault(); + self._input.focus(); + } + break; + } + } + if (self.amPM !== undefined && eventTarget === self.amPM) { + switch (e.key) { + case self.l10n.amPM[0].charAt(0): + case self.l10n.amPM[0].charAt(0).toLowerCase(): + self.amPM.textContent = self.l10n.amPM[0]; + setHoursFromInputs(); + updateValue(); + break; + case self.l10n.amPM[1].charAt(0): + case self.l10n.amPM[1].charAt(0).toLowerCase(): + self.amPM.textContent = self.l10n.amPM[1]; + setHoursFromInputs(); + updateValue(); + break; + } + } + if (isInput || isCalendarElem(eventTarget)) { + triggerEvent("onKeyDown", e); + } + } + function onMouseOver(elem) { + if (self.selectedDates.length !== 1 || + (elem && + (!elem.classList.contains("flatpickr-day") || + elem.classList.contains("flatpickr-disabled")))) + return; + var hoverDate = elem + ? elem.dateObj.getTime() + : self.days.firstElementChild.dateObj.getTime(), initialDate = self.parseDate(self.selectedDates[0], undefined, true).getTime(), rangeStartDate = Math.min(hoverDate, self.selectedDates[0].getTime()), rangeEndDate = Math.max(hoverDate, self.selectedDates[0].getTime()); + var containsDisabled = false; + var minRange = 0, maxRange = 0; + for (var t = rangeStartDate; t < rangeEndDate; t += duration.DAY) { + if (!isEnabled(new Date(t), true)) { + containsDisabled = + containsDisabled || (t > rangeStartDate && t < rangeEndDate); + if (t < initialDate && (!minRange || t > minRange)) + minRange = t; + else if (t > initialDate && (!maxRange || t < maxRange)) + maxRange = t; + } + } + for (var m = 0; m < self.config.showMonths; m++) { + var month = self.daysContainer.children[m]; + var _loop_1 = function (i, l) { + var dayElem = month.children[i], date = dayElem.dateObj; + var timestamp = date.getTime(); + var outOfRange = (minRange > 0 && timestamp < minRange) || + (maxRange > 0 && timestamp > maxRange); + if (outOfRange) { + dayElem.classList.add("notAllowed"); + ["inRange", "startRange", "endRange"].forEach(function (c) { + dayElem.classList.remove(c); + }); + return "continue"; + } + else if (containsDisabled && !outOfRange) + return "continue"; + ["startRange", "inRange", "endRange", "notAllowed"].forEach(function (c) { + dayElem.classList.remove(c); + }); + if (elem !== undefined) { + elem.classList.add(hoverDate <= self.selectedDates[0].getTime() + ? "startRange" + : "endRange"); + if (initialDate < hoverDate && timestamp === initialDate) + dayElem.classList.add("startRange"); + else if (initialDate > hoverDate && timestamp === initialDate) + dayElem.classList.add("endRange"); + if (timestamp >= minRange && + (maxRange === 0 || timestamp <= maxRange) && + isBetween(timestamp, initialDate, hoverDate)) + dayElem.classList.add("inRange"); + } + }; + for (var i = 0, l = month.children.length; i < l; i++) { + _loop_1(i, l); + } + } + } + function onResize() { + if (self.isOpen && !self.config.static && !self.config.inline) + positionCalendar(); + } + function open(e, positionElement) { + if (positionElement === void 0) { positionElement = self._positionElement; } + if (self.isMobile === true) { + if (e) { + e.preventDefault(); + var eventTarget = getEventTarget(e); + eventTarget && eventTarget.blur(); + } + if (self.mobileInput !== undefined) { + self.mobileInput.focus(); + self.mobileInput.click(); + } + triggerEvent("onOpen"); + return; + } + if (self._input.disabled || self.config.inline) + return; + var wasOpen = self.isOpen; + self.isOpen = true; + if (!wasOpen) { + self.calendarContainer.classList.add("open"); + self._input.classList.add("active"); + triggerEvent("onOpen"); + positionCalendar(positionElement); + } + if (self.config.enableTime === true && self.config.noCalendar === true) { + if (self.config.allowInput === false && + (e === undefined || + !self.timeContainer.contains(e.relatedTarget))) { + setTimeout(function () { return self.hourElement.select(); }, 50); + } + } + } + function minMaxDateSetter(type) { + return function (date) { + var dateObj = (self.config["_" + type + "Date"] = self.parseDate(date, self.config.dateFormat)); + var inverseDateObj = self.config["_" + (type === "min" ? "max" : "min") + "Date"]; + if (dateObj !== undefined) { + self[type === "min" ? "minDateHasTime" : "maxDateHasTime"] = + dateObj.getHours() > 0 || + dateObj.getMinutes() > 0 || + dateObj.getSeconds() > 0; + } + if (self.selectedDates) { + self.selectedDates = self.selectedDates.filter(function (d) { return isEnabled(d); }); + if (!self.selectedDates.length && type === "min") + setHoursFromDate(dateObj); + updateValue(); + } + if (self.daysContainer) { + redraw(); + if (dateObj !== undefined) + self.currentYearElement[type] = dateObj.getFullYear().toString(); + else + self.currentYearElement.removeAttribute(type); + self.currentYearElement.disabled = + !!inverseDateObj && + dateObj !== undefined && + inverseDateObj.getFullYear() === dateObj.getFullYear(); + } + }; + } + function parseConfig() { + var boolOpts = [ + "wrap", + "weekNumbers", + "allowInput", + "allowInvalidPreload", + "clickOpens", + "time_24hr", + "enableTime", + "noCalendar", + "altInput", + "shorthandCurrentMonth", + "inline", + "static", + "enableSeconds", + "disableMobile", + ]; + var userConfig = __assign(__assign({}, JSON.parse(JSON.stringify(element.dataset || {}))), instanceConfig); + var formats = {}; + self.config.parseDate = userConfig.parseDate; + self.config.formatDate = userConfig.formatDate; + Object.defineProperty(self.config, "enable", { + get: function () { return self.config._enable; }, + set: function (dates) { + self.config._enable = parseDateRules(dates); + }, + }); + Object.defineProperty(self.config, "disable", { + get: function () { return self.config._disable; }, + set: function (dates) { + self.config._disable = parseDateRules(dates); + }, + }); + var timeMode = userConfig.mode === "time"; + if (!userConfig.dateFormat && (userConfig.enableTime || timeMode)) { + var defaultDateFormat = flatpickr.defaultConfig.dateFormat || defaults.dateFormat; + formats.dateFormat = + userConfig.noCalendar || timeMode + ? "H:i" + (userConfig.enableSeconds ? ":S" : "") + : defaultDateFormat + " H:i" + (userConfig.enableSeconds ? ":S" : ""); + } + if (userConfig.altInput && + (userConfig.enableTime || timeMode) && + !userConfig.altFormat) { + var defaultAltFormat = flatpickr.defaultConfig.altFormat || defaults.altFormat; + formats.altFormat = + userConfig.noCalendar || timeMode + ? "h:i" + (userConfig.enableSeconds ? ":S K" : " K") + : defaultAltFormat + (" h:i" + (userConfig.enableSeconds ? ":S" : "") + " K"); + } + Object.defineProperty(self.config, "minDate", { + get: function () { return self.config._minDate; }, + set: minMaxDateSetter("min"), + }); + Object.defineProperty(self.config, "maxDate", { + get: function () { return self.config._maxDate; }, + set: minMaxDateSetter("max"), + }); + var minMaxTimeSetter = function (type) { return function (val) { + self.config[type === "min" ? "_minTime" : "_maxTime"] = self.parseDate(val, "H:i:S"); + }; }; + Object.defineProperty(self.config, "minTime", { + get: function () { return self.config._minTime; }, + set: minMaxTimeSetter("min"), + }); + Object.defineProperty(self.config, "maxTime", { + get: function () { return self.config._maxTime; }, + set: minMaxTimeSetter("max"), + }); + if (userConfig.mode === "time") { + self.config.noCalendar = true; + self.config.enableTime = true; + } + Object.assign(self.config, formats, userConfig); + for (var i = 0; i < boolOpts.length; i++) + // https://github.com/microsoft/TypeScript/issues/31663 + self.config[boolOpts[i]] = + self.config[boolOpts[i]] === true || + self.config[boolOpts[i]] === "true"; + HOOKS.filter(function (hook) { return self.config[hook] !== undefined; }).forEach(function (hook) { + self.config[hook] = arrayify(self.config[hook] || []).map(bindToInstance); + }); + self.isMobile = + !self.config.disableMobile && + !self.config.inline && + self.config.mode === "single" && + !self.config.disable.length && + !self.config.enable.length && + !self.config.weekNumbers && + /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent); + for (var i = 0; i < self.config.plugins.length; i++) { + var pluginConf = self.config.plugins[i](self) || {}; + for (var key in pluginConf) { + if (HOOKS.indexOf(key) > -1) { + self.config[key] = arrayify(pluginConf[key]) + .map(bindToInstance) + .concat(self.config[key]); + } + else if (typeof userConfig[key] === "undefined") + self.config[key] = pluginConf[key]; + } + } + if (!userConfig.altInputClass) { + self.config.altInputClass = + getInputElem().className + " " + self.config.altInputClass; + } + triggerEvent("onParseConfig"); + } + function getInputElem() { + return self.config.wrap + ? element.querySelector("[data-input]") + : element; + } + function setupLocale() { + if (typeof self.config.locale !== "object" && + typeof flatpickr.l10ns[self.config.locale] === "undefined") + self.config.errorHandler(new Error("flatpickr: invalid locale " + self.config.locale)); + self.l10n = __assign(__assign({}, flatpickr.l10ns.default), (typeof self.config.locale === "object" + ? self.config.locale + : self.config.locale !== "default" + ? flatpickr.l10ns[self.config.locale] + : undefined)); + tokenRegex.K = "(" + self.l10n.amPM[0] + "|" + self.l10n.amPM[1] + "|" + self.l10n.amPM[0].toLowerCase() + "|" + self.l10n.amPM[1].toLowerCase() + ")"; + var userConfig = __assign(__assign({}, instanceConfig), JSON.parse(JSON.stringify(element.dataset || {}))); + if (userConfig.time_24hr === undefined && + flatpickr.defaultConfig.time_24hr === undefined) { + self.config.time_24hr = self.l10n.time_24hr; + } + self.formatDate = createDateFormatter(self); + self.parseDate = createDateParser({ config: self.config, l10n: self.l10n }); + } + function positionCalendar(customPositionElement) { + if (self.calendarContainer === undefined) + return; + triggerEvent("onPreCalendarPosition"); + var positionElement = customPositionElement || self._positionElement; + var calendarHeight = Array.prototype.reduce.call(self.calendarContainer.children, (function (acc, child) { return acc + child.offsetHeight; }), 0), calendarWidth = self.calendarContainer.offsetWidth, configPos = self.config.position.split(" "), configPosVertical = configPos[0], configPosHorizontal = configPos.length > 1 ? configPos[1] : null, inputBounds = positionElement.getBoundingClientRect(), distanceFromBottom = window.innerHeight - inputBounds.bottom, showOnTop = configPosVertical === "above" || + (configPosVertical !== "below" && + distanceFromBottom < calendarHeight && + inputBounds.top > calendarHeight); + var top = window.pageYOffset + + inputBounds.top + + (!showOnTop ? positionElement.offsetHeight + 2 : -calendarHeight - 2); + toggleClass(self.calendarContainer, "arrowTop", !showOnTop); + toggleClass(self.calendarContainer, "arrowBottom", showOnTop); + if (self.config.inline) + return; + var left = window.pageXOffset + inputBounds.left; + var isCenter = false; + var isRight = false; + if (configPosHorizontal === "center") { + left -= (calendarWidth - inputBounds.width) / 2; + isCenter = true; + } + else if (configPosHorizontal === "right") { + left -= calendarWidth - inputBounds.width; + isRight = true; + } + toggleClass(self.calendarContainer, "arrowLeft", !isCenter && !isRight); + toggleClass(self.calendarContainer, "arrowCenter", isCenter); + toggleClass(self.calendarContainer, "arrowRight", isRight); + var right = window.document.body.offsetWidth - + (window.pageXOffset + inputBounds.right); + var rightMost = left + calendarWidth > window.document.body.offsetWidth; + var centerMost = right + calendarWidth > window.document.body.offsetWidth; + toggleClass(self.calendarContainer, "rightMost", rightMost); + if (self.config.static) + return; + self.calendarContainer.style.top = top + "px"; + if (!rightMost) { + self.calendarContainer.style.left = left + "px"; + self.calendarContainer.style.right = "auto"; + } + else if (!centerMost) { + self.calendarContainer.style.left = "auto"; + self.calendarContainer.style.right = right + "px"; + } + else { + var doc = getDocumentStyleSheet(); + // some testing environments don't have css support + if (doc === undefined) + return; + var bodyWidth = window.document.body.offsetWidth; + var centerLeft = Math.max(0, bodyWidth / 2 - calendarWidth / 2); + var centerBefore = ".flatpickr-calendar.centerMost:before"; + var centerAfter = ".flatpickr-calendar.centerMost:after"; + var centerIndex = doc.cssRules.length; + var centerStyle = "{left:" + inputBounds.left + "px;right:auto;}"; + toggleClass(self.calendarContainer, "rightMost", false); + toggleClass(self.calendarContainer, "centerMost", true); + doc.insertRule(centerBefore + "," + centerAfter + centerStyle, centerIndex); + self.calendarContainer.style.left = centerLeft + "px"; + self.calendarContainer.style.right = "auto"; + } + } + function getDocumentStyleSheet() { + var editableSheet = null; + for (var i = 0; i < document.styleSheets.length; i++) { + var sheet = document.styleSheets[i]; + try { + sheet.cssRules; + } + catch (err) { + continue; + } + editableSheet = sheet; + break; + } + return editableSheet != null ? editableSheet : createStyleSheet(); + } + function createStyleSheet() { + var style = document.createElement("style"); + document.head.appendChild(style); + return style.sheet; + } + function redraw() { + if (self.config.noCalendar || self.isMobile) + return; + buildMonthSwitch(); + updateNavigationCurrentMonth(); + buildDays(); + } + function focusAndClose() { + self._input.focus(); + if (window.navigator.userAgent.indexOf("MSIE") !== -1 || + navigator.msMaxTouchPoints !== undefined) { + // hack - bugs in the way IE handles focus keeps the calendar open + setTimeout(self.close, 0); + } + else { + self.close(); + } + } + function selectDate(e) { + e.preventDefault(); + e.stopPropagation(); + var isSelectable = function (day) { + return day.classList && + day.classList.contains("flatpickr-day") && + !day.classList.contains("flatpickr-disabled") && + !day.classList.contains("notAllowed"); + }; + var t = findParent(getEventTarget(e), isSelectable); + if (t === undefined) + return; + var target = t; + var selectedDate = (self.latestSelectedDateObj = new Date(target.dateObj.getTime())); + var shouldChangeMonth = (selectedDate.getMonth() < self.currentMonth || + selectedDate.getMonth() > + self.currentMonth + self.config.showMonths - 1) && + self.config.mode !== "range"; + self.selectedDateElem = target; + if (self.config.mode === "single") + self.selectedDates = [selectedDate]; + else if (self.config.mode === "multiple") { + var selectedIndex = isDateSelected(selectedDate); + if (selectedIndex) + self.selectedDates.splice(parseInt(selectedIndex), 1); + else + self.selectedDates.push(selectedDate); + } + else if (self.config.mode === "range") { + if (self.selectedDates.length === 2) { + self.clear(false, false); + } + self.latestSelectedDateObj = selectedDate; + self.selectedDates.push(selectedDate); + // unless selecting same date twice, sort ascendingly + if (compareDates(selectedDate, self.selectedDates[0], true) !== 0) + self.selectedDates.sort(function (a, b) { return a.getTime() - b.getTime(); }); + } + setHoursFromInputs(); + if (shouldChangeMonth) { + var isNewYear = self.currentYear !== selectedDate.getFullYear(); + self.currentYear = selectedDate.getFullYear(); + self.currentMonth = selectedDate.getMonth(); + if (isNewYear) { + triggerEvent("onYearChange"); + buildMonthSwitch(); + } + triggerEvent("onMonthChange"); + } + updateNavigationCurrentMonth(); + buildDays(); + updateValue(); + // maintain focus + if (!shouldChangeMonth && + self.config.mode !== "range" && + self.config.showMonths === 1) + focusOnDayElem(target); + else if (self.selectedDateElem !== undefined && + self.hourElement === undefined) { + self.selectedDateElem && self.selectedDateElem.focus(); + } + if (self.hourElement !== undefined) + self.hourElement !== undefined && self.hourElement.focus(); + if (self.config.closeOnSelect) { + var single = self.config.mode === "single" && !self.config.enableTime; + var range = self.config.mode === "range" && + self.selectedDates.length === 2 && + !self.config.enableTime; + if (single || range) { + focusAndClose(); + } + } + triggerChange(); + } + var CALLBACKS = { + locale: [setupLocale, updateWeekdays], + showMonths: [buildMonths, setCalendarWidth, buildWeekdays], + minDate: [jumpToDate], + maxDate: [jumpToDate], + }; + function set(option, value) { + if (option !== null && typeof option === "object") { + Object.assign(self.config, option); + for (var key in option) { + if (CALLBACKS[key] !== undefined) + CALLBACKS[key].forEach(function (x) { return x(); }); + } + } + else { + self.config[option] = value; + if (CALLBACKS[option] !== undefined) + CALLBACKS[option].forEach(function (x) { return x(); }); + else if (HOOKS.indexOf(option) > -1) + self.config[option] = arrayify(value); + } + self.redraw(); + updateValue(true); + } + function setSelectedDate(inputDate, format) { + var dates = []; + if (inputDate instanceof Array) + dates = inputDate.map(function (d) { return self.parseDate(d, format); }); + else if (inputDate instanceof Date || typeof inputDate === "number") + dates = [self.parseDate(inputDate, format)]; + else if (typeof inputDate === "string") { + switch (self.config.mode) { + case "single": + case "time": + dates = [self.parseDate(inputDate, format)]; + break; + case "multiple": + dates = inputDate + .split(self.config.conjunction) + .map(function (date) { return self.parseDate(date, format); }); + break; + case "range": + dates = inputDate + .split(self.l10n.rangeSeparator) + .map(function (date) { return self.parseDate(date, format); }); + break; + } + } + else + self.config.errorHandler(new Error("Invalid date supplied: " + JSON.stringify(inputDate))); + self.selectedDates = (self.config.allowInvalidPreload + ? dates + : dates.filter(function (d) { return d instanceof Date && isEnabled(d, false); })); + if (self.config.mode === "range") + self.selectedDates.sort(function (a, b) { return a.getTime() - b.getTime(); }); + } + function setDate(date, triggerChange, format) { + if (triggerChange === void 0) { triggerChange = false; } + if (format === void 0) { format = self.config.dateFormat; } + if ((date !== 0 && !date) || (date instanceof Array && date.length === 0)) + return self.clear(triggerChange); + setSelectedDate(date, format); + self.latestSelectedDateObj = + self.selectedDates[self.selectedDates.length - 1]; + self.redraw(); + jumpToDate(undefined, triggerChange); + setHoursFromDate(); + if (self.selectedDates.length === 0) { + self.clear(false); + } + updateValue(triggerChange); + if (triggerChange) + triggerEvent("onChange"); + } + function parseDateRules(arr) { + return arr + .slice() + .map(function (rule) { + if (typeof rule === "string" || + typeof rule === "number" || + rule instanceof Date) { + return self.parseDate(rule, undefined, true); + } + else if (rule && + typeof rule === "object" && + rule.from && + rule.to) + return { + from: self.parseDate(rule.from, undefined), + to: self.parseDate(rule.to, undefined), + }; + return rule; + }) + .filter(function (x) { return x; }); // remove falsy values + } + function setupDates() { + self.selectedDates = []; + self.now = self.parseDate(self.config.now) || new Date(); + // Workaround IE11 setting placeholder as the input's value + var preloadedDate = self.config.defaultDate || + ((self.input.nodeName === "INPUT" || + self.input.nodeName === "TEXTAREA") && + self.input.placeholder && + self.input.value === self.input.placeholder + ? null + : self.input.value); + if (preloadedDate) + setSelectedDate(preloadedDate, self.config.dateFormat); + self._initialDate = + self.selectedDates.length > 0 + ? self.selectedDates[0] + : self.config.minDate && + self.config.minDate.getTime() > self.now.getTime() + ? self.config.minDate + : self.config.maxDate && + self.config.maxDate.getTime() < self.now.getTime() + ? self.config.maxDate + : self.now; + self.currentYear = self._initialDate.getFullYear(); + self.currentMonth = self._initialDate.getMonth(); + if (self.selectedDates.length > 0) + self.latestSelectedDateObj = self.selectedDates[0]; + if (self.config.minTime !== undefined) + self.config.minTime = self.parseDate(self.config.minTime, "H:i"); + if (self.config.maxTime !== undefined) + self.config.maxTime = self.parseDate(self.config.maxTime, "H:i"); + self.minDateHasTime = + !!self.config.minDate && + (self.config.minDate.getHours() > 0 || + self.config.minDate.getMinutes() > 0 || + self.config.minDate.getSeconds() > 0); + self.maxDateHasTime = + !!self.config.maxDate && + (self.config.maxDate.getHours() > 0 || + self.config.maxDate.getMinutes() > 0 || + self.config.maxDate.getSeconds() > 0); + } + function setupInputs() { + self.input = getInputElem(); + /* istanbul ignore next */ + if (!self.input) { + self.config.errorHandler(new Error("Invalid input element specified")); + return; + } + // hack: store previous type to restore it after destroy() + self.input._type = self.input.type; + self.input.type = "text"; + self.input.classList.add("flatpickr-input"); + self._input = self.input; + if (self.config.altInput) { + // replicate self.element + self.altInput = createElement(self.input.nodeName, self.config.altInputClass); + self._input = self.altInput; + self.altInput.placeholder = self.input.placeholder; + self.altInput.disabled = self.input.disabled; + self.altInput.required = self.input.required; + self.altInput.tabIndex = self.input.tabIndex; + self.altInput.type = "text"; + self.input.setAttribute("type", "hidden"); + if (!self.config.static && self.input.parentNode) + self.input.parentNode.insertBefore(self.altInput, self.input.nextSibling); + } + if (!self.config.allowInput) + self._input.setAttribute("readonly", "readonly"); + self._positionElement = self.config.positionElement || self._input; + } + function setupMobile() { + var inputType = self.config.enableTime + ? self.config.noCalendar + ? "time" + : "datetime-local" + : "date"; + self.mobileInput = createElement("input", self.input.className + " flatpickr-mobile"); + self.mobileInput.tabIndex = 1; + self.mobileInput.type = inputType; + self.mobileInput.disabled = self.input.disabled; + self.mobileInput.required = self.input.required; + self.mobileInput.placeholder = self.input.placeholder; + self.mobileFormatStr = + inputType === "datetime-local" + ? "Y-m-d\\TH:i:S" + : inputType === "date" + ? "Y-m-d" + : "H:i:S"; + if (self.selectedDates.length > 0) { + self.mobileInput.defaultValue = self.mobileInput.value = self.formatDate(self.selectedDates[0], self.mobileFormatStr); + } + if (self.config.minDate) + self.mobileInput.min = self.formatDate(self.config.minDate, "Y-m-d"); + if (self.config.maxDate) + self.mobileInput.max = self.formatDate(self.config.maxDate, "Y-m-d"); + if (self.input.getAttribute("step")) + self.mobileInput.step = String(self.input.getAttribute("step")); + self.input.type = "hidden"; + if (self.altInput !== undefined) + self.altInput.type = "hidden"; + try { + if (self.input.parentNode) + self.input.parentNode.insertBefore(self.mobileInput, self.input.nextSibling); + } + catch (_a) { } + bind(self.mobileInput, "change", function (e) { + self.setDate(getEventTarget(e).value, false, self.mobileFormatStr); + triggerEvent("onChange"); + triggerEvent("onClose"); + }); + } + function toggle(e) { + if (self.isOpen === true) + return self.close(); + self.open(e); + } + function triggerEvent(event, data) { + // If the instance has been destroyed already, all hooks have been removed + if (self.config === undefined) + return; + var hooks = self.config[event]; + if (hooks !== undefined && hooks.length > 0) { + for (var i = 0; hooks[i] && i < hooks.length; i++) + hooks[i](self.selectedDates, self.input.value, self, data); + } + if (event === "onChange") { + self.input.dispatchEvent(createEvent("change")); + // many front-end frameworks bind to the input event + self.input.dispatchEvent(createEvent("input")); + } + } + function createEvent(name) { + var e = document.createEvent("Event"); + e.initEvent(name, true, true); + return e; + } + function isDateSelected(date) { + for (var i = 0; i < self.selectedDates.length; i++) { + if (compareDates(self.selectedDates[i], date) === 0) + return "" + i; + } + return false; + } + function isDateInRange(date) { + if (self.config.mode !== "range" || self.selectedDates.length < 2) + return false; + return (compareDates(date, self.selectedDates[0]) >= 0 && + compareDates(date, self.selectedDates[1]) <= 0); + } + function updateNavigationCurrentMonth() { + if (self.config.noCalendar || self.isMobile || !self.monthNav) + return; + self.yearElements.forEach(function (yearElement, i) { + var d = new Date(self.currentYear, self.currentMonth, 1); + d.setMonth(self.currentMonth + i); + if (self.config.showMonths > 1 || + self.config.monthSelectorType === "static") { + self.monthElements[i].textContent = + monthToStr(d.getMonth(), self.config.shorthandCurrentMonth, self.l10n) + " "; + } + else { + self.monthsDropdownContainer.value = d.getMonth().toString(); + } + yearElement.value = d.getFullYear().toString(); + }); + self._hidePrevMonthArrow = + self.config.minDate !== undefined && + (self.currentYear === self.config.minDate.getFullYear() + ? self.currentMonth <= self.config.minDate.getMonth() + : self.currentYear < self.config.minDate.getFullYear()); + self._hideNextMonthArrow = + self.config.maxDate !== undefined && + (self.currentYear === self.config.maxDate.getFullYear() + ? self.currentMonth + 1 > self.config.maxDate.getMonth() + : self.currentYear > self.config.maxDate.getFullYear()); + } + function getDateStr(format) { + return self.selectedDates + .map(function (dObj) { return self.formatDate(dObj, format); }) + .filter(function (d, i, arr) { + return self.config.mode !== "range" || + self.config.enableTime || + arr.indexOf(d) === i; + }) + .join(self.config.mode !== "range" + ? self.config.conjunction + : self.l10n.rangeSeparator); + } + /** + * Updates the values of inputs associated with the calendar + */ + function updateValue(triggerChange) { + if (triggerChange === void 0) { triggerChange = true; } + if (self.mobileInput !== undefined && self.mobileFormatStr) { + self.mobileInput.value = + self.latestSelectedDateObj !== undefined + ? self.formatDate(self.latestSelectedDateObj, self.mobileFormatStr) + : ""; + } + self.input.value = getDateStr(self.config.dateFormat); + if (self.altInput !== undefined) { + self.altInput.value = getDateStr(self.config.altFormat); + } + if (triggerChange !== false) + triggerEvent("onValueUpdate"); + } + function onMonthNavClick(e) { + var eventTarget = getEventTarget(e); + var isPrevMonth = self.prevMonthNav.contains(eventTarget); + var isNextMonth = self.nextMonthNav.contains(eventTarget); + if (isPrevMonth || isNextMonth) { + changeMonth(isPrevMonth ? -1 : 1); + } + else if (self.yearElements.indexOf(eventTarget) >= 0) { + eventTarget.select(); + } + else if (eventTarget.classList.contains("arrowUp")) { + self.changeYear(self.currentYear + 1); + } + else if (eventTarget.classList.contains("arrowDown")) { + self.changeYear(self.currentYear - 1); + } + } + function timeWrapper(e) { + e.preventDefault(); + var isKeyDown = e.type === "keydown", eventTarget = getEventTarget(e), input = eventTarget; + if (self.amPM !== undefined && eventTarget === self.amPM) { + self.amPM.textContent = + self.l10n.amPM[int(self.amPM.textContent === self.l10n.amPM[0])]; + } + var min = parseFloat(input.getAttribute("min")), max = parseFloat(input.getAttribute("max")), step = parseFloat(input.getAttribute("step")), curValue = parseInt(input.value, 10), delta = e.delta || + (isKeyDown ? (e.which === 38 ? 1 : -1) : 0); + var newValue = curValue + step * delta; + if (typeof input.value !== "undefined" && input.value.length === 2) { + var isHourElem = input === self.hourElement, isMinuteElem = input === self.minuteElement; + if (newValue < min) { + newValue = + max + + newValue + + int(!isHourElem) + + (int(isHourElem) && int(!self.amPM)); + if (isMinuteElem) + incrementNumInput(undefined, -1, self.hourElement); + } + else if (newValue > max) { + newValue = + input === self.hourElement ? newValue - max - int(!self.amPM) : min; + if (isMinuteElem) + incrementNumInput(undefined, 1, self.hourElement); + } + if (self.amPM && + isHourElem && + (step === 1 + ? newValue + curValue === 23 + : Math.abs(newValue - curValue) > step)) { + self.amPM.textContent = + self.l10n.amPM[int(self.amPM.textContent === self.l10n.amPM[0])]; + } + input.value = pad(newValue); + } + } + init(); + return self; + } + /* istanbul ignore next */ + function _flatpickr(nodeList, config) { + // static list + var nodes = Array.prototype.slice + .call(nodeList) + .filter(function (x) { return x instanceof HTMLElement; }); + var instances = []; + for (var i = 0; i < nodes.length; i++) { + var node = nodes[i]; + try { + if (node.getAttribute("data-fp-omit") !== null) + continue; + if (node._flatpickr !== undefined) { + node._flatpickr.destroy(); + node._flatpickr = undefined; + } + node._flatpickr = FlatpickrInstance(node, config || {}); + instances.push(node._flatpickr); + } + catch (e) { + console.error(e); + } + } + return instances.length === 1 ? instances[0] : instances; + } + /* istanbul ignore next */ + if (typeof HTMLElement !== "undefined" && + typeof HTMLCollection !== "undefined" && + typeof NodeList !== "undefined") { + // browser env + HTMLCollection.prototype.flatpickr = NodeList.prototype.flatpickr = function (config) { + return _flatpickr(this, config); + }; + HTMLElement.prototype.flatpickr = function (config) { + return _flatpickr([this], config); + }; + } + /* istanbul ignore next */ + var flatpickr = function (selector, config) { + if (typeof selector === "string") { + return _flatpickr(window.document.querySelectorAll(selector), config); + } + else if (selector instanceof Node) { + return _flatpickr([selector], config); + } + else { + return _flatpickr(selector, config); + } + }; + /* istanbul ignore next */ + flatpickr.defaultConfig = {}; + flatpickr.l10ns = { + en: __assign({}, english), + default: __assign({}, english), + }; + flatpickr.localize = function (l10n) { + flatpickr.l10ns.default = __assign(__assign({}, flatpickr.l10ns.default), l10n); + }; + flatpickr.setDefaults = function (config) { + flatpickr.defaultConfig = __assign(__assign({}, flatpickr.defaultConfig), config); + }; + flatpickr.parseDate = createDateParser({}); + flatpickr.formatDate = createDateFormatter({}); + flatpickr.compareDates = compareDates; + /* istanbul ignore next */ + if (typeof jQuery !== "undefined" && typeof jQuery.fn !== "undefined") { + jQuery.fn.flatpickr = function (config) { + return _flatpickr(this, config); + }; + } + // eslint-disable-next-line @typescript-eslint/camelcase + Date.prototype.fp_incr = function (days) { + return new Date(this.getFullYear(), this.getMonth(), this.getDate() + (typeof days === "string" ? parseInt(days, 10) : days)); + }; + if (typeof window !== "undefined") { + window.flatpickr = flatpickr; + } + + return flatpickr; + +}))); diff --git a/admin/js/vendors/flatpickr/flatpickr.min.css b/admin/js/vendors/flatpickr/flatpickr.min.css new file mode 100644 index 0000000..2b5da59 --- /dev/null +++ b/admin/js/vendors/flatpickr/flatpickr.min.css @@ -0,0 +1,13 @@ +.flatpickr-calendar{background:transparent;opacity:0;display:none;text-align:center;visibility:hidden;padding:0;-webkit-animation:none;animation:none;direction:ltr;border:0;font-size:14px;line-height:24px;border-radius:5px;position:absolute;width:307.875px;-webkit-box-sizing:border-box;box-sizing:border-box;-ms-touch-action:manipulation;touch-action:manipulation;background:#fff;-webkit-box-shadow:1px 0 0 #e6e6e6,-1px 0 0 #e6e6e6,0 1px 0 #e6e6e6,0 -1px 0 #e6e6e6,0 3px 13px rgba(0,0,0,0.08);box-shadow:1px 0 0 #e6e6e6,-1px 0 0 #e6e6e6,0 1px 0 #e6e6e6,0 -1px 0 #e6e6e6,0 3px 13px rgba(0,0,0,0.08)}.flatpickr-calendar.open,.flatpickr-calendar.inline{opacity:1;max-height:640px;visibility:visible}.flatpickr-calendar.open{display:inline-block;z-index:99999}.flatpickr-calendar.animate.open{-webkit-animation:fpFadeInDown 300ms cubic-bezier(.23,1,.32,1);animation:fpFadeInDown 300ms cubic-bezier(.23,1,.32,1)}.flatpickr-calendar.inline{display:block;position:relative;top:2px}.flatpickr-calendar.static{position:absolute;top:calc(100% + 2px)}.flatpickr-calendar.static.open{z-index:999;display:block}.flatpickr-calendar.multiMonth .flatpickr-days .dayContainer:nth-child(n+1) .flatpickr-day.inRange:nth-child(7n+7){-webkit-box-shadow:none !important;box-shadow:none !important}.flatpickr-calendar.multiMonth .flatpickr-days .dayContainer:nth-child(n+2) .flatpickr-day.inRange:nth-child(7n+1){-webkit-box-shadow:-2px 0 0 #e6e6e6,5px 0 0 #e6e6e6;box-shadow:-2px 0 0 #e6e6e6,5px 0 0 #e6e6e6}.flatpickr-calendar .hasWeeks .dayContainer,.flatpickr-calendar .hasTime .dayContainer{border-bottom:0;border-bottom-right-radius:0;border-bottom-left-radius:0}.flatpickr-calendar .hasWeeks .dayContainer{border-left:0}.flatpickr-calendar.hasTime .flatpickr-time{height:40px;border-top:1px solid #e6e6e6}.flatpickr-calendar.noCalendar.hasTime .flatpickr-time{height:auto}.flatpickr-calendar:before,.flatpickr-calendar:after{position:absolute;display:block;pointer-events:none;border:solid transparent;content:'';height:0;width:0;left:22px}.flatpickr-calendar.rightMost:before,.flatpickr-calendar.arrowRight:before,.flatpickr-calendar.rightMost:after,.flatpickr-calendar.arrowRight:after{left:auto;right:22px}.flatpickr-calendar.arrowCenter:before,.flatpickr-calendar.arrowCenter:after{left:50%;right:50%}.flatpickr-calendar:before{border-width:5px;margin:0 -5px}.flatpickr-calendar:after{border-width:4px;margin:0 -4px}.flatpickr-calendar.arrowTop:before,.flatpickr-calendar.arrowTop:after{bottom:100%}.flatpickr-calendar.arrowTop:before{border-bottom-color:#e6e6e6}.flatpickr-calendar.arrowTop:after{border-bottom-color:#fff}.flatpickr-calendar.arrowBottom:before,.flatpickr-calendar.arrowBottom:after{top:100%}.flatpickr-calendar.arrowBottom:before{border-top-color:#e6e6e6}.flatpickr-calendar.arrowBottom:after{border-top-color:#fff}.flatpickr-calendar:focus{outline:0}.flatpickr-wrapper{position:relative;display:inline-block}.flatpickr-months{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex}.flatpickr-months .flatpickr-month{background:transparent;color:rgba(0,0,0,0.9);fill:rgba(0,0,0,0.9);height:34px;line-height:1;text-align:center;position:relative;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;overflow:hidden;-webkit-box-flex:1;-webkit-flex:1;-ms-flex:1;flex:1}.flatpickr-months .flatpickr-prev-month,.flatpickr-months .flatpickr-next-month{text-decoration:none;cursor:pointer;position:absolute;top:0;height:34px;padding:10px;z-index:3;color:rgba(0,0,0,0.9);fill:rgba(0,0,0,0.9)}.flatpickr-months .flatpickr-prev-month.flatpickr-disabled,.flatpickr-months .flatpickr-next-month.flatpickr-disabled{display:none}.flatpickr-months .flatpickr-prev-month i,.flatpickr-months .flatpickr-next-month i{position:relative}.flatpickr-months .flatpickr-prev-month.flatpickr-prev-month,.flatpickr-months .flatpickr-next-month.flatpickr-prev-month{/* + /*rtl:begin:ignore*/left:0/* + /*rtl:end:ignore*/}/* + /*rtl:begin:ignore*/ +/* + /*rtl:end:ignore*/ +.flatpickr-months .flatpickr-prev-month.flatpickr-next-month,.flatpickr-months .flatpickr-next-month.flatpickr-next-month{/* + /*rtl:begin:ignore*/right:0/* + /*rtl:end:ignore*/}/* + /*rtl:begin:ignore*/ +/* + /*rtl:end:ignore*/ +.flatpickr-months .flatpickr-prev-month:hover,.flatpickr-months .flatpickr-next-month:hover{color:#959ea9}.flatpickr-months .flatpickr-prev-month:hover svg,.flatpickr-months .flatpickr-next-month:hover svg{fill:#f64747}.flatpickr-months .flatpickr-prev-month svg,.flatpickr-months .flatpickr-next-month svg{width:14px;height:14px}.flatpickr-months .flatpickr-prev-month svg path,.flatpickr-months .flatpickr-next-month svg path{-webkit-transition:fill .1s;transition:fill .1s;fill:inherit}.numInputWrapper{position:relative;height:auto}.numInputWrapper input,.numInputWrapper span{display:inline-block}.numInputWrapper input{width:100%}.numInputWrapper input::-ms-clear{display:none}.numInputWrapper input::-webkit-outer-spin-button,.numInputWrapper input::-webkit-inner-spin-button{margin:0;-webkit-appearance:none}.numInputWrapper span{position:absolute;right:0;width:14px;padding:0 4px 0 2px;height:50%;line-height:50%;opacity:0;cursor:pointer;border:1px solid rgba(57,57,57,0.15);-webkit-box-sizing:border-box;box-sizing:border-box}.numInputWrapper span:hover{background:rgba(0,0,0,0.1)}.numInputWrapper span:active{background:rgba(0,0,0,0.2)}.numInputWrapper span:after{display:block;content:"";position:absolute}.numInputWrapper span.arrowUp{top:0;border-bottom:0}.numInputWrapper span.arrowUp:after{border-left:4px solid transparent;border-right:4px solid transparent;border-bottom:4px solid rgba(57,57,57,0.6);top:26%}.numInputWrapper span.arrowDown{top:50%}.numInputWrapper span.arrowDown:after{border-left:4px solid transparent;border-right:4px solid transparent;border-top:4px solid rgba(57,57,57,0.6);top:40%}.numInputWrapper span svg{width:inherit;height:auto}.numInputWrapper span svg path{fill:rgba(0,0,0,0.5)}.numInputWrapper:hover{background:rgba(0,0,0,0.05)}.numInputWrapper:hover span{opacity:1}.flatpickr-current-month{font-size:135%;line-height:inherit;font-weight:300;color:inherit;position:absolute;width:75%;left:12.5%;padding:7.48px 0 0 0;line-height:1;height:34px;display:inline-block;text-align:center;-webkit-transform:translate3d(0,0,0);transform:translate3d(0,0,0)}.flatpickr-current-month span.cur-month{font-family:inherit;font-weight:700;color:inherit;display:inline-block;margin-left:.5ch;padding:0}.flatpickr-current-month span.cur-month:hover{background:rgba(0,0,0,0.05)}.flatpickr-current-month .numInputWrapper{width:6ch;width:7ch\0;display:inline-block}.flatpickr-current-month .numInputWrapper span.arrowUp:after{border-bottom-color:rgba(0,0,0,0.9)}.flatpickr-current-month .numInputWrapper span.arrowDown:after{border-top-color:rgba(0,0,0,0.9)}.flatpickr-current-month input.cur-year{background:transparent;-webkit-box-sizing:border-box;box-sizing:border-box;color:inherit;cursor:text;padding:0 0 0 .5ch;margin:0;display:inline-block;font-size:inherit;font-family:inherit;font-weight:300;line-height:inherit;height:auto;border:0;border-radius:0;vertical-align:initial;-webkit-appearance:textfield;-moz-appearance:textfield;appearance:textfield}.flatpickr-current-month input.cur-year:focus{outline:0}.flatpickr-current-month input.cur-year[disabled],.flatpickr-current-month input.cur-year[disabled]:hover{font-size:100%;color:rgba(0,0,0,0.5);background:transparent;pointer-events:none}.flatpickr-current-month .flatpickr-monthDropdown-months{appearance:menulist;background:transparent;border:none;border-radius:0;box-sizing:border-box;color:inherit;cursor:pointer;font-size:inherit;font-family:inherit;font-weight:300;height:auto;line-height:inherit;margin:-1px 0 0 0;outline:none;padding:0 0 0 .5ch;position:relative;vertical-align:initial;-webkit-box-sizing:border-box;-webkit-appearance:menulist;-moz-appearance:menulist;width:auto}.flatpickr-current-month .flatpickr-monthDropdown-months:focus,.flatpickr-current-month .flatpickr-monthDropdown-months:active{outline:none}.flatpickr-current-month .flatpickr-monthDropdown-months:hover{background:rgba(0,0,0,0.05)}.flatpickr-current-month .flatpickr-monthDropdown-months .flatpickr-monthDropdown-month{background-color:transparent;outline:none;padding:0}.flatpickr-weekdays{background:transparent;text-align:center;overflow:hidden;width:100%;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-box-align:center;-webkit-align-items:center;-ms-flex-align:center;align-items:center;height:28px}.flatpickr-weekdays .flatpickr-weekdaycontainer{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-box-flex:1;-webkit-flex:1;-ms-flex:1;flex:1}span.flatpickr-weekday{cursor:default;font-size:90%;background:transparent;color:rgba(0,0,0,0.54);line-height:1;margin:0;text-align:center;display:block;-webkit-box-flex:1;-webkit-flex:1;-ms-flex:1;flex:1;font-weight:bolder}.dayContainer,.flatpickr-weeks{padding:1px 0 0 0}.flatpickr-days{position:relative;overflow:hidden;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-box-align:start;-webkit-align-items:flex-start;-ms-flex-align:start;align-items:flex-start;width:307.875px}.flatpickr-days:focus{outline:0}.dayContainer{padding:0;outline:0;text-align:left;width:307.875px;min-width:307.875px;max-width:307.875px;-webkit-box-sizing:border-box;box-sizing:border-box;display:inline-block;display:-ms-flexbox;display:-webkit-box;display:-webkit-flex;display:flex;-webkit-flex-wrap:wrap;flex-wrap:wrap;-ms-flex-wrap:wrap;-ms-flex-pack:justify;-webkit-justify-content:space-around;justify-content:space-around;-webkit-transform:translate3d(0,0,0);transform:translate3d(0,0,0);opacity:1}.dayContainer + .dayContainer{-webkit-box-shadow:-1px 0 0 #e6e6e6;box-shadow:-1px 0 0 #e6e6e6}.flatpickr-day{background:none;border:1px solid transparent;border-radius:150px;-webkit-box-sizing:border-box;box-sizing:border-box;color:#393939;cursor:pointer;font-weight:400;width:14.2857143%;-webkit-flex-basis:14.2857143%;-ms-flex-preferred-size:14.2857143%;flex-basis:14.2857143%;max-width:39px;height:39px;line-height:39px;margin:0;display:inline-block;position:relative;-webkit-box-pack:center;-webkit-justify-content:center;-ms-flex-pack:center;justify-content:center;text-align:center}.flatpickr-day.inRange,.flatpickr-day.prevMonthDay.inRange,.flatpickr-day.nextMonthDay.inRange,.flatpickr-day.today.inRange,.flatpickr-day.prevMonthDay.today.inRange,.flatpickr-day.nextMonthDay.today.inRange,.flatpickr-day:hover,.flatpickr-day.prevMonthDay:hover,.flatpickr-day.nextMonthDay:hover,.flatpickr-day:focus,.flatpickr-day.prevMonthDay:focus,.flatpickr-day.nextMonthDay:focus{cursor:pointer;outline:0;background:#e6e6e6;border-color:#e6e6e6}.flatpickr-day.today{border-color:#959ea9}.flatpickr-day.today:hover,.flatpickr-day.today:focus{border-color:#959ea9;background:#959ea9;color:#fff}.flatpickr-day.selected,.flatpickr-day.startRange,.flatpickr-day.endRange,.flatpickr-day.selected.inRange,.flatpickr-day.startRange.inRange,.flatpickr-day.endRange.inRange,.flatpickr-day.selected:focus,.flatpickr-day.startRange:focus,.flatpickr-day.endRange:focus,.flatpickr-day.selected:hover,.flatpickr-day.startRange:hover,.flatpickr-day.endRange:hover,.flatpickr-day.selected.prevMonthDay,.flatpickr-day.startRange.prevMonthDay,.flatpickr-day.endRange.prevMonthDay,.flatpickr-day.selected.nextMonthDay,.flatpickr-day.startRange.nextMonthDay,.flatpickr-day.endRange.nextMonthDay{background:#569ff7;-webkit-box-shadow:none;box-shadow:none;color:#fff;border-color:#569ff7}.flatpickr-day.selected.startRange,.flatpickr-day.startRange.startRange,.flatpickr-day.endRange.startRange{border-radius:50px 0 0 50px}.flatpickr-day.selected.endRange,.flatpickr-day.startRange.endRange,.flatpickr-day.endRange.endRange{border-radius:0 50px 50px 0}.flatpickr-day.selected.startRange + .endRange:not(:nth-child(7n+1)),.flatpickr-day.startRange.startRange + .endRange:not(:nth-child(7n+1)),.flatpickr-day.endRange.startRange + .endRange:not(:nth-child(7n+1)){-webkit-box-shadow:-10px 0 0 #569ff7;box-shadow:-10px 0 0 #569ff7}.flatpickr-day.selected.startRange.endRange,.flatpickr-day.startRange.startRange.endRange,.flatpickr-day.endRange.startRange.endRange{border-radius:50px}.flatpickr-day.inRange{border-radius:0;-webkit-box-shadow:-5px 0 0 #e6e6e6,5px 0 0 #e6e6e6;box-shadow:-5px 0 0 #e6e6e6,5px 0 0 #e6e6e6}.flatpickr-day.flatpickr-disabled,.flatpickr-day.flatpickr-disabled:hover,.flatpickr-day.prevMonthDay,.flatpickr-day.nextMonthDay,.flatpickr-day.notAllowed,.flatpickr-day.notAllowed.prevMonthDay,.flatpickr-day.notAllowed.nextMonthDay{color:rgba(57,57,57,0.3);background:transparent;border-color:transparent;cursor:default}.flatpickr-day.flatpickr-disabled,.flatpickr-day.flatpickr-disabled:hover{cursor:not-allowed;color:rgba(57,57,57,0.1)}.flatpickr-day.week.selected{border-radius:0;-webkit-box-shadow:-5px 0 0 #569ff7,5px 0 0 #569ff7;box-shadow:-5px 0 0 #569ff7,5px 0 0 #569ff7}.flatpickr-day.hidden{visibility:hidden}.rangeMode .flatpickr-day{margin-top:1px}.flatpickr-weekwrapper{float:left}.flatpickr-weekwrapper .flatpickr-weeks{padding:0 12px;-webkit-box-shadow:1px 0 0 #e6e6e6;box-shadow:1px 0 0 #e6e6e6}.flatpickr-weekwrapper .flatpickr-weekday{float:none;width:100%;line-height:28px}.flatpickr-weekwrapper span.flatpickr-day,.flatpickr-weekwrapper span.flatpickr-day:hover{display:block;width:100%;max-width:none;color:rgba(57,57,57,0.3);background:transparent;cursor:default;border:none}.flatpickr-innerContainer{display:block;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-box-sizing:border-box;box-sizing:border-box;overflow:hidden}.flatpickr-rContainer{display:inline-block;padding:0;-webkit-box-sizing:border-box;box-sizing:border-box}.flatpickr-time{text-align:center;outline:0;display:block;height:0;line-height:40px;max-height:40px;-webkit-box-sizing:border-box;box-sizing:border-box;overflow:hidden;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex}.flatpickr-time:after{content:"";display:table;clear:both}.flatpickr-time .numInputWrapper{-webkit-box-flex:1;-webkit-flex:1;-ms-flex:1;flex:1;width:40%;height:40px;float:left}.flatpickr-time .numInputWrapper span.arrowUp:after{border-bottom-color:#393939}.flatpickr-time .numInputWrapper span.arrowDown:after{border-top-color:#393939}.flatpickr-time.hasSeconds .numInputWrapper{width:26%}.flatpickr-time.time24hr .numInputWrapper{width:49%}.flatpickr-time input{background:transparent;-webkit-box-shadow:none;box-shadow:none;border:0;border-radius:0;text-align:center;margin:0;padding:0;height:inherit;line-height:inherit;color:#393939;font-size:14px;position:relative;-webkit-box-sizing:border-box;box-sizing:border-box;-webkit-appearance:textfield;-moz-appearance:textfield;appearance:textfield}.flatpickr-time input.flatpickr-hour{font-weight:bold}.flatpickr-time input.flatpickr-minute,.flatpickr-time input.flatpickr-second{font-weight:400}.flatpickr-time input:focus{outline:0;border:0}.flatpickr-time .flatpickr-time-separator,.flatpickr-time .flatpickr-am-pm{height:inherit;float:left;line-height:inherit;color:#393939;font-weight:bold;width:2%;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;-webkit-align-self:center;-ms-flex-item-align:center;align-self:center}.flatpickr-time .flatpickr-am-pm{outline:0;width:18%;cursor:pointer;text-align:center;font-weight:400}.flatpickr-time input:hover,.flatpickr-time .flatpickr-am-pm:hover,.flatpickr-time input:focus,.flatpickr-time .flatpickr-am-pm:focus{background:#eee}.flatpickr-input[readonly]{cursor:pointer}@-webkit-keyframes fpFadeInDown{from{opacity:0;-webkit-transform:translate3d(0,-20px,0);transform:translate3d(0,-20px,0)}to{opacity:1;-webkit-transform:translate3d(0,0,0);transform:translate3d(0,0,0)}}@keyframes fpFadeInDown{from{opacity:0;-webkit-transform:translate3d(0,-20px,0);transform:translate3d(0,-20px,0)}to{opacity:1;-webkit-transform:translate3d(0,0,0);transform:translate3d(0,0,0)}} \ No newline at end of file diff --git a/admin/js/vendors/flatpickr/flatpickr.min.js b/admin/js/vendors/flatpickr/flatpickr.min.js new file mode 100644 index 0000000..bded21e --- /dev/null +++ b/admin/js/vendors/flatpickr/flatpickr.min.js @@ -0,0 +1,2 @@ +/* flatpickr v4.6.6,, @license MIT */ +!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):(e=e||self).flatpickr=n()}(this,(function(){"use strict";var e=function(){return(e=Object.assign||function(e){for(var n,t=1,a=arguments.length;t",noCalendar:!1,now:new Date,onChange:[],onClose:[],onDayCreate:[],onDestroy:[],onKeyDown:[],onMonthChange:[],onOpen:[],onParseConfig:[],onReady:[],onValueUpdate:[],onYearChange:[],onPreCalendarPosition:[],plugins:[],position:"auto",positionElement:void 0,prevArrow:"",shorthandCurrentMonth:!1,showMonths:1,static:!1,time_24hr:!1,weekNumbers:!1,wrap:!1},i={weekdays:{shorthand:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],longhand:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},months:{shorthand:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],longhand:["January","February","March","April","May","June","July","August","September","October","November","December"]},daysInMonth:[31,28,31,30,31,30,31,31,30,31,30,31],firstDayOfWeek:0,ordinal:function(e){var n=e%100;if(n>3&&n<21)return"th";switch(n%10){case 1:return"st";case 2:return"nd";case 3:return"rd";default:return"th"}},rangeSeparator:" to ",weekAbbreviation:"Wk",scrollTitle:"Scroll to increment",toggleTitle:"Click to toggle",amPM:["AM","PM"],yearAriaLabel:"Year",monthAriaLabel:"Month",hourAriaLabel:"Hour",minuteAriaLabel:"Minute",time_24hr:!1},o=function(e,n){return void 0===n&&(n=2),("000"+e).slice(-1*n)},r=function(e){return!0===e?1:0};function l(e,n,t){var a;return void 0===t&&(t=!1),function(){var i=this,o=arguments;null!==a&&clearTimeout(a),a=window.setTimeout((function(){a=null,t||e.apply(i,o)}),n),t&&!a&&e.apply(i,o)}}var c=function(e){return e instanceof Array?e:[e]};function d(e,n,t){if(!0===t)return e.classList.add(n);e.classList.remove(n)}function s(e,n,t){var a=window.document.createElement(e);return n=n||"",t=t||"",a.className=n,void 0!==t&&(a.textContent=t),a}function u(e){for(;e.firstChild;)e.removeChild(e.firstChild)}function f(e,n){var t=s("div","numInputWrapper"),a=s("input","numInput "+e),i=s("span","arrowUp"),o=s("span","arrowDown");if(-1===navigator.userAgent.indexOf("MSIE 9.0")?a.type="number":(a.type="text",a.pattern="\\d*"),void 0!==n)for(var r in n)a.setAttribute(r,n[r]);return t.appendChild(a),t.appendChild(i),t.appendChild(o),t}function m(e){try{return"function"==typeof e.composedPath?e.composedPath()[0]:e.target}catch(n){return e.target}}var g=function(){},p=function(e,n,t){return t.months[n?"shorthand":"longhand"][e]},h={D:g,F:function(e,n,t){e.setMonth(t.months.longhand.indexOf(n))},G:function(e,n){e.setHours(parseFloat(n))},H:function(e,n){e.setHours(parseFloat(n))},J:function(e,n){e.setDate(parseFloat(n))},K:function(e,n,t){e.setHours(e.getHours()%12+12*r(new RegExp(t.amPM[1],"i").test(n)))},M:function(e,n,t){e.setMonth(t.months.shorthand.indexOf(n))},S:function(e,n){e.setSeconds(parseFloat(n))},U:function(e,n){return new Date(1e3*parseFloat(n))},W:function(e,n,t){var a=parseInt(n),i=new Date(e.getFullYear(),0,2+7*(a-1),0,0,0,0);return i.setDate(i.getDate()-i.getDay()+t.firstDayOfWeek),i},Y:function(e,n){e.setFullYear(parseFloat(n))},Z:function(e,n){return new Date(n)},d:function(e,n){e.setDate(parseFloat(n))},h:function(e,n){e.setHours(parseFloat(n))},i:function(e,n){e.setMinutes(parseFloat(n))},j:function(e,n){e.setDate(parseFloat(n))},l:g,m:function(e,n){e.setMonth(parseFloat(n)-1)},n:function(e,n){e.setMonth(parseFloat(n)-1)},s:function(e,n){e.setSeconds(parseFloat(n))},u:function(e,n){return new Date(parseFloat(n))},w:g,y:function(e,n){e.setFullYear(2e3+parseFloat(n))}},v={D:"(\\w+)",F:"(\\w+)",G:"(\\d\\d|\\d)",H:"(\\d\\d|\\d)",J:"(\\d\\d|\\d)\\w+",K:"",M:"(\\w+)",S:"(\\d\\d|\\d)",U:"(.+)",W:"(\\d\\d|\\d)",Y:"(\\d{4})",Z:"(.+)",d:"(\\d\\d|\\d)",h:"(\\d\\d|\\d)",i:"(\\d\\d|\\d)",j:"(\\d\\d|\\d)",l:"(\\w+)",m:"(\\d\\d|\\d)",n:"(\\d\\d|\\d)",s:"(\\d\\d|\\d)",u:"(.+)",w:"(\\d\\d|\\d)",y:"(\\d{2})"},D={Z:function(e){return e.toISOString()},D:function(e,n,t){return n.weekdays.shorthand[D.w(e,n,t)]},F:function(e,n,t){return p(D.n(e,n,t)-1,!1,n)},G:function(e,n,t){return o(D.h(e,n,t))},H:function(e){return o(e.getHours())},J:function(e,n){return void 0!==n.ordinal?e.getDate()+n.ordinal(e.getDate()):e.getDate()},K:function(e,n){return n.amPM[r(e.getHours()>11)]},M:function(e,n){return p(e.getMonth(),!0,n)},S:function(e){return o(e.getSeconds())},U:function(e){return e.getTime()/1e3},W:function(e,n,t){return t.getWeek(e)},Y:function(e){return o(e.getFullYear(),4)},d:function(e){return o(e.getDate())},h:function(e){return e.getHours()%12?e.getHours()%12:12},i:function(e){return o(e.getMinutes())},j:function(e){return e.getDate()},l:function(e,n){return n.weekdays.longhand[e.getDay()]},m:function(e){return o(e.getMonth()+1)},n:function(e){return e.getMonth()+1},s:function(e){return e.getSeconds()},u:function(e){return e.getTime()},w:function(e){return e.getDay()},y:function(e){return String(e.getFullYear()).substring(2)}},w=function(e){var n=e.config,t=void 0===n?a:n,o=e.l10n,r=void 0===o?i:o,l=e.isMobile,c=void 0!==l&&l;return function(e,n,a){var i=a||r;return void 0===t.formatDate||c?n.split("").map((function(n,a,o){return D[n]&&"\\"!==o[a-1]?D[n](e,i,t):"\\"!==n?n:""})).join(""):t.formatDate(e,n,i)}},b=function(e){var n=e.config,t=void 0===n?a:n,o=e.l10n,r=void 0===o?i:o;return function(e,n,i,o){if(0===e||e){var l,c=o||r,d=e;if(e instanceof Date)l=new Date(e.getTime());else if("string"!=typeof e&&void 0!==e.toFixed)l=new Date(e);else if("string"==typeof e){var s=n||(t||a).dateFormat,u=String(e).trim();if("today"===u)l=new Date,i=!0;else if(/Z$/.test(u)||/GMT$/.test(u))l=new Date(e);else if(t&&t.parseDate)l=t.parseDate(e,s);else{l=t&&t.noCalendar?new Date((new Date).setHours(0,0,0,0)):new Date((new Date).getFullYear(),0,1,0,0,0,0);for(var f=void 0,m=[],g=0,p=0,D="";gl&&(u=a===D.hourElement?u-l-r(!D.amPM):i,g&&Y(void 0,1,D.hourElement)),D.amPM&&f&&(1===c?u+d===23:Math.abs(u-d)>c)&&(D.amPM.textContent=D.l10n.amPM[r(D.amPM.textContent===D.l10n.amPM[0])]),a.value=o(u)}}(e);var c=D._input.value;T(),we(),D._input.value!==c&&D._debouncedChange()}function T(){if(void 0!==D.hourElement&&void 0!==D.minuteElement){var e,n,t=(parseInt(D.hourElement.value.slice(-2),10)||0)%24,a=(parseInt(D.minuteElement.value,10)||0)%60,i=void 0!==D.secondElement?(parseInt(D.secondElement.value,10)||0)%60:0;void 0!==D.amPM&&(e=t,n=D.amPM.textContent,t=e%12+12*r(n===D.l10n.amPM[1]));var o=void 0!==D.config.minTime||D.config.minDate&&D.minDateHasTime&&D.latestSelectedDateObj&&0===C(D.latestSelectedDateObj,D.config.minDate,!0);if(void 0!==D.config.maxTime||D.config.maxDate&&D.maxDateHasTime&&D.latestSelectedDateObj&&0===C(D.latestSelectedDateObj,D.config.maxDate,!0)){var l=void 0!==D.config.maxTime?D.config.maxTime:D.config.maxDate;(t=Math.min(t,l.getHours()))===l.getHours()&&(a=Math.min(a,l.getMinutes())),a===l.getMinutes()&&(i=Math.min(i,l.getSeconds()))}if(o){var c=void 0!==D.config.minTime?D.config.minTime:D.config.minDate;(t=Math.max(t,c.getHours()))===c.getHours()&&(a=Math.max(a,c.getMinutes())),a===c.getMinutes()&&(i=Math.max(i,c.getSeconds()))}_(t,a,i)}}function I(e){var n=e||D.latestSelectedDateObj;n&&_(n.getHours(),n.getMinutes(),n.getSeconds())}function S(){var e=D.config.defaultHour,n=D.config.defaultMinute,t=D.config.defaultSeconds;if(void 0!==D.config.minDate){var a=D.config.minDate.getHours(),i=D.config.minDate.getMinutes();(e=Math.max(e,a))===a&&(n=Math.max(i,n)),e===a&&n===i&&(t=D.config.minDate.getSeconds())}if(void 0!==D.config.maxDate){var o=D.config.maxDate.getHours(),r=D.config.maxDate.getMinutes();(e=Math.min(e,o))===o&&(n=Math.min(r,n)),e===o&&n===r&&(t=D.config.maxDate.getSeconds())}return{hours:e,minutes:n,seconds:t}}function _(e,n,t){void 0!==D.latestSelectedDateObj&&D.latestSelectedDateObj.setHours(e%24,n,t||0,0),D.hourElement&&D.minuteElement&&!D.isMobile&&(D.hourElement.value=o(D.config.time_24hr?e:(12+e)%12+12*r(e%12==0)),D.minuteElement.value=o(n),void 0!==D.amPM&&(D.amPM.textContent=D.l10n.amPM[r(e>=12)]),void 0!==D.secondElement&&(D.secondElement.value=o(t)))}function O(e){var n=m(e),t=parseInt(n.value)+(e.delta||0);(t/1e3>1||"Enter"===e.key&&!/[^\d]/.test(t.toString()))&&Z(t)}function F(e,n,t,a){return n instanceof Array?n.forEach((function(n){return F(e,n,t,a)})):e instanceof Array?e.forEach((function(e){return F(e,n,t,a)})):(e.addEventListener(n,t,a),void D._handlers.push({element:e,event:n,handler:t,options:a}))}function N(){ge("onChange")}function A(e,n){var t=void 0!==e?D.parseDate(e):D.latestSelectedDateObj||(D.config.minDate&&D.config.minDate>D.now?D.config.minDate:D.config.maxDate&&D.config.maxDate=0&&C(e,D.selectedDates[1])<=0)}(n)&&!he(n)&&o.classList.add("inRange"),D.weekNumbers&&1===D.config.showMonths&&"prevMonthDay"!==e&&t%7==1&&D.weekNumbers.insertAdjacentHTML("beforeend",""+D.config.getWeek(n)+""),ge("onDayCreate",o),o}function j(e){e.focus(),"range"===D.config.mode&&te(e)}function L(e){for(var n=e>0?0:D.config.showMonths-1,t=e>0?D.config.showMonths:-1,a=n;a!=t;a+=e)for(var i=D.daysContainer.children[a],o=e>0?0:i.children.length-1,r=e>0?i.children.length:-1,l=o;l!=r;l+=e){var c=i.children[l];if(-1===c.className.indexOf("hidden")&&Q(c.dateObj))return c}}function W(e,n){var t=X(document.activeElement||document.body),a=void 0!==e?e:t?document.activeElement:void 0!==D.selectedDateElem&&X(D.selectedDateElem)?D.selectedDateElem:void 0!==D.todayDateElem&&X(D.todayDateElem)?D.todayDateElem:L(n>0?1:-1);void 0===a?D._input.focus():t?function(e,n){for(var t=-1===e.className.indexOf("Month")?e.dateObj.getMonth():D.currentMonth,a=n>0?D.config.showMonths:-1,i=n>0?1:-1,o=t-D.currentMonth;o!=a;o+=i)for(var r=D.daysContainer.children[o],l=t-D.currentMonth===o?e.$i+n:n<0?r.children.length-1:0,c=r.children.length,d=l;d>=0&&d0?c:-1);d+=i){var s=r.children[d];if(-1===s.className.indexOf("hidden")&&Q(s.dateObj)&&Math.abs(e.$i-d)>=Math.abs(n))return j(s)}D.changeMonth(i),W(L(i),0)}(a,n):j(a)}function R(e,n){for(var t=(new Date(e,n,1).getDay()-D.l10n.firstDayOfWeek+7)%7,a=D.utils.getDaysInMonth((n-1+12)%12,e),i=D.utils.getDaysInMonth(n,e),o=window.document.createDocumentFragment(),r=D.config.showMonths>1,l=r?"prevMonthDay hidden":"prevMonthDay",c=r?"nextMonthDay hidden":"nextMonthDay",d=a+1-t,u=0;d<=a;d++,u++)o.appendChild(H(l,new Date(e,n-1,d),d,u));for(d=1;d<=i;d++,u++)o.appendChild(H("",new Date(e,n,d),d,u));for(var f=i+1;f<=42-t&&(1===D.config.showMonths||u%7!=0);f++,u++)o.appendChild(H(c,new Date(e,n+1,f%i),f,u));var m=s("div","dayContainer");return m.appendChild(o),m}function B(){if(void 0!==D.daysContainer){u(D.daysContainer),D.weekNumbers&&u(D.weekNumbers);for(var e=document.createDocumentFragment(),n=0;n1||"dropdown"!==D.config.monthSelectorType)){var e=function(e){return!(void 0!==D.config.minDate&&D.currentYear===D.config.minDate.getFullYear()&&eD.config.maxDate.getMonth())};D.monthsDropdownContainer.tabIndex=-1,D.monthsDropdownContainer.innerHTML="";for(var n=0;n<12;n++)if(e(n)){var t=s("option","flatpickr-monthDropdown-month");t.value=new Date(D.currentYear,n).getMonth().toString(),t.textContent=p(n,D.config.shorthandCurrentMonth,D.l10n),t.tabIndex=-1,D.currentMonth===n&&(t.selected=!0),D.monthsDropdownContainer.appendChild(t)}}}function K(){var e,n=s("div","flatpickr-month"),t=window.document.createDocumentFragment();D.config.showMonths>1||"static"===D.config.monthSelectorType?e=s("span","cur-month"):(D.monthsDropdownContainer=s("select","flatpickr-monthDropdown-months"),D.monthsDropdownContainer.setAttribute("aria-label",D.l10n.monthAriaLabel),F(D.monthsDropdownContainer,"change",(function(e){var n=m(e),t=parseInt(n.value,10);D.changeMonth(t-D.currentMonth),ge("onMonthChange")})),J(),e=D.monthsDropdownContainer);var a=f("cur-year",{tabindex:"-1"}),i=a.getElementsByTagName("input")[0];i.setAttribute("aria-label",D.l10n.yearAriaLabel),D.config.minDate&&i.setAttribute("min",D.config.minDate.getFullYear().toString()),D.config.maxDate&&(i.setAttribute("max",D.config.maxDate.getFullYear().toString()),i.disabled=!!D.config.minDate&&D.config.minDate.getFullYear()===D.config.maxDate.getFullYear());var o=s("div","flatpickr-current-month");return o.appendChild(e),o.appendChild(a),t.appendChild(o),n.appendChild(t),{container:n,yearElement:i,monthElement:e}}function U(){u(D.monthNav),D.monthNav.appendChild(D.prevMonthNav),D.config.showMonths&&(D.yearElements=[],D.monthElements=[]);for(var e=D.config.showMonths;e--;){var n=K();D.yearElements.push(n.yearElement),D.monthElements.push(n.monthElement),D.monthNav.appendChild(n.container)}D.monthNav.appendChild(D.nextMonthNav)}function q(){D.weekdayContainer?u(D.weekdayContainer):D.weekdayContainer=s("div","flatpickr-weekdays");for(var e=D.config.showMonths;e--;){var n=s("div","flatpickr-weekdaycontainer");D.weekdayContainer.appendChild(n)}return $(),D.weekdayContainer}function $(){if(D.weekdayContainer){var e=D.l10n.firstDayOfWeek,t=n(D.l10n.weekdays.shorthand);e>0&&e\n "+t.join("")+"\n \n "}}function z(e,n){void 0===n&&(n=!0);var t=n?e:e-D.currentMonth;t<0&&!0===D._hidePrevMonthArrow||t>0&&!0===D._hideNextMonthArrow||(D.currentMonth+=t,(D.currentMonth<0||D.currentMonth>11)&&(D.currentYear+=D.currentMonth>11?1:-1,D.currentMonth=(D.currentMonth+12)%12,ge("onYearChange"),J()),B(),ge("onMonthChange"),ve())}function G(e){return!(!D.config.appendTo||!D.config.appendTo.contains(e))||D.calendarContainer.contains(e)}function V(e){if(D.isOpen&&!D.config.inline){var n=m(e),t=G(n),a=n===D.input||n===D.altInput||D.element.contains(n)||e.path&&e.path.indexOf&&(~e.path.indexOf(D.input)||~e.path.indexOf(D.altInput)),i="blur"===e.type?a&&e.relatedTarget&&!G(e.relatedTarget):!a&&!t&&!G(e.relatedTarget),o=!D.config.ignoredFocusElements.some((function(e){return e.contains(n)}));i&&o&&(void 0!==D.timeContainer&&void 0!==D.minuteElement&&void 0!==D.hourElement&&""!==D.input.value&&void 0!==D.input.value&&k(),D.close(),D.config&&"range"===D.config.mode&&1===D.selectedDates.length&&(D.clear(!1),D.redraw()))}}function Z(e){if(!(!e||D.config.minDate&&eD.config.maxDate.getFullYear())){var n=e,t=D.currentYear!==n;D.currentYear=n||D.currentYear,D.config.maxDate&&D.currentYear===D.config.maxDate.getFullYear()?D.currentMonth=Math.min(D.config.maxDate.getMonth(),D.currentMonth):D.config.minDate&&D.currentYear===D.config.minDate.getFullYear()&&(D.currentMonth=Math.max(D.config.minDate.getMonth(),D.currentMonth)),t&&(D.redraw(),ge("onYearChange"),J())}}function Q(e,n){void 0===n&&(n=!0);var t=D.parseDate(e,void 0,n);if(D.config.minDate&&t&&C(t,D.config.minDate,void 0!==n?n:!D.minDateHasTime)<0||D.config.maxDate&&t&&C(t,D.config.maxDate,void 0!==n?n:!D.maxDateHasTime)>0)return!1;if(0===D.config.enable.length&&0===D.config.disable.length)return!0;if(void 0===t)return!1;for(var a=D.config.enable.length>0,i=a?D.config.enable:D.config.disable,o=0,r=void 0;o=r.from.getTime()&&t.getTime()<=r.to.getTime())return a}return!a}function X(e){return void 0!==D.daysContainer&&(-1===e.className.indexOf("hidden")&&-1===e.className.indexOf("flatpickr-disabled")&&D.daysContainer.contains(e))}function ee(e){!(e.target===D._input)||e.relatedTarget&&G(e.relatedTarget)||D.setDate(D._input.value,!0,e.target===D.altInput?D.config.altFormat:D.config.dateFormat)}function ne(e){var n=m(e),t=D.config.wrap?g.contains(n):n===D._input,a=D.config.allowInput,i=D.isOpen&&(!a||!t),o=D.config.inline&&t&&!a;if(13===e.keyCode&&t){if(a)return D.setDate(D._input.value,!0,n===D.altInput?D.config.altFormat:D.config.dateFormat),n.blur();D.open()}else if(G(n)||i||o){var r=!!D.timeContainer&&D.timeContainer.contains(n);switch(e.keyCode){case 13:r?(e.preventDefault(),k(),de()):se(e);break;case 27:e.preventDefault(),de();break;case 8:case 46:t&&!D.config.allowInput&&(e.preventDefault(),D.clear());break;case 37:case 39:if(r||t)D.hourElement&&D.hourElement.focus();else if(e.preventDefault(),void 0!==D.daysContainer&&(!1===a||document.activeElement&&X(document.activeElement))){var l=39===e.keyCode?1:-1;e.ctrlKey?(e.stopPropagation(),z(l),W(L(1),0)):W(void 0,l)}break;case 38:case 40:e.preventDefault();var c=40===e.keyCode?1:-1;D.daysContainer&&void 0!==n.$i||n===D.input||n===D.altInput?e.ctrlKey?(e.stopPropagation(),Z(D.currentYear-c),W(L(1),0)):r||W(void 0,7*c):n===D.currentYearElement?Z(D.currentYear-c):D.config.enableTime&&(!r&&D.hourElement&&D.hourElement.focus(),k(e),D._debouncedChange());break;case 9:if(r){var d=[D.hourElement,D.minuteElement,D.secondElement,D.amPM].concat(D.pluginElements).filter((function(e){return e})),s=d.indexOf(n);if(-1!==s){var u=d[s+(e.shiftKey?-1:1)];e.preventDefault(),(u||D._input).focus()}}else!D.config.noCalendar&&D.daysContainer&&D.daysContainer.contains(n)&&e.shiftKey&&(e.preventDefault(),D._input.focus())}}if(void 0!==D.amPM&&n===D.amPM)switch(e.key){case D.l10n.amPM[0].charAt(0):case D.l10n.amPM[0].charAt(0).toLowerCase():D.amPM.textContent=D.l10n.amPM[0],T(),we();break;case D.l10n.amPM[1].charAt(0):case D.l10n.amPM[1].charAt(0).toLowerCase():D.amPM.textContent=D.l10n.amPM[1],T(),we()}(t||G(n))&&ge("onKeyDown",e)}function te(e){if(1===D.selectedDates.length&&(!e||e.classList.contains("flatpickr-day")&&!e.classList.contains("flatpickr-disabled"))){for(var n=e?e.dateObj.getTime():D.days.firstElementChild.dateObj.getTime(),t=D.parseDate(D.selectedDates[0],void 0,!0).getTime(),a=Math.min(n,D.selectedDates[0].getTime()),i=Math.max(n,D.selectedDates[0].getTime()),o=!1,r=0,l=0,c=a;ca&&cr)?r=c:c>t&&(!l||c0&&m0&&m>l;return g?(f.classList.add("notAllowed"),["inRange","startRange","endRange"].forEach((function(e){f.classList.remove(e)})),"continue"):o&&!g?"continue":(["startRange","inRange","endRange","notAllowed"].forEach((function(e){f.classList.remove(e)})),void(void 0!==e&&(e.classList.add(n<=D.selectedDates[0].getTime()?"startRange":"endRange"),tn&&m===t&&f.classList.add("endRange"),m>=r&&(0===l||m<=l)&&(d=t,u=n,(c=m)>Math.min(d,u)&&c0||t.getMinutes()>0||t.getSeconds()>0),D.selectedDates&&(D.selectedDates=D.selectedDates.filter((function(e){return Q(e)})),D.selectedDates.length||"min"!==e||I(t),we()),D.daysContainer&&(ce(),void 0!==t?D.currentYearElement[e]=t.getFullYear().toString():D.currentYearElement.removeAttribute(e),D.currentYearElement.disabled=!!a&&void 0!==t&&a.getFullYear()===t.getFullYear())}}function oe(){return D.config.wrap?g.querySelector("[data-input]"):g}function re(){"object"!=typeof D.config.locale&&void 0===E.l10ns[D.config.locale]&&D.config.errorHandler(new Error("flatpickr: invalid locale "+D.config.locale)),D.l10n=e(e({},E.l10ns.default),"object"==typeof D.config.locale?D.config.locale:"default"!==D.config.locale?E.l10ns[D.config.locale]:void 0),v.K="("+D.l10n.amPM[0]+"|"+D.l10n.amPM[1]+"|"+D.l10n.amPM[0].toLowerCase()+"|"+D.l10n.amPM[1].toLowerCase()+")",void 0===e(e({},h),JSON.parse(JSON.stringify(g.dataset||{}))).time_24hr&&void 0===E.defaultConfig.time_24hr&&(D.config.time_24hr=D.l10n.time_24hr),D.formatDate=w(D),D.parseDate=b({config:D.config,l10n:D.l10n})}function le(e){if(void 0!==D.calendarContainer){ge("onPreCalendarPosition");var n=e||D._positionElement,t=Array.prototype.reduce.call(D.calendarContainer.children,(function(e,n){return e+n.offsetHeight}),0),a=D.calendarContainer.offsetWidth,i=D.config.position.split(" "),o=i[0],r=i.length>1?i[1]:null,l=n.getBoundingClientRect(),c=window.innerHeight-l.bottom,s="above"===o||"below"!==o&&ct,u=window.pageYOffset+l.top+(s?-t-2:n.offsetHeight+2);if(d(D.calendarContainer,"arrowTop",!s),d(D.calendarContainer,"arrowBottom",s),!D.config.inline){var f=window.pageXOffset+l.left,m=!1,g=!1;"center"===r?(f-=(a-l.width)/2,m=!0):"right"===r&&(f-=a-l.width,g=!0),d(D.calendarContainer,"arrowLeft",!m&&!g),d(D.calendarContainer,"arrowCenter",m),d(D.calendarContainer,"arrowRight",g);var p=window.document.body.offsetWidth-(window.pageXOffset+l.right),h=f+a>window.document.body.offsetWidth,v=p+a>window.document.body.offsetWidth;if(d(D.calendarContainer,"rightMost",h),!D.config.static)if(D.calendarContainer.style.top=u+"px",h)if(v){var w=function(){for(var e=null,n=0;nD.currentMonth+D.config.showMonths-1)&&"range"!==D.config.mode;if(D.selectedDateElem=t,"single"===D.config.mode)D.selectedDates=[a];else if("multiple"===D.config.mode){var o=he(a);o?D.selectedDates.splice(parseInt(o),1):D.selectedDates.push(a)}else"range"===D.config.mode&&(2===D.selectedDates.length&&D.clear(!1,!1),D.latestSelectedDateObj=a,D.selectedDates.push(a),0!==C(a,D.selectedDates[0],!0)&&D.selectedDates.sort((function(e,n){return e.getTime()-n.getTime()})));if(T(),i){var r=D.currentYear!==a.getFullYear();D.currentYear=a.getFullYear(),D.currentMonth=a.getMonth(),r&&(ge("onYearChange"),J()),ge("onMonthChange")}if(ve(),B(),we(),i||"range"===D.config.mode||1!==D.config.showMonths?void 0!==D.selectedDateElem&&void 0===D.hourElement&&D.selectedDateElem&&D.selectedDateElem.focus():j(t),void 0!==D.hourElement&&void 0!==D.hourElement&&D.hourElement.focus(),D.config.closeOnSelect){var l="single"===D.config.mode&&!D.config.enableTime,c="range"===D.config.mode&&2===D.selectedDates.length&&!D.config.enableTime;(l||c)&&de()}N()}}D.parseDate=b({config:D.config,l10n:D.l10n}),D._handlers=[],D.pluginElements=[],D.loadedPlugins=[],D._bind=F,D._setHoursFromDate=I,D._positionCalendar=le,D.changeMonth=z,D.changeYear=Z,D.clear=function(e,n){void 0===e&&(e=!0);void 0===n&&(n=!0);D.input.value="",void 0!==D.altInput&&(D.altInput.value="");void 0!==D.mobileInput&&(D.mobileInput.value="");D.selectedDates=[],D.latestSelectedDateObj=void 0,!0===n&&(D.currentYear=D._initialDate.getFullYear(),D.currentMonth=D._initialDate.getMonth());if(!0===D.config.enableTime){var t=S(),a=t.hours,i=t.minutes,o=t.seconds;_(a,i,o)}D.redraw(),e&&ge("onChange")},D.close=function(){D.isOpen=!1,D.isMobile||(void 0!==D.calendarContainer&&D.calendarContainer.classList.remove("open"),void 0!==D._input&&D._input.classList.remove("active"));ge("onClose")},D._createElement=s,D.destroy=function(){void 0!==D.config&&ge("onDestroy");for(var e=D._handlers.length;e--;){var n=D._handlers[e];n.element.removeEventListener(n.event,n.handler,n.options)}if(D._handlers=[],D.mobileInput)D.mobileInput.parentNode&&D.mobileInput.parentNode.removeChild(D.mobileInput),D.mobileInput=void 0;else if(D.calendarContainer&&D.calendarContainer.parentNode)if(D.config.static&&D.calendarContainer.parentNode){var t=D.calendarContainer.parentNode;if(t.lastChild&&t.removeChild(t.lastChild),t.parentNode){for(;t.firstChild;)t.parentNode.insertBefore(t.firstChild,t);t.parentNode.removeChild(t)}}else D.calendarContainer.parentNode.removeChild(D.calendarContainer);D.altInput&&(D.input.type="text",D.altInput.parentNode&&D.altInput.parentNode.removeChild(D.altInput),delete D.altInput);D.input&&(D.input.type=D.input._type,D.input.classList.remove("flatpickr-input"),D.input.removeAttribute("readonly"));["_showTimeInput","latestSelectedDateObj","_hideNextMonthArrow","_hidePrevMonthArrow","__hideNextMonthArrow","__hidePrevMonthArrow","isMobile","isOpen","selectedDateElem","minDateHasTime","maxDateHasTime","days","daysContainer","_input","_positionElement","innerContainer","rContainer","monthNav","todayDateElem","calendarContainer","weekdayContainer","prevMonthNav","nextMonthNav","monthsDropdownContainer","currentMonthElement","currentYearElement","navigationCurrentMonth","selectedDateElem","config"].forEach((function(e){try{delete D[e]}catch(e){}}))},D.isEnabled=Q,D.jumpToDate=A,D.open=function(e,n){void 0===n&&(n=D._positionElement);if(!0===D.isMobile){if(e){e.preventDefault();var t=m(e);t&&t.blur()}return void 0!==D.mobileInput&&(D.mobileInput.focus(),D.mobileInput.click()),void ge("onOpen")}if(D._input.disabled||D.config.inline)return;var a=D.isOpen;D.isOpen=!0,a||(D.calendarContainer.classList.add("open"),D._input.classList.add("active"),ge("onOpen"),le(n));!0===D.config.enableTime&&!0===D.config.noCalendar&&(!1!==D.config.allowInput||void 0!==e&&D.timeContainer.contains(e.relatedTarget)||setTimeout((function(){return D.hourElement.select()}),50))},D.redraw=ce,D.set=function(e,n){if(null!==e&&"object"==typeof e)for(var a in Object.assign(D.config,e),e)void 0!==ue[a]&&ue[a].forEach((function(e){return e()}));else D.config[e]=n,void 0!==ue[e]?ue[e].forEach((function(e){return e()})):t.indexOf(e)>-1&&(D.config[e]=c(n));D.redraw(),we(!0)},D.setDate=function(e,n,t){void 0===n&&(n=!1);void 0===t&&(t=D.config.dateFormat);if(0!==e&&!e||e instanceof Array&&0===e.length)return D.clear(n);fe(e,t),D.latestSelectedDateObj=D.selectedDates[D.selectedDates.length-1],D.redraw(),A(void 0,n),I(),0===D.selectedDates.length&&D.clear(!1);we(n),n&&ge("onChange")},D.toggle=function(e){if(!0===D.isOpen)return D.close();D.open(e)};var ue={locale:[re,$],showMonths:[U,x,q],minDate:[A],maxDate:[A]};function fe(e,n){var t=[];if(e instanceof Array)t=e.map((function(e){return D.parseDate(e,n)}));else if(e instanceof Date||"number"==typeof e)t=[D.parseDate(e,n)];else if("string"==typeof e)switch(D.config.mode){case"single":case"time":t=[D.parseDate(e,n)];break;case"multiple":t=e.split(D.config.conjunction).map((function(e){return D.parseDate(e,n)}));break;case"range":t=e.split(D.l10n.rangeSeparator).map((function(e){return D.parseDate(e,n)}))}else D.config.errorHandler(new Error("Invalid date supplied: "+JSON.stringify(e)));D.selectedDates=D.config.allowInvalidPreload?t:t.filter((function(e){return e instanceof Date&&Q(e,!1)})),"range"===D.config.mode&&D.selectedDates.sort((function(e,n){return e.getTime()-n.getTime()}))}function me(e){return e.slice().map((function(e){return"string"==typeof e||"number"==typeof e||e instanceof Date?D.parseDate(e,void 0,!0):e&&"object"==typeof e&&e.from&&e.to?{from:D.parseDate(e.from,void 0),to:D.parseDate(e.to,void 0)}:e})).filter((function(e){return e}))}function ge(e,n){if(void 0!==D.config){var t=D.config[e];if(void 0!==t&&t.length>0)for(var a=0;t[a]&&a1||"static"===D.config.monthSelectorType?D.monthElements[n].textContent=p(t.getMonth(),D.config.shorthandCurrentMonth,D.l10n)+" ":D.monthsDropdownContainer.value=t.getMonth().toString(),e.value=t.getFullYear().toString()})),D._hidePrevMonthArrow=void 0!==D.config.minDate&&(D.currentYear===D.config.minDate.getFullYear()?D.currentMonth<=D.config.minDate.getMonth():D.currentYearD.config.maxDate.getMonth():D.currentYear>D.config.maxDate.getFullYear()))}function De(e){return D.selectedDates.map((function(n){return D.formatDate(n,e)})).filter((function(e,n,t){return"range"!==D.config.mode||D.config.enableTime||t.indexOf(e)===n})).join("range"!==D.config.mode?D.config.conjunction:D.l10n.rangeSeparator)}function we(e){void 0===e&&(e=!0),void 0!==D.mobileInput&&D.mobileFormatStr&&(D.mobileInput.value=void 0!==D.latestSelectedDateObj?D.formatDate(D.latestSelectedDateObj,D.mobileFormatStr):""),D.input.value=De(D.config.dateFormat),void 0!==D.altInput&&(D.altInput.value=De(D.config.altFormat)),!1!==e&&ge("onValueUpdate")}function be(e){var n=m(e),t=D.prevMonthNav.contains(n),a=D.nextMonthNav.contains(n);t||a?z(t?-1:1):D.yearElements.indexOf(n)>=0?n.select():n.classList.contains("arrowUp")?D.changeYear(D.currentYear+1):n.classList.contains("arrowDown")&&D.changeYear(D.currentYear-1)}return function(){D.element=D.input=g,D.isOpen=!1,function(){var n=["wrap","weekNumbers","allowInput","allowInvalidPreload","clickOpens","time_24hr","enableTime","noCalendar","altInput","shorthandCurrentMonth","inline","static","enableSeconds","disableMobile"],i=e(e({},JSON.parse(JSON.stringify(g.dataset||{}))),h),o={};D.config.parseDate=i.parseDate,D.config.formatDate=i.formatDate,Object.defineProperty(D.config,"enable",{get:function(){return D.config._enable},set:function(e){D.config._enable=me(e)}}),Object.defineProperty(D.config,"disable",{get:function(){return D.config._disable},set:function(e){D.config._disable=me(e)}});var r="time"===i.mode;if(!i.dateFormat&&(i.enableTime||r)){var l=E.defaultConfig.dateFormat||a.dateFormat;o.dateFormat=i.noCalendar||r?"H:i"+(i.enableSeconds?":S":""):l+" H:i"+(i.enableSeconds?":S":"")}if(i.altInput&&(i.enableTime||r)&&!i.altFormat){var d=E.defaultConfig.altFormat||a.altFormat;o.altFormat=i.noCalendar||r?"h:i"+(i.enableSeconds?":S K":" K"):d+" h:i"+(i.enableSeconds?":S":"")+" K"}Object.defineProperty(D.config,"minDate",{get:function(){return D.config._minDate},set:ie("min")}),Object.defineProperty(D.config,"maxDate",{get:function(){return D.config._maxDate},set:ie("max")});var s=function(e){return function(n){D.config["min"===e?"_minTime":"_maxTime"]=D.parseDate(n,"H:i:S")}};Object.defineProperty(D.config,"minTime",{get:function(){return D.config._minTime},set:s("min")}),Object.defineProperty(D.config,"maxTime",{get:function(){return D.config._maxTime},set:s("max")}),"time"===i.mode&&(D.config.noCalendar=!0,D.config.enableTime=!0);Object.assign(D.config,o,i);for(var u=0;u-1?D.config[m]=c(f[m]).map(y).concat(D.config[m]):void 0===i[m]&&(D.config[m]=f[m])}i.altInputClass||(D.config.altInputClass=oe().className+" "+D.config.altInputClass);ge("onParseConfig")}(),re(),function(){if(D.input=oe(),!D.input)return void D.config.errorHandler(new Error("Invalid input element specified"));D.input._type=D.input.type,D.input.type="text",D.input.classList.add("flatpickr-input"),D._input=D.input,D.config.altInput&&(D.altInput=s(D.input.nodeName,D.config.altInputClass),D._input=D.altInput,D.altInput.placeholder=D.input.placeholder,D.altInput.disabled=D.input.disabled,D.altInput.required=D.input.required,D.altInput.tabIndex=D.input.tabIndex,D.altInput.type="text",D.input.setAttribute("type","hidden"),!D.config.static&&D.input.parentNode&&D.input.parentNode.insertBefore(D.altInput,D.input.nextSibling));D.config.allowInput||D._input.setAttribute("readonly","readonly");D._positionElement=D.config.positionElement||D._input}(),function(){D.selectedDates=[],D.now=D.parseDate(D.config.now)||new Date;var e=D.config.defaultDate||("INPUT"!==D.input.nodeName&&"TEXTAREA"!==D.input.nodeName||!D.input.placeholder||D.input.value!==D.input.placeholder?D.input.value:null);e&&fe(e,D.config.dateFormat);D._initialDate=D.selectedDates.length>0?D.selectedDates[0]:D.config.minDate&&D.config.minDate.getTime()>D.now.getTime()?D.config.minDate:D.config.maxDate&&D.config.maxDate.getTime()0&&(D.latestSelectedDateObj=D.selectedDates[0]);void 0!==D.config.minTime&&(D.config.minTime=D.parseDate(D.config.minTime,"H:i"));void 0!==D.config.maxTime&&(D.config.maxTime=D.parseDate(D.config.maxTime,"H:i"));D.minDateHasTime=!!D.config.minDate&&(D.config.minDate.getHours()>0||D.config.minDate.getMinutes()>0||D.config.minDate.getSeconds()>0),D.maxDateHasTime=!!D.config.maxDate&&(D.config.maxDate.getHours()>0||D.config.maxDate.getMinutes()>0||D.config.maxDate.getSeconds()>0)}(),D.utils={getDaysInMonth:function(e,n){return void 0===e&&(e=D.currentMonth),void 0===n&&(n=D.currentYear),1===e&&(n%4==0&&n%100!=0||n%400==0)?29:D.l10n.daysInMonth[e]}},D.isMobile||function(){var e=window.document.createDocumentFragment();if(D.calendarContainer=s("div","flatpickr-calendar"),D.calendarContainer.tabIndex=-1,!D.config.noCalendar){if(e.appendChild((D.monthNav=s("div","flatpickr-months"),D.yearElements=[],D.monthElements=[],D.prevMonthNav=s("span","flatpickr-prev-month"),D.prevMonthNav.innerHTML=D.config.prevArrow,D.nextMonthNav=s("span","flatpickr-next-month"),D.nextMonthNav.innerHTML=D.config.nextArrow,U(),Object.defineProperty(D,"_hidePrevMonthArrow",{get:function(){return D.__hidePrevMonthArrow},set:function(e){D.__hidePrevMonthArrow!==e&&(d(D.prevMonthNav,"flatpickr-disabled",e),D.__hidePrevMonthArrow=e)}}),Object.defineProperty(D,"_hideNextMonthArrow",{get:function(){return D.__hideNextMonthArrow},set:function(e){D.__hideNextMonthArrow!==e&&(d(D.nextMonthNav,"flatpickr-disabled",e),D.__hideNextMonthArrow=e)}}),D.currentYearElement=D.yearElements[0],ve(),D.monthNav)),D.innerContainer=s("div","flatpickr-innerContainer"),D.config.weekNumbers){var n=function(){D.calendarContainer.classList.add("hasWeeks");var e=s("div","flatpickr-weekwrapper");e.appendChild(s("span","flatpickr-weekday",D.l10n.weekAbbreviation));var n=s("div","flatpickr-weeks");return e.appendChild(n),{weekWrapper:e,weekNumbers:n}}(),t=n.weekWrapper,a=n.weekNumbers;D.innerContainer.appendChild(t),D.weekNumbers=a,D.weekWrapper=t}D.rContainer=s("div","flatpickr-rContainer"),D.rContainer.appendChild(q()),D.daysContainer||(D.daysContainer=s("div","flatpickr-days"),D.daysContainer.tabIndex=-1),B(),D.rContainer.appendChild(D.daysContainer),D.innerContainer.appendChild(D.rContainer),e.appendChild(D.innerContainer)}D.config.enableTime&&e.appendChild(function(){D.calendarContainer.classList.add("hasTime"),D.config.noCalendar&&D.calendarContainer.classList.add("noCalendar");D.timeContainer=s("div","flatpickr-time"),D.timeContainer.tabIndex=-1;var e=s("span","flatpickr-time-separator",":"),n=f("flatpickr-hour",{"aria-label":D.l10n.hourAriaLabel});D.hourElement=n.getElementsByTagName("input")[0];var t=f("flatpickr-minute",{"aria-label":D.l10n.minuteAriaLabel});D.minuteElement=t.getElementsByTagName("input")[0],D.hourElement.tabIndex=D.minuteElement.tabIndex=-1,D.hourElement.value=o(D.latestSelectedDateObj?D.latestSelectedDateObj.getHours():D.config.time_24hr?D.config.defaultHour:function(e){switch(e%24){case 0:case 12:return 12;default:return e%12}}(D.config.defaultHour)),D.minuteElement.value=o(D.latestSelectedDateObj?D.latestSelectedDateObj.getMinutes():D.config.defaultMinute),D.hourElement.setAttribute("step",D.config.hourIncrement.toString()),D.minuteElement.setAttribute("step",D.config.minuteIncrement.toString()),D.hourElement.setAttribute("min",D.config.time_24hr?"0":"1"),D.hourElement.setAttribute("max",D.config.time_24hr?"23":"12"),D.minuteElement.setAttribute("min","0"),D.minuteElement.setAttribute("max","59"),D.timeContainer.appendChild(n),D.timeContainer.appendChild(e),D.timeContainer.appendChild(t),D.config.time_24hr&&D.timeContainer.classList.add("time24hr");if(D.config.enableSeconds){D.timeContainer.classList.add("hasSeconds");var a=f("flatpickr-second");D.secondElement=a.getElementsByTagName("input")[0],D.secondElement.value=o(D.latestSelectedDateObj?D.latestSelectedDateObj.getSeconds():D.config.defaultSeconds),D.secondElement.setAttribute("step",D.minuteElement.getAttribute("step")),D.secondElement.setAttribute("min","0"),D.secondElement.setAttribute("max","59"),D.timeContainer.appendChild(s("span","flatpickr-time-separator",":")),D.timeContainer.appendChild(a)}D.config.time_24hr||(D.amPM=s("span","flatpickr-am-pm",D.l10n.amPM[r((D.latestSelectedDateObj?D.hourElement.value:D.config.defaultHour)>11)]),D.amPM.title=D.l10n.toggleTitle,D.amPM.tabIndex=-1,D.timeContainer.appendChild(D.amPM));return D.timeContainer}());d(D.calendarContainer,"rangeMode","range"===D.config.mode),d(D.calendarContainer,"animate",!0===D.config.animate),d(D.calendarContainer,"multiMonth",D.config.showMonths>1),D.calendarContainer.appendChild(e);var i=void 0!==D.config.appendTo&&void 0!==D.config.appendTo.nodeType;if((D.config.inline||D.config.static)&&(D.calendarContainer.classList.add(D.config.inline?"inline":"static"),D.config.inline&&(!i&&D.element.parentNode?D.element.parentNode.insertBefore(D.calendarContainer,D._input.nextSibling):void 0!==D.config.appendTo&&D.config.appendTo.appendChild(D.calendarContainer)),D.config.static)){var l=s("div","flatpickr-wrapper");D.element.parentNode&&D.element.parentNode.insertBefore(l,D.element),l.appendChild(D.element),D.altInput&&l.appendChild(D.altInput),l.appendChild(D.calendarContainer)}D.config.static||D.config.inline||(void 0!==D.config.appendTo?D.config.appendTo:window.document.body).appendChild(D.calendarContainer)}(),function(){D.config.wrap&&["open","close","toggle","clear"].forEach((function(e){Array.prototype.forEach.call(D.element.querySelectorAll("[data-"+e+"]"),(function(n){return F(n,"click",D[e])}))}));if(D.isMobile)return void function(){var e=D.config.enableTime?D.config.noCalendar?"time":"datetime-local":"date";D.mobileInput=s("input",D.input.className+" flatpickr-mobile"),D.mobileInput.tabIndex=1,D.mobileInput.type=e,D.mobileInput.disabled=D.input.disabled,D.mobileInput.required=D.input.required,D.mobileInput.placeholder=D.input.placeholder,D.mobileFormatStr="datetime-local"===e?"Y-m-d\\TH:i:S":"date"===e?"Y-m-d":"H:i:S",D.selectedDates.length>0&&(D.mobileInput.defaultValue=D.mobileInput.value=D.formatDate(D.selectedDates[0],D.mobileFormatStr));D.config.minDate&&(D.mobileInput.min=D.formatDate(D.config.minDate,"Y-m-d"));D.config.maxDate&&(D.mobileInput.max=D.formatDate(D.config.maxDate,"Y-m-d"));D.input.getAttribute("step")&&(D.mobileInput.step=String(D.input.getAttribute("step")));D.input.type="hidden",void 0!==D.altInput&&(D.altInput.type="hidden");try{D.input.parentNode&&D.input.parentNode.insertBefore(D.mobileInput,D.input.nextSibling)}catch(e){}F(D.mobileInput,"change",(function(e){D.setDate(m(e).value,!1,D.mobileFormatStr),ge("onChange"),ge("onClose")}))}();var e=l(ae,50);D._debouncedChange=l(N,300),D.daysContainer&&!/iPhone|iPad|iPod/i.test(navigator.userAgent)&&F(D.daysContainer,"mouseover",(function(e){"range"===D.config.mode&&te(m(e))}));F(window.document.body,"keydown",ne),D.config.inline||D.config.static||F(window,"resize",e);void 0!==window.ontouchstart?F(window.document,"touchstart",V):F(window.document,"click",V);F(window.document,"focus",V,{capture:!0}),!0===D.config.clickOpens&&(F(D._input,"focus",D.open),F(D._input,"click",D.open));void 0!==D.daysContainer&&(F(D.monthNav,"click",be),F(D.monthNav,["keyup","increment"],O),F(D.daysContainer,"click",se));if(void 0!==D.timeContainer&&void 0!==D.minuteElement&&void 0!==D.hourElement){F(D.timeContainer,["increment"],k),F(D.timeContainer,"blur",k,{capture:!0}),F(D.timeContainer,"click",P),F([D.hourElement,D.minuteElement],["focus","click"],(function(e){return m(e).select()})),void 0!==D.secondElement&&F(D.secondElement,"focus",(function(){return D.secondElement&&D.secondElement.select()})),void 0!==D.amPM&&F(D.amPM,"click",(function(e){k(e),N()}))}D.config.allowInput&&F(D._input,"blur",ee)}(),(D.selectedDates.length||D.config.noCalendar)&&(D.config.enableTime&&I(D.config.noCalendar?D.latestSelectedDateObj||D.config.minDate:void 0),we(!1)),x();var n=/^((?!chrome|android).)*safari/i.test(navigator.userAgent);!D.isMobile&&n&&le(),ge("onReady")}(),D}function x(e,n){for(var t=Array.prototype.slice.call(e).filter((function(e){return e instanceof HTMLElement})),a=[],i=0;i 3 && s < 21) + return "th"; + switch (s % 10) { + case 1: + return "st"; + case 2: + return "nd"; + case 3: + return "rd"; + default: + return "th"; + } + }, + rangeSeparator: " to ", + weekAbbreviation: "Wk", + scrollTitle: "Scroll to increment", + toggleTitle: "Click to toggle", + amPM: ["AM", "PM"], + yearAriaLabel: "Year", + monthAriaLabel: "Month", + hourAriaLabel: "Hour", + minuteAriaLabel: "Minute", + time_24hr: false, + }; + + exports.default = english; + exports.english = english; + + Object.defineProperty(exports, '__esModule', { value: true }); + +}))); diff --git a/admin/js/vendors/flatpickr/l10n/fr.d.ts b/admin/js/vendors/flatpickr/l10n/fr.d.ts new file mode 100644 index 0000000..6fcd191 --- /dev/null +++ b/admin/js/vendors/flatpickr/l10n/fr.d.ts @@ -0,0 +1,69 @@ +import { CustomLocale } from "../types/locale"; +export declare const French: CustomLocale; +declare const _default: { + default?: CustomLocale | undefined; + hr?: CustomLocale | undefined; + th?: CustomLocale | undefined; + tr?: CustomLocale | undefined; + ar?: CustomLocale | undefined; + at?: CustomLocale | undefined; + az?: CustomLocale | undefined; + be?: CustomLocale | undefined; + bg?: CustomLocale | undefined; + bn?: CustomLocale | undefined; + bs?: CustomLocale | undefined; + ca?: CustomLocale | undefined; + cat?: CustomLocale | undefined; + cs?: CustomLocale | undefined; + cy?: CustomLocale | undefined; + da?: CustomLocale | undefined; + de?: CustomLocale | undefined; + en?: CustomLocale | undefined; + eo?: CustomLocale | undefined; + es?: CustomLocale | undefined; + et?: CustomLocale | undefined; + fa?: CustomLocale | undefined; + fi?: CustomLocale | undefined; + fo?: CustomLocale | undefined; + fr?: CustomLocale | undefined; + gr?: CustomLocale | undefined; + he?: CustomLocale | undefined; + hi?: CustomLocale | undefined; + hu?: CustomLocale | undefined; + id?: CustomLocale | undefined; + is?: CustomLocale | undefined; + it?: CustomLocale | undefined; + ja?: CustomLocale | undefined; + ka?: CustomLocale | undefined; + ko?: CustomLocale | undefined; + km?: CustomLocale | undefined; + kz?: CustomLocale | undefined; + lt?: CustomLocale | undefined; + lv?: CustomLocale | undefined; + mk?: CustomLocale | undefined; + mn?: CustomLocale | undefined; + ms?: CustomLocale | undefined; + my?: CustomLocale | undefined; + nl?: CustomLocale | undefined; + no?: CustomLocale | undefined; + pa?: CustomLocale | undefined; + pl?: CustomLocale | undefined; + pt?: CustomLocale | undefined; + ro?: CustomLocale | undefined; + ru?: CustomLocale | undefined; + si?: CustomLocale | undefined; + sk?: CustomLocale | undefined; + sl?: CustomLocale | undefined; + sq?: CustomLocale | undefined; + sr?: CustomLocale | undefined; + sv?: CustomLocale | undefined; + uk?: CustomLocale | undefined; + vn?: CustomLocale | undefined; + zh?: CustomLocale | undefined; + uz?: CustomLocale | undefined; + uz_latn?: CustomLocale | undefined; + zh_tw?: CustomLocale | undefined; +} & { + default: import("../types/locale").Locale; +}; +export default _default; diff --git a/admin/js/vendors/flatpickr/l10n/fr.js b/admin/js/vendors/flatpickr/l10n/fr.js new file mode 100644 index 0000000..4a63cfe --- /dev/null +++ b/admin/js/vendors/flatpickr/l10n/fr.js @@ -0,0 +1,75 @@ +(function (global, factory) { + typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : + typeof define === 'function' && define.amd ? define(['exports'], factory) : + (global = global || self, factory(global.fr = {})); +}(this, (function (exports) { 'use strict'; + + var fp = typeof window !== "undefined" && window.flatpickr !== undefined + ? window.flatpickr + : { + l10ns: {}, + }; + var French = { + firstDayOfWeek: 1, + weekdays: { + shorthand: ["dim", "lun", "mar", "mer", "jeu", "ven", "sam"], + longhand: [ + "dimanche", + "lundi", + "mardi", + "mercredi", + "jeudi", + "vendredi", + "samedi", + ], + }, + months: { + shorthand: [ + "janv", + "févr", + "mars", + "avr", + "mai", + "juin", + "juil", + "août", + "sept", + "oct", + "nov", + "déc", + ], + longhand: [ + "janvier", + "février", + "mars", + "avril", + "mai", + "juin", + "juillet", + "août", + "septembre", + "octobre", + "novembre", + "décembre", + ], + }, + ordinal: function (nth) { + if (nth > 1) + return ""; + return "er"; + }, + rangeSeparator: " au ", + weekAbbreviation: "Sem", + scrollTitle: "Défiler pour augmenter la valeur", + toggleTitle: "Cliquer pour basculer", + time_24hr: true, + }; + fp.l10ns.fr = French; + var fr = fp.l10ns; + + exports.French = French; + exports.default = fr; + + Object.defineProperty(exports, '__esModule', { value: true }); + +}))); diff --git a/admin/js/vendors/flatpickr/l10n/index.d.ts b/admin/js/vendors/flatpickr/l10n/index.d.ts new file mode 100644 index 0000000..8b2ef7d --- /dev/null +++ b/admin/js/vendors/flatpickr/l10n/index.d.ts @@ -0,0 +1,3 @@ +import { key, CustomLocale } from "../types/locale"; +declare const l10n: Record; +export default l10n; diff --git a/admin/js/vendors/flatpickr/l10n/index.js b/admin/js/vendors/flatpickr/l10n/index.js new file mode 100644 index 0000000..c197ead --- /dev/null +++ b/admin/js/vendors/flatpickr/l10n/index.js @@ -0,0 +1,3594 @@ +(function (global, factory) { + typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : + typeof define === 'function' && define.amd ? define(['exports'], factory) : + (global = global || self, factory(global.index = {})); +}(this, (function (exports) { 'use strict'; + + /*! ***************************************************************************** + Copyright (c) Microsoft Corporation. + + Permission to use, copy, modify, and/or distribute this software for any + purpose with or without fee is hereby granted. + + THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH + REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY + AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, + INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM + LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR + OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + PERFORMANCE OF THIS SOFTWARE. + ***************************************************************************** */ + + var __assign = function() { + __assign = Object.assign || function __assign(t) { + for (var s, i = 1, n = arguments.length; i < n; i++) { + s = arguments[i]; + for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; + } + return t; + }; + return __assign.apply(this, arguments); + }; + + var fp = typeof window !== "undefined" && window.flatpickr !== undefined + ? window.flatpickr + : { + l10ns: {}, + }; + var Arabic = { + weekdays: { + shorthand: ["أحد", "اثنين", "ثلاثاء", "أربعاء", "خميس", "جمعة", "سبت"], + longhand: [ + "الأحد", + "الاثنين", + "الثلاثاء", + "الأربعاء", + "الخميس", + "الجمعة", + "السبت", + ], + }, + months: { + shorthand: ["1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12"], + longhand: [ + "يناير", + "فبراير", + "مارس", + "أبريل", + "مايو", + "يونيو", + "يوليو", + "أغسطس", + "سبتمبر", + "أكتوبر", + "نوفمبر", + "ديسمبر", + ], + }, + rangeSeparator: " - ", + }; + fp.l10ns.ar = Arabic; + fp.l10ns; + + var fp$1 = typeof window !== "undefined" && window.flatpickr !== undefined + ? window.flatpickr + : { + l10ns: {}, + }; + var Austria = { + weekdays: { + shorthand: ["So", "Mo", "Di", "Mi", "Do", "Fr", "Sa"], + longhand: [ + "Sonntag", + "Montag", + "Dienstag", + "Mittwoch", + "Donnerstag", + "Freitag", + "Samstag", + ], + }, + months: { + shorthand: [ + "Jän", + "Feb", + "Mär", + "Apr", + "Mai", + "Jun", + "Jul", + "Aug", + "Sep", + "Okt", + "Nov", + "Dez", + ], + longhand: [ + "Jänner", + "Februar", + "März", + "April", + "Mai", + "Juni", + "Juli", + "August", + "September", + "Oktober", + "November", + "Dezember", + ], + }, + firstDayOfWeek: 1, + weekAbbreviation: "KW", + rangeSeparator: " bis ", + scrollTitle: "Zum Ändern scrollen", + toggleTitle: "Zum Umschalten klicken", + }; + fp$1.l10ns.at = Austria; + fp$1.l10ns; + + var fp$2 = typeof window !== "undefined" && window.flatpickr !== undefined + ? window.flatpickr + : { + l10ns: {}, + }; + var Azerbaijan = { + weekdays: { + shorthand: ["B.", "B.e.", "Ç.a.", "Ç.", "C.a.", "C.", "Ş."], + longhand: [ + "Bazar", + "Bazar ertəsi", + "Çərşənbə axşamı", + "Çərşənbə", + "Cümə axşamı", + "Cümə", + "Şənbə", + ], + }, + months: { + shorthand: [ + "Yan", + "Fev", + "Mar", + "Apr", + "May", + "İyn", + "İyl", + "Avq", + "Sen", + "Okt", + "Noy", + "Dek", + ], + longhand: [ + "Yanvar", + "Fevral", + "Mart", + "Aprel", + "May", + "İyun", + "İyul", + "Avqust", + "Sentyabr", + "Oktyabr", + "Noyabr", + "Dekabr", + ], + }, + firstDayOfWeek: 1, + ordinal: function () { + return "."; + }, + rangeSeparator: " - ", + weekAbbreviation: "Hf", + scrollTitle: "Artırmaq üçün sürüşdürün", + toggleTitle: "Aç / Bağla", + amPM: ["GƏ", "GS"], + time_24hr: true, + }; + fp$2.l10ns.az = Azerbaijan; + fp$2.l10ns; + + var fp$3 = typeof window !== "undefined" && window.flatpickr !== undefined + ? window.flatpickr + : { + l10ns: {}, + }; + var Belarusian = { + weekdays: { + shorthand: ["Нд", "Пн", "Аў", "Ср", "Чц", "Пт", "Сб"], + longhand: [ + "Нядзеля", + "Панядзелак", + "Аўторак", + "Серада", + "Чацвер", + "Пятніца", + "Субота", + ], + }, + months: { + shorthand: [ + "Сту", + "Лют", + "Сак", + "Кра", + "Тра", + "Чэр", + "Ліп", + "Жні", + "Вер", + "Кас", + "Ліс", + "Сне", + ], + longhand: [ + "Студзень", + "Люты", + "Сакавік", + "Красавік", + "Травень", + "Чэрвень", + "Ліпень", + "Жнівень", + "Верасень", + "Кастрычнік", + "Лістапад", + "Снежань", + ], + }, + firstDayOfWeek: 1, + ordinal: function () { + return ""; + }, + rangeSeparator: " — ", + weekAbbreviation: "Тыд.", + scrollTitle: "Пракруціце для павелічэння", + toggleTitle: "Націсніце для пераключэння", + amPM: ["ДП", "ПП"], + yearAriaLabel: "Год", + time_24hr: true, + }; + fp$3.l10ns.be = Belarusian; + fp$3.l10ns; + + var fp$4 = typeof window !== "undefined" && window.flatpickr !== undefined + ? window.flatpickr + : { + l10ns: {}, + }; + var Bosnian = { + firstDayOfWeek: 1, + weekdays: { + shorthand: ["Ned", "Pon", "Uto", "Sri", "Čet", "Pet", "Sub"], + longhand: [ + "Nedjelja", + "Ponedjeljak", + "Utorak", + "Srijeda", + "Četvrtak", + "Petak", + "Subota", + ], + }, + months: { + shorthand: [ + "Jan", + "Feb", + "Mar", + "Apr", + "Maj", + "Jun", + "Jul", + "Avg", + "Sep", + "Okt", + "Nov", + "Dec", + ], + longhand: [ + "Januar", + "Februar", + "Mart", + "April", + "Maj", + "Juni", + "Juli", + "Avgust", + "Septembar", + "Oktobar", + "Novembar", + "Decembar", + ], + }, + time_24hr: true, + }; + fp$4.l10ns.bs = Bosnian; + fp$4.l10ns; + + var fp$5 = typeof window !== "undefined" && window.flatpickr !== undefined + ? window.flatpickr + : { + l10ns: {}, + }; + var Bulgarian = { + weekdays: { + shorthand: ["Нд", "Пн", "Вт", "Ср", "Чт", "Пт", "Сб"], + longhand: [ + "Неделя", + "Понеделник", + "Вторник", + "Сряда", + "Четвъртък", + "Петък", + "Събота", + ], + }, + months: { + shorthand: [ + "Яну", + "Фев", + "Март", + "Апр", + "Май", + "Юни", + "Юли", + "Авг", + "Сеп", + "Окт", + "Ное", + "Дек", + ], + longhand: [ + "Януари", + "Февруари", + "Март", + "Април", + "Май", + "Юни", + "Юли", + "Август", + "Септември", + "Октомври", + "Ноември", + "Декември", + ], + }, + time_24hr: true, + firstDayOfWeek: 1, + }; + fp$5.l10ns.bg = Bulgarian; + fp$5.l10ns; + + var fp$6 = typeof window !== "undefined" && window.flatpickr !== undefined + ? window.flatpickr + : { + l10ns: {}, + }; + var Bangla = { + weekdays: { + shorthand: ["রবি", "সোম", "মঙ্গল", "বুধ", "বৃহস্পতি", "শুক্র", "শনি"], + longhand: [ + "রবিবার", + "সোমবার", + "মঙ্গলবার", + "বুধবার", + "বৃহস্পতিবার", + "শুক্রবার", + "শনিবার", + ], + }, + months: { + shorthand: [ + "জানু", + "ফেব্রু", + "মার্চ", + "এপ্রিল", + "মে", + "জুন", + "জুলাই", + "আগ", + "সেপ্টে", + "অক্টো", + "নভে", + "ডিসে", + ], + longhand: [ + "জানুয়ারী", + "ফেব্রুয়ারী", + "মার্চ", + "এপ্রিল", + "মে", + "জুন", + "জুলাই", + "আগস্ট", + "সেপ্টেম্বর", + "অক্টোবর", + "নভেম্বর", + "ডিসেম্বর", + ], + }, + }; + fp$6.l10ns.bn = Bangla; + fp$6.l10ns; + + var fp$7 = typeof window !== "undefined" && window.flatpickr !== undefined + ? window.flatpickr + : { + l10ns: {}, + }; + var Catalan = { + weekdays: { + shorthand: ["Dg", "Dl", "Dt", "Dc", "Dj", "Dv", "Ds"], + longhand: [ + "Diumenge", + "Dilluns", + "Dimarts", + "Dimecres", + "Dijous", + "Divendres", + "Dissabte", + ], + }, + months: { + shorthand: [ + "Gen", + "Febr", + "Març", + "Abr", + "Maig", + "Juny", + "Jul", + "Ag", + "Set", + "Oct", + "Nov", + "Des", + ], + longhand: [ + "Gener", + "Febrer", + "Març", + "Abril", + "Maig", + "Juny", + "Juliol", + "Agost", + "Setembre", + "Octubre", + "Novembre", + "Desembre", + ], + }, + ordinal: function (nth) { + var s = nth % 100; + if (s > 3 && s < 21) + return "è"; + switch (s % 10) { + case 1: + return "r"; + case 2: + return "n"; + case 3: + return "r"; + case 4: + return "t"; + default: + return "è"; + } + }, + firstDayOfWeek: 1, + time_24hr: true, + }; + fp$7.l10ns.cat = fp$7.l10ns.ca = Catalan; + fp$7.l10ns; + + var fp$8 = typeof window !== "undefined" && window.flatpickr !== undefined + ? window.flatpickr + : { + l10ns: {}, + }; + var Czech = { + weekdays: { + shorthand: ["Ne", "Po", "Út", "St", "Čt", "Pá", "So"], + longhand: [ + "Neděle", + "Pondělí", + "Úterý", + "Středa", + "Čtvrtek", + "Pátek", + "Sobota", + ], + }, + months: { + shorthand: [ + "Led", + "Ún", + "Bře", + "Dub", + "Kvě", + "Čer", + "Čvc", + "Srp", + "Zář", + "Říj", + "Lis", + "Pro", + ], + longhand: [ + "Leden", + "Únor", + "Březen", + "Duben", + "Květen", + "Červen", + "Červenec", + "Srpen", + "Září", + "Říjen", + "Listopad", + "Prosinec", + ], + }, + firstDayOfWeek: 1, + ordinal: function () { + return "."; + }, + rangeSeparator: " do ", + weekAbbreviation: "Týd.", + scrollTitle: "Rolujte pro změnu", + toggleTitle: "Přepnout dopoledne/odpoledne", + amPM: ["dop.", "odp."], + yearAriaLabel: "Rok", + time_24hr: true, + }; + fp$8.l10ns.cs = Czech; + fp$8.l10ns; + + var fp$9 = typeof window !== "undefined" && window.flatpickr !== undefined + ? window.flatpickr + : { + l10ns: {}, + }; + var Welsh = { + weekdays: { + shorthand: ["Sul", "Llun", "Maw", "Mer", "Iau", "Gwe", "Sad"], + longhand: [ + "Dydd Sul", + "Dydd Llun", + "Dydd Mawrth", + "Dydd Mercher", + "Dydd Iau", + "Dydd Gwener", + "Dydd Sadwrn", + ], + }, + months: { + shorthand: [ + "Ion", + "Chwef", + "Maw", + "Ebr", + "Mai", + "Meh", + "Gorff", + "Awst", + "Medi", + "Hyd", + "Tach", + "Rhag", + ], + longhand: [ + "Ionawr", + "Chwefror", + "Mawrth", + "Ebrill", + "Mai", + "Mehefin", + "Gorffennaf", + "Awst", + "Medi", + "Hydref", + "Tachwedd", + "Rhagfyr", + ], + }, + firstDayOfWeek: 1, + ordinal: function (nth) { + if (nth === 1) + return "af"; + if (nth === 2) + return "ail"; + if (nth === 3 || nth === 4) + return "ydd"; + if (nth === 5 || nth === 6) + return "ed"; + if ((nth >= 7 && nth <= 10) || + nth == 12 || + nth == 15 || + nth == 18 || + nth == 20) + return "fed"; + if (nth == 11 || + nth == 13 || + nth == 14 || + nth == 16 || + nth == 17 || + nth == 19) + return "eg"; + if (nth >= 21 && nth <= 39) + return "ain"; + // Inconclusive. + return ""; + }, + time_24hr: true, + }; + fp$9.l10ns.cy = Welsh; + fp$9.l10ns; + + var fp$a = typeof window !== "undefined" && window.flatpickr !== undefined + ? window.flatpickr + : { + l10ns: {}, + }; + var Danish = { + weekdays: { + shorthand: ["søn", "man", "tir", "ons", "tors", "fre", "lør"], + longhand: [ + "søndag", + "mandag", + "tirsdag", + "onsdag", + "torsdag", + "fredag", + "lørdag", + ], + }, + months: { + shorthand: [ + "jan", + "feb", + "mar", + "apr", + "maj", + "jun", + "jul", + "aug", + "sep", + "okt", + "nov", + "dec", + ], + longhand: [ + "januar", + "februar", + "marts", + "april", + "maj", + "juni", + "juli", + "august", + "september", + "oktober", + "november", + "december", + ], + }, + ordinal: function () { + return "."; + }, + firstDayOfWeek: 1, + rangeSeparator: " til ", + weekAbbreviation: "uge", + time_24hr: true, + }; + fp$a.l10ns.da = Danish; + fp$a.l10ns; + + var fp$b = typeof window !== "undefined" && window.flatpickr !== undefined + ? window.flatpickr + : { + l10ns: {}, + }; + var German = { + weekdays: { + shorthand: ["So", "Mo", "Di", "Mi", "Do", "Fr", "Sa"], + longhand: [ + "Sonntag", + "Montag", + "Dienstag", + "Mittwoch", + "Donnerstag", + "Freitag", + "Samstag", + ], + }, + months: { + shorthand: [ + "Jan", + "Feb", + "Mär", + "Apr", + "Mai", + "Jun", + "Jul", + "Aug", + "Sep", + "Okt", + "Nov", + "Dez", + ], + longhand: [ + "Januar", + "Februar", + "März", + "April", + "Mai", + "Juni", + "Juli", + "August", + "September", + "Oktober", + "November", + "Dezember", + ], + }, + firstDayOfWeek: 1, + weekAbbreviation: "KW", + rangeSeparator: " bis ", + scrollTitle: "Zum Ändern scrollen", + toggleTitle: "Zum Umschalten klicken", + time_24hr: true, + }; + fp$b.l10ns.de = German; + fp$b.l10ns; + + var english = { + weekdays: { + shorthand: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"], + longhand: [ + "Sunday", + "Monday", + "Tuesday", + "Wednesday", + "Thursday", + "Friday", + "Saturday", + ], + }, + months: { + shorthand: [ + "Jan", + "Feb", + "Mar", + "Apr", + "May", + "Jun", + "Jul", + "Aug", + "Sep", + "Oct", + "Nov", + "Dec", + ], + longhand: [ + "January", + "February", + "March", + "April", + "May", + "June", + "July", + "August", + "September", + "October", + "November", + "December", + ], + }, + daysInMonth: [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31], + firstDayOfWeek: 0, + ordinal: function (nth) { + var s = nth % 100; + if (s > 3 && s < 21) + return "th"; + switch (s % 10) { + case 1: + return "st"; + case 2: + return "nd"; + case 3: + return "rd"; + default: + return "th"; + } + }, + rangeSeparator: " to ", + weekAbbreviation: "Wk", + scrollTitle: "Scroll to increment", + toggleTitle: "Click to toggle", + amPM: ["AM", "PM"], + yearAriaLabel: "Year", + monthAriaLabel: "Month", + hourAriaLabel: "Hour", + minuteAriaLabel: "Minute", + time_24hr: false, + }; + + var fp$c = typeof window !== "undefined" && window.flatpickr !== undefined + ? window.flatpickr + : { + l10ns: {}, + }; + var Esperanto = { + firstDayOfWeek: 1, + rangeSeparator: " ĝis ", + weekAbbreviation: "Sem", + scrollTitle: "Rulumu por pligrandigi la valoron", + toggleTitle: "Klaku por ŝalti", + weekdays: { + shorthand: ["Dim", "Lun", "Mar", "Mer", "Ĵaŭ", "Ven", "Sab"], + longhand: [ + "dimanĉo", + "lundo", + "mardo", + "merkredo", + "ĵaŭdo", + "vendredo", + "sabato", + ], + }, + months: { + shorthand: [ + "Jan", + "Feb", + "Mar", + "Apr", + "Maj", + "Jun", + "Jul", + "Aŭg", + "Sep", + "Okt", + "Nov", + "Dec", + ], + longhand: [ + "januaro", + "februaro", + "marto", + "aprilo", + "majo", + "junio", + "julio", + "aŭgusto", + "septembro", + "oktobro", + "novembro", + "decembro", + ], + }, + ordinal: function () { + return "-a"; + }, + time_24hr: true, + }; + fp$c.l10ns.eo = Esperanto; + fp$c.l10ns; + + var fp$d = typeof window !== "undefined" && window.flatpickr !== undefined + ? window.flatpickr + : { + l10ns: {}, + }; + var Spanish = { + weekdays: { + shorthand: ["Dom", "Lun", "Mar", "Mié", "Jue", "Vie", "Sáb"], + longhand: [ + "Domingo", + "Lunes", + "Martes", + "Miércoles", + "Jueves", + "Viernes", + "Sábado", + ], + }, + months: { + shorthand: [ + "Ene", + "Feb", + "Mar", + "Abr", + "May", + "Jun", + "Jul", + "Ago", + "Sep", + "Oct", + "Nov", + "Dic", + ], + longhand: [ + "Enero", + "Febrero", + "Marzo", + "Abril", + "Mayo", + "Junio", + "Julio", + "Agosto", + "Septiembre", + "Octubre", + "Noviembre", + "Diciembre", + ], + }, + ordinal: function () { + return "º"; + }, + firstDayOfWeek: 1, + rangeSeparator: " a ", + time_24hr: true, + }; + fp$d.l10ns.es = Spanish; + fp$d.l10ns; + + var fp$e = typeof window !== "undefined" && window.flatpickr !== undefined + ? window.flatpickr + : { + l10ns: {}, + }; + var Estonian = { + weekdays: { + shorthand: ["P", "E", "T", "K", "N", "R", "L"], + longhand: [ + "Pühapäev", + "Esmaspäev", + "Teisipäev", + "Kolmapäev", + "Neljapäev", + "Reede", + "Laupäev", + ], + }, + months: { + shorthand: [ + "Jaan", + "Veebr", + "Märts", + "Apr", + "Mai", + "Juuni", + "Juuli", + "Aug", + "Sept", + "Okt", + "Nov", + "Dets", + ], + longhand: [ + "Jaanuar", + "Veebruar", + "Märts", + "Aprill", + "Mai", + "Juuni", + "Juuli", + "August", + "September", + "Oktoober", + "November", + "Detsember", + ], + }, + firstDayOfWeek: 1, + ordinal: function () { + return "."; + }, + weekAbbreviation: "Näd", + rangeSeparator: " kuni ", + scrollTitle: "Keri, et suurendada", + toggleTitle: "Klõpsa, et vahetada", + time_24hr: true, + }; + fp$e.l10ns.et = Estonian; + fp$e.l10ns; + + var fp$f = typeof window !== "undefined" && window.flatpickr !== undefined + ? window.flatpickr + : { + l10ns: {}, + }; + var Persian = { + weekdays: { + shorthand: ["یک", "دو", "سه", "چهار", "پنج", "جمعه", "شنبه"], + longhand: [ + "یک‌شنبه", + "دوشنبه", + "سه‌شنبه", + "چهارشنبه", + "پنچ‌شنبه", + "جمعه", + "شنبه", + ], + }, + months: { + shorthand: [ + "ژانویه", + "فوریه", + "مارس", + "آوریل", + "مه", + "ژوئن", + "ژوئیه", + "اوت", + "سپتامبر", + "اکتبر", + "نوامبر", + "دسامبر", + ], + longhand: [ + "ژانویه", + "فوریه", + "مارس", + "آوریل", + "مه", + "ژوئن", + "ژوئیه", + "اوت", + "سپتامبر", + "اکتبر", + "نوامبر", + "دسامبر", + ], + }, + firstDayOfWeek: 6, + ordinal: function () { + return ""; + }, + }; + fp$f.l10ns.fa = Persian; + fp$f.l10ns; + + var fp$g = typeof window !== "undefined" && window.flatpickr !== undefined + ? window.flatpickr + : { + l10ns: {}, + }; + var Finnish = { + firstDayOfWeek: 1, + weekdays: { + shorthand: ["Su", "Ma", "Ti", "Ke", "To", "Pe", "La"], + longhand: [ + "Sunnuntai", + "Maanantai", + "Tiistai", + "Keskiviikko", + "Torstai", + "Perjantai", + "Lauantai", + ], + }, + months: { + shorthand: [ + "Tammi", + "Helmi", + "Maalis", + "Huhti", + "Touko", + "Kesä", + "Heinä", + "Elo", + "Syys", + "Loka", + "Marras", + "Joulu", + ], + longhand: [ + "Tammikuu", + "Helmikuu", + "Maaliskuu", + "Huhtikuu", + "Toukokuu", + "Kesäkuu", + "Heinäkuu", + "Elokuu", + "Syyskuu", + "Lokakuu", + "Marraskuu", + "Joulukuu", + ], + }, + ordinal: function () { + return "."; + }, + time_24hr: true, + }; + fp$g.l10ns.fi = Finnish; + fp$g.l10ns; + + var fp$h = typeof window !== "undefined" && window.flatpickr !== undefined + ? window.flatpickr + : { + l10ns: {}, + }; + var Faroese = { + weekdays: { + shorthand: ["Sun", "Mán", "Týs", "Mik", "Hós", "Frí", "Ley"], + longhand: [ + "Sunnudagur", + "Mánadagur", + "Týsdagur", + "Mikudagur", + "Hósdagur", + "Fríggjadagur", + "Leygardagur", + ], + }, + months: { + shorthand: [ + "Jan", + "Feb", + "Mar", + "Apr", + "Mai", + "Jun", + "Jul", + "Aug", + "Sep", + "Okt", + "Nov", + "Des", + ], + longhand: [ + "Januar", + "Februar", + "Mars", + "Apríl", + "Mai", + "Juni", + "Juli", + "August", + "Septembur", + "Oktobur", + "Novembur", + "Desembur", + ], + }, + ordinal: function () { + return "."; + }, + firstDayOfWeek: 1, + rangeSeparator: " til ", + weekAbbreviation: "vika", + scrollTitle: "Rulla fyri at broyta", + toggleTitle: "Trýst fyri at skifta", + yearAriaLabel: "Ár", + time_24hr: true, + }; + fp$h.l10ns.fo = Faroese; + fp$h.l10ns; + + var fp$i = typeof window !== "undefined" && window.flatpickr !== undefined + ? window.flatpickr + : { + l10ns: {}, + }; + var French = { + firstDayOfWeek: 1, + weekdays: { + shorthand: ["dim", "lun", "mar", "mer", "jeu", "ven", "sam"], + longhand: [ + "dimanche", + "lundi", + "mardi", + "mercredi", + "jeudi", + "vendredi", + "samedi", + ], + }, + months: { + shorthand: [ + "janv", + "févr", + "mars", + "avr", + "mai", + "juin", + "juil", + "août", + "sept", + "oct", + "nov", + "déc", + ], + longhand: [ + "janvier", + "février", + "mars", + "avril", + "mai", + "juin", + "juillet", + "août", + "septembre", + "octobre", + "novembre", + "décembre", + ], + }, + ordinal: function (nth) { + if (nth > 1) + return ""; + return "er"; + }, + rangeSeparator: " au ", + weekAbbreviation: "Sem", + scrollTitle: "Défiler pour augmenter la valeur", + toggleTitle: "Cliquer pour basculer", + time_24hr: true, + }; + fp$i.l10ns.fr = French; + fp$i.l10ns; + + var fp$j = typeof window !== "undefined" && window.flatpickr !== undefined + ? window.flatpickr + : { + l10ns: {}, + }; + var Greek = { + weekdays: { + shorthand: ["Κυ", "Δε", "Τρ", "Τε", "Πέ", "Πα", "Σά"], + longhand: [ + "Κυριακή", + "Δευτέρα", + "Τρίτη", + "Τετάρτη", + "Πέμπτη", + "Παρασκευή", + "Σάββατο", + ], + }, + months: { + shorthand: [ + "Ιαν", + "Φεβ", + "Μάρ", + "Απρ", + "Μάι", + "Ιού", + "Ιού", + "Αύγ", + "Σεπ", + "Οκτ", + "Νοέ", + "Δεκ", + ], + longhand: [ + "Ιανουάριος", + "Φεβρουάριος", + "Μάρτιος", + "Απρίλιος", + "Μάιος", + "Ιούνιος", + "Ιούλιος", + "Αύγουστος", + "Σεπτέμβριος", + "Οκτώβριος", + "Νοέμβριος", + "Δεκέμβριος", + ], + }, + firstDayOfWeek: 1, + ordinal: function () { + return ""; + }, + weekAbbreviation: "Εβδ", + rangeSeparator: " έως ", + scrollTitle: "Μετακυλήστε για προσαύξηση", + toggleTitle: "Κάντε κλικ για αλλαγή", + amPM: ["ΠΜ", "ΜΜ"], + }; + fp$j.l10ns.gr = Greek; + fp$j.l10ns; + + var fp$k = typeof window !== "undefined" && window.flatpickr !== undefined + ? window.flatpickr + : { + l10ns: {}, + }; + var Hebrew = { + weekdays: { + shorthand: ["א", "ב", "ג", "ד", "ה", "ו", "ש"], + longhand: ["ראשון", "שני", "שלישי", "רביעי", "חמישי", "שישי", "שבת"], + }, + months: { + shorthand: [ + "ינו׳", + "פבר׳", + "מרץ", + "אפר׳", + "מאי", + "יוני", + "יולי", + "אוג׳", + "ספט׳", + "אוק׳", + "נוב׳", + "דצמ׳", + ], + longhand: [ + "ינואר", + "פברואר", + "מרץ", + "אפריל", + "מאי", + "יוני", + "יולי", + "אוגוסט", + "ספטמבר", + "אוקטובר", + "נובמבר", + "דצמבר", + ], + }, + rangeSeparator: " אל ", + time_24hr: true, + }; + fp$k.l10ns.he = Hebrew; + fp$k.l10ns; + + var fp$l = typeof window !== "undefined" && window.flatpickr !== undefined + ? window.flatpickr + : { + l10ns: {}, + }; + var Hindi = { + weekdays: { + shorthand: ["रवि", "सोम", "मंगल", "बुध", "गुरु", "शुक्र", "शनि"], + longhand: [ + "रविवार", + "सोमवार", + "मंगलवार", + "बुधवार", + "गुरुवार", + "शुक्रवार", + "शनिवार", + ], + }, + months: { + shorthand: [ + "जन", + "फर", + "मार्च", + "अप्रेल", + "मई", + "जून", + "जूलाई", + "अग", + "सित", + "अक्ट", + "नव", + "दि", + ], + longhand: [ + "जनवरी ", + "फरवरी", + "मार्च", + "अप्रेल", + "मई", + "जून", + "जूलाई", + "अगस्त ", + "सितम्बर", + "अक्टूबर", + "नवम्बर", + "दिसम्बर", + ], + }, + }; + fp$l.l10ns.hi = Hindi; + fp$l.l10ns; + + var fp$m = typeof window !== "undefined" && window.flatpickr !== undefined + ? window.flatpickr + : { + l10ns: {}, + }; + var Croatian = { + firstDayOfWeek: 1, + weekdays: { + shorthand: ["Ned", "Pon", "Uto", "Sri", "Čet", "Pet", "Sub"], + longhand: [ + "Nedjelja", + "Ponedjeljak", + "Utorak", + "Srijeda", + "Četvrtak", + "Petak", + "Subota", + ], + }, + months: { + shorthand: [ + "Sij", + "Velj", + "Ožu", + "Tra", + "Svi", + "Lip", + "Srp", + "Kol", + "Ruj", + "Lis", + "Stu", + "Pro", + ], + longhand: [ + "Siječanj", + "Veljača", + "Ožujak", + "Travanj", + "Svibanj", + "Lipanj", + "Srpanj", + "Kolovoz", + "Rujan", + "Listopad", + "Studeni", + "Prosinac", + ], + }, + time_24hr: true, + }; + fp$m.l10ns.hr = Croatian; + fp$m.l10ns; + + var fp$n = typeof window !== "undefined" && window.flatpickr !== undefined + ? window.flatpickr + : { + l10ns: {}, + }; + var Hungarian = { + firstDayOfWeek: 1, + weekdays: { + shorthand: ["V", "H", "K", "Sz", "Cs", "P", "Szo"], + longhand: [ + "Vasárnap", + "Hétfő", + "Kedd", + "Szerda", + "Csütörtök", + "Péntek", + "Szombat", + ], + }, + months: { + shorthand: [ + "Jan", + "Feb", + "Már", + "Ápr", + "Máj", + "Jún", + "Júl", + "Aug", + "Szep", + "Okt", + "Nov", + "Dec", + ], + longhand: [ + "Január", + "Február", + "Március", + "Április", + "Május", + "Június", + "Július", + "Augusztus", + "Szeptember", + "Október", + "November", + "December", + ], + }, + ordinal: function () { + return "."; + }, + weekAbbreviation: "Hét", + scrollTitle: "Görgessen", + toggleTitle: "Kattintson a váltáshoz", + rangeSeparator: " - ", + time_24hr: true, + }; + fp$n.l10ns.hu = Hungarian; + fp$n.l10ns; + + var fp$o = typeof window !== "undefined" && window.flatpickr !== undefined + ? window.flatpickr + : { + l10ns: {}, + }; + var Indonesian = { + weekdays: { + shorthand: ["Min", "Sen", "Sel", "Rab", "Kam", "Jum", "Sab"], + longhand: ["Minggu", "Senin", "Selasa", "Rabu", "Kamis", "Jumat", "Sabtu"], + }, + months: { + shorthand: [ + "Jan", + "Feb", + "Mar", + "Apr", + "Mei", + "Jun", + "Jul", + "Agu", + "Sep", + "Okt", + "Nov", + "Des", + ], + longhand: [ + "Januari", + "Februari", + "Maret", + "April", + "Mei", + "Juni", + "Juli", + "Agustus", + "September", + "Oktober", + "November", + "Desember", + ], + }, + firstDayOfWeek: 1, + ordinal: function () { + return ""; + }, + time_24hr: true, + rangeSeparator: " - ", + }; + fp$o.l10ns.id = Indonesian; + fp$o.l10ns; + + var fp$p = typeof window !== "undefined" && window.flatpickr !== undefined + ? window.flatpickr + : { + l10ns: {}, + }; + var Icelandic = { + weekdays: { + shorthand: ["Sun", "Mán", "Þri", "Mið", "Fim", "Fös", "Lau"], + longhand: [ + "Sunnudagur", + "Mánudagur", + "Þriðjudagur", + "Miðvikudagur", + "Fimmtudagur", + "Föstudagur", + "Laugardagur", + ], + }, + months: { + shorthand: [ + "Jan", + "Feb", + "Mar", + "Apr", + "Maí", + "Jún", + "Júl", + "Ágú", + "Sep", + "Okt", + "Nóv", + "Des", + ], + longhand: [ + "Janúar", + "Febrúar", + "Mars", + "Apríl", + "Maí", + "Júní", + "Júlí", + "Ágúst", + "September", + "Október", + "Nóvember", + "Desember", + ], + }, + ordinal: function () { + return "."; + }, + firstDayOfWeek: 1, + rangeSeparator: " til ", + weekAbbreviation: "vika", + yearAriaLabel: "Ár", + time_24hr: true, + }; + fp$p.l10ns.is = Icelandic; + fp$p.l10ns; + + var fp$q = typeof window !== "undefined" && window.flatpickr !== undefined + ? window.flatpickr + : { + l10ns: {}, + }; + var Italian = { + weekdays: { + shorthand: ["Dom", "Lun", "Mar", "Mer", "Gio", "Ven", "Sab"], + longhand: [ + "Domenica", + "Lunedì", + "Martedì", + "Mercoledì", + "Giovedì", + "Venerdì", + "Sabato", + ], + }, + months: { + shorthand: [ + "Gen", + "Feb", + "Mar", + "Apr", + "Mag", + "Giu", + "Lug", + "Ago", + "Set", + "Ott", + "Nov", + "Dic", + ], + longhand: [ + "Gennaio", + "Febbraio", + "Marzo", + "Aprile", + "Maggio", + "Giugno", + "Luglio", + "Agosto", + "Settembre", + "Ottobre", + "Novembre", + "Dicembre", + ], + }, + firstDayOfWeek: 1, + ordinal: function () { return "°"; }, + rangeSeparator: " al ", + weekAbbreviation: "Se", + scrollTitle: "Scrolla per aumentare", + toggleTitle: "Clicca per cambiare", + time_24hr: true, + }; + fp$q.l10ns.it = Italian; + fp$q.l10ns; + + var fp$r = typeof window !== "undefined" && window.flatpickr !== undefined + ? window.flatpickr + : { + l10ns: {}, + }; + var Japanese = { + weekdays: { + shorthand: ["日", "月", "火", "水", "木", "金", "土"], + longhand: [ + "日曜日", + "月曜日", + "火曜日", + "水曜日", + "木曜日", + "金曜日", + "土曜日", + ], + }, + months: { + shorthand: [ + "1月", + "2月", + "3月", + "4月", + "5月", + "6月", + "7月", + "8月", + "9月", + "10月", + "11月", + "12月", + ], + longhand: [ + "1月", + "2月", + "3月", + "4月", + "5月", + "6月", + "7月", + "8月", + "9月", + "10月", + "11月", + "12月", + ], + }, + time_24hr: true, + rangeSeparator: " から ", + firstDayOfWeek: 1, + }; + fp$r.l10ns.ja = Japanese; + fp$r.l10ns; + + var fp$s = typeof window !== "undefined" && window.flatpickr !== undefined + ? window.flatpickr + : { + l10ns: {}, + }; + var Georgian = { + weekdays: { + shorthand: ["კვ", "ორ", "სა", "ოთ", "ხუ", "პა", "შა"], + longhand: [ + "კვირა", + "ორშაბათი", + "სამშაბათი", + "ოთხშაბათი", + "ხუთშაბათი", + "პარასკევი", + "შაბათი", + ], + }, + months: { + shorthand: [ + "იან", + "თებ", + "მარ", + "აპრ", + "მაი", + "ივნ", + "ივლ", + "აგვ", + "სექ", + "ოქტ", + "ნოე", + "დეკ", + ], + longhand: [ + "იანვარი", + "თებერვალი", + "მარტი", + "აპრილი", + "მაისი", + "ივნისი", + "ივლისი", + "აგვისტო", + "სექტემბერი", + "ოქტომბერი", + "ნოემბერი", + "დეკემბერი", + ], + }, + firstDayOfWeek: 1, + ordinal: function () { + return ""; + }, + rangeSeparator: " — ", + weekAbbreviation: "კვ.", + scrollTitle: "დასქროლეთ გასადიდებლად", + toggleTitle: "დააკლიკეთ გადართვისთვის", + amPM: ["AM", "PM"], + yearAriaLabel: "წელი", + time_24hr: true, + }; + fp$s.l10ns.ka = Georgian; + fp$s.l10ns; + + var fp$t = typeof window !== "undefined" && window.flatpickr !== undefined + ? window.flatpickr + : { + l10ns: {}, + }; + var Korean = { + weekdays: { + shorthand: ["일", "월", "화", "수", "목", "금", "토"], + longhand: [ + "일요일", + "월요일", + "화요일", + "수요일", + "목요일", + "금요일", + "토요일", + ], + }, + months: { + shorthand: [ + "1월", + "2월", + "3월", + "4월", + "5월", + "6월", + "7월", + "8월", + "9월", + "10월", + "11월", + "12월", + ], + longhand: [ + "1월", + "2월", + "3월", + "4월", + "5월", + "6월", + "7월", + "8월", + "9월", + "10월", + "11월", + "12월", + ], + }, + ordinal: function () { + return "일"; + }, + rangeSeparator: " ~ ", + }; + fp$t.l10ns.ko = Korean; + fp$t.l10ns; + + var fp$u = typeof window !== "undefined" && window.flatpickr !== undefined + ? window.flatpickr + : { + l10ns: {}, + }; + var Khmer = { + weekdays: { + shorthand: ["អាទិត្យ", "ចន្ទ", "អង្គារ", "ពុធ", "ព្រហស.", "សុក្រ", "សៅរ៍"], + longhand: [ + "អាទិត្យ", + "ចន្ទ", + "អង្គារ", + "ពុធ", + "ព្រហស្បតិ៍", + "សុក្រ", + "សៅរ៍", + ], + }, + months: { + shorthand: [ + "មករា", + "កុម្ភះ", + "មីនា", + "មេសា", + "ឧសភា", + "មិថុនា", + "កក្កដា", + "សីហា", + "កញ្ញា", + "តុលា", + "វិច្ឆិកា", + "ធ្នូ", + ], + longhand: [ + "មករា", + "កុម្ភះ", + "មីនា", + "មេសា", + "ឧសភា", + "មិថុនា", + "កក្កដា", + "សីហា", + "កញ្ញា", + "តុលា", + "វិច្ឆិកា", + "ធ្នូ", + ], + }, + ordinal: function () { + return ""; + }, + firstDayOfWeek: 1, + rangeSeparator: " ដល់ ", + weekAbbreviation: "សប្តាហ៍", + scrollTitle: "រំកិលដើម្បីបង្កើន", + toggleTitle: "ចុចដើម្បីផ្លាស់ប្ដូរ", + yearAriaLabel: "ឆ្នាំ", + time_24hr: true, + }; + fp$u.l10ns.km = Khmer; + fp$u.l10ns; + + var fp$v = typeof window !== "undefined" && window.flatpickr !== undefined + ? window.flatpickr + : { + l10ns: {}, + }; + var Kazakh = { + weekdays: { + shorthand: ["Жс", "Дс", "Сc", "Ср", "Бс", "Жм", "Сб"], + longhand: [ + "Жексенбi", + "Дүйсенбi", + "Сейсенбi", + "Сәрсенбi", + "Бейсенбi", + "Жұма", + "Сенбi", + ], + }, + months: { + shorthand: [ + "Қаң", + "Ақп", + "Нау", + "Сәу", + "Мам", + "Мау", + "Шiл", + "Там", + "Қыр", + "Қаз", + "Қар", + "Жел", + ], + longhand: [ + "Қаңтар", + "Ақпан", + "Наурыз", + "Сәуiр", + "Мамыр", + "Маусым", + "Шiлде", + "Тамыз", + "Қыркүйек", + "Қазан", + "Қараша", + "Желтоқсан", + ], + }, + firstDayOfWeek: 1, + ordinal: function () { + return ""; + }, + rangeSeparator: " — ", + weekAbbreviation: "Апта", + scrollTitle: "Үлкейту үшін айналдырыңыз", + toggleTitle: "Ауыстыру үшін басыңыз", + amPM: ["ТД", "ТК"], + yearAriaLabel: "Жыл", + }; + fp$v.l10ns.kz = Kazakh; + fp$v.l10ns; + + var fp$w = typeof window !== "undefined" && window.flatpickr !== undefined + ? window.flatpickr + : { + l10ns: {}, + }; + var Lithuanian = { + weekdays: { + shorthand: ["S", "Pr", "A", "T", "K", "Pn", "Š"], + longhand: [ + "Sekmadienis", + "Pirmadienis", + "Antradienis", + "Trečiadienis", + "Ketvirtadienis", + "Penktadienis", + "Šeštadienis", + ], + }, + months: { + shorthand: [ + "Sau", + "Vas", + "Kov", + "Bal", + "Geg", + "Bir", + "Lie", + "Rgp", + "Rgs", + "Spl", + "Lap", + "Grd", + ], + longhand: [ + "Sausis", + "Vasaris", + "Kovas", + "Balandis", + "Gegužė", + "Birželis", + "Liepa", + "Rugpjūtis", + "Rugsėjis", + "Spalis", + "Lapkritis", + "Gruodis", + ], + }, + firstDayOfWeek: 1, + ordinal: function () { + return "-a"; + }, + rangeSeparator: " iki ", + weekAbbreviation: "Sav", + scrollTitle: "Keisti laiką pelės rateliu", + toggleTitle: "Perjungti laiko formatą", + time_24hr: true, + }; + fp$w.l10ns.lt = Lithuanian; + fp$w.l10ns; + + var fp$x = typeof window !== "undefined" && window.flatpickr !== undefined + ? window.flatpickr + : { + l10ns: {}, + }; + var Latvian = { + firstDayOfWeek: 1, + weekdays: { + shorthand: ["Sv", "Pr", "Ot", "Tr", "Ce", "Pk", "Se"], + longhand: [ + "Svētdiena", + "Pirmdiena", + "Otrdiena", + "Trešdiena", + "Ceturtdiena", + "Piektdiena", + "Sestdiena", + ], + }, + months: { + shorthand: [ + "Jan", + "Feb", + "Mar", + "Apr", + "Mai", + "Jūn", + "Jūl", + "Aug", + "Sep", + "Okt", + "Nov", + "Dec", + ], + longhand: [ + "Janvāris", + "Februāris", + "Marts", + "Aprīlis", + "Maijs", + "Jūnijs", + "Jūlijs", + "Augusts", + "Septembris", + "Oktobris", + "Novembris", + "Decembris", + ], + }, + rangeSeparator: " līdz ", + time_24hr: true, + }; + fp$x.l10ns.lv = Latvian; + fp$x.l10ns; + + var fp$y = typeof window !== "undefined" && window.flatpickr !== undefined + ? window.flatpickr + : { + l10ns: {}, + }; + var Macedonian = { + weekdays: { + shorthand: ["Не", "По", "Вт", "Ср", "Че", "Пе", "Са"], + longhand: [ + "Недела", + "Понеделник", + "Вторник", + "Среда", + "Четврток", + "Петок", + "Сабота", + ], + }, + months: { + shorthand: [ + "Јан", + "Фев", + "Мар", + "Апр", + "Мај", + "Јун", + "Јул", + "Авг", + "Сеп", + "Окт", + "Ное", + "Дек", + ], + longhand: [ + "Јануари", + "Февруари", + "Март", + "Април", + "Мај", + "Јуни", + "Јули", + "Август", + "Септември", + "Октомври", + "Ноември", + "Декември", + ], + }, + firstDayOfWeek: 1, + weekAbbreviation: "Нед.", + rangeSeparator: " до ", + time_24hr: true, + }; + fp$y.l10ns.mk = Macedonian; + fp$y.l10ns; + + var fp$z = typeof window !== "undefined" && window.flatpickr !== undefined + ? window.flatpickr + : { + l10ns: {}, + }; + var Mongolian = { + firstDayOfWeek: 1, + weekdays: { + shorthand: ["Да", "Мя", "Лх", "Пү", "Ба", "Бя", "Ня"], + longhand: ["Даваа", "Мягмар", "Лхагва", "Пүрэв", "Баасан", "Бямба", "Ням"], + }, + months: { + shorthand: [ + "1-р сар", + "2-р сар", + "3-р сар", + "4-р сар", + "5-р сар", + "6-р сар", + "7-р сар", + "8-р сар", + "9-р сар", + "10-р сар", + "11-р сар", + "12-р сар", + ], + longhand: [ + "Нэгдүгээр сар", + "Хоёрдугаар сар", + "Гуравдугаар сар", + "Дөрөвдүгээр сар", + "Тавдугаар сар", + "Зургаадугаар сар", + "Долдугаар сар", + "Наймдугаар сар", + "Есдүгээр сар", + "Аравдугаар сар", + "Арваннэгдүгээр сар", + "Арванхоёрдугаар сар", + ], + }, + rangeSeparator: "-с ", + time_24hr: true, + }; + fp$z.l10ns.mn = Mongolian; + fp$z.l10ns; + + var fp$A = typeof window !== "undefined" && window.flatpickr !== undefined + ? window.flatpickr + : { + l10ns: {}, + }; + var Malaysian = { + weekdays: { + shorthand: ["Min", "Isn", "Sel", "Rab", "Kha", "Jum", "Sab"], + longhand: [ + "Minggu", + "Isnin", + "Selasa", + "Rabu", + "Khamis", + "Jumaat", + "Sabtu", + ], + }, + months: { + shorthand: [ + "Jan", + "Feb", + "Mac", + "Apr", + "Mei", + "Jun", + "Jul", + "Ogo", + "Sep", + "Okt", + "Nov", + "Dis", + ], + longhand: [ + "Januari", + "Februari", + "Mac", + "April", + "Mei", + "Jun", + "Julai", + "Ogos", + "September", + "Oktober", + "November", + "Disember", + ], + }, + firstDayOfWeek: 1, + ordinal: function () { + return ""; + }, + }; + fp$A.l10ns; + + var fp$B = typeof window !== "undefined" && window.flatpickr !== undefined + ? window.flatpickr + : { + l10ns: {}, + }; + var Burmese = { + weekdays: { + shorthand: ["နွေ", "လာ", "ဂါ", "ဟူး", "ကြာ", "သော", "နေ"], + longhand: [ + "တနင်္ဂနွေ", + "တနင်္လာ", + "အင်္ဂါ", + "ဗုဒ္ဓဟူး", + "ကြာသပတေး", + "သောကြာ", + "စနေ", + ], + }, + months: { + shorthand: [ + "ဇန်", + "ဖေ", + "မတ်", + "ပြီ", + "မေ", + "ဇွန်", + "လိုင်", + "သြ", + "စက်", + "အောက်", + "နို", + "ဒီ", + ], + longhand: [ + "ဇန်နဝါရီ", + "ဖေဖော်ဝါရီ", + "မတ်", + "ဧပြီ", + "မေ", + "ဇွန်", + "ဇူလိုင်", + "သြဂုတ်", + "စက်တင်ဘာ", + "အောက်တိုဘာ", + "နိုဝင်ဘာ", + "ဒီဇင်ဘာ", + ], + }, + firstDayOfWeek: 1, + ordinal: function () { + return ""; + }, + time_24hr: true, + }; + fp$B.l10ns.my = Burmese; + fp$B.l10ns; + + var fp$C = typeof window !== "undefined" && window.flatpickr !== undefined + ? window.flatpickr + : { + l10ns: {}, + }; + var Dutch = { + weekdays: { + shorthand: ["zo", "ma", "di", "wo", "do", "vr", "za"], + longhand: [ + "zondag", + "maandag", + "dinsdag", + "woensdag", + "donderdag", + "vrijdag", + "zaterdag", + ], + }, + months: { + shorthand: [ + "jan", + "feb", + "mrt", + "apr", + "mei", + "jun", + "jul", + "aug", + "sept", + "okt", + "nov", + "dec", + ], + longhand: [ + "januari", + "februari", + "maart", + "april", + "mei", + "juni", + "juli", + "augustus", + "september", + "oktober", + "november", + "december", + ], + }, + firstDayOfWeek: 1, + weekAbbreviation: "wk", + rangeSeparator: " t/m ", + scrollTitle: "Scroll voor volgende / vorige", + toggleTitle: "Klik om te wisselen", + time_24hr: true, + ordinal: function (nth) { + if (nth === 1 || nth === 8 || nth >= 20) + return "ste"; + return "de"; + }, + }; + fp$C.l10ns.nl = Dutch; + fp$C.l10ns; + + var fp$D = typeof window !== "undefined" && window.flatpickr !== undefined + ? window.flatpickr + : { + l10ns: {}, + }; + var Norwegian = { + weekdays: { + shorthand: ["Søn", "Man", "Tir", "Ons", "Tor", "Fre", "Lør"], + longhand: [ + "Søndag", + "Mandag", + "Tirsdag", + "Onsdag", + "Torsdag", + "Fredag", + "Lørdag", + ], + }, + months: { + shorthand: [ + "Jan", + "Feb", + "Mar", + "Apr", + "Mai", + "Jun", + "Jul", + "Aug", + "Sep", + "Okt", + "Nov", + "Des", + ], + longhand: [ + "Januar", + "Februar", + "Mars", + "April", + "Mai", + "Juni", + "Juli", + "August", + "September", + "Oktober", + "November", + "Desember", + ], + }, + firstDayOfWeek: 1, + rangeSeparator: " til ", + weekAbbreviation: "Uke", + scrollTitle: "Scroll for å endre", + toggleTitle: "Klikk for å veksle", + time_24hr: true, + ordinal: function () { + return "."; + }, + }; + fp$D.l10ns.no = Norwegian; + fp$D.l10ns; + + var fp$E = typeof window !== "undefined" && window.flatpickr !== undefined + ? window.flatpickr + : { + l10ns: {}, + }; + var Punjabi = { + weekdays: { + shorthand: ["ਐਤ", "ਸੋਮ", "ਮੰਗਲ", "ਬੁੱਧ", "ਵੀਰ", "ਸ਼ੁੱਕਰ", "ਸ਼ਨਿੱਚਰ"], + longhand: [ + "ਐਤਵਾਰ", + "ਸੋਮਵਾਰ", + "ਮੰਗਲਵਾਰ", + "ਬੁੱਧਵਾਰ", + "ਵੀਰਵਾਰ", + "ਸ਼ੁੱਕਰਵਾਰ", + "ਸ਼ਨਿੱਚਰਵਾਰ", + ], + }, + months: { + shorthand: [ + "ਜਨ", + "ਫ਼ਰ", + "ਮਾਰ", + "ਅਪ੍ਰੈ", + "ਮਈ", + "ਜੂਨ", + "ਜੁਲਾ", + "ਅਗ", + "ਸਤੰ", + "ਅਕ", + "ਨਵੰ", + "ਦਸੰ", + ], + longhand: [ + "ਜਨਵਰੀ", + "ਫ਼ਰਵਰੀ", + "ਮਾਰਚ", + "ਅਪ੍ਰੈਲ", + "ਮਈ", + "ਜੂਨ", + "ਜੁਲਾਈ", + "ਅਗਸਤ", + "ਸਤੰਬਰ", + "ਅਕਤੂਬਰ", + "ਨਵੰਬਰ", + "ਦਸੰਬਰ", + ], + }, + time_24hr: true, + }; + fp$E.l10ns.pa = Punjabi; + fp$E.l10ns; + + var fp$F = typeof window !== "undefined" && window.flatpickr !== undefined + ? window.flatpickr + : { + l10ns: {}, + }; + var Polish = { + weekdays: { + shorthand: ["Nd", "Pn", "Wt", "Śr", "Cz", "Pt", "So"], + longhand: [ + "Niedziela", + "Poniedziałek", + "Wtorek", + "Środa", + "Czwartek", + "Piątek", + "Sobota", + ], + }, + months: { + shorthand: [ + "Sty", + "Lut", + "Mar", + "Kwi", + "Maj", + "Cze", + "Lip", + "Sie", + "Wrz", + "Paź", + "Lis", + "Gru", + ], + longhand: [ + "Styczeń", + "Luty", + "Marzec", + "Kwiecień", + "Maj", + "Czerwiec", + "Lipiec", + "Sierpień", + "Wrzesień", + "Październik", + "Listopad", + "Grudzień", + ], + }, + rangeSeparator: " do ", + weekAbbreviation: "tydz.", + scrollTitle: "Przewiń, aby zwiększyć", + toggleTitle: "Kliknij, aby przełączyć", + firstDayOfWeek: 1, + time_24hr: true, + ordinal: function () { + return "."; + }, + }; + fp$F.l10ns.pl = Polish; + fp$F.l10ns; + + var fp$G = typeof window !== "undefined" && window.flatpickr !== undefined + ? window.flatpickr + : { + l10ns: {}, + }; + var Portuguese = { + weekdays: { + shorthand: ["Dom", "Seg", "Ter", "Qua", "Qui", "Sex", "Sáb"], + longhand: [ + "Domingo", + "Segunda-feira", + "Terça-feira", + "Quarta-feira", + "Quinta-feira", + "Sexta-feira", + "Sábado", + ], + }, + months: { + shorthand: [ + "Jan", + "Fev", + "Mar", + "Abr", + "Mai", + "Jun", + "Jul", + "Ago", + "Set", + "Out", + "Nov", + "Dez", + ], + longhand: [ + "Janeiro", + "Fevereiro", + "Março", + "Abril", + "Maio", + "Junho", + "Julho", + "Agosto", + "Setembro", + "Outubro", + "Novembro", + "Dezembro", + ], + }, + rangeSeparator: " até ", + time_24hr: true, + }; + fp$G.l10ns.pt = Portuguese; + fp$G.l10ns; + + var fp$H = typeof window !== "undefined" && window.flatpickr !== undefined + ? window.flatpickr + : { + l10ns: {}, + }; + var Romanian = { + weekdays: { + shorthand: ["Dum", "Lun", "Mar", "Mie", "Joi", "Vin", "Sâm"], + longhand: [ + "Duminică", + "Luni", + "Marți", + "Miercuri", + "Joi", + "Vineri", + "Sâmbătă", + ], + }, + months: { + shorthand: [ + "Ian", + "Feb", + "Mar", + "Apr", + "Mai", + "Iun", + "Iul", + "Aug", + "Sep", + "Oct", + "Noi", + "Dec", + ], + longhand: [ + "Ianuarie", + "Februarie", + "Martie", + "Aprilie", + "Mai", + "Iunie", + "Iulie", + "August", + "Septembrie", + "Octombrie", + "Noiembrie", + "Decembrie", + ], + }, + firstDayOfWeek: 1, + time_24hr: true, + ordinal: function () { + return ""; + }, + }; + fp$H.l10ns.ro = Romanian; + fp$H.l10ns; + + var fp$I = typeof window !== "undefined" && window.flatpickr !== undefined + ? window.flatpickr + : { + l10ns: {}, + }; + var Russian = { + weekdays: { + shorthand: ["Вс", "Пн", "Вт", "Ср", "Чт", "Пт", "Сб"], + longhand: [ + "Воскресенье", + "Понедельник", + "Вторник", + "Среда", + "Четверг", + "Пятница", + "Суббота", + ], + }, + months: { + shorthand: [ + "Янв", + "Фев", + "Март", + "Апр", + "Май", + "Июнь", + "Июль", + "Авг", + "Сен", + "Окт", + "Ноя", + "Дек", + ], + longhand: [ + "Январь", + "Февраль", + "Март", + "Апрель", + "Май", + "Июнь", + "Июль", + "Август", + "Сентябрь", + "Октябрь", + "Ноябрь", + "Декабрь", + ], + }, + firstDayOfWeek: 1, + ordinal: function () { + return ""; + }, + rangeSeparator: " — ", + weekAbbreviation: "Нед.", + scrollTitle: "Прокрутите для увеличения", + toggleTitle: "Нажмите для переключения", + amPM: ["ДП", "ПП"], + yearAriaLabel: "Год", + time_24hr: true, + }; + fp$I.l10ns.ru = Russian; + fp$I.l10ns; + + var fp$J = typeof window !== "undefined" && window.flatpickr !== undefined + ? window.flatpickr + : { + l10ns: {}, + }; + var Sinhala = { + weekdays: { + shorthand: ["ඉ", "ස", "අ", "බ", "බ්‍ර", "සි", "සෙ"], + longhand: [ + "ඉරිදා", + "සඳුදා", + "අඟහරුවාදා", + "බදාදා", + "බ්‍රහස්පතින්දා", + "සිකුරාදා", + "සෙනසුරාදා", + ], + }, + months: { + shorthand: [ + "ජන", + "පෙබ", + "මාර්", + "අප්‍රේ", + "මැයි", + "ජුනි", + "ජූලි", + "අගෝ", + "සැප්", + "ඔක්", + "නොවැ", + "දෙසැ", + ], + longhand: [ + "ජනවාරි", + "පෙබරවාරි", + "මාර්තු", + "අප්‍රේල්", + "මැයි", + "ජුනි", + "ජූලි", + "අගෝස්තු", + "සැප්තැම්බර්", + "ඔක්තෝබර්", + "නොවැම්බර්", + "දෙසැම්බර්", + ], + }, + time_24hr: true, + }; + fp$J.l10ns.si = Sinhala; + fp$J.l10ns; + + var fp$K = typeof window !== "undefined" && window.flatpickr !== undefined + ? window.flatpickr + : { + l10ns: {}, + }; + var Slovak = { + weekdays: { + shorthand: ["Ned", "Pon", "Ut", "Str", "Štv", "Pia", "Sob"], + longhand: [ + "Nedeľa", + "Pondelok", + "Utorok", + "Streda", + "Štvrtok", + "Piatok", + "Sobota", + ], + }, + months: { + shorthand: [ + "Jan", + "Feb", + "Mar", + "Apr", + "Máj", + "Jún", + "Júl", + "Aug", + "Sep", + "Okt", + "Nov", + "Dec", + ], + longhand: [ + "Január", + "Február", + "Marec", + "Apríl", + "Máj", + "Jún", + "Júl", + "August", + "September", + "Október", + "November", + "December", + ], + }, + firstDayOfWeek: 1, + rangeSeparator: " do ", + time_24hr: true, + ordinal: function () { + return "."; + }, + }; + fp$K.l10ns.sk = Slovak; + fp$K.l10ns; + + var fp$L = typeof window !== "undefined" && window.flatpickr !== undefined + ? window.flatpickr + : { + l10ns: {}, + }; + var Slovenian = { + weekdays: { + shorthand: ["Ned", "Pon", "Tor", "Sre", "Čet", "Pet", "Sob"], + longhand: [ + "Nedelja", + "Ponedeljek", + "Torek", + "Sreda", + "Četrtek", + "Petek", + "Sobota", + ], + }, + months: { + shorthand: [ + "Jan", + "Feb", + "Mar", + "Apr", + "Maj", + "Jun", + "Jul", + "Avg", + "Sep", + "Okt", + "Nov", + "Dec", + ], + longhand: [ + "Januar", + "Februar", + "Marec", + "April", + "Maj", + "Junij", + "Julij", + "Avgust", + "September", + "Oktober", + "November", + "December", + ], + }, + firstDayOfWeek: 1, + rangeSeparator: " do ", + time_24hr: true, + ordinal: function () { + return "."; + }, + }; + fp$L.l10ns.sl = Slovenian; + fp$L.l10ns; + + var fp$M = typeof window !== "undefined" && window.flatpickr !== undefined + ? window.flatpickr + : { + l10ns: {}, + }; + var Albanian = { + weekdays: { + shorthand: ["Di", "Hë", "Ma", "Më", "En", "Pr", "Sh"], + longhand: [ + "E Diel", + "E Hënë", + "E Martë", + "E Mërkurë", + "E Enjte", + "E Premte", + "E Shtunë", + ], + }, + months: { + shorthand: [ + "Jan", + "Shk", + "Mar", + "Pri", + "Maj", + "Qer", + "Kor", + "Gus", + "Sht", + "Tet", + "Nën", + "Dhj", + ], + longhand: [ + "Janar", + "Shkurt", + "Mars", + "Prill", + "Maj", + "Qershor", + "Korrik", + "Gusht", + "Shtator", + "Tetor", + "Nëntor", + "Dhjetor", + ], + }, + time_24hr: true, + }; + fp$M.l10ns.sq = Albanian; + fp$M.l10ns; + + var fp$N = typeof window !== "undefined" && window.flatpickr !== undefined + ? window.flatpickr + : { + l10ns: {}, + }; + var Serbian = { + weekdays: { + shorthand: ["Ned", "Pon", "Uto", "Sre", "Čet", "Pet", "Sub"], + longhand: [ + "Nedelja", + "Ponedeljak", + "Utorak", + "Sreda", + "Četvrtak", + "Petak", + "Subota", + ], + }, + months: { + shorthand: [ + "Jan", + "Feb", + "Mar", + "Apr", + "Maj", + "Jun", + "Jul", + "Avg", + "Sep", + "Okt", + "Nov", + "Dec", + ], + longhand: [ + "Januar", + "Februar", + "Mart", + "April", + "Maj", + "Jun", + "Jul", + "Avgust", + "Septembar", + "Oktobar", + "Novembar", + "Decembar", + ], + }, + firstDayOfWeek: 1, + weekAbbreviation: "Ned.", + rangeSeparator: " do ", + time_24hr: true, + }; + fp$N.l10ns.sr = Serbian; + fp$N.l10ns; + + var fp$O = typeof window !== "undefined" && window.flatpickr !== undefined + ? window.flatpickr + : { + l10ns: {}, + }; + var Swedish = { + firstDayOfWeek: 1, + weekAbbreviation: "v", + weekdays: { + shorthand: ["Sön", "Mån", "Tis", "Ons", "Tor", "Fre", "Lör"], + longhand: [ + "Söndag", + "Måndag", + "Tisdag", + "Onsdag", + "Torsdag", + "Fredag", + "Lördag", + ], + }, + months: { + shorthand: [ + "Jan", + "Feb", + "Mar", + "Apr", + "Maj", + "Jun", + "Jul", + "Aug", + "Sep", + "Okt", + "Nov", + "Dec", + ], + longhand: [ + "Januari", + "Februari", + "Mars", + "April", + "Maj", + "Juni", + "Juli", + "Augusti", + "September", + "Oktober", + "November", + "December", + ], + }, + time_24hr: true, + ordinal: function () { + return "."; + }, + }; + fp$O.l10ns.sv = Swedish; + fp$O.l10ns; + + var fp$P = typeof window !== "undefined" && window.flatpickr !== undefined + ? window.flatpickr + : { + l10ns: {}, + }; + var Thai = { + weekdays: { + shorthand: ["อา", "จ", "อ", "พ", "พฤ", "ศ", "ส"], + longhand: [ + "อาทิตย์", + "จันทร์", + "อังคาร", + "พุธ", + "พฤหัสบดี", + "ศุกร์", + "เสาร์", + ], + }, + months: { + shorthand: [ + "ม.ค.", + "ก.พ.", + "มี.ค.", + "เม.ย.", + "พ.ค.", + "มิ.ย.", + "ก.ค.", + "ส.ค.", + "ก.ย.", + "ต.ค.", + "พ.ย.", + "ธ.ค.", + ], + longhand: [ + "มกราคม", + "กุมภาพันธ์", + "มีนาคม", + "เมษายน", + "พฤษภาคม", + "มิถุนายน", + "กรกฎาคม", + "สิงหาคม", + "กันยายน", + "ตุลาคม", + "พฤศจิกายน", + "ธันวาคม", + ], + }, + firstDayOfWeek: 1, + rangeSeparator: " ถึง ", + scrollTitle: "เลื่อนเพื่อเพิ่มหรือลด", + toggleTitle: "คลิกเพื่อเปลี่ยน", + time_24hr: true, + ordinal: function () { + return ""; + }, + }; + fp$P.l10ns.th = Thai; + fp$P.l10ns; + + var fp$Q = typeof window !== "undefined" && window.flatpickr !== undefined + ? window.flatpickr + : { + l10ns: {}, + }; + var Turkish = { + weekdays: { + shorthand: ["Paz", "Pzt", "Sal", "Çar", "Per", "Cum", "Cmt"], + longhand: [ + "Pazar", + "Pazartesi", + "Salı", + "Çarşamba", + "Perşembe", + "Cuma", + "Cumartesi", + ], + }, + months: { + shorthand: [ + "Oca", + "Şub", + "Mar", + "Nis", + "May", + "Haz", + "Tem", + "Ağu", + "Eyl", + "Eki", + "Kas", + "Ara", + ], + longhand: [ + "Ocak", + "Şubat", + "Mart", + "Nisan", + "Mayıs", + "Haziran", + "Temmuz", + "Ağustos", + "Eylül", + "Ekim", + "Kasım", + "Aralık", + ], + }, + firstDayOfWeek: 1, + ordinal: function () { + return "."; + }, + rangeSeparator: " - ", + weekAbbreviation: "Hf", + scrollTitle: "Artırmak için kaydırın", + toggleTitle: "Aç/Kapa", + amPM: ["ÖÖ", "ÖS"], + time_24hr: true, + }; + fp$Q.l10ns.tr = Turkish; + fp$Q.l10ns; + + var fp$R = typeof window !== "undefined" && window.flatpickr !== undefined + ? window.flatpickr + : { + l10ns: {}, + }; + var Ukrainian = { + firstDayOfWeek: 1, + weekdays: { + shorthand: ["Нд", "Пн", "Вт", "Ср", "Чт", "Пт", "Сб"], + longhand: [ + "Неділя", + "Понеділок", + "Вівторок", + "Середа", + "Четвер", + "П'ятниця", + "Субота", + ], + }, + months: { + shorthand: [ + "Січ", + "Лют", + "Бер", + "Кві", + "Тра", + "Чер", + "Лип", + "Сер", + "Вер", + "Жов", + "Лис", + "Гру", + ], + longhand: [ + "Січень", + "Лютий", + "Березень", + "Квітень", + "Травень", + "Червень", + "Липень", + "Серпень", + "Вересень", + "Жовтень", + "Листопад", + "Грудень", + ], + }, + time_24hr: true, + }; + fp$R.l10ns.uk = Ukrainian; + fp$R.l10ns; + + var fp$S = typeof window !== "undefined" && window.flatpickr !== undefined + ? window.flatpickr + : { + l10ns: {}, + }; + var Uzbek = { + weekdays: { + shorthand: ["Якш", "Душ", "Сеш", "Чор", "Пай", "Жум", "Шан"], + longhand: [ + "Якшанба", + "Душанба", + "Сешанба", + "Чоршанба", + "Пайшанба", + "Жума", + "Шанба", + ], + }, + months: { + shorthand: [ + "Янв", + "Фев", + "Мар", + "Апр", + "Май", + "Июн", + "Июл", + "Авг", + "Сен", + "Окт", + "Ноя", + "Дек", + ], + longhand: [ + "Январ", + "Феврал", + "Март", + "Апрел", + "Май", + "Июн", + "Июл", + "Август", + "Сентябр", + "Октябр", + "Ноябр", + "Декабр", + ], + }, + firstDayOfWeek: 1, + ordinal: function () { + return ""; + }, + rangeSeparator: " — ", + weekAbbreviation: "Ҳафта", + scrollTitle: "Катталаштириш учун айлантиринг", + toggleTitle: "Ўтиш учун босинг", + amPM: ["AM", "PM"], + yearAriaLabel: "Йил", + time_24hr: true, + }; + fp$S.l10ns.uz = Uzbek; + fp$S.l10ns; + + var fp$T = typeof window !== "undefined" && window.flatpickr !== undefined + ? window.flatpickr + : { + l10ns: {}, + }; + var UzbekLatin = { + weekdays: { + shorthand: ["Ya", "Du", "Se", "Cho", "Pa", "Ju", "Sha"], + longhand: [ + "Yakshanba", + "Dushanba", + "Seshanba", + "Chorshanba", + "Payshanba", + "Juma", + "Shanba", + ], + }, + months: { + shorthand: [ + "Yan", + "Fev", + "Mar", + "Apr", + "May", + "Iyun", + "Iyul", + "Avg", + "Sen", + "Okt", + "Noy", + "Dek", + ], + longhand: [ + "Yanvar", + "Fevral", + "Mart", + "Aprel", + "May", + "Iyun", + "Iyul", + "Avgust", + "Sentabr", + "Oktabr", + "Noyabr", + "Dekabr", + ], + }, + firstDayOfWeek: 1, + ordinal: function () { + return ""; + }, + rangeSeparator: " — ", + weekAbbreviation: "Hafta", + scrollTitle: "Kattalashtirish uchun aylantiring", + toggleTitle: "O‘tish uchun bosing", + amPM: ["AM", "PM"], + yearAriaLabel: "Yil", + time_24hr: true, + }; + fp$T.l10ns["uz_latn"] = UzbekLatin; + fp$T.l10ns; + + var fp$U = typeof window !== "undefined" && window.flatpickr !== undefined + ? window.flatpickr + : { + l10ns: {}, + }; + var Vietnamese = { + weekdays: { + shorthand: ["CN", "T2", "T3", "T4", "T5", "T6", "T7"], + longhand: [ + "Chủ nhật", + "Thứ hai", + "Thứ ba", + "Thứ tư", + "Thứ năm", + "Thứ sáu", + "Thứ bảy", + ], + }, + months: { + shorthand: [ + "Th1", + "Th2", + "Th3", + "Th4", + "Th5", + "Th6", + "Th7", + "Th8", + "Th9", + "Th10", + "Th11", + "Th12", + ], + longhand: [ + "Tháng một", + "Tháng hai", + "Tháng ba", + "Tháng tư", + "Tháng năm", + "Tháng sáu", + "Tháng bảy", + "Tháng tám", + "Tháng chín", + "Tháng mười", + "Tháng 11", + "Tháng 12", + ], + }, + firstDayOfWeek: 1, + rangeSeparator: " đến ", + }; + fp$U.l10ns.vn = Vietnamese; + fp$U.l10ns; + + var fp$V = typeof window !== "undefined" && window.flatpickr !== undefined + ? window.flatpickr + : { + l10ns: {}, + }; + var Mandarin = { + weekdays: { + shorthand: ["周日", "周一", "周二", "周三", "周四", "周五", "周六"], + longhand: [ + "星期日", + "星期一", + "星期二", + "星期三", + "星期四", + "星期五", + "星期六", + ], + }, + months: { + shorthand: [ + "一月", + "二月", + "三月", + "四月", + "五月", + "六月", + "七月", + "八月", + "九月", + "十月", + "十一月", + "十二月", + ], + longhand: [ + "一月", + "二月", + "三月", + "四月", + "五月", + "六月", + "七月", + "八月", + "九月", + "十月", + "十一月", + "十二月", + ], + }, + rangeSeparator: " 至 ", + weekAbbreviation: "周", + scrollTitle: "滚动切换", + toggleTitle: "点击切换 12/24 小时时制", + }; + fp$V.l10ns.zh = Mandarin; + fp$V.l10ns; + + var fp$W = typeof window !== "undefined" && window.flatpickr !== undefined + ? window.flatpickr + : { + l10ns: {}, + }; + var MandarinTraditional = { + weekdays: { + shorthand: ["週日", "週一", "週二", "週三", "週四", "週五", "週六"], + longhand: [ + "星期日", + "星期一", + "星期二", + "星期三", + "星期四", + "星期五", + "星期六", + ], + }, + months: { + shorthand: [ + "一月", + "二月", + "三月", + "四月", + "五月", + "六月", + "七月", + "八月", + "九月", + "十月", + "十一月", + "十二月", + ], + longhand: [ + "一月", + "二月", + "三月", + "四月", + "五月", + "六月", + "七月", + "八月", + "九月", + "十月", + "十一月", + "十二月", + ], + }, + rangeSeparator: " 至 ", + weekAbbreviation: "週", + scrollTitle: "滾動切換", + toggleTitle: "點擊切換 12/24 小時時制", + }; + fp$W.l10ns.zh_tw = MandarinTraditional; + fp$W.l10ns; + + var l10n = { + ar: Arabic, + at: Austria, + az: Azerbaijan, + be: Belarusian, + bg: Bulgarian, + bn: Bangla, + bs: Bosnian, + ca: Catalan, + cat: Catalan, + cs: Czech, + cy: Welsh, + da: Danish, + de: German, + default: __assign({}, english), + en: english, + eo: Esperanto, + es: Spanish, + et: Estonian, + fa: Persian, + fi: Finnish, + fo: Faroese, + fr: French, + gr: Greek, + he: Hebrew, + hi: Hindi, + hr: Croatian, + hu: Hungarian, + id: Indonesian, + is: Icelandic, + it: Italian, + ja: Japanese, + ka: Georgian, + ko: Korean, + km: Khmer, + kz: Kazakh, + lt: Lithuanian, + lv: Latvian, + mk: Macedonian, + mn: Mongolian, + ms: Malaysian, + my: Burmese, + nl: Dutch, + no: Norwegian, + pa: Punjabi, + pl: Polish, + pt: Portuguese, + ro: Romanian, + ru: Russian, + si: Sinhala, + sk: Slovak, + sl: Slovenian, + sq: Albanian, + sr: Serbian, + sv: Swedish, + th: Thai, + tr: Turkish, + uk: Ukrainian, + vn: Vietnamese, + zh: Mandarin, + zh_tw: MandarinTraditional, + uz: Uzbek, + uz_latn: UzbekLatin, + }; + + exports.default = l10n; + + Object.defineProperty(exports, '__esModule', { value: true }); + +}))); diff --git a/admin/js/vendors/flatpickr/plugins/confirmDate/confirmDate.css b/admin/js/vendors/flatpickr/plugins/confirmDate/confirmDate.css new file mode 100644 index 0000000..9508ea9 --- /dev/null +++ b/admin/js/vendors/flatpickr/plugins/confirmDate/confirmDate.css @@ -0,0 +1,24 @@ +.flatpickr-confirm { + height: 40px; + max-height: 0px; + visibility: hidden; + display: flex; + justify-content: center; + align-items: center; + cursor: pointer; + background: rgba(0,0,0,0.06) +} + +.flatpickr-confirm svg path { + fill: inherit; +} + +.flatpickr-confirm.darkTheme { + color: white; + fill: white; +} + +.flatpickr-confirm.visible { + max-height: 40px; + visibility: visible +} diff --git a/admin/js/vendors/flatpickr/plugins/confirmDate/confirmDate.d.ts b/admin/js/vendors/flatpickr/plugins/confirmDate/confirmDate.d.ts new file mode 100644 index 0000000..a4ddf39 --- /dev/null +++ b/admin/js/vendors/flatpickr/plugins/confirmDate/confirmDate.d.ts @@ -0,0 +1,9 @@ +import { Plugin } from "../../types/options"; +export interface Config { + confirmIcon?: string; + confirmText?: string; + showAlways?: boolean; + theme?: string; +} +declare function confirmDatePlugin(pluginConfig: Config): Plugin; +export default confirmDatePlugin; diff --git a/admin/js/vendors/flatpickr/plugins/confirmDate/confirmDate.js b/admin/js/vendors/flatpickr/plugins/confirmDate/confirmDate.js new file mode 100644 index 0000000..8c55a4e --- /dev/null +++ b/admin/js/vendors/flatpickr/plugins/confirmDate/confirmDate.js @@ -0,0 +1,100 @@ +(function (global, factory) { + typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : + typeof define === 'function' && define.amd ? define(factory) : + (global = global || self, global.confirmDatePlugin = factory()); +}(this, (function () { 'use strict'; + + /*! ***************************************************************************** + Copyright (c) Microsoft Corporation. + + Permission to use, copy, modify, and/or distribute this software for any + purpose with or without fee is hereby granted. + + THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH + REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY + AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, + INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM + LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR + OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + PERFORMANCE OF THIS SOFTWARE. + ***************************************************************************** */ + + var __assign = function() { + __assign = Object.assign || function __assign(t) { + for (var s, i = 1, n = arguments.length; i < n; i++) { + s = arguments[i]; + for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; + } + return t; + }; + return __assign.apply(this, arguments); + }; + + function getEventTarget(event) { + try { + if (typeof event.composedPath === "function") { + var path = event.composedPath(); + return path[0]; + } + return event.target; + } + catch (error) { + return event.target; + } + } + + var defaultConfig = { + confirmIcon: " ", + confirmText: "OK ", + showAlways: false, + theme: "light", + }; + function confirmDatePlugin(pluginConfig) { + var config = __assign(__assign({}, defaultConfig), pluginConfig); + var confirmContainer; + var confirmButtonCSSClass = "flatpickr-confirm"; + return function (fp) { + if (fp.config.noCalendar || fp.isMobile) + return {}; + return __assign({ onKeyDown: function (_, __, ___, e) { + var eventTarget = getEventTarget(e); + if (fp.config.enableTime && + e.key === "Tab" && + eventTarget === fp.amPM) { + e.preventDefault(); + confirmContainer.focus(); + } + else if (e.key === "Enter" && eventTarget === confirmContainer) + fp.close(); + }, + onReady: function () { + confirmContainer = fp._createElement("div", confirmButtonCSSClass + " " + (config.showAlways ? "visible" : "") + " " + config.theme + "Theme", config.confirmText); + confirmContainer.tabIndex = -1; + confirmContainer.innerHTML += config.confirmIcon; + confirmContainer.addEventListener("click", fp.close); + fp.calendarContainer.appendChild(confirmContainer); + fp.loadedPlugins.push("confirmDate"); + } }, (!config.showAlways + ? { + onChange: function (_, dateStr) { + var showCondition = fp.config.enableTime || + fp.config.mode === "multiple" || + fp.loadedPlugins.indexOf("monthSelect") !== -1; + var localConfirmContainer = fp.calendarContainer.querySelector("." + confirmButtonCSSClass); + if (!localConfirmContainer) + return; + if (dateStr && + !fp.config.inline && + showCondition && + localConfirmContainer) + return localConfirmContainer.classList.add("visible"); + localConfirmContainer.classList.remove("visible"); + }, + } + : {})); + }; + } + + return confirmDatePlugin; + +}))); diff --git a/admin/js/vendors/flatpickr/plugins/labelPlugin/labelPlugin.d.ts b/admin/js/vendors/flatpickr/plugins/labelPlugin/labelPlugin.d.ts new file mode 100644 index 0000000..1a9cbce --- /dev/null +++ b/admin/js/vendors/flatpickr/plugins/labelPlugin/labelPlugin.d.ts @@ -0,0 +1,3 @@ +import { Plugin } from "../../types/options"; +declare function labelPlugin(): Plugin; +export default labelPlugin; diff --git a/admin/js/vendors/flatpickr/plugins/labelPlugin/labelPlugin.js b/admin/js/vendors/flatpickr/plugins/labelPlugin/labelPlugin.js new file mode 100644 index 0000000..1d8f0b0 --- /dev/null +++ b/admin/js/vendors/flatpickr/plugins/labelPlugin/labelPlugin.js @@ -0,0 +1,31 @@ +(function (global, factory) { + typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : + typeof define === 'function' && define.amd ? define(factory) : + (global = global || self, global.labelPlugin = factory()); +}(this, (function () { 'use strict'; + + function labelPlugin() { + return function (fp) { + return { + onReady: function () { + var id = fp.input.id; + if (!id) { + return; + } + if (fp.mobileInput) { + fp.input.removeAttribute("id"); + fp.mobileInput.id = id; + } + else if (fp.altInput) { + fp.input.removeAttribute("id"); + fp.altInput.id = id; + } + fp.loadedPlugins.push("labelPlugin"); + }, + }; + }; + } + + return labelPlugin; + +}))); diff --git a/admin/js/vendors/flatpickr/plugins/minMaxTimePlugin.d.ts b/admin/js/vendors/flatpickr/plugins/minMaxTimePlugin.d.ts new file mode 100644 index 0000000..4fe2e5c --- /dev/null +++ b/admin/js/vendors/flatpickr/plugins/minMaxTimePlugin.d.ts @@ -0,0 +1,17 @@ +import { Plugin } from "../types/options"; +export interface MinMaxTime { + minTime?: string; + maxTime?: string; +} +export interface Config { + table?: Record; + getTimeLimits?: (date: Date) => MinMaxTime; + tableDateFormat?: string; +} +export interface State { + formatDate: (date: Date, f: string) => string; + tableDateFormat: string; + defaults: MinMaxTime; +} +declare function minMaxTimePlugin(config?: Config): Plugin; +export default minMaxTimePlugin; diff --git a/admin/js/vendors/flatpickr/plugins/minMaxTimePlugin.js b/admin/js/vendors/flatpickr/plugins/minMaxTimePlugin.js new file mode 100644 index 0000000..cfc485f --- /dev/null +++ b/admin/js/vendors/flatpickr/plugins/minMaxTimePlugin.js @@ -0,0 +1,332 @@ +(function (global, factory) { + typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : + typeof define === 'function' && define.amd ? define(factory) : + (global = global || self, global.minMaxTimePlugin = factory()); +}(this, (function () { 'use strict'; + + var pad = function (number, length) { + if (length === void 0) { length = 2; } + return ("000" + number).slice(length * -1); + }; + var int = function (bool) { return (bool === true ? 1 : 0); }; + + var monthToStr = function (monthNumber, shorthand, locale) { return locale.months[shorthand ? "shorthand" : "longhand"][monthNumber]; }; + var formats = { + // get the date in UTC + Z: function (date) { return date.toISOString(); }, + // weekday name, short, e.g. Thu + D: function (date, locale, options) { + return locale.weekdays.shorthand[formats.w(date, locale, options)]; + }, + // full month name e.g. January + F: function (date, locale, options) { + return monthToStr(formats.n(date, locale, options) - 1, false, locale); + }, + // padded hour 1-12 + G: function (date, locale, options) { + return pad(formats.h(date, locale, options)); + }, + // hours with leading zero e.g. 03 + H: function (date) { return pad(date.getHours()); }, + // day (1-30) with ordinal suffix e.g. 1st, 2nd + J: function (date, locale) { + return locale.ordinal !== undefined + ? date.getDate() + locale.ordinal(date.getDate()) + : date.getDate(); + }, + // AM/PM + K: function (date, locale) { return locale.amPM[int(date.getHours() > 11)]; }, + // shorthand month e.g. Jan, Sep, Oct, etc + M: function (date, locale) { + return monthToStr(date.getMonth(), true, locale); + }, + // seconds 00-59 + S: function (date) { return pad(date.getSeconds()); }, + // unix timestamp + U: function (date) { return date.getTime() / 1000; }, + W: function (date, _, options) { + return options.getWeek(date); + }, + // full year e.g. 2016, padded (0001-9999) + Y: function (date) { return pad(date.getFullYear(), 4); }, + // day in month, padded (01-30) + d: function (date) { return pad(date.getDate()); }, + // hour from 1-12 (am/pm) + h: function (date) { return (date.getHours() % 12 ? date.getHours() % 12 : 12); }, + // minutes, padded with leading zero e.g. 09 + i: function (date) { return pad(date.getMinutes()); }, + // day in month (1-30) + j: function (date) { return date.getDate(); }, + // weekday name, full, e.g. Thursday + l: function (date, locale) { + return locale.weekdays.longhand[date.getDay()]; + }, + // padded month number (01-12) + m: function (date) { return pad(date.getMonth() + 1); }, + // the month number (1-12) + n: function (date) { return date.getMonth() + 1; }, + // seconds 0-59 + s: function (date) { return date.getSeconds(); }, + // Unix Milliseconds + u: function (date) { return date.getTime(); }, + // number of the day of the week + w: function (date) { return date.getDay(); }, + // last two digits of year e.g. 16 for 2016 + y: function (date) { return String(date.getFullYear()).substring(2); }, + }; + + var defaults = { + _disable: [], + _enable: [], + allowInput: false, + allowInvalidPreload: false, + altFormat: "F j, Y", + altInput: false, + altInputClass: "form-control input", + animate: typeof window === "object" && + window.navigator.userAgent.indexOf("MSIE") === -1, + ariaDateFormat: "F j, Y", + autoFillDefaultTime: true, + clickOpens: true, + closeOnSelect: true, + conjunction: ", ", + dateFormat: "Y-m-d", + defaultHour: 12, + defaultMinute: 0, + defaultSeconds: 0, + disable: [], + disableMobile: false, + enable: [], + enableSeconds: false, + enableTime: false, + errorHandler: function (err) { + return typeof console !== "undefined" && console.warn(err); + }, + getWeek: function (givenDate) { + var date = new Date(givenDate.getTime()); + date.setHours(0, 0, 0, 0); + // Thursday in current week decides the year. + date.setDate(date.getDate() + 3 - ((date.getDay() + 6) % 7)); + // January 4 is always in week 1. + var week1 = new Date(date.getFullYear(), 0, 4); + // Adjust to Thursday in week 1 and count number of weeks from date to week1. + return (1 + + Math.round(((date.getTime() - week1.getTime()) / 86400000 - + 3 + + ((week1.getDay() + 6) % 7)) / + 7)); + }, + hourIncrement: 1, + ignoredFocusElements: [], + inline: false, + locale: "default", + minuteIncrement: 5, + mode: "single", + monthSelectorType: "dropdown", + nextArrow: "", + noCalendar: false, + now: new Date(), + onChange: [], + onClose: [], + onDayCreate: [], + onDestroy: [], + onKeyDown: [], + onMonthChange: [], + onOpen: [], + onParseConfig: [], + onReady: [], + onValueUpdate: [], + onYearChange: [], + onPreCalendarPosition: [], + plugins: [], + position: "auto", + positionElement: undefined, + prevArrow: "", + shorthandCurrentMonth: false, + showMonths: 1, + static: false, + time_24hr: false, + weekNumbers: false, + wrap: false, + }; + + var english = { + weekdays: { + shorthand: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"], + longhand: [ + "Sunday", + "Monday", + "Tuesday", + "Wednesday", + "Thursday", + "Friday", + "Saturday", + ], + }, + months: { + shorthand: [ + "Jan", + "Feb", + "Mar", + "Apr", + "May", + "Jun", + "Jul", + "Aug", + "Sep", + "Oct", + "Nov", + "Dec", + ], + longhand: [ + "January", + "February", + "March", + "April", + "May", + "June", + "July", + "August", + "September", + "October", + "November", + "December", + ], + }, + daysInMonth: [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31], + firstDayOfWeek: 0, + ordinal: function (nth) { + var s = nth % 100; + if (s > 3 && s < 21) + return "th"; + switch (s % 10) { + case 1: + return "st"; + case 2: + return "nd"; + case 3: + return "rd"; + default: + return "th"; + } + }, + rangeSeparator: " to ", + weekAbbreviation: "Wk", + scrollTitle: "Scroll to increment", + toggleTitle: "Click to toggle", + amPM: ["AM", "PM"], + yearAriaLabel: "Year", + monthAriaLabel: "Month", + hourAriaLabel: "Hour", + minuteAriaLabel: "Minute", + time_24hr: false, + }; + + var createDateFormatter = function (_a) { + var _b = _a.config, config = _b === void 0 ? defaults : _b, _c = _a.l10n, l10n = _c === void 0 ? english : _c, _d = _a.isMobile, isMobile = _d === void 0 ? false : _d; + return function (dateObj, frmt, overrideLocale) { + var locale = overrideLocale || l10n; + if (config.formatDate !== undefined && !isMobile) { + return config.formatDate(dateObj, frmt, locale); + } + return frmt + .split("") + .map(function (c, i, arr) { + return formats[c] && arr[i - 1] !== "\\" + ? formats[c](dateObj, locale, config) + : c !== "\\" + ? c + : ""; + }) + .join(""); + }; + }; + /** + * Compute the difference in dates, measured in ms + */ + function compareDates(date1, date2, timeless) { + if (timeless === void 0) { timeless = true; } + if (timeless !== false) { + return (new Date(date1.getTime()).setHours(0, 0, 0, 0) - + new Date(date2.getTime()).setHours(0, 0, 0, 0)); + } + return date1.getTime() - date2.getTime(); + } + /** + * Compute the difference in times, measured in ms + */ + function compareTimes(date1, date2) { + return (3600 * (date1.getHours() - date2.getHours()) + + 60 * (date1.getMinutes() - date2.getMinutes()) + + date1.getSeconds() - + date2.getSeconds()); + } + + function minMaxTimePlugin(config) { + if (config === void 0) { config = {}; } + var state = { + formatDate: createDateFormatter({}), + tableDateFormat: config.tableDateFormat || "Y-m-d", + defaults: { + minTime: undefined, + maxTime: undefined, + }, + }; + function findDateTimeLimit(date) { + if (config.table !== undefined) { + return config.table[state.formatDate(date, state.tableDateFormat)]; + } + return config.getTimeLimits && config.getTimeLimits(date); + } + return function (fp) { + return { + onReady: function () { + state.formatDate = this.formatDate; + state.defaults = { + minTime: this.config.minTime && state.formatDate(this.config.minTime, "H:i"), + maxTime: this.config.maxTime && state.formatDate(this.config.maxTime, "H:i"), + }; + fp.loadedPlugins.push("minMaxTime"); + }, + onChange: function () { + var latest = this.latestSelectedDateObj; + var matchingTimeLimit = latest && findDateTimeLimit(latest); + if (latest && matchingTimeLimit !== undefined) { + this.set(matchingTimeLimit); + fp.config.minTime.setFullYear(latest.getFullYear()); + fp.config.maxTime.setFullYear(latest.getFullYear()); + fp.config.minTime.setMonth(latest.getMonth()); + fp.config.maxTime.setMonth(latest.getMonth()); + fp.config.minTime.setDate(latest.getDate()); + fp.config.maxTime.setDate(latest.getDate()); + if (compareDates(latest, fp.config.maxTime, false) > 0) { + fp.setDate(new Date(latest.getTime()).setHours(fp.config.maxTime.getHours(), fp.config.maxTime.getMinutes(), fp.config.maxTime.getSeconds(), fp.config.maxTime.getMilliseconds()), false); + } + else if (compareDates(latest, fp.config.minTime, false) < 0) + fp.setDate(new Date(latest.getTime()).setHours(fp.config.minTime.getHours(), fp.config.minTime.getMinutes(), fp.config.minTime.getSeconds(), fp.config.minTime.getMilliseconds()), false); + } + else { + var newMinMax = state.defaults || { + minTime: undefined, + maxTime: undefined, + }; + this.set(newMinMax); + if (!latest) + return; + var _a = fp.config, minTime = _a.minTime, maxTime = _a.maxTime; + if (minTime && compareTimes(latest, minTime) < 0) { + fp.setDate(new Date(latest.getTime()).setHours(minTime.getHours(), minTime.getMinutes(), minTime.getSeconds(), minTime.getMilliseconds()), false); + } + else if (maxTime && compareTimes(latest, maxTime) > 0) { + fp.setDate(new Date(latest.getTime()).setHours(maxTime.getHours(), maxTime.getMinutes(), maxTime.getSeconds(), maxTime.getMilliseconds())); + } + // + } + }, + }; + }; + } + + return minMaxTimePlugin; + +}))); diff --git a/admin/js/vendors/flatpickr/plugins/momentPlugin.d.ts b/admin/js/vendors/flatpickr/plugins/momentPlugin.d.ts new file mode 100644 index 0000000..c0ed5aa --- /dev/null +++ b/admin/js/vendors/flatpickr/plugins/momentPlugin.d.ts @@ -0,0 +1,6 @@ +import { Plugin } from "../types/options"; +export interface Config { + moment: Function; +} +declare function momentPlugin(config: Config): Plugin; +export default momentPlugin; diff --git a/admin/js/vendors/flatpickr/plugins/momentPlugin.js b/admin/js/vendors/flatpickr/plugins/momentPlugin.js new file mode 100644 index 0000000..777ef3a --- /dev/null +++ b/admin/js/vendors/flatpickr/plugins/momentPlugin.js @@ -0,0 +1,69 @@ +(function (global, factory) { + typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : + typeof define === 'function' && define.amd ? define(factory) : + (global = global || self, global.momentPlugin = factory()); +}(this, (function () { 'use strict'; + + function getEventTarget(event) { + try { + if (typeof event.composedPath === "function") { + var path = event.composedPath(); + return path[0]; + } + return event.target; + } + catch (error) { + return event.target; + } + } + + function momentPlugin(config) { + var moment = config.moment; + return function (fp) { + function captureIncrement(e) { + var event = e; + event.stopPropagation(); + var date = moment(fp.selectedDates[0]); + var input = getEventTarget(event); + var unit = Array.from(input.classList) + .filter(function (name) { return name.startsWith("flatpickr-"); }) + .map(function (name) { return name.substring(10); })[0]; + var step = parseFloat(input.getAttribute("step")); + date.add(step * event.delta, unit); + fp.setDate(date.toDate()); + } + return { + parseDate: function (datestr, format) { + return moment(datestr, format, true).toDate(); + }, + formatDate: function (date, format) { + // locale can also be used + var momentDate = moment(date); + if (typeof fp.config.locale === "string") { + momentDate.locale(fp.config.locale); + } + return momentDate.format(format); + }, + onReady: function () { + [fp.hourElement, fp.minuteElement, fp.secondElement].forEach(function (element) { + return element && + element.addEventListener("increment", captureIncrement, { + capture: true, + }); + }); + }, + onDestroy: function () { + [fp.hourElement, fp.minuteElement, fp.secondElement].forEach(function (element) { + return element && + element.removeEventListener("increment", captureIncrement, { + capture: true, + }); + }); + }, + }; + }; + } + + return momentPlugin; + +}))); diff --git a/admin/js/vendors/flatpickr/plugins/monthSelect/index.d.ts b/admin/js/vendors/flatpickr/plugins/monthSelect/index.d.ts new file mode 100644 index 0000000..78d5c52 --- /dev/null +++ b/admin/js/vendors/flatpickr/plugins/monthSelect/index.d.ts @@ -0,0 +1,16 @@ +import { Plugin } from "../../types/options"; +export interface Config { + shorthand: boolean; + dateFormat: string; + altFormat: string; + theme: string; +} +export interface ElementDate extends Element { + dateObj: Date; +} +export declare type MonthElement = HTMLSpanElement & { + dateObj: Date; + $i: number; +}; +declare function monthSelectPlugin(pluginConfig?: Partial): Plugin; +export default monthSelectPlugin; diff --git a/admin/js/vendors/flatpickr/plugins/monthSelect/index.js b/admin/js/vendors/flatpickr/plugins/monthSelect/index.js new file mode 100644 index 0000000..87f7629 --- /dev/null +++ b/admin/js/vendors/flatpickr/plugins/monthSelect/index.js @@ -0,0 +1,233 @@ +(function (global, factory) { + typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : + typeof define === 'function' && define.amd ? define(factory) : + (global = global || self, global.monthSelectPlugin = factory()); +}(this, (function () { 'use strict'; + + /*! ***************************************************************************** + Copyright (c) Microsoft Corporation. + + Permission to use, copy, modify, and/or distribute this software for any + purpose with or without fee is hereby granted. + + THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH + REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY + AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, + INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM + LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR + OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + PERFORMANCE OF THIS SOFTWARE. + ***************************************************************************** */ + + var __assign = function() { + __assign = Object.assign || function __assign(t) { + for (var s, i = 1, n = arguments.length; i < n; i++) { + s = arguments[i]; + for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; + } + return t; + }; + return __assign.apply(this, arguments); + }; + + var monthToStr = function (monthNumber, shorthand, locale) { return locale.months[shorthand ? "shorthand" : "longhand"][monthNumber]; }; + + function getEventTarget(event) { + try { + if (typeof event.composedPath === "function") { + var path = event.composedPath(); + return path[0]; + } + return event.target; + } + catch (error) { + return event.target; + } + } + + var defaultConfig = { + shorthand: false, + dateFormat: "F Y", + altFormat: "F Y", + theme: "light", + }; + function monthSelectPlugin(pluginConfig) { + var config = __assign(__assign({}, defaultConfig), pluginConfig); + return function (fp) { + fp.config.dateFormat = config.dateFormat; + fp.config.altFormat = config.altFormat; + var self = { monthsContainer: null }; + function clearUnnecessaryDOMElements() { + if (!fp.rContainer || !fp.daysContainer || !fp.weekdayContainer) + return; + fp.rContainer.removeChild(fp.daysContainer); + fp.rContainer.removeChild(fp.weekdayContainer); + for (var index = 0; index < fp.monthElements.length; index++) { + var element = fp.monthElements[index]; + if (!element.parentNode) + continue; + element.parentNode.removeChild(element); + } + } + function addListeners() { + fp._bind(fp.prevMonthNav, "click", function (e) { + var _a; + e.preventDefault(); + e.stopPropagation(); + var selectedMonth = (_a = fp.rContainer) === null || _a === void 0 ? void 0 : _a.querySelector(".flatpickr-monthSelect-month.selected").dateObj.getMonth(); + if (selectedMonth === 0) { + fp.currentYear--; + } + selectYear(); + }); + fp._bind(fp.nextMonthNav, "click", function (e) { + var _a; + e.preventDefault(); + e.stopPropagation(); + var selectedMonth = (_a = fp.rContainer) === null || _a === void 0 ? void 0 : _a.querySelector(".flatpickr-monthSelect-month.selected").dateObj.getMonth(); + if (selectedMonth === 11) { + fp.currentYear++; + } + selectYear(); + }); + } + function addMonths() { + if (!fp.rContainer) + return; + self.monthsContainer = fp._createElement("div", "flatpickr-monthSelect-months"); + self.monthsContainer.tabIndex = -1; + fp.calendarContainer.classList.add("flatpickr-monthSelect-theme-" + config.theme); + for (var i = 0; i < 12; i++) { + var month = fp._createElement("span", "flatpickr-monthSelect-month"); + month.dateObj = new Date(fp.currentYear, i); + month.$i = i; + month.textContent = monthToStr(i, config.shorthand, fp.l10n); + month.tabIndex = -1; + month.addEventListener("click", selectMonth); + self.monthsContainer.appendChild(month); + if ((fp.config.minDate && month.dateObj < fp.config.minDate) || + (fp.config.maxDate && month.dateObj > fp.config.maxDate)) { + month.classList.add("disabled"); + } + } + fp.rContainer.appendChild(self.monthsContainer); + } + function setCurrentlySelected() { + if (!fp.rContainer) + return; + var currentlySelected = fp.rContainer.querySelectorAll(".flatpickr-monthSelect-month.selected"); + for (var index = 0; index < currentlySelected.length; index++) { + currentlySelected[index].classList.remove("selected"); + } + var month = fp.rContainer.querySelector(".flatpickr-monthSelect-month:nth-child(" + (fp.currentMonth + 1) + ")"); + if (month) { + month.classList.add("selected"); + } + } + function selectYear() { + var selectedDate = fp.selectedDates[0]; + if (selectedDate) { + selectedDate = new Date(selectedDate); + selectedDate.setFullYear(fp.currentYear); + if (fp.config.minDate && selectedDate < fp.config.minDate) { + selectedDate = fp.config.minDate; + } + if (fp.config.maxDate && selectedDate > fp.config.maxDate) { + selectedDate = fp.config.maxDate; + } + fp.currentYear = selectedDate.getFullYear(); + fp.currentYearElement.value = String(fp.currentYear); + fp.currentMonth = selectedDate.getMonth(); + } + if (fp.rContainer) { + var months = fp.rContainer.querySelectorAll(".flatpickr-monthSelect-month"); + months.forEach(function (month) { + month.dateObj.setFullYear(fp.currentYear); + if ((fp.config.minDate && month.dateObj < fp.config.minDate) || + (fp.config.maxDate && month.dateObj > fp.config.maxDate)) { + month.classList.add("disabled"); + } + else { + month.classList.remove("disabled"); + } + }); + } + setCurrentlySelected(); + } + function selectMonth(e) { + e.preventDefault(); + e.stopPropagation(); + var eventTarget = getEventTarget(e); + if (eventTarget instanceof Element && + !eventTarget.classList.contains("disabled")) { + setMonth(eventTarget.dateObj); + fp.close(); + } + } + function setMonth(date) { + var selectedDate = new Date(date); + selectedDate.setFullYear(fp.currentYear); + fp.currentMonth = selectedDate.getMonth(); + fp.setDate(selectedDate, true); + setCurrentlySelected(); + } + var shifts = { + 37: -1, + 39: 1, + 40: 3, + 38: -3, + }; + function onKeyDown(_, __, ___, e) { + var shouldMove = shifts[e.keyCode] !== undefined; + if (!shouldMove && e.keyCode !== 13) { + return; + } + if (!fp.rContainer || !self.monthsContainer) + return; + var currentlySelected = fp.rContainer.querySelector(".flatpickr-monthSelect-month.selected"); + var index = Array.prototype.indexOf.call(self.monthsContainer.children, document.activeElement); + if (index === -1) { + var target = currentlySelected || self.monthsContainer.firstElementChild; + target.focus(); + index = target.$i; + } + if (shouldMove) { + self.monthsContainer.children[(12 + index + shifts[e.keyCode]) % 12].focus(); + } + else if (e.keyCode === 13 && + self.monthsContainer.contains(document.activeElement)) { + setMonth(document.activeElement.dateObj); + } + } + function destroyPluginInstance() { + if (self.monthsContainer !== null) { + var months = self.monthsContainer.querySelectorAll(".flatpickr-monthSelect-month"); + for (var index = 0; index < months.length; index++) { + months[index].removeEventListener("click", selectMonth); + } + } + } + return { + onParseConfig: function () { + fp.config.mode = "single"; + fp.config.enableTime = false; + }, + onValueUpdate: setCurrentlySelected, + onKeyDown: onKeyDown, + onReady: [ + clearUnnecessaryDOMElements, + addListeners, + addMonths, + setCurrentlySelected, + function () { + fp.loadedPlugins.push("monthSelect"); + }, + ], + onDestroy: destroyPluginInstance, + }; + }; + } + + return monthSelectPlugin; + +}))); diff --git a/admin/js/vendors/flatpickr/plugins/monthSelect/style.css b/admin/js/vendors/flatpickr/plugins/monthSelect/style.css new file mode 100644 index 0000000..f49a9ec --- /dev/null +++ b/admin/js/vendors/flatpickr/plugins/monthSelect/style.css @@ -0,0 +1,79 @@ +.flatpickr-monthSelect-months { + margin: 10px 1px 3px 1px; + flex-wrap: wrap; +} + +.flatpickr-monthSelect-month { + background: none; + border: 0; + border-radius: 2px; + -webkit-box-sizing: border-box; + box-sizing: border-box; + color: #393939; + cursor: pointer; + display: inline-block; + font-weight: 400; + margin: 0.5px; + justify-content: center; + padding: 10px; + position: relative; + -webkit-box-pack: center; + -webkit-justify-content: center; + -ms-flex-pack: center; + text-align: center; + width: 33%; +} + +.flatpickr-monthSelect-month.disabled { + color: #eee; +} + +.flatpickr-monthSelect-month.disabled:hover, +.flatpickr-monthSelect-month.disabled:focus { + cursor: not-allowed; + background: none !important; +} + +.flatpickr-monthSelect-theme-dark { + background: #3f4458; +} + +.flatpickr-monthSelect-theme-dark .flatpickr-current-month input.cur-year { + color: #fff; +} + +.flatpickr-monthSelect-theme-dark .flatpickr-months .flatpickr-prev-month, +.flatpickr-monthSelect-theme-dark .flatpickr-months .flatpickr-next-month { + color: #fff; + fill: #fff; +} + +.flatpickr-monthSelect-theme-dark .flatpickr-monthSelect-month { + color: rgba(255, 255, 255, 0.95); +} + +.flatpickr-monthSelect-month:hover, +.flatpickr-monthSelect-month:focus { + background: #e6e6e6; + cursor: pointer; + outline: 0; +} + +.flatpickr-monthSelect-theme-dark .flatpickr-monthSelect-month:hover, +.flatpickr-monthSelect-theme-dark .flatpickr-monthSelect-month:focus { + background: #646c8c; + border-color: #646c8c; +} + +.flatpickr-monthSelect-month.selected { + background-color: #569ff7; + color: #fff; +} + +.flatpickr-monthSelect-theme-dark .flatpickr-monthSelect-month.selected { + background: #80cbc4; + -webkit-box-shadow: none; + box-shadow: none; + color: #fff; + border-color: #80cbc4; +} diff --git a/admin/js/vendors/flatpickr/plugins/monthSelect/tests.spec.d.ts b/admin/js/vendors/flatpickr/plugins/monthSelect/tests.spec.d.ts new file mode 100644 index 0000000..cb0ff5c --- /dev/null +++ b/admin/js/vendors/flatpickr/plugins/monthSelect/tests.spec.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/admin/js/vendors/flatpickr/plugins/rangePlugin.d.ts b/admin/js/vendors/flatpickr/plugins/rangePlugin.d.ts new file mode 100644 index 0000000..960a834 --- /dev/null +++ b/admin/js/vendors/flatpickr/plugins/rangePlugin.d.ts @@ -0,0 +1,12 @@ +import { Plugin } from "../types/options"; +export interface Config { + input?: string | HTMLInputElement; + position?: "left"; +} +declare global { + interface Window { + rangePlugin: (config?: Config) => void; + } +} +declare function rangePlugin(config?: Config): Plugin; +export default rangePlugin; diff --git a/admin/js/vendors/flatpickr/plugins/rangePlugin.js b/admin/js/vendors/flatpickr/plugins/rangePlugin.js new file mode 100644 index 0000000..8413ca8 --- /dev/null +++ b/admin/js/vendors/flatpickr/plugins/rangePlugin.js @@ -0,0 +1,169 @@ +(function (global, factory) { + typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : + typeof define === 'function' && define.amd ? define(factory) : + (global = global || self, global.rangePlugin = factory()); +}(this, (function () { 'use strict'; + + /*! ***************************************************************************** + Copyright (c) Microsoft Corporation. + + Permission to use, copy, modify, and/or distribute this software for any + purpose with or without fee is hereby granted. + + THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH + REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY + AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, + INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM + LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR + OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + PERFORMANCE OF THIS SOFTWARE. + ***************************************************************************** */ + + function __spreadArrays() { + for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length; + for (var r = Array(s), k = 0, i = 0; i < il; i++) + for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) + r[k] = a[j]; + return r; + } + + function rangePlugin(config) { + if (config === void 0) { config = {}; } + return function (fp) { + var dateFormat = "", secondInput, _secondInputFocused, _prevDates; + var createSecondInput = function () { + if (config.input) { + secondInput = + config.input instanceof Element + ? config.input + : window.document.querySelector(config.input); + if (!secondInput) { + fp.config.errorHandler(new Error("Invalid input element specified")); + return; + } + if (fp.config.wrap) { + secondInput = secondInput.querySelector("[data-input]"); + } + } + else { + secondInput = fp._input.cloneNode(); + secondInput.removeAttribute("id"); + secondInput._flatpickr = undefined; + } + if (secondInput.value) { + var parsedDate = fp.parseDate(secondInput.value); + if (parsedDate) + fp.selectedDates.push(parsedDate); + } + secondInput.setAttribute("data-fp-omit", ""); + fp._bind(secondInput, ["focus", "click"], function () { + if (fp.selectedDates[1]) { + fp.latestSelectedDateObj = fp.selectedDates[1]; + fp._setHoursFromDate(fp.selectedDates[1]); + fp.jumpToDate(fp.selectedDates[1]); + } + _secondInputFocused = true; + fp.isOpen = false; + fp.open(undefined, config.position === "left" ? fp._input : secondInput); + }); + fp._bind(fp._input, ["focus", "click"], function (e) { + e.preventDefault(); + fp.isOpen = false; + fp.open(); + }); + if (fp.config.allowInput) + fp._bind(secondInput, "keydown", function (e) { + if (e.key === "Enter") { + fp.setDate([fp.selectedDates[0], secondInput.value], true, dateFormat); + secondInput.click(); + } + }); + if (!config.input) + fp._input.parentNode && + fp._input.parentNode.insertBefore(secondInput, fp._input.nextSibling); + }; + var plugin = { + onParseConfig: function () { + fp.config.mode = "range"; + dateFormat = fp.config.altInput + ? fp.config.altFormat + : fp.config.dateFormat; + }, + onReady: function () { + createSecondInput(); + fp.config.ignoredFocusElements.push(secondInput); + if (fp.config.allowInput) { + fp._input.removeAttribute("readonly"); + secondInput.removeAttribute("readonly"); + } + else { + secondInput.setAttribute("readonly", "readonly"); + } + fp._bind(fp._input, "focus", function () { + fp.latestSelectedDateObj = fp.selectedDates[0]; + fp._setHoursFromDate(fp.selectedDates[0]); + _secondInputFocused = false; + fp.jumpToDate(fp.selectedDates[0]); + }); + if (fp.config.allowInput) + fp._bind(fp._input, "keydown", function (e) { + if (e.key === "Enter") + fp.setDate([fp._input.value, fp.selectedDates[1]], true, dateFormat); + }); + fp.setDate(fp.selectedDates, false); + plugin.onValueUpdate(fp.selectedDates); + fp.loadedPlugins.push("range"); + }, + onPreCalendarPosition: function () { + if (_secondInputFocused) { + fp._positionElement = secondInput; + setTimeout(function () { + fp._positionElement = fp._input; + }, 0); + } + }, + onChange: function () { + if (!fp.selectedDates.length) { + setTimeout(function () { + if (fp.selectedDates.length) + return; + secondInput.value = ""; + _prevDates = []; + }, 10); + } + if (_secondInputFocused) { + setTimeout(function () { + secondInput.focus(); + }, 0); + } + }, + onDestroy: function () { + if (!config.input) + secondInput.parentNode && + secondInput.parentNode.removeChild(secondInput); + }, + onValueUpdate: function (selDates) { + var _a, _b, _c; + if (!secondInput) + return; + _prevDates = + !_prevDates || selDates.length >= _prevDates.length + ? __spreadArrays(selDates) : _prevDates; + if (_prevDates.length > selDates.length) { + var newSelectedDate = selDates[0]; + var newDates = _secondInputFocused + ? [_prevDates[0], newSelectedDate] + : [newSelectedDate, _prevDates[1]]; + fp.setDate(newDates, false); + _prevDates = __spreadArrays(newDates); + } + _a = fp.selectedDates.map(function (d) { return fp.formatDate(d, dateFormat); }), _b = _a[0], fp._input.value = _b === void 0 ? "" : _b, _c = _a[1], secondInput.value = _c === void 0 ? "" : _c; + }, + }; + return plugin; + }; + } + + return rangePlugin; + +}))); diff --git a/admin/js/vendors/flatpickr/plugins/scrollPlugin.d.ts b/admin/js/vendors/flatpickr/plugins/scrollPlugin.d.ts new file mode 100644 index 0000000..a367428 --- /dev/null +++ b/admin/js/vendors/flatpickr/plugins/scrollPlugin.d.ts @@ -0,0 +1,3 @@ +import { Plugin } from "../types/options"; +declare function scrollPlugin(): Plugin; +export default scrollPlugin; diff --git a/admin/js/vendors/flatpickr/plugins/scrollPlugin.js b/admin/js/vendors/flatpickr/plugins/scrollPlugin.js new file mode 100644 index 0000000..0e50f95 --- /dev/null +++ b/admin/js/vendors/flatpickr/plugins/scrollPlugin.js @@ -0,0 +1,85 @@ +(function (global, factory) { + typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : + typeof define === 'function' && define.amd ? define(factory) : + (global = global || self, global.scrollPlugin = factory()); +}(this, (function () { 'use strict'; + + function getEventTarget(event) { + try { + if (typeof event.composedPath === "function") { + var path = event.composedPath(); + return path[0]; + } + return event.target; + } + catch (error) { + return event.target; + } + } + + if (typeof window.CustomEvent !== "function") { + function CustomEvent(typeArg, eventInitDict) { + eventInitDict = eventInitDict || { + bubbles: false, + cancelable: false, + detail: undefined, + }; + var evt = document.createEvent("CustomEvent"); + evt.initCustomEvent(typeArg, eventInitDict.bubbles, eventInitDict.cancelable, eventInitDict.detail); + return evt; + } + CustomEvent.prototype = window.Event.prototype; + window.CustomEvent = CustomEvent; + } + function delta(e) { + return Math.max(-1, Math.min(1, e.wheelDelta || -e.deltaY)); + } + var scroll = function (e) { + e.preventDefault(); + var ev = new CustomEvent("increment", { + bubbles: true, + }); + ev.delta = delta(e); + getEventTarget(e).dispatchEvent(ev); + }; + function scrollMonth(fp) { + return function (e) { + e.preventDefault(); + var mDelta = delta(e); + fp.changeMonth(mDelta); + }; + } + function scrollPlugin() { + return function (fp) { + var monthScroller = scrollMonth(fp); + return { + onReady: function () { + if (fp.timeContainer) { + fp.timeContainer.addEventListener("wheel", scroll); + } + fp.yearElements.forEach(function (yearElem) { + return yearElem.addEventListener("wheel", scroll); + }); + fp.monthElements.forEach(function (monthElem) { + return monthElem.addEventListener("wheel", monthScroller); + }); + fp.loadedPlugins.push("scroll"); + }, + onDestroy: function () { + if (fp.timeContainer) { + fp.timeContainer.removeEventListener("wheel", scroll); + } + fp.yearElements.forEach(function (yearElem) { + return yearElem.removeEventListener("wheel", scroll); + }); + fp.monthElements.forEach(function (monthElem) { + return monthElem.removeEventListener("wheel", monthScroller); + }); + }, + }; + }; + } + + return scrollPlugin; + +}))); diff --git a/admin/js/vendors/flatpickr/plugins/weekSelect/weekSelect.d.ts b/admin/js/vendors/flatpickr/plugins/weekSelect/weekSelect.d.ts new file mode 100644 index 0000000..88cc964 --- /dev/null +++ b/admin/js/vendors/flatpickr/plugins/weekSelect/weekSelect.d.ts @@ -0,0 +1,7 @@ +import { Plugin } from "../../types/options"; +export declare type PlusWeeks = { + weekStartDay: Date; + weekEndDay: Date; +}; +declare function weekSelectPlugin(): Plugin; +export default weekSelectPlugin; diff --git a/admin/js/vendors/flatpickr/plugins/weekSelect/weekSelect.js b/admin/js/vendors/flatpickr/plugins/weekSelect/weekSelect.js new file mode 100644 index 0000000..d72fd8a --- /dev/null +++ b/admin/js/vendors/flatpickr/plugins/weekSelect/weekSelect.js @@ -0,0 +1,99 @@ +(function (global, factory) { + typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : + typeof define === 'function' && define.amd ? define(factory) : + (global = global || self, global.weekSelect = factory()); +}(this, (function () { 'use strict'; + + function getEventTarget(event) { + try { + if (typeof event.composedPath === "function") { + var path = event.composedPath(); + return path[0]; + } + return event.target; + } + catch (error) { + return event.target; + } + } + + function weekSelectPlugin() { + return function (fp) { + function onDayHover(event) { + var day = getEventTarget(event); + if (!day.classList.contains("flatpickr-day")) + return; + var days = fp.days.childNodes; + var dayIndex = day.$i; + var dayIndSeven = dayIndex / 7; + var weekStartDay = days[7 * Math.floor(dayIndSeven)] + .dateObj; + var weekEndDay = days[7 * Math.ceil(dayIndSeven + 0.01) - 1].dateObj; + for (var i = days.length; i--;) { + var day_1 = days[i]; + var date = day_1.dateObj; + if (date > weekEndDay || date < weekStartDay) + day_1.classList.remove("inRange"); + else + day_1.classList.add("inRange"); + } + } + function highlightWeek() { + var selDate = fp.latestSelectedDateObj; + if (selDate !== undefined && + selDate.getMonth() === fp.currentMonth && + selDate.getFullYear() === fp.currentYear) { + fp.weekStartDay = fp.days.childNodes[7 * Math.floor(fp.selectedDateElem.$i / 7)].dateObj; + fp.weekEndDay = fp.days.childNodes[7 * Math.ceil(fp.selectedDateElem.$i / 7 + 0.01) - 1].dateObj; + } + var days = fp.days.childNodes; + for (var i = days.length; i--;) { + var date = days[i].dateObj; + if (date >= fp.weekStartDay && date <= fp.weekEndDay) + days[i].classList.add("week", "selected"); + } + } + function clearHover() { + var days = fp.days.childNodes; + for (var i = days.length; i--;) + days[i].classList.remove("inRange"); + } + function onReady() { + if (fp.daysContainer !== undefined) + fp.daysContainer.addEventListener("mouseover", onDayHover); + } + function onDestroy() { + if (fp.daysContainer !== undefined) + fp.daysContainer.removeEventListener("mouseover", onDayHover); + } + return { + onValueUpdate: highlightWeek, + onMonthChange: highlightWeek, + onYearChange: highlightWeek, + onOpen: highlightWeek, + onClose: clearHover, + onParseConfig: function () { + fp.config.mode = "single"; + fp.config.enableTime = false; + fp.config.dateFormat = fp.config.dateFormat + ? fp.config.dateFormat + : "\\W\\e\\e\\k #W, Y"; + fp.config.altFormat = fp.config.altFormat + ? fp.config.altFormat + : "\\W\\e\\e\\k #W, Y"; + }, + onReady: [ + onReady, + highlightWeek, + function () { + fp.loadedPlugins.push("weekSelect"); + }, + ], + onDestroy: onDestroy, + }; + }; + } + + return weekSelectPlugin; + +}))); diff --git a/admin/js/vendors/flatpickr/themes/airbnb.css b/admin/js/vendors/flatpickr/themes/airbnb.css new file mode 100644 index 0000000..ad55e5a --- /dev/null +++ b/admin/js/vendors/flatpickr/themes/airbnb.css @@ -0,0 +1,880 @@ +.flatpickr-calendar { + background: transparent; + opacity: 0; + display: none; + text-align: center; + visibility: hidden; + padding: 0; + -webkit-animation: none; + animation: none; + direction: ltr; + border: 0; + font-size: 14px; + line-height: 24px; + border-radius: 5px; + position: absolute; + width: 307.875px; + -webkit-box-sizing: border-box; + box-sizing: border-box; + -ms-touch-action: manipulation; + touch-action: manipulation; + background: #fff; + -webkit-box-shadow: 1px 0 0 #eee, -1px 0 0 #eee, 0 1px 0 #eee, 0 -1px 0 #eee, 0 3px 13px rgba(0,0,0,0.08); + box-shadow: 1px 0 0 #eee, -1px 0 0 #eee, 0 1px 0 #eee, 0 -1px 0 #eee, 0 3px 13px rgba(0,0,0,0.08); +} +.flatpickr-calendar.open, +.flatpickr-calendar.inline { + opacity: 1; + max-height: 640px; + visibility: visible; +} +.flatpickr-calendar.open { + display: inline-block; + z-index: 99999; +} +.flatpickr-calendar.animate.open { + -webkit-animation: fpFadeInDown 300ms cubic-bezier(0.23, 1, 0.32, 1); + animation: fpFadeInDown 300ms cubic-bezier(0.23, 1, 0.32, 1); +} +.flatpickr-calendar.inline { + display: block; + position: relative; + top: 2px; +} +.flatpickr-calendar.static { + position: absolute; + top: calc(100% + 2px); +} +.flatpickr-calendar.static.open { + z-index: 999; + display: block; +} +.flatpickr-calendar.multiMonth .flatpickr-days .dayContainer:nth-child(n+1) .flatpickr-day.inRange:nth-child(7n+7) { + -webkit-box-shadow: none !important; + box-shadow: none !important; +} +.flatpickr-calendar.multiMonth .flatpickr-days .dayContainer:nth-child(n+2) .flatpickr-day.inRange:nth-child(7n+1) { + -webkit-box-shadow: -2px 0 0 #e6e6e6, 5px 0 0 #e6e6e6; + box-shadow: -2px 0 0 #e6e6e6, 5px 0 0 #e6e6e6; +} +.flatpickr-calendar .hasWeeks .dayContainer, +.flatpickr-calendar .hasTime .dayContainer { + border-bottom: 0; + border-bottom-right-radius: 0; + border-bottom-left-radius: 0; +} +.flatpickr-calendar .hasWeeks .dayContainer { + border-left: 0; +} +.flatpickr-calendar.hasTime .flatpickr-time { + height: 40px; + border-top: 1px solid #eee; +} +.flatpickr-calendar.noCalendar.hasTime .flatpickr-time { + height: auto; +} +.flatpickr-calendar:before, +.flatpickr-calendar:after { + position: absolute; + display: block; + pointer-events: none; + border: solid transparent; + content: ''; + height: 0; + width: 0; + left: 22px; +} +.flatpickr-calendar.rightMost:before, +.flatpickr-calendar.arrowRight:before, +.flatpickr-calendar.rightMost:after, +.flatpickr-calendar.arrowRight:after { + left: auto; + right: 22px; +} +.flatpickr-calendar.arrowCenter:before, +.flatpickr-calendar.arrowCenter:after { + left: 50%; + right: 50%; +} +.flatpickr-calendar:before { + border-width: 5px; + margin: 0 -5px; +} +.flatpickr-calendar:after { + border-width: 4px; + margin: 0 -4px; +} +.flatpickr-calendar.arrowTop:before, +.flatpickr-calendar.arrowTop:after { + bottom: 100%; +} +.flatpickr-calendar.arrowTop:before { + border-bottom-color: #eee; +} +.flatpickr-calendar.arrowTop:after { + border-bottom-color: #fff; +} +.flatpickr-calendar.arrowBottom:before, +.flatpickr-calendar.arrowBottom:after { + top: 100%; +} +.flatpickr-calendar.arrowBottom:before { + border-top-color: #eee; +} +.flatpickr-calendar.arrowBottom:after { + border-top-color: #fff; +} +.flatpickr-calendar:focus { + outline: 0; +} +.flatpickr-wrapper { + position: relative; + display: inline-block; +} +.flatpickr-months { + display: -webkit-box; + display: -webkit-flex; + display: -ms-flexbox; + display: flex; +} +.flatpickr-months .flatpickr-month { + background: transparent; + color: #3c3f40; + fill: #3c3f40; + height: 34px; + line-height: 1; + text-align: center; + position: relative; + -webkit-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; + overflow: hidden; + -webkit-box-flex: 1; + -webkit-flex: 1; + -ms-flex: 1; + flex: 1; +} +.flatpickr-months .flatpickr-prev-month, +.flatpickr-months .flatpickr-next-month { + text-decoration: none; + cursor: pointer; + position: absolute; + top: 0; + height: 34px; + padding: 10px; + z-index: 3; + color: #3c3f40; + fill: #3c3f40; +} +.flatpickr-months .flatpickr-prev-month.flatpickr-disabled, +.flatpickr-months .flatpickr-next-month.flatpickr-disabled { + display: none; +} +.flatpickr-months .flatpickr-prev-month i, +.flatpickr-months .flatpickr-next-month i { + position: relative; +} +.flatpickr-months .flatpickr-prev-month.flatpickr-prev-month, +.flatpickr-months .flatpickr-next-month.flatpickr-prev-month { +/* + /*rtl:begin:ignore*/ +/* + */ + left: 0; +/* + /*rtl:end:ignore*/ +/* + */ +} +/* + /*rtl:begin:ignore*/ +/* + /*rtl:end:ignore*/ +.flatpickr-months .flatpickr-prev-month.flatpickr-next-month, +.flatpickr-months .flatpickr-next-month.flatpickr-next-month { +/* + /*rtl:begin:ignore*/ +/* + */ + right: 0; +/* + /*rtl:end:ignore*/ +/* + */ +} +/* + /*rtl:begin:ignore*/ +/* + /*rtl:end:ignore*/ +.flatpickr-months .flatpickr-prev-month:hover, +.flatpickr-months .flatpickr-next-month:hover { + color: #3a6fc3; +} +.flatpickr-months .flatpickr-prev-month:hover svg, +.flatpickr-months .flatpickr-next-month:hover svg { + fill: #3a6fc3;; +} +.flatpickr-months .flatpickr-prev-month svg, +.flatpickr-months .flatpickr-next-month svg { + width: 14px; + height: 14px; +} +.flatpickr-months .flatpickr-prev-month svg path, +.flatpickr-months .flatpickr-next-month svg path { + -webkit-transition: fill 0.1s; + transition: fill 0.1s; + fill: inherit; +} +.numInputWrapper { + position: relative; + height: auto; +} +.numInputWrapper input, +.numInputWrapper span { + display: inline-block; +} +.numInputWrapper input { + width: 100%; +} +.numInputWrapper input::-ms-clear { + display: none; +} +.numInputWrapper input::-webkit-outer-spin-button, +.numInputWrapper input::-webkit-inner-spin-button { + margin: 0; + -webkit-appearance: none; +} +.numInputWrapper span { + position: absolute; + right: 0; + width: 14px; + padding: 0 4px 0 2px; + height: 50%; + line-height: 50%; + opacity: 0; + cursor: pointer; + border: 1px solid rgba(64,72,72,0.15); + -webkit-box-sizing: border-box; + box-sizing: border-box; +} +.numInputWrapper span:hover { + background: rgba(0,0,0,0.1); +} +.numInputWrapper span:active { + background: rgba(0,0,0,0.2); +} +.numInputWrapper span:after { + display: block; + content: ""; + position: absolute; +} +.numInputWrapper span.arrowUp { + top: 0; + border-bottom: 0; +} +.numInputWrapper span.arrowUp:after { + border-left: 4px solid transparent; + border-right: 4px solid transparent; + border-bottom: 4px solid rgba(64,72,72,0.6); + top: 26%; +} +.numInputWrapper span.arrowDown { + top: 50%; +} +.numInputWrapper span.arrowDown:after { + border-left: 4px solid transparent; + border-right: 4px solid transparent; + border-top: 4px solid rgba(64,72,72,0.6); + top: 40%; +} +.numInputWrapper span svg { + width: inherit; + height: auto; +} +.numInputWrapper span svg path { + fill: rgba(60,63,64,0.5); +} +.numInputWrapper:hover { + background: rgba(0,0,0,0.05); +} +.numInputWrapper:hover span { + opacity: 1; +} +.flatpickr-current-month { + font-size: 135%; + line-height: inherit; + font-weight: 300; + color: inherit; + position: absolute; + width: 75%; + left: 12.5%; + padding: 7.48px 0 0 0; + line-height: 1; + height: 34px; + display: inline-block; + text-align: center; + -webkit-transform: translate3d(0px, 0px, 0px); + transform: translate3d(0px, 0px, 0px); +} +.flatpickr-current-month span.cur-month { + font-family: inherit; + font-weight: 700; + color: inherit; + display: inline-block; + margin-left: 0.5ch; + padding: 0; +} +.flatpickr-current-month span.cur-month:hover { + background: rgba(0,0,0,0.05); +} +.flatpickr-current-month .numInputWrapper { + top: -27px; + width: 6ch; + left: 53px; + display: inline-block; +} +.flatpickr-current-month .numInputWrapper span.arrowUp:after { + border-bottom-color: #3c3f40; +} +.flatpickr-current-month .numInputWrapper span.arrowDown:after { + border-top-color: #3c3f40; +} +.flatpickr-current-month input.cur-year { + background: transparent; + -webkit-box-sizing: border-box; + box-sizing: border-box; + color: inherit; + cursor: text; + padding: 0 0 0 0.5ch; + margin: 0; + display: inline-block; + font-size: inherit; + font-family: inherit; + font-weight: 300; + line-height: inherit; + height: 27px; + border: 1px solid #ccc; + border-radius: 0; + vertical-align: initial; + -webkit-appearance: textfield; + -moz-appearance: textfield; + appearance: textfield; +} +.flatpickr-current-month input.cur-year:focus { + outline: 0; +} +.flatpickr-current-month input.cur-year[disabled], +.flatpickr-current-month input.cur-year[disabled]:hover { + font-size: 100%; + color: rgba(60,63,64,0.5); + background: transparent; + pointer-events: none; +} +.flatpickr-current-month .flatpickr-monthDropdown-months { + appearance: menulist; + background: transparent; + border: 1px solid #ccc; + border-radius: 0; + box-sizing: border-box; + color: inherit; + cursor: pointer; + font-size: inherit; + font-family: inherit; + font-weight: 300; + height: auto; + line-height: inherit; + margin: -1px 0 0 0; + outline: none; + padding: 0 0 0 0.5ch; + position: relative; + vertical-align: initial; + -webkit-box-sizing: border-box; + -webkit-appearance: menulist; + -moz-appearance: menulist; + width: auto; +} +.flatpickr-current-month .flatpickr-monthDropdown-months:focus, +.flatpickr-current-month .flatpickr-monthDropdown-months:active { + outline: none; +} +.flatpickr-current-month .flatpickr-monthDropdown-months:hover { + background: rgba(0,0,0,0.05); +} +.flatpickr-current-month .flatpickr-monthDropdown-months .flatpickr-monthDropdown-month { + background-color: transparent; + outline: none; + padding: 0; +} +.flatpickr-weekdays { + background: transparent; + text-align: center; + overflow: hidden; + width: 100%; + display: -webkit-box; + display: -webkit-flex; + display: -ms-flexbox; + display: flex; + -webkit-box-align: center; + -webkit-align-items: center; + -ms-flex-align: center; + align-items: center; + height: 28px; +} +.flatpickr-weekdays .flatpickr-weekdaycontainer { + display: -webkit-box; + display: -webkit-flex; + display: -ms-flexbox; + display: flex; + -webkit-box-flex: 1; + -webkit-flex: 1; + -ms-flex: 1; + flex: 1; +} +span.flatpickr-weekday { + cursor: default; + font-size: 90%; + background: transparent; + color: rgba(0,0,0,0.54); + line-height: 1; + margin: 0; + text-align: center; + display: block; + -webkit-box-flex: 1; + -webkit-flex: 1; + -ms-flex: 1; + flex: 1; + font-weight: bolder; +} +.dayContainer, +.flatpickr-weeks { + padding: 1px 0 0 0; +} +.flatpickr-days { + position: relative; + overflow: hidden; + display: -webkit-box; + display: -webkit-flex; + display: -ms-flexbox; + display: flex; + -webkit-box-align: start; + -webkit-align-items: flex-start; + -ms-flex-align: start; + align-items: flex-start; + width: 307.875px; +} +.flatpickr-days:focus { + outline: 0; +} +.dayContainer { + padding: 0; + outline: 0; + text-align: left; + width: 307.875px; + min-width: 307.875px; + max-width: 307.875px; + -webkit-box-sizing: border-box; + box-sizing: border-box; + display: inline-block; + display: -ms-flexbox; + display: -webkit-box; + display: -webkit-flex; + display: flex; + -webkit-flex-wrap: wrap; + flex-wrap: wrap; + -ms-flex-wrap: wrap; + -ms-flex-pack: justify; + -webkit-justify-content: space-around; + justify-content: space-around; + -webkit-transform: translate3d(0px, 0px, 0px); + transform: translate3d(0px, 0px, 0px); + opacity: 1; +} +.dayContainer + .dayContainer { + -webkit-box-shadow: -1px 0 0 #eee; + box-shadow: -1px 0 0 #eee; +} +.flatpickr-day { + background: none; + border: 1px solid transparent; + border-radius: 150px; + -webkit-box-sizing: border-box; + box-sizing: border-box; + color: #404848; + cursor: pointer; + font-weight: 400; + width: 14.2857143%; + -webkit-flex-basis: 14.2857143%; + -ms-flex-preferred-size: 14.2857143%; + flex-basis: 14.2857143%; + max-width: 39px; + height: 39px; + line-height: 39px; + margin: 0; + display: inline-block; + position: relative; + -webkit-box-pack: center; + -webkit-justify-content: center; + -ms-flex-pack: center; + justify-content: center; + text-align: center; +} +.flatpickr-day.inRange, +.flatpickr-day.prevMonthDay.inRange, +.flatpickr-day.nextMonthDay.inRange, +.flatpickr-day.today.inRange, +.flatpickr-day.prevMonthDay.today.inRange, +.flatpickr-day.nextMonthDay.today.inRange, +.flatpickr-day:hover, +.flatpickr-day.prevMonthDay:hover, +.flatpickr-day.nextMonthDay:hover, +.flatpickr-day:focus, +.flatpickr-day.prevMonthDay:focus, +.flatpickr-day.nextMonthDay:focus { + cursor: pointer; + outline: 0; + background: #e9e9e9; + border-color: #e9e9e9; +} +.flatpickr-day.today { + border-color: #f64747; +} +.flatpickr-day.today:hover, +.flatpickr-day.today:focus { + border-color: #f64747; + background: #f64747; + color: #fff; +} +.flatpickr-day.selected, +.flatpickr-day.startRange, +.flatpickr-day.endRange, +.flatpickr-day.selected.inRange, +.flatpickr-day.startRange.inRange, +.flatpickr-day.endRange.inRange, +.flatpickr-day.selected:focus, +.flatpickr-day.startRange:focus, +.flatpickr-day.endRange:focus, +.flatpickr-day.selected:hover, +.flatpickr-day.startRange:hover, +.flatpickr-day.endRange:hover, +.flatpickr-day.selected.prevMonthDay, +.flatpickr-day.startRange.prevMonthDay, +.flatpickr-day.endRange.prevMonthDay, +.flatpickr-day.selected.nextMonthDay, +.flatpickr-day.startRange.nextMonthDay, +.flatpickr-day.endRange.nextMonthDay { + background: #4f99ff; + -webkit-box-shadow: none; + box-shadow: none; + color: #fff; + border-color: #4f99ff; +} +.flatpickr-day.selected.startRange, +.flatpickr-day.startRange.startRange, +.flatpickr-day.endRange.startRange { + border-radius: 50px 0 0 50px; +} +.flatpickr-day.selected.endRange, +.flatpickr-day.startRange.endRange, +.flatpickr-day.endRange.endRange { + border-radius: 0 50px 50px 0; +} +.flatpickr-day.selected.startRange + .endRange:not(:nth-child(7n+1)), +.flatpickr-day.startRange.startRange + .endRange:not(:nth-child(7n+1)), +.flatpickr-day.endRange.startRange + .endRange:not(:nth-child(7n+1)) { + -webkit-box-shadow: -10px 0 0 #4f99ff; + box-shadow: -10px 0 0 #4f99ff; +} +.flatpickr-day.selected.startRange.endRange, +.flatpickr-day.startRange.startRange.endRange, +.flatpickr-day.endRange.startRange.endRange { + border-radius: 50px; +} +.flatpickr-day.inRange { + border-radius: 0; + -webkit-box-shadow: -5px 0 0 #e9e9e9, 5px 0 0 #e9e9e9; + box-shadow: -5px 0 0 #e9e9e9, 5px 0 0 #e9e9e9; +} +.flatpickr-day.flatpickr-disabled, +.flatpickr-day.flatpickr-disabled:hover, +.flatpickr-day.prevMonthDay, +.flatpickr-day.nextMonthDay, +.flatpickr-day.notAllowed, +.flatpickr-day.notAllowed.prevMonthDay, +.flatpickr-day.notAllowed.nextMonthDay { + color: rgba(64,72,72,0.3); + background: transparent; + border-color: #e9e9e9; + cursor: default; +} +.flatpickr-day.flatpickr-disabled, +.flatpickr-day.flatpickr-disabled:hover { + cursor: not-allowed; + color: rgba(64,72,72,0.1); +} +.flatpickr-day.week.selected { + border-radius: 0; + -webkit-box-shadow: -5px 0 0 #4f99ff, 5px 0 0 #4f99ff; + box-shadow: -5px 0 0 #4f99ff, 5px 0 0 #4f99ff; +} +.flatpickr-day.hidden { + visibility: hidden; +} +.rangeMode .flatpickr-day { + margin-top: 1px; +} +.flatpickr-weekwrapper { + float: left; +} +.flatpickr-weekwrapper .flatpickr-weeks { + padding: 0 12px; + -webkit-box-shadow: 1px 0 0 #eee; + box-shadow: 1px 0 0 #eee; +} +.flatpickr-weekwrapper .flatpickr-weekday { + float: none; + width: 100%; + line-height: 28px; +} +.flatpickr-weekwrapper span.flatpickr-day, +.flatpickr-weekwrapper span.flatpickr-day:hover { + display: block; + width: 100%; + max-width: none; + color: rgba(64,72,72,0.3); + background: transparent; + cursor: default; + border: none; +} +.flatpickr-innerContainer { + display: block; + display: -webkit-box; + display: -webkit-flex; + display: -ms-flexbox; + display: flex; + -webkit-box-sizing: border-box; + box-sizing: border-box; + overflow: hidden; +} +.flatpickr-rContainer { + display: inline-block; + padding: 0; + -webkit-box-sizing: border-box; + box-sizing: border-box; +} +.flatpickr-time { + text-align: center; + outline: 0; + display: block; + height: 0; + line-height: 40px; + max-height: 40px; + -webkit-box-sizing: border-box; + box-sizing: border-box; + overflow: hidden; + display: -webkit-box; + display: -webkit-flex; + display: -ms-flexbox; + display: flex; +} +.flatpickr-time:after { + content: ""; + display: table; + clear: both; +} +.flatpickr-time .numInputWrapper { + -webkit-box-flex: 1; + -webkit-flex: 1; + -ms-flex: 1; + flex: 1; + width: 40%; + height: 40px; + float: left; +} +.flatpickr-time .numInputWrapper span.arrowUp:after { + border-bottom-color: #404848; +} +.flatpickr-time .numInputWrapper span.arrowDown:after { + border-top-color: #404848; +} +.flatpickr-time.hasSeconds .numInputWrapper { + width: 26%; +} +.flatpickr-time.time24hr .numInputWrapper { + width: 49%; +} +.flatpickr-time input { + background: transparent; + -webkit-box-shadow: none; + box-shadow: none; + border: 0; + border-radius: 0; + text-align: center; + margin: 0; + padding: 0; + height: inherit; + line-height: inherit; + color: #404848; + font-size: 14px; + position: relative; + -webkit-box-sizing: border-box; + box-sizing: border-box; + -webkit-appearance: textfield; + -moz-appearance: textfield; + appearance: textfield; +} +.flatpickr-time input.flatpickr-hour { + font-weight: bold; +} +.flatpickr-time input.flatpickr-minute, +.flatpickr-time input.flatpickr-second { + font-weight: 400; +} +.flatpickr-time input:focus { + outline: 0; + border: 0; +} +.flatpickr-time .flatpickr-time-separator, +.flatpickr-time .flatpickr-am-pm { + height: inherit; + float: left; + line-height: inherit; + color: #404848; + font-weight: bold; + width: 2%; + -webkit-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; + -webkit-align-self: center; + -ms-flex-item-align: center; + align-self: center; +} +.flatpickr-time .flatpickr-am-pm { + outline: 0; + width: 18%; + cursor: pointer; + text-align: center; + font-weight: 400; +} +.flatpickr-time input:hover, +.flatpickr-time .flatpickr-am-pm:hover, +.flatpickr-time input:focus, +.flatpickr-time .flatpickr-am-pm:focus { + background: #f1f1f1; +} +.flatpickr-input[readonly] { + cursor: pointer; +} +@-webkit-keyframes fpFadeInDown { + from { + opacity: 0; + -webkit-transform: translate3d(0, -20px, 0); + transform: translate3d(0, -20px, 0); + } + to { + opacity: 1; + -webkit-transform: translate3d(0, 0, 0); + transform: translate3d(0, 0, 0); + } +} +@keyframes fpFadeInDown { + from { + opacity: 0; + -webkit-transform: translate3d(0, -20px, 0); + transform: translate3d(0, -20px, 0); + } + to { + opacity: 1; + -webkit-transform: translate3d(0, 0, 0); + transform: translate3d(0, 0, 0); + } +} +.flatpickr-calendar { + width: 310px; +} +.dayContainer { + padding: 0; + border-right: 0; +} +span.flatpickr-day, +span.flatpickr-day.prevMonthDay, +span.flatpickr-day.nextMonthDay { + border-radius: 0 !important; + border: 1px solid #e9e9e9; + max-width: none; + border-right-color: transparent; +} +span.flatpickr-day:nth-child(n+8), +span.flatpickr-day.prevMonthDay:nth-child(n+8), +span.flatpickr-day.nextMonthDay:nth-child(n+8) { + border-top-color: transparent; +} +span.flatpickr-day:nth-child(7n-6), +span.flatpickr-day.prevMonthDay:nth-child(7n-6), +span.flatpickr-day.nextMonthDay:nth-child(7n-6) { + border-left: 0; +} +span.flatpickr-day:nth-child(n+36), +span.flatpickr-day.prevMonthDay:nth-child(n+36), +span.flatpickr-day.nextMonthDay:nth-child(n+36) { + border-bottom: 0; +} +span.flatpickr-day:nth-child(-n+7), +span.flatpickr-day.prevMonthDay:nth-child(-n+7), +span.flatpickr-day.nextMonthDay:nth-child(-n+7) { + margin-top: 0; +} +span.flatpickr-day.today:not(.selected), +span.flatpickr-day.prevMonthDay.today:not(.selected), +span.flatpickr-day.nextMonthDay.today:not(.selected) { + border-color: #e9e9e9; + border-right-color: transparent; + border-top-color: transparent; + border-bottom-color: #f64747; +} +span.flatpickr-day.today:not(.selected):hover, +span.flatpickr-day.prevMonthDay.today:not(.selected):hover, +span.flatpickr-day.nextMonthDay.today:not(.selected):hover { + border: 1px solid #f64747; +} +span.flatpickr-day.startRange, +span.flatpickr-day.prevMonthDay.startRange, +span.flatpickr-day.nextMonthDay.startRange, +span.flatpickr-day.endRange, +span.flatpickr-day.prevMonthDay.endRange, +span.flatpickr-day.nextMonthDay.endRange { + border-color: #4f99ff; +} +span.flatpickr-day.today, +span.flatpickr-day.prevMonthDay.today, +span.flatpickr-day.nextMonthDay.today, +span.flatpickr-day.selected, +span.flatpickr-day.prevMonthDay.selected, +span.flatpickr-day.nextMonthDay.selected { + z-index: 2; +} +.rangeMode .flatpickr-day { + margin-top: -1px; +} +.flatpickr-weekwrapper .flatpickr-weeks { + -webkit-box-shadow: none; + box-shadow: none; +} +.flatpickr-weekwrapper span.flatpickr-day { + border: 0; + margin: -1px 0 0 -1px; +} +.hasWeeks .flatpickr-days { + border-right: 0; +} + + @media screen and (min-width:0\0) and (min-resolution: +72dpi) { + span.flatpickr-day { + display: block; + -webkit-box-flex: 1; + -webkit-flex: 1 0 auto; + -ms-flex: 1 0 auto; + flex: 1 0 auto; + } + } diff --git a/admin/js/vendors/flatpickr/types/globals.d.ts b/admin/js/vendors/flatpickr/types/globals.d.ts new file mode 100644 index 0000000..a36e45b --- /dev/null +++ b/admin/js/vendors/flatpickr/types/globals.d.ts @@ -0,0 +1,20 @@ +import { Options } from "./options"; +import { Instance, FlatpickrFn } from "./instance"; +declare global { + interface HTMLElement { + flatpickr: (config?: Options) => Instance; + _flatpickr?: Instance; + } + interface NodeList { + flatpickr: (config?: Options) => Instance | Instance[]; + } + interface HTMLCollection { + flatpickr: (config?: Options) => Instance | Instance[]; + } + interface Window { + flatpickr: FlatpickrFn; + } + interface Date { + fp_incr: (n: number) => Date; + } +} diff --git a/admin/js/vendors/flatpickr/types/instance.d.ts b/admin/js/vendors/flatpickr/types/instance.d.ts new file mode 100644 index 0000000..e274274 --- /dev/null +++ b/admin/js/vendors/flatpickr/types/instance.d.ts @@ -0,0 +1,116 @@ +import { DateOption, Options, ParsedOptions } from "./options"; +import { Locale, CustomLocale, key as LocaleKey } from "./locale"; +import { RevFormat, Formats, TokenRegex } from "../utils/formatting"; +export interface Elements { + element: HTMLElement; + input: HTMLInputElement; + altInput?: HTMLInputElement; + _input: HTMLInputElement; + mobileInput?: HTMLInputElement; + mobileFormatStr?: string; + selectedDateElem?: DayElement; + todayDateElem?: DayElement; + _positionElement: HTMLElement; + weekdayContainer: HTMLDivElement; + calendarContainer: HTMLDivElement; + innerContainer?: HTMLDivElement; + rContainer?: HTMLDivElement; + daysContainer?: HTMLDivElement; + days: HTMLDivElement; + weekWrapper?: HTMLDivElement; + weekNumbers?: HTMLDivElement; + monthNav: HTMLDivElement; + monthsDropdownContainer: HTMLSelectElement; + yearElements: HTMLInputElement[]; + monthElements: HTMLSpanElement[]; + currentYearElement: HTMLInputElement; + currentMonthElement: HTMLSpanElement; + _hidePrevMonthArrow: boolean; + _hideNextMonthArrow: boolean; + prevMonthNav: HTMLElement; + nextMonthNav: HTMLElement; + timeContainer?: HTMLDivElement; + hourElement?: HTMLInputElement; + minuteElement?: HTMLInputElement; + secondElement?: HTMLInputElement; + amPM?: HTMLSpanElement; + pluginElements: Node[]; +} +export interface Formatting { + revFormat: RevFormat; + formats: Formats; + tokenRegex: TokenRegex; +} +export declare type Instance = Elements & Formatting & { + minRangeDate?: Date; + maxRangeDate?: Date; + now: Date; + latestSelectedDateObj?: Date; + _selectedDateObj?: Date; + selectedDates: Date[]; + _initialDate: Date; + config: ParsedOptions; + loadedPlugins: string[]; + l10n: Locale; + currentYear: number; + currentMonth: number; + isOpen: boolean; + isMobile: boolean; + minDateHasTime: boolean; + maxDateHasTime: boolean; + changeMonth: (value: number, isOffset?: boolean, fromKeyboard?: boolean) => void; + changeYear: (year: number) => void; + clear: (emitChangeEvent?: boolean, toInitial?: boolean) => void; + close: () => void; + destroy: () => void; + isEnabled: (date: DateOption, timeless?: boolean) => boolean; + jumpToDate: (date?: DateOption, triggerChange?: boolean) => void; + open: (e?: FocusEvent | MouseEvent, positionElement?: HTMLElement) => void; + redraw: () => void; + set: (option: keyof Options | { + [k in keyof Options]?: Options[k]; + }, value?: any) => void; + setDate: (date: DateOption | DateOption[], triggerChange?: boolean, format?: string) => void; + toggle: () => void; + pad: (num: string | number) => string; + parseDate: (date: Date | string | number, givenFormat?: string, timeless?: boolean) => Date | undefined; + formatDate: (dateObj: Date, frmt: string) => string; + _handlers: { + event: string; + element: Element; + handler: (e?: Event) => void; + options?: { + capture?: boolean; + }; + }[]; + _bind: (element: E | E[], event: string | string[], handler: (e?: any) => void) => void; + _createElement: (tag: keyof HTMLElementTagNameMap, className: string, content?: string) => E; + _setHoursFromDate: (date: Date) => void; + _debouncedChange: () => void; + __hideNextMonthArrow: boolean; + __hidePrevMonthArrow: boolean; + _positionCalendar: (customPositionElement?: HTMLElement) => void; + utils: { + getDaysInMonth: (month?: number, year?: number) => number; + }; +}; +export interface FlatpickrFn { + (selector: Node, config?: Options): Instance; + (selector: ArrayLike, config?: Options): Instance[]; + (selector: string, config?: Options): Instance | Instance[]; + defaultConfig: Partial; + l10ns: { + [k in LocaleKey]?: CustomLocale; + } & { + default: Locale; + }; + localize: (l10n: CustomLocale) => void; + setDefaults: (config: Options) => void; + parseDate: (date: DateOption, format?: string, timeless?: boolean) => Date | undefined; + formatDate: (date: Date, format: string) => string; + compareDates: (date1: Date, date2: Date, timeless?: boolean) => number; +} +export declare type DayElement = HTMLSpanElement & { + dateObj: Date; + $i: number; +}; diff --git a/admin/js/vendors/flatpickr/types/locale.d.ts b/admin/js/vendors/flatpickr/types/locale.d.ts new file mode 100644 index 0000000..86ad582 --- /dev/null +++ b/admin/js/vendors/flatpickr/types/locale.d.ts @@ -0,0 +1,46 @@ +export declare type Locale = { + weekdays: { + shorthand: [string, string, string, string, string, string, string]; + longhand: [string, string, string, string, string, string, string]; + }; + months: { + shorthand: [string, string, string, string, string, string, string, string, string, string, string, string]; + longhand: [string, string, string, string, string, string, string, string, string, string, string, string]; + }; + daysInMonth: [number, number, number, number, number, number, number, number, number, number, number, number]; + firstDayOfWeek: number; + ordinal: (nth: number) => string; + rangeSeparator: string; + weekAbbreviation: string; + scrollTitle: string; + toggleTitle: string; + amPM: [string, string]; + yearAriaLabel: string; + monthAriaLabel: string; + hourAriaLabel: string; + minuteAriaLabel: string; + time_24hr: boolean; +}; +export declare type CustomLocale = { + ordinal?: Locale["ordinal"]; + daysInMonth?: Locale["daysInMonth"]; + firstDayOfWeek?: Locale["firstDayOfWeek"]; + rangeSeparator?: Locale["rangeSeparator"]; + weekAbbreviation?: Locale["weekAbbreviation"]; + toggleTitle?: Locale["toggleTitle"]; + scrollTitle?: Locale["scrollTitle"]; + yearAriaLabel?: string; + hourAriaLabel?: string; + minuteAriaLabel?: string; + amPM?: Locale["amPM"]; + time_24hr?: Locale["time_24hr"]; + weekdays: { + shorthand: [string, string, string, string, string, string, string]; + longhand: [string, string, string, string, string, string, string]; + }; + months: { + shorthand: [string, string, string, string, string, string, string, string, string, string, string, string]; + longhand: [string, string, string, string, string, string, string, string, string, string, string, string]; + }; +}; +export declare type key = "ar" | "at" | "az" | "be" | "bg" | "bn" | "bs" | "ca" | "cat" | "cs" | "cy" | "da" | "de" | "default" | "en" | "eo" | "es" | "et" | "fa" | "fi" | "fo" | "fr" | "gr" | "he" | "hi" | "hr" | "hu" | "id" | "is" | "it" | "ja" | "ka" | "ko" | "km" | "kz" | "lt" | "lv" | "mk" | "mn" | "ms" | "my" | "nl" | "no" | "pa" | "pl" | "pt" | "ro" | "ru" | "si" | "sk" | "sl" | "sq" | "sr" | "sv" | "th" | "tr" | "uk" | "vn" | "zh" | "uz" | "uz_latn" | "zh_tw"; diff --git a/admin/js/vendors/flatpickr/types/options.d.ts b/admin/js/vendors/flatpickr/types/options.d.ts new file mode 100644 index 0000000..f62d10e --- /dev/null +++ b/admin/js/vendors/flatpickr/types/options.d.ts @@ -0,0 +1,148 @@ +import { Instance } from "./instance"; +import { CustomLocale, key as LocaleKey, Locale } from "./locale"; +export declare type DateOption = Date | string | number; +export declare type DateRangeLimit = { + from: D; + to: D; +}; +export declare type DateLimit = D | DateRangeLimit | ((date: Date) => boolean); +export declare type Hook = (dates: Date[], currentDateString: string, self: Instance, data?: any) => void; +export declare type HookKey = "onChange" | "onClose" | "onDayCreate" | "onDestroy" | "onKeyDown" | "onMonthChange" | "onOpen" | "onParseConfig" | "onReady" | "onValueUpdate" | "onYearChange" | "onPreCalendarPosition"; +export declare const HOOKS: HookKey[]; +export declare type Plugin = (fp: Instance & E) => Options; +export interface BaseOptions { + allowInput: boolean; + allowInvalidPreload: boolean; + altFormat: string; + altInput: boolean; + altInputClass: string; + animate: boolean; + appendTo: HTMLElement; + ariaDateFormat: string; + autoFillDefaultTime: boolean; + clickOpens: boolean; + closeOnSelect: boolean; + conjunction: string; + dateFormat: string; + defaultDate: DateOption | DateOption[]; + defaultHour: number; + defaultMinute: number; + defaultSeconds: number; + disable: DateLimit[]; + disableMobile: boolean; + enable: DateLimit[]; + enableSeconds: boolean; + enableTime: boolean; + errorHandler: (e: Error) => void; + formatDate: (date: Date, format: string, locale: Locale) => string; + getWeek: (date: Date) => string | number; + hourIncrement: number; + ignoredFocusElements: HTMLElement[]; + inline: boolean; + locale: LocaleKey | CustomLocale; + maxDate: DateOption; + maxTime: DateOption; + minDate: DateOption; + minTime: DateOption; + minuteIncrement: number; + mode: "single" | "multiple" | "range" | "time"; + monthSelectorType: "dropdown" | "static"; + nextArrow: string; + noCalendar: boolean; + now?: DateOption; + onChange: Hook | Hook[]; + onClose: Hook | Hook[]; + onDayCreate: Hook | Hook[]; + onDestroy: Hook | Hook[]; + onKeyDown: Hook | Hook[]; + onMonthChange: Hook | Hook[]; + onOpen: Hook | Hook[]; + onParseConfig: Hook | Hook[]; + onReady: Hook | Hook[]; + onValueUpdate: Hook | Hook[]; + onYearChange: Hook | Hook[]; + onPreCalendarPosition: Hook | Hook[]; + parseDate: (date: string, format: string) => Date; + plugins: Plugin[]; + position: "auto" | "above" | "below"; + positionElement: Element; + prevArrow: string; + shorthandCurrentMonth: boolean; + static: boolean; + showMonths?: number; + time_24hr: boolean; + weekNumbers: boolean; + wrap: boolean; +} +export declare type Options = Partial; +export interface ParsedOptions { + _disable: DateLimit[]; + _enable: DateLimit[]; + _maxDate?: Date; + _maxTime?: Date; + _minDate?: Date; + _minTime?: Date; + allowInput: boolean; + allowInvalidPreload: boolean; + altFormat: string; + altInput: boolean; + altInputClass: string; + animate: boolean; + appendTo?: HTMLElement; + ariaDateFormat: string; + autoFillDefaultTime: boolean; + clickOpens: boolean; + closeOnSelect: boolean; + conjunction: string; + dateFormat: string; + defaultDate?: Date | Date[]; + defaultHour: number; + defaultMinute: number; + defaultSeconds: number; + disable: DateLimit[]; + disableMobile: boolean; + enable: DateLimit[]; + enableSeconds: boolean; + enableTime: boolean; + errorHandler: (err: Error) => void; + formatDate?: Options["formatDate"]; + getWeek: (date: Date) => string | number; + hourIncrement: number; + ignoredFocusElements: HTMLElement[]; + inline: boolean; + locale: LocaleKey | CustomLocale; + maxDate?: Date; + maxTime?: Date; + minDate?: Date; + minTime?: Date; + minuteIncrement: number; + mode: BaseOptions["mode"]; + monthSelectorType: string; + nextArrow: string; + noCalendar: boolean; + now: Date; + onChange: Hook[]; + onClose: Hook[]; + onDayCreate: Hook[]; + onDestroy: Hook[]; + onKeyDown: Hook[]; + onMonthChange: Hook[]; + onOpen: Hook[]; + onParseConfig: Hook[]; + onReady: Hook[]; + onValueUpdate: Hook[]; + onYearChange: Hook[]; + onPreCalendarPosition: Hook[]; + parseDate?: BaseOptions["parseDate"]; + plugins: Plugin[]; + position: BaseOptions["position"]; + positionElement?: HTMLElement; + prevArrow: string; + shorthandCurrentMonth: boolean; + showMonths: number; + static: boolean; + time_24hr: boolean; + weekNumbers: boolean; + wrap: boolean; +} +export declare const defaults: ParsedOptions; diff --git a/admin/js/vendors/flatpickr/typings.d.ts b/admin/js/vendors/flatpickr/typings.d.ts new file mode 100644 index 0000000..2c9c27d --- /dev/null +++ b/admin/js/vendors/flatpickr/typings.d.ts @@ -0,0 +1,40 @@ +import { FlatpickrFn } from "./types/instance"; +import { Instance as _Instance } from "./types/instance"; +import { + Options as _Options, + Hook as _Hook, + HookKey as _HookKey, + ParsedOptions as _ParsedOptions, + DateLimit as _DateLimit, + DateOption as _DateOption, + DateRangeLimit as _DateRangeLimit, + Plugin as _Plugin, +} from "./types/options"; + +import { + Locale as _Locale, + CustomLocale as _CustomLocale, + key as _LocaleKey, +} from "./types/locale"; + +declare var flatpickr: FlatpickrFn; + +declare namespace flatpickr { + export type Instance = _Instance; + export type CustomLocale = _CustomLocale; + export type Locale = _Locale; + + export namespace Options { + export type Options = _Options; + export type Hook = _Hook; + export type HookKey = _HookKey; + export type ParsedOptions = _ParsedOptions; + export type DateLimit = _DateLimit; + export type DateOption = _DateOption; + export type DateRangeLimit = _DateRangeLimit; + export type Plugin = _Plugin; + export type LocaleKey = _LocaleKey; + } +} + +export default flatpickr; diff --git a/admin/js/vendors/flatpickr/utils/dates.d.ts b/admin/js/vendors/flatpickr/utils/dates.d.ts new file mode 100644 index 0000000..fc30798 --- /dev/null +++ b/admin/js/vendors/flatpickr/utils/dates.d.ts @@ -0,0 +1,18 @@ +import { Locale } from "../types/locale"; +import { ParsedOptions } from "../types/options"; +export interface FormatterArgs { + config?: ParsedOptions; + l10n?: Locale; + isMobile?: boolean; +} +export declare const createDateFormatter: ({ config, l10n, isMobile, }: FormatterArgs) => (dateObj: Date, frmt: string, overrideLocale?: Locale | undefined) => string; +export declare const createDateParser: ({ config, l10n }: { + config?: ParsedOptions | undefined; + l10n?: Locale | undefined; +}) => (date: Date | string | number, givenFormat?: string | undefined, timeless?: boolean | undefined, customLocale?: Locale | undefined) => Date | undefined; +export declare function compareDates(date1: Date, date2: Date, timeless?: boolean): number; +export declare function compareTimes(date1: Date, date2: Date): number; +export declare const isBetween: (ts: number, ts1: number, ts2: number) => boolean; +export declare const duration: { + DAY: number; +}; diff --git a/admin/js/vendors/flatpickr/utils/dom.d.ts b/admin/js/vendors/flatpickr/utils/dom.d.ts new file mode 100644 index 0000000..b15f309 --- /dev/null +++ b/admin/js/vendors/flatpickr/utils/dom.d.ts @@ -0,0 +1,6 @@ +export declare function toggleClass(elem: HTMLElement, className: string, bool: boolean): void; +export declare function createElement(tag: keyof HTMLElementTagNameMap, className: string, content?: string): T; +export declare function clearNode(node: HTMLElement): void; +export declare function findParent(node: Element, condition: (n: Element) => boolean): Element | undefined; +export declare function createNumberInput(inputClassName: string, opts?: Record): HTMLDivElement; +export declare function getEventTarget(event: Event): EventTarget | null; diff --git a/admin/js/vendors/flatpickr/utils/formatting.d.ts b/admin/js/vendors/flatpickr/utils/formatting.d.ts new file mode 100644 index 0000000..b430324 --- /dev/null +++ b/admin/js/vendors/flatpickr/utils/formatting.d.ts @@ -0,0 +1,13 @@ +import { Locale } from "../types/locale"; +import { ParsedOptions } from "../types/options"; +export declare type token = "D" | "F" | "G" | "H" | "J" | "K" | "M" | "S" | "U" | "W" | "Y" | "Z" | "d" | "h" | "i" | "j" | "l" | "m" | "n" | "s" | "u" | "w" | "y"; +export declare const monthToStr: (monthNumber: number, shorthand: boolean, locale: Locale) => string; +export declare type RevFormatFn = (date: Date, data: string, locale: Locale) => Date | void | undefined; +export declare type RevFormat = Record; +export declare const revFormat: RevFormat; +export declare type TokenRegex = { + [k in token]: string; +}; +export declare const tokenRegex: TokenRegex; +export declare type Formats = Record string | number>; +export declare const formats: Formats; diff --git a/admin/js/vendors/flatpickr/utils/index.d.ts b/admin/js/vendors/flatpickr/utils/index.d.ts new file mode 100644 index 0000000..113069e --- /dev/null +++ b/admin/js/vendors/flatpickr/utils/index.d.ts @@ -0,0 +1,8 @@ +export declare const pad: (number: string | number, length?: number) => string; +export declare const int: (bool: boolean) => 1 | 0; +export declare function debounce(func: F, wait: number, immediate?: boolean): (this: Function) => void; +export declare const arrayify: (obj: T | T[]) => T[]; +export declare type IncrementEvent = MouseEvent & { + delta: number; + type: "increment"; +}; diff --git a/admin/js/vendors/flatpickr/utils/polyfills.d.ts b/admin/js/vendors/flatpickr/utils/polyfills.d.ts new file mode 100644 index 0000000..e69de29 diff --git a/admin/js/vendors/moment/locales.js b/admin/js/vendors/moment/locales.js new file mode 100644 index 0000000..caabe6a --- /dev/null +++ b/admin/js/vendors/moment/locales.js @@ -0,0 +1,12105 @@ +;(function (global, factory) { + typeof exports === 'object' && typeof module !== 'undefined' + && typeof require === 'function' ? factory(require('../moment')) : + typeof define === 'function' && define.amd ? define(['../moment'], factory) : + factory(global.moment) +}(this, (function (moment) { 'use strict'; + + //! moment.js locale configuration + + moment.defineLocale('af', { + months: 'Januarie_Februarie_Maart_April_Mei_Junie_Julie_Augustus_September_Oktober_November_Desember'.split( + '_' + ), + monthsShort: 'Jan_Feb_Mrt_Apr_Mei_Jun_Jul_Aug_Sep_Okt_Nov_Des'.split('_'), + weekdays: 'Sondag_Maandag_Dinsdag_Woensdag_Donderdag_Vrydag_Saterdag'.split( + '_' + ), + weekdaysShort: 'Son_Maa_Din_Woe_Don_Vry_Sat'.split('_'), + weekdaysMin: 'So_Ma_Di_Wo_Do_Vr_Sa'.split('_'), + meridiemParse: /vm|nm/i, + isPM: function (input) { + return /^nm$/i.test(input); + }, + meridiem: function (hours, minutes, isLower) { + if (hours < 12) { + return isLower ? 'vm' : 'VM'; + } else { + return isLower ? 'nm' : 'NM'; + } + }, + longDateFormat: { + LT: 'HH:mm', + LTS: 'HH:mm:ss', + L: 'DD/MM/YYYY', + LL: 'D MMMM YYYY', + LLL: 'D MMMM YYYY HH:mm', + LLLL: 'dddd, D MMMM YYYY HH:mm', + }, + calendar: { + sameDay: '[Vandag om] LT', + nextDay: '[Môre om] LT', + nextWeek: 'dddd [om] LT', + lastDay: '[Gister om] LT', + lastWeek: '[Laas] dddd [om] LT', + sameElse: 'L', + }, + relativeTime: { + future: 'oor %s', + past: '%s gelede', + s: "'n paar sekondes", + ss: '%d sekondes', + m: "'n minuut", + mm: '%d minute', + h: "'n uur", + hh: '%d ure', + d: "'n dag", + dd: '%d dae', + M: "'n maand", + MM: '%d maande', + y: "'n jaar", + yy: '%d jaar', + }, + dayOfMonthOrdinalParse: /\d{1,2}(ste|de)/, + ordinal: function (number) { + return ( + number + + (number === 1 || number === 8 || number >= 20 ? 'ste' : 'de') + ); // Thanks to Joris Röling : https://github.com/jjupiter + }, + week: { + dow: 1, // Maandag is die eerste dag van die week. + doy: 4, // Die week wat die 4de Januarie bevat is die eerste week van die jaar. + }, + }); + + //! moment.js locale configuration + + var pluralForm = function (n) { + return n === 0 + ? 0 + : n === 1 + ? 1 + : n === 2 + ? 2 + : n % 100 >= 3 && n % 100 <= 10 + ? 3 + : n % 100 >= 11 + ? 4 + : 5; + }, + plurals = { + s: [ + 'أقل من ثانية', + 'ثانية واحدة', + ['ثانيتان', 'ثانيتين'], + '%d ثوان', + '%d ثانية', + '%d ثانية', + ], + m: [ + 'أقل من دقيقة', + 'دقيقة واحدة', + ['دقيقتان', 'دقيقتين'], + '%d دقائق', + '%d دقيقة', + '%d دقيقة', + ], + h: [ + 'أقل من ساعة', + 'ساعة واحدة', + ['ساعتان', 'ساعتين'], + '%d ساعات', + '%d ساعة', + '%d ساعة', + ], + d: [ + 'أقل من يوم', + 'يوم واحد', + ['يومان', 'يومين'], + '%d أيام', + '%d يومًا', + '%d يوم', + ], + M: [ + 'أقل من شهر', + 'شهر واحد', + ['شهران', 'شهرين'], + '%d أشهر', + '%d شهرا', + '%d شهر', + ], + y: [ + 'أقل من عام', + 'عام واحد', + ['عامان', 'عامين'], + '%d أعوام', + '%d عامًا', + '%d عام', + ], + }, + pluralize = function (u) { + return function (number, withoutSuffix, string, isFuture) { + var f = pluralForm(number), + str = plurals[u][pluralForm(number)]; + if (f === 2) { + str = str[withoutSuffix ? 0 : 1]; + } + return str.replace(/%d/i, number); + }; + }, + months = [ + 'جانفي', + 'فيفري', + 'مارس', + 'أفريل', + 'ماي', + 'جوان', + 'جويلية', + 'أوت', + 'سبتمبر', + 'أكتوبر', + 'نوفمبر', + 'ديسمبر', + ]; + + moment.defineLocale('ar-dz', { + months: months, + monthsShort: months, + weekdays: 'الأحد_الإثنين_الثلاثاء_الأربعاء_الخميس_الجمعة_السبت'.split('_'), + weekdaysShort: 'أحد_إثنين_ثلاثاء_أربعاء_خميس_جمعة_سبت'.split('_'), + weekdaysMin: 'ح_ن_ث_ر_خ_ج_س'.split('_'), + weekdaysParseExact: true, + longDateFormat: { + LT: 'HH:mm', + LTS: 'HH:mm:ss', + L: 'D/\u200FM/\u200FYYYY', + LL: 'D MMMM YYYY', + LLL: 'D MMMM YYYY HH:mm', + LLLL: 'dddd D MMMM YYYY HH:mm', + }, + meridiemParse: /ص|م/, + isPM: function (input) { + return 'م' === input; + }, + meridiem: function (hour, minute, isLower) { + if (hour < 12) { + return 'ص'; + } else { + return 'م'; + } + }, + calendar: { + sameDay: '[اليوم عند الساعة] LT', + nextDay: '[غدًا عند الساعة] LT', + nextWeek: 'dddd [عند الساعة] LT', + lastDay: '[أمس عند الساعة] LT', + lastWeek: 'dddd [عند الساعة] LT', + sameElse: 'L', + }, + relativeTime: { + future: 'بعد %s', + past: 'منذ %s', + s: pluralize('s'), + ss: pluralize('s'), + m: pluralize('m'), + mm: pluralize('m'), + h: pluralize('h'), + hh: pluralize('h'), + d: pluralize('d'), + dd: pluralize('d'), + M: pluralize('M'), + MM: pluralize('M'), + y: pluralize('y'), + yy: pluralize('y'), + }, + postformat: function (string) { + return string.replace(/,/g, '،'); + }, + week: { + dow: 0, // Sunday is the first day of the week. + doy: 4, // The week that contains Jan 4th is the first week of the year. + }, + }); + + //! moment.js locale configuration + + moment.defineLocale('ar-kw', { + months: 'يناير_فبراير_مارس_أبريل_ماي_يونيو_يوليوز_غشت_شتنبر_أكتوبر_نونبر_دجنبر'.split( + '_' + ), + monthsShort: 'يناير_فبراير_مارس_أبريل_ماي_يونيو_يوليوز_غشت_شتنبر_أكتوبر_نونبر_دجنبر'.split( + '_' + ), + weekdays: 'الأحد_الإتنين_الثلاثاء_الأربعاء_الخميس_الجمعة_السبت'.split('_'), + weekdaysShort: 'احد_اتنين_ثلاثاء_اربعاء_خميس_جمعة_سبت'.split('_'), + weekdaysMin: 'ح_ن_ث_ر_خ_ج_س'.split('_'), + weekdaysParseExact: true, + longDateFormat: { + LT: 'HH:mm', + LTS: 'HH:mm:ss', + L: 'DD/MM/YYYY', + LL: 'D MMMM YYYY', + LLL: 'D MMMM YYYY HH:mm', + LLLL: 'dddd D MMMM YYYY HH:mm', + }, + calendar: { + sameDay: '[اليوم على الساعة] LT', + nextDay: '[غدا على الساعة] LT', + nextWeek: 'dddd [على الساعة] LT', + lastDay: '[أمس على الساعة] LT', + lastWeek: 'dddd [على الساعة] LT', + sameElse: 'L', + }, + relativeTime: { + future: 'في %s', + past: 'منذ %s', + s: 'ثوان', + ss: '%d ثانية', + m: 'دقيقة', + mm: '%d دقائق', + h: 'ساعة', + hh: '%d ساعات', + d: 'يوم', + dd: '%d أيام', + M: 'شهر', + MM: '%d أشهر', + y: 'سنة', + yy: '%d سنوات', + }, + week: { + dow: 0, // Sunday is the first day of the week. + doy: 12, // The week that contains Jan 12th is the first week of the year. + }, + }); + + //! moment.js locale configuration + + var symbolMap = { + '1': '1', + '2': '2', + '3': '3', + '4': '4', + '5': '5', + '6': '6', + '7': '7', + '8': '8', + '9': '9', + '0': '0', + }, + pluralForm$1 = function (n) { + return n === 0 + ? 0 + : n === 1 + ? 1 + : n === 2 + ? 2 + : n % 100 >= 3 && n % 100 <= 10 + ? 3 + : n % 100 >= 11 + ? 4 + : 5; + }, + plurals$1 = { + s: [ + 'أقل من ثانية', + 'ثانية واحدة', + ['ثانيتان', 'ثانيتين'], + '%d ثوان', + '%d ثانية', + '%d ثانية', + ], + m: [ + 'أقل من دقيقة', + 'دقيقة واحدة', + ['دقيقتان', 'دقيقتين'], + '%d دقائق', + '%d دقيقة', + '%d دقيقة', + ], + h: [ + 'أقل من ساعة', + 'ساعة واحدة', + ['ساعتان', 'ساعتين'], + '%d ساعات', + '%d ساعة', + '%d ساعة', + ], + d: [ + 'أقل من يوم', + 'يوم واحد', + ['يومان', 'يومين'], + '%d أيام', + '%d يومًا', + '%d يوم', + ], + M: [ + 'أقل من شهر', + 'شهر واحد', + ['شهران', 'شهرين'], + '%d أشهر', + '%d شهرا', + '%d شهر', + ], + y: [ + 'أقل من عام', + 'عام واحد', + ['عامان', 'عامين'], + '%d أعوام', + '%d عامًا', + '%d عام', + ], + }, + pluralize$1 = function (u) { + return function (number, withoutSuffix, string, isFuture) { + var f = pluralForm$1(number), + str = plurals$1[u][pluralForm$1(number)]; + if (f === 2) { + str = str[withoutSuffix ? 0 : 1]; + } + return str.replace(/%d/i, number); + }; + }, + months$1 = [ + 'يناير', + 'فبراير', + 'مارس', + 'أبريل', + 'مايو', + 'يونيو', + 'يوليو', + 'أغسطس', + 'سبتمبر', + 'أكتوبر', + 'نوفمبر', + 'ديسمبر', + ]; + + moment.defineLocale('ar-ly', { + months: months$1, + monthsShort: months$1, + weekdays: 'الأحد_الإثنين_الثلاثاء_الأربعاء_الخميس_الجمعة_السبت'.split('_'), + weekdaysShort: 'أحد_إثنين_ثلاثاء_أربعاء_خميس_جمعة_سبت'.split('_'), + weekdaysMin: 'ح_ن_ث_ر_خ_ج_س'.split('_'), + weekdaysParseExact: true, + longDateFormat: { + LT: 'HH:mm', + LTS: 'HH:mm:ss', + L: 'D/\u200FM/\u200FYYYY', + LL: 'D MMMM YYYY', + LLL: 'D MMMM YYYY HH:mm', + LLLL: 'dddd D MMMM YYYY HH:mm', + }, + meridiemParse: /ص|م/, + isPM: function (input) { + return 'م' === input; + }, + meridiem: function (hour, minute, isLower) { + if (hour < 12) { + return 'ص'; + } else { + return 'م'; + } + }, + calendar: { + sameDay: '[اليوم عند الساعة] LT', + nextDay: '[غدًا عند الساعة] LT', + nextWeek: 'dddd [عند الساعة] LT', + lastDay: '[أمس عند الساعة] LT', + lastWeek: 'dddd [عند الساعة] LT', + sameElse: 'L', + }, + relativeTime: { + future: 'بعد %s', + past: 'منذ %s', + s: pluralize$1('s'), + ss: pluralize$1('s'), + m: pluralize$1('m'), + mm: pluralize$1('m'), + h: pluralize$1('h'), + hh: pluralize$1('h'), + d: pluralize$1('d'), + dd: pluralize$1('d'), + M: pluralize$1('M'), + MM: pluralize$1('M'), + y: pluralize$1('y'), + yy: pluralize$1('y'), + }, + preparse: function (string) { + return string.replace(/،/g, ','); + }, + postformat: function (string) { + return string + .replace(/\d/g, function (match) { + return symbolMap[match]; + }) + .replace(/,/g, '،'); + }, + week: { + dow: 6, // Saturday is the first day of the week. + doy: 12, // The week that contains Jan 12th is the first week of the year. + }, + }); + + //! moment.js locale configuration + + moment.defineLocale('ar-ma', { + months: 'يناير_فبراير_مارس_أبريل_ماي_يونيو_يوليوز_غشت_شتنبر_أكتوبر_نونبر_دجنبر'.split( + '_' + ), + monthsShort: 'يناير_فبراير_مارس_أبريل_ماي_يونيو_يوليوز_غشت_شتنبر_أكتوبر_نونبر_دجنبر'.split( + '_' + ), + weekdays: 'الأحد_الإثنين_الثلاثاء_الأربعاء_الخميس_الجمعة_السبت'.split('_'), + weekdaysShort: 'احد_اثنين_ثلاثاء_اربعاء_خميس_جمعة_سبت'.split('_'), + weekdaysMin: 'ح_ن_ث_ر_خ_ج_س'.split('_'), + weekdaysParseExact: true, + longDateFormat: { + LT: 'HH:mm', + LTS: 'HH:mm:ss', + L: 'DD/MM/YYYY', + LL: 'D MMMM YYYY', + LLL: 'D MMMM YYYY HH:mm', + LLLL: 'dddd D MMMM YYYY HH:mm', + }, + calendar: { + sameDay: '[اليوم على الساعة] LT', + nextDay: '[غدا على الساعة] LT', + nextWeek: 'dddd [على الساعة] LT', + lastDay: '[أمس على الساعة] LT', + lastWeek: 'dddd [على الساعة] LT', + sameElse: 'L', + }, + relativeTime: { + future: 'في %s', + past: 'منذ %s', + s: 'ثوان', + ss: '%d ثانية', + m: 'دقيقة', + mm: '%d دقائق', + h: 'ساعة', + hh: '%d ساعات', + d: 'يوم', + dd: '%d أيام', + M: 'شهر', + MM: '%d أشهر', + y: 'سنة', + yy: '%d سنوات', + }, + week: { + dow: 6, // Saturday is the first day of the week. + doy: 12, // The week that contains Jan 12th is the first week of the year. + }, + }); + + //! moment.js locale configuration + + var symbolMap$1 = { + '1': '١', + '2': '٢', + '3': '٣', + '4': '٤', + '5': '٥', + '6': '٦', + '7': '٧', + '8': '٨', + '9': '٩', + '0': '٠', + }, + numberMap = { + '١': '1', + '٢': '2', + '٣': '3', + '٤': '4', + '٥': '5', + '٦': '6', + '٧': '7', + '٨': '8', + '٩': '9', + '٠': '0', + }; + + moment.defineLocale('ar-sa', { + months: 'يناير_فبراير_مارس_أبريل_مايو_يونيو_يوليو_أغسطس_سبتمبر_أكتوبر_نوفمبر_ديسمبر'.split( + '_' + ), + monthsShort: 'يناير_فبراير_مارس_أبريل_مايو_يونيو_يوليو_أغسطس_سبتمبر_أكتوبر_نوفمبر_ديسمبر'.split( + '_' + ), + weekdays: 'الأحد_الإثنين_الثلاثاء_الأربعاء_الخميس_الجمعة_السبت'.split('_'), + weekdaysShort: 'أحد_إثنين_ثلاثاء_أربعاء_خميس_جمعة_سبت'.split('_'), + weekdaysMin: 'ح_ن_ث_ر_خ_ج_س'.split('_'), + weekdaysParseExact: true, + longDateFormat: { + LT: 'HH:mm', + LTS: 'HH:mm:ss', + L: 'DD/MM/YYYY', + LL: 'D MMMM YYYY', + LLL: 'D MMMM YYYY HH:mm', + LLLL: 'dddd D MMMM YYYY HH:mm', + }, + meridiemParse: /ص|م/, + isPM: function (input) { + return 'م' === input; + }, + meridiem: function (hour, minute, isLower) { + if (hour < 12) { + return 'ص'; + } else { + return 'م'; + } + }, + calendar: { + sameDay: '[اليوم على الساعة] LT', + nextDay: '[غدا على الساعة] LT', + nextWeek: 'dddd [على الساعة] LT', + lastDay: '[أمس على الساعة] LT', + lastWeek: 'dddd [على الساعة] LT', + sameElse: 'L', + }, + relativeTime: { + future: 'في %s', + past: 'منذ %s', + s: 'ثوان', + ss: '%d ثانية', + m: 'دقيقة', + mm: '%d دقائق', + h: 'ساعة', + hh: '%d ساعات', + d: 'يوم', + dd: '%d أيام', + M: 'شهر', + MM: '%d أشهر', + y: 'سنة', + yy: '%d سنوات', + }, + preparse: function (string) { + return string + .replace(/[١٢٣٤٥٦٧٨٩٠]/g, function (match) { + return numberMap[match]; + }) + .replace(/،/g, ','); + }, + postformat: function (string) { + return string + .replace(/\d/g, function (match) { + return symbolMap$1[match]; + }) + .replace(/,/g, '،'); + }, + week: { + dow: 0, // Sunday is the first day of the week. + doy: 6, // The week that contains Jan 6th is the first week of the year. + }, + }); + + //! moment.js locale configuration + + moment.defineLocale('ar-tn', { + months: 'جانفي_فيفري_مارس_أفريل_ماي_جوان_جويلية_أوت_سبتمبر_أكتوبر_نوفمبر_ديسمبر'.split( + '_' + ), + monthsShort: 'جانفي_فيفري_مارس_أفريل_ماي_جوان_جويلية_أوت_سبتمبر_أكتوبر_نوفمبر_ديسمبر'.split( + '_' + ), + weekdays: 'الأحد_الإثنين_الثلاثاء_الأربعاء_الخميس_الجمعة_السبت'.split('_'), + weekdaysShort: 'أحد_إثنين_ثلاثاء_أربعاء_خميس_جمعة_سبت'.split('_'), + weekdaysMin: 'ح_ن_ث_ر_خ_ج_س'.split('_'), + weekdaysParseExact: true, + longDateFormat: { + LT: 'HH:mm', + LTS: 'HH:mm:ss', + L: 'DD/MM/YYYY', + LL: 'D MMMM YYYY', + LLL: 'D MMMM YYYY HH:mm', + LLLL: 'dddd D MMMM YYYY HH:mm', + }, + calendar: { + sameDay: '[اليوم على الساعة] LT', + nextDay: '[غدا على الساعة] LT', + nextWeek: 'dddd [على الساعة] LT', + lastDay: '[أمس على الساعة] LT', + lastWeek: 'dddd [على الساعة] LT', + sameElse: 'L', + }, + relativeTime: { + future: 'في %s', + past: 'منذ %s', + s: 'ثوان', + ss: '%d ثانية', + m: 'دقيقة', + mm: '%d دقائق', + h: 'ساعة', + hh: '%d ساعات', + d: 'يوم', + dd: '%d أيام', + M: 'شهر', + MM: '%d أشهر', + y: 'سنة', + yy: '%d سنوات', + }, + week: { + dow: 1, // Monday is the first day of the week. + doy: 4, // The week that contains Jan 4th is the first week of the year. + }, + }); + + //! moment.js locale configuration + + var symbolMap$2 = { + '1': '١', + '2': '٢', + '3': '٣', + '4': '٤', + '5': '٥', + '6': '٦', + '7': '٧', + '8': '٨', + '9': '٩', + '0': '٠', + }, + numberMap$1 = { + '١': '1', + '٢': '2', + '٣': '3', + '٤': '4', + '٥': '5', + '٦': '6', + '٧': '7', + '٨': '8', + '٩': '9', + '٠': '0', + }, + pluralForm$2 = function (n) { + return n === 0 + ? 0 + : n === 1 + ? 1 + : n === 2 + ? 2 + : n % 100 >= 3 && n % 100 <= 10 + ? 3 + : n % 100 >= 11 + ? 4 + : 5; + }, + plurals$2 = { + s: [ + 'أقل من ثانية', + 'ثانية واحدة', + ['ثانيتان', 'ثانيتين'], + '%d ثوان', + '%d ثانية', + '%d ثانية', + ], + m: [ + 'أقل من دقيقة', + 'دقيقة واحدة', + ['دقيقتان', 'دقيقتين'], + '%d دقائق', + '%d دقيقة', + '%d دقيقة', + ], + h: [ + 'أقل من ساعة', + 'ساعة واحدة', + ['ساعتان', 'ساعتين'], + '%d ساعات', + '%d ساعة', + '%d ساعة', + ], + d: [ + 'أقل من يوم', + 'يوم واحد', + ['يومان', 'يومين'], + '%d أيام', + '%d يومًا', + '%d يوم', + ], + M: [ + 'أقل من شهر', + 'شهر واحد', + ['شهران', 'شهرين'], + '%d أشهر', + '%d شهرا', + '%d شهر', + ], + y: [ + 'أقل من عام', + 'عام واحد', + ['عامان', 'عامين'], + '%d أعوام', + '%d عامًا', + '%d عام', + ], + }, + pluralize$2 = function (u) { + return function (number, withoutSuffix, string, isFuture) { + var f = pluralForm$2(number), + str = plurals$2[u][pluralForm$2(number)]; + if (f === 2) { + str = str[withoutSuffix ? 0 : 1]; + } + return str.replace(/%d/i, number); + }; + }, + months$2 = [ + 'يناير', + 'فبراير', + 'مارس', + 'أبريل', + 'مايو', + 'يونيو', + 'يوليو', + 'أغسطس', + 'سبتمبر', + 'أكتوبر', + 'نوفمبر', + 'ديسمبر', + ]; + + moment.defineLocale('ar', { + months: months$2, + monthsShort: months$2, + weekdays: 'الأحد_الإثنين_الثلاثاء_الأربعاء_الخميس_الجمعة_السبت'.split('_'), + weekdaysShort: 'أحد_إثنين_ثلاثاء_أربعاء_خميس_جمعة_سبت'.split('_'), + weekdaysMin: 'ح_ن_ث_ر_خ_ج_س'.split('_'), + weekdaysParseExact: true, + longDateFormat: { + LT: 'HH:mm', + LTS: 'HH:mm:ss', + L: 'D/\u200FM/\u200FYYYY', + LL: 'D MMMM YYYY', + LLL: 'D MMMM YYYY HH:mm', + LLLL: 'dddd D MMMM YYYY HH:mm', + }, + meridiemParse: /ص|م/, + isPM: function (input) { + return 'م' === input; + }, + meridiem: function (hour, minute, isLower) { + if (hour < 12) { + return 'ص'; + } else { + return 'م'; + } + }, + calendar: { + sameDay: '[اليوم عند الساعة] LT', + nextDay: '[غدًا عند الساعة] LT', + nextWeek: 'dddd [عند الساعة] LT', + lastDay: '[أمس عند الساعة] LT', + lastWeek: 'dddd [عند الساعة] LT', + sameElse: 'L', + }, + relativeTime: { + future: 'بعد %s', + past: 'منذ %s', + s: pluralize$2('s'), + ss: pluralize$2('s'), + m: pluralize$2('m'), + mm: pluralize$2('m'), + h: pluralize$2('h'), + hh: pluralize$2('h'), + d: pluralize$2('d'), + dd: pluralize$2('d'), + M: pluralize$2('M'), + MM: pluralize$2('M'), + y: pluralize$2('y'), + yy: pluralize$2('y'), + }, + preparse: function (string) { + return string + .replace(/[١٢٣٤٥٦٧٨٩٠]/g, function (match) { + return numberMap$1[match]; + }) + .replace(/،/g, ','); + }, + postformat: function (string) { + return string + .replace(/\d/g, function (match) { + return symbolMap$2[match]; + }) + .replace(/,/g, '،'); + }, + week: { + dow: 6, // Saturday is the first day of the week. + doy: 12, // The week that contains Jan 12th is the first week of the year. + }, + }); + + //! moment.js locale configuration + + var suffixes = { + 1: '-inci', + 5: '-inci', + 8: '-inci', + 70: '-inci', + 80: '-inci', + 2: '-nci', + 7: '-nci', + 20: '-nci', + 50: '-nci', + 3: '-üncü', + 4: '-üncü', + 100: '-üncü', + 6: '-ncı', + 9: '-uncu', + 10: '-uncu', + 30: '-uncu', + 60: '-ıncı', + 90: '-ıncı', + }; + + moment.defineLocale('az', { + months: 'yanvar_fevral_mart_aprel_may_iyun_iyul_avqust_sentyabr_oktyabr_noyabr_dekabr'.split( + '_' + ), + monthsShort: 'yan_fev_mar_apr_may_iyn_iyl_avq_sen_okt_noy_dek'.split('_'), + weekdays: 'Bazar_Bazar ertəsi_Çərşənbə axşamı_Çərşənbə_Cümə axşamı_Cümə_Şənbə'.split( + '_' + ), + weekdaysShort: 'Baz_BzE_ÇAx_Çər_CAx_Cüm_Şən'.split('_'), + weekdaysMin: 'Bz_BE_ÇA_Çə_CA_Cü_Şə'.split('_'), + weekdaysParseExact: true, + longDateFormat: { + LT: 'HH:mm', + LTS: 'HH:mm:ss', + L: 'DD.MM.YYYY', + LL: 'D MMMM YYYY', + LLL: 'D MMMM YYYY HH:mm', + LLLL: 'dddd, D MMMM YYYY HH:mm', + }, + calendar: { + sameDay: '[bugün saat] LT', + nextDay: '[sabah saat] LT', + nextWeek: '[gələn həftə] dddd [saat] LT', + lastDay: '[dünən] LT', + lastWeek: '[keçən həftə] dddd [saat] LT', + sameElse: 'L', + }, + relativeTime: { + future: '%s sonra', + past: '%s əvvəl', + s: 'bir neçə saniyə', + ss: '%d saniyə', + m: 'bir dəqiqə', + mm: '%d dəqiqə', + h: 'bir saat', + hh: '%d saat', + d: 'bir gün', + dd: '%d gün', + M: 'bir ay', + MM: '%d ay', + y: 'bir il', + yy: '%d il', + }, + meridiemParse: /gecə|səhər|gündüz|axşam/, + isPM: function (input) { + return /^(gündüz|axşam)$/.test(input); + }, + meridiem: function (hour, minute, isLower) { + if (hour < 4) { + return 'gecə'; + } else if (hour < 12) { + return 'səhər'; + } else if (hour < 17) { + return 'gündüz'; + } else { + return 'axşam'; + } + }, + dayOfMonthOrdinalParse: /\d{1,2}-(ıncı|inci|nci|üncü|ncı|uncu)/, + ordinal: function (number) { + if (number === 0) { + // special case for zero + return number + '-ıncı'; + } + var a = number % 10, + b = (number % 100) - a, + c = number >= 100 ? 100 : null; + return number + (suffixes[a] || suffixes[b] || suffixes[c]); + }, + week: { + dow: 1, // Monday is the first day of the week. + doy: 7, // The week that contains Jan 7th is the first week of the year. + }, + }); + + //! moment.js locale configuration + + function plural(word, num) { + var forms = word.split('_'); + return num % 10 === 1 && num % 100 !== 11 + ? forms[0] + : num % 10 >= 2 && num % 10 <= 4 && (num % 100 < 10 || num % 100 >= 20) + ? forms[1] + : forms[2]; + } + function relativeTimeWithPlural(number, withoutSuffix, key) { + var format = { + ss: withoutSuffix ? 'секунда_секунды_секунд' : 'секунду_секунды_секунд', + mm: withoutSuffix ? 'хвіліна_хвіліны_хвілін' : 'хвіліну_хвіліны_хвілін', + hh: withoutSuffix ? 'гадзіна_гадзіны_гадзін' : 'гадзіну_гадзіны_гадзін', + dd: 'дзень_дні_дзён', + MM: 'месяц_месяцы_месяцаў', + yy: 'год_гады_гадоў', + }; + if (key === 'm') { + return withoutSuffix ? 'хвіліна' : 'хвіліну'; + } else if (key === 'h') { + return withoutSuffix ? 'гадзіна' : 'гадзіну'; + } else { + return number + ' ' + plural(format[key], +number); + } + } + + moment.defineLocale('be', { + months: { + format: 'студзеня_лютага_сакавіка_красавіка_траўня_чэрвеня_ліпеня_жніўня_верасня_кастрычніка_лістапада_снежня'.split( + '_' + ), + standalone: 'студзень_люты_сакавік_красавік_травень_чэрвень_ліпень_жнівень_верасень_кастрычнік_лістапад_снежань'.split( + '_' + ), + }, + monthsShort: 'студ_лют_сак_крас_трав_чэрв_ліп_жнів_вер_каст_ліст_снеж'.split( + '_' + ), + weekdays: { + format: 'нядзелю_панядзелак_аўторак_сераду_чацвер_пятніцу_суботу'.split( + '_' + ), + standalone: 'нядзеля_панядзелак_аўторак_серада_чацвер_пятніца_субота'.split( + '_' + ), + isFormat: /\[ ?[Ууў] ?(?:мінулую|наступную)? ?\] ?dddd/, + }, + weekdaysShort: 'нд_пн_ат_ср_чц_пт_сб'.split('_'), + weekdaysMin: 'нд_пн_ат_ср_чц_пт_сб'.split('_'), + longDateFormat: { + LT: 'HH:mm', + LTS: 'HH:mm:ss', + L: 'DD.MM.YYYY', + LL: 'D MMMM YYYY г.', + LLL: 'D MMMM YYYY г., HH:mm', + LLLL: 'dddd, D MMMM YYYY г., HH:mm', + }, + calendar: { + sameDay: '[Сёння ў] LT', + nextDay: '[Заўтра ў] LT', + lastDay: '[Учора ў] LT', + nextWeek: function () { + return '[У] dddd [ў] LT'; + }, + lastWeek: function () { + switch (this.day()) { + case 0: + case 3: + case 5: + case 6: + return '[У мінулую] dddd [ў] LT'; + case 1: + case 2: + case 4: + return '[У мінулы] dddd [ў] LT'; + } + }, + sameElse: 'L', + }, + relativeTime: { + future: 'праз %s', + past: '%s таму', + s: 'некалькі секунд', + m: relativeTimeWithPlural, + mm: relativeTimeWithPlural, + h: relativeTimeWithPlural, + hh: relativeTimeWithPlural, + d: 'дзень', + dd: relativeTimeWithPlural, + M: 'месяц', + MM: relativeTimeWithPlural, + y: 'год', + yy: relativeTimeWithPlural, + }, + meridiemParse: /ночы|раніцы|дня|вечара/, + isPM: function (input) { + return /^(дня|вечара)$/.test(input); + }, + meridiem: function (hour, minute, isLower) { + if (hour < 4) { + return 'ночы'; + } else if (hour < 12) { + return 'раніцы'; + } else if (hour < 17) { + return 'дня'; + } else { + return 'вечара'; + } + }, + dayOfMonthOrdinalParse: /\d{1,2}-(і|ы|га)/, + ordinal: function (number, period) { + switch (period) { + case 'M': + case 'd': + case 'DDD': + case 'w': + case 'W': + return (number % 10 === 2 || number % 10 === 3) && + number % 100 !== 12 && + number % 100 !== 13 + ? number + '-і' + : number + '-ы'; + case 'D': + return number + '-га'; + default: + return number; + } + }, + week: { + dow: 1, // Monday is the first day of the week. + doy: 7, // The week that contains Jan 7th is the first week of the year. + }, + }); + + //! moment.js locale configuration + + moment.defineLocale('bg', { + months: 'януари_февруари_март_април_май_юни_юли_август_септември_октомври_ноември_декември'.split( + '_' + ), + monthsShort: 'яну_фев_мар_апр_май_юни_юли_авг_сеп_окт_ное_дек'.split('_'), + weekdays: 'неделя_понеделник_вторник_сряда_четвъртък_петък_събота'.split( + '_' + ), + weekdaysShort: 'нед_пон_вто_сря_чет_пет_съб'.split('_'), + weekdaysMin: 'нд_пн_вт_ср_чт_пт_сб'.split('_'), + longDateFormat: { + LT: 'H:mm', + LTS: 'H:mm:ss', + L: 'D.MM.YYYY', + LL: 'D MMMM YYYY', + LLL: 'D MMMM YYYY H:mm', + LLLL: 'dddd, D MMMM YYYY H:mm', + }, + calendar: { + sameDay: '[Днес в] LT', + nextDay: '[Утре в] LT', + nextWeek: 'dddd [в] LT', + lastDay: '[Вчера в] LT', + lastWeek: function () { + switch (this.day()) { + case 0: + case 3: + case 6: + return '[Миналата] dddd [в] LT'; + case 1: + case 2: + case 4: + case 5: + return '[Миналия] dddd [в] LT'; + } + }, + sameElse: 'L', + }, + relativeTime: { + future: 'след %s', + past: 'преди %s', + s: 'няколко секунди', + ss: '%d секунди', + m: 'минута', + mm: '%d минути', + h: 'час', + hh: '%d часа', + d: 'ден', + dd: '%d дена', + M: 'месец', + MM: '%d месеца', + y: 'година', + yy: '%d години', + }, + dayOfMonthOrdinalParse: /\d{1,2}-(ев|ен|ти|ви|ри|ми)/, + ordinal: function (number) { + var lastDigit = number % 10, + last2Digits = number % 100; + if (number === 0) { + return number + '-ев'; + } else if (last2Digits === 0) { + return number + '-ен'; + } else if (last2Digits > 10 && last2Digits < 20) { + return number + '-ти'; + } else if (lastDigit === 1) { + return number + '-ви'; + } else if (lastDigit === 2) { + return number + '-ри'; + } else if (lastDigit === 7 || lastDigit === 8) { + return number + '-ми'; + } else { + return number + '-ти'; + } + }, + week: { + dow: 1, // Monday is the first day of the week. + doy: 7, // The week that contains Jan 7th is the first week of the year. + }, + }); + + //! moment.js locale configuration + + moment.defineLocale('bm', { + months: 'Zanwuyekalo_Fewuruyekalo_Marisikalo_Awirilikalo_Mɛkalo_Zuwɛnkalo_Zuluyekalo_Utikalo_Sɛtanburukalo_ɔkutɔburukalo_Nowanburukalo_Desanburukalo'.split( + '_' + ), + monthsShort: 'Zan_Few_Mar_Awi_Mɛ_Zuw_Zul_Uti_Sɛt_ɔku_Now_Des'.split('_'), + weekdays: 'Kari_Ntɛnɛn_Tarata_Araba_Alamisa_Juma_Sibiri'.split('_'), + weekdaysShort: 'Kar_Ntɛ_Tar_Ara_Ala_Jum_Sib'.split('_'), + weekdaysMin: 'Ka_Nt_Ta_Ar_Al_Ju_Si'.split('_'), + longDateFormat: { + LT: 'HH:mm', + LTS: 'HH:mm:ss', + L: 'DD/MM/YYYY', + LL: 'MMMM [tile] D [san] YYYY', + LLL: 'MMMM [tile] D [san] YYYY [lɛrɛ] HH:mm', + LLLL: 'dddd MMMM [tile] D [san] YYYY [lɛrɛ] HH:mm', + }, + calendar: { + sameDay: '[Bi lɛrɛ] LT', + nextDay: '[Sini lɛrɛ] LT', + nextWeek: 'dddd [don lɛrɛ] LT', + lastDay: '[Kunu lɛrɛ] LT', + lastWeek: 'dddd [tɛmɛnen lɛrɛ] LT', + sameElse: 'L', + }, + relativeTime: { + future: '%s kɔnɔ', + past: 'a bɛ %s bɔ', + s: 'sanga dama dama', + ss: 'sekondi %d', + m: 'miniti kelen', + mm: 'miniti %d', + h: 'lɛrɛ kelen', + hh: 'lɛrɛ %d', + d: 'tile kelen', + dd: 'tile %d', + M: 'kalo kelen', + MM: 'kalo %d', + y: 'san kelen', + yy: 'san %d', + }, + week: { + dow: 1, // Monday is the first day of the week. + doy: 4, // The week that contains Jan 4th is the first week of the year. + }, + }); + + //! moment.js locale configuration + + var symbolMap$3 = { + '1': '১', + '2': '২', + '3': '৩', + '4': '৪', + '5': '৫', + '6': '৬', + '7': '৭', + '8': '৮', + '9': '৯', + '0': '০', + }, + numberMap$2 = { + '১': '1', + '২': '2', + '৩': '3', + '৪': '4', + '৫': '5', + '৬': '6', + '৭': '7', + '৮': '8', + '৯': '9', + '০': '0', + }; + + moment.defineLocale('bn', { + months: 'জানুয়ারি_ফেব্রুয়ারি_মার্চ_এপ্রিল_মে_জুন_জুলাই_আগস্ট_সেপ্টেম্বর_অক্টোবর_নভেম্বর_ডিসেম্বর'.split( + '_' + ), + monthsShort: 'জানু_ফেব্রু_মার্চ_এপ্রিল_মে_জুন_জুলাই_আগস্ট_সেপ্ট_অক্টো_নভে_ডিসে'.split( + '_' + ), + weekdays: 'রবিবার_সোমবার_মঙ্গলবার_বুধবার_বৃহস্পতিবার_শুক্রবার_শনিবার'.split( + '_' + ), + weekdaysShort: 'রবি_সোম_মঙ্গল_বুধ_বৃহস্পতি_শুক্র_শনি'.split('_'), + weekdaysMin: 'রবি_সোম_মঙ্গল_বুধ_বৃহ_শুক্র_শনি'.split('_'), + longDateFormat: { + LT: 'A h:mm সময়', + LTS: 'A h:mm:ss সময়', + L: 'DD/MM/YYYY', + LL: 'D MMMM YYYY', + LLL: 'D MMMM YYYY, A h:mm সময়', + LLLL: 'dddd, D MMMM YYYY, A h:mm সময়', + }, + calendar: { + sameDay: '[আজ] LT', + nextDay: '[আগামীকাল] LT', + nextWeek: 'dddd, LT', + lastDay: '[গতকাল] LT', + lastWeek: '[গত] dddd, LT', + sameElse: 'L', + }, + relativeTime: { + future: '%s পরে', + past: '%s আগে', + s: 'কয়েক সেকেন্ড', + ss: '%d সেকেন্ড', + m: 'এক মিনিট', + mm: '%d মিনিট', + h: 'এক ঘন্টা', + hh: '%d ঘন্টা', + d: 'এক দিন', + dd: '%d দিন', + M: 'এক মাস', + MM: '%d মাস', + y: 'এক বছর', + yy: '%d বছর', + }, + preparse: function (string) { + return string.replace(/[১২৩৪৫৬৭৮৯০]/g, function (match) { + return numberMap$2[match]; + }); + }, + postformat: function (string) { + return string.replace(/\d/g, function (match) { + return symbolMap$3[match]; + }); + }, + meridiemParse: /রাত|সকাল|দুপুর|বিকাল|রাত/, + meridiemHour: function (hour, meridiem) { + if (hour === 12) { + hour = 0; + } + if ( + (meridiem === 'রাত' && hour >= 4) || + (meridiem === 'দুপুর' && hour < 5) || + meridiem === 'বিকাল' + ) { + return hour + 12; + } else { + return hour; + } + }, + meridiem: function (hour, minute, isLower) { + if (hour < 4) { + return 'রাত'; + } else if (hour < 10) { + return 'সকাল'; + } else if (hour < 17) { + return 'দুপুর'; + } else if (hour < 20) { + return 'বিকাল'; + } else { + return 'রাত'; + } + }, + week: { + dow: 0, // Sunday is the first day of the week. + doy: 6, // The week that contains Jan 6th is the first week of the year. + }, + }); + + //! moment.js locale configuration + + var symbolMap$4 = { + '1': '༡', + '2': '༢', + '3': '༣', + '4': '༤', + '5': '༥', + '6': '༦', + '7': '༧', + '8': '༨', + '9': '༩', + '0': '༠', + }, + numberMap$3 = { + '༡': '1', + '༢': '2', + '༣': '3', + '༤': '4', + '༥': '5', + '༦': '6', + '༧': '7', + '༨': '8', + '༩': '9', + '༠': '0', + }; + + moment.defineLocale('bo', { + months: 'ཟླ་བ་དང་པོ_ཟླ་བ་གཉིས་པ_ཟླ་བ་གསུམ་པ_ཟླ་བ་བཞི་པ_ཟླ་བ་ལྔ་པ_ཟླ་བ་དྲུག་པ_ཟླ་བ་བདུན་པ_ཟླ་བ་བརྒྱད་པ_ཟླ་བ་དགུ་པ_ཟླ་བ་བཅུ་པ_ཟླ་བ་བཅུ་གཅིག་པ_ཟླ་བ་བཅུ་གཉིས་པ'.split( + '_' + ), + monthsShort: 'ཟླ་1_ཟླ་2_ཟླ་3_ཟླ་4_ཟླ་5_ཟླ་6_ཟླ་7_ཟླ་8_ཟླ་9_ཟླ་10_ཟླ་11_ཟླ་12'.split( + '_' + ), + monthsShortRegex: /^(ཟླ་\d{1,2})/, + monthsParseExact: true, + weekdays: 'གཟའ་ཉི་མ་_གཟའ་ཟླ་བ་_གཟའ་མིག་དམར་_གཟའ་ལྷག་པ་_གཟའ་ཕུར་བུ_གཟའ་པ་སངས་_གཟའ་སྤེན་པ་'.split( + '_' + ), + weekdaysShort: 'ཉི་མ་_ཟླ་བ་_མིག་དམར་_ལྷག་པ་_ཕུར་བུ_པ་སངས་_སྤེན་པ་'.split( + '_' + ), + weekdaysMin: 'ཉི_ཟླ_མིག_ལྷག_ཕུར_སངས_སྤེན'.split('_'), + longDateFormat: { + LT: 'A h:mm', + LTS: 'A h:mm:ss', + L: 'DD/MM/YYYY', + LL: 'D MMMM YYYY', + LLL: 'D MMMM YYYY, A h:mm', + LLLL: 'dddd, D MMMM YYYY, A h:mm', + }, + calendar: { + sameDay: '[དི་རིང] LT', + nextDay: '[སང་ཉིན] LT', + nextWeek: '[བདུན་ཕྲག་རྗེས་མ], LT', + lastDay: '[ཁ་སང] LT', + lastWeek: '[བདུན་ཕྲག་མཐའ་མ] dddd, LT', + sameElse: 'L', + }, + relativeTime: { + future: '%s ལ་', + past: '%s སྔན་ལ', + s: 'ལམ་སང', + ss: '%d སྐར་ཆ།', + m: 'སྐར་མ་གཅིག', + mm: '%d སྐར་མ', + h: 'ཆུ་ཚོད་གཅིག', + hh: '%d ཆུ་ཚོད', + d: 'ཉིན་གཅིག', + dd: '%d ཉིན་', + M: 'ཟླ་བ་གཅིག', + MM: '%d ཟླ་བ', + y: 'ལོ་གཅིག', + yy: '%d ལོ', + }, + preparse: function (string) { + return string.replace(/[༡༢༣༤༥༦༧༨༩༠]/g, function (match) { + return numberMap$3[match]; + }); + }, + postformat: function (string) { + return string.replace(/\d/g, function (match) { + return symbolMap$4[match]; + }); + }, + meridiemParse: /མཚན་མོ|ཞོགས་ཀས|ཉིན་གུང|དགོང་དག|མཚན་མོ/, + meridiemHour: function (hour, meridiem) { + if (hour === 12) { + hour = 0; + } + if ( + (meridiem === 'མཚན་མོ' && hour >= 4) || + (meridiem === 'ཉིན་གུང' && hour < 5) || + meridiem === 'དགོང་དག' + ) { + return hour + 12; + } else { + return hour; + } + }, + meridiem: function (hour, minute, isLower) { + if (hour < 4) { + return 'མཚན་མོ'; + } else if (hour < 10) { + return 'ཞོགས་ཀས'; + } else if (hour < 17) { + return 'ཉིན་གུང'; + } else if (hour < 20) { + return 'དགོང་དག'; + } else { + return 'མཚན་མོ'; + } + }, + week: { + dow: 0, // Sunday is the first day of the week. + doy: 6, // The week that contains Jan 6th is the first week of the year. + }, + }); + + //! moment.js locale configuration + + function relativeTimeWithMutation(number, withoutSuffix, key) { + var format = { + mm: 'munutenn', + MM: 'miz', + dd: 'devezh', + }; + return number + ' ' + mutation(format[key], number); + } + function specialMutationForYears(number) { + switch (lastNumber(number)) { + case 1: + case 3: + case 4: + case 5: + case 9: + return number + ' bloaz'; + default: + return number + ' vloaz'; + } + } + function lastNumber(number) { + if (number > 9) { + return lastNumber(number % 10); + } + return number; + } + function mutation(text, number) { + if (number === 2) { + return softMutation(text); + } + return text; + } + function softMutation(text) { + var mutationTable = { + m: 'v', + b: 'v', + d: 'z', + }; + if (mutationTable[text.charAt(0)] === undefined) { + return text; + } + return mutationTable[text.charAt(0)] + text.substring(1); + } + + var monthsParse = [ + /^gen/i, + /^c[ʼ\']hwe/i, + /^meu/i, + /^ebr/i, + /^mae/i, + /^(mez|eve)/i, + /^gou/i, + /^eos/i, + /^gwe/i, + /^her/i, + /^du/i, + /^ker/i, + ], + monthsRegex = /^(genver|c[ʼ\']hwevrer|meurzh|ebrel|mae|mezheven|gouere|eost|gwengolo|here|du|kerzu|gen|c[ʼ\']hwe|meu|ebr|mae|eve|gou|eos|gwe|her|du|ker)/i, + monthsStrictRegex = /^(genver|c[ʼ\']hwevrer|meurzh|ebrel|mae|mezheven|gouere|eost|gwengolo|here|du|kerzu)/i, + monthsShortStrictRegex = /^(gen|c[ʼ\']hwe|meu|ebr|mae|eve|gou|eos|gwe|her|du|ker)/i, + fullWeekdaysParse = [ + /^sul/i, + /^lun/i, + /^meurzh/i, + /^merc[ʼ\']her/i, + /^yaou/i, + /^gwener/i, + /^sadorn/i, + ], + shortWeekdaysParse = [ + /^Sul/i, + /^Lun/i, + /^Meu/i, + /^Mer/i, + /^Yao/i, + /^Gwe/i, + /^Sad/i, + ], + minWeekdaysParse = [ + /^Su/i, + /^Lu/i, + /^Me([^r]|$)/i, + /^Mer/i, + /^Ya/i, + /^Gw/i, + /^Sa/i, + ]; + + moment.defineLocale('br', { + months: 'Genver_Cʼhwevrer_Meurzh_Ebrel_Mae_Mezheven_Gouere_Eost_Gwengolo_Here_Du_Kerzu'.split( + '_' + ), + monthsShort: 'Gen_Cʼhwe_Meu_Ebr_Mae_Eve_Gou_Eos_Gwe_Her_Du_Ker'.split('_'), + weekdays: 'Sul_Lun_Meurzh_Mercʼher_Yaou_Gwener_Sadorn'.split('_'), + weekdaysShort: 'Sul_Lun_Meu_Mer_Yao_Gwe_Sad'.split('_'), + weekdaysMin: 'Su_Lu_Me_Mer_Ya_Gw_Sa'.split('_'), + weekdaysParse: minWeekdaysParse, + fullWeekdaysParse: fullWeekdaysParse, + shortWeekdaysParse: shortWeekdaysParse, + minWeekdaysParse: minWeekdaysParse, + + monthsRegex: monthsRegex, + monthsShortRegex: monthsRegex, + monthsStrictRegex: monthsStrictRegex, + monthsShortStrictRegex: monthsShortStrictRegex, + monthsParse: monthsParse, + longMonthsParse: monthsParse, + shortMonthsParse: monthsParse, + + longDateFormat: { + LT: 'HH:mm', + LTS: 'HH:mm:ss', + L: 'DD/MM/YYYY', + LL: 'D [a viz] MMMM YYYY', + LLL: 'D [a viz] MMMM YYYY HH:mm', + LLLL: 'dddd, D [a viz] MMMM YYYY HH:mm', + }, + calendar: { + sameDay: '[Hiziv da] LT', + nextDay: '[Warcʼhoazh da] LT', + nextWeek: 'dddd [da] LT', + lastDay: '[Decʼh da] LT', + lastWeek: 'dddd [paset da] LT', + sameElse: 'L', + }, + relativeTime: { + future: 'a-benn %s', + past: '%s ʼzo', + s: 'un nebeud segondennoù', + ss: '%d eilenn', + m: 'ur vunutenn', + mm: relativeTimeWithMutation, + h: 'un eur', + hh: '%d eur', + d: 'un devezh', + dd: relativeTimeWithMutation, + M: 'ur miz', + MM: relativeTimeWithMutation, + y: 'ur bloaz', + yy: specialMutationForYears, + }, + dayOfMonthOrdinalParse: /\d{1,2}(añ|vet)/, + ordinal: function (number) { + var output = number === 1 ? 'añ' : 'vet'; + return number + output; + }, + week: { + dow: 1, // Monday is the first day of the week. + doy: 4, // The week that contains Jan 4th is the first week of the year. + }, + meridiemParse: /a.m.|g.m./, // goude merenn | a-raok merenn + isPM: function (token) { + return token === 'g.m.'; + }, + meridiem: function (hour, minute, isLower) { + return hour < 12 ? 'a.m.' : 'g.m.'; + }, + }); + + //! moment.js locale configuration + + function translate(number, withoutSuffix, key) { + var result = number + ' '; + switch (key) { + case 'ss': + if (number === 1) { + result += 'sekunda'; + } else if (number === 2 || number === 3 || number === 4) { + result += 'sekunde'; + } else { + result += 'sekundi'; + } + return result; + case 'm': + return withoutSuffix ? 'jedna minuta' : 'jedne minute'; + case 'mm': + if (number === 1) { + result += 'minuta'; + } else if (number === 2 || number === 3 || number === 4) { + result += 'minute'; + } else { + result += 'minuta'; + } + return result; + case 'h': + return withoutSuffix ? 'jedan sat' : 'jednog sata'; + case 'hh': + if (number === 1) { + result += 'sat'; + } else if (number === 2 || number === 3 || number === 4) { + result += 'sata'; + } else { + result += 'sati'; + } + return result; + case 'dd': + if (number === 1) { + result += 'dan'; + } else { + result += 'dana'; + } + return result; + case 'MM': + if (number === 1) { + result += 'mjesec'; + } else if (number === 2 || number === 3 || number === 4) { + result += 'mjeseca'; + } else { + result += 'mjeseci'; + } + return result; + case 'yy': + if (number === 1) { + result += 'godina'; + } else if (number === 2 || number === 3 || number === 4) { + result += 'godine'; + } else { + result += 'godina'; + } + return result; + } + } + + moment.defineLocale('bs', { + months: 'januar_februar_mart_april_maj_juni_juli_august_septembar_oktobar_novembar_decembar'.split( + '_' + ), + monthsShort: 'jan._feb._mar._apr._maj._jun._jul._aug._sep._okt._nov._dec.'.split( + '_' + ), + monthsParseExact: true, + weekdays: 'nedjelja_ponedjeljak_utorak_srijeda_četvrtak_petak_subota'.split( + '_' + ), + weekdaysShort: 'ned._pon._uto._sri._čet._pet._sub.'.split('_'), + weekdaysMin: 'ne_po_ut_sr_če_pe_su'.split('_'), + weekdaysParseExact: true, + longDateFormat: { + LT: 'H:mm', + LTS: 'H:mm:ss', + L: 'DD.MM.YYYY', + LL: 'D. MMMM YYYY', + LLL: 'D. MMMM YYYY H:mm', + LLLL: 'dddd, D. MMMM YYYY H:mm', + }, + calendar: { + sameDay: '[danas u] LT', + nextDay: '[sutra u] LT', + nextWeek: function () { + switch (this.day()) { + case 0: + return '[u] [nedjelju] [u] LT'; + case 3: + return '[u] [srijedu] [u] LT'; + case 6: + return '[u] [subotu] [u] LT'; + case 1: + case 2: + case 4: + case 5: + return '[u] dddd [u] LT'; + } + }, + lastDay: '[jučer u] LT', + lastWeek: function () { + switch (this.day()) { + case 0: + case 3: + return '[prošlu] dddd [u] LT'; + case 6: + return '[prošle] [subote] [u] LT'; + case 1: + case 2: + case 4: + case 5: + return '[prošli] dddd [u] LT'; + } + }, + sameElse: 'L', + }, + relativeTime: { + future: 'za %s', + past: 'prije %s', + s: 'par sekundi', + ss: translate, + m: translate, + mm: translate, + h: translate, + hh: translate, + d: 'dan', + dd: translate, + M: 'mjesec', + MM: translate, + y: 'godinu', + yy: translate, + }, + dayOfMonthOrdinalParse: /\d{1,2}\./, + ordinal: '%d.', + week: { + dow: 1, // Monday is the first day of the week. + doy: 7, // The week that contains Jan 7th is the first week of the year. + }, + }); + + //! moment.js locale configuration + + moment.defineLocale('ca', { + months: { + standalone: 'gener_febrer_març_abril_maig_juny_juliol_agost_setembre_octubre_novembre_desembre'.split( + '_' + ), + format: "de gener_de febrer_de març_d'abril_de maig_de juny_de juliol_d'agost_de setembre_d'octubre_de novembre_de desembre".split( + '_' + ), + isFormat: /D[oD]?(\s)+MMMM/, + }, + monthsShort: 'gen._febr._març_abr._maig_juny_jul._ag._set._oct._nov._des.'.split( + '_' + ), + monthsParseExact: true, + weekdays: 'diumenge_dilluns_dimarts_dimecres_dijous_divendres_dissabte'.split( + '_' + ), + weekdaysShort: 'dg._dl._dt._dc._dj._dv._ds.'.split('_'), + weekdaysMin: 'dg_dl_dt_dc_dj_dv_ds'.split('_'), + weekdaysParseExact: true, + longDateFormat: { + LT: 'H:mm', + LTS: 'H:mm:ss', + L: 'DD/MM/YYYY', + LL: 'D MMMM [de] YYYY', + ll: 'D MMM YYYY', + LLL: 'D MMMM [de] YYYY [a les] H:mm', + lll: 'D MMM YYYY, H:mm', + LLLL: 'dddd D MMMM [de] YYYY [a les] H:mm', + llll: 'ddd D MMM YYYY, H:mm', + }, + calendar: { + sameDay: function () { + return '[avui a ' + (this.hours() !== 1 ? 'les' : 'la') + '] LT'; + }, + nextDay: function () { + return '[demà a ' + (this.hours() !== 1 ? 'les' : 'la') + '] LT'; + }, + nextWeek: function () { + return 'dddd [a ' + (this.hours() !== 1 ? 'les' : 'la') + '] LT'; + }, + lastDay: function () { + return '[ahir a ' + (this.hours() !== 1 ? 'les' : 'la') + '] LT'; + }, + lastWeek: function () { + return ( + '[el] dddd [passat a ' + + (this.hours() !== 1 ? 'les' : 'la') + + '] LT' + ); + }, + sameElse: 'L', + }, + relativeTime: { + future: "d'aquí %s", + past: 'fa %s', + s: 'uns segons', + ss: '%d segons', + m: 'un minut', + mm: '%d minuts', + h: 'una hora', + hh: '%d hores', + d: 'un dia', + dd: '%d dies', + M: 'un mes', + MM: '%d mesos', + y: 'un any', + yy: '%d anys', + }, + dayOfMonthOrdinalParse: /\d{1,2}(r|n|t|è|a)/, + ordinal: function (number, period) { + var output = + number === 1 + ? 'r' + : number === 2 + ? 'n' + : number === 3 + ? 'r' + : number === 4 + ? 't' + : 'è'; + if (period === 'w' || period === 'W') { + output = 'a'; + } + return number + output; + }, + week: { + dow: 1, // Monday is the first day of the week. + doy: 4, // The week that contains Jan 4th is the first week of the year. + }, + }); + + //! moment.js locale configuration + + var months$3 = 'leden_únor_březen_duben_květen_červen_červenec_srpen_září_říjen_listopad_prosinec'.split( + '_' + ), + monthsShort = 'led_úno_bře_dub_kvě_čvn_čvc_srp_zář_říj_lis_pro'.split('_'), + monthsParse$1 = [ + /^led/i, + /^úno/i, + /^bře/i, + /^dub/i, + /^kvě/i, + /^(čvn|červen$|června)/i, + /^(čvc|červenec|července)/i, + /^srp/i, + /^zář/i, + /^říj/i, + /^lis/i, + /^pro/i, + ], + // NOTE: 'červen' is substring of 'červenec'; therefore 'červenec' must precede 'červen' in the regex to be fully matched. + // Otherwise parser matches '1. červenec' as '1. červen' + 'ec'. + monthsRegex$1 = /^(leden|únor|březen|duben|květen|červenec|července|červen|června|srpen|září|říjen|listopad|prosinec|led|úno|bře|dub|kvě|čvn|čvc|srp|zář|říj|lis|pro)/i; + + function plural$1(n) { + return n > 1 && n < 5 && ~~(n / 10) !== 1; + } + function translate$1(number, withoutSuffix, key, isFuture) { + var result = number + ' '; + switch (key) { + case 's': // a few seconds / in a few seconds / a few seconds ago + return withoutSuffix || isFuture ? 'pár sekund' : 'pár sekundami'; + case 'ss': // 9 seconds / in 9 seconds / 9 seconds ago + if (withoutSuffix || isFuture) { + return result + (plural$1(number) ? 'sekundy' : 'sekund'); + } else { + return result + 'sekundami'; + } + case 'm': // a minute / in a minute / a minute ago + return withoutSuffix ? 'minuta' : isFuture ? 'minutu' : 'minutou'; + case 'mm': // 9 minutes / in 9 minutes / 9 minutes ago + if (withoutSuffix || isFuture) { + return result + (plural$1(number) ? 'minuty' : 'minut'); + } else { + return result + 'minutami'; + } + case 'h': // an hour / in an hour / an hour ago + return withoutSuffix ? 'hodina' : isFuture ? 'hodinu' : 'hodinou'; + case 'hh': // 9 hours / in 9 hours / 9 hours ago + if (withoutSuffix || isFuture) { + return result + (plural$1(number) ? 'hodiny' : 'hodin'); + } else { + return result + 'hodinami'; + } + case 'd': // a day / in a day / a day ago + return withoutSuffix || isFuture ? 'den' : 'dnem'; + case 'dd': // 9 days / in 9 days / 9 days ago + if (withoutSuffix || isFuture) { + return result + (plural$1(number) ? 'dny' : 'dní'); + } else { + return result + 'dny'; + } + case 'M': // a month / in a month / a month ago + return withoutSuffix || isFuture ? 'měsíc' : 'měsícem'; + case 'MM': // 9 months / in 9 months / 9 months ago + if (withoutSuffix || isFuture) { + return result + (plural$1(number) ? 'měsíce' : 'měsíců'); + } else { + return result + 'měsíci'; + } + case 'y': // a year / in a year / a year ago + return withoutSuffix || isFuture ? 'rok' : 'rokem'; + case 'yy': // 9 years / in 9 years / 9 years ago + if (withoutSuffix || isFuture) { + return result + (plural$1(number) ? 'roky' : 'let'); + } else { + return result + 'lety'; + } + } + } + + moment.defineLocale('cs', { + months: months$3, + monthsShort: monthsShort, + monthsRegex: monthsRegex$1, + monthsShortRegex: monthsRegex$1, + // NOTE: 'červen' is substring of 'červenec'; therefore 'červenec' must precede 'červen' in the regex to be fully matched. + // Otherwise parser matches '1. červenec' as '1. červen' + 'ec'. + monthsStrictRegex: /^(leden|ledna|února|únor|březen|března|duben|dubna|květen|května|červenec|července|červen|června|srpen|srpna|září|říjen|října|listopadu|listopad|prosinec|prosince)/i, + monthsShortStrictRegex: /^(led|úno|bře|dub|kvě|čvn|čvc|srp|zář|říj|lis|pro)/i, + monthsParse: monthsParse$1, + longMonthsParse: monthsParse$1, + shortMonthsParse: monthsParse$1, + weekdays: 'neděle_pondělí_úterý_středa_čtvrtek_pátek_sobota'.split('_'), + weekdaysShort: 'ne_po_út_st_čt_pá_so'.split('_'), + weekdaysMin: 'ne_po_út_st_čt_pá_so'.split('_'), + longDateFormat: { + LT: 'H:mm', + LTS: 'H:mm:ss', + L: 'DD.MM.YYYY', + LL: 'D. MMMM YYYY', + LLL: 'D. MMMM YYYY H:mm', + LLLL: 'dddd D. MMMM YYYY H:mm', + l: 'D. M. YYYY', + }, + calendar: { + sameDay: '[dnes v] LT', + nextDay: '[zítra v] LT', + nextWeek: function () { + switch (this.day()) { + case 0: + return '[v neděli v] LT'; + case 1: + case 2: + return '[v] dddd [v] LT'; + case 3: + return '[ve středu v] LT'; + case 4: + return '[ve čtvrtek v] LT'; + case 5: + return '[v pátek v] LT'; + case 6: + return '[v sobotu v] LT'; + } + }, + lastDay: '[včera v] LT', + lastWeek: function () { + switch (this.day()) { + case 0: + return '[minulou neděli v] LT'; + case 1: + case 2: + return '[minulé] dddd [v] LT'; + case 3: + return '[minulou středu v] LT'; + case 4: + case 5: + return '[minulý] dddd [v] LT'; + case 6: + return '[minulou sobotu v] LT'; + } + }, + sameElse: 'L', + }, + relativeTime: { + future: 'za %s', + past: 'před %s', + s: translate$1, + ss: translate$1, + m: translate$1, + mm: translate$1, + h: translate$1, + hh: translate$1, + d: translate$1, + dd: translate$1, + M: translate$1, + MM: translate$1, + y: translate$1, + yy: translate$1, + }, + dayOfMonthOrdinalParse: /\d{1,2}\./, + ordinal: '%d.', + week: { + dow: 1, // Monday is the first day of the week. + doy: 4, // The week that contains Jan 4th is the first week of the year. + }, + }); + + //! moment.js locale configuration + + moment.defineLocale('cv', { + months: 'кӑрлач_нарӑс_пуш_ака_май_ҫӗртме_утӑ_ҫурла_авӑн_юпа_чӳк_раштав'.split( + '_' + ), + monthsShort: 'кӑр_нар_пуш_ака_май_ҫӗр_утӑ_ҫур_авн_юпа_чӳк_раш'.split('_'), + weekdays: 'вырсарникун_тунтикун_ытларикун_юнкун_кӗҫнерникун_эрнекун_шӑматкун'.split( + '_' + ), + weekdaysShort: 'выр_тун_ытл_юн_кӗҫ_эрн_шӑм'.split('_'), + weekdaysMin: 'вр_тн_ыт_юн_кҫ_эр_шм'.split('_'), + longDateFormat: { + LT: 'HH:mm', + LTS: 'HH:mm:ss', + L: 'DD-MM-YYYY', + LL: 'YYYY [ҫулхи] MMMM [уйӑхӗн] D[-мӗшӗ]', + LLL: 'YYYY [ҫулхи] MMMM [уйӑхӗн] D[-мӗшӗ], HH:mm', + LLLL: 'dddd, YYYY [ҫулхи] MMMM [уйӑхӗн] D[-мӗшӗ], HH:mm', + }, + calendar: { + sameDay: '[Паян] LT [сехетре]', + nextDay: '[Ыран] LT [сехетре]', + lastDay: '[Ӗнер] LT [сехетре]', + nextWeek: '[Ҫитес] dddd LT [сехетре]', + lastWeek: '[Иртнӗ] dddd LT [сехетре]', + sameElse: 'L', + }, + relativeTime: { + future: function (output) { + var affix = /сехет$/i.exec(output) + ? 'рен' + : /ҫул$/i.exec(output) + ? 'тан' + : 'ран'; + return output + affix; + }, + past: '%s каялла', + s: 'пӗр-ик ҫеккунт', + ss: '%d ҫеккунт', + m: 'пӗр минут', + mm: '%d минут', + h: 'пӗр сехет', + hh: '%d сехет', + d: 'пӗр кун', + dd: '%d кун', + M: 'пӗр уйӑх', + MM: '%d уйӑх', + y: 'пӗр ҫул', + yy: '%d ҫул', + }, + dayOfMonthOrdinalParse: /\d{1,2}-мӗш/, + ordinal: '%d-мӗш', + week: { + dow: 1, // Monday is the first day of the week. + doy: 7, // The week that contains Jan 7th is the first week of the year. + }, + }); + + //! moment.js locale configuration + + moment.defineLocale('cy', { + months: 'Ionawr_Chwefror_Mawrth_Ebrill_Mai_Mehefin_Gorffennaf_Awst_Medi_Hydref_Tachwedd_Rhagfyr'.split( + '_' + ), + monthsShort: 'Ion_Chwe_Maw_Ebr_Mai_Meh_Gor_Aws_Med_Hyd_Tach_Rhag'.split( + '_' + ), + weekdays: 'Dydd Sul_Dydd Llun_Dydd Mawrth_Dydd Mercher_Dydd Iau_Dydd Gwener_Dydd Sadwrn'.split( + '_' + ), + weekdaysShort: 'Sul_Llun_Maw_Mer_Iau_Gwe_Sad'.split('_'), + weekdaysMin: 'Su_Ll_Ma_Me_Ia_Gw_Sa'.split('_'), + weekdaysParseExact: true, + // time formats are the same as en-gb + longDateFormat: { + LT: 'HH:mm', + LTS: 'HH:mm:ss', + L: 'DD/MM/YYYY', + LL: 'D MMMM YYYY', + LLL: 'D MMMM YYYY HH:mm', + LLLL: 'dddd, D MMMM YYYY HH:mm', + }, + calendar: { + sameDay: '[Heddiw am] LT', + nextDay: '[Yfory am] LT', + nextWeek: 'dddd [am] LT', + lastDay: '[Ddoe am] LT', + lastWeek: 'dddd [diwethaf am] LT', + sameElse: 'L', + }, + relativeTime: { + future: 'mewn %s', + past: '%s yn ôl', + s: 'ychydig eiliadau', + ss: '%d eiliad', + m: 'munud', + mm: '%d munud', + h: 'awr', + hh: '%d awr', + d: 'diwrnod', + dd: '%d diwrnod', + M: 'mis', + MM: '%d mis', + y: 'blwyddyn', + yy: '%d flynedd', + }, + dayOfMonthOrdinalParse: /\d{1,2}(fed|ain|af|il|ydd|ed|eg)/, + // traditional ordinal numbers above 31 are not commonly used in colloquial Welsh + ordinal: function (number) { + var b = number, + output = '', + lookup = [ + '', + 'af', + 'il', + 'ydd', + 'ydd', + 'ed', + 'ed', + 'ed', + 'fed', + 'fed', + 'fed', // 1af to 10fed + 'eg', + 'fed', + 'eg', + 'eg', + 'fed', + 'eg', + 'eg', + 'fed', + 'eg', + 'fed', // 11eg to 20fed + ]; + if (b > 20) { + if (b === 40 || b === 50 || b === 60 || b === 80 || b === 100) { + output = 'fed'; // not 30ain, 70ain or 90ain + } else { + output = 'ain'; + } + } else if (b > 0) { + output = lookup[b]; + } + return number + output; + }, + week: { + dow: 1, // Monday is the first day of the week. + doy: 4, // The week that contains Jan 4th is the first week of the year. + }, + }); + + //! moment.js locale configuration + + moment.defineLocale('da', { + months: 'januar_februar_marts_april_maj_juni_juli_august_september_oktober_november_december'.split( + '_' + ), + monthsShort: 'jan_feb_mar_apr_maj_jun_jul_aug_sep_okt_nov_dec'.split('_'), + weekdays: 'søndag_mandag_tirsdag_onsdag_torsdag_fredag_lørdag'.split('_'), + weekdaysShort: 'søn_man_tir_ons_tor_fre_lør'.split('_'), + weekdaysMin: 'sø_ma_ti_on_to_fr_lø'.split('_'), + longDateFormat: { + LT: 'HH:mm', + LTS: 'HH:mm:ss', + L: 'DD.MM.YYYY', + LL: 'D. MMMM YYYY', + LLL: 'D. MMMM YYYY HH:mm', + LLLL: 'dddd [d.] D. MMMM YYYY [kl.] HH:mm', + }, + calendar: { + sameDay: '[i dag kl.] LT', + nextDay: '[i morgen kl.] LT', + nextWeek: 'på dddd [kl.] LT', + lastDay: '[i går kl.] LT', + lastWeek: '[i] dddd[s kl.] LT', + sameElse: 'L', + }, + relativeTime: { + future: 'om %s', + past: '%s siden', + s: 'få sekunder', + ss: '%d sekunder', + m: 'et minut', + mm: '%d minutter', + h: 'en time', + hh: '%d timer', + d: 'en dag', + dd: '%d dage', + M: 'en måned', + MM: '%d måneder', + y: 'et år', + yy: '%d år', + }, + dayOfMonthOrdinalParse: /\d{1,2}\./, + ordinal: '%d.', + week: { + dow: 1, // Monday is the first day of the week. + doy: 4, // The week that contains Jan 4th is the first week of the year. + }, + }); + + //! moment.js locale configuration + + function processRelativeTime(number, withoutSuffix, key, isFuture) { + var format = { + m: ['eine Minute', 'einer Minute'], + h: ['eine Stunde', 'einer Stunde'], + d: ['ein Tag', 'einem Tag'], + dd: [number + ' Tage', number + ' Tagen'], + w: ['eine Woche', 'einer Woche'], + M: ['ein Monat', 'einem Monat'], + MM: [number + ' Monate', number + ' Monaten'], + y: ['ein Jahr', 'einem Jahr'], + yy: [number + ' Jahre', number + ' Jahren'], + }; + return withoutSuffix ? format[key][0] : format[key][1]; + } + + moment.defineLocale('de-at', { + months: 'Jänner_Februar_März_April_Mai_Juni_Juli_August_September_Oktober_November_Dezember'.split( + '_' + ), + monthsShort: 'Jän._Feb._März_Apr._Mai_Juni_Juli_Aug._Sep._Okt._Nov._Dez.'.split( + '_' + ), + monthsParseExact: true, + weekdays: 'Sonntag_Montag_Dienstag_Mittwoch_Donnerstag_Freitag_Samstag'.split( + '_' + ), + weekdaysShort: 'So._Mo._Di._Mi._Do._Fr._Sa.'.split('_'), + weekdaysMin: 'So_Mo_Di_Mi_Do_Fr_Sa'.split('_'), + weekdaysParseExact: true, + longDateFormat: { + LT: 'HH:mm', + LTS: 'HH:mm:ss', + L: 'DD.MM.YYYY', + LL: 'D. MMMM YYYY', + LLL: 'D. MMMM YYYY HH:mm', + LLLL: 'dddd, D. MMMM YYYY HH:mm', + }, + calendar: { + sameDay: '[heute um] LT [Uhr]', + sameElse: 'L', + nextDay: '[morgen um] LT [Uhr]', + nextWeek: 'dddd [um] LT [Uhr]', + lastDay: '[gestern um] LT [Uhr]', + lastWeek: '[letzten] dddd [um] LT [Uhr]', + }, + relativeTime: { + future: 'in %s', + past: 'vor %s', + s: 'ein paar Sekunden', + ss: '%d Sekunden', + m: processRelativeTime, + mm: '%d Minuten', + h: processRelativeTime, + hh: '%d Stunden', + d: processRelativeTime, + dd: processRelativeTime, + w: processRelativeTime, + ww: '%d Wochen', + M: processRelativeTime, + MM: processRelativeTime, + y: processRelativeTime, + yy: processRelativeTime, + }, + dayOfMonthOrdinalParse: /\d{1,2}\./, + ordinal: '%d.', + week: { + dow: 1, // Monday is the first day of the week. + doy: 4, // The week that contains Jan 4th is the first week of the year. + }, + }); + + //! moment.js locale configuration + + function processRelativeTime$1(number, withoutSuffix, key, isFuture) { + var format = { + m: ['eine Minute', 'einer Minute'], + h: ['eine Stunde', 'einer Stunde'], + d: ['ein Tag', 'einem Tag'], + dd: [number + ' Tage', number + ' Tagen'], + w: ['eine Woche', 'einer Woche'], + M: ['ein Monat', 'einem Monat'], + MM: [number + ' Monate', number + ' Monaten'], + y: ['ein Jahr', 'einem Jahr'], + yy: [number + ' Jahre', number + ' Jahren'], + }; + return withoutSuffix ? format[key][0] : format[key][1]; + } + + moment.defineLocale('de-ch', { + months: 'Januar_Februar_März_April_Mai_Juni_Juli_August_September_Oktober_November_Dezember'.split( + '_' + ), + monthsShort: 'Jan._Feb._März_Apr._Mai_Juni_Juli_Aug._Sep._Okt._Nov._Dez.'.split( + '_' + ), + monthsParseExact: true, + weekdays: 'Sonntag_Montag_Dienstag_Mittwoch_Donnerstag_Freitag_Samstag'.split( + '_' + ), + weekdaysShort: 'So_Mo_Di_Mi_Do_Fr_Sa'.split('_'), + weekdaysMin: 'So_Mo_Di_Mi_Do_Fr_Sa'.split('_'), + weekdaysParseExact: true, + longDateFormat: { + LT: 'HH:mm', + LTS: 'HH:mm:ss', + L: 'DD.MM.YYYY', + LL: 'D. MMMM YYYY', + LLL: 'D. MMMM YYYY HH:mm', + LLLL: 'dddd, D. MMMM YYYY HH:mm', + }, + calendar: { + sameDay: '[heute um] LT [Uhr]', + sameElse: 'L', + nextDay: '[morgen um] LT [Uhr]', + nextWeek: 'dddd [um] LT [Uhr]', + lastDay: '[gestern um] LT [Uhr]', + lastWeek: '[letzten] dddd [um] LT [Uhr]', + }, + relativeTime: { + future: 'in %s', + past: 'vor %s', + s: 'ein paar Sekunden', + ss: '%d Sekunden', + m: processRelativeTime$1, + mm: '%d Minuten', + h: processRelativeTime$1, + hh: '%d Stunden', + d: processRelativeTime$1, + dd: processRelativeTime$1, + w: processRelativeTime$1, + ww: '%d Wochen', + M: processRelativeTime$1, + MM: processRelativeTime$1, + y: processRelativeTime$1, + yy: processRelativeTime$1, + }, + dayOfMonthOrdinalParse: /\d{1,2}\./, + ordinal: '%d.', + week: { + dow: 1, // Monday is the first day of the week. + doy: 4, // The week that contains Jan 4th is the first week of the year. + }, + }); + + //! moment.js locale configuration + + function processRelativeTime$2(number, withoutSuffix, key, isFuture) { + var format = { + m: ['eine Minute', 'einer Minute'], + h: ['eine Stunde', 'einer Stunde'], + d: ['ein Tag', 'einem Tag'], + dd: [number + ' Tage', number + ' Tagen'], + w: ['eine Woche', 'einer Woche'], + M: ['ein Monat', 'einem Monat'], + MM: [number + ' Monate', number + ' Monaten'], + y: ['ein Jahr', 'einem Jahr'], + yy: [number + ' Jahre', number + ' Jahren'], + }; + return withoutSuffix ? format[key][0] : format[key][1]; + } + + moment.defineLocale('de', { + months: 'Januar_Februar_März_April_Mai_Juni_Juli_August_September_Oktober_November_Dezember'.split( + '_' + ), + monthsShort: 'Jan._Feb._März_Apr._Mai_Juni_Juli_Aug._Sep._Okt._Nov._Dez.'.split( + '_' + ), + monthsParseExact: true, + weekdays: 'Sonntag_Montag_Dienstag_Mittwoch_Donnerstag_Freitag_Samstag'.split( + '_' + ), + weekdaysShort: 'So._Mo._Di._Mi._Do._Fr._Sa.'.split('_'), + weekdaysMin: 'So_Mo_Di_Mi_Do_Fr_Sa'.split('_'), + weekdaysParseExact: true, + longDateFormat: { + LT: 'HH:mm', + LTS: 'HH:mm:ss', + L: 'DD.MM.YYYY', + LL: 'D. MMMM YYYY', + LLL: 'D. MMMM YYYY HH:mm', + LLLL: 'dddd, D. MMMM YYYY HH:mm', + }, + calendar: { + sameDay: '[heute um] LT [Uhr]', + sameElse: 'L', + nextDay: '[morgen um] LT [Uhr]', + nextWeek: 'dddd [um] LT [Uhr]', + lastDay: '[gestern um] LT [Uhr]', + lastWeek: '[letzten] dddd [um] LT [Uhr]', + }, + relativeTime: { + future: 'in %s', + past: 'vor %s', + s: 'ein paar Sekunden', + ss: '%d Sekunden', + m: processRelativeTime$2, + mm: '%d Minuten', + h: processRelativeTime$2, + hh: '%d Stunden', + d: processRelativeTime$2, + dd: processRelativeTime$2, + w: processRelativeTime$2, + ww: '%d Wochen', + M: processRelativeTime$2, + MM: processRelativeTime$2, + y: processRelativeTime$2, + yy: processRelativeTime$2, + }, + dayOfMonthOrdinalParse: /\d{1,2}\./, + ordinal: '%d.', + week: { + dow: 1, // Monday is the first day of the week. + doy: 4, // The week that contains Jan 4th is the first week of the year. + }, + }); + + //! moment.js locale configuration + + var months$4 = [ + 'ޖެނުއަރީ', + 'ފެބްރުއަރީ', + 'މާރިޗު', + 'އޭޕްރީލު', + 'މޭ', + 'ޖޫން', + 'ޖުލައި', + 'އޯގަސްޓު', + 'ސެޕްޓެމްބަރު', + 'އޮކްޓޯބަރު', + 'ނޮވެމްބަރު', + 'ޑިސެމްބަރު', + ], + weekdays = [ + 'އާދިއްތަ', + 'ހޯމަ', + 'އަންގާރަ', + 'ބުދަ', + 'ބުރާސްފަތި', + 'ހުކުރު', + 'ހޮނިހިރު', + ]; + + moment.defineLocale('dv', { + months: months$4, + monthsShort: months$4, + weekdays: weekdays, + weekdaysShort: weekdays, + weekdaysMin: 'އާދި_ހޯމަ_އަން_ބުދަ_ބުރާ_ހުކު_ހޮނި'.split('_'), + longDateFormat: { + LT: 'HH:mm', + LTS: 'HH:mm:ss', + L: 'D/M/YYYY', + LL: 'D MMMM YYYY', + LLL: 'D MMMM YYYY HH:mm', + LLLL: 'dddd D MMMM YYYY HH:mm', + }, + meridiemParse: /މކ|މފ/, + isPM: function (input) { + return 'މފ' === input; + }, + meridiem: function (hour, minute, isLower) { + if (hour < 12) { + return 'މކ'; + } else { + return 'މފ'; + } + }, + calendar: { + sameDay: '[މިއަދު] LT', + nextDay: '[މާދަމާ] LT', + nextWeek: 'dddd LT', + lastDay: '[އިއްޔެ] LT', + lastWeek: '[ފާއިތުވި] dddd LT', + sameElse: 'L', + }, + relativeTime: { + future: 'ތެރޭގައި %s', + past: 'ކުރިން %s', + s: 'ސިކުންތުކޮޅެއް', + ss: 'd% ސިކުންތު', + m: 'މިނިޓެއް', + mm: 'މިނިޓު %d', + h: 'ގަޑިއިރެއް', + hh: 'ގަޑިއިރު %d', + d: 'ދުވަހެއް', + dd: 'ދުވަސް %d', + M: 'މަހެއް', + MM: 'މަސް %d', + y: 'އަހަރެއް', + yy: 'އަހަރު %d', + }, + preparse: function (string) { + return string.replace(/،/g, ','); + }, + postformat: function (string) { + return string.replace(/,/g, '،'); + }, + week: { + dow: 7, // Sunday is the first day of the week. + doy: 12, // The week that contains Jan 12th is the first week of the year. + }, + }); + + //! moment.js locale configuration + + function isFunction(input) { + return ( + (typeof Function !== 'undefined' && input instanceof Function) || + Object.prototype.toString.call(input) === '[object Function]' + ); + } + + moment.defineLocale('el', { + monthsNominativeEl: 'Ιανουάριος_Φεβρουάριος_Μάρτιος_Απρίλιος_Μάιος_Ιούνιος_Ιούλιος_Αύγουστος_Σεπτέμβριος_Οκτώβριος_Νοέμβριος_Δεκέμβριος'.split( + '_' + ), + monthsGenitiveEl: 'Ιανουαρίου_Φεβρουαρίου_Μαρτίου_Απριλίου_Μαΐου_Ιουνίου_Ιουλίου_Αυγούστου_Σεπτεμβρίου_Οκτωβρίου_Νοεμβρίου_Δεκεμβρίου'.split( + '_' + ), + months: function (momentToFormat, format) { + if (!momentToFormat) { + return this._monthsNominativeEl; + } else if ( + typeof format === 'string' && + /D/.test(format.substring(0, format.indexOf('MMMM'))) + ) { + // if there is a day number before 'MMMM' + return this._monthsGenitiveEl[momentToFormat.month()]; + } else { + return this._monthsNominativeEl[momentToFormat.month()]; + } + }, + monthsShort: 'Ιαν_Φεβ_Μαρ_Απρ_Μαϊ_Ιουν_Ιουλ_Αυγ_Σεπ_Οκτ_Νοε_Δεκ'.split('_'), + weekdays: 'Κυριακή_Δευτέρα_Τρίτη_Τετάρτη_Πέμπτη_Παρασκευή_Σάββατο'.split( + '_' + ), + weekdaysShort: 'Κυρ_Δευ_Τρι_Τετ_Πεμ_Παρ_Σαβ'.split('_'), + weekdaysMin: 'Κυ_Δε_Τρ_Τε_Πε_Πα_Σα'.split('_'), + meridiem: function (hours, minutes, isLower) { + if (hours > 11) { + return isLower ? 'μμ' : 'ΜΜ'; + } else { + return isLower ? 'πμ' : 'ΠΜ'; + } + }, + isPM: function (input) { + return (input + '').toLowerCase()[0] === 'μ'; + }, + meridiemParse: /[ΠΜ]\.?Μ?\.?/i, + longDateFormat: { + LT: 'h:mm A', + LTS: 'h:mm:ss A', + L: 'DD/MM/YYYY', + LL: 'D MMMM YYYY', + LLL: 'D MMMM YYYY h:mm A', + LLLL: 'dddd, D MMMM YYYY h:mm A', + }, + calendarEl: { + sameDay: '[Σήμερα {}] LT', + nextDay: '[Αύριο {}] LT', + nextWeek: 'dddd [{}] LT', + lastDay: '[Χθες {}] LT', + lastWeek: function () { + switch (this.day()) { + case 6: + return '[το προηγούμενο] dddd [{}] LT'; + default: + return '[την προηγούμενη] dddd [{}] LT'; + } + }, + sameElse: 'L', + }, + calendar: function (key, mom) { + var output = this._calendarEl[key], + hours = mom && mom.hours(); + if (isFunction(output)) { + output = output.apply(mom); + } + return output.replace('{}', hours % 12 === 1 ? 'στη' : 'στις'); + }, + relativeTime: { + future: 'σε %s', + past: '%s πριν', + s: 'λίγα δευτερόλεπτα', + ss: '%d δευτερόλεπτα', + m: 'ένα λεπτό', + mm: '%d λεπτά', + h: 'μία ώρα', + hh: '%d ώρες', + d: 'μία μέρα', + dd: '%d μέρες', + M: 'ένας μήνας', + MM: '%d μήνες', + y: 'ένας χρόνος', + yy: '%d χρόνια', + }, + dayOfMonthOrdinalParse: /\d{1,2}η/, + ordinal: '%dη', + week: { + dow: 1, // Monday is the first day of the week. + doy: 4, // The week that contains Jan 4st is the first week of the year. + }, + }); + + //! moment.js locale configuration + + moment.defineLocale('en-au', { + months: 'January_February_March_April_May_June_July_August_September_October_November_December'.split( + '_' + ), + monthsShort: 'Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec'.split('_'), + weekdays: 'Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday'.split( + '_' + ), + weekdaysShort: 'Sun_Mon_Tue_Wed_Thu_Fri_Sat'.split('_'), + weekdaysMin: 'Su_Mo_Tu_We_Th_Fr_Sa'.split('_'), + longDateFormat: { + LT: 'h:mm A', + LTS: 'h:mm:ss A', + L: 'DD/MM/YYYY', + LL: 'D MMMM YYYY', + LLL: 'D MMMM YYYY h:mm A', + LLLL: 'dddd, D MMMM YYYY h:mm A', + }, + calendar: { + sameDay: '[Today at] LT', + nextDay: '[Tomorrow at] LT', + nextWeek: 'dddd [at] LT', + lastDay: '[Yesterday at] LT', + lastWeek: '[Last] dddd [at] LT', + sameElse: 'L', + }, + relativeTime: { + future: 'in %s', + past: '%s ago', + s: 'a few seconds', + ss: '%d seconds', + m: 'a minute', + mm: '%d minutes', + h: 'an hour', + hh: '%d hours', + d: 'a day', + dd: '%d days', + M: 'a month', + MM: '%d months', + y: 'a year', + yy: '%d years', + }, + dayOfMonthOrdinalParse: /\d{1,2}(st|nd|rd|th)/, + ordinal: function (number) { + var b = number % 10, + output = + ~~((number % 100) / 10) === 1 + ? 'th' + : b === 1 + ? 'st' + : b === 2 + ? 'nd' + : b === 3 + ? 'rd' + : 'th'; + return number + output; + }, + week: { + dow: 0, // Sunday is the first day of the week. + doy: 4, // The week that contains Jan 4th is the first week of the year. + }, + }); + + //! moment.js locale configuration + + moment.defineLocale('en-ca', { + months: 'January_February_March_April_May_June_July_August_September_October_November_December'.split( + '_' + ), + monthsShort: 'Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec'.split('_'), + weekdays: 'Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday'.split( + '_' + ), + weekdaysShort: 'Sun_Mon_Tue_Wed_Thu_Fri_Sat'.split('_'), + weekdaysMin: 'Su_Mo_Tu_We_Th_Fr_Sa'.split('_'), + longDateFormat: { + LT: 'h:mm A', + LTS: 'h:mm:ss A', + L: 'YYYY-MM-DD', + LL: 'MMMM D, YYYY', + LLL: 'MMMM D, YYYY h:mm A', + LLLL: 'dddd, MMMM D, YYYY h:mm A', + }, + calendar: { + sameDay: '[Today at] LT', + nextDay: '[Tomorrow at] LT', + nextWeek: 'dddd [at] LT', + lastDay: '[Yesterday at] LT', + lastWeek: '[Last] dddd [at] LT', + sameElse: 'L', + }, + relativeTime: { + future: 'in %s', + past: '%s ago', + s: 'a few seconds', + ss: '%d seconds', + m: 'a minute', + mm: '%d minutes', + h: 'an hour', + hh: '%d hours', + d: 'a day', + dd: '%d days', + M: 'a month', + MM: '%d months', + y: 'a year', + yy: '%d years', + }, + dayOfMonthOrdinalParse: /\d{1,2}(st|nd|rd|th)/, + ordinal: function (number) { + var b = number % 10, + output = + ~~((number % 100) / 10) === 1 + ? 'th' + : b === 1 + ? 'st' + : b === 2 + ? 'nd' + : b === 3 + ? 'rd' + : 'th'; + return number + output; + }, + }); + + //! moment.js locale configuration + + moment.defineLocale('en-gb', { + months: 'January_February_March_April_May_June_July_August_September_October_November_December'.split( + '_' + ), + monthsShort: 'Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec'.split('_'), + weekdays: 'Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday'.split( + '_' + ), + weekdaysShort: 'Sun_Mon_Tue_Wed_Thu_Fri_Sat'.split('_'), + weekdaysMin: 'Su_Mo_Tu_We_Th_Fr_Sa'.split('_'), + longDateFormat: { + LT: 'HH:mm', + LTS: 'HH:mm:ss', + L: 'DD/MM/YYYY', + LL: 'D MMMM YYYY', + LLL: 'D MMMM YYYY HH:mm', + LLLL: 'dddd, D MMMM YYYY HH:mm', + }, + calendar: { + sameDay: '[Today at] LT', + nextDay: '[Tomorrow at] LT', + nextWeek: 'dddd [at] LT', + lastDay: '[Yesterday at] LT', + lastWeek: '[Last] dddd [at] LT', + sameElse: 'L', + }, + relativeTime: { + future: 'in %s', + past: '%s ago', + s: 'a few seconds', + ss: '%d seconds', + m: 'a minute', + mm: '%d minutes', + h: 'an hour', + hh: '%d hours', + d: 'a day', + dd: '%d days', + M: 'a month', + MM: '%d months', + y: 'a year', + yy: '%d years', + }, + dayOfMonthOrdinalParse: /\d{1,2}(st|nd|rd|th)/, + ordinal: function (number) { + var b = number % 10, + output = + ~~((number % 100) / 10) === 1 + ? 'th' + : b === 1 + ? 'st' + : b === 2 + ? 'nd' + : b === 3 + ? 'rd' + : 'th'; + return number + output; + }, + week: { + dow: 1, // Monday is the first day of the week. + doy: 4, // The week that contains Jan 4th is the first week of the year. + }, + }); + + //! moment.js locale configuration + + moment.defineLocale('en-ie', { + months: 'January_February_March_April_May_June_July_August_September_October_November_December'.split( + '_' + ), + monthsShort: 'Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec'.split('_'), + weekdays: 'Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday'.split( + '_' + ), + weekdaysShort: 'Sun_Mon_Tue_Wed_Thu_Fri_Sat'.split('_'), + weekdaysMin: 'Su_Mo_Tu_We_Th_Fr_Sa'.split('_'), + longDateFormat: { + LT: 'HH:mm', + LTS: 'HH:mm:ss', + L: 'DD/MM/YYYY', + LL: 'D MMMM YYYY', + LLL: 'D MMMM YYYY HH:mm', + LLLL: 'dddd D MMMM YYYY HH:mm', + }, + calendar: { + sameDay: '[Today at] LT', + nextDay: '[Tomorrow at] LT', + nextWeek: 'dddd [at] LT', + lastDay: '[Yesterday at] LT', + lastWeek: '[Last] dddd [at] LT', + sameElse: 'L', + }, + relativeTime: { + future: 'in %s', + past: '%s ago', + s: 'a few seconds', + ss: '%d seconds', + m: 'a minute', + mm: '%d minutes', + h: 'an hour', + hh: '%d hours', + d: 'a day', + dd: '%d days', + M: 'a month', + MM: '%d months', + y: 'a year', + yy: '%d years', + }, + dayOfMonthOrdinalParse: /\d{1,2}(st|nd|rd|th)/, + ordinal: function (number) { + var b = number % 10, + output = + ~~((number % 100) / 10) === 1 + ? 'th' + : b === 1 + ? 'st' + : b === 2 + ? 'nd' + : b === 3 + ? 'rd' + : 'th'; + return number + output; + }, + week: { + dow: 1, // Monday is the first day of the week. + doy: 4, // The week that contains Jan 4th is the first week of the year. + }, + }); + + //! moment.js locale configuration + + moment.defineLocale('en-il', { + months: 'January_February_March_April_May_June_July_August_September_October_November_December'.split( + '_' + ), + monthsShort: 'Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec'.split('_'), + weekdays: 'Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday'.split( + '_' + ), + weekdaysShort: 'Sun_Mon_Tue_Wed_Thu_Fri_Sat'.split('_'), + weekdaysMin: 'Su_Mo_Tu_We_Th_Fr_Sa'.split('_'), + longDateFormat: { + LT: 'HH:mm', + LTS: 'HH:mm:ss', + L: 'DD/MM/YYYY', + LL: 'D MMMM YYYY', + LLL: 'D MMMM YYYY HH:mm', + LLLL: 'dddd, D MMMM YYYY HH:mm', + }, + calendar: { + sameDay: '[Today at] LT', + nextDay: '[Tomorrow at] LT', + nextWeek: 'dddd [at] LT', + lastDay: '[Yesterday at] LT', + lastWeek: '[Last] dddd [at] LT', + sameElse: 'L', + }, + relativeTime: { + future: 'in %s', + past: '%s ago', + s: 'a few seconds', + ss: '%d seconds', + m: 'a minute', + mm: '%d minutes', + h: 'an hour', + hh: '%d hours', + d: 'a day', + dd: '%d days', + M: 'a month', + MM: '%d months', + y: 'a year', + yy: '%d years', + }, + dayOfMonthOrdinalParse: /\d{1,2}(st|nd|rd|th)/, + ordinal: function (number) { + var b = number % 10, + output = + ~~((number % 100) / 10) === 1 + ? 'th' + : b === 1 + ? 'st' + : b === 2 + ? 'nd' + : b === 3 + ? 'rd' + : 'th'; + return number + output; + }, + }); + + //! moment.js locale configuration + + moment.defineLocale('en-in', { + months: 'January_February_March_April_May_June_July_August_September_October_November_December'.split( + '_' + ), + monthsShort: 'Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec'.split('_'), + weekdays: 'Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday'.split( + '_' + ), + weekdaysShort: 'Sun_Mon_Tue_Wed_Thu_Fri_Sat'.split('_'), + weekdaysMin: 'Su_Mo_Tu_We_Th_Fr_Sa'.split('_'), + longDateFormat: { + LT: 'h:mm A', + LTS: 'h:mm:ss A', + L: 'DD/MM/YYYY', + LL: 'D MMMM YYYY', + LLL: 'D MMMM YYYY h:mm A', + LLLL: 'dddd, D MMMM YYYY h:mm A', + }, + calendar: { + sameDay: '[Today at] LT', + nextDay: '[Tomorrow at] LT', + nextWeek: 'dddd [at] LT', + lastDay: '[Yesterday at] LT', + lastWeek: '[Last] dddd [at] LT', + sameElse: 'L', + }, + relativeTime: { + future: 'in %s', + past: '%s ago', + s: 'a few seconds', + ss: '%d seconds', + m: 'a minute', + mm: '%d minutes', + h: 'an hour', + hh: '%d hours', + d: 'a day', + dd: '%d days', + M: 'a month', + MM: '%d months', + y: 'a year', + yy: '%d years', + }, + dayOfMonthOrdinalParse: /\d{1,2}(st|nd|rd|th)/, + ordinal: function (number) { + var b = number % 10, + output = + ~~((number % 100) / 10) === 1 + ? 'th' + : b === 1 + ? 'st' + : b === 2 + ? 'nd' + : b === 3 + ? 'rd' + : 'th'; + return number + output; + }, + week: { + dow: 0, // Sunday is the first day of the week. + doy: 6, // The week that contains Jan 1st is the first week of the year. + }, + }); + + //! moment.js locale configuration + + moment.defineLocale('en-nz', { + months: 'January_February_March_April_May_June_July_August_September_October_November_December'.split( + '_' + ), + monthsShort: 'Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec'.split('_'), + weekdays: 'Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday'.split( + '_' + ), + weekdaysShort: 'Sun_Mon_Tue_Wed_Thu_Fri_Sat'.split('_'), + weekdaysMin: 'Su_Mo_Tu_We_Th_Fr_Sa'.split('_'), + longDateFormat: { + LT: 'h:mm A', + LTS: 'h:mm:ss A', + L: 'DD/MM/YYYY', + LL: 'D MMMM YYYY', + LLL: 'D MMMM YYYY h:mm A', + LLLL: 'dddd, D MMMM YYYY h:mm A', + }, + calendar: { + sameDay: '[Today at] LT', + nextDay: '[Tomorrow at] LT', + nextWeek: 'dddd [at] LT', + lastDay: '[Yesterday at] LT', + lastWeek: '[Last] dddd [at] LT', + sameElse: 'L', + }, + relativeTime: { + future: 'in %s', + past: '%s ago', + s: 'a few seconds', + ss: '%d seconds', + m: 'a minute', + mm: '%d minutes', + h: 'an hour', + hh: '%d hours', + d: 'a day', + dd: '%d days', + M: 'a month', + MM: '%d months', + y: 'a year', + yy: '%d years', + }, + dayOfMonthOrdinalParse: /\d{1,2}(st|nd|rd|th)/, + ordinal: function (number) { + var b = number % 10, + output = + ~~((number % 100) / 10) === 1 + ? 'th' + : b === 1 + ? 'st' + : b === 2 + ? 'nd' + : b === 3 + ? 'rd' + : 'th'; + return number + output; + }, + week: { + dow: 1, // Monday is the first day of the week. + doy: 4, // The week that contains Jan 4th is the first week of the year. + }, + }); + + //! moment.js locale configuration + + moment.defineLocale('en-sg', { + months: 'January_February_March_April_May_June_July_August_September_October_November_December'.split( + '_' + ), + monthsShort: 'Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec'.split('_'), + weekdays: 'Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday'.split( + '_' + ), + weekdaysShort: 'Sun_Mon_Tue_Wed_Thu_Fri_Sat'.split('_'), + weekdaysMin: 'Su_Mo_Tu_We_Th_Fr_Sa'.split('_'), + longDateFormat: { + LT: 'HH:mm', + LTS: 'HH:mm:ss', + L: 'DD/MM/YYYY', + LL: 'D MMMM YYYY', + LLL: 'D MMMM YYYY HH:mm', + LLLL: 'dddd, D MMMM YYYY HH:mm', + }, + calendar: { + sameDay: '[Today at] LT', + nextDay: '[Tomorrow at] LT', + nextWeek: 'dddd [at] LT', + lastDay: '[Yesterday at] LT', + lastWeek: '[Last] dddd [at] LT', + sameElse: 'L', + }, + relativeTime: { + future: 'in %s', + past: '%s ago', + s: 'a few seconds', + ss: '%d seconds', + m: 'a minute', + mm: '%d minutes', + h: 'an hour', + hh: '%d hours', + d: 'a day', + dd: '%d days', + M: 'a month', + MM: '%d months', + y: 'a year', + yy: '%d years', + }, + dayOfMonthOrdinalParse: /\d{1,2}(st|nd|rd|th)/, + ordinal: function (number) { + var b = number % 10, + output = + ~~((number % 100) / 10) === 1 + ? 'th' + : b === 1 + ? 'st' + : b === 2 + ? 'nd' + : b === 3 + ? 'rd' + : 'th'; + return number + output; + }, + week: { + dow: 1, // Monday is the first day of the week. + doy: 4, // The week that contains Jan 4th is the first week of the year. + }, + }); + + //! moment.js locale configuration + + moment.defineLocale('eo', { + months: 'januaro_februaro_marto_aprilo_majo_junio_julio_aŭgusto_septembro_oktobro_novembro_decembro'.split( + '_' + ), + monthsShort: 'jan_feb_mart_apr_maj_jun_jul_aŭg_sept_okt_nov_dec'.split('_'), + weekdays: 'dimanĉo_lundo_mardo_merkredo_ĵaŭdo_vendredo_sabato'.split('_'), + weekdaysShort: 'dim_lun_mard_merk_ĵaŭ_ven_sab'.split('_'), + weekdaysMin: 'di_lu_ma_me_ĵa_ve_sa'.split('_'), + longDateFormat: { + LT: 'HH:mm', + LTS: 'HH:mm:ss', + L: 'YYYY-MM-DD', + LL: '[la] D[-an de] MMMM, YYYY', + LLL: '[la] D[-an de] MMMM, YYYY HH:mm', + LLLL: 'dddd[n], [la] D[-an de] MMMM, YYYY HH:mm', + llll: 'ddd, [la] D[-an de] MMM, YYYY HH:mm', + }, + meridiemParse: /[ap]\.t\.m/i, + isPM: function (input) { + return input.charAt(0).toLowerCase() === 'p'; + }, + meridiem: function (hours, minutes, isLower) { + if (hours > 11) { + return isLower ? 'p.t.m.' : 'P.T.M.'; + } else { + return isLower ? 'a.t.m.' : 'A.T.M.'; + } + }, + calendar: { + sameDay: '[Hodiaŭ je] LT', + nextDay: '[Morgaŭ je] LT', + nextWeek: 'dddd[n je] LT', + lastDay: '[Hieraŭ je] LT', + lastWeek: '[pasintan] dddd[n je] LT', + sameElse: 'L', + }, + relativeTime: { + future: 'post %s', + past: 'antaŭ %s', + s: 'kelkaj sekundoj', + ss: '%d sekundoj', + m: 'unu minuto', + mm: '%d minutoj', + h: 'unu horo', + hh: '%d horoj', + d: 'unu tago', //ne 'diurno', ĉar estas uzita por proksimumo + dd: '%d tagoj', + M: 'unu monato', + MM: '%d monatoj', + y: 'unu jaro', + yy: '%d jaroj', + }, + dayOfMonthOrdinalParse: /\d{1,2}a/, + ordinal: '%da', + week: { + dow: 1, // Monday is the first day of the week. + doy: 7, // The week that contains Jan 7th is the first week of the year. + }, + }); + + //! moment.js locale configuration + + var monthsShortDot = 'ene._feb._mar._abr._may._jun._jul._ago._sep._oct._nov._dic.'.split( + '_' + ), + monthsShort$1 = 'ene_feb_mar_abr_may_jun_jul_ago_sep_oct_nov_dic'.split('_'), + monthsParse$2 = [ + /^ene/i, + /^feb/i, + /^mar/i, + /^abr/i, + /^may/i, + /^jun/i, + /^jul/i, + /^ago/i, + /^sep/i, + /^oct/i, + /^nov/i, + /^dic/i, + ], + monthsRegex$2 = /^(enero|febrero|marzo|abril|mayo|junio|julio|agosto|septiembre|octubre|noviembre|diciembre|ene\.?|feb\.?|mar\.?|abr\.?|may\.?|jun\.?|jul\.?|ago\.?|sep\.?|oct\.?|nov\.?|dic\.?)/i; + + moment.defineLocale('es-do', { + months: 'enero_febrero_marzo_abril_mayo_junio_julio_agosto_septiembre_octubre_noviembre_diciembre'.split( + '_' + ), + monthsShort: function (m, format) { + if (!m) { + return monthsShortDot; + } else if (/-MMM-/.test(format)) { + return monthsShort$1[m.month()]; + } else { + return monthsShortDot[m.month()]; + } + }, + monthsRegex: monthsRegex$2, + monthsShortRegex: monthsRegex$2, + monthsStrictRegex: /^(enero|febrero|marzo|abril|mayo|junio|julio|agosto|septiembre|octubre|noviembre|diciembre)/i, + monthsShortStrictRegex: /^(ene\.?|feb\.?|mar\.?|abr\.?|may\.?|jun\.?|jul\.?|ago\.?|sep\.?|oct\.?|nov\.?|dic\.?)/i, + monthsParse: monthsParse$2, + longMonthsParse: monthsParse$2, + shortMonthsParse: monthsParse$2, + weekdays: 'domingo_lunes_martes_miércoles_jueves_viernes_sábado'.split('_'), + weekdaysShort: 'dom._lun._mar._mié._jue._vie._sáb.'.split('_'), + weekdaysMin: 'do_lu_ma_mi_ju_vi_sá'.split('_'), + weekdaysParseExact: true, + longDateFormat: { + LT: 'h:mm A', + LTS: 'h:mm:ss A', + L: 'DD/MM/YYYY', + LL: 'D [de] MMMM [de] YYYY', + LLL: 'D [de] MMMM [de] YYYY h:mm A', + LLLL: 'dddd, D [de] MMMM [de] YYYY h:mm A', + }, + calendar: { + sameDay: function () { + return '[hoy a la' + (this.hours() !== 1 ? 's' : '') + '] LT'; + }, + nextDay: function () { + return '[mañana a la' + (this.hours() !== 1 ? 's' : '') + '] LT'; + }, + nextWeek: function () { + return 'dddd [a la' + (this.hours() !== 1 ? 's' : '') + '] LT'; + }, + lastDay: function () { + return '[ayer a la' + (this.hours() !== 1 ? 's' : '') + '] LT'; + }, + lastWeek: function () { + return ( + '[el] dddd [pasado a la' + + (this.hours() !== 1 ? 's' : '') + + '] LT' + ); + }, + sameElse: 'L', + }, + relativeTime: { + future: 'en %s', + past: 'hace %s', + s: 'unos segundos', + ss: '%d segundos', + m: 'un minuto', + mm: '%d minutos', + h: 'una hora', + hh: '%d horas', + d: 'un día', + dd: '%d días', + M: 'un mes', + MM: '%d meses', + y: 'un año', + yy: '%d años', + }, + dayOfMonthOrdinalParse: /\d{1,2}º/, + ordinal: '%dº', + week: { + dow: 1, // Monday is the first day of the week. + doy: 4, // The week that contains Jan 4th is the first week of the year. + }, + }); + + //! moment.js locale configuration + + var monthsShortDot$1 = 'ene._feb._mar._abr._may._jun._jul._ago._sep._oct._nov._dic.'.split( + '_' + ), + monthsShort$2 = 'ene_feb_mar_abr_may_jun_jul_ago_sep_oct_nov_dic'.split('_'), + monthsParse$3 = [ + /^ene/i, + /^feb/i, + /^mar/i, + /^abr/i, + /^may/i, + /^jun/i, + /^jul/i, + /^ago/i, + /^sep/i, + /^oct/i, + /^nov/i, + /^dic/i, + ], + monthsRegex$3 = /^(enero|febrero|marzo|abril|mayo|junio|julio|agosto|septiembre|octubre|noviembre|diciembre|ene\.?|feb\.?|mar\.?|abr\.?|may\.?|jun\.?|jul\.?|ago\.?|sep\.?|oct\.?|nov\.?|dic\.?)/i; + + moment.defineLocale('es-us', { + months: 'enero_febrero_marzo_abril_mayo_junio_julio_agosto_septiembre_octubre_noviembre_diciembre'.split( + '_' + ), + monthsShort: function (m, format) { + if (!m) { + return monthsShortDot$1; + } else if (/-MMM-/.test(format)) { + return monthsShort$2[m.month()]; + } else { + return monthsShortDot$1[m.month()]; + } + }, + monthsRegex: monthsRegex$3, + monthsShortRegex: monthsRegex$3, + monthsStrictRegex: /^(enero|febrero|marzo|abril|mayo|junio|julio|agosto|septiembre|octubre|noviembre|diciembre)/i, + monthsShortStrictRegex: /^(ene\.?|feb\.?|mar\.?|abr\.?|may\.?|jun\.?|jul\.?|ago\.?|sep\.?|oct\.?|nov\.?|dic\.?)/i, + monthsParse: monthsParse$3, + longMonthsParse: monthsParse$3, + shortMonthsParse: monthsParse$3, + weekdays: 'domingo_lunes_martes_miércoles_jueves_viernes_sábado'.split('_'), + weekdaysShort: 'dom._lun._mar._mié._jue._vie._sáb.'.split('_'), + weekdaysMin: 'do_lu_ma_mi_ju_vi_sá'.split('_'), + weekdaysParseExact: true, + longDateFormat: { + LT: 'h:mm A', + LTS: 'h:mm:ss A', + L: 'MM/DD/YYYY', + LL: 'D [de] MMMM [de] YYYY', + LLL: 'D [de] MMMM [de] YYYY h:mm A', + LLLL: 'dddd, D [de] MMMM [de] YYYY h:mm A', + }, + calendar: { + sameDay: function () { + return '[hoy a la' + (this.hours() !== 1 ? 's' : '') + '] LT'; + }, + nextDay: function () { + return '[mañana a la' + (this.hours() !== 1 ? 's' : '') + '] LT'; + }, + nextWeek: function () { + return 'dddd [a la' + (this.hours() !== 1 ? 's' : '') + '] LT'; + }, + lastDay: function () { + return '[ayer a la' + (this.hours() !== 1 ? 's' : '') + '] LT'; + }, + lastWeek: function () { + return ( + '[el] dddd [pasado a la' + + (this.hours() !== 1 ? 's' : '') + + '] LT' + ); + }, + sameElse: 'L', + }, + relativeTime: { + future: 'en %s', + past: 'hace %s', + s: 'unos segundos', + ss: '%d segundos', + m: 'un minuto', + mm: '%d minutos', + h: 'una hora', + hh: '%d horas', + d: 'un día', + dd: '%d días', + M: 'un mes', + MM: '%d meses', + y: 'un año', + yy: '%d años', + }, + dayOfMonthOrdinalParse: /\d{1,2}º/, + ordinal: '%dº', + week: { + dow: 0, // Sunday is the first day of the week. + doy: 6, // The week that contains Jan 6th is the first week of the year. + }, + }); + + //! moment.js locale configuration + + var monthsShortDot$2 = 'ene._feb._mar._abr._may._jun._jul._ago._sep._oct._nov._dic.'.split( + '_' + ), + monthsShort$3 = 'ene_feb_mar_abr_may_jun_jul_ago_sep_oct_nov_dic'.split('_'), + monthsParse$4 = [ + /^ene/i, + /^feb/i, + /^mar/i, + /^abr/i, + /^may/i, + /^jun/i, + /^jul/i, + /^ago/i, + /^sep/i, + /^oct/i, + /^nov/i, + /^dic/i, + ], + monthsRegex$4 = /^(enero|febrero|marzo|abril|mayo|junio|julio|agosto|septiembre|octubre|noviembre|diciembre|ene\.?|feb\.?|mar\.?|abr\.?|may\.?|jun\.?|jul\.?|ago\.?|sep\.?|oct\.?|nov\.?|dic\.?)/i; + + moment.defineLocale('es', { + months: 'enero_febrero_marzo_abril_mayo_junio_julio_agosto_septiembre_octubre_noviembre_diciembre'.split( + '_' + ), + monthsShort: function (m, format) { + if (!m) { + return monthsShortDot$2; + } else if (/-MMM-/.test(format)) { + return monthsShort$3[m.month()]; + } else { + return monthsShortDot$2[m.month()]; + } + }, + monthsRegex: monthsRegex$4, + monthsShortRegex: monthsRegex$4, + monthsStrictRegex: /^(enero|febrero|marzo|abril|mayo|junio|julio|agosto|septiembre|octubre|noviembre|diciembre)/i, + monthsShortStrictRegex: /^(ene\.?|feb\.?|mar\.?|abr\.?|may\.?|jun\.?|jul\.?|ago\.?|sep\.?|oct\.?|nov\.?|dic\.?)/i, + monthsParse: monthsParse$4, + longMonthsParse: monthsParse$4, + shortMonthsParse: monthsParse$4, + weekdays: 'domingo_lunes_martes_miércoles_jueves_viernes_sábado'.split('_'), + weekdaysShort: 'dom._lun._mar._mié._jue._vie._sáb.'.split('_'), + weekdaysMin: 'do_lu_ma_mi_ju_vi_sá'.split('_'), + weekdaysParseExact: true, + longDateFormat: { + LT: 'H:mm', + LTS: 'H:mm:ss', + L: 'DD/MM/YYYY', + LL: 'D [de] MMMM [de] YYYY', + LLL: 'D [de] MMMM [de] YYYY H:mm', + LLLL: 'dddd, D [de] MMMM [de] YYYY H:mm', + }, + calendar: { + sameDay: function () { + return '[hoy a la' + (this.hours() !== 1 ? 's' : '') + '] LT'; + }, + nextDay: function () { + return '[mañana a la' + (this.hours() !== 1 ? 's' : '') + '] LT'; + }, + nextWeek: function () { + return 'dddd [a la' + (this.hours() !== 1 ? 's' : '') + '] LT'; + }, + lastDay: function () { + return '[ayer a la' + (this.hours() !== 1 ? 's' : '') + '] LT'; + }, + lastWeek: function () { + return ( + '[el] dddd [pasado a la' + + (this.hours() !== 1 ? 's' : '') + + '] LT' + ); + }, + sameElse: 'L', + }, + relativeTime: { + future: 'en %s', + past: 'hace %s', + s: 'unos segundos', + ss: '%d segundos', + m: 'un minuto', + mm: '%d minutos', + h: 'una hora', + hh: '%d horas', + d: 'un día', + dd: '%d días', + M: 'un mes', + MM: '%d meses', + y: 'un año', + yy: '%d años', + }, + dayOfMonthOrdinalParse: /\d{1,2}º/, + ordinal: '%dº', + week: { + dow: 1, // Monday is the first day of the week. + doy: 4, // The week that contains Jan 4th is the first week of the year. + }, + invalidDate: 'Fecha inválida', + }); + + //! moment.js locale configuration + + function processRelativeTime$3(number, withoutSuffix, key, isFuture) { + var format = { + s: ['mõne sekundi', 'mõni sekund', 'paar sekundit'], + ss: [number + 'sekundi', number + 'sekundit'], + m: ['ühe minuti', 'üks minut'], + mm: [number + ' minuti', number + ' minutit'], + h: ['ühe tunni', 'tund aega', 'üks tund'], + hh: [number + ' tunni', number + ' tundi'], + d: ['ühe päeva', 'üks päev'], + M: ['kuu aja', 'kuu aega', 'üks kuu'], + MM: [number + ' kuu', number + ' kuud'], + y: ['ühe aasta', 'aasta', 'üks aasta'], + yy: [number + ' aasta', number + ' aastat'], + }; + if (withoutSuffix) { + return format[key][2] ? format[key][2] : format[key][1]; + } + return isFuture ? format[key][0] : format[key][1]; + } + + moment.defineLocale('et', { + months: 'jaanuar_veebruar_märts_aprill_mai_juuni_juuli_august_september_oktoober_november_detsember'.split( + '_' + ), + monthsShort: 'jaan_veebr_märts_apr_mai_juuni_juuli_aug_sept_okt_nov_dets'.split( + '_' + ), + weekdays: 'pühapäev_esmaspäev_teisipäev_kolmapäev_neljapäev_reede_laupäev'.split( + '_' + ), + weekdaysShort: 'P_E_T_K_N_R_L'.split('_'), + weekdaysMin: 'P_E_T_K_N_R_L'.split('_'), + longDateFormat: { + LT: 'H:mm', + LTS: 'H:mm:ss', + L: 'DD.MM.YYYY', + LL: 'D. MMMM YYYY', + LLL: 'D. MMMM YYYY H:mm', + LLLL: 'dddd, D. MMMM YYYY H:mm', + }, + calendar: { + sameDay: '[Täna,] LT', + nextDay: '[Homme,] LT', + nextWeek: '[Järgmine] dddd LT', + lastDay: '[Eile,] LT', + lastWeek: '[Eelmine] dddd LT', + sameElse: 'L', + }, + relativeTime: { + future: '%s pärast', + past: '%s tagasi', + s: processRelativeTime$3, + ss: processRelativeTime$3, + m: processRelativeTime$3, + mm: processRelativeTime$3, + h: processRelativeTime$3, + hh: processRelativeTime$3, + d: processRelativeTime$3, + dd: '%d päeva', + M: processRelativeTime$3, + MM: processRelativeTime$3, + y: processRelativeTime$3, + yy: processRelativeTime$3, + }, + dayOfMonthOrdinalParse: /\d{1,2}\./, + ordinal: '%d.', + week: { + dow: 1, // Monday is the first day of the week. + doy: 4, // The week that contains Jan 4th is the first week of the year. + }, + }); + + //! moment.js locale configuration + + moment.defineLocale('eu', { + months: 'urtarrila_otsaila_martxoa_apirila_maiatza_ekaina_uztaila_abuztua_iraila_urria_azaroa_abendua'.split( + '_' + ), + monthsShort: 'urt._ots._mar._api._mai._eka._uzt._abu._ira._urr._aza._abe.'.split( + '_' + ), + monthsParseExact: true, + weekdays: 'igandea_astelehena_asteartea_asteazkena_osteguna_ostirala_larunbata'.split( + '_' + ), + weekdaysShort: 'ig._al._ar._az._og._ol._lr.'.split('_'), + weekdaysMin: 'ig_al_ar_az_og_ol_lr'.split('_'), + weekdaysParseExact: true, + longDateFormat: { + LT: 'HH:mm', + LTS: 'HH:mm:ss', + L: 'YYYY-MM-DD', + LL: 'YYYY[ko] MMMM[ren] D[a]', + LLL: 'YYYY[ko] MMMM[ren] D[a] HH:mm', + LLLL: 'dddd, YYYY[ko] MMMM[ren] D[a] HH:mm', + l: 'YYYY-M-D', + ll: 'YYYY[ko] MMM D[a]', + lll: 'YYYY[ko] MMM D[a] HH:mm', + llll: 'ddd, YYYY[ko] MMM D[a] HH:mm', + }, + calendar: { + sameDay: '[gaur] LT[etan]', + nextDay: '[bihar] LT[etan]', + nextWeek: 'dddd LT[etan]', + lastDay: '[atzo] LT[etan]', + lastWeek: '[aurreko] dddd LT[etan]', + sameElse: 'L', + }, + relativeTime: { + future: '%s barru', + past: 'duela %s', + s: 'segundo batzuk', + ss: '%d segundo', + m: 'minutu bat', + mm: '%d minutu', + h: 'ordu bat', + hh: '%d ordu', + d: 'egun bat', + dd: '%d egun', + M: 'hilabete bat', + MM: '%d hilabete', + y: 'urte bat', + yy: '%d urte', + }, + dayOfMonthOrdinalParse: /\d{1,2}\./, + ordinal: '%d.', + week: { + dow: 1, // Monday is the first day of the week. + doy: 7, // The week that contains Jan 7th is the first week of the year. + }, + }); + + //! moment.js locale configuration + + var symbolMap$5 = { + '1': '۱', + '2': '۲', + '3': '۳', + '4': '۴', + '5': '۵', + '6': '۶', + '7': '۷', + '8': '۸', + '9': '۹', + '0': '۰', + }, + numberMap$4 = { + '۱': '1', + '۲': '2', + '۳': '3', + '۴': '4', + '۵': '5', + '۶': '6', + '۷': '7', + '۸': '8', + '۹': '9', + '۰': '0', + }; + + moment.defineLocale('fa', { + months: 'ژانویه_فوریه_مارس_آوریل_مه_ژوئن_ژوئیه_اوت_سپتامبر_اکتبر_نوامبر_دسامبر'.split( + '_' + ), + monthsShort: 'ژانویه_فوریه_مارس_آوریل_مه_ژوئن_ژوئیه_اوت_سپتامبر_اکتبر_نوامبر_دسامبر'.split( + '_' + ), + weekdays: 'یک\u200cشنبه_دوشنبه_سه\u200cشنبه_چهارشنبه_پنج\u200cشنبه_جمعه_شنبه'.split( + '_' + ), + weekdaysShort: 'یک\u200cشنبه_دوشنبه_سه\u200cشنبه_چهارشنبه_پنج\u200cشنبه_جمعه_شنبه'.split( + '_' + ), + weekdaysMin: 'ی_د_س_چ_پ_ج_ش'.split('_'), + weekdaysParseExact: true, + longDateFormat: { + LT: 'HH:mm', + LTS: 'HH:mm:ss', + L: 'DD/MM/YYYY', + LL: 'D MMMM YYYY', + LLL: 'D MMMM YYYY HH:mm', + LLLL: 'dddd, D MMMM YYYY HH:mm', + }, + meridiemParse: /قبل از ظهر|بعد از ظهر/, + isPM: function (input) { + return /بعد از ظهر/.test(input); + }, + meridiem: function (hour, minute, isLower) { + if (hour < 12) { + return 'قبل از ظهر'; + } else { + return 'بعد از ظهر'; + } + }, + calendar: { + sameDay: '[امروز ساعت] LT', + nextDay: '[فردا ساعت] LT', + nextWeek: 'dddd [ساعت] LT', + lastDay: '[دیروز ساعت] LT', + lastWeek: 'dddd [پیش] [ساعت] LT', + sameElse: 'L', + }, + relativeTime: { + future: 'در %s', + past: '%s پیش', + s: 'چند ثانیه', + ss: '%d ثانیه', + m: 'یک دقیقه', + mm: '%d دقیقه', + h: 'یک ساعت', + hh: '%d ساعت', + d: 'یک روز', + dd: '%d روز', + M: 'یک ماه', + MM: '%d ماه', + y: 'یک سال', + yy: '%d سال', + }, + preparse: function (string) { + return string + .replace(/[۰-۹]/g, function (match) { + return numberMap$4[match]; + }) + .replace(/،/g, ','); + }, + postformat: function (string) { + return string + .replace(/\d/g, function (match) { + return symbolMap$5[match]; + }) + .replace(/,/g, '،'); + }, + dayOfMonthOrdinalParse: /\d{1,2}م/, + ordinal: '%dم', + week: { + dow: 6, // Saturday is the first day of the week. + doy: 12, // The week that contains Jan 12th is the first week of the year. + }, + }); + + //! moment.js locale configuration + + var numbersPast = 'nolla yksi kaksi kolme neljä viisi kuusi seitsemän kahdeksan yhdeksän'.split( + ' ' + ), + numbersFuture = [ + 'nolla', + 'yhden', + 'kahden', + 'kolmen', + 'neljän', + 'viiden', + 'kuuden', + numbersPast[7], + numbersPast[8], + numbersPast[9], + ]; + function translate$2(number, withoutSuffix, key, isFuture) { + var result = ''; + switch (key) { + case 's': + return isFuture ? 'muutaman sekunnin' : 'muutama sekunti'; + case 'ss': + result = isFuture ? 'sekunnin' : 'sekuntia'; + break; + case 'm': + return isFuture ? 'minuutin' : 'minuutti'; + case 'mm': + result = isFuture ? 'minuutin' : 'minuuttia'; + break; + case 'h': + return isFuture ? 'tunnin' : 'tunti'; + case 'hh': + result = isFuture ? 'tunnin' : 'tuntia'; + break; + case 'd': + return isFuture ? 'päivän' : 'päivä'; + case 'dd': + result = isFuture ? 'päivän' : 'päivää'; + break; + case 'M': + return isFuture ? 'kuukauden' : 'kuukausi'; + case 'MM': + result = isFuture ? 'kuukauden' : 'kuukautta'; + break; + case 'y': + return isFuture ? 'vuoden' : 'vuosi'; + case 'yy': + result = isFuture ? 'vuoden' : 'vuotta'; + break; + } + result = verbalNumber(number, isFuture) + ' ' + result; + return result; + } + function verbalNumber(number, isFuture) { + return number < 10 + ? isFuture + ? numbersFuture[number] + : numbersPast[number] + : number; + } + + moment.defineLocale('fi', { + months: 'tammikuu_helmikuu_maaliskuu_huhtikuu_toukokuu_kesäkuu_heinäkuu_elokuu_syyskuu_lokakuu_marraskuu_joulukuu'.split( + '_' + ), + monthsShort: 'tammi_helmi_maalis_huhti_touko_kesä_heinä_elo_syys_loka_marras_joulu'.split( + '_' + ), + weekdays: 'sunnuntai_maanantai_tiistai_keskiviikko_torstai_perjantai_lauantai'.split( + '_' + ), + weekdaysShort: 'su_ma_ti_ke_to_pe_la'.split('_'), + weekdaysMin: 'su_ma_ti_ke_to_pe_la'.split('_'), + longDateFormat: { + LT: 'HH.mm', + LTS: 'HH.mm.ss', + L: 'DD.MM.YYYY', + LL: 'Do MMMM[ta] YYYY', + LLL: 'Do MMMM[ta] YYYY, [klo] HH.mm', + LLLL: 'dddd, Do MMMM[ta] YYYY, [klo] HH.mm', + l: 'D.M.YYYY', + ll: 'Do MMM YYYY', + lll: 'Do MMM YYYY, [klo] HH.mm', + llll: 'ddd, Do MMM YYYY, [klo] HH.mm', + }, + calendar: { + sameDay: '[tänään] [klo] LT', + nextDay: '[huomenna] [klo] LT', + nextWeek: 'dddd [klo] LT', + lastDay: '[eilen] [klo] LT', + lastWeek: '[viime] dddd[na] [klo] LT', + sameElse: 'L', + }, + relativeTime: { + future: '%s päästä', + past: '%s sitten', + s: translate$2, + ss: translate$2, + m: translate$2, + mm: translate$2, + h: translate$2, + hh: translate$2, + d: translate$2, + dd: translate$2, + M: translate$2, + MM: translate$2, + y: translate$2, + yy: translate$2, + }, + dayOfMonthOrdinalParse: /\d{1,2}\./, + ordinal: '%d.', + week: { + dow: 1, // Monday is the first day of the week. + doy: 4, // The week that contains Jan 4th is the first week of the year. + }, + }); + + //! moment.js locale configuration + + moment.defineLocale('fil', { + months: 'Enero_Pebrero_Marso_Abril_Mayo_Hunyo_Hulyo_Agosto_Setyembre_Oktubre_Nobyembre_Disyembre'.split( + '_' + ), + monthsShort: 'Ene_Peb_Mar_Abr_May_Hun_Hul_Ago_Set_Okt_Nob_Dis'.split('_'), + weekdays: 'Linggo_Lunes_Martes_Miyerkules_Huwebes_Biyernes_Sabado'.split( + '_' + ), + weekdaysShort: 'Lin_Lun_Mar_Miy_Huw_Biy_Sab'.split('_'), + weekdaysMin: 'Li_Lu_Ma_Mi_Hu_Bi_Sab'.split('_'), + longDateFormat: { + LT: 'HH:mm', + LTS: 'HH:mm:ss', + L: 'MM/D/YYYY', + LL: 'MMMM D, YYYY', + LLL: 'MMMM D, YYYY HH:mm', + LLLL: 'dddd, MMMM DD, YYYY HH:mm', + }, + calendar: { + sameDay: 'LT [ngayong araw]', + nextDay: '[Bukas ng] LT', + nextWeek: 'LT [sa susunod na] dddd', + lastDay: 'LT [kahapon]', + lastWeek: 'LT [noong nakaraang] dddd', + sameElse: 'L', + }, + relativeTime: { + future: 'sa loob ng %s', + past: '%s ang nakalipas', + s: 'ilang segundo', + ss: '%d segundo', + m: 'isang minuto', + mm: '%d minuto', + h: 'isang oras', + hh: '%d oras', + d: 'isang araw', + dd: '%d araw', + M: 'isang buwan', + MM: '%d buwan', + y: 'isang taon', + yy: '%d taon', + }, + dayOfMonthOrdinalParse: /\d{1,2}/, + ordinal: function (number) { + return number; + }, + week: { + dow: 1, // Monday is the first day of the week. + doy: 4, // The week that contains Jan 4th is the first week of the year. + }, + }); + + //! moment.js locale configuration + + moment.defineLocale('fo', { + months: 'januar_februar_mars_apríl_mai_juni_juli_august_september_oktober_november_desember'.split( + '_' + ), + monthsShort: 'jan_feb_mar_apr_mai_jun_jul_aug_sep_okt_nov_des'.split('_'), + weekdays: 'sunnudagur_mánadagur_týsdagur_mikudagur_hósdagur_fríggjadagur_leygardagur'.split( + '_' + ), + weekdaysShort: 'sun_mán_týs_mik_hós_frí_ley'.split('_'), + weekdaysMin: 'su_má_tý_mi_hó_fr_le'.split('_'), + longDateFormat: { + LT: 'HH:mm', + LTS: 'HH:mm:ss', + L: 'DD/MM/YYYY', + LL: 'D MMMM YYYY', + LLL: 'D MMMM YYYY HH:mm', + LLLL: 'dddd D. MMMM, YYYY HH:mm', + }, + calendar: { + sameDay: '[Í dag kl.] LT', + nextDay: '[Í morgin kl.] LT', + nextWeek: 'dddd [kl.] LT', + lastDay: '[Í gjár kl.] LT', + lastWeek: '[síðstu] dddd [kl] LT', + sameElse: 'L', + }, + relativeTime: { + future: 'um %s', + past: '%s síðani', + s: 'fá sekund', + ss: '%d sekundir', + m: 'ein minuttur', + mm: '%d minuttir', + h: 'ein tími', + hh: '%d tímar', + d: 'ein dagur', + dd: '%d dagar', + M: 'ein mánaður', + MM: '%d mánaðir', + y: 'eitt ár', + yy: '%d ár', + }, + dayOfMonthOrdinalParse: /\d{1,2}\./, + ordinal: '%d.', + week: { + dow: 1, // Monday is the first day of the week. + doy: 4, // The week that contains Jan 4th is the first week of the year. + }, + }); + + //! moment.js locale configuration + + moment.defineLocale('fr-ca', { + months: 'janvier_février_mars_avril_mai_juin_juillet_août_septembre_octobre_novembre_décembre'.split( + '_' + ), + monthsShort: 'janv._févr._mars_avr._mai_juin_juil._août_sept._oct._nov._déc.'.split( + '_' + ), + monthsParseExact: true, + weekdays: 'dimanche_lundi_mardi_mercredi_jeudi_vendredi_samedi'.split('_'), + weekdaysShort: 'dim._lun._mar._mer._jeu._ven._sam.'.split('_'), + weekdaysMin: 'di_lu_ma_me_je_ve_sa'.split('_'), + weekdaysParseExact: true, + longDateFormat: { + LT: 'HH:mm', + LTS: 'HH:mm:ss', + L: 'YYYY-MM-DD', + LL: 'D MMMM YYYY', + LLL: 'D MMMM YYYY HH:mm', + LLLL: 'dddd D MMMM YYYY HH:mm', + }, + calendar: { + sameDay: '[Aujourd’hui à] LT', + nextDay: '[Demain à] LT', + nextWeek: 'dddd [à] LT', + lastDay: '[Hier à] LT', + lastWeek: 'dddd [dernier à] LT', + sameElse: 'L', + }, + relativeTime: { + future: 'dans %s', + past: 'il y a %s', + s: 'quelques secondes', + ss: '%d secondes', + m: 'une minute', + mm: '%d minutes', + h: 'une heure', + hh: '%d heures', + d: 'un jour', + dd: '%d jours', + M: 'un mois', + MM: '%d mois', + y: 'un an', + yy: '%d ans', + }, + dayOfMonthOrdinalParse: /\d{1,2}(er|e)/, + ordinal: function (number, period) { + switch (period) { + // Words with masculine grammatical gender: mois, trimestre, jour + default: + case 'M': + case 'Q': + case 'D': + case 'DDD': + case 'd': + return number + (number === 1 ? 'er' : 'e'); + + // Words with feminine grammatical gender: semaine + case 'w': + case 'W': + return number + (number === 1 ? 're' : 'e'); + } + }, + }); + + //! moment.js locale configuration + + moment.defineLocale('fr-ch', { + months: 'janvier_février_mars_avril_mai_juin_juillet_août_septembre_octobre_novembre_décembre'.split( + '_' + ), + monthsShort: 'janv._févr._mars_avr._mai_juin_juil._août_sept._oct._nov._déc.'.split( + '_' + ), + monthsParseExact: true, + weekdays: 'dimanche_lundi_mardi_mercredi_jeudi_vendredi_samedi'.split('_'), + weekdaysShort: 'dim._lun._mar._mer._jeu._ven._sam.'.split('_'), + weekdaysMin: 'di_lu_ma_me_je_ve_sa'.split('_'), + weekdaysParseExact: true, + longDateFormat: { + LT: 'HH:mm', + LTS: 'HH:mm:ss', + L: 'DD.MM.YYYY', + LL: 'D MMMM YYYY', + LLL: 'D MMMM YYYY HH:mm', + LLLL: 'dddd D MMMM YYYY HH:mm', + }, + calendar: { + sameDay: '[Aujourd’hui à] LT', + nextDay: '[Demain à] LT', + nextWeek: 'dddd [à] LT', + lastDay: '[Hier à] LT', + lastWeek: 'dddd [dernier à] LT', + sameElse: 'L', + }, + relativeTime: { + future: 'dans %s', + past: 'il y a %s', + s: 'quelques secondes', + ss: '%d secondes', + m: 'une minute', + mm: '%d minutes', + h: 'une heure', + hh: '%d heures', + d: 'un jour', + dd: '%d jours', + M: 'un mois', + MM: '%d mois', + y: 'un an', + yy: '%d ans', + }, + dayOfMonthOrdinalParse: /\d{1,2}(er|e)/, + ordinal: function (number, period) { + switch (period) { + // Words with masculine grammatical gender: mois, trimestre, jour + default: + case 'M': + case 'Q': + case 'D': + case 'DDD': + case 'd': + return number + (number === 1 ? 'er' : 'e'); + + // Words with feminine grammatical gender: semaine + case 'w': + case 'W': + return number + (number === 1 ? 're' : 'e'); + } + }, + week: { + dow: 1, // Monday is the first day of the week. + doy: 4, // The week that contains Jan 4th is the first week of the year. + }, + }); + + //! moment.js locale configuration + + var monthsStrictRegex$1 = /^(janvier|février|mars|avril|mai|juin|juillet|août|septembre|octobre|novembre|décembre)/i, + monthsShortStrictRegex$1 = /(janv\.?|févr\.?|mars|avr\.?|mai|juin|juil\.?|août|sept\.?|oct\.?|nov\.?|déc\.?)/i, + monthsRegex$5 = /(janv\.?|févr\.?|mars|avr\.?|mai|juin|juil\.?|août|sept\.?|oct\.?|nov\.?|déc\.?|janvier|février|mars|avril|mai|juin|juillet|août|septembre|octobre|novembre|décembre)/i, + monthsParse$5 = [ + /^janv/i, + /^févr/i, + /^mars/i, + /^avr/i, + /^mai/i, + /^juin/i, + /^juil/i, + /^août/i, + /^sept/i, + /^oct/i, + /^nov/i, + /^déc/i, + ]; + + moment.defineLocale('fr', { + months: 'janvier_février_mars_avril_mai_juin_juillet_août_septembre_octobre_novembre_décembre'.split( + '_' + ), + monthsShort: 'janv._févr._mars_avr._mai_juin_juil._août_sept._oct._nov._déc.'.split( + '_' + ), + monthsRegex: monthsRegex$5, + monthsShortRegex: monthsRegex$5, + monthsStrictRegex: monthsStrictRegex$1, + monthsShortStrictRegex: monthsShortStrictRegex$1, + monthsParse: monthsParse$5, + longMonthsParse: monthsParse$5, + shortMonthsParse: monthsParse$5, + weekdays: 'dimanche_lundi_mardi_mercredi_jeudi_vendredi_samedi'.split('_'), + weekdaysShort: 'dim._lun._mar._mer._jeu._ven._sam.'.split('_'), + weekdaysMin: 'di_lu_ma_me_je_ve_sa'.split('_'), + weekdaysParseExact: true, + longDateFormat: { + LT: 'HH:mm', + LTS: 'HH:mm:ss', + L: 'DD/MM/YYYY', + LL: 'D MMMM YYYY', + LLL: 'D MMMM YYYY HH:mm', + LLLL: 'dddd D MMMM YYYY HH:mm', + }, + calendar: { + sameDay: '[Aujourd’hui à] LT', + nextDay: '[Demain à] LT', + nextWeek: 'dddd [à] LT', + lastDay: '[Hier à] LT', + lastWeek: 'dddd [dernier à] LT', + sameElse: 'L', + }, + relativeTime: { + future: 'dans %s', + past: 'il y a %s', + s: 'quelques secondes', + ss: '%d secondes', + m: 'une minute', + mm: '%d minutes', + h: 'une heure', + hh: '%d heures', + d: 'un jour', + dd: '%d jours', + M: 'un mois', + MM: '%d mois', + y: 'un an', + yy: '%d ans', + }, + dayOfMonthOrdinalParse: /\d{1,2}(er|)/, + ordinal: function (number, period) { + switch (period) { + // TODO: Return 'e' when day of month > 1. Move this case inside + // block for masculine words below. + // See https://github.com/moment/moment/issues/3375 + case 'D': + return number + (number === 1 ? 'er' : ''); + + // Words with masculine grammatical gender: mois, trimestre, jour + default: + case 'M': + case 'Q': + case 'DDD': + case 'd': + return number + (number === 1 ? 'er' : 'e'); + + // Words with feminine grammatical gender: semaine + case 'w': + case 'W': + return number + (number === 1 ? 're' : 'e'); + } + }, + week: { + dow: 1, // Monday is the first day of the week. + doy: 4, // The week that contains Jan 4th is the first week of the year. + }, + }); + + //! moment.js locale configuration + + var monthsShortWithDots = 'jan._feb._mrt._apr._mai_jun._jul._aug._sep._okt._nov._des.'.split( + '_' + ), + monthsShortWithoutDots = 'jan_feb_mrt_apr_mai_jun_jul_aug_sep_okt_nov_des'.split( + '_' + ); + + moment.defineLocale('fy', { + months: 'jannewaris_febrewaris_maart_april_maaie_juny_july_augustus_septimber_oktober_novimber_desimber'.split( + '_' + ), + monthsShort: function (m, format) { + if (!m) { + return monthsShortWithDots; + } else if (/-MMM-/.test(format)) { + return monthsShortWithoutDots[m.month()]; + } else { + return monthsShortWithDots[m.month()]; + } + }, + monthsParseExact: true, + weekdays: 'snein_moandei_tiisdei_woansdei_tongersdei_freed_sneon'.split( + '_' + ), + weekdaysShort: 'si._mo._ti._wo._to._fr._so.'.split('_'), + weekdaysMin: 'Si_Mo_Ti_Wo_To_Fr_So'.split('_'), + weekdaysParseExact: true, + longDateFormat: { + LT: 'HH:mm', + LTS: 'HH:mm:ss', + L: 'DD-MM-YYYY', + LL: 'D MMMM YYYY', + LLL: 'D MMMM YYYY HH:mm', + LLLL: 'dddd D MMMM YYYY HH:mm', + }, + calendar: { + sameDay: '[hjoed om] LT', + nextDay: '[moarn om] LT', + nextWeek: 'dddd [om] LT', + lastDay: '[juster om] LT', + lastWeek: '[ôfrûne] dddd [om] LT', + sameElse: 'L', + }, + relativeTime: { + future: 'oer %s', + past: '%s lyn', + s: 'in pear sekonden', + ss: '%d sekonden', + m: 'ien minút', + mm: '%d minuten', + h: 'ien oere', + hh: '%d oeren', + d: 'ien dei', + dd: '%d dagen', + M: 'ien moanne', + MM: '%d moannen', + y: 'ien jier', + yy: '%d jierren', + }, + dayOfMonthOrdinalParse: /\d{1,2}(ste|de)/, + ordinal: function (number) { + return ( + number + + (number === 1 || number === 8 || number >= 20 ? 'ste' : 'de') + ); + }, + week: { + dow: 1, // Monday is the first day of the week. + doy: 4, // The week that contains Jan 4th is the first week of the year. + }, + }); + + //! moment.js locale configuration + + var months$5 = [ + 'Eanáir', + 'Feabhra', + 'Márta', + 'Aibreán', + 'Bealtaine', + 'Meitheamh', + 'Iúil', + 'Lúnasa', + 'Meán Fómhair', + 'Deireadh Fómhair', + 'Samhain', + 'Nollaig', + ], + monthsShort$4 = [ + 'Ean', + 'Feabh', + 'Márt', + 'Aib', + 'Beal', + 'Meith', + 'Iúil', + 'Lún', + 'M.F.', + 'D.F.', + 'Samh', + 'Noll', + ], + weekdays$1 = [ + 'Dé Domhnaigh', + 'Dé Luain', + 'Dé Máirt', + 'Dé Céadaoin', + 'Déardaoin', + 'Dé hAoine', + 'Dé Sathairn', + ], + weekdaysShort = ['Domh', 'Luan', 'Máirt', 'Céad', 'Déar', 'Aoine', 'Sath'], + weekdaysMin = ['Do', 'Lu', 'Má', 'Cé', 'Dé', 'A', 'Sa']; + + moment.defineLocale('ga', { + months: months$5, + monthsShort: monthsShort$4, + monthsParseExact: true, + weekdays: weekdays$1, + weekdaysShort: weekdaysShort, + weekdaysMin: weekdaysMin, + longDateFormat: { + LT: 'HH:mm', + LTS: 'HH:mm:ss', + L: 'DD/MM/YYYY', + LL: 'D MMMM YYYY', + LLL: 'D MMMM YYYY HH:mm', + LLLL: 'dddd, D MMMM YYYY HH:mm', + }, + calendar: { + sameDay: '[Inniu ag] LT', + nextDay: '[Amárach ag] LT', + nextWeek: 'dddd [ag] LT', + lastDay: '[Inné ag] LT', + lastWeek: 'dddd [seo caite] [ag] LT', + sameElse: 'L', + }, + relativeTime: { + future: 'i %s', + past: '%s ó shin', + s: 'cúpla soicind', + ss: '%d soicind', + m: 'nóiméad', + mm: '%d nóiméad', + h: 'uair an chloig', + hh: '%d uair an chloig', + d: 'lá', + dd: '%d lá', + M: 'mí', + MM: '%d míonna', + y: 'bliain', + yy: '%d bliain', + }, + dayOfMonthOrdinalParse: /\d{1,2}(d|na|mh)/, + ordinal: function (number) { + var output = number === 1 ? 'd' : number % 10 === 2 ? 'na' : 'mh'; + return number + output; + }, + week: { + dow: 1, // Monday is the first day of the week. + doy: 4, // The week that contains Jan 4th is the first week of the year. + }, + }); + + //! moment.js locale configuration + + var months$6 = [ + 'Am Faoilleach', + 'An Gearran', + 'Am Màrt', + 'An Giblean', + 'An Cèitean', + 'An t-Ògmhios', + 'An t-Iuchar', + 'An Lùnastal', + 'An t-Sultain', + 'An Dàmhair', + 'An t-Samhain', + 'An Dùbhlachd', + ], + monthsShort$5 = [ + 'Faoi', + 'Gear', + 'Màrt', + 'Gibl', + 'Cèit', + 'Ògmh', + 'Iuch', + 'Lùn', + 'Sult', + 'Dàmh', + 'Samh', + 'Dùbh', + ], + weekdays$2 = [ + 'Didòmhnaich', + 'Diluain', + 'Dimàirt', + 'Diciadain', + 'Diardaoin', + 'Dihaoine', + 'Disathairne', + ], + weekdaysShort$1 = ['Did', 'Dil', 'Dim', 'Dic', 'Dia', 'Dih', 'Dis'], + weekdaysMin$1 = ['Dò', 'Lu', 'Mà', 'Ci', 'Ar', 'Ha', 'Sa']; + + moment.defineLocale('gd', { + months: months$6, + monthsShort: monthsShort$5, + monthsParseExact: true, + weekdays: weekdays$2, + weekdaysShort: weekdaysShort$1, + weekdaysMin: weekdaysMin$1, + longDateFormat: { + LT: 'HH:mm', + LTS: 'HH:mm:ss', + L: 'DD/MM/YYYY', + LL: 'D MMMM YYYY', + LLL: 'D MMMM YYYY HH:mm', + LLLL: 'dddd, D MMMM YYYY HH:mm', + }, + calendar: { + sameDay: '[An-diugh aig] LT', + nextDay: '[A-màireach aig] LT', + nextWeek: 'dddd [aig] LT', + lastDay: '[An-dè aig] LT', + lastWeek: 'dddd [seo chaidh] [aig] LT', + sameElse: 'L', + }, + relativeTime: { + future: 'ann an %s', + past: 'bho chionn %s', + s: 'beagan diogan', + ss: '%d diogan', + m: 'mionaid', + mm: '%d mionaidean', + h: 'uair', + hh: '%d uairean', + d: 'latha', + dd: '%d latha', + M: 'mìos', + MM: '%d mìosan', + y: 'bliadhna', + yy: '%d bliadhna', + }, + dayOfMonthOrdinalParse: /\d{1,2}(d|na|mh)/, + ordinal: function (number) { + var output = number === 1 ? 'd' : number % 10 === 2 ? 'na' : 'mh'; + return number + output; + }, + week: { + dow: 1, // Monday is the first day of the week. + doy: 4, // The week that contains Jan 4th is the first week of the year. + }, + }); + + //! moment.js locale configuration + + moment.defineLocale('gl', { + months: 'xaneiro_febreiro_marzo_abril_maio_xuño_xullo_agosto_setembro_outubro_novembro_decembro'.split( + '_' + ), + monthsShort: 'xan._feb._mar._abr._mai._xuñ._xul._ago._set._out._nov._dec.'.split( + '_' + ), + monthsParseExact: true, + weekdays: 'domingo_luns_martes_mércores_xoves_venres_sábado'.split('_'), + weekdaysShort: 'dom._lun._mar._mér._xov._ven._sáb.'.split('_'), + weekdaysMin: 'do_lu_ma_mé_xo_ve_sá'.split('_'), + weekdaysParseExact: true, + longDateFormat: { + LT: 'H:mm', + LTS: 'H:mm:ss', + L: 'DD/MM/YYYY', + LL: 'D [de] MMMM [de] YYYY', + LLL: 'D [de] MMMM [de] YYYY H:mm', + LLLL: 'dddd, D [de] MMMM [de] YYYY H:mm', + }, + calendar: { + sameDay: function () { + return '[hoxe ' + (this.hours() !== 1 ? 'ás' : 'á') + '] LT'; + }, + nextDay: function () { + return '[mañá ' + (this.hours() !== 1 ? 'ás' : 'á') + '] LT'; + }, + nextWeek: function () { + return 'dddd [' + (this.hours() !== 1 ? 'ás' : 'a') + '] LT'; + }, + lastDay: function () { + return '[onte ' + (this.hours() !== 1 ? 'á' : 'a') + '] LT'; + }, + lastWeek: function () { + return ( + '[o] dddd [pasado ' + (this.hours() !== 1 ? 'ás' : 'a') + '] LT' + ); + }, + sameElse: 'L', + }, + relativeTime: { + future: function (str) { + if (str.indexOf('un') === 0) { + return 'n' + str; + } + return 'en ' + str; + }, + past: 'hai %s', + s: 'uns segundos', + ss: '%d segundos', + m: 'un minuto', + mm: '%d minutos', + h: 'unha hora', + hh: '%d horas', + d: 'un día', + dd: '%d días', + M: 'un mes', + MM: '%d meses', + y: 'un ano', + yy: '%d anos', + }, + dayOfMonthOrdinalParse: /\d{1,2}º/, + ordinal: '%dº', + week: { + dow: 1, // Monday is the first day of the week. + doy: 4, // The week that contains Jan 4th is the first week of the year. + }, + }); + + //! moment.js locale configuration + + function processRelativeTime$4(number, withoutSuffix, key, isFuture) { + var format = { + s: ['थोडया सॅकंडांनी', 'थोडे सॅकंड'], + ss: [number + ' सॅकंडांनी', number + ' सॅकंड'], + m: ['एका मिणटान', 'एक मिनूट'], + mm: [number + ' मिणटांनी', number + ' मिणटां'], + h: ['एका वरान', 'एक वर'], + hh: [number + ' वरांनी', number + ' वरां'], + d: ['एका दिसान', 'एक दीस'], + dd: [number + ' दिसांनी', number + ' दीस'], + M: ['एका म्हयन्यान', 'एक म्हयनो'], + MM: [number + ' म्हयन्यानी', number + ' म्हयने'], + y: ['एका वर्सान', 'एक वर्स'], + yy: [number + ' वर्सांनी', number + ' वर्सां'], + }; + return isFuture ? format[key][0] : format[key][1]; + } + + moment.defineLocale('gom-deva', { + months: { + standalone: 'जानेवारी_फेब्रुवारी_मार्च_एप्रील_मे_जून_जुलय_ऑगस्ट_सप्टेंबर_ऑक्टोबर_नोव्हेंबर_डिसेंबर'.split( + '_' + ), + format: 'जानेवारीच्या_फेब्रुवारीच्या_मार्चाच्या_एप्रीलाच्या_मेयाच्या_जूनाच्या_जुलयाच्या_ऑगस्टाच्या_सप्टेंबराच्या_ऑक्टोबराच्या_नोव्हेंबराच्या_डिसेंबराच्या'.split( + '_' + ), + isFormat: /MMMM(\s)+D[oD]?/, + }, + monthsShort: 'जाने._फेब्रु._मार्च_एप्री._मे_जून_जुल._ऑग._सप्टें._ऑक्टो._नोव्हें._डिसें.'.split( + '_' + ), + monthsParseExact: true, + weekdays: 'आयतार_सोमार_मंगळार_बुधवार_बिरेस्तार_सुक्रार_शेनवार'.split('_'), + weekdaysShort: 'आयत._सोम._मंगळ._बुध._ब्रेस्त._सुक्र._शेन.'.split('_'), + weekdaysMin: 'आ_सो_मं_बु_ब्रे_सु_शे'.split('_'), + weekdaysParseExact: true, + longDateFormat: { + LT: 'A h:mm [वाजतां]', + LTS: 'A h:mm:ss [वाजतां]', + L: 'DD-MM-YYYY', + LL: 'D MMMM YYYY', + LLL: 'D MMMM YYYY A h:mm [वाजतां]', + LLLL: 'dddd, MMMM Do, YYYY, A h:mm [वाजतां]', + llll: 'ddd, D MMM YYYY, A h:mm [वाजतां]', + }, + calendar: { + sameDay: '[आयज] LT', + nextDay: '[फाल्यां] LT', + nextWeek: '[फुडलो] dddd[,] LT', + lastDay: '[काल] LT', + lastWeek: '[फाटलो] dddd[,] LT', + sameElse: 'L', + }, + relativeTime: { + future: '%s', + past: '%s आदीं', + s: processRelativeTime$4, + ss: processRelativeTime$4, + m: processRelativeTime$4, + mm: processRelativeTime$4, + h: processRelativeTime$4, + hh: processRelativeTime$4, + d: processRelativeTime$4, + dd: processRelativeTime$4, + M: processRelativeTime$4, + MM: processRelativeTime$4, + y: processRelativeTime$4, + yy: processRelativeTime$4, + }, + dayOfMonthOrdinalParse: /\d{1,2}(वेर)/, + ordinal: function (number, period) { + switch (period) { + // the ordinal 'वेर' only applies to day of the month + case 'D': + return number + 'वेर'; + default: + case 'M': + case 'Q': + case 'DDD': + case 'd': + case 'w': + case 'W': + return number; + } + }, + week: { + dow: 0, // Sunday is the first day of the week + doy: 3, // The week that contains Jan 4th is the first week of the year (7 + 0 - 4) + }, + meridiemParse: /राती|सकाळीं|दनपारां|सांजे/, + meridiemHour: function (hour, meridiem) { + if (hour === 12) { + hour = 0; + } + if (meridiem === 'राती') { + return hour < 4 ? hour : hour + 12; + } else if (meridiem === 'सकाळीं') { + return hour; + } else if (meridiem === 'दनपारां') { + return hour > 12 ? hour : hour + 12; + } else if (meridiem === 'सांजे') { + return hour + 12; + } + }, + meridiem: function (hour, minute, isLower) { + if (hour < 4) { + return 'राती'; + } else if (hour < 12) { + return 'सकाळीं'; + } else if (hour < 16) { + return 'दनपारां'; + } else if (hour < 20) { + return 'सांजे'; + } else { + return 'राती'; + } + }, + }); + + //! moment.js locale configuration + + function processRelativeTime$5(number, withoutSuffix, key, isFuture) { + var format = { + s: ['thoddea sekondamni', 'thodde sekond'], + ss: [number + ' sekondamni', number + ' sekond'], + m: ['eka mintan', 'ek minut'], + mm: [number + ' mintamni', number + ' mintam'], + h: ['eka voran', 'ek vor'], + hh: [number + ' voramni', number + ' voram'], + d: ['eka disan', 'ek dis'], + dd: [number + ' disamni', number + ' dis'], + M: ['eka mhoinean', 'ek mhoino'], + MM: [number + ' mhoineamni', number + ' mhoine'], + y: ['eka vorsan', 'ek voros'], + yy: [number + ' vorsamni', number + ' vorsam'], + }; + return isFuture ? format[key][0] : format[key][1]; + } + + moment.defineLocale('gom-latn', { + months: { + standalone: 'Janer_Febrer_Mars_Abril_Mai_Jun_Julai_Agost_Setembr_Otubr_Novembr_Dezembr'.split( + '_' + ), + format: 'Janerachea_Febrerachea_Marsachea_Abrilachea_Maiachea_Junachea_Julaiachea_Agostachea_Setembrachea_Otubrachea_Novembrachea_Dezembrachea'.split( + '_' + ), + isFormat: /MMMM(\s)+D[oD]?/, + }, + monthsShort: 'Jan._Feb._Mars_Abr._Mai_Jun_Jul._Ago._Set._Otu._Nov._Dez.'.split( + '_' + ), + monthsParseExact: true, + weekdays: "Aitar_Somar_Mongllar_Budhvar_Birestar_Sukrar_Son'var".split('_'), + weekdaysShort: 'Ait._Som._Mon._Bud._Bre._Suk._Son.'.split('_'), + weekdaysMin: 'Ai_Sm_Mo_Bu_Br_Su_Sn'.split('_'), + weekdaysParseExact: true, + longDateFormat: { + LT: 'A h:mm [vazta]', + LTS: 'A h:mm:ss [vazta]', + L: 'DD-MM-YYYY', + LL: 'D MMMM YYYY', + LLL: 'D MMMM YYYY A h:mm [vazta]', + LLLL: 'dddd, MMMM Do, YYYY, A h:mm [vazta]', + llll: 'ddd, D MMM YYYY, A h:mm [vazta]', + }, + calendar: { + sameDay: '[Aiz] LT', + nextDay: '[Faleam] LT', + nextWeek: '[Fuddlo] dddd[,] LT', + lastDay: '[Kal] LT', + lastWeek: '[Fattlo] dddd[,] LT', + sameElse: 'L', + }, + relativeTime: { + future: '%s', + past: '%s adim', + s: processRelativeTime$5, + ss: processRelativeTime$5, + m: processRelativeTime$5, + mm: processRelativeTime$5, + h: processRelativeTime$5, + hh: processRelativeTime$5, + d: processRelativeTime$5, + dd: processRelativeTime$5, + M: processRelativeTime$5, + MM: processRelativeTime$5, + y: processRelativeTime$5, + yy: processRelativeTime$5, + }, + dayOfMonthOrdinalParse: /\d{1,2}(er)/, + ordinal: function (number, period) { + switch (period) { + // the ordinal 'er' only applies to day of the month + case 'D': + return number + 'er'; + default: + case 'M': + case 'Q': + case 'DDD': + case 'd': + case 'w': + case 'W': + return number; + } + }, + week: { + dow: 0, // Sunday is the first day of the week + doy: 3, // The week that contains Jan 4th is the first week of the year (7 + 0 - 4) + }, + meridiemParse: /rati|sokallim|donparam|sanje/, + meridiemHour: function (hour, meridiem) { + if (hour === 12) { + hour = 0; + } + if (meridiem === 'rati') { + return hour < 4 ? hour : hour + 12; + } else if (meridiem === 'sokallim') { + return hour; + } else if (meridiem === 'donparam') { + return hour > 12 ? hour : hour + 12; + } else if (meridiem === 'sanje') { + return hour + 12; + } + }, + meridiem: function (hour, minute, isLower) { + if (hour < 4) { + return 'rati'; + } else if (hour < 12) { + return 'sokallim'; + } else if (hour < 16) { + return 'donparam'; + } else if (hour < 20) { + return 'sanje'; + } else { + return 'rati'; + } + }, + }); + + //! moment.js locale configuration + + var symbolMap$6 = { + '1': '૧', + '2': '૨', + '3': '૩', + '4': '૪', + '5': '૫', + '6': '૬', + '7': '૭', + '8': '૮', + '9': '૯', + '0': '૦', + }, + numberMap$5 = { + '૧': '1', + '૨': '2', + '૩': '3', + '૪': '4', + '૫': '5', + '૬': '6', + '૭': '7', + '૮': '8', + '૯': '9', + '૦': '0', + }; + + moment.defineLocale('gu', { + months: 'જાન્યુઆરી_ફેબ્રુઆરી_માર્ચ_એપ્રિલ_મે_જૂન_જુલાઈ_ઑગસ્ટ_સપ્ટેમ્બર_ઑક્ટ્બર_નવેમ્બર_ડિસેમ્બર'.split( + '_' + ), + monthsShort: 'જાન્યુ._ફેબ્રુ._માર્ચ_એપ્રિ._મે_જૂન_જુલા._ઑગ._સપ્ટે._ઑક્ટ્._નવે._ડિસે.'.split( + '_' + ), + monthsParseExact: true, + weekdays: 'રવિવાર_સોમવાર_મંગળવાર_બુધ્વાર_ગુરુવાર_શુક્રવાર_શનિવાર'.split( + '_' + ), + weekdaysShort: 'રવિ_સોમ_મંગળ_બુધ્_ગુરુ_શુક્ર_શનિ'.split('_'), + weekdaysMin: 'ર_સો_મં_બુ_ગુ_શુ_શ'.split('_'), + longDateFormat: { + LT: 'A h:mm વાગ્યે', + LTS: 'A h:mm:ss વાગ્યે', + L: 'DD/MM/YYYY', + LL: 'D MMMM YYYY', + LLL: 'D MMMM YYYY, A h:mm વાગ્યે', + LLLL: 'dddd, D MMMM YYYY, A h:mm વાગ્યે', + }, + calendar: { + sameDay: '[આજ] LT', + nextDay: '[કાલે] LT', + nextWeek: 'dddd, LT', + lastDay: '[ગઇકાલે] LT', + lastWeek: '[પાછલા] dddd, LT', + sameElse: 'L', + }, + relativeTime: { + future: '%s મા', + past: '%s પહેલા', + s: 'અમુક પળો', + ss: '%d સેકંડ', + m: 'એક મિનિટ', + mm: '%d મિનિટ', + h: 'એક કલાક', + hh: '%d કલાક', + d: 'એક દિવસ', + dd: '%d દિવસ', + M: 'એક મહિનો', + MM: '%d મહિનો', + y: 'એક વર્ષ', + yy: '%d વર્ષ', + }, + preparse: function (string) { + return string.replace(/[૧૨૩૪૫૬૭૮૯૦]/g, function (match) { + return numberMap$5[match]; + }); + }, + postformat: function (string) { + return string.replace(/\d/g, function (match) { + return symbolMap$6[match]; + }); + }, + // Gujarati notation for meridiems are quite fuzzy in practice. While there exists + // a rigid notion of a 'Pahar' it is not used as rigidly in modern Gujarati. + meridiemParse: /રાત|બપોર|સવાર|સાંજ/, + meridiemHour: function (hour, meridiem) { + if (hour === 12) { + hour = 0; + } + if (meridiem === 'રાત') { + return hour < 4 ? hour : hour + 12; + } else if (meridiem === 'સવાર') { + return hour; + } else if (meridiem === 'બપોર') { + return hour >= 10 ? hour : hour + 12; + } else if (meridiem === 'સાંજ') { + return hour + 12; + } + }, + meridiem: function (hour, minute, isLower) { + if (hour < 4) { + return 'રાત'; + } else if (hour < 10) { + return 'સવાર'; + } else if (hour < 17) { + return 'બપોર'; + } else if (hour < 20) { + return 'સાંજ'; + } else { + return 'રાત'; + } + }, + week: { + dow: 0, // Sunday is the first day of the week. + doy: 6, // The week that contains Jan 6th is the first week of the year. + }, + }); + + //! moment.js locale configuration + + moment.defineLocale('he', { + months: 'ינואר_פברואר_מרץ_אפריל_מאי_יוני_יולי_אוגוסט_ספטמבר_אוקטובר_נובמבר_דצמבר'.split( + '_' + ), + monthsShort: 'ינו׳_פבר׳_מרץ_אפר׳_מאי_יוני_יולי_אוג׳_ספט׳_אוק׳_נוב׳_דצמ׳'.split( + '_' + ), + weekdays: 'ראשון_שני_שלישי_רביעי_חמישי_שישי_שבת'.split('_'), + weekdaysShort: 'א׳_ב׳_ג׳_ד׳_ה׳_ו׳_ש׳'.split('_'), + weekdaysMin: 'א_ב_ג_ד_ה_ו_ש'.split('_'), + longDateFormat: { + LT: 'HH:mm', + LTS: 'HH:mm:ss', + L: 'DD/MM/YYYY', + LL: 'D [ב]MMMM YYYY', + LLL: 'D [ב]MMMM YYYY HH:mm', + LLLL: 'dddd, D [ב]MMMM YYYY HH:mm', + l: 'D/M/YYYY', + ll: 'D MMM YYYY', + lll: 'D MMM YYYY HH:mm', + llll: 'ddd, D MMM YYYY HH:mm', + }, + calendar: { + sameDay: '[היום ב־]LT', + nextDay: '[מחר ב־]LT', + nextWeek: 'dddd [בשעה] LT', + lastDay: '[אתמול ב־]LT', + lastWeek: '[ביום] dddd [האחרון בשעה] LT', + sameElse: 'L', + }, + relativeTime: { + future: 'בעוד %s', + past: 'לפני %s', + s: 'מספר שניות', + ss: '%d שניות', + m: 'דקה', + mm: '%d דקות', + h: 'שעה', + hh: function (number) { + if (number === 2) { + return 'שעתיים'; + } + return number + ' שעות'; + }, + d: 'יום', + dd: function (number) { + if (number === 2) { + return 'יומיים'; + } + return number + ' ימים'; + }, + M: 'חודש', + MM: function (number) { + if (number === 2) { + return 'חודשיים'; + } + return number + ' חודשים'; + }, + y: 'שנה', + yy: function (number) { + if (number === 2) { + return 'שנתיים'; + } else if (number % 10 === 0 && number !== 10) { + return number + ' שנה'; + } + return number + ' שנים'; + }, + }, + meridiemParse: /אחה"צ|לפנה"צ|אחרי הצהריים|לפני הצהריים|לפנות בוקר|בבוקר|בערב/i, + isPM: function (input) { + return /^(אחה"צ|אחרי הצהריים|בערב)$/.test(input); + }, + meridiem: function (hour, minute, isLower) { + if (hour < 5) { + return 'לפנות בוקר'; + } else if (hour < 10) { + return 'בבוקר'; + } else if (hour < 12) { + return isLower ? 'לפנה"צ' : 'לפני הצהריים'; + } else if (hour < 18) { + return isLower ? 'אחה"צ' : 'אחרי הצהריים'; + } else { + return 'בערב'; + } + }, + }); + + //! moment.js locale configuration + + var symbolMap$7 = { + '1': '१', + '2': '२', + '3': '३', + '4': '४', + '5': '५', + '6': '६', + '7': '७', + '8': '८', + '9': '९', + '0': '०', + }, + numberMap$6 = { + '१': '1', + '२': '2', + '३': '3', + '४': '4', + '५': '5', + '६': '6', + '७': '7', + '८': '8', + '९': '9', + '०': '0', + }; + + moment.defineLocale('hi', { + months: 'जनवरी_फ़रवरी_मार्च_अप्रैल_मई_जून_जुलाई_अगस्त_सितम्बर_अक्टूबर_नवम्बर_दिसम्बर'.split( + '_' + ), + monthsShort: 'जन._फ़र._मार्च_अप्रै._मई_जून_जुल._अग._सित._अक्टू._नव._दिस.'.split( + '_' + ), + monthsParseExact: true, + weekdays: 'रविवार_सोमवार_मंगलवार_बुधवार_गुरूवार_शुक्रवार_शनिवार'.split('_'), + weekdaysShort: 'रवि_सोम_मंगल_बुध_गुरू_शुक्र_शनि'.split('_'), + weekdaysMin: 'र_सो_मं_बु_गु_शु_श'.split('_'), + longDateFormat: { + LT: 'A h:mm बजे', + LTS: 'A h:mm:ss बजे', + L: 'DD/MM/YYYY', + LL: 'D MMMM YYYY', + LLL: 'D MMMM YYYY, A h:mm बजे', + LLLL: 'dddd, D MMMM YYYY, A h:mm बजे', + }, + calendar: { + sameDay: '[आज] LT', + nextDay: '[कल] LT', + nextWeek: 'dddd, LT', + lastDay: '[कल] LT', + lastWeek: '[पिछले] dddd, LT', + sameElse: 'L', + }, + relativeTime: { + future: '%s में', + past: '%s पहले', + s: 'कुछ ही क्षण', + ss: '%d सेकंड', + m: 'एक मिनट', + mm: '%d मिनट', + h: 'एक घंटा', + hh: '%d घंटे', + d: 'एक दिन', + dd: '%d दिन', + M: 'एक महीने', + MM: '%d महीने', + y: 'एक वर्ष', + yy: '%d वर्ष', + }, + preparse: function (string) { + return string.replace(/[१२३४५६७८९०]/g, function (match) { + return numberMap$6[match]; + }); + }, + postformat: function (string) { + return string.replace(/\d/g, function (match) { + return symbolMap$7[match]; + }); + }, + // Hindi notation for meridiems are quite fuzzy in practice. While there exists + // a rigid notion of a 'Pahar' it is not used as rigidly in modern Hindi. + meridiemParse: /रात|सुबह|दोपहर|शाम/, + meridiemHour: function (hour, meridiem) { + if (hour === 12) { + hour = 0; + } + if (meridiem === 'रात') { + return hour < 4 ? hour : hour + 12; + } else if (meridiem === 'सुबह') { + return hour; + } else if (meridiem === 'दोपहर') { + return hour >= 10 ? hour : hour + 12; + } else if (meridiem === 'शाम') { + return hour + 12; + } + }, + meridiem: function (hour, minute, isLower) { + if (hour < 4) { + return 'रात'; + } else if (hour < 10) { + return 'सुबह'; + } else if (hour < 17) { + return 'दोपहर'; + } else if (hour < 20) { + return 'शाम'; + } else { + return 'रात'; + } + }, + week: { + dow: 0, // Sunday is the first day of the week. + doy: 6, // The week that contains Jan 6th is the first week of the year. + }, + }); + + //! moment.js locale configuration + + function translate$3(number, withoutSuffix, key) { + var result = number + ' '; + switch (key) { + case 'ss': + if (number === 1) { + result += 'sekunda'; + } else if (number === 2 || number === 3 || number === 4) { + result += 'sekunde'; + } else { + result += 'sekundi'; + } + return result; + case 'm': + return withoutSuffix ? 'jedna minuta' : 'jedne minute'; + case 'mm': + if (number === 1) { + result += 'minuta'; + } else if (number === 2 || number === 3 || number === 4) { + result += 'minute'; + } else { + result += 'minuta'; + } + return result; + case 'h': + return withoutSuffix ? 'jedan sat' : 'jednog sata'; + case 'hh': + if (number === 1) { + result += 'sat'; + } else if (number === 2 || number === 3 || number === 4) { + result += 'sata'; + } else { + result += 'sati'; + } + return result; + case 'dd': + if (number === 1) { + result += 'dan'; + } else { + result += 'dana'; + } + return result; + case 'MM': + if (number === 1) { + result += 'mjesec'; + } else if (number === 2 || number === 3 || number === 4) { + result += 'mjeseca'; + } else { + result += 'mjeseci'; + } + return result; + case 'yy': + if (number === 1) { + result += 'godina'; + } else if (number === 2 || number === 3 || number === 4) { + result += 'godine'; + } else { + result += 'godina'; + } + return result; + } + } + + moment.defineLocale('hr', { + months: { + format: 'siječnja_veljače_ožujka_travnja_svibnja_lipnja_srpnja_kolovoza_rujna_listopada_studenoga_prosinca'.split( + '_' + ), + standalone: 'siječanj_veljača_ožujak_travanj_svibanj_lipanj_srpanj_kolovoz_rujan_listopad_studeni_prosinac'.split( + '_' + ), + }, + monthsShort: 'sij._velj._ožu._tra._svi._lip._srp._kol._ruj._lis._stu._pro.'.split( + '_' + ), + monthsParseExact: true, + weekdays: 'nedjelja_ponedjeljak_utorak_srijeda_četvrtak_petak_subota'.split( + '_' + ), + weekdaysShort: 'ned._pon._uto._sri._čet._pet._sub.'.split('_'), + weekdaysMin: 'ne_po_ut_sr_če_pe_su'.split('_'), + weekdaysParseExact: true, + longDateFormat: { + LT: 'H:mm', + LTS: 'H:mm:ss', + L: 'DD.MM.YYYY', + LL: 'Do MMMM YYYY', + LLL: 'Do MMMM YYYY H:mm', + LLLL: 'dddd, Do MMMM YYYY H:mm', + }, + calendar: { + sameDay: '[danas u] LT', + nextDay: '[sutra u] LT', + nextWeek: function () { + switch (this.day()) { + case 0: + return '[u] [nedjelju] [u] LT'; + case 3: + return '[u] [srijedu] [u] LT'; + case 6: + return '[u] [subotu] [u] LT'; + case 1: + case 2: + case 4: + case 5: + return '[u] dddd [u] LT'; + } + }, + lastDay: '[jučer u] LT', + lastWeek: function () { + switch (this.day()) { + case 0: + return '[prošlu] [nedjelju] [u] LT'; + case 3: + return '[prošlu] [srijedu] [u] LT'; + case 6: + return '[prošle] [subote] [u] LT'; + case 1: + case 2: + case 4: + case 5: + return '[prošli] dddd [u] LT'; + } + }, + sameElse: 'L', + }, + relativeTime: { + future: 'za %s', + past: 'prije %s', + s: 'par sekundi', + ss: translate$3, + m: translate$3, + mm: translate$3, + h: translate$3, + hh: translate$3, + d: 'dan', + dd: translate$3, + M: 'mjesec', + MM: translate$3, + y: 'godinu', + yy: translate$3, + }, + dayOfMonthOrdinalParse: /\d{1,2}\./, + ordinal: '%d.', + week: { + dow: 1, // Monday is the first day of the week. + doy: 7, // The week that contains Jan 7th is the first week of the year. + }, + }); + + //! moment.js locale configuration + + var weekEndings = 'vasárnap hétfőn kedden szerdán csütörtökön pénteken szombaton'.split( + ' ' + ); + function translate$4(number, withoutSuffix, key, isFuture) { + var num = number; + switch (key) { + case 's': + return isFuture || withoutSuffix + ? 'néhány másodperc' + : 'néhány másodperce'; + case 'ss': + return num + (isFuture || withoutSuffix) + ? ' másodperc' + : ' másodperce'; + case 'm': + return 'egy' + (isFuture || withoutSuffix ? ' perc' : ' perce'); + case 'mm': + return num + (isFuture || withoutSuffix ? ' perc' : ' perce'); + case 'h': + return 'egy' + (isFuture || withoutSuffix ? ' óra' : ' órája'); + case 'hh': + return num + (isFuture || withoutSuffix ? ' óra' : ' órája'); + case 'd': + return 'egy' + (isFuture || withoutSuffix ? ' nap' : ' napja'); + case 'dd': + return num + (isFuture || withoutSuffix ? ' nap' : ' napja'); + case 'M': + return 'egy' + (isFuture || withoutSuffix ? ' hónap' : ' hónapja'); + case 'MM': + return num + (isFuture || withoutSuffix ? ' hónap' : ' hónapja'); + case 'y': + return 'egy' + (isFuture || withoutSuffix ? ' év' : ' éve'); + case 'yy': + return num + (isFuture || withoutSuffix ? ' év' : ' éve'); + } + return ''; + } + function week(isFuture) { + return ( + (isFuture ? '' : '[múlt] ') + + '[' + + weekEndings[this.day()] + + '] LT[-kor]' + ); + } + + moment.defineLocale('hu', { + months: 'január_február_március_április_május_június_július_augusztus_szeptember_október_november_december'.split( + '_' + ), + monthsShort: 'jan_feb_márc_ápr_máj_jún_júl_aug_szept_okt_nov_dec'.split( + '_' + ), + weekdays: 'vasárnap_hétfő_kedd_szerda_csütörtök_péntek_szombat'.split('_'), + weekdaysShort: 'vas_hét_kedd_sze_csüt_pén_szo'.split('_'), + weekdaysMin: 'v_h_k_sze_cs_p_szo'.split('_'), + longDateFormat: { + LT: 'H:mm', + LTS: 'H:mm:ss', + L: 'YYYY.MM.DD.', + LL: 'YYYY. MMMM D.', + LLL: 'YYYY. MMMM D. H:mm', + LLLL: 'YYYY. MMMM D., dddd H:mm', + }, + meridiemParse: /de|du/i, + isPM: function (input) { + return input.charAt(1).toLowerCase() === 'u'; + }, + meridiem: function (hours, minutes, isLower) { + if (hours < 12) { + return isLower === true ? 'de' : 'DE'; + } else { + return isLower === true ? 'du' : 'DU'; + } + }, + calendar: { + sameDay: '[ma] LT[-kor]', + nextDay: '[holnap] LT[-kor]', + nextWeek: function () { + return week.call(this, true); + }, + lastDay: '[tegnap] LT[-kor]', + lastWeek: function () { + return week.call(this, false); + }, + sameElse: 'L', + }, + relativeTime: { + future: '%s múlva', + past: '%s', + s: translate$4, + ss: translate$4, + m: translate$4, + mm: translate$4, + h: translate$4, + hh: translate$4, + d: translate$4, + dd: translate$4, + M: translate$4, + MM: translate$4, + y: translate$4, + yy: translate$4, + }, + dayOfMonthOrdinalParse: /\d{1,2}\./, + ordinal: '%d.', + week: { + dow: 1, // Monday is the first day of the week. + doy: 4, // The week that contains Jan 4th is the first week of the year. + }, + }); + + //! moment.js locale configuration + + moment.defineLocale('hy-am', { + months: { + format: 'հունվարի_փետրվարի_մարտի_ապրիլի_մայիսի_հունիսի_հուլիսի_օգոստոսի_սեպտեմբերի_հոկտեմբերի_նոյեմբերի_դեկտեմբերի'.split( + '_' + ), + standalone: 'հունվար_փետրվար_մարտ_ապրիլ_մայիս_հունիս_հուլիս_օգոստոս_սեպտեմբեր_հոկտեմբեր_նոյեմբեր_դեկտեմբեր'.split( + '_' + ), + }, + monthsShort: 'հնվ_փտր_մրտ_ապր_մյս_հնս_հլս_օգս_սպտ_հկտ_նմբ_դկտ'.split('_'), + weekdays: 'կիրակի_երկուշաբթի_երեքշաբթի_չորեքշաբթի_հինգշաբթի_ուրբաթ_շաբաթ'.split( + '_' + ), + weekdaysShort: 'կրկ_երկ_երք_չրք_հնգ_ուրբ_շբթ'.split('_'), + weekdaysMin: 'կրկ_երկ_երք_չրք_հնգ_ուրբ_շբթ'.split('_'), + longDateFormat: { + LT: 'HH:mm', + LTS: 'HH:mm:ss', + L: 'DD.MM.YYYY', + LL: 'D MMMM YYYY թ.', + LLL: 'D MMMM YYYY թ., HH:mm', + LLLL: 'dddd, D MMMM YYYY թ., HH:mm', + }, + calendar: { + sameDay: '[այսօր] LT', + nextDay: '[վաղը] LT', + lastDay: '[երեկ] LT', + nextWeek: function () { + return 'dddd [օրը ժամը] LT'; + }, + lastWeek: function () { + return '[անցած] dddd [օրը ժամը] LT'; + }, + sameElse: 'L', + }, + relativeTime: { + future: '%s հետո', + past: '%s առաջ', + s: 'մի քանի վայրկյան', + ss: '%d վայրկյան', + m: 'րոպե', + mm: '%d րոպե', + h: 'ժամ', + hh: '%d ժամ', + d: 'օր', + dd: '%d օր', + M: 'ամիս', + MM: '%d ամիս', + y: 'տարի', + yy: '%d տարի', + }, + meridiemParse: /գիշերվա|առավոտվա|ցերեկվա|երեկոյան/, + isPM: function (input) { + return /^(ցերեկվա|երեկոյան)$/.test(input); + }, + meridiem: function (hour) { + if (hour < 4) { + return 'գիշերվա'; + } else if (hour < 12) { + return 'առավոտվա'; + } else if (hour < 17) { + return 'ցերեկվա'; + } else { + return 'երեկոյան'; + } + }, + dayOfMonthOrdinalParse: /\d{1,2}|\d{1,2}-(ին|րդ)/, + ordinal: function (number, period) { + switch (period) { + case 'DDD': + case 'w': + case 'W': + case 'DDDo': + if (number === 1) { + return number + '-ին'; + } + return number + '-րդ'; + default: + return number; + } + }, + week: { + dow: 1, // Monday is the first day of the week. + doy: 7, // The week that contains Jan 7th is the first week of the year. + }, + }); + + //! moment.js locale configuration + + moment.defineLocale('id', { + months: 'Januari_Februari_Maret_April_Mei_Juni_Juli_Agustus_September_Oktober_November_Desember'.split( + '_' + ), + monthsShort: 'Jan_Feb_Mar_Apr_Mei_Jun_Jul_Agt_Sep_Okt_Nov_Des'.split('_'), + weekdays: 'Minggu_Senin_Selasa_Rabu_Kamis_Jumat_Sabtu'.split('_'), + weekdaysShort: 'Min_Sen_Sel_Rab_Kam_Jum_Sab'.split('_'), + weekdaysMin: 'Mg_Sn_Sl_Rb_Km_Jm_Sb'.split('_'), + longDateFormat: { + LT: 'HH.mm', + LTS: 'HH.mm.ss', + L: 'DD/MM/YYYY', + LL: 'D MMMM YYYY', + LLL: 'D MMMM YYYY [pukul] HH.mm', + LLLL: 'dddd, D MMMM YYYY [pukul] HH.mm', + }, + meridiemParse: /pagi|siang|sore|malam/, + meridiemHour: function (hour, meridiem) { + if (hour === 12) { + hour = 0; + } + if (meridiem === 'pagi') { + return hour; + } else if (meridiem === 'siang') { + return hour >= 11 ? hour : hour + 12; + } else if (meridiem === 'sore' || meridiem === 'malam') { + return hour + 12; + } + }, + meridiem: function (hours, minutes, isLower) { + if (hours < 11) { + return 'pagi'; + } else if (hours < 15) { + return 'siang'; + } else if (hours < 19) { + return 'sore'; + } else { + return 'malam'; + } + }, + calendar: { + sameDay: '[Hari ini pukul] LT', + nextDay: '[Besok pukul] LT', + nextWeek: 'dddd [pukul] LT', + lastDay: '[Kemarin pukul] LT', + lastWeek: 'dddd [lalu pukul] LT', + sameElse: 'L', + }, + relativeTime: { + future: 'dalam %s', + past: '%s yang lalu', + s: 'beberapa detik', + ss: '%d detik', + m: 'semenit', + mm: '%d menit', + h: 'sejam', + hh: '%d jam', + d: 'sehari', + dd: '%d hari', + M: 'sebulan', + MM: '%d bulan', + y: 'setahun', + yy: '%d tahun', + }, + week: { + dow: 0, // Sunday is the first day of the week. + doy: 6, // The week that contains Jan 6th is the first week of the year. + }, + }); + + //! moment.js locale configuration + + function plural$2(n) { + if (n % 100 === 11) { + return true; + } else if (n % 10 === 1) { + return false; + } + return true; + } + function translate$5(number, withoutSuffix, key, isFuture) { + var result = number + ' '; + switch (key) { + case 's': + return withoutSuffix || isFuture + ? 'nokkrar sekúndur' + : 'nokkrum sekúndum'; + case 'ss': + if (plural$2(number)) { + return ( + result + + (withoutSuffix || isFuture ? 'sekúndur' : 'sekúndum') + ); + } + return result + 'sekúnda'; + case 'm': + return withoutSuffix ? 'mínúta' : 'mínútu'; + case 'mm': + if (plural$2(number)) { + return ( + result + (withoutSuffix || isFuture ? 'mínútur' : 'mínútum') + ); + } else if (withoutSuffix) { + return result + 'mínúta'; + } + return result + 'mínútu'; + case 'hh': + if (plural$2(number)) { + return ( + result + + (withoutSuffix || isFuture + ? 'klukkustundir' + : 'klukkustundum') + ); + } + return result + 'klukkustund'; + case 'd': + if (withoutSuffix) { + return 'dagur'; + } + return isFuture ? 'dag' : 'degi'; + case 'dd': + if (plural$2(number)) { + if (withoutSuffix) { + return result + 'dagar'; + } + return result + (isFuture ? 'daga' : 'dögum'); + } else if (withoutSuffix) { + return result + 'dagur'; + } + return result + (isFuture ? 'dag' : 'degi'); + case 'M': + if (withoutSuffix) { + return 'mánuður'; + } + return isFuture ? 'mánuð' : 'mánuði'; + case 'MM': + if (plural$2(number)) { + if (withoutSuffix) { + return result + 'mánuðir'; + } + return result + (isFuture ? 'mánuði' : 'mánuðum'); + } else if (withoutSuffix) { + return result + 'mánuður'; + } + return result + (isFuture ? 'mánuð' : 'mánuði'); + case 'y': + return withoutSuffix || isFuture ? 'ár' : 'ári'; + case 'yy': + if (plural$2(number)) { + return result + (withoutSuffix || isFuture ? 'ár' : 'árum'); + } + return result + (withoutSuffix || isFuture ? 'ár' : 'ári'); + } + } + + moment.defineLocale('is', { + months: 'janúar_febrúar_mars_apríl_maí_júní_júlí_ágúst_september_október_nóvember_desember'.split( + '_' + ), + monthsShort: 'jan_feb_mar_apr_maí_jún_júl_ágú_sep_okt_nóv_des'.split('_'), + weekdays: 'sunnudagur_mánudagur_þriðjudagur_miðvikudagur_fimmtudagur_föstudagur_laugardagur'.split( + '_' + ), + weekdaysShort: 'sun_mán_þri_mið_fim_fös_lau'.split('_'), + weekdaysMin: 'Su_Má_Þr_Mi_Fi_Fö_La'.split('_'), + longDateFormat: { + LT: 'H:mm', + LTS: 'H:mm:ss', + L: 'DD.MM.YYYY', + LL: 'D. MMMM YYYY', + LLL: 'D. MMMM YYYY [kl.] H:mm', + LLLL: 'dddd, D. MMMM YYYY [kl.] H:mm', + }, + calendar: { + sameDay: '[í dag kl.] LT', + nextDay: '[á morgun kl.] LT', + nextWeek: 'dddd [kl.] LT', + lastDay: '[í gær kl.] LT', + lastWeek: '[síðasta] dddd [kl.] LT', + sameElse: 'L', + }, + relativeTime: { + future: 'eftir %s', + past: 'fyrir %s síðan', + s: translate$5, + ss: translate$5, + m: translate$5, + mm: translate$5, + h: 'klukkustund', + hh: translate$5, + d: translate$5, + dd: translate$5, + M: translate$5, + MM: translate$5, + y: translate$5, + yy: translate$5, + }, + dayOfMonthOrdinalParse: /\d{1,2}\./, + ordinal: '%d.', + week: { + dow: 1, // Monday is the first day of the week. + doy: 4, // The week that contains Jan 4th is the first week of the year. + }, + }); + + //! moment.js locale configuration + + moment.defineLocale('it-ch', { + months: 'gennaio_febbraio_marzo_aprile_maggio_giugno_luglio_agosto_settembre_ottobre_novembre_dicembre'.split( + '_' + ), + monthsShort: 'gen_feb_mar_apr_mag_giu_lug_ago_set_ott_nov_dic'.split('_'), + weekdays: 'domenica_lunedì_martedì_mercoledì_giovedì_venerdì_sabato'.split( + '_' + ), + weekdaysShort: 'dom_lun_mar_mer_gio_ven_sab'.split('_'), + weekdaysMin: 'do_lu_ma_me_gi_ve_sa'.split('_'), + longDateFormat: { + LT: 'HH:mm', + LTS: 'HH:mm:ss', + L: 'DD.MM.YYYY', + LL: 'D MMMM YYYY', + LLL: 'D MMMM YYYY HH:mm', + LLLL: 'dddd D MMMM YYYY HH:mm', + }, + calendar: { + sameDay: '[Oggi alle] LT', + nextDay: '[Domani alle] LT', + nextWeek: 'dddd [alle] LT', + lastDay: '[Ieri alle] LT', + lastWeek: function () { + switch (this.day()) { + case 0: + return '[la scorsa] dddd [alle] LT'; + default: + return '[lo scorso] dddd [alle] LT'; + } + }, + sameElse: 'L', + }, + relativeTime: { + future: function (s) { + return (/^[0-9].+$/.test(s) ? 'tra' : 'in') + ' ' + s; + }, + past: '%s fa', + s: 'alcuni secondi', + ss: '%d secondi', + m: 'un minuto', + mm: '%d minuti', + h: "un'ora", + hh: '%d ore', + d: 'un giorno', + dd: '%d giorni', + M: 'un mese', + MM: '%d mesi', + y: 'un anno', + yy: '%d anni', + }, + dayOfMonthOrdinalParse: /\d{1,2}º/, + ordinal: '%dº', + week: { + dow: 1, // Monday is the first day of the week. + doy: 4, // The week that contains Jan 4th is the first week of the year. + }, + }); + + //! moment.js locale configuration + + moment.defineLocale('it', { + months: 'gennaio_febbraio_marzo_aprile_maggio_giugno_luglio_agosto_settembre_ottobre_novembre_dicembre'.split( + '_' + ), + monthsShort: 'gen_feb_mar_apr_mag_giu_lug_ago_set_ott_nov_dic'.split('_'), + weekdays: 'domenica_lunedì_martedì_mercoledì_giovedì_venerdì_sabato'.split( + '_' + ), + weekdaysShort: 'dom_lun_mar_mer_gio_ven_sab'.split('_'), + weekdaysMin: 'do_lu_ma_me_gi_ve_sa'.split('_'), + longDateFormat: { + LT: 'HH:mm', + LTS: 'HH:mm:ss', + L: 'DD/MM/YYYY', + LL: 'D MMMM YYYY', + LLL: 'D MMMM YYYY HH:mm', + LLLL: 'dddd D MMMM YYYY HH:mm', + }, + calendar: { + sameDay: function () { + return ( + '[Oggi a' + + (this.hours() > 1 ? 'lle ' : this.hours() === 0 ? ' ' : "ll'") + + ']LT' + ); + }, + nextDay: function () { + return ( + '[Domani a' + + (this.hours() > 1 ? 'lle ' : this.hours() === 0 ? ' ' : "ll'") + + ']LT' + ); + }, + nextWeek: function () { + return ( + 'dddd [a' + + (this.hours() > 1 ? 'lle ' : this.hours() === 0 ? ' ' : "ll'") + + ']LT' + ); + }, + lastDay: function () { + return ( + '[Ieri a' + + (this.hours() > 1 ? 'lle ' : this.hours() === 0 ? ' ' : "ll'") + + ']LT' + ); + }, + lastWeek: function () { + switch (this.day()) { + case 0: + return ( + '[La scorsa] dddd [a' + + (this.hours() > 1 + ? 'lle ' + : this.hours() === 0 + ? ' ' + : "ll'") + + ']LT' + ); + default: + return ( + '[Lo scorso] dddd [a' + + (this.hours() > 1 + ? 'lle ' + : this.hours() === 0 + ? ' ' + : "ll'") + + ']LT' + ); + } + }, + sameElse: 'L', + }, + relativeTime: { + future: 'tra %s', + past: '%s fa', + s: 'alcuni secondi', + ss: '%d secondi', + m: 'un minuto', + mm: '%d minuti', + h: "un'ora", + hh: '%d ore', + d: 'un giorno', + dd: '%d giorni', + M: 'un mese', + MM: '%d mesi', + y: 'un anno', + yy: '%d anni', + }, + dayOfMonthOrdinalParse: /\d{1,2}º/, + ordinal: '%dº', + week: { + dow: 1, // Monday is the first day of the week. + doy: 4, // The week that contains Jan 4th is the first week of the year. + }, + }); + + //! moment.js locale configuration + + moment.defineLocale('ja', { + eras: [ + { + since: '2019-05-01', + offset: 1, + name: '令和', + narrow: '㋿', + abbr: 'R', + }, + { + since: '1989-01-08', + until: '2019-04-30', + offset: 1, + name: '平成', + narrow: '㍻', + abbr: 'H', + }, + { + since: '1926-12-25', + until: '1989-01-07', + offset: 1, + name: '昭和', + narrow: '㍼', + abbr: 'S', + }, + { + since: '1912-07-30', + until: '1926-12-24', + offset: 1, + name: '大正', + narrow: '㍽', + abbr: 'T', + }, + { + since: '1873-01-01', + until: '1912-07-29', + offset: 6, + name: '明治', + narrow: '㍾', + abbr: 'M', + }, + { + since: '0001-01-01', + until: '1873-12-31', + offset: 1, + name: '西暦', + narrow: 'AD', + abbr: 'AD', + }, + { + since: '0000-12-31', + until: -Infinity, + offset: 1, + name: '紀元前', + narrow: 'BC', + abbr: 'BC', + }, + ], + eraYearOrdinalRegex: /(元|\d+)年/, + eraYearOrdinalParse: function (input, match) { + return match[1] === '元' ? 1 : parseInt(match[1] || input, 10); + }, + months: '1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月'.split('_'), + monthsShort: '1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月'.split( + '_' + ), + weekdays: '日曜日_月曜日_火曜日_水曜日_木曜日_金曜日_土曜日'.split('_'), + weekdaysShort: '日_月_火_水_木_金_土'.split('_'), + weekdaysMin: '日_月_火_水_木_金_土'.split('_'), + longDateFormat: { + LT: 'HH:mm', + LTS: 'HH:mm:ss', + L: 'YYYY/MM/DD', + LL: 'YYYY年M月D日', + LLL: 'YYYY年M月D日 HH:mm', + LLLL: 'YYYY年M月D日 dddd HH:mm', + l: 'YYYY/MM/DD', + ll: 'YYYY年M月D日', + lll: 'YYYY年M月D日 HH:mm', + llll: 'YYYY年M月D日(ddd) HH:mm', + }, + meridiemParse: /午前|午後/i, + isPM: function (input) { + return input === '午後'; + }, + meridiem: function (hour, minute, isLower) { + if (hour < 12) { + return '午前'; + } else { + return '午後'; + } + }, + calendar: { + sameDay: '[今日] LT', + nextDay: '[明日] LT', + nextWeek: function (now) { + if (now.week() !== this.week()) { + return '[来週]dddd LT'; + } else { + return 'dddd LT'; + } + }, + lastDay: '[昨日] LT', + lastWeek: function (now) { + if (this.week() !== now.week()) { + return '[先週]dddd LT'; + } else { + return 'dddd LT'; + } + }, + sameElse: 'L', + }, + dayOfMonthOrdinalParse: /\d{1,2}日/, + ordinal: function (number, period) { + switch (period) { + case 'y': + return number === 1 ? '元年' : number + '年'; + case 'd': + case 'D': + case 'DDD': + return number + '日'; + default: + return number; + } + }, + relativeTime: { + future: '%s後', + past: '%s前', + s: '数秒', + ss: '%d秒', + m: '1分', + mm: '%d分', + h: '1時間', + hh: '%d時間', + d: '1日', + dd: '%d日', + M: '1ヶ月', + MM: '%dヶ月', + y: '1年', + yy: '%d年', + }, + }); + + //! moment.js locale configuration + + moment.defineLocale('jv', { + months: 'Januari_Februari_Maret_April_Mei_Juni_Juli_Agustus_September_Oktober_Nopember_Desember'.split( + '_' + ), + monthsShort: 'Jan_Feb_Mar_Apr_Mei_Jun_Jul_Ags_Sep_Okt_Nop_Des'.split('_'), + weekdays: 'Minggu_Senen_Seloso_Rebu_Kemis_Jemuwah_Septu'.split('_'), + weekdaysShort: 'Min_Sen_Sel_Reb_Kem_Jem_Sep'.split('_'), + weekdaysMin: 'Mg_Sn_Sl_Rb_Km_Jm_Sp'.split('_'), + longDateFormat: { + LT: 'HH.mm', + LTS: 'HH.mm.ss', + L: 'DD/MM/YYYY', + LL: 'D MMMM YYYY', + LLL: 'D MMMM YYYY [pukul] HH.mm', + LLLL: 'dddd, D MMMM YYYY [pukul] HH.mm', + }, + meridiemParse: /enjing|siyang|sonten|ndalu/, + meridiemHour: function (hour, meridiem) { + if (hour === 12) { + hour = 0; + } + if (meridiem === 'enjing') { + return hour; + } else if (meridiem === 'siyang') { + return hour >= 11 ? hour : hour + 12; + } else if (meridiem === 'sonten' || meridiem === 'ndalu') { + return hour + 12; + } + }, + meridiem: function (hours, minutes, isLower) { + if (hours < 11) { + return 'enjing'; + } else if (hours < 15) { + return 'siyang'; + } else if (hours < 19) { + return 'sonten'; + } else { + return 'ndalu'; + } + }, + calendar: { + sameDay: '[Dinten puniko pukul] LT', + nextDay: '[Mbenjang pukul] LT', + nextWeek: 'dddd [pukul] LT', + lastDay: '[Kala wingi pukul] LT', + lastWeek: 'dddd [kepengker pukul] LT', + sameElse: 'L', + }, + relativeTime: { + future: 'wonten ing %s', + past: '%s ingkang kepengker', + s: 'sawetawis detik', + ss: '%d detik', + m: 'setunggal menit', + mm: '%d menit', + h: 'setunggal jam', + hh: '%d jam', + d: 'sedinten', + dd: '%d dinten', + M: 'sewulan', + MM: '%d wulan', + y: 'setaun', + yy: '%d taun', + }, + week: { + dow: 1, // Monday is the first day of the week. + doy: 7, // The week that contains Jan 7th is the first week of the year. + }, + }); + + //! moment.js locale configuration + + moment.defineLocale('ka', { + months: 'იანვარი_თებერვალი_მარტი_აპრილი_მაისი_ივნისი_ივლისი_აგვისტო_სექტემბერი_ოქტომბერი_ნოემბერი_დეკემბერი'.split( + '_' + ), + monthsShort: 'იან_თებ_მარ_აპრ_მაი_ივნ_ივლ_აგვ_სექ_ოქტ_ნოე_დეკ'.split('_'), + weekdays: { + standalone: 'კვირა_ორშაბათი_სამშაბათი_ოთხშაბათი_ხუთშაბათი_პარასკევი_შაბათი'.split( + '_' + ), + format: 'კვირას_ორშაბათს_სამშაბათს_ოთხშაბათს_ხუთშაბათს_პარასკევს_შაბათს'.split( + '_' + ), + isFormat: /(წინა|შემდეგ)/, + }, + weekdaysShort: 'კვი_ორშ_სამ_ოთხ_ხუთ_პარ_შაბ'.split('_'), + weekdaysMin: 'კვ_ორ_სა_ოთ_ხუ_პა_შა'.split('_'), + longDateFormat: { + LT: 'HH:mm', + LTS: 'HH:mm:ss', + L: 'DD/MM/YYYY', + LL: 'D MMMM YYYY', + LLL: 'D MMMM YYYY HH:mm', + LLLL: 'dddd, D MMMM YYYY HH:mm', + }, + calendar: { + sameDay: '[დღეს] LT[-ზე]', + nextDay: '[ხვალ] LT[-ზე]', + lastDay: '[გუშინ] LT[-ზე]', + nextWeek: '[შემდეგ] dddd LT[-ზე]', + lastWeek: '[წინა] dddd LT-ზე', + sameElse: 'L', + }, + relativeTime: { + future: function (s) { + return s.replace(/(წამ|წუთ|საათ|წელ|დღ|თვ)(ი|ე)/, function ( + $0, + $1, + $2 + ) { + return $2 === 'ი' ? $1 + 'ში' : $1 + $2 + 'ში'; + }); + }, + past: function (s) { + if (/(წამი|წუთი|საათი|დღე|თვე)/.test(s)) { + return s.replace(/(ი|ე)$/, 'ის წინ'); + } + if (/წელი/.test(s)) { + return s.replace(/წელი$/, 'წლის წინ'); + } + return s; + }, + s: 'რამდენიმე წამი', + ss: '%d წამი', + m: 'წუთი', + mm: '%d წუთი', + h: 'საათი', + hh: '%d საათი', + d: 'დღე', + dd: '%d დღე', + M: 'თვე', + MM: '%d თვე', + y: 'წელი', + yy: '%d წელი', + }, + dayOfMonthOrdinalParse: /0|1-ლი|მე-\d{1,2}|\d{1,2}-ე/, + ordinal: function (number) { + if (number === 0) { + return number; + } + if (number === 1) { + return number + '-ლი'; + } + if ( + number < 20 || + (number <= 100 && number % 20 === 0) || + number % 100 === 0 + ) { + return 'მე-' + number; + } + return number + '-ე'; + }, + week: { + dow: 1, + doy: 7, + }, + }); + + //! moment.js locale configuration + + var suffixes$1 = { + 0: '-ші', + 1: '-ші', + 2: '-ші', + 3: '-ші', + 4: '-ші', + 5: '-ші', + 6: '-шы', + 7: '-ші', + 8: '-ші', + 9: '-шы', + 10: '-шы', + 20: '-шы', + 30: '-шы', + 40: '-шы', + 50: '-ші', + 60: '-шы', + 70: '-ші', + 80: '-ші', + 90: '-шы', + 100: '-ші', + }; + + moment.defineLocale('kk', { + months: 'қаңтар_ақпан_наурыз_сәуір_мамыр_маусым_шілде_тамыз_қыркүйек_қазан_қараша_желтоқсан'.split( + '_' + ), + monthsShort: 'қаң_ақп_нау_сәу_мам_мау_шіл_там_қыр_қаз_қар_жел'.split('_'), + weekdays: 'жексенбі_дүйсенбі_сейсенбі_сәрсенбі_бейсенбі_жұма_сенбі'.split( + '_' + ), + weekdaysShort: 'жек_дүй_сей_сәр_бей_жұм_сен'.split('_'), + weekdaysMin: 'жк_дй_сй_ср_бй_жм_сн'.split('_'), + longDateFormat: { + LT: 'HH:mm', + LTS: 'HH:mm:ss', + L: 'DD.MM.YYYY', + LL: 'D MMMM YYYY', + LLL: 'D MMMM YYYY HH:mm', + LLLL: 'dddd, D MMMM YYYY HH:mm', + }, + calendar: { + sameDay: '[Бүгін сағат] LT', + nextDay: '[Ертең сағат] LT', + nextWeek: 'dddd [сағат] LT', + lastDay: '[Кеше сағат] LT', + lastWeek: '[Өткен аптаның] dddd [сағат] LT', + sameElse: 'L', + }, + relativeTime: { + future: '%s ішінде', + past: '%s бұрын', + s: 'бірнеше секунд', + ss: '%d секунд', + m: 'бір минут', + mm: '%d минут', + h: 'бір сағат', + hh: '%d сағат', + d: 'бір күн', + dd: '%d күн', + M: 'бір ай', + MM: '%d ай', + y: 'бір жыл', + yy: '%d жыл', + }, + dayOfMonthOrdinalParse: /\d{1,2}-(ші|шы)/, + ordinal: function (number) { + var a = number % 10, + b = number >= 100 ? 100 : null; + return number + (suffixes$1[number] || suffixes$1[a] || suffixes$1[b]); + }, + week: { + dow: 1, // Monday is the first day of the week. + doy: 7, // The week that contains Jan 7th is the first week of the year. + }, + }); + + //! moment.js locale configuration + + var symbolMap$8 = { + '1': '១', + '2': '២', + '3': '៣', + '4': '៤', + '5': '៥', + '6': '៦', + '7': '៧', + '8': '៨', + '9': '៩', + '0': '០', + }, + numberMap$7 = { + '១': '1', + '២': '2', + '៣': '3', + '៤': '4', + '៥': '5', + '៦': '6', + '៧': '7', + '៨': '8', + '៩': '9', + '០': '0', + }; + + moment.defineLocale('km', { + months: 'មករា_កុម្ភៈ_មីនា_មេសា_ឧសភា_មិថុនា_កក្កដា_សីហា_កញ្ញា_តុលា_វិច្ឆិកា_ធ្នូ'.split( + '_' + ), + monthsShort: 'មករា_កុម្ភៈ_មីនា_មេសា_ឧសភា_មិថុនា_កក្កដា_សីហា_កញ្ញា_តុលា_វិច្ឆិកា_ធ្នូ'.split( + '_' + ), + weekdays: 'អាទិត្យ_ច័ន្ទ_អង្គារ_ពុធ_ព្រហស្បតិ៍_សុក្រ_សៅរ៍'.split('_'), + weekdaysShort: 'អា_ច_អ_ព_ព្រ_សុ_ស'.split('_'), + weekdaysMin: 'អា_ច_អ_ព_ព្រ_សុ_ស'.split('_'), + weekdaysParseExact: true, + longDateFormat: { + LT: 'HH:mm', + LTS: 'HH:mm:ss', + L: 'DD/MM/YYYY', + LL: 'D MMMM YYYY', + LLL: 'D MMMM YYYY HH:mm', + LLLL: 'dddd, D MMMM YYYY HH:mm', + }, + meridiemParse: /ព្រឹក|ល្ងាច/, + isPM: function (input) { + return input === 'ល្ងាច'; + }, + meridiem: function (hour, minute, isLower) { + if (hour < 12) { + return 'ព្រឹក'; + } else { + return 'ល្ងាច'; + } + }, + calendar: { + sameDay: '[ថ្ងៃនេះ ម៉ោង] LT', + nextDay: '[ស្អែក ម៉ោង] LT', + nextWeek: 'dddd [ម៉ោង] LT', + lastDay: '[ម្សិលមិញ ម៉ោង] LT', + lastWeek: 'dddd [សប្តាហ៍មុន] [ម៉ោង] LT', + sameElse: 'L', + }, + relativeTime: { + future: '%sទៀត', + past: '%sមុន', + s: 'ប៉ុន្មានវិនាទី', + ss: '%d វិនាទី', + m: 'មួយនាទី', + mm: '%d នាទី', + h: 'មួយម៉ោង', + hh: '%d ម៉ោង', + d: 'មួយថ្ងៃ', + dd: '%d ថ្ងៃ', + M: 'មួយខែ', + MM: '%d ខែ', + y: 'មួយឆ្នាំ', + yy: '%d ឆ្នាំ', + }, + dayOfMonthOrdinalParse: /ទី\d{1,2}/, + ordinal: 'ទី%d', + preparse: function (string) { + return string.replace(/[១២៣៤៥៦៧៨៩០]/g, function (match) { + return numberMap$7[match]; + }); + }, + postformat: function (string) { + return string.replace(/\d/g, function (match) { + return symbolMap$8[match]; + }); + }, + week: { + dow: 1, // Monday is the first day of the week. + doy: 4, // The week that contains Jan 4th is the first week of the year. + }, + }); + + //! moment.js locale configuration + + var symbolMap$9 = { + '1': '೧', + '2': '೨', + '3': '೩', + '4': '೪', + '5': '೫', + '6': '೬', + '7': '೭', + '8': '೮', + '9': '೯', + '0': '೦', + }, + numberMap$8 = { + '೧': '1', + '೨': '2', + '೩': '3', + '೪': '4', + '೫': '5', + '೬': '6', + '೭': '7', + '೮': '8', + '೯': '9', + '೦': '0', + }; + + moment.defineLocale('kn', { + months: 'ಜನವರಿ_ಫೆಬ್ರವರಿ_ಮಾರ್ಚ್_ಏಪ್ರಿಲ್_ಮೇ_ಜೂನ್_ಜುಲೈ_ಆಗಸ್ಟ್_ಸೆಪ್ಟೆಂಬರ್_ಅಕ್ಟೋಬರ್_ನವೆಂಬರ್_ಡಿಸೆಂಬರ್'.split( + '_' + ), + monthsShort: 'ಜನ_ಫೆಬ್ರ_ಮಾರ್ಚ್_ಏಪ್ರಿಲ್_ಮೇ_ಜೂನ್_ಜುಲೈ_ಆಗಸ್ಟ್_ಸೆಪ್ಟೆಂ_ಅಕ್ಟೋ_ನವೆಂ_ಡಿಸೆಂ'.split( + '_' + ), + monthsParseExact: true, + weekdays: 'ಭಾನುವಾರ_ಸೋಮವಾರ_ಮಂಗಳವಾರ_ಬುಧವಾರ_ಗುರುವಾರ_ಶುಕ್ರವಾರ_ಶನಿವಾರ'.split( + '_' + ), + weekdaysShort: 'ಭಾನು_ಸೋಮ_ಮಂಗಳ_ಬುಧ_ಗುರು_ಶುಕ್ರ_ಶನಿ'.split('_'), + weekdaysMin: 'ಭಾ_ಸೋ_ಮಂ_ಬು_ಗು_ಶು_ಶ'.split('_'), + longDateFormat: { + LT: 'A h:mm', + LTS: 'A h:mm:ss', + L: 'DD/MM/YYYY', + LL: 'D MMMM YYYY', + LLL: 'D MMMM YYYY, A h:mm', + LLLL: 'dddd, D MMMM YYYY, A h:mm', + }, + calendar: { + sameDay: '[ಇಂದು] LT', + nextDay: '[ನಾಳೆ] LT', + nextWeek: 'dddd, LT', + lastDay: '[ನಿನ್ನೆ] LT', + lastWeek: '[ಕೊನೆಯ] dddd, LT', + sameElse: 'L', + }, + relativeTime: { + future: '%s ನಂತರ', + past: '%s ಹಿಂದೆ', + s: 'ಕೆಲವು ಕ್ಷಣಗಳು', + ss: '%d ಸೆಕೆಂಡುಗಳು', + m: 'ಒಂದು ನಿಮಿಷ', + mm: '%d ನಿಮಿಷ', + h: 'ಒಂದು ಗಂಟೆ', + hh: '%d ಗಂಟೆ', + d: 'ಒಂದು ದಿನ', + dd: '%d ದಿನ', + M: 'ಒಂದು ತಿಂಗಳು', + MM: '%d ತಿಂಗಳು', + y: 'ಒಂದು ವರ್ಷ', + yy: '%d ವರ್ಷ', + }, + preparse: function (string) { + return string.replace(/[೧೨೩೪೫೬೭೮೯೦]/g, function (match) { + return numberMap$8[match]; + }); + }, + postformat: function (string) { + return string.replace(/\d/g, function (match) { + return symbolMap$9[match]; + }); + }, + meridiemParse: /ರಾತ್ರಿ|ಬೆಳಿಗ್ಗೆ|ಮಧ್ಯಾಹ್ನ|ಸಂಜೆ/, + meridiemHour: function (hour, meridiem) { + if (hour === 12) { + hour = 0; + } + if (meridiem === 'ರಾತ್ರಿ') { + return hour < 4 ? hour : hour + 12; + } else if (meridiem === 'ಬೆಳಿಗ್ಗೆ') { + return hour; + } else if (meridiem === 'ಮಧ್ಯಾಹ್ನ') { + return hour >= 10 ? hour : hour + 12; + } else if (meridiem === 'ಸಂಜೆ') { + return hour + 12; + } + }, + meridiem: function (hour, minute, isLower) { + if (hour < 4) { + return 'ರಾತ್ರಿ'; + } else if (hour < 10) { + return 'ಬೆಳಿಗ್ಗೆ'; + } else if (hour < 17) { + return 'ಮಧ್ಯಾಹ್ನ'; + } else if (hour < 20) { + return 'ಸಂಜೆ'; + } else { + return 'ರಾತ್ರಿ'; + } + }, + dayOfMonthOrdinalParse: /\d{1,2}(ನೇ)/, + ordinal: function (number) { + return number + 'ನೇ'; + }, + week: { + dow: 0, // Sunday is the first day of the week. + doy: 6, // The week that contains Jan 6th is the first week of the year. + }, + }); + + //! moment.js locale configuration + + moment.defineLocale('ko', { + months: '1월_2월_3월_4월_5월_6월_7월_8월_9월_10월_11월_12월'.split('_'), + monthsShort: '1월_2월_3월_4월_5월_6월_7월_8월_9월_10월_11월_12월'.split( + '_' + ), + weekdays: '일요일_월요일_화요일_수요일_목요일_금요일_토요일'.split('_'), + weekdaysShort: '일_월_화_수_목_금_토'.split('_'), + weekdaysMin: '일_월_화_수_목_금_토'.split('_'), + longDateFormat: { + LT: 'A h:mm', + LTS: 'A h:mm:ss', + L: 'YYYY.MM.DD.', + LL: 'YYYY년 MMMM D일', + LLL: 'YYYY년 MMMM D일 A h:mm', + LLLL: 'YYYY년 MMMM D일 dddd A h:mm', + l: 'YYYY.MM.DD.', + ll: 'YYYY년 MMMM D일', + lll: 'YYYY년 MMMM D일 A h:mm', + llll: 'YYYY년 MMMM D일 dddd A h:mm', + }, + calendar: { + sameDay: '오늘 LT', + nextDay: '내일 LT', + nextWeek: 'dddd LT', + lastDay: '어제 LT', + lastWeek: '지난주 dddd LT', + sameElse: 'L', + }, + relativeTime: { + future: '%s 후', + past: '%s 전', + s: '몇 초', + ss: '%d초', + m: '1분', + mm: '%d분', + h: '한 시간', + hh: '%d시간', + d: '하루', + dd: '%d일', + M: '한 달', + MM: '%d달', + y: '일 년', + yy: '%d년', + }, + dayOfMonthOrdinalParse: /\d{1,2}(일|월|주)/, + ordinal: function (number, period) { + switch (period) { + case 'd': + case 'D': + case 'DDD': + return number + '일'; + case 'M': + return number + '월'; + case 'w': + case 'W': + return number + '주'; + default: + return number; + } + }, + meridiemParse: /오전|오후/, + isPM: function (token) { + return token === '오후'; + }, + meridiem: function (hour, minute, isUpper) { + return hour < 12 ? '오전' : '오후'; + }, + }); + + //! moment.js locale configuration + + var symbolMap$a = { + '1': '١', + '2': '٢', + '3': '٣', + '4': '٤', + '5': '٥', + '6': '٦', + '7': '٧', + '8': '٨', + '9': '٩', + '0': '٠', + }, + numberMap$9 = { + '١': '1', + '٢': '2', + '٣': '3', + '٤': '4', + '٥': '5', + '٦': '6', + '٧': '7', + '٨': '8', + '٩': '9', + '٠': '0', + }, + months$7 = [ + 'کانونی دووەم', + 'شوبات', + 'ئازار', + 'نیسان', + 'ئایار', + 'حوزەیران', + 'تەمموز', + 'ئاب', + 'ئەیلوول', + 'تشرینی یەكەم', + 'تشرینی دووەم', + 'كانونی یەکەم', + ]; + + moment.defineLocale('ku', { + months: months$7, + monthsShort: months$7, + weekdays: 'یه‌كشه‌ممه‌_دووشه‌ممه‌_سێشه‌ممه‌_چوارشه‌ممه‌_پێنجشه‌ممه‌_هه‌ینی_شه‌ممه‌'.split( + '_' + ), + weekdaysShort: 'یه‌كشه‌م_دووشه‌م_سێشه‌م_چوارشه‌م_پێنجشه‌م_هه‌ینی_شه‌ممه‌'.split( + '_' + ), + weekdaysMin: 'ی_د_س_چ_پ_ه_ش'.split('_'), + weekdaysParseExact: true, + longDateFormat: { + LT: 'HH:mm', + LTS: 'HH:mm:ss', + L: 'DD/MM/YYYY', + LL: 'D MMMM YYYY', + LLL: 'D MMMM YYYY HH:mm', + LLLL: 'dddd, D MMMM YYYY HH:mm', + }, + meridiemParse: /ئێواره‌|به‌یانی/, + isPM: function (input) { + return /ئێواره‌/.test(input); + }, + meridiem: function (hour, minute, isLower) { + if (hour < 12) { + return 'به‌یانی'; + } else { + return 'ئێواره‌'; + } + }, + calendar: { + sameDay: '[ئه‌مرۆ كاتژمێر] LT', + nextDay: '[به‌یانی كاتژمێر] LT', + nextWeek: 'dddd [كاتژمێر] LT', + lastDay: '[دوێنێ كاتژمێر] LT', + lastWeek: 'dddd [كاتژمێر] LT', + sameElse: 'L', + }, + relativeTime: { + future: 'له‌ %s', + past: '%s', + s: 'چه‌ند چركه‌یه‌ك', + ss: 'چركه‌ %d', + m: 'یه‌ك خوله‌ك', + mm: '%d خوله‌ك', + h: 'یه‌ك كاتژمێر', + hh: '%d كاتژمێر', + d: 'یه‌ك ڕۆژ', + dd: '%d ڕۆژ', + M: 'یه‌ك مانگ', + MM: '%d مانگ', + y: 'یه‌ك ساڵ', + yy: '%d ساڵ', + }, + preparse: function (string) { + return string + .replace(/[١٢٣٤٥٦٧٨٩٠]/g, function (match) { + return numberMap$9[match]; + }) + .replace(/،/g, ','); + }, + postformat: function (string) { + return string + .replace(/\d/g, function (match) { + return symbolMap$a[match]; + }) + .replace(/,/g, '،'); + }, + week: { + dow: 6, // Saturday is the first day of the week. + doy: 12, // The week that contains Jan 12th is the first week of the year. + }, + }); + + //! moment.js locale configuration + + var suffixes$2 = { + 0: '-чү', + 1: '-чи', + 2: '-чи', + 3: '-чү', + 4: '-чү', + 5: '-чи', + 6: '-чы', + 7: '-чи', + 8: '-чи', + 9: '-чу', + 10: '-чу', + 20: '-чы', + 30: '-чу', + 40: '-чы', + 50: '-чү', + 60: '-чы', + 70: '-чи', + 80: '-чи', + 90: '-чу', + 100: '-чү', + }; + + moment.defineLocale('ky', { + months: 'январь_февраль_март_апрель_май_июнь_июль_август_сентябрь_октябрь_ноябрь_декабрь'.split( + '_' + ), + monthsShort: 'янв_фев_март_апр_май_июнь_июль_авг_сен_окт_ноя_дек'.split( + '_' + ), + weekdays: 'Жекшемби_Дүйшөмбү_Шейшемби_Шаршемби_Бейшемби_Жума_Ишемби'.split( + '_' + ), + weekdaysShort: 'Жек_Дүй_Шей_Шар_Бей_Жум_Ише'.split('_'), + weekdaysMin: 'Жк_Дй_Шй_Шр_Бй_Жм_Иш'.split('_'), + longDateFormat: { + LT: 'HH:mm', + LTS: 'HH:mm:ss', + L: 'DD.MM.YYYY', + LL: 'D MMMM YYYY', + LLL: 'D MMMM YYYY HH:mm', + LLLL: 'dddd, D MMMM YYYY HH:mm', + }, + calendar: { + sameDay: '[Бүгүн саат] LT', + nextDay: '[Эртең саат] LT', + nextWeek: 'dddd [саат] LT', + lastDay: '[Кечээ саат] LT', + lastWeek: '[Өткөн аптанын] dddd [күнү] [саат] LT', + sameElse: 'L', + }, + relativeTime: { + future: '%s ичинде', + past: '%s мурун', + s: 'бирнече секунд', + ss: '%d секунд', + m: 'бир мүнөт', + mm: '%d мүнөт', + h: 'бир саат', + hh: '%d саат', + d: 'бир күн', + dd: '%d күн', + M: 'бир ай', + MM: '%d ай', + y: 'бир жыл', + yy: '%d жыл', + }, + dayOfMonthOrdinalParse: /\d{1,2}-(чи|чы|чү|чу)/, + ordinal: function (number) { + var a = number % 10, + b = number >= 100 ? 100 : null; + return number + (suffixes$2[number] || suffixes$2[a] || suffixes$2[b]); + }, + week: { + dow: 1, // Monday is the first day of the week. + doy: 7, // The week that contains Jan 7th is the first week of the year. + }, + }); + + //! moment.js locale configuration + + function processRelativeTime$6(number, withoutSuffix, key, isFuture) { + var format = { + m: ['eng Minutt', 'enger Minutt'], + h: ['eng Stonn', 'enger Stonn'], + d: ['een Dag', 'engem Dag'], + M: ['ee Mount', 'engem Mount'], + y: ['ee Joer', 'engem Joer'], + }; + return withoutSuffix ? format[key][0] : format[key][1]; + } + function processFutureTime(string) { + var number = string.substr(0, string.indexOf(' ')); + if (eifelerRegelAppliesToNumber(number)) { + return 'a ' + string; + } + return 'an ' + string; + } + function processPastTime(string) { + var number = string.substr(0, string.indexOf(' ')); + if (eifelerRegelAppliesToNumber(number)) { + return 'viru ' + string; + } + return 'virun ' + string; + } + /** + * Returns true if the word before the given number loses the '-n' ending. + * e.g. 'an 10 Deeg' but 'a 5 Deeg' + * + * @param number {integer} + * @returns {boolean} + */ + function eifelerRegelAppliesToNumber(number) { + number = parseInt(number, 10); + if (isNaN(number)) { + return false; + } + if (number < 0) { + // Negative Number --> always true + return true; + } else if (number < 10) { + // Only 1 digit + if (4 <= number && number <= 7) { + return true; + } + return false; + } else if (number < 100) { + // 2 digits + var lastDigit = number % 10, + firstDigit = number / 10; + if (lastDigit === 0) { + return eifelerRegelAppliesToNumber(firstDigit); + } + return eifelerRegelAppliesToNumber(lastDigit); + } else if (number < 10000) { + // 3 or 4 digits --> recursively check first digit + while (number >= 10) { + number = number / 10; + } + return eifelerRegelAppliesToNumber(number); + } else { + // Anything larger than 4 digits: recursively check first n-3 digits + number = number / 1000; + return eifelerRegelAppliesToNumber(number); + } + } + + moment.defineLocale('lb', { + months: 'Januar_Februar_Mäerz_Abrëll_Mee_Juni_Juli_August_September_Oktober_November_Dezember'.split( + '_' + ), + monthsShort: 'Jan._Febr._Mrz._Abr._Mee_Jun._Jul._Aug._Sept._Okt._Nov._Dez.'.split( + '_' + ), + monthsParseExact: true, + weekdays: 'Sonndeg_Méindeg_Dënschdeg_Mëttwoch_Donneschdeg_Freideg_Samschdeg'.split( + '_' + ), + weekdaysShort: 'So._Mé._Dë._Më._Do._Fr._Sa.'.split('_'), + weekdaysMin: 'So_Mé_Dë_Më_Do_Fr_Sa'.split('_'), + weekdaysParseExact: true, + longDateFormat: { + LT: 'H:mm [Auer]', + LTS: 'H:mm:ss [Auer]', + L: 'DD.MM.YYYY', + LL: 'D. MMMM YYYY', + LLL: 'D. MMMM YYYY H:mm [Auer]', + LLLL: 'dddd, D. MMMM YYYY H:mm [Auer]', + }, + calendar: { + sameDay: '[Haut um] LT', + sameElse: 'L', + nextDay: '[Muer um] LT', + nextWeek: 'dddd [um] LT', + lastDay: '[Gëschter um] LT', + lastWeek: function () { + // Different date string for 'Dënschdeg' (Tuesday) and 'Donneschdeg' (Thursday) due to phonological rule + switch (this.day()) { + case 2: + case 4: + return '[Leschten] dddd [um] LT'; + default: + return '[Leschte] dddd [um] LT'; + } + }, + }, + relativeTime: { + future: processFutureTime, + past: processPastTime, + s: 'e puer Sekonnen', + ss: '%d Sekonnen', + m: processRelativeTime$6, + mm: '%d Minutten', + h: processRelativeTime$6, + hh: '%d Stonnen', + d: processRelativeTime$6, + dd: '%d Deeg', + M: processRelativeTime$6, + MM: '%d Méint', + y: processRelativeTime$6, + yy: '%d Joer', + }, + dayOfMonthOrdinalParse: /\d{1,2}\./, + ordinal: '%d.', + week: { + dow: 1, // Monday is the first day of the week. + doy: 4, // The week that contains Jan 4th is the first week of the year. + }, + }); + + //! moment.js locale configuration + + moment.defineLocale('lo', { + months: 'ມັງກອນ_ກຸມພາ_ມີນາ_ເມສາ_ພຶດສະພາ_ມິຖຸນາ_ກໍລະກົດ_ສິງຫາ_ກັນຍາ_ຕຸລາ_ພະຈິກ_ທັນວາ'.split( + '_' + ), + monthsShort: 'ມັງກອນ_ກຸມພາ_ມີນາ_ເມສາ_ພຶດສະພາ_ມິຖຸນາ_ກໍລະກົດ_ສິງຫາ_ກັນຍາ_ຕຸລາ_ພະຈິກ_ທັນວາ'.split( + '_' + ), + weekdays: 'ອາທິດ_ຈັນ_ອັງຄານ_ພຸດ_ພະຫັດ_ສຸກ_ເສົາ'.split('_'), + weekdaysShort: 'ທິດ_ຈັນ_ອັງຄານ_ພຸດ_ພະຫັດ_ສຸກ_ເສົາ'.split('_'), + weekdaysMin: 'ທ_ຈ_ອຄ_ພ_ພຫ_ສກ_ສ'.split('_'), + weekdaysParseExact: true, + longDateFormat: { + LT: 'HH:mm', + LTS: 'HH:mm:ss', + L: 'DD/MM/YYYY', + LL: 'D MMMM YYYY', + LLL: 'D MMMM YYYY HH:mm', + LLLL: 'ວັນdddd D MMMM YYYY HH:mm', + }, + meridiemParse: /ຕອນເຊົ້າ|ຕອນແລງ/, + isPM: function (input) { + return input === 'ຕອນແລງ'; + }, + meridiem: function (hour, minute, isLower) { + if (hour < 12) { + return 'ຕອນເຊົ້າ'; + } else { + return 'ຕອນແລງ'; + } + }, + calendar: { + sameDay: '[ມື້ນີ້ເວລາ] LT', + nextDay: '[ມື້ອື່ນເວລາ] LT', + nextWeek: '[ວັນ]dddd[ໜ້າເວລາ] LT', + lastDay: '[ມື້ວານນີ້ເວລາ] LT', + lastWeek: '[ວັນ]dddd[ແລ້ວນີ້ເວລາ] LT', + sameElse: 'L', + }, + relativeTime: { + future: 'ອີກ %s', + past: '%sຜ່ານມາ', + s: 'ບໍ່ເທົ່າໃດວິນາທີ', + ss: '%d ວິນາທີ', + m: '1 ນາທີ', + mm: '%d ນາທີ', + h: '1 ຊົ່ວໂມງ', + hh: '%d ຊົ່ວໂມງ', + d: '1 ມື້', + dd: '%d ມື້', + M: '1 ເດືອນ', + MM: '%d ເດືອນ', + y: '1 ປີ', + yy: '%d ປີ', + }, + dayOfMonthOrdinalParse: /(ທີ່)\d{1,2}/, + ordinal: function (number) { + return 'ທີ່' + number; + }, + }); + + //! moment.js locale configuration + + var units = { + ss: 'sekundė_sekundžių_sekundes', + m: 'minutė_minutės_minutę', + mm: 'minutės_minučių_minutes', + h: 'valanda_valandos_valandą', + hh: 'valandos_valandų_valandas', + d: 'diena_dienos_dieną', + dd: 'dienos_dienų_dienas', + M: 'mėnuo_mėnesio_mėnesį', + MM: 'mėnesiai_mėnesių_mėnesius', + y: 'metai_metų_metus', + yy: 'metai_metų_metus', + }; + function translateSeconds(number, withoutSuffix, key, isFuture) { + if (withoutSuffix) { + return 'kelios sekundės'; + } else { + return isFuture ? 'kelių sekundžių' : 'kelias sekundes'; + } + } + function translateSingular(number, withoutSuffix, key, isFuture) { + return withoutSuffix + ? forms(key)[0] + : isFuture + ? forms(key)[1] + : forms(key)[2]; + } + function special(number) { + return number % 10 === 0 || (number > 10 && number < 20); + } + function forms(key) { + return units[key].split('_'); + } + function translate$6(number, withoutSuffix, key, isFuture) { + var result = number + ' '; + if (number === 1) { + return ( + result + translateSingular(number, withoutSuffix, key[0], isFuture) + ); + } else if (withoutSuffix) { + return result + (special(number) ? forms(key)[1] : forms(key)[0]); + } else { + if (isFuture) { + return result + forms(key)[1]; + } else { + return result + (special(number) ? forms(key)[1] : forms(key)[2]); + } + } + } + moment.defineLocale('lt', { + months: { + format: 'sausio_vasario_kovo_balandžio_gegužės_birželio_liepos_rugpjūčio_rugsėjo_spalio_lapkričio_gruodžio'.split( + '_' + ), + standalone: 'sausis_vasaris_kovas_balandis_gegužė_birželis_liepa_rugpjūtis_rugsėjis_spalis_lapkritis_gruodis'.split( + '_' + ), + isFormat: /D[oD]?(\[[^\[\]]*\]|\s)+MMMM?|MMMM?(\[[^\[\]]*\]|\s)+D[oD]?/, + }, + monthsShort: 'sau_vas_kov_bal_geg_bir_lie_rgp_rgs_spa_lap_grd'.split('_'), + weekdays: { + format: 'sekmadienį_pirmadienį_antradienį_trečiadienį_ketvirtadienį_penktadienį_šeštadienį'.split( + '_' + ), + standalone: 'sekmadienis_pirmadienis_antradienis_trečiadienis_ketvirtadienis_penktadienis_šeštadienis'.split( + '_' + ), + isFormat: /dddd HH:mm/, + }, + weekdaysShort: 'Sek_Pir_Ant_Tre_Ket_Pen_Šeš'.split('_'), + weekdaysMin: 'S_P_A_T_K_Pn_Š'.split('_'), + weekdaysParseExact: true, + longDateFormat: { + LT: 'HH:mm', + LTS: 'HH:mm:ss', + L: 'YYYY-MM-DD', + LL: 'YYYY [m.] MMMM D [d.]', + LLL: 'YYYY [m.] MMMM D [d.], HH:mm [val.]', + LLLL: 'YYYY [m.] MMMM D [d.], dddd, HH:mm [val.]', + l: 'YYYY-MM-DD', + ll: 'YYYY [m.] MMMM D [d.]', + lll: 'YYYY [m.] MMMM D [d.], HH:mm [val.]', + llll: 'YYYY [m.] MMMM D [d.], ddd, HH:mm [val.]', + }, + calendar: { + sameDay: '[Šiandien] LT', + nextDay: '[Rytoj] LT', + nextWeek: 'dddd LT', + lastDay: '[Vakar] LT', + lastWeek: '[Praėjusį] dddd LT', + sameElse: 'L', + }, + relativeTime: { + future: 'po %s', + past: 'prieš %s', + s: translateSeconds, + ss: translate$6, + m: translateSingular, + mm: translate$6, + h: translateSingular, + hh: translate$6, + d: translateSingular, + dd: translate$6, + M: translateSingular, + MM: translate$6, + y: translateSingular, + yy: translate$6, + }, + dayOfMonthOrdinalParse: /\d{1,2}-oji/, + ordinal: function (number) { + return number + '-oji'; + }, + week: { + dow: 1, // Monday is the first day of the week. + doy: 4, // The week that contains Jan 4th is the first week of the year. + }, + }); + + //! moment.js locale configuration + + var units$1 = { + ss: 'sekundes_sekundēm_sekunde_sekundes'.split('_'), + m: 'minūtes_minūtēm_minūte_minūtes'.split('_'), + mm: 'minūtes_minūtēm_minūte_minūtes'.split('_'), + h: 'stundas_stundām_stunda_stundas'.split('_'), + hh: 'stundas_stundām_stunda_stundas'.split('_'), + d: 'dienas_dienām_diena_dienas'.split('_'), + dd: 'dienas_dienām_diena_dienas'.split('_'), + M: 'mēneša_mēnešiem_mēnesis_mēneši'.split('_'), + MM: 'mēneša_mēnešiem_mēnesis_mēneši'.split('_'), + y: 'gada_gadiem_gads_gadi'.split('_'), + yy: 'gada_gadiem_gads_gadi'.split('_'), + }; + /** + * @param withoutSuffix boolean true = a length of time; false = before/after a period of time. + */ + function format(forms, number, withoutSuffix) { + if (withoutSuffix) { + // E.g. "21 minūte", "3 minūtes". + return number % 10 === 1 && number % 100 !== 11 ? forms[2] : forms[3]; + } else { + // E.g. "21 minūtes" as in "pēc 21 minūtes". + // E.g. "3 minūtēm" as in "pēc 3 minūtēm". + return number % 10 === 1 && number % 100 !== 11 ? forms[0] : forms[1]; + } + } + function relativeTimeWithPlural$1(number, withoutSuffix, key) { + return number + ' ' + format(units$1[key], number, withoutSuffix); + } + function relativeTimeWithSingular(number, withoutSuffix, key) { + return format(units$1[key], number, withoutSuffix); + } + function relativeSeconds(number, withoutSuffix) { + return withoutSuffix ? 'dažas sekundes' : 'dažām sekundēm'; + } + + moment.defineLocale('lv', { + months: 'janvāris_februāris_marts_aprīlis_maijs_jūnijs_jūlijs_augusts_septembris_oktobris_novembris_decembris'.split( + '_' + ), + monthsShort: 'jan_feb_mar_apr_mai_jūn_jūl_aug_sep_okt_nov_dec'.split('_'), + weekdays: 'svētdiena_pirmdiena_otrdiena_trešdiena_ceturtdiena_piektdiena_sestdiena'.split( + '_' + ), + weekdaysShort: 'Sv_P_O_T_C_Pk_S'.split('_'), + weekdaysMin: 'Sv_P_O_T_C_Pk_S'.split('_'), + weekdaysParseExact: true, + longDateFormat: { + LT: 'HH:mm', + LTS: 'HH:mm:ss', + L: 'DD.MM.YYYY.', + LL: 'YYYY. [gada] D. MMMM', + LLL: 'YYYY. [gada] D. MMMM, HH:mm', + LLLL: 'YYYY. [gada] D. MMMM, dddd, HH:mm', + }, + calendar: { + sameDay: '[Šodien pulksten] LT', + nextDay: '[Rīt pulksten] LT', + nextWeek: 'dddd [pulksten] LT', + lastDay: '[Vakar pulksten] LT', + lastWeek: '[Pagājušā] dddd [pulksten] LT', + sameElse: 'L', + }, + relativeTime: { + future: 'pēc %s', + past: 'pirms %s', + s: relativeSeconds, + ss: relativeTimeWithPlural$1, + m: relativeTimeWithSingular, + mm: relativeTimeWithPlural$1, + h: relativeTimeWithSingular, + hh: relativeTimeWithPlural$1, + d: relativeTimeWithSingular, + dd: relativeTimeWithPlural$1, + M: relativeTimeWithSingular, + MM: relativeTimeWithPlural$1, + y: relativeTimeWithSingular, + yy: relativeTimeWithPlural$1, + }, + dayOfMonthOrdinalParse: /\d{1,2}\./, + ordinal: '%d.', + week: { + dow: 1, // Monday is the first day of the week. + doy: 4, // The week that contains Jan 4th is the first week of the year. + }, + }); + + //! moment.js locale configuration + + var translator = { + words: { + //Different grammatical cases + ss: ['sekund', 'sekunda', 'sekundi'], + m: ['jedan minut', 'jednog minuta'], + mm: ['minut', 'minuta', 'minuta'], + h: ['jedan sat', 'jednog sata'], + hh: ['sat', 'sata', 'sati'], + dd: ['dan', 'dana', 'dana'], + MM: ['mjesec', 'mjeseca', 'mjeseci'], + yy: ['godina', 'godine', 'godina'], + }, + correctGrammaticalCase: function (number, wordKey) { + return number === 1 + ? wordKey[0] + : number >= 2 && number <= 4 + ? wordKey[1] + : wordKey[2]; + }, + translate: function (number, withoutSuffix, key) { + var wordKey = translator.words[key]; + if (key.length === 1) { + return withoutSuffix ? wordKey[0] : wordKey[1]; + } else { + return ( + number + + ' ' + + translator.correctGrammaticalCase(number, wordKey) + ); + } + }, + }; + + moment.defineLocale('me', { + months: 'januar_februar_mart_april_maj_jun_jul_avgust_septembar_oktobar_novembar_decembar'.split( + '_' + ), + monthsShort: 'jan._feb._mar._apr._maj_jun_jul_avg._sep._okt._nov._dec.'.split( + '_' + ), + monthsParseExact: true, + weekdays: 'nedjelja_ponedjeljak_utorak_srijeda_četvrtak_petak_subota'.split( + '_' + ), + weekdaysShort: 'ned._pon._uto._sri._čet._pet._sub.'.split('_'), + weekdaysMin: 'ne_po_ut_sr_če_pe_su'.split('_'), + weekdaysParseExact: true, + longDateFormat: { + LT: 'H:mm', + LTS: 'H:mm:ss', + L: 'DD.MM.YYYY', + LL: 'D. MMMM YYYY', + LLL: 'D. MMMM YYYY H:mm', + LLLL: 'dddd, D. MMMM YYYY H:mm', + }, + calendar: { + sameDay: '[danas u] LT', + nextDay: '[sjutra u] LT', + + nextWeek: function () { + switch (this.day()) { + case 0: + return '[u] [nedjelju] [u] LT'; + case 3: + return '[u] [srijedu] [u] LT'; + case 6: + return '[u] [subotu] [u] LT'; + case 1: + case 2: + case 4: + case 5: + return '[u] dddd [u] LT'; + } + }, + lastDay: '[juče u] LT', + lastWeek: function () { + var lastWeekDays = [ + '[prošle] [nedjelje] [u] LT', + '[prošlog] [ponedjeljka] [u] LT', + '[prošlog] [utorka] [u] LT', + '[prošle] [srijede] [u] LT', + '[prošlog] [četvrtka] [u] LT', + '[prošlog] [petka] [u] LT', + '[prošle] [subote] [u] LT', + ]; + return lastWeekDays[this.day()]; + }, + sameElse: 'L', + }, + relativeTime: { + future: 'za %s', + past: 'prije %s', + s: 'nekoliko sekundi', + ss: translator.translate, + m: translator.translate, + mm: translator.translate, + h: translator.translate, + hh: translator.translate, + d: 'dan', + dd: translator.translate, + M: 'mjesec', + MM: translator.translate, + y: 'godinu', + yy: translator.translate, + }, + dayOfMonthOrdinalParse: /\d{1,2}\./, + ordinal: '%d.', + week: { + dow: 1, // Monday is the first day of the week. + doy: 7, // The week that contains Jan 7th is the first week of the year. + }, + }); + + //! moment.js locale configuration + + moment.defineLocale('mi', { + months: 'Kohi-tāte_Hui-tanguru_Poutū-te-rangi_Paenga-whāwhā_Haratua_Pipiri_Hōngoingoi_Here-turi-kōkā_Mahuru_Whiringa-ā-nuku_Whiringa-ā-rangi_Hakihea'.split( + '_' + ), + monthsShort: 'Kohi_Hui_Pou_Pae_Hara_Pipi_Hōngoi_Here_Mahu_Whi-nu_Whi-ra_Haki'.split( + '_' + ), + monthsRegex: /(?:['a-z\u0101\u014D\u016B]+\-?){1,3}/i, + monthsStrictRegex: /(?:['a-z\u0101\u014D\u016B]+\-?){1,3}/i, + monthsShortRegex: /(?:['a-z\u0101\u014D\u016B]+\-?){1,3}/i, + monthsShortStrictRegex: /(?:['a-z\u0101\u014D\u016B]+\-?){1,2}/i, + weekdays: 'Rātapu_Mane_Tūrei_Wenerei_Tāite_Paraire_Hātarei'.split('_'), + weekdaysShort: 'Ta_Ma_Tū_We_Tāi_Pa_Hā'.split('_'), + weekdaysMin: 'Ta_Ma_Tū_We_Tāi_Pa_Hā'.split('_'), + longDateFormat: { + LT: 'HH:mm', + LTS: 'HH:mm:ss', + L: 'DD/MM/YYYY', + LL: 'D MMMM YYYY', + LLL: 'D MMMM YYYY [i] HH:mm', + LLLL: 'dddd, D MMMM YYYY [i] HH:mm', + }, + calendar: { + sameDay: '[i teie mahana, i] LT', + nextDay: '[apopo i] LT', + nextWeek: 'dddd [i] LT', + lastDay: '[inanahi i] LT', + lastWeek: 'dddd [whakamutunga i] LT', + sameElse: 'L', + }, + relativeTime: { + future: 'i roto i %s', + past: '%s i mua', + s: 'te hēkona ruarua', + ss: '%d hēkona', + m: 'he meneti', + mm: '%d meneti', + h: 'te haora', + hh: '%d haora', + d: 'he ra', + dd: '%d ra', + M: 'he marama', + MM: '%d marama', + y: 'he tau', + yy: '%d tau', + }, + dayOfMonthOrdinalParse: /\d{1,2}º/, + ordinal: '%dº', + week: { + dow: 1, // Monday is the first day of the week. + doy: 4, // The week that contains Jan 4th is the first week of the year. + }, + }); + + //! moment.js locale configuration + + moment.defineLocale('mk', { + months: 'јануари_февруари_март_април_мај_јуни_јули_август_септември_октомври_ноември_декември'.split( + '_' + ), + monthsShort: 'јан_фев_мар_апр_мај_јун_јул_авг_сеп_окт_ное_дек'.split('_'), + weekdays: 'недела_понеделник_вторник_среда_четврток_петок_сабота'.split( + '_' + ), + weekdaysShort: 'нед_пон_вто_сре_чет_пет_саб'.split('_'), + weekdaysMin: 'нe_пo_вт_ср_че_пе_сa'.split('_'), + longDateFormat: { + LT: 'H:mm', + LTS: 'H:mm:ss', + L: 'D.MM.YYYY', + LL: 'D MMMM YYYY', + LLL: 'D MMMM YYYY H:mm', + LLLL: 'dddd, D MMMM YYYY H:mm', + }, + calendar: { + sameDay: '[Денес во] LT', + nextDay: '[Утре во] LT', + nextWeek: '[Во] dddd [во] LT', + lastDay: '[Вчера во] LT', + lastWeek: function () { + switch (this.day()) { + case 0: + case 3: + case 6: + return '[Изминатата] dddd [во] LT'; + case 1: + case 2: + case 4: + case 5: + return '[Изминатиот] dddd [во] LT'; + } + }, + sameElse: 'L', + }, + relativeTime: { + future: 'за %s', + past: 'пред %s', + s: 'неколку секунди', + ss: '%d секунди', + m: 'една минута', + mm: '%d минути', + h: 'еден час', + hh: '%d часа', + d: 'еден ден', + dd: '%d дена', + M: 'еден месец', + MM: '%d месеци', + y: 'една година', + yy: '%d години', + }, + dayOfMonthOrdinalParse: /\d{1,2}-(ев|ен|ти|ви|ри|ми)/, + ordinal: function (number) { + var lastDigit = number % 10, + last2Digits = number % 100; + if (number === 0) { + return number + '-ев'; + } else if (last2Digits === 0) { + return number + '-ен'; + } else if (last2Digits > 10 && last2Digits < 20) { + return number + '-ти'; + } else if (lastDigit === 1) { + return number + '-ви'; + } else if (lastDigit === 2) { + return number + '-ри'; + } else if (lastDigit === 7 || lastDigit === 8) { + return number + '-ми'; + } else { + return number + '-ти'; + } + }, + week: { + dow: 1, // Monday is the first day of the week. + doy: 7, // The week that contains Jan 7th is the first week of the year. + }, + }); + + //! moment.js locale configuration + + moment.defineLocale('ml', { + months: 'ജനുവരി_ഫെബ്രുവരി_മാർച്ച്_ഏപ്രിൽ_മേയ്_ജൂൺ_ജൂലൈ_ഓഗസ്റ്റ്_സെപ്റ്റംബർ_ഒക്ടോബർ_നവംബർ_ഡിസംബർ'.split( + '_' + ), + monthsShort: 'ജനു._ഫെബ്രു._മാർ._ഏപ്രി._മേയ്_ജൂൺ_ജൂലൈ._ഓഗ._സെപ്റ്റ._ഒക്ടോ._നവം._ഡിസം.'.split( + '_' + ), + monthsParseExact: true, + weekdays: 'ഞായറാഴ്ച_തിങ്കളാഴ്ച_ചൊവ്വാഴ്ച_ബുധനാഴ്ച_വ്യാഴാഴ്ച_വെള്ളിയാഴ്ച_ശനിയാഴ്ച'.split( + '_' + ), + weekdaysShort: 'ഞായർ_തിങ്കൾ_ചൊവ്വ_ബുധൻ_വ്യാഴം_വെള്ളി_ശനി'.split('_'), + weekdaysMin: 'ഞാ_തി_ചൊ_ബു_വ്യാ_വെ_ശ'.split('_'), + longDateFormat: { + LT: 'A h:mm -നു', + LTS: 'A h:mm:ss -നു', + L: 'DD/MM/YYYY', + LL: 'D MMMM YYYY', + LLL: 'D MMMM YYYY, A h:mm -നു', + LLLL: 'dddd, D MMMM YYYY, A h:mm -നു', + }, + calendar: { + sameDay: '[ഇന്ന്] LT', + nextDay: '[നാളെ] LT', + nextWeek: 'dddd, LT', + lastDay: '[ഇന്നലെ] LT', + lastWeek: '[കഴിഞ്ഞ] dddd, LT', + sameElse: 'L', + }, + relativeTime: { + future: '%s കഴിഞ്ഞ്', + past: '%s മുൻപ്', + s: 'അൽപ നിമിഷങ്ങൾ', + ss: '%d സെക്കൻഡ്', + m: 'ഒരു മിനിറ്റ്', + mm: '%d മിനിറ്റ്', + h: 'ഒരു മണിക്കൂർ', + hh: '%d മണിക്കൂർ', + d: 'ഒരു ദിവസം', + dd: '%d ദിവസം', + M: 'ഒരു മാസം', + MM: '%d മാസം', + y: 'ഒരു വർഷം', + yy: '%d വർഷം', + }, + meridiemParse: /രാത്രി|രാവിലെ|ഉച്ച കഴിഞ്ഞ്|വൈകുന്നേരം|രാത്രി/i, + meridiemHour: function (hour, meridiem) { + if (hour === 12) { + hour = 0; + } + if ( + (meridiem === 'രാത്രി' && hour >= 4) || + meridiem === 'ഉച്ച കഴിഞ്ഞ്' || + meridiem === 'വൈകുന്നേരം' + ) { + return hour + 12; + } else { + return hour; + } + }, + meridiem: function (hour, minute, isLower) { + if (hour < 4) { + return 'രാത്രി'; + } else if (hour < 12) { + return 'രാവിലെ'; + } else if (hour < 17) { + return 'ഉച്ച കഴിഞ്ഞ്'; + } else if (hour < 20) { + return 'വൈകുന്നേരം'; + } else { + return 'രാത്രി'; + } + }, + }); + + //! moment.js locale configuration + + function translate$7(number, withoutSuffix, key, isFuture) { + switch (key) { + case 's': + return withoutSuffix ? 'хэдхэн секунд' : 'хэдхэн секундын'; + case 'ss': + return number + (withoutSuffix ? ' секунд' : ' секундын'); + case 'm': + case 'mm': + return number + (withoutSuffix ? ' минут' : ' минутын'); + case 'h': + case 'hh': + return number + (withoutSuffix ? ' цаг' : ' цагийн'); + case 'd': + case 'dd': + return number + (withoutSuffix ? ' өдөр' : ' өдрийн'); + case 'M': + case 'MM': + return number + (withoutSuffix ? ' сар' : ' сарын'); + case 'y': + case 'yy': + return number + (withoutSuffix ? ' жил' : ' жилийн'); + default: + return number; + } + } + + moment.defineLocale('mn', { + months: 'Нэгдүгээр сар_Хоёрдугаар сар_Гуравдугаар сар_Дөрөвдүгээр сар_Тавдугаар сар_Зургадугаар сар_Долдугаар сар_Наймдугаар сар_Есдүгээр сар_Аравдугаар сар_Арван нэгдүгээр сар_Арван хоёрдугаар сар'.split( + '_' + ), + monthsShort: '1 сар_2 сар_3 сар_4 сар_5 сар_6 сар_7 сар_8 сар_9 сар_10 сар_11 сар_12 сар'.split( + '_' + ), + monthsParseExact: true, + weekdays: 'Ням_Даваа_Мягмар_Лхагва_Пүрэв_Баасан_Бямба'.split('_'), + weekdaysShort: 'Ням_Дав_Мяг_Лха_Пүр_Баа_Бям'.split('_'), + weekdaysMin: 'Ня_Да_Мя_Лх_Пү_Ба_Бя'.split('_'), + weekdaysParseExact: true, + longDateFormat: { + LT: 'HH:mm', + LTS: 'HH:mm:ss', + L: 'YYYY-MM-DD', + LL: 'YYYY оны MMMMын D', + LLL: 'YYYY оны MMMMын D HH:mm', + LLLL: 'dddd, YYYY оны MMMMын D HH:mm', + }, + meridiemParse: /ҮӨ|ҮХ/i, + isPM: function (input) { + return input === 'ҮХ'; + }, + meridiem: function (hour, minute, isLower) { + if (hour < 12) { + return 'ҮӨ'; + } else { + return 'ҮХ'; + } + }, + calendar: { + sameDay: '[Өнөөдөр] LT', + nextDay: '[Маргааш] LT', + nextWeek: '[Ирэх] dddd LT', + lastDay: '[Өчигдөр] LT', + lastWeek: '[Өнгөрсөн] dddd LT', + sameElse: 'L', + }, + relativeTime: { + future: '%s дараа', + past: '%s өмнө', + s: translate$7, + ss: translate$7, + m: translate$7, + mm: translate$7, + h: translate$7, + hh: translate$7, + d: translate$7, + dd: translate$7, + M: translate$7, + MM: translate$7, + y: translate$7, + yy: translate$7, + }, + dayOfMonthOrdinalParse: /\d{1,2} өдөр/, + ordinal: function (number, period) { + switch (period) { + case 'd': + case 'D': + case 'DDD': + return number + ' өдөр'; + default: + return number; + } + }, + }); + + //! moment.js locale configuration + + var symbolMap$b = { + '1': '१', + '2': '२', + '3': '३', + '4': '४', + '5': '५', + '6': '६', + '7': '७', + '8': '८', + '9': '९', + '0': '०', + }, + numberMap$a = { + '१': '1', + '२': '2', + '३': '3', + '४': '4', + '५': '5', + '६': '6', + '७': '7', + '८': '8', + '९': '9', + '०': '0', + }; + + function relativeTimeMr(number, withoutSuffix, string, isFuture) { + var output = ''; + if (withoutSuffix) { + switch (string) { + case 's': + output = 'काही सेकंद'; + break; + case 'ss': + output = '%d सेकंद'; + break; + case 'm': + output = 'एक मिनिट'; + break; + case 'mm': + output = '%d मिनिटे'; + break; + case 'h': + output = 'एक तास'; + break; + case 'hh': + output = '%d तास'; + break; + case 'd': + output = 'एक दिवस'; + break; + case 'dd': + output = '%d दिवस'; + break; + case 'M': + output = 'एक महिना'; + break; + case 'MM': + output = '%d महिने'; + break; + case 'y': + output = 'एक वर्ष'; + break; + case 'yy': + output = '%d वर्षे'; + break; + } + } else { + switch (string) { + case 's': + output = 'काही सेकंदां'; + break; + case 'ss': + output = '%d सेकंदां'; + break; + case 'm': + output = 'एका मिनिटा'; + break; + case 'mm': + output = '%d मिनिटां'; + break; + case 'h': + output = 'एका तासा'; + break; + case 'hh': + output = '%d तासां'; + break; + case 'd': + output = 'एका दिवसा'; + break; + case 'dd': + output = '%d दिवसां'; + break; + case 'M': + output = 'एका महिन्या'; + break; + case 'MM': + output = '%d महिन्यां'; + break; + case 'y': + output = 'एका वर्षा'; + break; + case 'yy': + output = '%d वर्षां'; + break; + } + } + return output.replace(/%d/i, number); + } + + moment.defineLocale('mr', { + months: 'जानेवारी_फेब्रुवारी_मार्च_एप्रिल_मे_जून_जुलै_ऑगस्ट_सप्टेंबर_ऑक्टोबर_नोव्हेंबर_डिसेंबर'.split( + '_' + ), + monthsShort: 'जाने._फेब्रु._मार्च._एप्रि._मे._जून._जुलै._ऑग._सप्टें._ऑक्टो._नोव्हें._डिसें.'.split( + '_' + ), + monthsParseExact: true, + weekdays: 'रविवार_सोमवार_मंगळवार_बुधवार_गुरूवार_शुक्रवार_शनिवार'.split('_'), + weekdaysShort: 'रवि_सोम_मंगळ_बुध_गुरू_शुक्र_शनि'.split('_'), + weekdaysMin: 'र_सो_मं_बु_गु_शु_श'.split('_'), + longDateFormat: { + LT: 'A h:mm वाजता', + LTS: 'A h:mm:ss वाजता', + L: 'DD/MM/YYYY', + LL: 'D MMMM YYYY', + LLL: 'D MMMM YYYY, A h:mm वाजता', + LLLL: 'dddd, D MMMM YYYY, A h:mm वाजता', + }, + calendar: { + sameDay: '[आज] LT', + nextDay: '[उद्या] LT', + nextWeek: 'dddd, LT', + lastDay: '[काल] LT', + lastWeek: '[मागील] dddd, LT', + sameElse: 'L', + }, + relativeTime: { + future: '%sमध्ये', + past: '%sपूर्वी', + s: relativeTimeMr, + ss: relativeTimeMr, + m: relativeTimeMr, + mm: relativeTimeMr, + h: relativeTimeMr, + hh: relativeTimeMr, + d: relativeTimeMr, + dd: relativeTimeMr, + M: relativeTimeMr, + MM: relativeTimeMr, + y: relativeTimeMr, + yy: relativeTimeMr, + }, + preparse: function (string) { + return string.replace(/[१२३४५६७८९०]/g, function (match) { + return numberMap$a[match]; + }); + }, + postformat: function (string) { + return string.replace(/\d/g, function (match) { + return symbolMap$b[match]; + }); + }, + meridiemParse: /पहाटे|सकाळी|दुपारी|सायंकाळी|रात्री/, + meridiemHour: function (hour, meridiem) { + if (hour === 12) { + hour = 0; + } + if (meridiem === 'पहाटे' || meridiem === 'सकाळी') { + return hour; + } else if ( + meridiem === 'दुपारी' || + meridiem === 'सायंकाळी' || + meridiem === 'रात्री' + ) { + return hour >= 12 ? hour : hour + 12; + } + }, + meridiem: function (hour, minute, isLower) { + if (hour >= 0 && hour < 6) { + return 'पहाटे'; + } else if (hour < 12) { + return 'सकाळी'; + } else if (hour < 17) { + return 'दुपारी'; + } else if (hour < 20) { + return 'सायंकाळी'; + } else { + return 'रात्री'; + } + }, + week: { + dow: 0, // Sunday is the first day of the week. + doy: 6, // The week that contains Jan 6th is the first week of the year. + }, + }); + + //! moment.js locale configuration + + moment.defineLocale('ms-my', { + months: 'Januari_Februari_Mac_April_Mei_Jun_Julai_Ogos_September_Oktober_November_Disember'.split( + '_' + ), + monthsShort: 'Jan_Feb_Mac_Apr_Mei_Jun_Jul_Ogs_Sep_Okt_Nov_Dis'.split('_'), + weekdays: 'Ahad_Isnin_Selasa_Rabu_Khamis_Jumaat_Sabtu'.split('_'), + weekdaysShort: 'Ahd_Isn_Sel_Rab_Kha_Jum_Sab'.split('_'), + weekdaysMin: 'Ah_Is_Sl_Rb_Km_Jm_Sb'.split('_'), + longDateFormat: { + LT: 'HH.mm', + LTS: 'HH.mm.ss', + L: 'DD/MM/YYYY', + LL: 'D MMMM YYYY', + LLL: 'D MMMM YYYY [pukul] HH.mm', + LLLL: 'dddd, D MMMM YYYY [pukul] HH.mm', + }, + meridiemParse: /pagi|tengahari|petang|malam/, + meridiemHour: function (hour, meridiem) { + if (hour === 12) { + hour = 0; + } + if (meridiem === 'pagi') { + return hour; + } else if (meridiem === 'tengahari') { + return hour >= 11 ? hour : hour + 12; + } else if (meridiem === 'petang' || meridiem === 'malam') { + return hour + 12; + } + }, + meridiem: function (hours, minutes, isLower) { + if (hours < 11) { + return 'pagi'; + } else if (hours < 15) { + return 'tengahari'; + } else if (hours < 19) { + return 'petang'; + } else { + return 'malam'; + } + }, + calendar: { + sameDay: '[Hari ini pukul] LT', + nextDay: '[Esok pukul] LT', + nextWeek: 'dddd [pukul] LT', + lastDay: '[Kelmarin pukul] LT', + lastWeek: 'dddd [lepas pukul] LT', + sameElse: 'L', + }, + relativeTime: { + future: 'dalam %s', + past: '%s yang lepas', + s: 'beberapa saat', + ss: '%d saat', + m: 'seminit', + mm: '%d minit', + h: 'sejam', + hh: '%d jam', + d: 'sehari', + dd: '%d hari', + M: 'sebulan', + MM: '%d bulan', + y: 'setahun', + yy: '%d tahun', + }, + week: { + dow: 1, // Monday is the first day of the week. + doy: 7, // The week that contains Jan 7th is the first week of the year. + }, + }); + + //! moment.js locale configuration + + moment.defineLocale('ms', { + months: 'Januari_Februari_Mac_April_Mei_Jun_Julai_Ogos_September_Oktober_November_Disember'.split( + '_' + ), + monthsShort: 'Jan_Feb_Mac_Apr_Mei_Jun_Jul_Ogs_Sep_Okt_Nov_Dis'.split('_'), + weekdays: 'Ahad_Isnin_Selasa_Rabu_Khamis_Jumaat_Sabtu'.split('_'), + weekdaysShort: 'Ahd_Isn_Sel_Rab_Kha_Jum_Sab'.split('_'), + weekdaysMin: 'Ah_Is_Sl_Rb_Km_Jm_Sb'.split('_'), + longDateFormat: { + LT: 'HH.mm', + LTS: 'HH.mm.ss', + L: 'DD/MM/YYYY', + LL: 'D MMMM YYYY', + LLL: 'D MMMM YYYY [pukul] HH.mm', + LLLL: 'dddd, D MMMM YYYY [pukul] HH.mm', + }, + meridiemParse: /pagi|tengahari|petang|malam/, + meridiemHour: function (hour, meridiem) { + if (hour === 12) { + hour = 0; + } + if (meridiem === 'pagi') { + return hour; + } else if (meridiem === 'tengahari') { + return hour >= 11 ? hour : hour + 12; + } else if (meridiem === 'petang' || meridiem === 'malam') { + return hour + 12; + } + }, + meridiem: function (hours, minutes, isLower) { + if (hours < 11) { + return 'pagi'; + } else if (hours < 15) { + return 'tengahari'; + } else if (hours < 19) { + return 'petang'; + } else { + return 'malam'; + } + }, + calendar: { + sameDay: '[Hari ini pukul] LT', + nextDay: '[Esok pukul] LT', + nextWeek: 'dddd [pukul] LT', + lastDay: '[Kelmarin pukul] LT', + lastWeek: 'dddd [lepas pukul] LT', + sameElse: 'L', + }, + relativeTime: { + future: 'dalam %s', + past: '%s yang lepas', + s: 'beberapa saat', + ss: '%d saat', + m: 'seminit', + mm: '%d minit', + h: 'sejam', + hh: '%d jam', + d: 'sehari', + dd: '%d hari', + M: 'sebulan', + MM: '%d bulan', + y: 'setahun', + yy: '%d tahun', + }, + week: { + dow: 1, // Monday is the first day of the week. + doy: 7, // The week that contains Jan 7th is the first week of the year. + }, + }); + + //! moment.js locale configuration + + moment.defineLocale('mt', { + months: 'Jannar_Frar_Marzu_April_Mejju_Ġunju_Lulju_Awwissu_Settembru_Ottubru_Novembru_Diċembru'.split( + '_' + ), + monthsShort: 'Jan_Fra_Mar_Apr_Mej_Ġun_Lul_Aww_Set_Ott_Nov_Diċ'.split('_'), + weekdays: 'Il-Ħadd_It-Tnejn_It-Tlieta_L-Erbgħa_Il-Ħamis_Il-Ġimgħa_Is-Sibt'.split( + '_' + ), + weekdaysShort: 'Ħad_Tne_Tli_Erb_Ħam_Ġim_Sib'.split('_'), + weekdaysMin: 'Ħa_Tn_Tl_Er_Ħa_Ġi_Si'.split('_'), + longDateFormat: { + LT: 'HH:mm', + LTS: 'HH:mm:ss', + L: 'DD/MM/YYYY', + LL: 'D MMMM YYYY', + LLL: 'D MMMM YYYY HH:mm', + LLLL: 'dddd, D MMMM YYYY HH:mm', + }, + calendar: { + sameDay: '[Illum fil-]LT', + nextDay: '[Għada fil-]LT', + nextWeek: 'dddd [fil-]LT', + lastDay: '[Il-bieraħ fil-]LT', + lastWeek: 'dddd [li għadda] [fil-]LT', + sameElse: 'L', + }, + relativeTime: { + future: 'f’ %s', + past: '%s ilu', + s: 'ftit sekondi', + ss: '%d sekondi', + m: 'minuta', + mm: '%d minuti', + h: 'siegħa', + hh: '%d siegħat', + d: 'ġurnata', + dd: '%d ġranet', + M: 'xahar', + MM: '%d xhur', + y: 'sena', + yy: '%d sni', + }, + dayOfMonthOrdinalParse: /\d{1,2}º/, + ordinal: '%dº', + week: { + dow: 1, // Monday is the first day of the week. + doy: 4, // The week that contains Jan 4th is the first week of the year. + }, + }); + + //! moment.js locale configuration + + var symbolMap$c = { + '1': '၁', + '2': '၂', + '3': '၃', + '4': '၄', + '5': '၅', + '6': '၆', + '7': '၇', + '8': '၈', + '9': '၉', + '0': '၀', + }, + numberMap$b = { + '၁': '1', + '၂': '2', + '၃': '3', + '၄': '4', + '၅': '5', + '၆': '6', + '၇': '7', + '၈': '8', + '၉': '9', + '၀': '0', + }; + + moment.defineLocale('my', { + months: 'ဇန်နဝါရီ_ဖေဖော်ဝါရီ_မတ်_ဧပြီ_မေ_ဇွန်_ဇူလိုင်_သြဂုတ်_စက်တင်ဘာ_အောက်တိုဘာ_နိုဝင်ဘာ_ဒီဇင်ဘာ'.split( + '_' + ), + monthsShort: 'ဇန်_ဖေ_မတ်_ပြီ_မေ_ဇွန်_လိုင်_သြ_စက်_အောက်_နို_ဒီ'.split('_'), + weekdays: 'တနင်္ဂနွေ_တနင်္လာ_အင်္ဂါ_ဗုဒ္ဓဟူး_ကြာသပတေး_သောကြာ_စနေ'.split( + '_' + ), + weekdaysShort: 'နွေ_လာ_ဂါ_ဟူး_ကြာ_သော_နေ'.split('_'), + weekdaysMin: 'နွေ_လာ_ဂါ_ဟူး_ကြာ_သော_နေ'.split('_'), + + longDateFormat: { + LT: 'HH:mm', + LTS: 'HH:mm:ss', + L: 'DD/MM/YYYY', + LL: 'D MMMM YYYY', + LLL: 'D MMMM YYYY HH:mm', + LLLL: 'dddd D MMMM YYYY HH:mm', + }, + calendar: { + sameDay: '[ယနေ.] LT [မှာ]', + nextDay: '[မနက်ဖြန်] LT [မှာ]', + nextWeek: 'dddd LT [မှာ]', + lastDay: '[မနေ.က] LT [မှာ]', + lastWeek: '[ပြီးခဲ့သော] dddd LT [မှာ]', + sameElse: 'L', + }, + relativeTime: { + future: 'လာမည့် %s မှာ', + past: 'လွန်ခဲ့သော %s က', + s: 'စက္ကန်.အနည်းငယ်', + ss: '%d စက္ကန့်', + m: 'တစ်မိနစ်', + mm: '%d မိနစ်', + h: 'တစ်နာရီ', + hh: '%d နာရီ', + d: 'တစ်ရက်', + dd: '%d ရက်', + M: 'တစ်လ', + MM: '%d လ', + y: 'တစ်နှစ်', + yy: '%d နှစ်', + }, + preparse: function (string) { + return string.replace(/[၁၂၃၄၅၆၇၈၉၀]/g, function (match) { + return numberMap$b[match]; + }); + }, + postformat: function (string) { + return string.replace(/\d/g, function (match) { + return symbolMap$c[match]; + }); + }, + week: { + dow: 1, // Monday is the first day of the week. + doy: 4, // The week that contains Jan 4th is the first week of the year. + }, + }); + + //! moment.js locale configuration + + moment.defineLocale('nb', { + months: 'januar_februar_mars_april_mai_juni_juli_august_september_oktober_november_desember'.split( + '_' + ), + monthsShort: 'jan._feb._mars_apr._mai_juni_juli_aug._sep._okt._nov._des.'.split( + '_' + ), + monthsParseExact: true, + weekdays: 'søndag_mandag_tirsdag_onsdag_torsdag_fredag_lørdag'.split('_'), + weekdaysShort: 'sø._ma._ti._on._to._fr._lø.'.split('_'), + weekdaysMin: 'sø_ma_ti_on_to_fr_lø'.split('_'), + weekdaysParseExact: true, + longDateFormat: { + LT: 'HH:mm', + LTS: 'HH:mm:ss', + L: 'DD.MM.YYYY', + LL: 'D. MMMM YYYY', + LLL: 'D. MMMM YYYY [kl.] HH:mm', + LLLL: 'dddd D. MMMM YYYY [kl.] HH:mm', + }, + calendar: { + sameDay: '[i dag kl.] LT', + nextDay: '[i morgen kl.] LT', + nextWeek: 'dddd [kl.] LT', + lastDay: '[i går kl.] LT', + lastWeek: '[forrige] dddd [kl.] LT', + sameElse: 'L', + }, + relativeTime: { + future: 'om %s', + past: '%s siden', + s: 'noen sekunder', + ss: '%d sekunder', + m: 'ett minutt', + mm: '%d minutter', + h: 'en time', + hh: '%d timer', + d: 'en dag', + dd: '%d dager', + M: 'en måned', + MM: '%d måneder', + y: 'ett år', + yy: '%d år', + }, + dayOfMonthOrdinalParse: /\d{1,2}\./, + ordinal: '%d.', + week: { + dow: 1, // Monday is the first day of the week. + doy: 4, // The week that contains Jan 4th is the first week of the year. + }, + }); + + //! moment.js locale configuration + + var symbolMap$d = { + '1': '१', + '2': '२', + '3': '३', + '4': '४', + '5': '५', + '6': '६', + '7': '७', + '8': '८', + '9': '९', + '0': '०', + }, + numberMap$c = { + '१': '1', + '२': '2', + '३': '3', + '४': '4', + '५': '5', + '६': '6', + '७': '7', + '८': '8', + '९': '9', + '०': '0', + }; + + moment.defineLocale('ne', { + months: 'जनवरी_फेब्रुवरी_मार्च_अप्रिल_मई_जुन_जुलाई_अगष्ट_सेप्टेम्बर_अक्टोबर_नोभेम्बर_डिसेम्बर'.split( + '_' + ), + monthsShort: 'जन._फेब्रु._मार्च_अप्रि._मई_जुन_जुलाई._अग._सेप्ट._अक्टो._नोभे._डिसे.'.split( + '_' + ), + monthsParseExact: true, + weekdays: 'आइतबार_सोमबार_मङ्गलबार_बुधबार_बिहिबार_शुक्रबार_शनिबार'.split( + '_' + ), + weekdaysShort: 'आइत._सोम._मङ्गल._बुध._बिहि._शुक्र._शनि.'.split('_'), + weekdaysMin: 'आ._सो._मं._बु._बि._शु._श.'.split('_'), + weekdaysParseExact: true, + longDateFormat: { + LT: 'Aको h:mm बजे', + LTS: 'Aको h:mm:ss बजे', + L: 'DD/MM/YYYY', + LL: 'D MMMM YYYY', + LLL: 'D MMMM YYYY, Aको h:mm बजे', + LLLL: 'dddd, D MMMM YYYY, Aको h:mm बजे', + }, + preparse: function (string) { + return string.replace(/[१२३४५६७८९०]/g, function (match) { + return numberMap$c[match]; + }); + }, + postformat: function (string) { + return string.replace(/\d/g, function (match) { + return symbolMap$d[match]; + }); + }, + meridiemParse: /राति|बिहान|दिउँसो|साँझ/, + meridiemHour: function (hour, meridiem) { + if (hour === 12) { + hour = 0; + } + if (meridiem === 'राति') { + return hour < 4 ? hour : hour + 12; + } else if (meridiem === 'बिहान') { + return hour; + } else if (meridiem === 'दिउँसो') { + return hour >= 10 ? hour : hour + 12; + } else if (meridiem === 'साँझ') { + return hour + 12; + } + }, + meridiem: function (hour, minute, isLower) { + if (hour < 3) { + return 'राति'; + } else if (hour < 12) { + return 'बिहान'; + } else if (hour < 16) { + return 'दिउँसो'; + } else if (hour < 20) { + return 'साँझ'; + } else { + return 'राति'; + } + }, + calendar: { + sameDay: '[आज] LT', + nextDay: '[भोलि] LT', + nextWeek: '[आउँदो] dddd[,] LT', + lastDay: '[हिजो] LT', + lastWeek: '[गएको] dddd[,] LT', + sameElse: 'L', + }, + relativeTime: { + future: '%sमा', + past: '%s अगाडि', + s: 'केही क्षण', + ss: '%d सेकेण्ड', + m: 'एक मिनेट', + mm: '%d मिनेट', + h: 'एक घण्टा', + hh: '%d घण्टा', + d: 'एक दिन', + dd: '%d दिन', + M: 'एक महिना', + MM: '%d महिना', + y: 'एक बर्ष', + yy: '%d बर्ष', + }, + week: { + dow: 0, // Sunday is the first day of the week. + doy: 6, // The week that contains Jan 6th is the first week of the year. + }, + }); + + //! moment.js locale configuration + + var monthsShortWithDots$1 = 'jan._feb._mrt._apr._mei_jun._jul._aug._sep._okt._nov._dec.'.split( + '_' + ), + monthsShortWithoutDots$1 = 'jan_feb_mrt_apr_mei_jun_jul_aug_sep_okt_nov_dec'.split( + '_' + ), + monthsParse$6 = [ + /^jan/i, + /^feb/i, + /^maart|mrt.?$/i, + /^apr/i, + /^mei$/i, + /^jun[i.]?$/i, + /^jul[i.]?$/i, + /^aug/i, + /^sep/i, + /^okt/i, + /^nov/i, + /^dec/i, + ], + monthsRegex$6 = /^(januari|februari|maart|april|mei|ju[nl]i|augustus|september|oktober|november|december|jan\.?|feb\.?|mrt\.?|apr\.?|ju[nl]\.?|aug\.?|sep\.?|okt\.?|nov\.?|dec\.?)/i; + + moment.defineLocale('nl-be', { + months: 'januari_februari_maart_april_mei_juni_juli_augustus_september_oktober_november_december'.split( + '_' + ), + monthsShort: function (m, format) { + if (!m) { + return monthsShortWithDots$1; + } else if (/-MMM-/.test(format)) { + return monthsShortWithoutDots$1[m.month()]; + } else { + return monthsShortWithDots$1[m.month()]; + } + }, + + monthsRegex: monthsRegex$6, + monthsShortRegex: monthsRegex$6, + monthsStrictRegex: /^(januari|februari|maart|april|mei|ju[nl]i|augustus|september|oktober|november|december)/i, + monthsShortStrictRegex: /^(jan\.?|feb\.?|mrt\.?|apr\.?|mei|ju[nl]\.?|aug\.?|sep\.?|okt\.?|nov\.?|dec\.?)/i, + + monthsParse: monthsParse$6, + longMonthsParse: monthsParse$6, + shortMonthsParse: monthsParse$6, + + weekdays: 'zondag_maandag_dinsdag_woensdag_donderdag_vrijdag_zaterdag'.split( + '_' + ), + weekdaysShort: 'zo._ma._di._wo._do._vr._za.'.split('_'), + weekdaysMin: 'zo_ma_di_wo_do_vr_za'.split('_'), + weekdaysParseExact: true, + longDateFormat: { + LT: 'HH:mm', + LTS: 'HH:mm:ss', + L: 'DD/MM/YYYY', + LL: 'D MMMM YYYY', + LLL: 'D MMMM YYYY HH:mm', + LLLL: 'dddd D MMMM YYYY HH:mm', + }, + calendar: { + sameDay: '[vandaag om] LT', + nextDay: '[morgen om] LT', + nextWeek: 'dddd [om] LT', + lastDay: '[gisteren om] LT', + lastWeek: '[afgelopen] dddd [om] LT', + sameElse: 'L', + }, + relativeTime: { + future: 'over %s', + past: '%s geleden', + s: 'een paar seconden', + ss: '%d seconden', + m: 'één minuut', + mm: '%d minuten', + h: 'één uur', + hh: '%d uur', + d: 'één dag', + dd: '%d dagen', + M: 'één maand', + MM: '%d maanden', + y: 'één jaar', + yy: '%d jaar', + }, + dayOfMonthOrdinalParse: /\d{1,2}(ste|de)/, + ordinal: function (number) { + return ( + number + + (number === 1 || number === 8 || number >= 20 ? 'ste' : 'de') + ); + }, + week: { + dow: 1, // Monday is the first day of the week. + doy: 4, // The week that contains Jan 4th is the first week of the year. + }, + }); + + //! moment.js locale configuration + + var monthsShortWithDots$2 = 'jan._feb._mrt._apr._mei_jun._jul._aug._sep._okt._nov._dec.'.split( + '_' + ), + monthsShortWithoutDots$2 = 'jan_feb_mrt_apr_mei_jun_jul_aug_sep_okt_nov_dec'.split( + '_' + ), + monthsParse$7 = [ + /^jan/i, + /^feb/i, + /^maart|mrt.?$/i, + /^apr/i, + /^mei$/i, + /^jun[i.]?$/i, + /^jul[i.]?$/i, + /^aug/i, + /^sep/i, + /^okt/i, + /^nov/i, + /^dec/i, + ], + monthsRegex$7 = /^(januari|februari|maart|april|mei|ju[nl]i|augustus|september|oktober|november|december|jan\.?|feb\.?|mrt\.?|apr\.?|ju[nl]\.?|aug\.?|sep\.?|okt\.?|nov\.?|dec\.?)/i; + + moment.defineLocale('nl', { + months: 'januari_februari_maart_april_mei_juni_juli_augustus_september_oktober_november_december'.split( + '_' + ), + monthsShort: function (m, format) { + if (!m) { + return monthsShortWithDots$2; + } else if (/-MMM-/.test(format)) { + return monthsShortWithoutDots$2[m.month()]; + } else { + return monthsShortWithDots$2[m.month()]; + } + }, + + monthsRegex: monthsRegex$7, + monthsShortRegex: monthsRegex$7, + monthsStrictRegex: /^(januari|februari|maart|april|mei|ju[nl]i|augustus|september|oktober|november|december)/i, + monthsShortStrictRegex: /^(jan\.?|feb\.?|mrt\.?|apr\.?|mei|ju[nl]\.?|aug\.?|sep\.?|okt\.?|nov\.?|dec\.?)/i, + + monthsParse: monthsParse$7, + longMonthsParse: monthsParse$7, + shortMonthsParse: monthsParse$7, + + weekdays: 'zondag_maandag_dinsdag_woensdag_donderdag_vrijdag_zaterdag'.split( + '_' + ), + weekdaysShort: 'zo._ma._di._wo._do._vr._za.'.split('_'), + weekdaysMin: 'zo_ma_di_wo_do_vr_za'.split('_'), + weekdaysParseExact: true, + longDateFormat: { + LT: 'HH:mm', + LTS: 'HH:mm:ss', + L: 'DD-MM-YYYY', + LL: 'D MMMM YYYY', + LLL: 'D MMMM YYYY HH:mm', + LLLL: 'dddd D MMMM YYYY HH:mm', + }, + calendar: { + sameDay: '[vandaag om] LT', + nextDay: '[morgen om] LT', + nextWeek: 'dddd [om] LT', + lastDay: '[gisteren om] LT', + lastWeek: '[afgelopen] dddd [om] LT', + sameElse: 'L', + }, + relativeTime: { + future: 'over %s', + past: '%s geleden', + s: 'een paar seconden', + ss: '%d seconden', + m: 'één minuut', + mm: '%d minuten', + h: 'één uur', + hh: '%d uur', + d: 'één dag', + dd: '%d dagen', + M: 'één maand', + MM: '%d maanden', + y: 'één jaar', + yy: '%d jaar', + }, + dayOfMonthOrdinalParse: /\d{1,2}(ste|de)/, + ordinal: function (number) { + return ( + number + + (number === 1 || number === 8 || number >= 20 ? 'ste' : 'de') + ); + }, + week: { + dow: 1, // Monday is the first day of the week. + doy: 4, // The week that contains Jan 4th is the first week of the year. + }, + }); + + //! moment.js locale configuration + + moment.defineLocale('nn', { + months: 'januar_februar_mars_april_mai_juni_juli_august_september_oktober_november_desember'.split( + '_' + ), + monthsShort: 'jan._feb._mars_apr._mai_juni_juli_aug._sep._okt._nov._des.'.split( + '_' + ), + monthsParseExact: true, + weekdays: 'sundag_måndag_tysdag_onsdag_torsdag_fredag_laurdag'.split('_'), + weekdaysShort: 'su._må._ty._on._to._fr._lau.'.split('_'), + weekdaysMin: 'su_må_ty_on_to_fr_la'.split('_'), + weekdaysParseExact: true, + longDateFormat: { + LT: 'HH:mm', + LTS: 'HH:mm:ss', + L: 'DD.MM.YYYY', + LL: 'D. MMMM YYYY', + LLL: 'D. MMMM YYYY [kl.] H:mm', + LLLL: 'dddd D. MMMM YYYY [kl.] HH:mm', + }, + calendar: { + sameDay: '[I dag klokka] LT', + nextDay: '[I morgon klokka] LT', + nextWeek: 'dddd [klokka] LT', + lastDay: '[I går klokka] LT', + lastWeek: '[Føregåande] dddd [klokka] LT', + sameElse: 'L', + }, + relativeTime: { + future: 'om %s', + past: '%s sidan', + s: 'nokre sekund', + ss: '%d sekund', + m: 'eit minutt', + mm: '%d minutt', + h: 'ein time', + hh: '%d timar', + d: 'ein dag', + dd: '%d dagar', + M: 'ein månad', + MM: '%d månader', + y: 'eit år', + yy: '%d år', + }, + dayOfMonthOrdinalParse: /\d{1,2}\./, + ordinal: '%d.', + week: { + dow: 1, // Monday is the first day of the week. + doy: 4, // The week that contains Jan 4th is the first week of the year. + }, + }); + + //! moment.js locale configuration + + moment.defineLocale('oc-lnc', { + months: { + standalone: 'genièr_febrièr_març_abril_mai_junh_julhet_agost_setembre_octòbre_novembre_decembre'.split( + '_' + ), + format: "de genièr_de febrièr_de març_d'abril_de mai_de junh_de julhet_d'agost_de setembre_d'octòbre_de novembre_de decembre".split( + '_' + ), + isFormat: /D[oD]?(\s)+MMMM/, + }, + monthsShort: 'gen._febr._març_abr._mai_junh_julh._ago._set._oct._nov._dec.'.split( + '_' + ), + monthsParseExact: true, + weekdays: 'dimenge_diluns_dimars_dimècres_dijòus_divendres_dissabte'.split( + '_' + ), + weekdaysShort: 'dg._dl._dm._dc._dj._dv._ds.'.split('_'), + weekdaysMin: 'dg_dl_dm_dc_dj_dv_ds'.split('_'), + weekdaysParseExact: true, + longDateFormat: { + LT: 'H:mm', + LTS: 'H:mm:ss', + L: 'DD/MM/YYYY', + LL: 'D MMMM [de] YYYY', + ll: 'D MMM YYYY', + LLL: 'D MMMM [de] YYYY [a] H:mm', + lll: 'D MMM YYYY, H:mm', + LLLL: 'dddd D MMMM [de] YYYY [a] H:mm', + llll: 'ddd D MMM YYYY, H:mm', + }, + calendar: { + sameDay: '[uèi a] LT', + nextDay: '[deman a] LT', + nextWeek: 'dddd [a] LT', + lastDay: '[ièr a] LT', + lastWeek: 'dddd [passat a] LT', + sameElse: 'L', + }, + relativeTime: { + future: "d'aquí %s", + past: 'fa %s', + s: 'unas segondas', + ss: '%d segondas', + m: 'una minuta', + mm: '%d minutas', + h: 'una ora', + hh: '%d oras', + d: 'un jorn', + dd: '%d jorns', + M: 'un mes', + MM: '%d meses', + y: 'un an', + yy: '%d ans', + }, + dayOfMonthOrdinalParse: /\d{1,2}(r|n|t|è|a)/, + ordinal: function (number, period) { + var output = + number === 1 + ? 'r' + : number === 2 + ? 'n' + : number === 3 + ? 'r' + : number === 4 + ? 't' + : 'è'; + if (period === 'w' || period === 'W') { + output = 'a'; + } + return number + output; + }, + week: { + dow: 1, // Monday is the first day of the week. + doy: 4, + }, + }); + + //! moment.js locale configuration + + var symbolMap$e = { + '1': '੧', + '2': '੨', + '3': '੩', + '4': '੪', + '5': '੫', + '6': '੬', + '7': '੭', + '8': '੮', + '9': '੯', + '0': '੦', + }, + numberMap$d = { + '੧': '1', + '੨': '2', + '੩': '3', + '੪': '4', + '੫': '5', + '੬': '6', + '੭': '7', + '੮': '8', + '੯': '9', + '੦': '0', + }; + + moment.defineLocale('pa-in', { + // There are months name as per Nanakshahi Calendar but they are not used as rigidly in modern Punjabi. + months: 'ਜਨਵਰੀ_ਫ਼ਰਵਰੀ_ਮਾਰਚ_ਅਪ੍ਰੈਲ_ਮਈ_ਜੂਨ_ਜੁਲਾਈ_ਅਗਸਤ_ਸਤੰਬਰ_ਅਕਤੂਬਰ_ਨਵੰਬਰ_ਦਸੰਬਰ'.split( + '_' + ), + monthsShort: 'ਜਨਵਰੀ_ਫ਼ਰਵਰੀ_ਮਾਰਚ_ਅਪ੍ਰੈਲ_ਮਈ_ਜੂਨ_ਜੁਲਾਈ_ਅਗਸਤ_ਸਤੰਬਰ_ਅਕਤੂਬਰ_ਨਵੰਬਰ_ਦਸੰਬਰ'.split( + '_' + ), + weekdays: 'ਐਤਵਾਰ_ਸੋਮਵਾਰ_ਮੰਗਲਵਾਰ_ਬੁਧਵਾਰ_ਵੀਰਵਾਰ_ਸ਼ੁੱਕਰਵਾਰ_ਸ਼ਨੀਚਰਵਾਰ'.split( + '_' + ), + weekdaysShort: 'ਐਤ_ਸੋਮ_ਮੰਗਲ_ਬੁਧ_ਵੀਰ_ਸ਼ੁਕਰ_ਸ਼ਨੀ'.split('_'), + weekdaysMin: 'ਐਤ_ਸੋਮ_ਮੰਗਲ_ਬੁਧ_ਵੀਰ_ਸ਼ੁਕਰ_ਸ਼ਨੀ'.split('_'), + longDateFormat: { + LT: 'A h:mm ਵਜੇ', + LTS: 'A h:mm:ss ਵਜੇ', + L: 'DD/MM/YYYY', + LL: 'D MMMM YYYY', + LLL: 'D MMMM YYYY, A h:mm ਵਜੇ', + LLLL: 'dddd, D MMMM YYYY, A h:mm ਵਜੇ', + }, + calendar: { + sameDay: '[ਅਜ] LT', + nextDay: '[ਕਲ] LT', + nextWeek: '[ਅਗਲਾ] dddd, LT', + lastDay: '[ਕਲ] LT', + lastWeek: '[ਪਿਛਲੇ] dddd, LT', + sameElse: 'L', + }, + relativeTime: { + future: '%s ਵਿੱਚ', + past: '%s ਪਿਛਲੇ', + s: 'ਕੁਝ ਸਕਿੰਟ', + ss: '%d ਸਕਿੰਟ', + m: 'ਇਕ ਮਿੰਟ', + mm: '%d ਮਿੰਟ', + h: 'ਇੱਕ ਘੰਟਾ', + hh: '%d ਘੰਟੇ', + d: 'ਇੱਕ ਦਿਨ', + dd: '%d ਦਿਨ', + M: 'ਇੱਕ ਮਹੀਨਾ', + MM: '%d ਮਹੀਨੇ', + y: 'ਇੱਕ ਸਾਲ', + yy: '%d ਸਾਲ', + }, + preparse: function (string) { + return string.replace(/[੧੨੩੪੫੬੭੮੯੦]/g, function (match) { + return numberMap$d[match]; + }); + }, + postformat: function (string) { + return string.replace(/\d/g, function (match) { + return symbolMap$e[match]; + }); + }, + // Punjabi notation for meridiems are quite fuzzy in practice. While there exists + // a rigid notion of a 'Pahar' it is not used as rigidly in modern Punjabi. + meridiemParse: /ਰਾਤ|ਸਵੇਰ|ਦੁਪਹਿਰ|ਸ਼ਾਮ/, + meridiemHour: function (hour, meridiem) { + if (hour === 12) { + hour = 0; + } + if (meridiem === 'ਰਾਤ') { + return hour < 4 ? hour : hour + 12; + } else if (meridiem === 'ਸਵੇਰ') { + return hour; + } else if (meridiem === 'ਦੁਪਹਿਰ') { + return hour >= 10 ? hour : hour + 12; + } else if (meridiem === 'ਸ਼ਾਮ') { + return hour + 12; + } + }, + meridiem: function (hour, minute, isLower) { + if (hour < 4) { + return 'ਰਾਤ'; + } else if (hour < 10) { + return 'ਸਵੇਰ'; + } else if (hour < 17) { + return 'ਦੁਪਹਿਰ'; + } else if (hour < 20) { + return 'ਸ਼ਾਮ'; + } else { + return 'ਰਾਤ'; + } + }, + week: { + dow: 0, // Sunday is the first day of the week. + doy: 6, // The week that contains Jan 6th is the first week of the year. + }, + }); + + //! moment.js locale configuration + + var monthsNominative = 'styczeń_luty_marzec_kwiecień_maj_czerwiec_lipiec_sierpień_wrzesień_październik_listopad_grudzień'.split( + '_' + ), + monthsSubjective = 'stycznia_lutego_marca_kwietnia_maja_czerwca_lipca_sierpnia_września_października_listopada_grudnia'.split( + '_' + ); + function plural$3(n) { + return n % 10 < 5 && n % 10 > 1 && ~~(n / 10) % 10 !== 1; + } + function translate$8(number, withoutSuffix, key) { + var result = number + ' '; + switch (key) { + case 'ss': + return result + (plural$3(number) ? 'sekundy' : 'sekund'); + case 'm': + return withoutSuffix ? 'minuta' : 'minutę'; + case 'mm': + return result + (plural$3(number) ? 'minuty' : 'minut'); + case 'h': + return withoutSuffix ? 'godzina' : 'godzinę'; + case 'hh': + return result + (plural$3(number) ? 'godziny' : 'godzin'); + case 'MM': + return result + (plural$3(number) ? 'miesiące' : 'miesięcy'); + case 'yy': + return result + (plural$3(number) ? 'lata' : 'lat'); + } + } + + moment.defineLocale('pl', { + months: function (momentToFormat, format) { + if (!momentToFormat) { + return monthsNominative; + } else if (format === '') { + // Hack: if format empty we know this is used to generate + // RegExp by moment. Give then back both valid forms of months + // in RegExp ready format. + return ( + '(' + + monthsSubjective[momentToFormat.month()] + + '|' + + monthsNominative[momentToFormat.month()] + + ')' + ); + } else if (/D MMMM/.test(format)) { + return monthsSubjective[momentToFormat.month()]; + } else { + return monthsNominative[momentToFormat.month()]; + } + }, + monthsShort: 'sty_lut_mar_kwi_maj_cze_lip_sie_wrz_paź_lis_gru'.split('_'), + weekdays: 'niedziela_poniedziałek_wtorek_środa_czwartek_piątek_sobota'.split( + '_' + ), + weekdaysShort: 'ndz_pon_wt_śr_czw_pt_sob'.split('_'), + weekdaysMin: 'Nd_Pn_Wt_Śr_Cz_Pt_So'.split('_'), + longDateFormat: { + LT: 'HH:mm', + LTS: 'HH:mm:ss', + L: 'DD.MM.YYYY', + LL: 'D MMMM YYYY', + LLL: 'D MMMM YYYY HH:mm', + LLLL: 'dddd, D MMMM YYYY HH:mm', + }, + calendar: { + sameDay: '[Dziś o] LT', + nextDay: '[Jutro o] LT', + nextWeek: function () { + switch (this.day()) { + case 0: + return '[W niedzielę o] LT'; + + case 2: + return '[We wtorek o] LT'; + + case 3: + return '[W środę o] LT'; + + case 6: + return '[W sobotę o] LT'; + + default: + return '[W] dddd [o] LT'; + } + }, + lastDay: '[Wczoraj o] LT', + lastWeek: function () { + switch (this.day()) { + case 0: + return '[W zeszłą niedzielę o] LT'; + case 3: + return '[W zeszłą środę o] LT'; + case 6: + return '[W zeszłą sobotę o] LT'; + default: + return '[W zeszły] dddd [o] LT'; + } + }, + sameElse: 'L', + }, + relativeTime: { + future: 'za %s', + past: '%s temu', + s: 'kilka sekund', + ss: translate$8, + m: translate$8, + mm: translate$8, + h: translate$8, + hh: translate$8, + d: '1 dzień', + dd: '%d dni', + M: 'miesiąc', + MM: translate$8, + y: 'rok', + yy: translate$8, + }, + dayOfMonthOrdinalParse: /\d{1,2}\./, + ordinal: '%d.', + week: { + dow: 1, // Monday is the first day of the week. + doy: 4, // The week that contains Jan 4th is the first week of the year. + }, + }); + + //! moment.js locale configuration + + moment.defineLocale('pt-br', { + months: 'janeiro_fevereiro_março_abril_maio_junho_julho_agosto_setembro_outubro_novembro_dezembro'.split( + '_' + ), + monthsShort: 'jan_fev_mar_abr_mai_jun_jul_ago_set_out_nov_dez'.split('_'), + weekdays: 'domingo_segunda-feira_terça-feira_quarta-feira_quinta-feira_sexta-feira_sábado'.split( + '_' + ), + weekdaysShort: 'dom_seg_ter_qua_qui_sex_sáb'.split('_'), + weekdaysMin: 'do_2ª_3ª_4ª_5ª_6ª_sá'.split('_'), + weekdaysParseExact: true, + longDateFormat: { + LT: 'HH:mm', + LTS: 'HH:mm:ss', + L: 'DD/MM/YYYY', + LL: 'D [de] MMMM [de] YYYY', + LLL: 'D [de] MMMM [de] YYYY [às] HH:mm', + LLLL: 'dddd, D [de] MMMM [de] YYYY [às] HH:mm', + }, + calendar: { + sameDay: '[Hoje às] LT', + nextDay: '[Amanhã às] LT', + nextWeek: 'dddd [às] LT', + lastDay: '[Ontem às] LT', + lastWeek: function () { + return this.day() === 0 || this.day() === 6 + ? '[Último] dddd [às] LT' // Saturday + Sunday + : '[Última] dddd [às] LT'; // Monday - Friday + }, + sameElse: 'L', + }, + relativeTime: { + future: 'em %s', + past: 'há %s', + s: 'poucos segundos', + ss: '%d segundos', + m: 'um minuto', + mm: '%d minutos', + h: 'uma hora', + hh: '%d horas', + d: 'um dia', + dd: '%d dias', + M: 'um mês', + MM: '%d meses', + y: 'um ano', + yy: '%d anos', + }, + dayOfMonthOrdinalParse: /\d{1,2}º/, + ordinal: '%dº', + }); + + //! moment.js locale configuration + + moment.defineLocale('pt', { + months: 'janeiro_fevereiro_março_abril_maio_junho_julho_agosto_setembro_outubro_novembro_dezembro'.split( + '_' + ), + monthsShort: 'jan_fev_mar_abr_mai_jun_jul_ago_set_out_nov_dez'.split('_'), + weekdays: 'Domingo_Segunda-feira_Terça-feira_Quarta-feira_Quinta-feira_Sexta-feira_Sábado'.split( + '_' + ), + weekdaysShort: 'Dom_Seg_Ter_Qua_Qui_Sex_Sáb'.split('_'), + weekdaysMin: 'Do_2ª_3ª_4ª_5ª_6ª_Sá'.split('_'), + weekdaysParseExact: true, + longDateFormat: { + LT: 'HH:mm', + LTS: 'HH:mm:ss', + L: 'DD/MM/YYYY', + LL: 'D [de] MMMM [de] YYYY', + LLL: 'D [de] MMMM [de] YYYY HH:mm', + LLLL: 'dddd, D [de] MMMM [de] YYYY HH:mm', + }, + calendar: { + sameDay: '[Hoje às] LT', + nextDay: '[Amanhã às] LT', + nextWeek: 'dddd [às] LT', + lastDay: '[Ontem às] LT', + lastWeek: function () { + return this.day() === 0 || this.day() === 6 + ? '[Último] dddd [às] LT' // Saturday + Sunday + : '[Última] dddd [às] LT'; // Monday - Friday + }, + sameElse: 'L', + }, + relativeTime: { + future: 'em %s', + past: 'há %s', + s: 'segundos', + ss: '%d segundos', + m: 'um minuto', + mm: '%d minutos', + h: 'uma hora', + hh: '%d horas', + d: 'um dia', + dd: '%d dias', + M: 'um mês', + MM: '%d meses', + y: 'um ano', + yy: '%d anos', + }, + dayOfMonthOrdinalParse: /\d{1,2}º/, + ordinal: '%dº', + week: { + dow: 1, // Monday is the first day of the week. + doy: 4, // The week that contains Jan 4th is the first week of the year. + }, + }); + + //! moment.js locale configuration + + function relativeTimeWithPlural$2(number, withoutSuffix, key) { + var format = { + ss: 'secunde', + mm: 'minute', + hh: 'ore', + dd: 'zile', + MM: 'luni', + yy: 'ani', + }, + separator = ' '; + if (number % 100 >= 20 || (number >= 100 && number % 100 === 0)) { + separator = ' de '; + } + return number + separator + format[key]; + } + + moment.defineLocale('ro', { + months: 'ianuarie_februarie_martie_aprilie_mai_iunie_iulie_august_septembrie_octombrie_noiembrie_decembrie'.split( + '_' + ), + monthsShort: 'ian._feb._mart._apr._mai_iun._iul._aug._sept._oct._nov._dec.'.split( + '_' + ), + monthsParseExact: true, + weekdays: 'duminică_luni_marți_miercuri_joi_vineri_sâmbătă'.split('_'), + weekdaysShort: 'Dum_Lun_Mar_Mie_Joi_Vin_Sâm'.split('_'), + weekdaysMin: 'Du_Lu_Ma_Mi_Jo_Vi_Sâ'.split('_'), + longDateFormat: { + LT: 'H:mm', + LTS: 'H:mm:ss', + L: 'DD.MM.YYYY', + LL: 'D MMMM YYYY', + LLL: 'D MMMM YYYY H:mm', + LLLL: 'dddd, D MMMM YYYY H:mm', + }, + calendar: { + sameDay: '[azi la] LT', + nextDay: '[mâine la] LT', + nextWeek: 'dddd [la] LT', + lastDay: '[ieri la] LT', + lastWeek: '[fosta] dddd [la] LT', + sameElse: 'L', + }, + relativeTime: { + future: 'peste %s', + past: '%s în urmă', + s: 'câteva secunde', + ss: relativeTimeWithPlural$2, + m: 'un minut', + mm: relativeTimeWithPlural$2, + h: 'o oră', + hh: relativeTimeWithPlural$2, + d: 'o zi', + dd: relativeTimeWithPlural$2, + M: 'o lună', + MM: relativeTimeWithPlural$2, + y: 'un an', + yy: relativeTimeWithPlural$2, + }, + week: { + dow: 1, // Monday is the first day of the week. + doy: 7, // The week that contains Jan 7th is the first week of the year. + }, + }); + + //! moment.js locale configuration + + function plural$4(word, num) { + var forms = word.split('_'); + return num % 10 === 1 && num % 100 !== 11 + ? forms[0] + : num % 10 >= 2 && num % 10 <= 4 && (num % 100 < 10 || num % 100 >= 20) + ? forms[1] + : forms[2]; + } + function relativeTimeWithPlural$3(number, withoutSuffix, key) { + var format = { + ss: withoutSuffix ? 'секунда_секунды_секунд' : 'секунду_секунды_секунд', + mm: withoutSuffix ? 'минута_минуты_минут' : 'минуту_минуты_минут', + hh: 'час_часа_часов', + dd: 'день_дня_дней', + MM: 'месяц_месяца_месяцев', + yy: 'год_года_лет', + }; + if (key === 'm') { + return withoutSuffix ? 'минута' : 'минуту'; + } else { + return number + ' ' + plural$4(format[key], +number); + } + } + var monthsParse$8 = [ + /^янв/i, + /^фев/i, + /^мар/i, + /^апр/i, + /^ма[йя]/i, + /^июн/i, + /^июл/i, + /^авг/i, + /^сен/i, + /^окт/i, + /^ноя/i, + /^дек/i, + ]; + + // http://new.gramota.ru/spravka/rules/139-prop : § 103 + // Сокращения месяцев: http://new.gramota.ru/spravka/buro/search-answer?s=242637 + // CLDR data: http://www.unicode.org/cldr/charts/28/summary/ru.html#1753 + moment.defineLocale('ru', { + months: { + format: 'января_февраля_марта_апреля_мая_июня_июля_августа_сентября_октября_ноября_декабря'.split( + '_' + ), + standalone: 'январь_февраль_март_апрель_май_июнь_июль_август_сентябрь_октябрь_ноябрь_декабрь'.split( + '_' + ), + }, + monthsShort: { + // по CLDR именно "июл." и "июн.", но какой смысл менять букву на точку? + format: 'янв._февр._мар._апр._мая_июня_июля_авг._сент._окт._нояб._дек.'.split( + '_' + ), + standalone: 'янв._февр._март_апр._май_июнь_июль_авг._сент._окт._нояб._дек.'.split( + '_' + ), + }, + weekdays: { + standalone: 'воскресенье_понедельник_вторник_среда_четверг_пятница_суббота'.split( + '_' + ), + format: 'воскресенье_понедельник_вторник_среду_четверг_пятницу_субботу'.split( + '_' + ), + isFormat: /\[ ?[Вв] ?(?:прошлую|следующую|эту)? ?] ?dddd/, + }, + weekdaysShort: 'вс_пн_вт_ср_чт_пт_сб'.split('_'), + weekdaysMin: 'вс_пн_вт_ср_чт_пт_сб'.split('_'), + monthsParse: monthsParse$8, + longMonthsParse: monthsParse$8, + shortMonthsParse: monthsParse$8, + + // полные названия с падежами, по три буквы, для некоторых, по 4 буквы, сокращения с точкой и без точки + monthsRegex: /^(январ[ья]|янв\.?|феврал[ья]|февр?\.?|марта?|мар\.?|апрел[ья]|апр\.?|ма[йя]|июн[ья]|июн\.?|июл[ья]|июл\.?|августа?|авг\.?|сентябр[ья]|сент?\.?|октябр[ья]|окт\.?|ноябр[ья]|нояб?\.?|декабр[ья]|дек\.?)/i, + + // копия предыдущего + monthsShortRegex: /^(январ[ья]|янв\.?|феврал[ья]|февр?\.?|марта?|мар\.?|апрел[ья]|апр\.?|ма[йя]|июн[ья]|июн\.?|июл[ья]|июл\.?|августа?|авг\.?|сентябр[ья]|сент?\.?|октябр[ья]|окт\.?|ноябр[ья]|нояб?\.?|декабр[ья]|дек\.?)/i, + + // полные названия с падежами + monthsStrictRegex: /^(январ[яь]|феврал[яь]|марта?|апрел[яь]|ма[яй]|июн[яь]|июл[яь]|августа?|сентябр[яь]|октябр[яь]|ноябр[яь]|декабр[яь])/i, + + // Выражение, которое соответствует только сокращённым формам + monthsShortStrictRegex: /^(янв\.|февр?\.|мар[т.]|апр\.|ма[яй]|июн[ья.]|июл[ья.]|авг\.|сент?\.|окт\.|нояб?\.|дек\.)/i, + longDateFormat: { + LT: 'H:mm', + LTS: 'H:mm:ss', + L: 'DD.MM.YYYY', + LL: 'D MMMM YYYY г.', + LLL: 'D MMMM YYYY г., H:mm', + LLLL: 'dddd, D MMMM YYYY г., H:mm', + }, + calendar: { + sameDay: '[Сегодня, в] LT', + nextDay: '[Завтра, в] LT', + lastDay: '[Вчера, в] LT', + nextWeek: function (now) { + if (now.week() !== this.week()) { + switch (this.day()) { + case 0: + return '[В следующее] dddd, [в] LT'; + case 1: + case 2: + case 4: + return '[В следующий] dddd, [в] LT'; + case 3: + case 5: + case 6: + return '[В следующую] dddd, [в] LT'; + } + } else { + if (this.day() === 2) { + return '[Во] dddd, [в] LT'; + } else { + return '[В] dddd, [в] LT'; + } + } + }, + lastWeek: function (now) { + if (now.week() !== this.week()) { + switch (this.day()) { + case 0: + return '[В прошлое] dddd, [в] LT'; + case 1: + case 2: + case 4: + return '[В прошлый] dddd, [в] LT'; + case 3: + case 5: + case 6: + return '[В прошлую] dddd, [в] LT'; + } + } else { + if (this.day() === 2) { + return '[Во] dddd, [в] LT'; + } else { + return '[В] dddd, [в] LT'; + } + } + }, + sameElse: 'L', + }, + relativeTime: { + future: 'через %s', + past: '%s назад', + s: 'несколько секунд', + ss: relativeTimeWithPlural$3, + m: relativeTimeWithPlural$3, + mm: relativeTimeWithPlural$3, + h: 'час', + hh: relativeTimeWithPlural$3, + d: 'день', + dd: relativeTimeWithPlural$3, + M: 'месяц', + MM: relativeTimeWithPlural$3, + y: 'год', + yy: relativeTimeWithPlural$3, + }, + meridiemParse: /ночи|утра|дня|вечера/i, + isPM: function (input) { + return /^(дня|вечера)$/.test(input); + }, + meridiem: function (hour, minute, isLower) { + if (hour < 4) { + return 'ночи'; + } else if (hour < 12) { + return 'утра'; + } else if (hour < 17) { + return 'дня'; + } else { + return 'вечера'; + } + }, + dayOfMonthOrdinalParse: /\d{1,2}-(й|го|я)/, + ordinal: function (number, period) { + switch (period) { + case 'M': + case 'd': + case 'DDD': + return number + '-й'; + case 'D': + return number + '-го'; + case 'w': + case 'W': + return number + '-я'; + default: + return number; + } + }, + week: { + dow: 1, // Monday is the first day of the week. + doy: 4, // The week that contains Jan 4th is the first week of the year. + }, + }); + + //! moment.js locale configuration + + var months$8 = [ + 'جنوري', + 'فيبروري', + 'مارچ', + 'اپريل', + 'مئي', + 'جون', + 'جولاءِ', + 'آگسٽ', + 'سيپٽمبر', + 'آڪٽوبر', + 'نومبر', + 'ڊسمبر', + ], + days = ['آچر', 'سومر', 'اڱارو', 'اربع', 'خميس', 'جمع', 'ڇنڇر']; + + moment.defineLocale('sd', { + months: months$8, + monthsShort: months$8, + weekdays: days, + weekdaysShort: days, + weekdaysMin: days, + longDateFormat: { + LT: 'HH:mm', + LTS: 'HH:mm:ss', + L: 'DD/MM/YYYY', + LL: 'D MMMM YYYY', + LLL: 'D MMMM YYYY HH:mm', + LLLL: 'dddd، D MMMM YYYY HH:mm', + }, + meridiemParse: /صبح|شام/, + isPM: function (input) { + return 'شام' === input; + }, + meridiem: function (hour, minute, isLower) { + if (hour < 12) { + return 'صبح'; + } + return 'شام'; + }, + calendar: { + sameDay: '[اڄ] LT', + nextDay: '[سڀاڻي] LT', + nextWeek: 'dddd [اڳين هفتي تي] LT', + lastDay: '[ڪالهه] LT', + lastWeek: '[گزريل هفتي] dddd [تي] LT', + sameElse: 'L', + }, + relativeTime: { + future: '%s پوء', + past: '%s اڳ', + s: 'چند سيڪنڊ', + ss: '%d سيڪنڊ', + m: 'هڪ منٽ', + mm: '%d منٽ', + h: 'هڪ ڪلاڪ', + hh: '%d ڪلاڪ', + d: 'هڪ ڏينهن', + dd: '%d ڏينهن', + M: 'هڪ مهينو', + MM: '%d مهينا', + y: 'هڪ سال', + yy: '%d سال', + }, + preparse: function (string) { + return string.replace(/،/g, ','); + }, + postformat: function (string) { + return string.replace(/,/g, '،'); + }, + week: { + dow: 1, // Monday is the first day of the week. + doy: 4, // The week that contains Jan 4th is the first week of the year. + }, + }); + + //! moment.js locale configuration + + moment.defineLocale('se', { + months: 'ođđajagemánnu_guovvamánnu_njukčamánnu_cuoŋománnu_miessemánnu_geassemánnu_suoidnemánnu_borgemánnu_čakčamánnu_golggotmánnu_skábmamánnu_juovlamánnu'.split( + '_' + ), + monthsShort: 'ođđj_guov_njuk_cuo_mies_geas_suoi_borg_čakč_golg_skáb_juov'.split( + '_' + ), + weekdays: 'sotnabeaivi_vuossárga_maŋŋebárga_gaskavahkku_duorastat_bearjadat_lávvardat'.split( + '_' + ), + weekdaysShort: 'sotn_vuos_maŋ_gask_duor_bear_láv'.split('_'), + weekdaysMin: 's_v_m_g_d_b_L'.split('_'), + longDateFormat: { + LT: 'HH:mm', + LTS: 'HH:mm:ss', + L: 'DD.MM.YYYY', + LL: 'MMMM D. [b.] YYYY', + LLL: 'MMMM D. [b.] YYYY [ti.] HH:mm', + LLLL: 'dddd, MMMM D. [b.] YYYY [ti.] HH:mm', + }, + calendar: { + sameDay: '[otne ti] LT', + nextDay: '[ihttin ti] LT', + nextWeek: 'dddd [ti] LT', + lastDay: '[ikte ti] LT', + lastWeek: '[ovddit] dddd [ti] LT', + sameElse: 'L', + }, + relativeTime: { + future: '%s geažes', + past: 'maŋit %s', + s: 'moadde sekunddat', + ss: '%d sekunddat', + m: 'okta minuhta', + mm: '%d minuhtat', + h: 'okta diimmu', + hh: '%d diimmut', + d: 'okta beaivi', + dd: '%d beaivvit', + M: 'okta mánnu', + MM: '%d mánut', + y: 'okta jahki', + yy: '%d jagit', + }, + dayOfMonthOrdinalParse: /\d{1,2}\./, + ordinal: '%d.', + week: { + dow: 1, // Monday is the first day of the week. + doy: 4, // The week that contains Jan 4th is the first week of the year. + }, + }); + + //! moment.js locale configuration + + /*jshint -W100*/ + moment.defineLocale('si', { + months: 'ජනවාරි_පෙබරවාරි_මාර්තු_අප්‍රේල්_මැයි_ජූනි_ජූලි_අගෝස්තු_සැප්තැම්බර්_ඔක්තෝබර්_නොවැම්බර්_දෙසැම්බර්'.split( + '_' + ), + monthsShort: 'ජන_පෙබ_මාර්_අප්_මැයි_ජූනි_ජූලි_අගෝ_සැප්_ඔක්_නොවැ_දෙසැ'.split( + '_' + ), + weekdays: 'ඉරිදා_සඳුදා_අඟහරුවාදා_බදාදා_බ්‍රහස්පතින්දා_සිකුරාදා_සෙනසුරාදා'.split( + '_' + ), + weekdaysShort: 'ඉරි_සඳු_අඟ_බදා_බ්‍රහ_සිකු_සෙන'.split('_'), + weekdaysMin: 'ඉ_ස_අ_බ_බ්‍ර_සි_සෙ'.split('_'), + weekdaysParseExact: true, + longDateFormat: { + LT: 'a h:mm', + LTS: 'a h:mm:ss', + L: 'YYYY/MM/DD', + LL: 'YYYY MMMM D', + LLL: 'YYYY MMMM D, a h:mm', + LLLL: 'YYYY MMMM D [වැනි] dddd, a h:mm:ss', + }, + calendar: { + sameDay: '[අද] LT[ට]', + nextDay: '[හෙට] LT[ට]', + nextWeek: 'dddd LT[ට]', + lastDay: '[ඊයේ] LT[ට]', + lastWeek: '[පසුගිය] dddd LT[ට]', + sameElse: 'L', + }, + relativeTime: { + future: '%sකින්', + past: '%sකට පෙර', + s: 'තත්පර කිහිපය', + ss: 'තත්පර %d', + m: 'මිනිත්තුව', + mm: 'මිනිත්තු %d', + h: 'පැය', + hh: 'පැය %d', + d: 'දිනය', + dd: 'දින %d', + M: 'මාසය', + MM: 'මාස %d', + y: 'වසර', + yy: 'වසර %d', + }, + dayOfMonthOrdinalParse: /\d{1,2} වැනි/, + ordinal: function (number) { + return number + ' වැනි'; + }, + meridiemParse: /පෙර වරු|පස් වරු|පෙ.ව|ප.ව./, + isPM: function (input) { + return input === 'ප.ව.' || input === 'පස් වරු'; + }, + meridiem: function (hours, minutes, isLower) { + if (hours > 11) { + return isLower ? 'ප.ව.' : 'පස් වරු'; + } else { + return isLower ? 'පෙ.ව.' : 'පෙර වරු'; + } + }, + }); + + //! moment.js locale configuration + + var months$9 = 'január_február_marec_apríl_máj_jún_júl_august_september_október_november_december'.split( + '_' + ), + monthsShort$6 = 'jan_feb_mar_apr_máj_jún_júl_aug_sep_okt_nov_dec'.split('_'); + function plural$5(n) { + return n > 1 && n < 5; + } + function translate$9(number, withoutSuffix, key, isFuture) { + var result = number + ' '; + switch (key) { + case 's': // a few seconds / in a few seconds / a few seconds ago + return withoutSuffix || isFuture ? 'pár sekúnd' : 'pár sekundami'; + case 'ss': // 9 seconds / in 9 seconds / 9 seconds ago + if (withoutSuffix || isFuture) { + return result + (plural$5(number) ? 'sekundy' : 'sekúnd'); + } else { + return result + 'sekundami'; + } + case 'm': // a minute / in a minute / a minute ago + return withoutSuffix ? 'minúta' : isFuture ? 'minútu' : 'minútou'; + case 'mm': // 9 minutes / in 9 minutes / 9 minutes ago + if (withoutSuffix || isFuture) { + return result + (plural$5(number) ? 'minúty' : 'minút'); + } else { + return result + 'minútami'; + } + case 'h': // an hour / in an hour / an hour ago + return withoutSuffix ? 'hodina' : isFuture ? 'hodinu' : 'hodinou'; + case 'hh': // 9 hours / in 9 hours / 9 hours ago + if (withoutSuffix || isFuture) { + return result + (plural$5(number) ? 'hodiny' : 'hodín'); + } else { + return result + 'hodinami'; + } + case 'd': // a day / in a day / a day ago + return withoutSuffix || isFuture ? 'deň' : 'dňom'; + case 'dd': // 9 days / in 9 days / 9 days ago + if (withoutSuffix || isFuture) { + return result + (plural$5(number) ? 'dni' : 'dní'); + } else { + return result + 'dňami'; + } + case 'M': // a month / in a month / a month ago + return withoutSuffix || isFuture ? 'mesiac' : 'mesiacom'; + case 'MM': // 9 months / in 9 months / 9 months ago + if (withoutSuffix || isFuture) { + return result + (plural$5(number) ? 'mesiace' : 'mesiacov'); + } else { + return result + 'mesiacmi'; + } + case 'y': // a year / in a year / a year ago + return withoutSuffix || isFuture ? 'rok' : 'rokom'; + case 'yy': // 9 years / in 9 years / 9 years ago + if (withoutSuffix || isFuture) { + return result + (plural$5(number) ? 'roky' : 'rokov'); + } else { + return result + 'rokmi'; + } + } + } + + moment.defineLocale('sk', { + months: months$9, + monthsShort: monthsShort$6, + weekdays: 'nedeľa_pondelok_utorok_streda_štvrtok_piatok_sobota'.split('_'), + weekdaysShort: 'ne_po_ut_st_št_pi_so'.split('_'), + weekdaysMin: 'ne_po_ut_st_št_pi_so'.split('_'), + longDateFormat: { + LT: 'H:mm', + LTS: 'H:mm:ss', + L: 'DD.MM.YYYY', + LL: 'D. MMMM YYYY', + LLL: 'D. MMMM YYYY H:mm', + LLLL: 'dddd D. MMMM YYYY H:mm', + }, + calendar: { + sameDay: '[dnes o] LT', + nextDay: '[zajtra o] LT', + nextWeek: function () { + switch (this.day()) { + case 0: + return '[v nedeľu o] LT'; + case 1: + case 2: + return '[v] dddd [o] LT'; + case 3: + return '[v stredu o] LT'; + case 4: + return '[vo štvrtok o] LT'; + case 5: + return '[v piatok o] LT'; + case 6: + return '[v sobotu o] LT'; + } + }, + lastDay: '[včera o] LT', + lastWeek: function () { + switch (this.day()) { + case 0: + return '[minulú nedeľu o] LT'; + case 1: + case 2: + return '[minulý] dddd [o] LT'; + case 3: + return '[minulú stredu o] LT'; + case 4: + case 5: + return '[minulý] dddd [o] LT'; + case 6: + return '[minulú sobotu o] LT'; + } + }, + sameElse: 'L', + }, + relativeTime: { + future: 'za %s', + past: 'pred %s', + s: translate$9, + ss: translate$9, + m: translate$9, + mm: translate$9, + h: translate$9, + hh: translate$9, + d: translate$9, + dd: translate$9, + M: translate$9, + MM: translate$9, + y: translate$9, + yy: translate$9, + }, + dayOfMonthOrdinalParse: /\d{1,2}\./, + ordinal: '%d.', + week: { + dow: 1, // Monday is the first day of the week. + doy: 4, // The week that contains Jan 4th is the first week of the year. + }, + }); + + //! moment.js locale configuration + + function processRelativeTime$7(number, withoutSuffix, key, isFuture) { + var result = number + ' '; + switch (key) { + case 's': + return withoutSuffix || isFuture + ? 'nekaj sekund' + : 'nekaj sekundami'; + case 'ss': + if (number === 1) { + result += withoutSuffix ? 'sekundo' : 'sekundi'; + } else if (number === 2) { + result += withoutSuffix || isFuture ? 'sekundi' : 'sekundah'; + } else if (number < 5) { + result += withoutSuffix || isFuture ? 'sekunde' : 'sekundah'; + } else { + result += 'sekund'; + } + return result; + case 'm': + return withoutSuffix ? 'ena minuta' : 'eno minuto'; + case 'mm': + if (number === 1) { + result += withoutSuffix ? 'minuta' : 'minuto'; + } else if (number === 2) { + result += withoutSuffix || isFuture ? 'minuti' : 'minutama'; + } else if (number < 5) { + result += withoutSuffix || isFuture ? 'minute' : 'minutami'; + } else { + result += withoutSuffix || isFuture ? 'minut' : 'minutami'; + } + return result; + case 'h': + return withoutSuffix ? 'ena ura' : 'eno uro'; + case 'hh': + if (number === 1) { + result += withoutSuffix ? 'ura' : 'uro'; + } else if (number === 2) { + result += withoutSuffix || isFuture ? 'uri' : 'urama'; + } else if (number < 5) { + result += withoutSuffix || isFuture ? 'ure' : 'urami'; + } else { + result += withoutSuffix || isFuture ? 'ur' : 'urami'; + } + return result; + case 'd': + return withoutSuffix || isFuture ? 'en dan' : 'enim dnem'; + case 'dd': + if (number === 1) { + result += withoutSuffix || isFuture ? 'dan' : 'dnem'; + } else if (number === 2) { + result += withoutSuffix || isFuture ? 'dni' : 'dnevoma'; + } else { + result += withoutSuffix || isFuture ? 'dni' : 'dnevi'; + } + return result; + case 'M': + return withoutSuffix || isFuture ? 'en mesec' : 'enim mesecem'; + case 'MM': + if (number === 1) { + result += withoutSuffix || isFuture ? 'mesec' : 'mesecem'; + } else if (number === 2) { + result += withoutSuffix || isFuture ? 'meseca' : 'mesecema'; + } else if (number < 5) { + result += withoutSuffix || isFuture ? 'mesece' : 'meseci'; + } else { + result += withoutSuffix || isFuture ? 'mesecev' : 'meseci'; + } + return result; + case 'y': + return withoutSuffix || isFuture ? 'eno leto' : 'enim letom'; + case 'yy': + if (number === 1) { + result += withoutSuffix || isFuture ? 'leto' : 'letom'; + } else if (number === 2) { + result += withoutSuffix || isFuture ? 'leti' : 'letoma'; + } else if (number < 5) { + result += withoutSuffix || isFuture ? 'leta' : 'leti'; + } else { + result += withoutSuffix || isFuture ? 'let' : 'leti'; + } + return result; + } + } + + moment.defineLocale('sl', { + months: 'januar_februar_marec_april_maj_junij_julij_avgust_september_oktober_november_december'.split( + '_' + ), + monthsShort: 'jan._feb._mar._apr._maj._jun._jul._avg._sep._okt._nov._dec.'.split( + '_' + ), + monthsParseExact: true, + weekdays: 'nedelja_ponedeljek_torek_sreda_četrtek_petek_sobota'.split('_'), + weekdaysShort: 'ned._pon._tor._sre._čet._pet._sob.'.split('_'), + weekdaysMin: 'ne_po_to_sr_če_pe_so'.split('_'), + weekdaysParseExact: true, + longDateFormat: { + LT: 'H:mm', + LTS: 'H:mm:ss', + L: 'DD. MM. YYYY', + LL: 'D. MMMM YYYY', + LLL: 'D. MMMM YYYY H:mm', + LLLL: 'dddd, D. MMMM YYYY H:mm', + }, + calendar: { + sameDay: '[danes ob] LT', + nextDay: '[jutri ob] LT', + + nextWeek: function () { + switch (this.day()) { + case 0: + return '[v] [nedeljo] [ob] LT'; + case 3: + return '[v] [sredo] [ob] LT'; + case 6: + return '[v] [soboto] [ob] LT'; + case 1: + case 2: + case 4: + case 5: + return '[v] dddd [ob] LT'; + } + }, + lastDay: '[včeraj ob] LT', + lastWeek: function () { + switch (this.day()) { + case 0: + return '[prejšnjo] [nedeljo] [ob] LT'; + case 3: + return '[prejšnjo] [sredo] [ob] LT'; + case 6: + return '[prejšnjo] [soboto] [ob] LT'; + case 1: + case 2: + case 4: + case 5: + return '[prejšnji] dddd [ob] LT'; + } + }, + sameElse: 'L', + }, + relativeTime: { + future: 'čez %s', + past: 'pred %s', + s: processRelativeTime$7, + ss: processRelativeTime$7, + m: processRelativeTime$7, + mm: processRelativeTime$7, + h: processRelativeTime$7, + hh: processRelativeTime$7, + d: processRelativeTime$7, + dd: processRelativeTime$7, + M: processRelativeTime$7, + MM: processRelativeTime$7, + y: processRelativeTime$7, + yy: processRelativeTime$7, + }, + dayOfMonthOrdinalParse: /\d{1,2}\./, + ordinal: '%d.', + week: { + dow: 1, // Monday is the first day of the week. + doy: 7, // The week that contains Jan 7th is the first week of the year. + }, + }); + + //! moment.js locale configuration + + moment.defineLocale('sq', { + months: 'Janar_Shkurt_Mars_Prill_Maj_Qershor_Korrik_Gusht_Shtator_Tetor_Nëntor_Dhjetor'.split( + '_' + ), + monthsShort: 'Jan_Shk_Mar_Pri_Maj_Qer_Kor_Gus_Sht_Tet_Nën_Dhj'.split('_'), + weekdays: 'E Diel_E Hënë_E Martë_E Mërkurë_E Enjte_E Premte_E Shtunë'.split( + '_' + ), + weekdaysShort: 'Die_Hën_Mar_Mër_Enj_Pre_Sht'.split('_'), + weekdaysMin: 'D_H_Ma_Më_E_P_Sh'.split('_'), + weekdaysParseExact: true, + meridiemParse: /PD|MD/, + isPM: function (input) { + return input.charAt(0) === 'M'; + }, + meridiem: function (hours, minutes, isLower) { + return hours < 12 ? 'PD' : 'MD'; + }, + longDateFormat: { + LT: 'HH:mm', + LTS: 'HH:mm:ss', + L: 'DD/MM/YYYY', + LL: 'D MMMM YYYY', + LLL: 'D MMMM YYYY HH:mm', + LLLL: 'dddd, D MMMM YYYY HH:mm', + }, + calendar: { + sameDay: '[Sot në] LT', + nextDay: '[Nesër në] LT', + nextWeek: 'dddd [në] LT', + lastDay: '[Dje në] LT', + lastWeek: 'dddd [e kaluar në] LT', + sameElse: 'L', + }, + relativeTime: { + future: 'në %s', + past: '%s më parë', + s: 'disa sekonda', + ss: '%d sekonda', + m: 'një minutë', + mm: '%d minuta', + h: 'një orë', + hh: '%d orë', + d: 'një ditë', + dd: '%d ditë', + M: 'një muaj', + MM: '%d muaj', + y: 'një vit', + yy: '%d vite', + }, + dayOfMonthOrdinalParse: /\d{1,2}\./, + ordinal: '%d.', + week: { + dow: 1, // Monday is the first day of the week. + doy: 4, // The week that contains Jan 4th is the first week of the year. + }, + }); + + //! moment.js locale configuration + + var translator$1 = { + words: { + //Different grammatical cases + ss: ['секунда', 'секунде', 'секунди'], + m: ['један минут', 'једне минуте'], + mm: ['минут', 'минуте', 'минута'], + h: ['један сат', 'једног сата'], + hh: ['сат', 'сата', 'сати'], + dd: ['дан', 'дана', 'дана'], + MM: ['месец', 'месеца', 'месеци'], + yy: ['година', 'године', 'година'], + }, + correctGrammaticalCase: function (number, wordKey) { + return number === 1 + ? wordKey[0] + : number >= 2 && number <= 4 + ? wordKey[1] + : wordKey[2]; + }, + translate: function (number, withoutSuffix, key) { + var wordKey = translator$1.words[key]; + if (key.length === 1) { + return withoutSuffix ? wordKey[0] : wordKey[1]; + } else { + return ( + number + + ' ' + + translator$1.correctGrammaticalCase(number, wordKey) + ); + } + }, + }; + + moment.defineLocale('sr-cyrl', { + months: 'јануар_фебруар_март_април_мај_јун_јул_август_септембар_октобар_новембар_децембар'.split( + '_' + ), + monthsShort: 'јан._феб._мар._апр._мај_јун_јул_авг._сеп._окт._нов._дец.'.split( + '_' + ), + monthsParseExact: true, + weekdays: 'недеља_понедељак_уторак_среда_четвртак_петак_субота'.split('_'), + weekdaysShort: 'нед._пон._уто._сре._чет._пет._суб.'.split('_'), + weekdaysMin: 'не_по_ут_ср_че_пе_су'.split('_'), + weekdaysParseExact: true, + longDateFormat: { + LT: 'H:mm', + LTS: 'H:mm:ss', + L: 'DD.MM.YYYY', + LL: 'D. MMMM YYYY', + LLL: 'D. MMMM YYYY H:mm', + LLLL: 'dddd, D. MMMM YYYY H:mm', + }, + calendar: { + sameDay: '[данас у] LT', + nextDay: '[сутра у] LT', + nextWeek: function () { + switch (this.day()) { + case 0: + return '[у] [недељу] [у] LT'; + case 3: + return '[у] [среду] [у] LT'; + case 6: + return '[у] [суботу] [у] LT'; + case 1: + case 2: + case 4: + case 5: + return '[у] dddd [у] LT'; + } + }, + lastDay: '[јуче у] LT', + lastWeek: function () { + var lastWeekDays = [ + '[прошле] [недеље] [у] LT', + '[прошлог] [понедељка] [у] LT', + '[прошлог] [уторка] [у] LT', + '[прошле] [среде] [у] LT', + '[прошлог] [четвртка] [у] LT', + '[прошлог] [петка] [у] LT', + '[прошле] [суботе] [у] LT', + ]; + return lastWeekDays[this.day()]; + }, + sameElse: 'L', + }, + relativeTime: { + future: 'за %s', + past: 'пре %s', + s: 'неколико секунди', + ss: translator$1.translate, + m: translator$1.translate, + mm: translator$1.translate, + h: translator$1.translate, + hh: translator$1.translate, + d: 'дан', + dd: translator$1.translate, + M: 'месец', + MM: translator$1.translate, + y: 'годину', + yy: translator$1.translate, + }, + dayOfMonthOrdinalParse: /\d{1,2}\./, + ordinal: '%d.', + week: { + dow: 1, // Monday is the first day of the week. + doy: 7, // The week that contains Jan 7th is the first week of the year. + }, + }); + + //! moment.js locale configuration + + var translator$2 = { + words: { + //Different grammatical cases + ss: ['sekunda', 'sekunde', 'sekundi'], + m: ['jedan minut', 'jedne minute'], + mm: ['minut', 'minute', 'minuta'], + h: ['jedan sat', 'jednog sata'], + hh: ['sat', 'sata', 'sati'], + dd: ['dan', 'dana', 'dana'], + MM: ['mesec', 'meseca', 'meseci'], + yy: ['godina', 'godine', 'godina'], + }, + correctGrammaticalCase: function (number, wordKey) { + return number === 1 + ? wordKey[0] + : number >= 2 && number <= 4 + ? wordKey[1] + : wordKey[2]; + }, + translate: function (number, withoutSuffix, key) { + var wordKey = translator$2.words[key]; + if (key.length === 1) { + return withoutSuffix ? wordKey[0] : wordKey[1]; + } else { + return ( + number + + ' ' + + translator$2.correctGrammaticalCase(number, wordKey) + ); + } + }, + }; + + moment.defineLocale('sr', { + months: 'januar_februar_mart_april_maj_jun_jul_avgust_septembar_oktobar_novembar_decembar'.split( + '_' + ), + monthsShort: 'jan._feb._mar._apr._maj_jun_jul_avg._sep._okt._nov._dec.'.split( + '_' + ), + monthsParseExact: true, + weekdays: 'nedelja_ponedeljak_utorak_sreda_četvrtak_petak_subota'.split( + '_' + ), + weekdaysShort: 'ned._pon._uto._sre._čet._pet._sub.'.split('_'), + weekdaysMin: 'ne_po_ut_sr_če_pe_su'.split('_'), + weekdaysParseExact: true, + longDateFormat: { + LT: 'H:mm', + LTS: 'H:mm:ss', + L: 'DD.MM.YYYY', + LL: 'D. MMMM YYYY', + LLL: 'D. MMMM YYYY H:mm', + LLLL: 'dddd, D. MMMM YYYY H:mm', + }, + calendar: { + sameDay: '[danas u] LT', + nextDay: '[sutra u] LT', + nextWeek: function () { + switch (this.day()) { + case 0: + return '[u] [nedelju] [u] LT'; + case 3: + return '[u] [sredu] [u] LT'; + case 6: + return '[u] [subotu] [u] LT'; + case 1: + case 2: + case 4: + case 5: + return '[u] dddd [u] LT'; + } + }, + lastDay: '[juče u] LT', + lastWeek: function () { + var lastWeekDays = [ + '[prošle] [nedelje] [u] LT', + '[prošlog] [ponedeljka] [u] LT', + '[prošlog] [utorka] [u] LT', + '[prošle] [srede] [u] LT', + '[prošlog] [četvrtka] [u] LT', + '[prošlog] [petka] [u] LT', + '[prošle] [subote] [u] LT', + ]; + return lastWeekDays[this.day()]; + }, + sameElse: 'L', + }, + relativeTime: { + future: 'za %s', + past: 'pre %s', + s: 'nekoliko sekundi', + ss: translator$2.translate, + m: translator$2.translate, + mm: translator$2.translate, + h: translator$2.translate, + hh: translator$2.translate, + d: 'dan', + dd: translator$2.translate, + M: 'mesec', + MM: translator$2.translate, + y: 'godinu', + yy: translator$2.translate, + }, + dayOfMonthOrdinalParse: /\d{1,2}\./, + ordinal: '%d.', + week: { + dow: 1, // Monday is the first day of the week. + doy: 7, // The week that contains Jan 7th is the first week of the year. + }, + }); + + //! moment.js locale configuration + + moment.defineLocale('ss', { + months: "Bhimbidvwane_Indlovana_Indlov'lenkhulu_Mabasa_Inkhwekhweti_Inhlaba_Kholwane_Ingci_Inyoni_Imphala_Lweti_Ingongoni".split( + '_' + ), + monthsShort: 'Bhi_Ina_Inu_Mab_Ink_Inh_Kho_Igc_Iny_Imp_Lwe_Igo'.split('_'), + weekdays: 'Lisontfo_Umsombuluko_Lesibili_Lesitsatfu_Lesine_Lesihlanu_Umgcibelo'.split( + '_' + ), + weekdaysShort: 'Lis_Umb_Lsb_Les_Lsi_Lsh_Umg'.split('_'), + weekdaysMin: 'Li_Us_Lb_Lt_Ls_Lh_Ug'.split('_'), + weekdaysParseExact: true, + longDateFormat: { + LT: 'h:mm A', + LTS: 'h:mm:ss A', + L: 'DD/MM/YYYY', + LL: 'D MMMM YYYY', + LLL: 'D MMMM YYYY h:mm A', + LLLL: 'dddd, D MMMM YYYY h:mm A', + }, + calendar: { + sameDay: '[Namuhla nga] LT', + nextDay: '[Kusasa nga] LT', + nextWeek: 'dddd [nga] LT', + lastDay: '[Itolo nga] LT', + lastWeek: 'dddd [leliphelile] [nga] LT', + sameElse: 'L', + }, + relativeTime: { + future: 'nga %s', + past: 'wenteka nga %s', + s: 'emizuzwana lomcane', + ss: '%d mzuzwana', + m: 'umzuzu', + mm: '%d emizuzu', + h: 'lihora', + hh: '%d emahora', + d: 'lilanga', + dd: '%d emalanga', + M: 'inyanga', + MM: '%d tinyanga', + y: 'umnyaka', + yy: '%d iminyaka', + }, + meridiemParse: /ekuseni|emini|entsambama|ebusuku/, + meridiem: function (hours, minutes, isLower) { + if (hours < 11) { + return 'ekuseni'; + } else if (hours < 15) { + return 'emini'; + } else if (hours < 19) { + return 'entsambama'; + } else { + return 'ebusuku'; + } + }, + meridiemHour: function (hour, meridiem) { + if (hour === 12) { + hour = 0; + } + if (meridiem === 'ekuseni') { + return hour; + } else if (meridiem === 'emini') { + return hour >= 11 ? hour : hour + 12; + } else if (meridiem === 'entsambama' || meridiem === 'ebusuku') { + if (hour === 0) { + return 0; + } + return hour + 12; + } + }, + dayOfMonthOrdinalParse: /\d{1,2}/, + ordinal: '%d', + week: { + dow: 1, // Monday is the first day of the week. + doy: 4, // The week that contains Jan 4th is the first week of the year. + }, + }); + + //! moment.js locale configuration + + moment.defineLocale('sv', { + months: 'januari_februari_mars_april_maj_juni_juli_augusti_september_oktober_november_december'.split( + '_' + ), + monthsShort: 'jan_feb_mar_apr_maj_jun_jul_aug_sep_okt_nov_dec'.split('_'), + weekdays: 'söndag_måndag_tisdag_onsdag_torsdag_fredag_lördag'.split('_'), + weekdaysShort: 'sön_mån_tis_ons_tor_fre_lör'.split('_'), + weekdaysMin: 'sö_må_ti_on_to_fr_lö'.split('_'), + longDateFormat: { + LT: 'HH:mm', + LTS: 'HH:mm:ss', + L: 'YYYY-MM-DD', + LL: 'D MMMM YYYY', + LLL: 'D MMMM YYYY [kl.] HH:mm', + LLLL: 'dddd D MMMM YYYY [kl.] HH:mm', + lll: 'D MMM YYYY HH:mm', + llll: 'ddd D MMM YYYY HH:mm', + }, + calendar: { + sameDay: '[Idag] LT', + nextDay: '[Imorgon] LT', + lastDay: '[Igår] LT', + nextWeek: '[På] dddd LT', + lastWeek: '[I] dddd[s] LT', + sameElse: 'L', + }, + relativeTime: { + future: 'om %s', + past: 'för %s sedan', + s: 'några sekunder', + ss: '%d sekunder', + m: 'en minut', + mm: '%d minuter', + h: 'en timme', + hh: '%d timmar', + d: 'en dag', + dd: '%d dagar', + M: 'en månad', + MM: '%d månader', + y: 'ett år', + yy: '%d år', + }, + dayOfMonthOrdinalParse: /\d{1,2}(\:e|\:a)/, + ordinal: function (number) { + var b = number % 10, + output = + ~~((number % 100) / 10) === 1 + ? ':e' + : b === 1 + ? ':a' + : b === 2 + ? ':a' + : b === 3 + ? ':e' + : ':e'; + return number + output; + }, + week: { + dow: 1, // Monday is the first day of the week. + doy: 4, // The week that contains Jan 4th is the first week of the year. + }, + }); + + //! moment.js locale configuration + + moment.defineLocale('sw', { + months: 'Januari_Februari_Machi_Aprili_Mei_Juni_Julai_Agosti_Septemba_Oktoba_Novemba_Desemba'.split( + '_' + ), + monthsShort: 'Jan_Feb_Mac_Apr_Mei_Jun_Jul_Ago_Sep_Okt_Nov_Des'.split('_'), + weekdays: 'Jumapili_Jumatatu_Jumanne_Jumatano_Alhamisi_Ijumaa_Jumamosi'.split( + '_' + ), + weekdaysShort: 'Jpl_Jtat_Jnne_Jtan_Alh_Ijm_Jmos'.split('_'), + weekdaysMin: 'J2_J3_J4_J5_Al_Ij_J1'.split('_'), + weekdaysParseExact: true, + longDateFormat: { + LT: 'hh:mm A', + LTS: 'HH:mm:ss', + L: 'DD.MM.YYYY', + LL: 'D MMMM YYYY', + LLL: 'D MMMM YYYY HH:mm', + LLLL: 'dddd, D MMMM YYYY HH:mm', + }, + calendar: { + sameDay: '[leo saa] LT', + nextDay: '[kesho saa] LT', + nextWeek: '[wiki ijayo] dddd [saat] LT', + lastDay: '[jana] LT', + lastWeek: '[wiki iliyopita] dddd [saat] LT', + sameElse: 'L', + }, + relativeTime: { + future: '%s baadaye', + past: 'tokea %s', + s: 'hivi punde', + ss: 'sekunde %d', + m: 'dakika moja', + mm: 'dakika %d', + h: 'saa limoja', + hh: 'masaa %d', + d: 'siku moja', + dd: 'siku %d', + M: 'mwezi mmoja', + MM: 'miezi %d', + y: 'mwaka mmoja', + yy: 'miaka %d', + }, + week: { + dow: 1, // Monday is the first day of the week. + doy: 7, // The week that contains Jan 7th is the first week of the year. + }, + }); + + //! moment.js locale configuration + + var symbolMap$f = { + '1': '௧', + '2': '௨', + '3': '௩', + '4': '௪', + '5': '௫', + '6': '௬', + '7': '௭', + '8': '௮', + '9': '௯', + '0': '௦', + }, + numberMap$e = { + '௧': '1', + '௨': '2', + '௩': '3', + '௪': '4', + '௫': '5', + '௬': '6', + '௭': '7', + '௮': '8', + '௯': '9', + '௦': '0', + }; + + moment.defineLocale('ta', { + months: 'ஜனவரி_பிப்ரவரி_மார்ச்_ஏப்ரல்_மே_ஜூன்_ஜூலை_ஆகஸ்ட்_செப்டெம்பர்_அக்டோபர்_நவம்பர்_டிசம்பர்'.split( + '_' + ), + monthsShort: 'ஜனவரி_பிப்ரவரி_மார்ச்_ஏப்ரல்_மே_ஜூன்_ஜூலை_ஆகஸ்ட்_செப்டெம்பர்_அக்டோபர்_நவம்பர்_டிசம்பர்'.split( + '_' + ), + weekdays: 'ஞாயிற்றுக்கிழமை_திங்கட்கிழமை_செவ்வாய்கிழமை_புதன்கிழமை_வியாழக்கிழமை_வெள்ளிக்கிழமை_சனிக்கிழமை'.split( + '_' + ), + weekdaysShort: 'ஞாயிறு_திங்கள்_செவ்வாய்_புதன்_வியாழன்_வெள்ளி_சனி'.split( + '_' + ), + weekdaysMin: 'ஞா_தி_செ_பு_வி_வெ_ச'.split('_'), + longDateFormat: { + LT: 'HH:mm', + LTS: 'HH:mm:ss', + L: 'DD/MM/YYYY', + LL: 'D MMMM YYYY', + LLL: 'D MMMM YYYY, HH:mm', + LLLL: 'dddd, D MMMM YYYY, HH:mm', + }, + calendar: { + sameDay: '[இன்று] LT', + nextDay: '[நாளை] LT', + nextWeek: 'dddd, LT', + lastDay: '[நேற்று] LT', + lastWeek: '[கடந்த வாரம்] dddd, LT', + sameElse: 'L', + }, + relativeTime: { + future: '%s இல்', + past: '%s முன்', + s: 'ஒரு சில விநாடிகள்', + ss: '%d விநாடிகள்', + m: 'ஒரு நிமிடம்', + mm: '%d நிமிடங்கள்', + h: 'ஒரு மணி நேரம்', + hh: '%d மணி நேரம்', + d: 'ஒரு நாள்', + dd: '%d நாட்கள்', + M: 'ஒரு மாதம்', + MM: '%d மாதங்கள்', + y: 'ஒரு வருடம்', + yy: '%d ஆண்டுகள்', + }, + dayOfMonthOrdinalParse: /\d{1,2}வது/, + ordinal: function (number) { + return number + 'வது'; + }, + preparse: function (string) { + return string.replace(/[௧௨௩௪௫௬௭௮௯௦]/g, function (match) { + return numberMap$e[match]; + }); + }, + postformat: function (string) { + return string.replace(/\d/g, function (match) { + return symbolMap$f[match]; + }); + }, + // refer http://ta.wikipedia.org/s/1er1 + meridiemParse: /யாமம்|வைகறை|காலை|நண்பகல்|எற்பாடு|மாலை/, + meridiem: function (hour, minute, isLower) { + if (hour < 2) { + return ' யாமம்'; + } else if (hour < 6) { + return ' வைகறை'; // வைகறை + } else if (hour < 10) { + return ' காலை'; // காலை + } else if (hour < 14) { + return ' நண்பகல்'; // நண்பகல் + } else if (hour < 18) { + return ' எற்பாடு'; // எற்பாடு + } else if (hour < 22) { + return ' மாலை'; // மாலை + } else { + return ' யாமம்'; + } + }, + meridiemHour: function (hour, meridiem) { + if (hour === 12) { + hour = 0; + } + if (meridiem === 'யாமம்') { + return hour < 2 ? hour : hour + 12; + } else if (meridiem === 'வைகறை' || meridiem === 'காலை') { + return hour; + } else if (meridiem === 'நண்பகல்') { + return hour >= 10 ? hour : hour + 12; + } else { + return hour + 12; + } + }, + week: { + dow: 0, // Sunday is the first day of the week. + doy: 6, // The week that contains Jan 6th is the first week of the year. + }, + }); + + //! moment.js locale configuration + + moment.defineLocale('te', { + months: 'జనవరి_ఫిబ్రవరి_మార్చి_ఏప్రిల్_మే_జూన్_జులై_ఆగస్టు_సెప్టెంబర్_అక్టోబర్_నవంబర్_డిసెంబర్'.split( + '_' + ), + monthsShort: 'జన._ఫిబ్ర._మార్చి_ఏప్రి._మే_జూన్_జులై_ఆగ._సెప్._అక్టో._నవ._డిసె.'.split( + '_' + ), + monthsParseExact: true, + weekdays: 'ఆదివారం_సోమవారం_మంగళవారం_బుధవారం_గురువారం_శుక్రవారం_శనివారం'.split( + '_' + ), + weekdaysShort: 'ఆది_సోమ_మంగళ_బుధ_గురు_శుక్ర_శని'.split('_'), + weekdaysMin: 'ఆ_సో_మం_బు_గు_శు_శ'.split('_'), + longDateFormat: { + LT: 'A h:mm', + LTS: 'A h:mm:ss', + L: 'DD/MM/YYYY', + LL: 'D MMMM YYYY', + LLL: 'D MMMM YYYY, A h:mm', + LLLL: 'dddd, D MMMM YYYY, A h:mm', + }, + calendar: { + sameDay: '[నేడు] LT', + nextDay: '[రేపు] LT', + nextWeek: 'dddd, LT', + lastDay: '[నిన్న] LT', + lastWeek: '[గత] dddd, LT', + sameElse: 'L', + }, + relativeTime: { + future: '%s లో', + past: '%s క్రితం', + s: 'కొన్ని క్షణాలు', + ss: '%d సెకన్లు', + m: 'ఒక నిమిషం', + mm: '%d నిమిషాలు', + h: 'ఒక గంట', + hh: '%d గంటలు', + d: 'ఒక రోజు', + dd: '%d రోజులు', + M: 'ఒక నెల', + MM: '%d నెలలు', + y: 'ఒక సంవత్సరం', + yy: '%d సంవత్సరాలు', + }, + dayOfMonthOrdinalParse: /\d{1,2}వ/, + ordinal: '%dవ', + meridiemParse: /రాత్రి|ఉదయం|మధ్యాహ్నం|సాయంత్రం/, + meridiemHour: function (hour, meridiem) { + if (hour === 12) { + hour = 0; + } + if (meridiem === 'రాత్రి') { + return hour < 4 ? hour : hour + 12; + } else if (meridiem === 'ఉదయం') { + return hour; + } else if (meridiem === 'మధ్యాహ్నం') { + return hour >= 10 ? hour : hour + 12; + } else if (meridiem === 'సాయంత్రం') { + return hour + 12; + } + }, + meridiem: function (hour, minute, isLower) { + if (hour < 4) { + return 'రాత్రి'; + } else if (hour < 10) { + return 'ఉదయం'; + } else if (hour < 17) { + return 'మధ్యాహ్నం'; + } else if (hour < 20) { + return 'సాయంత్రం'; + } else { + return 'రాత్రి'; + } + }, + week: { + dow: 0, // Sunday is the first day of the week. + doy: 6, // The week that contains Jan 6th is the first week of the year. + }, + }); + + //! moment.js locale configuration + + moment.defineLocale('tet', { + months: 'Janeiru_Fevereiru_Marsu_Abril_Maiu_Juñu_Jullu_Agustu_Setembru_Outubru_Novembru_Dezembru'.split( + '_' + ), + monthsShort: 'Jan_Fev_Mar_Abr_Mai_Jun_Jul_Ago_Set_Out_Nov_Dez'.split('_'), + weekdays: 'Domingu_Segunda_Tersa_Kuarta_Kinta_Sesta_Sabadu'.split('_'), + weekdaysShort: 'Dom_Seg_Ters_Kua_Kint_Sest_Sab'.split('_'), + weekdaysMin: 'Do_Seg_Te_Ku_Ki_Ses_Sa'.split('_'), + longDateFormat: { + LT: 'HH:mm', + LTS: 'HH:mm:ss', + L: 'DD/MM/YYYY', + LL: 'D MMMM YYYY', + LLL: 'D MMMM YYYY HH:mm', + LLLL: 'dddd, D MMMM YYYY HH:mm', + }, + calendar: { + sameDay: '[Ohin iha] LT', + nextDay: '[Aban iha] LT', + nextWeek: 'dddd [iha] LT', + lastDay: '[Horiseik iha] LT', + lastWeek: 'dddd [semana kotuk] [iha] LT', + sameElse: 'L', + }, + relativeTime: { + future: 'iha %s', + past: '%s liuba', + s: 'segundu balun', + ss: 'segundu %d', + m: 'minutu ida', + mm: 'minutu %d', + h: 'oras ida', + hh: 'oras %d', + d: 'loron ida', + dd: 'loron %d', + M: 'fulan ida', + MM: 'fulan %d', + y: 'tinan ida', + yy: 'tinan %d', + }, + dayOfMonthOrdinalParse: /\d{1,2}(st|nd|rd|th)/, + ordinal: function (number) { + var b = number % 10, + output = + ~~((number % 100) / 10) === 1 + ? 'th' + : b === 1 + ? 'st' + : b === 2 + ? 'nd' + : b === 3 + ? 'rd' + : 'th'; + return number + output; + }, + week: { + dow: 1, // Monday is the first day of the week. + doy: 4, // The week that contains Jan 4th is the first week of the year. + }, + }); + + //! moment.js locale configuration + + var suffixes$3 = { + 0: '-ум', + 1: '-ум', + 2: '-юм', + 3: '-юм', + 4: '-ум', + 5: '-ум', + 6: '-ум', + 7: '-ум', + 8: '-ум', + 9: '-ум', + 10: '-ум', + 12: '-ум', + 13: '-ум', + 20: '-ум', + 30: '-юм', + 40: '-ум', + 50: '-ум', + 60: '-ум', + 70: '-ум', + 80: '-ум', + 90: '-ум', + 100: '-ум', + }; + + moment.defineLocale('tg', { + months: 'январ_феврал_март_апрел_май_июн_июл_август_сентябр_октябр_ноябр_декабр'.split( + '_' + ), + monthsShort: 'янв_фев_мар_апр_май_июн_июл_авг_сен_окт_ноя_дек'.split('_'), + weekdays: 'якшанбе_душанбе_сешанбе_чоршанбе_панҷшанбе_ҷумъа_шанбе'.split( + '_' + ), + weekdaysShort: 'яшб_дшб_сшб_чшб_пшб_ҷум_шнб'.split('_'), + weekdaysMin: 'яш_дш_сш_чш_пш_ҷм_шб'.split('_'), + longDateFormat: { + LT: 'HH:mm', + LTS: 'HH:mm:ss', + L: 'DD/MM/YYYY', + LL: 'D MMMM YYYY', + LLL: 'D MMMM YYYY HH:mm', + LLLL: 'dddd, D MMMM YYYY HH:mm', + }, + calendar: { + sameDay: '[Имрӯз соати] LT', + nextDay: '[Пагоҳ соати] LT', + lastDay: '[Дирӯз соати] LT', + nextWeek: 'dddd[и] [ҳафтаи оянда соати] LT', + lastWeek: 'dddd[и] [ҳафтаи гузашта соати] LT', + sameElse: 'L', + }, + relativeTime: { + future: 'баъди %s', + past: '%s пеш', + s: 'якчанд сония', + m: 'як дақиқа', + mm: '%d дақиқа', + h: 'як соат', + hh: '%d соат', + d: 'як рӯз', + dd: '%d рӯз', + M: 'як моҳ', + MM: '%d моҳ', + y: 'як сол', + yy: '%d сол', + }, + meridiemParse: /шаб|субҳ|рӯз|бегоҳ/, + meridiemHour: function (hour, meridiem) { + if (hour === 12) { + hour = 0; + } + if (meridiem === 'шаб') { + return hour < 4 ? hour : hour + 12; + } else if (meridiem === 'субҳ') { + return hour; + } else if (meridiem === 'рӯз') { + return hour >= 11 ? hour : hour + 12; + } else if (meridiem === 'бегоҳ') { + return hour + 12; + } + }, + meridiem: function (hour, minute, isLower) { + if (hour < 4) { + return 'шаб'; + } else if (hour < 11) { + return 'субҳ'; + } else if (hour < 16) { + return 'рӯз'; + } else if (hour < 19) { + return 'бегоҳ'; + } else { + return 'шаб'; + } + }, + dayOfMonthOrdinalParse: /\d{1,2}-(ум|юм)/, + ordinal: function (number) { + var a = number % 10, + b = number >= 100 ? 100 : null; + return number + (suffixes$3[number] || suffixes$3[a] || suffixes$3[b]); + }, + week: { + dow: 1, // Monday is the first day of the week. + doy: 7, // The week that contains Jan 1th is the first week of the year. + }, + }); + + //! moment.js locale configuration + + moment.defineLocale('th', { + months: 'มกราคม_กุมภาพันธ์_มีนาคม_เมษายน_พฤษภาคม_มิถุนายน_กรกฎาคม_สิงหาคม_กันยายน_ตุลาคม_พฤศจิกายน_ธันวาคม'.split( + '_' + ), + monthsShort: 'ม.ค._ก.พ._มี.ค._เม.ย._พ.ค._มิ.ย._ก.ค._ส.ค._ก.ย._ต.ค._พ.ย._ธ.ค.'.split( + '_' + ), + monthsParseExact: true, + weekdays: 'อาทิตย์_จันทร์_อังคาร_พุธ_พฤหัสบดี_ศุกร์_เสาร์'.split('_'), + weekdaysShort: 'อาทิตย์_จันทร์_อังคาร_พุธ_พฤหัส_ศุกร์_เสาร์'.split('_'), // yes, three characters difference + weekdaysMin: 'อา._จ._อ._พ._พฤ._ศ._ส.'.split('_'), + weekdaysParseExact: true, + longDateFormat: { + LT: 'H:mm', + LTS: 'H:mm:ss', + L: 'DD/MM/YYYY', + LL: 'D MMMM YYYY', + LLL: 'D MMMM YYYY เวลา H:mm', + LLLL: 'วันddddที่ D MMMM YYYY เวลา H:mm', + }, + meridiemParse: /ก่อนเที่ยง|หลังเที่ยง/, + isPM: function (input) { + return input === 'หลังเที่ยง'; + }, + meridiem: function (hour, minute, isLower) { + if (hour < 12) { + return 'ก่อนเที่ยง'; + } else { + return 'หลังเที่ยง'; + } + }, + calendar: { + sameDay: '[วันนี้ เวลา] LT', + nextDay: '[พรุ่งนี้ เวลา] LT', + nextWeek: 'dddd[หน้า เวลา] LT', + lastDay: '[เมื่อวานนี้ เวลา] LT', + lastWeek: '[วัน]dddd[ที่แล้ว เวลา] LT', + sameElse: 'L', + }, + relativeTime: { + future: 'อีก %s', + past: '%sที่แล้ว', + s: 'ไม่กี่วินาที', + ss: '%d วินาที', + m: '1 นาที', + mm: '%d นาที', + h: '1 ชั่วโมง', + hh: '%d ชั่วโมง', + d: '1 วัน', + dd: '%d วัน', + M: '1 เดือน', + MM: '%d เดือน', + y: '1 ปี', + yy: '%d ปี', + }, + }); + + //! moment.js locale configuration + + var suffixes$4 = { + 1: "'inji", + 5: "'inji", + 8: "'inji", + 70: "'inji", + 80: "'inji", + 2: "'nji", + 7: "'nji", + 20: "'nji", + 50: "'nji", + 3: "'ünji", + 4: "'ünji", + 100: "'ünji", + 6: "'njy", + 9: "'unjy", + 10: "'unjy", + 30: "'unjy", + 60: "'ynjy", + 90: "'ynjy", + }; + + moment.defineLocale('tk', { + months: 'Ýanwar_Fewral_Mart_Aprel_Maý_Iýun_Iýul_Awgust_Sentýabr_Oktýabr_Noýabr_Dekabr'.split( + '_' + ), + monthsShort: 'Ýan_Few_Mar_Apr_Maý_Iýn_Iýl_Awg_Sen_Okt_Noý_Dek'.split('_'), + weekdays: 'Ýekşenbe_Duşenbe_Sişenbe_Çarşenbe_Penşenbe_Anna_Şenbe'.split( + '_' + ), + weekdaysShort: 'Ýek_Duş_Siş_Çar_Pen_Ann_Şen'.split('_'), + weekdaysMin: 'Ýk_Dş_Sş_Çr_Pn_An_Şn'.split('_'), + longDateFormat: { + LT: 'HH:mm', + LTS: 'HH:mm:ss', + L: 'DD.MM.YYYY', + LL: 'D MMMM YYYY', + LLL: 'D MMMM YYYY HH:mm', + LLLL: 'dddd, D MMMM YYYY HH:mm', + }, + calendar: { + sameDay: '[bugün sagat] LT', + nextDay: '[ertir sagat] LT', + nextWeek: '[indiki] dddd [sagat] LT', + lastDay: '[düýn] LT', + lastWeek: '[geçen] dddd [sagat] LT', + sameElse: 'L', + }, + relativeTime: { + future: '%s soň', + past: '%s öň', + s: 'birnäçe sekunt', + m: 'bir minut', + mm: '%d minut', + h: 'bir sagat', + hh: '%d sagat', + d: 'bir gün', + dd: '%d gün', + M: 'bir aý', + MM: '%d aý', + y: 'bir ýyl', + yy: '%d ýyl', + }, + ordinal: function (number, period) { + switch (period) { + case 'd': + case 'D': + case 'Do': + case 'DD': + return number; + default: + if (number === 0) { + // special case for zero + return number + "'unjy"; + } + var a = number % 10, + b = (number % 100) - a, + c = number >= 100 ? 100 : null; + return number + (suffixes$4[a] || suffixes$4[b] || suffixes$4[c]); + } + }, + week: { + dow: 1, // Monday is the first day of the week. + doy: 7, // The week that contains Jan 7th is the first week of the year. + }, + }); + + //! moment.js locale configuration + + moment.defineLocale('tl-ph', { + months: 'Enero_Pebrero_Marso_Abril_Mayo_Hunyo_Hulyo_Agosto_Setyembre_Oktubre_Nobyembre_Disyembre'.split( + '_' + ), + monthsShort: 'Ene_Peb_Mar_Abr_May_Hun_Hul_Ago_Set_Okt_Nob_Dis'.split('_'), + weekdays: 'Linggo_Lunes_Martes_Miyerkules_Huwebes_Biyernes_Sabado'.split( + '_' + ), + weekdaysShort: 'Lin_Lun_Mar_Miy_Huw_Biy_Sab'.split('_'), + weekdaysMin: 'Li_Lu_Ma_Mi_Hu_Bi_Sab'.split('_'), + longDateFormat: { + LT: 'HH:mm', + LTS: 'HH:mm:ss', + L: 'MM/D/YYYY', + LL: 'MMMM D, YYYY', + LLL: 'MMMM D, YYYY HH:mm', + LLLL: 'dddd, MMMM DD, YYYY HH:mm', + }, + calendar: { + sameDay: 'LT [ngayong araw]', + nextDay: '[Bukas ng] LT', + nextWeek: 'LT [sa susunod na] dddd', + lastDay: 'LT [kahapon]', + lastWeek: 'LT [noong nakaraang] dddd', + sameElse: 'L', + }, + relativeTime: { + future: 'sa loob ng %s', + past: '%s ang nakalipas', + s: 'ilang segundo', + ss: '%d segundo', + m: 'isang minuto', + mm: '%d minuto', + h: 'isang oras', + hh: '%d oras', + d: 'isang araw', + dd: '%d araw', + M: 'isang buwan', + MM: '%d buwan', + y: 'isang taon', + yy: '%d taon', + }, + dayOfMonthOrdinalParse: /\d{1,2}/, + ordinal: function (number) { + return number; + }, + week: { + dow: 1, // Monday is the first day of the week. + doy: 4, // The week that contains Jan 4th is the first week of the year. + }, + }); + + //! moment.js locale configuration + + var numbersNouns = 'pagh_wa’_cha’_wej_loS_vagh_jav_Soch_chorgh_Hut'.split('_'); + + function translateFuture(output) { + var time = output; + time = + output.indexOf('jaj') !== -1 + ? time.slice(0, -3) + 'leS' + : output.indexOf('jar') !== -1 + ? time.slice(0, -3) + 'waQ' + : output.indexOf('DIS') !== -1 + ? time.slice(0, -3) + 'nem' + : time + ' pIq'; + return time; + } + + function translatePast(output) { + var time = output; + time = + output.indexOf('jaj') !== -1 + ? time.slice(0, -3) + 'Hu’' + : output.indexOf('jar') !== -1 + ? time.slice(0, -3) + 'wen' + : output.indexOf('DIS') !== -1 + ? time.slice(0, -3) + 'ben' + : time + ' ret'; + return time; + } + + function translate$a(number, withoutSuffix, string, isFuture) { + var numberNoun = numberAsNoun(number); + switch (string) { + case 'ss': + return numberNoun + ' lup'; + case 'mm': + return numberNoun + ' tup'; + case 'hh': + return numberNoun + ' rep'; + case 'dd': + return numberNoun + ' jaj'; + case 'MM': + return numberNoun + ' jar'; + case 'yy': + return numberNoun + ' DIS'; + } + } + + function numberAsNoun(number) { + var hundred = Math.floor((number % 1000) / 100), + ten = Math.floor((number % 100) / 10), + one = number % 10, + word = ''; + if (hundred > 0) { + word += numbersNouns[hundred] + 'vatlh'; + } + if (ten > 0) { + word += (word !== '' ? ' ' : '') + numbersNouns[ten] + 'maH'; + } + if (one > 0) { + word += (word !== '' ? ' ' : '') + numbersNouns[one]; + } + return word === '' ? 'pagh' : word; + } + + moment.defineLocale('tlh', { + months: 'tera’ jar wa’_tera’ jar cha’_tera’ jar wej_tera’ jar loS_tera’ jar vagh_tera’ jar jav_tera’ jar Soch_tera’ jar chorgh_tera’ jar Hut_tera’ jar wa’maH_tera’ jar wa’maH wa’_tera’ jar wa’maH cha’'.split( + '_' + ), + monthsShort: 'jar wa’_jar cha’_jar wej_jar loS_jar vagh_jar jav_jar Soch_jar chorgh_jar Hut_jar wa’maH_jar wa’maH wa’_jar wa’maH cha’'.split( + '_' + ), + monthsParseExact: true, + weekdays: 'lojmItjaj_DaSjaj_povjaj_ghItlhjaj_loghjaj_buqjaj_ghInjaj'.split( + '_' + ), + weekdaysShort: 'lojmItjaj_DaSjaj_povjaj_ghItlhjaj_loghjaj_buqjaj_ghInjaj'.split( + '_' + ), + weekdaysMin: 'lojmItjaj_DaSjaj_povjaj_ghItlhjaj_loghjaj_buqjaj_ghInjaj'.split( + '_' + ), + longDateFormat: { + LT: 'HH:mm', + LTS: 'HH:mm:ss', + L: 'DD.MM.YYYY', + LL: 'D MMMM YYYY', + LLL: 'D MMMM YYYY HH:mm', + LLLL: 'dddd, D MMMM YYYY HH:mm', + }, + calendar: { + sameDay: '[DaHjaj] LT', + nextDay: '[wa’leS] LT', + nextWeek: 'LLL', + lastDay: '[wa’Hu’] LT', + lastWeek: 'LLL', + sameElse: 'L', + }, + relativeTime: { + future: translateFuture, + past: translatePast, + s: 'puS lup', + ss: translate$a, + m: 'wa’ tup', + mm: translate$a, + h: 'wa’ rep', + hh: translate$a, + d: 'wa’ jaj', + dd: translate$a, + M: 'wa’ jar', + MM: translate$a, + y: 'wa’ DIS', + yy: translate$a, + }, + dayOfMonthOrdinalParse: /\d{1,2}\./, + ordinal: '%d.', + week: { + dow: 1, // Monday is the first day of the week. + doy: 4, // The week that contains Jan 4th is the first week of the year. + }, + }); + + //! moment.js locale configuration + + var suffixes$5 = { + 1: "'inci", + 5: "'inci", + 8: "'inci", + 70: "'inci", + 80: "'inci", + 2: "'nci", + 7: "'nci", + 20: "'nci", + 50: "'nci", + 3: "'üncü", + 4: "'üncü", + 100: "'üncü", + 6: "'ncı", + 9: "'uncu", + 10: "'uncu", + 30: "'uncu", + 60: "'ıncı", + 90: "'ıncı", + }; + + moment.defineLocale('tr', { + months: 'Ocak_Şubat_Mart_Nisan_Mayıs_Haziran_Temmuz_Ağustos_Eylül_Ekim_Kasım_Aralık'.split( + '_' + ), + monthsShort: 'Oca_Şub_Mar_Nis_May_Haz_Tem_Ağu_Eyl_Eki_Kas_Ara'.split('_'), + weekdays: 'Pazar_Pazartesi_Salı_Çarşamba_Perşembe_Cuma_Cumartesi'.split( + '_' + ), + weekdaysShort: 'Paz_Pts_Sal_Çar_Per_Cum_Cts'.split('_'), + weekdaysMin: 'Pz_Pt_Sa_Ça_Pe_Cu_Ct'.split('_'), + meridiem: function (hours, minutes, isLower) { + if (hours < 12) { + return isLower ? 'öö' : 'ÖÖ'; + } else { + return isLower ? 'ös' : 'ÖS'; + } + }, + meridiemParse: /öö|ÖÖ|ös|ÖS/, + isPM: function (input) { + return input === 'ös' || input === 'ÖS'; + }, + longDateFormat: { + LT: 'HH:mm', + LTS: 'HH:mm:ss', + L: 'DD.MM.YYYY', + LL: 'D MMMM YYYY', + LLL: 'D MMMM YYYY HH:mm', + LLLL: 'dddd, D MMMM YYYY HH:mm', + }, + calendar: { + sameDay: '[bugün saat] LT', + nextDay: '[yarın saat] LT', + nextWeek: '[gelecek] dddd [saat] LT', + lastDay: '[dün] LT', + lastWeek: '[geçen] dddd [saat] LT', + sameElse: 'L', + }, + relativeTime: { + future: '%s sonra', + past: '%s önce', + s: 'birkaç saniye', + ss: '%d saniye', + m: 'bir dakika', + mm: '%d dakika', + h: 'bir saat', + hh: '%d saat', + d: 'bir gün', + dd: '%d gün', + M: 'bir ay', + MM: '%d ay', + y: 'bir yıl', + yy: '%d yıl', + }, + ordinal: function (number, period) { + switch (period) { + case 'd': + case 'D': + case 'Do': + case 'DD': + return number; + default: + if (number === 0) { + // special case for zero + return number + "'ıncı"; + } + var a = number % 10, + b = (number % 100) - a, + c = number >= 100 ? 100 : null; + return number + (suffixes$5[a] || suffixes$5[b] || suffixes$5[c]); + } + }, + week: { + dow: 1, // Monday is the first day of the week. + doy: 7, // The week that contains Jan 7th is the first week of the year. + }, + }); + + //! moment.js locale configuration + + // After the year there should be a slash and the amount of years since December 26, 1979 in Roman numerals. + // This is currently too difficult (maybe even impossible) to add. + moment.defineLocale('tzl', { + months: 'Januar_Fevraglh_Març_Avrïu_Mai_Gün_Julia_Guscht_Setemvar_Listopäts_Noemvar_Zecemvar'.split( + '_' + ), + monthsShort: 'Jan_Fev_Mar_Avr_Mai_Gün_Jul_Gus_Set_Lis_Noe_Zec'.split('_'), + weekdays: 'Súladi_Lúneçi_Maitzi_Márcuri_Xhúadi_Viénerçi_Sáturi'.split('_'), + weekdaysShort: 'Súl_Lún_Mai_Már_Xhú_Vié_Sát'.split('_'), + weekdaysMin: 'Sú_Lú_Ma_Má_Xh_Vi_Sá'.split('_'), + longDateFormat: { + LT: 'HH.mm', + LTS: 'HH.mm.ss', + L: 'DD.MM.YYYY', + LL: 'D. MMMM [dallas] YYYY', + LLL: 'D. MMMM [dallas] YYYY HH.mm', + LLLL: 'dddd, [li] D. MMMM [dallas] YYYY HH.mm', + }, + meridiemParse: /d\'o|d\'a/i, + isPM: function (input) { + return "d'o" === input.toLowerCase(); + }, + meridiem: function (hours, minutes, isLower) { + if (hours > 11) { + return isLower ? "d'o" : "D'O"; + } else { + return isLower ? "d'a" : "D'A"; + } + }, + calendar: { + sameDay: '[oxhi à] LT', + nextDay: '[demà à] LT', + nextWeek: 'dddd [à] LT', + lastDay: '[ieiri à] LT', + lastWeek: '[sür el] dddd [lasteu à] LT', + sameElse: 'L', + }, + relativeTime: { + future: 'osprei %s', + past: 'ja%s', + s: processRelativeTime$8, + ss: processRelativeTime$8, + m: processRelativeTime$8, + mm: processRelativeTime$8, + h: processRelativeTime$8, + hh: processRelativeTime$8, + d: processRelativeTime$8, + dd: processRelativeTime$8, + M: processRelativeTime$8, + MM: processRelativeTime$8, + y: processRelativeTime$8, + yy: processRelativeTime$8, + }, + dayOfMonthOrdinalParse: /\d{1,2}\./, + ordinal: '%d.', + week: { + dow: 1, // Monday is the first day of the week. + doy: 4, // The week that contains Jan 4th is the first week of the year. + }, + }); + + function processRelativeTime$8(number, withoutSuffix, key, isFuture) { + var format = { + s: ['viensas secunds', "'iensas secunds"], + ss: [number + ' secunds', '' + number + ' secunds'], + m: ["'n míut", "'iens míut"], + mm: [number + ' míuts', '' + number + ' míuts'], + h: ["'n þora", "'iensa þora"], + hh: [number + ' þoras', '' + number + ' þoras'], + d: ["'n ziua", "'iensa ziua"], + dd: [number + ' ziuas', '' + number + ' ziuas'], + M: ["'n mes", "'iens mes"], + MM: [number + ' mesen', '' + number + ' mesen'], + y: ["'n ar", "'iens ar"], + yy: [number + ' ars', '' + number + ' ars'], + }; + return isFuture + ? format[key][0] + : withoutSuffix + ? format[key][0] + : format[key][1]; + } + + //! moment.js locale configuration + + moment.defineLocale('tzm-latn', { + months: 'innayr_brˤayrˤ_marˤsˤ_ibrir_mayyw_ywnyw_ywlywz_ɣwšt_šwtanbir_ktˤwbrˤ_nwwanbir_dwjnbir'.split( + '_' + ), + monthsShort: 'innayr_brˤayrˤ_marˤsˤ_ibrir_mayyw_ywnyw_ywlywz_ɣwšt_šwtanbir_ktˤwbrˤ_nwwanbir_dwjnbir'.split( + '_' + ), + weekdays: 'asamas_aynas_asinas_akras_akwas_asimwas_asiḍyas'.split('_'), + weekdaysShort: 'asamas_aynas_asinas_akras_akwas_asimwas_asiḍyas'.split('_'), + weekdaysMin: 'asamas_aynas_asinas_akras_akwas_asimwas_asiḍyas'.split('_'), + longDateFormat: { + LT: 'HH:mm', + LTS: 'HH:mm:ss', + L: 'DD/MM/YYYY', + LL: 'D MMMM YYYY', + LLL: 'D MMMM YYYY HH:mm', + LLLL: 'dddd D MMMM YYYY HH:mm', + }, + calendar: { + sameDay: '[asdkh g] LT', + nextDay: '[aska g] LT', + nextWeek: 'dddd [g] LT', + lastDay: '[assant g] LT', + lastWeek: 'dddd [g] LT', + sameElse: 'L', + }, + relativeTime: { + future: 'dadkh s yan %s', + past: 'yan %s', + s: 'imik', + ss: '%d imik', + m: 'minuḍ', + mm: '%d minuḍ', + h: 'saɛa', + hh: '%d tassaɛin', + d: 'ass', + dd: '%d ossan', + M: 'ayowr', + MM: '%d iyyirn', + y: 'asgas', + yy: '%d isgasn', + }, + week: { + dow: 6, // Saturday is the first day of the week. + doy: 12, // The week that contains Jan 12th is the first week of the year. + }, + }); + + //! moment.js locale configuration + + moment.defineLocale('tzm', { + months: 'ⵉⵏⵏⴰⵢⵔ_ⴱⵕⴰⵢⵕ_ⵎⴰⵕⵚ_ⵉⴱⵔⵉⵔ_ⵎⴰⵢⵢⵓ_ⵢⵓⵏⵢⵓ_ⵢⵓⵍⵢⵓⵣ_ⵖⵓⵛⵜ_ⵛⵓⵜⴰⵏⴱⵉⵔ_ⴽⵟⵓⴱⵕ_ⵏⵓⵡⴰⵏⴱⵉⵔ_ⴷⵓⵊⵏⴱⵉⵔ'.split( + '_' + ), + monthsShort: 'ⵉⵏⵏⴰⵢⵔ_ⴱⵕⴰⵢⵕ_ⵎⴰⵕⵚ_ⵉⴱⵔⵉⵔ_ⵎⴰⵢⵢⵓ_ⵢⵓⵏⵢⵓ_ⵢⵓⵍⵢⵓⵣ_ⵖⵓⵛⵜ_ⵛⵓⵜⴰⵏⴱⵉⵔ_ⴽⵟⵓⴱⵕ_ⵏⵓⵡⴰⵏⴱⵉⵔ_ⴷⵓⵊⵏⴱⵉⵔ'.split( + '_' + ), + weekdays: 'ⴰⵙⴰⵎⴰⵙ_ⴰⵢⵏⴰⵙ_ⴰⵙⵉⵏⴰⵙ_ⴰⴽⵔⴰⵙ_ⴰⴽⵡⴰⵙ_ⴰⵙⵉⵎⵡⴰⵙ_ⴰⵙⵉⴹⵢⴰⵙ'.split('_'), + weekdaysShort: 'ⴰⵙⴰⵎⴰⵙ_ⴰⵢⵏⴰⵙ_ⴰⵙⵉⵏⴰⵙ_ⴰⴽⵔⴰⵙ_ⴰⴽⵡⴰⵙ_ⴰⵙⵉⵎⵡⴰⵙ_ⴰⵙⵉⴹⵢⴰⵙ'.split('_'), + weekdaysMin: 'ⴰⵙⴰⵎⴰⵙ_ⴰⵢⵏⴰⵙ_ⴰⵙⵉⵏⴰⵙ_ⴰⴽⵔⴰⵙ_ⴰⴽⵡⴰⵙ_ⴰⵙⵉⵎⵡⴰⵙ_ⴰⵙⵉⴹⵢⴰⵙ'.split('_'), + longDateFormat: { + LT: 'HH:mm', + LTS: 'HH:mm:ss', + L: 'DD/MM/YYYY', + LL: 'D MMMM YYYY', + LLL: 'D MMMM YYYY HH:mm', + LLLL: 'dddd D MMMM YYYY HH:mm', + }, + calendar: { + sameDay: '[ⴰⵙⴷⵅ ⴴ] LT', + nextDay: '[ⴰⵙⴽⴰ ⴴ] LT', + nextWeek: 'dddd [ⴴ] LT', + lastDay: '[ⴰⵚⴰⵏⵜ ⴴ] LT', + lastWeek: 'dddd [ⴴ] LT', + sameElse: 'L', + }, + relativeTime: { + future: 'ⴷⴰⴷⵅ ⵙ ⵢⴰⵏ %s', + past: 'ⵢⴰⵏ %s', + s: 'ⵉⵎⵉⴽ', + ss: '%d ⵉⵎⵉⴽ', + m: 'ⵎⵉⵏⵓⴺ', + mm: '%d ⵎⵉⵏⵓⴺ', + h: 'ⵙⴰⵄⴰ', + hh: '%d ⵜⴰⵙⵙⴰⵄⵉⵏ', + d: 'ⴰⵙⵙ', + dd: '%d oⵙⵙⴰⵏ', + M: 'ⴰⵢoⵓⵔ', + MM: '%d ⵉⵢⵢⵉⵔⵏ', + y: 'ⴰⵙⴳⴰⵙ', + yy: '%d ⵉⵙⴳⴰⵙⵏ', + }, + week: { + dow: 6, // Saturday is the first day of the week. + doy: 12, // The week that contains Jan 12th is the first week of the year. + }, + }); + + //! moment.js locale configuration + + moment.defineLocale('ug-cn', { + months: 'يانۋار_فېۋرال_مارت_ئاپرېل_ماي_ئىيۇن_ئىيۇل_ئاۋغۇست_سېنتەبىر_ئۆكتەبىر_نويابىر_دېكابىر'.split( + '_' + ), + monthsShort: 'يانۋار_فېۋرال_مارت_ئاپرېل_ماي_ئىيۇن_ئىيۇل_ئاۋغۇست_سېنتەبىر_ئۆكتەبىر_نويابىر_دېكابىر'.split( + '_' + ), + weekdays: 'يەكشەنبە_دۈشەنبە_سەيشەنبە_چارشەنبە_پەيشەنبە_جۈمە_شەنبە'.split( + '_' + ), + weekdaysShort: 'يە_دۈ_سە_چا_پە_جۈ_شە'.split('_'), + weekdaysMin: 'يە_دۈ_سە_چا_پە_جۈ_شە'.split('_'), + longDateFormat: { + LT: 'HH:mm', + LTS: 'HH:mm:ss', + L: 'YYYY-MM-DD', + LL: 'YYYY-يىلىM-ئاينىڭD-كۈنى', + LLL: 'YYYY-يىلىM-ئاينىڭD-كۈنى، HH:mm', + LLLL: 'dddd، YYYY-يىلىM-ئاينىڭD-كۈنى، HH:mm', + }, + meridiemParse: /يېرىم كېچە|سەھەر|چۈشتىن بۇرۇن|چۈش|چۈشتىن كېيىن|كەچ/, + meridiemHour: function (hour, meridiem) { + if (hour === 12) { + hour = 0; + } + if ( + meridiem === 'يېرىم كېچە' || + meridiem === 'سەھەر' || + meridiem === 'چۈشتىن بۇرۇن' + ) { + return hour; + } else if (meridiem === 'چۈشتىن كېيىن' || meridiem === 'كەچ') { + return hour + 12; + } else { + return hour >= 11 ? hour : hour + 12; + } + }, + meridiem: function (hour, minute, isLower) { + var hm = hour * 100 + minute; + if (hm < 600) { + return 'يېرىم كېچە'; + } else if (hm < 900) { + return 'سەھەر'; + } else if (hm < 1130) { + return 'چۈشتىن بۇرۇن'; + } else if (hm < 1230) { + return 'چۈش'; + } else if (hm < 1800) { + return 'چۈشتىن كېيىن'; + } else { + return 'كەچ'; + } + }, + calendar: { + sameDay: '[بۈگۈن سائەت] LT', + nextDay: '[ئەتە سائەت] LT', + nextWeek: '[كېلەركى] dddd [سائەت] LT', + lastDay: '[تۆنۈگۈن] LT', + lastWeek: '[ئالدىنقى] dddd [سائەت] LT', + sameElse: 'L', + }, + relativeTime: { + future: '%s كېيىن', + past: '%s بۇرۇن', + s: 'نەچچە سېكونت', + ss: '%d سېكونت', + m: 'بىر مىنۇت', + mm: '%d مىنۇت', + h: 'بىر سائەت', + hh: '%d سائەت', + d: 'بىر كۈن', + dd: '%d كۈن', + M: 'بىر ئاي', + MM: '%d ئاي', + y: 'بىر يىل', + yy: '%d يىل', + }, + + dayOfMonthOrdinalParse: /\d{1,2}(-كۈنى|-ئاي|-ھەپتە)/, + ordinal: function (number, period) { + switch (period) { + case 'd': + case 'D': + case 'DDD': + return number + '-كۈنى'; + case 'w': + case 'W': + return number + '-ھەپتە'; + default: + return number; + } + }, + preparse: function (string) { + return string.replace(/،/g, ','); + }, + postformat: function (string) { + return string.replace(/,/g, '،'); + }, + week: { + // GB/T 7408-1994《数据元和交换格式·信息交换·日期和时间表示法》与ISO 8601:1988等效 + dow: 1, // Monday is the first day of the week. + doy: 7, // The week that contains Jan 1st is the first week of the year. + }, + }); + + //! moment.js locale configuration + + function plural$6(word, num) { + var forms = word.split('_'); + return num % 10 === 1 && num % 100 !== 11 + ? forms[0] + : num % 10 >= 2 && num % 10 <= 4 && (num % 100 < 10 || num % 100 >= 20) + ? forms[1] + : forms[2]; + } + function relativeTimeWithPlural$4(number, withoutSuffix, key) { + var format = { + ss: withoutSuffix ? 'секунда_секунди_секунд' : 'секунду_секунди_секунд', + mm: withoutSuffix ? 'хвилина_хвилини_хвилин' : 'хвилину_хвилини_хвилин', + hh: withoutSuffix ? 'година_години_годин' : 'годину_години_годин', + dd: 'день_дні_днів', + MM: 'місяць_місяці_місяців', + yy: 'рік_роки_років', + }; + if (key === 'm') { + return withoutSuffix ? 'хвилина' : 'хвилину'; + } else if (key === 'h') { + return withoutSuffix ? 'година' : 'годину'; + } else { + return number + ' ' + plural$6(format[key], +number); + } + } + function weekdaysCaseReplace(m, format) { + var weekdays = { + nominative: 'неділя_понеділок_вівторок_середа_четвер_п’ятниця_субота'.split( + '_' + ), + accusative: 'неділю_понеділок_вівторок_середу_четвер_п’ятницю_суботу'.split( + '_' + ), + genitive: 'неділі_понеділка_вівторка_середи_четверга_п’ятниці_суботи'.split( + '_' + ), + }, + nounCase; + + if (m === true) { + return weekdays['nominative'] + .slice(1, 7) + .concat(weekdays['nominative'].slice(0, 1)); + } + if (!m) { + return weekdays['nominative']; + } + + nounCase = /(\[[ВвУу]\]) ?dddd/.test(format) + ? 'accusative' + : /\[?(?:минулої|наступної)? ?\] ?dddd/.test(format) + ? 'genitive' + : 'nominative'; + return weekdays[nounCase][m.day()]; + } + function processHoursFunction(str) { + return function () { + return str + 'о' + (this.hours() === 11 ? 'б' : '') + '] LT'; + }; + } + + moment.defineLocale('uk', { + months: { + format: 'січня_лютого_березня_квітня_травня_червня_липня_серпня_вересня_жовтня_листопада_грудня'.split( + '_' + ), + standalone: 'січень_лютий_березень_квітень_травень_червень_липень_серпень_вересень_жовтень_листопад_грудень'.split( + '_' + ), + }, + monthsShort: 'січ_лют_бер_квіт_трав_черв_лип_серп_вер_жовт_лист_груд'.split( + '_' + ), + weekdays: weekdaysCaseReplace, + weekdaysShort: 'нд_пн_вт_ср_чт_пт_сб'.split('_'), + weekdaysMin: 'нд_пн_вт_ср_чт_пт_сб'.split('_'), + longDateFormat: { + LT: 'HH:mm', + LTS: 'HH:mm:ss', + L: 'DD.MM.YYYY', + LL: 'D MMMM YYYY р.', + LLL: 'D MMMM YYYY р., HH:mm', + LLLL: 'dddd, D MMMM YYYY р., HH:mm', + }, + calendar: { + sameDay: processHoursFunction('[Сьогодні '), + nextDay: processHoursFunction('[Завтра '), + lastDay: processHoursFunction('[Вчора '), + nextWeek: processHoursFunction('[У] dddd ['), + lastWeek: function () { + switch (this.day()) { + case 0: + case 3: + case 5: + case 6: + return processHoursFunction('[Минулої] dddd [').call(this); + case 1: + case 2: + case 4: + return processHoursFunction('[Минулого] dddd [').call(this); + } + }, + sameElse: 'L', + }, + relativeTime: { + future: 'за %s', + past: '%s тому', + s: 'декілька секунд', + ss: relativeTimeWithPlural$4, + m: relativeTimeWithPlural$4, + mm: relativeTimeWithPlural$4, + h: 'годину', + hh: relativeTimeWithPlural$4, + d: 'день', + dd: relativeTimeWithPlural$4, + M: 'місяць', + MM: relativeTimeWithPlural$4, + y: 'рік', + yy: relativeTimeWithPlural$4, + }, + // M. E.: those two are virtually unused but a user might want to implement them for his/her website for some reason + meridiemParse: /ночі|ранку|дня|вечора/, + isPM: function (input) { + return /^(дня|вечора)$/.test(input); + }, + meridiem: function (hour, minute, isLower) { + if (hour < 4) { + return 'ночі'; + } else if (hour < 12) { + return 'ранку'; + } else if (hour < 17) { + return 'дня'; + } else { + return 'вечора'; + } + }, + dayOfMonthOrdinalParse: /\d{1,2}-(й|го)/, + ordinal: function (number, period) { + switch (period) { + case 'M': + case 'd': + case 'DDD': + case 'w': + case 'W': + return number + '-й'; + case 'D': + return number + '-го'; + default: + return number; + } + }, + week: { + dow: 1, // Monday is the first day of the week. + doy: 7, // The week that contains Jan 7th is the first week of the year. + }, + }); + + //! moment.js locale configuration + + var months$a = [ + 'جنوری', + 'فروری', + 'مارچ', + 'اپریل', + 'مئی', + 'جون', + 'جولائی', + 'اگست', + 'ستمبر', + 'اکتوبر', + 'نومبر', + 'دسمبر', + ], + days$1 = ['اتوار', 'پیر', 'منگل', 'بدھ', 'جمعرات', 'جمعہ', 'ہفتہ']; + + moment.defineLocale('ur', { + months: months$a, + monthsShort: months$a, + weekdays: days$1, + weekdaysShort: days$1, + weekdaysMin: days$1, + longDateFormat: { + LT: 'HH:mm', + LTS: 'HH:mm:ss', + L: 'DD/MM/YYYY', + LL: 'D MMMM YYYY', + LLL: 'D MMMM YYYY HH:mm', + LLLL: 'dddd، D MMMM YYYY HH:mm', + }, + meridiemParse: /صبح|شام/, + isPM: function (input) { + return 'شام' === input; + }, + meridiem: function (hour, minute, isLower) { + if (hour < 12) { + return 'صبح'; + } + return 'شام'; + }, + calendar: { + sameDay: '[آج بوقت] LT', + nextDay: '[کل بوقت] LT', + nextWeek: 'dddd [بوقت] LT', + lastDay: '[گذشتہ روز بوقت] LT', + lastWeek: '[گذشتہ] dddd [بوقت] LT', + sameElse: 'L', + }, + relativeTime: { + future: '%s بعد', + past: '%s قبل', + s: 'چند سیکنڈ', + ss: '%d سیکنڈ', + m: 'ایک منٹ', + mm: '%d منٹ', + h: 'ایک گھنٹہ', + hh: '%d گھنٹے', + d: 'ایک دن', + dd: '%d دن', + M: 'ایک ماہ', + MM: '%d ماہ', + y: 'ایک سال', + yy: '%d سال', + }, + preparse: function (string) { + return string.replace(/،/g, ','); + }, + postformat: function (string) { + return string.replace(/,/g, '،'); + }, + week: { + dow: 1, // Monday is the first day of the week. + doy: 4, // The week that contains Jan 4th is the first week of the year. + }, + }); + + //! moment.js locale configuration + + moment.defineLocale('uz-latn', { + months: 'Yanvar_Fevral_Mart_Aprel_May_Iyun_Iyul_Avgust_Sentabr_Oktabr_Noyabr_Dekabr'.split( + '_' + ), + monthsShort: 'Yan_Fev_Mar_Apr_May_Iyun_Iyul_Avg_Sen_Okt_Noy_Dek'.split('_'), + weekdays: 'Yakshanba_Dushanba_Seshanba_Chorshanba_Payshanba_Juma_Shanba'.split( + '_' + ), + weekdaysShort: 'Yak_Dush_Sesh_Chor_Pay_Jum_Shan'.split('_'), + weekdaysMin: 'Ya_Du_Se_Cho_Pa_Ju_Sha'.split('_'), + longDateFormat: { + LT: 'HH:mm', + LTS: 'HH:mm:ss', + L: 'DD/MM/YYYY', + LL: 'D MMMM YYYY', + LLL: 'D MMMM YYYY HH:mm', + LLLL: 'D MMMM YYYY, dddd HH:mm', + }, + calendar: { + sameDay: '[Bugun soat] LT [da]', + nextDay: '[Ertaga] LT [da]', + nextWeek: 'dddd [kuni soat] LT [da]', + lastDay: '[Kecha soat] LT [da]', + lastWeek: "[O'tgan] dddd [kuni soat] LT [da]", + sameElse: 'L', + }, + relativeTime: { + future: 'Yaqin %s ichida', + past: 'Bir necha %s oldin', + s: 'soniya', + ss: '%d soniya', + m: 'bir daqiqa', + mm: '%d daqiqa', + h: 'bir soat', + hh: '%d soat', + d: 'bir kun', + dd: '%d kun', + M: 'bir oy', + MM: '%d oy', + y: 'bir yil', + yy: '%d yil', + }, + week: { + dow: 1, // Monday is the first day of the week. + doy: 7, // The week that contains Jan 7th is the first week of the year. + }, + }); + + //! moment.js locale configuration + + moment.defineLocale('uz', { + months: 'январ_феврал_март_апрел_май_июн_июл_август_сентябр_октябр_ноябр_декабр'.split( + '_' + ), + monthsShort: 'янв_фев_мар_апр_май_июн_июл_авг_сен_окт_ноя_дек'.split('_'), + weekdays: 'Якшанба_Душанба_Сешанба_Чоршанба_Пайшанба_Жума_Шанба'.split('_'), + weekdaysShort: 'Якш_Душ_Сеш_Чор_Пай_Жум_Шан'.split('_'), + weekdaysMin: 'Як_Ду_Се_Чо_Па_Жу_Ша'.split('_'), + longDateFormat: { + LT: 'HH:mm', + LTS: 'HH:mm:ss', + L: 'DD/MM/YYYY', + LL: 'D MMMM YYYY', + LLL: 'D MMMM YYYY HH:mm', + LLLL: 'D MMMM YYYY, dddd HH:mm', + }, + calendar: { + sameDay: '[Бугун соат] LT [да]', + nextDay: '[Эртага] LT [да]', + nextWeek: 'dddd [куни соат] LT [да]', + lastDay: '[Кеча соат] LT [да]', + lastWeek: '[Утган] dddd [куни соат] LT [да]', + sameElse: 'L', + }, + relativeTime: { + future: 'Якин %s ичида', + past: 'Бир неча %s олдин', + s: 'фурсат', + ss: '%d фурсат', + m: 'бир дакика', + mm: '%d дакика', + h: 'бир соат', + hh: '%d соат', + d: 'бир кун', + dd: '%d кун', + M: 'бир ой', + MM: '%d ой', + y: 'бир йил', + yy: '%d йил', + }, + week: { + dow: 1, // Monday is the first day of the week. + doy: 7, // The week that contains Jan 4th is the first week of the year. + }, + }); + + //! moment.js locale configuration + + moment.defineLocale('vi', { + months: 'tháng 1_tháng 2_tháng 3_tháng 4_tháng 5_tháng 6_tháng 7_tháng 8_tháng 9_tháng 10_tháng 11_tháng 12'.split( + '_' + ), + monthsShort: 'Thg 01_Thg 02_Thg 03_Thg 04_Thg 05_Thg 06_Thg 07_Thg 08_Thg 09_Thg 10_Thg 11_Thg 12'.split( + '_' + ), + monthsParseExact: true, + weekdays: 'chủ nhật_thứ hai_thứ ba_thứ tư_thứ năm_thứ sáu_thứ bảy'.split( + '_' + ), + weekdaysShort: 'CN_T2_T3_T4_T5_T6_T7'.split('_'), + weekdaysMin: 'CN_T2_T3_T4_T5_T6_T7'.split('_'), + weekdaysParseExact: true, + meridiemParse: /sa|ch/i, + isPM: function (input) { + return /^ch$/i.test(input); + }, + meridiem: function (hours, minutes, isLower) { + if (hours < 12) { + return isLower ? 'sa' : 'SA'; + } else { + return isLower ? 'ch' : 'CH'; + } + }, + longDateFormat: { + LT: 'HH:mm', + LTS: 'HH:mm:ss', + L: 'DD/MM/YYYY', + LL: 'D MMMM [năm] YYYY', + LLL: 'D MMMM [năm] YYYY HH:mm', + LLLL: 'dddd, D MMMM [năm] YYYY HH:mm', + l: 'DD/M/YYYY', + ll: 'D MMM YYYY', + lll: 'D MMM YYYY HH:mm', + llll: 'ddd, D MMM YYYY HH:mm', + }, + calendar: { + sameDay: '[Hôm nay lúc] LT', + nextDay: '[Ngày mai lúc] LT', + nextWeek: 'dddd [tuần tới lúc] LT', + lastDay: '[Hôm qua lúc] LT', + lastWeek: 'dddd [tuần trước lúc] LT', + sameElse: 'L', + }, + relativeTime: { + future: '%s tới', + past: '%s trước', + s: 'vài giây', + ss: '%d giây', + m: 'một phút', + mm: '%d phút', + h: 'một giờ', + hh: '%d giờ', + d: 'một ngày', + dd: '%d ngày', + M: 'một tháng', + MM: '%d tháng', + y: 'một năm', + yy: '%d năm', + }, + dayOfMonthOrdinalParse: /\d{1,2}/, + ordinal: function (number) { + return number; + }, + week: { + dow: 1, // Monday is the first day of the week. + doy: 4, // The week that contains Jan 4th is the first week of the year. + }, + }); + + //! moment.js locale configuration + + moment.defineLocale('x-pseudo', { + months: 'J~áñúá~rý_F~ébrú~árý_~Márc~h_Áp~ríl_~Máý_~Júñé~_Júl~ý_Áú~gúst~_Sép~témb~ér_Ó~ctób~ér_Ñ~óvém~bér_~Décé~mbér'.split( + '_' + ), + monthsShort: 'J~áñ_~Féb_~Már_~Ápr_~Máý_~Júñ_~Júl_~Áúg_~Sép_~Óct_~Ñóv_~Déc'.split( + '_' + ), + monthsParseExact: true, + weekdays: 'S~úñdá~ý_Mó~ñdáý~_Túé~sdáý~_Wéd~ñésd~áý_T~húrs~dáý_~Fríd~áý_S~átúr~dáý'.split( + '_' + ), + weekdaysShort: 'S~úñ_~Móñ_~Túé_~Wéd_~Thú_~Frí_~Sát'.split('_'), + weekdaysMin: 'S~ú_Mó~_Tú_~Wé_T~h_Fr~_Sá'.split('_'), + weekdaysParseExact: true, + longDateFormat: { + LT: 'HH:mm', + L: 'DD/MM/YYYY', + LL: 'D MMMM YYYY', + LLL: 'D MMMM YYYY HH:mm', + LLLL: 'dddd, D MMMM YYYY HH:mm', + }, + calendar: { + sameDay: '[T~ódá~ý át] LT', + nextDay: '[T~ómó~rró~w át] LT', + nextWeek: 'dddd [át] LT', + lastDay: '[Ý~ést~érdá~ý át] LT', + lastWeek: '[L~ást] dddd [át] LT', + sameElse: 'L', + }, + relativeTime: { + future: 'í~ñ %s', + past: '%s á~gó', + s: 'á ~féw ~sécó~ñds', + ss: '%d s~écóñ~ds', + m: 'á ~míñ~úté', + mm: '%d m~íñú~tés', + h: 'á~ñ hó~úr', + hh: '%d h~óúrs', + d: 'á ~dáý', + dd: '%d d~áýs', + M: 'á ~móñ~th', + MM: '%d m~óñt~hs', + y: 'á ~ýéár', + yy: '%d ý~éárs', + }, + dayOfMonthOrdinalParse: /\d{1,2}(th|st|nd|rd)/, + ordinal: function (number) { + var b = number % 10, + output = + ~~((number % 100) / 10) === 1 + ? 'th' + : b === 1 + ? 'st' + : b === 2 + ? 'nd' + : b === 3 + ? 'rd' + : 'th'; + return number + output; + }, + week: { + dow: 1, // Monday is the first day of the week. + doy: 4, // The week that contains Jan 4th is the first week of the year. + }, + }); + + //! moment.js locale configuration + + moment.defineLocale('yo', { + months: 'Sẹ́rẹ́_Èrèlè_Ẹrẹ̀nà_Ìgbé_Èbibi_Òkùdu_Agẹmo_Ògún_Owewe_Ọ̀wàrà_Bélú_Ọ̀pẹ̀̀'.split( + '_' + ), + monthsShort: 'Sẹ́r_Èrl_Ẹrn_Ìgb_Èbi_Òkù_Agẹ_Ògú_Owe_Ọ̀wà_Bél_Ọ̀pẹ̀̀'.split('_'), + weekdays: 'Àìkú_Ajé_Ìsẹ́gun_Ọjọ́rú_Ọjọ́bọ_Ẹtì_Àbámẹ́ta'.split('_'), + weekdaysShort: 'Àìk_Ajé_Ìsẹ́_Ọjr_Ọjb_Ẹtì_Àbá'.split('_'), + weekdaysMin: 'Àì_Aj_Ìs_Ọr_Ọb_Ẹt_Àb'.split('_'), + longDateFormat: { + LT: 'h:mm A', + LTS: 'h:mm:ss A', + L: 'DD/MM/YYYY', + LL: 'D MMMM YYYY', + LLL: 'D MMMM YYYY h:mm A', + LLLL: 'dddd, D MMMM YYYY h:mm A', + }, + calendar: { + sameDay: '[Ònì ni] LT', + nextDay: '[Ọ̀la ni] LT', + nextWeek: "dddd [Ọsẹ̀ tón'bọ] [ni] LT", + lastDay: '[Àna ni] LT', + lastWeek: 'dddd [Ọsẹ̀ tólọ́] [ni] LT', + sameElse: 'L', + }, + relativeTime: { + future: 'ní %s', + past: '%s kọjá', + s: 'ìsẹjú aayá die', + ss: 'aayá %d', + m: 'ìsẹjú kan', + mm: 'ìsẹjú %d', + h: 'wákati kan', + hh: 'wákati %d', + d: 'ọjọ́ kan', + dd: 'ọjọ́ %d', + M: 'osù kan', + MM: 'osù %d', + y: 'ọdún kan', + yy: 'ọdún %d', + }, + dayOfMonthOrdinalParse: /ọjọ́\s\d{1,2}/, + ordinal: 'ọjọ́ %d', + week: { + dow: 1, // Monday is the first day of the week. + doy: 4, // The week that contains Jan 4th is the first week of the year. + }, + }); + + //! moment.js locale configuration + + moment.defineLocale('zh-cn', { + months: '一月_二月_三月_四月_五月_六月_七月_八月_九月_十月_十一月_十二月'.split( + '_' + ), + monthsShort: '1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月'.split( + '_' + ), + weekdays: '星期日_星期一_星期二_星期三_星期四_星期五_星期六'.split('_'), + weekdaysShort: '周日_周一_周二_周三_周四_周五_周六'.split('_'), + weekdaysMin: '日_一_二_三_四_五_六'.split('_'), + longDateFormat: { + LT: 'HH:mm', + LTS: 'HH:mm:ss', + L: 'YYYY/MM/DD', + LL: 'YYYY年M月D日', + LLL: 'YYYY年M月D日Ah点mm分', + LLLL: 'YYYY年M月D日ddddAh点mm分', + l: 'YYYY/M/D', + ll: 'YYYY年M月D日', + lll: 'YYYY年M月D日 HH:mm', + llll: 'YYYY年M月D日dddd HH:mm', + }, + meridiemParse: /凌晨|早上|上午|中午|下午|晚上/, + meridiemHour: function (hour, meridiem) { + if (hour === 12) { + hour = 0; + } + if (meridiem === '凌晨' || meridiem === '早上' || meridiem === '上午') { + return hour; + } else if (meridiem === '下午' || meridiem === '晚上') { + return hour + 12; + } else { + // '中午' + return hour >= 11 ? hour : hour + 12; + } + }, + meridiem: function (hour, minute, isLower) { + var hm = hour * 100 + minute; + if (hm < 600) { + return '凌晨'; + } else if (hm < 900) { + return '早上'; + } else if (hm < 1130) { + return '上午'; + } else if (hm < 1230) { + return '中午'; + } else if (hm < 1800) { + return '下午'; + } else { + return '晚上'; + } + }, + calendar: { + sameDay: '[今天]LT', + nextDay: '[明天]LT', + nextWeek: function (now) { + if (now.week() !== this.week()) { + return '[下]dddLT'; + } else { + return '[本]dddLT'; + } + }, + lastDay: '[昨天]LT', + lastWeek: function (now) { + if (this.week() !== now.week()) { + return '[上]dddLT'; + } else { + return '[本]dddLT'; + } + }, + sameElse: 'L', + }, + dayOfMonthOrdinalParse: /\d{1,2}(日|月|周)/, + ordinal: function (number, period) { + switch (period) { + case 'd': + case 'D': + case 'DDD': + return number + '日'; + case 'M': + return number + '月'; + case 'w': + case 'W': + return number + '周'; + default: + return number; + } + }, + relativeTime: { + future: '%s后', + past: '%s前', + s: '几秒', + ss: '%d 秒', + m: '1 分钟', + mm: '%d 分钟', + h: '1 小时', + hh: '%d 小时', + d: '1 天', + dd: '%d 天', + M: '1 个月', + MM: '%d 个月', + y: '1 年', + yy: '%d 年', + }, + week: { + // GB/T 7408-1994《数据元和交换格式·信息交换·日期和时间表示法》与ISO 8601:1988等效 + dow: 1, // Monday is the first day of the week. + doy: 4, // The week that contains Jan 4th is the first week of the year. + }, + }); + + //! moment.js locale configuration + + moment.defineLocale('zh-hk', { + months: '一月_二月_三月_四月_五月_六月_七月_八月_九月_十月_十一月_十二月'.split( + '_' + ), + monthsShort: '1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月'.split( + '_' + ), + weekdays: '星期日_星期一_星期二_星期三_星期四_星期五_星期六'.split('_'), + weekdaysShort: '週日_週一_週二_週三_週四_週五_週六'.split('_'), + weekdaysMin: '日_一_二_三_四_五_六'.split('_'), + longDateFormat: { + LT: 'HH:mm', + LTS: 'HH:mm:ss', + L: 'YYYY/MM/DD', + LL: 'YYYY年M月D日', + LLL: 'YYYY年M月D日 HH:mm', + LLLL: 'YYYY年M月D日dddd HH:mm', + l: 'YYYY/M/D', + ll: 'YYYY年M月D日', + lll: 'YYYY年M月D日 HH:mm', + llll: 'YYYY年M月D日dddd HH:mm', + }, + meridiemParse: /凌晨|早上|上午|中午|下午|晚上/, + meridiemHour: function (hour, meridiem) { + if (hour === 12) { + hour = 0; + } + if (meridiem === '凌晨' || meridiem === '早上' || meridiem === '上午') { + return hour; + } else if (meridiem === '中午') { + return hour >= 11 ? hour : hour + 12; + } else if (meridiem === '下午' || meridiem === '晚上') { + return hour + 12; + } + }, + meridiem: function (hour, minute, isLower) { + var hm = hour * 100 + minute; + if (hm < 600) { + return '凌晨'; + } else if (hm < 900) { + return '早上'; + } else if (hm < 1200) { + return '上午'; + } else if (hm === 1200) { + return '中午'; + } else if (hm < 1800) { + return '下午'; + } else { + return '晚上'; + } + }, + calendar: { + sameDay: '[今天]LT', + nextDay: '[明天]LT', + nextWeek: '[下]ddddLT', + lastDay: '[昨天]LT', + lastWeek: '[上]ddddLT', + sameElse: 'L', + }, + dayOfMonthOrdinalParse: /\d{1,2}(日|月|週)/, + ordinal: function (number, period) { + switch (period) { + case 'd': + case 'D': + case 'DDD': + return number + '日'; + case 'M': + return number + '月'; + case 'w': + case 'W': + return number + '週'; + default: + return number; + } + }, + relativeTime: { + future: '%s後', + past: '%s前', + s: '幾秒', + ss: '%d 秒', + m: '1 分鐘', + mm: '%d 分鐘', + h: '1 小時', + hh: '%d 小時', + d: '1 天', + dd: '%d 天', + M: '1 個月', + MM: '%d 個月', + y: '1 年', + yy: '%d 年', + }, + }); + + //! moment.js locale configuration + + moment.defineLocale('zh-mo', { + months: '一月_二月_三月_四月_五月_六月_七月_八月_九月_十月_十一月_十二月'.split( + '_' + ), + monthsShort: '1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月'.split( + '_' + ), + weekdays: '星期日_星期一_星期二_星期三_星期四_星期五_星期六'.split('_'), + weekdaysShort: '週日_週一_週二_週三_週四_週五_週六'.split('_'), + weekdaysMin: '日_一_二_三_四_五_六'.split('_'), + longDateFormat: { + LT: 'HH:mm', + LTS: 'HH:mm:ss', + L: 'DD/MM/YYYY', + LL: 'YYYY年M月D日', + LLL: 'YYYY年M月D日 HH:mm', + LLLL: 'YYYY年M月D日dddd HH:mm', + l: 'D/M/YYYY', + ll: 'YYYY年M月D日', + lll: 'YYYY年M月D日 HH:mm', + llll: 'YYYY年M月D日dddd HH:mm', + }, + meridiemParse: /凌晨|早上|上午|中午|下午|晚上/, + meridiemHour: function (hour, meridiem) { + if (hour === 12) { + hour = 0; + } + if (meridiem === '凌晨' || meridiem === '早上' || meridiem === '上午') { + return hour; + } else if (meridiem === '中午') { + return hour >= 11 ? hour : hour + 12; + } else if (meridiem === '下午' || meridiem === '晚上') { + return hour + 12; + } + }, + meridiem: function (hour, minute, isLower) { + var hm = hour * 100 + minute; + if (hm < 600) { + return '凌晨'; + } else if (hm < 900) { + return '早上'; + } else if (hm < 1130) { + return '上午'; + } else if (hm < 1230) { + return '中午'; + } else if (hm < 1800) { + return '下午'; + } else { + return '晚上'; + } + }, + calendar: { + sameDay: '[今天] LT', + nextDay: '[明天] LT', + nextWeek: '[下]dddd LT', + lastDay: '[昨天] LT', + lastWeek: '[上]dddd LT', + sameElse: 'L', + }, + dayOfMonthOrdinalParse: /\d{1,2}(日|月|週)/, + ordinal: function (number, period) { + switch (period) { + case 'd': + case 'D': + case 'DDD': + return number + '日'; + case 'M': + return number + '月'; + case 'w': + case 'W': + return number + '週'; + default: + return number; + } + }, + relativeTime: { + future: '%s內', + past: '%s前', + s: '幾秒', + ss: '%d 秒', + m: '1 分鐘', + mm: '%d 分鐘', + h: '1 小時', + hh: '%d 小時', + d: '1 天', + dd: '%d 天', + M: '1 個月', + MM: '%d 個月', + y: '1 年', + yy: '%d 年', + }, + }); + + //! moment.js locale configuration + + moment.defineLocale('zh-tw', { + months: '一月_二月_三月_四月_五月_六月_七月_八月_九月_十月_十一月_十二月'.split( + '_' + ), + monthsShort: '1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月'.split( + '_' + ), + weekdays: '星期日_星期一_星期二_星期三_星期四_星期五_星期六'.split('_'), + weekdaysShort: '週日_週一_週二_週三_週四_週五_週六'.split('_'), + weekdaysMin: '日_一_二_三_四_五_六'.split('_'), + longDateFormat: { + LT: 'HH:mm', + LTS: 'HH:mm:ss', + L: 'YYYY/MM/DD', + LL: 'YYYY年M月D日', + LLL: 'YYYY年M月D日 HH:mm', + LLLL: 'YYYY年M月D日dddd HH:mm', + l: 'YYYY/M/D', + ll: 'YYYY年M月D日', + lll: 'YYYY年M月D日 HH:mm', + llll: 'YYYY年M月D日dddd HH:mm', + }, + meridiemParse: /凌晨|早上|上午|中午|下午|晚上/, + meridiemHour: function (hour, meridiem) { + if (hour === 12) { + hour = 0; + } + if (meridiem === '凌晨' || meridiem === '早上' || meridiem === '上午') { + return hour; + } else if (meridiem === '中午') { + return hour >= 11 ? hour : hour + 12; + } else if (meridiem === '下午' || meridiem === '晚上') { + return hour + 12; + } + }, + meridiem: function (hour, minute, isLower) { + var hm = hour * 100 + minute; + if (hm < 600) { + return '凌晨'; + } else if (hm < 900) { + return '早上'; + } else if (hm < 1130) { + return '上午'; + } else if (hm < 1230) { + return '中午'; + } else if (hm < 1800) { + return '下午'; + } else { + return '晚上'; + } + }, + calendar: { + sameDay: '[今天] LT', + nextDay: '[明天] LT', + nextWeek: '[下]dddd LT', + lastDay: '[昨天] LT', + lastWeek: '[上]dddd LT', + sameElse: 'L', + }, + dayOfMonthOrdinalParse: /\d{1,2}(日|月|週)/, + ordinal: function (number, period) { + switch (period) { + case 'd': + case 'D': + case 'DDD': + return number + '日'; + case 'M': + return number + '月'; + case 'w': + case 'W': + return number + '週'; + default: + return number; + } + }, + relativeTime: { + future: '%s後', + past: '%s前', + s: '幾秒', + ss: '%d 秒', + m: '1 分鐘', + mm: '%d 分鐘', + h: '1 小時', + hh: '%d 小時', + d: '1 天', + dd: '%d 天', + M: '1 個月', + MM: '%d 個月', + y: '1 年', + yy: '%d 年', + }, + }); + + moment.locale('en'); + + return moment; + +}))); diff --git a/admin/js/vendors/moment/locales.min.js b/admin/js/vendors/moment/locales.min.js new file mode 100644 index 0000000..56da071 --- /dev/null +++ b/admin/js/vendors/moment/locales.min.js @@ -0,0 +1,2 @@ +!function(e,a){"object"==typeof exports&&"undefined"!=typeof module&&"function"==typeof require?a(require("../moment")):"function"==typeof define&&define.amd?define(["../moment"],a):a(e.moment)}(this,function(e){"use strict";e.defineLocale("af",{months:"Januarie_Februarie_Maart_April_Mei_Junie_Julie_Augustus_September_Oktober_November_Desember".split("_"),monthsShort:"Jan_Feb_Mrt_Apr_Mei_Jun_Jul_Aug_Sep_Okt_Nov_Des".split("_"),weekdays:"Sondag_Maandag_Dinsdag_Woensdag_Donderdag_Vrydag_Saterdag".split("_"),weekdaysShort:"Son_Maa_Din_Woe_Don_Vry_Sat".split("_"),weekdaysMin:"So_Ma_Di_Wo_Do_Vr_Sa".split("_"),meridiemParse:/vm|nm/i,isPM:function(e){return/^nm$/i.test(e)},meridiem:function(e,a,_){return e<12?_?"vm":"VM":_?"nm":"NM"},longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd, D MMMM YYYY HH:mm"},calendar:{sameDay:"[Vandag om] LT",nextDay:"[M\xf4re om] LT",nextWeek:"dddd [om] LT",lastDay:"[Gister om] LT",lastWeek:"[Laas] dddd [om] LT",sameElse:"L"},relativeTime:{future:"oor %s",past:"%s gelede",s:"'n paar sekondes",ss:"%d sekondes",m:"'n minuut",mm:"%d minute",h:"'n uur",hh:"%d ure",d:"'n dag",dd:"%d dae",M:"'n maand",MM:"%d maande",y:"'n jaar",yy:"%d jaar"},dayOfMonthOrdinalParse:/\d{1,2}(ste|de)/,ordinal:function(e){return e+(1===e||8===e||20<=e?"ste":"de")},week:{dow:1,doy:4}});function r(e){return 0===e?0:1===e?1:2===e?2:3<=e%100&&e%100<=10?3:11<=e%100?4:5}function a(n){return function(e,a,_,s){var d=r(e),t=i[n][r(e)];return 2===d&&(t=t[a?0:1]),t.replace(/%d/i,e)}}var i={s:["\u0623\u0642\u0644 \u0645\u0646 \u062b\u0627\u0646\u064a\u0629","\u062b\u0627\u0646\u064a\u0629 \u0648\u0627\u062d\u062f\u0629",["\u062b\u0627\u0646\u064a\u062a\u0627\u0646","\u062b\u0627\u0646\u064a\u062a\u064a\u0646"],"%d \u062b\u0648\u0627\u0646","%d \u062b\u0627\u0646\u064a\u0629","%d \u062b\u0627\u0646\u064a\u0629"],m:["\u0623\u0642\u0644 \u0645\u0646 \u062f\u0642\u064a\u0642\u0629","\u062f\u0642\u064a\u0642\u0629 \u0648\u0627\u062d\u062f\u0629",["\u062f\u0642\u064a\u0642\u062a\u0627\u0646","\u062f\u0642\u064a\u0642\u062a\u064a\u0646"],"%d \u062f\u0642\u0627\u0626\u0642","%d \u062f\u0642\u064a\u0642\u0629","%d \u062f\u0642\u064a\u0642\u0629"],h:["\u0623\u0642\u0644 \u0645\u0646 \u0633\u0627\u0639\u0629","\u0633\u0627\u0639\u0629 \u0648\u0627\u062d\u062f\u0629",["\u0633\u0627\u0639\u062a\u0627\u0646","\u0633\u0627\u0639\u062a\u064a\u0646"],"%d \u0633\u0627\u0639\u0627\u062a","%d \u0633\u0627\u0639\u0629","%d \u0633\u0627\u0639\u0629"],d:["\u0623\u0642\u0644 \u0645\u0646 \u064a\u0648\u0645","\u064a\u0648\u0645 \u0648\u0627\u062d\u062f",["\u064a\u0648\u0645\u0627\u0646","\u064a\u0648\u0645\u064a\u0646"],"%d \u0623\u064a\u0627\u0645","%d \u064a\u0648\u0645\u064b\u0627","%d \u064a\u0648\u0645"],M:["\u0623\u0642\u0644 \u0645\u0646 \u0634\u0647\u0631","\u0634\u0647\u0631 \u0648\u0627\u062d\u062f",["\u0634\u0647\u0631\u0627\u0646","\u0634\u0647\u0631\u064a\u0646"],"%d \u0623\u0634\u0647\u0631","%d \u0634\u0647\u0631\u0627","%d \u0634\u0647\u0631"],y:["\u0623\u0642\u0644 \u0645\u0646 \u0639\u0627\u0645","\u0639\u0627\u0645 \u0648\u0627\u062d\u062f",["\u0639\u0627\u0645\u0627\u0646","\u0639\u0627\u0645\u064a\u0646"],"%d \u0623\u0639\u0648\u0627\u0645","%d \u0639\u0627\u0645\u064b\u0627","%d \u0639\u0627\u0645"]},_=["\u062c\u0627\u0646\u0641\u064a","\u0641\u064a\u0641\u0631\u064a","\u0645\u0627\u0631\u0633","\u0623\u0641\u0631\u064a\u0644","\u0645\u0627\u064a","\u062c\u0648\u0627\u0646","\u062c\u0648\u064a\u0644\u064a\u0629","\u0623\u0648\u062a","\u0633\u0628\u062a\u0645\u0628\u0631","\u0623\u0643\u062a\u0648\u0628\u0631","\u0646\u0648\u0641\u0645\u0628\u0631","\u062f\u064a\u0633\u0645\u0628\u0631"];e.defineLocale("ar-dz",{months:_,monthsShort:_,weekdays:"\u0627\u0644\u0623\u062d\u062f_\u0627\u0644\u0625\u062b\u0646\u064a\u0646_\u0627\u0644\u062b\u0644\u0627\u062b\u0627\u0621_\u0627\u0644\u0623\u0631\u0628\u0639\u0627\u0621_\u0627\u0644\u062e\u0645\u064a\u0633_\u0627\u0644\u062c\u0645\u0639\u0629_\u0627\u0644\u0633\u0628\u062a".split("_"),weekdaysShort:"\u0623\u062d\u062f_\u0625\u062b\u0646\u064a\u0646_\u062b\u0644\u0627\u062b\u0627\u0621_\u0623\u0631\u0628\u0639\u0627\u0621_\u062e\u0645\u064a\u0633_\u062c\u0645\u0639\u0629_\u0633\u0628\u062a".split("_"),weekdaysMin:"\u062d_\u0646_\u062b_\u0631_\u062e_\u062c_\u0633".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"D/\u200fM/\u200fYYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd D MMMM YYYY HH:mm"},meridiemParse:/\u0635|\u0645/,isPM:function(e){return"\u0645"===e},meridiem:function(e,a,_){return e<12?"\u0635":"\u0645"},calendar:{sameDay:"[\u0627\u0644\u064a\u0648\u0645 \u0639\u0646\u062f \u0627\u0644\u0633\u0627\u0639\u0629] LT",nextDay:"[\u063a\u062f\u064b\u0627 \u0639\u0646\u062f \u0627\u0644\u0633\u0627\u0639\u0629] LT",nextWeek:"dddd [\u0639\u0646\u062f \u0627\u0644\u0633\u0627\u0639\u0629] LT",lastDay:"[\u0623\u0645\u0633 \u0639\u0646\u062f \u0627\u0644\u0633\u0627\u0639\u0629] LT",lastWeek:"dddd [\u0639\u0646\u062f \u0627\u0644\u0633\u0627\u0639\u0629] LT",sameElse:"L"},relativeTime:{future:"\u0628\u0639\u062f %s",past:"\u0645\u0646\u0630 %s",s:a("s"),ss:a("s"),m:a("m"),mm:a("m"),h:a("h"),hh:a("h"),d:a("d"),dd:a("d"),M:a("M"),MM:a("M"),y:a("y"),yy:a("y")},postformat:function(e){return e.replace(/,/g,"\u060c")},week:{dow:0,doy:4}}),e.defineLocale("ar-kw",{months:"\u064a\u0646\u0627\u064a\u0631_\u0641\u0628\u0631\u0627\u064a\u0631_\u0645\u0627\u0631\u0633_\u0623\u0628\u0631\u064a\u0644_\u0645\u0627\u064a_\u064a\u0648\u0646\u064a\u0648_\u064a\u0648\u0644\u064a\u0648\u0632_\u063a\u0634\u062a_\u0634\u062a\u0646\u0628\u0631_\u0623\u0643\u062a\u0648\u0628\u0631_\u0646\u0648\u0646\u0628\u0631_\u062f\u062c\u0646\u0628\u0631".split("_"),monthsShort:"\u064a\u0646\u0627\u064a\u0631_\u0641\u0628\u0631\u0627\u064a\u0631_\u0645\u0627\u0631\u0633_\u0623\u0628\u0631\u064a\u0644_\u0645\u0627\u064a_\u064a\u0648\u0646\u064a\u0648_\u064a\u0648\u0644\u064a\u0648\u0632_\u063a\u0634\u062a_\u0634\u062a\u0646\u0628\u0631_\u0623\u0643\u062a\u0648\u0628\u0631_\u0646\u0648\u0646\u0628\u0631_\u062f\u062c\u0646\u0628\u0631".split("_"),weekdays:"\u0627\u0644\u0623\u062d\u062f_\u0627\u0644\u0625\u062a\u0646\u064a\u0646_\u0627\u0644\u062b\u0644\u0627\u062b\u0627\u0621_\u0627\u0644\u0623\u0631\u0628\u0639\u0627\u0621_\u0627\u0644\u062e\u0645\u064a\u0633_\u0627\u0644\u062c\u0645\u0639\u0629_\u0627\u0644\u0633\u0628\u062a".split("_"),weekdaysShort:"\u0627\u062d\u062f_\u0627\u062a\u0646\u064a\u0646_\u062b\u0644\u0627\u062b\u0627\u0621_\u0627\u0631\u0628\u0639\u0627\u0621_\u062e\u0645\u064a\u0633_\u062c\u0645\u0639\u0629_\u0633\u0628\u062a".split("_"),weekdaysMin:"\u062d_\u0646_\u062b_\u0631_\u062e_\u062c_\u0633".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd D MMMM YYYY HH:mm"},calendar:{sameDay:"[\u0627\u0644\u064a\u0648\u0645 \u0639\u0644\u0649 \u0627\u0644\u0633\u0627\u0639\u0629] LT",nextDay:"[\u063a\u062f\u0627 \u0639\u0644\u0649 \u0627\u0644\u0633\u0627\u0639\u0629] LT",nextWeek:"dddd [\u0639\u0644\u0649 \u0627\u0644\u0633\u0627\u0639\u0629] LT",lastDay:"[\u0623\u0645\u0633 \u0639\u0644\u0649 \u0627\u0644\u0633\u0627\u0639\u0629] LT",lastWeek:"dddd [\u0639\u0644\u0649 \u0627\u0644\u0633\u0627\u0639\u0629] LT",sameElse:"L"},relativeTime:{future:"\u0641\u064a %s",past:"\u0645\u0646\u0630 %s",s:"\u062b\u0648\u0627\u0646",ss:"%d \u062b\u0627\u0646\u064a\u0629",m:"\u062f\u0642\u064a\u0642\u0629",mm:"%d \u062f\u0642\u0627\u0626\u0642",h:"\u0633\u0627\u0639\u0629",hh:"%d \u0633\u0627\u0639\u0627\u062a",d:"\u064a\u0648\u0645",dd:"%d \u0623\u064a\u0627\u0645",M:"\u0634\u0647\u0631",MM:"%d \u0623\u0634\u0647\u0631",y:"\u0633\u0646\u0629",yy:"%d \u0633\u0646\u0648\u0627\u062a"},week:{dow:0,doy:12}});function m(e){return 0===e?0:1===e?1:2===e?2:3<=e%100&&e%100<=10?3:11<=e%100?4:5}function s(n){return function(e,a,_,s){var d=m(e),t=o[n][m(e)];return 2===d&&(t=t[a?0:1]),t.replace(/%d/i,e)}}var d={1:"1",2:"2",3:"3",4:"4",5:"5",6:"6",7:"7",8:"8",9:"9",0:"0"},o={s:["\u0623\u0642\u0644 \u0645\u0646 \u062b\u0627\u0646\u064a\u0629","\u062b\u0627\u0646\u064a\u0629 \u0648\u0627\u062d\u062f\u0629",["\u062b\u0627\u0646\u064a\u062a\u0627\u0646","\u062b\u0627\u0646\u064a\u062a\u064a\u0646"],"%d \u062b\u0648\u0627\u0646","%d \u062b\u0627\u0646\u064a\u0629","%d \u062b\u0627\u0646\u064a\u0629"],m:["\u0623\u0642\u0644 \u0645\u0646 \u062f\u0642\u064a\u0642\u0629","\u062f\u0642\u064a\u0642\u0629 \u0648\u0627\u062d\u062f\u0629",["\u062f\u0642\u064a\u0642\u062a\u0627\u0646","\u062f\u0642\u064a\u0642\u062a\u064a\u0646"],"%d \u062f\u0642\u0627\u0626\u0642","%d \u062f\u0642\u064a\u0642\u0629","%d \u062f\u0642\u064a\u0642\u0629"],h:["\u0623\u0642\u0644 \u0645\u0646 \u0633\u0627\u0639\u0629","\u0633\u0627\u0639\u0629 \u0648\u0627\u062d\u062f\u0629",["\u0633\u0627\u0639\u062a\u0627\u0646","\u0633\u0627\u0639\u062a\u064a\u0646"],"%d \u0633\u0627\u0639\u0627\u062a","%d \u0633\u0627\u0639\u0629","%d \u0633\u0627\u0639\u0629"],d:["\u0623\u0642\u0644 \u0645\u0646 \u064a\u0648\u0645","\u064a\u0648\u0645 \u0648\u0627\u062d\u062f",["\u064a\u0648\u0645\u0627\u0646","\u064a\u0648\u0645\u064a\u0646"],"%d \u0623\u064a\u0627\u0645","%d \u064a\u0648\u0645\u064b\u0627","%d \u064a\u0648\u0645"],M:["\u0623\u0642\u0644 \u0645\u0646 \u0634\u0647\u0631","\u0634\u0647\u0631 \u0648\u0627\u062d\u062f",["\u0634\u0647\u0631\u0627\u0646","\u0634\u0647\u0631\u064a\u0646"],"%d \u0623\u0634\u0647\u0631","%d \u0634\u0647\u0631\u0627","%d \u0634\u0647\u0631"],y:["\u0623\u0642\u0644 \u0645\u0646 \u0639\u0627\u0645","\u0639\u0627\u0645 \u0648\u0627\u062d\u062f",["\u0639\u0627\u0645\u0627\u0646","\u0639\u0627\u0645\u064a\u0646"],"%d \u0623\u0639\u0648\u0627\u0645","%d \u0639\u0627\u0645\u064b\u0627","%d \u0639\u0627\u0645"]},t=["\u064a\u0646\u0627\u064a\u0631","\u0641\u0628\u0631\u0627\u064a\u0631","\u0645\u0627\u0631\u0633","\u0623\u0628\u0631\u064a\u0644","\u0645\u0627\u064a\u0648","\u064a\u0648\u0646\u064a\u0648","\u064a\u0648\u0644\u064a\u0648","\u0623\u063a\u0633\u0637\u0633","\u0633\u0628\u062a\u0645\u0628\u0631","\u0623\u0643\u062a\u0648\u0628\u0631","\u0646\u0648\u0641\u0645\u0628\u0631","\u062f\u064a\u0633\u0645\u0628\u0631"];e.defineLocale("ar-ly",{months:t,monthsShort:t,weekdays:"\u0627\u0644\u0623\u062d\u062f_\u0627\u0644\u0625\u062b\u0646\u064a\u0646_\u0627\u0644\u062b\u0644\u0627\u062b\u0627\u0621_\u0627\u0644\u0623\u0631\u0628\u0639\u0627\u0621_\u0627\u0644\u062e\u0645\u064a\u0633_\u0627\u0644\u062c\u0645\u0639\u0629_\u0627\u0644\u0633\u0628\u062a".split("_"),weekdaysShort:"\u0623\u062d\u062f_\u0625\u062b\u0646\u064a\u0646_\u062b\u0644\u0627\u062b\u0627\u0621_\u0623\u0631\u0628\u0639\u0627\u0621_\u062e\u0645\u064a\u0633_\u062c\u0645\u0639\u0629_\u0633\u0628\u062a".split("_"),weekdaysMin:"\u062d_\u0646_\u062b_\u0631_\u062e_\u062c_\u0633".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"D/\u200fM/\u200fYYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd D MMMM YYYY HH:mm"},meridiemParse:/\u0635|\u0645/,isPM:function(e){return"\u0645"===e},meridiem:function(e,a,_){return e<12?"\u0635":"\u0645"},calendar:{sameDay:"[\u0627\u0644\u064a\u0648\u0645 \u0639\u0646\u062f \u0627\u0644\u0633\u0627\u0639\u0629] LT",nextDay:"[\u063a\u062f\u064b\u0627 \u0639\u0646\u062f \u0627\u0644\u0633\u0627\u0639\u0629] LT",nextWeek:"dddd [\u0639\u0646\u062f \u0627\u0644\u0633\u0627\u0639\u0629] LT",lastDay:"[\u0623\u0645\u0633 \u0639\u0646\u062f \u0627\u0644\u0633\u0627\u0639\u0629] LT",lastWeek:"dddd [\u0639\u0646\u062f \u0627\u0644\u0633\u0627\u0639\u0629] LT",sameElse:"L"},relativeTime:{future:"\u0628\u0639\u062f %s",past:"\u0645\u0646\u0630 %s",s:s("s"),ss:s("s"),m:s("m"),mm:s("m"),h:s("h"),hh:s("h"),d:s("d"),dd:s("d"),M:s("M"),MM:s("M"),y:s("y"),yy:s("y")},preparse:function(e){return e.replace(/\u060c/g,",")},postformat:function(e){return e.replace(/\d/g,function(e){return d[e]}).replace(/,/g,"\u060c")},week:{dow:6,doy:12}}),e.defineLocale("ar-ma",{months:"\u064a\u0646\u0627\u064a\u0631_\u0641\u0628\u0631\u0627\u064a\u0631_\u0645\u0627\u0631\u0633_\u0623\u0628\u0631\u064a\u0644_\u0645\u0627\u064a_\u064a\u0648\u0646\u064a\u0648_\u064a\u0648\u0644\u064a\u0648\u0632_\u063a\u0634\u062a_\u0634\u062a\u0646\u0628\u0631_\u0623\u0643\u062a\u0648\u0628\u0631_\u0646\u0648\u0646\u0628\u0631_\u062f\u062c\u0646\u0628\u0631".split("_"),monthsShort:"\u064a\u0646\u0627\u064a\u0631_\u0641\u0628\u0631\u0627\u064a\u0631_\u0645\u0627\u0631\u0633_\u0623\u0628\u0631\u064a\u0644_\u0645\u0627\u064a_\u064a\u0648\u0646\u064a\u0648_\u064a\u0648\u0644\u064a\u0648\u0632_\u063a\u0634\u062a_\u0634\u062a\u0646\u0628\u0631_\u0623\u0643\u062a\u0648\u0628\u0631_\u0646\u0648\u0646\u0628\u0631_\u062f\u062c\u0646\u0628\u0631".split("_"),weekdays:"\u0627\u0644\u0623\u062d\u062f_\u0627\u0644\u0625\u062b\u0646\u064a\u0646_\u0627\u0644\u062b\u0644\u0627\u062b\u0627\u0621_\u0627\u0644\u0623\u0631\u0628\u0639\u0627\u0621_\u0627\u0644\u062e\u0645\u064a\u0633_\u0627\u0644\u062c\u0645\u0639\u0629_\u0627\u0644\u0633\u0628\u062a".split("_"),weekdaysShort:"\u0627\u062d\u062f_\u0627\u062b\u0646\u064a\u0646_\u062b\u0644\u0627\u062b\u0627\u0621_\u0627\u0631\u0628\u0639\u0627\u0621_\u062e\u0645\u064a\u0633_\u062c\u0645\u0639\u0629_\u0633\u0628\u062a".split("_"),weekdaysMin:"\u062d_\u0646_\u062b_\u0631_\u062e_\u062c_\u0633".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd D MMMM YYYY HH:mm"},calendar:{sameDay:"[\u0627\u0644\u064a\u0648\u0645 \u0639\u0644\u0649 \u0627\u0644\u0633\u0627\u0639\u0629] LT",nextDay:"[\u063a\u062f\u0627 \u0639\u0644\u0649 \u0627\u0644\u0633\u0627\u0639\u0629] LT",nextWeek:"dddd [\u0639\u0644\u0649 \u0627\u0644\u0633\u0627\u0639\u0629] LT",lastDay:"[\u0623\u0645\u0633 \u0639\u0644\u0649 \u0627\u0644\u0633\u0627\u0639\u0629] LT",lastWeek:"dddd [\u0639\u0644\u0649 \u0627\u0644\u0633\u0627\u0639\u0629] LT",sameElse:"L"},relativeTime:{future:"\u0641\u064a %s",past:"\u0645\u0646\u0630 %s",s:"\u062b\u0648\u0627\u0646",ss:"%d \u062b\u0627\u0646\u064a\u0629",m:"\u062f\u0642\u064a\u0642\u0629",mm:"%d \u062f\u0642\u0627\u0626\u0642",h:"\u0633\u0627\u0639\u0629",hh:"%d \u0633\u0627\u0639\u0627\u062a",d:"\u064a\u0648\u0645",dd:"%d \u0623\u064a\u0627\u0645",M:"\u0634\u0647\u0631",MM:"%d \u0623\u0634\u0647\u0631",y:"\u0633\u0646\u0629",yy:"%d \u0633\u0646\u0648\u0627\u062a"},week:{dow:6,doy:12}});var n={1:"\u0661",2:"\u0662",3:"\u0663",4:"\u0664",5:"\u0665",6:"\u0666",7:"\u0667",8:"\u0668",9:"\u0669",0:"\u0660"},u={"\u0661":"1","\u0662":"2","\u0663":"3","\u0664":"4","\u0665":"5","\u0666":"6","\u0667":"7","\u0668":"8","\u0669":"9","\u0660":"0"};e.defineLocale("ar-sa",{months:"\u064a\u0646\u0627\u064a\u0631_\u0641\u0628\u0631\u0627\u064a\u0631_\u0645\u0627\u0631\u0633_\u0623\u0628\u0631\u064a\u0644_\u0645\u0627\u064a\u0648_\u064a\u0648\u0646\u064a\u0648_\u064a\u0648\u0644\u064a\u0648_\u0623\u063a\u0633\u0637\u0633_\u0633\u0628\u062a\u0645\u0628\u0631_\u0623\u0643\u062a\u0648\u0628\u0631_\u0646\u0648\u0641\u0645\u0628\u0631_\u062f\u064a\u0633\u0645\u0628\u0631".split("_"),monthsShort:"\u064a\u0646\u0627\u064a\u0631_\u0641\u0628\u0631\u0627\u064a\u0631_\u0645\u0627\u0631\u0633_\u0623\u0628\u0631\u064a\u0644_\u0645\u0627\u064a\u0648_\u064a\u0648\u0646\u064a\u0648_\u064a\u0648\u0644\u064a\u0648_\u0623\u063a\u0633\u0637\u0633_\u0633\u0628\u062a\u0645\u0628\u0631_\u0623\u0643\u062a\u0648\u0628\u0631_\u0646\u0648\u0641\u0645\u0628\u0631_\u062f\u064a\u0633\u0645\u0628\u0631".split("_"),weekdays:"\u0627\u0644\u0623\u062d\u062f_\u0627\u0644\u0625\u062b\u0646\u064a\u0646_\u0627\u0644\u062b\u0644\u0627\u062b\u0627\u0621_\u0627\u0644\u0623\u0631\u0628\u0639\u0627\u0621_\u0627\u0644\u062e\u0645\u064a\u0633_\u0627\u0644\u062c\u0645\u0639\u0629_\u0627\u0644\u0633\u0628\u062a".split("_"),weekdaysShort:"\u0623\u062d\u062f_\u0625\u062b\u0646\u064a\u0646_\u062b\u0644\u0627\u062b\u0627\u0621_\u0623\u0631\u0628\u0639\u0627\u0621_\u062e\u0645\u064a\u0633_\u062c\u0645\u0639\u0629_\u0633\u0628\u062a".split("_"),weekdaysMin:"\u062d_\u0646_\u062b_\u0631_\u062e_\u062c_\u0633".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd D MMMM YYYY HH:mm"},meridiemParse:/\u0635|\u0645/,isPM:function(e){return"\u0645"===e},meridiem:function(e,a,_){return e<12?"\u0635":"\u0645"},calendar:{sameDay:"[\u0627\u0644\u064a\u0648\u0645 \u0639\u0644\u0649 \u0627\u0644\u0633\u0627\u0639\u0629] LT",nextDay:"[\u063a\u062f\u0627 \u0639\u0644\u0649 \u0627\u0644\u0633\u0627\u0639\u0629] LT",nextWeek:"dddd [\u0639\u0644\u0649 \u0627\u0644\u0633\u0627\u0639\u0629] LT",lastDay:"[\u0623\u0645\u0633 \u0639\u0644\u0649 \u0627\u0644\u0633\u0627\u0639\u0629] LT",lastWeek:"dddd [\u0639\u0644\u0649 \u0627\u0644\u0633\u0627\u0639\u0629] LT",sameElse:"L"},relativeTime:{future:"\u0641\u064a %s",past:"\u0645\u0646\u0630 %s",s:"\u062b\u0648\u0627\u0646",ss:"%d \u062b\u0627\u0646\u064a\u0629",m:"\u062f\u0642\u064a\u0642\u0629",mm:"%d \u062f\u0642\u0627\u0626\u0642",h:"\u0633\u0627\u0639\u0629",hh:"%d \u0633\u0627\u0639\u0627\u062a",d:"\u064a\u0648\u0645",dd:"%d \u0623\u064a\u0627\u0645",M:"\u0634\u0647\u0631",MM:"%d \u0623\u0634\u0647\u0631",y:"\u0633\u0646\u0629",yy:"%d \u0633\u0646\u0648\u0627\u062a"},preparse:function(e){return e.replace(/[\u0661\u0662\u0663\u0664\u0665\u0666\u0667\u0668\u0669\u0660]/g,function(e){return u[e]}).replace(/\u060c/g,",")},postformat:function(e){return e.replace(/\d/g,function(e){return n[e]}).replace(/,/g,"\u060c")},week:{dow:0,doy:6}}),e.defineLocale("ar-tn",{months:"\u062c\u0627\u0646\u0641\u064a_\u0641\u064a\u0641\u0631\u064a_\u0645\u0627\u0631\u0633_\u0623\u0641\u0631\u064a\u0644_\u0645\u0627\u064a_\u062c\u0648\u0627\u0646_\u062c\u0648\u064a\u0644\u064a\u0629_\u0623\u0648\u062a_\u0633\u0628\u062a\u0645\u0628\u0631_\u0623\u0643\u062a\u0648\u0628\u0631_\u0646\u0648\u0641\u0645\u0628\u0631_\u062f\u064a\u0633\u0645\u0628\u0631".split("_"),monthsShort:"\u062c\u0627\u0646\u0641\u064a_\u0641\u064a\u0641\u0631\u064a_\u0645\u0627\u0631\u0633_\u0623\u0641\u0631\u064a\u0644_\u0645\u0627\u064a_\u062c\u0648\u0627\u0646_\u062c\u0648\u064a\u0644\u064a\u0629_\u0623\u0648\u062a_\u0633\u0628\u062a\u0645\u0628\u0631_\u0623\u0643\u062a\u0648\u0628\u0631_\u0646\u0648\u0641\u0645\u0628\u0631_\u062f\u064a\u0633\u0645\u0628\u0631".split("_"),weekdays:"\u0627\u0644\u0623\u062d\u062f_\u0627\u0644\u0625\u062b\u0646\u064a\u0646_\u0627\u0644\u062b\u0644\u0627\u062b\u0627\u0621_\u0627\u0644\u0623\u0631\u0628\u0639\u0627\u0621_\u0627\u0644\u062e\u0645\u064a\u0633_\u0627\u0644\u062c\u0645\u0639\u0629_\u0627\u0644\u0633\u0628\u062a".split("_"),weekdaysShort:"\u0623\u062d\u062f_\u0625\u062b\u0646\u064a\u0646_\u062b\u0644\u0627\u062b\u0627\u0621_\u0623\u0631\u0628\u0639\u0627\u0621_\u062e\u0645\u064a\u0633_\u062c\u0645\u0639\u0629_\u0633\u0628\u062a".split("_"),weekdaysMin:"\u062d_\u0646_\u062b_\u0631_\u062e_\u062c_\u0633".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd D MMMM YYYY HH:mm"},calendar:{sameDay:"[\u0627\u0644\u064a\u0648\u0645 \u0639\u0644\u0649 \u0627\u0644\u0633\u0627\u0639\u0629] LT",nextDay:"[\u063a\u062f\u0627 \u0639\u0644\u0649 \u0627\u0644\u0633\u0627\u0639\u0629] LT",nextWeek:"dddd [\u0639\u0644\u0649 \u0627\u0644\u0633\u0627\u0639\u0629] LT",lastDay:"[\u0623\u0645\u0633 \u0639\u0644\u0649 \u0627\u0644\u0633\u0627\u0639\u0629] LT",lastWeek:"dddd [\u0639\u0644\u0649 \u0627\u0644\u0633\u0627\u0639\u0629] LT",sameElse:"L"},relativeTime:{future:"\u0641\u064a %s",past:"\u0645\u0646\u0630 %s",s:"\u062b\u0648\u0627\u0646",ss:"%d \u062b\u0627\u0646\u064a\u0629",m:"\u062f\u0642\u064a\u0642\u0629",mm:"%d \u062f\u0642\u0627\u0626\u0642",h:"\u0633\u0627\u0639\u0629",hh:"%d \u0633\u0627\u0639\u0627\u062a",d:"\u064a\u0648\u0645",dd:"%d \u0623\u064a\u0627\u0645",M:"\u0634\u0647\u0631",MM:"%d \u0623\u0634\u0647\u0631",y:"\u0633\u0646\u0629",yy:"%d \u0633\u0646\u0648\u0627\u062a"},week:{dow:1,doy:4}});function l(e){return 0===e?0:1===e?1:2===e?2:3<=e%100&&e%100<=10?3:11<=e%100?4:5}function M(n){return function(e,a,_,s){var d=l(e),t=h[n][l(e)];return 2===d&&(t=t[a?0:1]),t.replace(/%d/i,e)}}var L={1:"\u0661",2:"\u0662",3:"\u0663",4:"\u0664",5:"\u0665",6:"\u0666",7:"\u0667",8:"\u0668",9:"\u0669",0:"\u0660"},Y={"\u0661":"1","\u0662":"2","\u0663":"3","\u0664":"4","\u0665":"5","\u0666":"6","\u0667":"7","\u0668":"8","\u0669":"9","\u0660":"0"},h={s:["\u0623\u0642\u0644 \u0645\u0646 \u062b\u0627\u0646\u064a\u0629","\u062b\u0627\u0646\u064a\u0629 \u0648\u0627\u062d\u062f\u0629",["\u062b\u0627\u0646\u064a\u062a\u0627\u0646","\u062b\u0627\u0646\u064a\u062a\u064a\u0646"],"%d \u062b\u0648\u0627\u0646","%d \u062b\u0627\u0646\u064a\u0629","%d \u062b\u0627\u0646\u064a\u0629"],m:["\u0623\u0642\u0644 \u0645\u0646 \u062f\u0642\u064a\u0642\u0629","\u062f\u0642\u064a\u0642\u0629 \u0648\u0627\u062d\u062f\u0629",["\u062f\u0642\u064a\u0642\u062a\u0627\u0646","\u062f\u0642\u064a\u0642\u062a\u064a\u0646"],"%d \u062f\u0642\u0627\u0626\u0642","%d \u062f\u0642\u064a\u0642\u0629","%d \u062f\u0642\u064a\u0642\u0629"],h:["\u0623\u0642\u0644 \u0645\u0646 \u0633\u0627\u0639\u0629","\u0633\u0627\u0639\u0629 \u0648\u0627\u062d\u062f\u0629",["\u0633\u0627\u0639\u062a\u0627\u0646","\u0633\u0627\u0639\u062a\u064a\u0646"],"%d \u0633\u0627\u0639\u0627\u062a","%d \u0633\u0627\u0639\u0629","%d \u0633\u0627\u0639\u0629"],d:["\u0623\u0642\u0644 \u0645\u0646 \u064a\u0648\u0645","\u064a\u0648\u0645 \u0648\u0627\u062d\u062f",["\u064a\u0648\u0645\u0627\u0646","\u064a\u0648\u0645\u064a\u0646"],"%d \u0623\u064a\u0627\u0645","%d \u064a\u0648\u0645\u064b\u0627","%d \u064a\u0648\u0645"],M:["\u0623\u0642\u0644 \u0645\u0646 \u0634\u0647\u0631","\u0634\u0647\u0631 \u0648\u0627\u062d\u062f",["\u0634\u0647\u0631\u0627\u0646","\u0634\u0647\u0631\u064a\u0646"],"%d \u0623\u0634\u0647\u0631","%d \u0634\u0647\u0631\u0627","%d \u0634\u0647\u0631"],y:["\u0623\u0642\u0644 \u0645\u0646 \u0639\u0627\u0645","\u0639\u0627\u0645 \u0648\u0627\u062d\u062f",["\u0639\u0627\u0645\u0627\u0646","\u0639\u0627\u0645\u064a\u0646"],"%d \u0623\u0639\u0648\u0627\u0645","%d \u0639\u0627\u0645\u064b\u0627","%d \u0639\u0627\u0645"]},y=["\u064a\u0646\u0627\u064a\u0631","\u0641\u0628\u0631\u0627\u064a\u0631","\u0645\u0627\u0631\u0633","\u0623\u0628\u0631\u064a\u0644","\u0645\u0627\u064a\u0648","\u064a\u0648\u0646\u064a\u0648","\u064a\u0648\u0644\u064a\u0648","\u0623\u063a\u0633\u0637\u0633","\u0633\u0628\u062a\u0645\u0628\u0631","\u0623\u0643\u062a\u0648\u0628\u0631","\u0646\u0648\u0641\u0645\u0628\u0631","\u062f\u064a\u0633\u0645\u0628\u0631"];e.defineLocale("ar",{months:y,monthsShort:y,weekdays:"\u0627\u0644\u0623\u062d\u062f_\u0627\u0644\u0625\u062b\u0646\u064a\u0646_\u0627\u0644\u062b\u0644\u0627\u062b\u0627\u0621_\u0627\u0644\u0623\u0631\u0628\u0639\u0627\u0621_\u0627\u0644\u062e\u0645\u064a\u0633_\u0627\u0644\u062c\u0645\u0639\u0629_\u0627\u0644\u0633\u0628\u062a".split("_"),weekdaysShort:"\u0623\u062d\u062f_\u0625\u062b\u0646\u064a\u0646_\u062b\u0644\u0627\u062b\u0627\u0621_\u0623\u0631\u0628\u0639\u0627\u0621_\u062e\u0645\u064a\u0633_\u062c\u0645\u0639\u0629_\u0633\u0628\u062a".split("_"),weekdaysMin:"\u062d_\u0646_\u062b_\u0631_\u062e_\u062c_\u0633".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"D/\u200fM/\u200fYYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd D MMMM YYYY HH:mm"},meridiemParse:/\u0635|\u0645/,isPM:function(e){return"\u0645"===e},meridiem:function(e,a,_){return e<12?"\u0635":"\u0645"},calendar:{sameDay:"[\u0627\u0644\u064a\u0648\u0645 \u0639\u0646\u062f \u0627\u0644\u0633\u0627\u0639\u0629] LT",nextDay:"[\u063a\u062f\u064b\u0627 \u0639\u0646\u062f \u0627\u0644\u0633\u0627\u0639\u0629] LT",nextWeek:"dddd [\u0639\u0646\u062f \u0627\u0644\u0633\u0627\u0639\u0629] LT",lastDay:"[\u0623\u0645\u0633 \u0639\u0646\u062f \u0627\u0644\u0633\u0627\u0639\u0629] LT",lastWeek:"dddd [\u0639\u0646\u062f \u0627\u0644\u0633\u0627\u0639\u0629] LT",sameElse:"L"},relativeTime:{future:"\u0628\u0639\u062f %s",past:"\u0645\u0646\u0630 %s",s:M("s"),ss:M("s"),m:M("m"),mm:M("m"),h:M("h"),hh:M("h"),d:M("d"),dd:M("d"),M:M("M"),MM:M("M"),y:M("y"),yy:M("y")},preparse:function(e){return e.replace(/[\u0661\u0662\u0663\u0664\u0665\u0666\u0667\u0668\u0669\u0660]/g,function(e){return Y[e]}).replace(/\u060c/g,",")},postformat:function(e){return e.replace(/\d/g,function(e){return L[e]}).replace(/,/g,"\u060c")},week:{dow:6,doy:12}});var c={1:"-inci",5:"-inci",8:"-inci",70:"-inci",80:"-inci",2:"-nci",7:"-nci",20:"-nci",50:"-nci",3:"-\xfcnc\xfc",4:"-\xfcnc\xfc",100:"-\xfcnc\xfc",6:"-nc\u0131",9:"-uncu",10:"-uncu",30:"-uncu",60:"-\u0131nc\u0131",90:"-\u0131nc\u0131"};function k(e,a,_){var s,d;return"m"===_?a?"\u0445\u0432\u0456\u043b\u0456\u043d\u0430":"\u0445\u0432\u0456\u043b\u0456\u043d\u0443":"h"===_?a?"\u0433\u0430\u0434\u0437\u0456\u043d\u0430":"\u0433\u0430\u0434\u0437\u0456\u043d\u0443":e+" "+(s=+e,d={ss:a?"\u0441\u0435\u043a\u0443\u043d\u0434\u0430_\u0441\u0435\u043a\u0443\u043d\u0434\u044b_\u0441\u0435\u043a\u0443\u043d\u0434":"\u0441\u0435\u043a\u0443\u043d\u0434\u0443_\u0441\u0435\u043a\u0443\u043d\u0434\u044b_\u0441\u0435\u043a\u0443\u043d\u0434",mm:a?"\u0445\u0432\u0456\u043b\u0456\u043d\u0430_\u0445\u0432\u0456\u043b\u0456\u043d\u044b_\u0445\u0432\u0456\u043b\u0456\u043d":"\u0445\u0432\u0456\u043b\u0456\u043d\u0443_\u0445\u0432\u0456\u043b\u0456\u043d\u044b_\u0445\u0432\u0456\u043b\u0456\u043d",hh:a?"\u0433\u0430\u0434\u0437\u0456\u043d\u0430_\u0433\u0430\u0434\u0437\u0456\u043d\u044b_\u0433\u0430\u0434\u0437\u0456\u043d":"\u0433\u0430\u0434\u0437\u0456\u043d\u0443_\u0433\u0430\u0434\u0437\u0456\u043d\u044b_\u0433\u0430\u0434\u0437\u0456\u043d",dd:"\u0434\u0437\u0435\u043d\u044c_\u0434\u043d\u0456_\u0434\u0437\u0451\u043d",MM:"\u043c\u0435\u0441\u044f\u0446_\u043c\u0435\u0441\u044f\u0446\u044b_\u043c\u0435\u0441\u044f\u0446\u0430\u045e",yy:"\u0433\u043e\u0434_\u0433\u0430\u0434\u044b_\u0433\u0430\u0434\u043e\u045e"}[_].split("_"),s%10==1&&s%100!=11?d[0]:2<=s%10&&s%10<=4&&(s%100<10||20<=s%100)?d[1]:d[2])}e.defineLocale("az",{months:"yanvar_fevral_mart_aprel_may_iyun_iyul_avqust_sentyabr_oktyabr_noyabr_dekabr".split("_"),monthsShort:"yan_fev_mar_apr_may_iyn_iyl_avq_sen_okt_noy_dek".split("_"),weekdays:"Bazar_Bazar ert\u0259si_\xc7\u0259r\u015f\u0259nb\u0259 ax\u015fam\u0131_\xc7\u0259r\u015f\u0259nb\u0259_C\xfcm\u0259 ax\u015fam\u0131_C\xfcm\u0259_\u015e\u0259nb\u0259".split("_"),weekdaysShort:"Baz_BzE_\xc7Ax_\xc7\u0259r_CAx_C\xfcm_\u015e\u0259n".split("_"),weekdaysMin:"Bz_BE_\xc7A_\xc7\u0259_CA_C\xfc_\u015e\u0259".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD.MM.YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd, D MMMM YYYY HH:mm"},calendar:{sameDay:"[bug\xfcn saat] LT",nextDay:"[sabah saat] LT",nextWeek:"[g\u0259l\u0259n h\u0259ft\u0259] dddd [saat] LT",lastDay:"[d\xfcn\u0259n] LT",lastWeek:"[ke\xe7\u0259n h\u0259ft\u0259] dddd [saat] LT",sameElse:"L"},relativeTime:{future:"%s sonra",past:"%s \u0259vv\u0259l",s:"bir ne\xe7\u0259 saniy\u0259",ss:"%d saniy\u0259",m:"bir d\u0259qiq\u0259",mm:"%d d\u0259qiq\u0259",h:"bir saat",hh:"%d saat",d:"bir g\xfcn",dd:"%d g\xfcn",M:"bir ay",MM:"%d ay",y:"bir il",yy:"%d il"},meridiemParse:/gec\u0259|s\u0259h\u0259r|g\xfcnd\xfcz|ax\u015fam/,isPM:function(e){return/^(g\xfcnd\xfcz|ax\u015fam)$/.test(e)},meridiem:function(e,a,_){return e<4?"gec\u0259":e<12?"s\u0259h\u0259r":e<17?"g\xfcnd\xfcz":"ax\u015fam"},dayOfMonthOrdinalParse:/\d{1,2}-(\u0131nc\u0131|inci|nci|\xfcnc\xfc|nc\u0131|uncu)/,ordinal:function(e){if(0===e)return e+"-\u0131nc\u0131";var a=e%10;return e+(c[a]||c[e%100-a]||c[100<=e?100:null])},week:{dow:1,doy:7}}),e.defineLocale("be",{months:{format:"\u0441\u0442\u0443\u0434\u0437\u0435\u043d\u044f_\u043b\u044e\u0442\u0430\u0433\u0430_\u0441\u0430\u043a\u0430\u0432\u0456\u043a\u0430_\u043a\u0440\u0430\u0441\u0430\u0432\u0456\u043a\u0430_\u0442\u0440\u0430\u045e\u043d\u044f_\u0447\u044d\u0440\u0432\u0435\u043d\u044f_\u043b\u0456\u043f\u0435\u043d\u044f_\u0436\u043d\u0456\u045e\u043d\u044f_\u0432\u0435\u0440\u0430\u0441\u043d\u044f_\u043a\u0430\u0441\u0442\u0440\u044b\u0447\u043d\u0456\u043a\u0430_\u043b\u0456\u0441\u0442\u0430\u043f\u0430\u0434\u0430_\u0441\u043d\u0435\u0436\u043d\u044f".split("_"),standalone:"\u0441\u0442\u0443\u0434\u0437\u0435\u043d\u044c_\u043b\u044e\u0442\u044b_\u0441\u0430\u043a\u0430\u0432\u0456\u043a_\u043a\u0440\u0430\u0441\u0430\u0432\u0456\u043a_\u0442\u0440\u0430\u0432\u0435\u043d\u044c_\u0447\u044d\u0440\u0432\u0435\u043d\u044c_\u043b\u0456\u043f\u0435\u043d\u044c_\u0436\u043d\u0456\u0432\u0435\u043d\u044c_\u0432\u0435\u0440\u0430\u0441\u0435\u043d\u044c_\u043a\u0430\u0441\u0442\u0440\u044b\u0447\u043d\u0456\u043a_\u043b\u0456\u0441\u0442\u0430\u043f\u0430\u0434_\u0441\u043d\u0435\u0436\u0430\u043d\u044c".split("_")},monthsShort:"\u0441\u0442\u0443\u0434_\u043b\u044e\u0442_\u0441\u0430\u043a_\u043a\u0440\u0430\u0441_\u0442\u0440\u0430\u0432_\u0447\u044d\u0440\u0432_\u043b\u0456\u043f_\u0436\u043d\u0456\u0432_\u0432\u0435\u0440_\u043a\u0430\u0441\u0442_\u043b\u0456\u0441\u0442_\u0441\u043d\u0435\u0436".split("_"),weekdays:{format:"\u043d\u044f\u0434\u0437\u0435\u043b\u044e_\u043f\u0430\u043d\u044f\u0434\u0437\u0435\u043b\u0430\u043a_\u0430\u045e\u0442\u043e\u0440\u0430\u043a_\u0441\u0435\u0440\u0430\u0434\u0443_\u0447\u0430\u0446\u0432\u0435\u0440_\u043f\u044f\u0442\u043d\u0456\u0446\u0443_\u0441\u0443\u0431\u043e\u0442\u0443".split("_"),standalone:"\u043d\u044f\u0434\u0437\u0435\u043b\u044f_\u043f\u0430\u043d\u044f\u0434\u0437\u0435\u043b\u0430\u043a_\u0430\u045e\u0442\u043e\u0440\u0430\u043a_\u0441\u0435\u0440\u0430\u0434\u0430_\u0447\u0430\u0446\u0432\u0435\u0440_\u043f\u044f\u0442\u043d\u0456\u0446\u0430_\u0441\u0443\u0431\u043e\u0442\u0430".split("_"),isFormat:/\[ ?[\u0423\u0443\u045e] ?(?:\u043c\u0456\u043d\u0443\u043b\u0443\u044e|\u043d\u0430\u0441\u0442\u0443\u043f\u043d\u0443\u044e)? ?\] ?dddd/},weekdaysShort:"\u043d\u0434_\u043f\u043d_\u0430\u0442_\u0441\u0440_\u0447\u0446_\u043f\u0442_\u0441\u0431".split("_"),weekdaysMin:"\u043d\u0434_\u043f\u043d_\u0430\u0442_\u0441\u0440_\u0447\u0446_\u043f\u0442_\u0441\u0431".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD.MM.YYYY",LL:"D MMMM YYYY \u0433.",LLL:"D MMMM YYYY \u0433., HH:mm",LLLL:"dddd, D MMMM YYYY \u0433., HH:mm"},calendar:{sameDay:"[\u0421\u0451\u043d\u043d\u044f \u045e] LT",nextDay:"[\u0417\u0430\u045e\u0442\u0440\u0430 \u045e] LT",lastDay:"[\u0423\u0447\u043e\u0440\u0430 \u045e] LT",nextWeek:function(){return"[\u0423] dddd [\u045e] LT"},lastWeek:function(){switch(this.day()){case 0:case 3:case 5:case 6:return"[\u0423 \u043c\u0456\u043d\u0443\u043b\u0443\u044e] dddd [\u045e] LT";case 1:case 2:case 4:return"[\u0423 \u043c\u0456\u043d\u0443\u043b\u044b] dddd [\u045e] LT"}},sameElse:"L"},relativeTime:{future:"\u043f\u0440\u0430\u0437 %s",past:"%s \u0442\u0430\u043c\u0443",s:"\u043d\u0435\u043a\u0430\u043b\u044c\u043a\u0456 \u0441\u0435\u043a\u0443\u043d\u0434",m:k,mm:k,h:k,hh:k,d:"\u0434\u0437\u0435\u043d\u044c",dd:k,M:"\u043c\u0435\u0441\u044f\u0446",MM:k,y:"\u0433\u043e\u0434",yy:k},meridiemParse:/\u043d\u043e\u0447\u044b|\u0440\u0430\u043d\u0456\u0446\u044b|\u0434\u043d\u044f|\u0432\u0435\u0447\u0430\u0440\u0430/,isPM:function(e){return/^(\u0434\u043d\u044f|\u0432\u0435\u0447\u0430\u0440\u0430)$/.test(e)},meridiem:function(e,a,_){return e<4?"\u043d\u043e\u0447\u044b":e<12?"\u0440\u0430\u043d\u0456\u0446\u044b":e<17?"\u0434\u043d\u044f":"\u0432\u0435\u0447\u0430\u0440\u0430"},dayOfMonthOrdinalParse:/\d{1,2}-(\u0456|\u044b|\u0433\u0430)/,ordinal:function(e,a){switch(a){case"M":case"d":case"DDD":case"w":case"W":return e%10!=2&&e%10!=3||e%100==12||e%100==13?e+"-\u044b":e+"-\u0456";case"D":return e+"-\u0433\u0430";default:return e}},week:{dow:1,doy:7}}),e.defineLocale("bg",{months:"\u044f\u043d\u0443\u0430\u0440\u0438_\u0444\u0435\u0432\u0440\u0443\u0430\u0440\u0438_\u043c\u0430\u0440\u0442_\u0430\u043f\u0440\u0438\u043b_\u043c\u0430\u0439_\u044e\u043d\u0438_\u044e\u043b\u0438_\u0430\u0432\u0433\u0443\u0441\u0442_\u0441\u0435\u043f\u0442\u0435\u043c\u0432\u0440\u0438_\u043e\u043a\u0442\u043e\u043c\u0432\u0440\u0438_\u043d\u043e\u0435\u043c\u0432\u0440\u0438_\u0434\u0435\u043a\u0435\u043c\u0432\u0440\u0438".split("_"),monthsShort:"\u044f\u043d\u0443_\u0444\u0435\u0432_\u043c\u0430\u0440_\u0430\u043f\u0440_\u043c\u0430\u0439_\u044e\u043d\u0438_\u044e\u043b\u0438_\u0430\u0432\u0433_\u0441\u0435\u043f_\u043e\u043a\u0442_\u043d\u043e\u0435_\u0434\u0435\u043a".split("_"),weekdays:"\u043d\u0435\u0434\u0435\u043b\u044f_\u043f\u043e\u043d\u0435\u0434\u0435\u043b\u043d\u0438\u043a_\u0432\u0442\u043e\u0440\u043d\u0438\u043a_\u0441\u0440\u044f\u0434\u0430_\u0447\u0435\u0442\u0432\u044a\u0440\u0442\u044a\u043a_\u043f\u0435\u0442\u044a\u043a_\u0441\u044a\u0431\u043e\u0442\u0430".split("_"),weekdaysShort:"\u043d\u0435\u0434_\u043f\u043e\u043d_\u0432\u0442\u043e_\u0441\u0440\u044f_\u0447\u0435\u0442_\u043f\u0435\u0442_\u0441\u044a\u0431".split("_"),weekdaysMin:"\u043d\u0434_\u043f\u043d_\u0432\u0442_\u0441\u0440_\u0447\u0442_\u043f\u0442_\u0441\u0431".split("_"),longDateFormat:{LT:"H:mm",LTS:"H:mm:ss",L:"D.MM.YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY H:mm",LLLL:"dddd, D MMMM YYYY H:mm"},calendar:{sameDay:"[\u0414\u043d\u0435\u0441 \u0432] LT",nextDay:"[\u0423\u0442\u0440\u0435 \u0432] LT",nextWeek:"dddd [\u0432] LT",lastDay:"[\u0412\u0447\u0435\u0440\u0430 \u0432] LT",lastWeek:function(){switch(this.day()){case 0:case 3:case 6:return"[\u041c\u0438\u043d\u0430\u043b\u0430\u0442\u0430] dddd [\u0432] LT";case 1:case 2:case 4:case 5:return"[\u041c\u0438\u043d\u0430\u043b\u0438\u044f] dddd [\u0432] LT"}},sameElse:"L"},relativeTime:{future:"\u0441\u043b\u0435\u0434 %s",past:"\u043f\u0440\u0435\u0434\u0438 %s",s:"\u043d\u044f\u043a\u043e\u043b\u043a\u043e \u0441\u0435\u043a\u0443\u043d\u0434\u0438",ss:"%d \u0441\u0435\u043a\u0443\u043d\u0434\u0438",m:"\u043c\u0438\u043d\u0443\u0442\u0430",mm:"%d \u043c\u0438\u043d\u0443\u0442\u0438",h:"\u0447\u0430\u0441",hh:"%d \u0447\u0430\u0441\u0430",d:"\u0434\u0435\u043d",dd:"%d \u0434\u0435\u043d\u0430",M:"\u043c\u0435\u0441\u0435\u0446",MM:"%d \u043c\u0435\u0441\u0435\u0446\u0430",y:"\u0433\u043e\u0434\u0438\u043d\u0430",yy:"%d \u0433\u043e\u0434\u0438\u043d\u0438"},dayOfMonthOrdinalParse:/\d{1,2}-(\u0435\u0432|\u0435\u043d|\u0442\u0438|\u0432\u0438|\u0440\u0438|\u043c\u0438)/,ordinal:function(e){var a=e%10,_=e%100;return 0===e?e+"-\u0435\u0432":0==_?e+"-\u0435\u043d":10<_&&_<20?e+"-\u0442\u0438":1==a?e+"-\u0432\u0438":2==a?e+"-\u0440\u0438":7==a||8==a?e+"-\u043c\u0438":e+"-\u0442\u0438"},week:{dow:1,doy:7}}),e.defineLocale("bm",{months:"Zanwuyekalo_Fewuruyekalo_Marisikalo_Awirilikalo_M\u025bkalo_Zuw\u025bnkalo_Zuluyekalo_Utikalo_S\u025btanburukalo_\u0254kut\u0254burukalo_Nowanburukalo_Desanburukalo".split("_"),monthsShort:"Zan_Few_Mar_Awi_M\u025b_Zuw_Zul_Uti_S\u025bt_\u0254ku_Now_Des".split("_"),weekdays:"Kari_Nt\u025bn\u025bn_Tarata_Araba_Alamisa_Juma_Sibiri".split("_"),weekdaysShort:"Kar_Nt\u025b_Tar_Ara_Ala_Jum_Sib".split("_"),weekdaysMin:"Ka_Nt_Ta_Ar_Al_Ju_Si".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"MMMM [tile] D [san] YYYY",LLL:"MMMM [tile] D [san] YYYY [l\u025br\u025b] HH:mm",LLLL:"dddd MMMM [tile] D [san] YYYY [l\u025br\u025b] HH:mm"},calendar:{sameDay:"[Bi l\u025br\u025b] LT",nextDay:"[Sini l\u025br\u025b] LT",nextWeek:"dddd [don l\u025br\u025b] LT",lastDay:"[Kunu l\u025br\u025b] LT",lastWeek:"dddd [t\u025bm\u025bnen l\u025br\u025b] LT",sameElse:"L"},relativeTime:{future:"%s k\u0254n\u0254",past:"a b\u025b %s b\u0254",s:"sanga dama dama",ss:"sekondi %d",m:"miniti kelen",mm:"miniti %d",h:"l\u025br\u025b kelen",hh:"l\u025br\u025b %d",d:"tile kelen",dd:"tile %d",M:"kalo kelen",MM:"kalo %d",y:"san kelen",yy:"san %d"},week:{dow:1,doy:4}});var D={1:"\u09e7",2:"\u09e8",3:"\u09e9",4:"\u09ea",5:"\u09eb",6:"\u09ec",7:"\u09ed",8:"\u09ee",9:"\u09ef",0:"\u09e6"},p={"\u09e7":"1","\u09e8":"2","\u09e9":"3","\u09ea":"4","\u09eb":"5","\u09ec":"6","\u09ed":"7","\u09ee":"8","\u09ef":"9","\u09e6":"0"};e.defineLocale("bn",{months:"\u099c\u09be\u09a8\u09c1\u09df\u09be\u09b0\u09bf_\u09ab\u09c7\u09ac\u09cd\u09b0\u09c1\u09df\u09be\u09b0\u09bf_\u09ae\u09be\u09b0\u09cd\u099a_\u098f\u09aa\u09cd\u09b0\u09bf\u09b2_\u09ae\u09c7_\u099c\u09c1\u09a8_\u099c\u09c1\u09b2\u09be\u0987_\u0986\u0997\u09b8\u09cd\u099f_\u09b8\u09c7\u09aa\u09cd\u099f\u09c7\u09ae\u09cd\u09ac\u09b0_\u0985\u0995\u09cd\u099f\u09cb\u09ac\u09b0_\u09a8\u09ad\u09c7\u09ae\u09cd\u09ac\u09b0_\u09a1\u09bf\u09b8\u09c7\u09ae\u09cd\u09ac\u09b0".split("_"),monthsShort:"\u099c\u09be\u09a8\u09c1_\u09ab\u09c7\u09ac\u09cd\u09b0\u09c1_\u09ae\u09be\u09b0\u09cd\u099a_\u098f\u09aa\u09cd\u09b0\u09bf\u09b2_\u09ae\u09c7_\u099c\u09c1\u09a8_\u099c\u09c1\u09b2\u09be\u0987_\u0986\u0997\u09b8\u09cd\u099f_\u09b8\u09c7\u09aa\u09cd\u099f_\u0985\u0995\u09cd\u099f\u09cb_\u09a8\u09ad\u09c7_\u09a1\u09bf\u09b8\u09c7".split("_"),weekdays:"\u09b0\u09ac\u09bf\u09ac\u09be\u09b0_\u09b8\u09cb\u09ae\u09ac\u09be\u09b0_\u09ae\u0999\u09cd\u0997\u09b2\u09ac\u09be\u09b0_\u09ac\u09c1\u09a7\u09ac\u09be\u09b0_\u09ac\u09c3\u09b9\u09b8\u09cd\u09aa\u09a4\u09bf\u09ac\u09be\u09b0_\u09b6\u09c1\u0995\u09cd\u09b0\u09ac\u09be\u09b0_\u09b6\u09a8\u09bf\u09ac\u09be\u09b0".split("_"),weekdaysShort:"\u09b0\u09ac\u09bf_\u09b8\u09cb\u09ae_\u09ae\u0999\u09cd\u0997\u09b2_\u09ac\u09c1\u09a7_\u09ac\u09c3\u09b9\u09b8\u09cd\u09aa\u09a4\u09bf_\u09b6\u09c1\u0995\u09cd\u09b0_\u09b6\u09a8\u09bf".split("_"),weekdaysMin:"\u09b0\u09ac\u09bf_\u09b8\u09cb\u09ae_\u09ae\u0999\u09cd\u0997\u09b2_\u09ac\u09c1\u09a7_\u09ac\u09c3\u09b9_\u09b6\u09c1\u0995\u09cd\u09b0_\u09b6\u09a8\u09bf".split("_"),longDateFormat:{LT:"A h:mm \u09b8\u09ae\u09df",LTS:"A h:mm:ss \u09b8\u09ae\u09df",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY, A h:mm \u09b8\u09ae\u09df",LLLL:"dddd, D MMMM YYYY, A h:mm \u09b8\u09ae\u09df"},calendar:{sameDay:"[\u0986\u099c] LT",nextDay:"[\u0986\u0997\u09be\u09ae\u09c0\u0995\u09be\u09b2] LT",nextWeek:"dddd, LT",lastDay:"[\u0997\u09a4\u0995\u09be\u09b2] LT",lastWeek:"[\u0997\u09a4] dddd, LT",sameElse:"L"},relativeTime:{future:"%s \u09aa\u09b0\u09c7",past:"%s \u0986\u0997\u09c7",s:"\u0995\u09df\u09c7\u0995 \u09b8\u09c7\u0995\u09c7\u09a8\u09cd\u09a1",ss:"%d \u09b8\u09c7\u0995\u09c7\u09a8\u09cd\u09a1",m:"\u098f\u0995 \u09ae\u09bf\u09a8\u09bf\u099f",mm:"%d \u09ae\u09bf\u09a8\u09bf\u099f",h:"\u098f\u0995 \u0998\u09a8\u09cd\u099f\u09be",hh:"%d \u0998\u09a8\u09cd\u099f\u09be",d:"\u098f\u0995 \u09a6\u09bf\u09a8",dd:"%d \u09a6\u09bf\u09a8",M:"\u098f\u0995 \u09ae\u09be\u09b8",MM:"%d \u09ae\u09be\u09b8",y:"\u098f\u0995 \u09ac\u099b\u09b0",yy:"%d \u09ac\u099b\u09b0"},preparse:function(e){return e.replace(/[\u09e7\u09e8\u09e9\u09ea\u09eb\u09ec\u09ed\u09ee\u09ef\u09e6]/g,function(e){return p[e]})},postformat:function(e){return e.replace(/\d/g,function(e){return D[e]})},meridiemParse:/\u09b0\u09be\u09a4|\u09b8\u0995\u09be\u09b2|\u09a6\u09c1\u09aa\u09c1\u09b0|\u09ac\u09bf\u0995\u09be\u09b2|\u09b0\u09be\u09a4/,meridiemHour:function(e,a){return 12===e&&(e=0),"\u09b0\u09be\u09a4"===a&&4<=e||"\u09a6\u09c1\u09aa\u09c1\u09b0"===a&&e<5||"\u09ac\u09bf\u0995\u09be\u09b2"===a?e+12:e},meridiem:function(e,a,_){return e<4?"\u09b0\u09be\u09a4":e<10?"\u09b8\u0995\u09be\u09b2":e<17?"\u09a6\u09c1\u09aa\u09c1\u09b0":e<20?"\u09ac\u09bf\u0995\u09be\u09b2":"\u09b0\u09be\u09a4"},week:{dow:0,doy:6}});var T={1:"\u0f21",2:"\u0f22",3:"\u0f23",4:"\u0f24",5:"\u0f25",6:"\u0f26",7:"\u0f27",8:"\u0f28",9:"\u0f29",0:"\u0f20"},f={"\u0f21":"1","\u0f22":"2","\u0f23":"3","\u0f24":"4","\u0f25":"5","\u0f26":"6","\u0f27":"7","\u0f28":"8","\u0f29":"9","\u0f20":"0"};function g(e,a,_){var s;return e+" "+(s={mm:"munutenn",MM:"miz",dd:"devezh"}[_],2!==e?s:function(e){var a={m:"v",b:"v",d:"z"};return void 0!==a[e.charAt(0)]?a[e.charAt(0)]+e.substring(1):e}(s))}e.defineLocale("bo",{months:"\u0f5f\u0fb3\u0f0b\u0f56\u0f0b\u0f51\u0f44\u0f0b\u0f54\u0f7c_\u0f5f\u0fb3\u0f0b\u0f56\u0f0b\u0f42\u0f49\u0f72\u0f66\u0f0b\u0f54_\u0f5f\u0fb3\u0f0b\u0f56\u0f0b\u0f42\u0f66\u0f74\u0f58\u0f0b\u0f54_\u0f5f\u0fb3\u0f0b\u0f56\u0f0b\u0f56\u0f5e\u0f72\u0f0b\u0f54_\u0f5f\u0fb3\u0f0b\u0f56\u0f0b\u0f63\u0f94\u0f0b\u0f54_\u0f5f\u0fb3\u0f0b\u0f56\u0f0b\u0f51\u0fb2\u0f74\u0f42\u0f0b\u0f54_\u0f5f\u0fb3\u0f0b\u0f56\u0f0b\u0f56\u0f51\u0f74\u0f53\u0f0b\u0f54_\u0f5f\u0fb3\u0f0b\u0f56\u0f0b\u0f56\u0f62\u0f92\u0fb1\u0f51\u0f0b\u0f54_\u0f5f\u0fb3\u0f0b\u0f56\u0f0b\u0f51\u0f42\u0f74\u0f0b\u0f54_\u0f5f\u0fb3\u0f0b\u0f56\u0f0b\u0f56\u0f45\u0f74\u0f0b\u0f54_\u0f5f\u0fb3\u0f0b\u0f56\u0f0b\u0f56\u0f45\u0f74\u0f0b\u0f42\u0f45\u0f72\u0f42\u0f0b\u0f54_\u0f5f\u0fb3\u0f0b\u0f56\u0f0b\u0f56\u0f45\u0f74\u0f0b\u0f42\u0f49\u0f72\u0f66\u0f0b\u0f54".split("_"),monthsShort:"\u0f5f\u0fb3\u0f0b1_\u0f5f\u0fb3\u0f0b2_\u0f5f\u0fb3\u0f0b3_\u0f5f\u0fb3\u0f0b4_\u0f5f\u0fb3\u0f0b5_\u0f5f\u0fb3\u0f0b6_\u0f5f\u0fb3\u0f0b7_\u0f5f\u0fb3\u0f0b8_\u0f5f\u0fb3\u0f0b9_\u0f5f\u0fb3\u0f0b10_\u0f5f\u0fb3\u0f0b11_\u0f5f\u0fb3\u0f0b12".split("_"),monthsShortRegex:/^(\u0f5f\u0fb3\u0f0b\d{1,2})/,monthsParseExact:!0,weekdays:"\u0f42\u0f5f\u0f60\u0f0b\u0f49\u0f72\u0f0b\u0f58\u0f0b_\u0f42\u0f5f\u0f60\u0f0b\u0f5f\u0fb3\u0f0b\u0f56\u0f0b_\u0f42\u0f5f\u0f60\u0f0b\u0f58\u0f72\u0f42\u0f0b\u0f51\u0f58\u0f62\u0f0b_\u0f42\u0f5f\u0f60\u0f0b\u0f63\u0fb7\u0f42\u0f0b\u0f54\u0f0b_\u0f42\u0f5f\u0f60\u0f0b\u0f55\u0f74\u0f62\u0f0b\u0f56\u0f74_\u0f42\u0f5f\u0f60\u0f0b\u0f54\u0f0b\u0f66\u0f44\u0f66\u0f0b_\u0f42\u0f5f\u0f60\u0f0b\u0f66\u0fa4\u0f7a\u0f53\u0f0b\u0f54\u0f0b".split("_"),weekdaysShort:"\u0f49\u0f72\u0f0b\u0f58\u0f0b_\u0f5f\u0fb3\u0f0b\u0f56\u0f0b_\u0f58\u0f72\u0f42\u0f0b\u0f51\u0f58\u0f62\u0f0b_\u0f63\u0fb7\u0f42\u0f0b\u0f54\u0f0b_\u0f55\u0f74\u0f62\u0f0b\u0f56\u0f74_\u0f54\u0f0b\u0f66\u0f44\u0f66\u0f0b_\u0f66\u0fa4\u0f7a\u0f53\u0f0b\u0f54\u0f0b".split("_"),weekdaysMin:"\u0f49\u0f72_\u0f5f\u0fb3_\u0f58\u0f72\u0f42_\u0f63\u0fb7\u0f42_\u0f55\u0f74\u0f62_\u0f66\u0f44\u0f66_\u0f66\u0fa4\u0f7a\u0f53".split("_"),longDateFormat:{LT:"A h:mm",LTS:"A h:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY, A h:mm",LLLL:"dddd, D MMMM YYYY, A h:mm"},calendar:{sameDay:"[\u0f51\u0f72\u0f0b\u0f62\u0f72\u0f44] LT",nextDay:"[\u0f66\u0f44\u0f0b\u0f49\u0f72\u0f53] LT",nextWeek:"[\u0f56\u0f51\u0f74\u0f53\u0f0b\u0f55\u0fb2\u0f42\u0f0b\u0f62\u0f97\u0f7a\u0f66\u0f0b\u0f58], LT",lastDay:"[\u0f41\u0f0b\u0f66\u0f44] LT",lastWeek:"[\u0f56\u0f51\u0f74\u0f53\u0f0b\u0f55\u0fb2\u0f42\u0f0b\u0f58\u0f50\u0f60\u0f0b\u0f58] dddd, LT",sameElse:"L"},relativeTime:{future:"%s \u0f63\u0f0b",past:"%s \u0f66\u0f94\u0f53\u0f0b\u0f63",s:"\u0f63\u0f58\u0f0b\u0f66\u0f44",ss:"%d \u0f66\u0f90\u0f62\u0f0b\u0f46\u0f0d",m:"\u0f66\u0f90\u0f62\u0f0b\u0f58\u0f0b\u0f42\u0f45\u0f72\u0f42",mm:"%d \u0f66\u0f90\u0f62\u0f0b\u0f58",h:"\u0f46\u0f74\u0f0b\u0f5a\u0f7c\u0f51\u0f0b\u0f42\u0f45\u0f72\u0f42",hh:"%d \u0f46\u0f74\u0f0b\u0f5a\u0f7c\u0f51",d:"\u0f49\u0f72\u0f53\u0f0b\u0f42\u0f45\u0f72\u0f42",dd:"%d \u0f49\u0f72\u0f53\u0f0b",M:"\u0f5f\u0fb3\u0f0b\u0f56\u0f0b\u0f42\u0f45\u0f72\u0f42",MM:"%d \u0f5f\u0fb3\u0f0b\u0f56",y:"\u0f63\u0f7c\u0f0b\u0f42\u0f45\u0f72\u0f42",yy:"%d \u0f63\u0f7c"},preparse:function(e){return e.replace(/[\u0f21\u0f22\u0f23\u0f24\u0f25\u0f26\u0f27\u0f28\u0f29\u0f20]/g,function(e){return f[e]})},postformat:function(e){return e.replace(/\d/g,function(e){return T[e]})},meridiemParse:/\u0f58\u0f5a\u0f53\u0f0b\u0f58\u0f7c|\u0f5e\u0f7c\u0f42\u0f66\u0f0b\u0f40\u0f66|\u0f49\u0f72\u0f53\u0f0b\u0f42\u0f74\u0f44|\u0f51\u0f42\u0f7c\u0f44\u0f0b\u0f51\u0f42|\u0f58\u0f5a\u0f53\u0f0b\u0f58\u0f7c/,meridiemHour:function(e,a){return 12===e&&(e=0),"\u0f58\u0f5a\u0f53\u0f0b\u0f58\u0f7c"===a&&4<=e||"\u0f49\u0f72\u0f53\u0f0b\u0f42\u0f74\u0f44"===a&&e<5||"\u0f51\u0f42\u0f7c\u0f44\u0f0b\u0f51\u0f42"===a?e+12:e},meridiem:function(e,a,_){return e<4?"\u0f58\u0f5a\u0f53\u0f0b\u0f58\u0f7c":e<10?"\u0f5e\u0f7c\u0f42\u0f66\u0f0b\u0f40\u0f66":e<17?"\u0f49\u0f72\u0f53\u0f0b\u0f42\u0f74\u0f44":e<20?"\u0f51\u0f42\u0f7c\u0f44\u0f0b\u0f51\u0f42":"\u0f58\u0f5a\u0f53\u0f0b\u0f58\u0f7c"},week:{dow:0,doy:6}});var w=[/^gen/i,/^c[\u02bc\']hwe/i,/^meu/i,/^ebr/i,/^mae/i,/^(mez|eve)/i,/^gou/i,/^eos/i,/^gwe/i,/^her/i,/^du/i,/^ker/i],H=/^(genver|c[\u02bc\']hwevrer|meurzh|ebrel|mae|mezheven|gouere|eost|gwengolo|here|du|kerzu|gen|c[\u02bc\']hwe|meu|ebr|mae|eve|gou|eos|gwe|her|du|ker)/i,b=[/^Su/i,/^Lu/i,/^Me([^r]|$)/i,/^Mer/i,/^Ya/i,/^Gw/i,/^Sa/i];function v(e,a,_){var s=e+" ";switch(_){case"ss":return s+=1===e?"sekunda":2===e||3===e||4===e?"sekunde":"sekundi";case"m":return a?"jedna minuta":"jedne minute";case"mm":return s+=1!==e&&(2===e||3===e||4===e)?"minute":"minuta";case"h":return a?"jedan sat":"jednog sata";case"hh":return s+=1===e?"sat":2===e||3===e||4===e?"sata":"sati";case"dd":return s+=1===e?"dan":"dana";case"MM":return s+=1===e?"mjesec":2===e||3===e||4===e?"mjeseca":"mjeseci";case"yy":return s+=1!==e&&(2===e||3===e||4===e)?"godine":"godina"}}e.defineLocale("br",{months:"Genver_C\u02bchwevrer_Meurzh_Ebrel_Mae_Mezheven_Gouere_Eost_Gwengolo_Here_Du_Kerzu".split("_"),monthsShort:"Gen_C\u02bchwe_Meu_Ebr_Mae_Eve_Gou_Eos_Gwe_Her_Du_Ker".split("_"),weekdays:"Sul_Lun_Meurzh_Merc\u02bcher_Yaou_Gwener_Sadorn".split("_"),weekdaysShort:"Sul_Lun_Meu_Mer_Yao_Gwe_Sad".split("_"),weekdaysMin:"Su_Lu_Me_Mer_Ya_Gw_Sa".split("_"),weekdaysParse:b,fullWeekdaysParse:[/^sul/i,/^lun/i,/^meurzh/i,/^merc[\u02bc\']her/i,/^yaou/i,/^gwener/i,/^sadorn/i],shortWeekdaysParse:[/^Sul/i,/^Lun/i,/^Meu/i,/^Mer/i,/^Yao/i,/^Gwe/i,/^Sad/i],minWeekdaysParse:b,monthsRegex:H,monthsShortRegex:H,monthsStrictRegex:/^(genver|c[\u02bc\']hwevrer|meurzh|ebrel|mae|mezheven|gouere|eost|gwengolo|here|du|kerzu)/i,monthsShortStrictRegex:/^(gen|c[\u02bc\']hwe|meu|ebr|mae|eve|gou|eos|gwe|her|du|ker)/i,monthsParse:w,longMonthsParse:w,shortMonthsParse:w,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D [a viz] MMMM YYYY",LLL:"D [a viz] MMMM YYYY HH:mm",LLLL:"dddd, D [a viz] MMMM YYYY HH:mm"},calendar:{sameDay:"[Hiziv da] LT",nextDay:"[Warc\u02bchoazh da] LT",nextWeek:"dddd [da] LT",lastDay:"[Dec\u02bch da] LT",lastWeek:"dddd [paset da] LT",sameElse:"L"},relativeTime:{future:"a-benn %s",past:"%s \u02bczo",s:"un nebeud segondenno\xf9",ss:"%d eilenn",m:"ur vunutenn",mm:g,h:"un eur",hh:"%d eur",d:"un devezh",dd:g,M:"ur miz",MM:g,y:"ur bloaz",yy:function(e){switch(function e(a){if(9>> 0, + i; + + for (i = 0; i < len; i++) { + if (i in t && fun.call(this, t[i], i, t)) { + return true; + } + } + + return false; + }; + } + + function isValid(m) { + if (m._isValid == null) { + var flags = getParsingFlags(m), + parsedParts = some.call(flags.parsedDateParts, function (i) { + return i != null; + }), + isNowValid = + !isNaN(m._d.getTime()) && + flags.overflow < 0 && + !flags.empty && + !flags.invalidEra && + !flags.invalidMonth && + !flags.invalidWeekday && + !flags.weekdayMismatch && + !flags.nullInput && + !flags.invalidFormat && + !flags.userInvalidated && + (!flags.meridiem || (flags.meridiem && parsedParts)); + + if (m._strict) { + isNowValid = + isNowValid && + flags.charsLeftOver === 0 && + flags.unusedTokens.length === 0 && + flags.bigHour === undefined; + } + + if (Object.isFrozen == null || !Object.isFrozen(m)) { + m._isValid = isNowValid; + } else { + return isNowValid; + } + } + return m._isValid; + } + + function createInvalid(flags) { + var m = createUTC(NaN); + if (flags != null) { + extend(getParsingFlags(m), flags); + } else { + getParsingFlags(m).userInvalidated = true; + } + + return m; + } + + // Plugins that add properties should also add the key here (null value), + // so we can properly clone ourselves. + var momentProperties = (hooks.momentProperties = []), + updateInProgress = false; + + function copyConfig(to, from) { + var i, prop, val; + + if (!isUndefined(from._isAMomentObject)) { + to._isAMomentObject = from._isAMomentObject; + } + if (!isUndefined(from._i)) { + to._i = from._i; + } + if (!isUndefined(from._f)) { + to._f = from._f; + } + if (!isUndefined(from._l)) { + to._l = from._l; + } + if (!isUndefined(from._strict)) { + to._strict = from._strict; + } + if (!isUndefined(from._tzm)) { + to._tzm = from._tzm; + } + if (!isUndefined(from._isUTC)) { + to._isUTC = from._isUTC; + } + if (!isUndefined(from._offset)) { + to._offset = from._offset; + } + if (!isUndefined(from._pf)) { + to._pf = getParsingFlags(from); + } + if (!isUndefined(from._locale)) { + to._locale = from._locale; + } + + if (momentProperties.length > 0) { + for (i = 0; i < momentProperties.length; i++) { + prop = momentProperties[i]; + val = from[prop]; + if (!isUndefined(val)) { + to[prop] = val; + } + } + } + + return to; + } + + // Moment prototype object + function Moment(config) { + copyConfig(this, config); + this._d = new Date(config._d != null ? config._d.getTime() : NaN); + if (!this.isValid()) { + this._d = new Date(NaN); + } + // Prevent infinite loop in case updateOffset creates new moment + // objects. + if (updateInProgress === false) { + updateInProgress = true; + hooks.updateOffset(this); + updateInProgress = false; + } + } + + function isMoment(obj) { + return ( + obj instanceof Moment || (obj != null && obj._isAMomentObject != null) + ); + } + + function warn(msg) { + if ( + hooks.suppressDeprecationWarnings === false && + typeof console !== 'undefined' && + console.warn + ) { + console.warn('Deprecation warning: ' + msg); + } + } + + function deprecate(msg, fn) { + var firstTime = true; + + return extend(function () { + if (hooks.deprecationHandler != null) { + hooks.deprecationHandler(null, msg); + } + if (firstTime) { + var args = [], + arg, + i, + key; + for (i = 0; i < arguments.length; i++) { + arg = ''; + if (typeof arguments[i] === 'object') { + arg += '\n[' + i + '] '; + for (key in arguments[0]) { + if (hasOwnProp(arguments[0], key)) { + arg += key + ': ' + arguments[0][key] + ', '; + } + } + arg = arg.slice(0, -2); // Remove trailing comma and space + } else { + arg = arguments[i]; + } + args.push(arg); + } + warn( + msg + + '\nArguments: ' + + Array.prototype.slice.call(args).join('') + + '\n' + + new Error().stack + ); + firstTime = false; + } + return fn.apply(this, arguments); + }, fn); + } + + var deprecations = {}; + + function deprecateSimple(name, msg) { + if (hooks.deprecationHandler != null) { + hooks.deprecationHandler(name, msg); + } + if (!deprecations[name]) { + warn(msg); + deprecations[name] = true; + } + } + + hooks.suppressDeprecationWarnings = false; + hooks.deprecationHandler = null; + + function isFunction(input) { + return ( + (typeof Function !== 'undefined' && input instanceof Function) || + Object.prototype.toString.call(input) === '[object Function]' + ); + } + + function set(config) { + var prop, i; + for (i in config) { + if (hasOwnProp(config, i)) { + prop = config[i]; + if (isFunction(prop)) { + this[i] = prop; + } else { + this['_' + i] = prop; + } + } + } + this._config = config; + // Lenient ordinal parsing accepts just a number in addition to + // number + (possibly) stuff coming from _dayOfMonthOrdinalParse. + // TODO: Remove "ordinalParse" fallback in next major release. + this._dayOfMonthOrdinalParseLenient = new RegExp( + (this._dayOfMonthOrdinalParse.source || this._ordinalParse.source) + + '|' + + /\d{1,2}/.source + ); + } + + function mergeConfigs(parentConfig, childConfig) { + var res = extend({}, parentConfig), + prop; + for (prop in childConfig) { + if (hasOwnProp(childConfig, prop)) { + if (isObject(parentConfig[prop]) && isObject(childConfig[prop])) { + res[prop] = {}; + extend(res[prop], parentConfig[prop]); + extend(res[prop], childConfig[prop]); + } else if (childConfig[prop] != null) { + res[prop] = childConfig[prop]; + } else { + delete res[prop]; + } + } + } + for (prop in parentConfig) { + if ( + hasOwnProp(parentConfig, prop) && + !hasOwnProp(childConfig, prop) && + isObject(parentConfig[prop]) + ) { + // make sure changes to properties don't modify parent config + res[prop] = extend({}, res[prop]); + } + } + return res; + } + + function Locale(config) { + if (config != null) { + this.set(config); + } + } + + var keys; + + if (Object.keys) { + keys = Object.keys; + } else { + keys = function (obj) { + var i, + res = []; + for (i in obj) { + if (hasOwnProp(obj, i)) { + res.push(i); + } + } + return res; + }; + } + + var defaultCalendar = { + sameDay: '[Today at] LT', + nextDay: '[Tomorrow at] LT', + nextWeek: 'dddd [at] LT', + lastDay: '[Yesterday at] LT', + lastWeek: '[Last] dddd [at] LT', + sameElse: 'L', + }; + + function calendar(key, mom, now) { + var output = this._calendar[key] || this._calendar['sameElse']; + return isFunction(output) ? output.call(mom, now) : output; + } + + function zeroFill(number, targetLength, forceSign) { + var absNumber = '' + Math.abs(number), + zerosToFill = targetLength - absNumber.length, + sign = number >= 0; + return ( + (sign ? (forceSign ? '+' : '') : '-') + + Math.pow(10, Math.max(0, zerosToFill)).toString().substr(1) + + absNumber + ); + } + + var formattingTokens = /(\[[^\[]*\])|(\\)?([Hh]mm(ss)?|Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Qo?|N{1,5}|YYYYYY|YYYYY|YYYY|YY|y{2,4}|yo?|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|kk?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g, + localFormattingTokens = /(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g, + formatFunctions = {}, + formatTokenFunctions = {}; + + // token: 'M' + // padded: ['MM', 2] + // ordinal: 'Mo' + // callback: function () { this.month() + 1 } + function addFormatToken(token, padded, ordinal, callback) { + var func = callback; + if (typeof callback === 'string') { + func = function () { + return this[callback](); + }; + } + if (token) { + formatTokenFunctions[token] = func; + } + if (padded) { + formatTokenFunctions[padded[0]] = function () { + return zeroFill(func.apply(this, arguments), padded[1], padded[2]); + }; + } + if (ordinal) { + formatTokenFunctions[ordinal] = function () { + return this.localeData().ordinal( + func.apply(this, arguments), + token + ); + }; + } + } + + function removeFormattingTokens(input) { + if (input.match(/\[[\s\S]/)) { + return input.replace(/^\[|\]$/g, ''); + } + return input.replace(/\\/g, ''); + } + + function makeFormatFunction(format) { + var array = format.match(formattingTokens), + i, + length; + + for (i = 0, length = array.length; i < length; i++) { + if (formatTokenFunctions[array[i]]) { + array[i] = formatTokenFunctions[array[i]]; + } else { + array[i] = removeFormattingTokens(array[i]); + } + } + + return function (mom) { + var output = '', + i; + for (i = 0; i < length; i++) { + output += isFunction(array[i]) + ? array[i].call(mom, format) + : array[i]; + } + return output; + }; + } + + // format date using native date object + function formatMoment(m, format) { + if (!m.isValid()) { + return m.localeData().invalidDate(); + } + + format = expandFormat(format, m.localeData()); + formatFunctions[format] = + formatFunctions[format] || makeFormatFunction(format); + + return formatFunctions[format](m); + } + + function expandFormat(format, locale) { + var i = 5; + + function replaceLongDateFormatTokens(input) { + return locale.longDateFormat(input) || input; + } + + localFormattingTokens.lastIndex = 0; + while (i >= 0 && localFormattingTokens.test(format)) { + format = format.replace( + localFormattingTokens, + replaceLongDateFormatTokens + ); + localFormattingTokens.lastIndex = 0; + i -= 1; + } + + return format; + } + + var defaultLongDateFormat = { + LTS: 'h:mm:ss A', + LT: 'h:mm A', + L: 'MM/DD/YYYY', + LL: 'MMMM D, YYYY', + LLL: 'MMMM D, YYYY h:mm A', + LLLL: 'dddd, MMMM D, YYYY h:mm A', + }; + + function longDateFormat(key) { + var format = this._longDateFormat[key], + formatUpper = this._longDateFormat[key.toUpperCase()]; + + if (format || !formatUpper) { + return format; + } + + this._longDateFormat[key] = formatUpper + .match(formattingTokens) + .map(function (tok) { + if ( + tok === 'MMMM' || + tok === 'MM' || + tok === 'DD' || + tok === 'dddd' + ) { + return tok.slice(1); + } + return tok; + }) + .join(''); + + return this._longDateFormat[key]; + } + + var defaultInvalidDate = 'Invalid date'; + + function invalidDate() { + return this._invalidDate; + } + + var defaultOrdinal = '%d', + defaultDayOfMonthOrdinalParse = /\d{1,2}/; + + function ordinal(number) { + return this._ordinal.replace('%d', number); + } + + var defaultRelativeTime = { + future: 'in %s', + past: '%s ago', + s: 'a few seconds', + ss: '%d seconds', + m: 'a minute', + mm: '%d minutes', + h: 'an hour', + hh: '%d hours', + d: 'a day', + dd: '%d days', + w: 'a week', + ww: '%d weeks', + M: 'a month', + MM: '%d months', + y: 'a year', + yy: '%d years', + }; + + function relativeTime(number, withoutSuffix, string, isFuture) { + var output = this._relativeTime[string]; + return isFunction(output) + ? output(number, withoutSuffix, string, isFuture) + : output.replace(/%d/i, number); + } + + function pastFuture(diff, output) { + var format = this._relativeTime[diff > 0 ? 'future' : 'past']; + return isFunction(format) ? format(output) : format.replace(/%s/i, output); + } + + var aliases = {}; + + function addUnitAlias(unit, shorthand) { + var lowerCase = unit.toLowerCase(); + aliases[lowerCase] = aliases[lowerCase + 's'] = aliases[shorthand] = unit; + } + + function normalizeUnits(units) { + return typeof units === 'string' + ? aliases[units] || aliases[units.toLowerCase()] + : undefined; + } + + function normalizeObjectUnits(inputObject) { + var normalizedInput = {}, + normalizedProp, + prop; + + for (prop in inputObject) { + if (hasOwnProp(inputObject, prop)) { + normalizedProp = normalizeUnits(prop); + if (normalizedProp) { + normalizedInput[normalizedProp] = inputObject[prop]; + } + } + } + + return normalizedInput; + } + + var priorities = {}; + + function addUnitPriority(unit, priority) { + priorities[unit] = priority; + } + + function getPrioritizedUnits(unitsObj) { + var units = [], + u; + for (u in unitsObj) { + if (hasOwnProp(unitsObj, u)) { + units.push({ unit: u, priority: priorities[u] }); + } + } + units.sort(function (a, b) { + return a.priority - b.priority; + }); + return units; + } + + function isLeapYear(year) { + return (year % 4 === 0 && year % 100 !== 0) || year % 400 === 0; + } + + function absFloor(number) { + if (number < 0) { + // -0 -> 0 + return Math.ceil(number) || 0; + } else { + return Math.floor(number); + } + } + + function toInt(argumentForCoercion) { + var coercedNumber = +argumentForCoercion, + value = 0; + + if (coercedNumber !== 0 && isFinite(coercedNumber)) { + value = absFloor(coercedNumber); + } + + return value; + } + + function makeGetSet(unit, keepTime) { + return function (value) { + if (value != null) { + set$1(this, unit, value); + hooks.updateOffset(this, keepTime); + return this; + } else { + return get(this, unit); + } + }; + } + + function get(mom, unit) { + return mom.isValid() + ? mom._d['get' + (mom._isUTC ? 'UTC' : '') + unit]() + : NaN; + } + + function set$1(mom, unit, value) { + if (mom.isValid() && !isNaN(value)) { + if ( + unit === 'FullYear' && + isLeapYear(mom.year()) && + mom.month() === 1 && + mom.date() === 29 + ) { + value = toInt(value); + mom._d['set' + (mom._isUTC ? 'UTC' : '') + unit]( + value, + mom.month(), + daysInMonth(value, mom.month()) + ); + } else { + mom._d['set' + (mom._isUTC ? 'UTC' : '') + unit](value); + } + } + } + + // MOMENTS + + function stringGet(units) { + units = normalizeUnits(units); + if (isFunction(this[units])) { + return this[units](); + } + return this; + } + + function stringSet(units, value) { + if (typeof units === 'object') { + units = normalizeObjectUnits(units); + var prioritized = getPrioritizedUnits(units), + i; + for (i = 0; i < prioritized.length; i++) { + this[prioritized[i].unit](units[prioritized[i].unit]); + } + } else { + units = normalizeUnits(units); + if (isFunction(this[units])) { + return this[units](value); + } + } + return this; + } + + var match1 = /\d/, // 0 - 9 + match2 = /\d\d/, // 00 - 99 + match3 = /\d{3}/, // 000 - 999 + match4 = /\d{4}/, // 0000 - 9999 + match6 = /[+-]?\d{6}/, // -999999 - 999999 + match1to2 = /\d\d?/, // 0 - 99 + match3to4 = /\d\d\d\d?/, // 999 - 9999 + match5to6 = /\d\d\d\d\d\d?/, // 99999 - 999999 + match1to3 = /\d{1,3}/, // 0 - 999 + match1to4 = /\d{1,4}/, // 0 - 9999 + match1to6 = /[+-]?\d{1,6}/, // -999999 - 999999 + matchUnsigned = /\d+/, // 0 - inf + matchSigned = /[+-]?\d+/, // -inf - inf + matchOffset = /Z|[+-]\d\d:?\d\d/gi, // +00:00 -00:00 +0000 -0000 or Z + matchShortOffset = /Z|[+-]\d\d(?::?\d\d)?/gi, // +00 -00 +00:00 -00:00 +0000 -0000 or Z + matchTimestamp = /[+-]?\d+(\.\d{1,3})?/, // 123456789 123456789.123 + // any word (or two) characters or numbers including two/three word month in arabic. + // includes scottish gaelic two word and hyphenated months + matchWord = /[0-9]{0,256}['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFF07\uFF10-\uFFEF]{1,256}|[\u0600-\u06FF\/]{1,256}(\s*?[\u0600-\u06FF]{1,256}){1,2}/i, + regexes; + + regexes = {}; + + function addRegexToken(token, regex, strictRegex) { + regexes[token] = isFunction(regex) + ? regex + : function (isStrict, localeData) { + return isStrict && strictRegex ? strictRegex : regex; + }; + } + + function getParseRegexForToken(token, config) { + if (!hasOwnProp(regexes, token)) { + return new RegExp(unescapeFormat(token)); + } + + return regexes[token](config._strict, config._locale); + } + + // Code from http://stackoverflow.com/questions/3561493/is-there-a-regexp-escape-function-in-javascript + function unescapeFormat(s) { + return regexEscape( + s + .replace('\\', '') + .replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g, function ( + matched, + p1, + p2, + p3, + p4 + ) { + return p1 || p2 || p3 || p4; + }) + ); + } + + function regexEscape(s) { + return s.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&'); + } + + var tokens = {}; + + function addParseToken(token, callback) { + var i, + func = callback; + if (typeof token === 'string') { + token = [token]; + } + if (isNumber(callback)) { + func = function (input, array) { + array[callback] = toInt(input); + }; + } + for (i = 0; i < token.length; i++) { + tokens[token[i]] = func; + } + } + + function addWeekParseToken(token, callback) { + addParseToken(token, function (input, array, config, token) { + config._w = config._w || {}; + callback(input, config._w, config, token); + }); + } + + function addTimeToArrayFromToken(token, input, config) { + if (input != null && hasOwnProp(tokens, token)) { + tokens[token](input, config._a, config, token); + } + } + + var YEAR = 0, + MONTH = 1, + DATE = 2, + HOUR = 3, + MINUTE = 4, + SECOND = 5, + MILLISECOND = 6, + WEEK = 7, + WEEKDAY = 8; + + function mod(n, x) { + return ((n % x) + x) % x; + } + + var indexOf; + + if (Array.prototype.indexOf) { + indexOf = Array.prototype.indexOf; + } else { + indexOf = function (o) { + // I know + var i; + for (i = 0; i < this.length; ++i) { + if (this[i] === o) { + return i; + } + } + return -1; + }; + } + + function daysInMonth(year, month) { + if (isNaN(year) || isNaN(month)) { + return NaN; + } + var modMonth = mod(month, 12); + year += (month - modMonth) / 12; + return modMonth === 1 + ? isLeapYear(year) + ? 29 + : 28 + : 31 - ((modMonth % 7) % 2); + } + + // FORMATTING + + addFormatToken('M', ['MM', 2], 'Mo', function () { + return this.month() + 1; + }); + + addFormatToken('MMM', 0, 0, function (format) { + return this.localeData().monthsShort(this, format); + }); + + addFormatToken('MMMM', 0, 0, function (format) { + return this.localeData().months(this, format); + }); + + // ALIASES + + addUnitAlias('month', 'M'); + + // PRIORITY + + addUnitPriority('month', 8); + + // PARSING + + addRegexToken('M', match1to2); + addRegexToken('MM', match1to2, match2); + addRegexToken('MMM', function (isStrict, locale) { + return locale.monthsShortRegex(isStrict); + }); + addRegexToken('MMMM', function (isStrict, locale) { + return locale.monthsRegex(isStrict); + }); + + addParseToken(['M', 'MM'], function (input, array) { + array[MONTH] = toInt(input) - 1; + }); + + addParseToken(['MMM', 'MMMM'], function (input, array, config, token) { + var month = config._locale.monthsParse(input, token, config._strict); + // if we didn't find a month name, mark the date as invalid. + if (month != null) { + array[MONTH] = month; + } else { + getParsingFlags(config).invalidMonth = input; + } + }); + + // LOCALES + + var defaultLocaleMonths = 'January_February_March_April_May_June_July_August_September_October_November_December'.split( + '_' + ), + defaultLocaleMonthsShort = 'Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec'.split( + '_' + ), + MONTHS_IN_FORMAT = /D[oD]?(\[[^\[\]]*\]|\s)+MMMM?/, + defaultMonthsShortRegex = matchWord, + defaultMonthsRegex = matchWord; + + function localeMonths(m, format) { + if (!m) { + return isArray(this._months) + ? this._months + : this._months['standalone']; + } + return isArray(this._months) + ? this._months[m.month()] + : this._months[ + (this._months.isFormat || MONTHS_IN_FORMAT).test(format) + ? 'format' + : 'standalone' + ][m.month()]; + } + + function localeMonthsShort(m, format) { + if (!m) { + return isArray(this._monthsShort) + ? this._monthsShort + : this._monthsShort['standalone']; + } + return isArray(this._monthsShort) + ? this._monthsShort[m.month()] + : this._monthsShort[ + MONTHS_IN_FORMAT.test(format) ? 'format' : 'standalone' + ][m.month()]; + } + + function handleStrictParse(monthName, format, strict) { + var i, + ii, + mom, + llc = monthName.toLocaleLowerCase(); + if (!this._monthsParse) { + // this is not used + this._monthsParse = []; + this._longMonthsParse = []; + this._shortMonthsParse = []; + for (i = 0; i < 12; ++i) { + mom = createUTC([2000, i]); + this._shortMonthsParse[i] = this.monthsShort( + mom, + '' + ).toLocaleLowerCase(); + this._longMonthsParse[i] = this.months(mom, '').toLocaleLowerCase(); + } + } + + if (strict) { + if (format === 'MMM') { + ii = indexOf.call(this._shortMonthsParse, llc); + return ii !== -1 ? ii : null; + } else { + ii = indexOf.call(this._longMonthsParse, llc); + return ii !== -1 ? ii : null; + } + } else { + if (format === 'MMM') { + ii = indexOf.call(this._shortMonthsParse, llc); + if (ii !== -1) { + return ii; + } + ii = indexOf.call(this._longMonthsParse, llc); + return ii !== -1 ? ii : null; + } else { + ii = indexOf.call(this._longMonthsParse, llc); + if (ii !== -1) { + return ii; + } + ii = indexOf.call(this._shortMonthsParse, llc); + return ii !== -1 ? ii : null; + } + } + } + + function localeMonthsParse(monthName, format, strict) { + var i, mom, regex; + + if (this._monthsParseExact) { + return handleStrictParse.call(this, monthName, format, strict); + } + + if (!this._monthsParse) { + this._monthsParse = []; + this._longMonthsParse = []; + this._shortMonthsParse = []; + } + + // TODO: add sorting + // Sorting makes sure if one month (or abbr) is a prefix of another + // see sorting in computeMonthsParse + for (i = 0; i < 12; i++) { + // make the regex if we don't have it already + mom = createUTC([2000, i]); + if (strict && !this._longMonthsParse[i]) { + this._longMonthsParse[i] = new RegExp( + '^' + this.months(mom, '').replace('.', '') + '$', + 'i' + ); + this._shortMonthsParse[i] = new RegExp( + '^' + this.monthsShort(mom, '').replace('.', '') + '$', + 'i' + ); + } + if (!strict && !this._monthsParse[i]) { + regex = + '^' + this.months(mom, '') + '|^' + this.monthsShort(mom, ''); + this._monthsParse[i] = new RegExp(regex.replace('.', ''), 'i'); + } + // test the regex + if ( + strict && + format === 'MMMM' && + this._longMonthsParse[i].test(monthName) + ) { + return i; + } else if ( + strict && + format === 'MMM' && + this._shortMonthsParse[i].test(monthName) + ) { + return i; + } else if (!strict && this._monthsParse[i].test(monthName)) { + return i; + } + } + } + + // MOMENTS + + function setMonth(mom, value) { + var dayOfMonth; + + if (!mom.isValid()) { + // No op + return mom; + } + + if (typeof value === 'string') { + if (/^\d+$/.test(value)) { + value = toInt(value); + } else { + value = mom.localeData().monthsParse(value); + // TODO: Another silent failure? + if (!isNumber(value)) { + return mom; + } + } + } + + dayOfMonth = Math.min(mom.date(), daysInMonth(mom.year(), value)); + mom._d['set' + (mom._isUTC ? 'UTC' : '') + 'Month'](value, dayOfMonth); + return mom; + } + + function getSetMonth(value) { + if (value != null) { + setMonth(this, value); + hooks.updateOffset(this, true); + return this; + } else { + return get(this, 'Month'); + } + } + + function getDaysInMonth() { + return daysInMonth(this.year(), this.month()); + } + + function monthsShortRegex(isStrict) { + if (this._monthsParseExact) { + if (!hasOwnProp(this, '_monthsRegex')) { + computeMonthsParse.call(this); + } + if (isStrict) { + return this._monthsShortStrictRegex; + } else { + return this._monthsShortRegex; + } + } else { + if (!hasOwnProp(this, '_monthsShortRegex')) { + this._monthsShortRegex = defaultMonthsShortRegex; + } + return this._monthsShortStrictRegex && isStrict + ? this._monthsShortStrictRegex + : this._monthsShortRegex; + } + } + + function monthsRegex(isStrict) { + if (this._monthsParseExact) { + if (!hasOwnProp(this, '_monthsRegex')) { + computeMonthsParse.call(this); + } + if (isStrict) { + return this._monthsStrictRegex; + } else { + return this._monthsRegex; + } + } else { + if (!hasOwnProp(this, '_monthsRegex')) { + this._monthsRegex = defaultMonthsRegex; + } + return this._monthsStrictRegex && isStrict + ? this._monthsStrictRegex + : this._monthsRegex; + } + } + + function computeMonthsParse() { + function cmpLenRev(a, b) { + return b.length - a.length; + } + + var shortPieces = [], + longPieces = [], + mixedPieces = [], + i, + mom; + for (i = 0; i < 12; i++) { + // make the regex if we don't have it already + mom = createUTC([2000, i]); + shortPieces.push(this.monthsShort(mom, '')); + longPieces.push(this.months(mom, '')); + mixedPieces.push(this.months(mom, '')); + mixedPieces.push(this.monthsShort(mom, '')); + } + // Sorting makes sure if one month (or abbr) is a prefix of another it + // will match the longer piece. + shortPieces.sort(cmpLenRev); + longPieces.sort(cmpLenRev); + mixedPieces.sort(cmpLenRev); + for (i = 0; i < 12; i++) { + shortPieces[i] = regexEscape(shortPieces[i]); + longPieces[i] = regexEscape(longPieces[i]); + } + for (i = 0; i < 24; i++) { + mixedPieces[i] = regexEscape(mixedPieces[i]); + } + + this._monthsRegex = new RegExp('^(' + mixedPieces.join('|') + ')', 'i'); + this._monthsShortRegex = this._monthsRegex; + this._monthsStrictRegex = new RegExp( + '^(' + longPieces.join('|') + ')', + 'i' + ); + this._monthsShortStrictRegex = new RegExp( + '^(' + shortPieces.join('|') + ')', + 'i' + ); + } + + // FORMATTING + + addFormatToken('Y', 0, 0, function () { + var y = this.year(); + return y <= 9999 ? zeroFill(y, 4) : '+' + y; + }); + + addFormatToken(0, ['YY', 2], 0, function () { + return this.year() % 100; + }); + + addFormatToken(0, ['YYYY', 4], 0, 'year'); + addFormatToken(0, ['YYYYY', 5], 0, 'year'); + addFormatToken(0, ['YYYYYY', 6, true], 0, 'year'); + + // ALIASES + + addUnitAlias('year', 'y'); + + // PRIORITIES + + addUnitPriority('year', 1); + + // PARSING + + addRegexToken('Y', matchSigned); + addRegexToken('YY', match1to2, match2); + addRegexToken('YYYY', match1to4, match4); + addRegexToken('YYYYY', match1to6, match6); + addRegexToken('YYYYYY', match1to6, match6); + + addParseToken(['YYYYY', 'YYYYYY'], YEAR); + addParseToken('YYYY', function (input, array) { + array[YEAR] = + input.length === 2 ? hooks.parseTwoDigitYear(input) : toInt(input); + }); + addParseToken('YY', function (input, array) { + array[YEAR] = hooks.parseTwoDigitYear(input); + }); + addParseToken('Y', function (input, array) { + array[YEAR] = parseInt(input, 10); + }); + + // HELPERS + + function daysInYear(year) { + return isLeapYear(year) ? 366 : 365; + } + + // HOOKS + + hooks.parseTwoDigitYear = function (input) { + return toInt(input) + (toInt(input) > 68 ? 1900 : 2000); + }; + + // MOMENTS + + var getSetYear = makeGetSet('FullYear', true); + + function getIsLeapYear() { + return isLeapYear(this.year()); + } + + function createDate(y, m, d, h, M, s, ms) { + // can't just apply() to create a date: + // https://stackoverflow.com/q/181348 + var date; + // the date constructor remaps years 0-99 to 1900-1999 + if (y < 100 && y >= 0) { + // preserve leap years using a full 400 year cycle, then reset + date = new Date(y + 400, m, d, h, M, s, ms); + if (isFinite(date.getFullYear())) { + date.setFullYear(y); + } + } else { + date = new Date(y, m, d, h, M, s, ms); + } + + return date; + } + + function createUTCDate(y) { + var date, args; + // the Date.UTC function remaps years 0-99 to 1900-1999 + if (y < 100 && y >= 0) { + args = Array.prototype.slice.call(arguments); + // preserve leap years using a full 400 year cycle, then reset + args[0] = y + 400; + date = new Date(Date.UTC.apply(null, args)); + if (isFinite(date.getUTCFullYear())) { + date.setUTCFullYear(y); + } + } else { + date = new Date(Date.UTC.apply(null, arguments)); + } + + return date; + } + + // start-of-first-week - start-of-year + function firstWeekOffset(year, dow, doy) { + var // first-week day -- which january is always in the first week (4 for iso, 1 for other) + fwd = 7 + dow - doy, + // first-week day local weekday -- which local weekday is fwd + fwdlw = (7 + createUTCDate(year, 0, fwd).getUTCDay() - dow) % 7; + + return -fwdlw + fwd - 1; + } + + // https://en.wikipedia.org/wiki/ISO_week_date#Calculating_a_date_given_the_year.2C_week_number_and_weekday + function dayOfYearFromWeeks(year, week, weekday, dow, doy) { + var localWeekday = (7 + weekday - dow) % 7, + weekOffset = firstWeekOffset(year, dow, doy), + dayOfYear = 1 + 7 * (week - 1) + localWeekday + weekOffset, + resYear, + resDayOfYear; + + if (dayOfYear <= 0) { + resYear = year - 1; + resDayOfYear = daysInYear(resYear) + dayOfYear; + } else if (dayOfYear > daysInYear(year)) { + resYear = year + 1; + resDayOfYear = dayOfYear - daysInYear(year); + } else { + resYear = year; + resDayOfYear = dayOfYear; + } + + return { + year: resYear, + dayOfYear: resDayOfYear, + }; + } + + function weekOfYear(mom, dow, doy) { + var weekOffset = firstWeekOffset(mom.year(), dow, doy), + week = Math.floor((mom.dayOfYear() - weekOffset - 1) / 7) + 1, + resWeek, + resYear; + + if (week < 1) { + resYear = mom.year() - 1; + resWeek = week + weeksInYear(resYear, dow, doy); + } else if (week > weeksInYear(mom.year(), dow, doy)) { + resWeek = week - weeksInYear(mom.year(), dow, doy); + resYear = mom.year() + 1; + } else { + resYear = mom.year(); + resWeek = week; + } + + return { + week: resWeek, + year: resYear, + }; + } + + function weeksInYear(year, dow, doy) { + var weekOffset = firstWeekOffset(year, dow, doy), + weekOffsetNext = firstWeekOffset(year + 1, dow, doy); + return (daysInYear(year) - weekOffset + weekOffsetNext) / 7; + } + + // FORMATTING + + addFormatToken('w', ['ww', 2], 'wo', 'week'); + addFormatToken('W', ['WW', 2], 'Wo', 'isoWeek'); + + // ALIASES + + addUnitAlias('week', 'w'); + addUnitAlias('isoWeek', 'W'); + + // PRIORITIES + + addUnitPriority('week', 5); + addUnitPriority('isoWeek', 5); + + // PARSING + + addRegexToken('w', match1to2); + addRegexToken('ww', match1to2, match2); + addRegexToken('W', match1to2); + addRegexToken('WW', match1to2, match2); + + addWeekParseToken(['w', 'ww', 'W', 'WW'], function ( + input, + week, + config, + token + ) { + week[token.substr(0, 1)] = toInt(input); + }); + + // HELPERS + + // LOCALES + + function localeWeek(mom) { + return weekOfYear(mom, this._week.dow, this._week.doy).week; + } + + var defaultLocaleWeek = { + dow: 0, // Sunday is the first day of the week. + doy: 6, // The week that contains Jan 6th is the first week of the year. + }; + + function localeFirstDayOfWeek() { + return this._week.dow; + } + + function localeFirstDayOfYear() { + return this._week.doy; + } + + // MOMENTS + + function getSetWeek(input) { + var week = this.localeData().week(this); + return input == null ? week : this.add((input - week) * 7, 'd'); + } + + function getSetISOWeek(input) { + var week = weekOfYear(this, 1, 4).week; + return input == null ? week : this.add((input - week) * 7, 'd'); + } + + // FORMATTING + + addFormatToken('d', 0, 'do', 'day'); + + addFormatToken('dd', 0, 0, function (format) { + return this.localeData().weekdaysMin(this, format); + }); + + addFormatToken('ddd', 0, 0, function (format) { + return this.localeData().weekdaysShort(this, format); + }); + + addFormatToken('dddd', 0, 0, function (format) { + return this.localeData().weekdays(this, format); + }); + + addFormatToken('e', 0, 0, 'weekday'); + addFormatToken('E', 0, 0, 'isoWeekday'); + + // ALIASES + + addUnitAlias('day', 'd'); + addUnitAlias('weekday', 'e'); + addUnitAlias('isoWeekday', 'E'); + + // PRIORITY + addUnitPriority('day', 11); + addUnitPriority('weekday', 11); + addUnitPriority('isoWeekday', 11); + + // PARSING + + addRegexToken('d', match1to2); + addRegexToken('e', match1to2); + addRegexToken('E', match1to2); + addRegexToken('dd', function (isStrict, locale) { + return locale.weekdaysMinRegex(isStrict); + }); + addRegexToken('ddd', function (isStrict, locale) { + return locale.weekdaysShortRegex(isStrict); + }); + addRegexToken('dddd', function (isStrict, locale) { + return locale.weekdaysRegex(isStrict); + }); + + addWeekParseToken(['dd', 'ddd', 'dddd'], function (input, week, config, token) { + var weekday = config._locale.weekdaysParse(input, token, config._strict); + // if we didn't get a weekday name, mark the date as invalid + if (weekday != null) { + week.d = weekday; + } else { + getParsingFlags(config).invalidWeekday = input; + } + }); + + addWeekParseToken(['d', 'e', 'E'], function (input, week, config, token) { + week[token] = toInt(input); + }); + + // HELPERS + + function parseWeekday(input, locale) { + if (typeof input !== 'string') { + return input; + } + + if (!isNaN(input)) { + return parseInt(input, 10); + } + + input = locale.weekdaysParse(input); + if (typeof input === 'number') { + return input; + } + + return null; + } + + function parseIsoWeekday(input, locale) { + if (typeof input === 'string') { + return locale.weekdaysParse(input) % 7 || 7; + } + return isNaN(input) ? null : input; + } + + // LOCALES + function shiftWeekdays(ws, n) { + return ws.slice(n, 7).concat(ws.slice(0, n)); + } + + var defaultLocaleWeekdays = 'Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday'.split( + '_' + ), + defaultLocaleWeekdaysShort = 'Sun_Mon_Tue_Wed_Thu_Fri_Sat'.split('_'), + defaultLocaleWeekdaysMin = 'Su_Mo_Tu_We_Th_Fr_Sa'.split('_'), + defaultWeekdaysRegex = matchWord, + defaultWeekdaysShortRegex = matchWord, + defaultWeekdaysMinRegex = matchWord; + + function localeWeekdays(m, format) { + var weekdays = isArray(this._weekdays) + ? this._weekdays + : this._weekdays[ + m && m !== true && this._weekdays.isFormat.test(format) + ? 'format' + : 'standalone' + ]; + return m === true + ? shiftWeekdays(weekdays, this._week.dow) + : m + ? weekdays[m.day()] + : weekdays; + } + + function localeWeekdaysShort(m) { + return m === true + ? shiftWeekdays(this._weekdaysShort, this._week.dow) + : m + ? this._weekdaysShort[m.day()] + : this._weekdaysShort; + } + + function localeWeekdaysMin(m) { + return m === true + ? shiftWeekdays(this._weekdaysMin, this._week.dow) + : m + ? this._weekdaysMin[m.day()] + : this._weekdaysMin; + } + + function handleStrictParse$1(weekdayName, format, strict) { + var i, + ii, + mom, + llc = weekdayName.toLocaleLowerCase(); + if (!this._weekdaysParse) { + this._weekdaysParse = []; + this._shortWeekdaysParse = []; + this._minWeekdaysParse = []; + + for (i = 0; i < 7; ++i) { + mom = createUTC([2000, 1]).day(i); + this._minWeekdaysParse[i] = this.weekdaysMin( + mom, + '' + ).toLocaleLowerCase(); + this._shortWeekdaysParse[i] = this.weekdaysShort( + mom, + '' + ).toLocaleLowerCase(); + this._weekdaysParse[i] = this.weekdays(mom, '').toLocaleLowerCase(); + } + } + + if (strict) { + if (format === 'dddd') { + ii = indexOf.call(this._weekdaysParse, llc); + return ii !== -1 ? ii : null; + } else if (format === 'ddd') { + ii = indexOf.call(this._shortWeekdaysParse, llc); + return ii !== -1 ? ii : null; + } else { + ii = indexOf.call(this._minWeekdaysParse, llc); + return ii !== -1 ? ii : null; + } + } else { + if (format === 'dddd') { + ii = indexOf.call(this._weekdaysParse, llc); + if (ii !== -1) { + return ii; + } + ii = indexOf.call(this._shortWeekdaysParse, llc); + if (ii !== -1) { + return ii; + } + ii = indexOf.call(this._minWeekdaysParse, llc); + return ii !== -1 ? ii : null; + } else if (format === 'ddd') { + ii = indexOf.call(this._shortWeekdaysParse, llc); + if (ii !== -1) { + return ii; + } + ii = indexOf.call(this._weekdaysParse, llc); + if (ii !== -1) { + return ii; + } + ii = indexOf.call(this._minWeekdaysParse, llc); + return ii !== -1 ? ii : null; + } else { + ii = indexOf.call(this._minWeekdaysParse, llc); + if (ii !== -1) { + return ii; + } + ii = indexOf.call(this._weekdaysParse, llc); + if (ii !== -1) { + return ii; + } + ii = indexOf.call(this._shortWeekdaysParse, llc); + return ii !== -1 ? ii : null; + } + } + } + + function localeWeekdaysParse(weekdayName, format, strict) { + var i, mom, regex; + + if (this._weekdaysParseExact) { + return handleStrictParse$1.call(this, weekdayName, format, strict); + } + + if (!this._weekdaysParse) { + this._weekdaysParse = []; + this._minWeekdaysParse = []; + this._shortWeekdaysParse = []; + this._fullWeekdaysParse = []; + } + + for (i = 0; i < 7; i++) { + // make the regex if we don't have it already + + mom = createUTC([2000, 1]).day(i); + if (strict && !this._fullWeekdaysParse[i]) { + this._fullWeekdaysParse[i] = new RegExp( + '^' + this.weekdays(mom, '').replace('.', '\\.?') + '$', + 'i' + ); + this._shortWeekdaysParse[i] = new RegExp( + '^' + this.weekdaysShort(mom, '').replace('.', '\\.?') + '$', + 'i' + ); + this._minWeekdaysParse[i] = new RegExp( + '^' + this.weekdaysMin(mom, '').replace('.', '\\.?') + '$', + 'i' + ); + } + if (!this._weekdaysParse[i]) { + regex = + '^' + + this.weekdays(mom, '') + + '|^' + + this.weekdaysShort(mom, '') + + '|^' + + this.weekdaysMin(mom, ''); + this._weekdaysParse[i] = new RegExp(regex.replace('.', ''), 'i'); + } + // test the regex + if ( + strict && + format === 'dddd' && + this._fullWeekdaysParse[i].test(weekdayName) + ) { + return i; + } else if ( + strict && + format === 'ddd' && + this._shortWeekdaysParse[i].test(weekdayName) + ) { + return i; + } else if ( + strict && + format === 'dd' && + this._minWeekdaysParse[i].test(weekdayName) + ) { + return i; + } else if (!strict && this._weekdaysParse[i].test(weekdayName)) { + return i; + } + } + } + + // MOMENTS + + function getSetDayOfWeek(input) { + if (!this.isValid()) { + return input != null ? this : NaN; + } + var day = this._isUTC ? this._d.getUTCDay() : this._d.getDay(); + if (input != null) { + input = parseWeekday(input, this.localeData()); + return this.add(input - day, 'd'); + } else { + return day; + } + } + + function getSetLocaleDayOfWeek(input) { + if (!this.isValid()) { + return input != null ? this : NaN; + } + var weekday = (this.day() + 7 - this.localeData()._week.dow) % 7; + return input == null ? weekday : this.add(input - weekday, 'd'); + } + + function getSetISODayOfWeek(input) { + if (!this.isValid()) { + return input != null ? this : NaN; + } + + // behaves the same as moment#day except + // as a getter, returns 7 instead of 0 (1-7 range instead of 0-6) + // as a setter, sunday should belong to the previous week. + + if (input != null) { + var weekday = parseIsoWeekday(input, this.localeData()); + return this.day(this.day() % 7 ? weekday : weekday - 7); + } else { + return this.day() || 7; + } + } + + function weekdaysRegex(isStrict) { + if (this._weekdaysParseExact) { + if (!hasOwnProp(this, '_weekdaysRegex')) { + computeWeekdaysParse.call(this); + } + if (isStrict) { + return this._weekdaysStrictRegex; + } else { + return this._weekdaysRegex; + } + } else { + if (!hasOwnProp(this, '_weekdaysRegex')) { + this._weekdaysRegex = defaultWeekdaysRegex; + } + return this._weekdaysStrictRegex && isStrict + ? this._weekdaysStrictRegex + : this._weekdaysRegex; + } + } + + function weekdaysShortRegex(isStrict) { + if (this._weekdaysParseExact) { + if (!hasOwnProp(this, '_weekdaysRegex')) { + computeWeekdaysParse.call(this); + } + if (isStrict) { + return this._weekdaysShortStrictRegex; + } else { + return this._weekdaysShortRegex; + } + } else { + if (!hasOwnProp(this, '_weekdaysShortRegex')) { + this._weekdaysShortRegex = defaultWeekdaysShortRegex; + } + return this._weekdaysShortStrictRegex && isStrict + ? this._weekdaysShortStrictRegex + : this._weekdaysShortRegex; + } + } + + function weekdaysMinRegex(isStrict) { + if (this._weekdaysParseExact) { + if (!hasOwnProp(this, '_weekdaysRegex')) { + computeWeekdaysParse.call(this); + } + if (isStrict) { + return this._weekdaysMinStrictRegex; + } else { + return this._weekdaysMinRegex; + } + } else { + if (!hasOwnProp(this, '_weekdaysMinRegex')) { + this._weekdaysMinRegex = defaultWeekdaysMinRegex; + } + return this._weekdaysMinStrictRegex && isStrict + ? this._weekdaysMinStrictRegex + : this._weekdaysMinRegex; + } + } + + function computeWeekdaysParse() { + function cmpLenRev(a, b) { + return b.length - a.length; + } + + var minPieces = [], + shortPieces = [], + longPieces = [], + mixedPieces = [], + i, + mom, + minp, + shortp, + longp; + for (i = 0; i < 7; i++) { + // make the regex if we don't have it already + mom = createUTC([2000, 1]).day(i); + minp = regexEscape(this.weekdaysMin(mom, '')); + shortp = regexEscape(this.weekdaysShort(mom, '')); + longp = regexEscape(this.weekdays(mom, '')); + minPieces.push(minp); + shortPieces.push(shortp); + longPieces.push(longp); + mixedPieces.push(minp); + mixedPieces.push(shortp); + mixedPieces.push(longp); + } + // Sorting makes sure if one weekday (or abbr) is a prefix of another it + // will match the longer piece. + minPieces.sort(cmpLenRev); + shortPieces.sort(cmpLenRev); + longPieces.sort(cmpLenRev); + mixedPieces.sort(cmpLenRev); + + this._weekdaysRegex = new RegExp('^(' + mixedPieces.join('|') + ')', 'i'); + this._weekdaysShortRegex = this._weekdaysRegex; + this._weekdaysMinRegex = this._weekdaysRegex; + + this._weekdaysStrictRegex = new RegExp( + '^(' + longPieces.join('|') + ')', + 'i' + ); + this._weekdaysShortStrictRegex = new RegExp( + '^(' + shortPieces.join('|') + ')', + 'i' + ); + this._weekdaysMinStrictRegex = new RegExp( + '^(' + minPieces.join('|') + ')', + 'i' + ); + } + + // FORMATTING + + function hFormat() { + return this.hours() % 12 || 12; + } + + function kFormat() { + return this.hours() || 24; + } + + addFormatToken('H', ['HH', 2], 0, 'hour'); + addFormatToken('h', ['hh', 2], 0, hFormat); + addFormatToken('k', ['kk', 2], 0, kFormat); + + addFormatToken('hmm', 0, 0, function () { + return '' + hFormat.apply(this) + zeroFill(this.minutes(), 2); + }); + + addFormatToken('hmmss', 0, 0, function () { + return ( + '' + + hFormat.apply(this) + + zeroFill(this.minutes(), 2) + + zeroFill(this.seconds(), 2) + ); + }); + + addFormatToken('Hmm', 0, 0, function () { + return '' + this.hours() + zeroFill(this.minutes(), 2); + }); + + addFormatToken('Hmmss', 0, 0, function () { + return ( + '' + + this.hours() + + zeroFill(this.minutes(), 2) + + zeroFill(this.seconds(), 2) + ); + }); + + function meridiem(token, lowercase) { + addFormatToken(token, 0, 0, function () { + return this.localeData().meridiem( + this.hours(), + this.minutes(), + lowercase + ); + }); + } + + meridiem('a', true); + meridiem('A', false); + + // ALIASES + + addUnitAlias('hour', 'h'); + + // PRIORITY + addUnitPriority('hour', 13); + + // PARSING + + function matchMeridiem(isStrict, locale) { + return locale._meridiemParse; + } + + addRegexToken('a', matchMeridiem); + addRegexToken('A', matchMeridiem); + addRegexToken('H', match1to2); + addRegexToken('h', match1to2); + addRegexToken('k', match1to2); + addRegexToken('HH', match1to2, match2); + addRegexToken('hh', match1to2, match2); + addRegexToken('kk', match1to2, match2); + + addRegexToken('hmm', match3to4); + addRegexToken('hmmss', match5to6); + addRegexToken('Hmm', match3to4); + addRegexToken('Hmmss', match5to6); + + addParseToken(['H', 'HH'], HOUR); + addParseToken(['k', 'kk'], function (input, array, config) { + var kInput = toInt(input); + array[HOUR] = kInput === 24 ? 0 : kInput; + }); + addParseToken(['a', 'A'], function (input, array, config) { + config._isPm = config._locale.isPM(input); + config._meridiem = input; + }); + addParseToken(['h', 'hh'], function (input, array, config) { + array[HOUR] = toInt(input); + getParsingFlags(config).bigHour = true; + }); + addParseToken('hmm', function (input, array, config) { + var pos = input.length - 2; + array[HOUR] = toInt(input.substr(0, pos)); + array[MINUTE] = toInt(input.substr(pos)); + getParsingFlags(config).bigHour = true; + }); + addParseToken('hmmss', function (input, array, config) { + var pos1 = input.length - 4, + pos2 = input.length - 2; + array[HOUR] = toInt(input.substr(0, pos1)); + array[MINUTE] = toInt(input.substr(pos1, 2)); + array[SECOND] = toInt(input.substr(pos2)); + getParsingFlags(config).bigHour = true; + }); + addParseToken('Hmm', function (input, array, config) { + var pos = input.length - 2; + array[HOUR] = toInt(input.substr(0, pos)); + array[MINUTE] = toInt(input.substr(pos)); + }); + addParseToken('Hmmss', function (input, array, config) { + var pos1 = input.length - 4, + pos2 = input.length - 2; + array[HOUR] = toInt(input.substr(0, pos1)); + array[MINUTE] = toInt(input.substr(pos1, 2)); + array[SECOND] = toInt(input.substr(pos2)); + }); + + // LOCALES + + function localeIsPM(input) { + // IE8 Quirks Mode & IE7 Standards Mode do not allow accessing strings like arrays + // Using charAt should be more compatible. + return (input + '').toLowerCase().charAt(0) === 'p'; + } + + var defaultLocaleMeridiemParse = /[ap]\.?m?\.?/i, + // Setting the hour should keep the time, because the user explicitly + // specified which hour they want. So trying to maintain the same hour (in + // a new timezone) makes sense. Adding/subtracting hours does not follow + // this rule. + getSetHour = makeGetSet('Hours', true); + + function localeMeridiem(hours, minutes, isLower) { + if (hours > 11) { + return isLower ? 'pm' : 'PM'; + } else { + return isLower ? 'am' : 'AM'; + } + } + + var baseConfig = { + calendar: defaultCalendar, + longDateFormat: defaultLongDateFormat, + invalidDate: defaultInvalidDate, + ordinal: defaultOrdinal, + dayOfMonthOrdinalParse: defaultDayOfMonthOrdinalParse, + relativeTime: defaultRelativeTime, + + months: defaultLocaleMonths, + monthsShort: defaultLocaleMonthsShort, + + week: defaultLocaleWeek, + + weekdays: defaultLocaleWeekdays, + weekdaysMin: defaultLocaleWeekdaysMin, + weekdaysShort: defaultLocaleWeekdaysShort, + + meridiemParse: defaultLocaleMeridiemParse, + }; + + // internal storage for locale config files + var locales = {}, + localeFamilies = {}, + globalLocale; + + function commonPrefix(arr1, arr2) { + var i, + minl = Math.min(arr1.length, arr2.length); + for (i = 0; i < minl; i += 1) { + if (arr1[i] !== arr2[i]) { + return i; + } + } + return minl; + } + + function normalizeLocale(key) { + return key ? key.toLowerCase().replace('_', '-') : key; + } + + // pick the locale from the array + // try ['en-au', 'en-gb'] as 'en-au', 'en-gb', 'en', as in move through the list trying each + // substring from most specific to least, but move to the next array item if it's a more specific variant than the current root + function chooseLocale(names) { + var i = 0, + j, + next, + locale, + split; + + while (i < names.length) { + split = normalizeLocale(names[i]).split('-'); + j = split.length; + next = normalizeLocale(names[i + 1]); + next = next ? next.split('-') : null; + while (j > 0) { + locale = loadLocale(split.slice(0, j).join('-')); + if (locale) { + return locale; + } + if ( + next && + next.length >= j && + commonPrefix(split, next) >= j - 1 + ) { + //the next array item is better than a shallower substring of this one + break; + } + j--; + } + i++; + } + return globalLocale; + } + + function loadLocale(name) { + var oldLocale = null, + aliasedRequire; + // TODO: Find a better way to register and load all the locales in Node + if ( + locales[name] === undefined && + typeof module !== 'undefined' && + module && + module.exports + ) { + try { + oldLocale = globalLocale._abbr; + aliasedRequire = require; + aliasedRequire('./locale/' + name); + getSetGlobalLocale(oldLocale); + } catch (e) { + // mark as not found to avoid repeating expensive file require call causing high CPU + // when trying to find en-US, en_US, en-us for every format call + locales[name] = null; // null means not found + } + } + return locales[name]; + } + + // This function will load locale and then set the global locale. If + // no arguments are passed in, it will simply return the current global + // locale key. + function getSetGlobalLocale(key, values) { + var data; + if (key) { + if (isUndefined(values)) { + data = getLocale(key); + } else { + data = defineLocale(key, values); + } + + if (data) { + // moment.duration._locale = moment._locale = data; + globalLocale = data; + } else { + if (typeof console !== 'undefined' && console.warn) { + //warn user if arguments are passed but the locale could not be set + console.warn( + 'Locale ' + key + ' not found. Did you forget to load it?' + ); + } + } + } + + return globalLocale._abbr; + } + + function defineLocale(name, config) { + if (config !== null) { + var locale, + parentConfig = baseConfig; + config.abbr = name; + if (locales[name] != null) { + deprecateSimple( + 'defineLocaleOverride', + 'use moment.updateLocale(localeName, config) to change ' + + 'an existing locale. moment.defineLocale(localeName, ' + + 'config) should only be used for creating a new locale ' + + 'See http://momentjs.com/guides/#/warnings/define-locale/ for more info.' + ); + parentConfig = locales[name]._config; + } else if (config.parentLocale != null) { + if (locales[config.parentLocale] != null) { + parentConfig = locales[config.parentLocale]._config; + } else { + locale = loadLocale(config.parentLocale); + if (locale != null) { + parentConfig = locale._config; + } else { + if (!localeFamilies[config.parentLocale]) { + localeFamilies[config.parentLocale] = []; + } + localeFamilies[config.parentLocale].push({ + name: name, + config: config, + }); + return null; + } + } + } + locales[name] = new Locale(mergeConfigs(parentConfig, config)); + + if (localeFamilies[name]) { + localeFamilies[name].forEach(function (x) { + defineLocale(x.name, x.config); + }); + } + + // backwards compat for now: also set the locale + // make sure we set the locale AFTER all child locales have been + // created, so we won't end up with the child locale set. + getSetGlobalLocale(name); + + return locales[name]; + } else { + // useful for testing + delete locales[name]; + return null; + } + } + + function updateLocale(name, config) { + if (config != null) { + var locale, + tmpLocale, + parentConfig = baseConfig; + + if (locales[name] != null && locales[name].parentLocale != null) { + // Update existing child locale in-place to avoid memory-leaks + locales[name].set(mergeConfigs(locales[name]._config, config)); + } else { + // MERGE + tmpLocale = loadLocale(name); + if (tmpLocale != null) { + parentConfig = tmpLocale._config; + } + config = mergeConfigs(parentConfig, config); + if (tmpLocale == null) { + // updateLocale is called for creating a new locale + // Set abbr so it will have a name (getters return + // undefined otherwise). + config.abbr = name; + } + locale = new Locale(config); + locale.parentLocale = locales[name]; + locales[name] = locale; + } + + // backwards compat for now: also set the locale + getSetGlobalLocale(name); + } else { + // pass null for config to unupdate, useful for tests + if (locales[name] != null) { + if (locales[name].parentLocale != null) { + locales[name] = locales[name].parentLocale; + if (name === getSetGlobalLocale()) { + getSetGlobalLocale(name); + } + } else if (locales[name] != null) { + delete locales[name]; + } + } + } + return locales[name]; + } + + // returns locale data + function getLocale(key) { + var locale; + + if (key && key._locale && key._locale._abbr) { + key = key._locale._abbr; + } + + if (!key) { + return globalLocale; + } + + if (!isArray(key)) { + //short-circuit everything else + locale = loadLocale(key); + if (locale) { + return locale; + } + key = [key]; + } + + return chooseLocale(key); + } + + function listLocales() { + return keys(locales); + } + + function checkOverflow(m) { + var overflow, + a = m._a; + + if (a && getParsingFlags(m).overflow === -2) { + overflow = + a[MONTH] < 0 || a[MONTH] > 11 + ? MONTH + : a[DATE] < 1 || a[DATE] > daysInMonth(a[YEAR], a[MONTH]) + ? DATE + : a[HOUR] < 0 || + a[HOUR] > 24 || + (a[HOUR] === 24 && + (a[MINUTE] !== 0 || + a[SECOND] !== 0 || + a[MILLISECOND] !== 0)) + ? HOUR + : a[MINUTE] < 0 || a[MINUTE] > 59 + ? MINUTE + : a[SECOND] < 0 || a[SECOND] > 59 + ? SECOND + : a[MILLISECOND] < 0 || a[MILLISECOND] > 999 + ? MILLISECOND + : -1; + + if ( + getParsingFlags(m)._overflowDayOfYear && + (overflow < YEAR || overflow > DATE) + ) { + overflow = DATE; + } + if (getParsingFlags(m)._overflowWeeks && overflow === -1) { + overflow = WEEK; + } + if (getParsingFlags(m)._overflowWeekday && overflow === -1) { + overflow = WEEKDAY; + } + + getParsingFlags(m).overflow = overflow; + } + + return m; + } + + // iso 8601 regex + // 0000-00-00 0000-W00 or 0000-W00-0 + T + 00 or 00:00 or 00:00:00 or 00:00:00.000 + +00:00 or +0000 or +00) + var extendedIsoRegex = /^\s*((?:[+-]\d{6}|\d{4})-(?:\d\d-\d\d|W\d\d-\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?::\d\d(?::\d\d(?:[.,]\d+)?)?)?)([+-]\d\d(?::?\d\d)?|\s*Z)?)?$/, + basicIsoRegex = /^\s*((?:[+-]\d{6}|\d{4})(?:\d\d\d\d|W\d\d\d|W\d\d|\d\d\d|\d\d|))(?:(T| )(\d\d(?:\d\d(?:\d\d(?:[.,]\d+)?)?)?)([+-]\d\d(?::?\d\d)?|\s*Z)?)?$/, + tzRegex = /Z|[+-]\d\d(?::?\d\d)?/, + isoDates = [ + ['YYYYYY-MM-DD', /[+-]\d{6}-\d\d-\d\d/], + ['YYYY-MM-DD', /\d{4}-\d\d-\d\d/], + ['GGGG-[W]WW-E', /\d{4}-W\d\d-\d/], + ['GGGG-[W]WW', /\d{4}-W\d\d/, false], + ['YYYY-DDD', /\d{4}-\d{3}/], + ['YYYY-MM', /\d{4}-\d\d/, false], + ['YYYYYYMMDD', /[+-]\d{10}/], + ['YYYYMMDD', /\d{8}/], + ['GGGG[W]WWE', /\d{4}W\d{3}/], + ['GGGG[W]WW', /\d{4}W\d{2}/, false], + ['YYYYDDD', /\d{7}/], + ['YYYYMM', /\d{6}/, false], + ['YYYY', /\d{4}/, false], + ], + // iso time formats and regexes + isoTimes = [ + ['HH:mm:ss.SSSS', /\d\d:\d\d:\d\d\.\d+/], + ['HH:mm:ss,SSSS', /\d\d:\d\d:\d\d,\d+/], + ['HH:mm:ss', /\d\d:\d\d:\d\d/], + ['HH:mm', /\d\d:\d\d/], + ['HHmmss.SSSS', /\d\d\d\d\d\d\.\d+/], + ['HHmmss,SSSS', /\d\d\d\d\d\d,\d+/], + ['HHmmss', /\d\d\d\d\d\d/], + ['HHmm', /\d\d\d\d/], + ['HH', /\d\d/], + ], + aspNetJsonRegex = /^\/?Date\((-?\d+)/i, + // RFC 2822 regex: For details see https://tools.ietf.org/html/rfc2822#section-3.3 + rfc2822 = /^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),?\s)?(\d{1,2})\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(\d{2,4})\s(\d\d):(\d\d)(?::(\d\d))?\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|([+-]\d{4}))$/, + obsOffsets = { + UT: 0, + GMT: 0, + EDT: -4 * 60, + EST: -5 * 60, + CDT: -5 * 60, + CST: -6 * 60, + MDT: -6 * 60, + MST: -7 * 60, + PDT: -7 * 60, + PST: -8 * 60, + }; + + // date from iso format + function configFromISO(config) { + var i, + l, + string = config._i, + match = extendedIsoRegex.exec(string) || basicIsoRegex.exec(string), + allowTime, + dateFormat, + timeFormat, + tzFormat; + + if (match) { + getParsingFlags(config).iso = true; + + for (i = 0, l = isoDates.length; i < l; i++) { + if (isoDates[i][1].exec(match[1])) { + dateFormat = isoDates[i][0]; + allowTime = isoDates[i][2] !== false; + break; + } + } + if (dateFormat == null) { + config._isValid = false; + return; + } + if (match[3]) { + for (i = 0, l = isoTimes.length; i < l; i++) { + if (isoTimes[i][1].exec(match[3])) { + // match[2] should be 'T' or space + timeFormat = (match[2] || ' ') + isoTimes[i][0]; + break; + } + } + if (timeFormat == null) { + config._isValid = false; + return; + } + } + if (!allowTime && timeFormat != null) { + config._isValid = false; + return; + } + if (match[4]) { + if (tzRegex.exec(match[4])) { + tzFormat = 'Z'; + } else { + config._isValid = false; + return; + } + } + config._f = dateFormat + (timeFormat || '') + (tzFormat || ''); + configFromStringAndFormat(config); + } else { + config._isValid = false; + } + } + + function extractFromRFC2822Strings( + yearStr, + monthStr, + dayStr, + hourStr, + minuteStr, + secondStr + ) { + var result = [ + untruncateYear(yearStr), + defaultLocaleMonthsShort.indexOf(monthStr), + parseInt(dayStr, 10), + parseInt(hourStr, 10), + parseInt(minuteStr, 10), + ]; + + if (secondStr) { + result.push(parseInt(secondStr, 10)); + } + + return result; + } + + function untruncateYear(yearStr) { + var year = parseInt(yearStr, 10); + if (year <= 49) { + return 2000 + year; + } else if (year <= 999) { + return 1900 + year; + } + return year; + } + + function preprocessRFC2822(s) { + // Remove comments and folding whitespace and replace multiple-spaces with a single space + return s + .replace(/\([^)]*\)|[\n\t]/g, ' ') + .replace(/(\s\s+)/g, ' ') + .replace(/^\s\s*/, '') + .replace(/\s\s*$/, ''); + } + + function checkWeekday(weekdayStr, parsedInput, config) { + if (weekdayStr) { + // TODO: Replace the vanilla JS Date object with an independent day-of-week check. + var weekdayProvided = defaultLocaleWeekdaysShort.indexOf(weekdayStr), + weekdayActual = new Date( + parsedInput[0], + parsedInput[1], + parsedInput[2] + ).getDay(); + if (weekdayProvided !== weekdayActual) { + getParsingFlags(config).weekdayMismatch = true; + config._isValid = false; + return false; + } + } + return true; + } + + function calculateOffset(obsOffset, militaryOffset, numOffset) { + if (obsOffset) { + return obsOffsets[obsOffset]; + } else if (militaryOffset) { + // the only allowed military tz is Z + return 0; + } else { + var hm = parseInt(numOffset, 10), + m = hm % 100, + h = (hm - m) / 100; + return h * 60 + m; + } + } + + // date and time from ref 2822 format + function configFromRFC2822(config) { + var match = rfc2822.exec(preprocessRFC2822(config._i)), + parsedArray; + if (match) { + parsedArray = extractFromRFC2822Strings( + match[4], + match[3], + match[2], + match[5], + match[6], + match[7] + ); + if (!checkWeekday(match[1], parsedArray, config)) { + return; + } + + config._a = parsedArray; + config._tzm = calculateOffset(match[8], match[9], match[10]); + + config._d = createUTCDate.apply(null, config._a); + config._d.setUTCMinutes(config._d.getUTCMinutes() - config._tzm); + + getParsingFlags(config).rfc2822 = true; + } else { + config._isValid = false; + } + } + + // date from 1) ASP.NET, 2) ISO, 3) RFC 2822 formats, or 4) optional fallback if parsing isn't strict + function configFromString(config) { + var matched = aspNetJsonRegex.exec(config._i); + if (matched !== null) { + config._d = new Date(+matched[1]); + return; + } + + configFromISO(config); + if (config._isValid === false) { + delete config._isValid; + } else { + return; + } + + configFromRFC2822(config); + if (config._isValid === false) { + delete config._isValid; + } else { + return; + } + + if (config._strict) { + config._isValid = false; + } else { + // Final attempt, use Input Fallback + hooks.createFromInputFallback(config); + } + } + + hooks.createFromInputFallback = deprecate( + 'value provided is not in a recognized RFC2822 or ISO format. moment construction falls back to js Date(), ' + + 'which is not reliable across all browsers and versions. Non RFC2822/ISO date formats are ' + + 'discouraged and will be removed in an upcoming major release. Please refer to ' + + 'http://momentjs.com/guides/#/warnings/js-date/ for more info.', + function (config) { + config._d = new Date(config._i + (config._useUTC ? ' UTC' : '')); + } + ); + + // Pick the first defined of two or three arguments. + function defaults(a, b, c) { + if (a != null) { + return a; + } + if (b != null) { + return b; + } + return c; + } + + function currentDateArray(config) { + // hooks is actually the exported moment object + var nowValue = new Date(hooks.now()); + if (config._useUTC) { + return [ + nowValue.getUTCFullYear(), + nowValue.getUTCMonth(), + nowValue.getUTCDate(), + ]; + } + return [nowValue.getFullYear(), nowValue.getMonth(), nowValue.getDate()]; + } + + // convert an array to a date. + // the array should mirror the parameters below + // note: all values past the year are optional and will default to the lowest possible value. + // [year, month, day , hour, minute, second, millisecond] + function configFromArray(config) { + var i, + date, + input = [], + currentDate, + expectedWeekday, + yearToUse; + + if (config._d) { + return; + } + + currentDate = currentDateArray(config); + + //compute day of the year from weeks and weekdays + if (config._w && config._a[DATE] == null && config._a[MONTH] == null) { + dayOfYearFromWeekInfo(config); + } + + //if the day of the year is set, figure out what it is + if (config._dayOfYear != null) { + yearToUse = defaults(config._a[YEAR], currentDate[YEAR]); + + if ( + config._dayOfYear > daysInYear(yearToUse) || + config._dayOfYear === 0 + ) { + getParsingFlags(config)._overflowDayOfYear = true; + } + + date = createUTCDate(yearToUse, 0, config._dayOfYear); + config._a[MONTH] = date.getUTCMonth(); + config._a[DATE] = date.getUTCDate(); + } + + // Default to current date. + // * if no year, month, day of month are given, default to today + // * if day of month is given, default month and year + // * if month is given, default only year + // * if year is given, don't default anything + for (i = 0; i < 3 && config._a[i] == null; ++i) { + config._a[i] = input[i] = currentDate[i]; + } + + // Zero out whatever was not defaulted, including time + for (; i < 7; i++) { + config._a[i] = input[i] = + config._a[i] == null ? (i === 2 ? 1 : 0) : config._a[i]; + } + + // Check for 24:00:00.000 + if ( + config._a[HOUR] === 24 && + config._a[MINUTE] === 0 && + config._a[SECOND] === 0 && + config._a[MILLISECOND] === 0 + ) { + config._nextDay = true; + config._a[HOUR] = 0; + } + + config._d = (config._useUTC ? createUTCDate : createDate).apply( + null, + input + ); + expectedWeekday = config._useUTC + ? config._d.getUTCDay() + : config._d.getDay(); + + // Apply timezone offset from input. The actual utcOffset can be changed + // with parseZone. + if (config._tzm != null) { + config._d.setUTCMinutes(config._d.getUTCMinutes() - config._tzm); + } + + if (config._nextDay) { + config._a[HOUR] = 24; + } + + // check for mismatching day of week + if ( + config._w && + typeof config._w.d !== 'undefined' && + config._w.d !== expectedWeekday + ) { + getParsingFlags(config).weekdayMismatch = true; + } + } + + function dayOfYearFromWeekInfo(config) { + var w, weekYear, week, weekday, dow, doy, temp, weekdayOverflow, curWeek; + + w = config._w; + if (w.GG != null || w.W != null || w.E != null) { + dow = 1; + doy = 4; + + // TODO: We need to take the current isoWeekYear, but that depends on + // how we interpret now (local, utc, fixed offset). So create + // a now version of current config (take local/utc/offset flags, and + // create now). + weekYear = defaults( + w.GG, + config._a[YEAR], + weekOfYear(createLocal(), 1, 4).year + ); + week = defaults(w.W, 1); + weekday = defaults(w.E, 1); + if (weekday < 1 || weekday > 7) { + weekdayOverflow = true; + } + } else { + dow = config._locale._week.dow; + doy = config._locale._week.doy; + + curWeek = weekOfYear(createLocal(), dow, doy); + + weekYear = defaults(w.gg, config._a[YEAR], curWeek.year); + + // Default to current week. + week = defaults(w.w, curWeek.week); + + if (w.d != null) { + // weekday -- low day numbers are considered next week + weekday = w.d; + if (weekday < 0 || weekday > 6) { + weekdayOverflow = true; + } + } else if (w.e != null) { + // local weekday -- counting starts from beginning of week + weekday = w.e + dow; + if (w.e < 0 || w.e > 6) { + weekdayOverflow = true; + } + } else { + // default to beginning of week + weekday = dow; + } + } + if (week < 1 || week > weeksInYear(weekYear, dow, doy)) { + getParsingFlags(config)._overflowWeeks = true; + } else if (weekdayOverflow != null) { + getParsingFlags(config)._overflowWeekday = true; + } else { + temp = dayOfYearFromWeeks(weekYear, week, weekday, dow, doy); + config._a[YEAR] = temp.year; + config._dayOfYear = temp.dayOfYear; + } + } + + // constant that refers to the ISO standard + hooks.ISO_8601 = function () {}; + + // constant that refers to the RFC 2822 form + hooks.RFC_2822 = function () {}; + + // date from string and format string + function configFromStringAndFormat(config) { + // TODO: Move this to another part of the creation flow to prevent circular deps + if (config._f === hooks.ISO_8601) { + configFromISO(config); + return; + } + if (config._f === hooks.RFC_2822) { + configFromRFC2822(config); + return; + } + config._a = []; + getParsingFlags(config).empty = true; + + // This array is used to make a Date, either with `new Date` or `Date.UTC` + var string = '' + config._i, + i, + parsedInput, + tokens, + token, + skipped, + stringLength = string.length, + totalParsedInputLength = 0, + era; + + tokens = + expandFormat(config._f, config._locale).match(formattingTokens) || []; + + for (i = 0; i < tokens.length; i++) { + token = tokens[i]; + parsedInput = (string.match(getParseRegexForToken(token, config)) || + [])[0]; + if (parsedInput) { + skipped = string.substr(0, string.indexOf(parsedInput)); + if (skipped.length > 0) { + getParsingFlags(config).unusedInput.push(skipped); + } + string = string.slice( + string.indexOf(parsedInput) + parsedInput.length + ); + totalParsedInputLength += parsedInput.length; + } + // don't parse if it's not a known token + if (formatTokenFunctions[token]) { + if (parsedInput) { + getParsingFlags(config).empty = false; + } else { + getParsingFlags(config).unusedTokens.push(token); + } + addTimeToArrayFromToken(token, parsedInput, config); + } else if (config._strict && !parsedInput) { + getParsingFlags(config).unusedTokens.push(token); + } + } + + // add remaining unparsed input length to the string + getParsingFlags(config).charsLeftOver = + stringLength - totalParsedInputLength; + if (string.length > 0) { + getParsingFlags(config).unusedInput.push(string); + } + + // clear _12h flag if hour is <= 12 + if ( + config._a[HOUR] <= 12 && + getParsingFlags(config).bigHour === true && + config._a[HOUR] > 0 + ) { + getParsingFlags(config).bigHour = undefined; + } + + getParsingFlags(config).parsedDateParts = config._a.slice(0); + getParsingFlags(config).meridiem = config._meridiem; + // handle meridiem + config._a[HOUR] = meridiemFixWrap( + config._locale, + config._a[HOUR], + config._meridiem + ); + + // handle era + era = getParsingFlags(config).era; + if (era !== null) { + config._a[YEAR] = config._locale.erasConvertYear(era, config._a[YEAR]); + } + + configFromArray(config); + checkOverflow(config); + } + + function meridiemFixWrap(locale, hour, meridiem) { + var isPm; + + if (meridiem == null) { + // nothing to do + return hour; + } + if (locale.meridiemHour != null) { + return locale.meridiemHour(hour, meridiem); + } else if (locale.isPM != null) { + // Fallback + isPm = locale.isPM(meridiem); + if (isPm && hour < 12) { + hour += 12; + } + if (!isPm && hour === 12) { + hour = 0; + } + return hour; + } else { + // this is not supposed to happen + return hour; + } + } + + // date from string and array of format strings + function configFromStringAndArray(config) { + var tempConfig, + bestMoment, + scoreToBeat, + i, + currentScore, + validFormatFound, + bestFormatIsValid = false; + + if (config._f.length === 0) { + getParsingFlags(config).invalidFormat = true; + config._d = new Date(NaN); + return; + } + + for (i = 0; i < config._f.length; i++) { + currentScore = 0; + validFormatFound = false; + tempConfig = copyConfig({}, config); + if (config._useUTC != null) { + tempConfig._useUTC = config._useUTC; + } + tempConfig._f = config._f[i]; + configFromStringAndFormat(tempConfig); + + if (isValid(tempConfig)) { + validFormatFound = true; + } + + // if there is any input that was not parsed add a penalty for that format + currentScore += getParsingFlags(tempConfig).charsLeftOver; + + //or tokens + currentScore += getParsingFlags(tempConfig).unusedTokens.length * 10; + + getParsingFlags(tempConfig).score = currentScore; + + if (!bestFormatIsValid) { + if ( + scoreToBeat == null || + currentScore < scoreToBeat || + validFormatFound + ) { + scoreToBeat = currentScore; + bestMoment = tempConfig; + if (validFormatFound) { + bestFormatIsValid = true; + } + } + } else { + if (currentScore < scoreToBeat) { + scoreToBeat = currentScore; + bestMoment = tempConfig; + } + } + } + + extend(config, bestMoment || tempConfig); + } + + function configFromObject(config) { + if (config._d) { + return; + } + + var i = normalizeObjectUnits(config._i), + dayOrDate = i.day === undefined ? i.date : i.day; + config._a = map( + [i.year, i.month, dayOrDate, i.hour, i.minute, i.second, i.millisecond], + function (obj) { + return obj && parseInt(obj, 10); + } + ); + + configFromArray(config); + } + + function createFromConfig(config) { + var res = new Moment(checkOverflow(prepareConfig(config))); + if (res._nextDay) { + // Adding is smart enough around DST + res.add(1, 'd'); + res._nextDay = undefined; + } + + return res; + } + + function prepareConfig(config) { + var input = config._i, + format = config._f; + + config._locale = config._locale || getLocale(config._l); + + if (input === null || (format === undefined && input === '')) { + return createInvalid({ nullInput: true }); + } + + if (typeof input === 'string') { + config._i = input = config._locale.preparse(input); + } + + if (isMoment(input)) { + return new Moment(checkOverflow(input)); + } else if (isDate(input)) { + config._d = input; + } else if (isArray(format)) { + configFromStringAndArray(config); + } else if (format) { + configFromStringAndFormat(config); + } else { + configFromInput(config); + } + + if (!isValid(config)) { + config._d = null; + } + + return config; + } + + function configFromInput(config) { + var input = config._i; + if (isUndefined(input)) { + config._d = new Date(hooks.now()); + } else if (isDate(input)) { + config._d = new Date(input.valueOf()); + } else if (typeof input === 'string') { + configFromString(config); + } else if (isArray(input)) { + config._a = map(input.slice(0), function (obj) { + return parseInt(obj, 10); + }); + configFromArray(config); + } else if (isObject(input)) { + configFromObject(config); + } else if (isNumber(input)) { + // from milliseconds + config._d = new Date(input); + } else { + hooks.createFromInputFallback(config); + } + } + + function createLocalOrUTC(input, format, locale, strict, isUTC) { + var c = {}; + + if (format === true || format === false) { + strict = format; + format = undefined; + } + + if (locale === true || locale === false) { + strict = locale; + locale = undefined; + } + + if ( + (isObject(input) && isObjectEmpty(input)) || + (isArray(input) && input.length === 0) + ) { + input = undefined; + } + // object construction must be done this way. + // https://github.com/moment/moment/issues/1423 + c._isAMomentObject = true; + c._useUTC = c._isUTC = isUTC; + c._l = locale; + c._i = input; + c._f = format; + c._strict = strict; + + return createFromConfig(c); + } + + function createLocal(input, format, locale, strict) { + return createLocalOrUTC(input, format, locale, strict, false); + } + + var prototypeMin = deprecate( + 'moment().min is deprecated, use moment.max instead. http://momentjs.com/guides/#/warnings/min-max/', + function () { + var other = createLocal.apply(null, arguments); + if (this.isValid() && other.isValid()) { + return other < this ? this : other; + } else { + return createInvalid(); + } + } + ), + prototypeMax = deprecate( + 'moment().max is deprecated, use moment.min instead. http://momentjs.com/guides/#/warnings/min-max/', + function () { + var other = createLocal.apply(null, arguments); + if (this.isValid() && other.isValid()) { + return other > this ? this : other; + } else { + return createInvalid(); + } + } + ); + + // Pick a moment m from moments so that m[fn](other) is true for all + // other. This relies on the function fn to be transitive. + // + // moments should either be an array of moment objects or an array, whose + // first element is an array of moment objects. + function pickBy(fn, moments) { + var res, i; + if (moments.length === 1 && isArray(moments[0])) { + moments = moments[0]; + } + if (!moments.length) { + return createLocal(); + } + res = moments[0]; + for (i = 1; i < moments.length; ++i) { + if (!moments[i].isValid() || moments[i][fn](res)) { + res = moments[i]; + } + } + return res; + } + + // TODO: Use [].sort instead? + function min() { + var args = [].slice.call(arguments, 0); + + return pickBy('isBefore', args); + } + + function max() { + var args = [].slice.call(arguments, 0); + + return pickBy('isAfter', args); + } + + var now = function () { + return Date.now ? Date.now() : +new Date(); + }; + + var ordering = [ + 'year', + 'quarter', + 'month', + 'week', + 'day', + 'hour', + 'minute', + 'second', + 'millisecond', + ]; + + function isDurationValid(m) { + var key, + unitHasDecimal = false, + i; + for (key in m) { + if ( + hasOwnProp(m, key) && + !( + indexOf.call(ordering, key) !== -1 && + (m[key] == null || !isNaN(m[key])) + ) + ) { + return false; + } + } + + for (i = 0; i < ordering.length; ++i) { + if (m[ordering[i]]) { + if (unitHasDecimal) { + return false; // only allow non-integers for smallest unit + } + if (parseFloat(m[ordering[i]]) !== toInt(m[ordering[i]])) { + unitHasDecimal = true; + } + } + } + + return true; + } + + function isValid$1() { + return this._isValid; + } + + function createInvalid$1() { + return createDuration(NaN); + } + + function Duration(duration) { + var normalizedInput = normalizeObjectUnits(duration), + years = normalizedInput.year || 0, + quarters = normalizedInput.quarter || 0, + months = normalizedInput.month || 0, + weeks = normalizedInput.week || normalizedInput.isoWeek || 0, + days = normalizedInput.day || 0, + hours = normalizedInput.hour || 0, + minutes = normalizedInput.minute || 0, + seconds = normalizedInput.second || 0, + milliseconds = normalizedInput.millisecond || 0; + + this._isValid = isDurationValid(normalizedInput); + + // representation for dateAddRemove + this._milliseconds = + +milliseconds + + seconds * 1e3 + // 1000 + minutes * 6e4 + // 1000 * 60 + hours * 1000 * 60 * 60; //using 1000 * 60 * 60 instead of 36e5 to avoid floating point rounding errors https://github.com/moment/moment/issues/2978 + // Because of dateAddRemove treats 24 hours as different from a + // day when working around DST, we need to store them separately + this._days = +days + weeks * 7; + // It is impossible to translate months into days without knowing + // which months you are are talking about, so we have to store + // it separately. + this._months = +months + quarters * 3 + years * 12; + + this._data = {}; + + this._locale = getLocale(); + + this._bubble(); + } + + function isDuration(obj) { + return obj instanceof Duration; + } + + function absRound(number) { + if (number < 0) { + return Math.round(-1 * number) * -1; + } else { + return Math.round(number); + } + } + + // compare two arrays, return the number of differences + function compareArrays(array1, array2, dontConvert) { + var len = Math.min(array1.length, array2.length), + lengthDiff = Math.abs(array1.length - array2.length), + diffs = 0, + i; + for (i = 0; i < len; i++) { + if ( + (dontConvert && array1[i] !== array2[i]) || + (!dontConvert && toInt(array1[i]) !== toInt(array2[i])) + ) { + diffs++; + } + } + return diffs + lengthDiff; + } + + // FORMATTING + + function offset(token, separator) { + addFormatToken(token, 0, 0, function () { + var offset = this.utcOffset(), + sign = '+'; + if (offset < 0) { + offset = -offset; + sign = '-'; + } + return ( + sign + + zeroFill(~~(offset / 60), 2) + + separator + + zeroFill(~~offset % 60, 2) + ); + }); + } + + offset('Z', ':'); + offset('ZZ', ''); + + // PARSING + + addRegexToken('Z', matchShortOffset); + addRegexToken('ZZ', matchShortOffset); + addParseToken(['Z', 'ZZ'], function (input, array, config) { + config._useUTC = true; + config._tzm = offsetFromString(matchShortOffset, input); + }); + + // HELPERS + + // timezone chunker + // '+10:00' > ['10', '00'] + // '-1530' > ['-15', '30'] + var chunkOffset = /([\+\-]|\d\d)/gi; + + function offsetFromString(matcher, string) { + var matches = (string || '').match(matcher), + chunk, + parts, + minutes; + + if (matches === null) { + return null; + } + + chunk = matches[matches.length - 1] || []; + parts = (chunk + '').match(chunkOffset) || ['-', 0, 0]; + minutes = +(parts[1] * 60) + toInt(parts[2]); + + return minutes === 0 ? 0 : parts[0] === '+' ? minutes : -minutes; + } + + // Return a moment from input, that is local/utc/zone equivalent to model. + function cloneWithOffset(input, model) { + var res, diff; + if (model._isUTC) { + res = model.clone(); + diff = + (isMoment(input) || isDate(input) + ? input.valueOf() + : createLocal(input).valueOf()) - res.valueOf(); + // Use low-level api, because this fn is low-level api. + res._d.setTime(res._d.valueOf() + diff); + hooks.updateOffset(res, false); + return res; + } else { + return createLocal(input).local(); + } + } + + function getDateOffset(m) { + // On Firefox.24 Date#getTimezoneOffset returns a floating point. + // https://github.com/moment/moment/pull/1871 + return -Math.round(m._d.getTimezoneOffset()); + } + + // HOOKS + + // This function will be called whenever a moment is mutated. + // It is intended to keep the offset in sync with the timezone. + hooks.updateOffset = function () {}; + + // MOMENTS + + // keepLocalTime = true means only change the timezone, without + // affecting the local hour. So 5:31:26 +0300 --[utcOffset(2, true)]--> + // 5:31:26 +0200 It is possible that 5:31:26 doesn't exist with offset + // +0200, so we adjust the time as needed, to be valid. + // + // Keeping the time actually adds/subtracts (one hour) + // from the actual represented time. That is why we call updateOffset + // a second time. In case it wants us to change the offset again + // _changeInProgress == true case, then we have to adjust, because + // there is no such time in the given timezone. + function getSetOffset(input, keepLocalTime, keepMinutes) { + var offset = this._offset || 0, + localAdjust; + if (!this.isValid()) { + return input != null ? this : NaN; + } + if (input != null) { + if (typeof input === 'string') { + input = offsetFromString(matchShortOffset, input); + if (input === null) { + return this; + } + } else if (Math.abs(input) < 16 && !keepMinutes) { + input = input * 60; + } + if (!this._isUTC && keepLocalTime) { + localAdjust = getDateOffset(this); + } + this._offset = input; + this._isUTC = true; + if (localAdjust != null) { + this.add(localAdjust, 'm'); + } + if (offset !== input) { + if (!keepLocalTime || this._changeInProgress) { + addSubtract( + this, + createDuration(input - offset, 'm'), + 1, + false + ); + } else if (!this._changeInProgress) { + this._changeInProgress = true; + hooks.updateOffset(this, true); + this._changeInProgress = null; + } + } + return this; + } else { + return this._isUTC ? offset : getDateOffset(this); + } + } + + function getSetZone(input, keepLocalTime) { + if (input != null) { + if (typeof input !== 'string') { + input = -input; + } + + this.utcOffset(input, keepLocalTime); + + return this; + } else { + return -this.utcOffset(); + } + } + + function setOffsetToUTC(keepLocalTime) { + return this.utcOffset(0, keepLocalTime); + } + + function setOffsetToLocal(keepLocalTime) { + if (this._isUTC) { + this.utcOffset(0, keepLocalTime); + this._isUTC = false; + + if (keepLocalTime) { + this.subtract(getDateOffset(this), 'm'); + } + } + return this; + } + + function setOffsetToParsedOffset() { + if (this._tzm != null) { + this.utcOffset(this._tzm, false, true); + } else if (typeof this._i === 'string') { + var tZone = offsetFromString(matchOffset, this._i); + if (tZone != null) { + this.utcOffset(tZone); + } else { + this.utcOffset(0, true); + } + } + return this; + } + + function hasAlignedHourOffset(input) { + if (!this.isValid()) { + return false; + } + input = input ? createLocal(input).utcOffset() : 0; + + return (this.utcOffset() - input) % 60 === 0; + } + + function isDaylightSavingTime() { + return ( + this.utcOffset() > this.clone().month(0).utcOffset() || + this.utcOffset() > this.clone().month(5).utcOffset() + ); + } + + function isDaylightSavingTimeShifted() { + if (!isUndefined(this._isDSTShifted)) { + return this._isDSTShifted; + } + + var c = {}, + other; + + copyConfig(c, this); + c = prepareConfig(c); + + if (c._a) { + other = c._isUTC ? createUTC(c._a) : createLocal(c._a); + this._isDSTShifted = + this.isValid() && compareArrays(c._a, other.toArray()) > 0; + } else { + this._isDSTShifted = false; + } + + return this._isDSTShifted; + } + + function isLocal() { + return this.isValid() ? !this._isUTC : false; + } + + function isUtcOffset() { + return this.isValid() ? this._isUTC : false; + } + + function isUtc() { + return this.isValid() ? this._isUTC && this._offset === 0 : false; + } + + // ASP.NET json date format regex + var aspNetRegex = /^(-|\+)?(?:(\d*)[. ])?(\d+):(\d+)(?::(\d+)(\.\d*)?)?$/, + // from http://docs.closure-library.googlecode.com/git/closure_goog_date_date.js.source.html + // somewhat more in line with 4.4.3.2 2004 spec, but allows decimal anywhere + // and further modified to allow for strings containing both week and day + isoRegex = /^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/; + + function createDuration(input, key) { + var duration = input, + // matching against regexp is expensive, do it on demand + match = null, + sign, + ret, + diffRes; + + if (isDuration(input)) { + duration = { + ms: input._milliseconds, + d: input._days, + M: input._months, + }; + } else if (isNumber(input) || !isNaN(+input)) { + duration = {}; + if (key) { + duration[key] = +input; + } else { + duration.milliseconds = +input; + } + } else if ((match = aspNetRegex.exec(input))) { + sign = match[1] === '-' ? -1 : 1; + duration = { + y: 0, + d: toInt(match[DATE]) * sign, + h: toInt(match[HOUR]) * sign, + m: toInt(match[MINUTE]) * sign, + s: toInt(match[SECOND]) * sign, + ms: toInt(absRound(match[MILLISECOND] * 1000)) * sign, // the millisecond decimal point is included in the match + }; + } else if ((match = isoRegex.exec(input))) { + sign = match[1] === '-' ? -1 : 1; + duration = { + y: parseIso(match[2], sign), + M: parseIso(match[3], sign), + w: parseIso(match[4], sign), + d: parseIso(match[5], sign), + h: parseIso(match[6], sign), + m: parseIso(match[7], sign), + s: parseIso(match[8], sign), + }; + } else if (duration == null) { + // checks for null or undefined + duration = {}; + } else if ( + typeof duration === 'object' && + ('from' in duration || 'to' in duration) + ) { + diffRes = momentsDifference( + createLocal(duration.from), + createLocal(duration.to) + ); + + duration = {}; + duration.ms = diffRes.milliseconds; + duration.M = diffRes.months; + } + + ret = new Duration(duration); + + if (isDuration(input) && hasOwnProp(input, '_locale')) { + ret._locale = input._locale; + } + + if (isDuration(input) && hasOwnProp(input, '_isValid')) { + ret._isValid = input._isValid; + } + + return ret; + } + + createDuration.fn = Duration.prototype; + createDuration.invalid = createInvalid$1; + + function parseIso(inp, sign) { + // We'd normally use ~~inp for this, but unfortunately it also + // converts floats to ints. + // inp may be undefined, so careful calling replace on it. + var res = inp && parseFloat(inp.replace(',', '.')); + // apply sign while we're at it + return (isNaN(res) ? 0 : res) * sign; + } + + function positiveMomentsDifference(base, other) { + var res = {}; + + res.months = + other.month() - base.month() + (other.year() - base.year()) * 12; + if (base.clone().add(res.months, 'M').isAfter(other)) { + --res.months; + } + + res.milliseconds = +other - +base.clone().add(res.months, 'M'); + + return res; + } + + function momentsDifference(base, other) { + var res; + if (!(base.isValid() && other.isValid())) { + return { milliseconds: 0, months: 0 }; + } + + other = cloneWithOffset(other, base); + if (base.isBefore(other)) { + res = positiveMomentsDifference(base, other); + } else { + res = positiveMomentsDifference(other, base); + res.milliseconds = -res.milliseconds; + res.months = -res.months; + } + + return res; + } + + // TODO: remove 'name' arg after deprecation is removed + function createAdder(direction, name) { + return function (val, period) { + var dur, tmp; + //invert the arguments, but complain about it + if (period !== null && !isNaN(+period)) { + deprecateSimple( + name, + 'moment().' + + name + + '(period, number) is deprecated. Please use moment().' + + name + + '(number, period). ' + + 'See http://momentjs.com/guides/#/warnings/add-inverted-param/ for more info.' + ); + tmp = val; + val = period; + period = tmp; + } + + dur = createDuration(val, period); + addSubtract(this, dur, direction); + return this; + }; + } + + function addSubtract(mom, duration, isAdding, updateOffset) { + var milliseconds = duration._milliseconds, + days = absRound(duration._days), + months = absRound(duration._months); + + if (!mom.isValid()) { + // No op + return; + } + + updateOffset = updateOffset == null ? true : updateOffset; + + if (months) { + setMonth(mom, get(mom, 'Month') + months * isAdding); + } + if (days) { + set$1(mom, 'Date', get(mom, 'Date') + days * isAdding); + } + if (milliseconds) { + mom._d.setTime(mom._d.valueOf() + milliseconds * isAdding); + } + if (updateOffset) { + hooks.updateOffset(mom, days || months); + } + } + + var add = createAdder(1, 'add'), + subtract = createAdder(-1, 'subtract'); + + function isString(input) { + return typeof input === 'string' || input instanceof String; + } + + // type MomentInput = Moment | Date | string | number | (number | string)[] | MomentInputObject | void; // null | undefined + function isMomentInput(input) { + return ( + isMoment(input) || + isDate(input) || + isString(input) || + isNumber(input) || + isNumberOrStringArray(input) || + isMomentInputObject(input) || + input === null || + input === undefined + ); + } + + function isMomentInputObject(input) { + var objectTest = isObject(input) && !isObjectEmpty(input), + propertyTest = false, + properties = [ + 'years', + 'year', + 'y', + 'months', + 'month', + 'M', + 'days', + 'day', + 'd', + 'dates', + 'date', + 'D', + 'hours', + 'hour', + 'h', + 'minutes', + 'minute', + 'm', + 'seconds', + 'second', + 's', + 'milliseconds', + 'millisecond', + 'ms', + ], + i, + property; + + for (i = 0; i < properties.length; i += 1) { + property = properties[i]; + propertyTest = propertyTest || hasOwnProp(input, property); + } + + return objectTest && propertyTest; + } + + function isNumberOrStringArray(input) { + var arrayTest = isArray(input), + dataTypeTest = false; + if (arrayTest) { + dataTypeTest = + input.filter(function (item) { + return !isNumber(item) && isString(input); + }).length === 0; + } + return arrayTest && dataTypeTest; + } + + function isCalendarSpec(input) { + var objectTest = isObject(input) && !isObjectEmpty(input), + propertyTest = false, + properties = [ + 'sameDay', + 'nextDay', + 'lastDay', + 'nextWeek', + 'lastWeek', + 'sameElse', + ], + i, + property; + + for (i = 0; i < properties.length; i += 1) { + property = properties[i]; + propertyTest = propertyTest || hasOwnProp(input, property); + } + + return objectTest && propertyTest; + } + + function getCalendarFormat(myMoment, now) { + var diff = myMoment.diff(now, 'days', true); + return diff < -6 + ? 'sameElse' + : diff < -1 + ? 'lastWeek' + : diff < 0 + ? 'lastDay' + : diff < 1 + ? 'sameDay' + : diff < 2 + ? 'nextDay' + : diff < 7 + ? 'nextWeek' + : 'sameElse'; + } + + function calendar$1(time, formats) { + // Support for single parameter, formats only overload to the calendar function + if (arguments.length === 1) { + if (isMomentInput(arguments[0])) { + time = arguments[0]; + formats = undefined; + } else if (isCalendarSpec(arguments[0])) { + formats = arguments[0]; + time = undefined; + } + } + // We want to compare the start of today, vs this. + // Getting start-of-today depends on whether we're local/utc/offset or not. + var now = time || createLocal(), + sod = cloneWithOffset(now, this).startOf('day'), + format = hooks.calendarFormat(this, sod) || 'sameElse', + output = + formats && + (isFunction(formats[format]) + ? formats[format].call(this, now) + : formats[format]); + + return this.format( + output || this.localeData().calendar(format, this, createLocal(now)) + ); + } + + function clone() { + return new Moment(this); + } + + function isAfter(input, units) { + var localInput = isMoment(input) ? input : createLocal(input); + if (!(this.isValid() && localInput.isValid())) { + return false; + } + units = normalizeUnits(units) || 'millisecond'; + if (units === 'millisecond') { + return this.valueOf() > localInput.valueOf(); + } else { + return localInput.valueOf() < this.clone().startOf(units).valueOf(); + } + } + + function isBefore(input, units) { + var localInput = isMoment(input) ? input : createLocal(input); + if (!(this.isValid() && localInput.isValid())) { + return false; + } + units = normalizeUnits(units) || 'millisecond'; + if (units === 'millisecond') { + return this.valueOf() < localInput.valueOf(); + } else { + return this.clone().endOf(units).valueOf() < localInput.valueOf(); + } + } + + function isBetween(from, to, units, inclusivity) { + var localFrom = isMoment(from) ? from : createLocal(from), + localTo = isMoment(to) ? to : createLocal(to); + if (!(this.isValid() && localFrom.isValid() && localTo.isValid())) { + return false; + } + inclusivity = inclusivity || '()'; + return ( + (inclusivity[0] === '(' + ? this.isAfter(localFrom, units) + : !this.isBefore(localFrom, units)) && + (inclusivity[1] === ')' + ? this.isBefore(localTo, units) + : !this.isAfter(localTo, units)) + ); + } + + function isSame(input, units) { + var localInput = isMoment(input) ? input : createLocal(input), + inputMs; + if (!(this.isValid() && localInput.isValid())) { + return false; + } + units = normalizeUnits(units) || 'millisecond'; + if (units === 'millisecond') { + return this.valueOf() === localInput.valueOf(); + } else { + inputMs = localInput.valueOf(); + return ( + this.clone().startOf(units).valueOf() <= inputMs && + inputMs <= this.clone().endOf(units).valueOf() + ); + } + } + + function isSameOrAfter(input, units) { + return this.isSame(input, units) || this.isAfter(input, units); + } + + function isSameOrBefore(input, units) { + return this.isSame(input, units) || this.isBefore(input, units); + } + + function diff(input, units, asFloat) { + var that, zoneDelta, output; + + if (!this.isValid()) { + return NaN; + } + + that = cloneWithOffset(input, this); + + if (!that.isValid()) { + return NaN; + } + + zoneDelta = (that.utcOffset() - this.utcOffset()) * 6e4; + + units = normalizeUnits(units); + + switch (units) { + case 'year': + output = monthDiff(this, that) / 12; + break; + case 'month': + output = monthDiff(this, that); + break; + case 'quarter': + output = monthDiff(this, that) / 3; + break; + case 'second': + output = (this - that) / 1e3; + break; // 1000 + case 'minute': + output = (this - that) / 6e4; + break; // 1000 * 60 + case 'hour': + output = (this - that) / 36e5; + break; // 1000 * 60 * 60 + case 'day': + output = (this - that - zoneDelta) / 864e5; + break; // 1000 * 60 * 60 * 24, negate dst + case 'week': + output = (this - that - zoneDelta) / 6048e5; + break; // 1000 * 60 * 60 * 24 * 7, negate dst + default: + output = this - that; + } + + return asFloat ? output : absFloor(output); + } + + function monthDiff(a, b) { + if (a.date() < b.date()) { + // end-of-month calculations work correct when the start month has more + // days than the end month. + return -monthDiff(b, a); + } + // difference in months + var wholeMonthDiff = (b.year() - a.year()) * 12 + (b.month() - a.month()), + // b is in (anchor - 1 month, anchor + 1 month) + anchor = a.clone().add(wholeMonthDiff, 'months'), + anchor2, + adjust; + + if (b - anchor < 0) { + anchor2 = a.clone().add(wholeMonthDiff - 1, 'months'); + // linear across the month + adjust = (b - anchor) / (anchor - anchor2); + } else { + anchor2 = a.clone().add(wholeMonthDiff + 1, 'months'); + // linear across the month + adjust = (b - anchor) / (anchor2 - anchor); + } + + //check for negative zero, return zero if negative zero + return -(wholeMonthDiff + adjust) || 0; + } + + hooks.defaultFormat = 'YYYY-MM-DDTHH:mm:ssZ'; + hooks.defaultFormatUtc = 'YYYY-MM-DDTHH:mm:ss[Z]'; + + function toString() { + return this.clone().locale('en').format('ddd MMM DD YYYY HH:mm:ss [GMT]ZZ'); + } + + function toISOString(keepOffset) { + if (!this.isValid()) { + return null; + } + var utc = keepOffset !== true, + m = utc ? this.clone().utc() : this; + if (m.year() < 0 || m.year() > 9999) { + return formatMoment( + m, + utc + ? 'YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]' + : 'YYYYYY-MM-DD[T]HH:mm:ss.SSSZ' + ); + } + if (isFunction(Date.prototype.toISOString)) { + // native implementation is ~50x faster, use it when we can + if (utc) { + return this.toDate().toISOString(); + } else { + return new Date(this.valueOf() + this.utcOffset() * 60 * 1000) + .toISOString() + .replace('Z', formatMoment(m, 'Z')); + } + } + return formatMoment( + m, + utc ? 'YYYY-MM-DD[T]HH:mm:ss.SSS[Z]' : 'YYYY-MM-DD[T]HH:mm:ss.SSSZ' + ); + } + + /** + * Return a human readable representation of a moment that can + * also be evaluated to get a new moment which is the same + * + * @link https://nodejs.org/dist/latest/docs/api/util.html#util_custom_inspect_function_on_objects + */ + function inspect() { + if (!this.isValid()) { + return 'moment.invalid(/* ' + this._i + ' */)'; + } + var func = 'moment', + zone = '', + prefix, + year, + datetime, + suffix; + if (!this.isLocal()) { + func = this.utcOffset() === 0 ? 'moment.utc' : 'moment.parseZone'; + zone = 'Z'; + } + prefix = '[' + func + '("]'; + year = 0 <= this.year() && this.year() <= 9999 ? 'YYYY' : 'YYYYYY'; + datetime = '-MM-DD[T]HH:mm:ss.SSS'; + suffix = zone + '[")]'; + + return this.format(prefix + year + datetime + suffix); + } + + function format(inputString) { + if (!inputString) { + inputString = this.isUtc() + ? hooks.defaultFormatUtc + : hooks.defaultFormat; + } + var output = formatMoment(this, inputString); + return this.localeData().postformat(output); + } + + function from(time, withoutSuffix) { + if ( + this.isValid() && + ((isMoment(time) && time.isValid()) || createLocal(time).isValid()) + ) { + return createDuration({ to: this, from: time }) + .locale(this.locale()) + .humanize(!withoutSuffix); + } else { + return this.localeData().invalidDate(); + } + } + + function fromNow(withoutSuffix) { + return this.from(createLocal(), withoutSuffix); + } + + function to(time, withoutSuffix) { + if ( + this.isValid() && + ((isMoment(time) && time.isValid()) || createLocal(time).isValid()) + ) { + return createDuration({ from: this, to: time }) + .locale(this.locale()) + .humanize(!withoutSuffix); + } else { + return this.localeData().invalidDate(); + } + } + + function toNow(withoutSuffix) { + return this.to(createLocal(), withoutSuffix); + } + + // If passed a locale key, it will set the locale for this + // instance. Otherwise, it will return the locale configuration + // variables for this instance. + function locale(key) { + var newLocaleData; + + if (key === undefined) { + return this._locale._abbr; + } else { + newLocaleData = getLocale(key); + if (newLocaleData != null) { + this._locale = newLocaleData; + } + return this; + } + } + + var lang = deprecate( + 'moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.', + function (key) { + if (key === undefined) { + return this.localeData(); + } else { + return this.locale(key); + } + } + ); + + function localeData() { + return this._locale; + } + + var MS_PER_SECOND = 1000, + MS_PER_MINUTE = 60 * MS_PER_SECOND, + MS_PER_HOUR = 60 * MS_PER_MINUTE, + MS_PER_400_YEARS = (365 * 400 + 97) * 24 * MS_PER_HOUR; + + // actual modulo - handles negative numbers (for dates before 1970): + function mod$1(dividend, divisor) { + return ((dividend % divisor) + divisor) % divisor; + } + + function localStartOfDate(y, m, d) { + // the date constructor remaps years 0-99 to 1900-1999 + if (y < 100 && y >= 0) { + // preserve leap years using a full 400 year cycle, then reset + return new Date(y + 400, m, d) - MS_PER_400_YEARS; + } else { + return new Date(y, m, d).valueOf(); + } + } + + function utcStartOfDate(y, m, d) { + // Date.UTC remaps years 0-99 to 1900-1999 + if (y < 100 && y >= 0) { + // preserve leap years using a full 400 year cycle, then reset + return Date.UTC(y + 400, m, d) - MS_PER_400_YEARS; + } else { + return Date.UTC(y, m, d); + } + } + + function startOf(units) { + var time, startOfDate; + units = normalizeUnits(units); + if (units === undefined || units === 'millisecond' || !this.isValid()) { + return this; + } + + startOfDate = this._isUTC ? utcStartOfDate : localStartOfDate; + + switch (units) { + case 'year': + time = startOfDate(this.year(), 0, 1); + break; + case 'quarter': + time = startOfDate( + this.year(), + this.month() - (this.month() % 3), + 1 + ); + break; + case 'month': + time = startOfDate(this.year(), this.month(), 1); + break; + case 'week': + time = startOfDate( + this.year(), + this.month(), + this.date() - this.weekday() + ); + break; + case 'isoWeek': + time = startOfDate( + this.year(), + this.month(), + this.date() - (this.isoWeekday() - 1) + ); + break; + case 'day': + case 'date': + time = startOfDate(this.year(), this.month(), this.date()); + break; + case 'hour': + time = this._d.valueOf(); + time -= mod$1( + time + (this._isUTC ? 0 : this.utcOffset() * MS_PER_MINUTE), + MS_PER_HOUR + ); + break; + case 'minute': + time = this._d.valueOf(); + time -= mod$1(time, MS_PER_MINUTE); + break; + case 'second': + time = this._d.valueOf(); + time -= mod$1(time, MS_PER_SECOND); + break; + } + + this._d.setTime(time); + hooks.updateOffset(this, true); + return this; + } + + function endOf(units) { + var time, startOfDate; + units = normalizeUnits(units); + if (units === undefined || units === 'millisecond' || !this.isValid()) { + return this; + } + + startOfDate = this._isUTC ? utcStartOfDate : localStartOfDate; + + switch (units) { + case 'year': + time = startOfDate(this.year() + 1, 0, 1) - 1; + break; + case 'quarter': + time = + startOfDate( + this.year(), + this.month() - (this.month() % 3) + 3, + 1 + ) - 1; + break; + case 'month': + time = startOfDate(this.year(), this.month() + 1, 1) - 1; + break; + case 'week': + time = + startOfDate( + this.year(), + this.month(), + this.date() - this.weekday() + 7 + ) - 1; + break; + case 'isoWeek': + time = + startOfDate( + this.year(), + this.month(), + this.date() - (this.isoWeekday() - 1) + 7 + ) - 1; + break; + case 'day': + case 'date': + time = startOfDate(this.year(), this.month(), this.date() + 1) - 1; + break; + case 'hour': + time = this._d.valueOf(); + time += + MS_PER_HOUR - + mod$1( + time + (this._isUTC ? 0 : this.utcOffset() * MS_PER_MINUTE), + MS_PER_HOUR + ) - + 1; + break; + case 'minute': + time = this._d.valueOf(); + time += MS_PER_MINUTE - mod$1(time, MS_PER_MINUTE) - 1; + break; + case 'second': + time = this._d.valueOf(); + time += MS_PER_SECOND - mod$1(time, MS_PER_SECOND) - 1; + break; + } + + this._d.setTime(time); + hooks.updateOffset(this, true); + return this; + } + + function valueOf() { + return this._d.valueOf() - (this._offset || 0) * 60000; + } + + function unix() { + return Math.floor(this.valueOf() / 1000); + } + + function toDate() { + return new Date(this.valueOf()); + } + + function toArray() { + var m = this; + return [ + m.year(), + m.month(), + m.date(), + m.hour(), + m.minute(), + m.second(), + m.millisecond(), + ]; + } + + function toObject() { + var m = this; + return { + years: m.year(), + months: m.month(), + date: m.date(), + hours: m.hours(), + minutes: m.minutes(), + seconds: m.seconds(), + milliseconds: m.milliseconds(), + }; + } + + function toJSON() { + // new Date(NaN).toJSON() === null + return this.isValid() ? this.toISOString() : null; + } + + function isValid$2() { + return isValid(this); + } + + function parsingFlags() { + return extend({}, getParsingFlags(this)); + } + + function invalidAt() { + return getParsingFlags(this).overflow; + } + + function creationData() { + return { + input: this._i, + format: this._f, + locale: this._locale, + isUTC: this._isUTC, + strict: this._strict, + }; + } + + addFormatToken('N', 0, 0, 'eraAbbr'); + addFormatToken('NN', 0, 0, 'eraAbbr'); + addFormatToken('NNN', 0, 0, 'eraAbbr'); + addFormatToken('NNNN', 0, 0, 'eraName'); + addFormatToken('NNNNN', 0, 0, 'eraNarrow'); + + addFormatToken('y', ['y', 1], 'yo', 'eraYear'); + addFormatToken('y', ['yy', 2], 0, 'eraYear'); + addFormatToken('y', ['yyy', 3], 0, 'eraYear'); + addFormatToken('y', ['yyyy', 4], 0, 'eraYear'); + + addRegexToken('N', matchEraAbbr); + addRegexToken('NN', matchEraAbbr); + addRegexToken('NNN', matchEraAbbr); + addRegexToken('NNNN', matchEraName); + addRegexToken('NNNNN', matchEraNarrow); + + addParseToken(['N', 'NN', 'NNN', 'NNNN', 'NNNNN'], function ( + input, + array, + config, + token + ) { + var era = config._locale.erasParse(input, token, config._strict); + if (era) { + getParsingFlags(config).era = era; + } else { + getParsingFlags(config).invalidEra = input; + } + }); + + addRegexToken('y', matchUnsigned); + addRegexToken('yy', matchUnsigned); + addRegexToken('yyy', matchUnsigned); + addRegexToken('yyyy', matchUnsigned); + addRegexToken('yo', matchEraYearOrdinal); + + addParseToken(['y', 'yy', 'yyy', 'yyyy'], YEAR); + addParseToken(['yo'], function (input, array, config, token) { + var match; + if (config._locale._eraYearOrdinalRegex) { + match = input.match(config._locale._eraYearOrdinalRegex); + } + + if (config._locale.eraYearOrdinalParse) { + array[YEAR] = config._locale.eraYearOrdinalParse(input, match); + } else { + array[YEAR] = parseInt(input, 10); + } + }); + + function localeEras(m, format) { + var i, + l, + date, + eras = this._eras || getLocale('en')._eras; + for (i = 0, l = eras.length; i < l; ++i) { + switch (typeof eras[i].since) { + case 'string': + // truncate time + date = hooks(eras[i].since).startOf('day'); + eras[i].since = date.valueOf(); + break; + } + + switch (typeof eras[i].until) { + case 'undefined': + eras[i].until = +Infinity; + break; + case 'string': + // truncate time + date = hooks(eras[i].until).startOf('day').valueOf(); + eras[i].until = date.valueOf(); + break; + } + } + return eras; + } + + function localeErasParse(eraName, format, strict) { + var i, + l, + eras = this.eras(), + name, + abbr, + narrow; + eraName = eraName.toUpperCase(); + + for (i = 0, l = eras.length; i < l; ++i) { + name = eras[i].name.toUpperCase(); + abbr = eras[i].abbr.toUpperCase(); + narrow = eras[i].narrow.toUpperCase(); + + if (strict) { + switch (format) { + case 'N': + case 'NN': + case 'NNN': + if (abbr === eraName) { + return eras[i]; + } + break; + + case 'NNNN': + if (name === eraName) { + return eras[i]; + } + break; + + case 'NNNNN': + if (narrow === eraName) { + return eras[i]; + } + break; + } + } else if ([name, abbr, narrow].indexOf(eraName) >= 0) { + return eras[i]; + } + } + } + + function localeErasConvertYear(era, year) { + var dir = era.since <= era.until ? +1 : -1; + if (year === undefined) { + return hooks(era.since).year(); + } else { + return hooks(era.since).year() + (year - era.offset) * dir; + } + } + + function getEraName() { + var i, + l, + val, + eras = this.localeData().eras(); + for (i = 0, l = eras.length; i < l; ++i) { + // truncate time + val = this.clone().startOf('day').valueOf(); + + if (eras[i].since <= val && val <= eras[i].until) { + return eras[i].name; + } + if (eras[i].until <= val && val <= eras[i].since) { + return eras[i].name; + } + } + + return ''; + } + + function getEraNarrow() { + var i, + l, + val, + eras = this.localeData().eras(); + for (i = 0, l = eras.length; i < l; ++i) { + // truncate time + val = this.clone().startOf('day').valueOf(); + + if (eras[i].since <= val && val <= eras[i].until) { + return eras[i].narrow; + } + if (eras[i].until <= val && val <= eras[i].since) { + return eras[i].narrow; + } + } + + return ''; + } + + function getEraAbbr() { + var i, + l, + val, + eras = this.localeData().eras(); + for (i = 0, l = eras.length; i < l; ++i) { + // truncate time + val = this.clone().startOf('day').valueOf(); + + if (eras[i].since <= val && val <= eras[i].until) { + return eras[i].abbr; + } + if (eras[i].until <= val && val <= eras[i].since) { + return eras[i].abbr; + } + } + + return ''; + } + + function getEraYear() { + var i, + l, + dir, + val, + eras = this.localeData().eras(); + for (i = 0, l = eras.length; i < l; ++i) { + dir = eras[i].since <= eras[i].until ? +1 : -1; + + // truncate time + val = this.clone().startOf('day').valueOf(); + + if ( + (eras[i].since <= val && val <= eras[i].until) || + (eras[i].until <= val && val <= eras[i].since) + ) { + return ( + (this.year() - hooks(eras[i].since).year()) * dir + + eras[i].offset + ); + } + } + + return this.year(); + } + + function erasNameRegex(isStrict) { + if (!hasOwnProp(this, '_erasNameRegex')) { + computeErasParse.call(this); + } + return isStrict ? this._erasNameRegex : this._erasRegex; + } + + function erasAbbrRegex(isStrict) { + if (!hasOwnProp(this, '_erasAbbrRegex')) { + computeErasParse.call(this); + } + return isStrict ? this._erasAbbrRegex : this._erasRegex; + } + + function erasNarrowRegex(isStrict) { + if (!hasOwnProp(this, '_erasNarrowRegex')) { + computeErasParse.call(this); + } + return isStrict ? this._erasNarrowRegex : this._erasRegex; + } + + function matchEraAbbr(isStrict, locale) { + return locale.erasAbbrRegex(isStrict); + } + + function matchEraName(isStrict, locale) { + return locale.erasNameRegex(isStrict); + } + + function matchEraNarrow(isStrict, locale) { + return locale.erasNarrowRegex(isStrict); + } + + function matchEraYearOrdinal(isStrict, locale) { + return locale._eraYearOrdinalRegex || matchUnsigned; + } + + function computeErasParse() { + var abbrPieces = [], + namePieces = [], + narrowPieces = [], + mixedPieces = [], + i, + l, + eras = this.eras(); + + for (i = 0, l = eras.length; i < l; ++i) { + namePieces.push(regexEscape(eras[i].name)); + abbrPieces.push(regexEscape(eras[i].abbr)); + narrowPieces.push(regexEscape(eras[i].narrow)); + + mixedPieces.push(regexEscape(eras[i].name)); + mixedPieces.push(regexEscape(eras[i].abbr)); + mixedPieces.push(regexEscape(eras[i].narrow)); + } + + this._erasRegex = new RegExp('^(' + mixedPieces.join('|') + ')', 'i'); + this._erasNameRegex = new RegExp('^(' + namePieces.join('|') + ')', 'i'); + this._erasAbbrRegex = new RegExp('^(' + abbrPieces.join('|') + ')', 'i'); + this._erasNarrowRegex = new RegExp( + '^(' + narrowPieces.join('|') + ')', + 'i' + ); + } + + // FORMATTING + + addFormatToken(0, ['gg', 2], 0, function () { + return this.weekYear() % 100; + }); + + addFormatToken(0, ['GG', 2], 0, function () { + return this.isoWeekYear() % 100; + }); + + function addWeekYearFormatToken(token, getter) { + addFormatToken(0, [token, token.length], 0, getter); + } + + addWeekYearFormatToken('gggg', 'weekYear'); + addWeekYearFormatToken('ggggg', 'weekYear'); + addWeekYearFormatToken('GGGG', 'isoWeekYear'); + addWeekYearFormatToken('GGGGG', 'isoWeekYear'); + + // ALIASES + + addUnitAlias('weekYear', 'gg'); + addUnitAlias('isoWeekYear', 'GG'); + + // PRIORITY + + addUnitPriority('weekYear', 1); + addUnitPriority('isoWeekYear', 1); + + // PARSING + + addRegexToken('G', matchSigned); + addRegexToken('g', matchSigned); + addRegexToken('GG', match1to2, match2); + addRegexToken('gg', match1to2, match2); + addRegexToken('GGGG', match1to4, match4); + addRegexToken('gggg', match1to4, match4); + addRegexToken('GGGGG', match1to6, match6); + addRegexToken('ggggg', match1to6, match6); + + addWeekParseToken(['gggg', 'ggggg', 'GGGG', 'GGGGG'], function ( + input, + week, + config, + token + ) { + week[token.substr(0, 2)] = toInt(input); + }); + + addWeekParseToken(['gg', 'GG'], function (input, week, config, token) { + week[token] = hooks.parseTwoDigitYear(input); + }); + + // MOMENTS + + function getSetWeekYear(input) { + return getSetWeekYearHelper.call( + this, + input, + this.week(), + this.weekday(), + this.localeData()._week.dow, + this.localeData()._week.doy + ); + } + + function getSetISOWeekYear(input) { + return getSetWeekYearHelper.call( + this, + input, + this.isoWeek(), + this.isoWeekday(), + 1, + 4 + ); + } + + function getISOWeeksInYear() { + return weeksInYear(this.year(), 1, 4); + } + + function getISOWeeksInISOWeekYear() { + return weeksInYear(this.isoWeekYear(), 1, 4); + } + + function getWeeksInYear() { + var weekInfo = this.localeData()._week; + return weeksInYear(this.year(), weekInfo.dow, weekInfo.doy); + } + + function getWeeksInWeekYear() { + var weekInfo = this.localeData()._week; + return weeksInYear(this.weekYear(), weekInfo.dow, weekInfo.doy); + } + + function getSetWeekYearHelper(input, week, weekday, dow, doy) { + var weeksTarget; + if (input == null) { + return weekOfYear(this, dow, doy).year; + } else { + weeksTarget = weeksInYear(input, dow, doy); + if (week > weeksTarget) { + week = weeksTarget; + } + return setWeekAll.call(this, input, week, weekday, dow, doy); + } + } + + function setWeekAll(weekYear, week, weekday, dow, doy) { + var dayOfYearData = dayOfYearFromWeeks(weekYear, week, weekday, dow, doy), + date = createUTCDate(dayOfYearData.year, 0, dayOfYearData.dayOfYear); + + this.year(date.getUTCFullYear()); + this.month(date.getUTCMonth()); + this.date(date.getUTCDate()); + return this; + } + + // FORMATTING + + addFormatToken('Q', 0, 'Qo', 'quarter'); + + // ALIASES + + addUnitAlias('quarter', 'Q'); + + // PRIORITY + + addUnitPriority('quarter', 7); + + // PARSING + + addRegexToken('Q', match1); + addParseToken('Q', function (input, array) { + array[MONTH] = (toInt(input) - 1) * 3; + }); + + // MOMENTS + + function getSetQuarter(input) { + return input == null + ? Math.ceil((this.month() + 1) / 3) + : this.month((input - 1) * 3 + (this.month() % 3)); + } + + // FORMATTING + + addFormatToken('D', ['DD', 2], 'Do', 'date'); + + // ALIASES + + addUnitAlias('date', 'D'); + + // PRIORITY + addUnitPriority('date', 9); + + // PARSING + + addRegexToken('D', match1to2); + addRegexToken('DD', match1to2, match2); + addRegexToken('Do', function (isStrict, locale) { + // TODO: Remove "ordinalParse" fallback in next major release. + return isStrict + ? locale._dayOfMonthOrdinalParse || locale._ordinalParse + : locale._dayOfMonthOrdinalParseLenient; + }); + + addParseToken(['D', 'DD'], DATE); + addParseToken('Do', function (input, array) { + array[DATE] = toInt(input.match(match1to2)[0]); + }); + + // MOMENTS + + var getSetDayOfMonth = makeGetSet('Date', true); + + // FORMATTING + + addFormatToken('DDD', ['DDDD', 3], 'DDDo', 'dayOfYear'); + + // ALIASES + + addUnitAlias('dayOfYear', 'DDD'); + + // PRIORITY + addUnitPriority('dayOfYear', 4); + + // PARSING + + addRegexToken('DDD', match1to3); + addRegexToken('DDDD', match3); + addParseToken(['DDD', 'DDDD'], function (input, array, config) { + config._dayOfYear = toInt(input); + }); + + // HELPERS + + // MOMENTS + + function getSetDayOfYear(input) { + var dayOfYear = + Math.round( + (this.clone().startOf('day') - this.clone().startOf('year')) / 864e5 + ) + 1; + return input == null ? dayOfYear : this.add(input - dayOfYear, 'd'); + } + + // FORMATTING + + addFormatToken('m', ['mm', 2], 0, 'minute'); + + // ALIASES + + addUnitAlias('minute', 'm'); + + // PRIORITY + + addUnitPriority('minute', 14); + + // PARSING + + addRegexToken('m', match1to2); + addRegexToken('mm', match1to2, match2); + addParseToken(['m', 'mm'], MINUTE); + + // MOMENTS + + var getSetMinute = makeGetSet('Minutes', false); + + // FORMATTING + + addFormatToken('s', ['ss', 2], 0, 'second'); + + // ALIASES + + addUnitAlias('second', 's'); + + // PRIORITY + + addUnitPriority('second', 15); + + // PARSING + + addRegexToken('s', match1to2); + addRegexToken('ss', match1to2, match2); + addParseToken(['s', 'ss'], SECOND); + + // MOMENTS + + var getSetSecond = makeGetSet('Seconds', false); + + // FORMATTING + + addFormatToken('S', 0, 0, function () { + return ~~(this.millisecond() / 100); + }); + + addFormatToken(0, ['SS', 2], 0, function () { + return ~~(this.millisecond() / 10); + }); + + addFormatToken(0, ['SSS', 3], 0, 'millisecond'); + addFormatToken(0, ['SSSS', 4], 0, function () { + return this.millisecond() * 10; + }); + addFormatToken(0, ['SSSSS', 5], 0, function () { + return this.millisecond() * 100; + }); + addFormatToken(0, ['SSSSSS', 6], 0, function () { + return this.millisecond() * 1000; + }); + addFormatToken(0, ['SSSSSSS', 7], 0, function () { + return this.millisecond() * 10000; + }); + addFormatToken(0, ['SSSSSSSS', 8], 0, function () { + return this.millisecond() * 100000; + }); + addFormatToken(0, ['SSSSSSSSS', 9], 0, function () { + return this.millisecond() * 1000000; + }); + + // ALIASES + + addUnitAlias('millisecond', 'ms'); + + // PRIORITY + + addUnitPriority('millisecond', 16); + + // PARSING + + addRegexToken('S', match1to3, match1); + addRegexToken('SS', match1to3, match2); + addRegexToken('SSS', match1to3, match3); + + var token, getSetMillisecond; + for (token = 'SSSS'; token.length <= 9; token += 'S') { + addRegexToken(token, matchUnsigned); + } + + function parseMs(input, array) { + array[MILLISECOND] = toInt(('0.' + input) * 1000); + } + + for (token = 'S'; token.length <= 9; token += 'S') { + addParseToken(token, parseMs); + } + + getSetMillisecond = makeGetSet('Milliseconds', false); + + // FORMATTING + + addFormatToken('z', 0, 0, 'zoneAbbr'); + addFormatToken('zz', 0, 0, 'zoneName'); + + // MOMENTS + + function getZoneAbbr() { + return this._isUTC ? 'UTC' : ''; + } + + function getZoneName() { + return this._isUTC ? 'Coordinated Universal Time' : ''; + } + + var proto = Moment.prototype; + + proto.add = add; + proto.calendar = calendar$1; + proto.clone = clone; + proto.diff = diff; + proto.endOf = endOf; + proto.format = format; + proto.from = from; + proto.fromNow = fromNow; + proto.to = to; + proto.toNow = toNow; + proto.get = stringGet; + proto.invalidAt = invalidAt; + proto.isAfter = isAfter; + proto.isBefore = isBefore; + proto.isBetween = isBetween; + proto.isSame = isSame; + proto.isSameOrAfter = isSameOrAfter; + proto.isSameOrBefore = isSameOrBefore; + proto.isValid = isValid$2; + proto.lang = lang; + proto.locale = locale; + proto.localeData = localeData; + proto.max = prototypeMax; + proto.min = prototypeMin; + proto.parsingFlags = parsingFlags; + proto.set = stringSet; + proto.startOf = startOf; + proto.subtract = subtract; + proto.toArray = toArray; + proto.toObject = toObject; + proto.toDate = toDate; + proto.toISOString = toISOString; + proto.inspect = inspect; + if (typeof Symbol !== 'undefined' && Symbol.for != null) { + proto[Symbol.for('nodejs.util.inspect.custom')] = function () { + return 'Moment<' + this.format() + '>'; + }; + } + proto.toJSON = toJSON; + proto.toString = toString; + proto.unix = unix; + proto.valueOf = valueOf; + proto.creationData = creationData; + proto.eraName = getEraName; + proto.eraNarrow = getEraNarrow; + proto.eraAbbr = getEraAbbr; + proto.eraYear = getEraYear; + proto.year = getSetYear; + proto.isLeapYear = getIsLeapYear; + proto.weekYear = getSetWeekYear; + proto.isoWeekYear = getSetISOWeekYear; + proto.quarter = proto.quarters = getSetQuarter; + proto.month = getSetMonth; + proto.daysInMonth = getDaysInMonth; + proto.week = proto.weeks = getSetWeek; + proto.isoWeek = proto.isoWeeks = getSetISOWeek; + proto.weeksInYear = getWeeksInYear; + proto.weeksInWeekYear = getWeeksInWeekYear; + proto.isoWeeksInYear = getISOWeeksInYear; + proto.isoWeeksInISOWeekYear = getISOWeeksInISOWeekYear; + proto.date = getSetDayOfMonth; + proto.day = proto.days = getSetDayOfWeek; + proto.weekday = getSetLocaleDayOfWeek; + proto.isoWeekday = getSetISODayOfWeek; + proto.dayOfYear = getSetDayOfYear; + proto.hour = proto.hours = getSetHour; + proto.minute = proto.minutes = getSetMinute; + proto.second = proto.seconds = getSetSecond; + proto.millisecond = proto.milliseconds = getSetMillisecond; + proto.utcOffset = getSetOffset; + proto.utc = setOffsetToUTC; + proto.local = setOffsetToLocal; + proto.parseZone = setOffsetToParsedOffset; + proto.hasAlignedHourOffset = hasAlignedHourOffset; + proto.isDST = isDaylightSavingTime; + proto.isLocal = isLocal; + proto.isUtcOffset = isUtcOffset; + proto.isUtc = isUtc; + proto.isUTC = isUtc; + proto.zoneAbbr = getZoneAbbr; + proto.zoneName = getZoneName; + proto.dates = deprecate( + 'dates accessor is deprecated. Use date instead.', + getSetDayOfMonth + ); + proto.months = deprecate( + 'months accessor is deprecated. Use month instead', + getSetMonth + ); + proto.years = deprecate( + 'years accessor is deprecated. Use year instead', + getSetYear + ); + proto.zone = deprecate( + 'moment().zone is deprecated, use moment().utcOffset instead. http://momentjs.com/guides/#/warnings/zone/', + getSetZone + ); + proto.isDSTShifted = deprecate( + 'isDSTShifted is deprecated. See http://momentjs.com/guides/#/warnings/dst-shifted/ for more information', + isDaylightSavingTimeShifted + ); + + function createUnix(input) { + return createLocal(input * 1000); + } + + function createInZone() { + return createLocal.apply(null, arguments).parseZone(); + } + + function preParsePostFormat(string) { + return string; + } + + var proto$1 = Locale.prototype; + + proto$1.calendar = calendar; + proto$1.longDateFormat = longDateFormat; + proto$1.invalidDate = invalidDate; + proto$1.ordinal = ordinal; + proto$1.preparse = preParsePostFormat; + proto$1.postformat = preParsePostFormat; + proto$1.relativeTime = relativeTime; + proto$1.pastFuture = pastFuture; + proto$1.set = set; + proto$1.eras = localeEras; + proto$1.erasParse = localeErasParse; + proto$1.erasConvertYear = localeErasConvertYear; + proto$1.erasAbbrRegex = erasAbbrRegex; + proto$1.erasNameRegex = erasNameRegex; + proto$1.erasNarrowRegex = erasNarrowRegex; + + proto$1.months = localeMonths; + proto$1.monthsShort = localeMonthsShort; + proto$1.monthsParse = localeMonthsParse; + proto$1.monthsRegex = monthsRegex; + proto$1.monthsShortRegex = monthsShortRegex; + proto$1.week = localeWeek; + proto$1.firstDayOfYear = localeFirstDayOfYear; + proto$1.firstDayOfWeek = localeFirstDayOfWeek; + + proto$1.weekdays = localeWeekdays; + proto$1.weekdaysMin = localeWeekdaysMin; + proto$1.weekdaysShort = localeWeekdaysShort; + proto$1.weekdaysParse = localeWeekdaysParse; + + proto$1.weekdaysRegex = weekdaysRegex; + proto$1.weekdaysShortRegex = weekdaysShortRegex; + proto$1.weekdaysMinRegex = weekdaysMinRegex; + + proto$1.isPM = localeIsPM; + proto$1.meridiem = localeMeridiem; + + function get$1(format, index, field, setter) { + var locale = getLocale(), + utc = createUTC().set(setter, index); + return locale[field](utc, format); + } + + function listMonthsImpl(format, index, field) { + if (isNumber(format)) { + index = format; + format = undefined; + } + + format = format || ''; + + if (index != null) { + return get$1(format, index, field, 'month'); + } + + var i, + out = []; + for (i = 0; i < 12; i++) { + out[i] = get$1(format, i, field, 'month'); + } + return out; + } + + // () + // (5) + // (fmt, 5) + // (fmt) + // (true) + // (true, 5) + // (true, fmt, 5) + // (true, fmt) + function listWeekdaysImpl(localeSorted, format, index, field) { + if (typeof localeSorted === 'boolean') { + if (isNumber(format)) { + index = format; + format = undefined; + } + + format = format || ''; + } else { + format = localeSorted; + index = format; + localeSorted = false; + + if (isNumber(format)) { + index = format; + format = undefined; + } + + format = format || ''; + } + + var locale = getLocale(), + shift = localeSorted ? locale._week.dow : 0, + i, + out = []; + + if (index != null) { + return get$1(format, (index + shift) % 7, field, 'day'); + } + + for (i = 0; i < 7; i++) { + out[i] = get$1(format, (i + shift) % 7, field, 'day'); + } + return out; + } + + function listMonths(format, index) { + return listMonthsImpl(format, index, 'months'); + } + + function listMonthsShort(format, index) { + return listMonthsImpl(format, index, 'monthsShort'); + } + + function listWeekdays(localeSorted, format, index) { + return listWeekdaysImpl(localeSorted, format, index, 'weekdays'); + } + + function listWeekdaysShort(localeSorted, format, index) { + return listWeekdaysImpl(localeSorted, format, index, 'weekdaysShort'); + } + + function listWeekdaysMin(localeSorted, format, index) { + return listWeekdaysImpl(localeSorted, format, index, 'weekdaysMin'); + } + + getSetGlobalLocale('en', { + eras: [ + { + since: '0001-01-01', + until: +Infinity, + offset: 1, + name: 'Anno Domini', + narrow: 'AD', + abbr: 'AD', + }, + { + since: '0000-12-31', + until: -Infinity, + offset: 1, + name: 'Before Christ', + narrow: 'BC', + abbr: 'BC', + }, + ], + dayOfMonthOrdinalParse: /\d{1,2}(th|st|nd|rd)/, + ordinal: function (number) { + var b = number % 10, + output = + toInt((number % 100) / 10) === 1 + ? 'th' + : b === 1 + ? 'st' + : b === 2 + ? 'nd' + : b === 3 + ? 'rd' + : 'th'; + return number + output; + }, + }); + + // Side effect imports + + hooks.lang = deprecate( + 'moment.lang is deprecated. Use moment.locale instead.', + getSetGlobalLocale + ); + hooks.langData = deprecate( + 'moment.langData is deprecated. Use moment.localeData instead.', + getLocale + ); + + var mathAbs = Math.abs; + + function abs() { + var data = this._data; + + this._milliseconds = mathAbs(this._milliseconds); + this._days = mathAbs(this._days); + this._months = mathAbs(this._months); + + data.milliseconds = mathAbs(data.milliseconds); + data.seconds = mathAbs(data.seconds); + data.minutes = mathAbs(data.minutes); + data.hours = mathAbs(data.hours); + data.months = mathAbs(data.months); + data.years = mathAbs(data.years); + + return this; + } + + function addSubtract$1(duration, input, value, direction) { + var other = createDuration(input, value); + + duration._milliseconds += direction * other._milliseconds; + duration._days += direction * other._days; + duration._months += direction * other._months; + + return duration._bubble(); + } + + // supports only 2.0-style add(1, 's') or add(duration) + function add$1(input, value) { + return addSubtract$1(this, input, value, 1); + } + + // supports only 2.0-style subtract(1, 's') or subtract(duration) + function subtract$1(input, value) { + return addSubtract$1(this, input, value, -1); + } + + function absCeil(number) { + if (number < 0) { + return Math.floor(number); + } else { + return Math.ceil(number); + } + } + + function bubble() { + var milliseconds = this._milliseconds, + days = this._days, + months = this._months, + data = this._data, + seconds, + minutes, + hours, + years, + monthsFromDays; + + // if we have a mix of positive and negative values, bubble down first + // check: https://github.com/moment/moment/issues/2166 + if ( + !( + (milliseconds >= 0 && days >= 0 && months >= 0) || + (milliseconds <= 0 && days <= 0 && months <= 0) + ) + ) { + milliseconds += absCeil(monthsToDays(months) + days) * 864e5; + days = 0; + months = 0; + } + + // The following code bubbles up values, see the tests for + // examples of what that means. + data.milliseconds = milliseconds % 1000; + + seconds = absFloor(milliseconds / 1000); + data.seconds = seconds % 60; + + minutes = absFloor(seconds / 60); + data.minutes = minutes % 60; + + hours = absFloor(minutes / 60); + data.hours = hours % 24; + + days += absFloor(hours / 24); + + // convert days to months + monthsFromDays = absFloor(daysToMonths(days)); + months += monthsFromDays; + days -= absCeil(monthsToDays(monthsFromDays)); + + // 12 months -> 1 year + years = absFloor(months / 12); + months %= 12; + + data.days = days; + data.months = months; + data.years = years; + + return this; + } + + function daysToMonths(days) { + // 400 years have 146097 days (taking into account leap year rules) + // 400 years have 12 months === 4800 + return (days * 4800) / 146097; + } + + function monthsToDays(months) { + // the reverse of daysToMonths + return (months * 146097) / 4800; + } + + function as(units) { + if (!this.isValid()) { + return NaN; + } + var days, + months, + milliseconds = this._milliseconds; + + units = normalizeUnits(units); + + if (units === 'month' || units === 'quarter' || units === 'year') { + days = this._days + milliseconds / 864e5; + months = this._months + daysToMonths(days); + switch (units) { + case 'month': + return months; + case 'quarter': + return months / 3; + case 'year': + return months / 12; + } + } else { + // handle milliseconds separately because of floating point math errors (issue #1867) + days = this._days + Math.round(monthsToDays(this._months)); + switch (units) { + case 'week': + return days / 7 + milliseconds / 6048e5; + case 'day': + return days + milliseconds / 864e5; + case 'hour': + return days * 24 + milliseconds / 36e5; + case 'minute': + return days * 1440 + milliseconds / 6e4; + case 'second': + return days * 86400 + milliseconds / 1000; + // Math.floor prevents floating point math errors here + case 'millisecond': + return Math.floor(days * 864e5) + milliseconds; + default: + throw new Error('Unknown unit ' + units); + } + } + } + + // TODO: Use this.as('ms')? + function valueOf$1() { + if (!this.isValid()) { + return NaN; + } + return ( + this._milliseconds + + this._days * 864e5 + + (this._months % 12) * 2592e6 + + toInt(this._months / 12) * 31536e6 + ); + } + + function makeAs(alias) { + return function () { + return this.as(alias); + }; + } + + var asMilliseconds = makeAs('ms'), + asSeconds = makeAs('s'), + asMinutes = makeAs('m'), + asHours = makeAs('h'), + asDays = makeAs('d'), + asWeeks = makeAs('w'), + asMonths = makeAs('M'), + asQuarters = makeAs('Q'), + asYears = makeAs('y'); + + function clone$1() { + return createDuration(this); + } + + function get$2(units) { + units = normalizeUnits(units); + return this.isValid() ? this[units + 's']() : NaN; + } + + function makeGetter(name) { + return function () { + return this.isValid() ? this._data[name] : NaN; + }; + } + + var milliseconds = makeGetter('milliseconds'), + seconds = makeGetter('seconds'), + minutes = makeGetter('minutes'), + hours = makeGetter('hours'), + days = makeGetter('days'), + months = makeGetter('months'), + years = makeGetter('years'); + + function weeks() { + return absFloor(this.days() / 7); + } + + var round = Math.round, + thresholds = { + ss: 44, // a few seconds to seconds + s: 45, // seconds to minute + m: 45, // minutes to hour + h: 22, // hours to day + d: 26, // days to month/week + w: null, // weeks to month + M: 11, // months to year + }; + + // helper function for moment.fn.from, moment.fn.fromNow, and moment.duration.fn.humanize + function substituteTimeAgo(string, number, withoutSuffix, isFuture, locale) { + return locale.relativeTime(number || 1, !!withoutSuffix, string, isFuture); + } + + function relativeTime$1(posNegDuration, withoutSuffix, thresholds, locale) { + var duration = createDuration(posNegDuration).abs(), + seconds = round(duration.as('s')), + minutes = round(duration.as('m')), + hours = round(duration.as('h')), + days = round(duration.as('d')), + months = round(duration.as('M')), + weeks = round(duration.as('w')), + years = round(duration.as('y')), + a = + (seconds <= thresholds.ss && ['s', seconds]) || + (seconds < thresholds.s && ['ss', seconds]) || + (minutes <= 1 && ['m']) || + (minutes < thresholds.m && ['mm', minutes]) || + (hours <= 1 && ['h']) || + (hours < thresholds.h && ['hh', hours]) || + (days <= 1 && ['d']) || + (days < thresholds.d && ['dd', days]); + + if (thresholds.w != null) { + a = + a || + (weeks <= 1 && ['w']) || + (weeks < thresholds.w && ['ww', weeks]); + } + a = a || + (months <= 1 && ['M']) || + (months < thresholds.M && ['MM', months]) || + (years <= 1 && ['y']) || ['yy', years]; + + a[2] = withoutSuffix; + a[3] = +posNegDuration > 0; + a[4] = locale; + return substituteTimeAgo.apply(null, a); + } + + // This function allows you to set the rounding function for relative time strings + function getSetRelativeTimeRounding(roundingFunction) { + if (roundingFunction === undefined) { + return round; + } + if (typeof roundingFunction === 'function') { + round = roundingFunction; + return true; + } + return false; + } + + // This function allows you to set a threshold for relative time strings + function getSetRelativeTimeThreshold(threshold, limit) { + if (thresholds[threshold] === undefined) { + return false; + } + if (limit === undefined) { + return thresholds[threshold]; + } + thresholds[threshold] = limit; + if (threshold === 's') { + thresholds.ss = limit - 1; + } + return true; + } + + function humanize(argWithSuffix, argThresholds) { + if (!this.isValid()) { + return this.localeData().invalidDate(); + } + + var withSuffix = false, + th = thresholds, + locale, + output; + + if (typeof argWithSuffix === 'object') { + argThresholds = argWithSuffix; + argWithSuffix = false; + } + if (typeof argWithSuffix === 'boolean') { + withSuffix = argWithSuffix; + } + if (typeof argThresholds === 'object') { + th = Object.assign({}, thresholds, argThresholds); + if (argThresholds.s != null && argThresholds.ss == null) { + th.ss = argThresholds.s - 1; + } + } + + locale = this.localeData(); + output = relativeTime$1(this, !withSuffix, th, locale); + + if (withSuffix) { + output = locale.pastFuture(+this, output); + } + + return locale.postformat(output); + } + + var abs$1 = Math.abs; + + function sign(x) { + return (x > 0) - (x < 0) || +x; + } + + function toISOString$1() { + // for ISO strings we do not use the normal bubbling rules: + // * milliseconds bubble up until they become hours + // * days do not bubble at all + // * months bubble up until they become years + // This is because there is no context-free conversion between hours and days + // (think of clock changes) + // and also not between days and months (28-31 days per month) + if (!this.isValid()) { + return this.localeData().invalidDate(); + } + + var seconds = abs$1(this._milliseconds) / 1000, + days = abs$1(this._days), + months = abs$1(this._months), + minutes, + hours, + years, + s, + total = this.asSeconds(), + totalSign, + ymSign, + daysSign, + hmsSign; + + if (!total) { + // this is the same as C#'s (Noda) and python (isodate)... + // but not other JS (goog.date) + return 'P0D'; + } + + // 3600 seconds -> 60 minutes -> 1 hour + minutes = absFloor(seconds / 60); + hours = absFloor(minutes / 60); + seconds %= 60; + minutes %= 60; + + // 12 months -> 1 year + years = absFloor(months / 12); + months %= 12; + + // inspired by https://github.com/dordille/moment-isoduration/blob/master/moment.isoduration.js + s = seconds ? seconds.toFixed(3).replace(/\.?0+$/, '') : ''; + + totalSign = total < 0 ? '-' : ''; + ymSign = sign(this._months) !== sign(total) ? '-' : ''; + daysSign = sign(this._days) !== sign(total) ? '-' : ''; + hmsSign = sign(this._milliseconds) !== sign(total) ? '-' : ''; + + return ( + totalSign + + 'P' + + (years ? ymSign + years + 'Y' : '') + + (months ? ymSign + months + 'M' : '') + + (days ? daysSign + days + 'D' : '') + + (hours || minutes || seconds ? 'T' : '') + + (hours ? hmsSign + hours + 'H' : '') + + (minutes ? hmsSign + minutes + 'M' : '') + + (seconds ? hmsSign + s + 'S' : '') + ); + } + + var proto$2 = Duration.prototype; + + proto$2.isValid = isValid$1; + proto$2.abs = abs; + proto$2.add = add$1; + proto$2.subtract = subtract$1; + proto$2.as = as; + proto$2.asMilliseconds = asMilliseconds; + proto$2.asSeconds = asSeconds; + proto$2.asMinutes = asMinutes; + proto$2.asHours = asHours; + proto$2.asDays = asDays; + proto$2.asWeeks = asWeeks; + proto$2.asMonths = asMonths; + proto$2.asQuarters = asQuarters; + proto$2.asYears = asYears; + proto$2.valueOf = valueOf$1; + proto$2._bubble = bubble; + proto$2.clone = clone$1; + proto$2.get = get$2; + proto$2.milliseconds = milliseconds; + proto$2.seconds = seconds; + proto$2.minutes = minutes; + proto$2.hours = hours; + proto$2.days = days; + proto$2.weeks = weeks; + proto$2.months = months; + proto$2.years = years; + proto$2.humanize = humanize; + proto$2.toISOString = toISOString$1; + proto$2.toString = toISOString$1; + proto$2.toJSON = toISOString$1; + proto$2.locale = locale; + proto$2.localeData = localeData; + + proto$2.toIsoString = deprecate( + 'toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)', + toISOString$1 + ); + proto$2.lang = lang; + + // FORMATTING + + addFormatToken('X', 0, 0, 'unix'); + addFormatToken('x', 0, 0, 'valueOf'); + + // PARSING + + addRegexToken('x', matchSigned); + addRegexToken('X', matchTimestamp); + addParseToken('X', function (input, array, config) { + config._d = new Date(parseFloat(input) * 1000); + }); + addParseToken('x', function (input, array, config) { + config._d = new Date(toInt(input)); + }); + + //! moment.js + + hooks.version = '2.28.0'; + + setHookCallback(createLocal); + + hooks.fn = proto; + hooks.min = min; + hooks.max = max; + hooks.now = now; + hooks.utc = createUTC; + hooks.unix = createUnix; + hooks.months = listMonths; + hooks.isDate = isDate; + hooks.locale = getSetGlobalLocale; + hooks.invalid = createInvalid; + hooks.duration = createDuration; + hooks.isMoment = isMoment; + hooks.weekdays = listWeekdays; + hooks.parseZone = createInZone; + hooks.localeData = getLocale; + hooks.isDuration = isDuration; + hooks.monthsShort = listMonthsShort; + hooks.weekdaysMin = listWeekdaysMin; + hooks.defineLocale = defineLocale; + hooks.updateLocale = updateLocale; + hooks.locales = listLocales; + hooks.weekdaysShort = listWeekdaysShort; + hooks.normalizeUnits = normalizeUnits; + hooks.relativeTimeRounding = getSetRelativeTimeRounding; + hooks.relativeTimeThreshold = getSetRelativeTimeThreshold; + hooks.calendarFormat = getCalendarFormat; + hooks.prototype = proto; + + // currently HTML5 input type only supports 24-hour formats + hooks.HTML5_FMT = { + DATETIME_LOCAL: 'YYYY-MM-DDTHH:mm', // + DATETIME_LOCAL_SECONDS: 'YYYY-MM-DDTHH:mm:ss', // + DATETIME_LOCAL_MS: 'YYYY-MM-DDTHH:mm:ss.SSS', // + DATE: 'YYYY-MM-DD', // + TIME: 'HH:mm', // + TIME_SECONDS: 'HH:mm:ss', // + TIME_MS: 'HH:mm:ss.SSS', // + WEEK: 'GGGG-[W]WW', // + MONTH: 'YYYY-MM', // + }; + + //! moment.js locale configuration + + hooks.defineLocale('af', { + months: 'Januarie_Februarie_Maart_April_Mei_Junie_Julie_Augustus_September_Oktober_November_Desember'.split( + '_' + ), + monthsShort: 'Jan_Feb_Mrt_Apr_Mei_Jun_Jul_Aug_Sep_Okt_Nov_Des'.split('_'), + weekdays: 'Sondag_Maandag_Dinsdag_Woensdag_Donderdag_Vrydag_Saterdag'.split( + '_' + ), + weekdaysShort: 'Son_Maa_Din_Woe_Don_Vry_Sat'.split('_'), + weekdaysMin: 'So_Ma_Di_Wo_Do_Vr_Sa'.split('_'), + meridiemParse: /vm|nm/i, + isPM: function (input) { + return /^nm$/i.test(input); + }, + meridiem: function (hours, minutes, isLower) { + if (hours < 12) { + return isLower ? 'vm' : 'VM'; + } else { + return isLower ? 'nm' : 'NM'; + } + }, + longDateFormat: { + LT: 'HH:mm', + LTS: 'HH:mm:ss', + L: 'DD/MM/YYYY', + LL: 'D MMMM YYYY', + LLL: 'D MMMM YYYY HH:mm', + LLLL: 'dddd, D MMMM YYYY HH:mm', + }, + calendar: { + sameDay: '[Vandag om] LT', + nextDay: '[Môre om] LT', + nextWeek: 'dddd [om] LT', + lastDay: '[Gister om] LT', + lastWeek: '[Laas] dddd [om] LT', + sameElse: 'L', + }, + relativeTime: { + future: 'oor %s', + past: '%s gelede', + s: "'n paar sekondes", + ss: '%d sekondes', + m: "'n minuut", + mm: '%d minute', + h: "'n uur", + hh: '%d ure', + d: "'n dag", + dd: '%d dae', + M: "'n maand", + MM: '%d maande', + y: "'n jaar", + yy: '%d jaar', + }, + dayOfMonthOrdinalParse: /\d{1,2}(ste|de)/, + ordinal: function (number) { + return ( + number + + (number === 1 || number === 8 || number >= 20 ? 'ste' : 'de') + ); // Thanks to Joris Röling : https://github.com/jjupiter + }, + week: { + dow: 1, // Maandag is die eerste dag van die week. + doy: 4, // Die week wat die 4de Januarie bevat is die eerste week van die jaar. + }, + }); + + //! moment.js locale configuration + + var pluralForm = function (n) { + return n === 0 + ? 0 + : n === 1 + ? 1 + : n === 2 + ? 2 + : n % 100 >= 3 && n % 100 <= 10 + ? 3 + : n % 100 >= 11 + ? 4 + : 5; + }, + plurals = { + s: [ + 'أقل من ثانية', + 'ثانية واحدة', + ['ثانيتان', 'ثانيتين'], + '%d ثوان', + '%d ثانية', + '%d ثانية', + ], + m: [ + 'أقل من دقيقة', + 'دقيقة واحدة', + ['دقيقتان', 'دقيقتين'], + '%d دقائق', + '%d دقيقة', + '%d دقيقة', + ], + h: [ + 'أقل من ساعة', + 'ساعة واحدة', + ['ساعتان', 'ساعتين'], + '%d ساعات', + '%d ساعة', + '%d ساعة', + ], + d: [ + 'أقل من يوم', + 'يوم واحد', + ['يومان', 'يومين'], + '%d أيام', + '%d يومًا', + '%d يوم', + ], + M: [ + 'أقل من شهر', + 'شهر واحد', + ['شهران', 'شهرين'], + '%d أشهر', + '%d شهرا', + '%d شهر', + ], + y: [ + 'أقل من عام', + 'عام واحد', + ['عامان', 'عامين'], + '%d أعوام', + '%d عامًا', + '%d عام', + ], + }, + pluralize = function (u) { + return function (number, withoutSuffix, string, isFuture) { + var f = pluralForm(number), + str = plurals[u][pluralForm(number)]; + if (f === 2) { + str = str[withoutSuffix ? 0 : 1]; + } + return str.replace(/%d/i, number); + }; + }, + months$1 = [ + 'جانفي', + 'فيفري', + 'مارس', + 'أفريل', + 'ماي', + 'جوان', + 'جويلية', + 'أوت', + 'سبتمبر', + 'أكتوبر', + 'نوفمبر', + 'ديسمبر', + ]; + + hooks.defineLocale('ar-dz', { + months: months$1, + monthsShort: months$1, + weekdays: 'الأحد_الإثنين_الثلاثاء_الأربعاء_الخميس_الجمعة_السبت'.split('_'), + weekdaysShort: 'أحد_إثنين_ثلاثاء_أربعاء_خميس_جمعة_سبت'.split('_'), + weekdaysMin: 'ح_ن_ث_ر_خ_ج_س'.split('_'), + weekdaysParseExact: true, + longDateFormat: { + LT: 'HH:mm', + LTS: 'HH:mm:ss', + L: 'D/\u200FM/\u200FYYYY', + LL: 'D MMMM YYYY', + LLL: 'D MMMM YYYY HH:mm', + LLLL: 'dddd D MMMM YYYY HH:mm', + }, + meridiemParse: /ص|م/, + isPM: function (input) { + return 'م' === input; + }, + meridiem: function (hour, minute, isLower) { + if (hour < 12) { + return 'ص'; + } else { + return 'م'; + } + }, + calendar: { + sameDay: '[اليوم عند الساعة] LT', + nextDay: '[غدًا عند الساعة] LT', + nextWeek: 'dddd [عند الساعة] LT', + lastDay: '[أمس عند الساعة] LT', + lastWeek: 'dddd [عند الساعة] LT', + sameElse: 'L', + }, + relativeTime: { + future: 'بعد %s', + past: 'منذ %s', + s: pluralize('s'), + ss: pluralize('s'), + m: pluralize('m'), + mm: pluralize('m'), + h: pluralize('h'), + hh: pluralize('h'), + d: pluralize('d'), + dd: pluralize('d'), + M: pluralize('M'), + MM: pluralize('M'), + y: pluralize('y'), + yy: pluralize('y'), + }, + postformat: function (string) { + return string.replace(/,/g, '،'); + }, + week: { + dow: 0, // Sunday is the first day of the week. + doy: 4, // The week that contains Jan 4th is the first week of the year. + }, + }); + + //! moment.js locale configuration + + hooks.defineLocale('ar-kw', { + months: 'يناير_فبراير_مارس_أبريل_ماي_يونيو_يوليوز_غشت_شتنبر_أكتوبر_نونبر_دجنبر'.split( + '_' + ), + monthsShort: 'يناير_فبراير_مارس_أبريل_ماي_يونيو_يوليوز_غشت_شتنبر_أكتوبر_نونبر_دجنبر'.split( + '_' + ), + weekdays: 'الأحد_الإتنين_الثلاثاء_الأربعاء_الخميس_الجمعة_السبت'.split('_'), + weekdaysShort: 'احد_اتنين_ثلاثاء_اربعاء_خميس_جمعة_سبت'.split('_'), + weekdaysMin: 'ح_ن_ث_ر_خ_ج_س'.split('_'), + weekdaysParseExact: true, + longDateFormat: { + LT: 'HH:mm', + LTS: 'HH:mm:ss', + L: 'DD/MM/YYYY', + LL: 'D MMMM YYYY', + LLL: 'D MMMM YYYY HH:mm', + LLLL: 'dddd D MMMM YYYY HH:mm', + }, + calendar: { + sameDay: '[اليوم على الساعة] LT', + nextDay: '[غدا على الساعة] LT', + nextWeek: 'dddd [على الساعة] LT', + lastDay: '[أمس على الساعة] LT', + lastWeek: 'dddd [على الساعة] LT', + sameElse: 'L', + }, + relativeTime: { + future: 'في %s', + past: 'منذ %s', + s: 'ثوان', + ss: '%d ثانية', + m: 'دقيقة', + mm: '%d دقائق', + h: 'ساعة', + hh: '%d ساعات', + d: 'يوم', + dd: '%d أيام', + M: 'شهر', + MM: '%d أشهر', + y: 'سنة', + yy: '%d سنوات', + }, + week: { + dow: 0, // Sunday is the first day of the week. + doy: 12, // The week that contains Jan 12th is the first week of the year. + }, + }); + + //! moment.js locale configuration + + var symbolMap = { + '1': '1', + '2': '2', + '3': '3', + '4': '4', + '5': '5', + '6': '6', + '7': '7', + '8': '8', + '9': '9', + '0': '0', + }, + pluralForm$1 = function (n) { + return n === 0 + ? 0 + : n === 1 + ? 1 + : n === 2 + ? 2 + : n % 100 >= 3 && n % 100 <= 10 + ? 3 + : n % 100 >= 11 + ? 4 + : 5; + }, + plurals$1 = { + s: [ + 'أقل من ثانية', + 'ثانية واحدة', + ['ثانيتان', 'ثانيتين'], + '%d ثوان', + '%d ثانية', + '%d ثانية', + ], + m: [ + 'أقل من دقيقة', + 'دقيقة واحدة', + ['دقيقتان', 'دقيقتين'], + '%d دقائق', + '%d دقيقة', + '%d دقيقة', + ], + h: [ + 'أقل من ساعة', + 'ساعة واحدة', + ['ساعتان', 'ساعتين'], + '%d ساعات', + '%d ساعة', + '%d ساعة', + ], + d: [ + 'أقل من يوم', + 'يوم واحد', + ['يومان', 'يومين'], + '%d أيام', + '%d يومًا', + '%d يوم', + ], + M: [ + 'أقل من شهر', + 'شهر واحد', + ['شهران', 'شهرين'], + '%d أشهر', + '%d شهرا', + '%d شهر', + ], + y: [ + 'أقل من عام', + 'عام واحد', + ['عامان', 'عامين'], + '%d أعوام', + '%d عامًا', + '%d عام', + ], + }, + pluralize$1 = function (u) { + return function (number, withoutSuffix, string, isFuture) { + var f = pluralForm$1(number), + str = plurals$1[u][pluralForm$1(number)]; + if (f === 2) { + str = str[withoutSuffix ? 0 : 1]; + } + return str.replace(/%d/i, number); + }; + }, + months$2 = [ + 'يناير', + 'فبراير', + 'مارس', + 'أبريل', + 'مايو', + 'يونيو', + 'يوليو', + 'أغسطس', + 'سبتمبر', + 'أكتوبر', + 'نوفمبر', + 'ديسمبر', + ]; + + hooks.defineLocale('ar-ly', { + months: months$2, + monthsShort: months$2, + weekdays: 'الأحد_الإثنين_الثلاثاء_الأربعاء_الخميس_الجمعة_السبت'.split('_'), + weekdaysShort: 'أحد_إثنين_ثلاثاء_أربعاء_خميس_جمعة_سبت'.split('_'), + weekdaysMin: 'ح_ن_ث_ر_خ_ج_س'.split('_'), + weekdaysParseExact: true, + longDateFormat: { + LT: 'HH:mm', + LTS: 'HH:mm:ss', + L: 'D/\u200FM/\u200FYYYY', + LL: 'D MMMM YYYY', + LLL: 'D MMMM YYYY HH:mm', + LLLL: 'dddd D MMMM YYYY HH:mm', + }, + meridiemParse: /ص|م/, + isPM: function (input) { + return 'م' === input; + }, + meridiem: function (hour, minute, isLower) { + if (hour < 12) { + return 'ص'; + } else { + return 'م'; + } + }, + calendar: { + sameDay: '[اليوم عند الساعة] LT', + nextDay: '[غدًا عند الساعة] LT', + nextWeek: 'dddd [عند الساعة] LT', + lastDay: '[أمس عند الساعة] LT', + lastWeek: 'dddd [عند الساعة] LT', + sameElse: 'L', + }, + relativeTime: { + future: 'بعد %s', + past: 'منذ %s', + s: pluralize$1('s'), + ss: pluralize$1('s'), + m: pluralize$1('m'), + mm: pluralize$1('m'), + h: pluralize$1('h'), + hh: pluralize$1('h'), + d: pluralize$1('d'), + dd: pluralize$1('d'), + M: pluralize$1('M'), + MM: pluralize$1('M'), + y: pluralize$1('y'), + yy: pluralize$1('y'), + }, + preparse: function (string) { + return string.replace(/،/g, ','); + }, + postformat: function (string) { + return string + .replace(/\d/g, function (match) { + return symbolMap[match]; + }) + .replace(/,/g, '،'); + }, + week: { + dow: 6, // Saturday is the first day of the week. + doy: 12, // The week that contains Jan 12th is the first week of the year. + }, + }); + + //! moment.js locale configuration + + hooks.defineLocale('ar-ma', { + months: 'يناير_فبراير_مارس_أبريل_ماي_يونيو_يوليوز_غشت_شتنبر_أكتوبر_نونبر_دجنبر'.split( + '_' + ), + monthsShort: 'يناير_فبراير_مارس_أبريل_ماي_يونيو_يوليوز_غشت_شتنبر_أكتوبر_نونبر_دجنبر'.split( + '_' + ), + weekdays: 'الأحد_الإثنين_الثلاثاء_الأربعاء_الخميس_الجمعة_السبت'.split('_'), + weekdaysShort: 'احد_اثنين_ثلاثاء_اربعاء_خميس_جمعة_سبت'.split('_'), + weekdaysMin: 'ح_ن_ث_ر_خ_ج_س'.split('_'), + weekdaysParseExact: true, + longDateFormat: { + LT: 'HH:mm', + LTS: 'HH:mm:ss', + L: 'DD/MM/YYYY', + LL: 'D MMMM YYYY', + LLL: 'D MMMM YYYY HH:mm', + LLLL: 'dddd D MMMM YYYY HH:mm', + }, + calendar: { + sameDay: '[اليوم على الساعة] LT', + nextDay: '[غدا على الساعة] LT', + nextWeek: 'dddd [على الساعة] LT', + lastDay: '[أمس على الساعة] LT', + lastWeek: 'dddd [على الساعة] LT', + sameElse: 'L', + }, + relativeTime: { + future: 'في %s', + past: 'منذ %s', + s: 'ثوان', + ss: '%d ثانية', + m: 'دقيقة', + mm: '%d دقائق', + h: 'ساعة', + hh: '%d ساعات', + d: 'يوم', + dd: '%d أيام', + M: 'شهر', + MM: '%d أشهر', + y: 'سنة', + yy: '%d سنوات', + }, + week: { + dow: 6, // Saturday is the first day of the week. + doy: 12, // The week that contains Jan 12th is the first week of the year. + }, + }); + + //! moment.js locale configuration + + var symbolMap$1 = { + '1': '١', + '2': '٢', + '3': '٣', + '4': '٤', + '5': '٥', + '6': '٦', + '7': '٧', + '8': '٨', + '9': '٩', + '0': '٠', + }, + numberMap = { + '١': '1', + '٢': '2', + '٣': '3', + '٤': '4', + '٥': '5', + '٦': '6', + '٧': '7', + '٨': '8', + '٩': '9', + '٠': '0', + }; + + hooks.defineLocale('ar-sa', { + months: 'يناير_فبراير_مارس_أبريل_مايو_يونيو_يوليو_أغسطس_سبتمبر_أكتوبر_نوفمبر_ديسمبر'.split( + '_' + ), + monthsShort: 'يناير_فبراير_مارس_أبريل_مايو_يونيو_يوليو_أغسطس_سبتمبر_أكتوبر_نوفمبر_ديسمبر'.split( + '_' + ), + weekdays: 'الأحد_الإثنين_الثلاثاء_الأربعاء_الخميس_الجمعة_السبت'.split('_'), + weekdaysShort: 'أحد_إثنين_ثلاثاء_أربعاء_خميس_جمعة_سبت'.split('_'), + weekdaysMin: 'ح_ن_ث_ر_خ_ج_س'.split('_'), + weekdaysParseExact: true, + longDateFormat: { + LT: 'HH:mm', + LTS: 'HH:mm:ss', + L: 'DD/MM/YYYY', + LL: 'D MMMM YYYY', + LLL: 'D MMMM YYYY HH:mm', + LLLL: 'dddd D MMMM YYYY HH:mm', + }, + meridiemParse: /ص|م/, + isPM: function (input) { + return 'م' === input; + }, + meridiem: function (hour, minute, isLower) { + if (hour < 12) { + return 'ص'; + } else { + return 'م'; + } + }, + calendar: { + sameDay: '[اليوم على الساعة] LT', + nextDay: '[غدا على الساعة] LT', + nextWeek: 'dddd [على الساعة] LT', + lastDay: '[أمس على الساعة] LT', + lastWeek: 'dddd [على الساعة] LT', + sameElse: 'L', + }, + relativeTime: { + future: 'في %s', + past: 'منذ %s', + s: 'ثوان', + ss: '%d ثانية', + m: 'دقيقة', + mm: '%d دقائق', + h: 'ساعة', + hh: '%d ساعات', + d: 'يوم', + dd: '%d أيام', + M: 'شهر', + MM: '%d أشهر', + y: 'سنة', + yy: '%d سنوات', + }, + preparse: function (string) { + return string + .replace(/[١٢٣٤٥٦٧٨٩٠]/g, function (match) { + return numberMap[match]; + }) + .replace(/،/g, ','); + }, + postformat: function (string) { + return string + .replace(/\d/g, function (match) { + return symbolMap$1[match]; + }) + .replace(/,/g, '،'); + }, + week: { + dow: 0, // Sunday is the first day of the week. + doy: 6, // The week that contains Jan 6th is the first week of the year. + }, + }); + + //! moment.js locale configuration + + hooks.defineLocale('ar-tn', { + months: 'جانفي_فيفري_مارس_أفريل_ماي_جوان_جويلية_أوت_سبتمبر_أكتوبر_نوفمبر_ديسمبر'.split( + '_' + ), + monthsShort: 'جانفي_فيفري_مارس_أفريل_ماي_جوان_جويلية_أوت_سبتمبر_أكتوبر_نوفمبر_ديسمبر'.split( + '_' + ), + weekdays: 'الأحد_الإثنين_الثلاثاء_الأربعاء_الخميس_الجمعة_السبت'.split('_'), + weekdaysShort: 'أحد_إثنين_ثلاثاء_أربعاء_خميس_جمعة_سبت'.split('_'), + weekdaysMin: 'ح_ن_ث_ر_خ_ج_س'.split('_'), + weekdaysParseExact: true, + longDateFormat: { + LT: 'HH:mm', + LTS: 'HH:mm:ss', + L: 'DD/MM/YYYY', + LL: 'D MMMM YYYY', + LLL: 'D MMMM YYYY HH:mm', + LLLL: 'dddd D MMMM YYYY HH:mm', + }, + calendar: { + sameDay: '[اليوم على الساعة] LT', + nextDay: '[غدا على الساعة] LT', + nextWeek: 'dddd [على الساعة] LT', + lastDay: '[أمس على الساعة] LT', + lastWeek: 'dddd [على الساعة] LT', + sameElse: 'L', + }, + relativeTime: { + future: 'في %s', + past: 'منذ %s', + s: 'ثوان', + ss: '%d ثانية', + m: 'دقيقة', + mm: '%d دقائق', + h: 'ساعة', + hh: '%d ساعات', + d: 'يوم', + dd: '%d أيام', + M: 'شهر', + MM: '%d أشهر', + y: 'سنة', + yy: '%d سنوات', + }, + week: { + dow: 1, // Monday is the first day of the week. + doy: 4, // The week that contains Jan 4th is the first week of the year. + }, + }); + + //! moment.js locale configuration + + var symbolMap$2 = { + '1': '١', + '2': '٢', + '3': '٣', + '4': '٤', + '5': '٥', + '6': '٦', + '7': '٧', + '8': '٨', + '9': '٩', + '0': '٠', + }, + numberMap$1 = { + '١': '1', + '٢': '2', + '٣': '3', + '٤': '4', + '٥': '5', + '٦': '6', + '٧': '7', + '٨': '8', + '٩': '9', + '٠': '0', + }, + pluralForm$2 = function (n) { + return n === 0 + ? 0 + : n === 1 + ? 1 + : n === 2 + ? 2 + : n % 100 >= 3 && n % 100 <= 10 + ? 3 + : n % 100 >= 11 + ? 4 + : 5; + }, + plurals$2 = { + s: [ + 'أقل من ثانية', + 'ثانية واحدة', + ['ثانيتان', 'ثانيتين'], + '%d ثوان', + '%d ثانية', + '%d ثانية', + ], + m: [ + 'أقل من دقيقة', + 'دقيقة واحدة', + ['دقيقتان', 'دقيقتين'], + '%d دقائق', + '%d دقيقة', + '%d دقيقة', + ], + h: [ + 'أقل من ساعة', + 'ساعة واحدة', + ['ساعتان', 'ساعتين'], + '%d ساعات', + '%d ساعة', + '%d ساعة', + ], + d: [ + 'أقل من يوم', + 'يوم واحد', + ['يومان', 'يومين'], + '%d أيام', + '%d يومًا', + '%d يوم', + ], + M: [ + 'أقل من شهر', + 'شهر واحد', + ['شهران', 'شهرين'], + '%d أشهر', + '%d شهرا', + '%d شهر', + ], + y: [ + 'أقل من عام', + 'عام واحد', + ['عامان', 'عامين'], + '%d أعوام', + '%d عامًا', + '%d عام', + ], + }, + pluralize$2 = function (u) { + return function (number, withoutSuffix, string, isFuture) { + var f = pluralForm$2(number), + str = plurals$2[u][pluralForm$2(number)]; + if (f === 2) { + str = str[withoutSuffix ? 0 : 1]; + } + return str.replace(/%d/i, number); + }; + }, + months$3 = [ + 'يناير', + 'فبراير', + 'مارس', + 'أبريل', + 'مايو', + 'يونيو', + 'يوليو', + 'أغسطس', + 'سبتمبر', + 'أكتوبر', + 'نوفمبر', + 'ديسمبر', + ]; + + hooks.defineLocale('ar', { + months: months$3, + monthsShort: months$3, + weekdays: 'الأحد_الإثنين_الثلاثاء_الأربعاء_الخميس_الجمعة_السبت'.split('_'), + weekdaysShort: 'أحد_إثنين_ثلاثاء_أربعاء_خميس_جمعة_سبت'.split('_'), + weekdaysMin: 'ح_ن_ث_ر_خ_ج_س'.split('_'), + weekdaysParseExact: true, + longDateFormat: { + LT: 'HH:mm', + LTS: 'HH:mm:ss', + L: 'D/\u200FM/\u200FYYYY', + LL: 'D MMMM YYYY', + LLL: 'D MMMM YYYY HH:mm', + LLLL: 'dddd D MMMM YYYY HH:mm', + }, + meridiemParse: /ص|م/, + isPM: function (input) { + return 'م' === input; + }, + meridiem: function (hour, minute, isLower) { + if (hour < 12) { + return 'ص'; + } else { + return 'م'; + } + }, + calendar: { + sameDay: '[اليوم عند الساعة] LT', + nextDay: '[غدًا عند الساعة] LT', + nextWeek: 'dddd [عند الساعة] LT', + lastDay: '[أمس عند الساعة] LT', + lastWeek: 'dddd [عند الساعة] LT', + sameElse: 'L', + }, + relativeTime: { + future: 'بعد %s', + past: 'منذ %s', + s: pluralize$2('s'), + ss: pluralize$2('s'), + m: pluralize$2('m'), + mm: pluralize$2('m'), + h: pluralize$2('h'), + hh: pluralize$2('h'), + d: pluralize$2('d'), + dd: pluralize$2('d'), + M: pluralize$2('M'), + MM: pluralize$2('M'), + y: pluralize$2('y'), + yy: pluralize$2('y'), + }, + preparse: function (string) { + return string + .replace(/[١٢٣٤٥٦٧٨٩٠]/g, function (match) { + return numberMap$1[match]; + }) + .replace(/،/g, ','); + }, + postformat: function (string) { + return string + .replace(/\d/g, function (match) { + return symbolMap$2[match]; + }) + .replace(/,/g, '،'); + }, + week: { + dow: 6, // Saturday is the first day of the week. + doy: 12, // The week that contains Jan 12th is the first week of the year. + }, + }); + + //! moment.js locale configuration + + var suffixes = { + 1: '-inci', + 5: '-inci', + 8: '-inci', + 70: '-inci', + 80: '-inci', + 2: '-nci', + 7: '-nci', + 20: '-nci', + 50: '-nci', + 3: '-üncü', + 4: '-üncü', + 100: '-üncü', + 6: '-ncı', + 9: '-uncu', + 10: '-uncu', + 30: '-uncu', + 60: '-ıncı', + 90: '-ıncı', + }; + + hooks.defineLocale('az', { + months: 'yanvar_fevral_mart_aprel_may_iyun_iyul_avqust_sentyabr_oktyabr_noyabr_dekabr'.split( + '_' + ), + monthsShort: 'yan_fev_mar_apr_may_iyn_iyl_avq_sen_okt_noy_dek'.split('_'), + weekdays: 'Bazar_Bazar ertəsi_Çərşənbə axşamı_Çərşənbə_Cümə axşamı_Cümə_Şənbə'.split( + '_' + ), + weekdaysShort: 'Baz_BzE_ÇAx_Çər_CAx_Cüm_Şən'.split('_'), + weekdaysMin: 'Bz_BE_ÇA_Çə_CA_Cü_Şə'.split('_'), + weekdaysParseExact: true, + longDateFormat: { + LT: 'HH:mm', + LTS: 'HH:mm:ss', + L: 'DD.MM.YYYY', + LL: 'D MMMM YYYY', + LLL: 'D MMMM YYYY HH:mm', + LLLL: 'dddd, D MMMM YYYY HH:mm', + }, + calendar: { + sameDay: '[bugün saat] LT', + nextDay: '[sabah saat] LT', + nextWeek: '[gələn həftə] dddd [saat] LT', + lastDay: '[dünən] LT', + lastWeek: '[keçən həftə] dddd [saat] LT', + sameElse: 'L', + }, + relativeTime: { + future: '%s sonra', + past: '%s əvvəl', + s: 'bir neçə saniyə', + ss: '%d saniyə', + m: 'bir dəqiqə', + mm: '%d dəqiqə', + h: 'bir saat', + hh: '%d saat', + d: 'bir gün', + dd: '%d gün', + M: 'bir ay', + MM: '%d ay', + y: 'bir il', + yy: '%d il', + }, + meridiemParse: /gecə|səhər|gündüz|axşam/, + isPM: function (input) { + return /^(gündüz|axşam)$/.test(input); + }, + meridiem: function (hour, minute, isLower) { + if (hour < 4) { + return 'gecə'; + } else if (hour < 12) { + return 'səhər'; + } else if (hour < 17) { + return 'gündüz'; + } else { + return 'axşam'; + } + }, + dayOfMonthOrdinalParse: /\d{1,2}-(ıncı|inci|nci|üncü|ncı|uncu)/, + ordinal: function (number) { + if (number === 0) { + // special case for zero + return number + '-ıncı'; + } + var a = number % 10, + b = (number % 100) - a, + c = number >= 100 ? 100 : null; + return number + (suffixes[a] || suffixes[b] || suffixes[c]); + }, + week: { + dow: 1, // Monday is the first day of the week. + doy: 7, // The week that contains Jan 7th is the first week of the year. + }, + }); + + //! moment.js locale configuration + + function plural(word, num) { + var forms = word.split('_'); + return num % 10 === 1 && num % 100 !== 11 + ? forms[0] + : num % 10 >= 2 && num % 10 <= 4 && (num % 100 < 10 || num % 100 >= 20) + ? forms[1] + : forms[2]; + } + function relativeTimeWithPlural(number, withoutSuffix, key) { + var format = { + ss: withoutSuffix ? 'секунда_секунды_секунд' : 'секунду_секунды_секунд', + mm: withoutSuffix ? 'хвіліна_хвіліны_хвілін' : 'хвіліну_хвіліны_хвілін', + hh: withoutSuffix ? 'гадзіна_гадзіны_гадзін' : 'гадзіну_гадзіны_гадзін', + dd: 'дзень_дні_дзён', + MM: 'месяц_месяцы_месяцаў', + yy: 'год_гады_гадоў', + }; + if (key === 'm') { + return withoutSuffix ? 'хвіліна' : 'хвіліну'; + } else if (key === 'h') { + return withoutSuffix ? 'гадзіна' : 'гадзіну'; + } else { + return number + ' ' + plural(format[key], +number); + } + } + + hooks.defineLocale('be', { + months: { + format: 'студзеня_лютага_сакавіка_красавіка_траўня_чэрвеня_ліпеня_жніўня_верасня_кастрычніка_лістапада_снежня'.split( + '_' + ), + standalone: 'студзень_люты_сакавік_красавік_травень_чэрвень_ліпень_жнівень_верасень_кастрычнік_лістапад_снежань'.split( + '_' + ), + }, + monthsShort: 'студ_лют_сак_крас_трав_чэрв_ліп_жнів_вер_каст_ліст_снеж'.split( + '_' + ), + weekdays: { + format: 'нядзелю_панядзелак_аўторак_сераду_чацвер_пятніцу_суботу'.split( + '_' + ), + standalone: 'нядзеля_панядзелак_аўторак_серада_чацвер_пятніца_субота'.split( + '_' + ), + isFormat: /\[ ?[Ууў] ?(?:мінулую|наступную)? ?\] ?dddd/, + }, + weekdaysShort: 'нд_пн_ат_ср_чц_пт_сб'.split('_'), + weekdaysMin: 'нд_пн_ат_ср_чц_пт_сб'.split('_'), + longDateFormat: { + LT: 'HH:mm', + LTS: 'HH:mm:ss', + L: 'DD.MM.YYYY', + LL: 'D MMMM YYYY г.', + LLL: 'D MMMM YYYY г., HH:mm', + LLLL: 'dddd, D MMMM YYYY г., HH:mm', + }, + calendar: { + sameDay: '[Сёння ў] LT', + nextDay: '[Заўтра ў] LT', + lastDay: '[Учора ў] LT', + nextWeek: function () { + return '[У] dddd [ў] LT'; + }, + lastWeek: function () { + switch (this.day()) { + case 0: + case 3: + case 5: + case 6: + return '[У мінулую] dddd [ў] LT'; + case 1: + case 2: + case 4: + return '[У мінулы] dddd [ў] LT'; + } + }, + sameElse: 'L', + }, + relativeTime: { + future: 'праз %s', + past: '%s таму', + s: 'некалькі секунд', + m: relativeTimeWithPlural, + mm: relativeTimeWithPlural, + h: relativeTimeWithPlural, + hh: relativeTimeWithPlural, + d: 'дзень', + dd: relativeTimeWithPlural, + M: 'месяц', + MM: relativeTimeWithPlural, + y: 'год', + yy: relativeTimeWithPlural, + }, + meridiemParse: /ночы|раніцы|дня|вечара/, + isPM: function (input) { + return /^(дня|вечара)$/.test(input); + }, + meridiem: function (hour, minute, isLower) { + if (hour < 4) { + return 'ночы'; + } else if (hour < 12) { + return 'раніцы'; + } else if (hour < 17) { + return 'дня'; + } else { + return 'вечара'; + } + }, + dayOfMonthOrdinalParse: /\d{1,2}-(і|ы|га)/, + ordinal: function (number, period) { + switch (period) { + case 'M': + case 'd': + case 'DDD': + case 'w': + case 'W': + return (number % 10 === 2 || number % 10 === 3) && + number % 100 !== 12 && + number % 100 !== 13 + ? number + '-і' + : number + '-ы'; + case 'D': + return number + '-га'; + default: + return number; + } + }, + week: { + dow: 1, // Monday is the first day of the week. + doy: 7, // The week that contains Jan 7th is the first week of the year. + }, + }); + + //! moment.js locale configuration + + hooks.defineLocale('bg', { + months: 'януари_февруари_март_април_май_юни_юли_август_септември_октомври_ноември_декември'.split( + '_' + ), + monthsShort: 'яну_фев_мар_апр_май_юни_юли_авг_сеп_окт_ное_дек'.split('_'), + weekdays: 'неделя_понеделник_вторник_сряда_четвъртък_петък_събота'.split( + '_' + ), + weekdaysShort: 'нед_пон_вто_сря_чет_пет_съб'.split('_'), + weekdaysMin: 'нд_пн_вт_ср_чт_пт_сб'.split('_'), + longDateFormat: { + LT: 'H:mm', + LTS: 'H:mm:ss', + L: 'D.MM.YYYY', + LL: 'D MMMM YYYY', + LLL: 'D MMMM YYYY H:mm', + LLLL: 'dddd, D MMMM YYYY H:mm', + }, + calendar: { + sameDay: '[Днес в] LT', + nextDay: '[Утре в] LT', + nextWeek: 'dddd [в] LT', + lastDay: '[Вчера в] LT', + lastWeek: function () { + switch (this.day()) { + case 0: + case 3: + case 6: + return '[Миналата] dddd [в] LT'; + case 1: + case 2: + case 4: + case 5: + return '[Миналия] dddd [в] LT'; + } + }, + sameElse: 'L', + }, + relativeTime: { + future: 'след %s', + past: 'преди %s', + s: 'няколко секунди', + ss: '%d секунди', + m: 'минута', + mm: '%d минути', + h: 'час', + hh: '%d часа', + d: 'ден', + dd: '%d дена', + M: 'месец', + MM: '%d месеца', + y: 'година', + yy: '%d години', + }, + dayOfMonthOrdinalParse: /\d{1,2}-(ев|ен|ти|ви|ри|ми)/, + ordinal: function (number) { + var lastDigit = number % 10, + last2Digits = number % 100; + if (number === 0) { + return number + '-ев'; + } else if (last2Digits === 0) { + return number + '-ен'; + } else if (last2Digits > 10 && last2Digits < 20) { + return number + '-ти'; + } else if (lastDigit === 1) { + return number + '-ви'; + } else if (lastDigit === 2) { + return number + '-ри'; + } else if (lastDigit === 7 || lastDigit === 8) { + return number + '-ми'; + } else { + return number + '-ти'; + } + }, + week: { + dow: 1, // Monday is the first day of the week. + doy: 7, // The week that contains Jan 7th is the first week of the year. + }, + }); + + //! moment.js locale configuration + + hooks.defineLocale('bm', { + months: 'Zanwuyekalo_Fewuruyekalo_Marisikalo_Awirilikalo_Mɛkalo_Zuwɛnkalo_Zuluyekalo_Utikalo_Sɛtanburukalo_ɔkutɔburukalo_Nowanburukalo_Desanburukalo'.split( + '_' + ), + monthsShort: 'Zan_Few_Mar_Awi_Mɛ_Zuw_Zul_Uti_Sɛt_ɔku_Now_Des'.split('_'), + weekdays: 'Kari_Ntɛnɛn_Tarata_Araba_Alamisa_Juma_Sibiri'.split('_'), + weekdaysShort: 'Kar_Ntɛ_Tar_Ara_Ala_Jum_Sib'.split('_'), + weekdaysMin: 'Ka_Nt_Ta_Ar_Al_Ju_Si'.split('_'), + longDateFormat: { + LT: 'HH:mm', + LTS: 'HH:mm:ss', + L: 'DD/MM/YYYY', + LL: 'MMMM [tile] D [san] YYYY', + LLL: 'MMMM [tile] D [san] YYYY [lɛrɛ] HH:mm', + LLLL: 'dddd MMMM [tile] D [san] YYYY [lɛrɛ] HH:mm', + }, + calendar: { + sameDay: '[Bi lɛrɛ] LT', + nextDay: '[Sini lɛrɛ] LT', + nextWeek: 'dddd [don lɛrɛ] LT', + lastDay: '[Kunu lɛrɛ] LT', + lastWeek: 'dddd [tɛmɛnen lɛrɛ] LT', + sameElse: 'L', + }, + relativeTime: { + future: '%s kɔnɔ', + past: 'a bɛ %s bɔ', + s: 'sanga dama dama', + ss: 'sekondi %d', + m: 'miniti kelen', + mm: 'miniti %d', + h: 'lɛrɛ kelen', + hh: 'lɛrɛ %d', + d: 'tile kelen', + dd: 'tile %d', + M: 'kalo kelen', + MM: 'kalo %d', + y: 'san kelen', + yy: 'san %d', + }, + week: { + dow: 1, // Monday is the first day of the week. + doy: 4, // The week that contains Jan 4th is the first week of the year. + }, + }); + + //! moment.js locale configuration + + var symbolMap$3 = { + '1': '১', + '2': '২', + '3': '৩', + '4': '৪', + '5': '৫', + '6': '৬', + '7': '৭', + '8': '৮', + '9': '৯', + '0': '০', + }, + numberMap$2 = { + '১': '1', + '২': '2', + '৩': '3', + '৪': '4', + '৫': '5', + '৬': '6', + '৭': '7', + '৮': '8', + '৯': '9', + '০': '0', + }; + + hooks.defineLocale('bn', { + months: 'জানুয়ারি_ফেব্রুয়ারি_মার্চ_এপ্রিল_মে_জুন_জুলাই_আগস্ট_সেপ্টেম্বর_অক্টোবর_নভেম্বর_ডিসেম্বর'.split( + '_' + ), + monthsShort: 'জানু_ফেব্রু_মার্চ_এপ্রিল_মে_জুন_জুলাই_আগস্ট_সেপ্ট_অক্টো_নভে_ডিসে'.split( + '_' + ), + weekdays: 'রবিবার_সোমবার_মঙ্গলবার_বুধবার_বৃহস্পতিবার_শুক্রবার_শনিবার'.split( + '_' + ), + weekdaysShort: 'রবি_সোম_মঙ্গল_বুধ_বৃহস্পতি_শুক্র_শনি'.split('_'), + weekdaysMin: 'রবি_সোম_মঙ্গল_বুধ_বৃহ_শুক্র_শনি'.split('_'), + longDateFormat: { + LT: 'A h:mm সময়', + LTS: 'A h:mm:ss সময়', + L: 'DD/MM/YYYY', + LL: 'D MMMM YYYY', + LLL: 'D MMMM YYYY, A h:mm সময়', + LLLL: 'dddd, D MMMM YYYY, A h:mm সময়', + }, + calendar: { + sameDay: '[আজ] LT', + nextDay: '[আগামীকাল] LT', + nextWeek: 'dddd, LT', + lastDay: '[গতকাল] LT', + lastWeek: '[গত] dddd, LT', + sameElse: 'L', + }, + relativeTime: { + future: '%s পরে', + past: '%s আগে', + s: 'কয়েক সেকেন্ড', + ss: '%d সেকেন্ড', + m: 'এক মিনিট', + mm: '%d মিনিট', + h: 'এক ঘন্টা', + hh: '%d ঘন্টা', + d: 'এক দিন', + dd: '%d দিন', + M: 'এক মাস', + MM: '%d মাস', + y: 'এক বছর', + yy: '%d বছর', + }, + preparse: function (string) { + return string.replace(/[১২৩৪৫৬৭৮৯০]/g, function (match) { + return numberMap$2[match]; + }); + }, + postformat: function (string) { + return string.replace(/\d/g, function (match) { + return symbolMap$3[match]; + }); + }, + meridiemParse: /রাত|সকাল|দুপুর|বিকাল|রাত/, + meridiemHour: function (hour, meridiem) { + if (hour === 12) { + hour = 0; + } + if ( + (meridiem === 'রাত' && hour >= 4) || + (meridiem === 'দুপুর' && hour < 5) || + meridiem === 'বিকাল' + ) { + return hour + 12; + } else { + return hour; + } + }, + meridiem: function (hour, minute, isLower) { + if (hour < 4) { + return 'রাত'; + } else if (hour < 10) { + return 'সকাল'; + } else if (hour < 17) { + return 'দুপুর'; + } else if (hour < 20) { + return 'বিকাল'; + } else { + return 'রাত'; + } + }, + week: { + dow: 0, // Sunday is the first day of the week. + doy: 6, // The week that contains Jan 6th is the first week of the year. + }, + }); + + //! moment.js locale configuration + + var symbolMap$4 = { + '1': '༡', + '2': '༢', + '3': '༣', + '4': '༤', + '5': '༥', + '6': '༦', + '7': '༧', + '8': '༨', + '9': '༩', + '0': '༠', + }, + numberMap$3 = { + '༡': '1', + '༢': '2', + '༣': '3', + '༤': '4', + '༥': '5', + '༦': '6', + '༧': '7', + '༨': '8', + '༩': '9', + '༠': '0', + }; + + hooks.defineLocale('bo', { + months: 'ཟླ་བ་དང་པོ_ཟླ་བ་གཉིས་པ_ཟླ་བ་གསུམ་པ_ཟླ་བ་བཞི་པ_ཟླ་བ་ལྔ་པ_ཟླ་བ་དྲུག་པ_ཟླ་བ་བདུན་པ_ཟླ་བ་བརྒྱད་པ_ཟླ་བ་དགུ་པ_ཟླ་བ་བཅུ་པ_ཟླ་བ་བཅུ་གཅིག་པ_ཟླ་བ་བཅུ་གཉིས་པ'.split( + '_' + ), + monthsShort: 'ཟླ་1_ཟླ་2_ཟླ་3_ཟླ་4_ཟླ་5_ཟླ་6_ཟླ་7_ཟླ་8_ཟླ་9_ཟླ་10_ཟླ་11_ཟླ་12'.split( + '_' + ), + monthsShortRegex: /^(ཟླ་\d{1,2})/, + monthsParseExact: true, + weekdays: 'གཟའ་ཉི་མ་_གཟའ་ཟླ་བ་_གཟའ་མིག་དམར་_གཟའ་ལྷག་པ་_གཟའ་ཕུར་བུ_གཟའ་པ་སངས་_གཟའ་སྤེན་པ་'.split( + '_' + ), + weekdaysShort: 'ཉི་མ་_ཟླ་བ་_མིག་དམར་_ལྷག་པ་_ཕུར་བུ_པ་སངས་_སྤེན་པ་'.split( + '_' + ), + weekdaysMin: 'ཉི_ཟླ_མིག_ལྷག_ཕུར_སངས_སྤེན'.split('_'), + longDateFormat: { + LT: 'A h:mm', + LTS: 'A h:mm:ss', + L: 'DD/MM/YYYY', + LL: 'D MMMM YYYY', + LLL: 'D MMMM YYYY, A h:mm', + LLLL: 'dddd, D MMMM YYYY, A h:mm', + }, + calendar: { + sameDay: '[དི་རིང] LT', + nextDay: '[སང་ཉིན] LT', + nextWeek: '[བདུན་ཕྲག་རྗེས་མ], LT', + lastDay: '[ཁ་སང] LT', + lastWeek: '[བདུན་ཕྲག་མཐའ་མ] dddd, LT', + sameElse: 'L', + }, + relativeTime: { + future: '%s ལ་', + past: '%s སྔན་ལ', + s: 'ལམ་སང', + ss: '%d སྐར་ཆ།', + m: 'སྐར་མ་གཅིག', + mm: '%d སྐར་མ', + h: 'ཆུ་ཚོད་གཅིག', + hh: '%d ཆུ་ཚོད', + d: 'ཉིན་གཅིག', + dd: '%d ཉིན་', + M: 'ཟླ་བ་གཅིག', + MM: '%d ཟླ་བ', + y: 'ལོ་གཅིག', + yy: '%d ལོ', + }, + preparse: function (string) { + return string.replace(/[༡༢༣༤༥༦༧༨༩༠]/g, function (match) { + return numberMap$3[match]; + }); + }, + postformat: function (string) { + return string.replace(/\d/g, function (match) { + return symbolMap$4[match]; + }); + }, + meridiemParse: /མཚན་མོ|ཞོགས་ཀས|ཉིན་གུང|དགོང་དག|མཚན་མོ/, + meridiemHour: function (hour, meridiem) { + if (hour === 12) { + hour = 0; + } + if ( + (meridiem === 'མཚན་མོ' && hour >= 4) || + (meridiem === 'ཉིན་གུང' && hour < 5) || + meridiem === 'དགོང་དག' + ) { + return hour + 12; + } else { + return hour; + } + }, + meridiem: function (hour, minute, isLower) { + if (hour < 4) { + return 'མཚན་མོ'; + } else if (hour < 10) { + return 'ཞོགས་ཀས'; + } else if (hour < 17) { + return 'ཉིན་གུང'; + } else if (hour < 20) { + return 'དགོང་དག'; + } else { + return 'མཚན་མོ'; + } + }, + week: { + dow: 0, // Sunday is the first day of the week. + doy: 6, // The week that contains Jan 6th is the first week of the year. + }, + }); + + //! moment.js locale configuration + + function relativeTimeWithMutation(number, withoutSuffix, key) { + var format = { + mm: 'munutenn', + MM: 'miz', + dd: 'devezh', + }; + return number + ' ' + mutation(format[key], number); + } + function specialMutationForYears(number) { + switch (lastNumber(number)) { + case 1: + case 3: + case 4: + case 5: + case 9: + return number + ' bloaz'; + default: + return number + ' vloaz'; + } + } + function lastNumber(number) { + if (number > 9) { + return lastNumber(number % 10); + } + return number; + } + function mutation(text, number) { + if (number === 2) { + return softMutation(text); + } + return text; + } + function softMutation(text) { + var mutationTable = { + m: 'v', + b: 'v', + d: 'z', + }; + if (mutationTable[text.charAt(0)] === undefined) { + return text; + } + return mutationTable[text.charAt(0)] + text.substring(1); + } + + var monthsParse = [ + /^gen/i, + /^c[ʼ\']hwe/i, + /^meu/i, + /^ebr/i, + /^mae/i, + /^(mez|eve)/i, + /^gou/i, + /^eos/i, + /^gwe/i, + /^her/i, + /^du/i, + /^ker/i, + ], + monthsRegex$1 = /^(genver|c[ʼ\']hwevrer|meurzh|ebrel|mae|mezheven|gouere|eost|gwengolo|here|du|kerzu|gen|c[ʼ\']hwe|meu|ebr|mae|eve|gou|eos|gwe|her|du|ker)/i, + monthsStrictRegex = /^(genver|c[ʼ\']hwevrer|meurzh|ebrel|mae|mezheven|gouere|eost|gwengolo|here|du|kerzu)/i, + monthsShortStrictRegex = /^(gen|c[ʼ\']hwe|meu|ebr|mae|eve|gou|eos|gwe|her|du|ker)/i, + fullWeekdaysParse = [ + /^sul/i, + /^lun/i, + /^meurzh/i, + /^merc[ʼ\']her/i, + /^yaou/i, + /^gwener/i, + /^sadorn/i, + ], + shortWeekdaysParse = [ + /^Sul/i, + /^Lun/i, + /^Meu/i, + /^Mer/i, + /^Yao/i, + /^Gwe/i, + /^Sad/i, + ], + minWeekdaysParse = [ + /^Su/i, + /^Lu/i, + /^Me([^r]|$)/i, + /^Mer/i, + /^Ya/i, + /^Gw/i, + /^Sa/i, + ]; + + hooks.defineLocale('br', { + months: 'Genver_Cʼhwevrer_Meurzh_Ebrel_Mae_Mezheven_Gouere_Eost_Gwengolo_Here_Du_Kerzu'.split( + '_' + ), + monthsShort: 'Gen_Cʼhwe_Meu_Ebr_Mae_Eve_Gou_Eos_Gwe_Her_Du_Ker'.split('_'), + weekdays: 'Sul_Lun_Meurzh_Mercʼher_Yaou_Gwener_Sadorn'.split('_'), + weekdaysShort: 'Sul_Lun_Meu_Mer_Yao_Gwe_Sad'.split('_'), + weekdaysMin: 'Su_Lu_Me_Mer_Ya_Gw_Sa'.split('_'), + weekdaysParse: minWeekdaysParse, + fullWeekdaysParse: fullWeekdaysParse, + shortWeekdaysParse: shortWeekdaysParse, + minWeekdaysParse: minWeekdaysParse, + + monthsRegex: monthsRegex$1, + monthsShortRegex: monthsRegex$1, + monthsStrictRegex: monthsStrictRegex, + monthsShortStrictRegex: monthsShortStrictRegex, + monthsParse: monthsParse, + longMonthsParse: monthsParse, + shortMonthsParse: monthsParse, + + longDateFormat: { + LT: 'HH:mm', + LTS: 'HH:mm:ss', + L: 'DD/MM/YYYY', + LL: 'D [a viz] MMMM YYYY', + LLL: 'D [a viz] MMMM YYYY HH:mm', + LLLL: 'dddd, D [a viz] MMMM YYYY HH:mm', + }, + calendar: { + sameDay: '[Hiziv da] LT', + nextDay: '[Warcʼhoazh da] LT', + nextWeek: 'dddd [da] LT', + lastDay: '[Decʼh da] LT', + lastWeek: 'dddd [paset da] LT', + sameElse: 'L', + }, + relativeTime: { + future: 'a-benn %s', + past: '%s ʼzo', + s: 'un nebeud segondennoù', + ss: '%d eilenn', + m: 'ur vunutenn', + mm: relativeTimeWithMutation, + h: 'un eur', + hh: '%d eur', + d: 'un devezh', + dd: relativeTimeWithMutation, + M: 'ur miz', + MM: relativeTimeWithMutation, + y: 'ur bloaz', + yy: specialMutationForYears, + }, + dayOfMonthOrdinalParse: /\d{1,2}(añ|vet)/, + ordinal: function (number) { + var output = number === 1 ? 'añ' : 'vet'; + return number + output; + }, + week: { + dow: 1, // Monday is the first day of the week. + doy: 4, // The week that contains Jan 4th is the first week of the year. + }, + meridiemParse: /a.m.|g.m./, // goude merenn | a-raok merenn + isPM: function (token) { + return token === 'g.m.'; + }, + meridiem: function (hour, minute, isLower) { + return hour < 12 ? 'a.m.' : 'g.m.'; + }, + }); + + //! moment.js locale configuration + + function translate(number, withoutSuffix, key) { + var result = number + ' '; + switch (key) { + case 'ss': + if (number === 1) { + result += 'sekunda'; + } else if (number === 2 || number === 3 || number === 4) { + result += 'sekunde'; + } else { + result += 'sekundi'; + } + return result; + case 'm': + return withoutSuffix ? 'jedna minuta' : 'jedne minute'; + case 'mm': + if (number === 1) { + result += 'minuta'; + } else if (number === 2 || number === 3 || number === 4) { + result += 'minute'; + } else { + result += 'minuta'; + } + return result; + case 'h': + return withoutSuffix ? 'jedan sat' : 'jednog sata'; + case 'hh': + if (number === 1) { + result += 'sat'; + } else if (number === 2 || number === 3 || number === 4) { + result += 'sata'; + } else { + result += 'sati'; + } + return result; + case 'dd': + if (number === 1) { + result += 'dan'; + } else { + result += 'dana'; + } + return result; + case 'MM': + if (number === 1) { + result += 'mjesec'; + } else if (number === 2 || number === 3 || number === 4) { + result += 'mjeseca'; + } else { + result += 'mjeseci'; + } + return result; + case 'yy': + if (number === 1) { + result += 'godina'; + } else if (number === 2 || number === 3 || number === 4) { + result += 'godine'; + } else { + result += 'godina'; + } + return result; + } + } + + hooks.defineLocale('bs', { + months: 'januar_februar_mart_april_maj_juni_juli_august_septembar_oktobar_novembar_decembar'.split( + '_' + ), + monthsShort: 'jan._feb._mar._apr._maj._jun._jul._aug._sep._okt._nov._dec.'.split( + '_' + ), + monthsParseExact: true, + weekdays: 'nedjelja_ponedjeljak_utorak_srijeda_četvrtak_petak_subota'.split( + '_' + ), + weekdaysShort: 'ned._pon._uto._sri._čet._pet._sub.'.split('_'), + weekdaysMin: 'ne_po_ut_sr_če_pe_su'.split('_'), + weekdaysParseExact: true, + longDateFormat: { + LT: 'H:mm', + LTS: 'H:mm:ss', + L: 'DD.MM.YYYY', + LL: 'D. MMMM YYYY', + LLL: 'D. MMMM YYYY H:mm', + LLLL: 'dddd, D. MMMM YYYY H:mm', + }, + calendar: { + sameDay: '[danas u] LT', + nextDay: '[sutra u] LT', + nextWeek: function () { + switch (this.day()) { + case 0: + return '[u] [nedjelju] [u] LT'; + case 3: + return '[u] [srijedu] [u] LT'; + case 6: + return '[u] [subotu] [u] LT'; + case 1: + case 2: + case 4: + case 5: + return '[u] dddd [u] LT'; + } + }, + lastDay: '[jučer u] LT', + lastWeek: function () { + switch (this.day()) { + case 0: + case 3: + return '[prošlu] dddd [u] LT'; + case 6: + return '[prošle] [subote] [u] LT'; + case 1: + case 2: + case 4: + case 5: + return '[prošli] dddd [u] LT'; + } + }, + sameElse: 'L', + }, + relativeTime: { + future: 'za %s', + past: 'prije %s', + s: 'par sekundi', + ss: translate, + m: translate, + mm: translate, + h: translate, + hh: translate, + d: 'dan', + dd: translate, + M: 'mjesec', + MM: translate, + y: 'godinu', + yy: translate, + }, + dayOfMonthOrdinalParse: /\d{1,2}\./, + ordinal: '%d.', + week: { + dow: 1, // Monday is the first day of the week. + doy: 7, // The week that contains Jan 7th is the first week of the year. + }, + }); + + //! moment.js locale configuration + + hooks.defineLocale('ca', { + months: { + standalone: 'gener_febrer_març_abril_maig_juny_juliol_agost_setembre_octubre_novembre_desembre'.split( + '_' + ), + format: "de gener_de febrer_de març_d'abril_de maig_de juny_de juliol_d'agost_de setembre_d'octubre_de novembre_de desembre".split( + '_' + ), + isFormat: /D[oD]?(\s)+MMMM/, + }, + monthsShort: 'gen._febr._març_abr._maig_juny_jul._ag._set._oct._nov._des.'.split( + '_' + ), + monthsParseExact: true, + weekdays: 'diumenge_dilluns_dimarts_dimecres_dijous_divendres_dissabte'.split( + '_' + ), + weekdaysShort: 'dg._dl._dt._dc._dj._dv._ds.'.split('_'), + weekdaysMin: 'dg_dl_dt_dc_dj_dv_ds'.split('_'), + weekdaysParseExact: true, + longDateFormat: { + LT: 'H:mm', + LTS: 'H:mm:ss', + L: 'DD/MM/YYYY', + LL: 'D MMMM [de] YYYY', + ll: 'D MMM YYYY', + LLL: 'D MMMM [de] YYYY [a les] H:mm', + lll: 'D MMM YYYY, H:mm', + LLLL: 'dddd D MMMM [de] YYYY [a les] H:mm', + llll: 'ddd D MMM YYYY, H:mm', + }, + calendar: { + sameDay: function () { + return '[avui a ' + (this.hours() !== 1 ? 'les' : 'la') + '] LT'; + }, + nextDay: function () { + return '[demà a ' + (this.hours() !== 1 ? 'les' : 'la') + '] LT'; + }, + nextWeek: function () { + return 'dddd [a ' + (this.hours() !== 1 ? 'les' : 'la') + '] LT'; + }, + lastDay: function () { + return '[ahir a ' + (this.hours() !== 1 ? 'les' : 'la') + '] LT'; + }, + lastWeek: function () { + return ( + '[el] dddd [passat a ' + + (this.hours() !== 1 ? 'les' : 'la') + + '] LT' + ); + }, + sameElse: 'L', + }, + relativeTime: { + future: "d'aquí %s", + past: 'fa %s', + s: 'uns segons', + ss: '%d segons', + m: 'un minut', + mm: '%d minuts', + h: 'una hora', + hh: '%d hores', + d: 'un dia', + dd: '%d dies', + M: 'un mes', + MM: '%d mesos', + y: 'un any', + yy: '%d anys', + }, + dayOfMonthOrdinalParse: /\d{1,2}(r|n|t|è|a)/, + ordinal: function (number, period) { + var output = + number === 1 + ? 'r' + : number === 2 + ? 'n' + : number === 3 + ? 'r' + : number === 4 + ? 't' + : 'è'; + if (period === 'w' || period === 'W') { + output = 'a'; + } + return number + output; + }, + week: { + dow: 1, // Monday is the first day of the week. + doy: 4, // The week that contains Jan 4th is the first week of the year. + }, + }); + + //! moment.js locale configuration + + var months$4 = 'leden_únor_březen_duben_květen_červen_červenec_srpen_září_říjen_listopad_prosinec'.split( + '_' + ), + monthsShort = 'led_úno_bře_dub_kvě_čvn_čvc_srp_zář_říj_lis_pro'.split('_'), + monthsParse$1 = [ + /^led/i, + /^úno/i, + /^bře/i, + /^dub/i, + /^kvě/i, + /^(čvn|červen$|června)/i, + /^(čvc|červenec|července)/i, + /^srp/i, + /^zář/i, + /^říj/i, + /^lis/i, + /^pro/i, + ], + // NOTE: 'červen' is substring of 'červenec'; therefore 'červenec' must precede 'červen' in the regex to be fully matched. + // Otherwise parser matches '1. červenec' as '1. červen' + 'ec'. + monthsRegex$2 = /^(leden|únor|březen|duben|květen|červenec|července|červen|června|srpen|září|říjen|listopad|prosinec|led|úno|bře|dub|kvě|čvn|čvc|srp|zář|říj|lis|pro)/i; + + function plural$1(n) { + return n > 1 && n < 5 && ~~(n / 10) !== 1; + } + function translate$1(number, withoutSuffix, key, isFuture) { + var result = number + ' '; + switch (key) { + case 's': // a few seconds / in a few seconds / a few seconds ago + return withoutSuffix || isFuture ? 'pár sekund' : 'pár sekundami'; + case 'ss': // 9 seconds / in 9 seconds / 9 seconds ago + if (withoutSuffix || isFuture) { + return result + (plural$1(number) ? 'sekundy' : 'sekund'); + } else { + return result + 'sekundami'; + } + case 'm': // a minute / in a minute / a minute ago + return withoutSuffix ? 'minuta' : isFuture ? 'minutu' : 'minutou'; + case 'mm': // 9 minutes / in 9 minutes / 9 minutes ago + if (withoutSuffix || isFuture) { + return result + (plural$1(number) ? 'minuty' : 'minut'); + } else { + return result + 'minutami'; + } + case 'h': // an hour / in an hour / an hour ago + return withoutSuffix ? 'hodina' : isFuture ? 'hodinu' : 'hodinou'; + case 'hh': // 9 hours / in 9 hours / 9 hours ago + if (withoutSuffix || isFuture) { + return result + (plural$1(number) ? 'hodiny' : 'hodin'); + } else { + return result + 'hodinami'; + } + case 'd': // a day / in a day / a day ago + return withoutSuffix || isFuture ? 'den' : 'dnem'; + case 'dd': // 9 days / in 9 days / 9 days ago + if (withoutSuffix || isFuture) { + return result + (plural$1(number) ? 'dny' : 'dní'); + } else { + return result + 'dny'; + } + case 'M': // a month / in a month / a month ago + return withoutSuffix || isFuture ? 'měsíc' : 'měsícem'; + case 'MM': // 9 months / in 9 months / 9 months ago + if (withoutSuffix || isFuture) { + return result + (plural$1(number) ? 'měsíce' : 'měsíců'); + } else { + return result + 'měsíci'; + } + case 'y': // a year / in a year / a year ago + return withoutSuffix || isFuture ? 'rok' : 'rokem'; + case 'yy': // 9 years / in 9 years / 9 years ago + if (withoutSuffix || isFuture) { + return result + (plural$1(number) ? 'roky' : 'let'); + } else { + return result + 'lety'; + } + } + } + + hooks.defineLocale('cs', { + months: months$4, + monthsShort: monthsShort, + monthsRegex: monthsRegex$2, + monthsShortRegex: monthsRegex$2, + // NOTE: 'červen' is substring of 'červenec'; therefore 'červenec' must precede 'červen' in the regex to be fully matched. + // Otherwise parser matches '1. červenec' as '1. červen' + 'ec'. + monthsStrictRegex: /^(leden|ledna|února|únor|březen|března|duben|dubna|květen|května|červenec|července|červen|června|srpen|srpna|září|říjen|října|listopadu|listopad|prosinec|prosince)/i, + monthsShortStrictRegex: /^(led|úno|bře|dub|kvě|čvn|čvc|srp|zář|říj|lis|pro)/i, + monthsParse: monthsParse$1, + longMonthsParse: monthsParse$1, + shortMonthsParse: monthsParse$1, + weekdays: 'neděle_pondělí_úterý_středa_čtvrtek_pátek_sobota'.split('_'), + weekdaysShort: 'ne_po_út_st_čt_pá_so'.split('_'), + weekdaysMin: 'ne_po_út_st_čt_pá_so'.split('_'), + longDateFormat: { + LT: 'H:mm', + LTS: 'H:mm:ss', + L: 'DD.MM.YYYY', + LL: 'D. MMMM YYYY', + LLL: 'D. MMMM YYYY H:mm', + LLLL: 'dddd D. MMMM YYYY H:mm', + l: 'D. M. YYYY', + }, + calendar: { + sameDay: '[dnes v] LT', + nextDay: '[zítra v] LT', + nextWeek: function () { + switch (this.day()) { + case 0: + return '[v neděli v] LT'; + case 1: + case 2: + return '[v] dddd [v] LT'; + case 3: + return '[ve středu v] LT'; + case 4: + return '[ve čtvrtek v] LT'; + case 5: + return '[v pátek v] LT'; + case 6: + return '[v sobotu v] LT'; + } + }, + lastDay: '[včera v] LT', + lastWeek: function () { + switch (this.day()) { + case 0: + return '[minulou neděli v] LT'; + case 1: + case 2: + return '[minulé] dddd [v] LT'; + case 3: + return '[minulou středu v] LT'; + case 4: + case 5: + return '[minulý] dddd [v] LT'; + case 6: + return '[minulou sobotu v] LT'; + } + }, + sameElse: 'L', + }, + relativeTime: { + future: 'za %s', + past: 'před %s', + s: translate$1, + ss: translate$1, + m: translate$1, + mm: translate$1, + h: translate$1, + hh: translate$1, + d: translate$1, + dd: translate$1, + M: translate$1, + MM: translate$1, + y: translate$1, + yy: translate$1, + }, + dayOfMonthOrdinalParse: /\d{1,2}\./, + ordinal: '%d.', + week: { + dow: 1, // Monday is the first day of the week. + doy: 4, // The week that contains Jan 4th is the first week of the year. + }, + }); + + //! moment.js locale configuration + + hooks.defineLocale('cv', { + months: 'кӑрлач_нарӑс_пуш_ака_май_ҫӗртме_утӑ_ҫурла_авӑн_юпа_чӳк_раштав'.split( + '_' + ), + monthsShort: 'кӑр_нар_пуш_ака_май_ҫӗр_утӑ_ҫур_авн_юпа_чӳк_раш'.split('_'), + weekdays: 'вырсарникун_тунтикун_ытларикун_юнкун_кӗҫнерникун_эрнекун_шӑматкун'.split( + '_' + ), + weekdaysShort: 'выр_тун_ытл_юн_кӗҫ_эрн_шӑм'.split('_'), + weekdaysMin: 'вр_тн_ыт_юн_кҫ_эр_шм'.split('_'), + longDateFormat: { + LT: 'HH:mm', + LTS: 'HH:mm:ss', + L: 'DD-MM-YYYY', + LL: 'YYYY [ҫулхи] MMMM [уйӑхӗн] D[-мӗшӗ]', + LLL: 'YYYY [ҫулхи] MMMM [уйӑхӗн] D[-мӗшӗ], HH:mm', + LLLL: 'dddd, YYYY [ҫулхи] MMMM [уйӑхӗн] D[-мӗшӗ], HH:mm', + }, + calendar: { + sameDay: '[Паян] LT [сехетре]', + nextDay: '[Ыран] LT [сехетре]', + lastDay: '[Ӗнер] LT [сехетре]', + nextWeek: '[Ҫитес] dddd LT [сехетре]', + lastWeek: '[Иртнӗ] dddd LT [сехетре]', + sameElse: 'L', + }, + relativeTime: { + future: function (output) { + var affix = /сехет$/i.exec(output) + ? 'рен' + : /ҫул$/i.exec(output) + ? 'тан' + : 'ран'; + return output + affix; + }, + past: '%s каялла', + s: 'пӗр-ик ҫеккунт', + ss: '%d ҫеккунт', + m: 'пӗр минут', + mm: '%d минут', + h: 'пӗр сехет', + hh: '%d сехет', + d: 'пӗр кун', + dd: '%d кун', + M: 'пӗр уйӑх', + MM: '%d уйӑх', + y: 'пӗр ҫул', + yy: '%d ҫул', + }, + dayOfMonthOrdinalParse: /\d{1,2}-мӗш/, + ordinal: '%d-мӗш', + week: { + dow: 1, // Monday is the first day of the week. + doy: 7, // The week that contains Jan 7th is the first week of the year. + }, + }); + + //! moment.js locale configuration + + hooks.defineLocale('cy', { + months: 'Ionawr_Chwefror_Mawrth_Ebrill_Mai_Mehefin_Gorffennaf_Awst_Medi_Hydref_Tachwedd_Rhagfyr'.split( + '_' + ), + monthsShort: 'Ion_Chwe_Maw_Ebr_Mai_Meh_Gor_Aws_Med_Hyd_Tach_Rhag'.split( + '_' + ), + weekdays: 'Dydd Sul_Dydd Llun_Dydd Mawrth_Dydd Mercher_Dydd Iau_Dydd Gwener_Dydd Sadwrn'.split( + '_' + ), + weekdaysShort: 'Sul_Llun_Maw_Mer_Iau_Gwe_Sad'.split('_'), + weekdaysMin: 'Su_Ll_Ma_Me_Ia_Gw_Sa'.split('_'), + weekdaysParseExact: true, + // time formats are the same as en-gb + longDateFormat: { + LT: 'HH:mm', + LTS: 'HH:mm:ss', + L: 'DD/MM/YYYY', + LL: 'D MMMM YYYY', + LLL: 'D MMMM YYYY HH:mm', + LLLL: 'dddd, D MMMM YYYY HH:mm', + }, + calendar: { + sameDay: '[Heddiw am] LT', + nextDay: '[Yfory am] LT', + nextWeek: 'dddd [am] LT', + lastDay: '[Ddoe am] LT', + lastWeek: 'dddd [diwethaf am] LT', + sameElse: 'L', + }, + relativeTime: { + future: 'mewn %s', + past: '%s yn ôl', + s: 'ychydig eiliadau', + ss: '%d eiliad', + m: 'munud', + mm: '%d munud', + h: 'awr', + hh: '%d awr', + d: 'diwrnod', + dd: '%d diwrnod', + M: 'mis', + MM: '%d mis', + y: 'blwyddyn', + yy: '%d flynedd', + }, + dayOfMonthOrdinalParse: /\d{1,2}(fed|ain|af|il|ydd|ed|eg)/, + // traditional ordinal numbers above 31 are not commonly used in colloquial Welsh + ordinal: function (number) { + var b = number, + output = '', + lookup = [ + '', + 'af', + 'il', + 'ydd', + 'ydd', + 'ed', + 'ed', + 'ed', + 'fed', + 'fed', + 'fed', // 1af to 10fed + 'eg', + 'fed', + 'eg', + 'eg', + 'fed', + 'eg', + 'eg', + 'fed', + 'eg', + 'fed', // 11eg to 20fed + ]; + if (b > 20) { + if (b === 40 || b === 50 || b === 60 || b === 80 || b === 100) { + output = 'fed'; // not 30ain, 70ain or 90ain + } else { + output = 'ain'; + } + } else if (b > 0) { + output = lookup[b]; + } + return number + output; + }, + week: { + dow: 1, // Monday is the first day of the week. + doy: 4, // The week that contains Jan 4th is the first week of the year. + }, + }); + + //! moment.js locale configuration + + hooks.defineLocale('da', { + months: 'januar_februar_marts_april_maj_juni_juli_august_september_oktober_november_december'.split( + '_' + ), + monthsShort: 'jan_feb_mar_apr_maj_jun_jul_aug_sep_okt_nov_dec'.split('_'), + weekdays: 'søndag_mandag_tirsdag_onsdag_torsdag_fredag_lørdag'.split('_'), + weekdaysShort: 'søn_man_tir_ons_tor_fre_lør'.split('_'), + weekdaysMin: 'sø_ma_ti_on_to_fr_lø'.split('_'), + longDateFormat: { + LT: 'HH:mm', + LTS: 'HH:mm:ss', + L: 'DD.MM.YYYY', + LL: 'D. MMMM YYYY', + LLL: 'D. MMMM YYYY HH:mm', + LLLL: 'dddd [d.] D. MMMM YYYY [kl.] HH:mm', + }, + calendar: { + sameDay: '[i dag kl.] LT', + nextDay: '[i morgen kl.] LT', + nextWeek: 'på dddd [kl.] LT', + lastDay: '[i går kl.] LT', + lastWeek: '[i] dddd[s kl.] LT', + sameElse: 'L', + }, + relativeTime: { + future: 'om %s', + past: '%s siden', + s: 'få sekunder', + ss: '%d sekunder', + m: 'et minut', + mm: '%d minutter', + h: 'en time', + hh: '%d timer', + d: 'en dag', + dd: '%d dage', + M: 'en måned', + MM: '%d måneder', + y: 'et år', + yy: '%d år', + }, + dayOfMonthOrdinalParse: /\d{1,2}\./, + ordinal: '%d.', + week: { + dow: 1, // Monday is the first day of the week. + doy: 4, // The week that contains Jan 4th is the first week of the year. + }, + }); + + //! moment.js locale configuration + + function processRelativeTime(number, withoutSuffix, key, isFuture) { + var format = { + m: ['eine Minute', 'einer Minute'], + h: ['eine Stunde', 'einer Stunde'], + d: ['ein Tag', 'einem Tag'], + dd: [number + ' Tage', number + ' Tagen'], + w: ['eine Woche', 'einer Woche'], + M: ['ein Monat', 'einem Monat'], + MM: [number + ' Monate', number + ' Monaten'], + y: ['ein Jahr', 'einem Jahr'], + yy: [number + ' Jahre', number + ' Jahren'], + }; + return withoutSuffix ? format[key][0] : format[key][1]; + } + + hooks.defineLocale('de-at', { + months: 'Jänner_Februar_März_April_Mai_Juni_Juli_August_September_Oktober_November_Dezember'.split( + '_' + ), + monthsShort: 'Jän._Feb._März_Apr._Mai_Juni_Juli_Aug._Sep._Okt._Nov._Dez.'.split( + '_' + ), + monthsParseExact: true, + weekdays: 'Sonntag_Montag_Dienstag_Mittwoch_Donnerstag_Freitag_Samstag'.split( + '_' + ), + weekdaysShort: 'So._Mo._Di._Mi._Do._Fr._Sa.'.split('_'), + weekdaysMin: 'So_Mo_Di_Mi_Do_Fr_Sa'.split('_'), + weekdaysParseExact: true, + longDateFormat: { + LT: 'HH:mm', + LTS: 'HH:mm:ss', + L: 'DD.MM.YYYY', + LL: 'D. MMMM YYYY', + LLL: 'D. MMMM YYYY HH:mm', + LLLL: 'dddd, D. MMMM YYYY HH:mm', + }, + calendar: { + sameDay: '[heute um] LT [Uhr]', + sameElse: 'L', + nextDay: '[morgen um] LT [Uhr]', + nextWeek: 'dddd [um] LT [Uhr]', + lastDay: '[gestern um] LT [Uhr]', + lastWeek: '[letzten] dddd [um] LT [Uhr]', + }, + relativeTime: { + future: 'in %s', + past: 'vor %s', + s: 'ein paar Sekunden', + ss: '%d Sekunden', + m: processRelativeTime, + mm: '%d Minuten', + h: processRelativeTime, + hh: '%d Stunden', + d: processRelativeTime, + dd: processRelativeTime, + w: processRelativeTime, + ww: '%d Wochen', + M: processRelativeTime, + MM: processRelativeTime, + y: processRelativeTime, + yy: processRelativeTime, + }, + dayOfMonthOrdinalParse: /\d{1,2}\./, + ordinal: '%d.', + week: { + dow: 1, // Monday is the first day of the week. + doy: 4, // The week that contains Jan 4th is the first week of the year. + }, + }); + + //! moment.js locale configuration + + function processRelativeTime$1(number, withoutSuffix, key, isFuture) { + var format = { + m: ['eine Minute', 'einer Minute'], + h: ['eine Stunde', 'einer Stunde'], + d: ['ein Tag', 'einem Tag'], + dd: [number + ' Tage', number + ' Tagen'], + w: ['eine Woche', 'einer Woche'], + M: ['ein Monat', 'einem Monat'], + MM: [number + ' Monate', number + ' Monaten'], + y: ['ein Jahr', 'einem Jahr'], + yy: [number + ' Jahre', number + ' Jahren'], + }; + return withoutSuffix ? format[key][0] : format[key][1]; + } + + hooks.defineLocale('de-ch', { + months: 'Januar_Februar_März_April_Mai_Juni_Juli_August_September_Oktober_November_Dezember'.split( + '_' + ), + monthsShort: 'Jan._Feb._März_Apr._Mai_Juni_Juli_Aug._Sep._Okt._Nov._Dez.'.split( + '_' + ), + monthsParseExact: true, + weekdays: 'Sonntag_Montag_Dienstag_Mittwoch_Donnerstag_Freitag_Samstag'.split( + '_' + ), + weekdaysShort: 'So_Mo_Di_Mi_Do_Fr_Sa'.split('_'), + weekdaysMin: 'So_Mo_Di_Mi_Do_Fr_Sa'.split('_'), + weekdaysParseExact: true, + longDateFormat: { + LT: 'HH:mm', + LTS: 'HH:mm:ss', + L: 'DD.MM.YYYY', + LL: 'D. MMMM YYYY', + LLL: 'D. MMMM YYYY HH:mm', + LLLL: 'dddd, D. MMMM YYYY HH:mm', + }, + calendar: { + sameDay: '[heute um] LT [Uhr]', + sameElse: 'L', + nextDay: '[morgen um] LT [Uhr]', + nextWeek: 'dddd [um] LT [Uhr]', + lastDay: '[gestern um] LT [Uhr]', + lastWeek: '[letzten] dddd [um] LT [Uhr]', + }, + relativeTime: { + future: 'in %s', + past: 'vor %s', + s: 'ein paar Sekunden', + ss: '%d Sekunden', + m: processRelativeTime$1, + mm: '%d Minuten', + h: processRelativeTime$1, + hh: '%d Stunden', + d: processRelativeTime$1, + dd: processRelativeTime$1, + w: processRelativeTime$1, + ww: '%d Wochen', + M: processRelativeTime$1, + MM: processRelativeTime$1, + y: processRelativeTime$1, + yy: processRelativeTime$1, + }, + dayOfMonthOrdinalParse: /\d{1,2}\./, + ordinal: '%d.', + week: { + dow: 1, // Monday is the first day of the week. + doy: 4, // The week that contains Jan 4th is the first week of the year. + }, + }); + + //! moment.js locale configuration + + function processRelativeTime$2(number, withoutSuffix, key, isFuture) { + var format = { + m: ['eine Minute', 'einer Minute'], + h: ['eine Stunde', 'einer Stunde'], + d: ['ein Tag', 'einem Tag'], + dd: [number + ' Tage', number + ' Tagen'], + w: ['eine Woche', 'einer Woche'], + M: ['ein Monat', 'einem Monat'], + MM: [number + ' Monate', number + ' Monaten'], + y: ['ein Jahr', 'einem Jahr'], + yy: [number + ' Jahre', number + ' Jahren'], + }; + return withoutSuffix ? format[key][0] : format[key][1]; + } + + hooks.defineLocale('de', { + months: 'Januar_Februar_März_April_Mai_Juni_Juli_August_September_Oktober_November_Dezember'.split( + '_' + ), + monthsShort: 'Jan._Feb._März_Apr._Mai_Juni_Juli_Aug._Sep._Okt._Nov._Dez.'.split( + '_' + ), + monthsParseExact: true, + weekdays: 'Sonntag_Montag_Dienstag_Mittwoch_Donnerstag_Freitag_Samstag'.split( + '_' + ), + weekdaysShort: 'So._Mo._Di._Mi._Do._Fr._Sa.'.split('_'), + weekdaysMin: 'So_Mo_Di_Mi_Do_Fr_Sa'.split('_'), + weekdaysParseExact: true, + longDateFormat: { + LT: 'HH:mm', + LTS: 'HH:mm:ss', + L: 'DD.MM.YYYY', + LL: 'D. MMMM YYYY', + LLL: 'D. MMMM YYYY HH:mm', + LLLL: 'dddd, D. MMMM YYYY HH:mm', + }, + calendar: { + sameDay: '[heute um] LT [Uhr]', + sameElse: 'L', + nextDay: '[morgen um] LT [Uhr]', + nextWeek: 'dddd [um] LT [Uhr]', + lastDay: '[gestern um] LT [Uhr]', + lastWeek: '[letzten] dddd [um] LT [Uhr]', + }, + relativeTime: { + future: 'in %s', + past: 'vor %s', + s: 'ein paar Sekunden', + ss: '%d Sekunden', + m: processRelativeTime$2, + mm: '%d Minuten', + h: processRelativeTime$2, + hh: '%d Stunden', + d: processRelativeTime$2, + dd: processRelativeTime$2, + w: processRelativeTime$2, + ww: '%d Wochen', + M: processRelativeTime$2, + MM: processRelativeTime$2, + y: processRelativeTime$2, + yy: processRelativeTime$2, + }, + dayOfMonthOrdinalParse: /\d{1,2}\./, + ordinal: '%d.', + week: { + dow: 1, // Monday is the first day of the week. + doy: 4, // The week that contains Jan 4th is the first week of the year. + }, + }); + + //! moment.js locale configuration + + var months$5 = [ + 'ޖެނުއަރީ', + 'ފެބްރުއަރީ', + 'މާރިޗު', + 'އޭޕްރީލު', + 'މޭ', + 'ޖޫން', + 'ޖުލައި', + 'އޯގަސްޓު', + 'ސެޕްޓެމްބަރު', + 'އޮކްޓޯބަރު', + 'ނޮވެމްބަރު', + 'ޑިސެމްބަރު', + ], + weekdays = [ + 'އާދިއްތަ', + 'ހޯމަ', + 'އަންގާރަ', + 'ބުދަ', + 'ބުރާސްފަތި', + 'ހުކުރު', + 'ހޮނިހިރު', + ]; + + hooks.defineLocale('dv', { + months: months$5, + monthsShort: months$5, + weekdays: weekdays, + weekdaysShort: weekdays, + weekdaysMin: 'އާދި_ހޯމަ_އަން_ބުދަ_ބުރާ_ހުކު_ހޮނި'.split('_'), + longDateFormat: { + LT: 'HH:mm', + LTS: 'HH:mm:ss', + L: 'D/M/YYYY', + LL: 'D MMMM YYYY', + LLL: 'D MMMM YYYY HH:mm', + LLLL: 'dddd D MMMM YYYY HH:mm', + }, + meridiemParse: /މކ|މފ/, + isPM: function (input) { + return 'މފ' === input; + }, + meridiem: function (hour, minute, isLower) { + if (hour < 12) { + return 'މކ'; + } else { + return 'މފ'; + } + }, + calendar: { + sameDay: '[މިއަދު] LT', + nextDay: '[މާދަމާ] LT', + nextWeek: 'dddd LT', + lastDay: '[އިއްޔެ] LT', + lastWeek: '[ފާއިތުވި] dddd LT', + sameElse: 'L', + }, + relativeTime: { + future: 'ތެރޭގައި %s', + past: 'ކުރިން %s', + s: 'ސިކުންތުކޮޅެއް', + ss: 'd% ސިކުންތު', + m: 'މިނިޓެއް', + mm: 'މިނިޓު %d', + h: 'ގަޑިއިރެއް', + hh: 'ގަޑިއިރު %d', + d: 'ދުވަހެއް', + dd: 'ދުވަސް %d', + M: 'މަހެއް', + MM: 'މަސް %d', + y: 'އަހަރެއް', + yy: 'އަހަރު %d', + }, + preparse: function (string) { + return string.replace(/،/g, ','); + }, + postformat: function (string) { + return string.replace(/,/g, '،'); + }, + week: { + dow: 7, // Sunday is the first day of the week. + doy: 12, // The week that contains Jan 12th is the first week of the year. + }, + }); + + //! moment.js locale configuration + + function isFunction$1(input) { + return ( + (typeof Function !== 'undefined' && input instanceof Function) || + Object.prototype.toString.call(input) === '[object Function]' + ); + } + + hooks.defineLocale('el', { + monthsNominativeEl: 'Ιανουάριος_Φεβρουάριος_Μάρτιος_Απρίλιος_Μάιος_Ιούνιος_Ιούλιος_Αύγουστος_Σεπτέμβριος_Οκτώβριος_Νοέμβριος_Δεκέμβριος'.split( + '_' + ), + monthsGenitiveEl: 'Ιανουαρίου_Φεβρουαρίου_Μαρτίου_Απριλίου_Μαΐου_Ιουνίου_Ιουλίου_Αυγούστου_Σεπτεμβρίου_Οκτωβρίου_Νοεμβρίου_Δεκεμβρίου'.split( + '_' + ), + months: function (momentToFormat, format) { + if (!momentToFormat) { + return this._monthsNominativeEl; + } else if ( + typeof format === 'string' && + /D/.test(format.substring(0, format.indexOf('MMMM'))) + ) { + // if there is a day number before 'MMMM' + return this._monthsGenitiveEl[momentToFormat.month()]; + } else { + return this._monthsNominativeEl[momentToFormat.month()]; + } + }, + monthsShort: 'Ιαν_Φεβ_Μαρ_Απρ_Μαϊ_Ιουν_Ιουλ_Αυγ_Σεπ_Οκτ_Νοε_Δεκ'.split('_'), + weekdays: 'Κυριακή_Δευτέρα_Τρίτη_Τετάρτη_Πέμπτη_Παρασκευή_Σάββατο'.split( + '_' + ), + weekdaysShort: 'Κυρ_Δευ_Τρι_Τετ_Πεμ_Παρ_Σαβ'.split('_'), + weekdaysMin: 'Κυ_Δε_Τρ_Τε_Πε_Πα_Σα'.split('_'), + meridiem: function (hours, minutes, isLower) { + if (hours > 11) { + return isLower ? 'μμ' : 'ΜΜ'; + } else { + return isLower ? 'πμ' : 'ΠΜ'; + } + }, + isPM: function (input) { + return (input + '').toLowerCase()[0] === 'μ'; + }, + meridiemParse: /[ΠΜ]\.?Μ?\.?/i, + longDateFormat: { + LT: 'h:mm A', + LTS: 'h:mm:ss A', + L: 'DD/MM/YYYY', + LL: 'D MMMM YYYY', + LLL: 'D MMMM YYYY h:mm A', + LLLL: 'dddd, D MMMM YYYY h:mm A', + }, + calendarEl: { + sameDay: '[Σήμερα {}] LT', + nextDay: '[Αύριο {}] LT', + nextWeek: 'dddd [{}] LT', + lastDay: '[Χθες {}] LT', + lastWeek: function () { + switch (this.day()) { + case 6: + return '[το προηγούμενο] dddd [{}] LT'; + default: + return '[την προηγούμενη] dddd [{}] LT'; + } + }, + sameElse: 'L', + }, + calendar: function (key, mom) { + var output = this._calendarEl[key], + hours = mom && mom.hours(); + if (isFunction$1(output)) { + output = output.apply(mom); + } + return output.replace('{}', hours % 12 === 1 ? 'στη' : 'στις'); + }, + relativeTime: { + future: 'σε %s', + past: '%s πριν', + s: 'λίγα δευτερόλεπτα', + ss: '%d δευτερόλεπτα', + m: 'ένα λεπτό', + mm: '%d λεπτά', + h: 'μία ώρα', + hh: '%d ώρες', + d: 'μία μέρα', + dd: '%d μέρες', + M: 'ένας μήνας', + MM: '%d μήνες', + y: 'ένας χρόνος', + yy: '%d χρόνια', + }, + dayOfMonthOrdinalParse: /\d{1,2}η/, + ordinal: '%dη', + week: { + dow: 1, // Monday is the first day of the week. + doy: 4, // The week that contains Jan 4st is the first week of the year. + }, + }); + + //! moment.js locale configuration + + hooks.defineLocale('en-au', { + months: 'January_February_March_April_May_June_July_August_September_October_November_December'.split( + '_' + ), + monthsShort: 'Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec'.split('_'), + weekdays: 'Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday'.split( + '_' + ), + weekdaysShort: 'Sun_Mon_Tue_Wed_Thu_Fri_Sat'.split('_'), + weekdaysMin: 'Su_Mo_Tu_We_Th_Fr_Sa'.split('_'), + longDateFormat: { + LT: 'h:mm A', + LTS: 'h:mm:ss A', + L: 'DD/MM/YYYY', + LL: 'D MMMM YYYY', + LLL: 'D MMMM YYYY h:mm A', + LLLL: 'dddd, D MMMM YYYY h:mm A', + }, + calendar: { + sameDay: '[Today at] LT', + nextDay: '[Tomorrow at] LT', + nextWeek: 'dddd [at] LT', + lastDay: '[Yesterday at] LT', + lastWeek: '[Last] dddd [at] LT', + sameElse: 'L', + }, + relativeTime: { + future: 'in %s', + past: '%s ago', + s: 'a few seconds', + ss: '%d seconds', + m: 'a minute', + mm: '%d minutes', + h: 'an hour', + hh: '%d hours', + d: 'a day', + dd: '%d days', + M: 'a month', + MM: '%d months', + y: 'a year', + yy: '%d years', + }, + dayOfMonthOrdinalParse: /\d{1,2}(st|nd|rd|th)/, + ordinal: function (number) { + var b = number % 10, + output = + ~~((number % 100) / 10) === 1 + ? 'th' + : b === 1 + ? 'st' + : b === 2 + ? 'nd' + : b === 3 + ? 'rd' + : 'th'; + return number + output; + }, + week: { + dow: 0, // Sunday is the first day of the week. + doy: 4, // The week that contains Jan 4th is the first week of the year. + }, + }); + + //! moment.js locale configuration + + hooks.defineLocale('en-ca', { + months: 'January_February_March_April_May_June_July_August_September_October_November_December'.split( + '_' + ), + monthsShort: 'Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec'.split('_'), + weekdays: 'Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday'.split( + '_' + ), + weekdaysShort: 'Sun_Mon_Tue_Wed_Thu_Fri_Sat'.split('_'), + weekdaysMin: 'Su_Mo_Tu_We_Th_Fr_Sa'.split('_'), + longDateFormat: { + LT: 'h:mm A', + LTS: 'h:mm:ss A', + L: 'YYYY-MM-DD', + LL: 'MMMM D, YYYY', + LLL: 'MMMM D, YYYY h:mm A', + LLLL: 'dddd, MMMM D, YYYY h:mm A', + }, + calendar: { + sameDay: '[Today at] LT', + nextDay: '[Tomorrow at] LT', + nextWeek: 'dddd [at] LT', + lastDay: '[Yesterday at] LT', + lastWeek: '[Last] dddd [at] LT', + sameElse: 'L', + }, + relativeTime: { + future: 'in %s', + past: '%s ago', + s: 'a few seconds', + ss: '%d seconds', + m: 'a minute', + mm: '%d minutes', + h: 'an hour', + hh: '%d hours', + d: 'a day', + dd: '%d days', + M: 'a month', + MM: '%d months', + y: 'a year', + yy: '%d years', + }, + dayOfMonthOrdinalParse: /\d{1,2}(st|nd|rd|th)/, + ordinal: function (number) { + var b = number % 10, + output = + ~~((number % 100) / 10) === 1 + ? 'th' + : b === 1 + ? 'st' + : b === 2 + ? 'nd' + : b === 3 + ? 'rd' + : 'th'; + return number + output; + }, + }); + + //! moment.js locale configuration + + hooks.defineLocale('en-gb', { + months: 'January_February_March_April_May_June_July_August_September_October_November_December'.split( + '_' + ), + monthsShort: 'Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec'.split('_'), + weekdays: 'Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday'.split( + '_' + ), + weekdaysShort: 'Sun_Mon_Tue_Wed_Thu_Fri_Sat'.split('_'), + weekdaysMin: 'Su_Mo_Tu_We_Th_Fr_Sa'.split('_'), + longDateFormat: { + LT: 'HH:mm', + LTS: 'HH:mm:ss', + L: 'DD/MM/YYYY', + LL: 'D MMMM YYYY', + LLL: 'D MMMM YYYY HH:mm', + LLLL: 'dddd, D MMMM YYYY HH:mm', + }, + calendar: { + sameDay: '[Today at] LT', + nextDay: '[Tomorrow at] LT', + nextWeek: 'dddd [at] LT', + lastDay: '[Yesterday at] LT', + lastWeek: '[Last] dddd [at] LT', + sameElse: 'L', + }, + relativeTime: { + future: 'in %s', + past: '%s ago', + s: 'a few seconds', + ss: '%d seconds', + m: 'a minute', + mm: '%d minutes', + h: 'an hour', + hh: '%d hours', + d: 'a day', + dd: '%d days', + M: 'a month', + MM: '%d months', + y: 'a year', + yy: '%d years', + }, + dayOfMonthOrdinalParse: /\d{1,2}(st|nd|rd|th)/, + ordinal: function (number) { + var b = number % 10, + output = + ~~((number % 100) / 10) === 1 + ? 'th' + : b === 1 + ? 'st' + : b === 2 + ? 'nd' + : b === 3 + ? 'rd' + : 'th'; + return number + output; + }, + week: { + dow: 1, // Monday is the first day of the week. + doy: 4, // The week that contains Jan 4th is the first week of the year. + }, + }); + + //! moment.js locale configuration + + hooks.defineLocale('en-ie', { + months: 'January_February_March_April_May_June_July_August_September_October_November_December'.split( + '_' + ), + monthsShort: 'Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec'.split('_'), + weekdays: 'Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday'.split( + '_' + ), + weekdaysShort: 'Sun_Mon_Tue_Wed_Thu_Fri_Sat'.split('_'), + weekdaysMin: 'Su_Mo_Tu_We_Th_Fr_Sa'.split('_'), + longDateFormat: { + LT: 'HH:mm', + LTS: 'HH:mm:ss', + L: 'DD/MM/YYYY', + LL: 'D MMMM YYYY', + LLL: 'D MMMM YYYY HH:mm', + LLLL: 'dddd D MMMM YYYY HH:mm', + }, + calendar: { + sameDay: '[Today at] LT', + nextDay: '[Tomorrow at] LT', + nextWeek: 'dddd [at] LT', + lastDay: '[Yesterday at] LT', + lastWeek: '[Last] dddd [at] LT', + sameElse: 'L', + }, + relativeTime: { + future: 'in %s', + past: '%s ago', + s: 'a few seconds', + ss: '%d seconds', + m: 'a minute', + mm: '%d minutes', + h: 'an hour', + hh: '%d hours', + d: 'a day', + dd: '%d days', + M: 'a month', + MM: '%d months', + y: 'a year', + yy: '%d years', + }, + dayOfMonthOrdinalParse: /\d{1,2}(st|nd|rd|th)/, + ordinal: function (number) { + var b = number % 10, + output = + ~~((number % 100) / 10) === 1 + ? 'th' + : b === 1 + ? 'st' + : b === 2 + ? 'nd' + : b === 3 + ? 'rd' + : 'th'; + return number + output; + }, + week: { + dow: 1, // Monday is the first day of the week. + doy: 4, // The week that contains Jan 4th is the first week of the year. + }, + }); + + //! moment.js locale configuration + + hooks.defineLocale('en-il', { + months: 'January_February_March_April_May_June_July_August_September_October_November_December'.split( + '_' + ), + monthsShort: 'Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec'.split('_'), + weekdays: 'Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday'.split( + '_' + ), + weekdaysShort: 'Sun_Mon_Tue_Wed_Thu_Fri_Sat'.split('_'), + weekdaysMin: 'Su_Mo_Tu_We_Th_Fr_Sa'.split('_'), + longDateFormat: { + LT: 'HH:mm', + LTS: 'HH:mm:ss', + L: 'DD/MM/YYYY', + LL: 'D MMMM YYYY', + LLL: 'D MMMM YYYY HH:mm', + LLLL: 'dddd, D MMMM YYYY HH:mm', + }, + calendar: { + sameDay: '[Today at] LT', + nextDay: '[Tomorrow at] LT', + nextWeek: 'dddd [at] LT', + lastDay: '[Yesterday at] LT', + lastWeek: '[Last] dddd [at] LT', + sameElse: 'L', + }, + relativeTime: { + future: 'in %s', + past: '%s ago', + s: 'a few seconds', + ss: '%d seconds', + m: 'a minute', + mm: '%d minutes', + h: 'an hour', + hh: '%d hours', + d: 'a day', + dd: '%d days', + M: 'a month', + MM: '%d months', + y: 'a year', + yy: '%d years', + }, + dayOfMonthOrdinalParse: /\d{1,2}(st|nd|rd|th)/, + ordinal: function (number) { + var b = number % 10, + output = + ~~((number % 100) / 10) === 1 + ? 'th' + : b === 1 + ? 'st' + : b === 2 + ? 'nd' + : b === 3 + ? 'rd' + : 'th'; + return number + output; + }, + }); + + //! moment.js locale configuration + + hooks.defineLocale('en-in', { + months: 'January_February_March_April_May_June_July_August_September_October_November_December'.split( + '_' + ), + monthsShort: 'Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec'.split('_'), + weekdays: 'Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday'.split( + '_' + ), + weekdaysShort: 'Sun_Mon_Tue_Wed_Thu_Fri_Sat'.split('_'), + weekdaysMin: 'Su_Mo_Tu_We_Th_Fr_Sa'.split('_'), + longDateFormat: { + LT: 'h:mm A', + LTS: 'h:mm:ss A', + L: 'DD/MM/YYYY', + LL: 'D MMMM YYYY', + LLL: 'D MMMM YYYY h:mm A', + LLLL: 'dddd, D MMMM YYYY h:mm A', + }, + calendar: { + sameDay: '[Today at] LT', + nextDay: '[Tomorrow at] LT', + nextWeek: 'dddd [at] LT', + lastDay: '[Yesterday at] LT', + lastWeek: '[Last] dddd [at] LT', + sameElse: 'L', + }, + relativeTime: { + future: 'in %s', + past: '%s ago', + s: 'a few seconds', + ss: '%d seconds', + m: 'a minute', + mm: '%d minutes', + h: 'an hour', + hh: '%d hours', + d: 'a day', + dd: '%d days', + M: 'a month', + MM: '%d months', + y: 'a year', + yy: '%d years', + }, + dayOfMonthOrdinalParse: /\d{1,2}(st|nd|rd|th)/, + ordinal: function (number) { + var b = number % 10, + output = + ~~((number % 100) / 10) === 1 + ? 'th' + : b === 1 + ? 'st' + : b === 2 + ? 'nd' + : b === 3 + ? 'rd' + : 'th'; + return number + output; + }, + week: { + dow: 0, // Sunday is the first day of the week. + doy: 6, // The week that contains Jan 1st is the first week of the year. + }, + }); + + //! moment.js locale configuration + + hooks.defineLocale('en-nz', { + months: 'January_February_March_April_May_June_July_August_September_October_November_December'.split( + '_' + ), + monthsShort: 'Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec'.split('_'), + weekdays: 'Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday'.split( + '_' + ), + weekdaysShort: 'Sun_Mon_Tue_Wed_Thu_Fri_Sat'.split('_'), + weekdaysMin: 'Su_Mo_Tu_We_Th_Fr_Sa'.split('_'), + longDateFormat: { + LT: 'h:mm A', + LTS: 'h:mm:ss A', + L: 'DD/MM/YYYY', + LL: 'D MMMM YYYY', + LLL: 'D MMMM YYYY h:mm A', + LLLL: 'dddd, D MMMM YYYY h:mm A', + }, + calendar: { + sameDay: '[Today at] LT', + nextDay: '[Tomorrow at] LT', + nextWeek: 'dddd [at] LT', + lastDay: '[Yesterday at] LT', + lastWeek: '[Last] dddd [at] LT', + sameElse: 'L', + }, + relativeTime: { + future: 'in %s', + past: '%s ago', + s: 'a few seconds', + ss: '%d seconds', + m: 'a minute', + mm: '%d minutes', + h: 'an hour', + hh: '%d hours', + d: 'a day', + dd: '%d days', + M: 'a month', + MM: '%d months', + y: 'a year', + yy: '%d years', + }, + dayOfMonthOrdinalParse: /\d{1,2}(st|nd|rd|th)/, + ordinal: function (number) { + var b = number % 10, + output = + ~~((number % 100) / 10) === 1 + ? 'th' + : b === 1 + ? 'st' + : b === 2 + ? 'nd' + : b === 3 + ? 'rd' + : 'th'; + return number + output; + }, + week: { + dow: 1, // Monday is the first day of the week. + doy: 4, // The week that contains Jan 4th is the first week of the year. + }, + }); + + //! moment.js locale configuration + + hooks.defineLocale('en-sg', { + months: 'January_February_March_April_May_June_July_August_September_October_November_December'.split( + '_' + ), + monthsShort: 'Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec'.split('_'), + weekdays: 'Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday'.split( + '_' + ), + weekdaysShort: 'Sun_Mon_Tue_Wed_Thu_Fri_Sat'.split('_'), + weekdaysMin: 'Su_Mo_Tu_We_Th_Fr_Sa'.split('_'), + longDateFormat: { + LT: 'HH:mm', + LTS: 'HH:mm:ss', + L: 'DD/MM/YYYY', + LL: 'D MMMM YYYY', + LLL: 'D MMMM YYYY HH:mm', + LLLL: 'dddd, D MMMM YYYY HH:mm', + }, + calendar: { + sameDay: '[Today at] LT', + nextDay: '[Tomorrow at] LT', + nextWeek: 'dddd [at] LT', + lastDay: '[Yesterday at] LT', + lastWeek: '[Last] dddd [at] LT', + sameElse: 'L', + }, + relativeTime: { + future: 'in %s', + past: '%s ago', + s: 'a few seconds', + ss: '%d seconds', + m: 'a minute', + mm: '%d minutes', + h: 'an hour', + hh: '%d hours', + d: 'a day', + dd: '%d days', + M: 'a month', + MM: '%d months', + y: 'a year', + yy: '%d years', + }, + dayOfMonthOrdinalParse: /\d{1,2}(st|nd|rd|th)/, + ordinal: function (number) { + var b = number % 10, + output = + ~~((number % 100) / 10) === 1 + ? 'th' + : b === 1 + ? 'st' + : b === 2 + ? 'nd' + : b === 3 + ? 'rd' + : 'th'; + return number + output; + }, + week: { + dow: 1, // Monday is the first day of the week. + doy: 4, // The week that contains Jan 4th is the first week of the year. + }, + }); + + //! moment.js locale configuration + + hooks.defineLocale('eo', { + months: 'januaro_februaro_marto_aprilo_majo_junio_julio_aŭgusto_septembro_oktobro_novembro_decembro'.split( + '_' + ), + monthsShort: 'jan_feb_mart_apr_maj_jun_jul_aŭg_sept_okt_nov_dec'.split('_'), + weekdays: 'dimanĉo_lundo_mardo_merkredo_ĵaŭdo_vendredo_sabato'.split('_'), + weekdaysShort: 'dim_lun_mard_merk_ĵaŭ_ven_sab'.split('_'), + weekdaysMin: 'di_lu_ma_me_ĵa_ve_sa'.split('_'), + longDateFormat: { + LT: 'HH:mm', + LTS: 'HH:mm:ss', + L: 'YYYY-MM-DD', + LL: '[la] D[-an de] MMMM, YYYY', + LLL: '[la] D[-an de] MMMM, YYYY HH:mm', + LLLL: 'dddd[n], [la] D[-an de] MMMM, YYYY HH:mm', + llll: 'ddd, [la] D[-an de] MMM, YYYY HH:mm', + }, + meridiemParse: /[ap]\.t\.m/i, + isPM: function (input) { + return input.charAt(0).toLowerCase() === 'p'; + }, + meridiem: function (hours, minutes, isLower) { + if (hours > 11) { + return isLower ? 'p.t.m.' : 'P.T.M.'; + } else { + return isLower ? 'a.t.m.' : 'A.T.M.'; + } + }, + calendar: { + sameDay: '[Hodiaŭ je] LT', + nextDay: '[Morgaŭ je] LT', + nextWeek: 'dddd[n je] LT', + lastDay: '[Hieraŭ je] LT', + lastWeek: '[pasintan] dddd[n je] LT', + sameElse: 'L', + }, + relativeTime: { + future: 'post %s', + past: 'antaŭ %s', + s: 'kelkaj sekundoj', + ss: '%d sekundoj', + m: 'unu minuto', + mm: '%d minutoj', + h: 'unu horo', + hh: '%d horoj', + d: 'unu tago', //ne 'diurno', ĉar estas uzita por proksimumo + dd: '%d tagoj', + M: 'unu monato', + MM: '%d monatoj', + y: 'unu jaro', + yy: '%d jaroj', + }, + dayOfMonthOrdinalParse: /\d{1,2}a/, + ordinal: '%da', + week: { + dow: 1, // Monday is the first day of the week. + doy: 7, // The week that contains Jan 7th is the first week of the year. + }, + }); + + //! moment.js locale configuration + + var monthsShortDot = 'ene._feb._mar._abr._may._jun._jul._ago._sep._oct._nov._dic.'.split( + '_' + ), + monthsShort$1 = 'ene_feb_mar_abr_may_jun_jul_ago_sep_oct_nov_dic'.split('_'), + monthsParse$2 = [ + /^ene/i, + /^feb/i, + /^mar/i, + /^abr/i, + /^may/i, + /^jun/i, + /^jul/i, + /^ago/i, + /^sep/i, + /^oct/i, + /^nov/i, + /^dic/i, + ], + monthsRegex$3 = /^(enero|febrero|marzo|abril|mayo|junio|julio|agosto|septiembre|octubre|noviembre|diciembre|ene\.?|feb\.?|mar\.?|abr\.?|may\.?|jun\.?|jul\.?|ago\.?|sep\.?|oct\.?|nov\.?|dic\.?)/i; + + hooks.defineLocale('es-do', { + months: 'enero_febrero_marzo_abril_mayo_junio_julio_agosto_septiembre_octubre_noviembre_diciembre'.split( + '_' + ), + monthsShort: function (m, format) { + if (!m) { + return monthsShortDot; + } else if (/-MMM-/.test(format)) { + return monthsShort$1[m.month()]; + } else { + return monthsShortDot[m.month()]; + } + }, + monthsRegex: monthsRegex$3, + monthsShortRegex: monthsRegex$3, + monthsStrictRegex: /^(enero|febrero|marzo|abril|mayo|junio|julio|agosto|septiembre|octubre|noviembre|diciembre)/i, + monthsShortStrictRegex: /^(ene\.?|feb\.?|mar\.?|abr\.?|may\.?|jun\.?|jul\.?|ago\.?|sep\.?|oct\.?|nov\.?|dic\.?)/i, + monthsParse: monthsParse$2, + longMonthsParse: monthsParse$2, + shortMonthsParse: monthsParse$2, + weekdays: 'domingo_lunes_martes_miércoles_jueves_viernes_sábado'.split('_'), + weekdaysShort: 'dom._lun._mar._mié._jue._vie._sáb.'.split('_'), + weekdaysMin: 'do_lu_ma_mi_ju_vi_sá'.split('_'), + weekdaysParseExact: true, + longDateFormat: { + LT: 'h:mm A', + LTS: 'h:mm:ss A', + L: 'DD/MM/YYYY', + LL: 'D [de] MMMM [de] YYYY', + LLL: 'D [de] MMMM [de] YYYY h:mm A', + LLLL: 'dddd, D [de] MMMM [de] YYYY h:mm A', + }, + calendar: { + sameDay: function () { + return '[hoy a la' + (this.hours() !== 1 ? 's' : '') + '] LT'; + }, + nextDay: function () { + return '[mañana a la' + (this.hours() !== 1 ? 's' : '') + '] LT'; + }, + nextWeek: function () { + return 'dddd [a la' + (this.hours() !== 1 ? 's' : '') + '] LT'; + }, + lastDay: function () { + return '[ayer a la' + (this.hours() !== 1 ? 's' : '') + '] LT'; + }, + lastWeek: function () { + return ( + '[el] dddd [pasado a la' + + (this.hours() !== 1 ? 's' : '') + + '] LT' + ); + }, + sameElse: 'L', + }, + relativeTime: { + future: 'en %s', + past: 'hace %s', + s: 'unos segundos', + ss: '%d segundos', + m: 'un minuto', + mm: '%d minutos', + h: 'una hora', + hh: '%d horas', + d: 'un día', + dd: '%d días', + M: 'un mes', + MM: '%d meses', + y: 'un año', + yy: '%d años', + }, + dayOfMonthOrdinalParse: /\d{1,2}º/, + ordinal: '%dº', + week: { + dow: 1, // Monday is the first day of the week. + doy: 4, // The week that contains Jan 4th is the first week of the year. + }, + }); + + //! moment.js locale configuration + + var monthsShortDot$1 = 'ene._feb._mar._abr._may._jun._jul._ago._sep._oct._nov._dic.'.split( + '_' + ), + monthsShort$2 = 'ene_feb_mar_abr_may_jun_jul_ago_sep_oct_nov_dic'.split('_'), + monthsParse$3 = [ + /^ene/i, + /^feb/i, + /^mar/i, + /^abr/i, + /^may/i, + /^jun/i, + /^jul/i, + /^ago/i, + /^sep/i, + /^oct/i, + /^nov/i, + /^dic/i, + ], + monthsRegex$4 = /^(enero|febrero|marzo|abril|mayo|junio|julio|agosto|septiembre|octubre|noviembre|diciembre|ene\.?|feb\.?|mar\.?|abr\.?|may\.?|jun\.?|jul\.?|ago\.?|sep\.?|oct\.?|nov\.?|dic\.?)/i; + + hooks.defineLocale('es-us', { + months: 'enero_febrero_marzo_abril_mayo_junio_julio_agosto_septiembre_octubre_noviembre_diciembre'.split( + '_' + ), + monthsShort: function (m, format) { + if (!m) { + return monthsShortDot$1; + } else if (/-MMM-/.test(format)) { + return monthsShort$2[m.month()]; + } else { + return monthsShortDot$1[m.month()]; + } + }, + monthsRegex: monthsRegex$4, + monthsShortRegex: monthsRegex$4, + monthsStrictRegex: /^(enero|febrero|marzo|abril|mayo|junio|julio|agosto|septiembre|octubre|noviembre|diciembre)/i, + monthsShortStrictRegex: /^(ene\.?|feb\.?|mar\.?|abr\.?|may\.?|jun\.?|jul\.?|ago\.?|sep\.?|oct\.?|nov\.?|dic\.?)/i, + monthsParse: monthsParse$3, + longMonthsParse: monthsParse$3, + shortMonthsParse: monthsParse$3, + weekdays: 'domingo_lunes_martes_miércoles_jueves_viernes_sábado'.split('_'), + weekdaysShort: 'dom._lun._mar._mié._jue._vie._sáb.'.split('_'), + weekdaysMin: 'do_lu_ma_mi_ju_vi_sá'.split('_'), + weekdaysParseExact: true, + longDateFormat: { + LT: 'h:mm A', + LTS: 'h:mm:ss A', + L: 'MM/DD/YYYY', + LL: 'D [de] MMMM [de] YYYY', + LLL: 'D [de] MMMM [de] YYYY h:mm A', + LLLL: 'dddd, D [de] MMMM [de] YYYY h:mm A', + }, + calendar: { + sameDay: function () { + return '[hoy a la' + (this.hours() !== 1 ? 's' : '') + '] LT'; + }, + nextDay: function () { + return '[mañana a la' + (this.hours() !== 1 ? 's' : '') + '] LT'; + }, + nextWeek: function () { + return 'dddd [a la' + (this.hours() !== 1 ? 's' : '') + '] LT'; + }, + lastDay: function () { + return '[ayer a la' + (this.hours() !== 1 ? 's' : '') + '] LT'; + }, + lastWeek: function () { + return ( + '[el] dddd [pasado a la' + + (this.hours() !== 1 ? 's' : '') + + '] LT' + ); + }, + sameElse: 'L', + }, + relativeTime: { + future: 'en %s', + past: 'hace %s', + s: 'unos segundos', + ss: '%d segundos', + m: 'un minuto', + mm: '%d minutos', + h: 'una hora', + hh: '%d horas', + d: 'un día', + dd: '%d días', + M: 'un mes', + MM: '%d meses', + y: 'un año', + yy: '%d años', + }, + dayOfMonthOrdinalParse: /\d{1,2}º/, + ordinal: '%dº', + week: { + dow: 0, // Sunday is the first day of the week. + doy: 6, // The week that contains Jan 6th is the first week of the year. + }, + }); + + //! moment.js locale configuration + + var monthsShortDot$2 = 'ene._feb._mar._abr._may._jun._jul._ago._sep._oct._nov._dic.'.split( + '_' + ), + monthsShort$3 = 'ene_feb_mar_abr_may_jun_jul_ago_sep_oct_nov_dic'.split('_'), + monthsParse$4 = [ + /^ene/i, + /^feb/i, + /^mar/i, + /^abr/i, + /^may/i, + /^jun/i, + /^jul/i, + /^ago/i, + /^sep/i, + /^oct/i, + /^nov/i, + /^dic/i, + ], + monthsRegex$5 = /^(enero|febrero|marzo|abril|mayo|junio|julio|agosto|septiembre|octubre|noviembre|diciembre|ene\.?|feb\.?|mar\.?|abr\.?|may\.?|jun\.?|jul\.?|ago\.?|sep\.?|oct\.?|nov\.?|dic\.?)/i; + + hooks.defineLocale('es', { + months: 'enero_febrero_marzo_abril_mayo_junio_julio_agosto_septiembre_octubre_noviembre_diciembre'.split( + '_' + ), + monthsShort: function (m, format) { + if (!m) { + return monthsShortDot$2; + } else if (/-MMM-/.test(format)) { + return monthsShort$3[m.month()]; + } else { + return monthsShortDot$2[m.month()]; + } + }, + monthsRegex: monthsRegex$5, + monthsShortRegex: monthsRegex$5, + monthsStrictRegex: /^(enero|febrero|marzo|abril|mayo|junio|julio|agosto|septiembre|octubre|noviembre|diciembre)/i, + monthsShortStrictRegex: /^(ene\.?|feb\.?|mar\.?|abr\.?|may\.?|jun\.?|jul\.?|ago\.?|sep\.?|oct\.?|nov\.?|dic\.?)/i, + monthsParse: monthsParse$4, + longMonthsParse: monthsParse$4, + shortMonthsParse: monthsParse$4, + weekdays: 'domingo_lunes_martes_miércoles_jueves_viernes_sábado'.split('_'), + weekdaysShort: 'dom._lun._mar._mié._jue._vie._sáb.'.split('_'), + weekdaysMin: 'do_lu_ma_mi_ju_vi_sá'.split('_'), + weekdaysParseExact: true, + longDateFormat: { + LT: 'H:mm', + LTS: 'H:mm:ss', + L: 'DD/MM/YYYY', + LL: 'D [de] MMMM [de] YYYY', + LLL: 'D [de] MMMM [de] YYYY H:mm', + LLLL: 'dddd, D [de] MMMM [de] YYYY H:mm', + }, + calendar: { + sameDay: function () { + return '[hoy a la' + (this.hours() !== 1 ? 's' : '') + '] LT'; + }, + nextDay: function () { + return '[mañana a la' + (this.hours() !== 1 ? 's' : '') + '] LT'; + }, + nextWeek: function () { + return 'dddd [a la' + (this.hours() !== 1 ? 's' : '') + '] LT'; + }, + lastDay: function () { + return '[ayer a la' + (this.hours() !== 1 ? 's' : '') + '] LT'; + }, + lastWeek: function () { + return ( + '[el] dddd [pasado a la' + + (this.hours() !== 1 ? 's' : '') + + '] LT' + ); + }, + sameElse: 'L', + }, + relativeTime: { + future: 'en %s', + past: 'hace %s', + s: 'unos segundos', + ss: '%d segundos', + m: 'un minuto', + mm: '%d minutos', + h: 'una hora', + hh: '%d horas', + d: 'un día', + dd: '%d días', + M: 'un mes', + MM: '%d meses', + y: 'un año', + yy: '%d años', + }, + dayOfMonthOrdinalParse: /\d{1,2}º/, + ordinal: '%dº', + week: { + dow: 1, // Monday is the first day of the week. + doy: 4, // The week that contains Jan 4th is the first week of the year. + }, + invalidDate: 'Fecha inválida', + }); + + //! moment.js locale configuration + + function processRelativeTime$3(number, withoutSuffix, key, isFuture) { + var format = { + s: ['mõne sekundi', 'mõni sekund', 'paar sekundit'], + ss: [number + 'sekundi', number + 'sekundit'], + m: ['ühe minuti', 'üks minut'], + mm: [number + ' minuti', number + ' minutit'], + h: ['ühe tunni', 'tund aega', 'üks tund'], + hh: [number + ' tunni', number + ' tundi'], + d: ['ühe päeva', 'üks päev'], + M: ['kuu aja', 'kuu aega', 'üks kuu'], + MM: [number + ' kuu', number + ' kuud'], + y: ['ühe aasta', 'aasta', 'üks aasta'], + yy: [number + ' aasta', number + ' aastat'], + }; + if (withoutSuffix) { + return format[key][2] ? format[key][2] : format[key][1]; + } + return isFuture ? format[key][0] : format[key][1]; + } + + hooks.defineLocale('et', { + months: 'jaanuar_veebruar_märts_aprill_mai_juuni_juuli_august_september_oktoober_november_detsember'.split( + '_' + ), + monthsShort: 'jaan_veebr_märts_apr_mai_juuni_juuli_aug_sept_okt_nov_dets'.split( + '_' + ), + weekdays: 'pühapäev_esmaspäev_teisipäev_kolmapäev_neljapäev_reede_laupäev'.split( + '_' + ), + weekdaysShort: 'P_E_T_K_N_R_L'.split('_'), + weekdaysMin: 'P_E_T_K_N_R_L'.split('_'), + longDateFormat: { + LT: 'H:mm', + LTS: 'H:mm:ss', + L: 'DD.MM.YYYY', + LL: 'D. MMMM YYYY', + LLL: 'D. MMMM YYYY H:mm', + LLLL: 'dddd, D. MMMM YYYY H:mm', + }, + calendar: { + sameDay: '[Täna,] LT', + nextDay: '[Homme,] LT', + nextWeek: '[Järgmine] dddd LT', + lastDay: '[Eile,] LT', + lastWeek: '[Eelmine] dddd LT', + sameElse: 'L', + }, + relativeTime: { + future: '%s pärast', + past: '%s tagasi', + s: processRelativeTime$3, + ss: processRelativeTime$3, + m: processRelativeTime$3, + mm: processRelativeTime$3, + h: processRelativeTime$3, + hh: processRelativeTime$3, + d: processRelativeTime$3, + dd: '%d päeva', + M: processRelativeTime$3, + MM: processRelativeTime$3, + y: processRelativeTime$3, + yy: processRelativeTime$3, + }, + dayOfMonthOrdinalParse: /\d{1,2}\./, + ordinal: '%d.', + week: { + dow: 1, // Monday is the first day of the week. + doy: 4, // The week that contains Jan 4th is the first week of the year. + }, + }); + + //! moment.js locale configuration + + hooks.defineLocale('eu', { + months: 'urtarrila_otsaila_martxoa_apirila_maiatza_ekaina_uztaila_abuztua_iraila_urria_azaroa_abendua'.split( + '_' + ), + monthsShort: 'urt._ots._mar._api._mai._eka._uzt._abu._ira._urr._aza._abe.'.split( + '_' + ), + monthsParseExact: true, + weekdays: 'igandea_astelehena_asteartea_asteazkena_osteguna_ostirala_larunbata'.split( + '_' + ), + weekdaysShort: 'ig._al._ar._az._og._ol._lr.'.split('_'), + weekdaysMin: 'ig_al_ar_az_og_ol_lr'.split('_'), + weekdaysParseExact: true, + longDateFormat: { + LT: 'HH:mm', + LTS: 'HH:mm:ss', + L: 'YYYY-MM-DD', + LL: 'YYYY[ko] MMMM[ren] D[a]', + LLL: 'YYYY[ko] MMMM[ren] D[a] HH:mm', + LLLL: 'dddd, YYYY[ko] MMMM[ren] D[a] HH:mm', + l: 'YYYY-M-D', + ll: 'YYYY[ko] MMM D[a]', + lll: 'YYYY[ko] MMM D[a] HH:mm', + llll: 'ddd, YYYY[ko] MMM D[a] HH:mm', + }, + calendar: { + sameDay: '[gaur] LT[etan]', + nextDay: '[bihar] LT[etan]', + nextWeek: 'dddd LT[etan]', + lastDay: '[atzo] LT[etan]', + lastWeek: '[aurreko] dddd LT[etan]', + sameElse: 'L', + }, + relativeTime: { + future: '%s barru', + past: 'duela %s', + s: 'segundo batzuk', + ss: '%d segundo', + m: 'minutu bat', + mm: '%d minutu', + h: 'ordu bat', + hh: '%d ordu', + d: 'egun bat', + dd: '%d egun', + M: 'hilabete bat', + MM: '%d hilabete', + y: 'urte bat', + yy: '%d urte', + }, + dayOfMonthOrdinalParse: /\d{1,2}\./, + ordinal: '%d.', + week: { + dow: 1, // Monday is the first day of the week. + doy: 7, // The week that contains Jan 7th is the first week of the year. + }, + }); + + //! moment.js locale configuration + + var symbolMap$5 = { + '1': '۱', + '2': '۲', + '3': '۳', + '4': '۴', + '5': '۵', + '6': '۶', + '7': '۷', + '8': '۸', + '9': '۹', + '0': '۰', + }, + numberMap$4 = { + '۱': '1', + '۲': '2', + '۳': '3', + '۴': '4', + '۵': '5', + '۶': '6', + '۷': '7', + '۸': '8', + '۹': '9', + '۰': '0', + }; + + hooks.defineLocale('fa', { + months: 'ژانویه_فوریه_مارس_آوریل_مه_ژوئن_ژوئیه_اوت_سپتامبر_اکتبر_نوامبر_دسامبر'.split( + '_' + ), + monthsShort: 'ژانویه_فوریه_مارس_آوریل_مه_ژوئن_ژوئیه_اوت_سپتامبر_اکتبر_نوامبر_دسامبر'.split( + '_' + ), + weekdays: 'یک\u200cشنبه_دوشنبه_سه\u200cشنبه_چهارشنبه_پنج\u200cشنبه_جمعه_شنبه'.split( + '_' + ), + weekdaysShort: 'یک\u200cشنبه_دوشنبه_سه\u200cشنبه_چهارشنبه_پنج\u200cشنبه_جمعه_شنبه'.split( + '_' + ), + weekdaysMin: 'ی_د_س_چ_پ_ج_ش'.split('_'), + weekdaysParseExact: true, + longDateFormat: { + LT: 'HH:mm', + LTS: 'HH:mm:ss', + L: 'DD/MM/YYYY', + LL: 'D MMMM YYYY', + LLL: 'D MMMM YYYY HH:mm', + LLLL: 'dddd, D MMMM YYYY HH:mm', + }, + meridiemParse: /قبل از ظهر|بعد از ظهر/, + isPM: function (input) { + return /بعد از ظهر/.test(input); + }, + meridiem: function (hour, minute, isLower) { + if (hour < 12) { + return 'قبل از ظهر'; + } else { + return 'بعد از ظهر'; + } + }, + calendar: { + sameDay: '[امروز ساعت] LT', + nextDay: '[فردا ساعت] LT', + nextWeek: 'dddd [ساعت] LT', + lastDay: '[دیروز ساعت] LT', + lastWeek: 'dddd [پیش] [ساعت] LT', + sameElse: 'L', + }, + relativeTime: { + future: 'در %s', + past: '%s پیش', + s: 'چند ثانیه', + ss: '%d ثانیه', + m: 'یک دقیقه', + mm: '%d دقیقه', + h: 'یک ساعت', + hh: '%d ساعت', + d: 'یک روز', + dd: '%d روز', + M: 'یک ماه', + MM: '%d ماه', + y: 'یک سال', + yy: '%d سال', + }, + preparse: function (string) { + return string + .replace(/[۰-۹]/g, function (match) { + return numberMap$4[match]; + }) + .replace(/،/g, ','); + }, + postformat: function (string) { + return string + .replace(/\d/g, function (match) { + return symbolMap$5[match]; + }) + .replace(/,/g, '،'); + }, + dayOfMonthOrdinalParse: /\d{1,2}م/, + ordinal: '%dم', + week: { + dow: 6, // Saturday is the first day of the week. + doy: 12, // The week that contains Jan 12th is the first week of the year. + }, + }); + + //! moment.js locale configuration + + var numbersPast = 'nolla yksi kaksi kolme neljä viisi kuusi seitsemän kahdeksan yhdeksän'.split( + ' ' + ), + numbersFuture = [ + 'nolla', + 'yhden', + 'kahden', + 'kolmen', + 'neljän', + 'viiden', + 'kuuden', + numbersPast[7], + numbersPast[8], + numbersPast[9], + ]; + function translate$2(number, withoutSuffix, key, isFuture) { + var result = ''; + switch (key) { + case 's': + return isFuture ? 'muutaman sekunnin' : 'muutama sekunti'; + case 'ss': + result = isFuture ? 'sekunnin' : 'sekuntia'; + break; + case 'm': + return isFuture ? 'minuutin' : 'minuutti'; + case 'mm': + result = isFuture ? 'minuutin' : 'minuuttia'; + break; + case 'h': + return isFuture ? 'tunnin' : 'tunti'; + case 'hh': + result = isFuture ? 'tunnin' : 'tuntia'; + break; + case 'd': + return isFuture ? 'päivän' : 'päivä'; + case 'dd': + result = isFuture ? 'päivän' : 'päivää'; + break; + case 'M': + return isFuture ? 'kuukauden' : 'kuukausi'; + case 'MM': + result = isFuture ? 'kuukauden' : 'kuukautta'; + break; + case 'y': + return isFuture ? 'vuoden' : 'vuosi'; + case 'yy': + result = isFuture ? 'vuoden' : 'vuotta'; + break; + } + result = verbalNumber(number, isFuture) + ' ' + result; + return result; + } + function verbalNumber(number, isFuture) { + return number < 10 + ? isFuture + ? numbersFuture[number] + : numbersPast[number] + : number; + } + + hooks.defineLocale('fi', { + months: 'tammikuu_helmikuu_maaliskuu_huhtikuu_toukokuu_kesäkuu_heinäkuu_elokuu_syyskuu_lokakuu_marraskuu_joulukuu'.split( + '_' + ), + monthsShort: 'tammi_helmi_maalis_huhti_touko_kesä_heinä_elo_syys_loka_marras_joulu'.split( + '_' + ), + weekdays: 'sunnuntai_maanantai_tiistai_keskiviikko_torstai_perjantai_lauantai'.split( + '_' + ), + weekdaysShort: 'su_ma_ti_ke_to_pe_la'.split('_'), + weekdaysMin: 'su_ma_ti_ke_to_pe_la'.split('_'), + longDateFormat: { + LT: 'HH.mm', + LTS: 'HH.mm.ss', + L: 'DD.MM.YYYY', + LL: 'Do MMMM[ta] YYYY', + LLL: 'Do MMMM[ta] YYYY, [klo] HH.mm', + LLLL: 'dddd, Do MMMM[ta] YYYY, [klo] HH.mm', + l: 'D.M.YYYY', + ll: 'Do MMM YYYY', + lll: 'Do MMM YYYY, [klo] HH.mm', + llll: 'ddd, Do MMM YYYY, [klo] HH.mm', + }, + calendar: { + sameDay: '[tänään] [klo] LT', + nextDay: '[huomenna] [klo] LT', + nextWeek: 'dddd [klo] LT', + lastDay: '[eilen] [klo] LT', + lastWeek: '[viime] dddd[na] [klo] LT', + sameElse: 'L', + }, + relativeTime: { + future: '%s päästä', + past: '%s sitten', + s: translate$2, + ss: translate$2, + m: translate$2, + mm: translate$2, + h: translate$2, + hh: translate$2, + d: translate$2, + dd: translate$2, + M: translate$2, + MM: translate$2, + y: translate$2, + yy: translate$2, + }, + dayOfMonthOrdinalParse: /\d{1,2}\./, + ordinal: '%d.', + week: { + dow: 1, // Monday is the first day of the week. + doy: 4, // The week that contains Jan 4th is the first week of the year. + }, + }); + + //! moment.js locale configuration + + hooks.defineLocale('fil', { + months: 'Enero_Pebrero_Marso_Abril_Mayo_Hunyo_Hulyo_Agosto_Setyembre_Oktubre_Nobyembre_Disyembre'.split( + '_' + ), + monthsShort: 'Ene_Peb_Mar_Abr_May_Hun_Hul_Ago_Set_Okt_Nob_Dis'.split('_'), + weekdays: 'Linggo_Lunes_Martes_Miyerkules_Huwebes_Biyernes_Sabado'.split( + '_' + ), + weekdaysShort: 'Lin_Lun_Mar_Miy_Huw_Biy_Sab'.split('_'), + weekdaysMin: 'Li_Lu_Ma_Mi_Hu_Bi_Sab'.split('_'), + longDateFormat: { + LT: 'HH:mm', + LTS: 'HH:mm:ss', + L: 'MM/D/YYYY', + LL: 'MMMM D, YYYY', + LLL: 'MMMM D, YYYY HH:mm', + LLLL: 'dddd, MMMM DD, YYYY HH:mm', + }, + calendar: { + sameDay: 'LT [ngayong araw]', + nextDay: '[Bukas ng] LT', + nextWeek: 'LT [sa susunod na] dddd', + lastDay: 'LT [kahapon]', + lastWeek: 'LT [noong nakaraang] dddd', + sameElse: 'L', + }, + relativeTime: { + future: 'sa loob ng %s', + past: '%s ang nakalipas', + s: 'ilang segundo', + ss: '%d segundo', + m: 'isang minuto', + mm: '%d minuto', + h: 'isang oras', + hh: '%d oras', + d: 'isang araw', + dd: '%d araw', + M: 'isang buwan', + MM: '%d buwan', + y: 'isang taon', + yy: '%d taon', + }, + dayOfMonthOrdinalParse: /\d{1,2}/, + ordinal: function (number) { + return number; + }, + week: { + dow: 1, // Monday is the first day of the week. + doy: 4, // The week that contains Jan 4th is the first week of the year. + }, + }); + + //! moment.js locale configuration + + hooks.defineLocale('fo', { + months: 'januar_februar_mars_apríl_mai_juni_juli_august_september_oktober_november_desember'.split( + '_' + ), + monthsShort: 'jan_feb_mar_apr_mai_jun_jul_aug_sep_okt_nov_des'.split('_'), + weekdays: 'sunnudagur_mánadagur_týsdagur_mikudagur_hósdagur_fríggjadagur_leygardagur'.split( + '_' + ), + weekdaysShort: 'sun_mán_týs_mik_hós_frí_ley'.split('_'), + weekdaysMin: 'su_má_tý_mi_hó_fr_le'.split('_'), + longDateFormat: { + LT: 'HH:mm', + LTS: 'HH:mm:ss', + L: 'DD/MM/YYYY', + LL: 'D MMMM YYYY', + LLL: 'D MMMM YYYY HH:mm', + LLLL: 'dddd D. MMMM, YYYY HH:mm', + }, + calendar: { + sameDay: '[Í dag kl.] LT', + nextDay: '[Í morgin kl.] LT', + nextWeek: 'dddd [kl.] LT', + lastDay: '[Í gjár kl.] LT', + lastWeek: '[síðstu] dddd [kl] LT', + sameElse: 'L', + }, + relativeTime: { + future: 'um %s', + past: '%s síðani', + s: 'fá sekund', + ss: '%d sekundir', + m: 'ein minuttur', + mm: '%d minuttir', + h: 'ein tími', + hh: '%d tímar', + d: 'ein dagur', + dd: '%d dagar', + M: 'ein mánaður', + MM: '%d mánaðir', + y: 'eitt ár', + yy: '%d ár', + }, + dayOfMonthOrdinalParse: /\d{1,2}\./, + ordinal: '%d.', + week: { + dow: 1, // Monday is the first day of the week. + doy: 4, // The week that contains Jan 4th is the first week of the year. + }, + }); + + //! moment.js locale configuration + + hooks.defineLocale('fr-ca', { + months: 'janvier_février_mars_avril_mai_juin_juillet_août_septembre_octobre_novembre_décembre'.split( + '_' + ), + monthsShort: 'janv._févr._mars_avr._mai_juin_juil._août_sept._oct._nov._déc.'.split( + '_' + ), + monthsParseExact: true, + weekdays: 'dimanche_lundi_mardi_mercredi_jeudi_vendredi_samedi'.split('_'), + weekdaysShort: 'dim._lun._mar._mer._jeu._ven._sam.'.split('_'), + weekdaysMin: 'di_lu_ma_me_je_ve_sa'.split('_'), + weekdaysParseExact: true, + longDateFormat: { + LT: 'HH:mm', + LTS: 'HH:mm:ss', + L: 'YYYY-MM-DD', + LL: 'D MMMM YYYY', + LLL: 'D MMMM YYYY HH:mm', + LLLL: 'dddd D MMMM YYYY HH:mm', + }, + calendar: { + sameDay: '[Aujourd’hui à] LT', + nextDay: '[Demain à] LT', + nextWeek: 'dddd [à] LT', + lastDay: '[Hier à] LT', + lastWeek: 'dddd [dernier à] LT', + sameElse: 'L', + }, + relativeTime: { + future: 'dans %s', + past: 'il y a %s', + s: 'quelques secondes', + ss: '%d secondes', + m: 'une minute', + mm: '%d minutes', + h: 'une heure', + hh: '%d heures', + d: 'un jour', + dd: '%d jours', + M: 'un mois', + MM: '%d mois', + y: 'un an', + yy: '%d ans', + }, + dayOfMonthOrdinalParse: /\d{1,2}(er|e)/, + ordinal: function (number, period) { + switch (period) { + // Words with masculine grammatical gender: mois, trimestre, jour + default: + case 'M': + case 'Q': + case 'D': + case 'DDD': + case 'd': + return number + (number === 1 ? 'er' : 'e'); + + // Words with feminine grammatical gender: semaine + case 'w': + case 'W': + return number + (number === 1 ? 're' : 'e'); + } + }, + }); + + //! moment.js locale configuration + + hooks.defineLocale('fr-ch', { + months: 'janvier_février_mars_avril_mai_juin_juillet_août_septembre_octobre_novembre_décembre'.split( + '_' + ), + monthsShort: 'janv._févr._mars_avr._mai_juin_juil._août_sept._oct._nov._déc.'.split( + '_' + ), + monthsParseExact: true, + weekdays: 'dimanche_lundi_mardi_mercredi_jeudi_vendredi_samedi'.split('_'), + weekdaysShort: 'dim._lun._mar._mer._jeu._ven._sam.'.split('_'), + weekdaysMin: 'di_lu_ma_me_je_ve_sa'.split('_'), + weekdaysParseExact: true, + longDateFormat: { + LT: 'HH:mm', + LTS: 'HH:mm:ss', + L: 'DD.MM.YYYY', + LL: 'D MMMM YYYY', + LLL: 'D MMMM YYYY HH:mm', + LLLL: 'dddd D MMMM YYYY HH:mm', + }, + calendar: { + sameDay: '[Aujourd’hui à] LT', + nextDay: '[Demain à] LT', + nextWeek: 'dddd [à] LT', + lastDay: '[Hier à] LT', + lastWeek: 'dddd [dernier à] LT', + sameElse: 'L', + }, + relativeTime: { + future: 'dans %s', + past: 'il y a %s', + s: 'quelques secondes', + ss: '%d secondes', + m: 'une minute', + mm: '%d minutes', + h: 'une heure', + hh: '%d heures', + d: 'un jour', + dd: '%d jours', + M: 'un mois', + MM: '%d mois', + y: 'un an', + yy: '%d ans', + }, + dayOfMonthOrdinalParse: /\d{1,2}(er|e)/, + ordinal: function (number, period) { + switch (period) { + // Words with masculine grammatical gender: mois, trimestre, jour + default: + case 'M': + case 'Q': + case 'D': + case 'DDD': + case 'd': + return number + (number === 1 ? 'er' : 'e'); + + // Words with feminine grammatical gender: semaine + case 'w': + case 'W': + return number + (number === 1 ? 're' : 'e'); + } + }, + week: { + dow: 1, // Monday is the first day of the week. + doy: 4, // The week that contains Jan 4th is the first week of the year. + }, + }); + + //! moment.js locale configuration + + var monthsStrictRegex$1 = /^(janvier|février|mars|avril|mai|juin|juillet|août|septembre|octobre|novembre|décembre)/i, + monthsShortStrictRegex$1 = /(janv\.?|févr\.?|mars|avr\.?|mai|juin|juil\.?|août|sept\.?|oct\.?|nov\.?|déc\.?)/i, + monthsRegex$6 = /(janv\.?|févr\.?|mars|avr\.?|mai|juin|juil\.?|août|sept\.?|oct\.?|nov\.?|déc\.?|janvier|février|mars|avril|mai|juin|juillet|août|septembre|octobre|novembre|décembre)/i, + monthsParse$5 = [ + /^janv/i, + /^févr/i, + /^mars/i, + /^avr/i, + /^mai/i, + /^juin/i, + /^juil/i, + /^août/i, + /^sept/i, + /^oct/i, + /^nov/i, + /^déc/i, + ]; + + hooks.defineLocale('fr', { + months: 'janvier_février_mars_avril_mai_juin_juillet_août_septembre_octobre_novembre_décembre'.split( + '_' + ), + monthsShort: 'janv._févr._mars_avr._mai_juin_juil._août_sept._oct._nov._déc.'.split( + '_' + ), + monthsRegex: monthsRegex$6, + monthsShortRegex: monthsRegex$6, + monthsStrictRegex: monthsStrictRegex$1, + monthsShortStrictRegex: monthsShortStrictRegex$1, + monthsParse: monthsParse$5, + longMonthsParse: monthsParse$5, + shortMonthsParse: monthsParse$5, + weekdays: 'dimanche_lundi_mardi_mercredi_jeudi_vendredi_samedi'.split('_'), + weekdaysShort: 'dim._lun._mar._mer._jeu._ven._sam.'.split('_'), + weekdaysMin: 'di_lu_ma_me_je_ve_sa'.split('_'), + weekdaysParseExact: true, + longDateFormat: { + LT: 'HH:mm', + LTS: 'HH:mm:ss', + L: 'DD/MM/YYYY', + LL: 'D MMMM YYYY', + LLL: 'D MMMM YYYY HH:mm', + LLLL: 'dddd D MMMM YYYY HH:mm', + }, + calendar: { + sameDay: '[Aujourd’hui à] LT', + nextDay: '[Demain à] LT', + nextWeek: 'dddd [à] LT', + lastDay: '[Hier à] LT', + lastWeek: 'dddd [dernier à] LT', + sameElse: 'L', + }, + relativeTime: { + future: 'dans %s', + past: 'il y a %s', + s: 'quelques secondes', + ss: '%d secondes', + m: 'une minute', + mm: '%d minutes', + h: 'une heure', + hh: '%d heures', + d: 'un jour', + dd: '%d jours', + M: 'un mois', + MM: '%d mois', + y: 'un an', + yy: '%d ans', + }, + dayOfMonthOrdinalParse: /\d{1,2}(er|)/, + ordinal: function (number, period) { + switch (period) { + // TODO: Return 'e' when day of month > 1. Move this case inside + // block for masculine words below. + // See https://github.com/moment/moment/issues/3375 + case 'D': + return number + (number === 1 ? 'er' : ''); + + // Words with masculine grammatical gender: mois, trimestre, jour + default: + case 'M': + case 'Q': + case 'DDD': + case 'd': + return number + (number === 1 ? 'er' : 'e'); + + // Words with feminine grammatical gender: semaine + case 'w': + case 'W': + return number + (number === 1 ? 're' : 'e'); + } + }, + week: { + dow: 1, // Monday is the first day of the week. + doy: 4, // The week that contains Jan 4th is the first week of the year. + }, + }); + + //! moment.js locale configuration + + var monthsShortWithDots = 'jan._feb._mrt._apr._mai_jun._jul._aug._sep._okt._nov._des.'.split( + '_' + ), + monthsShortWithoutDots = 'jan_feb_mrt_apr_mai_jun_jul_aug_sep_okt_nov_des'.split( + '_' + ); + + hooks.defineLocale('fy', { + months: 'jannewaris_febrewaris_maart_april_maaie_juny_july_augustus_septimber_oktober_novimber_desimber'.split( + '_' + ), + monthsShort: function (m, format) { + if (!m) { + return monthsShortWithDots; + } else if (/-MMM-/.test(format)) { + return monthsShortWithoutDots[m.month()]; + } else { + return monthsShortWithDots[m.month()]; + } + }, + monthsParseExact: true, + weekdays: 'snein_moandei_tiisdei_woansdei_tongersdei_freed_sneon'.split( + '_' + ), + weekdaysShort: 'si._mo._ti._wo._to._fr._so.'.split('_'), + weekdaysMin: 'Si_Mo_Ti_Wo_To_Fr_So'.split('_'), + weekdaysParseExact: true, + longDateFormat: { + LT: 'HH:mm', + LTS: 'HH:mm:ss', + L: 'DD-MM-YYYY', + LL: 'D MMMM YYYY', + LLL: 'D MMMM YYYY HH:mm', + LLLL: 'dddd D MMMM YYYY HH:mm', + }, + calendar: { + sameDay: '[hjoed om] LT', + nextDay: '[moarn om] LT', + nextWeek: 'dddd [om] LT', + lastDay: '[juster om] LT', + lastWeek: '[ôfrûne] dddd [om] LT', + sameElse: 'L', + }, + relativeTime: { + future: 'oer %s', + past: '%s lyn', + s: 'in pear sekonden', + ss: '%d sekonden', + m: 'ien minút', + mm: '%d minuten', + h: 'ien oere', + hh: '%d oeren', + d: 'ien dei', + dd: '%d dagen', + M: 'ien moanne', + MM: '%d moannen', + y: 'ien jier', + yy: '%d jierren', + }, + dayOfMonthOrdinalParse: /\d{1,2}(ste|de)/, + ordinal: function (number) { + return ( + number + + (number === 1 || number === 8 || number >= 20 ? 'ste' : 'de') + ); + }, + week: { + dow: 1, // Monday is the first day of the week. + doy: 4, // The week that contains Jan 4th is the first week of the year. + }, + }); + + //! moment.js locale configuration + + var months$6 = [ + 'Eanáir', + 'Feabhra', + 'Márta', + 'Aibreán', + 'Bealtaine', + 'Meitheamh', + 'Iúil', + 'Lúnasa', + 'Meán Fómhair', + 'Deireadh Fómhair', + 'Samhain', + 'Nollaig', + ], + monthsShort$4 = [ + 'Ean', + 'Feabh', + 'Márt', + 'Aib', + 'Beal', + 'Meith', + 'Iúil', + 'Lún', + 'M.F.', + 'D.F.', + 'Samh', + 'Noll', + ], + weekdays$1 = [ + 'Dé Domhnaigh', + 'Dé Luain', + 'Dé Máirt', + 'Dé Céadaoin', + 'Déardaoin', + 'Dé hAoine', + 'Dé Sathairn', + ], + weekdaysShort = ['Domh', 'Luan', 'Máirt', 'Céad', 'Déar', 'Aoine', 'Sath'], + weekdaysMin = ['Do', 'Lu', 'Má', 'Cé', 'Dé', 'A', 'Sa']; + + hooks.defineLocale('ga', { + months: months$6, + monthsShort: monthsShort$4, + monthsParseExact: true, + weekdays: weekdays$1, + weekdaysShort: weekdaysShort, + weekdaysMin: weekdaysMin, + longDateFormat: { + LT: 'HH:mm', + LTS: 'HH:mm:ss', + L: 'DD/MM/YYYY', + LL: 'D MMMM YYYY', + LLL: 'D MMMM YYYY HH:mm', + LLLL: 'dddd, D MMMM YYYY HH:mm', + }, + calendar: { + sameDay: '[Inniu ag] LT', + nextDay: '[Amárach ag] LT', + nextWeek: 'dddd [ag] LT', + lastDay: '[Inné ag] LT', + lastWeek: 'dddd [seo caite] [ag] LT', + sameElse: 'L', + }, + relativeTime: { + future: 'i %s', + past: '%s ó shin', + s: 'cúpla soicind', + ss: '%d soicind', + m: 'nóiméad', + mm: '%d nóiméad', + h: 'uair an chloig', + hh: '%d uair an chloig', + d: 'lá', + dd: '%d lá', + M: 'mí', + MM: '%d míonna', + y: 'bliain', + yy: '%d bliain', + }, + dayOfMonthOrdinalParse: /\d{1,2}(d|na|mh)/, + ordinal: function (number) { + var output = number === 1 ? 'd' : number % 10 === 2 ? 'na' : 'mh'; + return number + output; + }, + week: { + dow: 1, // Monday is the first day of the week. + doy: 4, // The week that contains Jan 4th is the first week of the year. + }, + }); + + //! moment.js locale configuration + + var months$7 = [ + 'Am Faoilleach', + 'An Gearran', + 'Am Màrt', + 'An Giblean', + 'An Cèitean', + 'An t-Ògmhios', + 'An t-Iuchar', + 'An Lùnastal', + 'An t-Sultain', + 'An Dàmhair', + 'An t-Samhain', + 'An Dùbhlachd', + ], + monthsShort$5 = [ + 'Faoi', + 'Gear', + 'Màrt', + 'Gibl', + 'Cèit', + 'Ògmh', + 'Iuch', + 'Lùn', + 'Sult', + 'Dàmh', + 'Samh', + 'Dùbh', + ], + weekdays$2 = [ + 'Didòmhnaich', + 'Diluain', + 'Dimàirt', + 'Diciadain', + 'Diardaoin', + 'Dihaoine', + 'Disathairne', + ], + weekdaysShort$1 = ['Did', 'Dil', 'Dim', 'Dic', 'Dia', 'Dih', 'Dis'], + weekdaysMin$1 = ['Dò', 'Lu', 'Mà', 'Ci', 'Ar', 'Ha', 'Sa']; + + hooks.defineLocale('gd', { + months: months$7, + monthsShort: monthsShort$5, + monthsParseExact: true, + weekdays: weekdays$2, + weekdaysShort: weekdaysShort$1, + weekdaysMin: weekdaysMin$1, + longDateFormat: { + LT: 'HH:mm', + LTS: 'HH:mm:ss', + L: 'DD/MM/YYYY', + LL: 'D MMMM YYYY', + LLL: 'D MMMM YYYY HH:mm', + LLLL: 'dddd, D MMMM YYYY HH:mm', + }, + calendar: { + sameDay: '[An-diugh aig] LT', + nextDay: '[A-màireach aig] LT', + nextWeek: 'dddd [aig] LT', + lastDay: '[An-dè aig] LT', + lastWeek: 'dddd [seo chaidh] [aig] LT', + sameElse: 'L', + }, + relativeTime: { + future: 'ann an %s', + past: 'bho chionn %s', + s: 'beagan diogan', + ss: '%d diogan', + m: 'mionaid', + mm: '%d mionaidean', + h: 'uair', + hh: '%d uairean', + d: 'latha', + dd: '%d latha', + M: 'mìos', + MM: '%d mìosan', + y: 'bliadhna', + yy: '%d bliadhna', + }, + dayOfMonthOrdinalParse: /\d{1,2}(d|na|mh)/, + ordinal: function (number) { + var output = number === 1 ? 'd' : number % 10 === 2 ? 'na' : 'mh'; + return number + output; + }, + week: { + dow: 1, // Monday is the first day of the week. + doy: 4, // The week that contains Jan 4th is the first week of the year. + }, + }); + + //! moment.js locale configuration + + hooks.defineLocale('gl', { + months: 'xaneiro_febreiro_marzo_abril_maio_xuño_xullo_agosto_setembro_outubro_novembro_decembro'.split( + '_' + ), + monthsShort: 'xan._feb._mar._abr._mai._xuñ._xul._ago._set._out._nov._dec.'.split( + '_' + ), + monthsParseExact: true, + weekdays: 'domingo_luns_martes_mércores_xoves_venres_sábado'.split('_'), + weekdaysShort: 'dom._lun._mar._mér._xov._ven._sáb.'.split('_'), + weekdaysMin: 'do_lu_ma_mé_xo_ve_sá'.split('_'), + weekdaysParseExact: true, + longDateFormat: { + LT: 'H:mm', + LTS: 'H:mm:ss', + L: 'DD/MM/YYYY', + LL: 'D [de] MMMM [de] YYYY', + LLL: 'D [de] MMMM [de] YYYY H:mm', + LLLL: 'dddd, D [de] MMMM [de] YYYY H:mm', + }, + calendar: { + sameDay: function () { + return '[hoxe ' + (this.hours() !== 1 ? 'ás' : 'á') + '] LT'; + }, + nextDay: function () { + return '[mañá ' + (this.hours() !== 1 ? 'ás' : 'á') + '] LT'; + }, + nextWeek: function () { + return 'dddd [' + (this.hours() !== 1 ? 'ás' : 'a') + '] LT'; + }, + lastDay: function () { + return '[onte ' + (this.hours() !== 1 ? 'á' : 'a') + '] LT'; + }, + lastWeek: function () { + return ( + '[o] dddd [pasado ' + (this.hours() !== 1 ? 'ás' : 'a') + '] LT' + ); + }, + sameElse: 'L', + }, + relativeTime: { + future: function (str) { + if (str.indexOf('un') === 0) { + return 'n' + str; + } + return 'en ' + str; + }, + past: 'hai %s', + s: 'uns segundos', + ss: '%d segundos', + m: 'un minuto', + mm: '%d minutos', + h: 'unha hora', + hh: '%d horas', + d: 'un día', + dd: '%d días', + M: 'un mes', + MM: '%d meses', + y: 'un ano', + yy: '%d anos', + }, + dayOfMonthOrdinalParse: /\d{1,2}º/, + ordinal: '%dº', + week: { + dow: 1, // Monday is the first day of the week. + doy: 4, // The week that contains Jan 4th is the first week of the year. + }, + }); + + //! moment.js locale configuration + + function processRelativeTime$4(number, withoutSuffix, key, isFuture) { + var format = { + s: ['थोडया सॅकंडांनी', 'थोडे सॅकंड'], + ss: [number + ' सॅकंडांनी', number + ' सॅकंड'], + m: ['एका मिणटान', 'एक मिनूट'], + mm: [number + ' मिणटांनी', number + ' मिणटां'], + h: ['एका वरान', 'एक वर'], + hh: [number + ' वरांनी', number + ' वरां'], + d: ['एका दिसान', 'एक दीस'], + dd: [number + ' दिसांनी', number + ' दीस'], + M: ['एका म्हयन्यान', 'एक म्हयनो'], + MM: [number + ' म्हयन्यानी', number + ' म्हयने'], + y: ['एका वर्सान', 'एक वर्स'], + yy: [number + ' वर्सांनी', number + ' वर्सां'], + }; + return isFuture ? format[key][0] : format[key][1]; + } + + hooks.defineLocale('gom-deva', { + months: { + standalone: 'जानेवारी_फेब्रुवारी_मार्च_एप्रील_मे_जून_जुलय_ऑगस्ट_सप्टेंबर_ऑक्टोबर_नोव्हेंबर_डिसेंबर'.split( + '_' + ), + format: 'जानेवारीच्या_फेब्रुवारीच्या_मार्चाच्या_एप्रीलाच्या_मेयाच्या_जूनाच्या_जुलयाच्या_ऑगस्टाच्या_सप्टेंबराच्या_ऑक्टोबराच्या_नोव्हेंबराच्या_डिसेंबराच्या'.split( + '_' + ), + isFormat: /MMMM(\s)+D[oD]?/, + }, + monthsShort: 'जाने._फेब्रु._मार्च_एप्री._मे_जून_जुल._ऑग._सप्टें._ऑक्टो._नोव्हें._डिसें.'.split( + '_' + ), + monthsParseExact: true, + weekdays: 'आयतार_सोमार_मंगळार_बुधवार_बिरेस्तार_सुक्रार_शेनवार'.split('_'), + weekdaysShort: 'आयत._सोम._मंगळ._बुध._ब्रेस्त._सुक्र._शेन.'.split('_'), + weekdaysMin: 'आ_सो_मं_बु_ब्रे_सु_शे'.split('_'), + weekdaysParseExact: true, + longDateFormat: { + LT: 'A h:mm [वाजतां]', + LTS: 'A h:mm:ss [वाजतां]', + L: 'DD-MM-YYYY', + LL: 'D MMMM YYYY', + LLL: 'D MMMM YYYY A h:mm [वाजतां]', + LLLL: 'dddd, MMMM Do, YYYY, A h:mm [वाजतां]', + llll: 'ddd, D MMM YYYY, A h:mm [वाजतां]', + }, + calendar: { + sameDay: '[आयज] LT', + nextDay: '[फाल्यां] LT', + nextWeek: '[फुडलो] dddd[,] LT', + lastDay: '[काल] LT', + lastWeek: '[फाटलो] dddd[,] LT', + sameElse: 'L', + }, + relativeTime: { + future: '%s', + past: '%s आदीं', + s: processRelativeTime$4, + ss: processRelativeTime$4, + m: processRelativeTime$4, + mm: processRelativeTime$4, + h: processRelativeTime$4, + hh: processRelativeTime$4, + d: processRelativeTime$4, + dd: processRelativeTime$4, + M: processRelativeTime$4, + MM: processRelativeTime$4, + y: processRelativeTime$4, + yy: processRelativeTime$4, + }, + dayOfMonthOrdinalParse: /\d{1,2}(वेर)/, + ordinal: function (number, period) { + switch (period) { + // the ordinal 'वेर' only applies to day of the month + case 'D': + return number + 'वेर'; + default: + case 'M': + case 'Q': + case 'DDD': + case 'd': + case 'w': + case 'W': + return number; + } + }, + week: { + dow: 0, // Sunday is the first day of the week + doy: 3, // The week that contains Jan 4th is the first week of the year (7 + 0 - 4) + }, + meridiemParse: /राती|सकाळीं|दनपारां|सांजे/, + meridiemHour: function (hour, meridiem) { + if (hour === 12) { + hour = 0; + } + if (meridiem === 'राती') { + return hour < 4 ? hour : hour + 12; + } else if (meridiem === 'सकाळीं') { + return hour; + } else if (meridiem === 'दनपारां') { + return hour > 12 ? hour : hour + 12; + } else if (meridiem === 'सांजे') { + return hour + 12; + } + }, + meridiem: function (hour, minute, isLower) { + if (hour < 4) { + return 'राती'; + } else if (hour < 12) { + return 'सकाळीं'; + } else if (hour < 16) { + return 'दनपारां'; + } else if (hour < 20) { + return 'सांजे'; + } else { + return 'राती'; + } + }, + }); + + //! moment.js locale configuration + + function processRelativeTime$5(number, withoutSuffix, key, isFuture) { + var format = { + s: ['thoddea sekondamni', 'thodde sekond'], + ss: [number + ' sekondamni', number + ' sekond'], + m: ['eka mintan', 'ek minut'], + mm: [number + ' mintamni', number + ' mintam'], + h: ['eka voran', 'ek vor'], + hh: [number + ' voramni', number + ' voram'], + d: ['eka disan', 'ek dis'], + dd: [number + ' disamni', number + ' dis'], + M: ['eka mhoinean', 'ek mhoino'], + MM: [number + ' mhoineamni', number + ' mhoine'], + y: ['eka vorsan', 'ek voros'], + yy: [number + ' vorsamni', number + ' vorsam'], + }; + return isFuture ? format[key][0] : format[key][1]; + } + + hooks.defineLocale('gom-latn', { + months: { + standalone: 'Janer_Febrer_Mars_Abril_Mai_Jun_Julai_Agost_Setembr_Otubr_Novembr_Dezembr'.split( + '_' + ), + format: 'Janerachea_Febrerachea_Marsachea_Abrilachea_Maiachea_Junachea_Julaiachea_Agostachea_Setembrachea_Otubrachea_Novembrachea_Dezembrachea'.split( + '_' + ), + isFormat: /MMMM(\s)+D[oD]?/, + }, + monthsShort: 'Jan._Feb._Mars_Abr._Mai_Jun_Jul._Ago._Set._Otu._Nov._Dez.'.split( + '_' + ), + monthsParseExact: true, + weekdays: "Aitar_Somar_Mongllar_Budhvar_Birestar_Sukrar_Son'var".split('_'), + weekdaysShort: 'Ait._Som._Mon._Bud._Bre._Suk._Son.'.split('_'), + weekdaysMin: 'Ai_Sm_Mo_Bu_Br_Su_Sn'.split('_'), + weekdaysParseExact: true, + longDateFormat: { + LT: 'A h:mm [vazta]', + LTS: 'A h:mm:ss [vazta]', + L: 'DD-MM-YYYY', + LL: 'D MMMM YYYY', + LLL: 'D MMMM YYYY A h:mm [vazta]', + LLLL: 'dddd, MMMM Do, YYYY, A h:mm [vazta]', + llll: 'ddd, D MMM YYYY, A h:mm [vazta]', + }, + calendar: { + sameDay: '[Aiz] LT', + nextDay: '[Faleam] LT', + nextWeek: '[Fuddlo] dddd[,] LT', + lastDay: '[Kal] LT', + lastWeek: '[Fattlo] dddd[,] LT', + sameElse: 'L', + }, + relativeTime: { + future: '%s', + past: '%s adim', + s: processRelativeTime$5, + ss: processRelativeTime$5, + m: processRelativeTime$5, + mm: processRelativeTime$5, + h: processRelativeTime$5, + hh: processRelativeTime$5, + d: processRelativeTime$5, + dd: processRelativeTime$5, + M: processRelativeTime$5, + MM: processRelativeTime$5, + y: processRelativeTime$5, + yy: processRelativeTime$5, + }, + dayOfMonthOrdinalParse: /\d{1,2}(er)/, + ordinal: function (number, period) { + switch (period) { + // the ordinal 'er' only applies to day of the month + case 'D': + return number + 'er'; + default: + case 'M': + case 'Q': + case 'DDD': + case 'd': + case 'w': + case 'W': + return number; + } + }, + week: { + dow: 0, // Sunday is the first day of the week + doy: 3, // The week that contains Jan 4th is the first week of the year (7 + 0 - 4) + }, + meridiemParse: /rati|sokallim|donparam|sanje/, + meridiemHour: function (hour, meridiem) { + if (hour === 12) { + hour = 0; + } + if (meridiem === 'rati') { + return hour < 4 ? hour : hour + 12; + } else if (meridiem === 'sokallim') { + return hour; + } else if (meridiem === 'donparam') { + return hour > 12 ? hour : hour + 12; + } else if (meridiem === 'sanje') { + return hour + 12; + } + }, + meridiem: function (hour, minute, isLower) { + if (hour < 4) { + return 'rati'; + } else if (hour < 12) { + return 'sokallim'; + } else if (hour < 16) { + return 'donparam'; + } else if (hour < 20) { + return 'sanje'; + } else { + return 'rati'; + } + }, + }); + + //! moment.js locale configuration + + var symbolMap$6 = { + '1': '૧', + '2': '૨', + '3': '૩', + '4': '૪', + '5': '૫', + '6': '૬', + '7': '૭', + '8': '૮', + '9': '૯', + '0': '૦', + }, + numberMap$5 = { + '૧': '1', + '૨': '2', + '૩': '3', + '૪': '4', + '૫': '5', + '૬': '6', + '૭': '7', + '૮': '8', + '૯': '9', + '૦': '0', + }; + + hooks.defineLocale('gu', { + months: 'જાન્યુઆરી_ફેબ્રુઆરી_માર્ચ_એપ્રિલ_મે_જૂન_જુલાઈ_ઑગસ્ટ_સપ્ટેમ્બર_ઑક્ટ્બર_નવેમ્બર_ડિસેમ્બર'.split( + '_' + ), + monthsShort: 'જાન્યુ._ફેબ્રુ._માર્ચ_એપ્રિ._મે_જૂન_જુલા._ઑગ._સપ્ટે._ઑક્ટ્._નવે._ડિસે.'.split( + '_' + ), + monthsParseExact: true, + weekdays: 'રવિવાર_સોમવાર_મંગળવાર_બુધ્વાર_ગુરુવાર_શુક્રવાર_શનિવાર'.split( + '_' + ), + weekdaysShort: 'રવિ_સોમ_મંગળ_બુધ્_ગુરુ_શુક્ર_શનિ'.split('_'), + weekdaysMin: 'ર_સો_મં_બુ_ગુ_શુ_શ'.split('_'), + longDateFormat: { + LT: 'A h:mm વાગ્યે', + LTS: 'A h:mm:ss વાગ્યે', + L: 'DD/MM/YYYY', + LL: 'D MMMM YYYY', + LLL: 'D MMMM YYYY, A h:mm વાગ્યે', + LLLL: 'dddd, D MMMM YYYY, A h:mm વાગ્યે', + }, + calendar: { + sameDay: '[આજ] LT', + nextDay: '[કાલે] LT', + nextWeek: 'dddd, LT', + lastDay: '[ગઇકાલે] LT', + lastWeek: '[પાછલા] dddd, LT', + sameElse: 'L', + }, + relativeTime: { + future: '%s મા', + past: '%s પહેલા', + s: 'અમુક પળો', + ss: '%d સેકંડ', + m: 'એક મિનિટ', + mm: '%d મિનિટ', + h: 'એક કલાક', + hh: '%d કલાક', + d: 'એક દિવસ', + dd: '%d દિવસ', + M: 'એક મહિનો', + MM: '%d મહિનો', + y: 'એક વર્ષ', + yy: '%d વર્ષ', + }, + preparse: function (string) { + return string.replace(/[૧૨૩૪૫૬૭૮૯૦]/g, function (match) { + return numberMap$5[match]; + }); + }, + postformat: function (string) { + return string.replace(/\d/g, function (match) { + return symbolMap$6[match]; + }); + }, + // Gujarati notation for meridiems are quite fuzzy in practice. While there exists + // a rigid notion of a 'Pahar' it is not used as rigidly in modern Gujarati. + meridiemParse: /રાત|બપોર|સવાર|સાંજ/, + meridiemHour: function (hour, meridiem) { + if (hour === 12) { + hour = 0; + } + if (meridiem === 'રાત') { + return hour < 4 ? hour : hour + 12; + } else if (meridiem === 'સવાર') { + return hour; + } else if (meridiem === 'બપોર') { + return hour >= 10 ? hour : hour + 12; + } else if (meridiem === 'સાંજ') { + return hour + 12; + } + }, + meridiem: function (hour, minute, isLower) { + if (hour < 4) { + return 'રાત'; + } else if (hour < 10) { + return 'સવાર'; + } else if (hour < 17) { + return 'બપોર'; + } else if (hour < 20) { + return 'સાંજ'; + } else { + return 'રાત'; + } + }, + week: { + dow: 0, // Sunday is the first day of the week. + doy: 6, // The week that contains Jan 6th is the first week of the year. + }, + }); + + //! moment.js locale configuration + + hooks.defineLocale('he', { + months: 'ינואר_פברואר_מרץ_אפריל_מאי_יוני_יולי_אוגוסט_ספטמבר_אוקטובר_נובמבר_דצמבר'.split( + '_' + ), + monthsShort: 'ינו׳_פבר׳_מרץ_אפר׳_מאי_יוני_יולי_אוג׳_ספט׳_אוק׳_נוב׳_דצמ׳'.split( + '_' + ), + weekdays: 'ראשון_שני_שלישי_רביעי_חמישי_שישי_שבת'.split('_'), + weekdaysShort: 'א׳_ב׳_ג׳_ד׳_ה׳_ו׳_ש׳'.split('_'), + weekdaysMin: 'א_ב_ג_ד_ה_ו_ש'.split('_'), + longDateFormat: { + LT: 'HH:mm', + LTS: 'HH:mm:ss', + L: 'DD/MM/YYYY', + LL: 'D [ב]MMMM YYYY', + LLL: 'D [ב]MMMM YYYY HH:mm', + LLLL: 'dddd, D [ב]MMMM YYYY HH:mm', + l: 'D/M/YYYY', + ll: 'D MMM YYYY', + lll: 'D MMM YYYY HH:mm', + llll: 'ddd, D MMM YYYY HH:mm', + }, + calendar: { + sameDay: '[היום ב־]LT', + nextDay: '[מחר ב־]LT', + nextWeek: 'dddd [בשעה] LT', + lastDay: '[אתמול ב־]LT', + lastWeek: '[ביום] dddd [האחרון בשעה] LT', + sameElse: 'L', + }, + relativeTime: { + future: 'בעוד %s', + past: 'לפני %s', + s: 'מספר שניות', + ss: '%d שניות', + m: 'דקה', + mm: '%d דקות', + h: 'שעה', + hh: function (number) { + if (number === 2) { + return 'שעתיים'; + } + return number + ' שעות'; + }, + d: 'יום', + dd: function (number) { + if (number === 2) { + return 'יומיים'; + } + return number + ' ימים'; + }, + M: 'חודש', + MM: function (number) { + if (number === 2) { + return 'חודשיים'; + } + return number + ' חודשים'; + }, + y: 'שנה', + yy: function (number) { + if (number === 2) { + return 'שנתיים'; + } else if (number % 10 === 0 && number !== 10) { + return number + ' שנה'; + } + return number + ' שנים'; + }, + }, + meridiemParse: /אחה"צ|לפנה"צ|אחרי הצהריים|לפני הצהריים|לפנות בוקר|בבוקר|בערב/i, + isPM: function (input) { + return /^(אחה"צ|אחרי הצהריים|בערב)$/.test(input); + }, + meridiem: function (hour, minute, isLower) { + if (hour < 5) { + return 'לפנות בוקר'; + } else if (hour < 10) { + return 'בבוקר'; + } else if (hour < 12) { + return isLower ? 'לפנה"צ' : 'לפני הצהריים'; + } else if (hour < 18) { + return isLower ? 'אחה"צ' : 'אחרי הצהריים'; + } else { + return 'בערב'; + } + }, + }); + + //! moment.js locale configuration + + var symbolMap$7 = { + '1': '१', + '2': '२', + '3': '३', + '4': '४', + '5': '५', + '6': '६', + '7': '७', + '8': '८', + '9': '९', + '0': '०', + }, + numberMap$6 = { + '१': '1', + '२': '2', + '३': '3', + '४': '4', + '५': '5', + '६': '6', + '७': '7', + '८': '8', + '९': '9', + '०': '0', + }; + + hooks.defineLocale('hi', { + months: 'जनवरी_फ़रवरी_मार्च_अप्रैल_मई_जून_जुलाई_अगस्त_सितम्बर_अक्टूबर_नवम्बर_दिसम्बर'.split( + '_' + ), + monthsShort: 'जन._फ़र._मार्च_अप्रै._मई_जून_जुल._अग._सित._अक्टू._नव._दिस.'.split( + '_' + ), + monthsParseExact: true, + weekdays: 'रविवार_सोमवार_मंगलवार_बुधवार_गुरूवार_शुक्रवार_शनिवार'.split('_'), + weekdaysShort: 'रवि_सोम_मंगल_बुध_गुरू_शुक्र_शनि'.split('_'), + weekdaysMin: 'र_सो_मं_बु_गु_शु_श'.split('_'), + longDateFormat: { + LT: 'A h:mm बजे', + LTS: 'A h:mm:ss बजे', + L: 'DD/MM/YYYY', + LL: 'D MMMM YYYY', + LLL: 'D MMMM YYYY, A h:mm बजे', + LLLL: 'dddd, D MMMM YYYY, A h:mm बजे', + }, + calendar: { + sameDay: '[आज] LT', + nextDay: '[कल] LT', + nextWeek: 'dddd, LT', + lastDay: '[कल] LT', + lastWeek: '[पिछले] dddd, LT', + sameElse: 'L', + }, + relativeTime: { + future: '%s में', + past: '%s पहले', + s: 'कुछ ही क्षण', + ss: '%d सेकंड', + m: 'एक मिनट', + mm: '%d मिनट', + h: 'एक घंटा', + hh: '%d घंटे', + d: 'एक दिन', + dd: '%d दिन', + M: 'एक महीने', + MM: '%d महीने', + y: 'एक वर्ष', + yy: '%d वर्ष', + }, + preparse: function (string) { + return string.replace(/[१२३४५६७८९०]/g, function (match) { + return numberMap$6[match]; + }); + }, + postformat: function (string) { + return string.replace(/\d/g, function (match) { + return symbolMap$7[match]; + }); + }, + // Hindi notation for meridiems are quite fuzzy in practice. While there exists + // a rigid notion of a 'Pahar' it is not used as rigidly in modern Hindi. + meridiemParse: /रात|सुबह|दोपहर|शाम/, + meridiemHour: function (hour, meridiem) { + if (hour === 12) { + hour = 0; + } + if (meridiem === 'रात') { + return hour < 4 ? hour : hour + 12; + } else if (meridiem === 'सुबह') { + return hour; + } else if (meridiem === 'दोपहर') { + return hour >= 10 ? hour : hour + 12; + } else if (meridiem === 'शाम') { + return hour + 12; + } + }, + meridiem: function (hour, minute, isLower) { + if (hour < 4) { + return 'रात'; + } else if (hour < 10) { + return 'सुबह'; + } else if (hour < 17) { + return 'दोपहर'; + } else if (hour < 20) { + return 'शाम'; + } else { + return 'रात'; + } + }, + week: { + dow: 0, // Sunday is the first day of the week. + doy: 6, // The week that contains Jan 6th is the first week of the year. + }, + }); + + //! moment.js locale configuration + + function translate$3(number, withoutSuffix, key) { + var result = number + ' '; + switch (key) { + case 'ss': + if (number === 1) { + result += 'sekunda'; + } else if (number === 2 || number === 3 || number === 4) { + result += 'sekunde'; + } else { + result += 'sekundi'; + } + return result; + case 'm': + return withoutSuffix ? 'jedna minuta' : 'jedne minute'; + case 'mm': + if (number === 1) { + result += 'minuta'; + } else if (number === 2 || number === 3 || number === 4) { + result += 'minute'; + } else { + result += 'minuta'; + } + return result; + case 'h': + return withoutSuffix ? 'jedan sat' : 'jednog sata'; + case 'hh': + if (number === 1) { + result += 'sat'; + } else if (number === 2 || number === 3 || number === 4) { + result += 'sata'; + } else { + result += 'sati'; + } + return result; + case 'dd': + if (number === 1) { + result += 'dan'; + } else { + result += 'dana'; + } + return result; + case 'MM': + if (number === 1) { + result += 'mjesec'; + } else if (number === 2 || number === 3 || number === 4) { + result += 'mjeseca'; + } else { + result += 'mjeseci'; + } + return result; + case 'yy': + if (number === 1) { + result += 'godina'; + } else if (number === 2 || number === 3 || number === 4) { + result += 'godine'; + } else { + result += 'godina'; + } + return result; + } + } + + hooks.defineLocale('hr', { + months: { + format: 'siječnja_veljače_ožujka_travnja_svibnja_lipnja_srpnja_kolovoza_rujna_listopada_studenoga_prosinca'.split( + '_' + ), + standalone: 'siječanj_veljača_ožujak_travanj_svibanj_lipanj_srpanj_kolovoz_rujan_listopad_studeni_prosinac'.split( + '_' + ), + }, + monthsShort: 'sij._velj._ožu._tra._svi._lip._srp._kol._ruj._lis._stu._pro.'.split( + '_' + ), + monthsParseExact: true, + weekdays: 'nedjelja_ponedjeljak_utorak_srijeda_četvrtak_petak_subota'.split( + '_' + ), + weekdaysShort: 'ned._pon._uto._sri._čet._pet._sub.'.split('_'), + weekdaysMin: 'ne_po_ut_sr_če_pe_su'.split('_'), + weekdaysParseExact: true, + longDateFormat: { + LT: 'H:mm', + LTS: 'H:mm:ss', + L: 'DD.MM.YYYY', + LL: 'Do MMMM YYYY', + LLL: 'Do MMMM YYYY H:mm', + LLLL: 'dddd, Do MMMM YYYY H:mm', + }, + calendar: { + sameDay: '[danas u] LT', + nextDay: '[sutra u] LT', + nextWeek: function () { + switch (this.day()) { + case 0: + return '[u] [nedjelju] [u] LT'; + case 3: + return '[u] [srijedu] [u] LT'; + case 6: + return '[u] [subotu] [u] LT'; + case 1: + case 2: + case 4: + case 5: + return '[u] dddd [u] LT'; + } + }, + lastDay: '[jučer u] LT', + lastWeek: function () { + switch (this.day()) { + case 0: + return '[prošlu] [nedjelju] [u] LT'; + case 3: + return '[prošlu] [srijedu] [u] LT'; + case 6: + return '[prošle] [subote] [u] LT'; + case 1: + case 2: + case 4: + case 5: + return '[prošli] dddd [u] LT'; + } + }, + sameElse: 'L', + }, + relativeTime: { + future: 'za %s', + past: 'prije %s', + s: 'par sekundi', + ss: translate$3, + m: translate$3, + mm: translate$3, + h: translate$3, + hh: translate$3, + d: 'dan', + dd: translate$3, + M: 'mjesec', + MM: translate$3, + y: 'godinu', + yy: translate$3, + }, + dayOfMonthOrdinalParse: /\d{1,2}\./, + ordinal: '%d.', + week: { + dow: 1, // Monday is the first day of the week. + doy: 7, // The week that contains Jan 7th is the first week of the year. + }, + }); + + //! moment.js locale configuration + + var weekEndings = 'vasárnap hétfőn kedden szerdán csütörtökön pénteken szombaton'.split( + ' ' + ); + function translate$4(number, withoutSuffix, key, isFuture) { + var num = number; + switch (key) { + case 's': + return isFuture || withoutSuffix + ? 'néhány másodperc' + : 'néhány másodperce'; + case 'ss': + return num + (isFuture || withoutSuffix) + ? ' másodperc' + : ' másodperce'; + case 'm': + return 'egy' + (isFuture || withoutSuffix ? ' perc' : ' perce'); + case 'mm': + return num + (isFuture || withoutSuffix ? ' perc' : ' perce'); + case 'h': + return 'egy' + (isFuture || withoutSuffix ? ' óra' : ' órája'); + case 'hh': + return num + (isFuture || withoutSuffix ? ' óra' : ' órája'); + case 'd': + return 'egy' + (isFuture || withoutSuffix ? ' nap' : ' napja'); + case 'dd': + return num + (isFuture || withoutSuffix ? ' nap' : ' napja'); + case 'M': + return 'egy' + (isFuture || withoutSuffix ? ' hónap' : ' hónapja'); + case 'MM': + return num + (isFuture || withoutSuffix ? ' hónap' : ' hónapja'); + case 'y': + return 'egy' + (isFuture || withoutSuffix ? ' év' : ' éve'); + case 'yy': + return num + (isFuture || withoutSuffix ? ' év' : ' éve'); + } + return ''; + } + function week(isFuture) { + return ( + (isFuture ? '' : '[múlt] ') + + '[' + + weekEndings[this.day()] + + '] LT[-kor]' + ); + } + + hooks.defineLocale('hu', { + months: 'január_február_március_április_május_június_július_augusztus_szeptember_október_november_december'.split( + '_' + ), + monthsShort: 'jan_feb_márc_ápr_máj_jún_júl_aug_szept_okt_nov_dec'.split( + '_' + ), + weekdays: 'vasárnap_hétfő_kedd_szerda_csütörtök_péntek_szombat'.split('_'), + weekdaysShort: 'vas_hét_kedd_sze_csüt_pén_szo'.split('_'), + weekdaysMin: 'v_h_k_sze_cs_p_szo'.split('_'), + longDateFormat: { + LT: 'H:mm', + LTS: 'H:mm:ss', + L: 'YYYY.MM.DD.', + LL: 'YYYY. MMMM D.', + LLL: 'YYYY. MMMM D. H:mm', + LLLL: 'YYYY. MMMM D., dddd H:mm', + }, + meridiemParse: /de|du/i, + isPM: function (input) { + return input.charAt(1).toLowerCase() === 'u'; + }, + meridiem: function (hours, minutes, isLower) { + if (hours < 12) { + return isLower === true ? 'de' : 'DE'; + } else { + return isLower === true ? 'du' : 'DU'; + } + }, + calendar: { + sameDay: '[ma] LT[-kor]', + nextDay: '[holnap] LT[-kor]', + nextWeek: function () { + return week.call(this, true); + }, + lastDay: '[tegnap] LT[-kor]', + lastWeek: function () { + return week.call(this, false); + }, + sameElse: 'L', + }, + relativeTime: { + future: '%s múlva', + past: '%s', + s: translate$4, + ss: translate$4, + m: translate$4, + mm: translate$4, + h: translate$4, + hh: translate$4, + d: translate$4, + dd: translate$4, + M: translate$4, + MM: translate$4, + y: translate$4, + yy: translate$4, + }, + dayOfMonthOrdinalParse: /\d{1,2}\./, + ordinal: '%d.', + week: { + dow: 1, // Monday is the first day of the week. + doy: 4, // The week that contains Jan 4th is the first week of the year. + }, + }); + + //! moment.js locale configuration + + hooks.defineLocale('hy-am', { + months: { + format: 'հունվարի_փետրվարի_մարտի_ապրիլի_մայիսի_հունիսի_հուլիսի_օգոստոսի_սեպտեմբերի_հոկտեմբերի_նոյեմբերի_դեկտեմբերի'.split( + '_' + ), + standalone: 'հունվար_փետրվար_մարտ_ապրիլ_մայիս_հունիս_հուլիս_օգոստոս_սեպտեմբեր_հոկտեմբեր_նոյեմբեր_դեկտեմբեր'.split( + '_' + ), + }, + monthsShort: 'հնվ_փտր_մրտ_ապր_մյս_հնս_հլս_օգս_սպտ_հկտ_նմբ_դկտ'.split('_'), + weekdays: 'կիրակի_երկուշաբթի_երեքշաբթի_չորեքշաբթի_հինգշաբթի_ուրբաթ_շաբաթ'.split( + '_' + ), + weekdaysShort: 'կրկ_երկ_երք_չրք_հնգ_ուրբ_շբթ'.split('_'), + weekdaysMin: 'կրկ_երկ_երք_չրք_հնգ_ուրբ_շբթ'.split('_'), + longDateFormat: { + LT: 'HH:mm', + LTS: 'HH:mm:ss', + L: 'DD.MM.YYYY', + LL: 'D MMMM YYYY թ.', + LLL: 'D MMMM YYYY թ., HH:mm', + LLLL: 'dddd, D MMMM YYYY թ., HH:mm', + }, + calendar: { + sameDay: '[այսօր] LT', + nextDay: '[վաղը] LT', + lastDay: '[երեկ] LT', + nextWeek: function () { + return 'dddd [օրը ժամը] LT'; + }, + lastWeek: function () { + return '[անցած] dddd [օրը ժամը] LT'; + }, + sameElse: 'L', + }, + relativeTime: { + future: '%s հետո', + past: '%s առաջ', + s: 'մի քանի վայրկյան', + ss: '%d վայրկյան', + m: 'րոպե', + mm: '%d րոպե', + h: 'ժամ', + hh: '%d ժամ', + d: 'օր', + dd: '%d օր', + M: 'ամիս', + MM: '%d ամիս', + y: 'տարի', + yy: '%d տարի', + }, + meridiemParse: /գիշերվա|առավոտվա|ցերեկվա|երեկոյան/, + isPM: function (input) { + return /^(ցերեկվա|երեկոյան)$/.test(input); + }, + meridiem: function (hour) { + if (hour < 4) { + return 'գիշերվա'; + } else if (hour < 12) { + return 'առավոտվա'; + } else if (hour < 17) { + return 'ցերեկվա'; + } else { + return 'երեկոյան'; + } + }, + dayOfMonthOrdinalParse: /\d{1,2}|\d{1,2}-(ին|րդ)/, + ordinal: function (number, period) { + switch (period) { + case 'DDD': + case 'w': + case 'W': + case 'DDDo': + if (number === 1) { + return number + '-ին'; + } + return number + '-րդ'; + default: + return number; + } + }, + week: { + dow: 1, // Monday is the first day of the week. + doy: 7, // The week that contains Jan 7th is the first week of the year. + }, + }); + + //! moment.js locale configuration + + hooks.defineLocale('id', { + months: 'Januari_Februari_Maret_April_Mei_Juni_Juli_Agustus_September_Oktober_November_Desember'.split( + '_' + ), + monthsShort: 'Jan_Feb_Mar_Apr_Mei_Jun_Jul_Agt_Sep_Okt_Nov_Des'.split('_'), + weekdays: 'Minggu_Senin_Selasa_Rabu_Kamis_Jumat_Sabtu'.split('_'), + weekdaysShort: 'Min_Sen_Sel_Rab_Kam_Jum_Sab'.split('_'), + weekdaysMin: 'Mg_Sn_Sl_Rb_Km_Jm_Sb'.split('_'), + longDateFormat: { + LT: 'HH.mm', + LTS: 'HH.mm.ss', + L: 'DD/MM/YYYY', + LL: 'D MMMM YYYY', + LLL: 'D MMMM YYYY [pukul] HH.mm', + LLLL: 'dddd, D MMMM YYYY [pukul] HH.mm', + }, + meridiemParse: /pagi|siang|sore|malam/, + meridiemHour: function (hour, meridiem) { + if (hour === 12) { + hour = 0; + } + if (meridiem === 'pagi') { + return hour; + } else if (meridiem === 'siang') { + return hour >= 11 ? hour : hour + 12; + } else if (meridiem === 'sore' || meridiem === 'malam') { + return hour + 12; + } + }, + meridiem: function (hours, minutes, isLower) { + if (hours < 11) { + return 'pagi'; + } else if (hours < 15) { + return 'siang'; + } else if (hours < 19) { + return 'sore'; + } else { + return 'malam'; + } + }, + calendar: { + sameDay: '[Hari ini pukul] LT', + nextDay: '[Besok pukul] LT', + nextWeek: 'dddd [pukul] LT', + lastDay: '[Kemarin pukul] LT', + lastWeek: 'dddd [lalu pukul] LT', + sameElse: 'L', + }, + relativeTime: { + future: 'dalam %s', + past: '%s yang lalu', + s: 'beberapa detik', + ss: '%d detik', + m: 'semenit', + mm: '%d menit', + h: 'sejam', + hh: '%d jam', + d: 'sehari', + dd: '%d hari', + M: 'sebulan', + MM: '%d bulan', + y: 'setahun', + yy: '%d tahun', + }, + week: { + dow: 0, // Sunday is the first day of the week. + doy: 6, // The week that contains Jan 6th is the first week of the year. + }, + }); + + //! moment.js locale configuration + + function plural$2(n) { + if (n % 100 === 11) { + return true; + } else if (n % 10 === 1) { + return false; + } + return true; + } + function translate$5(number, withoutSuffix, key, isFuture) { + var result = number + ' '; + switch (key) { + case 's': + return withoutSuffix || isFuture + ? 'nokkrar sekúndur' + : 'nokkrum sekúndum'; + case 'ss': + if (plural$2(number)) { + return ( + result + + (withoutSuffix || isFuture ? 'sekúndur' : 'sekúndum') + ); + } + return result + 'sekúnda'; + case 'm': + return withoutSuffix ? 'mínúta' : 'mínútu'; + case 'mm': + if (plural$2(number)) { + return ( + result + (withoutSuffix || isFuture ? 'mínútur' : 'mínútum') + ); + } else if (withoutSuffix) { + return result + 'mínúta'; + } + return result + 'mínútu'; + case 'hh': + if (plural$2(number)) { + return ( + result + + (withoutSuffix || isFuture + ? 'klukkustundir' + : 'klukkustundum') + ); + } + return result + 'klukkustund'; + case 'd': + if (withoutSuffix) { + return 'dagur'; + } + return isFuture ? 'dag' : 'degi'; + case 'dd': + if (plural$2(number)) { + if (withoutSuffix) { + return result + 'dagar'; + } + return result + (isFuture ? 'daga' : 'dögum'); + } else if (withoutSuffix) { + return result + 'dagur'; + } + return result + (isFuture ? 'dag' : 'degi'); + case 'M': + if (withoutSuffix) { + return 'mánuður'; + } + return isFuture ? 'mánuð' : 'mánuði'; + case 'MM': + if (plural$2(number)) { + if (withoutSuffix) { + return result + 'mánuðir'; + } + return result + (isFuture ? 'mánuði' : 'mánuðum'); + } else if (withoutSuffix) { + return result + 'mánuður'; + } + return result + (isFuture ? 'mánuð' : 'mánuði'); + case 'y': + return withoutSuffix || isFuture ? 'ár' : 'ári'; + case 'yy': + if (plural$2(number)) { + return result + (withoutSuffix || isFuture ? 'ár' : 'árum'); + } + return result + (withoutSuffix || isFuture ? 'ár' : 'ári'); + } + } + + hooks.defineLocale('is', { + months: 'janúar_febrúar_mars_apríl_maí_júní_júlí_ágúst_september_október_nóvember_desember'.split( + '_' + ), + monthsShort: 'jan_feb_mar_apr_maí_jún_júl_ágú_sep_okt_nóv_des'.split('_'), + weekdays: 'sunnudagur_mánudagur_þriðjudagur_miðvikudagur_fimmtudagur_föstudagur_laugardagur'.split( + '_' + ), + weekdaysShort: 'sun_mán_þri_mið_fim_fös_lau'.split('_'), + weekdaysMin: 'Su_Má_Þr_Mi_Fi_Fö_La'.split('_'), + longDateFormat: { + LT: 'H:mm', + LTS: 'H:mm:ss', + L: 'DD.MM.YYYY', + LL: 'D. MMMM YYYY', + LLL: 'D. MMMM YYYY [kl.] H:mm', + LLLL: 'dddd, D. MMMM YYYY [kl.] H:mm', + }, + calendar: { + sameDay: '[í dag kl.] LT', + nextDay: '[á morgun kl.] LT', + nextWeek: 'dddd [kl.] LT', + lastDay: '[í gær kl.] LT', + lastWeek: '[síðasta] dddd [kl.] LT', + sameElse: 'L', + }, + relativeTime: { + future: 'eftir %s', + past: 'fyrir %s síðan', + s: translate$5, + ss: translate$5, + m: translate$5, + mm: translate$5, + h: 'klukkustund', + hh: translate$5, + d: translate$5, + dd: translate$5, + M: translate$5, + MM: translate$5, + y: translate$5, + yy: translate$5, + }, + dayOfMonthOrdinalParse: /\d{1,2}\./, + ordinal: '%d.', + week: { + dow: 1, // Monday is the first day of the week. + doy: 4, // The week that contains Jan 4th is the first week of the year. + }, + }); + + //! moment.js locale configuration + + hooks.defineLocale('it-ch', { + months: 'gennaio_febbraio_marzo_aprile_maggio_giugno_luglio_agosto_settembre_ottobre_novembre_dicembre'.split( + '_' + ), + monthsShort: 'gen_feb_mar_apr_mag_giu_lug_ago_set_ott_nov_dic'.split('_'), + weekdays: 'domenica_lunedì_martedì_mercoledì_giovedì_venerdì_sabato'.split( + '_' + ), + weekdaysShort: 'dom_lun_mar_mer_gio_ven_sab'.split('_'), + weekdaysMin: 'do_lu_ma_me_gi_ve_sa'.split('_'), + longDateFormat: { + LT: 'HH:mm', + LTS: 'HH:mm:ss', + L: 'DD.MM.YYYY', + LL: 'D MMMM YYYY', + LLL: 'D MMMM YYYY HH:mm', + LLLL: 'dddd D MMMM YYYY HH:mm', + }, + calendar: { + sameDay: '[Oggi alle] LT', + nextDay: '[Domani alle] LT', + nextWeek: 'dddd [alle] LT', + lastDay: '[Ieri alle] LT', + lastWeek: function () { + switch (this.day()) { + case 0: + return '[la scorsa] dddd [alle] LT'; + default: + return '[lo scorso] dddd [alle] LT'; + } + }, + sameElse: 'L', + }, + relativeTime: { + future: function (s) { + return (/^[0-9].+$/.test(s) ? 'tra' : 'in') + ' ' + s; + }, + past: '%s fa', + s: 'alcuni secondi', + ss: '%d secondi', + m: 'un minuto', + mm: '%d minuti', + h: "un'ora", + hh: '%d ore', + d: 'un giorno', + dd: '%d giorni', + M: 'un mese', + MM: '%d mesi', + y: 'un anno', + yy: '%d anni', + }, + dayOfMonthOrdinalParse: /\d{1,2}º/, + ordinal: '%dº', + week: { + dow: 1, // Monday is the first day of the week. + doy: 4, // The week that contains Jan 4th is the first week of the year. + }, + }); + + //! moment.js locale configuration + + hooks.defineLocale('it', { + months: 'gennaio_febbraio_marzo_aprile_maggio_giugno_luglio_agosto_settembre_ottobre_novembre_dicembre'.split( + '_' + ), + monthsShort: 'gen_feb_mar_apr_mag_giu_lug_ago_set_ott_nov_dic'.split('_'), + weekdays: 'domenica_lunedì_martedì_mercoledì_giovedì_venerdì_sabato'.split( + '_' + ), + weekdaysShort: 'dom_lun_mar_mer_gio_ven_sab'.split('_'), + weekdaysMin: 'do_lu_ma_me_gi_ve_sa'.split('_'), + longDateFormat: { + LT: 'HH:mm', + LTS: 'HH:mm:ss', + L: 'DD/MM/YYYY', + LL: 'D MMMM YYYY', + LLL: 'D MMMM YYYY HH:mm', + LLLL: 'dddd D MMMM YYYY HH:mm', + }, + calendar: { + sameDay: function () { + return ( + '[Oggi a' + + (this.hours() > 1 ? 'lle ' : this.hours() === 0 ? ' ' : "ll'") + + ']LT' + ); + }, + nextDay: function () { + return ( + '[Domani a' + + (this.hours() > 1 ? 'lle ' : this.hours() === 0 ? ' ' : "ll'") + + ']LT' + ); + }, + nextWeek: function () { + return ( + 'dddd [a' + + (this.hours() > 1 ? 'lle ' : this.hours() === 0 ? ' ' : "ll'") + + ']LT' + ); + }, + lastDay: function () { + return ( + '[Ieri a' + + (this.hours() > 1 ? 'lle ' : this.hours() === 0 ? ' ' : "ll'") + + ']LT' + ); + }, + lastWeek: function () { + switch (this.day()) { + case 0: + return ( + '[La scorsa] dddd [a' + + (this.hours() > 1 + ? 'lle ' + : this.hours() === 0 + ? ' ' + : "ll'") + + ']LT' + ); + default: + return ( + '[Lo scorso] dddd [a' + + (this.hours() > 1 + ? 'lle ' + : this.hours() === 0 + ? ' ' + : "ll'") + + ']LT' + ); + } + }, + sameElse: 'L', + }, + relativeTime: { + future: 'tra %s', + past: '%s fa', + s: 'alcuni secondi', + ss: '%d secondi', + m: 'un minuto', + mm: '%d minuti', + h: "un'ora", + hh: '%d ore', + d: 'un giorno', + dd: '%d giorni', + M: 'un mese', + MM: '%d mesi', + y: 'un anno', + yy: '%d anni', + }, + dayOfMonthOrdinalParse: /\d{1,2}º/, + ordinal: '%dº', + week: { + dow: 1, // Monday is the first day of the week. + doy: 4, // The week that contains Jan 4th is the first week of the year. + }, + }); + + //! moment.js locale configuration + + hooks.defineLocale('ja', { + eras: [ + { + since: '2019-05-01', + offset: 1, + name: '令和', + narrow: '㋿', + abbr: 'R', + }, + { + since: '1989-01-08', + until: '2019-04-30', + offset: 1, + name: '平成', + narrow: '㍻', + abbr: 'H', + }, + { + since: '1926-12-25', + until: '1989-01-07', + offset: 1, + name: '昭和', + narrow: '㍼', + abbr: 'S', + }, + { + since: '1912-07-30', + until: '1926-12-24', + offset: 1, + name: '大正', + narrow: '㍽', + abbr: 'T', + }, + { + since: '1873-01-01', + until: '1912-07-29', + offset: 6, + name: '明治', + narrow: '㍾', + abbr: 'M', + }, + { + since: '0001-01-01', + until: '1873-12-31', + offset: 1, + name: '西暦', + narrow: 'AD', + abbr: 'AD', + }, + { + since: '0000-12-31', + until: -Infinity, + offset: 1, + name: '紀元前', + narrow: 'BC', + abbr: 'BC', + }, + ], + eraYearOrdinalRegex: /(元|\d+)年/, + eraYearOrdinalParse: function (input, match) { + return match[1] === '元' ? 1 : parseInt(match[1] || input, 10); + }, + months: '1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月'.split('_'), + monthsShort: '1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月'.split( + '_' + ), + weekdays: '日曜日_月曜日_火曜日_水曜日_木曜日_金曜日_土曜日'.split('_'), + weekdaysShort: '日_月_火_水_木_金_土'.split('_'), + weekdaysMin: '日_月_火_水_木_金_土'.split('_'), + longDateFormat: { + LT: 'HH:mm', + LTS: 'HH:mm:ss', + L: 'YYYY/MM/DD', + LL: 'YYYY年M月D日', + LLL: 'YYYY年M月D日 HH:mm', + LLLL: 'YYYY年M月D日 dddd HH:mm', + l: 'YYYY/MM/DD', + ll: 'YYYY年M月D日', + lll: 'YYYY年M月D日 HH:mm', + llll: 'YYYY年M月D日(ddd) HH:mm', + }, + meridiemParse: /午前|午後/i, + isPM: function (input) { + return input === '午後'; + }, + meridiem: function (hour, minute, isLower) { + if (hour < 12) { + return '午前'; + } else { + return '午後'; + } + }, + calendar: { + sameDay: '[今日] LT', + nextDay: '[明日] LT', + nextWeek: function (now) { + if (now.week() !== this.week()) { + return '[来週]dddd LT'; + } else { + return 'dddd LT'; + } + }, + lastDay: '[昨日] LT', + lastWeek: function (now) { + if (this.week() !== now.week()) { + return '[先週]dddd LT'; + } else { + return 'dddd LT'; + } + }, + sameElse: 'L', + }, + dayOfMonthOrdinalParse: /\d{1,2}日/, + ordinal: function (number, period) { + switch (period) { + case 'y': + return number === 1 ? '元年' : number + '年'; + case 'd': + case 'D': + case 'DDD': + return number + '日'; + default: + return number; + } + }, + relativeTime: { + future: '%s後', + past: '%s前', + s: '数秒', + ss: '%d秒', + m: '1分', + mm: '%d分', + h: '1時間', + hh: '%d時間', + d: '1日', + dd: '%d日', + M: '1ヶ月', + MM: '%dヶ月', + y: '1年', + yy: '%d年', + }, + }); + + //! moment.js locale configuration + + hooks.defineLocale('jv', { + months: 'Januari_Februari_Maret_April_Mei_Juni_Juli_Agustus_September_Oktober_Nopember_Desember'.split( + '_' + ), + monthsShort: 'Jan_Feb_Mar_Apr_Mei_Jun_Jul_Ags_Sep_Okt_Nop_Des'.split('_'), + weekdays: 'Minggu_Senen_Seloso_Rebu_Kemis_Jemuwah_Septu'.split('_'), + weekdaysShort: 'Min_Sen_Sel_Reb_Kem_Jem_Sep'.split('_'), + weekdaysMin: 'Mg_Sn_Sl_Rb_Km_Jm_Sp'.split('_'), + longDateFormat: { + LT: 'HH.mm', + LTS: 'HH.mm.ss', + L: 'DD/MM/YYYY', + LL: 'D MMMM YYYY', + LLL: 'D MMMM YYYY [pukul] HH.mm', + LLLL: 'dddd, D MMMM YYYY [pukul] HH.mm', + }, + meridiemParse: /enjing|siyang|sonten|ndalu/, + meridiemHour: function (hour, meridiem) { + if (hour === 12) { + hour = 0; + } + if (meridiem === 'enjing') { + return hour; + } else if (meridiem === 'siyang') { + return hour >= 11 ? hour : hour + 12; + } else if (meridiem === 'sonten' || meridiem === 'ndalu') { + return hour + 12; + } + }, + meridiem: function (hours, minutes, isLower) { + if (hours < 11) { + return 'enjing'; + } else if (hours < 15) { + return 'siyang'; + } else if (hours < 19) { + return 'sonten'; + } else { + return 'ndalu'; + } + }, + calendar: { + sameDay: '[Dinten puniko pukul] LT', + nextDay: '[Mbenjang pukul] LT', + nextWeek: 'dddd [pukul] LT', + lastDay: '[Kala wingi pukul] LT', + lastWeek: 'dddd [kepengker pukul] LT', + sameElse: 'L', + }, + relativeTime: { + future: 'wonten ing %s', + past: '%s ingkang kepengker', + s: 'sawetawis detik', + ss: '%d detik', + m: 'setunggal menit', + mm: '%d menit', + h: 'setunggal jam', + hh: '%d jam', + d: 'sedinten', + dd: '%d dinten', + M: 'sewulan', + MM: '%d wulan', + y: 'setaun', + yy: '%d taun', + }, + week: { + dow: 1, // Monday is the first day of the week. + doy: 7, // The week that contains Jan 7th is the first week of the year. + }, + }); + + //! moment.js locale configuration + + hooks.defineLocale('ka', { + months: 'იანვარი_თებერვალი_მარტი_აპრილი_მაისი_ივნისი_ივლისი_აგვისტო_სექტემბერი_ოქტომბერი_ნოემბერი_დეკემბერი'.split( + '_' + ), + monthsShort: 'იან_თებ_მარ_აპრ_მაი_ივნ_ივლ_აგვ_სექ_ოქტ_ნოე_დეკ'.split('_'), + weekdays: { + standalone: 'კვირა_ორშაბათი_სამშაბათი_ოთხშაბათი_ხუთშაბათი_პარასკევი_შაბათი'.split( + '_' + ), + format: 'კვირას_ორშაბათს_სამშაბათს_ოთხშაბათს_ხუთშაბათს_პარასკევს_შაბათს'.split( + '_' + ), + isFormat: /(წინა|შემდეგ)/, + }, + weekdaysShort: 'კვი_ორშ_სამ_ოთხ_ხუთ_პარ_შაბ'.split('_'), + weekdaysMin: 'კვ_ორ_სა_ოთ_ხუ_პა_შა'.split('_'), + longDateFormat: { + LT: 'HH:mm', + LTS: 'HH:mm:ss', + L: 'DD/MM/YYYY', + LL: 'D MMMM YYYY', + LLL: 'D MMMM YYYY HH:mm', + LLLL: 'dddd, D MMMM YYYY HH:mm', + }, + calendar: { + sameDay: '[დღეს] LT[-ზე]', + nextDay: '[ხვალ] LT[-ზე]', + lastDay: '[გუშინ] LT[-ზე]', + nextWeek: '[შემდეგ] dddd LT[-ზე]', + lastWeek: '[წინა] dddd LT-ზე', + sameElse: 'L', + }, + relativeTime: { + future: function (s) { + return s.replace(/(წამ|წუთ|საათ|წელ|დღ|თვ)(ი|ე)/, function ( + $0, + $1, + $2 + ) { + return $2 === 'ი' ? $1 + 'ში' : $1 + $2 + 'ში'; + }); + }, + past: function (s) { + if (/(წამი|წუთი|საათი|დღე|თვე)/.test(s)) { + return s.replace(/(ი|ე)$/, 'ის წინ'); + } + if (/წელი/.test(s)) { + return s.replace(/წელი$/, 'წლის წინ'); + } + return s; + }, + s: 'რამდენიმე წამი', + ss: '%d წამი', + m: 'წუთი', + mm: '%d წუთი', + h: 'საათი', + hh: '%d საათი', + d: 'დღე', + dd: '%d დღე', + M: 'თვე', + MM: '%d თვე', + y: 'წელი', + yy: '%d წელი', + }, + dayOfMonthOrdinalParse: /0|1-ლი|მე-\d{1,2}|\d{1,2}-ე/, + ordinal: function (number) { + if (number === 0) { + return number; + } + if (number === 1) { + return number + '-ლი'; + } + if ( + number < 20 || + (number <= 100 && number % 20 === 0) || + number % 100 === 0 + ) { + return 'მე-' + number; + } + return number + '-ე'; + }, + week: { + dow: 1, + doy: 7, + }, + }); + + //! moment.js locale configuration + + var suffixes$1 = { + 0: '-ші', + 1: '-ші', + 2: '-ші', + 3: '-ші', + 4: '-ші', + 5: '-ші', + 6: '-шы', + 7: '-ші', + 8: '-ші', + 9: '-шы', + 10: '-шы', + 20: '-шы', + 30: '-шы', + 40: '-шы', + 50: '-ші', + 60: '-шы', + 70: '-ші', + 80: '-ші', + 90: '-шы', + 100: '-ші', + }; + + hooks.defineLocale('kk', { + months: 'қаңтар_ақпан_наурыз_сәуір_мамыр_маусым_шілде_тамыз_қыркүйек_қазан_қараша_желтоқсан'.split( + '_' + ), + monthsShort: 'қаң_ақп_нау_сәу_мам_мау_шіл_там_қыр_қаз_қар_жел'.split('_'), + weekdays: 'жексенбі_дүйсенбі_сейсенбі_сәрсенбі_бейсенбі_жұма_сенбі'.split( + '_' + ), + weekdaysShort: 'жек_дүй_сей_сәр_бей_жұм_сен'.split('_'), + weekdaysMin: 'жк_дй_сй_ср_бй_жм_сн'.split('_'), + longDateFormat: { + LT: 'HH:mm', + LTS: 'HH:mm:ss', + L: 'DD.MM.YYYY', + LL: 'D MMMM YYYY', + LLL: 'D MMMM YYYY HH:mm', + LLLL: 'dddd, D MMMM YYYY HH:mm', + }, + calendar: { + sameDay: '[Бүгін сағат] LT', + nextDay: '[Ертең сағат] LT', + nextWeek: 'dddd [сағат] LT', + lastDay: '[Кеше сағат] LT', + lastWeek: '[Өткен аптаның] dddd [сағат] LT', + sameElse: 'L', + }, + relativeTime: { + future: '%s ішінде', + past: '%s бұрын', + s: 'бірнеше секунд', + ss: '%d секунд', + m: 'бір минут', + mm: '%d минут', + h: 'бір сағат', + hh: '%d сағат', + d: 'бір күн', + dd: '%d күн', + M: 'бір ай', + MM: '%d ай', + y: 'бір жыл', + yy: '%d жыл', + }, + dayOfMonthOrdinalParse: /\d{1,2}-(ші|шы)/, + ordinal: function (number) { + var a = number % 10, + b = number >= 100 ? 100 : null; + return number + (suffixes$1[number] || suffixes$1[a] || suffixes$1[b]); + }, + week: { + dow: 1, // Monday is the first day of the week. + doy: 7, // The week that contains Jan 7th is the first week of the year. + }, + }); + + //! moment.js locale configuration + + var symbolMap$8 = { + '1': '១', + '2': '២', + '3': '៣', + '4': '៤', + '5': '៥', + '6': '៦', + '7': '៧', + '8': '៨', + '9': '៩', + '0': '០', + }, + numberMap$7 = { + '១': '1', + '២': '2', + '៣': '3', + '៤': '4', + '៥': '5', + '៦': '6', + '៧': '7', + '៨': '8', + '៩': '9', + '០': '0', + }; + + hooks.defineLocale('km', { + months: 'មករា_កុម្ភៈ_មីនា_មេសា_ឧសភា_មិថុនា_កក្កដា_សីហា_កញ្ញា_តុលា_វិច្ឆិកា_ធ្នូ'.split( + '_' + ), + monthsShort: 'មករា_កុម្ភៈ_មីនា_មេសា_ឧសភា_មិថុនា_កក្កដា_សីហា_កញ្ញា_តុលា_វិច្ឆិកា_ធ្នូ'.split( + '_' + ), + weekdays: 'អាទិត្យ_ច័ន្ទ_អង្គារ_ពុធ_ព្រហស្បតិ៍_សុក្រ_សៅរ៍'.split('_'), + weekdaysShort: 'អា_ច_អ_ព_ព្រ_សុ_ស'.split('_'), + weekdaysMin: 'អា_ច_អ_ព_ព្រ_សុ_ស'.split('_'), + weekdaysParseExact: true, + longDateFormat: { + LT: 'HH:mm', + LTS: 'HH:mm:ss', + L: 'DD/MM/YYYY', + LL: 'D MMMM YYYY', + LLL: 'D MMMM YYYY HH:mm', + LLLL: 'dddd, D MMMM YYYY HH:mm', + }, + meridiemParse: /ព្រឹក|ល្ងាច/, + isPM: function (input) { + return input === 'ល្ងាច'; + }, + meridiem: function (hour, minute, isLower) { + if (hour < 12) { + return 'ព្រឹក'; + } else { + return 'ល្ងាច'; + } + }, + calendar: { + sameDay: '[ថ្ងៃនេះ ម៉ោង] LT', + nextDay: '[ស្អែក ម៉ោង] LT', + nextWeek: 'dddd [ម៉ោង] LT', + lastDay: '[ម្សិលមិញ ម៉ោង] LT', + lastWeek: 'dddd [សប្តាហ៍មុន] [ម៉ោង] LT', + sameElse: 'L', + }, + relativeTime: { + future: '%sទៀត', + past: '%sមុន', + s: 'ប៉ុន្មានវិនាទី', + ss: '%d វិនាទី', + m: 'មួយនាទី', + mm: '%d នាទី', + h: 'មួយម៉ោង', + hh: '%d ម៉ោង', + d: 'មួយថ្ងៃ', + dd: '%d ថ្ងៃ', + M: 'មួយខែ', + MM: '%d ខែ', + y: 'មួយឆ្នាំ', + yy: '%d ឆ្នាំ', + }, + dayOfMonthOrdinalParse: /ទី\d{1,2}/, + ordinal: 'ទី%d', + preparse: function (string) { + return string.replace(/[១២៣៤៥៦៧៨៩០]/g, function (match) { + return numberMap$7[match]; + }); + }, + postformat: function (string) { + return string.replace(/\d/g, function (match) { + return symbolMap$8[match]; + }); + }, + week: { + dow: 1, // Monday is the first day of the week. + doy: 4, // The week that contains Jan 4th is the first week of the year. + }, + }); + + //! moment.js locale configuration + + var symbolMap$9 = { + '1': '೧', + '2': '೨', + '3': '೩', + '4': '೪', + '5': '೫', + '6': '೬', + '7': '೭', + '8': '೮', + '9': '೯', + '0': '೦', + }, + numberMap$8 = { + '೧': '1', + '೨': '2', + '೩': '3', + '೪': '4', + '೫': '5', + '೬': '6', + '೭': '7', + '೮': '8', + '೯': '9', + '೦': '0', + }; + + hooks.defineLocale('kn', { + months: 'ಜನವರಿ_ಫೆಬ್ರವರಿ_ಮಾರ್ಚ್_ಏಪ್ರಿಲ್_ಮೇ_ಜೂನ್_ಜುಲೈ_ಆಗಸ್ಟ್_ಸೆಪ್ಟೆಂಬರ್_ಅಕ್ಟೋಬರ್_ನವೆಂಬರ್_ಡಿಸೆಂಬರ್'.split( + '_' + ), + monthsShort: 'ಜನ_ಫೆಬ್ರ_ಮಾರ್ಚ್_ಏಪ್ರಿಲ್_ಮೇ_ಜೂನ್_ಜುಲೈ_ಆಗಸ್ಟ್_ಸೆಪ್ಟೆಂ_ಅಕ್ಟೋ_ನವೆಂ_ಡಿಸೆಂ'.split( + '_' + ), + monthsParseExact: true, + weekdays: 'ಭಾನುವಾರ_ಸೋಮವಾರ_ಮಂಗಳವಾರ_ಬುಧವಾರ_ಗುರುವಾರ_ಶುಕ್ರವಾರ_ಶನಿವಾರ'.split( + '_' + ), + weekdaysShort: 'ಭಾನು_ಸೋಮ_ಮಂಗಳ_ಬುಧ_ಗುರು_ಶುಕ್ರ_ಶನಿ'.split('_'), + weekdaysMin: 'ಭಾ_ಸೋ_ಮಂ_ಬು_ಗು_ಶು_ಶ'.split('_'), + longDateFormat: { + LT: 'A h:mm', + LTS: 'A h:mm:ss', + L: 'DD/MM/YYYY', + LL: 'D MMMM YYYY', + LLL: 'D MMMM YYYY, A h:mm', + LLLL: 'dddd, D MMMM YYYY, A h:mm', + }, + calendar: { + sameDay: '[ಇಂದು] LT', + nextDay: '[ನಾಳೆ] LT', + nextWeek: 'dddd, LT', + lastDay: '[ನಿನ್ನೆ] LT', + lastWeek: '[ಕೊನೆಯ] dddd, LT', + sameElse: 'L', + }, + relativeTime: { + future: '%s ನಂತರ', + past: '%s ಹಿಂದೆ', + s: 'ಕೆಲವು ಕ್ಷಣಗಳು', + ss: '%d ಸೆಕೆಂಡುಗಳು', + m: 'ಒಂದು ನಿಮಿಷ', + mm: '%d ನಿಮಿಷ', + h: 'ಒಂದು ಗಂಟೆ', + hh: '%d ಗಂಟೆ', + d: 'ಒಂದು ದಿನ', + dd: '%d ದಿನ', + M: 'ಒಂದು ತಿಂಗಳು', + MM: '%d ತಿಂಗಳು', + y: 'ಒಂದು ವರ್ಷ', + yy: '%d ವರ್ಷ', + }, + preparse: function (string) { + return string.replace(/[೧೨೩೪೫೬೭೮೯೦]/g, function (match) { + return numberMap$8[match]; + }); + }, + postformat: function (string) { + return string.replace(/\d/g, function (match) { + return symbolMap$9[match]; + }); + }, + meridiemParse: /ರಾತ್ರಿ|ಬೆಳಿಗ್ಗೆ|ಮಧ್ಯಾಹ್ನ|ಸಂಜೆ/, + meridiemHour: function (hour, meridiem) { + if (hour === 12) { + hour = 0; + } + if (meridiem === 'ರಾತ್ರಿ') { + return hour < 4 ? hour : hour + 12; + } else if (meridiem === 'ಬೆಳಿಗ್ಗೆ') { + return hour; + } else if (meridiem === 'ಮಧ್ಯಾಹ್ನ') { + return hour >= 10 ? hour : hour + 12; + } else if (meridiem === 'ಸಂಜೆ') { + return hour + 12; + } + }, + meridiem: function (hour, minute, isLower) { + if (hour < 4) { + return 'ರಾತ್ರಿ'; + } else if (hour < 10) { + return 'ಬೆಳಿಗ್ಗೆ'; + } else if (hour < 17) { + return 'ಮಧ್ಯಾಹ್ನ'; + } else if (hour < 20) { + return 'ಸಂಜೆ'; + } else { + return 'ರಾತ್ರಿ'; + } + }, + dayOfMonthOrdinalParse: /\d{1,2}(ನೇ)/, + ordinal: function (number) { + return number + 'ನೇ'; + }, + week: { + dow: 0, // Sunday is the first day of the week. + doy: 6, // The week that contains Jan 6th is the first week of the year. + }, + }); + + //! moment.js locale configuration + + hooks.defineLocale('ko', { + months: '1월_2월_3월_4월_5월_6월_7월_8월_9월_10월_11월_12월'.split('_'), + monthsShort: '1월_2월_3월_4월_5월_6월_7월_8월_9월_10월_11월_12월'.split( + '_' + ), + weekdays: '일요일_월요일_화요일_수요일_목요일_금요일_토요일'.split('_'), + weekdaysShort: '일_월_화_수_목_금_토'.split('_'), + weekdaysMin: '일_월_화_수_목_금_토'.split('_'), + longDateFormat: { + LT: 'A h:mm', + LTS: 'A h:mm:ss', + L: 'YYYY.MM.DD.', + LL: 'YYYY년 MMMM D일', + LLL: 'YYYY년 MMMM D일 A h:mm', + LLLL: 'YYYY년 MMMM D일 dddd A h:mm', + l: 'YYYY.MM.DD.', + ll: 'YYYY년 MMMM D일', + lll: 'YYYY년 MMMM D일 A h:mm', + llll: 'YYYY년 MMMM D일 dddd A h:mm', + }, + calendar: { + sameDay: '오늘 LT', + nextDay: '내일 LT', + nextWeek: 'dddd LT', + lastDay: '어제 LT', + lastWeek: '지난주 dddd LT', + sameElse: 'L', + }, + relativeTime: { + future: '%s 후', + past: '%s 전', + s: '몇 초', + ss: '%d초', + m: '1분', + mm: '%d분', + h: '한 시간', + hh: '%d시간', + d: '하루', + dd: '%d일', + M: '한 달', + MM: '%d달', + y: '일 년', + yy: '%d년', + }, + dayOfMonthOrdinalParse: /\d{1,2}(일|월|주)/, + ordinal: function (number, period) { + switch (period) { + case 'd': + case 'D': + case 'DDD': + return number + '일'; + case 'M': + return number + '월'; + case 'w': + case 'W': + return number + '주'; + default: + return number; + } + }, + meridiemParse: /오전|오후/, + isPM: function (token) { + return token === '오후'; + }, + meridiem: function (hour, minute, isUpper) { + return hour < 12 ? '오전' : '오후'; + }, + }); + + //! moment.js locale configuration + + var symbolMap$a = { + '1': '١', + '2': '٢', + '3': '٣', + '4': '٤', + '5': '٥', + '6': '٦', + '7': '٧', + '8': '٨', + '9': '٩', + '0': '٠', + }, + numberMap$9 = { + '١': '1', + '٢': '2', + '٣': '3', + '٤': '4', + '٥': '5', + '٦': '6', + '٧': '7', + '٨': '8', + '٩': '9', + '٠': '0', + }, + months$8 = [ + 'کانونی دووەم', + 'شوبات', + 'ئازار', + 'نیسان', + 'ئایار', + 'حوزەیران', + 'تەمموز', + 'ئاب', + 'ئەیلوول', + 'تشرینی یەكەم', + 'تشرینی دووەم', + 'كانونی یەکەم', + ]; + + hooks.defineLocale('ku', { + months: months$8, + monthsShort: months$8, + weekdays: 'یه‌كشه‌ممه‌_دووشه‌ممه‌_سێشه‌ممه‌_چوارشه‌ممه‌_پێنجشه‌ممه‌_هه‌ینی_شه‌ممه‌'.split( + '_' + ), + weekdaysShort: 'یه‌كشه‌م_دووشه‌م_سێشه‌م_چوارشه‌م_پێنجشه‌م_هه‌ینی_شه‌ممه‌'.split( + '_' + ), + weekdaysMin: 'ی_د_س_چ_پ_ه_ش'.split('_'), + weekdaysParseExact: true, + longDateFormat: { + LT: 'HH:mm', + LTS: 'HH:mm:ss', + L: 'DD/MM/YYYY', + LL: 'D MMMM YYYY', + LLL: 'D MMMM YYYY HH:mm', + LLLL: 'dddd, D MMMM YYYY HH:mm', + }, + meridiemParse: /ئێواره‌|به‌یانی/, + isPM: function (input) { + return /ئێواره‌/.test(input); + }, + meridiem: function (hour, minute, isLower) { + if (hour < 12) { + return 'به‌یانی'; + } else { + return 'ئێواره‌'; + } + }, + calendar: { + sameDay: '[ئه‌مرۆ كاتژمێر] LT', + nextDay: '[به‌یانی كاتژمێر] LT', + nextWeek: 'dddd [كاتژمێر] LT', + lastDay: '[دوێنێ كاتژمێر] LT', + lastWeek: 'dddd [كاتژمێر] LT', + sameElse: 'L', + }, + relativeTime: { + future: 'له‌ %s', + past: '%s', + s: 'چه‌ند چركه‌یه‌ك', + ss: 'چركه‌ %d', + m: 'یه‌ك خوله‌ك', + mm: '%d خوله‌ك', + h: 'یه‌ك كاتژمێر', + hh: '%d كاتژمێر', + d: 'یه‌ك ڕۆژ', + dd: '%d ڕۆژ', + M: 'یه‌ك مانگ', + MM: '%d مانگ', + y: 'یه‌ك ساڵ', + yy: '%d ساڵ', + }, + preparse: function (string) { + return string + .replace(/[١٢٣٤٥٦٧٨٩٠]/g, function (match) { + return numberMap$9[match]; + }) + .replace(/،/g, ','); + }, + postformat: function (string) { + return string + .replace(/\d/g, function (match) { + return symbolMap$a[match]; + }) + .replace(/,/g, '،'); + }, + week: { + dow: 6, // Saturday is the first day of the week. + doy: 12, // The week that contains Jan 12th is the first week of the year. + }, + }); + + //! moment.js locale configuration + + var suffixes$2 = { + 0: '-чү', + 1: '-чи', + 2: '-чи', + 3: '-чү', + 4: '-чү', + 5: '-чи', + 6: '-чы', + 7: '-чи', + 8: '-чи', + 9: '-чу', + 10: '-чу', + 20: '-чы', + 30: '-чу', + 40: '-чы', + 50: '-чү', + 60: '-чы', + 70: '-чи', + 80: '-чи', + 90: '-чу', + 100: '-чү', + }; + + hooks.defineLocale('ky', { + months: 'январь_февраль_март_апрель_май_июнь_июль_август_сентябрь_октябрь_ноябрь_декабрь'.split( + '_' + ), + monthsShort: 'янв_фев_март_апр_май_июнь_июль_авг_сен_окт_ноя_дек'.split( + '_' + ), + weekdays: 'Жекшемби_Дүйшөмбү_Шейшемби_Шаршемби_Бейшемби_Жума_Ишемби'.split( + '_' + ), + weekdaysShort: 'Жек_Дүй_Шей_Шар_Бей_Жум_Ише'.split('_'), + weekdaysMin: 'Жк_Дй_Шй_Шр_Бй_Жм_Иш'.split('_'), + longDateFormat: { + LT: 'HH:mm', + LTS: 'HH:mm:ss', + L: 'DD.MM.YYYY', + LL: 'D MMMM YYYY', + LLL: 'D MMMM YYYY HH:mm', + LLLL: 'dddd, D MMMM YYYY HH:mm', + }, + calendar: { + sameDay: '[Бүгүн саат] LT', + nextDay: '[Эртең саат] LT', + nextWeek: 'dddd [саат] LT', + lastDay: '[Кечээ саат] LT', + lastWeek: '[Өткөн аптанын] dddd [күнү] [саат] LT', + sameElse: 'L', + }, + relativeTime: { + future: '%s ичинде', + past: '%s мурун', + s: 'бирнече секунд', + ss: '%d секунд', + m: 'бир мүнөт', + mm: '%d мүнөт', + h: 'бир саат', + hh: '%d саат', + d: 'бир күн', + dd: '%d күн', + M: 'бир ай', + MM: '%d ай', + y: 'бир жыл', + yy: '%d жыл', + }, + dayOfMonthOrdinalParse: /\d{1,2}-(чи|чы|чү|чу)/, + ordinal: function (number) { + var a = number % 10, + b = number >= 100 ? 100 : null; + return number + (suffixes$2[number] || suffixes$2[a] || suffixes$2[b]); + }, + week: { + dow: 1, // Monday is the first day of the week. + doy: 7, // The week that contains Jan 7th is the first week of the year. + }, + }); + + //! moment.js locale configuration + + function processRelativeTime$6(number, withoutSuffix, key, isFuture) { + var format = { + m: ['eng Minutt', 'enger Minutt'], + h: ['eng Stonn', 'enger Stonn'], + d: ['een Dag', 'engem Dag'], + M: ['ee Mount', 'engem Mount'], + y: ['ee Joer', 'engem Joer'], + }; + return withoutSuffix ? format[key][0] : format[key][1]; + } + function processFutureTime(string) { + var number = string.substr(0, string.indexOf(' ')); + if (eifelerRegelAppliesToNumber(number)) { + return 'a ' + string; + } + return 'an ' + string; + } + function processPastTime(string) { + var number = string.substr(0, string.indexOf(' ')); + if (eifelerRegelAppliesToNumber(number)) { + return 'viru ' + string; + } + return 'virun ' + string; + } + /** + * Returns true if the word before the given number loses the '-n' ending. + * e.g. 'an 10 Deeg' but 'a 5 Deeg' + * + * @param number {integer} + * @returns {boolean} + */ + function eifelerRegelAppliesToNumber(number) { + number = parseInt(number, 10); + if (isNaN(number)) { + return false; + } + if (number < 0) { + // Negative Number --> always true + return true; + } else if (number < 10) { + // Only 1 digit + if (4 <= number && number <= 7) { + return true; + } + return false; + } else if (number < 100) { + // 2 digits + var lastDigit = number % 10, + firstDigit = number / 10; + if (lastDigit === 0) { + return eifelerRegelAppliesToNumber(firstDigit); + } + return eifelerRegelAppliesToNumber(lastDigit); + } else if (number < 10000) { + // 3 or 4 digits --> recursively check first digit + while (number >= 10) { + number = number / 10; + } + return eifelerRegelAppliesToNumber(number); + } else { + // Anything larger than 4 digits: recursively check first n-3 digits + number = number / 1000; + return eifelerRegelAppliesToNumber(number); + } + } + + hooks.defineLocale('lb', { + months: 'Januar_Februar_Mäerz_Abrëll_Mee_Juni_Juli_August_September_Oktober_November_Dezember'.split( + '_' + ), + monthsShort: 'Jan._Febr._Mrz._Abr._Mee_Jun._Jul._Aug._Sept._Okt._Nov._Dez.'.split( + '_' + ), + monthsParseExact: true, + weekdays: 'Sonndeg_Méindeg_Dënschdeg_Mëttwoch_Donneschdeg_Freideg_Samschdeg'.split( + '_' + ), + weekdaysShort: 'So._Mé._Dë._Më._Do._Fr._Sa.'.split('_'), + weekdaysMin: 'So_Mé_Dë_Më_Do_Fr_Sa'.split('_'), + weekdaysParseExact: true, + longDateFormat: { + LT: 'H:mm [Auer]', + LTS: 'H:mm:ss [Auer]', + L: 'DD.MM.YYYY', + LL: 'D. MMMM YYYY', + LLL: 'D. MMMM YYYY H:mm [Auer]', + LLLL: 'dddd, D. MMMM YYYY H:mm [Auer]', + }, + calendar: { + sameDay: '[Haut um] LT', + sameElse: 'L', + nextDay: '[Muer um] LT', + nextWeek: 'dddd [um] LT', + lastDay: '[Gëschter um] LT', + lastWeek: function () { + // Different date string for 'Dënschdeg' (Tuesday) and 'Donneschdeg' (Thursday) due to phonological rule + switch (this.day()) { + case 2: + case 4: + return '[Leschten] dddd [um] LT'; + default: + return '[Leschte] dddd [um] LT'; + } + }, + }, + relativeTime: { + future: processFutureTime, + past: processPastTime, + s: 'e puer Sekonnen', + ss: '%d Sekonnen', + m: processRelativeTime$6, + mm: '%d Minutten', + h: processRelativeTime$6, + hh: '%d Stonnen', + d: processRelativeTime$6, + dd: '%d Deeg', + M: processRelativeTime$6, + MM: '%d Méint', + y: processRelativeTime$6, + yy: '%d Joer', + }, + dayOfMonthOrdinalParse: /\d{1,2}\./, + ordinal: '%d.', + week: { + dow: 1, // Monday is the first day of the week. + doy: 4, // The week that contains Jan 4th is the first week of the year. + }, + }); + + //! moment.js locale configuration + + hooks.defineLocale('lo', { + months: 'ມັງກອນ_ກຸມພາ_ມີນາ_ເມສາ_ພຶດສະພາ_ມິຖຸນາ_ກໍລະກົດ_ສິງຫາ_ກັນຍາ_ຕຸລາ_ພະຈິກ_ທັນວາ'.split( + '_' + ), + monthsShort: 'ມັງກອນ_ກຸມພາ_ມີນາ_ເມສາ_ພຶດສະພາ_ມິຖຸນາ_ກໍລະກົດ_ສິງຫາ_ກັນຍາ_ຕຸລາ_ພະຈິກ_ທັນວາ'.split( + '_' + ), + weekdays: 'ອາທິດ_ຈັນ_ອັງຄານ_ພຸດ_ພະຫັດ_ສຸກ_ເສົາ'.split('_'), + weekdaysShort: 'ທິດ_ຈັນ_ອັງຄານ_ພຸດ_ພະຫັດ_ສຸກ_ເສົາ'.split('_'), + weekdaysMin: 'ທ_ຈ_ອຄ_ພ_ພຫ_ສກ_ສ'.split('_'), + weekdaysParseExact: true, + longDateFormat: { + LT: 'HH:mm', + LTS: 'HH:mm:ss', + L: 'DD/MM/YYYY', + LL: 'D MMMM YYYY', + LLL: 'D MMMM YYYY HH:mm', + LLLL: 'ວັນdddd D MMMM YYYY HH:mm', + }, + meridiemParse: /ຕອນເຊົ້າ|ຕອນແລງ/, + isPM: function (input) { + return input === 'ຕອນແລງ'; + }, + meridiem: function (hour, minute, isLower) { + if (hour < 12) { + return 'ຕອນເຊົ້າ'; + } else { + return 'ຕອນແລງ'; + } + }, + calendar: { + sameDay: '[ມື້ນີ້ເວລາ] LT', + nextDay: '[ມື້ອື່ນເວລາ] LT', + nextWeek: '[ວັນ]dddd[ໜ້າເວລາ] LT', + lastDay: '[ມື້ວານນີ້ເວລາ] LT', + lastWeek: '[ວັນ]dddd[ແລ້ວນີ້ເວລາ] LT', + sameElse: 'L', + }, + relativeTime: { + future: 'ອີກ %s', + past: '%sຜ່ານມາ', + s: 'ບໍ່ເທົ່າໃດວິນາທີ', + ss: '%d ວິນາທີ', + m: '1 ນາທີ', + mm: '%d ນາທີ', + h: '1 ຊົ່ວໂມງ', + hh: '%d ຊົ່ວໂມງ', + d: '1 ມື້', + dd: '%d ມື້', + M: '1 ເດືອນ', + MM: '%d ເດືອນ', + y: '1 ປີ', + yy: '%d ປີ', + }, + dayOfMonthOrdinalParse: /(ທີ່)\d{1,2}/, + ordinal: function (number) { + return 'ທີ່' + number; + }, + }); + + //! moment.js locale configuration + + var units = { + ss: 'sekundė_sekundžių_sekundes', + m: 'minutė_minutės_minutę', + mm: 'minutės_minučių_minutes', + h: 'valanda_valandos_valandą', + hh: 'valandos_valandų_valandas', + d: 'diena_dienos_dieną', + dd: 'dienos_dienų_dienas', + M: 'mėnuo_mėnesio_mėnesį', + MM: 'mėnesiai_mėnesių_mėnesius', + y: 'metai_metų_metus', + yy: 'metai_metų_metus', + }; + function translateSeconds(number, withoutSuffix, key, isFuture) { + if (withoutSuffix) { + return 'kelios sekundės'; + } else { + return isFuture ? 'kelių sekundžių' : 'kelias sekundes'; + } + } + function translateSingular(number, withoutSuffix, key, isFuture) { + return withoutSuffix + ? forms(key)[0] + : isFuture + ? forms(key)[1] + : forms(key)[2]; + } + function special(number) { + return number % 10 === 0 || (number > 10 && number < 20); + } + function forms(key) { + return units[key].split('_'); + } + function translate$6(number, withoutSuffix, key, isFuture) { + var result = number + ' '; + if (number === 1) { + return ( + result + translateSingular(number, withoutSuffix, key[0], isFuture) + ); + } else if (withoutSuffix) { + return result + (special(number) ? forms(key)[1] : forms(key)[0]); + } else { + if (isFuture) { + return result + forms(key)[1]; + } else { + return result + (special(number) ? forms(key)[1] : forms(key)[2]); + } + } + } + hooks.defineLocale('lt', { + months: { + format: 'sausio_vasario_kovo_balandžio_gegužės_birželio_liepos_rugpjūčio_rugsėjo_spalio_lapkričio_gruodžio'.split( + '_' + ), + standalone: 'sausis_vasaris_kovas_balandis_gegužė_birželis_liepa_rugpjūtis_rugsėjis_spalis_lapkritis_gruodis'.split( + '_' + ), + isFormat: /D[oD]?(\[[^\[\]]*\]|\s)+MMMM?|MMMM?(\[[^\[\]]*\]|\s)+D[oD]?/, + }, + monthsShort: 'sau_vas_kov_bal_geg_bir_lie_rgp_rgs_spa_lap_grd'.split('_'), + weekdays: { + format: 'sekmadienį_pirmadienį_antradienį_trečiadienį_ketvirtadienį_penktadienį_šeštadienį'.split( + '_' + ), + standalone: 'sekmadienis_pirmadienis_antradienis_trečiadienis_ketvirtadienis_penktadienis_šeštadienis'.split( + '_' + ), + isFormat: /dddd HH:mm/, + }, + weekdaysShort: 'Sek_Pir_Ant_Tre_Ket_Pen_Šeš'.split('_'), + weekdaysMin: 'S_P_A_T_K_Pn_Š'.split('_'), + weekdaysParseExact: true, + longDateFormat: { + LT: 'HH:mm', + LTS: 'HH:mm:ss', + L: 'YYYY-MM-DD', + LL: 'YYYY [m.] MMMM D [d.]', + LLL: 'YYYY [m.] MMMM D [d.], HH:mm [val.]', + LLLL: 'YYYY [m.] MMMM D [d.], dddd, HH:mm [val.]', + l: 'YYYY-MM-DD', + ll: 'YYYY [m.] MMMM D [d.]', + lll: 'YYYY [m.] MMMM D [d.], HH:mm [val.]', + llll: 'YYYY [m.] MMMM D [d.], ddd, HH:mm [val.]', + }, + calendar: { + sameDay: '[Šiandien] LT', + nextDay: '[Rytoj] LT', + nextWeek: 'dddd LT', + lastDay: '[Vakar] LT', + lastWeek: '[Praėjusį] dddd LT', + sameElse: 'L', + }, + relativeTime: { + future: 'po %s', + past: 'prieš %s', + s: translateSeconds, + ss: translate$6, + m: translateSingular, + mm: translate$6, + h: translateSingular, + hh: translate$6, + d: translateSingular, + dd: translate$6, + M: translateSingular, + MM: translate$6, + y: translateSingular, + yy: translate$6, + }, + dayOfMonthOrdinalParse: /\d{1,2}-oji/, + ordinal: function (number) { + return number + '-oji'; + }, + week: { + dow: 1, // Monday is the first day of the week. + doy: 4, // The week that contains Jan 4th is the first week of the year. + }, + }); + + //! moment.js locale configuration + + var units$1 = { + ss: 'sekundes_sekundēm_sekunde_sekundes'.split('_'), + m: 'minūtes_minūtēm_minūte_minūtes'.split('_'), + mm: 'minūtes_minūtēm_minūte_minūtes'.split('_'), + h: 'stundas_stundām_stunda_stundas'.split('_'), + hh: 'stundas_stundām_stunda_stundas'.split('_'), + d: 'dienas_dienām_diena_dienas'.split('_'), + dd: 'dienas_dienām_diena_dienas'.split('_'), + M: 'mēneša_mēnešiem_mēnesis_mēneši'.split('_'), + MM: 'mēneša_mēnešiem_mēnesis_mēneši'.split('_'), + y: 'gada_gadiem_gads_gadi'.split('_'), + yy: 'gada_gadiem_gads_gadi'.split('_'), + }; + /** + * @param withoutSuffix boolean true = a length of time; false = before/after a period of time. + */ + function format$1(forms, number, withoutSuffix) { + if (withoutSuffix) { + // E.g. "21 minūte", "3 minūtes". + return number % 10 === 1 && number % 100 !== 11 ? forms[2] : forms[3]; + } else { + // E.g. "21 minūtes" as in "pēc 21 minūtes". + // E.g. "3 minūtēm" as in "pēc 3 minūtēm". + return number % 10 === 1 && number % 100 !== 11 ? forms[0] : forms[1]; + } + } + function relativeTimeWithPlural$1(number, withoutSuffix, key) { + return number + ' ' + format$1(units$1[key], number, withoutSuffix); + } + function relativeTimeWithSingular(number, withoutSuffix, key) { + return format$1(units$1[key], number, withoutSuffix); + } + function relativeSeconds(number, withoutSuffix) { + return withoutSuffix ? 'dažas sekundes' : 'dažām sekundēm'; + } + + hooks.defineLocale('lv', { + months: 'janvāris_februāris_marts_aprīlis_maijs_jūnijs_jūlijs_augusts_septembris_oktobris_novembris_decembris'.split( + '_' + ), + monthsShort: 'jan_feb_mar_apr_mai_jūn_jūl_aug_sep_okt_nov_dec'.split('_'), + weekdays: 'svētdiena_pirmdiena_otrdiena_trešdiena_ceturtdiena_piektdiena_sestdiena'.split( + '_' + ), + weekdaysShort: 'Sv_P_O_T_C_Pk_S'.split('_'), + weekdaysMin: 'Sv_P_O_T_C_Pk_S'.split('_'), + weekdaysParseExact: true, + longDateFormat: { + LT: 'HH:mm', + LTS: 'HH:mm:ss', + L: 'DD.MM.YYYY.', + LL: 'YYYY. [gada] D. MMMM', + LLL: 'YYYY. [gada] D. MMMM, HH:mm', + LLLL: 'YYYY. [gada] D. MMMM, dddd, HH:mm', + }, + calendar: { + sameDay: '[Šodien pulksten] LT', + nextDay: '[Rīt pulksten] LT', + nextWeek: 'dddd [pulksten] LT', + lastDay: '[Vakar pulksten] LT', + lastWeek: '[Pagājušā] dddd [pulksten] LT', + sameElse: 'L', + }, + relativeTime: { + future: 'pēc %s', + past: 'pirms %s', + s: relativeSeconds, + ss: relativeTimeWithPlural$1, + m: relativeTimeWithSingular, + mm: relativeTimeWithPlural$1, + h: relativeTimeWithSingular, + hh: relativeTimeWithPlural$1, + d: relativeTimeWithSingular, + dd: relativeTimeWithPlural$1, + M: relativeTimeWithSingular, + MM: relativeTimeWithPlural$1, + y: relativeTimeWithSingular, + yy: relativeTimeWithPlural$1, + }, + dayOfMonthOrdinalParse: /\d{1,2}\./, + ordinal: '%d.', + week: { + dow: 1, // Monday is the first day of the week. + doy: 4, // The week that contains Jan 4th is the first week of the year. + }, + }); + + //! moment.js locale configuration + + var translator = { + words: { + //Different grammatical cases + ss: ['sekund', 'sekunda', 'sekundi'], + m: ['jedan minut', 'jednog minuta'], + mm: ['minut', 'minuta', 'minuta'], + h: ['jedan sat', 'jednog sata'], + hh: ['sat', 'sata', 'sati'], + dd: ['dan', 'dana', 'dana'], + MM: ['mjesec', 'mjeseca', 'mjeseci'], + yy: ['godina', 'godine', 'godina'], + }, + correctGrammaticalCase: function (number, wordKey) { + return number === 1 + ? wordKey[0] + : number >= 2 && number <= 4 + ? wordKey[1] + : wordKey[2]; + }, + translate: function (number, withoutSuffix, key) { + var wordKey = translator.words[key]; + if (key.length === 1) { + return withoutSuffix ? wordKey[0] : wordKey[1]; + } else { + return ( + number + + ' ' + + translator.correctGrammaticalCase(number, wordKey) + ); + } + }, + }; + + hooks.defineLocale('me', { + months: 'januar_februar_mart_april_maj_jun_jul_avgust_septembar_oktobar_novembar_decembar'.split( + '_' + ), + monthsShort: 'jan._feb._mar._apr._maj_jun_jul_avg._sep._okt._nov._dec.'.split( + '_' + ), + monthsParseExact: true, + weekdays: 'nedjelja_ponedjeljak_utorak_srijeda_četvrtak_petak_subota'.split( + '_' + ), + weekdaysShort: 'ned._pon._uto._sri._čet._pet._sub.'.split('_'), + weekdaysMin: 'ne_po_ut_sr_če_pe_su'.split('_'), + weekdaysParseExact: true, + longDateFormat: { + LT: 'H:mm', + LTS: 'H:mm:ss', + L: 'DD.MM.YYYY', + LL: 'D. MMMM YYYY', + LLL: 'D. MMMM YYYY H:mm', + LLLL: 'dddd, D. MMMM YYYY H:mm', + }, + calendar: { + sameDay: '[danas u] LT', + nextDay: '[sjutra u] LT', + + nextWeek: function () { + switch (this.day()) { + case 0: + return '[u] [nedjelju] [u] LT'; + case 3: + return '[u] [srijedu] [u] LT'; + case 6: + return '[u] [subotu] [u] LT'; + case 1: + case 2: + case 4: + case 5: + return '[u] dddd [u] LT'; + } + }, + lastDay: '[juče u] LT', + lastWeek: function () { + var lastWeekDays = [ + '[prošle] [nedjelje] [u] LT', + '[prošlog] [ponedjeljka] [u] LT', + '[prošlog] [utorka] [u] LT', + '[prošle] [srijede] [u] LT', + '[prošlog] [četvrtka] [u] LT', + '[prošlog] [petka] [u] LT', + '[prošle] [subote] [u] LT', + ]; + return lastWeekDays[this.day()]; + }, + sameElse: 'L', + }, + relativeTime: { + future: 'za %s', + past: 'prije %s', + s: 'nekoliko sekundi', + ss: translator.translate, + m: translator.translate, + mm: translator.translate, + h: translator.translate, + hh: translator.translate, + d: 'dan', + dd: translator.translate, + M: 'mjesec', + MM: translator.translate, + y: 'godinu', + yy: translator.translate, + }, + dayOfMonthOrdinalParse: /\d{1,2}\./, + ordinal: '%d.', + week: { + dow: 1, // Monday is the first day of the week. + doy: 7, // The week that contains Jan 7th is the first week of the year. + }, + }); + + //! moment.js locale configuration + + hooks.defineLocale('mi', { + months: 'Kohi-tāte_Hui-tanguru_Poutū-te-rangi_Paenga-whāwhā_Haratua_Pipiri_Hōngoingoi_Here-turi-kōkā_Mahuru_Whiringa-ā-nuku_Whiringa-ā-rangi_Hakihea'.split( + '_' + ), + monthsShort: 'Kohi_Hui_Pou_Pae_Hara_Pipi_Hōngoi_Here_Mahu_Whi-nu_Whi-ra_Haki'.split( + '_' + ), + monthsRegex: /(?:['a-z\u0101\u014D\u016B]+\-?){1,3}/i, + monthsStrictRegex: /(?:['a-z\u0101\u014D\u016B]+\-?){1,3}/i, + monthsShortRegex: /(?:['a-z\u0101\u014D\u016B]+\-?){1,3}/i, + monthsShortStrictRegex: /(?:['a-z\u0101\u014D\u016B]+\-?){1,2}/i, + weekdays: 'Rātapu_Mane_Tūrei_Wenerei_Tāite_Paraire_Hātarei'.split('_'), + weekdaysShort: 'Ta_Ma_Tū_We_Tāi_Pa_Hā'.split('_'), + weekdaysMin: 'Ta_Ma_Tū_We_Tāi_Pa_Hā'.split('_'), + longDateFormat: { + LT: 'HH:mm', + LTS: 'HH:mm:ss', + L: 'DD/MM/YYYY', + LL: 'D MMMM YYYY', + LLL: 'D MMMM YYYY [i] HH:mm', + LLLL: 'dddd, D MMMM YYYY [i] HH:mm', + }, + calendar: { + sameDay: '[i teie mahana, i] LT', + nextDay: '[apopo i] LT', + nextWeek: 'dddd [i] LT', + lastDay: '[inanahi i] LT', + lastWeek: 'dddd [whakamutunga i] LT', + sameElse: 'L', + }, + relativeTime: { + future: 'i roto i %s', + past: '%s i mua', + s: 'te hēkona ruarua', + ss: '%d hēkona', + m: 'he meneti', + mm: '%d meneti', + h: 'te haora', + hh: '%d haora', + d: 'he ra', + dd: '%d ra', + M: 'he marama', + MM: '%d marama', + y: 'he tau', + yy: '%d tau', + }, + dayOfMonthOrdinalParse: /\d{1,2}º/, + ordinal: '%dº', + week: { + dow: 1, // Monday is the first day of the week. + doy: 4, // The week that contains Jan 4th is the first week of the year. + }, + }); + + //! moment.js locale configuration + + hooks.defineLocale('mk', { + months: 'јануари_февруари_март_април_мај_јуни_јули_август_септември_октомври_ноември_декември'.split( + '_' + ), + monthsShort: 'јан_фев_мар_апр_мај_јун_јул_авг_сеп_окт_ное_дек'.split('_'), + weekdays: 'недела_понеделник_вторник_среда_четврток_петок_сабота'.split( + '_' + ), + weekdaysShort: 'нед_пон_вто_сре_чет_пет_саб'.split('_'), + weekdaysMin: 'нe_пo_вт_ср_че_пе_сa'.split('_'), + longDateFormat: { + LT: 'H:mm', + LTS: 'H:mm:ss', + L: 'D.MM.YYYY', + LL: 'D MMMM YYYY', + LLL: 'D MMMM YYYY H:mm', + LLLL: 'dddd, D MMMM YYYY H:mm', + }, + calendar: { + sameDay: '[Денес во] LT', + nextDay: '[Утре во] LT', + nextWeek: '[Во] dddd [во] LT', + lastDay: '[Вчера во] LT', + lastWeek: function () { + switch (this.day()) { + case 0: + case 3: + case 6: + return '[Изминатата] dddd [во] LT'; + case 1: + case 2: + case 4: + case 5: + return '[Изминатиот] dddd [во] LT'; + } + }, + sameElse: 'L', + }, + relativeTime: { + future: 'за %s', + past: 'пред %s', + s: 'неколку секунди', + ss: '%d секунди', + m: 'една минута', + mm: '%d минути', + h: 'еден час', + hh: '%d часа', + d: 'еден ден', + dd: '%d дена', + M: 'еден месец', + MM: '%d месеци', + y: 'една година', + yy: '%d години', + }, + dayOfMonthOrdinalParse: /\d{1,2}-(ев|ен|ти|ви|ри|ми)/, + ordinal: function (number) { + var lastDigit = number % 10, + last2Digits = number % 100; + if (number === 0) { + return number + '-ев'; + } else if (last2Digits === 0) { + return number + '-ен'; + } else if (last2Digits > 10 && last2Digits < 20) { + return number + '-ти'; + } else if (lastDigit === 1) { + return number + '-ви'; + } else if (lastDigit === 2) { + return number + '-ри'; + } else if (lastDigit === 7 || lastDigit === 8) { + return number + '-ми'; + } else { + return number + '-ти'; + } + }, + week: { + dow: 1, // Monday is the first day of the week. + doy: 7, // The week that contains Jan 7th is the first week of the year. + }, + }); + + //! moment.js locale configuration + + hooks.defineLocale('ml', { + months: 'ജനുവരി_ഫെബ്രുവരി_മാർച്ച്_ഏപ്രിൽ_മേയ്_ജൂൺ_ജൂലൈ_ഓഗസ്റ്റ്_സെപ്റ്റംബർ_ഒക്ടോബർ_നവംബർ_ഡിസംബർ'.split( + '_' + ), + monthsShort: 'ജനു._ഫെബ്രു._മാർ._ഏപ്രി._മേയ്_ജൂൺ_ജൂലൈ._ഓഗ._സെപ്റ്റ._ഒക്ടോ._നവം._ഡിസം.'.split( + '_' + ), + monthsParseExact: true, + weekdays: 'ഞായറാഴ്ച_തിങ്കളാഴ്ച_ചൊവ്വാഴ്ച_ബുധനാഴ്ച_വ്യാഴാഴ്ച_വെള്ളിയാഴ്ച_ശനിയാഴ്ച'.split( + '_' + ), + weekdaysShort: 'ഞായർ_തിങ്കൾ_ചൊവ്വ_ബുധൻ_വ്യാഴം_വെള്ളി_ശനി'.split('_'), + weekdaysMin: 'ഞാ_തി_ചൊ_ബു_വ്യാ_വെ_ശ'.split('_'), + longDateFormat: { + LT: 'A h:mm -നു', + LTS: 'A h:mm:ss -നു', + L: 'DD/MM/YYYY', + LL: 'D MMMM YYYY', + LLL: 'D MMMM YYYY, A h:mm -നു', + LLLL: 'dddd, D MMMM YYYY, A h:mm -നു', + }, + calendar: { + sameDay: '[ഇന്ന്] LT', + nextDay: '[നാളെ] LT', + nextWeek: 'dddd, LT', + lastDay: '[ഇന്നലെ] LT', + lastWeek: '[കഴിഞ്ഞ] dddd, LT', + sameElse: 'L', + }, + relativeTime: { + future: '%s കഴിഞ്ഞ്', + past: '%s മുൻപ്', + s: 'അൽപ നിമിഷങ്ങൾ', + ss: '%d സെക്കൻഡ്', + m: 'ഒരു മിനിറ്റ്', + mm: '%d മിനിറ്റ്', + h: 'ഒരു മണിക്കൂർ', + hh: '%d മണിക്കൂർ', + d: 'ഒരു ദിവസം', + dd: '%d ദിവസം', + M: 'ഒരു മാസം', + MM: '%d മാസം', + y: 'ഒരു വർഷം', + yy: '%d വർഷം', + }, + meridiemParse: /രാത്രി|രാവിലെ|ഉച്ച കഴിഞ്ഞ്|വൈകുന്നേരം|രാത്രി/i, + meridiemHour: function (hour, meridiem) { + if (hour === 12) { + hour = 0; + } + if ( + (meridiem === 'രാത്രി' && hour >= 4) || + meridiem === 'ഉച്ച കഴിഞ്ഞ്' || + meridiem === 'വൈകുന്നേരം' + ) { + return hour + 12; + } else { + return hour; + } + }, + meridiem: function (hour, minute, isLower) { + if (hour < 4) { + return 'രാത്രി'; + } else if (hour < 12) { + return 'രാവിലെ'; + } else if (hour < 17) { + return 'ഉച്ച കഴിഞ്ഞ്'; + } else if (hour < 20) { + return 'വൈകുന്നേരം'; + } else { + return 'രാത്രി'; + } + }, + }); + + //! moment.js locale configuration + + function translate$7(number, withoutSuffix, key, isFuture) { + switch (key) { + case 's': + return withoutSuffix ? 'хэдхэн секунд' : 'хэдхэн секундын'; + case 'ss': + return number + (withoutSuffix ? ' секунд' : ' секундын'); + case 'm': + case 'mm': + return number + (withoutSuffix ? ' минут' : ' минутын'); + case 'h': + case 'hh': + return number + (withoutSuffix ? ' цаг' : ' цагийн'); + case 'd': + case 'dd': + return number + (withoutSuffix ? ' өдөр' : ' өдрийн'); + case 'M': + case 'MM': + return number + (withoutSuffix ? ' сар' : ' сарын'); + case 'y': + case 'yy': + return number + (withoutSuffix ? ' жил' : ' жилийн'); + default: + return number; + } + } + + hooks.defineLocale('mn', { + months: 'Нэгдүгээр сар_Хоёрдугаар сар_Гуравдугаар сар_Дөрөвдүгээр сар_Тавдугаар сар_Зургадугаар сар_Долдугаар сар_Наймдугаар сар_Есдүгээр сар_Аравдугаар сар_Арван нэгдүгээр сар_Арван хоёрдугаар сар'.split( + '_' + ), + monthsShort: '1 сар_2 сар_3 сар_4 сар_5 сар_6 сар_7 сар_8 сар_9 сар_10 сар_11 сар_12 сар'.split( + '_' + ), + monthsParseExact: true, + weekdays: 'Ням_Даваа_Мягмар_Лхагва_Пүрэв_Баасан_Бямба'.split('_'), + weekdaysShort: 'Ням_Дав_Мяг_Лха_Пүр_Баа_Бям'.split('_'), + weekdaysMin: 'Ня_Да_Мя_Лх_Пү_Ба_Бя'.split('_'), + weekdaysParseExact: true, + longDateFormat: { + LT: 'HH:mm', + LTS: 'HH:mm:ss', + L: 'YYYY-MM-DD', + LL: 'YYYY оны MMMMын D', + LLL: 'YYYY оны MMMMын D HH:mm', + LLLL: 'dddd, YYYY оны MMMMын D HH:mm', + }, + meridiemParse: /ҮӨ|ҮХ/i, + isPM: function (input) { + return input === 'ҮХ'; + }, + meridiem: function (hour, minute, isLower) { + if (hour < 12) { + return 'ҮӨ'; + } else { + return 'ҮХ'; + } + }, + calendar: { + sameDay: '[Өнөөдөр] LT', + nextDay: '[Маргааш] LT', + nextWeek: '[Ирэх] dddd LT', + lastDay: '[Өчигдөр] LT', + lastWeek: '[Өнгөрсөн] dddd LT', + sameElse: 'L', + }, + relativeTime: { + future: '%s дараа', + past: '%s өмнө', + s: translate$7, + ss: translate$7, + m: translate$7, + mm: translate$7, + h: translate$7, + hh: translate$7, + d: translate$7, + dd: translate$7, + M: translate$7, + MM: translate$7, + y: translate$7, + yy: translate$7, + }, + dayOfMonthOrdinalParse: /\d{1,2} өдөр/, + ordinal: function (number, period) { + switch (period) { + case 'd': + case 'D': + case 'DDD': + return number + ' өдөр'; + default: + return number; + } + }, + }); + + //! moment.js locale configuration + + var symbolMap$b = { + '1': '१', + '2': '२', + '3': '३', + '4': '४', + '5': '५', + '6': '६', + '7': '७', + '8': '८', + '9': '९', + '0': '०', + }, + numberMap$a = { + '१': '1', + '२': '2', + '३': '3', + '४': '4', + '५': '5', + '६': '6', + '७': '7', + '८': '8', + '९': '9', + '०': '0', + }; + + function relativeTimeMr(number, withoutSuffix, string, isFuture) { + var output = ''; + if (withoutSuffix) { + switch (string) { + case 's': + output = 'काही सेकंद'; + break; + case 'ss': + output = '%d सेकंद'; + break; + case 'm': + output = 'एक मिनिट'; + break; + case 'mm': + output = '%d मिनिटे'; + break; + case 'h': + output = 'एक तास'; + break; + case 'hh': + output = '%d तास'; + break; + case 'd': + output = 'एक दिवस'; + break; + case 'dd': + output = '%d दिवस'; + break; + case 'M': + output = 'एक महिना'; + break; + case 'MM': + output = '%d महिने'; + break; + case 'y': + output = 'एक वर्ष'; + break; + case 'yy': + output = '%d वर्षे'; + break; + } + } else { + switch (string) { + case 's': + output = 'काही सेकंदां'; + break; + case 'ss': + output = '%d सेकंदां'; + break; + case 'm': + output = 'एका मिनिटा'; + break; + case 'mm': + output = '%d मिनिटां'; + break; + case 'h': + output = 'एका तासा'; + break; + case 'hh': + output = '%d तासां'; + break; + case 'd': + output = 'एका दिवसा'; + break; + case 'dd': + output = '%d दिवसां'; + break; + case 'M': + output = 'एका महिन्या'; + break; + case 'MM': + output = '%d महिन्यां'; + break; + case 'y': + output = 'एका वर्षा'; + break; + case 'yy': + output = '%d वर्षां'; + break; + } + } + return output.replace(/%d/i, number); + } + + hooks.defineLocale('mr', { + months: 'जानेवारी_फेब्रुवारी_मार्च_एप्रिल_मे_जून_जुलै_ऑगस्ट_सप्टेंबर_ऑक्टोबर_नोव्हेंबर_डिसेंबर'.split( + '_' + ), + monthsShort: 'जाने._फेब्रु._मार्च._एप्रि._मे._जून._जुलै._ऑग._सप्टें._ऑक्टो._नोव्हें._डिसें.'.split( + '_' + ), + monthsParseExact: true, + weekdays: 'रविवार_सोमवार_मंगळवार_बुधवार_गुरूवार_शुक्रवार_शनिवार'.split('_'), + weekdaysShort: 'रवि_सोम_मंगळ_बुध_गुरू_शुक्र_शनि'.split('_'), + weekdaysMin: 'र_सो_मं_बु_गु_शु_श'.split('_'), + longDateFormat: { + LT: 'A h:mm वाजता', + LTS: 'A h:mm:ss वाजता', + L: 'DD/MM/YYYY', + LL: 'D MMMM YYYY', + LLL: 'D MMMM YYYY, A h:mm वाजता', + LLLL: 'dddd, D MMMM YYYY, A h:mm वाजता', + }, + calendar: { + sameDay: '[आज] LT', + nextDay: '[उद्या] LT', + nextWeek: 'dddd, LT', + lastDay: '[काल] LT', + lastWeek: '[मागील] dddd, LT', + sameElse: 'L', + }, + relativeTime: { + future: '%sमध्ये', + past: '%sपूर्वी', + s: relativeTimeMr, + ss: relativeTimeMr, + m: relativeTimeMr, + mm: relativeTimeMr, + h: relativeTimeMr, + hh: relativeTimeMr, + d: relativeTimeMr, + dd: relativeTimeMr, + M: relativeTimeMr, + MM: relativeTimeMr, + y: relativeTimeMr, + yy: relativeTimeMr, + }, + preparse: function (string) { + return string.replace(/[१२३४५६७८९०]/g, function (match) { + return numberMap$a[match]; + }); + }, + postformat: function (string) { + return string.replace(/\d/g, function (match) { + return symbolMap$b[match]; + }); + }, + meridiemParse: /पहाटे|सकाळी|दुपारी|सायंकाळी|रात्री/, + meridiemHour: function (hour, meridiem) { + if (hour === 12) { + hour = 0; + } + if (meridiem === 'पहाटे' || meridiem === 'सकाळी') { + return hour; + } else if ( + meridiem === 'दुपारी' || + meridiem === 'सायंकाळी' || + meridiem === 'रात्री' + ) { + return hour >= 12 ? hour : hour + 12; + } + }, + meridiem: function (hour, minute, isLower) { + if (hour >= 0 && hour < 6) { + return 'पहाटे'; + } else if (hour < 12) { + return 'सकाळी'; + } else if (hour < 17) { + return 'दुपारी'; + } else if (hour < 20) { + return 'सायंकाळी'; + } else { + return 'रात्री'; + } + }, + week: { + dow: 0, // Sunday is the first day of the week. + doy: 6, // The week that contains Jan 6th is the first week of the year. + }, + }); + + //! moment.js locale configuration + + hooks.defineLocale('ms-my', { + months: 'Januari_Februari_Mac_April_Mei_Jun_Julai_Ogos_September_Oktober_November_Disember'.split( + '_' + ), + monthsShort: 'Jan_Feb_Mac_Apr_Mei_Jun_Jul_Ogs_Sep_Okt_Nov_Dis'.split('_'), + weekdays: 'Ahad_Isnin_Selasa_Rabu_Khamis_Jumaat_Sabtu'.split('_'), + weekdaysShort: 'Ahd_Isn_Sel_Rab_Kha_Jum_Sab'.split('_'), + weekdaysMin: 'Ah_Is_Sl_Rb_Km_Jm_Sb'.split('_'), + longDateFormat: { + LT: 'HH.mm', + LTS: 'HH.mm.ss', + L: 'DD/MM/YYYY', + LL: 'D MMMM YYYY', + LLL: 'D MMMM YYYY [pukul] HH.mm', + LLLL: 'dddd, D MMMM YYYY [pukul] HH.mm', + }, + meridiemParse: /pagi|tengahari|petang|malam/, + meridiemHour: function (hour, meridiem) { + if (hour === 12) { + hour = 0; + } + if (meridiem === 'pagi') { + return hour; + } else if (meridiem === 'tengahari') { + return hour >= 11 ? hour : hour + 12; + } else if (meridiem === 'petang' || meridiem === 'malam') { + return hour + 12; + } + }, + meridiem: function (hours, minutes, isLower) { + if (hours < 11) { + return 'pagi'; + } else if (hours < 15) { + return 'tengahari'; + } else if (hours < 19) { + return 'petang'; + } else { + return 'malam'; + } + }, + calendar: { + sameDay: '[Hari ini pukul] LT', + nextDay: '[Esok pukul] LT', + nextWeek: 'dddd [pukul] LT', + lastDay: '[Kelmarin pukul] LT', + lastWeek: 'dddd [lepas pukul] LT', + sameElse: 'L', + }, + relativeTime: { + future: 'dalam %s', + past: '%s yang lepas', + s: 'beberapa saat', + ss: '%d saat', + m: 'seminit', + mm: '%d minit', + h: 'sejam', + hh: '%d jam', + d: 'sehari', + dd: '%d hari', + M: 'sebulan', + MM: '%d bulan', + y: 'setahun', + yy: '%d tahun', + }, + week: { + dow: 1, // Monday is the first day of the week. + doy: 7, // The week that contains Jan 7th is the first week of the year. + }, + }); + + //! moment.js locale configuration + + hooks.defineLocale('ms', { + months: 'Januari_Februari_Mac_April_Mei_Jun_Julai_Ogos_September_Oktober_November_Disember'.split( + '_' + ), + monthsShort: 'Jan_Feb_Mac_Apr_Mei_Jun_Jul_Ogs_Sep_Okt_Nov_Dis'.split('_'), + weekdays: 'Ahad_Isnin_Selasa_Rabu_Khamis_Jumaat_Sabtu'.split('_'), + weekdaysShort: 'Ahd_Isn_Sel_Rab_Kha_Jum_Sab'.split('_'), + weekdaysMin: 'Ah_Is_Sl_Rb_Km_Jm_Sb'.split('_'), + longDateFormat: { + LT: 'HH.mm', + LTS: 'HH.mm.ss', + L: 'DD/MM/YYYY', + LL: 'D MMMM YYYY', + LLL: 'D MMMM YYYY [pukul] HH.mm', + LLLL: 'dddd, D MMMM YYYY [pukul] HH.mm', + }, + meridiemParse: /pagi|tengahari|petang|malam/, + meridiemHour: function (hour, meridiem) { + if (hour === 12) { + hour = 0; + } + if (meridiem === 'pagi') { + return hour; + } else if (meridiem === 'tengahari') { + return hour >= 11 ? hour : hour + 12; + } else if (meridiem === 'petang' || meridiem === 'malam') { + return hour + 12; + } + }, + meridiem: function (hours, minutes, isLower) { + if (hours < 11) { + return 'pagi'; + } else if (hours < 15) { + return 'tengahari'; + } else if (hours < 19) { + return 'petang'; + } else { + return 'malam'; + } + }, + calendar: { + sameDay: '[Hari ini pukul] LT', + nextDay: '[Esok pukul] LT', + nextWeek: 'dddd [pukul] LT', + lastDay: '[Kelmarin pukul] LT', + lastWeek: 'dddd [lepas pukul] LT', + sameElse: 'L', + }, + relativeTime: { + future: 'dalam %s', + past: '%s yang lepas', + s: 'beberapa saat', + ss: '%d saat', + m: 'seminit', + mm: '%d minit', + h: 'sejam', + hh: '%d jam', + d: 'sehari', + dd: '%d hari', + M: 'sebulan', + MM: '%d bulan', + y: 'setahun', + yy: '%d tahun', + }, + week: { + dow: 1, // Monday is the first day of the week. + doy: 7, // The week that contains Jan 7th is the first week of the year. + }, + }); + + //! moment.js locale configuration + + hooks.defineLocale('mt', { + months: 'Jannar_Frar_Marzu_April_Mejju_Ġunju_Lulju_Awwissu_Settembru_Ottubru_Novembru_Diċembru'.split( + '_' + ), + monthsShort: 'Jan_Fra_Mar_Apr_Mej_Ġun_Lul_Aww_Set_Ott_Nov_Diċ'.split('_'), + weekdays: 'Il-Ħadd_It-Tnejn_It-Tlieta_L-Erbgħa_Il-Ħamis_Il-Ġimgħa_Is-Sibt'.split( + '_' + ), + weekdaysShort: 'Ħad_Tne_Tli_Erb_Ħam_Ġim_Sib'.split('_'), + weekdaysMin: 'Ħa_Tn_Tl_Er_Ħa_Ġi_Si'.split('_'), + longDateFormat: { + LT: 'HH:mm', + LTS: 'HH:mm:ss', + L: 'DD/MM/YYYY', + LL: 'D MMMM YYYY', + LLL: 'D MMMM YYYY HH:mm', + LLLL: 'dddd, D MMMM YYYY HH:mm', + }, + calendar: { + sameDay: '[Illum fil-]LT', + nextDay: '[Għada fil-]LT', + nextWeek: 'dddd [fil-]LT', + lastDay: '[Il-bieraħ fil-]LT', + lastWeek: 'dddd [li għadda] [fil-]LT', + sameElse: 'L', + }, + relativeTime: { + future: 'f’ %s', + past: '%s ilu', + s: 'ftit sekondi', + ss: '%d sekondi', + m: 'minuta', + mm: '%d minuti', + h: 'siegħa', + hh: '%d siegħat', + d: 'ġurnata', + dd: '%d ġranet', + M: 'xahar', + MM: '%d xhur', + y: 'sena', + yy: '%d sni', + }, + dayOfMonthOrdinalParse: /\d{1,2}º/, + ordinal: '%dº', + week: { + dow: 1, // Monday is the first day of the week. + doy: 4, // The week that contains Jan 4th is the first week of the year. + }, + }); + + //! moment.js locale configuration + + var symbolMap$c = { + '1': '၁', + '2': '၂', + '3': '၃', + '4': '၄', + '5': '၅', + '6': '၆', + '7': '၇', + '8': '၈', + '9': '၉', + '0': '၀', + }, + numberMap$b = { + '၁': '1', + '၂': '2', + '၃': '3', + '၄': '4', + '၅': '5', + '၆': '6', + '၇': '7', + '၈': '8', + '၉': '9', + '၀': '0', + }; + + hooks.defineLocale('my', { + months: 'ဇန်နဝါရီ_ဖေဖော်ဝါရီ_မတ်_ဧပြီ_မေ_ဇွန်_ဇူလိုင်_သြဂုတ်_စက်တင်ဘာ_အောက်တိုဘာ_နိုဝင်ဘာ_ဒီဇင်ဘာ'.split( + '_' + ), + monthsShort: 'ဇန်_ဖေ_မတ်_ပြီ_မေ_ဇွန်_လိုင်_သြ_စက်_အောက်_နို_ဒီ'.split('_'), + weekdays: 'တနင်္ဂနွေ_တနင်္လာ_အင်္ဂါ_ဗုဒ္ဓဟူး_ကြာသပတေး_သောကြာ_စနေ'.split( + '_' + ), + weekdaysShort: 'နွေ_လာ_ဂါ_ဟူး_ကြာ_သော_နေ'.split('_'), + weekdaysMin: 'နွေ_လာ_ဂါ_ဟူး_ကြာ_သော_နေ'.split('_'), + + longDateFormat: { + LT: 'HH:mm', + LTS: 'HH:mm:ss', + L: 'DD/MM/YYYY', + LL: 'D MMMM YYYY', + LLL: 'D MMMM YYYY HH:mm', + LLLL: 'dddd D MMMM YYYY HH:mm', + }, + calendar: { + sameDay: '[ယနေ.] LT [မှာ]', + nextDay: '[မနက်ဖြန်] LT [မှာ]', + nextWeek: 'dddd LT [မှာ]', + lastDay: '[မနေ.က] LT [မှာ]', + lastWeek: '[ပြီးခဲ့သော] dddd LT [မှာ]', + sameElse: 'L', + }, + relativeTime: { + future: 'လာမည့် %s မှာ', + past: 'လွန်ခဲ့သော %s က', + s: 'စက္ကန်.အနည်းငယ်', + ss: '%d စက္ကန့်', + m: 'တစ်မိနစ်', + mm: '%d မိနစ်', + h: 'တစ်နာရီ', + hh: '%d နာရီ', + d: 'တစ်ရက်', + dd: '%d ရက်', + M: 'တစ်လ', + MM: '%d လ', + y: 'တစ်နှစ်', + yy: '%d နှစ်', + }, + preparse: function (string) { + return string.replace(/[၁၂၃၄၅၆၇၈၉၀]/g, function (match) { + return numberMap$b[match]; + }); + }, + postformat: function (string) { + return string.replace(/\d/g, function (match) { + return symbolMap$c[match]; + }); + }, + week: { + dow: 1, // Monday is the first day of the week. + doy: 4, // The week that contains Jan 4th is the first week of the year. + }, + }); + + //! moment.js locale configuration + + hooks.defineLocale('nb', { + months: 'januar_februar_mars_april_mai_juni_juli_august_september_oktober_november_desember'.split( + '_' + ), + monthsShort: 'jan._feb._mars_apr._mai_juni_juli_aug._sep._okt._nov._des.'.split( + '_' + ), + monthsParseExact: true, + weekdays: 'søndag_mandag_tirsdag_onsdag_torsdag_fredag_lørdag'.split('_'), + weekdaysShort: 'sø._ma._ti._on._to._fr._lø.'.split('_'), + weekdaysMin: 'sø_ma_ti_on_to_fr_lø'.split('_'), + weekdaysParseExact: true, + longDateFormat: { + LT: 'HH:mm', + LTS: 'HH:mm:ss', + L: 'DD.MM.YYYY', + LL: 'D. MMMM YYYY', + LLL: 'D. MMMM YYYY [kl.] HH:mm', + LLLL: 'dddd D. MMMM YYYY [kl.] HH:mm', + }, + calendar: { + sameDay: '[i dag kl.] LT', + nextDay: '[i morgen kl.] LT', + nextWeek: 'dddd [kl.] LT', + lastDay: '[i går kl.] LT', + lastWeek: '[forrige] dddd [kl.] LT', + sameElse: 'L', + }, + relativeTime: { + future: 'om %s', + past: '%s siden', + s: 'noen sekunder', + ss: '%d sekunder', + m: 'ett minutt', + mm: '%d minutter', + h: 'en time', + hh: '%d timer', + d: 'en dag', + dd: '%d dager', + M: 'en måned', + MM: '%d måneder', + y: 'ett år', + yy: '%d år', + }, + dayOfMonthOrdinalParse: /\d{1,2}\./, + ordinal: '%d.', + week: { + dow: 1, // Monday is the first day of the week. + doy: 4, // The week that contains Jan 4th is the first week of the year. + }, + }); + + //! moment.js locale configuration + + var symbolMap$d = { + '1': '१', + '2': '२', + '3': '३', + '4': '४', + '5': '५', + '6': '६', + '7': '७', + '8': '८', + '9': '९', + '0': '०', + }, + numberMap$c = { + '१': '1', + '२': '2', + '३': '3', + '४': '4', + '५': '5', + '६': '6', + '७': '7', + '८': '8', + '९': '9', + '०': '0', + }; + + hooks.defineLocale('ne', { + months: 'जनवरी_फेब्रुवरी_मार्च_अप्रिल_मई_जुन_जुलाई_अगष्ट_सेप्टेम्बर_अक्टोबर_नोभेम्बर_डिसेम्बर'.split( + '_' + ), + monthsShort: 'जन._फेब्रु._मार्च_अप्रि._मई_जुन_जुलाई._अग._सेप्ट._अक्टो._नोभे._डिसे.'.split( + '_' + ), + monthsParseExact: true, + weekdays: 'आइतबार_सोमबार_मङ्गलबार_बुधबार_बिहिबार_शुक्रबार_शनिबार'.split( + '_' + ), + weekdaysShort: 'आइत._सोम._मङ्गल._बुध._बिहि._शुक्र._शनि.'.split('_'), + weekdaysMin: 'आ._सो._मं._बु._बि._शु._श.'.split('_'), + weekdaysParseExact: true, + longDateFormat: { + LT: 'Aको h:mm बजे', + LTS: 'Aको h:mm:ss बजे', + L: 'DD/MM/YYYY', + LL: 'D MMMM YYYY', + LLL: 'D MMMM YYYY, Aको h:mm बजे', + LLLL: 'dddd, D MMMM YYYY, Aको h:mm बजे', + }, + preparse: function (string) { + return string.replace(/[१२३४५६७८९०]/g, function (match) { + return numberMap$c[match]; + }); + }, + postformat: function (string) { + return string.replace(/\d/g, function (match) { + return symbolMap$d[match]; + }); + }, + meridiemParse: /राति|बिहान|दिउँसो|साँझ/, + meridiemHour: function (hour, meridiem) { + if (hour === 12) { + hour = 0; + } + if (meridiem === 'राति') { + return hour < 4 ? hour : hour + 12; + } else if (meridiem === 'बिहान') { + return hour; + } else if (meridiem === 'दिउँसो') { + return hour >= 10 ? hour : hour + 12; + } else if (meridiem === 'साँझ') { + return hour + 12; + } + }, + meridiem: function (hour, minute, isLower) { + if (hour < 3) { + return 'राति'; + } else if (hour < 12) { + return 'बिहान'; + } else if (hour < 16) { + return 'दिउँसो'; + } else if (hour < 20) { + return 'साँझ'; + } else { + return 'राति'; + } + }, + calendar: { + sameDay: '[आज] LT', + nextDay: '[भोलि] LT', + nextWeek: '[आउँदो] dddd[,] LT', + lastDay: '[हिजो] LT', + lastWeek: '[गएको] dddd[,] LT', + sameElse: 'L', + }, + relativeTime: { + future: '%sमा', + past: '%s अगाडि', + s: 'केही क्षण', + ss: '%d सेकेण्ड', + m: 'एक मिनेट', + mm: '%d मिनेट', + h: 'एक घण्टा', + hh: '%d घण्टा', + d: 'एक दिन', + dd: '%d दिन', + M: 'एक महिना', + MM: '%d महिना', + y: 'एक बर्ष', + yy: '%d बर्ष', + }, + week: { + dow: 0, // Sunday is the first day of the week. + doy: 6, // The week that contains Jan 6th is the first week of the year. + }, + }); + + //! moment.js locale configuration + + var monthsShortWithDots$1 = 'jan._feb._mrt._apr._mei_jun._jul._aug._sep._okt._nov._dec.'.split( + '_' + ), + monthsShortWithoutDots$1 = 'jan_feb_mrt_apr_mei_jun_jul_aug_sep_okt_nov_dec'.split( + '_' + ), + monthsParse$6 = [ + /^jan/i, + /^feb/i, + /^maart|mrt.?$/i, + /^apr/i, + /^mei$/i, + /^jun[i.]?$/i, + /^jul[i.]?$/i, + /^aug/i, + /^sep/i, + /^okt/i, + /^nov/i, + /^dec/i, + ], + monthsRegex$7 = /^(januari|februari|maart|april|mei|ju[nl]i|augustus|september|oktober|november|december|jan\.?|feb\.?|mrt\.?|apr\.?|ju[nl]\.?|aug\.?|sep\.?|okt\.?|nov\.?|dec\.?)/i; + + hooks.defineLocale('nl-be', { + months: 'januari_februari_maart_april_mei_juni_juli_augustus_september_oktober_november_december'.split( + '_' + ), + monthsShort: function (m, format) { + if (!m) { + return monthsShortWithDots$1; + } else if (/-MMM-/.test(format)) { + return monthsShortWithoutDots$1[m.month()]; + } else { + return monthsShortWithDots$1[m.month()]; + } + }, + + monthsRegex: monthsRegex$7, + monthsShortRegex: monthsRegex$7, + monthsStrictRegex: /^(januari|februari|maart|april|mei|ju[nl]i|augustus|september|oktober|november|december)/i, + monthsShortStrictRegex: /^(jan\.?|feb\.?|mrt\.?|apr\.?|mei|ju[nl]\.?|aug\.?|sep\.?|okt\.?|nov\.?|dec\.?)/i, + + monthsParse: monthsParse$6, + longMonthsParse: monthsParse$6, + shortMonthsParse: monthsParse$6, + + weekdays: 'zondag_maandag_dinsdag_woensdag_donderdag_vrijdag_zaterdag'.split( + '_' + ), + weekdaysShort: 'zo._ma._di._wo._do._vr._za.'.split('_'), + weekdaysMin: 'zo_ma_di_wo_do_vr_za'.split('_'), + weekdaysParseExact: true, + longDateFormat: { + LT: 'HH:mm', + LTS: 'HH:mm:ss', + L: 'DD/MM/YYYY', + LL: 'D MMMM YYYY', + LLL: 'D MMMM YYYY HH:mm', + LLLL: 'dddd D MMMM YYYY HH:mm', + }, + calendar: { + sameDay: '[vandaag om] LT', + nextDay: '[morgen om] LT', + nextWeek: 'dddd [om] LT', + lastDay: '[gisteren om] LT', + lastWeek: '[afgelopen] dddd [om] LT', + sameElse: 'L', + }, + relativeTime: { + future: 'over %s', + past: '%s geleden', + s: 'een paar seconden', + ss: '%d seconden', + m: 'één minuut', + mm: '%d minuten', + h: 'één uur', + hh: '%d uur', + d: 'één dag', + dd: '%d dagen', + M: 'één maand', + MM: '%d maanden', + y: 'één jaar', + yy: '%d jaar', + }, + dayOfMonthOrdinalParse: /\d{1,2}(ste|de)/, + ordinal: function (number) { + return ( + number + + (number === 1 || number === 8 || number >= 20 ? 'ste' : 'de') + ); + }, + week: { + dow: 1, // Monday is the first day of the week. + doy: 4, // The week that contains Jan 4th is the first week of the year. + }, + }); + + //! moment.js locale configuration + + var monthsShortWithDots$2 = 'jan._feb._mrt._apr._mei_jun._jul._aug._sep._okt._nov._dec.'.split( + '_' + ), + monthsShortWithoutDots$2 = 'jan_feb_mrt_apr_mei_jun_jul_aug_sep_okt_nov_dec'.split( + '_' + ), + monthsParse$7 = [ + /^jan/i, + /^feb/i, + /^maart|mrt.?$/i, + /^apr/i, + /^mei$/i, + /^jun[i.]?$/i, + /^jul[i.]?$/i, + /^aug/i, + /^sep/i, + /^okt/i, + /^nov/i, + /^dec/i, + ], + monthsRegex$8 = /^(januari|februari|maart|april|mei|ju[nl]i|augustus|september|oktober|november|december|jan\.?|feb\.?|mrt\.?|apr\.?|ju[nl]\.?|aug\.?|sep\.?|okt\.?|nov\.?|dec\.?)/i; + + hooks.defineLocale('nl', { + months: 'januari_februari_maart_april_mei_juni_juli_augustus_september_oktober_november_december'.split( + '_' + ), + monthsShort: function (m, format) { + if (!m) { + return monthsShortWithDots$2; + } else if (/-MMM-/.test(format)) { + return monthsShortWithoutDots$2[m.month()]; + } else { + return monthsShortWithDots$2[m.month()]; + } + }, + + monthsRegex: monthsRegex$8, + monthsShortRegex: monthsRegex$8, + monthsStrictRegex: /^(januari|februari|maart|april|mei|ju[nl]i|augustus|september|oktober|november|december)/i, + monthsShortStrictRegex: /^(jan\.?|feb\.?|mrt\.?|apr\.?|mei|ju[nl]\.?|aug\.?|sep\.?|okt\.?|nov\.?|dec\.?)/i, + + monthsParse: monthsParse$7, + longMonthsParse: monthsParse$7, + shortMonthsParse: monthsParse$7, + + weekdays: 'zondag_maandag_dinsdag_woensdag_donderdag_vrijdag_zaterdag'.split( + '_' + ), + weekdaysShort: 'zo._ma._di._wo._do._vr._za.'.split('_'), + weekdaysMin: 'zo_ma_di_wo_do_vr_za'.split('_'), + weekdaysParseExact: true, + longDateFormat: { + LT: 'HH:mm', + LTS: 'HH:mm:ss', + L: 'DD-MM-YYYY', + LL: 'D MMMM YYYY', + LLL: 'D MMMM YYYY HH:mm', + LLLL: 'dddd D MMMM YYYY HH:mm', + }, + calendar: { + sameDay: '[vandaag om] LT', + nextDay: '[morgen om] LT', + nextWeek: 'dddd [om] LT', + lastDay: '[gisteren om] LT', + lastWeek: '[afgelopen] dddd [om] LT', + sameElse: 'L', + }, + relativeTime: { + future: 'over %s', + past: '%s geleden', + s: 'een paar seconden', + ss: '%d seconden', + m: 'één minuut', + mm: '%d minuten', + h: 'één uur', + hh: '%d uur', + d: 'één dag', + dd: '%d dagen', + M: 'één maand', + MM: '%d maanden', + y: 'één jaar', + yy: '%d jaar', + }, + dayOfMonthOrdinalParse: /\d{1,2}(ste|de)/, + ordinal: function (number) { + return ( + number + + (number === 1 || number === 8 || number >= 20 ? 'ste' : 'de') + ); + }, + week: { + dow: 1, // Monday is the first day of the week. + doy: 4, // The week that contains Jan 4th is the first week of the year. + }, + }); + + //! moment.js locale configuration + + hooks.defineLocale('nn', { + months: 'januar_februar_mars_april_mai_juni_juli_august_september_oktober_november_desember'.split( + '_' + ), + monthsShort: 'jan._feb._mars_apr._mai_juni_juli_aug._sep._okt._nov._des.'.split( + '_' + ), + monthsParseExact: true, + weekdays: 'sundag_måndag_tysdag_onsdag_torsdag_fredag_laurdag'.split('_'), + weekdaysShort: 'su._må._ty._on._to._fr._lau.'.split('_'), + weekdaysMin: 'su_må_ty_on_to_fr_la'.split('_'), + weekdaysParseExact: true, + longDateFormat: { + LT: 'HH:mm', + LTS: 'HH:mm:ss', + L: 'DD.MM.YYYY', + LL: 'D. MMMM YYYY', + LLL: 'D. MMMM YYYY [kl.] H:mm', + LLLL: 'dddd D. MMMM YYYY [kl.] HH:mm', + }, + calendar: { + sameDay: '[I dag klokka] LT', + nextDay: '[I morgon klokka] LT', + nextWeek: 'dddd [klokka] LT', + lastDay: '[I går klokka] LT', + lastWeek: '[Føregåande] dddd [klokka] LT', + sameElse: 'L', + }, + relativeTime: { + future: 'om %s', + past: '%s sidan', + s: 'nokre sekund', + ss: '%d sekund', + m: 'eit minutt', + mm: '%d minutt', + h: 'ein time', + hh: '%d timar', + d: 'ein dag', + dd: '%d dagar', + M: 'ein månad', + MM: '%d månader', + y: 'eit år', + yy: '%d år', + }, + dayOfMonthOrdinalParse: /\d{1,2}\./, + ordinal: '%d.', + week: { + dow: 1, // Monday is the first day of the week. + doy: 4, // The week that contains Jan 4th is the first week of the year. + }, + }); + + //! moment.js locale configuration + + hooks.defineLocale('oc-lnc', { + months: { + standalone: 'genièr_febrièr_març_abril_mai_junh_julhet_agost_setembre_octòbre_novembre_decembre'.split( + '_' + ), + format: "de genièr_de febrièr_de març_d'abril_de mai_de junh_de julhet_d'agost_de setembre_d'octòbre_de novembre_de decembre".split( + '_' + ), + isFormat: /D[oD]?(\s)+MMMM/, + }, + monthsShort: 'gen._febr._març_abr._mai_junh_julh._ago._set._oct._nov._dec.'.split( + '_' + ), + monthsParseExact: true, + weekdays: 'dimenge_diluns_dimars_dimècres_dijòus_divendres_dissabte'.split( + '_' + ), + weekdaysShort: 'dg._dl._dm._dc._dj._dv._ds.'.split('_'), + weekdaysMin: 'dg_dl_dm_dc_dj_dv_ds'.split('_'), + weekdaysParseExact: true, + longDateFormat: { + LT: 'H:mm', + LTS: 'H:mm:ss', + L: 'DD/MM/YYYY', + LL: 'D MMMM [de] YYYY', + ll: 'D MMM YYYY', + LLL: 'D MMMM [de] YYYY [a] H:mm', + lll: 'D MMM YYYY, H:mm', + LLLL: 'dddd D MMMM [de] YYYY [a] H:mm', + llll: 'ddd D MMM YYYY, H:mm', + }, + calendar: { + sameDay: '[uèi a] LT', + nextDay: '[deman a] LT', + nextWeek: 'dddd [a] LT', + lastDay: '[ièr a] LT', + lastWeek: 'dddd [passat a] LT', + sameElse: 'L', + }, + relativeTime: { + future: "d'aquí %s", + past: 'fa %s', + s: 'unas segondas', + ss: '%d segondas', + m: 'una minuta', + mm: '%d minutas', + h: 'una ora', + hh: '%d oras', + d: 'un jorn', + dd: '%d jorns', + M: 'un mes', + MM: '%d meses', + y: 'un an', + yy: '%d ans', + }, + dayOfMonthOrdinalParse: /\d{1,2}(r|n|t|è|a)/, + ordinal: function (number, period) { + var output = + number === 1 + ? 'r' + : number === 2 + ? 'n' + : number === 3 + ? 'r' + : number === 4 + ? 't' + : 'è'; + if (period === 'w' || period === 'W') { + output = 'a'; + } + return number + output; + }, + week: { + dow: 1, // Monday is the first day of the week. + doy: 4, + }, + }); + + //! moment.js locale configuration + + var symbolMap$e = { + '1': '੧', + '2': '੨', + '3': '੩', + '4': '੪', + '5': '੫', + '6': '੬', + '7': '੭', + '8': '੮', + '9': '੯', + '0': '੦', + }, + numberMap$d = { + '੧': '1', + '੨': '2', + '੩': '3', + '੪': '4', + '੫': '5', + '੬': '6', + '੭': '7', + '੮': '8', + '੯': '9', + '੦': '0', + }; + + hooks.defineLocale('pa-in', { + // There are months name as per Nanakshahi Calendar but they are not used as rigidly in modern Punjabi. + months: 'ਜਨਵਰੀ_ਫ਼ਰਵਰੀ_ਮਾਰਚ_ਅਪ੍ਰੈਲ_ਮਈ_ਜੂਨ_ਜੁਲਾਈ_ਅਗਸਤ_ਸਤੰਬਰ_ਅਕਤੂਬਰ_ਨਵੰਬਰ_ਦਸੰਬਰ'.split( + '_' + ), + monthsShort: 'ਜਨਵਰੀ_ਫ਼ਰਵਰੀ_ਮਾਰਚ_ਅਪ੍ਰੈਲ_ਮਈ_ਜੂਨ_ਜੁਲਾਈ_ਅਗਸਤ_ਸਤੰਬਰ_ਅਕਤੂਬਰ_ਨਵੰਬਰ_ਦਸੰਬਰ'.split( + '_' + ), + weekdays: 'ਐਤਵਾਰ_ਸੋਮਵਾਰ_ਮੰਗਲਵਾਰ_ਬੁਧਵਾਰ_ਵੀਰਵਾਰ_ਸ਼ੁੱਕਰਵਾਰ_ਸ਼ਨੀਚਰਵਾਰ'.split( + '_' + ), + weekdaysShort: 'ਐਤ_ਸੋਮ_ਮੰਗਲ_ਬੁਧ_ਵੀਰ_ਸ਼ੁਕਰ_ਸ਼ਨੀ'.split('_'), + weekdaysMin: 'ਐਤ_ਸੋਮ_ਮੰਗਲ_ਬੁਧ_ਵੀਰ_ਸ਼ੁਕਰ_ਸ਼ਨੀ'.split('_'), + longDateFormat: { + LT: 'A h:mm ਵਜੇ', + LTS: 'A h:mm:ss ਵਜੇ', + L: 'DD/MM/YYYY', + LL: 'D MMMM YYYY', + LLL: 'D MMMM YYYY, A h:mm ਵਜੇ', + LLLL: 'dddd, D MMMM YYYY, A h:mm ਵਜੇ', + }, + calendar: { + sameDay: '[ਅਜ] LT', + nextDay: '[ਕਲ] LT', + nextWeek: '[ਅਗਲਾ] dddd, LT', + lastDay: '[ਕਲ] LT', + lastWeek: '[ਪਿਛਲੇ] dddd, LT', + sameElse: 'L', + }, + relativeTime: { + future: '%s ਵਿੱਚ', + past: '%s ਪਿਛਲੇ', + s: 'ਕੁਝ ਸਕਿੰਟ', + ss: '%d ਸਕਿੰਟ', + m: 'ਇਕ ਮਿੰਟ', + mm: '%d ਮਿੰਟ', + h: 'ਇੱਕ ਘੰਟਾ', + hh: '%d ਘੰਟੇ', + d: 'ਇੱਕ ਦਿਨ', + dd: '%d ਦਿਨ', + M: 'ਇੱਕ ਮਹੀਨਾ', + MM: '%d ਮਹੀਨੇ', + y: 'ਇੱਕ ਸਾਲ', + yy: '%d ਸਾਲ', + }, + preparse: function (string) { + return string.replace(/[੧੨੩੪੫੬੭੮੯੦]/g, function (match) { + return numberMap$d[match]; + }); + }, + postformat: function (string) { + return string.replace(/\d/g, function (match) { + return symbolMap$e[match]; + }); + }, + // Punjabi notation for meridiems are quite fuzzy in practice. While there exists + // a rigid notion of a 'Pahar' it is not used as rigidly in modern Punjabi. + meridiemParse: /ਰਾਤ|ਸਵੇਰ|ਦੁਪਹਿਰ|ਸ਼ਾਮ/, + meridiemHour: function (hour, meridiem) { + if (hour === 12) { + hour = 0; + } + if (meridiem === 'ਰਾਤ') { + return hour < 4 ? hour : hour + 12; + } else if (meridiem === 'ਸਵੇਰ') { + return hour; + } else if (meridiem === 'ਦੁਪਹਿਰ') { + return hour >= 10 ? hour : hour + 12; + } else if (meridiem === 'ਸ਼ਾਮ') { + return hour + 12; + } + }, + meridiem: function (hour, minute, isLower) { + if (hour < 4) { + return 'ਰਾਤ'; + } else if (hour < 10) { + return 'ਸਵੇਰ'; + } else if (hour < 17) { + return 'ਦੁਪਹਿਰ'; + } else if (hour < 20) { + return 'ਸ਼ਾਮ'; + } else { + return 'ਰਾਤ'; + } + }, + week: { + dow: 0, // Sunday is the first day of the week. + doy: 6, // The week that contains Jan 6th is the first week of the year. + }, + }); + + //! moment.js locale configuration + + var monthsNominative = 'styczeń_luty_marzec_kwiecień_maj_czerwiec_lipiec_sierpień_wrzesień_październik_listopad_grudzień'.split( + '_' + ), + monthsSubjective = 'stycznia_lutego_marca_kwietnia_maja_czerwca_lipca_sierpnia_września_października_listopada_grudnia'.split( + '_' + ); + function plural$3(n) { + return n % 10 < 5 && n % 10 > 1 && ~~(n / 10) % 10 !== 1; + } + function translate$8(number, withoutSuffix, key) { + var result = number + ' '; + switch (key) { + case 'ss': + return result + (plural$3(number) ? 'sekundy' : 'sekund'); + case 'm': + return withoutSuffix ? 'minuta' : 'minutę'; + case 'mm': + return result + (plural$3(number) ? 'minuty' : 'minut'); + case 'h': + return withoutSuffix ? 'godzina' : 'godzinę'; + case 'hh': + return result + (plural$3(number) ? 'godziny' : 'godzin'); + case 'MM': + return result + (plural$3(number) ? 'miesiące' : 'miesięcy'); + case 'yy': + return result + (plural$3(number) ? 'lata' : 'lat'); + } + } + + hooks.defineLocale('pl', { + months: function (momentToFormat, format) { + if (!momentToFormat) { + return monthsNominative; + } else if (format === '') { + // Hack: if format empty we know this is used to generate + // RegExp by moment. Give then back both valid forms of months + // in RegExp ready format. + return ( + '(' + + monthsSubjective[momentToFormat.month()] + + '|' + + monthsNominative[momentToFormat.month()] + + ')' + ); + } else if (/D MMMM/.test(format)) { + return monthsSubjective[momentToFormat.month()]; + } else { + return monthsNominative[momentToFormat.month()]; + } + }, + monthsShort: 'sty_lut_mar_kwi_maj_cze_lip_sie_wrz_paź_lis_gru'.split('_'), + weekdays: 'niedziela_poniedziałek_wtorek_środa_czwartek_piątek_sobota'.split( + '_' + ), + weekdaysShort: 'ndz_pon_wt_śr_czw_pt_sob'.split('_'), + weekdaysMin: 'Nd_Pn_Wt_Śr_Cz_Pt_So'.split('_'), + longDateFormat: { + LT: 'HH:mm', + LTS: 'HH:mm:ss', + L: 'DD.MM.YYYY', + LL: 'D MMMM YYYY', + LLL: 'D MMMM YYYY HH:mm', + LLLL: 'dddd, D MMMM YYYY HH:mm', + }, + calendar: { + sameDay: '[Dziś o] LT', + nextDay: '[Jutro o] LT', + nextWeek: function () { + switch (this.day()) { + case 0: + return '[W niedzielę o] LT'; + + case 2: + return '[We wtorek o] LT'; + + case 3: + return '[W środę o] LT'; + + case 6: + return '[W sobotę o] LT'; + + default: + return '[W] dddd [o] LT'; + } + }, + lastDay: '[Wczoraj o] LT', + lastWeek: function () { + switch (this.day()) { + case 0: + return '[W zeszłą niedzielę o] LT'; + case 3: + return '[W zeszłą środę o] LT'; + case 6: + return '[W zeszłą sobotę o] LT'; + default: + return '[W zeszły] dddd [o] LT'; + } + }, + sameElse: 'L', + }, + relativeTime: { + future: 'za %s', + past: '%s temu', + s: 'kilka sekund', + ss: translate$8, + m: translate$8, + mm: translate$8, + h: translate$8, + hh: translate$8, + d: '1 dzień', + dd: '%d dni', + M: 'miesiąc', + MM: translate$8, + y: 'rok', + yy: translate$8, + }, + dayOfMonthOrdinalParse: /\d{1,2}\./, + ordinal: '%d.', + week: { + dow: 1, // Monday is the first day of the week. + doy: 4, // The week that contains Jan 4th is the first week of the year. + }, + }); + + //! moment.js locale configuration + + hooks.defineLocale('pt-br', { + months: 'janeiro_fevereiro_março_abril_maio_junho_julho_agosto_setembro_outubro_novembro_dezembro'.split( + '_' + ), + monthsShort: 'jan_fev_mar_abr_mai_jun_jul_ago_set_out_nov_dez'.split('_'), + weekdays: 'domingo_segunda-feira_terça-feira_quarta-feira_quinta-feira_sexta-feira_sábado'.split( + '_' + ), + weekdaysShort: 'dom_seg_ter_qua_qui_sex_sáb'.split('_'), + weekdaysMin: 'do_2ª_3ª_4ª_5ª_6ª_sá'.split('_'), + weekdaysParseExact: true, + longDateFormat: { + LT: 'HH:mm', + LTS: 'HH:mm:ss', + L: 'DD/MM/YYYY', + LL: 'D [de] MMMM [de] YYYY', + LLL: 'D [de] MMMM [de] YYYY [às] HH:mm', + LLLL: 'dddd, D [de] MMMM [de] YYYY [às] HH:mm', + }, + calendar: { + sameDay: '[Hoje às] LT', + nextDay: '[Amanhã às] LT', + nextWeek: 'dddd [às] LT', + lastDay: '[Ontem às] LT', + lastWeek: function () { + return this.day() === 0 || this.day() === 6 + ? '[Último] dddd [às] LT' // Saturday + Sunday + : '[Última] dddd [às] LT'; // Monday - Friday + }, + sameElse: 'L', + }, + relativeTime: { + future: 'em %s', + past: 'há %s', + s: 'poucos segundos', + ss: '%d segundos', + m: 'um minuto', + mm: '%d minutos', + h: 'uma hora', + hh: '%d horas', + d: 'um dia', + dd: '%d dias', + M: 'um mês', + MM: '%d meses', + y: 'um ano', + yy: '%d anos', + }, + dayOfMonthOrdinalParse: /\d{1,2}º/, + ordinal: '%dº', + }); + + //! moment.js locale configuration + + hooks.defineLocale('pt', { + months: 'janeiro_fevereiro_março_abril_maio_junho_julho_agosto_setembro_outubro_novembro_dezembro'.split( + '_' + ), + monthsShort: 'jan_fev_mar_abr_mai_jun_jul_ago_set_out_nov_dez'.split('_'), + weekdays: 'Domingo_Segunda-feira_Terça-feira_Quarta-feira_Quinta-feira_Sexta-feira_Sábado'.split( + '_' + ), + weekdaysShort: 'Dom_Seg_Ter_Qua_Qui_Sex_Sáb'.split('_'), + weekdaysMin: 'Do_2ª_3ª_4ª_5ª_6ª_Sá'.split('_'), + weekdaysParseExact: true, + longDateFormat: { + LT: 'HH:mm', + LTS: 'HH:mm:ss', + L: 'DD/MM/YYYY', + LL: 'D [de] MMMM [de] YYYY', + LLL: 'D [de] MMMM [de] YYYY HH:mm', + LLLL: 'dddd, D [de] MMMM [de] YYYY HH:mm', + }, + calendar: { + sameDay: '[Hoje às] LT', + nextDay: '[Amanhã às] LT', + nextWeek: 'dddd [às] LT', + lastDay: '[Ontem às] LT', + lastWeek: function () { + return this.day() === 0 || this.day() === 6 + ? '[Último] dddd [às] LT' // Saturday + Sunday + : '[Última] dddd [às] LT'; // Monday - Friday + }, + sameElse: 'L', + }, + relativeTime: { + future: 'em %s', + past: 'há %s', + s: 'segundos', + ss: '%d segundos', + m: 'um minuto', + mm: '%d minutos', + h: 'uma hora', + hh: '%d horas', + d: 'um dia', + dd: '%d dias', + M: 'um mês', + MM: '%d meses', + y: 'um ano', + yy: '%d anos', + }, + dayOfMonthOrdinalParse: /\d{1,2}º/, + ordinal: '%dº', + week: { + dow: 1, // Monday is the first day of the week. + doy: 4, // The week that contains Jan 4th is the first week of the year. + }, + }); + + //! moment.js locale configuration + + function relativeTimeWithPlural$2(number, withoutSuffix, key) { + var format = { + ss: 'secunde', + mm: 'minute', + hh: 'ore', + dd: 'zile', + MM: 'luni', + yy: 'ani', + }, + separator = ' '; + if (number % 100 >= 20 || (number >= 100 && number % 100 === 0)) { + separator = ' de '; + } + return number + separator + format[key]; + } + + hooks.defineLocale('ro', { + months: 'ianuarie_februarie_martie_aprilie_mai_iunie_iulie_august_septembrie_octombrie_noiembrie_decembrie'.split( + '_' + ), + monthsShort: 'ian._feb._mart._apr._mai_iun._iul._aug._sept._oct._nov._dec.'.split( + '_' + ), + monthsParseExact: true, + weekdays: 'duminică_luni_marți_miercuri_joi_vineri_sâmbătă'.split('_'), + weekdaysShort: 'Dum_Lun_Mar_Mie_Joi_Vin_Sâm'.split('_'), + weekdaysMin: 'Du_Lu_Ma_Mi_Jo_Vi_Sâ'.split('_'), + longDateFormat: { + LT: 'H:mm', + LTS: 'H:mm:ss', + L: 'DD.MM.YYYY', + LL: 'D MMMM YYYY', + LLL: 'D MMMM YYYY H:mm', + LLLL: 'dddd, D MMMM YYYY H:mm', + }, + calendar: { + sameDay: '[azi la] LT', + nextDay: '[mâine la] LT', + nextWeek: 'dddd [la] LT', + lastDay: '[ieri la] LT', + lastWeek: '[fosta] dddd [la] LT', + sameElse: 'L', + }, + relativeTime: { + future: 'peste %s', + past: '%s în urmă', + s: 'câteva secunde', + ss: relativeTimeWithPlural$2, + m: 'un minut', + mm: relativeTimeWithPlural$2, + h: 'o oră', + hh: relativeTimeWithPlural$2, + d: 'o zi', + dd: relativeTimeWithPlural$2, + M: 'o lună', + MM: relativeTimeWithPlural$2, + y: 'un an', + yy: relativeTimeWithPlural$2, + }, + week: { + dow: 1, // Monday is the first day of the week. + doy: 7, // The week that contains Jan 7th is the first week of the year. + }, + }); + + //! moment.js locale configuration + + function plural$4(word, num) { + var forms = word.split('_'); + return num % 10 === 1 && num % 100 !== 11 + ? forms[0] + : num % 10 >= 2 && num % 10 <= 4 && (num % 100 < 10 || num % 100 >= 20) + ? forms[1] + : forms[2]; + } + function relativeTimeWithPlural$3(number, withoutSuffix, key) { + var format = { + ss: withoutSuffix ? 'секунда_секунды_секунд' : 'секунду_секунды_секунд', + mm: withoutSuffix ? 'минута_минуты_минут' : 'минуту_минуты_минут', + hh: 'час_часа_часов', + dd: 'день_дня_дней', + MM: 'месяц_месяца_месяцев', + yy: 'год_года_лет', + }; + if (key === 'm') { + return withoutSuffix ? 'минута' : 'минуту'; + } else { + return number + ' ' + plural$4(format[key], +number); + } + } + var monthsParse$8 = [ + /^янв/i, + /^фев/i, + /^мар/i, + /^апр/i, + /^ма[йя]/i, + /^июн/i, + /^июл/i, + /^авг/i, + /^сен/i, + /^окт/i, + /^ноя/i, + /^дек/i, + ]; + + // http://new.gramota.ru/spravka/rules/139-prop : § 103 + // Сокращения месяцев: http://new.gramota.ru/spravka/buro/search-answer?s=242637 + // CLDR data: http://www.unicode.org/cldr/charts/28/summary/ru.html#1753 + hooks.defineLocale('ru', { + months: { + format: 'января_февраля_марта_апреля_мая_июня_июля_августа_сентября_октября_ноября_декабря'.split( + '_' + ), + standalone: 'январь_февраль_март_апрель_май_июнь_июль_август_сентябрь_октябрь_ноябрь_декабрь'.split( + '_' + ), + }, + monthsShort: { + // по CLDR именно "июл." и "июн.", но какой смысл менять букву на точку? + format: 'янв._февр._мар._апр._мая_июня_июля_авг._сент._окт._нояб._дек.'.split( + '_' + ), + standalone: 'янв._февр._март_апр._май_июнь_июль_авг._сент._окт._нояб._дек.'.split( + '_' + ), + }, + weekdays: { + standalone: 'воскресенье_понедельник_вторник_среда_четверг_пятница_суббота'.split( + '_' + ), + format: 'воскресенье_понедельник_вторник_среду_четверг_пятницу_субботу'.split( + '_' + ), + isFormat: /\[ ?[Вв] ?(?:прошлую|следующую|эту)? ?] ?dddd/, + }, + weekdaysShort: 'вс_пн_вт_ср_чт_пт_сб'.split('_'), + weekdaysMin: 'вс_пн_вт_ср_чт_пт_сб'.split('_'), + monthsParse: monthsParse$8, + longMonthsParse: monthsParse$8, + shortMonthsParse: monthsParse$8, + + // полные названия с падежами, по три буквы, для некоторых, по 4 буквы, сокращения с точкой и без точки + monthsRegex: /^(январ[ья]|янв\.?|феврал[ья]|февр?\.?|марта?|мар\.?|апрел[ья]|апр\.?|ма[йя]|июн[ья]|июн\.?|июл[ья]|июл\.?|августа?|авг\.?|сентябр[ья]|сент?\.?|октябр[ья]|окт\.?|ноябр[ья]|нояб?\.?|декабр[ья]|дек\.?)/i, + + // копия предыдущего + monthsShortRegex: /^(январ[ья]|янв\.?|феврал[ья]|февр?\.?|марта?|мар\.?|апрел[ья]|апр\.?|ма[йя]|июн[ья]|июн\.?|июл[ья]|июл\.?|августа?|авг\.?|сентябр[ья]|сент?\.?|октябр[ья]|окт\.?|ноябр[ья]|нояб?\.?|декабр[ья]|дек\.?)/i, + + // полные названия с падежами + monthsStrictRegex: /^(январ[яь]|феврал[яь]|марта?|апрел[яь]|ма[яй]|июн[яь]|июл[яь]|августа?|сентябр[яь]|октябр[яь]|ноябр[яь]|декабр[яь])/i, + + // Выражение, которое соответствует только сокращённым формам + monthsShortStrictRegex: /^(янв\.|февр?\.|мар[т.]|апр\.|ма[яй]|июн[ья.]|июл[ья.]|авг\.|сент?\.|окт\.|нояб?\.|дек\.)/i, + longDateFormat: { + LT: 'H:mm', + LTS: 'H:mm:ss', + L: 'DD.MM.YYYY', + LL: 'D MMMM YYYY г.', + LLL: 'D MMMM YYYY г., H:mm', + LLLL: 'dddd, D MMMM YYYY г., H:mm', + }, + calendar: { + sameDay: '[Сегодня, в] LT', + nextDay: '[Завтра, в] LT', + lastDay: '[Вчера, в] LT', + nextWeek: function (now) { + if (now.week() !== this.week()) { + switch (this.day()) { + case 0: + return '[В следующее] dddd, [в] LT'; + case 1: + case 2: + case 4: + return '[В следующий] dddd, [в] LT'; + case 3: + case 5: + case 6: + return '[В следующую] dddd, [в] LT'; + } + } else { + if (this.day() === 2) { + return '[Во] dddd, [в] LT'; + } else { + return '[В] dddd, [в] LT'; + } + } + }, + lastWeek: function (now) { + if (now.week() !== this.week()) { + switch (this.day()) { + case 0: + return '[В прошлое] dddd, [в] LT'; + case 1: + case 2: + case 4: + return '[В прошлый] dddd, [в] LT'; + case 3: + case 5: + case 6: + return '[В прошлую] dddd, [в] LT'; + } + } else { + if (this.day() === 2) { + return '[Во] dddd, [в] LT'; + } else { + return '[В] dddd, [в] LT'; + } + } + }, + sameElse: 'L', + }, + relativeTime: { + future: 'через %s', + past: '%s назад', + s: 'несколько секунд', + ss: relativeTimeWithPlural$3, + m: relativeTimeWithPlural$3, + mm: relativeTimeWithPlural$3, + h: 'час', + hh: relativeTimeWithPlural$3, + d: 'день', + dd: relativeTimeWithPlural$3, + M: 'месяц', + MM: relativeTimeWithPlural$3, + y: 'год', + yy: relativeTimeWithPlural$3, + }, + meridiemParse: /ночи|утра|дня|вечера/i, + isPM: function (input) { + return /^(дня|вечера)$/.test(input); + }, + meridiem: function (hour, minute, isLower) { + if (hour < 4) { + return 'ночи'; + } else if (hour < 12) { + return 'утра'; + } else if (hour < 17) { + return 'дня'; + } else { + return 'вечера'; + } + }, + dayOfMonthOrdinalParse: /\d{1,2}-(й|го|я)/, + ordinal: function (number, period) { + switch (period) { + case 'M': + case 'd': + case 'DDD': + return number + '-й'; + case 'D': + return number + '-го'; + case 'w': + case 'W': + return number + '-я'; + default: + return number; + } + }, + week: { + dow: 1, // Monday is the first day of the week. + doy: 4, // The week that contains Jan 4th is the first week of the year. + }, + }); + + //! moment.js locale configuration + + var months$9 = [ + 'جنوري', + 'فيبروري', + 'مارچ', + 'اپريل', + 'مئي', + 'جون', + 'جولاءِ', + 'آگسٽ', + 'سيپٽمبر', + 'آڪٽوبر', + 'نومبر', + 'ڊسمبر', + ], + days$1 = ['آچر', 'سومر', 'اڱارو', 'اربع', 'خميس', 'جمع', 'ڇنڇر']; + + hooks.defineLocale('sd', { + months: months$9, + monthsShort: months$9, + weekdays: days$1, + weekdaysShort: days$1, + weekdaysMin: days$1, + longDateFormat: { + LT: 'HH:mm', + LTS: 'HH:mm:ss', + L: 'DD/MM/YYYY', + LL: 'D MMMM YYYY', + LLL: 'D MMMM YYYY HH:mm', + LLLL: 'dddd، D MMMM YYYY HH:mm', + }, + meridiemParse: /صبح|شام/, + isPM: function (input) { + return 'شام' === input; + }, + meridiem: function (hour, minute, isLower) { + if (hour < 12) { + return 'صبح'; + } + return 'شام'; + }, + calendar: { + sameDay: '[اڄ] LT', + nextDay: '[سڀاڻي] LT', + nextWeek: 'dddd [اڳين هفتي تي] LT', + lastDay: '[ڪالهه] LT', + lastWeek: '[گزريل هفتي] dddd [تي] LT', + sameElse: 'L', + }, + relativeTime: { + future: '%s پوء', + past: '%s اڳ', + s: 'چند سيڪنڊ', + ss: '%d سيڪنڊ', + m: 'هڪ منٽ', + mm: '%d منٽ', + h: 'هڪ ڪلاڪ', + hh: '%d ڪلاڪ', + d: 'هڪ ڏينهن', + dd: '%d ڏينهن', + M: 'هڪ مهينو', + MM: '%d مهينا', + y: 'هڪ سال', + yy: '%d سال', + }, + preparse: function (string) { + return string.replace(/،/g, ','); + }, + postformat: function (string) { + return string.replace(/,/g, '،'); + }, + week: { + dow: 1, // Monday is the first day of the week. + doy: 4, // The week that contains Jan 4th is the first week of the year. + }, + }); + + //! moment.js locale configuration + + hooks.defineLocale('se', { + months: 'ođđajagemánnu_guovvamánnu_njukčamánnu_cuoŋománnu_miessemánnu_geassemánnu_suoidnemánnu_borgemánnu_čakčamánnu_golggotmánnu_skábmamánnu_juovlamánnu'.split( + '_' + ), + monthsShort: 'ođđj_guov_njuk_cuo_mies_geas_suoi_borg_čakč_golg_skáb_juov'.split( + '_' + ), + weekdays: 'sotnabeaivi_vuossárga_maŋŋebárga_gaskavahkku_duorastat_bearjadat_lávvardat'.split( + '_' + ), + weekdaysShort: 'sotn_vuos_maŋ_gask_duor_bear_láv'.split('_'), + weekdaysMin: 's_v_m_g_d_b_L'.split('_'), + longDateFormat: { + LT: 'HH:mm', + LTS: 'HH:mm:ss', + L: 'DD.MM.YYYY', + LL: 'MMMM D. [b.] YYYY', + LLL: 'MMMM D. [b.] YYYY [ti.] HH:mm', + LLLL: 'dddd, MMMM D. [b.] YYYY [ti.] HH:mm', + }, + calendar: { + sameDay: '[otne ti] LT', + nextDay: '[ihttin ti] LT', + nextWeek: 'dddd [ti] LT', + lastDay: '[ikte ti] LT', + lastWeek: '[ovddit] dddd [ti] LT', + sameElse: 'L', + }, + relativeTime: { + future: '%s geažes', + past: 'maŋit %s', + s: 'moadde sekunddat', + ss: '%d sekunddat', + m: 'okta minuhta', + mm: '%d minuhtat', + h: 'okta diimmu', + hh: '%d diimmut', + d: 'okta beaivi', + dd: '%d beaivvit', + M: 'okta mánnu', + MM: '%d mánut', + y: 'okta jahki', + yy: '%d jagit', + }, + dayOfMonthOrdinalParse: /\d{1,2}\./, + ordinal: '%d.', + week: { + dow: 1, // Monday is the first day of the week. + doy: 4, // The week that contains Jan 4th is the first week of the year. + }, + }); + + //! moment.js locale configuration + + /*jshint -W100*/ + hooks.defineLocale('si', { + months: 'ජනවාරි_පෙබරවාරි_මාර්තු_අප්‍රේල්_මැයි_ජූනි_ජූලි_අගෝස්තු_සැප්තැම්බර්_ඔක්තෝබර්_නොවැම්බර්_දෙසැම්බර්'.split( + '_' + ), + monthsShort: 'ජන_පෙබ_මාර්_අප්_මැයි_ජූනි_ජූලි_අගෝ_සැප්_ඔක්_නොවැ_දෙසැ'.split( + '_' + ), + weekdays: 'ඉරිදා_සඳුදා_අඟහරුවාදා_බදාදා_බ්‍රහස්පතින්දා_සිකුරාදා_සෙනසුරාදා'.split( + '_' + ), + weekdaysShort: 'ඉරි_සඳු_අඟ_බදා_බ්‍රහ_සිකු_සෙන'.split('_'), + weekdaysMin: 'ඉ_ස_අ_බ_බ්‍ර_සි_සෙ'.split('_'), + weekdaysParseExact: true, + longDateFormat: { + LT: 'a h:mm', + LTS: 'a h:mm:ss', + L: 'YYYY/MM/DD', + LL: 'YYYY MMMM D', + LLL: 'YYYY MMMM D, a h:mm', + LLLL: 'YYYY MMMM D [වැනි] dddd, a h:mm:ss', + }, + calendar: { + sameDay: '[අද] LT[ට]', + nextDay: '[හෙට] LT[ට]', + nextWeek: 'dddd LT[ට]', + lastDay: '[ඊයේ] LT[ට]', + lastWeek: '[පසුගිය] dddd LT[ට]', + sameElse: 'L', + }, + relativeTime: { + future: '%sකින්', + past: '%sකට පෙර', + s: 'තත්පර කිහිපය', + ss: 'තත්පර %d', + m: 'මිනිත්තුව', + mm: 'මිනිත්තු %d', + h: 'පැය', + hh: 'පැය %d', + d: 'දිනය', + dd: 'දින %d', + M: 'මාසය', + MM: 'මාස %d', + y: 'වසර', + yy: 'වසර %d', + }, + dayOfMonthOrdinalParse: /\d{1,2} වැනි/, + ordinal: function (number) { + return number + ' වැනි'; + }, + meridiemParse: /පෙර වරු|පස් වරු|පෙ.ව|ප.ව./, + isPM: function (input) { + return input === 'ප.ව.' || input === 'පස් වරු'; + }, + meridiem: function (hours, minutes, isLower) { + if (hours > 11) { + return isLower ? 'ප.ව.' : 'පස් වරු'; + } else { + return isLower ? 'පෙ.ව.' : 'පෙර වරු'; + } + }, + }); + + //! moment.js locale configuration + + var months$a = 'január_február_marec_apríl_máj_jún_júl_august_september_október_november_december'.split( + '_' + ), + monthsShort$6 = 'jan_feb_mar_apr_máj_jún_júl_aug_sep_okt_nov_dec'.split('_'); + function plural$5(n) { + return n > 1 && n < 5; + } + function translate$9(number, withoutSuffix, key, isFuture) { + var result = number + ' '; + switch (key) { + case 's': // a few seconds / in a few seconds / a few seconds ago + return withoutSuffix || isFuture ? 'pár sekúnd' : 'pár sekundami'; + case 'ss': // 9 seconds / in 9 seconds / 9 seconds ago + if (withoutSuffix || isFuture) { + return result + (plural$5(number) ? 'sekundy' : 'sekúnd'); + } else { + return result + 'sekundami'; + } + case 'm': // a minute / in a minute / a minute ago + return withoutSuffix ? 'minúta' : isFuture ? 'minútu' : 'minútou'; + case 'mm': // 9 minutes / in 9 minutes / 9 minutes ago + if (withoutSuffix || isFuture) { + return result + (plural$5(number) ? 'minúty' : 'minút'); + } else { + return result + 'minútami'; + } + case 'h': // an hour / in an hour / an hour ago + return withoutSuffix ? 'hodina' : isFuture ? 'hodinu' : 'hodinou'; + case 'hh': // 9 hours / in 9 hours / 9 hours ago + if (withoutSuffix || isFuture) { + return result + (plural$5(number) ? 'hodiny' : 'hodín'); + } else { + return result + 'hodinami'; + } + case 'd': // a day / in a day / a day ago + return withoutSuffix || isFuture ? 'deň' : 'dňom'; + case 'dd': // 9 days / in 9 days / 9 days ago + if (withoutSuffix || isFuture) { + return result + (plural$5(number) ? 'dni' : 'dní'); + } else { + return result + 'dňami'; + } + case 'M': // a month / in a month / a month ago + return withoutSuffix || isFuture ? 'mesiac' : 'mesiacom'; + case 'MM': // 9 months / in 9 months / 9 months ago + if (withoutSuffix || isFuture) { + return result + (plural$5(number) ? 'mesiace' : 'mesiacov'); + } else { + return result + 'mesiacmi'; + } + case 'y': // a year / in a year / a year ago + return withoutSuffix || isFuture ? 'rok' : 'rokom'; + case 'yy': // 9 years / in 9 years / 9 years ago + if (withoutSuffix || isFuture) { + return result + (plural$5(number) ? 'roky' : 'rokov'); + } else { + return result + 'rokmi'; + } + } + } + + hooks.defineLocale('sk', { + months: months$a, + monthsShort: monthsShort$6, + weekdays: 'nedeľa_pondelok_utorok_streda_štvrtok_piatok_sobota'.split('_'), + weekdaysShort: 'ne_po_ut_st_št_pi_so'.split('_'), + weekdaysMin: 'ne_po_ut_st_št_pi_so'.split('_'), + longDateFormat: { + LT: 'H:mm', + LTS: 'H:mm:ss', + L: 'DD.MM.YYYY', + LL: 'D. MMMM YYYY', + LLL: 'D. MMMM YYYY H:mm', + LLLL: 'dddd D. MMMM YYYY H:mm', + }, + calendar: { + sameDay: '[dnes o] LT', + nextDay: '[zajtra o] LT', + nextWeek: function () { + switch (this.day()) { + case 0: + return '[v nedeľu o] LT'; + case 1: + case 2: + return '[v] dddd [o] LT'; + case 3: + return '[v stredu o] LT'; + case 4: + return '[vo štvrtok o] LT'; + case 5: + return '[v piatok o] LT'; + case 6: + return '[v sobotu o] LT'; + } + }, + lastDay: '[včera o] LT', + lastWeek: function () { + switch (this.day()) { + case 0: + return '[minulú nedeľu o] LT'; + case 1: + case 2: + return '[minulý] dddd [o] LT'; + case 3: + return '[minulú stredu o] LT'; + case 4: + case 5: + return '[minulý] dddd [o] LT'; + case 6: + return '[minulú sobotu o] LT'; + } + }, + sameElse: 'L', + }, + relativeTime: { + future: 'za %s', + past: 'pred %s', + s: translate$9, + ss: translate$9, + m: translate$9, + mm: translate$9, + h: translate$9, + hh: translate$9, + d: translate$9, + dd: translate$9, + M: translate$9, + MM: translate$9, + y: translate$9, + yy: translate$9, + }, + dayOfMonthOrdinalParse: /\d{1,2}\./, + ordinal: '%d.', + week: { + dow: 1, // Monday is the first day of the week. + doy: 4, // The week that contains Jan 4th is the first week of the year. + }, + }); + + //! moment.js locale configuration + + function processRelativeTime$7(number, withoutSuffix, key, isFuture) { + var result = number + ' '; + switch (key) { + case 's': + return withoutSuffix || isFuture + ? 'nekaj sekund' + : 'nekaj sekundami'; + case 'ss': + if (number === 1) { + result += withoutSuffix ? 'sekundo' : 'sekundi'; + } else if (number === 2) { + result += withoutSuffix || isFuture ? 'sekundi' : 'sekundah'; + } else if (number < 5) { + result += withoutSuffix || isFuture ? 'sekunde' : 'sekundah'; + } else { + result += 'sekund'; + } + return result; + case 'm': + return withoutSuffix ? 'ena minuta' : 'eno minuto'; + case 'mm': + if (number === 1) { + result += withoutSuffix ? 'minuta' : 'minuto'; + } else if (number === 2) { + result += withoutSuffix || isFuture ? 'minuti' : 'minutama'; + } else if (number < 5) { + result += withoutSuffix || isFuture ? 'minute' : 'minutami'; + } else { + result += withoutSuffix || isFuture ? 'minut' : 'minutami'; + } + return result; + case 'h': + return withoutSuffix ? 'ena ura' : 'eno uro'; + case 'hh': + if (number === 1) { + result += withoutSuffix ? 'ura' : 'uro'; + } else if (number === 2) { + result += withoutSuffix || isFuture ? 'uri' : 'urama'; + } else if (number < 5) { + result += withoutSuffix || isFuture ? 'ure' : 'urami'; + } else { + result += withoutSuffix || isFuture ? 'ur' : 'urami'; + } + return result; + case 'd': + return withoutSuffix || isFuture ? 'en dan' : 'enim dnem'; + case 'dd': + if (number === 1) { + result += withoutSuffix || isFuture ? 'dan' : 'dnem'; + } else if (number === 2) { + result += withoutSuffix || isFuture ? 'dni' : 'dnevoma'; + } else { + result += withoutSuffix || isFuture ? 'dni' : 'dnevi'; + } + return result; + case 'M': + return withoutSuffix || isFuture ? 'en mesec' : 'enim mesecem'; + case 'MM': + if (number === 1) { + result += withoutSuffix || isFuture ? 'mesec' : 'mesecem'; + } else if (number === 2) { + result += withoutSuffix || isFuture ? 'meseca' : 'mesecema'; + } else if (number < 5) { + result += withoutSuffix || isFuture ? 'mesece' : 'meseci'; + } else { + result += withoutSuffix || isFuture ? 'mesecev' : 'meseci'; + } + return result; + case 'y': + return withoutSuffix || isFuture ? 'eno leto' : 'enim letom'; + case 'yy': + if (number === 1) { + result += withoutSuffix || isFuture ? 'leto' : 'letom'; + } else if (number === 2) { + result += withoutSuffix || isFuture ? 'leti' : 'letoma'; + } else if (number < 5) { + result += withoutSuffix || isFuture ? 'leta' : 'leti'; + } else { + result += withoutSuffix || isFuture ? 'let' : 'leti'; + } + return result; + } + } + + hooks.defineLocale('sl', { + months: 'januar_februar_marec_april_maj_junij_julij_avgust_september_oktober_november_december'.split( + '_' + ), + monthsShort: 'jan._feb._mar._apr._maj._jun._jul._avg._sep._okt._nov._dec.'.split( + '_' + ), + monthsParseExact: true, + weekdays: 'nedelja_ponedeljek_torek_sreda_četrtek_petek_sobota'.split('_'), + weekdaysShort: 'ned._pon._tor._sre._čet._pet._sob.'.split('_'), + weekdaysMin: 'ne_po_to_sr_če_pe_so'.split('_'), + weekdaysParseExact: true, + longDateFormat: { + LT: 'H:mm', + LTS: 'H:mm:ss', + L: 'DD. MM. YYYY', + LL: 'D. MMMM YYYY', + LLL: 'D. MMMM YYYY H:mm', + LLLL: 'dddd, D. MMMM YYYY H:mm', + }, + calendar: { + sameDay: '[danes ob] LT', + nextDay: '[jutri ob] LT', + + nextWeek: function () { + switch (this.day()) { + case 0: + return '[v] [nedeljo] [ob] LT'; + case 3: + return '[v] [sredo] [ob] LT'; + case 6: + return '[v] [soboto] [ob] LT'; + case 1: + case 2: + case 4: + case 5: + return '[v] dddd [ob] LT'; + } + }, + lastDay: '[včeraj ob] LT', + lastWeek: function () { + switch (this.day()) { + case 0: + return '[prejšnjo] [nedeljo] [ob] LT'; + case 3: + return '[prejšnjo] [sredo] [ob] LT'; + case 6: + return '[prejšnjo] [soboto] [ob] LT'; + case 1: + case 2: + case 4: + case 5: + return '[prejšnji] dddd [ob] LT'; + } + }, + sameElse: 'L', + }, + relativeTime: { + future: 'čez %s', + past: 'pred %s', + s: processRelativeTime$7, + ss: processRelativeTime$7, + m: processRelativeTime$7, + mm: processRelativeTime$7, + h: processRelativeTime$7, + hh: processRelativeTime$7, + d: processRelativeTime$7, + dd: processRelativeTime$7, + M: processRelativeTime$7, + MM: processRelativeTime$7, + y: processRelativeTime$7, + yy: processRelativeTime$7, + }, + dayOfMonthOrdinalParse: /\d{1,2}\./, + ordinal: '%d.', + week: { + dow: 1, // Monday is the first day of the week. + doy: 7, // The week that contains Jan 7th is the first week of the year. + }, + }); + + //! moment.js locale configuration + + hooks.defineLocale('sq', { + months: 'Janar_Shkurt_Mars_Prill_Maj_Qershor_Korrik_Gusht_Shtator_Tetor_Nëntor_Dhjetor'.split( + '_' + ), + monthsShort: 'Jan_Shk_Mar_Pri_Maj_Qer_Kor_Gus_Sht_Tet_Nën_Dhj'.split('_'), + weekdays: 'E Diel_E Hënë_E Martë_E Mërkurë_E Enjte_E Premte_E Shtunë'.split( + '_' + ), + weekdaysShort: 'Die_Hën_Mar_Mër_Enj_Pre_Sht'.split('_'), + weekdaysMin: 'D_H_Ma_Më_E_P_Sh'.split('_'), + weekdaysParseExact: true, + meridiemParse: /PD|MD/, + isPM: function (input) { + return input.charAt(0) === 'M'; + }, + meridiem: function (hours, minutes, isLower) { + return hours < 12 ? 'PD' : 'MD'; + }, + longDateFormat: { + LT: 'HH:mm', + LTS: 'HH:mm:ss', + L: 'DD/MM/YYYY', + LL: 'D MMMM YYYY', + LLL: 'D MMMM YYYY HH:mm', + LLLL: 'dddd, D MMMM YYYY HH:mm', + }, + calendar: { + sameDay: '[Sot në] LT', + nextDay: '[Nesër në] LT', + nextWeek: 'dddd [në] LT', + lastDay: '[Dje në] LT', + lastWeek: 'dddd [e kaluar në] LT', + sameElse: 'L', + }, + relativeTime: { + future: 'në %s', + past: '%s më parë', + s: 'disa sekonda', + ss: '%d sekonda', + m: 'një minutë', + mm: '%d minuta', + h: 'një orë', + hh: '%d orë', + d: 'një ditë', + dd: '%d ditë', + M: 'një muaj', + MM: '%d muaj', + y: 'një vit', + yy: '%d vite', + }, + dayOfMonthOrdinalParse: /\d{1,2}\./, + ordinal: '%d.', + week: { + dow: 1, // Monday is the first day of the week. + doy: 4, // The week that contains Jan 4th is the first week of the year. + }, + }); + + //! moment.js locale configuration + + var translator$1 = { + words: { + //Different grammatical cases + ss: ['секунда', 'секунде', 'секунди'], + m: ['један минут', 'једне минуте'], + mm: ['минут', 'минуте', 'минута'], + h: ['један сат', 'једног сата'], + hh: ['сат', 'сата', 'сати'], + dd: ['дан', 'дана', 'дана'], + MM: ['месец', 'месеца', 'месеци'], + yy: ['година', 'године', 'година'], + }, + correctGrammaticalCase: function (number, wordKey) { + return number === 1 + ? wordKey[0] + : number >= 2 && number <= 4 + ? wordKey[1] + : wordKey[2]; + }, + translate: function (number, withoutSuffix, key) { + var wordKey = translator$1.words[key]; + if (key.length === 1) { + return withoutSuffix ? wordKey[0] : wordKey[1]; + } else { + return ( + number + + ' ' + + translator$1.correctGrammaticalCase(number, wordKey) + ); + } + }, + }; + + hooks.defineLocale('sr-cyrl', { + months: 'јануар_фебруар_март_април_мај_јун_јул_август_септембар_октобар_новембар_децембар'.split( + '_' + ), + monthsShort: 'јан._феб._мар._апр._мај_јун_јул_авг._сеп._окт._нов._дец.'.split( + '_' + ), + monthsParseExact: true, + weekdays: 'недеља_понедељак_уторак_среда_четвртак_петак_субота'.split('_'), + weekdaysShort: 'нед._пон._уто._сре._чет._пет._суб.'.split('_'), + weekdaysMin: 'не_по_ут_ср_че_пе_су'.split('_'), + weekdaysParseExact: true, + longDateFormat: { + LT: 'H:mm', + LTS: 'H:mm:ss', + L: 'DD.MM.YYYY', + LL: 'D. MMMM YYYY', + LLL: 'D. MMMM YYYY H:mm', + LLLL: 'dddd, D. MMMM YYYY H:mm', + }, + calendar: { + sameDay: '[данас у] LT', + nextDay: '[сутра у] LT', + nextWeek: function () { + switch (this.day()) { + case 0: + return '[у] [недељу] [у] LT'; + case 3: + return '[у] [среду] [у] LT'; + case 6: + return '[у] [суботу] [у] LT'; + case 1: + case 2: + case 4: + case 5: + return '[у] dddd [у] LT'; + } + }, + lastDay: '[јуче у] LT', + lastWeek: function () { + var lastWeekDays = [ + '[прошле] [недеље] [у] LT', + '[прошлог] [понедељка] [у] LT', + '[прошлог] [уторка] [у] LT', + '[прошле] [среде] [у] LT', + '[прошлог] [четвртка] [у] LT', + '[прошлог] [петка] [у] LT', + '[прошле] [суботе] [у] LT', + ]; + return lastWeekDays[this.day()]; + }, + sameElse: 'L', + }, + relativeTime: { + future: 'за %s', + past: 'пре %s', + s: 'неколико секунди', + ss: translator$1.translate, + m: translator$1.translate, + mm: translator$1.translate, + h: translator$1.translate, + hh: translator$1.translate, + d: 'дан', + dd: translator$1.translate, + M: 'месец', + MM: translator$1.translate, + y: 'годину', + yy: translator$1.translate, + }, + dayOfMonthOrdinalParse: /\d{1,2}\./, + ordinal: '%d.', + week: { + dow: 1, // Monday is the first day of the week. + doy: 7, // The week that contains Jan 7th is the first week of the year. + }, + }); + + //! moment.js locale configuration + + var translator$2 = { + words: { + //Different grammatical cases + ss: ['sekunda', 'sekunde', 'sekundi'], + m: ['jedan minut', 'jedne minute'], + mm: ['minut', 'minute', 'minuta'], + h: ['jedan sat', 'jednog sata'], + hh: ['sat', 'sata', 'sati'], + dd: ['dan', 'dana', 'dana'], + MM: ['mesec', 'meseca', 'meseci'], + yy: ['godina', 'godine', 'godina'], + }, + correctGrammaticalCase: function (number, wordKey) { + return number === 1 + ? wordKey[0] + : number >= 2 && number <= 4 + ? wordKey[1] + : wordKey[2]; + }, + translate: function (number, withoutSuffix, key) { + var wordKey = translator$2.words[key]; + if (key.length === 1) { + return withoutSuffix ? wordKey[0] : wordKey[1]; + } else { + return ( + number + + ' ' + + translator$2.correctGrammaticalCase(number, wordKey) + ); + } + }, + }; + + hooks.defineLocale('sr', { + months: 'januar_februar_mart_april_maj_jun_jul_avgust_septembar_oktobar_novembar_decembar'.split( + '_' + ), + monthsShort: 'jan._feb._mar._apr._maj_jun_jul_avg._sep._okt._nov._dec.'.split( + '_' + ), + monthsParseExact: true, + weekdays: 'nedelja_ponedeljak_utorak_sreda_četvrtak_petak_subota'.split( + '_' + ), + weekdaysShort: 'ned._pon._uto._sre._čet._pet._sub.'.split('_'), + weekdaysMin: 'ne_po_ut_sr_če_pe_su'.split('_'), + weekdaysParseExact: true, + longDateFormat: { + LT: 'H:mm', + LTS: 'H:mm:ss', + L: 'DD.MM.YYYY', + LL: 'D. MMMM YYYY', + LLL: 'D. MMMM YYYY H:mm', + LLLL: 'dddd, D. MMMM YYYY H:mm', + }, + calendar: { + sameDay: '[danas u] LT', + nextDay: '[sutra u] LT', + nextWeek: function () { + switch (this.day()) { + case 0: + return '[u] [nedelju] [u] LT'; + case 3: + return '[u] [sredu] [u] LT'; + case 6: + return '[u] [subotu] [u] LT'; + case 1: + case 2: + case 4: + case 5: + return '[u] dddd [u] LT'; + } + }, + lastDay: '[juče u] LT', + lastWeek: function () { + var lastWeekDays = [ + '[prošle] [nedelje] [u] LT', + '[prošlog] [ponedeljka] [u] LT', + '[prošlog] [utorka] [u] LT', + '[prošle] [srede] [u] LT', + '[prošlog] [četvrtka] [u] LT', + '[prošlog] [petka] [u] LT', + '[prošle] [subote] [u] LT', + ]; + return lastWeekDays[this.day()]; + }, + sameElse: 'L', + }, + relativeTime: { + future: 'za %s', + past: 'pre %s', + s: 'nekoliko sekundi', + ss: translator$2.translate, + m: translator$2.translate, + mm: translator$2.translate, + h: translator$2.translate, + hh: translator$2.translate, + d: 'dan', + dd: translator$2.translate, + M: 'mesec', + MM: translator$2.translate, + y: 'godinu', + yy: translator$2.translate, + }, + dayOfMonthOrdinalParse: /\d{1,2}\./, + ordinal: '%d.', + week: { + dow: 1, // Monday is the first day of the week. + doy: 7, // The week that contains Jan 7th is the first week of the year. + }, + }); + + //! moment.js locale configuration + + hooks.defineLocale('ss', { + months: "Bhimbidvwane_Indlovana_Indlov'lenkhulu_Mabasa_Inkhwekhweti_Inhlaba_Kholwane_Ingci_Inyoni_Imphala_Lweti_Ingongoni".split( + '_' + ), + monthsShort: 'Bhi_Ina_Inu_Mab_Ink_Inh_Kho_Igc_Iny_Imp_Lwe_Igo'.split('_'), + weekdays: 'Lisontfo_Umsombuluko_Lesibili_Lesitsatfu_Lesine_Lesihlanu_Umgcibelo'.split( + '_' + ), + weekdaysShort: 'Lis_Umb_Lsb_Les_Lsi_Lsh_Umg'.split('_'), + weekdaysMin: 'Li_Us_Lb_Lt_Ls_Lh_Ug'.split('_'), + weekdaysParseExact: true, + longDateFormat: { + LT: 'h:mm A', + LTS: 'h:mm:ss A', + L: 'DD/MM/YYYY', + LL: 'D MMMM YYYY', + LLL: 'D MMMM YYYY h:mm A', + LLLL: 'dddd, D MMMM YYYY h:mm A', + }, + calendar: { + sameDay: '[Namuhla nga] LT', + nextDay: '[Kusasa nga] LT', + nextWeek: 'dddd [nga] LT', + lastDay: '[Itolo nga] LT', + lastWeek: 'dddd [leliphelile] [nga] LT', + sameElse: 'L', + }, + relativeTime: { + future: 'nga %s', + past: 'wenteka nga %s', + s: 'emizuzwana lomcane', + ss: '%d mzuzwana', + m: 'umzuzu', + mm: '%d emizuzu', + h: 'lihora', + hh: '%d emahora', + d: 'lilanga', + dd: '%d emalanga', + M: 'inyanga', + MM: '%d tinyanga', + y: 'umnyaka', + yy: '%d iminyaka', + }, + meridiemParse: /ekuseni|emini|entsambama|ebusuku/, + meridiem: function (hours, minutes, isLower) { + if (hours < 11) { + return 'ekuseni'; + } else if (hours < 15) { + return 'emini'; + } else if (hours < 19) { + return 'entsambama'; + } else { + return 'ebusuku'; + } + }, + meridiemHour: function (hour, meridiem) { + if (hour === 12) { + hour = 0; + } + if (meridiem === 'ekuseni') { + return hour; + } else if (meridiem === 'emini') { + return hour >= 11 ? hour : hour + 12; + } else if (meridiem === 'entsambama' || meridiem === 'ebusuku') { + if (hour === 0) { + return 0; + } + return hour + 12; + } + }, + dayOfMonthOrdinalParse: /\d{1,2}/, + ordinal: '%d', + week: { + dow: 1, // Monday is the first day of the week. + doy: 4, // The week that contains Jan 4th is the first week of the year. + }, + }); + + //! moment.js locale configuration + + hooks.defineLocale('sv', { + months: 'januari_februari_mars_april_maj_juni_juli_augusti_september_oktober_november_december'.split( + '_' + ), + monthsShort: 'jan_feb_mar_apr_maj_jun_jul_aug_sep_okt_nov_dec'.split('_'), + weekdays: 'söndag_måndag_tisdag_onsdag_torsdag_fredag_lördag'.split('_'), + weekdaysShort: 'sön_mån_tis_ons_tor_fre_lör'.split('_'), + weekdaysMin: 'sö_må_ti_on_to_fr_lö'.split('_'), + longDateFormat: { + LT: 'HH:mm', + LTS: 'HH:mm:ss', + L: 'YYYY-MM-DD', + LL: 'D MMMM YYYY', + LLL: 'D MMMM YYYY [kl.] HH:mm', + LLLL: 'dddd D MMMM YYYY [kl.] HH:mm', + lll: 'D MMM YYYY HH:mm', + llll: 'ddd D MMM YYYY HH:mm', + }, + calendar: { + sameDay: '[Idag] LT', + nextDay: '[Imorgon] LT', + lastDay: '[Igår] LT', + nextWeek: '[På] dddd LT', + lastWeek: '[I] dddd[s] LT', + sameElse: 'L', + }, + relativeTime: { + future: 'om %s', + past: 'för %s sedan', + s: 'några sekunder', + ss: '%d sekunder', + m: 'en minut', + mm: '%d minuter', + h: 'en timme', + hh: '%d timmar', + d: 'en dag', + dd: '%d dagar', + M: 'en månad', + MM: '%d månader', + y: 'ett år', + yy: '%d år', + }, + dayOfMonthOrdinalParse: /\d{1,2}(\:e|\:a)/, + ordinal: function (number) { + var b = number % 10, + output = + ~~((number % 100) / 10) === 1 + ? ':e' + : b === 1 + ? ':a' + : b === 2 + ? ':a' + : b === 3 + ? ':e' + : ':e'; + return number + output; + }, + week: { + dow: 1, // Monday is the first day of the week. + doy: 4, // The week that contains Jan 4th is the first week of the year. + }, + }); + + //! moment.js locale configuration + + hooks.defineLocale('sw', { + months: 'Januari_Februari_Machi_Aprili_Mei_Juni_Julai_Agosti_Septemba_Oktoba_Novemba_Desemba'.split( + '_' + ), + monthsShort: 'Jan_Feb_Mac_Apr_Mei_Jun_Jul_Ago_Sep_Okt_Nov_Des'.split('_'), + weekdays: 'Jumapili_Jumatatu_Jumanne_Jumatano_Alhamisi_Ijumaa_Jumamosi'.split( + '_' + ), + weekdaysShort: 'Jpl_Jtat_Jnne_Jtan_Alh_Ijm_Jmos'.split('_'), + weekdaysMin: 'J2_J3_J4_J5_Al_Ij_J1'.split('_'), + weekdaysParseExact: true, + longDateFormat: { + LT: 'hh:mm A', + LTS: 'HH:mm:ss', + L: 'DD.MM.YYYY', + LL: 'D MMMM YYYY', + LLL: 'D MMMM YYYY HH:mm', + LLLL: 'dddd, D MMMM YYYY HH:mm', + }, + calendar: { + sameDay: '[leo saa] LT', + nextDay: '[kesho saa] LT', + nextWeek: '[wiki ijayo] dddd [saat] LT', + lastDay: '[jana] LT', + lastWeek: '[wiki iliyopita] dddd [saat] LT', + sameElse: 'L', + }, + relativeTime: { + future: '%s baadaye', + past: 'tokea %s', + s: 'hivi punde', + ss: 'sekunde %d', + m: 'dakika moja', + mm: 'dakika %d', + h: 'saa limoja', + hh: 'masaa %d', + d: 'siku moja', + dd: 'siku %d', + M: 'mwezi mmoja', + MM: 'miezi %d', + y: 'mwaka mmoja', + yy: 'miaka %d', + }, + week: { + dow: 1, // Monday is the first day of the week. + doy: 7, // The week that contains Jan 7th is the first week of the year. + }, + }); + + //! moment.js locale configuration + + var symbolMap$f = { + '1': '௧', + '2': '௨', + '3': '௩', + '4': '௪', + '5': '௫', + '6': '௬', + '7': '௭', + '8': '௮', + '9': '௯', + '0': '௦', + }, + numberMap$e = { + '௧': '1', + '௨': '2', + '௩': '3', + '௪': '4', + '௫': '5', + '௬': '6', + '௭': '7', + '௮': '8', + '௯': '9', + '௦': '0', + }; + + hooks.defineLocale('ta', { + months: 'ஜனவரி_பிப்ரவரி_மார்ச்_ஏப்ரல்_மே_ஜூன்_ஜூலை_ஆகஸ்ட்_செப்டெம்பர்_அக்டோபர்_நவம்பர்_டிசம்பர்'.split( + '_' + ), + monthsShort: 'ஜனவரி_பிப்ரவரி_மார்ச்_ஏப்ரல்_மே_ஜூன்_ஜூலை_ஆகஸ்ட்_செப்டெம்பர்_அக்டோபர்_நவம்பர்_டிசம்பர்'.split( + '_' + ), + weekdays: 'ஞாயிற்றுக்கிழமை_திங்கட்கிழமை_செவ்வாய்கிழமை_புதன்கிழமை_வியாழக்கிழமை_வெள்ளிக்கிழமை_சனிக்கிழமை'.split( + '_' + ), + weekdaysShort: 'ஞாயிறு_திங்கள்_செவ்வாய்_புதன்_வியாழன்_வெள்ளி_சனி'.split( + '_' + ), + weekdaysMin: 'ஞா_தி_செ_பு_வி_வெ_ச'.split('_'), + longDateFormat: { + LT: 'HH:mm', + LTS: 'HH:mm:ss', + L: 'DD/MM/YYYY', + LL: 'D MMMM YYYY', + LLL: 'D MMMM YYYY, HH:mm', + LLLL: 'dddd, D MMMM YYYY, HH:mm', + }, + calendar: { + sameDay: '[இன்று] LT', + nextDay: '[நாளை] LT', + nextWeek: 'dddd, LT', + lastDay: '[நேற்று] LT', + lastWeek: '[கடந்த வாரம்] dddd, LT', + sameElse: 'L', + }, + relativeTime: { + future: '%s இல்', + past: '%s முன்', + s: 'ஒரு சில விநாடிகள்', + ss: '%d விநாடிகள்', + m: 'ஒரு நிமிடம்', + mm: '%d நிமிடங்கள்', + h: 'ஒரு மணி நேரம்', + hh: '%d மணி நேரம்', + d: 'ஒரு நாள்', + dd: '%d நாட்கள்', + M: 'ஒரு மாதம்', + MM: '%d மாதங்கள்', + y: 'ஒரு வருடம்', + yy: '%d ஆண்டுகள்', + }, + dayOfMonthOrdinalParse: /\d{1,2}வது/, + ordinal: function (number) { + return number + 'வது'; + }, + preparse: function (string) { + return string.replace(/[௧௨௩௪௫௬௭௮௯௦]/g, function (match) { + return numberMap$e[match]; + }); + }, + postformat: function (string) { + return string.replace(/\d/g, function (match) { + return symbolMap$f[match]; + }); + }, + // refer http://ta.wikipedia.org/s/1er1 + meridiemParse: /யாமம்|வைகறை|காலை|நண்பகல்|எற்பாடு|மாலை/, + meridiem: function (hour, minute, isLower) { + if (hour < 2) { + return ' யாமம்'; + } else if (hour < 6) { + return ' வைகறை'; // வைகறை + } else if (hour < 10) { + return ' காலை'; // காலை + } else if (hour < 14) { + return ' நண்பகல்'; // நண்பகல் + } else if (hour < 18) { + return ' எற்பாடு'; // எற்பாடு + } else if (hour < 22) { + return ' மாலை'; // மாலை + } else { + return ' யாமம்'; + } + }, + meridiemHour: function (hour, meridiem) { + if (hour === 12) { + hour = 0; + } + if (meridiem === 'யாமம்') { + return hour < 2 ? hour : hour + 12; + } else if (meridiem === 'வைகறை' || meridiem === 'காலை') { + return hour; + } else if (meridiem === 'நண்பகல்') { + return hour >= 10 ? hour : hour + 12; + } else { + return hour + 12; + } + }, + week: { + dow: 0, // Sunday is the first day of the week. + doy: 6, // The week that contains Jan 6th is the first week of the year. + }, + }); + + //! moment.js locale configuration + + hooks.defineLocale('te', { + months: 'జనవరి_ఫిబ్రవరి_మార్చి_ఏప్రిల్_మే_జూన్_జులై_ఆగస్టు_సెప్టెంబర్_అక్టోబర్_నవంబర్_డిసెంబర్'.split( + '_' + ), + monthsShort: 'జన._ఫిబ్ర._మార్చి_ఏప్రి._మే_జూన్_జులై_ఆగ._సెప్._అక్టో._నవ._డిసె.'.split( + '_' + ), + monthsParseExact: true, + weekdays: 'ఆదివారం_సోమవారం_మంగళవారం_బుధవారం_గురువారం_శుక్రవారం_శనివారం'.split( + '_' + ), + weekdaysShort: 'ఆది_సోమ_మంగళ_బుధ_గురు_శుక్ర_శని'.split('_'), + weekdaysMin: 'ఆ_సో_మం_బు_గు_శు_శ'.split('_'), + longDateFormat: { + LT: 'A h:mm', + LTS: 'A h:mm:ss', + L: 'DD/MM/YYYY', + LL: 'D MMMM YYYY', + LLL: 'D MMMM YYYY, A h:mm', + LLLL: 'dddd, D MMMM YYYY, A h:mm', + }, + calendar: { + sameDay: '[నేడు] LT', + nextDay: '[రేపు] LT', + nextWeek: 'dddd, LT', + lastDay: '[నిన్న] LT', + lastWeek: '[గత] dddd, LT', + sameElse: 'L', + }, + relativeTime: { + future: '%s లో', + past: '%s క్రితం', + s: 'కొన్ని క్షణాలు', + ss: '%d సెకన్లు', + m: 'ఒక నిమిషం', + mm: '%d నిమిషాలు', + h: 'ఒక గంట', + hh: '%d గంటలు', + d: 'ఒక రోజు', + dd: '%d రోజులు', + M: 'ఒక నెల', + MM: '%d నెలలు', + y: 'ఒక సంవత్సరం', + yy: '%d సంవత్సరాలు', + }, + dayOfMonthOrdinalParse: /\d{1,2}వ/, + ordinal: '%dవ', + meridiemParse: /రాత్రి|ఉదయం|మధ్యాహ్నం|సాయంత్రం/, + meridiemHour: function (hour, meridiem) { + if (hour === 12) { + hour = 0; + } + if (meridiem === 'రాత్రి') { + return hour < 4 ? hour : hour + 12; + } else if (meridiem === 'ఉదయం') { + return hour; + } else if (meridiem === 'మధ్యాహ్నం') { + return hour >= 10 ? hour : hour + 12; + } else if (meridiem === 'సాయంత్రం') { + return hour + 12; + } + }, + meridiem: function (hour, minute, isLower) { + if (hour < 4) { + return 'రాత్రి'; + } else if (hour < 10) { + return 'ఉదయం'; + } else if (hour < 17) { + return 'మధ్యాహ్నం'; + } else if (hour < 20) { + return 'సాయంత్రం'; + } else { + return 'రాత్రి'; + } + }, + week: { + dow: 0, // Sunday is the first day of the week. + doy: 6, // The week that contains Jan 6th is the first week of the year. + }, + }); + + //! moment.js locale configuration + + hooks.defineLocale('tet', { + months: 'Janeiru_Fevereiru_Marsu_Abril_Maiu_Juñu_Jullu_Agustu_Setembru_Outubru_Novembru_Dezembru'.split( + '_' + ), + monthsShort: 'Jan_Fev_Mar_Abr_Mai_Jun_Jul_Ago_Set_Out_Nov_Dez'.split('_'), + weekdays: 'Domingu_Segunda_Tersa_Kuarta_Kinta_Sesta_Sabadu'.split('_'), + weekdaysShort: 'Dom_Seg_Ters_Kua_Kint_Sest_Sab'.split('_'), + weekdaysMin: 'Do_Seg_Te_Ku_Ki_Ses_Sa'.split('_'), + longDateFormat: { + LT: 'HH:mm', + LTS: 'HH:mm:ss', + L: 'DD/MM/YYYY', + LL: 'D MMMM YYYY', + LLL: 'D MMMM YYYY HH:mm', + LLLL: 'dddd, D MMMM YYYY HH:mm', + }, + calendar: { + sameDay: '[Ohin iha] LT', + nextDay: '[Aban iha] LT', + nextWeek: 'dddd [iha] LT', + lastDay: '[Horiseik iha] LT', + lastWeek: 'dddd [semana kotuk] [iha] LT', + sameElse: 'L', + }, + relativeTime: { + future: 'iha %s', + past: '%s liuba', + s: 'segundu balun', + ss: 'segundu %d', + m: 'minutu ida', + mm: 'minutu %d', + h: 'oras ida', + hh: 'oras %d', + d: 'loron ida', + dd: 'loron %d', + M: 'fulan ida', + MM: 'fulan %d', + y: 'tinan ida', + yy: 'tinan %d', + }, + dayOfMonthOrdinalParse: /\d{1,2}(st|nd|rd|th)/, + ordinal: function (number) { + var b = number % 10, + output = + ~~((number % 100) / 10) === 1 + ? 'th' + : b === 1 + ? 'st' + : b === 2 + ? 'nd' + : b === 3 + ? 'rd' + : 'th'; + return number + output; + }, + week: { + dow: 1, // Monday is the first day of the week. + doy: 4, // The week that contains Jan 4th is the first week of the year. + }, + }); + + //! moment.js locale configuration + + var suffixes$3 = { + 0: '-ум', + 1: '-ум', + 2: '-юм', + 3: '-юм', + 4: '-ум', + 5: '-ум', + 6: '-ум', + 7: '-ум', + 8: '-ум', + 9: '-ум', + 10: '-ум', + 12: '-ум', + 13: '-ум', + 20: '-ум', + 30: '-юм', + 40: '-ум', + 50: '-ум', + 60: '-ум', + 70: '-ум', + 80: '-ум', + 90: '-ум', + 100: '-ум', + }; + + hooks.defineLocale('tg', { + months: 'январ_феврал_март_апрел_май_июн_июл_август_сентябр_октябр_ноябр_декабр'.split( + '_' + ), + monthsShort: 'янв_фев_мар_апр_май_июн_июл_авг_сен_окт_ноя_дек'.split('_'), + weekdays: 'якшанбе_душанбе_сешанбе_чоршанбе_панҷшанбе_ҷумъа_шанбе'.split( + '_' + ), + weekdaysShort: 'яшб_дшб_сшб_чшб_пшб_ҷум_шнб'.split('_'), + weekdaysMin: 'яш_дш_сш_чш_пш_ҷм_шб'.split('_'), + longDateFormat: { + LT: 'HH:mm', + LTS: 'HH:mm:ss', + L: 'DD/MM/YYYY', + LL: 'D MMMM YYYY', + LLL: 'D MMMM YYYY HH:mm', + LLLL: 'dddd, D MMMM YYYY HH:mm', + }, + calendar: { + sameDay: '[Имрӯз соати] LT', + nextDay: '[Пагоҳ соати] LT', + lastDay: '[Дирӯз соати] LT', + nextWeek: 'dddd[и] [ҳафтаи оянда соати] LT', + lastWeek: 'dddd[и] [ҳафтаи гузашта соати] LT', + sameElse: 'L', + }, + relativeTime: { + future: 'баъди %s', + past: '%s пеш', + s: 'якчанд сония', + m: 'як дақиқа', + mm: '%d дақиқа', + h: 'як соат', + hh: '%d соат', + d: 'як рӯз', + dd: '%d рӯз', + M: 'як моҳ', + MM: '%d моҳ', + y: 'як сол', + yy: '%d сол', + }, + meridiemParse: /шаб|субҳ|рӯз|бегоҳ/, + meridiemHour: function (hour, meridiem) { + if (hour === 12) { + hour = 0; + } + if (meridiem === 'шаб') { + return hour < 4 ? hour : hour + 12; + } else if (meridiem === 'субҳ') { + return hour; + } else if (meridiem === 'рӯз') { + return hour >= 11 ? hour : hour + 12; + } else if (meridiem === 'бегоҳ') { + return hour + 12; + } + }, + meridiem: function (hour, minute, isLower) { + if (hour < 4) { + return 'шаб'; + } else if (hour < 11) { + return 'субҳ'; + } else if (hour < 16) { + return 'рӯз'; + } else if (hour < 19) { + return 'бегоҳ'; + } else { + return 'шаб'; + } + }, + dayOfMonthOrdinalParse: /\d{1,2}-(ум|юм)/, + ordinal: function (number) { + var a = number % 10, + b = number >= 100 ? 100 : null; + return number + (suffixes$3[number] || suffixes$3[a] || suffixes$3[b]); + }, + week: { + dow: 1, // Monday is the first day of the week. + doy: 7, // The week that contains Jan 1th is the first week of the year. + }, + }); + + //! moment.js locale configuration + + hooks.defineLocale('th', { + months: 'มกราคม_กุมภาพันธ์_มีนาคม_เมษายน_พฤษภาคม_มิถุนายน_กรกฎาคม_สิงหาคม_กันยายน_ตุลาคม_พฤศจิกายน_ธันวาคม'.split( + '_' + ), + monthsShort: 'ม.ค._ก.พ._มี.ค._เม.ย._พ.ค._มิ.ย._ก.ค._ส.ค._ก.ย._ต.ค._พ.ย._ธ.ค.'.split( + '_' + ), + monthsParseExact: true, + weekdays: 'อาทิตย์_จันทร์_อังคาร_พุธ_พฤหัสบดี_ศุกร์_เสาร์'.split('_'), + weekdaysShort: 'อาทิตย์_จันทร์_อังคาร_พุธ_พฤหัส_ศุกร์_เสาร์'.split('_'), // yes, three characters difference + weekdaysMin: 'อา._จ._อ._พ._พฤ._ศ._ส.'.split('_'), + weekdaysParseExact: true, + longDateFormat: { + LT: 'H:mm', + LTS: 'H:mm:ss', + L: 'DD/MM/YYYY', + LL: 'D MMMM YYYY', + LLL: 'D MMMM YYYY เวลา H:mm', + LLLL: 'วันddddที่ D MMMM YYYY เวลา H:mm', + }, + meridiemParse: /ก่อนเที่ยง|หลังเที่ยง/, + isPM: function (input) { + return input === 'หลังเที่ยง'; + }, + meridiem: function (hour, minute, isLower) { + if (hour < 12) { + return 'ก่อนเที่ยง'; + } else { + return 'หลังเที่ยง'; + } + }, + calendar: { + sameDay: '[วันนี้ เวลา] LT', + nextDay: '[พรุ่งนี้ เวลา] LT', + nextWeek: 'dddd[หน้า เวลา] LT', + lastDay: '[เมื่อวานนี้ เวลา] LT', + lastWeek: '[วัน]dddd[ที่แล้ว เวลา] LT', + sameElse: 'L', + }, + relativeTime: { + future: 'อีก %s', + past: '%sที่แล้ว', + s: 'ไม่กี่วินาที', + ss: '%d วินาที', + m: '1 นาที', + mm: '%d นาที', + h: '1 ชั่วโมง', + hh: '%d ชั่วโมง', + d: '1 วัน', + dd: '%d วัน', + M: '1 เดือน', + MM: '%d เดือน', + y: '1 ปี', + yy: '%d ปี', + }, + }); + + //! moment.js locale configuration + + var suffixes$4 = { + 1: "'inji", + 5: "'inji", + 8: "'inji", + 70: "'inji", + 80: "'inji", + 2: "'nji", + 7: "'nji", + 20: "'nji", + 50: "'nji", + 3: "'ünji", + 4: "'ünji", + 100: "'ünji", + 6: "'njy", + 9: "'unjy", + 10: "'unjy", + 30: "'unjy", + 60: "'ynjy", + 90: "'ynjy", + }; + + hooks.defineLocale('tk', { + months: 'Ýanwar_Fewral_Mart_Aprel_Maý_Iýun_Iýul_Awgust_Sentýabr_Oktýabr_Noýabr_Dekabr'.split( + '_' + ), + monthsShort: 'Ýan_Few_Mar_Apr_Maý_Iýn_Iýl_Awg_Sen_Okt_Noý_Dek'.split('_'), + weekdays: 'Ýekşenbe_Duşenbe_Sişenbe_Çarşenbe_Penşenbe_Anna_Şenbe'.split( + '_' + ), + weekdaysShort: 'Ýek_Duş_Siş_Çar_Pen_Ann_Şen'.split('_'), + weekdaysMin: 'Ýk_Dş_Sş_Çr_Pn_An_Şn'.split('_'), + longDateFormat: { + LT: 'HH:mm', + LTS: 'HH:mm:ss', + L: 'DD.MM.YYYY', + LL: 'D MMMM YYYY', + LLL: 'D MMMM YYYY HH:mm', + LLLL: 'dddd, D MMMM YYYY HH:mm', + }, + calendar: { + sameDay: '[bugün sagat] LT', + nextDay: '[ertir sagat] LT', + nextWeek: '[indiki] dddd [sagat] LT', + lastDay: '[düýn] LT', + lastWeek: '[geçen] dddd [sagat] LT', + sameElse: 'L', + }, + relativeTime: { + future: '%s soň', + past: '%s öň', + s: 'birnäçe sekunt', + m: 'bir minut', + mm: '%d minut', + h: 'bir sagat', + hh: '%d sagat', + d: 'bir gün', + dd: '%d gün', + M: 'bir aý', + MM: '%d aý', + y: 'bir ýyl', + yy: '%d ýyl', + }, + ordinal: function (number, period) { + switch (period) { + case 'd': + case 'D': + case 'Do': + case 'DD': + return number; + default: + if (number === 0) { + // special case for zero + return number + "'unjy"; + } + var a = number % 10, + b = (number % 100) - a, + c = number >= 100 ? 100 : null; + return number + (suffixes$4[a] || suffixes$4[b] || suffixes$4[c]); + } + }, + week: { + dow: 1, // Monday is the first day of the week. + doy: 7, // The week that contains Jan 7th is the first week of the year. + }, + }); + + //! moment.js locale configuration + + hooks.defineLocale('tl-ph', { + months: 'Enero_Pebrero_Marso_Abril_Mayo_Hunyo_Hulyo_Agosto_Setyembre_Oktubre_Nobyembre_Disyembre'.split( + '_' + ), + monthsShort: 'Ene_Peb_Mar_Abr_May_Hun_Hul_Ago_Set_Okt_Nob_Dis'.split('_'), + weekdays: 'Linggo_Lunes_Martes_Miyerkules_Huwebes_Biyernes_Sabado'.split( + '_' + ), + weekdaysShort: 'Lin_Lun_Mar_Miy_Huw_Biy_Sab'.split('_'), + weekdaysMin: 'Li_Lu_Ma_Mi_Hu_Bi_Sab'.split('_'), + longDateFormat: { + LT: 'HH:mm', + LTS: 'HH:mm:ss', + L: 'MM/D/YYYY', + LL: 'MMMM D, YYYY', + LLL: 'MMMM D, YYYY HH:mm', + LLLL: 'dddd, MMMM DD, YYYY HH:mm', + }, + calendar: { + sameDay: 'LT [ngayong araw]', + nextDay: '[Bukas ng] LT', + nextWeek: 'LT [sa susunod na] dddd', + lastDay: 'LT [kahapon]', + lastWeek: 'LT [noong nakaraang] dddd', + sameElse: 'L', + }, + relativeTime: { + future: 'sa loob ng %s', + past: '%s ang nakalipas', + s: 'ilang segundo', + ss: '%d segundo', + m: 'isang minuto', + mm: '%d minuto', + h: 'isang oras', + hh: '%d oras', + d: 'isang araw', + dd: '%d araw', + M: 'isang buwan', + MM: '%d buwan', + y: 'isang taon', + yy: '%d taon', + }, + dayOfMonthOrdinalParse: /\d{1,2}/, + ordinal: function (number) { + return number; + }, + week: { + dow: 1, // Monday is the first day of the week. + doy: 4, // The week that contains Jan 4th is the first week of the year. + }, + }); + + //! moment.js locale configuration + + var numbersNouns = 'pagh_wa’_cha’_wej_loS_vagh_jav_Soch_chorgh_Hut'.split('_'); + + function translateFuture(output) { + var time = output; + time = + output.indexOf('jaj') !== -1 + ? time.slice(0, -3) + 'leS' + : output.indexOf('jar') !== -1 + ? time.slice(0, -3) + 'waQ' + : output.indexOf('DIS') !== -1 + ? time.slice(0, -3) + 'nem' + : time + ' pIq'; + return time; + } + + function translatePast(output) { + var time = output; + time = + output.indexOf('jaj') !== -1 + ? time.slice(0, -3) + 'Hu’' + : output.indexOf('jar') !== -1 + ? time.slice(0, -3) + 'wen' + : output.indexOf('DIS') !== -1 + ? time.slice(0, -3) + 'ben' + : time + ' ret'; + return time; + } + + function translate$a(number, withoutSuffix, string, isFuture) { + var numberNoun = numberAsNoun(number); + switch (string) { + case 'ss': + return numberNoun + ' lup'; + case 'mm': + return numberNoun + ' tup'; + case 'hh': + return numberNoun + ' rep'; + case 'dd': + return numberNoun + ' jaj'; + case 'MM': + return numberNoun + ' jar'; + case 'yy': + return numberNoun + ' DIS'; + } + } + + function numberAsNoun(number) { + var hundred = Math.floor((number % 1000) / 100), + ten = Math.floor((number % 100) / 10), + one = number % 10, + word = ''; + if (hundred > 0) { + word += numbersNouns[hundred] + 'vatlh'; + } + if (ten > 0) { + word += (word !== '' ? ' ' : '') + numbersNouns[ten] + 'maH'; + } + if (one > 0) { + word += (word !== '' ? ' ' : '') + numbersNouns[one]; + } + return word === '' ? 'pagh' : word; + } + + hooks.defineLocale('tlh', { + months: 'tera’ jar wa’_tera’ jar cha’_tera’ jar wej_tera’ jar loS_tera’ jar vagh_tera’ jar jav_tera’ jar Soch_tera’ jar chorgh_tera’ jar Hut_tera’ jar wa’maH_tera’ jar wa’maH wa’_tera’ jar wa’maH cha’'.split( + '_' + ), + monthsShort: 'jar wa’_jar cha’_jar wej_jar loS_jar vagh_jar jav_jar Soch_jar chorgh_jar Hut_jar wa’maH_jar wa’maH wa’_jar wa’maH cha’'.split( + '_' + ), + monthsParseExact: true, + weekdays: 'lojmItjaj_DaSjaj_povjaj_ghItlhjaj_loghjaj_buqjaj_ghInjaj'.split( + '_' + ), + weekdaysShort: 'lojmItjaj_DaSjaj_povjaj_ghItlhjaj_loghjaj_buqjaj_ghInjaj'.split( + '_' + ), + weekdaysMin: 'lojmItjaj_DaSjaj_povjaj_ghItlhjaj_loghjaj_buqjaj_ghInjaj'.split( + '_' + ), + longDateFormat: { + LT: 'HH:mm', + LTS: 'HH:mm:ss', + L: 'DD.MM.YYYY', + LL: 'D MMMM YYYY', + LLL: 'D MMMM YYYY HH:mm', + LLLL: 'dddd, D MMMM YYYY HH:mm', + }, + calendar: { + sameDay: '[DaHjaj] LT', + nextDay: '[wa’leS] LT', + nextWeek: 'LLL', + lastDay: '[wa’Hu’] LT', + lastWeek: 'LLL', + sameElse: 'L', + }, + relativeTime: { + future: translateFuture, + past: translatePast, + s: 'puS lup', + ss: translate$a, + m: 'wa’ tup', + mm: translate$a, + h: 'wa’ rep', + hh: translate$a, + d: 'wa’ jaj', + dd: translate$a, + M: 'wa’ jar', + MM: translate$a, + y: 'wa’ DIS', + yy: translate$a, + }, + dayOfMonthOrdinalParse: /\d{1,2}\./, + ordinal: '%d.', + week: { + dow: 1, // Monday is the first day of the week. + doy: 4, // The week that contains Jan 4th is the first week of the year. + }, + }); + + //! moment.js locale configuration + + var suffixes$5 = { + 1: "'inci", + 5: "'inci", + 8: "'inci", + 70: "'inci", + 80: "'inci", + 2: "'nci", + 7: "'nci", + 20: "'nci", + 50: "'nci", + 3: "'üncü", + 4: "'üncü", + 100: "'üncü", + 6: "'ncı", + 9: "'uncu", + 10: "'uncu", + 30: "'uncu", + 60: "'ıncı", + 90: "'ıncı", + }; + + hooks.defineLocale('tr', { + months: 'Ocak_Şubat_Mart_Nisan_Mayıs_Haziran_Temmuz_Ağustos_Eylül_Ekim_Kasım_Aralık'.split( + '_' + ), + monthsShort: 'Oca_Şub_Mar_Nis_May_Haz_Tem_Ağu_Eyl_Eki_Kas_Ara'.split('_'), + weekdays: 'Pazar_Pazartesi_Salı_Çarşamba_Perşembe_Cuma_Cumartesi'.split( + '_' + ), + weekdaysShort: 'Paz_Pts_Sal_Çar_Per_Cum_Cts'.split('_'), + weekdaysMin: 'Pz_Pt_Sa_Ça_Pe_Cu_Ct'.split('_'), + meridiem: function (hours, minutes, isLower) { + if (hours < 12) { + return isLower ? 'öö' : 'ÖÖ'; + } else { + return isLower ? 'ös' : 'ÖS'; + } + }, + meridiemParse: /öö|ÖÖ|ös|ÖS/, + isPM: function (input) { + return input === 'ös' || input === 'ÖS'; + }, + longDateFormat: { + LT: 'HH:mm', + LTS: 'HH:mm:ss', + L: 'DD.MM.YYYY', + LL: 'D MMMM YYYY', + LLL: 'D MMMM YYYY HH:mm', + LLLL: 'dddd, D MMMM YYYY HH:mm', + }, + calendar: { + sameDay: '[bugün saat] LT', + nextDay: '[yarın saat] LT', + nextWeek: '[gelecek] dddd [saat] LT', + lastDay: '[dün] LT', + lastWeek: '[geçen] dddd [saat] LT', + sameElse: 'L', + }, + relativeTime: { + future: '%s sonra', + past: '%s önce', + s: 'birkaç saniye', + ss: '%d saniye', + m: 'bir dakika', + mm: '%d dakika', + h: 'bir saat', + hh: '%d saat', + d: 'bir gün', + dd: '%d gün', + M: 'bir ay', + MM: '%d ay', + y: 'bir yıl', + yy: '%d yıl', + }, + ordinal: function (number, period) { + switch (period) { + case 'd': + case 'D': + case 'Do': + case 'DD': + return number; + default: + if (number === 0) { + // special case for zero + return number + "'ıncı"; + } + var a = number % 10, + b = (number % 100) - a, + c = number >= 100 ? 100 : null; + return number + (suffixes$5[a] || suffixes$5[b] || suffixes$5[c]); + } + }, + week: { + dow: 1, // Monday is the first day of the week. + doy: 7, // The week that contains Jan 7th is the first week of the year. + }, + }); + + //! moment.js locale configuration + + // After the year there should be a slash and the amount of years since December 26, 1979 in Roman numerals. + // This is currently too difficult (maybe even impossible) to add. + hooks.defineLocale('tzl', { + months: 'Januar_Fevraglh_Març_Avrïu_Mai_Gün_Julia_Guscht_Setemvar_Listopäts_Noemvar_Zecemvar'.split( + '_' + ), + monthsShort: 'Jan_Fev_Mar_Avr_Mai_Gün_Jul_Gus_Set_Lis_Noe_Zec'.split('_'), + weekdays: 'Súladi_Lúneçi_Maitzi_Márcuri_Xhúadi_Viénerçi_Sáturi'.split('_'), + weekdaysShort: 'Súl_Lún_Mai_Már_Xhú_Vié_Sát'.split('_'), + weekdaysMin: 'Sú_Lú_Ma_Má_Xh_Vi_Sá'.split('_'), + longDateFormat: { + LT: 'HH.mm', + LTS: 'HH.mm.ss', + L: 'DD.MM.YYYY', + LL: 'D. MMMM [dallas] YYYY', + LLL: 'D. MMMM [dallas] YYYY HH.mm', + LLLL: 'dddd, [li] D. MMMM [dallas] YYYY HH.mm', + }, + meridiemParse: /d\'o|d\'a/i, + isPM: function (input) { + return "d'o" === input.toLowerCase(); + }, + meridiem: function (hours, minutes, isLower) { + if (hours > 11) { + return isLower ? "d'o" : "D'O"; + } else { + return isLower ? "d'a" : "D'A"; + } + }, + calendar: { + sameDay: '[oxhi à] LT', + nextDay: '[demà à] LT', + nextWeek: 'dddd [à] LT', + lastDay: '[ieiri à] LT', + lastWeek: '[sür el] dddd [lasteu à] LT', + sameElse: 'L', + }, + relativeTime: { + future: 'osprei %s', + past: 'ja%s', + s: processRelativeTime$8, + ss: processRelativeTime$8, + m: processRelativeTime$8, + mm: processRelativeTime$8, + h: processRelativeTime$8, + hh: processRelativeTime$8, + d: processRelativeTime$8, + dd: processRelativeTime$8, + M: processRelativeTime$8, + MM: processRelativeTime$8, + y: processRelativeTime$8, + yy: processRelativeTime$8, + }, + dayOfMonthOrdinalParse: /\d{1,2}\./, + ordinal: '%d.', + week: { + dow: 1, // Monday is the first day of the week. + doy: 4, // The week that contains Jan 4th is the first week of the year. + }, + }); + + function processRelativeTime$8(number, withoutSuffix, key, isFuture) { + var format = { + s: ['viensas secunds', "'iensas secunds"], + ss: [number + ' secunds', '' + number + ' secunds'], + m: ["'n míut", "'iens míut"], + mm: [number + ' míuts', '' + number + ' míuts'], + h: ["'n þora", "'iensa þora"], + hh: [number + ' þoras', '' + number + ' þoras'], + d: ["'n ziua", "'iensa ziua"], + dd: [number + ' ziuas', '' + number + ' ziuas'], + M: ["'n mes", "'iens mes"], + MM: [number + ' mesen', '' + number + ' mesen'], + y: ["'n ar", "'iens ar"], + yy: [number + ' ars', '' + number + ' ars'], + }; + return isFuture + ? format[key][0] + : withoutSuffix + ? format[key][0] + : format[key][1]; + } + + //! moment.js locale configuration + + hooks.defineLocale('tzm-latn', { + months: 'innayr_brˤayrˤ_marˤsˤ_ibrir_mayyw_ywnyw_ywlywz_ɣwšt_šwtanbir_ktˤwbrˤ_nwwanbir_dwjnbir'.split( + '_' + ), + monthsShort: 'innayr_brˤayrˤ_marˤsˤ_ibrir_mayyw_ywnyw_ywlywz_ɣwšt_šwtanbir_ktˤwbrˤ_nwwanbir_dwjnbir'.split( + '_' + ), + weekdays: 'asamas_aynas_asinas_akras_akwas_asimwas_asiḍyas'.split('_'), + weekdaysShort: 'asamas_aynas_asinas_akras_akwas_asimwas_asiḍyas'.split('_'), + weekdaysMin: 'asamas_aynas_asinas_akras_akwas_asimwas_asiḍyas'.split('_'), + longDateFormat: { + LT: 'HH:mm', + LTS: 'HH:mm:ss', + L: 'DD/MM/YYYY', + LL: 'D MMMM YYYY', + LLL: 'D MMMM YYYY HH:mm', + LLLL: 'dddd D MMMM YYYY HH:mm', + }, + calendar: { + sameDay: '[asdkh g] LT', + nextDay: '[aska g] LT', + nextWeek: 'dddd [g] LT', + lastDay: '[assant g] LT', + lastWeek: 'dddd [g] LT', + sameElse: 'L', + }, + relativeTime: { + future: 'dadkh s yan %s', + past: 'yan %s', + s: 'imik', + ss: '%d imik', + m: 'minuḍ', + mm: '%d minuḍ', + h: 'saɛa', + hh: '%d tassaɛin', + d: 'ass', + dd: '%d ossan', + M: 'ayowr', + MM: '%d iyyirn', + y: 'asgas', + yy: '%d isgasn', + }, + week: { + dow: 6, // Saturday is the first day of the week. + doy: 12, // The week that contains Jan 12th is the first week of the year. + }, + }); + + //! moment.js locale configuration + + hooks.defineLocale('tzm', { + months: 'ⵉⵏⵏⴰⵢⵔ_ⴱⵕⴰⵢⵕ_ⵎⴰⵕⵚ_ⵉⴱⵔⵉⵔ_ⵎⴰⵢⵢⵓ_ⵢⵓⵏⵢⵓ_ⵢⵓⵍⵢⵓⵣ_ⵖⵓⵛⵜ_ⵛⵓⵜⴰⵏⴱⵉⵔ_ⴽⵟⵓⴱⵕ_ⵏⵓⵡⴰⵏⴱⵉⵔ_ⴷⵓⵊⵏⴱⵉⵔ'.split( + '_' + ), + monthsShort: 'ⵉⵏⵏⴰⵢⵔ_ⴱⵕⴰⵢⵕ_ⵎⴰⵕⵚ_ⵉⴱⵔⵉⵔ_ⵎⴰⵢⵢⵓ_ⵢⵓⵏⵢⵓ_ⵢⵓⵍⵢⵓⵣ_ⵖⵓⵛⵜ_ⵛⵓⵜⴰⵏⴱⵉⵔ_ⴽⵟⵓⴱⵕ_ⵏⵓⵡⴰⵏⴱⵉⵔ_ⴷⵓⵊⵏⴱⵉⵔ'.split( + '_' + ), + weekdays: 'ⴰⵙⴰⵎⴰⵙ_ⴰⵢⵏⴰⵙ_ⴰⵙⵉⵏⴰⵙ_ⴰⴽⵔⴰⵙ_ⴰⴽⵡⴰⵙ_ⴰⵙⵉⵎⵡⴰⵙ_ⴰⵙⵉⴹⵢⴰⵙ'.split('_'), + weekdaysShort: 'ⴰⵙⴰⵎⴰⵙ_ⴰⵢⵏⴰⵙ_ⴰⵙⵉⵏⴰⵙ_ⴰⴽⵔⴰⵙ_ⴰⴽⵡⴰⵙ_ⴰⵙⵉⵎⵡⴰⵙ_ⴰⵙⵉⴹⵢⴰⵙ'.split('_'), + weekdaysMin: 'ⴰⵙⴰⵎⴰⵙ_ⴰⵢⵏⴰⵙ_ⴰⵙⵉⵏⴰⵙ_ⴰⴽⵔⴰⵙ_ⴰⴽⵡⴰⵙ_ⴰⵙⵉⵎⵡⴰⵙ_ⴰⵙⵉⴹⵢⴰⵙ'.split('_'), + longDateFormat: { + LT: 'HH:mm', + LTS: 'HH:mm:ss', + L: 'DD/MM/YYYY', + LL: 'D MMMM YYYY', + LLL: 'D MMMM YYYY HH:mm', + LLLL: 'dddd D MMMM YYYY HH:mm', + }, + calendar: { + sameDay: '[ⴰⵙⴷⵅ ⴴ] LT', + nextDay: '[ⴰⵙⴽⴰ ⴴ] LT', + nextWeek: 'dddd [ⴴ] LT', + lastDay: '[ⴰⵚⴰⵏⵜ ⴴ] LT', + lastWeek: 'dddd [ⴴ] LT', + sameElse: 'L', + }, + relativeTime: { + future: 'ⴷⴰⴷⵅ ⵙ ⵢⴰⵏ %s', + past: 'ⵢⴰⵏ %s', + s: 'ⵉⵎⵉⴽ', + ss: '%d ⵉⵎⵉⴽ', + m: 'ⵎⵉⵏⵓⴺ', + mm: '%d ⵎⵉⵏⵓⴺ', + h: 'ⵙⴰⵄⴰ', + hh: '%d ⵜⴰⵙⵙⴰⵄⵉⵏ', + d: 'ⴰⵙⵙ', + dd: '%d oⵙⵙⴰⵏ', + M: 'ⴰⵢoⵓⵔ', + MM: '%d ⵉⵢⵢⵉⵔⵏ', + y: 'ⴰⵙⴳⴰⵙ', + yy: '%d ⵉⵙⴳⴰⵙⵏ', + }, + week: { + dow: 6, // Saturday is the first day of the week. + doy: 12, // The week that contains Jan 12th is the first week of the year. + }, + }); + + //! moment.js locale configuration + + hooks.defineLocale('ug-cn', { + months: 'يانۋار_فېۋرال_مارت_ئاپرېل_ماي_ئىيۇن_ئىيۇل_ئاۋغۇست_سېنتەبىر_ئۆكتەبىر_نويابىر_دېكابىر'.split( + '_' + ), + monthsShort: 'يانۋار_فېۋرال_مارت_ئاپرېل_ماي_ئىيۇن_ئىيۇل_ئاۋغۇست_سېنتەبىر_ئۆكتەبىر_نويابىر_دېكابىر'.split( + '_' + ), + weekdays: 'يەكشەنبە_دۈشەنبە_سەيشەنبە_چارشەنبە_پەيشەنبە_جۈمە_شەنبە'.split( + '_' + ), + weekdaysShort: 'يە_دۈ_سە_چا_پە_جۈ_شە'.split('_'), + weekdaysMin: 'يە_دۈ_سە_چا_پە_جۈ_شە'.split('_'), + longDateFormat: { + LT: 'HH:mm', + LTS: 'HH:mm:ss', + L: 'YYYY-MM-DD', + LL: 'YYYY-يىلىM-ئاينىڭD-كۈنى', + LLL: 'YYYY-يىلىM-ئاينىڭD-كۈنى، HH:mm', + LLLL: 'dddd، YYYY-يىلىM-ئاينىڭD-كۈنى، HH:mm', + }, + meridiemParse: /يېرىم كېچە|سەھەر|چۈشتىن بۇرۇن|چۈش|چۈشتىن كېيىن|كەچ/, + meridiemHour: function (hour, meridiem) { + if (hour === 12) { + hour = 0; + } + if ( + meridiem === 'يېرىم كېچە' || + meridiem === 'سەھەر' || + meridiem === 'چۈشتىن بۇرۇن' + ) { + return hour; + } else if (meridiem === 'چۈشتىن كېيىن' || meridiem === 'كەچ') { + return hour + 12; + } else { + return hour >= 11 ? hour : hour + 12; + } + }, + meridiem: function (hour, minute, isLower) { + var hm = hour * 100 + minute; + if (hm < 600) { + return 'يېرىم كېچە'; + } else if (hm < 900) { + return 'سەھەر'; + } else if (hm < 1130) { + return 'چۈشتىن بۇرۇن'; + } else if (hm < 1230) { + return 'چۈش'; + } else if (hm < 1800) { + return 'چۈشتىن كېيىن'; + } else { + return 'كەچ'; + } + }, + calendar: { + sameDay: '[بۈگۈن سائەت] LT', + nextDay: '[ئەتە سائەت] LT', + nextWeek: '[كېلەركى] dddd [سائەت] LT', + lastDay: '[تۆنۈگۈن] LT', + lastWeek: '[ئالدىنقى] dddd [سائەت] LT', + sameElse: 'L', + }, + relativeTime: { + future: '%s كېيىن', + past: '%s بۇرۇن', + s: 'نەچچە سېكونت', + ss: '%d سېكونت', + m: 'بىر مىنۇت', + mm: '%d مىنۇت', + h: 'بىر سائەت', + hh: '%d سائەت', + d: 'بىر كۈن', + dd: '%d كۈن', + M: 'بىر ئاي', + MM: '%d ئاي', + y: 'بىر يىل', + yy: '%d يىل', + }, + + dayOfMonthOrdinalParse: /\d{1,2}(-كۈنى|-ئاي|-ھەپتە)/, + ordinal: function (number, period) { + switch (period) { + case 'd': + case 'D': + case 'DDD': + return number + '-كۈنى'; + case 'w': + case 'W': + return number + '-ھەپتە'; + default: + return number; + } + }, + preparse: function (string) { + return string.replace(/،/g, ','); + }, + postformat: function (string) { + return string.replace(/,/g, '،'); + }, + week: { + // GB/T 7408-1994《数据元和交换格式·信息交换·日期和时间表示法》与ISO 8601:1988等效 + dow: 1, // Monday is the first day of the week. + doy: 7, // The week that contains Jan 1st is the first week of the year. + }, + }); + + //! moment.js locale configuration + + function plural$6(word, num) { + var forms = word.split('_'); + return num % 10 === 1 && num % 100 !== 11 + ? forms[0] + : num % 10 >= 2 && num % 10 <= 4 && (num % 100 < 10 || num % 100 >= 20) + ? forms[1] + : forms[2]; + } + function relativeTimeWithPlural$4(number, withoutSuffix, key) { + var format = { + ss: withoutSuffix ? 'секунда_секунди_секунд' : 'секунду_секунди_секунд', + mm: withoutSuffix ? 'хвилина_хвилини_хвилин' : 'хвилину_хвилини_хвилин', + hh: withoutSuffix ? 'година_години_годин' : 'годину_години_годин', + dd: 'день_дні_днів', + MM: 'місяць_місяці_місяців', + yy: 'рік_роки_років', + }; + if (key === 'm') { + return withoutSuffix ? 'хвилина' : 'хвилину'; + } else if (key === 'h') { + return withoutSuffix ? 'година' : 'годину'; + } else { + return number + ' ' + plural$6(format[key], +number); + } + } + function weekdaysCaseReplace(m, format) { + var weekdays = { + nominative: 'неділя_понеділок_вівторок_середа_четвер_п’ятниця_субота'.split( + '_' + ), + accusative: 'неділю_понеділок_вівторок_середу_четвер_п’ятницю_суботу'.split( + '_' + ), + genitive: 'неділі_понеділка_вівторка_середи_четверга_п’ятниці_суботи'.split( + '_' + ), + }, + nounCase; + + if (m === true) { + return weekdays['nominative'] + .slice(1, 7) + .concat(weekdays['nominative'].slice(0, 1)); + } + if (!m) { + return weekdays['nominative']; + } + + nounCase = /(\[[ВвУу]\]) ?dddd/.test(format) + ? 'accusative' + : /\[?(?:минулої|наступної)? ?\] ?dddd/.test(format) + ? 'genitive' + : 'nominative'; + return weekdays[nounCase][m.day()]; + } + function processHoursFunction(str) { + return function () { + return str + 'о' + (this.hours() === 11 ? 'б' : '') + '] LT'; + }; + } + + hooks.defineLocale('uk', { + months: { + format: 'січня_лютого_березня_квітня_травня_червня_липня_серпня_вересня_жовтня_листопада_грудня'.split( + '_' + ), + standalone: 'січень_лютий_березень_квітень_травень_червень_липень_серпень_вересень_жовтень_листопад_грудень'.split( + '_' + ), + }, + monthsShort: 'січ_лют_бер_квіт_трав_черв_лип_серп_вер_жовт_лист_груд'.split( + '_' + ), + weekdays: weekdaysCaseReplace, + weekdaysShort: 'нд_пн_вт_ср_чт_пт_сб'.split('_'), + weekdaysMin: 'нд_пн_вт_ср_чт_пт_сб'.split('_'), + longDateFormat: { + LT: 'HH:mm', + LTS: 'HH:mm:ss', + L: 'DD.MM.YYYY', + LL: 'D MMMM YYYY р.', + LLL: 'D MMMM YYYY р., HH:mm', + LLLL: 'dddd, D MMMM YYYY р., HH:mm', + }, + calendar: { + sameDay: processHoursFunction('[Сьогодні '), + nextDay: processHoursFunction('[Завтра '), + lastDay: processHoursFunction('[Вчора '), + nextWeek: processHoursFunction('[У] dddd ['), + lastWeek: function () { + switch (this.day()) { + case 0: + case 3: + case 5: + case 6: + return processHoursFunction('[Минулої] dddd [').call(this); + case 1: + case 2: + case 4: + return processHoursFunction('[Минулого] dddd [').call(this); + } + }, + sameElse: 'L', + }, + relativeTime: { + future: 'за %s', + past: '%s тому', + s: 'декілька секунд', + ss: relativeTimeWithPlural$4, + m: relativeTimeWithPlural$4, + mm: relativeTimeWithPlural$4, + h: 'годину', + hh: relativeTimeWithPlural$4, + d: 'день', + dd: relativeTimeWithPlural$4, + M: 'місяць', + MM: relativeTimeWithPlural$4, + y: 'рік', + yy: relativeTimeWithPlural$4, + }, + // M. E.: those two are virtually unused but a user might want to implement them for his/her website for some reason + meridiemParse: /ночі|ранку|дня|вечора/, + isPM: function (input) { + return /^(дня|вечора)$/.test(input); + }, + meridiem: function (hour, minute, isLower) { + if (hour < 4) { + return 'ночі'; + } else if (hour < 12) { + return 'ранку'; + } else if (hour < 17) { + return 'дня'; + } else { + return 'вечора'; + } + }, + dayOfMonthOrdinalParse: /\d{1,2}-(й|го)/, + ordinal: function (number, period) { + switch (period) { + case 'M': + case 'd': + case 'DDD': + case 'w': + case 'W': + return number + '-й'; + case 'D': + return number + '-го'; + default: + return number; + } + }, + week: { + dow: 1, // Monday is the first day of the week. + doy: 7, // The week that contains Jan 7th is the first week of the year. + }, + }); + + //! moment.js locale configuration + + var months$b = [ + 'جنوری', + 'فروری', + 'مارچ', + 'اپریل', + 'مئی', + 'جون', + 'جولائی', + 'اگست', + 'ستمبر', + 'اکتوبر', + 'نومبر', + 'دسمبر', + ], + days$2 = ['اتوار', 'پیر', 'منگل', 'بدھ', 'جمعرات', 'جمعہ', 'ہفتہ']; + + hooks.defineLocale('ur', { + months: months$b, + monthsShort: months$b, + weekdays: days$2, + weekdaysShort: days$2, + weekdaysMin: days$2, + longDateFormat: { + LT: 'HH:mm', + LTS: 'HH:mm:ss', + L: 'DD/MM/YYYY', + LL: 'D MMMM YYYY', + LLL: 'D MMMM YYYY HH:mm', + LLLL: 'dddd، D MMMM YYYY HH:mm', + }, + meridiemParse: /صبح|شام/, + isPM: function (input) { + return 'شام' === input; + }, + meridiem: function (hour, minute, isLower) { + if (hour < 12) { + return 'صبح'; + } + return 'شام'; + }, + calendar: { + sameDay: '[آج بوقت] LT', + nextDay: '[کل بوقت] LT', + nextWeek: 'dddd [بوقت] LT', + lastDay: '[گذشتہ روز بوقت] LT', + lastWeek: '[گذشتہ] dddd [بوقت] LT', + sameElse: 'L', + }, + relativeTime: { + future: '%s بعد', + past: '%s قبل', + s: 'چند سیکنڈ', + ss: '%d سیکنڈ', + m: 'ایک منٹ', + mm: '%d منٹ', + h: 'ایک گھنٹہ', + hh: '%d گھنٹے', + d: 'ایک دن', + dd: '%d دن', + M: 'ایک ماہ', + MM: '%d ماہ', + y: 'ایک سال', + yy: '%d سال', + }, + preparse: function (string) { + return string.replace(/،/g, ','); + }, + postformat: function (string) { + return string.replace(/,/g, '،'); + }, + week: { + dow: 1, // Monday is the first day of the week. + doy: 4, // The week that contains Jan 4th is the first week of the year. + }, + }); + + //! moment.js locale configuration + + hooks.defineLocale('uz-latn', { + months: 'Yanvar_Fevral_Mart_Aprel_May_Iyun_Iyul_Avgust_Sentabr_Oktabr_Noyabr_Dekabr'.split( + '_' + ), + monthsShort: 'Yan_Fev_Mar_Apr_May_Iyun_Iyul_Avg_Sen_Okt_Noy_Dek'.split('_'), + weekdays: 'Yakshanba_Dushanba_Seshanba_Chorshanba_Payshanba_Juma_Shanba'.split( + '_' + ), + weekdaysShort: 'Yak_Dush_Sesh_Chor_Pay_Jum_Shan'.split('_'), + weekdaysMin: 'Ya_Du_Se_Cho_Pa_Ju_Sha'.split('_'), + longDateFormat: { + LT: 'HH:mm', + LTS: 'HH:mm:ss', + L: 'DD/MM/YYYY', + LL: 'D MMMM YYYY', + LLL: 'D MMMM YYYY HH:mm', + LLLL: 'D MMMM YYYY, dddd HH:mm', + }, + calendar: { + sameDay: '[Bugun soat] LT [da]', + nextDay: '[Ertaga] LT [da]', + nextWeek: 'dddd [kuni soat] LT [da]', + lastDay: '[Kecha soat] LT [da]', + lastWeek: "[O'tgan] dddd [kuni soat] LT [da]", + sameElse: 'L', + }, + relativeTime: { + future: 'Yaqin %s ichida', + past: 'Bir necha %s oldin', + s: 'soniya', + ss: '%d soniya', + m: 'bir daqiqa', + mm: '%d daqiqa', + h: 'bir soat', + hh: '%d soat', + d: 'bir kun', + dd: '%d kun', + M: 'bir oy', + MM: '%d oy', + y: 'bir yil', + yy: '%d yil', + }, + week: { + dow: 1, // Monday is the first day of the week. + doy: 7, // The week that contains Jan 7th is the first week of the year. + }, + }); + + //! moment.js locale configuration + + hooks.defineLocale('uz', { + months: 'январ_феврал_март_апрел_май_июн_июл_август_сентябр_октябр_ноябр_декабр'.split( + '_' + ), + monthsShort: 'янв_фев_мар_апр_май_июн_июл_авг_сен_окт_ноя_дек'.split('_'), + weekdays: 'Якшанба_Душанба_Сешанба_Чоршанба_Пайшанба_Жума_Шанба'.split('_'), + weekdaysShort: 'Якш_Душ_Сеш_Чор_Пай_Жум_Шан'.split('_'), + weekdaysMin: 'Як_Ду_Се_Чо_Па_Жу_Ша'.split('_'), + longDateFormat: { + LT: 'HH:mm', + LTS: 'HH:mm:ss', + L: 'DD/MM/YYYY', + LL: 'D MMMM YYYY', + LLL: 'D MMMM YYYY HH:mm', + LLLL: 'D MMMM YYYY, dddd HH:mm', + }, + calendar: { + sameDay: '[Бугун соат] LT [да]', + nextDay: '[Эртага] LT [да]', + nextWeek: 'dddd [куни соат] LT [да]', + lastDay: '[Кеча соат] LT [да]', + lastWeek: '[Утган] dddd [куни соат] LT [да]', + sameElse: 'L', + }, + relativeTime: { + future: 'Якин %s ичида', + past: 'Бир неча %s олдин', + s: 'фурсат', + ss: '%d фурсат', + m: 'бир дакика', + mm: '%d дакика', + h: 'бир соат', + hh: '%d соат', + d: 'бир кун', + dd: '%d кун', + M: 'бир ой', + MM: '%d ой', + y: 'бир йил', + yy: '%d йил', + }, + week: { + dow: 1, // Monday is the first day of the week. + doy: 7, // The week that contains Jan 4th is the first week of the year. + }, + }); + + //! moment.js locale configuration + + hooks.defineLocale('vi', { + months: 'tháng 1_tháng 2_tháng 3_tháng 4_tháng 5_tháng 6_tháng 7_tháng 8_tháng 9_tháng 10_tháng 11_tháng 12'.split( + '_' + ), + monthsShort: 'Thg 01_Thg 02_Thg 03_Thg 04_Thg 05_Thg 06_Thg 07_Thg 08_Thg 09_Thg 10_Thg 11_Thg 12'.split( + '_' + ), + monthsParseExact: true, + weekdays: 'chủ nhật_thứ hai_thứ ba_thứ tư_thứ năm_thứ sáu_thứ bảy'.split( + '_' + ), + weekdaysShort: 'CN_T2_T3_T4_T5_T6_T7'.split('_'), + weekdaysMin: 'CN_T2_T3_T4_T5_T6_T7'.split('_'), + weekdaysParseExact: true, + meridiemParse: /sa|ch/i, + isPM: function (input) { + return /^ch$/i.test(input); + }, + meridiem: function (hours, minutes, isLower) { + if (hours < 12) { + return isLower ? 'sa' : 'SA'; + } else { + return isLower ? 'ch' : 'CH'; + } + }, + longDateFormat: { + LT: 'HH:mm', + LTS: 'HH:mm:ss', + L: 'DD/MM/YYYY', + LL: 'D MMMM [năm] YYYY', + LLL: 'D MMMM [năm] YYYY HH:mm', + LLLL: 'dddd, D MMMM [năm] YYYY HH:mm', + l: 'DD/M/YYYY', + ll: 'D MMM YYYY', + lll: 'D MMM YYYY HH:mm', + llll: 'ddd, D MMM YYYY HH:mm', + }, + calendar: { + sameDay: '[Hôm nay lúc] LT', + nextDay: '[Ngày mai lúc] LT', + nextWeek: 'dddd [tuần tới lúc] LT', + lastDay: '[Hôm qua lúc] LT', + lastWeek: 'dddd [tuần trước lúc] LT', + sameElse: 'L', + }, + relativeTime: { + future: '%s tới', + past: '%s trước', + s: 'vài giây', + ss: '%d giây', + m: 'một phút', + mm: '%d phút', + h: 'một giờ', + hh: '%d giờ', + d: 'một ngày', + dd: '%d ngày', + M: 'một tháng', + MM: '%d tháng', + y: 'một năm', + yy: '%d năm', + }, + dayOfMonthOrdinalParse: /\d{1,2}/, + ordinal: function (number) { + return number; + }, + week: { + dow: 1, // Monday is the first day of the week. + doy: 4, // The week that contains Jan 4th is the first week of the year. + }, + }); + + //! moment.js locale configuration + + hooks.defineLocale('x-pseudo', { + months: 'J~áñúá~rý_F~ébrú~árý_~Márc~h_Áp~ríl_~Máý_~Júñé~_Júl~ý_Áú~gúst~_Sép~témb~ér_Ó~ctób~ér_Ñ~óvém~bér_~Décé~mbér'.split( + '_' + ), + monthsShort: 'J~áñ_~Féb_~Már_~Ápr_~Máý_~Júñ_~Júl_~Áúg_~Sép_~Óct_~Ñóv_~Déc'.split( + '_' + ), + monthsParseExact: true, + weekdays: 'S~úñdá~ý_Mó~ñdáý~_Túé~sdáý~_Wéd~ñésd~áý_T~húrs~dáý_~Fríd~áý_S~átúr~dáý'.split( + '_' + ), + weekdaysShort: 'S~úñ_~Móñ_~Túé_~Wéd_~Thú_~Frí_~Sát'.split('_'), + weekdaysMin: 'S~ú_Mó~_Tú_~Wé_T~h_Fr~_Sá'.split('_'), + weekdaysParseExact: true, + longDateFormat: { + LT: 'HH:mm', + L: 'DD/MM/YYYY', + LL: 'D MMMM YYYY', + LLL: 'D MMMM YYYY HH:mm', + LLLL: 'dddd, D MMMM YYYY HH:mm', + }, + calendar: { + sameDay: '[T~ódá~ý át] LT', + nextDay: '[T~ómó~rró~w át] LT', + nextWeek: 'dddd [át] LT', + lastDay: '[Ý~ést~érdá~ý át] LT', + lastWeek: '[L~ást] dddd [át] LT', + sameElse: 'L', + }, + relativeTime: { + future: 'í~ñ %s', + past: '%s á~gó', + s: 'á ~féw ~sécó~ñds', + ss: '%d s~écóñ~ds', + m: 'á ~míñ~úté', + mm: '%d m~íñú~tés', + h: 'á~ñ hó~úr', + hh: '%d h~óúrs', + d: 'á ~dáý', + dd: '%d d~áýs', + M: 'á ~móñ~th', + MM: '%d m~óñt~hs', + y: 'á ~ýéár', + yy: '%d ý~éárs', + }, + dayOfMonthOrdinalParse: /\d{1,2}(th|st|nd|rd)/, + ordinal: function (number) { + var b = number % 10, + output = + ~~((number % 100) / 10) === 1 + ? 'th' + : b === 1 + ? 'st' + : b === 2 + ? 'nd' + : b === 3 + ? 'rd' + : 'th'; + return number + output; + }, + week: { + dow: 1, // Monday is the first day of the week. + doy: 4, // The week that contains Jan 4th is the first week of the year. + }, + }); + + //! moment.js locale configuration + + hooks.defineLocale('yo', { + months: 'Sẹ́rẹ́_Èrèlè_Ẹrẹ̀nà_Ìgbé_Èbibi_Òkùdu_Agẹmo_Ògún_Owewe_Ọ̀wàrà_Bélú_Ọ̀pẹ̀̀'.split( + '_' + ), + monthsShort: 'Sẹ́r_Èrl_Ẹrn_Ìgb_Èbi_Òkù_Agẹ_Ògú_Owe_Ọ̀wà_Bél_Ọ̀pẹ̀̀'.split('_'), + weekdays: 'Àìkú_Ajé_Ìsẹ́gun_Ọjọ́rú_Ọjọ́bọ_Ẹtì_Àbámẹ́ta'.split('_'), + weekdaysShort: 'Àìk_Ajé_Ìsẹ́_Ọjr_Ọjb_Ẹtì_Àbá'.split('_'), + weekdaysMin: 'Àì_Aj_Ìs_Ọr_Ọb_Ẹt_Àb'.split('_'), + longDateFormat: { + LT: 'h:mm A', + LTS: 'h:mm:ss A', + L: 'DD/MM/YYYY', + LL: 'D MMMM YYYY', + LLL: 'D MMMM YYYY h:mm A', + LLLL: 'dddd, D MMMM YYYY h:mm A', + }, + calendar: { + sameDay: '[Ònì ni] LT', + nextDay: '[Ọ̀la ni] LT', + nextWeek: "dddd [Ọsẹ̀ tón'bọ] [ni] LT", + lastDay: '[Àna ni] LT', + lastWeek: 'dddd [Ọsẹ̀ tólọ́] [ni] LT', + sameElse: 'L', + }, + relativeTime: { + future: 'ní %s', + past: '%s kọjá', + s: 'ìsẹjú aayá die', + ss: 'aayá %d', + m: 'ìsẹjú kan', + mm: 'ìsẹjú %d', + h: 'wákati kan', + hh: 'wákati %d', + d: 'ọjọ́ kan', + dd: 'ọjọ́ %d', + M: 'osù kan', + MM: 'osù %d', + y: 'ọdún kan', + yy: 'ọdún %d', + }, + dayOfMonthOrdinalParse: /ọjọ́\s\d{1,2}/, + ordinal: 'ọjọ́ %d', + week: { + dow: 1, // Monday is the first day of the week. + doy: 4, // The week that contains Jan 4th is the first week of the year. + }, + }); + + //! moment.js locale configuration + + hooks.defineLocale('zh-cn', { + months: '一月_二月_三月_四月_五月_六月_七月_八月_九月_十月_十一月_十二月'.split( + '_' + ), + monthsShort: '1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月'.split( + '_' + ), + weekdays: '星期日_星期一_星期二_星期三_星期四_星期五_星期六'.split('_'), + weekdaysShort: '周日_周一_周二_周三_周四_周五_周六'.split('_'), + weekdaysMin: '日_一_二_三_四_五_六'.split('_'), + longDateFormat: { + LT: 'HH:mm', + LTS: 'HH:mm:ss', + L: 'YYYY/MM/DD', + LL: 'YYYY年M月D日', + LLL: 'YYYY年M月D日Ah点mm分', + LLLL: 'YYYY年M月D日ddddAh点mm分', + l: 'YYYY/M/D', + ll: 'YYYY年M月D日', + lll: 'YYYY年M月D日 HH:mm', + llll: 'YYYY年M月D日dddd HH:mm', + }, + meridiemParse: /凌晨|早上|上午|中午|下午|晚上/, + meridiemHour: function (hour, meridiem) { + if (hour === 12) { + hour = 0; + } + if (meridiem === '凌晨' || meridiem === '早上' || meridiem === '上午') { + return hour; + } else if (meridiem === '下午' || meridiem === '晚上') { + return hour + 12; + } else { + // '中午' + return hour >= 11 ? hour : hour + 12; + } + }, + meridiem: function (hour, minute, isLower) { + var hm = hour * 100 + minute; + if (hm < 600) { + return '凌晨'; + } else if (hm < 900) { + return '早上'; + } else if (hm < 1130) { + return '上午'; + } else if (hm < 1230) { + return '中午'; + } else if (hm < 1800) { + return '下午'; + } else { + return '晚上'; + } + }, + calendar: { + sameDay: '[今天]LT', + nextDay: '[明天]LT', + nextWeek: function (now) { + if (now.week() !== this.week()) { + return '[下]dddLT'; + } else { + return '[本]dddLT'; + } + }, + lastDay: '[昨天]LT', + lastWeek: function (now) { + if (this.week() !== now.week()) { + return '[上]dddLT'; + } else { + return '[本]dddLT'; + } + }, + sameElse: 'L', + }, + dayOfMonthOrdinalParse: /\d{1,2}(日|月|周)/, + ordinal: function (number, period) { + switch (period) { + case 'd': + case 'D': + case 'DDD': + return number + '日'; + case 'M': + return number + '月'; + case 'w': + case 'W': + return number + '周'; + default: + return number; + } + }, + relativeTime: { + future: '%s后', + past: '%s前', + s: '几秒', + ss: '%d 秒', + m: '1 分钟', + mm: '%d 分钟', + h: '1 小时', + hh: '%d 小时', + d: '1 天', + dd: '%d 天', + M: '1 个月', + MM: '%d 个月', + y: '1 年', + yy: '%d 年', + }, + week: { + // GB/T 7408-1994《数据元和交换格式·信息交换·日期和时间表示法》与ISO 8601:1988等效 + dow: 1, // Monday is the first day of the week. + doy: 4, // The week that contains Jan 4th is the first week of the year. + }, + }); + + //! moment.js locale configuration + + hooks.defineLocale('zh-hk', { + months: '一月_二月_三月_四月_五月_六月_七月_八月_九月_十月_十一月_十二月'.split( + '_' + ), + monthsShort: '1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月'.split( + '_' + ), + weekdays: '星期日_星期一_星期二_星期三_星期四_星期五_星期六'.split('_'), + weekdaysShort: '週日_週一_週二_週三_週四_週五_週六'.split('_'), + weekdaysMin: '日_一_二_三_四_五_六'.split('_'), + longDateFormat: { + LT: 'HH:mm', + LTS: 'HH:mm:ss', + L: 'YYYY/MM/DD', + LL: 'YYYY年M月D日', + LLL: 'YYYY年M月D日 HH:mm', + LLLL: 'YYYY年M月D日dddd HH:mm', + l: 'YYYY/M/D', + ll: 'YYYY年M月D日', + lll: 'YYYY年M月D日 HH:mm', + llll: 'YYYY年M月D日dddd HH:mm', + }, + meridiemParse: /凌晨|早上|上午|中午|下午|晚上/, + meridiemHour: function (hour, meridiem) { + if (hour === 12) { + hour = 0; + } + if (meridiem === '凌晨' || meridiem === '早上' || meridiem === '上午') { + return hour; + } else if (meridiem === '中午') { + return hour >= 11 ? hour : hour + 12; + } else if (meridiem === '下午' || meridiem === '晚上') { + return hour + 12; + } + }, + meridiem: function (hour, minute, isLower) { + var hm = hour * 100 + minute; + if (hm < 600) { + return '凌晨'; + } else if (hm < 900) { + return '早上'; + } else if (hm < 1200) { + return '上午'; + } else if (hm === 1200) { + return '中午'; + } else if (hm < 1800) { + return '下午'; + } else { + return '晚上'; + } + }, + calendar: { + sameDay: '[今天]LT', + nextDay: '[明天]LT', + nextWeek: '[下]ddddLT', + lastDay: '[昨天]LT', + lastWeek: '[上]ddddLT', + sameElse: 'L', + }, + dayOfMonthOrdinalParse: /\d{1,2}(日|月|週)/, + ordinal: function (number, period) { + switch (period) { + case 'd': + case 'D': + case 'DDD': + return number + '日'; + case 'M': + return number + '月'; + case 'w': + case 'W': + return number + '週'; + default: + return number; + } + }, + relativeTime: { + future: '%s後', + past: '%s前', + s: '幾秒', + ss: '%d 秒', + m: '1 分鐘', + mm: '%d 分鐘', + h: '1 小時', + hh: '%d 小時', + d: '1 天', + dd: '%d 天', + M: '1 個月', + MM: '%d 個月', + y: '1 年', + yy: '%d 年', + }, + }); + + //! moment.js locale configuration + + hooks.defineLocale('zh-mo', { + months: '一月_二月_三月_四月_五月_六月_七月_八月_九月_十月_十一月_十二月'.split( + '_' + ), + monthsShort: '1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月'.split( + '_' + ), + weekdays: '星期日_星期一_星期二_星期三_星期四_星期五_星期六'.split('_'), + weekdaysShort: '週日_週一_週二_週三_週四_週五_週六'.split('_'), + weekdaysMin: '日_一_二_三_四_五_六'.split('_'), + longDateFormat: { + LT: 'HH:mm', + LTS: 'HH:mm:ss', + L: 'DD/MM/YYYY', + LL: 'YYYY年M月D日', + LLL: 'YYYY年M月D日 HH:mm', + LLLL: 'YYYY年M月D日dddd HH:mm', + l: 'D/M/YYYY', + ll: 'YYYY年M月D日', + lll: 'YYYY年M月D日 HH:mm', + llll: 'YYYY年M月D日dddd HH:mm', + }, + meridiemParse: /凌晨|早上|上午|中午|下午|晚上/, + meridiemHour: function (hour, meridiem) { + if (hour === 12) { + hour = 0; + } + if (meridiem === '凌晨' || meridiem === '早上' || meridiem === '上午') { + return hour; + } else if (meridiem === '中午') { + return hour >= 11 ? hour : hour + 12; + } else if (meridiem === '下午' || meridiem === '晚上') { + return hour + 12; + } + }, + meridiem: function (hour, minute, isLower) { + var hm = hour * 100 + minute; + if (hm < 600) { + return '凌晨'; + } else if (hm < 900) { + return '早上'; + } else if (hm < 1130) { + return '上午'; + } else if (hm < 1230) { + return '中午'; + } else if (hm < 1800) { + return '下午'; + } else { + return '晚上'; + } + }, + calendar: { + sameDay: '[今天] LT', + nextDay: '[明天] LT', + nextWeek: '[下]dddd LT', + lastDay: '[昨天] LT', + lastWeek: '[上]dddd LT', + sameElse: 'L', + }, + dayOfMonthOrdinalParse: /\d{1,2}(日|月|週)/, + ordinal: function (number, period) { + switch (period) { + case 'd': + case 'D': + case 'DDD': + return number + '日'; + case 'M': + return number + '月'; + case 'w': + case 'W': + return number + '週'; + default: + return number; + } + }, + relativeTime: { + future: '%s內', + past: '%s前', + s: '幾秒', + ss: '%d 秒', + m: '1 分鐘', + mm: '%d 分鐘', + h: '1 小時', + hh: '%d 小時', + d: '1 天', + dd: '%d 天', + M: '1 個月', + MM: '%d 個月', + y: '1 年', + yy: '%d 年', + }, + }); + + //! moment.js locale configuration + + hooks.defineLocale('zh-tw', { + months: '一月_二月_三月_四月_五月_六月_七月_八月_九月_十月_十一月_十二月'.split( + '_' + ), + monthsShort: '1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月'.split( + '_' + ), + weekdays: '星期日_星期一_星期二_星期三_星期四_星期五_星期六'.split('_'), + weekdaysShort: '週日_週一_週二_週三_週四_週五_週六'.split('_'), + weekdaysMin: '日_一_二_三_四_五_六'.split('_'), + longDateFormat: { + LT: 'HH:mm', + LTS: 'HH:mm:ss', + L: 'YYYY/MM/DD', + LL: 'YYYY年M月D日', + LLL: 'YYYY年M月D日 HH:mm', + LLLL: 'YYYY年M月D日dddd HH:mm', + l: 'YYYY/M/D', + ll: 'YYYY年M月D日', + lll: 'YYYY年M月D日 HH:mm', + llll: 'YYYY年M月D日dddd HH:mm', + }, + meridiemParse: /凌晨|早上|上午|中午|下午|晚上/, + meridiemHour: function (hour, meridiem) { + if (hour === 12) { + hour = 0; + } + if (meridiem === '凌晨' || meridiem === '早上' || meridiem === '上午') { + return hour; + } else if (meridiem === '中午') { + return hour >= 11 ? hour : hour + 12; + } else if (meridiem === '下午' || meridiem === '晚上') { + return hour + 12; + } + }, + meridiem: function (hour, minute, isLower) { + var hm = hour * 100 + minute; + if (hm < 600) { + return '凌晨'; + } else if (hm < 900) { + return '早上'; + } else if (hm < 1130) { + return '上午'; + } else if (hm < 1230) { + return '中午'; + } else if (hm < 1800) { + return '下午'; + } else { + return '晚上'; + } + }, + calendar: { + sameDay: '[今天] LT', + nextDay: '[明天] LT', + nextWeek: '[下]dddd LT', + lastDay: '[昨天] LT', + lastWeek: '[上]dddd LT', + sameElse: 'L', + }, + dayOfMonthOrdinalParse: /\d{1,2}(日|月|週)/, + ordinal: function (number, period) { + switch (period) { + case 'd': + case 'D': + case 'DDD': + return number + '日'; + case 'M': + return number + '月'; + case 'w': + case 'W': + return number + '週'; + default: + return number; + } + }, + relativeTime: { + future: '%s後', + past: '%s前', + s: '幾秒', + ss: '%d 秒', + m: '1 分鐘', + mm: '%d 分鐘', + h: '1 小時', + hh: '%d 小時', + d: '1 天', + dd: '%d 天', + M: '1 個月', + MM: '%d 個月', + y: '1 年', + yy: '%d 年', + }, + }); + + hooks.locale('en'); + + return hooks; + +}))); diff --git a/admin/js/vendors/moment/moment-with-locales.min.js b/admin/js/vendors/moment/moment-with-locales.min.js new file mode 100644 index 0000000..f1f8aba --- /dev/null +++ b/admin/js/vendors/moment/moment-with-locales.min.js @@ -0,0 +1,2 @@ +!function(e,a){"object"==typeof exports&&"undefined"!=typeof module?module.exports=a():"function"==typeof define&&define.amd?define(a):e.moment=a()}(this,function(){"use strict";var e,n;function M(){return e.apply(null,arguments)}function _(e){return e instanceof Array||"[object Array]"===Object.prototype.toString.call(e)}function i(e){return null!=e&&"[object Object]"===Object.prototype.toString.call(e)}function h(e,a){return Object.prototype.hasOwnProperty.call(e,a)}function o(e){if(Object.getOwnPropertyNames)return 0===Object.getOwnPropertyNames(e).length;for(var a in e)if(h(e,a))return;return 1}function r(e){return void 0===e}function m(e){return"number"==typeof e||"[object Number]"===Object.prototype.toString.call(e)}function d(e){return e instanceof Date||"[object Date]"===Object.prototype.toString.call(e)}function u(e,a){for(var t=[],s=0;s>>0,s=0;sFe(e)?(r=e+1,d-Fe(e)):(r=e,d);return{year:r,dayOfYear:_}}function Ce(e,a,t){var s,n,r=Je(e.year(),a,t),d=Math.floor((e.dayOfYear()-r-1)/7)+1;return d<1?s=d+Ie(n=e.year()-1,a,t):d>Ie(e.year(),a,t)?(s=d-Ie(e.year(),a,t),n=e.year()+1):(n=e.year(),s=d),{week:s,year:n}}function Ie(e,a,t){var s=Je(e,a,t),n=Je(e+1,a,t);return(Fe(e)-s+n)/7}W("w",["ww",2],"wo","week"),W("W",["WW",2],"Wo","isoWeek"),z("week","w"),z("isoWeek","W"),C("week",5),C("isoWeek",5),le("w",ae),le("ww",ae,$),le("W",ae),le("WW",ae,$),Ye(["w","ww","W","WW"],function(e,a,t,s){a[s.substr(0,1)]=G(e)});function Ue(e,a){return e.slice(a,7).concat(e.slice(0,a))}W("d",0,"do","day"),W("dd",0,0,function(e){return this.localeData().weekdaysMin(this,e)}),W("ddd",0,0,function(e){return this.localeData().weekdaysShort(this,e)}),W("dddd",0,0,function(e){return this.localeData().weekdays(this,e)}),W("e",0,0,"weekday"),W("E",0,0,"isoWeekday"),z("day","d"),z("weekday","e"),z("isoWeekday","E"),C("day",11),C("weekday",11),C("isoWeekday",11),le("d",ae),le("e",ae),le("E",ae),le("dd",function(e,a){return a.weekdaysMinRegex(e)}),le("ddd",function(e,a){return a.weekdaysShortRegex(e)}),le("dddd",function(e,a){return a.weekdaysRegex(e)}),Ye(["dd","ddd","dddd"],function(e,a,t,s){var n=t._locale.weekdaysParse(e,s,t._strict);null!=n?a.d=n:L(t).invalidWeekday=e}),Ye(["d","e","E"],function(e,a,t,s){a[s]=G(e)});var Ge="Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),Ve="Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),Be="Su_Mo_Tu_We_Th_Fr_Sa".split("_"),Ke=ue,qe=ue,Ze=ue;function $e(){function e(e,a){return a.length-e.length}for(var a,t,s,n,r=[],d=[],_=[],i=[],o=0;o<7;o++)a=c([2e3,1]).day(o),t=he(this.weekdaysMin(a,"")),s=he(this.weekdaysShort(a,"")),n=he(this.weekdays(a,"")),r.push(t),d.push(s),_.push(n),i.push(t),i.push(s),i.push(n);r.sort(e),d.sort(e),_.sort(e),i.sort(e),this._weekdaysRegex=new RegExp("^("+i.join("|")+")","i"),this._weekdaysShortRegex=this._weekdaysRegex,this._weekdaysMinRegex=this._weekdaysRegex,this._weekdaysStrictRegex=new RegExp("^("+_.join("|")+")","i"),this._weekdaysShortStrictRegex=new RegExp("^("+d.join("|")+")","i"),this._weekdaysMinStrictRegex=new RegExp("^("+r.join("|")+")","i")}function Qe(){return this.hours()%12||12}function Xe(e,a){W(e,0,0,function(){return this.localeData().meridiem(this.hours(),this.minutes(),a)})}function ea(e,a){return a._meridiemParse}W("H",["HH",2],0,"hour"),W("h",["hh",2],0,Qe),W("k",["kk",2],0,function(){return this.hours()||24}),W("hmm",0,0,function(){return""+Qe.apply(this)+S(this.minutes(),2)}),W("hmmss",0,0,function(){return""+Qe.apply(this)+S(this.minutes(),2)+S(this.seconds(),2)}),W("Hmm",0,0,function(){return""+this.hours()+S(this.minutes(),2)}),W("Hmmss",0,0,function(){return""+this.hours()+S(this.minutes(),2)+S(this.seconds(),2)}),Xe("a",!0),Xe("A",!1),z("hour","h"),C("hour",13),le("a",ea),le("A",ea),le("H",ae),le("h",ae),le("k",ae),le("HH",ae,$),le("hh",ae,$),le("kk",ae,$),le("hmm",te),le("hmmss",se),le("Hmm",te),le("Hmmss",se),Le(["H","HH"],De),Le(["k","kk"],function(e,a,t){var s=G(e);a[De]=24===s?0:s}),Le(["a","A"],function(e,a,t){t._isPm=t._locale.isPM(e),t._meridiem=e}),Le(["h","hh"],function(e,a,t){a[De]=G(e),L(t).bigHour=!0}),Le("hmm",function(e,a,t){var s=e.length-2;a[De]=G(e.substr(0,s)),a[Te]=G(e.substr(s)),L(t).bigHour=!0}),Le("hmmss",function(e,a,t){var s=e.length-4,n=e.length-2;a[De]=G(e.substr(0,s)),a[Te]=G(e.substr(s,2)),a[ge]=G(e.substr(n)),L(t).bigHour=!0}),Le("Hmm",function(e,a,t){var s=e.length-2;a[De]=G(e.substr(0,s)),a[Te]=G(e.substr(s))}),Le("Hmmss",function(e,a,t){var s=e.length-4,n=e.length-2;a[De]=G(e.substr(0,s)),a[Te]=G(e.substr(s,2)),a[ge]=G(e.substr(n))});var aa=V("Hours",!0);var ta,sa={calendar:{sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"},longDateFormat:{LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"},invalidDate:"Invalid date",ordinal:"%d",dayOfMonthOrdinalParse:/\d{1,2}/,relativeTime:{future:"in %s",past:"%s ago",s:"a few seconds",ss:"%d seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",w:"a week",ww:"%d weeks",M:"a month",MM:"%d months",y:"a year",yy:"%d years"},months:Se,monthsShort:je,week:{dow:0,doy:6},weekdays:Ge,weekdaysMin:Be,weekdaysShort:Ve,meridiemParse:/[ap]\.?m?\.?/i},na={},ra={};function da(e){return e?e.toLowerCase().replace("_","-"):e}function _a(e){for(var a,t,s,n,r=0;r=a&&function(e,a){for(var t=Math.min(e.length,a.length),s=0;s=a-1)break;a--}r++}return ta}function ia(a){var e;if(void 0===na[a]&&"undefined"!=typeof module&&module&&module.exports)try{e=ta._abbr,require("./locale/"+a),oa(e)}catch(e){na[a]=null}return na[a]}function oa(e,a){var t;return e&&((t=r(a)?ua(e):ma(e,a))?ta=t:"undefined"!=typeof console&&console.warn&&console.warn("Locale "+e+" not found. Did you forget to load it?")),ta._abbr}function ma(e,a){if(null===a)return delete na[e],null;var t,s=sa;if(a.abbr=e,null!=na[e])w("defineLocaleOverride","use moment.updateLocale(localeName, config) to change an existing locale. moment.defineLocale(localeName, config) should only be used for creating a new locale See http://momentjs.com/guides/#/warnings/define-locale/ for more info."),s=na[e]._config;else if(null!=a.parentLocale)if(null!=na[a.parentLocale])s=na[a.parentLocale]._config;else{if(null==(t=ia(a.parentLocale)))return ra[a.parentLocale]||(ra[a.parentLocale]=[]),ra[a.parentLocale].push({name:e,config:a}),null;s=t._config}return na[e]=new H(b(s,a)),ra[e]&&ra[e].forEach(function(e){ma(e.name,e.config)}),oa(e),na[e]}function ua(e){var a;if(e&&e._locale&&e._locale._abbr&&(e=e._locale._abbr),!e)return ta;if(!_(e)){if(a=ia(e))return a;e=[e]}return _a(e)}function la(e){var a,t=e._a;return t&&-2===L(e).overflow&&(a=t[pe]<0||11He(t[fe],t[pe])?ke:t[De]<0||24Ie(t,r,d)?L(e)._overflowWeeks=!0:null!=i?L(e)._overflowWeekday=!0:(_=Re(t,s,n,r,d),e._a[fe]=_.year,e._dayOfYear=_.dayOfYear)}(e),null!=e._dayOfYear&&(r=ga(e._a[fe],s[fe]),(e._dayOfYear>Fe(r)||0===e._dayOfYear)&&(L(e)._overflowDayOfYear=!0),t=Ne(r,0,e._dayOfYear),e._a[pe]=t.getUTCMonth(),e._a[ke]=t.getUTCDate()),a=0;a<3&&null==e._a[a];++a)e._a[a]=i[a]=s[a];for(;a<7;a++)e._a[a]=i[a]=null==e._a[a]?2===a?1:0:e._a[a];24===e._a[De]&&0===e._a[Te]&&0===e._a[ge]&&0===e._a[we]&&(e._nextDay=!0,e._a[De]=0),e._d=(e._useUTC?Ne:function(e,a,t,s,n,r,d){var _;return e<100&&0<=e?(_=new Date(e+400,a,t,s,n,r,d),isFinite(_.getFullYear())&&_.setFullYear(e)):_=new Date(e,a,t,s,n,r,d),_}).apply(null,i),n=e._useUTC?e._d.getUTCDay():e._d.getDay(),null!=e._tzm&&e._d.setUTCMinutes(e._d.getUTCMinutes()-e._tzm),e._nextDay&&(e._a[De]=24),e._w&&void 0!==e._w.d&&e._w.d!==n&&(L(e).weekdayMismatch=!0)}}function va(e){if(e._f!==M.ISO_8601)if(e._f!==M.RFC_2822){e._a=[],L(e).empty=!0;for(var a,t,s,n,r,d,_,i=""+e._i,o=i.length,m=0,u=E(e._f,e._locale).match(j)||[],l=0;lt.valueOf():t.valueOf()"}),yt.toJSON=function(){return this.isValid()?this.toISOString():null},yt.toString=function(){return this.clone().locale("en").format("ddd MMM DD YYYY HH:mm:ss [GMT]ZZ")},yt.unix=function(){return Math.floor(this.valueOf()/1e3)},yt.valueOf=function(){return this._d.valueOf()-6e4*(this._offset||0)},yt.creationData=function(){return{input:this._i,format:this._f,locale:this._locale,isUTC:this._isUTC,strict:this._strict}},yt.eraName=function(){for(var e,a=this.localeData().eras(),t=0,s=a.length;tthis.clone().month(0).utcOffset()||this.utcOffset()>this.clone().month(5).utcOffset()},yt.isLocal=function(){return!!this.isValid()&&!this._isUTC},yt.isUtcOffset=function(){return!!this.isValid()&&this._isUTC},yt.isUtc=Ca,yt.isUTC=Ca,yt.zoneAbbr=function(){return this._isUTC?"UTC":""},yt.zoneName=function(){return this._isUTC?"Coordinated Universal Time":""},yt.dates=t("dates accessor is deprecated. Use date instead.",lt),yt.months=t("months accessor is deprecated. Use month instead",Ae),yt.years=t("years accessor is deprecated. Use year instead",ze),yt.zone=t("moment().zone is deprecated, use moment().utcOffset instead. http://momentjs.com/guides/#/warnings/zone/",function(e,a){return null!=e?("string"!=typeof e&&(e=-e),this.utcOffset(e,a),this):-this.utcOffset()}),yt.isDSTShifted=t("isDSTShifted is deprecated. See http://momentjs.com/guides/#/warnings/dst-shifted/ for more information",function(){if(!r(this._isDSTShifted))return this._isDSTShifted;var e,a={};return p(a,this),(a=ba(a))._a?(e=(a._isUTC?c:Sa)(a._a),this._isDSTShifted=this.isValid()&&0>> 0, + i; + + for (i = 0; i < len; i++) { + if (i in t && fun.call(this, t[i], i, t)) { + return true; + } + } + + return false; + }; + } + + function isValid(m) { + if (m._isValid == null) { + var flags = getParsingFlags(m), + parsedParts = some.call(flags.parsedDateParts, function (i) { + return i != null; + }), + isNowValid = + !isNaN(m._d.getTime()) && + flags.overflow < 0 && + !flags.empty && + !flags.invalidEra && + !flags.invalidMonth && + !flags.invalidWeekday && + !flags.weekdayMismatch && + !flags.nullInput && + !flags.invalidFormat && + !flags.userInvalidated && + (!flags.meridiem || (flags.meridiem && parsedParts)); + + if (m._strict) { + isNowValid = + isNowValid && + flags.charsLeftOver === 0 && + flags.unusedTokens.length === 0 && + flags.bigHour === undefined; + } + + if (Object.isFrozen == null || !Object.isFrozen(m)) { + m._isValid = isNowValid; + } else { + return isNowValid; + } + } + return m._isValid; + } + + function createInvalid(flags) { + var m = createUTC(NaN); + if (flags != null) { + extend(getParsingFlags(m), flags); + } else { + getParsingFlags(m).userInvalidated = true; + } + + return m; + } + + // Plugins that add properties should also add the key here (null value), + // so we can properly clone ourselves. + var momentProperties = (hooks.momentProperties = []), + updateInProgress = false; + + function copyConfig(to, from) { + var i, prop, val; + + if (!isUndefined(from._isAMomentObject)) { + to._isAMomentObject = from._isAMomentObject; + } + if (!isUndefined(from._i)) { + to._i = from._i; + } + if (!isUndefined(from._f)) { + to._f = from._f; + } + if (!isUndefined(from._l)) { + to._l = from._l; + } + if (!isUndefined(from._strict)) { + to._strict = from._strict; + } + if (!isUndefined(from._tzm)) { + to._tzm = from._tzm; + } + if (!isUndefined(from._isUTC)) { + to._isUTC = from._isUTC; + } + if (!isUndefined(from._offset)) { + to._offset = from._offset; + } + if (!isUndefined(from._pf)) { + to._pf = getParsingFlags(from); + } + if (!isUndefined(from._locale)) { + to._locale = from._locale; + } + + if (momentProperties.length > 0) { + for (i = 0; i < momentProperties.length; i++) { + prop = momentProperties[i]; + val = from[prop]; + if (!isUndefined(val)) { + to[prop] = val; + } + } + } + + return to; + } + + // Moment prototype object + function Moment(config) { + copyConfig(this, config); + this._d = new Date(config._d != null ? config._d.getTime() : NaN); + if (!this.isValid()) { + this._d = new Date(NaN); + } + // Prevent infinite loop in case updateOffset creates new moment + // objects. + if (updateInProgress === false) { + updateInProgress = true; + hooks.updateOffset(this); + updateInProgress = false; + } + } + + function isMoment(obj) { + return ( + obj instanceof Moment || (obj != null && obj._isAMomentObject != null) + ); + } + + function warn(msg) { + if ( + hooks.suppressDeprecationWarnings === false && + typeof console !== 'undefined' && + console.warn + ) { + console.warn('Deprecation warning: ' + msg); + } + } + + function deprecate(msg, fn) { + var firstTime = true; + + return extend(function () { + if (hooks.deprecationHandler != null) { + hooks.deprecationHandler(null, msg); + } + if (firstTime) { + var args = [], + arg, + i, + key; + for (i = 0; i < arguments.length; i++) { + arg = ''; + if (typeof arguments[i] === 'object') { + arg += '\n[' + i + '] '; + for (key in arguments[0]) { + if (hasOwnProp(arguments[0], key)) { + arg += key + ': ' + arguments[0][key] + ', '; + } + } + arg = arg.slice(0, -2); // Remove trailing comma and space + } else { + arg = arguments[i]; + } + args.push(arg); + } + warn( + msg + + '\nArguments: ' + + Array.prototype.slice.call(args).join('') + + '\n' + + new Error().stack + ); + firstTime = false; + } + return fn.apply(this, arguments); + }, fn); + } + + var deprecations = {}; + + function deprecateSimple(name, msg) { + if (hooks.deprecationHandler != null) { + hooks.deprecationHandler(name, msg); + } + if (!deprecations[name]) { + warn(msg); + deprecations[name] = true; + } + } + + hooks.suppressDeprecationWarnings = false; + hooks.deprecationHandler = null; + + function isFunction(input) { + return ( + (typeof Function !== 'undefined' && input instanceof Function) || + Object.prototype.toString.call(input) === '[object Function]' + ); + } + + function set(config) { + var prop, i; + for (i in config) { + if (hasOwnProp(config, i)) { + prop = config[i]; + if (isFunction(prop)) { + this[i] = prop; + } else { + this['_' + i] = prop; + } + } + } + this._config = config; + // Lenient ordinal parsing accepts just a number in addition to + // number + (possibly) stuff coming from _dayOfMonthOrdinalParse. + // TODO: Remove "ordinalParse" fallback in next major release. + this._dayOfMonthOrdinalParseLenient = new RegExp( + (this._dayOfMonthOrdinalParse.source || this._ordinalParse.source) + + '|' + + /\d{1,2}/.source + ); + } + + function mergeConfigs(parentConfig, childConfig) { + var res = extend({}, parentConfig), + prop; + for (prop in childConfig) { + if (hasOwnProp(childConfig, prop)) { + if (isObject(parentConfig[prop]) && isObject(childConfig[prop])) { + res[prop] = {}; + extend(res[prop], parentConfig[prop]); + extend(res[prop], childConfig[prop]); + } else if (childConfig[prop] != null) { + res[prop] = childConfig[prop]; + } else { + delete res[prop]; + } + } + } + for (prop in parentConfig) { + if ( + hasOwnProp(parentConfig, prop) && + !hasOwnProp(childConfig, prop) && + isObject(parentConfig[prop]) + ) { + // make sure changes to properties don't modify parent config + res[prop] = extend({}, res[prop]); + } + } + return res; + } + + function Locale(config) { + if (config != null) { + this.set(config); + } + } + + var keys; + + if (Object.keys) { + keys = Object.keys; + } else { + keys = function (obj) { + var i, + res = []; + for (i in obj) { + if (hasOwnProp(obj, i)) { + res.push(i); + } + } + return res; + }; + } + + var defaultCalendar = { + sameDay: '[Today at] LT', + nextDay: '[Tomorrow at] LT', + nextWeek: 'dddd [at] LT', + lastDay: '[Yesterday at] LT', + lastWeek: '[Last] dddd [at] LT', + sameElse: 'L', + }; + + function calendar(key, mom, now) { + var output = this._calendar[key] || this._calendar['sameElse']; + return isFunction(output) ? output.call(mom, now) : output; + } + + function zeroFill(number, targetLength, forceSign) { + var absNumber = '' + Math.abs(number), + zerosToFill = targetLength - absNumber.length, + sign = number >= 0; + return ( + (sign ? (forceSign ? '+' : '') : '-') + + Math.pow(10, Math.max(0, zerosToFill)).toString().substr(1) + + absNumber + ); + } + + var formattingTokens = /(\[[^\[]*\])|(\\)?([Hh]mm(ss)?|Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Qo?|N{1,5}|YYYYYY|YYYYY|YYYY|YY|y{2,4}|yo?|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|kk?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g, + localFormattingTokens = /(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g, + formatFunctions = {}, + formatTokenFunctions = {}; + + // token: 'M' + // padded: ['MM', 2] + // ordinal: 'Mo' + // callback: function () { this.month() + 1 } + function addFormatToken(token, padded, ordinal, callback) { + var func = callback; + if (typeof callback === 'string') { + func = function () { + return this[callback](); + }; + } + if (token) { + formatTokenFunctions[token] = func; + } + if (padded) { + formatTokenFunctions[padded[0]] = function () { + return zeroFill(func.apply(this, arguments), padded[1], padded[2]); + }; + } + if (ordinal) { + formatTokenFunctions[ordinal] = function () { + return this.localeData().ordinal( + func.apply(this, arguments), + token + ); + }; + } + } + + function removeFormattingTokens(input) { + if (input.match(/\[[\s\S]/)) { + return input.replace(/^\[|\]$/g, ''); + } + return input.replace(/\\/g, ''); + } + + function makeFormatFunction(format) { + var array = format.match(formattingTokens), + i, + length; + + for (i = 0, length = array.length; i < length; i++) { + if (formatTokenFunctions[array[i]]) { + array[i] = formatTokenFunctions[array[i]]; + } else { + array[i] = removeFormattingTokens(array[i]); + } + } + + return function (mom) { + var output = '', + i; + for (i = 0; i < length; i++) { + output += isFunction(array[i]) + ? array[i].call(mom, format) + : array[i]; + } + return output; + }; + } + + // format date using native date object + function formatMoment(m, format) { + if (!m.isValid()) { + return m.localeData().invalidDate(); + } + + format = expandFormat(format, m.localeData()); + formatFunctions[format] = + formatFunctions[format] || makeFormatFunction(format); + + return formatFunctions[format](m); + } + + function expandFormat(format, locale) { + var i = 5; + + function replaceLongDateFormatTokens(input) { + return locale.longDateFormat(input) || input; + } + + localFormattingTokens.lastIndex = 0; + while (i >= 0 && localFormattingTokens.test(format)) { + format = format.replace( + localFormattingTokens, + replaceLongDateFormatTokens + ); + localFormattingTokens.lastIndex = 0; + i -= 1; + } + + return format; + } + + var defaultLongDateFormat = { + LTS: 'h:mm:ss A', + LT: 'h:mm A', + L: 'MM/DD/YYYY', + LL: 'MMMM D, YYYY', + LLL: 'MMMM D, YYYY h:mm A', + LLLL: 'dddd, MMMM D, YYYY h:mm A', + }; + + function longDateFormat(key) { + var format = this._longDateFormat[key], + formatUpper = this._longDateFormat[key.toUpperCase()]; + + if (format || !formatUpper) { + return format; + } + + this._longDateFormat[key] = formatUpper + .match(formattingTokens) + .map(function (tok) { + if ( + tok === 'MMMM' || + tok === 'MM' || + tok === 'DD' || + tok === 'dddd' + ) { + return tok.slice(1); + } + return tok; + }) + .join(''); + + return this._longDateFormat[key]; + } + + var defaultInvalidDate = 'Invalid date'; + + function invalidDate() { + return this._invalidDate; + } + + var defaultOrdinal = '%d', + defaultDayOfMonthOrdinalParse = /\d{1,2}/; + + function ordinal(number) { + return this._ordinal.replace('%d', number); + } + + var defaultRelativeTime = { + future: 'in %s', + past: '%s ago', + s: 'a few seconds', + ss: '%d seconds', + m: 'a minute', + mm: '%d minutes', + h: 'an hour', + hh: '%d hours', + d: 'a day', + dd: '%d days', + w: 'a week', + ww: '%d weeks', + M: 'a month', + MM: '%d months', + y: 'a year', + yy: '%d years', + }; + + function relativeTime(number, withoutSuffix, string, isFuture) { + var output = this._relativeTime[string]; + return isFunction(output) + ? output(number, withoutSuffix, string, isFuture) + : output.replace(/%d/i, number); + } + + function pastFuture(diff, output) { + var format = this._relativeTime[diff > 0 ? 'future' : 'past']; + return isFunction(format) ? format(output) : format.replace(/%s/i, output); + } + + var aliases = {}; + + function addUnitAlias(unit, shorthand) { + var lowerCase = unit.toLowerCase(); + aliases[lowerCase] = aliases[lowerCase + 's'] = aliases[shorthand] = unit; + } + + function normalizeUnits(units) { + return typeof units === 'string' + ? aliases[units] || aliases[units.toLowerCase()] + : undefined; + } + + function normalizeObjectUnits(inputObject) { + var normalizedInput = {}, + normalizedProp, + prop; + + for (prop in inputObject) { + if (hasOwnProp(inputObject, prop)) { + normalizedProp = normalizeUnits(prop); + if (normalizedProp) { + normalizedInput[normalizedProp] = inputObject[prop]; + } + } + } + + return normalizedInput; + } + + var priorities = {}; + + function addUnitPriority(unit, priority) { + priorities[unit] = priority; + } + + function getPrioritizedUnits(unitsObj) { + var units = [], + u; + for (u in unitsObj) { + if (hasOwnProp(unitsObj, u)) { + units.push({ unit: u, priority: priorities[u] }); + } + } + units.sort(function (a, b) { + return a.priority - b.priority; + }); + return units; + } + + function isLeapYear(year) { + return (year % 4 === 0 && year % 100 !== 0) || year % 400 === 0; + } + + function absFloor(number) { + if (number < 0) { + // -0 -> 0 + return Math.ceil(number) || 0; + } else { + return Math.floor(number); + } + } + + function toInt(argumentForCoercion) { + var coercedNumber = +argumentForCoercion, + value = 0; + + if (coercedNumber !== 0 && isFinite(coercedNumber)) { + value = absFloor(coercedNumber); + } + + return value; + } + + function makeGetSet(unit, keepTime) { + return function (value) { + if (value != null) { + set$1(this, unit, value); + hooks.updateOffset(this, keepTime); + return this; + } else { + return get(this, unit); + } + }; + } + + function get(mom, unit) { + return mom.isValid() + ? mom._d['get' + (mom._isUTC ? 'UTC' : '') + unit]() + : NaN; + } + + function set$1(mom, unit, value) { + if (mom.isValid() && !isNaN(value)) { + if ( + unit === 'FullYear' && + isLeapYear(mom.year()) && + mom.month() === 1 && + mom.date() === 29 + ) { + value = toInt(value); + mom._d['set' + (mom._isUTC ? 'UTC' : '') + unit]( + value, + mom.month(), + daysInMonth(value, mom.month()) + ); + } else { + mom._d['set' + (mom._isUTC ? 'UTC' : '') + unit](value); + } + } + } + + // MOMENTS + + function stringGet(units) { + units = normalizeUnits(units); + if (isFunction(this[units])) { + return this[units](); + } + return this; + } + + function stringSet(units, value) { + if (typeof units === 'object') { + units = normalizeObjectUnits(units); + var prioritized = getPrioritizedUnits(units), + i; + for (i = 0; i < prioritized.length; i++) { + this[prioritized[i].unit](units[prioritized[i].unit]); + } + } else { + units = normalizeUnits(units); + if (isFunction(this[units])) { + return this[units](value); + } + } + return this; + } + + var match1 = /\d/, // 0 - 9 + match2 = /\d\d/, // 00 - 99 + match3 = /\d{3}/, // 000 - 999 + match4 = /\d{4}/, // 0000 - 9999 + match6 = /[+-]?\d{6}/, // -999999 - 999999 + match1to2 = /\d\d?/, // 0 - 99 + match3to4 = /\d\d\d\d?/, // 999 - 9999 + match5to6 = /\d\d\d\d\d\d?/, // 99999 - 999999 + match1to3 = /\d{1,3}/, // 0 - 999 + match1to4 = /\d{1,4}/, // 0 - 9999 + match1to6 = /[+-]?\d{1,6}/, // -999999 - 999999 + matchUnsigned = /\d+/, // 0 - inf + matchSigned = /[+-]?\d+/, // -inf - inf + matchOffset = /Z|[+-]\d\d:?\d\d/gi, // +00:00 -00:00 +0000 -0000 or Z + matchShortOffset = /Z|[+-]\d\d(?::?\d\d)?/gi, // +00 -00 +00:00 -00:00 +0000 -0000 or Z + matchTimestamp = /[+-]?\d+(\.\d{1,3})?/, // 123456789 123456789.123 + // any word (or two) characters or numbers including two/three word month in arabic. + // includes scottish gaelic two word and hyphenated months + matchWord = /[0-9]{0,256}['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFF07\uFF10-\uFFEF]{1,256}|[\u0600-\u06FF\/]{1,256}(\s*?[\u0600-\u06FF]{1,256}){1,2}/i, + regexes; + + regexes = {}; + + function addRegexToken(token, regex, strictRegex) { + regexes[token] = isFunction(regex) + ? regex + : function (isStrict, localeData) { + return isStrict && strictRegex ? strictRegex : regex; + }; + } + + function getParseRegexForToken(token, config) { + if (!hasOwnProp(regexes, token)) { + return new RegExp(unescapeFormat(token)); + } + + return regexes[token](config._strict, config._locale); + } + + // Code from http://stackoverflow.com/questions/3561493/is-there-a-regexp-escape-function-in-javascript + function unescapeFormat(s) { + return regexEscape( + s + .replace('\\', '') + .replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g, function ( + matched, + p1, + p2, + p3, + p4 + ) { + return p1 || p2 || p3 || p4; + }) + ); + } + + function regexEscape(s) { + return s.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&'); + } + + var tokens = {}; + + function addParseToken(token, callback) { + var i, + func = callback; + if (typeof token === 'string') { + token = [token]; + } + if (isNumber(callback)) { + func = function (input, array) { + array[callback] = toInt(input); + }; + } + for (i = 0; i < token.length; i++) { + tokens[token[i]] = func; + } + } + + function addWeekParseToken(token, callback) { + addParseToken(token, function (input, array, config, token) { + config._w = config._w || {}; + callback(input, config._w, config, token); + }); + } + + function addTimeToArrayFromToken(token, input, config) { + if (input != null && hasOwnProp(tokens, token)) { + tokens[token](input, config._a, config, token); + } + } + + var YEAR = 0, + MONTH = 1, + DATE = 2, + HOUR = 3, + MINUTE = 4, + SECOND = 5, + MILLISECOND = 6, + WEEK = 7, + WEEKDAY = 8; + + function mod(n, x) { + return ((n % x) + x) % x; + } + + var indexOf; + + if (Array.prototype.indexOf) { + indexOf = Array.prototype.indexOf; + } else { + indexOf = function (o) { + // I know + var i; + for (i = 0; i < this.length; ++i) { + if (this[i] === o) { + return i; + } + } + return -1; + }; + } + + function daysInMonth(year, month) { + if (isNaN(year) || isNaN(month)) { + return NaN; + } + var modMonth = mod(month, 12); + year += (month - modMonth) / 12; + return modMonth === 1 + ? isLeapYear(year) + ? 29 + : 28 + : 31 - ((modMonth % 7) % 2); + } + + // FORMATTING + + addFormatToken('M', ['MM', 2], 'Mo', function () { + return this.month() + 1; + }); + + addFormatToken('MMM', 0, 0, function (format) { + return this.localeData().monthsShort(this, format); + }); + + addFormatToken('MMMM', 0, 0, function (format) { + return this.localeData().months(this, format); + }); + + // ALIASES + + addUnitAlias('month', 'M'); + + // PRIORITY + + addUnitPriority('month', 8); + + // PARSING + + addRegexToken('M', match1to2); + addRegexToken('MM', match1to2, match2); + addRegexToken('MMM', function (isStrict, locale) { + return locale.monthsShortRegex(isStrict); + }); + addRegexToken('MMMM', function (isStrict, locale) { + return locale.monthsRegex(isStrict); + }); + + addParseToken(['M', 'MM'], function (input, array) { + array[MONTH] = toInt(input) - 1; + }); + + addParseToken(['MMM', 'MMMM'], function (input, array, config, token) { + var month = config._locale.monthsParse(input, token, config._strict); + // if we didn't find a month name, mark the date as invalid. + if (month != null) { + array[MONTH] = month; + } else { + getParsingFlags(config).invalidMonth = input; + } + }); + + // LOCALES + + var defaultLocaleMonths = 'January_February_March_April_May_June_July_August_September_October_November_December'.split( + '_' + ), + defaultLocaleMonthsShort = 'Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec'.split( + '_' + ), + MONTHS_IN_FORMAT = /D[oD]?(\[[^\[\]]*\]|\s)+MMMM?/, + defaultMonthsShortRegex = matchWord, + defaultMonthsRegex = matchWord; + + function localeMonths(m, format) { + if (!m) { + return isArray(this._months) + ? this._months + : this._months['standalone']; + } + return isArray(this._months) + ? this._months[m.month()] + : this._months[ + (this._months.isFormat || MONTHS_IN_FORMAT).test(format) + ? 'format' + : 'standalone' + ][m.month()]; + } + + function localeMonthsShort(m, format) { + if (!m) { + return isArray(this._monthsShort) + ? this._monthsShort + : this._monthsShort['standalone']; + } + return isArray(this._monthsShort) + ? this._monthsShort[m.month()] + : this._monthsShort[ + MONTHS_IN_FORMAT.test(format) ? 'format' : 'standalone' + ][m.month()]; + } + + function handleStrictParse(monthName, format, strict) { + var i, + ii, + mom, + llc = monthName.toLocaleLowerCase(); + if (!this._monthsParse) { + // this is not used + this._monthsParse = []; + this._longMonthsParse = []; + this._shortMonthsParse = []; + for (i = 0; i < 12; ++i) { + mom = createUTC([2000, i]); + this._shortMonthsParse[i] = this.monthsShort( + mom, + '' + ).toLocaleLowerCase(); + this._longMonthsParse[i] = this.months(mom, '').toLocaleLowerCase(); + } + } + + if (strict) { + if (format === 'MMM') { + ii = indexOf.call(this._shortMonthsParse, llc); + return ii !== -1 ? ii : null; + } else { + ii = indexOf.call(this._longMonthsParse, llc); + return ii !== -1 ? ii : null; + } + } else { + if (format === 'MMM') { + ii = indexOf.call(this._shortMonthsParse, llc); + if (ii !== -1) { + return ii; + } + ii = indexOf.call(this._longMonthsParse, llc); + return ii !== -1 ? ii : null; + } else { + ii = indexOf.call(this._longMonthsParse, llc); + if (ii !== -1) { + return ii; + } + ii = indexOf.call(this._shortMonthsParse, llc); + return ii !== -1 ? ii : null; + } + } + } + + function localeMonthsParse(monthName, format, strict) { + var i, mom, regex; + + if (this._monthsParseExact) { + return handleStrictParse.call(this, monthName, format, strict); + } + + if (!this._monthsParse) { + this._monthsParse = []; + this._longMonthsParse = []; + this._shortMonthsParse = []; + } + + // TODO: add sorting + // Sorting makes sure if one month (or abbr) is a prefix of another + // see sorting in computeMonthsParse + for (i = 0; i < 12; i++) { + // make the regex if we don't have it already + mom = createUTC([2000, i]); + if (strict && !this._longMonthsParse[i]) { + this._longMonthsParse[i] = new RegExp( + '^' + this.months(mom, '').replace('.', '') + '$', + 'i' + ); + this._shortMonthsParse[i] = new RegExp( + '^' + this.monthsShort(mom, '').replace('.', '') + '$', + 'i' + ); + } + if (!strict && !this._monthsParse[i]) { + regex = + '^' + this.months(mom, '') + '|^' + this.monthsShort(mom, ''); + this._monthsParse[i] = new RegExp(regex.replace('.', ''), 'i'); + } + // test the regex + if ( + strict && + format === 'MMMM' && + this._longMonthsParse[i].test(monthName) + ) { + return i; + } else if ( + strict && + format === 'MMM' && + this._shortMonthsParse[i].test(monthName) + ) { + return i; + } else if (!strict && this._monthsParse[i].test(monthName)) { + return i; + } + } + } + + // MOMENTS + + function setMonth(mom, value) { + var dayOfMonth; + + if (!mom.isValid()) { + // No op + return mom; + } + + if (typeof value === 'string') { + if (/^\d+$/.test(value)) { + value = toInt(value); + } else { + value = mom.localeData().monthsParse(value); + // TODO: Another silent failure? + if (!isNumber(value)) { + return mom; + } + } + } + + dayOfMonth = Math.min(mom.date(), daysInMonth(mom.year(), value)); + mom._d['set' + (mom._isUTC ? 'UTC' : '') + 'Month'](value, dayOfMonth); + return mom; + } + + function getSetMonth(value) { + if (value != null) { + setMonth(this, value); + hooks.updateOffset(this, true); + return this; + } else { + return get(this, 'Month'); + } + } + + function getDaysInMonth() { + return daysInMonth(this.year(), this.month()); + } + + function monthsShortRegex(isStrict) { + if (this._monthsParseExact) { + if (!hasOwnProp(this, '_monthsRegex')) { + computeMonthsParse.call(this); + } + if (isStrict) { + return this._monthsShortStrictRegex; + } else { + return this._monthsShortRegex; + } + } else { + if (!hasOwnProp(this, '_monthsShortRegex')) { + this._monthsShortRegex = defaultMonthsShortRegex; + } + return this._monthsShortStrictRegex && isStrict + ? this._monthsShortStrictRegex + : this._monthsShortRegex; + } + } + + function monthsRegex(isStrict) { + if (this._monthsParseExact) { + if (!hasOwnProp(this, '_monthsRegex')) { + computeMonthsParse.call(this); + } + if (isStrict) { + return this._monthsStrictRegex; + } else { + return this._monthsRegex; + } + } else { + if (!hasOwnProp(this, '_monthsRegex')) { + this._monthsRegex = defaultMonthsRegex; + } + return this._monthsStrictRegex && isStrict + ? this._monthsStrictRegex + : this._monthsRegex; + } + } + + function computeMonthsParse() { + function cmpLenRev(a, b) { + return b.length - a.length; + } + + var shortPieces = [], + longPieces = [], + mixedPieces = [], + i, + mom; + for (i = 0; i < 12; i++) { + // make the regex if we don't have it already + mom = createUTC([2000, i]); + shortPieces.push(this.monthsShort(mom, '')); + longPieces.push(this.months(mom, '')); + mixedPieces.push(this.months(mom, '')); + mixedPieces.push(this.monthsShort(mom, '')); + } + // Sorting makes sure if one month (or abbr) is a prefix of another it + // will match the longer piece. + shortPieces.sort(cmpLenRev); + longPieces.sort(cmpLenRev); + mixedPieces.sort(cmpLenRev); + for (i = 0; i < 12; i++) { + shortPieces[i] = regexEscape(shortPieces[i]); + longPieces[i] = regexEscape(longPieces[i]); + } + for (i = 0; i < 24; i++) { + mixedPieces[i] = regexEscape(mixedPieces[i]); + } + + this._monthsRegex = new RegExp('^(' + mixedPieces.join('|') + ')', 'i'); + this._monthsShortRegex = this._monthsRegex; + this._monthsStrictRegex = new RegExp( + '^(' + longPieces.join('|') + ')', + 'i' + ); + this._monthsShortStrictRegex = new RegExp( + '^(' + shortPieces.join('|') + ')', + 'i' + ); + } + + // FORMATTING + + addFormatToken('Y', 0, 0, function () { + var y = this.year(); + return y <= 9999 ? zeroFill(y, 4) : '+' + y; + }); + + addFormatToken(0, ['YY', 2], 0, function () { + return this.year() % 100; + }); + + addFormatToken(0, ['YYYY', 4], 0, 'year'); + addFormatToken(0, ['YYYYY', 5], 0, 'year'); + addFormatToken(0, ['YYYYYY', 6, true], 0, 'year'); + + // ALIASES + + addUnitAlias('year', 'y'); + + // PRIORITIES + + addUnitPriority('year', 1); + + // PARSING + + addRegexToken('Y', matchSigned); + addRegexToken('YY', match1to2, match2); + addRegexToken('YYYY', match1to4, match4); + addRegexToken('YYYYY', match1to6, match6); + addRegexToken('YYYYYY', match1to6, match6); + + addParseToken(['YYYYY', 'YYYYYY'], YEAR); + addParseToken('YYYY', function (input, array) { + array[YEAR] = + input.length === 2 ? hooks.parseTwoDigitYear(input) : toInt(input); + }); + addParseToken('YY', function (input, array) { + array[YEAR] = hooks.parseTwoDigitYear(input); + }); + addParseToken('Y', function (input, array) { + array[YEAR] = parseInt(input, 10); + }); + + // HELPERS + + function daysInYear(year) { + return isLeapYear(year) ? 366 : 365; + } + + // HOOKS + + hooks.parseTwoDigitYear = function (input) { + return toInt(input) + (toInt(input) > 68 ? 1900 : 2000); + }; + + // MOMENTS + + var getSetYear = makeGetSet('FullYear', true); + + function getIsLeapYear() { + return isLeapYear(this.year()); + } + + function createDate(y, m, d, h, M, s, ms) { + // can't just apply() to create a date: + // https://stackoverflow.com/q/181348 + var date; + // the date constructor remaps years 0-99 to 1900-1999 + if (y < 100 && y >= 0) { + // preserve leap years using a full 400 year cycle, then reset + date = new Date(y + 400, m, d, h, M, s, ms); + if (isFinite(date.getFullYear())) { + date.setFullYear(y); + } + } else { + date = new Date(y, m, d, h, M, s, ms); + } + + return date; + } + + function createUTCDate(y) { + var date, args; + // the Date.UTC function remaps years 0-99 to 1900-1999 + if (y < 100 && y >= 0) { + args = Array.prototype.slice.call(arguments); + // preserve leap years using a full 400 year cycle, then reset + args[0] = y + 400; + date = new Date(Date.UTC.apply(null, args)); + if (isFinite(date.getUTCFullYear())) { + date.setUTCFullYear(y); + } + } else { + date = new Date(Date.UTC.apply(null, arguments)); + } + + return date; + } + + // start-of-first-week - start-of-year + function firstWeekOffset(year, dow, doy) { + var // first-week day -- which january is always in the first week (4 for iso, 1 for other) + fwd = 7 + dow - doy, + // first-week day local weekday -- which local weekday is fwd + fwdlw = (7 + createUTCDate(year, 0, fwd).getUTCDay() - dow) % 7; + + return -fwdlw + fwd - 1; + } + + // https://en.wikipedia.org/wiki/ISO_week_date#Calculating_a_date_given_the_year.2C_week_number_and_weekday + function dayOfYearFromWeeks(year, week, weekday, dow, doy) { + var localWeekday = (7 + weekday - dow) % 7, + weekOffset = firstWeekOffset(year, dow, doy), + dayOfYear = 1 + 7 * (week - 1) + localWeekday + weekOffset, + resYear, + resDayOfYear; + + if (dayOfYear <= 0) { + resYear = year - 1; + resDayOfYear = daysInYear(resYear) + dayOfYear; + } else if (dayOfYear > daysInYear(year)) { + resYear = year + 1; + resDayOfYear = dayOfYear - daysInYear(year); + } else { + resYear = year; + resDayOfYear = dayOfYear; + } + + return { + year: resYear, + dayOfYear: resDayOfYear, + }; + } + + function weekOfYear(mom, dow, doy) { + var weekOffset = firstWeekOffset(mom.year(), dow, doy), + week = Math.floor((mom.dayOfYear() - weekOffset - 1) / 7) + 1, + resWeek, + resYear; + + if (week < 1) { + resYear = mom.year() - 1; + resWeek = week + weeksInYear(resYear, dow, doy); + } else if (week > weeksInYear(mom.year(), dow, doy)) { + resWeek = week - weeksInYear(mom.year(), dow, doy); + resYear = mom.year() + 1; + } else { + resYear = mom.year(); + resWeek = week; + } + + return { + week: resWeek, + year: resYear, + }; + } + + function weeksInYear(year, dow, doy) { + var weekOffset = firstWeekOffset(year, dow, doy), + weekOffsetNext = firstWeekOffset(year + 1, dow, doy); + return (daysInYear(year) - weekOffset + weekOffsetNext) / 7; + } + + // FORMATTING + + addFormatToken('w', ['ww', 2], 'wo', 'week'); + addFormatToken('W', ['WW', 2], 'Wo', 'isoWeek'); + + // ALIASES + + addUnitAlias('week', 'w'); + addUnitAlias('isoWeek', 'W'); + + // PRIORITIES + + addUnitPriority('week', 5); + addUnitPriority('isoWeek', 5); + + // PARSING + + addRegexToken('w', match1to2); + addRegexToken('ww', match1to2, match2); + addRegexToken('W', match1to2); + addRegexToken('WW', match1to2, match2); + + addWeekParseToken(['w', 'ww', 'W', 'WW'], function ( + input, + week, + config, + token + ) { + week[token.substr(0, 1)] = toInt(input); + }); + + // HELPERS + + // LOCALES + + function localeWeek(mom) { + return weekOfYear(mom, this._week.dow, this._week.doy).week; + } + + var defaultLocaleWeek = { + dow: 0, // Sunday is the first day of the week. + doy: 6, // The week that contains Jan 6th is the first week of the year. + }; + + function localeFirstDayOfWeek() { + return this._week.dow; + } + + function localeFirstDayOfYear() { + return this._week.doy; + } + + // MOMENTS + + function getSetWeek(input) { + var week = this.localeData().week(this); + return input == null ? week : this.add((input - week) * 7, 'd'); + } + + function getSetISOWeek(input) { + var week = weekOfYear(this, 1, 4).week; + return input == null ? week : this.add((input - week) * 7, 'd'); + } + + // FORMATTING + + addFormatToken('d', 0, 'do', 'day'); + + addFormatToken('dd', 0, 0, function (format) { + return this.localeData().weekdaysMin(this, format); + }); + + addFormatToken('ddd', 0, 0, function (format) { + return this.localeData().weekdaysShort(this, format); + }); + + addFormatToken('dddd', 0, 0, function (format) { + return this.localeData().weekdays(this, format); + }); + + addFormatToken('e', 0, 0, 'weekday'); + addFormatToken('E', 0, 0, 'isoWeekday'); + + // ALIASES + + addUnitAlias('day', 'd'); + addUnitAlias('weekday', 'e'); + addUnitAlias('isoWeekday', 'E'); + + // PRIORITY + addUnitPriority('day', 11); + addUnitPriority('weekday', 11); + addUnitPriority('isoWeekday', 11); + + // PARSING + + addRegexToken('d', match1to2); + addRegexToken('e', match1to2); + addRegexToken('E', match1to2); + addRegexToken('dd', function (isStrict, locale) { + return locale.weekdaysMinRegex(isStrict); + }); + addRegexToken('ddd', function (isStrict, locale) { + return locale.weekdaysShortRegex(isStrict); + }); + addRegexToken('dddd', function (isStrict, locale) { + return locale.weekdaysRegex(isStrict); + }); + + addWeekParseToken(['dd', 'ddd', 'dddd'], function (input, week, config, token) { + var weekday = config._locale.weekdaysParse(input, token, config._strict); + // if we didn't get a weekday name, mark the date as invalid + if (weekday != null) { + week.d = weekday; + } else { + getParsingFlags(config).invalidWeekday = input; + } + }); + + addWeekParseToken(['d', 'e', 'E'], function (input, week, config, token) { + week[token] = toInt(input); + }); + + // HELPERS + + function parseWeekday(input, locale) { + if (typeof input !== 'string') { + return input; + } + + if (!isNaN(input)) { + return parseInt(input, 10); + } + + input = locale.weekdaysParse(input); + if (typeof input === 'number') { + return input; + } + + return null; + } + + function parseIsoWeekday(input, locale) { + if (typeof input === 'string') { + return locale.weekdaysParse(input) % 7 || 7; + } + return isNaN(input) ? null : input; + } + + // LOCALES + function shiftWeekdays(ws, n) { + return ws.slice(n, 7).concat(ws.slice(0, n)); + } + + var defaultLocaleWeekdays = 'Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday'.split( + '_' + ), + defaultLocaleWeekdaysShort = 'Sun_Mon_Tue_Wed_Thu_Fri_Sat'.split('_'), + defaultLocaleWeekdaysMin = 'Su_Mo_Tu_We_Th_Fr_Sa'.split('_'), + defaultWeekdaysRegex = matchWord, + defaultWeekdaysShortRegex = matchWord, + defaultWeekdaysMinRegex = matchWord; + + function localeWeekdays(m, format) { + var weekdays = isArray(this._weekdays) + ? this._weekdays + : this._weekdays[ + m && m !== true && this._weekdays.isFormat.test(format) + ? 'format' + : 'standalone' + ]; + return m === true + ? shiftWeekdays(weekdays, this._week.dow) + : m + ? weekdays[m.day()] + : weekdays; + } + + function localeWeekdaysShort(m) { + return m === true + ? shiftWeekdays(this._weekdaysShort, this._week.dow) + : m + ? this._weekdaysShort[m.day()] + : this._weekdaysShort; + } + + function localeWeekdaysMin(m) { + return m === true + ? shiftWeekdays(this._weekdaysMin, this._week.dow) + : m + ? this._weekdaysMin[m.day()] + : this._weekdaysMin; + } + + function handleStrictParse$1(weekdayName, format, strict) { + var i, + ii, + mom, + llc = weekdayName.toLocaleLowerCase(); + if (!this._weekdaysParse) { + this._weekdaysParse = []; + this._shortWeekdaysParse = []; + this._minWeekdaysParse = []; + + for (i = 0; i < 7; ++i) { + mom = createUTC([2000, 1]).day(i); + this._minWeekdaysParse[i] = this.weekdaysMin( + mom, + '' + ).toLocaleLowerCase(); + this._shortWeekdaysParse[i] = this.weekdaysShort( + mom, + '' + ).toLocaleLowerCase(); + this._weekdaysParse[i] = this.weekdays(mom, '').toLocaleLowerCase(); + } + } + + if (strict) { + if (format === 'dddd') { + ii = indexOf.call(this._weekdaysParse, llc); + return ii !== -1 ? ii : null; + } else if (format === 'ddd') { + ii = indexOf.call(this._shortWeekdaysParse, llc); + return ii !== -1 ? ii : null; + } else { + ii = indexOf.call(this._minWeekdaysParse, llc); + return ii !== -1 ? ii : null; + } + } else { + if (format === 'dddd') { + ii = indexOf.call(this._weekdaysParse, llc); + if (ii !== -1) { + return ii; + } + ii = indexOf.call(this._shortWeekdaysParse, llc); + if (ii !== -1) { + return ii; + } + ii = indexOf.call(this._minWeekdaysParse, llc); + return ii !== -1 ? ii : null; + } else if (format === 'ddd') { + ii = indexOf.call(this._shortWeekdaysParse, llc); + if (ii !== -1) { + return ii; + } + ii = indexOf.call(this._weekdaysParse, llc); + if (ii !== -1) { + return ii; + } + ii = indexOf.call(this._minWeekdaysParse, llc); + return ii !== -1 ? ii : null; + } else { + ii = indexOf.call(this._minWeekdaysParse, llc); + if (ii !== -1) { + return ii; + } + ii = indexOf.call(this._weekdaysParse, llc); + if (ii !== -1) { + return ii; + } + ii = indexOf.call(this._shortWeekdaysParse, llc); + return ii !== -1 ? ii : null; + } + } + } + + function localeWeekdaysParse(weekdayName, format, strict) { + var i, mom, regex; + + if (this._weekdaysParseExact) { + return handleStrictParse$1.call(this, weekdayName, format, strict); + } + + if (!this._weekdaysParse) { + this._weekdaysParse = []; + this._minWeekdaysParse = []; + this._shortWeekdaysParse = []; + this._fullWeekdaysParse = []; + } + + for (i = 0; i < 7; i++) { + // make the regex if we don't have it already + + mom = createUTC([2000, 1]).day(i); + if (strict && !this._fullWeekdaysParse[i]) { + this._fullWeekdaysParse[i] = new RegExp( + '^' + this.weekdays(mom, '').replace('.', '\\.?') + '$', + 'i' + ); + this._shortWeekdaysParse[i] = new RegExp( + '^' + this.weekdaysShort(mom, '').replace('.', '\\.?') + '$', + 'i' + ); + this._minWeekdaysParse[i] = new RegExp( + '^' + this.weekdaysMin(mom, '').replace('.', '\\.?') + '$', + 'i' + ); + } + if (!this._weekdaysParse[i]) { + regex = + '^' + + this.weekdays(mom, '') + + '|^' + + this.weekdaysShort(mom, '') + + '|^' + + this.weekdaysMin(mom, ''); + this._weekdaysParse[i] = new RegExp(regex.replace('.', ''), 'i'); + } + // test the regex + if ( + strict && + format === 'dddd' && + this._fullWeekdaysParse[i].test(weekdayName) + ) { + return i; + } else if ( + strict && + format === 'ddd' && + this._shortWeekdaysParse[i].test(weekdayName) + ) { + return i; + } else if ( + strict && + format === 'dd' && + this._minWeekdaysParse[i].test(weekdayName) + ) { + return i; + } else if (!strict && this._weekdaysParse[i].test(weekdayName)) { + return i; + } + } + } + + // MOMENTS + + function getSetDayOfWeek(input) { + if (!this.isValid()) { + return input != null ? this : NaN; + } + var day = this._isUTC ? this._d.getUTCDay() : this._d.getDay(); + if (input != null) { + input = parseWeekday(input, this.localeData()); + return this.add(input - day, 'd'); + } else { + return day; + } + } + + function getSetLocaleDayOfWeek(input) { + if (!this.isValid()) { + return input != null ? this : NaN; + } + var weekday = (this.day() + 7 - this.localeData()._week.dow) % 7; + return input == null ? weekday : this.add(input - weekday, 'd'); + } + + function getSetISODayOfWeek(input) { + if (!this.isValid()) { + return input != null ? this : NaN; + } + + // behaves the same as moment#day except + // as a getter, returns 7 instead of 0 (1-7 range instead of 0-6) + // as a setter, sunday should belong to the previous week. + + if (input != null) { + var weekday = parseIsoWeekday(input, this.localeData()); + return this.day(this.day() % 7 ? weekday : weekday - 7); + } else { + return this.day() || 7; + } + } + + function weekdaysRegex(isStrict) { + if (this._weekdaysParseExact) { + if (!hasOwnProp(this, '_weekdaysRegex')) { + computeWeekdaysParse.call(this); + } + if (isStrict) { + return this._weekdaysStrictRegex; + } else { + return this._weekdaysRegex; + } + } else { + if (!hasOwnProp(this, '_weekdaysRegex')) { + this._weekdaysRegex = defaultWeekdaysRegex; + } + return this._weekdaysStrictRegex && isStrict + ? this._weekdaysStrictRegex + : this._weekdaysRegex; + } + } + + function weekdaysShortRegex(isStrict) { + if (this._weekdaysParseExact) { + if (!hasOwnProp(this, '_weekdaysRegex')) { + computeWeekdaysParse.call(this); + } + if (isStrict) { + return this._weekdaysShortStrictRegex; + } else { + return this._weekdaysShortRegex; + } + } else { + if (!hasOwnProp(this, '_weekdaysShortRegex')) { + this._weekdaysShortRegex = defaultWeekdaysShortRegex; + } + return this._weekdaysShortStrictRegex && isStrict + ? this._weekdaysShortStrictRegex + : this._weekdaysShortRegex; + } + } + + function weekdaysMinRegex(isStrict) { + if (this._weekdaysParseExact) { + if (!hasOwnProp(this, '_weekdaysRegex')) { + computeWeekdaysParse.call(this); + } + if (isStrict) { + return this._weekdaysMinStrictRegex; + } else { + return this._weekdaysMinRegex; + } + } else { + if (!hasOwnProp(this, '_weekdaysMinRegex')) { + this._weekdaysMinRegex = defaultWeekdaysMinRegex; + } + return this._weekdaysMinStrictRegex && isStrict + ? this._weekdaysMinStrictRegex + : this._weekdaysMinRegex; + } + } + + function computeWeekdaysParse() { + function cmpLenRev(a, b) { + return b.length - a.length; + } + + var minPieces = [], + shortPieces = [], + longPieces = [], + mixedPieces = [], + i, + mom, + minp, + shortp, + longp; + for (i = 0; i < 7; i++) { + // make the regex if we don't have it already + mom = createUTC([2000, 1]).day(i); + minp = regexEscape(this.weekdaysMin(mom, '')); + shortp = regexEscape(this.weekdaysShort(mom, '')); + longp = regexEscape(this.weekdays(mom, '')); + minPieces.push(minp); + shortPieces.push(shortp); + longPieces.push(longp); + mixedPieces.push(minp); + mixedPieces.push(shortp); + mixedPieces.push(longp); + } + // Sorting makes sure if one weekday (or abbr) is a prefix of another it + // will match the longer piece. + minPieces.sort(cmpLenRev); + shortPieces.sort(cmpLenRev); + longPieces.sort(cmpLenRev); + mixedPieces.sort(cmpLenRev); + + this._weekdaysRegex = new RegExp('^(' + mixedPieces.join('|') + ')', 'i'); + this._weekdaysShortRegex = this._weekdaysRegex; + this._weekdaysMinRegex = this._weekdaysRegex; + + this._weekdaysStrictRegex = new RegExp( + '^(' + longPieces.join('|') + ')', + 'i' + ); + this._weekdaysShortStrictRegex = new RegExp( + '^(' + shortPieces.join('|') + ')', + 'i' + ); + this._weekdaysMinStrictRegex = new RegExp( + '^(' + minPieces.join('|') + ')', + 'i' + ); + } + + // FORMATTING + + function hFormat() { + return this.hours() % 12 || 12; + } + + function kFormat() { + return this.hours() || 24; + } + + addFormatToken('H', ['HH', 2], 0, 'hour'); + addFormatToken('h', ['hh', 2], 0, hFormat); + addFormatToken('k', ['kk', 2], 0, kFormat); + + addFormatToken('hmm', 0, 0, function () { + return '' + hFormat.apply(this) + zeroFill(this.minutes(), 2); + }); + + addFormatToken('hmmss', 0, 0, function () { + return ( + '' + + hFormat.apply(this) + + zeroFill(this.minutes(), 2) + + zeroFill(this.seconds(), 2) + ); + }); + + addFormatToken('Hmm', 0, 0, function () { + return '' + this.hours() + zeroFill(this.minutes(), 2); + }); + + addFormatToken('Hmmss', 0, 0, function () { + return ( + '' + + this.hours() + + zeroFill(this.minutes(), 2) + + zeroFill(this.seconds(), 2) + ); + }); + + function meridiem(token, lowercase) { + addFormatToken(token, 0, 0, function () { + return this.localeData().meridiem( + this.hours(), + this.minutes(), + lowercase + ); + }); + } + + meridiem('a', true); + meridiem('A', false); + + // ALIASES + + addUnitAlias('hour', 'h'); + + // PRIORITY + addUnitPriority('hour', 13); + + // PARSING + + function matchMeridiem(isStrict, locale) { + return locale._meridiemParse; + } + + addRegexToken('a', matchMeridiem); + addRegexToken('A', matchMeridiem); + addRegexToken('H', match1to2); + addRegexToken('h', match1to2); + addRegexToken('k', match1to2); + addRegexToken('HH', match1to2, match2); + addRegexToken('hh', match1to2, match2); + addRegexToken('kk', match1to2, match2); + + addRegexToken('hmm', match3to4); + addRegexToken('hmmss', match5to6); + addRegexToken('Hmm', match3to4); + addRegexToken('Hmmss', match5to6); + + addParseToken(['H', 'HH'], HOUR); + addParseToken(['k', 'kk'], function (input, array, config) { + var kInput = toInt(input); + array[HOUR] = kInput === 24 ? 0 : kInput; + }); + addParseToken(['a', 'A'], function (input, array, config) { + config._isPm = config._locale.isPM(input); + config._meridiem = input; + }); + addParseToken(['h', 'hh'], function (input, array, config) { + array[HOUR] = toInt(input); + getParsingFlags(config).bigHour = true; + }); + addParseToken('hmm', function (input, array, config) { + var pos = input.length - 2; + array[HOUR] = toInt(input.substr(0, pos)); + array[MINUTE] = toInt(input.substr(pos)); + getParsingFlags(config).bigHour = true; + }); + addParseToken('hmmss', function (input, array, config) { + var pos1 = input.length - 4, + pos2 = input.length - 2; + array[HOUR] = toInt(input.substr(0, pos1)); + array[MINUTE] = toInt(input.substr(pos1, 2)); + array[SECOND] = toInt(input.substr(pos2)); + getParsingFlags(config).bigHour = true; + }); + addParseToken('Hmm', function (input, array, config) { + var pos = input.length - 2; + array[HOUR] = toInt(input.substr(0, pos)); + array[MINUTE] = toInt(input.substr(pos)); + }); + addParseToken('Hmmss', function (input, array, config) { + var pos1 = input.length - 4, + pos2 = input.length - 2; + array[HOUR] = toInt(input.substr(0, pos1)); + array[MINUTE] = toInt(input.substr(pos1, 2)); + array[SECOND] = toInt(input.substr(pos2)); + }); + + // LOCALES + + function localeIsPM(input) { + // IE8 Quirks Mode & IE7 Standards Mode do not allow accessing strings like arrays + // Using charAt should be more compatible. + return (input + '').toLowerCase().charAt(0) === 'p'; + } + + var defaultLocaleMeridiemParse = /[ap]\.?m?\.?/i, + // Setting the hour should keep the time, because the user explicitly + // specified which hour they want. So trying to maintain the same hour (in + // a new timezone) makes sense. Adding/subtracting hours does not follow + // this rule. + getSetHour = makeGetSet('Hours', true); + + function localeMeridiem(hours, minutes, isLower) { + if (hours > 11) { + return isLower ? 'pm' : 'PM'; + } else { + return isLower ? 'am' : 'AM'; + } + } + + var baseConfig = { + calendar: defaultCalendar, + longDateFormat: defaultLongDateFormat, + invalidDate: defaultInvalidDate, + ordinal: defaultOrdinal, + dayOfMonthOrdinalParse: defaultDayOfMonthOrdinalParse, + relativeTime: defaultRelativeTime, + + months: defaultLocaleMonths, + monthsShort: defaultLocaleMonthsShort, + + week: defaultLocaleWeek, + + weekdays: defaultLocaleWeekdays, + weekdaysMin: defaultLocaleWeekdaysMin, + weekdaysShort: defaultLocaleWeekdaysShort, + + meridiemParse: defaultLocaleMeridiemParse, + }; + + // internal storage for locale config files + var locales = {}, + localeFamilies = {}, + globalLocale; + + function commonPrefix(arr1, arr2) { + var i, + minl = Math.min(arr1.length, arr2.length); + for (i = 0; i < minl; i += 1) { + if (arr1[i] !== arr2[i]) { + return i; + } + } + return minl; + } + + function normalizeLocale(key) { + return key ? key.toLowerCase().replace('_', '-') : key; + } + + // pick the locale from the array + // try ['en-au', 'en-gb'] as 'en-au', 'en-gb', 'en', as in move through the list trying each + // substring from most specific to least, but move to the next array item if it's a more specific variant than the current root + function chooseLocale(names) { + var i = 0, + j, + next, + locale, + split; + + while (i < names.length) { + split = normalizeLocale(names[i]).split('-'); + j = split.length; + next = normalizeLocale(names[i + 1]); + next = next ? next.split('-') : null; + while (j > 0) { + locale = loadLocale(split.slice(0, j).join('-')); + if (locale) { + return locale; + } + if ( + next && + next.length >= j && + commonPrefix(split, next) >= j - 1 + ) { + //the next array item is better than a shallower substring of this one + break; + } + j--; + } + i++; + } + return globalLocale; + } + + function loadLocale(name) { + var oldLocale = null, + aliasedRequire; + // TODO: Find a better way to register and load all the locales in Node + if ( + locales[name] === undefined && + typeof module !== 'undefined' && + module && + module.exports + ) { + try { + oldLocale = globalLocale._abbr; + aliasedRequire = require; + aliasedRequire('./locale/' + name); + getSetGlobalLocale(oldLocale); + } catch (e) { + // mark as not found to avoid repeating expensive file require call causing high CPU + // when trying to find en-US, en_US, en-us for every format call + locales[name] = null; // null means not found + } + } + return locales[name]; + } + + // This function will load locale and then set the global locale. If + // no arguments are passed in, it will simply return the current global + // locale key. + function getSetGlobalLocale(key, values) { + var data; + if (key) { + if (isUndefined(values)) { + data = getLocale(key); + } else { + data = defineLocale(key, values); + } + + if (data) { + // moment.duration._locale = moment._locale = data; + globalLocale = data; + } else { + if (typeof console !== 'undefined' && console.warn) { + //warn user if arguments are passed but the locale could not be set + console.warn( + 'Locale ' + key + ' not found. Did you forget to load it?' + ); + } + } + } + + return globalLocale._abbr; + } + + function defineLocale(name, config) { + if (config !== null) { + var locale, + parentConfig = baseConfig; + config.abbr = name; + if (locales[name] != null) { + deprecateSimple( + 'defineLocaleOverride', + 'use moment.updateLocale(localeName, config) to change ' + + 'an existing locale. moment.defineLocale(localeName, ' + + 'config) should only be used for creating a new locale ' + + 'See http://momentjs.com/guides/#/warnings/define-locale/ for more info.' + ); + parentConfig = locales[name]._config; + } else if (config.parentLocale != null) { + if (locales[config.parentLocale] != null) { + parentConfig = locales[config.parentLocale]._config; + } else { + locale = loadLocale(config.parentLocale); + if (locale != null) { + parentConfig = locale._config; + } else { + if (!localeFamilies[config.parentLocale]) { + localeFamilies[config.parentLocale] = []; + } + localeFamilies[config.parentLocale].push({ + name: name, + config: config, + }); + return null; + } + } + } + locales[name] = new Locale(mergeConfigs(parentConfig, config)); + + if (localeFamilies[name]) { + localeFamilies[name].forEach(function (x) { + defineLocale(x.name, x.config); + }); + } + + // backwards compat for now: also set the locale + // make sure we set the locale AFTER all child locales have been + // created, so we won't end up with the child locale set. + getSetGlobalLocale(name); + + return locales[name]; + } else { + // useful for testing + delete locales[name]; + return null; + } + } + + function updateLocale(name, config) { + if (config != null) { + var locale, + tmpLocale, + parentConfig = baseConfig; + + if (locales[name] != null && locales[name].parentLocale != null) { + // Update existing child locale in-place to avoid memory-leaks + locales[name].set(mergeConfigs(locales[name]._config, config)); + } else { + // MERGE + tmpLocale = loadLocale(name); + if (tmpLocale != null) { + parentConfig = tmpLocale._config; + } + config = mergeConfigs(parentConfig, config); + if (tmpLocale == null) { + // updateLocale is called for creating a new locale + // Set abbr so it will have a name (getters return + // undefined otherwise). + config.abbr = name; + } + locale = new Locale(config); + locale.parentLocale = locales[name]; + locales[name] = locale; + } + + // backwards compat for now: also set the locale + getSetGlobalLocale(name); + } else { + // pass null for config to unupdate, useful for tests + if (locales[name] != null) { + if (locales[name].parentLocale != null) { + locales[name] = locales[name].parentLocale; + if (name === getSetGlobalLocale()) { + getSetGlobalLocale(name); + } + } else if (locales[name] != null) { + delete locales[name]; + } + } + } + return locales[name]; + } + + // returns locale data + function getLocale(key) { + var locale; + + if (key && key._locale && key._locale._abbr) { + key = key._locale._abbr; + } + + if (!key) { + return globalLocale; + } + + if (!isArray(key)) { + //short-circuit everything else + locale = loadLocale(key); + if (locale) { + return locale; + } + key = [key]; + } + + return chooseLocale(key); + } + + function listLocales() { + return keys(locales); + } + + function checkOverflow(m) { + var overflow, + a = m._a; + + if (a && getParsingFlags(m).overflow === -2) { + overflow = + a[MONTH] < 0 || a[MONTH] > 11 + ? MONTH + : a[DATE] < 1 || a[DATE] > daysInMonth(a[YEAR], a[MONTH]) + ? DATE + : a[HOUR] < 0 || + a[HOUR] > 24 || + (a[HOUR] === 24 && + (a[MINUTE] !== 0 || + a[SECOND] !== 0 || + a[MILLISECOND] !== 0)) + ? HOUR + : a[MINUTE] < 0 || a[MINUTE] > 59 + ? MINUTE + : a[SECOND] < 0 || a[SECOND] > 59 + ? SECOND + : a[MILLISECOND] < 0 || a[MILLISECOND] > 999 + ? MILLISECOND + : -1; + + if ( + getParsingFlags(m)._overflowDayOfYear && + (overflow < YEAR || overflow > DATE) + ) { + overflow = DATE; + } + if (getParsingFlags(m)._overflowWeeks && overflow === -1) { + overflow = WEEK; + } + if (getParsingFlags(m)._overflowWeekday && overflow === -1) { + overflow = WEEKDAY; + } + + getParsingFlags(m).overflow = overflow; + } + + return m; + } + + // iso 8601 regex + // 0000-00-00 0000-W00 or 0000-W00-0 + T + 00 or 00:00 or 00:00:00 or 00:00:00.000 + +00:00 or +0000 or +00) + var extendedIsoRegex = /^\s*((?:[+-]\d{6}|\d{4})-(?:\d\d-\d\d|W\d\d-\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?::\d\d(?::\d\d(?:[.,]\d+)?)?)?)([+-]\d\d(?::?\d\d)?|\s*Z)?)?$/, + basicIsoRegex = /^\s*((?:[+-]\d{6}|\d{4})(?:\d\d\d\d|W\d\d\d|W\d\d|\d\d\d|\d\d|))(?:(T| )(\d\d(?:\d\d(?:\d\d(?:[.,]\d+)?)?)?)([+-]\d\d(?::?\d\d)?|\s*Z)?)?$/, + tzRegex = /Z|[+-]\d\d(?::?\d\d)?/, + isoDates = [ + ['YYYYYY-MM-DD', /[+-]\d{6}-\d\d-\d\d/], + ['YYYY-MM-DD', /\d{4}-\d\d-\d\d/], + ['GGGG-[W]WW-E', /\d{4}-W\d\d-\d/], + ['GGGG-[W]WW', /\d{4}-W\d\d/, false], + ['YYYY-DDD', /\d{4}-\d{3}/], + ['YYYY-MM', /\d{4}-\d\d/, false], + ['YYYYYYMMDD', /[+-]\d{10}/], + ['YYYYMMDD', /\d{8}/], + ['GGGG[W]WWE', /\d{4}W\d{3}/], + ['GGGG[W]WW', /\d{4}W\d{2}/, false], + ['YYYYDDD', /\d{7}/], + ['YYYYMM', /\d{6}/, false], + ['YYYY', /\d{4}/, false], + ], + // iso time formats and regexes + isoTimes = [ + ['HH:mm:ss.SSSS', /\d\d:\d\d:\d\d\.\d+/], + ['HH:mm:ss,SSSS', /\d\d:\d\d:\d\d,\d+/], + ['HH:mm:ss', /\d\d:\d\d:\d\d/], + ['HH:mm', /\d\d:\d\d/], + ['HHmmss.SSSS', /\d\d\d\d\d\d\.\d+/], + ['HHmmss,SSSS', /\d\d\d\d\d\d,\d+/], + ['HHmmss', /\d\d\d\d\d\d/], + ['HHmm', /\d\d\d\d/], + ['HH', /\d\d/], + ], + aspNetJsonRegex = /^\/?Date\((-?\d+)/i, + // RFC 2822 regex: For details see https://tools.ietf.org/html/rfc2822#section-3.3 + rfc2822 = /^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),?\s)?(\d{1,2})\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(\d{2,4})\s(\d\d):(\d\d)(?::(\d\d))?\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|([+-]\d{4}))$/, + obsOffsets = { + UT: 0, + GMT: 0, + EDT: -4 * 60, + EST: -5 * 60, + CDT: -5 * 60, + CST: -6 * 60, + MDT: -6 * 60, + MST: -7 * 60, + PDT: -7 * 60, + PST: -8 * 60, + }; + + // date from iso format + function configFromISO(config) { + var i, + l, + string = config._i, + match = extendedIsoRegex.exec(string) || basicIsoRegex.exec(string), + allowTime, + dateFormat, + timeFormat, + tzFormat; + + if (match) { + getParsingFlags(config).iso = true; + + for (i = 0, l = isoDates.length; i < l; i++) { + if (isoDates[i][1].exec(match[1])) { + dateFormat = isoDates[i][0]; + allowTime = isoDates[i][2] !== false; + break; + } + } + if (dateFormat == null) { + config._isValid = false; + return; + } + if (match[3]) { + for (i = 0, l = isoTimes.length; i < l; i++) { + if (isoTimes[i][1].exec(match[3])) { + // match[2] should be 'T' or space + timeFormat = (match[2] || ' ') + isoTimes[i][0]; + break; + } + } + if (timeFormat == null) { + config._isValid = false; + return; + } + } + if (!allowTime && timeFormat != null) { + config._isValid = false; + return; + } + if (match[4]) { + if (tzRegex.exec(match[4])) { + tzFormat = 'Z'; + } else { + config._isValid = false; + return; + } + } + config._f = dateFormat + (timeFormat || '') + (tzFormat || ''); + configFromStringAndFormat(config); + } else { + config._isValid = false; + } + } + + function extractFromRFC2822Strings( + yearStr, + monthStr, + dayStr, + hourStr, + minuteStr, + secondStr + ) { + var result = [ + untruncateYear(yearStr), + defaultLocaleMonthsShort.indexOf(monthStr), + parseInt(dayStr, 10), + parseInt(hourStr, 10), + parseInt(minuteStr, 10), + ]; + + if (secondStr) { + result.push(parseInt(secondStr, 10)); + } + + return result; + } + + function untruncateYear(yearStr) { + var year = parseInt(yearStr, 10); + if (year <= 49) { + return 2000 + year; + } else if (year <= 999) { + return 1900 + year; + } + return year; + } + + function preprocessRFC2822(s) { + // Remove comments and folding whitespace and replace multiple-spaces with a single space + return s + .replace(/\([^)]*\)|[\n\t]/g, ' ') + .replace(/(\s\s+)/g, ' ') + .replace(/^\s\s*/, '') + .replace(/\s\s*$/, ''); + } + + function checkWeekday(weekdayStr, parsedInput, config) { + if (weekdayStr) { + // TODO: Replace the vanilla JS Date object with an independent day-of-week check. + var weekdayProvided = defaultLocaleWeekdaysShort.indexOf(weekdayStr), + weekdayActual = new Date( + parsedInput[0], + parsedInput[1], + parsedInput[2] + ).getDay(); + if (weekdayProvided !== weekdayActual) { + getParsingFlags(config).weekdayMismatch = true; + config._isValid = false; + return false; + } + } + return true; + } + + function calculateOffset(obsOffset, militaryOffset, numOffset) { + if (obsOffset) { + return obsOffsets[obsOffset]; + } else if (militaryOffset) { + // the only allowed military tz is Z + return 0; + } else { + var hm = parseInt(numOffset, 10), + m = hm % 100, + h = (hm - m) / 100; + return h * 60 + m; + } + } + + // date and time from ref 2822 format + function configFromRFC2822(config) { + var match = rfc2822.exec(preprocessRFC2822(config._i)), + parsedArray; + if (match) { + parsedArray = extractFromRFC2822Strings( + match[4], + match[3], + match[2], + match[5], + match[6], + match[7] + ); + if (!checkWeekday(match[1], parsedArray, config)) { + return; + } + + config._a = parsedArray; + config._tzm = calculateOffset(match[8], match[9], match[10]); + + config._d = createUTCDate.apply(null, config._a); + config._d.setUTCMinutes(config._d.getUTCMinutes() - config._tzm); + + getParsingFlags(config).rfc2822 = true; + } else { + config._isValid = false; + } + } + + // date from 1) ASP.NET, 2) ISO, 3) RFC 2822 formats, or 4) optional fallback if parsing isn't strict + function configFromString(config) { + var matched = aspNetJsonRegex.exec(config._i); + if (matched !== null) { + config._d = new Date(+matched[1]); + return; + } + + configFromISO(config); + if (config._isValid === false) { + delete config._isValid; + } else { + return; + } + + configFromRFC2822(config); + if (config._isValid === false) { + delete config._isValid; + } else { + return; + } + + if (config._strict) { + config._isValid = false; + } else { + // Final attempt, use Input Fallback + hooks.createFromInputFallback(config); + } + } + + hooks.createFromInputFallback = deprecate( + 'value provided is not in a recognized RFC2822 or ISO format. moment construction falls back to js Date(), ' + + 'which is not reliable across all browsers and versions. Non RFC2822/ISO date formats are ' + + 'discouraged and will be removed in an upcoming major release. Please refer to ' + + 'http://momentjs.com/guides/#/warnings/js-date/ for more info.', + function (config) { + config._d = new Date(config._i + (config._useUTC ? ' UTC' : '')); + } + ); + + // Pick the first defined of two or three arguments. + function defaults(a, b, c) { + if (a != null) { + return a; + } + if (b != null) { + return b; + } + return c; + } + + function currentDateArray(config) { + // hooks is actually the exported moment object + var nowValue = new Date(hooks.now()); + if (config._useUTC) { + return [ + nowValue.getUTCFullYear(), + nowValue.getUTCMonth(), + nowValue.getUTCDate(), + ]; + } + return [nowValue.getFullYear(), nowValue.getMonth(), nowValue.getDate()]; + } + + // convert an array to a date. + // the array should mirror the parameters below + // note: all values past the year are optional and will default to the lowest possible value. + // [year, month, day , hour, minute, second, millisecond] + function configFromArray(config) { + var i, + date, + input = [], + currentDate, + expectedWeekday, + yearToUse; + + if (config._d) { + return; + } + + currentDate = currentDateArray(config); + + //compute day of the year from weeks and weekdays + if (config._w && config._a[DATE] == null && config._a[MONTH] == null) { + dayOfYearFromWeekInfo(config); + } + + //if the day of the year is set, figure out what it is + if (config._dayOfYear != null) { + yearToUse = defaults(config._a[YEAR], currentDate[YEAR]); + + if ( + config._dayOfYear > daysInYear(yearToUse) || + config._dayOfYear === 0 + ) { + getParsingFlags(config)._overflowDayOfYear = true; + } + + date = createUTCDate(yearToUse, 0, config._dayOfYear); + config._a[MONTH] = date.getUTCMonth(); + config._a[DATE] = date.getUTCDate(); + } + + // Default to current date. + // * if no year, month, day of month are given, default to today + // * if day of month is given, default month and year + // * if month is given, default only year + // * if year is given, don't default anything + for (i = 0; i < 3 && config._a[i] == null; ++i) { + config._a[i] = input[i] = currentDate[i]; + } + + // Zero out whatever was not defaulted, including time + for (; i < 7; i++) { + config._a[i] = input[i] = + config._a[i] == null ? (i === 2 ? 1 : 0) : config._a[i]; + } + + // Check for 24:00:00.000 + if ( + config._a[HOUR] === 24 && + config._a[MINUTE] === 0 && + config._a[SECOND] === 0 && + config._a[MILLISECOND] === 0 + ) { + config._nextDay = true; + config._a[HOUR] = 0; + } + + config._d = (config._useUTC ? createUTCDate : createDate).apply( + null, + input + ); + expectedWeekday = config._useUTC + ? config._d.getUTCDay() + : config._d.getDay(); + + // Apply timezone offset from input. The actual utcOffset can be changed + // with parseZone. + if (config._tzm != null) { + config._d.setUTCMinutes(config._d.getUTCMinutes() - config._tzm); + } + + if (config._nextDay) { + config._a[HOUR] = 24; + } + + // check for mismatching day of week + if ( + config._w && + typeof config._w.d !== 'undefined' && + config._w.d !== expectedWeekday + ) { + getParsingFlags(config).weekdayMismatch = true; + } + } + + function dayOfYearFromWeekInfo(config) { + var w, weekYear, week, weekday, dow, doy, temp, weekdayOverflow, curWeek; + + w = config._w; + if (w.GG != null || w.W != null || w.E != null) { + dow = 1; + doy = 4; + + // TODO: We need to take the current isoWeekYear, but that depends on + // how we interpret now (local, utc, fixed offset). So create + // a now version of current config (take local/utc/offset flags, and + // create now). + weekYear = defaults( + w.GG, + config._a[YEAR], + weekOfYear(createLocal(), 1, 4).year + ); + week = defaults(w.W, 1); + weekday = defaults(w.E, 1); + if (weekday < 1 || weekday > 7) { + weekdayOverflow = true; + } + } else { + dow = config._locale._week.dow; + doy = config._locale._week.doy; + + curWeek = weekOfYear(createLocal(), dow, doy); + + weekYear = defaults(w.gg, config._a[YEAR], curWeek.year); + + // Default to current week. + week = defaults(w.w, curWeek.week); + + if (w.d != null) { + // weekday -- low day numbers are considered next week + weekday = w.d; + if (weekday < 0 || weekday > 6) { + weekdayOverflow = true; + } + } else if (w.e != null) { + // local weekday -- counting starts from beginning of week + weekday = w.e + dow; + if (w.e < 0 || w.e > 6) { + weekdayOverflow = true; + } + } else { + // default to beginning of week + weekday = dow; + } + } + if (week < 1 || week > weeksInYear(weekYear, dow, doy)) { + getParsingFlags(config)._overflowWeeks = true; + } else if (weekdayOverflow != null) { + getParsingFlags(config)._overflowWeekday = true; + } else { + temp = dayOfYearFromWeeks(weekYear, week, weekday, dow, doy); + config._a[YEAR] = temp.year; + config._dayOfYear = temp.dayOfYear; + } + } + + // constant that refers to the ISO standard + hooks.ISO_8601 = function () {}; + + // constant that refers to the RFC 2822 form + hooks.RFC_2822 = function () {}; + + // date from string and format string + function configFromStringAndFormat(config) { + // TODO: Move this to another part of the creation flow to prevent circular deps + if (config._f === hooks.ISO_8601) { + configFromISO(config); + return; + } + if (config._f === hooks.RFC_2822) { + configFromRFC2822(config); + return; + } + config._a = []; + getParsingFlags(config).empty = true; + + // This array is used to make a Date, either with `new Date` or `Date.UTC` + var string = '' + config._i, + i, + parsedInput, + tokens, + token, + skipped, + stringLength = string.length, + totalParsedInputLength = 0, + era; + + tokens = + expandFormat(config._f, config._locale).match(formattingTokens) || []; + + for (i = 0; i < tokens.length; i++) { + token = tokens[i]; + parsedInput = (string.match(getParseRegexForToken(token, config)) || + [])[0]; + if (parsedInput) { + skipped = string.substr(0, string.indexOf(parsedInput)); + if (skipped.length > 0) { + getParsingFlags(config).unusedInput.push(skipped); + } + string = string.slice( + string.indexOf(parsedInput) + parsedInput.length + ); + totalParsedInputLength += parsedInput.length; + } + // don't parse if it's not a known token + if (formatTokenFunctions[token]) { + if (parsedInput) { + getParsingFlags(config).empty = false; + } else { + getParsingFlags(config).unusedTokens.push(token); + } + addTimeToArrayFromToken(token, parsedInput, config); + } else if (config._strict && !parsedInput) { + getParsingFlags(config).unusedTokens.push(token); + } + } + + // add remaining unparsed input length to the string + getParsingFlags(config).charsLeftOver = + stringLength - totalParsedInputLength; + if (string.length > 0) { + getParsingFlags(config).unusedInput.push(string); + } + + // clear _12h flag if hour is <= 12 + if ( + config._a[HOUR] <= 12 && + getParsingFlags(config).bigHour === true && + config._a[HOUR] > 0 + ) { + getParsingFlags(config).bigHour = undefined; + } + + getParsingFlags(config).parsedDateParts = config._a.slice(0); + getParsingFlags(config).meridiem = config._meridiem; + // handle meridiem + config._a[HOUR] = meridiemFixWrap( + config._locale, + config._a[HOUR], + config._meridiem + ); + + // handle era + era = getParsingFlags(config).era; + if (era !== null) { + config._a[YEAR] = config._locale.erasConvertYear(era, config._a[YEAR]); + } + + configFromArray(config); + checkOverflow(config); + } + + function meridiemFixWrap(locale, hour, meridiem) { + var isPm; + + if (meridiem == null) { + // nothing to do + return hour; + } + if (locale.meridiemHour != null) { + return locale.meridiemHour(hour, meridiem); + } else if (locale.isPM != null) { + // Fallback + isPm = locale.isPM(meridiem); + if (isPm && hour < 12) { + hour += 12; + } + if (!isPm && hour === 12) { + hour = 0; + } + return hour; + } else { + // this is not supposed to happen + return hour; + } + } + + // date from string and array of format strings + function configFromStringAndArray(config) { + var tempConfig, + bestMoment, + scoreToBeat, + i, + currentScore, + validFormatFound, + bestFormatIsValid = false; + + if (config._f.length === 0) { + getParsingFlags(config).invalidFormat = true; + config._d = new Date(NaN); + return; + } + + for (i = 0; i < config._f.length; i++) { + currentScore = 0; + validFormatFound = false; + tempConfig = copyConfig({}, config); + if (config._useUTC != null) { + tempConfig._useUTC = config._useUTC; + } + tempConfig._f = config._f[i]; + configFromStringAndFormat(tempConfig); + + if (isValid(tempConfig)) { + validFormatFound = true; + } + + // if there is any input that was not parsed add a penalty for that format + currentScore += getParsingFlags(tempConfig).charsLeftOver; + + //or tokens + currentScore += getParsingFlags(tempConfig).unusedTokens.length * 10; + + getParsingFlags(tempConfig).score = currentScore; + + if (!bestFormatIsValid) { + if ( + scoreToBeat == null || + currentScore < scoreToBeat || + validFormatFound + ) { + scoreToBeat = currentScore; + bestMoment = tempConfig; + if (validFormatFound) { + bestFormatIsValid = true; + } + } + } else { + if (currentScore < scoreToBeat) { + scoreToBeat = currentScore; + bestMoment = tempConfig; + } + } + } + + extend(config, bestMoment || tempConfig); + } + + function configFromObject(config) { + if (config._d) { + return; + } + + var i = normalizeObjectUnits(config._i), + dayOrDate = i.day === undefined ? i.date : i.day; + config._a = map( + [i.year, i.month, dayOrDate, i.hour, i.minute, i.second, i.millisecond], + function (obj) { + return obj && parseInt(obj, 10); + } + ); + + configFromArray(config); + } + + function createFromConfig(config) { + var res = new Moment(checkOverflow(prepareConfig(config))); + if (res._nextDay) { + // Adding is smart enough around DST + res.add(1, 'd'); + res._nextDay = undefined; + } + + return res; + } + + function prepareConfig(config) { + var input = config._i, + format = config._f; + + config._locale = config._locale || getLocale(config._l); + + if (input === null || (format === undefined && input === '')) { + return createInvalid({ nullInput: true }); + } + + if (typeof input === 'string') { + config._i = input = config._locale.preparse(input); + } + + if (isMoment(input)) { + return new Moment(checkOverflow(input)); + } else if (isDate(input)) { + config._d = input; + } else if (isArray(format)) { + configFromStringAndArray(config); + } else if (format) { + configFromStringAndFormat(config); + } else { + configFromInput(config); + } + + if (!isValid(config)) { + config._d = null; + } + + return config; + } + + function configFromInput(config) { + var input = config._i; + if (isUndefined(input)) { + config._d = new Date(hooks.now()); + } else if (isDate(input)) { + config._d = new Date(input.valueOf()); + } else if (typeof input === 'string') { + configFromString(config); + } else if (isArray(input)) { + config._a = map(input.slice(0), function (obj) { + return parseInt(obj, 10); + }); + configFromArray(config); + } else if (isObject(input)) { + configFromObject(config); + } else if (isNumber(input)) { + // from milliseconds + config._d = new Date(input); + } else { + hooks.createFromInputFallback(config); + } + } + + function createLocalOrUTC(input, format, locale, strict, isUTC) { + var c = {}; + + if (format === true || format === false) { + strict = format; + format = undefined; + } + + if (locale === true || locale === false) { + strict = locale; + locale = undefined; + } + + if ( + (isObject(input) && isObjectEmpty(input)) || + (isArray(input) && input.length === 0) + ) { + input = undefined; + } + // object construction must be done this way. + // https://github.com/moment/moment/issues/1423 + c._isAMomentObject = true; + c._useUTC = c._isUTC = isUTC; + c._l = locale; + c._i = input; + c._f = format; + c._strict = strict; + + return createFromConfig(c); + } + + function createLocal(input, format, locale, strict) { + return createLocalOrUTC(input, format, locale, strict, false); + } + + var prototypeMin = deprecate( + 'moment().min is deprecated, use moment.max instead. http://momentjs.com/guides/#/warnings/min-max/', + function () { + var other = createLocal.apply(null, arguments); + if (this.isValid() && other.isValid()) { + return other < this ? this : other; + } else { + return createInvalid(); + } + } + ), + prototypeMax = deprecate( + 'moment().max is deprecated, use moment.min instead. http://momentjs.com/guides/#/warnings/min-max/', + function () { + var other = createLocal.apply(null, arguments); + if (this.isValid() && other.isValid()) { + return other > this ? this : other; + } else { + return createInvalid(); + } + } + ); + + // Pick a moment m from moments so that m[fn](other) is true for all + // other. This relies on the function fn to be transitive. + // + // moments should either be an array of moment objects or an array, whose + // first element is an array of moment objects. + function pickBy(fn, moments) { + var res, i; + if (moments.length === 1 && isArray(moments[0])) { + moments = moments[0]; + } + if (!moments.length) { + return createLocal(); + } + res = moments[0]; + for (i = 1; i < moments.length; ++i) { + if (!moments[i].isValid() || moments[i][fn](res)) { + res = moments[i]; + } + } + return res; + } + + // TODO: Use [].sort instead? + function min() { + var args = [].slice.call(arguments, 0); + + return pickBy('isBefore', args); + } + + function max() { + var args = [].slice.call(arguments, 0); + + return pickBy('isAfter', args); + } + + var now = function () { + return Date.now ? Date.now() : +new Date(); + }; + + var ordering = [ + 'year', + 'quarter', + 'month', + 'week', + 'day', + 'hour', + 'minute', + 'second', + 'millisecond', + ]; + + function isDurationValid(m) { + var key, + unitHasDecimal = false, + i; + for (key in m) { + if ( + hasOwnProp(m, key) && + !( + indexOf.call(ordering, key) !== -1 && + (m[key] == null || !isNaN(m[key])) + ) + ) { + return false; + } + } + + for (i = 0; i < ordering.length; ++i) { + if (m[ordering[i]]) { + if (unitHasDecimal) { + return false; // only allow non-integers for smallest unit + } + if (parseFloat(m[ordering[i]]) !== toInt(m[ordering[i]])) { + unitHasDecimal = true; + } + } + } + + return true; + } + + function isValid$1() { + return this._isValid; + } + + function createInvalid$1() { + return createDuration(NaN); + } + + function Duration(duration) { + var normalizedInput = normalizeObjectUnits(duration), + years = normalizedInput.year || 0, + quarters = normalizedInput.quarter || 0, + months = normalizedInput.month || 0, + weeks = normalizedInput.week || normalizedInput.isoWeek || 0, + days = normalizedInput.day || 0, + hours = normalizedInput.hour || 0, + minutes = normalizedInput.minute || 0, + seconds = normalizedInput.second || 0, + milliseconds = normalizedInput.millisecond || 0; + + this._isValid = isDurationValid(normalizedInput); + + // representation for dateAddRemove + this._milliseconds = + +milliseconds + + seconds * 1e3 + // 1000 + minutes * 6e4 + // 1000 * 60 + hours * 1000 * 60 * 60; //using 1000 * 60 * 60 instead of 36e5 to avoid floating point rounding errors https://github.com/moment/moment/issues/2978 + // Because of dateAddRemove treats 24 hours as different from a + // day when working around DST, we need to store them separately + this._days = +days + weeks * 7; + // It is impossible to translate months into days without knowing + // which months you are are talking about, so we have to store + // it separately. + this._months = +months + quarters * 3 + years * 12; + + this._data = {}; + + this._locale = getLocale(); + + this._bubble(); + } + + function isDuration(obj) { + return obj instanceof Duration; + } + + function absRound(number) { + if (number < 0) { + return Math.round(-1 * number) * -1; + } else { + return Math.round(number); + } + } + + // compare two arrays, return the number of differences + function compareArrays(array1, array2, dontConvert) { + var len = Math.min(array1.length, array2.length), + lengthDiff = Math.abs(array1.length - array2.length), + diffs = 0, + i; + for (i = 0; i < len; i++) { + if ( + (dontConvert && array1[i] !== array2[i]) || + (!dontConvert && toInt(array1[i]) !== toInt(array2[i])) + ) { + diffs++; + } + } + return diffs + lengthDiff; + } + + // FORMATTING + + function offset(token, separator) { + addFormatToken(token, 0, 0, function () { + var offset = this.utcOffset(), + sign = '+'; + if (offset < 0) { + offset = -offset; + sign = '-'; + } + return ( + sign + + zeroFill(~~(offset / 60), 2) + + separator + + zeroFill(~~offset % 60, 2) + ); + }); + } + + offset('Z', ':'); + offset('ZZ', ''); + + // PARSING + + addRegexToken('Z', matchShortOffset); + addRegexToken('ZZ', matchShortOffset); + addParseToken(['Z', 'ZZ'], function (input, array, config) { + config._useUTC = true; + config._tzm = offsetFromString(matchShortOffset, input); + }); + + // HELPERS + + // timezone chunker + // '+10:00' > ['10', '00'] + // '-1530' > ['-15', '30'] + var chunkOffset = /([\+\-]|\d\d)/gi; + + function offsetFromString(matcher, string) { + var matches = (string || '').match(matcher), + chunk, + parts, + minutes; + + if (matches === null) { + return null; + } + + chunk = matches[matches.length - 1] || []; + parts = (chunk + '').match(chunkOffset) || ['-', 0, 0]; + minutes = +(parts[1] * 60) + toInt(parts[2]); + + return minutes === 0 ? 0 : parts[0] === '+' ? minutes : -minutes; + } + + // Return a moment from input, that is local/utc/zone equivalent to model. + function cloneWithOffset(input, model) { + var res, diff; + if (model._isUTC) { + res = model.clone(); + diff = + (isMoment(input) || isDate(input) + ? input.valueOf() + : createLocal(input).valueOf()) - res.valueOf(); + // Use low-level api, because this fn is low-level api. + res._d.setTime(res._d.valueOf() + diff); + hooks.updateOffset(res, false); + return res; + } else { + return createLocal(input).local(); + } + } + + function getDateOffset(m) { + // On Firefox.24 Date#getTimezoneOffset returns a floating point. + // https://github.com/moment/moment/pull/1871 + return -Math.round(m._d.getTimezoneOffset()); + } + + // HOOKS + + // This function will be called whenever a moment is mutated. + // It is intended to keep the offset in sync with the timezone. + hooks.updateOffset = function () {}; + + // MOMENTS + + // keepLocalTime = true means only change the timezone, without + // affecting the local hour. So 5:31:26 +0300 --[utcOffset(2, true)]--> + // 5:31:26 +0200 It is possible that 5:31:26 doesn't exist with offset + // +0200, so we adjust the time as needed, to be valid. + // + // Keeping the time actually adds/subtracts (one hour) + // from the actual represented time. That is why we call updateOffset + // a second time. In case it wants us to change the offset again + // _changeInProgress == true case, then we have to adjust, because + // there is no such time in the given timezone. + function getSetOffset(input, keepLocalTime, keepMinutes) { + var offset = this._offset || 0, + localAdjust; + if (!this.isValid()) { + return input != null ? this : NaN; + } + if (input != null) { + if (typeof input === 'string') { + input = offsetFromString(matchShortOffset, input); + if (input === null) { + return this; + } + } else if (Math.abs(input) < 16 && !keepMinutes) { + input = input * 60; + } + if (!this._isUTC && keepLocalTime) { + localAdjust = getDateOffset(this); + } + this._offset = input; + this._isUTC = true; + if (localAdjust != null) { + this.add(localAdjust, 'm'); + } + if (offset !== input) { + if (!keepLocalTime || this._changeInProgress) { + addSubtract( + this, + createDuration(input - offset, 'm'), + 1, + false + ); + } else if (!this._changeInProgress) { + this._changeInProgress = true; + hooks.updateOffset(this, true); + this._changeInProgress = null; + } + } + return this; + } else { + return this._isUTC ? offset : getDateOffset(this); + } + } + + function getSetZone(input, keepLocalTime) { + if (input != null) { + if (typeof input !== 'string') { + input = -input; + } + + this.utcOffset(input, keepLocalTime); + + return this; + } else { + return -this.utcOffset(); + } + } + + function setOffsetToUTC(keepLocalTime) { + return this.utcOffset(0, keepLocalTime); + } + + function setOffsetToLocal(keepLocalTime) { + if (this._isUTC) { + this.utcOffset(0, keepLocalTime); + this._isUTC = false; + + if (keepLocalTime) { + this.subtract(getDateOffset(this), 'm'); + } + } + return this; + } + + function setOffsetToParsedOffset() { + if (this._tzm != null) { + this.utcOffset(this._tzm, false, true); + } else if (typeof this._i === 'string') { + var tZone = offsetFromString(matchOffset, this._i); + if (tZone != null) { + this.utcOffset(tZone); + } else { + this.utcOffset(0, true); + } + } + return this; + } + + function hasAlignedHourOffset(input) { + if (!this.isValid()) { + return false; + } + input = input ? createLocal(input).utcOffset() : 0; + + return (this.utcOffset() - input) % 60 === 0; + } + + function isDaylightSavingTime() { + return ( + this.utcOffset() > this.clone().month(0).utcOffset() || + this.utcOffset() > this.clone().month(5).utcOffset() + ); + } + + function isDaylightSavingTimeShifted() { + if (!isUndefined(this._isDSTShifted)) { + return this._isDSTShifted; + } + + var c = {}, + other; + + copyConfig(c, this); + c = prepareConfig(c); + + if (c._a) { + other = c._isUTC ? createUTC(c._a) : createLocal(c._a); + this._isDSTShifted = + this.isValid() && compareArrays(c._a, other.toArray()) > 0; + } else { + this._isDSTShifted = false; + } + + return this._isDSTShifted; + } + + function isLocal() { + return this.isValid() ? !this._isUTC : false; + } + + function isUtcOffset() { + return this.isValid() ? this._isUTC : false; + } + + function isUtc() { + return this.isValid() ? this._isUTC && this._offset === 0 : false; + } + + // ASP.NET json date format regex + var aspNetRegex = /^(-|\+)?(?:(\d*)[. ])?(\d+):(\d+)(?::(\d+)(\.\d*)?)?$/, + // from http://docs.closure-library.googlecode.com/git/closure_goog_date_date.js.source.html + // somewhat more in line with 4.4.3.2 2004 spec, but allows decimal anywhere + // and further modified to allow for strings containing both week and day + isoRegex = /^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/; + + function createDuration(input, key) { + var duration = input, + // matching against regexp is expensive, do it on demand + match = null, + sign, + ret, + diffRes; + + if (isDuration(input)) { + duration = { + ms: input._milliseconds, + d: input._days, + M: input._months, + }; + } else if (isNumber(input) || !isNaN(+input)) { + duration = {}; + if (key) { + duration[key] = +input; + } else { + duration.milliseconds = +input; + } + } else if ((match = aspNetRegex.exec(input))) { + sign = match[1] === '-' ? -1 : 1; + duration = { + y: 0, + d: toInt(match[DATE]) * sign, + h: toInt(match[HOUR]) * sign, + m: toInt(match[MINUTE]) * sign, + s: toInt(match[SECOND]) * sign, + ms: toInt(absRound(match[MILLISECOND] * 1000)) * sign, // the millisecond decimal point is included in the match + }; + } else if ((match = isoRegex.exec(input))) { + sign = match[1] === '-' ? -1 : 1; + duration = { + y: parseIso(match[2], sign), + M: parseIso(match[3], sign), + w: parseIso(match[4], sign), + d: parseIso(match[5], sign), + h: parseIso(match[6], sign), + m: parseIso(match[7], sign), + s: parseIso(match[8], sign), + }; + } else if (duration == null) { + // checks for null or undefined + duration = {}; + } else if ( + typeof duration === 'object' && + ('from' in duration || 'to' in duration) + ) { + diffRes = momentsDifference( + createLocal(duration.from), + createLocal(duration.to) + ); + + duration = {}; + duration.ms = diffRes.milliseconds; + duration.M = diffRes.months; + } + + ret = new Duration(duration); + + if (isDuration(input) && hasOwnProp(input, '_locale')) { + ret._locale = input._locale; + } + + if (isDuration(input) && hasOwnProp(input, '_isValid')) { + ret._isValid = input._isValid; + } + + return ret; + } + + createDuration.fn = Duration.prototype; + createDuration.invalid = createInvalid$1; + + function parseIso(inp, sign) { + // We'd normally use ~~inp for this, but unfortunately it also + // converts floats to ints. + // inp may be undefined, so careful calling replace on it. + var res = inp && parseFloat(inp.replace(',', '.')); + // apply sign while we're at it + return (isNaN(res) ? 0 : res) * sign; + } + + function positiveMomentsDifference(base, other) { + var res = {}; + + res.months = + other.month() - base.month() + (other.year() - base.year()) * 12; + if (base.clone().add(res.months, 'M').isAfter(other)) { + --res.months; + } + + res.milliseconds = +other - +base.clone().add(res.months, 'M'); + + return res; + } + + function momentsDifference(base, other) { + var res; + if (!(base.isValid() && other.isValid())) { + return { milliseconds: 0, months: 0 }; + } + + other = cloneWithOffset(other, base); + if (base.isBefore(other)) { + res = positiveMomentsDifference(base, other); + } else { + res = positiveMomentsDifference(other, base); + res.milliseconds = -res.milliseconds; + res.months = -res.months; + } + + return res; + } + + // TODO: remove 'name' arg after deprecation is removed + function createAdder(direction, name) { + return function (val, period) { + var dur, tmp; + //invert the arguments, but complain about it + if (period !== null && !isNaN(+period)) { + deprecateSimple( + name, + 'moment().' + + name + + '(period, number) is deprecated. Please use moment().' + + name + + '(number, period). ' + + 'See http://momentjs.com/guides/#/warnings/add-inverted-param/ for more info.' + ); + tmp = val; + val = period; + period = tmp; + } + + dur = createDuration(val, period); + addSubtract(this, dur, direction); + return this; + }; + } + + function addSubtract(mom, duration, isAdding, updateOffset) { + var milliseconds = duration._milliseconds, + days = absRound(duration._days), + months = absRound(duration._months); + + if (!mom.isValid()) { + // No op + return; + } + + updateOffset = updateOffset == null ? true : updateOffset; + + if (months) { + setMonth(mom, get(mom, 'Month') + months * isAdding); + } + if (days) { + set$1(mom, 'Date', get(mom, 'Date') + days * isAdding); + } + if (milliseconds) { + mom._d.setTime(mom._d.valueOf() + milliseconds * isAdding); + } + if (updateOffset) { + hooks.updateOffset(mom, days || months); + } + } + + var add = createAdder(1, 'add'), + subtract = createAdder(-1, 'subtract'); + + function isString(input) { + return typeof input === 'string' || input instanceof String; + } + + // type MomentInput = Moment | Date | string | number | (number | string)[] | MomentInputObject | void; // null | undefined + function isMomentInput(input) { + return ( + isMoment(input) || + isDate(input) || + isString(input) || + isNumber(input) || + isNumberOrStringArray(input) || + isMomentInputObject(input) || + input === null || + input === undefined + ); + } + + function isMomentInputObject(input) { + var objectTest = isObject(input) && !isObjectEmpty(input), + propertyTest = false, + properties = [ + 'years', + 'year', + 'y', + 'months', + 'month', + 'M', + 'days', + 'day', + 'd', + 'dates', + 'date', + 'D', + 'hours', + 'hour', + 'h', + 'minutes', + 'minute', + 'm', + 'seconds', + 'second', + 's', + 'milliseconds', + 'millisecond', + 'ms', + ], + i, + property; + + for (i = 0; i < properties.length; i += 1) { + property = properties[i]; + propertyTest = propertyTest || hasOwnProp(input, property); + } + + return objectTest && propertyTest; + } + + function isNumberOrStringArray(input) { + var arrayTest = isArray(input), + dataTypeTest = false; + if (arrayTest) { + dataTypeTest = + input.filter(function (item) { + return !isNumber(item) && isString(input); + }).length === 0; + } + return arrayTest && dataTypeTest; + } + + function isCalendarSpec(input) { + var objectTest = isObject(input) && !isObjectEmpty(input), + propertyTest = false, + properties = [ + 'sameDay', + 'nextDay', + 'lastDay', + 'nextWeek', + 'lastWeek', + 'sameElse', + ], + i, + property; + + for (i = 0; i < properties.length; i += 1) { + property = properties[i]; + propertyTest = propertyTest || hasOwnProp(input, property); + } + + return objectTest && propertyTest; + } + + function getCalendarFormat(myMoment, now) { + var diff = myMoment.diff(now, 'days', true); + return diff < -6 + ? 'sameElse' + : diff < -1 + ? 'lastWeek' + : diff < 0 + ? 'lastDay' + : diff < 1 + ? 'sameDay' + : diff < 2 + ? 'nextDay' + : diff < 7 + ? 'nextWeek' + : 'sameElse'; + } + + function calendar$1(time, formats) { + // Support for single parameter, formats only overload to the calendar function + if (arguments.length === 1) { + if (isMomentInput(arguments[0])) { + time = arguments[0]; + formats = undefined; + } else if (isCalendarSpec(arguments[0])) { + formats = arguments[0]; + time = undefined; + } + } + // We want to compare the start of today, vs this. + // Getting start-of-today depends on whether we're local/utc/offset or not. + var now = time || createLocal(), + sod = cloneWithOffset(now, this).startOf('day'), + format = hooks.calendarFormat(this, sod) || 'sameElse', + output = + formats && + (isFunction(formats[format]) + ? formats[format].call(this, now) + : formats[format]); + + return this.format( + output || this.localeData().calendar(format, this, createLocal(now)) + ); + } + + function clone() { + return new Moment(this); + } + + function isAfter(input, units) { + var localInput = isMoment(input) ? input : createLocal(input); + if (!(this.isValid() && localInput.isValid())) { + return false; + } + units = normalizeUnits(units) || 'millisecond'; + if (units === 'millisecond') { + return this.valueOf() > localInput.valueOf(); + } else { + return localInput.valueOf() < this.clone().startOf(units).valueOf(); + } + } + + function isBefore(input, units) { + var localInput = isMoment(input) ? input : createLocal(input); + if (!(this.isValid() && localInput.isValid())) { + return false; + } + units = normalizeUnits(units) || 'millisecond'; + if (units === 'millisecond') { + return this.valueOf() < localInput.valueOf(); + } else { + return this.clone().endOf(units).valueOf() < localInput.valueOf(); + } + } + + function isBetween(from, to, units, inclusivity) { + var localFrom = isMoment(from) ? from : createLocal(from), + localTo = isMoment(to) ? to : createLocal(to); + if (!(this.isValid() && localFrom.isValid() && localTo.isValid())) { + return false; + } + inclusivity = inclusivity || '()'; + return ( + (inclusivity[0] === '(' + ? this.isAfter(localFrom, units) + : !this.isBefore(localFrom, units)) && + (inclusivity[1] === ')' + ? this.isBefore(localTo, units) + : !this.isAfter(localTo, units)) + ); + } + + function isSame(input, units) { + var localInput = isMoment(input) ? input : createLocal(input), + inputMs; + if (!(this.isValid() && localInput.isValid())) { + return false; + } + units = normalizeUnits(units) || 'millisecond'; + if (units === 'millisecond') { + return this.valueOf() === localInput.valueOf(); + } else { + inputMs = localInput.valueOf(); + return ( + this.clone().startOf(units).valueOf() <= inputMs && + inputMs <= this.clone().endOf(units).valueOf() + ); + } + } + + function isSameOrAfter(input, units) { + return this.isSame(input, units) || this.isAfter(input, units); + } + + function isSameOrBefore(input, units) { + return this.isSame(input, units) || this.isBefore(input, units); + } + + function diff(input, units, asFloat) { + var that, zoneDelta, output; + + if (!this.isValid()) { + return NaN; + } + + that = cloneWithOffset(input, this); + + if (!that.isValid()) { + return NaN; + } + + zoneDelta = (that.utcOffset() - this.utcOffset()) * 6e4; + + units = normalizeUnits(units); + + switch (units) { + case 'year': + output = monthDiff(this, that) / 12; + break; + case 'month': + output = monthDiff(this, that); + break; + case 'quarter': + output = monthDiff(this, that) / 3; + break; + case 'second': + output = (this - that) / 1e3; + break; // 1000 + case 'minute': + output = (this - that) / 6e4; + break; // 1000 * 60 + case 'hour': + output = (this - that) / 36e5; + break; // 1000 * 60 * 60 + case 'day': + output = (this - that - zoneDelta) / 864e5; + break; // 1000 * 60 * 60 * 24, negate dst + case 'week': + output = (this - that - zoneDelta) / 6048e5; + break; // 1000 * 60 * 60 * 24 * 7, negate dst + default: + output = this - that; + } + + return asFloat ? output : absFloor(output); + } + + function monthDiff(a, b) { + if (a.date() < b.date()) { + // end-of-month calculations work correct when the start month has more + // days than the end month. + return -monthDiff(b, a); + } + // difference in months + var wholeMonthDiff = (b.year() - a.year()) * 12 + (b.month() - a.month()), + // b is in (anchor - 1 month, anchor + 1 month) + anchor = a.clone().add(wholeMonthDiff, 'months'), + anchor2, + adjust; + + if (b - anchor < 0) { + anchor2 = a.clone().add(wholeMonthDiff - 1, 'months'); + // linear across the month + adjust = (b - anchor) / (anchor - anchor2); + } else { + anchor2 = a.clone().add(wholeMonthDiff + 1, 'months'); + // linear across the month + adjust = (b - anchor) / (anchor2 - anchor); + } + + //check for negative zero, return zero if negative zero + return -(wholeMonthDiff + adjust) || 0; + } + + hooks.defaultFormat = 'YYYY-MM-DDTHH:mm:ssZ'; + hooks.defaultFormatUtc = 'YYYY-MM-DDTHH:mm:ss[Z]'; + + function toString() { + return this.clone().locale('en').format('ddd MMM DD YYYY HH:mm:ss [GMT]ZZ'); + } + + function toISOString(keepOffset) { + if (!this.isValid()) { + return null; + } + var utc = keepOffset !== true, + m = utc ? this.clone().utc() : this; + if (m.year() < 0 || m.year() > 9999) { + return formatMoment( + m, + utc + ? 'YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]' + : 'YYYYYY-MM-DD[T]HH:mm:ss.SSSZ' + ); + } + if (isFunction(Date.prototype.toISOString)) { + // native implementation is ~50x faster, use it when we can + if (utc) { + return this.toDate().toISOString(); + } else { + return new Date(this.valueOf() + this.utcOffset() * 60 * 1000) + .toISOString() + .replace('Z', formatMoment(m, 'Z')); + } + } + return formatMoment( + m, + utc ? 'YYYY-MM-DD[T]HH:mm:ss.SSS[Z]' : 'YYYY-MM-DD[T]HH:mm:ss.SSSZ' + ); + } + + /** + * Return a human readable representation of a moment that can + * also be evaluated to get a new moment which is the same + * + * @link https://nodejs.org/dist/latest/docs/api/util.html#util_custom_inspect_function_on_objects + */ + function inspect() { + if (!this.isValid()) { + return 'moment.invalid(/* ' + this._i + ' */)'; + } + var func = 'moment', + zone = '', + prefix, + year, + datetime, + suffix; + if (!this.isLocal()) { + func = this.utcOffset() === 0 ? 'moment.utc' : 'moment.parseZone'; + zone = 'Z'; + } + prefix = '[' + func + '("]'; + year = 0 <= this.year() && this.year() <= 9999 ? 'YYYY' : 'YYYYYY'; + datetime = '-MM-DD[T]HH:mm:ss.SSS'; + suffix = zone + '[")]'; + + return this.format(prefix + year + datetime + suffix); + } + + function format(inputString) { + if (!inputString) { + inputString = this.isUtc() + ? hooks.defaultFormatUtc + : hooks.defaultFormat; + } + var output = formatMoment(this, inputString); + return this.localeData().postformat(output); + } + + function from(time, withoutSuffix) { + if ( + this.isValid() && + ((isMoment(time) && time.isValid()) || createLocal(time).isValid()) + ) { + return createDuration({ to: this, from: time }) + .locale(this.locale()) + .humanize(!withoutSuffix); + } else { + return this.localeData().invalidDate(); + } + } + + function fromNow(withoutSuffix) { + return this.from(createLocal(), withoutSuffix); + } + + function to(time, withoutSuffix) { + if ( + this.isValid() && + ((isMoment(time) && time.isValid()) || createLocal(time).isValid()) + ) { + return createDuration({ from: this, to: time }) + .locale(this.locale()) + .humanize(!withoutSuffix); + } else { + return this.localeData().invalidDate(); + } + } + + function toNow(withoutSuffix) { + return this.to(createLocal(), withoutSuffix); + } + + // If passed a locale key, it will set the locale for this + // instance. Otherwise, it will return the locale configuration + // variables for this instance. + function locale(key) { + var newLocaleData; + + if (key === undefined) { + return this._locale._abbr; + } else { + newLocaleData = getLocale(key); + if (newLocaleData != null) { + this._locale = newLocaleData; + } + return this; + } + } + + var lang = deprecate( + 'moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.', + function (key) { + if (key === undefined) { + return this.localeData(); + } else { + return this.locale(key); + } + } + ); + + function localeData() { + return this._locale; + } + + var MS_PER_SECOND = 1000, + MS_PER_MINUTE = 60 * MS_PER_SECOND, + MS_PER_HOUR = 60 * MS_PER_MINUTE, + MS_PER_400_YEARS = (365 * 400 + 97) * 24 * MS_PER_HOUR; + + // actual modulo - handles negative numbers (for dates before 1970): + function mod$1(dividend, divisor) { + return ((dividend % divisor) + divisor) % divisor; + } + + function localStartOfDate(y, m, d) { + // the date constructor remaps years 0-99 to 1900-1999 + if (y < 100 && y >= 0) { + // preserve leap years using a full 400 year cycle, then reset + return new Date(y + 400, m, d) - MS_PER_400_YEARS; + } else { + return new Date(y, m, d).valueOf(); + } + } + + function utcStartOfDate(y, m, d) { + // Date.UTC remaps years 0-99 to 1900-1999 + if (y < 100 && y >= 0) { + // preserve leap years using a full 400 year cycle, then reset + return Date.UTC(y + 400, m, d) - MS_PER_400_YEARS; + } else { + return Date.UTC(y, m, d); + } + } + + function startOf(units) { + var time, startOfDate; + units = normalizeUnits(units); + if (units === undefined || units === 'millisecond' || !this.isValid()) { + return this; + } + + startOfDate = this._isUTC ? utcStartOfDate : localStartOfDate; + + switch (units) { + case 'year': + time = startOfDate(this.year(), 0, 1); + break; + case 'quarter': + time = startOfDate( + this.year(), + this.month() - (this.month() % 3), + 1 + ); + break; + case 'month': + time = startOfDate(this.year(), this.month(), 1); + break; + case 'week': + time = startOfDate( + this.year(), + this.month(), + this.date() - this.weekday() + ); + break; + case 'isoWeek': + time = startOfDate( + this.year(), + this.month(), + this.date() - (this.isoWeekday() - 1) + ); + break; + case 'day': + case 'date': + time = startOfDate(this.year(), this.month(), this.date()); + break; + case 'hour': + time = this._d.valueOf(); + time -= mod$1( + time + (this._isUTC ? 0 : this.utcOffset() * MS_PER_MINUTE), + MS_PER_HOUR + ); + break; + case 'minute': + time = this._d.valueOf(); + time -= mod$1(time, MS_PER_MINUTE); + break; + case 'second': + time = this._d.valueOf(); + time -= mod$1(time, MS_PER_SECOND); + break; + } + + this._d.setTime(time); + hooks.updateOffset(this, true); + return this; + } + + function endOf(units) { + var time, startOfDate; + units = normalizeUnits(units); + if (units === undefined || units === 'millisecond' || !this.isValid()) { + return this; + } + + startOfDate = this._isUTC ? utcStartOfDate : localStartOfDate; + + switch (units) { + case 'year': + time = startOfDate(this.year() + 1, 0, 1) - 1; + break; + case 'quarter': + time = + startOfDate( + this.year(), + this.month() - (this.month() % 3) + 3, + 1 + ) - 1; + break; + case 'month': + time = startOfDate(this.year(), this.month() + 1, 1) - 1; + break; + case 'week': + time = + startOfDate( + this.year(), + this.month(), + this.date() - this.weekday() + 7 + ) - 1; + break; + case 'isoWeek': + time = + startOfDate( + this.year(), + this.month(), + this.date() - (this.isoWeekday() - 1) + 7 + ) - 1; + break; + case 'day': + case 'date': + time = startOfDate(this.year(), this.month(), this.date() + 1) - 1; + break; + case 'hour': + time = this._d.valueOf(); + time += + MS_PER_HOUR - + mod$1( + time + (this._isUTC ? 0 : this.utcOffset() * MS_PER_MINUTE), + MS_PER_HOUR + ) - + 1; + break; + case 'minute': + time = this._d.valueOf(); + time += MS_PER_MINUTE - mod$1(time, MS_PER_MINUTE) - 1; + break; + case 'second': + time = this._d.valueOf(); + time += MS_PER_SECOND - mod$1(time, MS_PER_SECOND) - 1; + break; + } + + this._d.setTime(time); + hooks.updateOffset(this, true); + return this; + } + + function valueOf() { + return this._d.valueOf() - (this._offset || 0) * 60000; + } + + function unix() { + return Math.floor(this.valueOf() / 1000); + } + + function toDate() { + return new Date(this.valueOf()); + } + + function toArray() { + var m = this; + return [ + m.year(), + m.month(), + m.date(), + m.hour(), + m.minute(), + m.second(), + m.millisecond(), + ]; + } + + function toObject() { + var m = this; + return { + years: m.year(), + months: m.month(), + date: m.date(), + hours: m.hours(), + minutes: m.minutes(), + seconds: m.seconds(), + milliseconds: m.milliseconds(), + }; + } + + function toJSON() { + // new Date(NaN).toJSON() === null + return this.isValid() ? this.toISOString() : null; + } + + function isValid$2() { + return isValid(this); + } + + function parsingFlags() { + return extend({}, getParsingFlags(this)); + } + + function invalidAt() { + return getParsingFlags(this).overflow; + } + + function creationData() { + return { + input: this._i, + format: this._f, + locale: this._locale, + isUTC: this._isUTC, + strict: this._strict, + }; + } + + addFormatToken('N', 0, 0, 'eraAbbr'); + addFormatToken('NN', 0, 0, 'eraAbbr'); + addFormatToken('NNN', 0, 0, 'eraAbbr'); + addFormatToken('NNNN', 0, 0, 'eraName'); + addFormatToken('NNNNN', 0, 0, 'eraNarrow'); + + addFormatToken('y', ['y', 1], 'yo', 'eraYear'); + addFormatToken('y', ['yy', 2], 0, 'eraYear'); + addFormatToken('y', ['yyy', 3], 0, 'eraYear'); + addFormatToken('y', ['yyyy', 4], 0, 'eraYear'); + + addRegexToken('N', matchEraAbbr); + addRegexToken('NN', matchEraAbbr); + addRegexToken('NNN', matchEraAbbr); + addRegexToken('NNNN', matchEraName); + addRegexToken('NNNNN', matchEraNarrow); + + addParseToken(['N', 'NN', 'NNN', 'NNNN', 'NNNNN'], function ( + input, + array, + config, + token + ) { + var era = config._locale.erasParse(input, token, config._strict); + if (era) { + getParsingFlags(config).era = era; + } else { + getParsingFlags(config).invalidEra = input; + } + }); + + addRegexToken('y', matchUnsigned); + addRegexToken('yy', matchUnsigned); + addRegexToken('yyy', matchUnsigned); + addRegexToken('yyyy', matchUnsigned); + addRegexToken('yo', matchEraYearOrdinal); + + addParseToken(['y', 'yy', 'yyy', 'yyyy'], YEAR); + addParseToken(['yo'], function (input, array, config, token) { + var match; + if (config._locale._eraYearOrdinalRegex) { + match = input.match(config._locale._eraYearOrdinalRegex); + } + + if (config._locale.eraYearOrdinalParse) { + array[YEAR] = config._locale.eraYearOrdinalParse(input, match); + } else { + array[YEAR] = parseInt(input, 10); + } + }); + + function localeEras(m, format) { + var i, + l, + date, + eras = this._eras || getLocale('en')._eras; + for (i = 0, l = eras.length; i < l; ++i) { + switch (typeof eras[i].since) { + case 'string': + // truncate time + date = hooks(eras[i].since).startOf('day'); + eras[i].since = date.valueOf(); + break; + } + + switch (typeof eras[i].until) { + case 'undefined': + eras[i].until = +Infinity; + break; + case 'string': + // truncate time + date = hooks(eras[i].until).startOf('day').valueOf(); + eras[i].until = date.valueOf(); + break; + } + } + return eras; + } + + function localeErasParse(eraName, format, strict) { + var i, + l, + eras = this.eras(), + name, + abbr, + narrow; + eraName = eraName.toUpperCase(); + + for (i = 0, l = eras.length; i < l; ++i) { + name = eras[i].name.toUpperCase(); + abbr = eras[i].abbr.toUpperCase(); + narrow = eras[i].narrow.toUpperCase(); + + if (strict) { + switch (format) { + case 'N': + case 'NN': + case 'NNN': + if (abbr === eraName) { + return eras[i]; + } + break; + + case 'NNNN': + if (name === eraName) { + return eras[i]; + } + break; + + case 'NNNNN': + if (narrow === eraName) { + return eras[i]; + } + break; + } + } else if ([name, abbr, narrow].indexOf(eraName) >= 0) { + return eras[i]; + } + } + } + + function localeErasConvertYear(era, year) { + var dir = era.since <= era.until ? +1 : -1; + if (year === undefined) { + return hooks(era.since).year(); + } else { + return hooks(era.since).year() + (year - era.offset) * dir; + } + } + + function getEraName() { + var i, + l, + val, + eras = this.localeData().eras(); + for (i = 0, l = eras.length; i < l; ++i) { + // truncate time + val = this.startOf('day').valueOf(); + + if (eras[i].since <= val && val <= eras[i].until) { + return eras[i].name; + } + if (eras[i].until <= val && val <= eras[i].since) { + return eras[i].name; + } + } + + return ''; + } + + function getEraNarrow() { + var i, + l, + val, + eras = this.localeData().eras(); + for (i = 0, l = eras.length; i < l; ++i) { + // truncate time + val = this.startOf('day').valueOf(); + + if (eras[i].since <= val && val <= eras[i].until) { + return eras[i].narrow; + } + if (eras[i].until <= val && val <= eras[i].since) { + return eras[i].narrow; + } + } + + return ''; + } + + function getEraAbbr() { + var i, + l, + val, + eras = this.localeData().eras(); + for (i = 0, l = eras.length; i < l; ++i) { + // truncate time + val = this.startOf('day').valueOf(); + + if (eras[i].since <= val && val <= eras[i].until) { + return eras[i].abbr; + } + if (eras[i].until <= val && val <= eras[i].since) { + return eras[i].abbr; + } + } + + return ''; + } + + function getEraYear() { + var i, + l, + dir, + val, + eras = this.localeData().eras(); + for (i = 0, l = eras.length; i < l; ++i) { + dir = eras[i].since <= eras[i].until ? +1 : -1; + + // truncate time + val = this.startOf('day').valueOf(); + + if ( + (eras[i].since <= val && val <= eras[i].until) || + (eras[i].until <= val && val <= eras[i].since) + ) { + return ( + (this.year() - hooks(eras[i].since).year()) * dir + + eras[i].offset + ); + } + } + + return this.year(); + } + + function erasNameRegex(isStrict) { + if (!hasOwnProp(this, '_erasNameRegex')) { + computeErasParse.call(this); + } + return isStrict ? this._erasNameRegex : this._erasRegex; + } + + function erasAbbrRegex(isStrict) { + if (!hasOwnProp(this, '_erasAbbrRegex')) { + computeErasParse.call(this); + } + return isStrict ? this._erasAbbrRegex : this._erasRegex; + } + + function erasNarrowRegex(isStrict) { + if (!hasOwnProp(this, '_erasNarrowRegex')) { + computeErasParse.call(this); + } + return isStrict ? this._erasNarrowRegex : this._erasRegex; + } + + function matchEraAbbr(isStrict, locale) { + return locale.erasAbbrRegex(isStrict); + } + + function matchEraName(isStrict, locale) { + return locale.erasNameRegex(isStrict); + } + + function matchEraNarrow(isStrict, locale) { + return locale.erasNarrowRegex(isStrict); + } + + function matchEraYearOrdinal(isStrict, locale) { + return locale._eraYearOrdinalRegex || matchUnsigned; + } + + function computeErasParse() { + var abbrPieces = [], + namePieces = [], + narrowPieces = [], + mixedPieces = [], + i, + l, + eras = this.eras(); + + for (i = 0, l = eras.length; i < l; ++i) { + namePieces.push(regexEscape(eras[i].name)); + abbrPieces.push(regexEscape(eras[i].abbr)); + narrowPieces.push(regexEscape(eras[i].narrow)); + + mixedPieces.push(regexEscape(eras[i].name)); + mixedPieces.push(regexEscape(eras[i].abbr)); + mixedPieces.push(regexEscape(eras[i].narrow)); + } + + this._erasRegex = new RegExp('^(' + mixedPieces.join('|') + ')', 'i'); + this._erasNameRegex = new RegExp('^(' + namePieces.join('|') + ')', 'i'); + this._erasAbbrRegex = new RegExp('^(' + abbrPieces.join('|') + ')', 'i'); + this._erasNarrowRegex = new RegExp( + '^(' + narrowPieces.join('|') + ')', + 'i' + ); + } + + // FORMATTING + + addFormatToken(0, ['gg', 2], 0, function () { + return this.weekYear() % 100; + }); + + addFormatToken(0, ['GG', 2], 0, function () { + return this.isoWeekYear() % 100; + }); + + function addWeekYearFormatToken(token, getter) { + addFormatToken(0, [token, token.length], 0, getter); + } + + addWeekYearFormatToken('gggg', 'weekYear'); + addWeekYearFormatToken('ggggg', 'weekYear'); + addWeekYearFormatToken('GGGG', 'isoWeekYear'); + addWeekYearFormatToken('GGGGG', 'isoWeekYear'); + + // ALIASES + + addUnitAlias('weekYear', 'gg'); + addUnitAlias('isoWeekYear', 'GG'); + + // PRIORITY + + addUnitPriority('weekYear', 1); + addUnitPriority('isoWeekYear', 1); + + // PARSING + + addRegexToken('G', matchSigned); + addRegexToken('g', matchSigned); + addRegexToken('GG', match1to2, match2); + addRegexToken('gg', match1to2, match2); + addRegexToken('GGGG', match1to4, match4); + addRegexToken('gggg', match1to4, match4); + addRegexToken('GGGGG', match1to6, match6); + addRegexToken('ggggg', match1to6, match6); + + addWeekParseToken(['gggg', 'ggggg', 'GGGG', 'GGGGG'], function ( + input, + week, + config, + token + ) { + week[token.substr(0, 2)] = toInt(input); + }); + + addWeekParseToken(['gg', 'GG'], function (input, week, config, token) { + week[token] = hooks.parseTwoDigitYear(input); + }); + + // MOMENTS + + function getSetWeekYear(input) { + return getSetWeekYearHelper.call( + this, + input, + this.week(), + this.weekday(), + this.localeData()._week.dow, + this.localeData()._week.doy + ); + } + + function getSetISOWeekYear(input) { + return getSetWeekYearHelper.call( + this, + input, + this.isoWeek(), + this.isoWeekday(), + 1, + 4 + ); + } + + function getISOWeeksInYear() { + return weeksInYear(this.year(), 1, 4); + } + + function getISOWeeksInISOWeekYear() { + return weeksInYear(this.isoWeekYear(), 1, 4); + } + + function getWeeksInYear() { + var weekInfo = this.localeData()._week; + return weeksInYear(this.year(), weekInfo.dow, weekInfo.doy); + } + + function getWeeksInWeekYear() { + var weekInfo = this.localeData()._week; + return weeksInYear(this.weekYear(), weekInfo.dow, weekInfo.doy); + } + + function getSetWeekYearHelper(input, week, weekday, dow, doy) { + var weeksTarget; + if (input == null) { + return weekOfYear(this, dow, doy).year; + } else { + weeksTarget = weeksInYear(input, dow, doy); + if (week > weeksTarget) { + week = weeksTarget; + } + return setWeekAll.call(this, input, week, weekday, dow, doy); + } + } + + function setWeekAll(weekYear, week, weekday, dow, doy) { + var dayOfYearData = dayOfYearFromWeeks(weekYear, week, weekday, dow, doy), + date = createUTCDate(dayOfYearData.year, 0, dayOfYearData.dayOfYear); + + this.year(date.getUTCFullYear()); + this.month(date.getUTCMonth()); + this.date(date.getUTCDate()); + return this; + } + + // FORMATTING + + addFormatToken('Q', 0, 'Qo', 'quarter'); + + // ALIASES + + addUnitAlias('quarter', 'Q'); + + // PRIORITY + + addUnitPriority('quarter', 7); + + // PARSING + + addRegexToken('Q', match1); + addParseToken('Q', function (input, array) { + array[MONTH] = (toInt(input) - 1) * 3; + }); + + // MOMENTS + + function getSetQuarter(input) { + return input == null + ? Math.ceil((this.month() + 1) / 3) + : this.month((input - 1) * 3 + (this.month() % 3)); + } + + // FORMATTING + + addFormatToken('D', ['DD', 2], 'Do', 'date'); + + // ALIASES + + addUnitAlias('date', 'D'); + + // PRIORITY + addUnitPriority('date', 9); + + // PARSING + + addRegexToken('D', match1to2); + addRegexToken('DD', match1to2, match2); + addRegexToken('Do', function (isStrict, locale) { + // TODO: Remove "ordinalParse" fallback in next major release. + return isStrict + ? locale._dayOfMonthOrdinalParse || locale._ordinalParse + : locale._dayOfMonthOrdinalParseLenient; + }); + + addParseToken(['D', 'DD'], DATE); + addParseToken('Do', function (input, array) { + array[DATE] = toInt(input.match(match1to2)[0]); + }); + + // MOMENTS + + var getSetDayOfMonth = makeGetSet('Date', true); + + // FORMATTING + + addFormatToken('DDD', ['DDDD', 3], 'DDDo', 'dayOfYear'); + + // ALIASES + + addUnitAlias('dayOfYear', 'DDD'); + + // PRIORITY + addUnitPriority('dayOfYear', 4); + + // PARSING + + addRegexToken('DDD', match1to3); + addRegexToken('DDDD', match3); + addParseToken(['DDD', 'DDDD'], function (input, array, config) { + config._dayOfYear = toInt(input); + }); + + // HELPERS + + // MOMENTS + + function getSetDayOfYear(input) { + var dayOfYear = + Math.round( + (this.clone().startOf('day') - this.clone().startOf('year')) / 864e5 + ) + 1; + return input == null ? dayOfYear : this.add(input - dayOfYear, 'd'); + } + + // FORMATTING + + addFormatToken('m', ['mm', 2], 0, 'minute'); + + // ALIASES + + addUnitAlias('minute', 'm'); + + // PRIORITY + + addUnitPriority('minute', 14); + + // PARSING + + addRegexToken('m', match1to2); + addRegexToken('mm', match1to2, match2); + addParseToken(['m', 'mm'], MINUTE); + + // MOMENTS + + var getSetMinute = makeGetSet('Minutes', false); + + // FORMATTING + + addFormatToken('s', ['ss', 2], 0, 'second'); + + // ALIASES + + addUnitAlias('second', 's'); + + // PRIORITY + + addUnitPriority('second', 15); + + // PARSING + + addRegexToken('s', match1to2); + addRegexToken('ss', match1to2, match2); + addParseToken(['s', 'ss'], SECOND); + + // MOMENTS + + var getSetSecond = makeGetSet('Seconds', false); + + // FORMATTING + + addFormatToken('S', 0, 0, function () { + return ~~(this.millisecond() / 100); + }); + + addFormatToken(0, ['SS', 2], 0, function () { + return ~~(this.millisecond() / 10); + }); + + addFormatToken(0, ['SSS', 3], 0, 'millisecond'); + addFormatToken(0, ['SSSS', 4], 0, function () { + return this.millisecond() * 10; + }); + addFormatToken(0, ['SSSSS', 5], 0, function () { + return this.millisecond() * 100; + }); + addFormatToken(0, ['SSSSSS', 6], 0, function () { + return this.millisecond() * 1000; + }); + addFormatToken(0, ['SSSSSSS', 7], 0, function () { + return this.millisecond() * 10000; + }); + addFormatToken(0, ['SSSSSSSS', 8], 0, function () { + return this.millisecond() * 100000; + }); + addFormatToken(0, ['SSSSSSSSS', 9], 0, function () { + return this.millisecond() * 1000000; + }); + + // ALIASES + + addUnitAlias('millisecond', 'ms'); + + // PRIORITY + + addUnitPriority('millisecond', 16); + + // PARSING + + addRegexToken('S', match1to3, match1); + addRegexToken('SS', match1to3, match2); + addRegexToken('SSS', match1to3, match3); + + var token, getSetMillisecond; + for (token = 'SSSS'; token.length <= 9; token += 'S') { + addRegexToken(token, matchUnsigned); + } + + function parseMs(input, array) { + array[MILLISECOND] = toInt(('0.' + input) * 1000); + } + + for (token = 'S'; token.length <= 9; token += 'S') { + addParseToken(token, parseMs); + } + + getSetMillisecond = makeGetSet('Milliseconds', false); + + // FORMATTING + + addFormatToken('z', 0, 0, 'zoneAbbr'); + addFormatToken('zz', 0, 0, 'zoneName'); + + // MOMENTS + + function getZoneAbbr() { + return this._isUTC ? 'UTC' : ''; + } + + function getZoneName() { + return this._isUTC ? 'Coordinated Universal Time' : ''; + } + + var proto = Moment.prototype; + + proto.add = add; + proto.calendar = calendar$1; + proto.clone = clone; + proto.diff = diff; + proto.endOf = endOf; + proto.format = format; + proto.from = from; + proto.fromNow = fromNow; + proto.to = to; + proto.toNow = toNow; + proto.get = stringGet; + proto.invalidAt = invalidAt; + proto.isAfter = isAfter; + proto.isBefore = isBefore; + proto.isBetween = isBetween; + proto.isSame = isSame; + proto.isSameOrAfter = isSameOrAfter; + proto.isSameOrBefore = isSameOrBefore; + proto.isValid = isValid$2; + proto.lang = lang; + proto.locale = locale; + proto.localeData = localeData; + proto.max = prototypeMax; + proto.min = prototypeMin; + proto.parsingFlags = parsingFlags; + proto.set = stringSet; + proto.startOf = startOf; + proto.subtract = subtract; + proto.toArray = toArray; + proto.toObject = toObject; + proto.toDate = toDate; + proto.toISOString = toISOString; + proto.inspect = inspect; + if (typeof Symbol !== 'undefined' && Symbol.for != null) { + proto[Symbol.for('nodejs.util.inspect.custom')] = function () { + return 'Moment<' + this.format() + '>'; + }; + } + proto.toJSON = toJSON; + proto.toString = toString; + proto.unix = unix; + proto.valueOf = valueOf; + proto.creationData = creationData; + proto.eraName = getEraName; + proto.eraNarrow = getEraNarrow; + proto.eraAbbr = getEraAbbr; + proto.eraYear = getEraYear; + proto.year = getSetYear; + proto.isLeapYear = getIsLeapYear; + proto.weekYear = getSetWeekYear; + proto.isoWeekYear = getSetISOWeekYear; + proto.quarter = proto.quarters = getSetQuarter; + proto.month = getSetMonth; + proto.daysInMonth = getDaysInMonth; + proto.week = proto.weeks = getSetWeek; + proto.isoWeek = proto.isoWeeks = getSetISOWeek; + proto.weeksInYear = getWeeksInYear; + proto.weeksInWeekYear = getWeeksInWeekYear; + proto.isoWeeksInYear = getISOWeeksInYear; + proto.isoWeeksInISOWeekYear = getISOWeeksInISOWeekYear; + proto.date = getSetDayOfMonth; + proto.day = proto.days = getSetDayOfWeek; + proto.weekday = getSetLocaleDayOfWeek; + proto.isoWeekday = getSetISODayOfWeek; + proto.dayOfYear = getSetDayOfYear; + proto.hour = proto.hours = getSetHour; + proto.minute = proto.minutes = getSetMinute; + proto.second = proto.seconds = getSetSecond; + proto.millisecond = proto.milliseconds = getSetMillisecond; + proto.utcOffset = getSetOffset; + proto.utc = setOffsetToUTC; + proto.local = setOffsetToLocal; + proto.parseZone = setOffsetToParsedOffset; + proto.hasAlignedHourOffset = hasAlignedHourOffset; + proto.isDST = isDaylightSavingTime; + proto.isLocal = isLocal; + proto.isUtcOffset = isUtcOffset; + proto.isUtc = isUtc; + proto.isUTC = isUtc; + proto.zoneAbbr = getZoneAbbr; + proto.zoneName = getZoneName; + proto.dates = deprecate( + 'dates accessor is deprecated. Use date instead.', + getSetDayOfMonth + ); + proto.months = deprecate( + 'months accessor is deprecated. Use month instead', + getSetMonth + ); + proto.years = deprecate( + 'years accessor is deprecated. Use year instead', + getSetYear + ); + proto.zone = deprecate( + 'moment().zone is deprecated, use moment().utcOffset instead. http://momentjs.com/guides/#/warnings/zone/', + getSetZone + ); + proto.isDSTShifted = deprecate( + 'isDSTShifted is deprecated. See http://momentjs.com/guides/#/warnings/dst-shifted/ for more information', + isDaylightSavingTimeShifted + ); + + function createUnix(input) { + return createLocal(input * 1000); + } + + function createInZone() { + return createLocal.apply(null, arguments).parseZone(); + } + + function preParsePostFormat(string) { + return string; + } + + var proto$1 = Locale.prototype; + + proto$1.calendar = calendar; + proto$1.longDateFormat = longDateFormat; + proto$1.invalidDate = invalidDate; + proto$1.ordinal = ordinal; + proto$1.preparse = preParsePostFormat; + proto$1.postformat = preParsePostFormat; + proto$1.relativeTime = relativeTime; + proto$1.pastFuture = pastFuture; + proto$1.set = set; + proto$1.eras = localeEras; + proto$1.erasParse = localeErasParse; + proto$1.erasConvertYear = localeErasConvertYear; + proto$1.erasAbbrRegex = erasAbbrRegex; + proto$1.erasNameRegex = erasNameRegex; + proto$1.erasNarrowRegex = erasNarrowRegex; + + proto$1.months = localeMonths; + proto$1.monthsShort = localeMonthsShort; + proto$1.monthsParse = localeMonthsParse; + proto$1.monthsRegex = monthsRegex; + proto$1.monthsShortRegex = monthsShortRegex; + proto$1.week = localeWeek; + proto$1.firstDayOfYear = localeFirstDayOfYear; + proto$1.firstDayOfWeek = localeFirstDayOfWeek; + + proto$1.weekdays = localeWeekdays; + proto$1.weekdaysMin = localeWeekdaysMin; + proto$1.weekdaysShort = localeWeekdaysShort; + proto$1.weekdaysParse = localeWeekdaysParse; + + proto$1.weekdaysRegex = weekdaysRegex; + proto$1.weekdaysShortRegex = weekdaysShortRegex; + proto$1.weekdaysMinRegex = weekdaysMinRegex; + + proto$1.isPM = localeIsPM; + proto$1.meridiem = localeMeridiem; + + function get$1(format, index, field, setter) { + var locale = getLocale(), + utc = createUTC().set(setter, index); + return locale[field](utc, format); + } + + function listMonthsImpl(format, index, field) { + if (isNumber(format)) { + index = format; + format = undefined; + } + + format = format || ''; + + if (index != null) { + return get$1(format, index, field, 'month'); + } + + var i, + out = []; + for (i = 0; i < 12; i++) { + out[i] = get$1(format, i, field, 'month'); + } + return out; + } + + // () + // (5) + // (fmt, 5) + // (fmt) + // (true) + // (true, 5) + // (true, fmt, 5) + // (true, fmt) + function listWeekdaysImpl(localeSorted, format, index, field) { + if (typeof localeSorted === 'boolean') { + if (isNumber(format)) { + index = format; + format = undefined; + } + + format = format || ''; + } else { + format = localeSorted; + index = format; + localeSorted = false; + + if (isNumber(format)) { + index = format; + format = undefined; + } + + format = format || ''; + } + + var locale = getLocale(), + shift = localeSorted ? locale._week.dow : 0, + i, + out = []; + + if (index != null) { + return get$1(format, (index + shift) % 7, field, 'day'); + } + + for (i = 0; i < 7; i++) { + out[i] = get$1(format, (i + shift) % 7, field, 'day'); + } + return out; + } + + function listMonths(format, index) { + return listMonthsImpl(format, index, 'months'); + } + + function listMonthsShort(format, index) { + return listMonthsImpl(format, index, 'monthsShort'); + } + + function listWeekdays(localeSorted, format, index) { + return listWeekdaysImpl(localeSorted, format, index, 'weekdays'); + } + + function listWeekdaysShort(localeSorted, format, index) { + return listWeekdaysImpl(localeSorted, format, index, 'weekdaysShort'); + } + + function listWeekdaysMin(localeSorted, format, index) { + return listWeekdaysImpl(localeSorted, format, index, 'weekdaysMin'); + } + + getSetGlobalLocale('en', { + eras: [ + { + since: '0001-01-01', + until: +Infinity, + offset: 1, + name: 'Anno Domini', + narrow: 'AD', + abbr: 'AD', + }, + { + since: '0000-12-31', + until: -Infinity, + offset: 1, + name: 'Before Christ', + narrow: 'BC', + abbr: 'BC', + }, + ], + dayOfMonthOrdinalParse: /\d{1,2}(th|st|nd|rd)/, + ordinal: function (number) { + var b = number % 10, + output = + toInt((number % 100) / 10) === 1 + ? 'th' + : b === 1 + ? 'st' + : b === 2 + ? 'nd' + : b === 3 + ? 'rd' + : 'th'; + return number + output; + }, + }); + + // Side effect imports + + hooks.lang = deprecate( + 'moment.lang is deprecated. Use moment.locale instead.', + getSetGlobalLocale + ); + hooks.langData = deprecate( + 'moment.langData is deprecated. Use moment.localeData instead.', + getLocale + ); + + var mathAbs = Math.abs; + + function abs() { + var data = this._data; + + this._milliseconds = mathAbs(this._milliseconds); + this._days = mathAbs(this._days); + this._months = mathAbs(this._months); + + data.milliseconds = mathAbs(data.milliseconds); + data.seconds = mathAbs(data.seconds); + data.minutes = mathAbs(data.minutes); + data.hours = mathAbs(data.hours); + data.months = mathAbs(data.months); + data.years = mathAbs(data.years); + + return this; + } + + function addSubtract$1(duration, input, value, direction) { + var other = createDuration(input, value); + + duration._milliseconds += direction * other._milliseconds; + duration._days += direction * other._days; + duration._months += direction * other._months; + + return duration._bubble(); + } + + // supports only 2.0-style add(1, 's') or add(duration) + function add$1(input, value) { + return addSubtract$1(this, input, value, 1); + } + + // supports only 2.0-style subtract(1, 's') or subtract(duration) + function subtract$1(input, value) { + return addSubtract$1(this, input, value, -1); + } + + function absCeil(number) { + if (number < 0) { + return Math.floor(number); + } else { + return Math.ceil(number); + } + } + + function bubble() { + var milliseconds = this._milliseconds, + days = this._days, + months = this._months, + data = this._data, + seconds, + minutes, + hours, + years, + monthsFromDays; + + // if we have a mix of positive and negative values, bubble down first + // check: https://github.com/moment/moment/issues/2166 + if ( + !( + (milliseconds >= 0 && days >= 0 && months >= 0) || + (milliseconds <= 0 && days <= 0 && months <= 0) + ) + ) { + milliseconds += absCeil(monthsToDays(months) + days) * 864e5; + days = 0; + months = 0; + } + + // The following code bubbles up values, see the tests for + // examples of what that means. + data.milliseconds = milliseconds % 1000; + + seconds = absFloor(milliseconds / 1000); + data.seconds = seconds % 60; + + minutes = absFloor(seconds / 60); + data.minutes = minutes % 60; + + hours = absFloor(minutes / 60); + data.hours = hours % 24; + + days += absFloor(hours / 24); + + // convert days to months + monthsFromDays = absFloor(daysToMonths(days)); + months += monthsFromDays; + days -= absCeil(monthsToDays(monthsFromDays)); + + // 12 months -> 1 year + years = absFloor(months / 12); + months %= 12; + + data.days = days; + data.months = months; + data.years = years; + + return this; + } + + function daysToMonths(days) { + // 400 years have 146097 days (taking into account leap year rules) + // 400 years have 12 months === 4800 + return (days * 4800) / 146097; + } + + function monthsToDays(months) { + // the reverse of daysToMonths + return (months * 146097) / 4800; + } + + function as(units) { + if (!this.isValid()) { + return NaN; + } + var days, + months, + milliseconds = this._milliseconds; + + units = normalizeUnits(units); + + if (units === 'month' || units === 'quarter' || units === 'year') { + days = this._days + milliseconds / 864e5; + months = this._months + daysToMonths(days); + switch (units) { + case 'month': + return months; + case 'quarter': + return months / 3; + case 'year': + return months / 12; + } + } else { + // handle milliseconds separately because of floating point math errors (issue #1867) + days = this._days + Math.round(monthsToDays(this._months)); + switch (units) { + case 'week': + return days / 7 + milliseconds / 6048e5; + case 'day': + return days + milliseconds / 864e5; + case 'hour': + return days * 24 + milliseconds / 36e5; + case 'minute': + return days * 1440 + milliseconds / 6e4; + case 'second': + return days * 86400 + milliseconds / 1000; + // Math.floor prevents floating point math errors here + case 'millisecond': + return Math.floor(days * 864e5) + milliseconds; + default: + throw new Error('Unknown unit ' + units); + } + } + } + + // TODO: Use this.as('ms')? + function valueOf$1() { + if (!this.isValid()) { + return NaN; + } + return ( + this._milliseconds + + this._days * 864e5 + + (this._months % 12) * 2592e6 + + toInt(this._months / 12) * 31536e6 + ); + } + + function makeAs(alias) { + return function () { + return this.as(alias); + }; + } + + var asMilliseconds = makeAs('ms'), + asSeconds = makeAs('s'), + asMinutes = makeAs('m'), + asHours = makeAs('h'), + asDays = makeAs('d'), + asWeeks = makeAs('w'), + asMonths = makeAs('M'), + asQuarters = makeAs('Q'), + asYears = makeAs('y'); + + function clone$1() { + return createDuration(this); + } + + function get$2(units) { + units = normalizeUnits(units); + return this.isValid() ? this[units + 's']() : NaN; + } + + function makeGetter(name) { + return function () { + return this.isValid() ? this._data[name] : NaN; + }; + } + + var milliseconds = makeGetter('milliseconds'), + seconds = makeGetter('seconds'), + minutes = makeGetter('minutes'), + hours = makeGetter('hours'), + days = makeGetter('days'), + months = makeGetter('months'), + years = makeGetter('years'); + + function weeks() { + return absFloor(this.days() / 7); + } + + var round = Math.round, + thresholds = { + ss: 44, // a few seconds to seconds + s: 45, // seconds to minute + m: 45, // minutes to hour + h: 22, // hours to day + d: 26, // days to month/week + w: null, // weeks to month + M: 11, // months to year + }; + + // helper function for moment.fn.from, moment.fn.fromNow, and moment.duration.fn.humanize + function substituteTimeAgo(string, number, withoutSuffix, isFuture, locale) { + return locale.relativeTime(number || 1, !!withoutSuffix, string, isFuture); + } + + function relativeTime$1(posNegDuration, withoutSuffix, thresholds, locale) { + var duration = createDuration(posNegDuration).abs(), + seconds = round(duration.as('s')), + minutes = round(duration.as('m')), + hours = round(duration.as('h')), + days = round(duration.as('d')), + months = round(duration.as('M')), + weeks = round(duration.as('w')), + years = round(duration.as('y')), + a = + (seconds <= thresholds.ss && ['s', seconds]) || + (seconds < thresholds.s && ['ss', seconds]) || + (minutes <= 1 && ['m']) || + (minutes < thresholds.m && ['mm', minutes]) || + (hours <= 1 && ['h']) || + (hours < thresholds.h && ['hh', hours]) || + (days <= 1 && ['d']) || + (days < thresholds.d && ['dd', days]); + + if (thresholds.w != null) { + a = + a || + (weeks <= 1 && ['w']) || + (weeks < thresholds.w && ['ww', weeks]); + } + a = a || + (months <= 1 && ['M']) || + (months < thresholds.M && ['MM', months]) || + (years <= 1 && ['y']) || ['yy', years]; + + a[2] = withoutSuffix; + a[3] = +posNegDuration > 0; + a[4] = locale; + return substituteTimeAgo.apply(null, a); + } + + // This function allows you to set the rounding function for relative time strings + function getSetRelativeTimeRounding(roundingFunction) { + if (roundingFunction === undefined) { + return round; + } + if (typeof roundingFunction === 'function') { + round = roundingFunction; + return true; + } + return false; + } + + // This function allows you to set a threshold for relative time strings + function getSetRelativeTimeThreshold(threshold, limit) { + if (thresholds[threshold] === undefined) { + return false; + } + if (limit === undefined) { + return thresholds[threshold]; + } + thresholds[threshold] = limit; + if (threshold === 's') { + thresholds.ss = limit - 1; + } + return true; + } + + function humanize(argWithSuffix, argThresholds) { + if (!this.isValid()) { + return this.localeData().invalidDate(); + } + + var withSuffix = false, + th = thresholds, + locale, + output; + + if (typeof argWithSuffix === 'object') { + argThresholds = argWithSuffix; + argWithSuffix = false; + } + if (typeof argWithSuffix === 'boolean') { + withSuffix = argWithSuffix; + } + if (typeof argThresholds === 'object') { + th = Object.assign({}, thresholds, argThresholds); + if (argThresholds.s != null && argThresholds.ss == null) { + th.ss = argThresholds.s - 1; + } + } + + locale = this.localeData(); + output = relativeTime$1(this, !withSuffix, th, locale); + + if (withSuffix) { + output = locale.pastFuture(+this, output); + } + + return locale.postformat(output); + } + + var abs$1 = Math.abs; + + function sign(x) { + return (x > 0) - (x < 0) || +x; + } + + function toISOString$1() { + // for ISO strings we do not use the normal bubbling rules: + // * milliseconds bubble up until they become hours + // * days do not bubble at all + // * months bubble up until they become years + // This is because there is no context-free conversion between hours and days + // (think of clock changes) + // and also not between days and months (28-31 days per month) + if (!this.isValid()) { + return this.localeData().invalidDate(); + } + + var seconds = abs$1(this._milliseconds) / 1000, + days = abs$1(this._days), + months = abs$1(this._months), + minutes, + hours, + years, + s, + total = this.asSeconds(), + totalSign, + ymSign, + daysSign, + hmsSign; + + if (!total) { + // this is the same as C#'s (Noda) and python (isodate)... + // but not other JS (goog.date) + return 'P0D'; + } + + // 3600 seconds -> 60 minutes -> 1 hour + minutes = absFloor(seconds / 60); + hours = absFloor(minutes / 60); + seconds %= 60; + minutes %= 60; + + // 12 months -> 1 year + years = absFloor(months / 12); + months %= 12; + + // inspired by https://github.com/dordille/moment-isoduration/blob/master/moment.isoduration.js + s = seconds ? seconds.toFixed(3).replace(/\.?0+$/, '') : ''; + + totalSign = total < 0 ? '-' : ''; + ymSign = sign(this._months) !== sign(total) ? '-' : ''; + daysSign = sign(this._days) !== sign(total) ? '-' : ''; + hmsSign = sign(this._milliseconds) !== sign(total) ? '-' : ''; + + return ( + totalSign + + 'P' + + (years ? ymSign + years + 'Y' : '') + + (months ? ymSign + months + 'M' : '') + + (days ? daysSign + days + 'D' : '') + + (hours || minutes || seconds ? 'T' : '') + + (hours ? hmsSign + hours + 'H' : '') + + (minutes ? hmsSign + minutes + 'M' : '') + + (seconds ? hmsSign + s + 'S' : '') + ); + } + + var proto$2 = Duration.prototype; + + proto$2.isValid = isValid$1; + proto$2.abs = abs; + proto$2.add = add$1; + proto$2.subtract = subtract$1; + proto$2.as = as; + proto$2.asMilliseconds = asMilliseconds; + proto$2.asSeconds = asSeconds; + proto$2.asMinutes = asMinutes; + proto$2.asHours = asHours; + proto$2.asDays = asDays; + proto$2.asWeeks = asWeeks; + proto$2.asMonths = asMonths; + proto$2.asQuarters = asQuarters; + proto$2.asYears = asYears; + proto$2.valueOf = valueOf$1; + proto$2._bubble = bubble; + proto$2.clone = clone$1; + proto$2.get = get$2; + proto$2.milliseconds = milliseconds; + proto$2.seconds = seconds; + proto$2.minutes = minutes; + proto$2.hours = hours; + proto$2.days = days; + proto$2.weeks = weeks; + proto$2.months = months; + proto$2.years = years; + proto$2.humanize = humanize; + proto$2.toISOString = toISOString$1; + proto$2.toString = toISOString$1; + proto$2.toJSON = toISOString$1; + proto$2.locale = locale; + proto$2.localeData = localeData; + + proto$2.toIsoString = deprecate( + 'toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)', + toISOString$1 + ); + proto$2.lang = lang; + + // FORMATTING + + addFormatToken('X', 0, 0, 'unix'); + addFormatToken('x', 0, 0, 'valueOf'); + + // PARSING + + addRegexToken('x', matchSigned); + addRegexToken('X', matchTimestamp); + addParseToken('X', function (input, array, config) { + config._d = new Date(parseFloat(input) * 1000); + }); + addParseToken('x', function (input, array, config) { + config._d = new Date(toInt(input)); + }); + + //! moment.js + + hooks.version = '2.27.0'; + + setHookCallback(createLocal); + + hooks.fn = proto; + hooks.min = min; + hooks.max = max; + hooks.now = now; + hooks.utc = createUTC; + hooks.unix = createUnix; + hooks.months = listMonths; + hooks.isDate = isDate; + hooks.locale = getSetGlobalLocale; + hooks.invalid = createInvalid; + hooks.duration = createDuration; + hooks.isMoment = isMoment; + hooks.weekdays = listWeekdays; + hooks.parseZone = createInZone; + hooks.localeData = getLocale; + hooks.isDuration = isDuration; + hooks.monthsShort = listMonthsShort; + hooks.weekdaysMin = listWeekdaysMin; + hooks.defineLocale = defineLocale; + hooks.updateLocale = updateLocale; + hooks.locales = listLocales; + hooks.weekdaysShort = listWeekdaysShort; + hooks.normalizeUnits = normalizeUnits; + hooks.relativeTimeRounding = getSetRelativeTimeRounding; + hooks.relativeTimeThreshold = getSetRelativeTimeThreshold; + hooks.calendarFormat = getCalendarFormat; + hooks.prototype = proto; + + // currently HTML5 input type only supports 24-hour formats + hooks.HTML5_FMT = { + DATETIME_LOCAL: 'YYYY-MM-DDTHH:mm', // + DATETIME_LOCAL_SECONDS: 'YYYY-MM-DDTHH:mm:ss', // + DATETIME_LOCAL_MS: 'YYYY-MM-DDTHH:mm:ss.SSS', // + DATE: 'YYYY-MM-DD', // + TIME: 'HH:mm', // + TIME_SECONDS: 'HH:mm:ss', // + TIME_MS: 'HH:mm:ss.SSS', // + WEEK: 'GGGG-[W]WW', // + MONTH: 'YYYY-MM', // + }; + + return hooks; + +}))); diff --git a/admin/js/vendors/moment/moment.min.js b/admin/js/vendors/moment/moment.min.js new file mode 100644 index 0000000..36f8628 --- /dev/null +++ b/admin/js/vendors/moment/moment.min.js @@ -0,0 +1,2 @@ +!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):e.moment=t()}(this,function(){"use strict";var e,i;function f(){return e.apply(null,arguments)}function o(e){return e instanceof Array||"[object Array]"===Object.prototype.toString.call(e)}function u(e){return null!=e&&"[object Object]"===Object.prototype.toString.call(e)}function m(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function l(e){if(Object.getOwnPropertyNames)return 0===Object.getOwnPropertyNames(e).length;for(var t in e)if(m(e,t))return;return 1}function r(e){return void 0===e}function h(e){return"number"==typeof e||"[object Number]"===Object.prototype.toString.call(e)}function a(e){return e instanceof Date||"[object Date]"===Object.prototype.toString.call(e)}function d(e,t){for(var n=[],s=0;s>>0,s=0;sFe(e)?(r=e+1,a-Fe(e)):(r=e,a);return{year:r,dayOfYear:o}}function Ae(e,t,n){var s,i,r=Ge(e.year(),t,n),a=Math.floor((e.dayOfYear()-r-1)/7)+1;return a<1?s=a+je(i=e.year()-1,t,n):a>je(e.year(),t,n)?(s=a-je(e.year(),t,n),i=e.year()+1):(i=e.year(),s=a),{week:s,year:i}}function je(e,t,n){var s=Ge(e,t,n),i=Ge(e+1,t,n);return(Fe(e)-s+i)/7}C("w",["ww",2],"wo","week"),C("W",["WW",2],"Wo","isoWeek"),L("week","w"),L("isoWeek","W"),A("week",5),A("isoWeek",5),ce("w",te),ce("ww",te,Q),ce("W",te),ce("WW",te,Q),ge(["w","ww","W","WW"],function(e,t,n,s){t[s.substr(0,1)]=Z(e)});function Ie(e,t){return e.slice(t,7).concat(e.slice(0,t))}C("d",0,"do","day"),C("dd",0,0,function(e){return this.localeData().weekdaysMin(this,e)}),C("ddd",0,0,function(e){return this.localeData().weekdaysShort(this,e)}),C("dddd",0,0,function(e){return this.localeData().weekdays(this,e)}),C("e",0,0,"weekday"),C("E",0,0,"isoWeekday"),L("day","d"),L("weekday","e"),L("isoWeekday","E"),A("day",11),A("weekday",11),A("isoWeekday",11),ce("d",te),ce("e",te),ce("E",te),ce("dd",function(e,t){return t.weekdaysMinRegex(e)}),ce("ddd",function(e,t){return t.weekdaysShortRegex(e)}),ce("dddd",function(e,t){return t.weekdaysRegex(e)}),ge(["dd","ddd","dddd"],function(e,t,n,s){var i=n._locale.weekdaysParse(e,s,n._strict);null!=i?t.d=i:y(n).invalidWeekday=e}),ge(["d","e","E"],function(e,t,n,s){t[s]=Z(e)});var Ze="Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),ze="Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),$e="Su_Mo_Tu_We_Th_Fr_Sa".split("_"),qe=de,Be=de,Je=de;function Qe(){function e(e,t){return t.length-e.length}for(var t,n,s,i,r=[],a=[],o=[],u=[],l=0;l<7;l++)t=_([2e3,1]).day(l),n=me(this.weekdaysMin(t,"")),s=me(this.weekdaysShort(t,"")),i=me(this.weekdays(t,"")),r.push(n),a.push(s),o.push(i),u.push(n),u.push(s),u.push(i);r.sort(e),a.sort(e),o.sort(e),u.sort(e),this._weekdaysRegex=new RegExp("^("+u.join("|")+")","i"),this._weekdaysShortRegex=this._weekdaysRegex,this._weekdaysMinRegex=this._weekdaysRegex,this._weekdaysStrictRegex=new RegExp("^("+o.join("|")+")","i"),this._weekdaysShortStrictRegex=new RegExp("^("+a.join("|")+")","i"),this._weekdaysMinStrictRegex=new RegExp("^("+r.join("|")+")","i")}function Xe(){return this.hours()%12||12}function Ke(e,t){C(e,0,0,function(){return this.localeData().meridiem(this.hours(),this.minutes(),t)})}function et(e,t){return t._meridiemParse}C("H",["HH",2],0,"hour"),C("h",["hh",2],0,Xe),C("k",["kk",2],0,function(){return this.hours()||24}),C("hmm",0,0,function(){return""+Xe.apply(this)+T(this.minutes(),2)}),C("hmmss",0,0,function(){return""+Xe.apply(this)+T(this.minutes(),2)+T(this.seconds(),2)}),C("Hmm",0,0,function(){return""+this.hours()+T(this.minutes(),2)}),C("Hmmss",0,0,function(){return""+this.hours()+T(this.minutes(),2)+T(this.seconds(),2)}),Ke("a",!0),Ke("A",!1),L("hour","h"),A("hour",13),ce("a",et),ce("A",et),ce("H",te),ce("h",te),ce("k",te),ce("HH",te,Q),ce("hh",te,Q),ce("kk",te,Q),ce("hmm",ne),ce("hmmss",se),ce("Hmm",ne),ce("Hmmss",se),ye(["H","HH"],Me),ye(["k","kk"],function(e,t,n){var s=Z(e);t[Me]=24===s?0:s}),ye(["a","A"],function(e,t,n){n._isPm=n._locale.isPM(e),n._meridiem=e}),ye(["h","hh"],function(e,t,n){t[Me]=Z(e),y(n).bigHour=!0}),ye("hmm",function(e,t,n){var s=e.length-2;t[Me]=Z(e.substr(0,s)),t[De]=Z(e.substr(s)),y(n).bigHour=!0}),ye("hmmss",function(e,t,n){var s=e.length-4,i=e.length-2;t[Me]=Z(e.substr(0,s)),t[De]=Z(e.substr(s,2)),t[Se]=Z(e.substr(i)),y(n).bigHour=!0}),ye("Hmm",function(e,t,n){var s=e.length-2;t[Me]=Z(e.substr(0,s)),t[De]=Z(e.substr(s))}),ye("Hmmss",function(e,t,n){var s=e.length-4,i=e.length-2;t[Me]=Z(e.substr(0,s)),t[De]=Z(e.substr(s,2)),t[Se]=Z(e.substr(i))});var tt=z("Hours",!0);var nt,st={calendar:{sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"},longDateFormat:{LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"},invalidDate:"Invalid date",ordinal:"%d",dayOfMonthOrdinalParse:/\d{1,2}/,relativeTime:{future:"in %s",past:"%s ago",s:"a few seconds",ss:"%d seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",w:"a week",ww:"%d weeks",M:"a month",MM:"%d months",y:"a year",yy:"%d years"},months:Te,monthsShort:Ne,week:{dow:0,doy:6},weekdays:Ze,weekdaysMin:$e,weekdaysShort:ze,meridiemParse:/[ap]\.?m?\.?/i},it={},rt={};function at(e){return e?e.toLowerCase().replace("_","-"):e}function ot(e){for(var t,n,s,i,r=0;r=t&&function(e,t){for(var n=Math.min(e.length,t.length),s=0;s=t-1)break;t--}r++}return nt}function ut(t){var e;if(void 0===it[t]&&"undefined"!=typeof module&&module&&module.exports)try{e=nt._abbr,require("./locale/"+t),lt(e)}catch(e){it[t]=null}return it[t]}function lt(e,t){var n;return e&&((n=r(t)?dt(e):ht(e,t))?nt=n:"undefined"!=typeof console&&console.warn&&console.warn("Locale "+e+" not found. Did you forget to load it?")),nt._abbr}function ht(e,t){if(null===t)return delete it[e],null;var n,s=st;if(t.abbr=e,null!=it[e])Y("defineLocaleOverride","use moment.updateLocale(localeName, config) to change an existing locale. moment.defineLocale(localeName, config) should only be used for creating a new locale See http://momentjs.com/guides/#/warnings/define-locale/ for more info."),s=it[e]._config;else if(null!=t.parentLocale)if(null!=it[t.parentLocale])s=it[t.parentLocale]._config;else{if(null==(n=ut(t.parentLocale)))return rt[t.parentLocale]||(rt[t.parentLocale]=[]),rt[t.parentLocale].push({name:e,config:t}),null;s=n._config}return it[e]=new x(b(s,t)),rt[e]&&rt[e].forEach(function(e){ht(e.name,e.config)}),lt(e),it[e]}function dt(e){var t;if(e&&e._locale&&e._locale._abbr&&(e=e._locale._abbr),!e)return nt;if(!o(e)){if(t=ut(e))return t;e=[e]}return ot(e)}function ct(e){var t,n=e._a;return n&&-2===y(e).overflow&&(t=n[ve]<0||11xe(n[pe],n[ve])?ke:n[Me]<0||24je(n,r,a)?y(e)._overflowWeeks=!0:null!=u?y(e)._overflowWeekday=!0:(o=Ee(n,s,i,r,a),e._a[pe]=o.year,e._dayOfYear=o.dayOfYear)}(e),null!=e._dayOfYear&&(r=St(e._a[pe],s[pe]),(e._dayOfYear>Fe(r)||0===e._dayOfYear)&&(y(e)._overflowDayOfYear=!0),n=Ve(r,0,e._dayOfYear),e._a[ve]=n.getUTCMonth(),e._a[ke]=n.getUTCDate()),t=0;t<3&&null==e._a[t];++t)e._a[t]=u[t]=s[t];for(;t<7;t++)e._a[t]=u[t]=null==e._a[t]?2===t?1:0:e._a[t];24===e._a[Me]&&0===e._a[De]&&0===e._a[Se]&&0===e._a[Ye]&&(e._nextDay=!0,e._a[Me]=0),e._d=(e._useUTC?Ve:function(e,t,n,s,i,r,a){var o;return e<100&&0<=e?(o=new Date(e+400,t,n,s,i,r,a),isFinite(o.getFullYear())&&o.setFullYear(e)):o=new Date(e,t,n,s,i,r,a),o}).apply(null,u),i=e._useUTC?e._d.getUTCDay():e._d.getDay(),null!=e._tzm&&e._d.setUTCMinutes(e._d.getUTCMinutes()-e._tzm),e._nextDay&&(e._a[Me]=24),e._w&&void 0!==e._w.d&&e._w.d!==i&&(y(e).weekdayMismatch=!0)}}function Ot(e){if(e._f!==f.ISO_8601)if(e._f!==f.RFC_2822){e._a=[],y(e).empty=!0;for(var t,n,s,i,r,a,o,u=""+e._i,l=u.length,h=0,d=H(e._f,e._locale).match(N)||[],c=0;cn.valueOf():n.valueOf()"}),pn.toJSON=function(){return this.isValid()?this.toISOString():null},pn.toString=function(){return this.clone().locale("en").format("ddd MMM DD YYYY HH:mm:ss [GMT]ZZ")},pn.unix=function(){return Math.floor(this.valueOf()/1e3)},pn.valueOf=function(){return this._d.valueOf()-6e4*(this._offset||0)},pn.creationData=function(){return{input:this._i,format:this._f,locale:this._locale,isUTC:this._isUTC,strict:this._strict}},pn.eraName=function(){for(var e,t=this.localeData().eras(),n=0,s=t.length;nthis.clone().month(0).utcOffset()||this.utcOffset()>this.clone().month(5).utcOffset()},pn.isLocal=function(){return!!this.isValid()&&!this._isUTC},pn.isUtcOffset=function(){return!!this.isValid()&&this._isUTC},pn.isUtc=At,pn.isUTC=At,pn.zoneAbbr=function(){return this._isUTC?"UTC":""},pn.zoneName=function(){return this._isUTC?"Coordinated Universal Time":""},pn.dates=n("dates accessor is deprecated. Use date instead.",fn),pn.months=n("months accessor is deprecated. Use month instead",Ue),pn.years=n("years accessor is deprecated. Use year instead",Le),pn.zone=n("moment().zone is deprecated, use moment().utcOffset instead. http://momentjs.com/guides/#/warnings/zone/",function(e,t){return null!=e?("string"!=typeof e&&(e=-e),this.utcOffset(e,t),this):-this.utcOffset()}),pn.isDSTShifted=n("isDSTShifted is deprecated. See http://momentjs.com/guides/#/warnings/dst-shifted/ for more information",function(){if(!r(this._isDSTShifted))return this._isDSTShifted;var e,t={};return v(t,this),(t=bt(t))._a?(e=(t._isUTC?_:Tt)(t._a),this._isDSTShifted=this.isValid()&&0=window.innerHeight?"above":i?t:"below"},t.debounce=function(n,a,o){var l;return void 0===a&&(a=100),void 0===o&&(o=!1),function(){for(var e=[],t=0;t[^<>]*'+l+"")},t.kebabCase=function(e){var t=e.replace(/[A-Z\u00C0-\u00D6\u00D8-\u00DE]/g,function(e){return"-"+e.toLowerCase()});return e[0]===e[0].toUpperCase()?t.substring(1):t},"function"!=typeof(n=window).CustomEvent&&(s.prototype=n.Event.prototype,n.CustomEvent=s)},function(e,t,i){"use strict";t.__esModule=!0;var s=(n.prototype.newOption=function(e){return{id:e.id?e.id:String(Math.floor(1e8*Math.random())),value:e.value?e.value:"",text:e.text?e.text:"",innerHTML:e.innerHTML?e.innerHTML:"",selected:!!e.selected&&e.selected,display:void 0===e.display||e.display,disabled:!!e.disabled&&e.disabled,placeholder:!!e.placeholder&&e.placeholder,class:e.class?e.class:void 0,data:e.data?e.data:{},mandatory:!!e.mandatory&&e.mandatory}},n.prototype.add=function(e){this.data.push({id:String(Math.floor(1e8*Math.random())),value:e.value,text:e.text,innerHTML:"",selected:!1,display:!0,disabled:!1,placeholder:!1,class:void 0,mandatory:e.mandatory,data:{}})},n.prototype.parseSelectData=function(){this.data=[];for(var e=0,t=this.main.select.element.childNodes;ecBottom&&(container.scrollTop+=eBottom-cBottom)}function putContent(el,currentPosition,isOpen){var height=el.offsetHeight,rect=el.getBoundingClientRect(),elemTop=isOpen?rect.top:rect.top-height,elemBottom=isOpen?rect.bottom:rect.bottom+height;return elemTop<=0?"below":elemBottom>=window.innerHeight?"above":isOpen?currentPosition:"below"}function debounce(func,wait,immediate){var timeout;return void 0===wait&&(wait=100),void 0===immediate&&(immediate=!1),function(){for(var args=[],_i=0;_i[^<>]*'+originalTextFoundByRegex+"")}function kebabCase(str){var result=str.replace(/[A-Z\u00C0-\u00D6\u00D8-\u00DE]/g,(function(match){return"-"+match.toLowerCase()}));return str[0]===str[0].toUpperCase()?result.substring(1):result}exports.__esModule=!0,exports.hasClassInTree=hasClassInTree,exports.ensureElementInView=ensureElementInView,exports.putContent=putContent,exports.debounce=debounce,exports.isValueInArrayOfObjects=isValueInArrayOfObjects,exports.highlight=highlight,exports.kebabCase=kebabCase,function(){var w=window;function CustomEvent(event,params){params=params||{bubbles:!1,cancelable:!1,detail:void 0};var evt=document.createEvent("CustomEvent");return evt.initCustomEvent(event,params.bubbles,params.cancelable,params.detail),evt}"function"!=typeof w.CustomEvent&&(CustomEvent.prototype=w.Event.prototype,w.CustomEvent=CustomEvent)}()},function(module,exports,__webpack_require__){"use strict";exports.__esModule=!0;var Data=function(){function Data(info){this.contentOpen=!1,this.contentPosition="below",this.isOnChangeEnabled=!0,this.main=info.main,this.searchValue="",this.data=[],this.filtered=null,this.parseSelectData(),this.setSelectedFromSelect()}return Data.prototype.newOption=function(info){return{id:info.id?info.id:String(Math.floor(1e8*Math.random())),value:info.value?info.value:"",text:info.text?info.text:"",innerHTML:info.innerHTML?info.innerHTML:"",selected:!!info.selected&&info.selected,display:void 0===info.display||info.display,disabled:!!info.disabled&&info.disabled,placeholder:!!info.placeholder&&info.placeholder,class:info.class?info.class:void 0,data:info.data?info.data:{},mandatory:!!info.mandatory&&info.mandatory}},Data.prototype.add=function(data){this.data.push({id:String(Math.floor(1e8*Math.random())),value:data.value,text:data.text,innerHTML:"",selected:!1,display:!0,disabled:!1,placeholder:!1,class:void 0,mandatory:data.mandatory,data:{}})},Data.prototype.parseSelectData=function(){this.data=[];for(var nodes,_i=0,nodes_1=this.main.select.element.childNodes;_i cBottom) { + container.scrollTop += (eBottom - cBottom); + } +} +exports.ensureElementInView = ensureElementInView; +function putContent(el, currentPosition, isOpen) { + var height = el.offsetHeight; + var rect = el.getBoundingClientRect(); + var elemTop = (isOpen ? rect.top : rect.top - height); + var elemBottom = (isOpen ? rect.bottom : rect.bottom + height); + if (elemTop <= 0) { + return 'below'; + } + if (elemBottom >= window.innerHeight) { + return 'above'; + } + return (isOpen ? currentPosition : 'below'); +} +exports.putContent = putContent; +function debounce(func, wait, immediate) { + if (wait === void 0) { wait = 100; } + if (immediate === void 0) { immediate = false; } + var timeout; + return function () { + var args = []; + for (var _i = 0; _i < arguments.length; _i++) { + args[_i] = arguments[_i]; + } + var context = self; + var later = function () { + timeout = null; + if (!immediate) { + func.apply(context, args); + } + }; + var callNow = immediate && !timeout; + clearTimeout(timeout); + timeout = setTimeout(later, wait); + if (callNow) { + func.apply(context, args); + } + }; +} +exports.debounce = debounce; +function isValueInArrayOfObjects(selected, key, value) { + if (!Array.isArray(selected)) { + return selected[key] === value; + } + for (var _i = 0, selected_1 = selected; _i < selected_1.length; _i++) { + var s = selected_1[_i]; + if (s && s[key] && s[key] === value) { + return true; + } + } + return false; +} +exports.isValueInArrayOfObjects = isValueInArrayOfObjects; +function highlight(str, search, className) { + var completedString = str; + var regex = new RegExp('(' + search.trim() + ')(?![^<]*>[^<>]*" + originalTextFoundByRegex + ""); + return completedString; +} +exports.highlight = highlight; +function kebabCase(str) { + var result = str.replace(/[A-Z\u00C0-\u00D6\u00D8-\u00DE]/g, function (match) { return '-' + match.toLowerCase(); }); + return (str[0] === str[0].toUpperCase()) + ? result.substring(1) + : result; +} +exports.kebabCase = kebabCase; +(function () { + var w = window; + if (typeof w.CustomEvent === 'function') { + return; + } + function CustomEvent(event, params) { + params = params || { bubbles: false, cancelable: false, detail: undefined }; + var evt = document.createEvent('CustomEvent'); + evt.initCustomEvent(event, params.bubbles, params.cancelable, params.detail); + return evt; + } + CustomEvent.prototype = w.Event.prototype; + w.CustomEvent = CustomEvent; +})(); + + +/***/ }), +/* 1 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + +exports.__esModule = true; +var Data = (function () { + function Data(info) { + this.contentOpen = false; + this.contentPosition = 'below'; + this.isOnChangeEnabled = true; + this.main = info.main; + this.searchValue = ''; + this.data = []; + this.filtered = null; + this.parseSelectData(); + this.setSelectedFromSelect(); + } + Data.prototype.newOption = function (info) { + return { + id: (info.id ? info.id : String(Math.floor(Math.random() * 100000000))), + value: (info.value ? info.value : ''), + text: (info.text ? info.text : ''), + innerHTML: (info.innerHTML ? info.innerHTML : ''), + selected: (info.selected ? info.selected : false), + display: (info.display !== undefined ? info.display : true), + disabled: (info.disabled ? info.disabled : false), + placeholder: (info.placeholder ? info.placeholder : false), + "class": (info["class"] ? info["class"] : undefined), + data: (info.data ? info.data : {}), + mandatory: (info.mandatory ? info.mandatory : false) + }; + }; + Data.prototype.add = function (data) { + this.data.push({ + id: String(Math.floor(Math.random() * 100000000)), + value: data.value, + text: data.text, + innerHTML: '', + selected: false, + display: true, + disabled: false, + placeholder: false, + "class": undefined, + mandatory: data.mandatory, + data: {} + }); + }; + Data.prototype.parseSelectData = function () { + this.data = []; + var nodes = this.main.select.element.childNodes; + for (var _i = 0, nodes_1 = nodes; _i < nodes_1.length; _i++) { + var n = nodes_1[_i]; + if (n.nodeName === 'OPTGROUP') { + var node = n; + var optgroup = { + label: node.label, + options: [] + }; + var options = n.childNodes; + for (var _a = 0, options_1 = options; _a < options_1.length; _a++) { + var o = options_1[_a]; + if (o.nodeName === 'OPTION') { + var option = this.pullOptionData(o); + optgroup.options.push(option); + if (option.placeholder && option.text.trim() !== '') { + this.main.config.placeholderText = option.text; + } + } + } + this.data.push(optgroup); + } + else if (n.nodeName === 'OPTION') { + var option = this.pullOptionData(n); + this.data.push(option); + if (option.placeholder && option.text.trim() !== '') { + this.main.config.placeholderText = option.text; + } + } + } + }; + Data.prototype.pullOptionData = function (option) { + return { + id: (option.dataset ? option.dataset.id : false) || String(Math.floor(Math.random() * 100000000)), + value: option.value, + text: option.text, + innerHTML: option.innerHTML, + selected: option.selected, + disabled: option.disabled, + placeholder: option.dataset.placeholder === 'true', + "class": option.className, + style: option.style.cssText, + data: option.dataset, + mandatory: (option.dataset ? option.dataset.mandatory === 'true' : false) + }; + }; + Data.prototype.setSelectedFromSelect = function () { + if (this.main.config.isMultiple) { + var options = this.main.select.element.options; + var newSelected = []; + for (var _i = 0, options_2 = options; _i < options_2.length; _i++) { + var o = options_2[_i]; + if (o.selected) { + var newOption = this.getObjectFromData(o.value, 'value'); + if (newOption && newOption.id) { + newSelected.push(newOption.id); + } + } + } + this.setSelected(newSelected, 'id'); + } + else { + var element = this.main.select.element; + if (element.selectedIndex !== -1) { + var option = element.options[element.selectedIndex]; + var value = option.value; + this.setSelected(value, 'value'); + } + } + }; + Data.prototype.setSelected = function (value, type) { + if (type === void 0) { type = 'id'; } + for (var _i = 0, _a = this.data; _i < _a.length; _i++) { + var d = _a[_i]; + if (d.hasOwnProperty('label')) { + if (d.hasOwnProperty('options')) { + var options = d.options; + if (options) { + for (var _b = 0, options_3 = options; _b < options_3.length; _b++) { + var o = options_3[_b]; + if (o.placeholder) { + continue; + } + o.selected = this.shouldBeSelected(o, value, type); + } + } + } + } + else { + d.selected = this.shouldBeSelected(d, value, type); + } + } + }; + Data.prototype.shouldBeSelected = function (option, value, type) { + if (type === void 0) { type = 'id'; } + if (Array.isArray(value)) { + for (var _i = 0, value_1 = value; _i < value_1.length; _i++) { + var v = value_1[_i]; + if (type in option && String(option[type]) === String(v)) { + return true; + } + } + } + else { + if (type in option && String(option[type]) === String(value)) { + return true; + } + } + return false; + }; + Data.prototype.getSelected = function () { + var value = { text: '', placeholder: this.main.config.placeholderText }; + var values = []; + for (var _i = 0, _a = this.data; _i < _a.length; _i++) { + var d = _a[_i]; + if (d.hasOwnProperty('label')) { + if (d.hasOwnProperty('options')) { + var options = d.options; + if (options) { + for (var _b = 0, options_4 = options; _b < options_4.length; _b++) { + var o = options_4[_b]; + if (o.selected) { + if (!this.main.config.isMultiple) { + value = o; + } + else { + values.push(o); + } + } + } + } + } + } + else { + if (d.selected) { + if (!this.main.config.isMultiple) { + value = d; + } + else { + values.push(d); + } + } + } + } + if (this.main.config.isMultiple) { + return values; + } + return value; + }; + Data.prototype.addToSelected = function (value, type) { + if (type === void 0) { type = 'id'; } + if (this.main.config.isMultiple) { + var values = []; + var selected = this.getSelected(); + if (Array.isArray(selected)) { + for (var _i = 0, selected_1 = selected; _i < selected_1.length; _i++) { + var s = selected_1[_i]; + values.push(s[type]); + } + } + values.push(value); + this.setSelected(values, type); + } + }; + Data.prototype.removeFromSelected = function (value, type) { + if (type === void 0) { type = 'id'; } + if (this.main.config.isMultiple) { + var values = []; + var selected = this.getSelected(); + for (var _i = 0, selected_2 = selected; _i < selected_2.length; _i++) { + var s = selected_2[_i]; + if (String(s[type]) !== String(value)) { + values.push(s[type]); + } + } + this.setSelected(values, type); + } + }; + Data.prototype.onDataChange = function () { + if (this.main.onChange && this.isOnChangeEnabled) { + this.main.onChange(JSON.parse(JSON.stringify(this.getSelected()))); + } + }; + Data.prototype.getObjectFromData = function (value, type) { + if (type === void 0) { type = 'id'; } + for (var _i = 0, _a = this.data; _i < _a.length; _i++) { + var d = _a[_i]; + if (type in d && String(d[type]) === String(value)) { + return d; + } + if (d.hasOwnProperty('options')) { + var optgroupObject = d; + if (optgroupObject.options) { + for (var _b = 0, _c = optgroupObject.options; _b < _c.length; _b++) { + var oo = _c[_b]; + if (String(oo[type]) === String(value)) { + return oo; + } + } + } + } + } + return null; + }; + Data.prototype.search = function (search) { + this.searchValue = search; + if (search.trim() === '') { + this.filtered = null; + return; + } + var searchFilter = this.main.config.searchFilter; + var valuesArray = this.data.slice(0); + search = search.trim(); + var filtered = valuesArray.map(function (obj) { + if (obj.hasOwnProperty('options')) { + var optgroupObj = obj; + var options = []; + if (optgroupObj.options) { + options = optgroupObj.options.filter(function (opt) { + return searchFilter(opt, search); + }); + } + if (options.length !== 0) { + var optgroup = Object.assign({}, optgroupObj); + optgroup.options = options; + return optgroup; + } + } + if (obj.hasOwnProperty('text')) { + var optionObj = obj; + if (searchFilter(optionObj, search)) { + return obj; + } + } + return null; + }); + this.filtered = filtered.filter(function (info) { return info; }); + }; + return Data; +}()); +exports.Data = Data; +function validateData(data) { + if (!data) { + console.error('Data must be an array of objects'); + return false; + } + var isValid = false; + var errorCount = 0; + for (var _i = 0, data_1 = data; _i < data_1.length; _i++) { + var d = data_1[_i]; + if (d.hasOwnProperty('label')) { + if (d.hasOwnProperty('options')) { + var optgroup = d; + var options = optgroup.options; + if (options) { + for (var _a = 0, options_5 = options; _a < options_5.length; _a++) { + var o = options_5[_a]; + isValid = validateOption(o); + if (!isValid) { + errorCount++; + } + } + } + } + } + else { + var option = d; + isValid = validateOption(option); + if (!isValid) { + errorCount++; + } + } + } + return errorCount === 0; +} +exports.validateData = validateData; +function validateOption(option) { + if (option.text === undefined) { + console.error('Data object option must have at least have a text value. Check object: ' + JSON.stringify(option)); + return false; + } + return true; +} +exports.validateOption = validateOption; + + +/***/ }), +/* 2 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + +exports.__esModule = true; +var config_1 = __webpack_require__(3); +var select_1 = __webpack_require__(4); +var slim_1 = __webpack_require__(5); +var data_1 = __webpack_require__(1); +var helper_1 = __webpack_require__(0); +var SlimSelect = (function () { + function SlimSelect(info) { + var _this = this; + this.ajax = null; + this.addable = null; + this.beforeOnChange = null; + this.onChange = null; + this.beforeOpen = null; + this.afterOpen = null; + this.beforeClose = null; + this.afterClose = null; + var selectElement = this.validate(info); + if (selectElement.dataset.ssid) { + this.destroy(selectElement.dataset.ssid); + } + if (info.ajax) { + this.ajax = info.ajax; + } + if (info.addable) { + this.addable = info.addable; + } + this.config = new config_1.Config({ + select: selectElement, + isAjax: (info.ajax ? true : false), + showSearch: info.showSearch, + searchPlaceholder: info.searchPlaceholder, + searchText: info.searchText, + searchingText: info.searchingText, + searchFocus: info.searchFocus, + searchHighlight: info.searchHighlight, + searchFilter: info.searchFilter, + closeOnSelect: info.closeOnSelect, + showContent: info.showContent, + placeholderText: info.placeholder, + allowDeselect: info.allowDeselect, + allowDeselectOption: info.allowDeselectOption, + hideSelectedOption: info.hideSelectedOption, + deselectLabel: info.deselectLabel, + isEnabled: info.isEnabled, + valuesUseText: info.valuesUseText, + showOptionTooltips: info.showOptionTooltips, + selectByGroup: info.selectByGroup, + limit: info.limit, + timeoutDelay: info.timeoutDelay, + addToBody: info.addToBody + }); + this.select = new select_1.Select({ + select: selectElement, + main: this + }); + this.data = new data_1.Data({ main: this }); + this.slim = new slim_1.Slim({ main: this }); + if (this.select.element.parentNode) { + this.select.element.parentNode.insertBefore(this.slim.container, this.select.element.nextSibling); + } + if (info.data) { + this.setData(info.data); + } + else { + this.render(); + } + document.addEventListener('click', function (e) { + if (e.target && !helper_1.hasClassInTree(e.target, _this.config.id)) { + _this.close(); + } + }); + if (this.config.showContent === 'auto') { + window.addEventListener('scroll', helper_1.debounce(function (e) { + if (_this.data.contentOpen) { + if (helper_1.putContent(_this.slim.content, _this.data.contentPosition, _this.data.contentOpen) === 'above') { + _this.moveContentAbove(); + } + else { + _this.moveContentBelow(); + } + } + }), false); + } + if (info.beforeOnChange) { + this.beforeOnChange = info.beforeOnChange; + } + if (info.onChange) { + this.onChange = info.onChange; + } + if (info.beforeOpen) { + this.beforeOpen = info.beforeOpen; + } + if (info.afterOpen) { + this.afterOpen = info.afterOpen; + } + if (info.beforeClose) { + this.beforeClose = info.beforeClose; + } + if (info.afterClose) { + this.afterClose = info.afterClose; + } + if (!this.config.isEnabled) { + this.disable(); + } + } + SlimSelect.prototype.validate = function (info) { + var select = (typeof info.select === 'string' ? document.querySelector(info.select) : info.select); + if (!select) { + throw new Error('Could not find select element'); + } + if (select.tagName !== 'SELECT') { + throw new Error('Element isnt of type select'); + } + return select; + }; + SlimSelect.prototype.selected = function () { + if (this.config.isMultiple) { + var selected = this.data.getSelected(); + var outputSelected = []; + for (var _i = 0, selected_1 = selected; _i < selected_1.length; _i++) { + var s = selected_1[_i]; + outputSelected.push(s.value); + } + return outputSelected; + } + else { + var selected = this.data.getSelected(); + return (selected ? selected.value : ''); + } + }; + SlimSelect.prototype.set = function (value, type, close, render) { + if (type === void 0) { type = 'value'; } + if (close === void 0) { close = true; } + if (render === void 0) { render = true; } + if (this.config.isMultiple && !Array.isArray(value)) { + this.data.addToSelected(value, type); + } + else { + this.data.setSelected(value, type); + } + this.select.setValue(); + this.data.onDataChange(); + this.render(); + if (close) { + this.close(); + } + }; + SlimSelect.prototype.setSelected = function (value, type, close, render) { + if (type === void 0) { type = 'value'; } + if (close === void 0) { close = true; } + if (render === void 0) { render = true; } + this.set(value, type, close, render); + }; + SlimSelect.prototype.setData = function (data) { + var isValid = data_1.validateData(data); + if (!isValid) { + console.error('Validation problem on: #' + this.select.element.id); + return; + } + var newData = JSON.parse(JSON.stringify(data)); + var selected = this.data.getSelected(); + if (this.config.isAjax && selected) { + if (this.config.isMultiple) { + var reverseSelected = selected.reverse(); + for (var _i = 0, reverseSelected_1 = reverseSelected; _i < reverseSelected_1.length; _i++) { + var r = reverseSelected_1[_i]; + newData.unshift(r); + } + } + else { + newData.unshift(this.data.getSelected()); + newData.unshift({ text: '', placeholder: true }); + } + } + this.select.create(newData); + this.data.parseSelectData(); + this.data.setSelectedFromSelect(); + }; + SlimSelect.prototype.addData = function (data) { + var isValid = data_1.validateData([data]); + if (!isValid) { + console.error('Validation problem on: #' + this.select.element.id); + return; + } + this.data.add(this.data.newOption(data)); + this.select.create(this.data.data); + this.data.parseSelectData(); + this.data.setSelectedFromSelect(); + this.render(); + }; + SlimSelect.prototype.open = function () { + var _this = this; + if (!this.config.isEnabled) { + return; + } + if (this.data.contentOpen) { + return; + } + if (this.beforeOpen) { + this.beforeOpen(); + } + if (this.config.isMultiple && this.slim.multiSelected) { + this.slim.multiSelected.plus.classList.add('ss-cross'); + } + else if (this.slim.singleSelected) { + this.slim.singleSelected.arrowIcon.arrow.classList.remove('arrow-down'); + this.slim.singleSelected.arrowIcon.arrow.classList.add('arrow-up'); + } + this.slim[(this.config.isMultiple ? 'multiSelected' : 'singleSelected')].container.classList.add((this.data.contentPosition === 'above' ? this.config.openAbove : this.config.openBelow)); + if (this.config.addToBody) { + var containerRect = this.slim.container.getBoundingClientRect(); + this.slim.content.style.top = (containerRect.top + containerRect.height + window.scrollY) + 'px'; + this.slim.content.style.left = (containerRect.left + window.scrollX) + 'px'; + this.slim.content.style.width = containerRect.width + 'px'; + } + this.slim.content.classList.add(this.config.open); + if (this.config.showContent.toLowerCase() === 'up') { + this.moveContentAbove(); + } + else if (this.config.showContent.toLowerCase() === 'down') { + this.moveContentBelow(); + } + else { + if (helper_1.putContent(this.slim.content, this.data.contentPosition, this.data.contentOpen) === 'above') { + this.moveContentAbove(); + } + else { + this.moveContentBelow(); + } + } + if (!this.config.isMultiple) { + var selected = this.data.getSelected(); + if (selected) { + var selectedId = selected.id; + var selectedOption = this.slim.list.querySelector('[data-id="' + selectedId + '"]'); + if (selectedOption) { + helper_1.ensureElementInView(this.slim.list, selectedOption); + } + } + } + setTimeout(function () { + _this.data.contentOpen = true; + if (_this.config.searchFocus) { + _this.slim.search.input.focus(); + } + if (_this.afterOpen) { + _this.afterOpen(); + } + }, this.config.timeoutDelay); + }; + SlimSelect.prototype.close = function () { + var _this = this; + if (!this.data.contentOpen) { + return; + } + if (this.beforeClose) { + this.beforeClose(); + } + if (this.config.isMultiple && this.slim.multiSelected) { + this.slim.multiSelected.container.classList.remove(this.config.openAbove); + this.slim.multiSelected.container.classList.remove(this.config.openBelow); + this.slim.multiSelected.plus.classList.remove('ss-cross'); + } + else if (this.slim.singleSelected) { + this.slim.singleSelected.container.classList.remove(this.config.openAbove); + this.slim.singleSelected.container.classList.remove(this.config.openBelow); + this.slim.singleSelected.arrowIcon.arrow.classList.add('arrow-down'); + this.slim.singleSelected.arrowIcon.arrow.classList.remove('arrow-up'); + } + this.slim.content.classList.remove(this.config.open); + this.data.contentOpen = false; + this.search(''); + setTimeout(function () { + _this.slim.content.removeAttribute('style'); + _this.data.contentPosition = 'below'; + if (_this.config.isMultiple && _this.slim.multiSelected) { + _this.slim.multiSelected.container.classList.remove(_this.config.openAbove); + _this.slim.multiSelected.container.classList.remove(_this.config.openBelow); + } + else if (_this.slim.singleSelected) { + _this.slim.singleSelected.container.classList.remove(_this.config.openAbove); + _this.slim.singleSelected.container.classList.remove(_this.config.openBelow); + } + _this.slim.search.input.blur(); + if (_this.afterClose) { + _this.afterClose(); + } + }, this.config.timeoutDelay); + }; + SlimSelect.prototype.moveContentAbove = function () { + var selectHeight = 0; + if (this.config.isMultiple && this.slim.multiSelected) { + selectHeight = this.slim.multiSelected.container.offsetHeight; + } + else if (this.slim.singleSelected) { + selectHeight = this.slim.singleSelected.container.offsetHeight; + } + var contentHeight = this.slim.content.offsetHeight; + var height = selectHeight + contentHeight - 1; + this.slim.content.style.margin = '-' + height + 'px 0 0 0'; + this.slim.content.style.height = (height - selectHeight + 1) + 'px'; + this.slim.content.style.transformOrigin = 'center bottom'; + this.data.contentPosition = 'above'; + if (this.config.isMultiple && this.slim.multiSelected) { + this.slim.multiSelected.container.classList.remove(this.config.openBelow); + this.slim.multiSelected.container.classList.add(this.config.openAbove); + } + else if (this.slim.singleSelected) { + this.slim.singleSelected.container.classList.remove(this.config.openBelow); + this.slim.singleSelected.container.classList.add(this.config.openAbove); + } + }; + SlimSelect.prototype.moveContentBelow = function () { + this.data.contentPosition = 'below'; + if (this.config.isMultiple && this.slim.multiSelected) { + this.slim.multiSelected.container.classList.remove(this.config.openAbove); + this.slim.multiSelected.container.classList.add(this.config.openBelow); + } + else if (this.slim.singleSelected) { + this.slim.singleSelected.container.classList.remove(this.config.openAbove); + this.slim.singleSelected.container.classList.add(this.config.openBelow); + } + }; + SlimSelect.prototype.enable = function () { + this.config.isEnabled = true; + if (this.config.isMultiple && this.slim.multiSelected) { + this.slim.multiSelected.container.classList.remove(this.config.disabled); + } + else if (this.slim.singleSelected) { + this.slim.singleSelected.container.classList.remove(this.config.disabled); + } + this.select.triggerMutationObserver = false; + this.select.element.disabled = false; + this.slim.search.input.disabled = false; + this.select.triggerMutationObserver = true; + }; + SlimSelect.prototype.disable = function () { + this.config.isEnabled = false; + if (this.config.isMultiple && this.slim.multiSelected) { + this.slim.multiSelected.container.classList.add(this.config.disabled); + } + else if (this.slim.singleSelected) { + this.slim.singleSelected.container.classList.add(this.config.disabled); + } + this.select.triggerMutationObserver = false; + this.select.element.disabled = true; + this.slim.search.input.disabled = true; + this.select.triggerMutationObserver = true; + }; + SlimSelect.prototype.search = function (value) { + if (this.data.searchValue !== value) { + this.slim.search.input.value = value; + if (this.config.isAjax) { + var master_1 = this; + this.config.isSearching = true; + this.render(); + if (this.ajax) { + this.ajax(value, function (info) { + master_1.config.isSearching = false; + if (Array.isArray(info)) { + info.unshift({ text: '', placeholder: true }); + master_1.setData(info); + master_1.data.search(value); + master_1.render(); + } + else if (typeof info === 'string') { + master_1.slim.options(info); + } + else { + master_1.render(); + } + }); + } + } + else { + this.data.search(value); + this.render(); + } + } + }; + SlimSelect.prototype.setSearchText = function (text) { + this.config.searchText = text; + }; + SlimSelect.prototype.render = function () { + if (this.config.isMultiple) { + this.slim.values(); + } + else { + this.slim.placeholder(); + this.slim.deselect(); + } + this.slim.options(); + }; + SlimSelect.prototype.destroy = function (id) { + if (id === void 0) { id = null; } + var slim = (id ? document.querySelector('.' + id + '.ss-main') : this.slim.container); + var select = (id ? document.querySelector("[data-ssid=" + id + "]") : this.select.element); + if (!slim || !select) { + return; + } + select.style.display = ''; + delete select.dataset.ssid; + var el = select; + el.slim = null; + if (slim.parentElement) { + slim.parentElement.removeChild(slim); + } + if (this.config.addToBody) { + var slimContent = (id ? document.querySelector('.' + id + '.ss-content') : this.slim.content); + if (!slimContent) { + return; + } + document.body.removeChild(slimContent); + } + }; + return SlimSelect; +}()); +exports["default"] = SlimSelect; + + +/***/ }), +/* 3 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + +exports.__esModule = true; +var Config = (function () { + function Config(info) { + this.id = ''; + this.isMultiple = false; + this.isAjax = false; + this.isSearching = false; + this.showSearch = true; + this.searchFocus = true; + this.searchHighlight = false; + this.closeOnSelect = true; + this.showContent = 'auto'; + this.searchPlaceholder = 'Search'; + this.searchText = 'No Results'; + this.searchingText = 'Searching...'; + this.placeholderText = 'Select Value'; + this.allowDeselect = false; + this.allowDeselectOption = false; + this.hideSelectedOption = false; + this.deselectLabel = 'x'; + this.isEnabled = true; + this.valuesUseText = false; + this.showOptionTooltips = false; + this.selectByGroup = false; + this.limit = 0; + this.timeoutDelay = 200; + this.addToBody = false; + this.main = 'ss-main'; + this.singleSelected = 'ss-single-selected'; + this.arrow = 'ss-arrow'; + this.multiSelected = 'ss-multi-selected'; + this.add = 'ss-add'; + this.plus = 'ss-plus'; + this.values = 'ss-values'; + this.value = 'ss-value'; + this.valueText = 'ss-value-text'; + this.valueDelete = 'ss-value-delete'; + this.content = 'ss-content'; + this.open = 'ss-open'; + this.openAbove = 'ss-open-above'; + this.openBelow = 'ss-open-below'; + this.search = 'ss-search'; + this.searchHighlighter = 'ss-search-highlight'; + this.addable = 'ss-addable'; + this.list = 'ss-list'; + this.optgroup = 'ss-optgroup'; + this.optgroupLabel = 'ss-optgroup-label'; + this.optgroupLabelSelectable = 'ss-optgroup-label-selectable'; + this.option = 'ss-option'; + this.optionSelected = 'ss-option-selected'; + this.highlighted = 'ss-highlighted'; + this.disabled = 'ss-disabled'; + this.hide = 'ss-hide'; + this.id = 'ss-' + Math.floor(Math.random() * 100000); + this.style = info.select.style.cssText; + this["class"] = info.select.className.split(' '); + this.isMultiple = info.select.multiple; + this.isAjax = info.isAjax; + this.showSearch = (info.showSearch === false ? false : true); + this.searchFocus = (info.searchFocus === false ? false : true); + this.searchHighlight = (info.searchHighlight === true ? true : false); + this.closeOnSelect = (info.closeOnSelect === false ? false : true); + if (info.showContent) { + this.showContent = info.showContent; + } + this.isEnabled = (info.isEnabled === false ? false : true); + if (info.searchPlaceholder) { + this.searchPlaceholder = info.searchPlaceholder; + } + if (info.searchText) { + this.searchText = info.searchText; + } + if (info.searchingText) { + this.searchingText = info.searchingText; + } + if (info.placeholderText) { + this.placeholderText = info.placeholderText; + } + this.allowDeselect = (info.allowDeselect === true ? true : false); + this.allowDeselectOption = (info.allowDeselectOption === true ? true : false); + this.hideSelectedOption = (info.hideSelectedOption === true ? true : false); + if (info.deselectLabel) { + this.deselectLabel = info.deselectLabel; + } + if (info.valuesUseText) { + this.valuesUseText = info.valuesUseText; + } + if (info.showOptionTooltips) { + this.showOptionTooltips = info.showOptionTooltips; + } + if (info.selectByGroup) { + this.selectByGroup = info.selectByGroup; + } + if (info.limit) { + this.limit = info.limit; + } + if (info.searchFilter) { + this.searchFilter = info.searchFilter; + } + if (info.timeoutDelay != null) { + this.timeoutDelay = info.timeoutDelay; + } + this.addToBody = (info.addToBody === true ? true : false); + } + Config.prototype.searchFilter = function (opt, search) { + return opt.text.toLowerCase().indexOf(search.toLowerCase()) !== -1; + }; + return Config; +}()); +exports.Config = Config; + + +/***/ }), +/* 4 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + +exports.__esModule = true; +var helper_1 = __webpack_require__(0); +var Select = (function () { + function Select(info) { + this.triggerMutationObserver = true; + this.element = info.select; + this.main = info.main; + if (this.element.disabled) { + this.main.config.isEnabled = false; + } + this.addAttributes(); + this.addEventListeners(); + this.mutationObserver = null; + this.addMutationObserver(); + var el = this.element; + el.slim = info.main; + } + Select.prototype.setValue = function () { + if (!this.main.data.getSelected()) { + return; + } + if (this.main.config.isMultiple) { + var selected = this.main.data.getSelected(); + var options = this.element.options; + for (var _i = 0, options_1 = options; _i < options_1.length; _i++) { + var o = options_1[_i]; + o.selected = false; + for (var _a = 0, selected_1 = selected; _a < selected_1.length; _a++) { + var s = selected_1[_a]; + if (s.value === o.value) { + o.selected = true; + } + } + } + } + else { + var selected = this.main.data.getSelected(); + this.element.value = (selected ? selected.value : ''); + } + this.main.data.isOnChangeEnabled = false; + this.element.dispatchEvent(new CustomEvent('change', { bubbles: true })); + this.main.data.isOnChangeEnabled = true; + }; + Select.prototype.addAttributes = function () { + this.element.tabIndex = -1; + this.element.style.display = 'none'; + this.element.dataset.ssid = this.main.config.id; + }; + Select.prototype.addEventListeners = function () { + var _this = this; + this.element.addEventListener('change', function (e) { + _this.main.data.setSelectedFromSelect(); + _this.main.render(); + }); + }; + Select.prototype.addMutationObserver = function () { + var _this = this; + if (this.main.config.isAjax) { + return; + } + this.mutationObserver = new MutationObserver(function (mutations) { + if (!_this.triggerMutationObserver) { + return; + } + _this.main.data.parseSelectData(); + _this.main.data.setSelectedFromSelect(); + _this.main.render(); + mutations.forEach(function (mutation) { + if (mutation.attributeName === 'class') { + _this.main.slim.updateContainerDivClass(_this.main.slim.container); + } + }); + }); + this.observeMutationObserver(); + }; + Select.prototype.observeMutationObserver = function () { + if (!this.mutationObserver) { + return; + } + this.mutationObserver.observe(this.element, { + attributes: true, + childList: true, + characterData: true + }); + }; + Select.prototype.disconnectMutationObserver = function () { + if (this.mutationObserver) { + this.mutationObserver.disconnect(); + } + }; + Select.prototype.create = function (data) { + this.element.innerHTML = ''; + for (var _i = 0, data_1 = data; _i < data_1.length; _i++) { + var d = data_1[_i]; + if (d.hasOwnProperty('options')) { + var optgroupObject = d; + var optgroupEl = document.createElement('optgroup'); + optgroupEl.label = optgroupObject.label; + if (optgroupObject.options) { + for (var _a = 0, _b = optgroupObject.options; _a < _b.length; _a++) { + var oo = _b[_a]; + optgroupEl.appendChild(this.createOption(oo)); + } + } + this.element.appendChild(optgroupEl); + } + else { + this.element.appendChild(this.createOption(d)); + } + } + }; + Select.prototype.createOption = function (info) { + var optionEl = document.createElement('option'); + optionEl.value = info.value !== '' ? info.value : info.text; + optionEl.innerHTML = info.innerHTML || info.text; + if (info.selected) { + optionEl.selected = info.selected; + } + if (info.display === false) { + optionEl.style.display = 'none'; + } + if (info.disabled) { + optionEl.disabled = true; + } + if (info.placeholder) { + optionEl.setAttribute('data-placeholder', 'true'); + } + if (info.mandatory) { + optionEl.setAttribute('data-mandatory', 'true'); + } + if (info["class"]) { + info["class"].split(' ').forEach(function (optionClass) { + optionEl.classList.add(optionClass); + }); + } + if (info.data && typeof info.data === 'object') { + Object.keys(info.data).forEach(function (key) { + optionEl.setAttribute('data-' + helper_1.kebabCase(key), info.data[key]); + }); + } + return optionEl; + }; + return Select; +}()); +exports.Select = Select; + + +/***/ }), +/* 5 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + +exports.__esModule = true; +var helper_1 = __webpack_require__(0); +var data_1 = __webpack_require__(1); +var Slim = (function () { + function Slim(info) { + this.main = info.main; + this.container = this.containerDiv(); + this.content = this.contentDiv(); + this.search = this.searchDiv(); + this.list = this.listDiv(); + this.options(); + this.singleSelected = null; + this.multiSelected = null; + if (this.main.config.isMultiple) { + this.multiSelected = this.multiSelectedDiv(); + if (this.multiSelected) { + this.container.appendChild(this.multiSelected.container); + } + } + else { + this.singleSelected = this.singleSelectedDiv(); + this.container.appendChild(this.singleSelected.container); + } + if (this.main.config.addToBody) { + this.content.classList.add(this.main.config.id); + document.body.appendChild(this.content); + } + else { + this.container.appendChild(this.content); + } + this.content.appendChild(this.search.container); + this.content.appendChild(this.list); + } + Slim.prototype.containerDiv = function () { + var container = document.createElement('div'); + container.style.cssText = this.main.config.style; + this.updateContainerDivClass(container); + return container; + }; + Slim.prototype.updateContainerDivClass = function (container) { + this.main.config["class"] = this.main.select.element.className.split(' '); + container.className = ''; + container.classList.add(this.main.config.id); + container.classList.add(this.main.config.main); + for (var _i = 0, _a = this.main.config["class"]; _i < _a.length; _i++) { + var c = _a[_i]; + if (c.trim() !== '') { + container.classList.add(c); + } + } + }; + Slim.prototype.singleSelectedDiv = function () { + var _this = this; + var container = document.createElement('div'); + container.classList.add(this.main.config.singleSelected); + var placeholder = document.createElement('span'); + placeholder.classList.add('placeholder'); + container.appendChild(placeholder); + var deselect = document.createElement('span'); + deselect.innerHTML = this.main.config.deselectLabel; + deselect.classList.add('ss-deselect'); + deselect.onclick = function (e) { + e.stopPropagation(); + if (!_this.main.config.isEnabled) { + return; + } + _this.main.set(''); + }; + container.appendChild(deselect); + var arrowContainer = document.createElement('span'); + arrowContainer.classList.add(this.main.config.arrow); + var arrowIcon = document.createElement('span'); + arrowIcon.classList.add('arrow-down'); + arrowContainer.appendChild(arrowIcon); + container.appendChild(arrowContainer); + container.onclick = function () { + if (!_this.main.config.isEnabled) { + return; + } + _this.main.data.contentOpen ? _this.main.close() : _this.main.open(); + }; + return { + container: container, + placeholder: placeholder, + deselect: deselect, + arrowIcon: { + container: arrowContainer, + arrow: arrowIcon + } + }; + }; + Slim.prototype.placeholder = function () { + var selected = this.main.data.getSelected(); + if (selected === null || (selected && selected.placeholder)) { + var placeholder = document.createElement('span'); + placeholder.classList.add(this.main.config.disabled); + placeholder.innerHTML = this.main.config.placeholderText; + if (this.singleSelected) { + this.singleSelected.placeholder.innerHTML = placeholder.outerHTML; + } + } + else { + var selectedValue = ''; + if (selected) { + selectedValue = selected.innerHTML && this.main.config.valuesUseText !== true ? selected.innerHTML : selected.text; + } + if (this.singleSelected) { + this.singleSelected.placeholder.innerHTML = (selected ? selectedValue : ''); + } + } + }; + Slim.prototype.deselect = function () { + if (this.singleSelected) { + if (!this.main.config.allowDeselect) { + this.singleSelected.deselect.classList.add('ss-hide'); + return; + } + if (this.main.selected() === '') { + this.singleSelected.deselect.classList.add('ss-hide'); + } + else { + this.singleSelected.deselect.classList.remove('ss-hide'); + } + } + }; + Slim.prototype.multiSelectedDiv = function () { + var _this = this; + var container = document.createElement('div'); + container.classList.add(this.main.config.multiSelected); + var values = document.createElement('div'); + values.classList.add(this.main.config.values); + container.appendChild(values); + var add = document.createElement('div'); + add.classList.add(this.main.config.add); + var plus = document.createElement('span'); + plus.classList.add(this.main.config.plus); + plus.onclick = function (e) { + if (_this.main.data.contentOpen) { + _this.main.close(); + e.stopPropagation(); + } + }; + add.appendChild(plus); + container.appendChild(add); + container.onclick = function (e) { + if (!_this.main.config.isEnabled) { + return; + } + var target = e.target; + if (!target.classList.contains(_this.main.config.valueDelete)) { + _this.main.data.contentOpen ? _this.main.close() : _this.main.open(); + } + }; + return { + container: container, + values: values, + add: add, + plus: plus + }; + }; + Slim.prototype.values = function () { + if (!this.multiSelected) { + return; + } + var currentNodes = this.multiSelected.values.childNodes; + var selected = this.main.data.getSelected(); + var exists; + var nodesToRemove = []; + for (var _i = 0, currentNodes_1 = currentNodes; _i < currentNodes_1.length; _i++) { + var c = currentNodes_1[_i]; + exists = true; + for (var _a = 0, selected_1 = selected; _a < selected_1.length; _a++) { + var s = selected_1[_a]; + if (String(s.id) === String(c.dataset.id)) { + exists = false; + } + } + if (exists) { + nodesToRemove.push(c); + } + } + for (var _b = 0, nodesToRemove_1 = nodesToRemove; _b < nodesToRemove_1.length; _b++) { + var n = nodesToRemove_1[_b]; + n.classList.add('ss-out'); + this.multiSelected.values.removeChild(n); + } + currentNodes = this.multiSelected.values.childNodes; + for (var s = 0; s < selected.length; s++) { + exists = false; + for (var _c = 0, currentNodes_2 = currentNodes; _c < currentNodes_2.length; _c++) { + var c = currentNodes_2[_c]; + if (String(selected[s].id) === String(c.dataset.id)) { + exists = true; + } + } + if (!exists) { + if (currentNodes.length === 0 || !HTMLElement.prototype.insertAdjacentElement) { + this.multiSelected.values.appendChild(this.valueDiv(selected[s])); + } + else if (s === 0) { + this.multiSelected.values.insertBefore(this.valueDiv(selected[s]), currentNodes[s]); + } + else { + currentNodes[s - 1].insertAdjacentElement('afterend', this.valueDiv(selected[s])); + } + } + } + if (selected.length === 0) { + var placeholder = document.createElement('span'); + placeholder.classList.add(this.main.config.disabled); + placeholder.innerHTML = this.main.config.placeholderText; + this.multiSelected.values.innerHTML = placeholder.outerHTML; + } + }; + Slim.prototype.valueDiv = function (optionObj) { + var _this = this; + var value = document.createElement('div'); + value.classList.add(this.main.config.value); + value.dataset.id = optionObj.id; + var text = document.createElement('span'); + text.classList.add(this.main.config.valueText); + text.innerHTML = (optionObj.innerHTML && this.main.config.valuesUseText !== true ? optionObj.innerHTML : optionObj.text); + value.appendChild(text); + if (!optionObj.mandatory) { + var deleteSpan = document.createElement('span'); + deleteSpan.classList.add(this.main.config.valueDelete); + deleteSpan.innerHTML = this.main.config.deselectLabel; + deleteSpan.onclick = function (e) { + e.preventDefault(); + e.stopPropagation(); + var shouldUpdate = false; + if (!_this.main.beforeOnChange) { + shouldUpdate = true; + } + if (_this.main.beforeOnChange) { + var selected = _this.main.data.getSelected(); + var currentValues = JSON.parse(JSON.stringify(selected)); + for (var i = 0; i < currentValues.length; i++) { + if (currentValues[i].id === optionObj.id) { + currentValues.splice(i, 1); + } + } + var beforeOnchange = _this.main.beforeOnChange(currentValues); + if (beforeOnchange !== false) { + shouldUpdate = true; + } + } + if (shouldUpdate) { + _this.main.data.removeFromSelected(optionObj.id, 'id'); + _this.main.render(); + _this.main.select.setValue(); + _this.main.data.onDataChange(); + } + }; + value.appendChild(deleteSpan); + } + return value; + }; + Slim.prototype.contentDiv = function () { + var container = document.createElement('div'); + container.classList.add(this.main.config.content); + return container; + }; + Slim.prototype.searchDiv = function () { + var _this = this; + var container = document.createElement('div'); + var input = document.createElement('input'); + var addable = document.createElement('div'); + container.classList.add(this.main.config.search); + var searchReturn = { + container: container, + input: input + }; + if (!this.main.config.showSearch) { + container.classList.add(this.main.config.hide); + input.readOnly = true; + } + input.type = 'search'; + input.placeholder = this.main.config.searchPlaceholder; + input.tabIndex = 0; + input.setAttribute('aria-label', this.main.config.searchPlaceholder); + input.setAttribute('autocapitalize', 'off'); + input.setAttribute('autocomplete', 'off'); + input.setAttribute('autocorrect', 'off'); + input.onclick = function (e) { + setTimeout(function () { + var target = e.target; + if (target.value === '') { + _this.main.search(''); + } + }, 10); + }; + input.onkeydown = function (e) { + if (e.key === 'ArrowUp') { + _this.main.open(); + _this.highlightUp(); + e.preventDefault(); + } + else if (e.key === 'ArrowDown') { + _this.main.open(); + _this.highlightDown(); + e.preventDefault(); + } + else if (e.key === 'Tab') { + if (!_this.main.data.contentOpen) { + setTimeout(function () { _this.main.close(); }, _this.main.config.timeoutDelay); + } + else { + _this.main.close(); + } + } + else if (e.key === 'Enter') { + e.preventDefault(); + } + }; + input.onkeyup = function (e) { + var target = e.target; + if (e.key === 'Enter') { + if (_this.main.addable && e.ctrlKey) { + addable.click(); + e.preventDefault(); + e.stopPropagation(); + return; + } + var highlighted = _this.list.querySelector('.' + _this.main.config.highlighted); + if (highlighted) { + highlighted.click(); + } + } + else if (e.key === 'ArrowUp' || e.key === 'ArrowDown') { + } + else if (e.key === 'Escape') { + _this.main.close(); + } + else { + if (_this.main.config.showSearch && _this.main.data.contentOpen) { + _this.main.search(target.value); + } + else { + input.value = ''; + } + } + e.preventDefault(); + e.stopPropagation(); + }; + input.onfocus = function () { _this.main.open(); }; + container.appendChild(input); + if (this.main.addable) { + addable.classList.add(this.main.config.addable); + addable.innerHTML = '+'; + addable.onclick = function (e) { + if (_this.main.addable) { + e.preventDefault(); + e.stopPropagation(); + var inputValue = _this.search.input.value; + if (inputValue.trim() === '') { + _this.search.input.focus(); + return; + } + var addableValue = _this.main.addable(inputValue); + var addableValueStr_1 = ''; + if (!addableValue) { + return; + } + if (typeof addableValue === 'object') { + var validValue = data_1.validateOption(addableValue); + if (validValue) { + _this.main.addData(addableValue); + addableValueStr_1 = (addableValue.value ? addableValue.value : addableValue.text); + } + } + else { + _this.main.addData(_this.main.data.newOption({ + text: addableValue, + value: addableValue + })); + addableValueStr_1 = addableValue; + } + _this.main.search(''); + setTimeout(function () { + _this.main.set(addableValueStr_1, 'value', false, false); + }, 100); + if (_this.main.config.closeOnSelect) { + setTimeout(function () { + _this.main.close(); + }, 100); + } + } + }; + container.appendChild(addable); + searchReturn.addable = addable; + } + return searchReturn; + }; + Slim.prototype.highlightUp = function () { + var highlighted = this.list.querySelector('.' + this.main.config.highlighted); + var prev = null; + if (highlighted) { + prev = highlighted.previousSibling; + while (prev !== null) { + if (prev.classList.contains(this.main.config.disabled)) { + prev = prev.previousSibling; + continue; + } + else { + break; + } + } + } + else { + var allOptions = this.list.querySelectorAll('.' + this.main.config.option + ':not(.' + this.main.config.disabled + ')'); + prev = allOptions[allOptions.length - 1]; + } + if (prev && prev.classList.contains(this.main.config.optgroupLabel)) { + prev = null; + } + if (prev === null) { + var parent_1 = highlighted.parentNode; + if (parent_1.classList.contains(this.main.config.optgroup)) { + if (parent_1.previousSibling) { + var prevNodes = parent_1.previousSibling.querySelectorAll('.' + this.main.config.option + ':not(.' + this.main.config.disabled + ')'); + if (prevNodes.length) { + prev = prevNodes[prevNodes.length - 1]; + } + } + } + } + if (prev) { + if (highlighted) { + highlighted.classList.remove(this.main.config.highlighted); + } + prev.classList.add(this.main.config.highlighted); + helper_1.ensureElementInView(this.list, prev); + } + }; + Slim.prototype.highlightDown = function () { + var highlighted = this.list.querySelector('.' + this.main.config.highlighted); + var next = null; + if (highlighted) { + next = highlighted.nextSibling; + while (next !== null) { + if (next.classList.contains(this.main.config.disabled)) { + next = next.nextSibling; + continue; + } + else { + break; + } + } + } + else { + next = this.list.querySelector('.' + this.main.config.option + ':not(.' + this.main.config.disabled + ')'); + } + if (next === null && highlighted !== null) { + var parent_2 = highlighted.parentNode; + if (parent_2.classList.contains(this.main.config.optgroup)) { + if (parent_2.nextSibling) { + var sibling = parent_2.nextSibling; + next = sibling.querySelector('.' + this.main.config.option + ':not(.' + this.main.config.disabled + ')'); + } + } + } + if (next) { + if (highlighted) { + highlighted.classList.remove(this.main.config.highlighted); + } + next.classList.add(this.main.config.highlighted); + helper_1.ensureElementInView(this.list, next); + } + }; + Slim.prototype.listDiv = function () { + var list = document.createElement('div'); + list.classList.add(this.main.config.list); + return list; + }; + Slim.prototype.options = function (content) { + if (content === void 0) { content = ''; } + var data = this.main.data.filtered || this.main.data.data; + this.list.innerHTML = ''; + if (content !== '') { + var searching = document.createElement('div'); + searching.classList.add(this.main.config.option); + searching.classList.add(this.main.config.disabled); + searching.innerHTML = content; + this.list.appendChild(searching); + return; + } + if (this.main.config.isAjax && this.main.config.isSearching) { + var searching = document.createElement('div'); + searching.classList.add(this.main.config.option); + searching.classList.add(this.main.config.disabled); + searching.innerHTML = this.main.config.searchingText; + this.list.appendChild(searching); + return; + } + if (data.length === 0) { + var noResults = document.createElement('div'); + noResults.classList.add(this.main.config.option); + noResults.classList.add(this.main.config.disabled); + noResults.innerHTML = this.main.config.searchText; + this.list.appendChild(noResults); + return; + } + var _loop_1 = function (d) { + if (d.hasOwnProperty('label')) { + var item = d; + var optgroupEl_1 = document.createElement('div'); + optgroupEl_1.classList.add(this_1.main.config.optgroup); + var optgroupLabel = document.createElement('div'); + optgroupLabel.classList.add(this_1.main.config.optgroupLabel); + if (this_1.main.config.selectByGroup && this_1.main.config.isMultiple) { + optgroupLabel.classList.add(this_1.main.config.optgroupLabelSelectable); + } + optgroupLabel.innerHTML = item.label; + optgroupEl_1.appendChild(optgroupLabel); + var options = item.options; + if (options) { + for (var _i = 0, options_1 = options; _i < options_1.length; _i++) { + var o = options_1[_i]; + optgroupEl_1.appendChild(this_1.option(o)); + } + if (this_1.main.config.selectByGroup && this_1.main.config.isMultiple) { + var master_1 = this_1; + optgroupLabel.addEventListener('click', function (e) { + e.preventDefault(); + e.stopPropagation(); + for (var _i = 0, _a = optgroupEl_1.children; _i < _a.length; _i++) { + var childEl = _a[_i]; + if (childEl.className.indexOf(master_1.main.config.option) !== -1) { + childEl.click(); + } + } + }); + } + } + this_1.list.appendChild(optgroupEl_1); + } + else { + this_1.list.appendChild(this_1.option(d)); + } + }; + var this_1 = this; + for (var _i = 0, data_2 = data; _i < data_2.length; _i++) { + var d = data_2[_i]; + _loop_1(d); + } + }; + Slim.prototype.option = function (data) { + if (data.placeholder) { + var placeholder = document.createElement('div'); + placeholder.classList.add(this.main.config.option); + placeholder.classList.add(this.main.config.hide); + return placeholder; + } + var optionEl = document.createElement('div'); + optionEl.classList.add(this.main.config.option); + if (data["class"]) { + data["class"].split(' ').forEach(function (dataClass) { + optionEl.classList.add(dataClass); + }); + } + if (data.style) { + optionEl.style.cssText = data.style; + } + var selected = this.main.data.getSelected(); + optionEl.dataset.id = data.id; + if (this.main.config.searchHighlight && this.main.slim && data.innerHTML && this.main.slim.search.input.value.trim() !== '') { + optionEl.innerHTML = helper_1.highlight(data.innerHTML, this.main.slim.search.input.value, this.main.config.searchHighlighter); + } + else if (data.innerHTML) { + optionEl.innerHTML = data.innerHTML; + } + if (this.main.config.showOptionTooltips && optionEl.textContent) { + optionEl.setAttribute('title', optionEl.textContent); + } + var master = this; + optionEl.addEventListener('click', function (e) { + e.preventDefault(); + e.stopPropagation(); + var element = this; + var elementID = element.dataset.id; + if (data.selected === true && master.main.config.allowDeselectOption) { + var shouldUpdate = false; + if (!master.main.beforeOnChange || !master.main.config.isMultiple) { + shouldUpdate = true; + } + if (master.main.beforeOnChange && master.main.config.isMultiple) { + var selectedValues = master.main.data.getSelected(); + var currentValues = JSON.parse(JSON.stringify(selectedValues)); + for (var i = 0; i < currentValues.length; i++) { + if (currentValues[i].id === elementID) { + currentValues.splice(i, 1); + } + } + var beforeOnchange = master.main.beforeOnChange(currentValues); + if (beforeOnchange !== false) { + shouldUpdate = true; + } + } + if (shouldUpdate) { + if (master.main.config.isMultiple) { + master.main.data.removeFromSelected(elementID, 'id'); + master.main.render(); + master.main.select.setValue(); + master.main.data.onDataChange(); + } + else { + master.main.set(''); + } + } + } + else { + if (data.disabled || data.selected) { + return; + } + if (master.main.config.limit && Array.isArray(selected) && master.main.config.limit <= selected.length) { + return; + } + if (master.main.beforeOnChange) { + var value = void 0; + var objectInfo = JSON.parse(JSON.stringify(master.main.data.getObjectFromData(elementID))); + objectInfo.selected = true; + if (master.main.config.isMultiple) { + value = JSON.parse(JSON.stringify(selected)); + value.push(objectInfo); + } + else { + value = JSON.parse(JSON.stringify(objectInfo)); + } + var beforeOnchange = master.main.beforeOnChange(value); + if (beforeOnchange !== false) { + master.main.set(elementID, 'id', master.main.config.closeOnSelect); + } + } + else { + master.main.set(elementID, 'id', master.main.config.closeOnSelect); + } + } + }); + var isSelected = selected && helper_1.isValueInArrayOfObjects(selected, 'id', data.id); + if (data.disabled || isSelected) { + optionEl.onclick = null; + if (!master.main.config.allowDeselectOption) { + optionEl.classList.add(this.main.config.disabled); + } + if (master.main.config.hideSelectedOption) { + optionEl.classList.add(this.main.config.hide); + } + } + if (isSelected) { + optionEl.classList.add(this.main.config.optionSelected); + } + else { + optionEl.classList.remove(this.main.config.optionSelected); + } + return optionEl; + }; + return Slim; +}()); +exports.Slim = Slim; + + +/***/ }) +/******/ ])["default"]; +}); \ No newline at end of file diff --git a/admin/js/vendors/tabulator/css/tabulator.css b/admin/js/vendors/tabulator/css/tabulator.css new file mode 100644 index 0000000..ec3b42a --- /dev/null +++ b/admin/js/vendors/tabulator/css/tabulator.css @@ -0,0 +1,995 @@ +/* Tabulator v4.7.0 (c) Oliver Folkerd */ +.tabulator { + position: relative; + border: 1px solid #999; + background-color: #888; + font-size: 14px; + text-align: left; + overflow: hidden; + -ms-transform: translatez(0); + transform: translatez(0); +} + +.tabulator[tabulator-layout="fitDataFill"] .tabulator-tableHolder .tabulator-table { + min-width: 100%; +} + +.tabulator[tabulator-layout="fitDataTable"] { + display: inline-block; +} + +.tabulator.tabulator-block-select { + -webkit-user-select: none; + -ms-user-select: none; + user-select: none; +} + +.tabulator .tabulator-header { + position: relative; + box-sizing: border-box; + width: 100%; + border-bottom: 1px solid #999; + background-color: #e6e6e6; + color: #555; + font-weight: bold; + white-space: nowrap; + overflow: hidden; + -moz-user-select: none; + -khtml-user-select: none; + -webkit-user-select: none; + -o-user-select: none; +} + +.tabulator .tabulator-header.tabulator-header-hidden { + display: none; +} + +.tabulator .tabulator-header .tabulator-col { + display: inline-block; + position: relative; + box-sizing: border-box; + border-right: 1px solid #aaa; + background: #e6e6e6; + text-align: left; + vertical-align: bottom; + overflow: hidden; +} + +.tabulator .tabulator-header .tabulator-col.tabulator-moving { + position: absolute; + border: 1px solid #999; + background: #cdcdcd; + pointer-events: none; +} + +.tabulator .tabulator-header .tabulator-col .tabulator-col-content { + box-sizing: border-box; + position: relative; + padding: 4px; +} + +.tabulator .tabulator-header .tabulator-col .tabulator-col-content .tabulator-header-menu-button { + padding: 0 8px; +} + +.tabulator .tabulator-header .tabulator-col .tabulator-col-content .tabulator-header-menu-button:hover { + cursor: pointer; + opacity: .6; +} + +.tabulator .tabulator-header .tabulator-col .tabulator-col-content .tabulator-col-title { + box-sizing: border-box; + width: 100%; + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; + vertical-align: bottom; +} + +.tabulator .tabulator-header .tabulator-col .tabulator-col-content .tabulator-col-title .tabulator-title-editor { + box-sizing: border-box; + width: 100%; + border: 1px solid #999; + padding: 1px; + background: #fff; +} + +.tabulator .tabulator-header .tabulator-col .tabulator-col-content .tabulator-arrow { + display: inline-block; + position: absolute; + top: 9px; + right: 8px; + width: 0; + height: 0; + border-left: 6px solid transparent; + border-right: 6px solid transparent; + border-bottom: 6px solid #bbb; +} + +.tabulator .tabulator-header .tabulator-col.tabulator-col-group .tabulator-col-group-cols { + position: relative; + display: -ms-flexbox; + display: flex; + border-top: 1px solid #aaa; + overflow: hidden; + margin-right: -1px; +} + +.tabulator .tabulator-header .tabulator-col:first-child .tabulator-col-resize-handle.prev { + display: none; +} + +.tabulator .tabulator-header .tabulator-col .tabulator-header-filter { + position: relative; + box-sizing: border-box; + margin-top: 2px; + width: 100%; + text-align: center; +} + +.tabulator .tabulator-header .tabulator-col .tabulator-header-filter textarea { + height: auto !important; +} + +.tabulator .tabulator-header .tabulator-col .tabulator-header-filter svg { + margin-top: 3px; +} + +.tabulator .tabulator-header .tabulator-col .tabulator-header-filter input::-ms-clear { + width: 0; + height: 0; +} + +.tabulator .tabulator-header .tabulator-col.tabulator-sortable .tabulator-col-title { + padding-right: 25px; +} + +.tabulator .tabulator-header .tabulator-col.tabulator-sortable:hover { + cursor: pointer; + background-color: #cdcdcd; +} + +.tabulator .tabulator-header .tabulator-col.tabulator-sortable[aria-sort="none"] .tabulator-col-content .tabulator-arrow { + border-top: none; + border-bottom: 6px solid #bbb; +} + +.tabulator .tabulator-header .tabulator-col.tabulator-sortable[aria-sort="asc"] .tabulator-col-content .tabulator-arrow { + border-top: none; + border-bottom: 6px solid #666; +} + +.tabulator .tabulator-header .tabulator-col.tabulator-sortable[aria-sort="desc"] .tabulator-col-content .tabulator-arrow { + border-top: 6px solid #666; + border-bottom: none; +} + +.tabulator .tabulator-header .tabulator-col.tabulator-col-vertical .tabulator-col-content .tabulator-col-title { + -ms-writing-mode: tb-rl; + writing-mode: vertical-rl; + text-orientation: mixed; + display: -ms-flexbox; + display: flex; + -ms-flex-align: center; + align-items: center; + -ms-flex-pack: center; + justify-content: center; +} + +.tabulator .tabulator-header .tabulator-col.tabulator-col-vertical.tabulator-col-vertical-flip .tabulator-col-title { + -ms-transform: rotate(180deg); + transform: rotate(180deg); +} + +.tabulator .tabulator-header .tabulator-col.tabulator-col-vertical.tabulator-sortable .tabulator-col-title { + padding-right: 0; + padding-top: 20px; +} + +.tabulator .tabulator-header .tabulator-col.tabulator-col-vertical.tabulator-sortable.tabulator-col-vertical-flip .tabulator-col-title { + padding-right: 0; + padding-bottom: 20px; +} + +.tabulator .tabulator-header .tabulator-col.tabulator-col-vertical.tabulator-sortable .tabulator-arrow { + right: calc(50% - 6px); +} + +.tabulator .tabulator-header .tabulator-frozen { + display: inline-block; + position: absolute; + z-index: 10; +} + +.tabulator .tabulator-header .tabulator-frozen.tabulator-frozen-left { + border-right: 2px solid #aaa; +} + +.tabulator .tabulator-header .tabulator-frozen.tabulator-frozen-right { + border-left: 2px solid #aaa; +} + +.tabulator .tabulator-header .tabulator-calcs-holder { + box-sizing: border-box; + min-width: 600%; + background: #f3f3f3 !important; + border-top: 1px solid #aaa; + border-bottom: 1px solid #aaa; + overflow: hidden; +} + +.tabulator .tabulator-header .tabulator-calcs-holder .tabulator-row { + background: #f3f3f3 !important; +} + +.tabulator .tabulator-header .tabulator-calcs-holder .tabulator-row .tabulator-col-resize-handle { + display: none; +} + +.tabulator .tabulator-header .tabulator-frozen-rows-holder { + min-width: 600%; +} + +.tabulator .tabulator-header .tabulator-frozen-rows-holder:empty { + display: none; +} + +.tabulator .tabulator-tableHolder { + position: relative; + width: 100%; + white-space: nowrap; + overflow: auto; + -webkit-overflow-scrolling: touch; +} + +.tabulator .tabulator-tableHolder:focus { + outline: none; +} + +.tabulator .tabulator-tableHolder .tabulator-placeholder { + box-sizing: border-box; + display: -ms-flexbox; + display: flex; + -ms-flex-align: center; + align-items: center; + width: 100%; +} + +.tabulator .tabulator-tableHolder .tabulator-placeholder[tabulator-render-mode="virtual"] { + min-height: 100%; + min-width: 100%; +} + +.tabulator .tabulator-tableHolder .tabulator-placeholder span { + display: inline-block; + margin: 0 auto; + padding: 10px; + color: #ccc; + font-weight: bold; + font-size: 20px; +} + +.tabulator .tabulator-tableHolder .tabulator-table { + position: relative; + display: inline-block; + background-color: #fff; + white-space: nowrap; + overflow: visible; + color: #333; +} + +.tabulator .tabulator-tableHolder .tabulator-table .tabulator-row.tabulator-calcs { + font-weight: bold; + background: #e2e2e2 !important; +} + +.tabulator .tabulator-tableHolder .tabulator-table .tabulator-row.tabulator-calcs.tabulator-calcs-top { + border-bottom: 2px solid #aaa; +} + +.tabulator .tabulator-tableHolder .tabulator-table .tabulator-row.tabulator-calcs.tabulator-calcs-bottom { + border-top: 2px solid #aaa; +} + +.tabulator .tabulator-footer { + padding: 5px 10px; + border-top: 1px solid #999; + background-color: #e6e6e6; + text-align: right; + color: #555; + font-weight: bold; + white-space: nowrap; + -ms-user-select: none; + user-select: none; + -moz-user-select: none; + -khtml-user-select: none; + -webkit-user-select: none; + -o-user-select: none; +} + +.tabulator .tabulator-footer .tabulator-calcs-holder { + box-sizing: border-box; + width: calc(100% + 20px); + margin: -5px -10px 5px -10px; + text-align: left; + background: #f3f3f3 !important; + border-bottom: 1px solid #aaa; + border-top: 1px solid #aaa; + overflow: hidden; +} + +.tabulator .tabulator-footer .tabulator-calcs-holder .tabulator-row { + background: #f3f3f3 !important; +} + +.tabulator .tabulator-footer .tabulator-calcs-holder .tabulator-row .tabulator-col-resize-handle { + display: none; +} + +.tabulator .tabulator-footer .tabulator-calcs-holder:only-child { + margin-bottom: -5px; + border-bottom: none; +} + +.tabulator .tabulator-footer .tabulator-paginator { + color: #555; + font-family: inherit; + font-weight: inherit; + font-size: inherit; +} + +.tabulator .tabulator-footer .tabulator-page-size { + display: inline-block; + margin: 0 5px; + padding: 2px 5px; + border: 1px solid #aaa; + border-radius: 3px; +} + +.tabulator .tabulator-footer .tabulator-pages { + margin: 0 7px; +} + +.tabulator .tabulator-footer .tabulator-page { + display: inline-block; + margin: 0 2px; + padding: 2px 5px; + border: 1px solid #aaa; + border-radius: 3px; + background: rgba(255, 255, 255, 0.2); +} + +.tabulator .tabulator-footer .tabulator-page.active { + color: #d00; +} + +.tabulator .tabulator-footer .tabulator-page:disabled { + opacity: .5; +} + +.tabulator .tabulator-footer .tabulator-page:not(.disabled):hover { + cursor: pointer; + background: rgba(0, 0, 0, 0.2); + color: #fff; +} + +.tabulator .tabulator-col-resize-handle { + position: absolute; + right: 0; + top: 0; + bottom: 0; + width: 5px; +} + +.tabulator .tabulator-col-resize-handle.prev { + left: 0; + right: auto; +} + +.tabulator .tabulator-col-resize-handle:hover { + cursor: ew-resize; +} + +.tabulator .tabulator-loader { + position: absolute; + display: -ms-flexbox; + display: flex; + -ms-flex-align: center; + align-items: center; + top: 0; + left: 0; + z-index: 100; + height: 100%; + width: 100%; + background: rgba(0, 0, 0, 0.4); + text-align: center; +} + +.tabulator .tabulator-loader .tabulator-loader-msg { + display: inline-block; + margin: 0 auto; + padding: 10px 20px; + border-radius: 10px; + background: #fff; + font-weight: bold; + font-size: 16px; +} + +.tabulator .tabulator-loader .tabulator-loader-msg.tabulator-loading { + border: 4px solid #333; + color: #000; +} + +.tabulator .tabulator-loader .tabulator-loader-msg.tabulator-error { + border: 4px solid #D00; + color: #590000; +} + +.tabulator-row { + position: relative; + box-sizing: border-box; + min-height: 22px; + background-color: #fff; +} + +.tabulator-row.tabulator-row-even { + background-color: #EFEFEF; +} + +.tabulator-row.tabulator-selectable:hover { + background-color: #bbb; + cursor: pointer; +} + +.tabulator-row.tabulator-selected { + background-color: #9ABCEA; +} + +.tabulator-row.tabulator-selected:hover { + background-color: #769BCC; + cursor: pointer; +} + +.tabulator-row.tabulator-row-moving { + border: 1px solid #000; + background: #fff; +} + +.tabulator-row.tabulator-moving { + position: absolute; + border-top: 1px solid #aaa; + border-bottom: 1px solid #aaa; + pointer-events: none; + z-index: 15; +} + +.tabulator-row .tabulator-row-resize-handle { + position: absolute; + right: 0; + bottom: 0; + left: 0; + height: 5px; +} + +.tabulator-row .tabulator-row-resize-handle.prev { + top: 0; + bottom: auto; +} + +.tabulator-row .tabulator-row-resize-handle:hover { + cursor: ns-resize; +} + +.tabulator-row .tabulator-frozen { + display: inline-block; + position: absolute; + background-color: inherit; + z-index: 10; +} + +.tabulator-row .tabulator-frozen.tabulator-frozen-left { + border-right: 2px solid #aaa; +} + +.tabulator-row .tabulator-frozen.tabulator-frozen-right { + border-left: 2px solid #aaa; +} + +.tabulator-row .tabulator-responsive-collapse { + box-sizing: border-box; + padding: 5px; + border-top: 1px solid #aaa; + border-bottom: 1px solid #aaa; +} + +.tabulator-row .tabulator-responsive-collapse:empty { + display: none; +} + +.tabulator-row .tabulator-responsive-collapse table { + font-size: 14px; +} + +.tabulator-row .tabulator-responsive-collapse table tr td { + position: relative; +} + +.tabulator-row .tabulator-responsive-collapse table tr td:first-of-type { + padding-right: 10px; +} + +.tabulator-row .tabulator-cell { + display: inline-block; + position: relative; + box-sizing: border-box; + padding: 4px; + border-right: 1px solid #aaa; + vertical-align: middle; + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; +} + +.tabulator-row .tabulator-cell.tabulator-editing { + border: 1px solid #1D68CD; + padding: 0; +} + +.tabulator-row .tabulator-cell.tabulator-editing input, .tabulator-row .tabulator-cell.tabulator-editing select { + border: 1px; + background: transparent; +} + +.tabulator-row .tabulator-cell.tabulator-validation-fail { + border: 1px solid #dd0000; +} + +.tabulator-row .tabulator-cell.tabulator-validation-fail input, .tabulator-row .tabulator-cell.tabulator-validation-fail select { + border: 1px; + background: transparent; + color: #dd0000; +} + +.tabulator-row .tabulator-cell:first-child .tabulator-col-resize-handle.prev { + display: none; +} + +.tabulator-row .tabulator-cell.tabulator-row-handle { + display: -ms-inline-flexbox; + display: inline-flex; + -ms-flex-align: center; + align-items: center; + -ms-flex-pack: center; + justify-content: center; + -moz-user-select: none; + -khtml-user-select: none; + -webkit-user-select: none; + -o-user-select: none; +} + +.tabulator-row .tabulator-cell.tabulator-row-handle .tabulator-row-handle-box { + width: 80%; +} + +.tabulator-row .tabulator-cell.tabulator-row-handle .tabulator-row-handle-box .tabulator-row-handle-bar { + width: 100%; + height: 3px; + margin-top: 2px; + background: #666; +} + +.tabulator-row .tabulator-cell .tabulator-data-tree-branch { + display: inline-block; + vertical-align: middle; + height: 9px; + width: 7px; + margin-top: -9px; + margin-right: 5px; + border-bottom-left-radius: 1px; + border-left: 2px solid #aaa; + border-bottom: 2px solid #aaa; +} + +.tabulator-row .tabulator-cell .tabulator-data-tree-control { + display: -ms-inline-flexbox; + display: inline-flex; + -ms-flex-pack: center; + justify-content: center; + -ms-flex-align: center; + align-items: center; + vertical-align: middle; + height: 11px; + width: 11px; + margin-right: 5px; + border: 1px solid #333; + border-radius: 2px; + background: rgba(0, 0, 0, 0.1); + overflow: hidden; +} + +.tabulator-row .tabulator-cell .tabulator-data-tree-control:hover { + cursor: pointer; + background: rgba(0, 0, 0, 0.2); +} + +.tabulator-row .tabulator-cell .tabulator-data-tree-control .tabulator-data-tree-control-collapse { + display: inline-block; + position: relative; + height: 7px; + width: 1px; + background: transparent; +} + +.tabulator-row .tabulator-cell .tabulator-data-tree-control .tabulator-data-tree-control-collapse:after { + position: absolute; + content: ""; + left: -3px; + top: 3px; + height: 1px; + width: 7px; + background: #333; +} + +.tabulator-row .tabulator-cell .tabulator-data-tree-control .tabulator-data-tree-control-expand { + display: inline-block; + position: relative; + height: 7px; + width: 1px; + background: #333; +} + +.tabulator-row .tabulator-cell .tabulator-data-tree-control .tabulator-data-tree-control-expand:after { + position: absolute; + content: ""; + left: -3px; + top: 3px; + height: 1px; + width: 7px; + background: #333; +} + +.tabulator-row .tabulator-cell .tabulator-responsive-collapse-toggle { + display: -ms-inline-flexbox; + display: inline-flex; + -ms-flex-align: center; + align-items: center; + -ms-flex-pack: center; + justify-content: center; + -moz-user-select: none; + -khtml-user-select: none; + -webkit-user-select: none; + -o-user-select: none; + height: 15px; + width: 15px; + border-radius: 20px; + background: #666; + color: #fff; + font-weight: bold; + font-size: 1.1em; +} + +.tabulator-row .tabulator-cell .tabulator-responsive-collapse-toggle:hover { + opacity: .7; +} + +.tabulator-row .tabulator-cell .tabulator-responsive-collapse-toggle.open .tabulator-responsive-collapse-toggle-close { + display: initial; +} + +.tabulator-row .tabulator-cell .tabulator-responsive-collapse-toggle.open .tabulator-responsive-collapse-toggle-open { + display: none; +} + +.tabulator-row .tabulator-cell .tabulator-responsive-collapse-toggle .tabulator-responsive-collapse-toggle-close { + display: none; +} + +.tabulator-row .tabulator-cell .tabulator-traffic-light { + display: inline-block; + height: 14px; + width: 14px; + border-radius: 14px; +} + +.tabulator-row.tabulator-group { + box-sizing: border-box; + border-bottom: 1px solid #999; + border-right: 1px solid #aaa; + border-top: 1px solid #999; + padding: 5px; + padding-left: 10px; + background: #ccc; + font-weight: bold; + min-width: 100%; +} + +.tabulator-row.tabulator-group:hover { + cursor: pointer; + background-color: rgba(0, 0, 0, 0.1); +} + +.tabulator-row.tabulator-group.tabulator-group-visible .tabulator-arrow { + margin-right: 10px; + border-left: 6px solid transparent; + border-right: 6px solid transparent; + border-top: 6px solid #666; + border-bottom: 0; +} + +.tabulator-row.tabulator-group.tabulator-group-level-1 { + padding-left: 30px; +} + +.tabulator-row.tabulator-group.tabulator-group-level-2 { + padding-left: 50px; +} + +.tabulator-row.tabulator-group.tabulator-group-level-3 { + padding-left: 70px; +} + +.tabulator-row.tabulator-group.tabulator-group-level-4 { + padding-left: 90px; +} + +.tabulator-row.tabulator-group.tabulator-group-level-5 { + padding-left: 110px; +} + +.tabulator-row.tabulator-group .tabulator-group-toggle { + display: inline-block; +} + +.tabulator-row.tabulator-group .tabulator-arrow { + display: inline-block; + width: 0; + height: 0; + margin-right: 16px; + border-top: 6px solid transparent; + border-bottom: 6px solid transparent; + border-right: 0; + border-left: 6px solid #666; + vertical-align: middle; +} + +.tabulator-row.tabulator-group span { + margin-left: 10px; + color: #d00; +} + +.tabulator-menu { + position: absolute; + display: inline-block; + box-sizing: border-box; + background: #fff; + border: 1px solid #aaa; + box-shadow: 0 0 5px 0 rgba(0, 0, 0, 0.2); + font-size: 14px; + overflow-y: auto; + -webkit-overflow-scrolling: touch; + z-index: 10000; +} + +.tabulator-menu .tabulator-menu-item { + padding: 5px 10px; + -webkit-user-select: none; + -ms-user-select: none; + user-select: none; +} + +.tabulator-menu .tabulator-menu-item.tabulator-menu-item-disabled { + opacity: .5; +} + +.tabulator-menu .tabulator-menu-item:not(.tabulator-menu-item-disabled):hover { + cursor: pointer; + background: #EFEFEF; +} + +.tabulator-menu .tabulator-menu-separator { + border-top: 1px solid #aaa; +} + +.tabulator-edit-select-list { + position: absolute; + display: inline-block; + box-sizing: border-box; + max-height: 200px; + background: #fff; + border: 1px solid #aaa; + font-size: 14px; + overflow-y: auto; + -webkit-overflow-scrolling: touch; + z-index: 10000; +} + +.tabulator-edit-select-list .tabulator-edit-select-list-item { + padding: 4px; + color: #333; +} + +.tabulator-edit-select-list .tabulator-edit-select-list-item.active { + color: #fff; + background: #1D68CD; +} + +.tabulator-edit-select-list .tabulator-edit-select-list-item.active.focused { + outline: 1px solid rgba(255, 255, 255, 0.5); +} + +.tabulator-edit-select-list .tabulator-edit-select-list-item.focused { + outline: 1px solid #1D68CD; +} + +.tabulator-edit-select-list .tabulator-edit-select-list-item:hover { + cursor: pointer; + color: #fff; + background: #1D68CD; +} + +.tabulator-edit-select-list .tabulator-edit-select-list-notice { + padding: 4px; + color: #333; + text-align: center; +} + +.tabulator-edit-select-list .tabulator-edit-select-list-group { + border-bottom: 1px solid #aaa; + padding: 4px; + padding-top: 6px; + color: #333; + font-weight: bold; +} + +.tabulator-print-fullscreen { + position: absolute; + top: 0; + bottom: 0; + left: 0; + right: 0; + z-index: 10000; +} + +body.tabulator-print-fullscreen-hide > *:not(.tabulator-print-fullscreen) { + display: none !important; +} + +.tabulator-print-table { + border-collapse: collapse; +} + +.tabulator-print-table .tabulator-data-tree-branch { + display: inline-block; + vertical-align: middle; + height: 9px; + width: 7px; + margin-top: -9px; + margin-right: 5px; + border-bottom-left-radius: 1px; + border-left: 2px solid #aaa; + border-bottom: 2px solid #aaa; +} + +.tabulator-print-table .tabulator-print-table-group { + box-sizing: border-box; + border-bottom: 1px solid #999; + border-right: 1px solid #aaa; + border-top: 1px solid #999; + padding: 5px; + padding-left: 10px; + background: #ccc; + font-weight: bold; + min-width: 100%; +} + +.tabulator-print-table .tabulator-print-table-group:hover { + cursor: pointer; + background-color: rgba(0, 0, 0, 0.1); +} + +.tabulator-print-table .tabulator-print-table-group.tabulator-group-visible .tabulator-arrow { + margin-right: 10px; + border-left: 6px solid transparent; + border-right: 6px solid transparent; + border-top: 6px solid #666; + border-bottom: 0; +} + +.tabulator-print-table .tabulator-print-table-group.tabulator-group-level-1 td { + padding-left: 30px !important; +} + +.tabulator-print-table .tabulator-print-table-group.tabulator-group-level-2 td { + padding-left: 50px !important; +} + +.tabulator-print-table .tabulator-print-table-group.tabulator-group-level-3 td { + padding-left: 70px !important; +} + +.tabulator-print-table .tabulator-print-table-group.tabulator-group-level-4 td { + padding-left: 90px !important; +} + +.tabulator-print-table .tabulator-print-table-group.tabulator-group-level-5 td { + padding-left: 110px !important; +} + +.tabulator-print-table .tabulator-print-table-group .tabulator-group-toggle { + display: inline-block; +} + +.tabulator-print-table .tabulator-print-table-group .tabulator-arrow { + display: inline-block; + width: 0; + height: 0; + margin-right: 16px; + border-top: 6px solid transparent; + border-bottom: 6px solid transparent; + border-right: 0; + border-left: 6px solid #666; + vertical-align: middle; +} + +.tabulator-print-table .tabulator-print-table-group span { + margin-left: 10px; + color: #d00; +} + +.tabulator-print-table .tabulator-data-tree-control { + display: -ms-inline-flexbox; + display: inline-flex; + -ms-flex-pack: center; + justify-content: center; + -ms-flex-align: center; + align-items: center; + vertical-align: middle; + height: 11px; + width: 11px; + margin-right: 5px; + border: 1px solid #333; + border-radius: 2px; + background: rgba(0, 0, 0, 0.1); + overflow: hidden; +} + +.tabulator-print-table .tabulator-data-tree-control:hover { + cursor: pointer; + background: rgba(0, 0, 0, 0.2); +} + +.tabulator-print-table .tabulator-data-tree-control .tabulator-data-tree-control-collapse { + display: inline-block; + position: relative; + height: 7px; + width: 1px; + background: transparent; +} + +.tabulator-print-table .tabulator-data-tree-control .tabulator-data-tree-control-collapse:after { + position: absolute; + content: ""; + left: -3px; + top: 3px; + height: 1px; + width: 7px; + background: #333; +} + +.tabulator-print-table .tabulator-data-tree-control .tabulator-data-tree-control-expand { + display: inline-block; + position: relative; + height: 7px; + width: 1px; + background: #333; +} + +.tabulator-print-table .tabulator-data-tree-control .tabulator-data-tree-control-expand:after { + position: absolute; + content: ""; + left: -3px; + top: 3px; + height: 1px; + width: 7px; + background: #333; +} diff --git a/admin/js/vendors/tabulator/css/tabulator.min.css b/admin/js/vendors/tabulator/css/tabulator.min.css new file mode 100644 index 0000000..bafd6c7 --- /dev/null +++ b/admin/js/vendors/tabulator/css/tabulator.min.css @@ -0,0 +1,3 @@ +/* Tabulator v4.7.0 (c) Oliver Folkerd */ +.tabulator{position:relative;border:1px solid #999;background-color:#888;font-size:14px;text-align:left;overflow:hidden;transform:translatez(0)}.tabulator[tabulator-layout=fitDataFill] .tabulator-tableHolder .tabulator-table{min-width:100%}.tabulator[tabulator-layout=fitDataTable]{display:inline-block}.tabulator.tabulator-block-select{-webkit-user-select:none;-ms-user-select:none;user-select:none}.tabulator .tabulator-header{position:relative;box-sizing:border-box;width:100%;border-bottom:1px solid #999;background-color:#e6e6e6;color:#555;font-weight:700;white-space:nowrap;overflow:hidden;-moz-user-select:none;-khtml-user-select:none;-webkit-user-select:none;-o-user-select:none}.tabulator .tabulator-header.tabulator-header-hidden{display:none}.tabulator .tabulator-header .tabulator-col{display:inline-block;position:relative;box-sizing:border-box;border-right:1px solid #aaa;background:#e6e6e6;text-align:left;vertical-align:bottom;overflow:hidden}.tabulator .tabulator-header .tabulator-col.tabulator-moving{position:absolute;border:1px solid #999;background:#cdcdcd;pointer-events:none}.tabulator .tabulator-header .tabulator-col .tabulator-col-content{box-sizing:border-box;position:relative;padding:4px}.tabulator .tabulator-header .tabulator-col .tabulator-col-content .tabulator-header-menu-button{padding:0 8px}.tabulator .tabulator-header .tabulator-col .tabulator-col-content .tabulator-header-menu-button:hover{cursor:pointer;opacity:.6}.tabulator .tabulator-header .tabulator-col .tabulator-col-content .tabulator-col-title{box-sizing:border-box;width:100%;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;vertical-align:bottom}.tabulator .tabulator-header .tabulator-col .tabulator-col-content .tabulator-col-title .tabulator-title-editor{box-sizing:border-box;width:100%;border:1px solid #999;padding:1px;background:#fff}.tabulator .tabulator-header .tabulator-col .tabulator-col-content .tabulator-arrow{display:inline-block;position:absolute;top:9px;right:8px;width:0;height:0;border-left:6px solid transparent;border-right:6px solid transparent;border-bottom:6px solid #bbb}.tabulator .tabulator-header .tabulator-col.tabulator-col-group .tabulator-col-group-cols{position:relative;display:-ms-flexbox;display:flex;border-top:1px solid #aaa;overflow:hidden;margin-right:-1px}.tabulator .tabulator-header .tabulator-col:first-child .tabulator-col-resize-handle.prev{display:none}.tabulator .tabulator-header .tabulator-col .tabulator-header-filter{position:relative;box-sizing:border-box;margin-top:2px;width:100%;text-align:center}.tabulator .tabulator-header .tabulator-col .tabulator-header-filter textarea{height:auto!important}.tabulator .tabulator-header .tabulator-col .tabulator-header-filter svg{margin-top:3px}.tabulator .tabulator-header .tabulator-col .tabulator-header-filter input::-ms-clear{width:0;height:0}.tabulator .tabulator-header .tabulator-col.tabulator-sortable .tabulator-col-title{padding-right:25px}.tabulator .tabulator-header .tabulator-col.tabulator-sortable:hover{cursor:pointer;background-color:#cdcdcd}.tabulator .tabulator-header .tabulator-col.tabulator-sortable[aria-sort=none] .tabulator-col-content .tabulator-arrow{border-top:none;border-bottom:6px solid #bbb}.tabulator .tabulator-header .tabulator-col.tabulator-sortable[aria-sort=asc] .tabulator-col-content .tabulator-arrow{border-top:none;border-bottom:6px solid #666}.tabulator .tabulator-header .tabulator-col.tabulator-sortable[aria-sort=desc] .tabulator-col-content .tabulator-arrow{border-top:6px solid #666;border-bottom:none}.tabulator .tabulator-header .tabulator-col.tabulator-col-vertical .tabulator-col-content .tabulator-col-title{-ms-writing-mode:tb-rl;writing-mode:vertical-rl;text-orientation:mixed;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center}.tabulator .tabulator-header .tabulator-col.tabulator-col-vertical.tabulator-col-vertical-flip .tabulator-col-title{transform:rotate(180deg)}.tabulator .tabulator-header .tabulator-col.tabulator-col-vertical.tabulator-sortable .tabulator-col-title{padding-right:0;padding-top:20px}.tabulator .tabulator-header .tabulator-col.tabulator-col-vertical.tabulator-sortable.tabulator-col-vertical-flip .tabulator-col-title{padding-right:0;padding-bottom:20px}.tabulator .tabulator-header .tabulator-col.tabulator-col-vertical.tabulator-sortable .tabulator-arrow{right:calc(50% - 6px)}.tabulator .tabulator-header .tabulator-frozen{display:inline-block;position:absolute;z-index:10}.tabulator .tabulator-header .tabulator-frozen.tabulator-frozen-left{border-right:2px solid #aaa}.tabulator .tabulator-header .tabulator-frozen.tabulator-frozen-right{border-left:2px solid #aaa}.tabulator .tabulator-header .tabulator-calcs-holder{box-sizing:border-box;min-width:600%;background:#f3f3f3!important;border-top:1px solid #aaa;border-bottom:1px solid #aaa;overflow:hidden}.tabulator .tabulator-header .tabulator-calcs-holder .tabulator-row{background:#f3f3f3!important}.tabulator .tabulator-header .tabulator-calcs-holder .tabulator-row .tabulator-col-resize-handle{display:none}.tabulator .tabulator-header .tabulator-frozen-rows-holder{min-width:600%}.tabulator .tabulator-header .tabulator-frozen-rows-holder:empty{display:none}.tabulator .tabulator-tableHolder{position:relative;width:100%;white-space:nowrap;overflow:auto;-webkit-overflow-scrolling:touch}.tabulator .tabulator-tableHolder:focus{outline:none}.tabulator .tabulator-tableHolder .tabulator-placeholder{box-sizing:border-box;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;width:100%}.tabulator .tabulator-tableHolder .tabulator-placeholder[tabulator-render-mode=virtual]{min-height:100%;min-width:100%}.tabulator .tabulator-tableHolder .tabulator-placeholder span{display:inline-block;margin:0 auto;padding:10px;color:#ccc;font-weight:700;font-size:20px}.tabulator .tabulator-tableHolder .tabulator-table{position:relative;display:inline-block;background-color:#fff;white-space:nowrap;overflow:visible;color:#333}.tabulator .tabulator-tableHolder .tabulator-table .tabulator-row.tabulator-calcs{font-weight:700;background:#e2e2e2!important}.tabulator .tabulator-tableHolder .tabulator-table .tabulator-row.tabulator-calcs.tabulator-calcs-top{border-bottom:2px solid #aaa}.tabulator .tabulator-tableHolder .tabulator-table .tabulator-row.tabulator-calcs.tabulator-calcs-bottom{border-top:2px solid #aaa}.tabulator .tabulator-footer{padding:5px 10px;border-top:1px solid #999;background-color:#e6e6e6;text-align:right;color:#555;font-weight:700;white-space:nowrap;-ms-user-select:none;user-select:none;-moz-user-select:none;-khtml-user-select:none;-webkit-user-select:none;-o-user-select:none}.tabulator .tabulator-footer .tabulator-calcs-holder{box-sizing:border-box;width:calc(100% + 20px);margin:-5px -10px 5px;text-align:left;background:#f3f3f3!important;border-bottom:1px solid #aaa;border-top:1px solid #aaa;overflow:hidden}.tabulator .tabulator-footer .tabulator-calcs-holder .tabulator-row{background:#f3f3f3!important}.tabulator .tabulator-footer .tabulator-calcs-holder .tabulator-row .tabulator-col-resize-handle{display:none}.tabulator .tabulator-footer .tabulator-calcs-holder:only-child{margin-bottom:-5px;border-bottom:none}.tabulator .tabulator-footer .tabulator-paginator{color:#555;font-family:inherit;font-weight:inherit;font-size:inherit}.tabulator .tabulator-footer .tabulator-page-size{display:inline-block;margin:0 5px;padding:2px 5px;border:1px solid #aaa;border-radius:3px}.tabulator .tabulator-footer .tabulator-pages{margin:0 7px}.tabulator .tabulator-footer .tabulator-page{display:inline-block;margin:0 2px;padding:2px 5px;border:1px solid #aaa;border-radius:3px;background:hsla(0,0%,100%,.2)}.tabulator .tabulator-footer .tabulator-page.active{color:#d00}.tabulator .tabulator-footer .tabulator-page:disabled{opacity:.5}.tabulator .tabulator-footer .tabulator-page:not(.disabled):hover{cursor:pointer;background:rgba(0,0,0,.2);color:#fff}.tabulator .tabulator-col-resize-handle{position:absolute;right:0;top:0;bottom:0;width:5px}.tabulator .tabulator-col-resize-handle.prev{left:0;right:auto}.tabulator .tabulator-col-resize-handle:hover{cursor:ew-resize}.tabulator .tabulator-loader{position:absolute;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;top:0;left:0;z-index:100;height:100%;width:100%;background:rgba(0,0,0,.4);text-align:center}.tabulator .tabulator-loader .tabulator-loader-msg{display:inline-block;margin:0 auto;padding:10px 20px;border-radius:10px;background:#fff;font-weight:700;font-size:16px}.tabulator .tabulator-loader .tabulator-loader-msg.tabulator-loading{border:4px solid #333;color:#000}.tabulator .tabulator-loader .tabulator-loader-msg.tabulator-error{border:4px solid #d00;color:#590000}.tabulator-row{position:relative;box-sizing:border-box;min-height:22px;background-color:#fff}.tabulator-row.tabulator-row-even{background-color:#efefef}.tabulator-row.tabulator-selectable:hover{background-color:#bbb;cursor:pointer}.tabulator-row.tabulator-selected{background-color:#9abcea}.tabulator-row.tabulator-selected:hover{background-color:#769bcc;cursor:pointer}.tabulator-row.tabulator-row-moving{border:1px solid #000;background:#fff}.tabulator-row.tabulator-moving{position:absolute;border-top:1px solid #aaa;border-bottom:1px solid #aaa;pointer-events:none;z-index:15}.tabulator-row .tabulator-row-resize-handle{position:absolute;right:0;bottom:0;left:0;height:5px}.tabulator-row .tabulator-row-resize-handle.prev{top:0;bottom:auto}.tabulator-row .tabulator-row-resize-handle:hover{cursor:ns-resize}.tabulator-row .tabulator-frozen{display:inline-block;position:absolute;background-color:inherit;z-index:10}.tabulator-row .tabulator-frozen.tabulator-frozen-left{border-right:2px solid #aaa}.tabulator-row .tabulator-frozen.tabulator-frozen-right{border-left:2px solid #aaa}.tabulator-row .tabulator-responsive-collapse{box-sizing:border-box;padding:5px;border-top:1px solid #aaa;border-bottom:1px solid #aaa}.tabulator-row .tabulator-responsive-collapse:empty{display:none}.tabulator-row .tabulator-responsive-collapse table{font-size:14px}.tabulator-row .tabulator-responsive-collapse table tr td{position:relative}.tabulator-row .tabulator-responsive-collapse table tr td:first-of-type{padding-right:10px}.tabulator-row .tabulator-cell{display:inline-block;position:relative;box-sizing:border-box;padding:4px;border-right:1px solid #aaa;vertical-align:middle;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.tabulator-row .tabulator-cell.tabulator-editing{border:1px solid #1d68cd;padding:0}.tabulator-row .tabulator-cell.tabulator-editing input,.tabulator-row .tabulator-cell.tabulator-editing select{border:1px;background:transparent}.tabulator-row .tabulator-cell.tabulator-validation-fail{border:1px solid #d00}.tabulator-row .tabulator-cell.tabulator-validation-fail input,.tabulator-row .tabulator-cell.tabulator-validation-fail select{border:1px;background:transparent;color:#d00}.tabulator-row .tabulator-cell:first-child .tabulator-col-resize-handle.prev{display:none}.tabulator-row .tabulator-cell.tabulator-row-handle{display:-ms-inline-flexbox;display:inline-flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;-moz-user-select:none;-khtml-user-select:none;-webkit-user-select:none;-o-user-select:none}.tabulator-row .tabulator-cell.tabulator-row-handle .tabulator-row-handle-box{width:80%}.tabulator-row .tabulator-cell.tabulator-row-handle .tabulator-row-handle-box .tabulator-row-handle-bar{width:100%;height:3px;margin-top:2px;background:#666}.tabulator-row .tabulator-cell .tabulator-data-tree-branch{display:inline-block;vertical-align:middle;height:9px;width:7px;margin-top:-9px;margin-right:5px;border-bottom-left-radius:1px;border-left:2px solid #aaa;border-bottom:2px solid #aaa}.tabulator-row .tabulator-cell .tabulator-data-tree-control{display:-ms-inline-flexbox;display:inline-flex;-ms-flex-pack:center;justify-content:center;-ms-flex-align:center;align-items:center;vertical-align:middle;height:11px;width:11px;margin-right:5px;border:1px solid #333;border-radius:2px;background:rgba(0,0,0,.1);overflow:hidden}.tabulator-row .tabulator-cell .tabulator-data-tree-control:hover{cursor:pointer;background:rgba(0,0,0,.2)}.tabulator-row .tabulator-cell .tabulator-data-tree-control .tabulator-data-tree-control-collapse{display:inline-block;position:relative;height:7px;width:1px;background:transparent}.tabulator-row .tabulator-cell .tabulator-data-tree-control .tabulator-data-tree-control-collapse:after{position:absolute;content:"";left:-3px;top:3px;height:1px;width:7px;background:#333}.tabulator-row .tabulator-cell .tabulator-data-tree-control .tabulator-data-tree-control-expand{display:inline-block;position:relative;height:7px;width:1px;background:#333}.tabulator-row .tabulator-cell .tabulator-data-tree-control .tabulator-data-tree-control-expand:after{position:absolute;content:"";left:-3px;top:3px;height:1px;width:7px;background:#333}.tabulator-row .tabulator-cell .tabulator-responsive-collapse-toggle{display:-ms-inline-flexbox;display:inline-flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;-moz-user-select:none;-khtml-user-select:none;-webkit-user-select:none;-o-user-select:none;height:15px;width:15px;border-radius:20px;background:#666;color:#fff;font-weight:700;font-size:1.1em}.tabulator-row .tabulator-cell .tabulator-responsive-collapse-toggle:hover{opacity:.7}.tabulator-row .tabulator-cell .tabulator-responsive-collapse-toggle.open .tabulator-responsive-collapse-toggle-close{display:initial}.tabulator-row .tabulator-cell .tabulator-responsive-collapse-toggle.open .tabulator-responsive-collapse-toggle-open,.tabulator-row .tabulator-cell .tabulator-responsive-collapse-toggle .tabulator-responsive-collapse-toggle-close{display:none}.tabulator-row .tabulator-cell .tabulator-traffic-light{display:inline-block;height:14px;width:14px;border-radius:14px}.tabulator-row.tabulator-group{box-sizing:border-box;border-bottom:1px solid #999;border-right:1px solid #aaa;border-top:1px solid #999;padding:5px;padding-left:10px;background:#ccc;font-weight:700;min-width:100%}.tabulator-row.tabulator-group:hover{cursor:pointer;background-color:rgba(0,0,0,.1)}.tabulator-row.tabulator-group.tabulator-group-visible .tabulator-arrow{margin-right:10px;border-left:6px solid transparent;border-right:6px solid transparent;border-top:6px solid #666;border-bottom:0}.tabulator-row.tabulator-group.tabulator-group-level-1{padding-left:30px}.tabulator-row.tabulator-group.tabulator-group-level-2{padding-left:50px}.tabulator-row.tabulator-group.tabulator-group-level-3{padding-left:70px}.tabulator-row.tabulator-group.tabulator-group-level-4{padding-left:90px}.tabulator-row.tabulator-group.tabulator-group-level-5{padding-left:110px}.tabulator-row.tabulator-group .tabulator-group-toggle{display:inline-block}.tabulator-row.tabulator-group .tabulator-arrow{display:inline-block;width:0;height:0;margin-right:16px;border-top:6px solid transparent;border-bottom:6px solid transparent;border-right:0;border-left:6px solid #666;vertical-align:middle}.tabulator-row.tabulator-group span{margin-left:10px;color:#d00}.tabulator-menu{position:absolute;display:inline-block;box-sizing:border-box;background:#fff;border:1px solid #aaa;box-shadow:0 0 5px 0 rgba(0,0,0,.2);font-size:14px;overflow-y:auto;-webkit-overflow-scrolling:touch;z-index:10000}.tabulator-menu .tabulator-menu-item{padding:5px 10px;-webkit-user-select:none;-ms-user-select:none;user-select:none}.tabulator-menu .tabulator-menu-item.tabulator-menu-item-disabled{opacity:.5}.tabulator-menu .tabulator-menu-item:not(.tabulator-menu-item-disabled):hover{cursor:pointer;background:#efefef}.tabulator-menu .tabulator-menu-separator{border-top:1px solid #aaa}.tabulator-edit-select-list{position:absolute;display:inline-block;box-sizing:border-box;max-height:200px;background:#fff;border:1px solid #aaa;font-size:14px;overflow-y:auto;-webkit-overflow-scrolling:touch;z-index:10000}.tabulator-edit-select-list .tabulator-edit-select-list-item{padding:4px;color:#333}.tabulator-edit-select-list .tabulator-edit-select-list-item.active{color:#fff;background:#1d68cd}.tabulator-edit-select-list .tabulator-edit-select-list-item.active.focused{outline:1px solid hsla(0,0%,100%,.5)}.tabulator-edit-select-list .tabulator-edit-select-list-item.focused{outline:1px solid #1d68cd}.tabulator-edit-select-list .tabulator-edit-select-list-item:hover{cursor:pointer;color:#fff;background:#1d68cd}.tabulator-edit-select-list .tabulator-edit-select-list-notice{padding:4px;color:#333;text-align:center}.tabulator-edit-select-list .tabulator-edit-select-list-group{border-bottom:1px solid #aaa;padding:4px;padding-top:6px;color:#333;font-weight:700}.tabulator-print-fullscreen{position:absolute;top:0;bottom:0;left:0;right:0;z-index:10000}body.tabulator-print-fullscreen-hide>:not(.tabulator-print-fullscreen){display:none!important}.tabulator-print-table{border-collapse:collapse}.tabulator-print-table .tabulator-data-tree-branch{display:inline-block;vertical-align:middle;height:9px;width:7px;margin-top:-9px;margin-right:5px;border-bottom-left-radius:1px;border-left:2px solid #aaa;border-bottom:2px solid #aaa}.tabulator-print-table .tabulator-print-table-group{box-sizing:border-box;border-bottom:1px solid #999;border-right:1px solid #aaa;border-top:1px solid #999;padding:5px;padding-left:10px;background:#ccc;font-weight:700;min-width:100%}.tabulator-print-table .tabulator-print-table-group:hover{cursor:pointer;background-color:rgba(0,0,0,.1)}.tabulator-print-table .tabulator-print-table-group.tabulator-group-visible .tabulator-arrow{margin-right:10px;border-left:6px solid transparent;border-right:6px solid transparent;border-top:6px solid #666;border-bottom:0}.tabulator-print-table .tabulator-print-table-group.tabulator-group-level-1 td{padding-left:30px!important}.tabulator-print-table .tabulator-print-table-group.tabulator-group-level-2 td{padding-left:50px!important}.tabulator-print-table .tabulator-print-table-group.tabulator-group-level-3 td{padding-left:70px!important}.tabulator-print-table .tabulator-print-table-group.tabulator-group-level-4 td{padding-left:90px!important}.tabulator-print-table .tabulator-print-table-group.tabulator-group-level-5 td{padding-left:110px!important}.tabulator-print-table .tabulator-print-table-group .tabulator-group-toggle{display:inline-block}.tabulator-print-table .tabulator-print-table-group .tabulator-arrow{display:inline-block;width:0;height:0;margin-right:16px;border-top:6px solid transparent;border-bottom:6px solid transparent;border-right:0;border-left:6px solid #666;vertical-align:middle}.tabulator-print-table .tabulator-print-table-group span{margin-left:10px;color:#d00}.tabulator-print-table .tabulator-data-tree-control{display:-ms-inline-flexbox;display:inline-flex;-ms-flex-pack:center;justify-content:center;-ms-flex-align:center;align-items:center;vertical-align:middle;height:11px;width:11px;margin-right:5px;border:1px solid #333;border-radius:2px;background:rgba(0,0,0,.1);overflow:hidden}.tabulator-print-table .tabulator-data-tree-control:hover{cursor:pointer;background:rgba(0,0,0,.2)}.tabulator-print-table .tabulator-data-tree-control .tabulator-data-tree-control-collapse{display:inline-block;position:relative;height:7px;width:1px;background:transparent}.tabulator-print-table .tabulator-data-tree-control .tabulator-data-tree-control-collapse:after{position:absolute;content:"";left:-3px;top:3px;height:1px;width:7px;background:#333}.tabulator-print-table .tabulator-data-tree-control .tabulator-data-tree-control-expand{display:inline-block;position:relative;height:7px;width:1px;background:#333}.tabulator-print-table .tabulator-data-tree-control .tabulator-data-tree-control-expand:after{position:absolute;content:"";left:-3px;top:3px;height:1px;width:7px;background:#333} +/*# sourceMappingURL=tabulator.min.css.map */ diff --git a/admin/js/vendors/tabulator/css/tabulator.min.css.map b/admin/js/vendors/tabulator/css/tabulator.min.css.map new file mode 100644 index 0000000..47a4c5c --- /dev/null +++ b/admin/js/vendors/tabulator/css/tabulator.min.css.map @@ -0,0 +1 @@ +{"version":3,"sources":["tabulator.scss"],"names":[],"mappings":"AA0CA,WACC,kBAAkB,AAElB,sBAxCgB,AA0ChB,sBA3CqB,AA6CrB,eA3Ca,AA4Cb,gBAAgB,AAChB,gBAAe,AAMf,uBAAwB,CAwfxB,AAvgBD,iFAoBI,cAAc,CACd,AArBJ,0CA0BE,oBAAqB,CACrB,AA3BF,kCA8BE,yBAAiB,AAAjB,qBAAiB,AAAjB,gBAAiB,CACjB,AA/BF,6BAmCE,kBAAiB,AACjB,sBAAsB,AAEtB,WAAU,AAEV,6BAtEwB,AAuExB,yBA1E4B,AA2E5B,WA1EmB,AA2EnB,gBAAgB,AAEhB,mBAAmB,AACnB,gBAAe,AAEf,sBAAsB,AACtB,wBAAwB,AACxB,yBAAyB,AACzB,mBAAoB,CAmPpB,AAtSF,qDAsDG,YAAY,CACZ,AAvDH,4CA2DG,qBAAoB,AACpB,kBAAiB,AACjB,sBAAqB,AACrB,4BA7FoB,AA8FpB,mBAhG2B,AAiG3B,gBAAe,AACf,sBAAsB,AACtB,eAAgB,CAqLhB,AAvPH,6DAqEI,kBAAkB,AAClB,sBApGsB,AAqGtB,mBAA8C,AAC9C,mBAAoB,CACpB,AAzEJ,mEA6EI,sBAAqB,AACrB,kBAAkB,AAClB,WAAW,CAgDX,AA/HJ,iGAmFK,aAAc,CAMd,AAzFL,uGAsFM,eAAe,AACf,UAAW,CACX,AAxFN,wFA6FK,sBAAqB,AACrB,WAAW,AAEX,mBAAmB,AACnB,gBAAgB,AAChB,uBAAuB,AACvB,qBAAqB,CAarB,AAhHL,gHAuGM,sBAAsB,AACtB,WAAW,AAEX,sBAAqB,AAErB,YAAW,AAEX,eAAgB,CAChB,AA/GN,oFAoHK,qBAAqB,AACrB,kBAAkB,AAClB,QAAO,AACP,UAAS,AACT,QAAQ,AACR,SAAS,AACT,kCAAkC,AAClC,mCAAmC,AACnC,4BArJmB,CAsJnB,AA7HL,0FAsIK,kBAAiB,AACjB,oBAAa,AAAb,aAAa,AAEb,0BAxKkB,AAyKlB,gBAAgB,AAEhB,iBAAiB,CACjB,AA7IL,0FAmJK,YAAa,CACb,AApJL,qEAyJI,kBAAkB,AAClB,sBAAsB,AACtB,eAAc,AACd,WAAU,AACV,iBAAkB,CAiBlB,AA9KJ,8EAiKK,qBAAsB,CACtB,AAlKL,yEAqKK,cAAe,CACf,AAtKL,sFA0KM,QAAS,AACT,QAAS,CACT,AA5KN,oFAmLK,kBAAkB,CAClB,AApLL,qEAuLK,eAAc,AACd,wBAAoD,CACpD,AAzLL,uHA6LM,gBAAgB,AAChB,4BAvNkB,CAwNlB,AA/LN,sHAoMM,gBAAgB,AAChB,4BA/NgB,CAgOhB,AAtMN,uHA2MM,0BArOgB,AAsOhB,kBAAmB,CACnB,AA7MN,+GAqNM,uBAAyB,AAAzB,yBAAyB,AACzB,uBAAuB,AAEvB,oBAAY,AAAZ,aAAY,AACZ,sBAAkB,AAAlB,mBAAkB,AAClB,qBAAsB,AAAtB,sBAAsB,CACtB,AA3NN,oHAgOM,wBAAyB,CACzB,AAjON,2GAsOM,gBAAe,AACf,gBAAgB,CAChB,AAxON,uIA4OO,gBAAe,AACf,mBAAmB,CACnB,AA9OP,uGAmPM,qBAAqB,CACrB,AApPN,+CA0PG,qBAAqB,AACrB,kBAAkB,AAIlB,UAAW,CASX,AAxQH,qEAkQI,2BAtRgB,CAuRhB,AAnQJ,sEAsQI,0BA1RgB,CA2RhB,AAvQJ,qDA4QG,sBAAqB,AACrB,eAAc,AAEd,6BAAyD,AAUzD,0BA7SiB,AA8SjB,6BAzToB,AA2TpB,eAAgB,CAChB,AA7RH,oEAkRI,4BAAyD,CAKzD,AAvRJ,iGAqRK,YAAa,CACb,AAtRL,2DAgSG,cAAc,CAKd,AArSH,iEAmSI,YAAa,CACb,AApSJ,kCA0SE,kBAAiB,AACjB,WAAU,AACV,mBAAmB,AACnB,cAAa,AACb,gCAAiC,CAyDjC,AAvWF,wCAiTG,YAAa,CACb,AAlTH,yDAsTG,sBAAqB,AACrB,oBAAa,AAAb,aAAa,AACb,sBAAkB,AAAlB,mBAAkB,AAOlB,UAAU,CAYV,AA3UH,wFA2TI,gBAAe,AACf,cAAc,CACd,AA7TJ,8DAkUI,qBAAqB,AAErB,cAAa,AACb,aAAY,AAEZ,WAAU,AACV,gBAAiB,AACjB,cAAe,CACf,AA1UJ,mDA+UG,kBAAiB,AACjB,qBAAoB,AACpB,sBAvWqB,AAwWrB,mBAAmB,AACnB,iBAAgB,AAChB,UAvWe,CAyXf,AAtWH,kFAyVK,gBAAiB,AACjB,4BAAwD,CASxD,AAnWL,sGA6VM,4BAjXc,CAkXd,AA9VN,yGAiWM,yBArXc,CAsXd,AAlWN,6BA6WE,iBAAgB,AAChB,0BApXwB,AAqXxB,yBAxX4B,AAyX5B,iBAAiB,AACjB,WAzXmB,AA0XnB,gBAAgB,AAChB,mBAAkB,AAClB,qBAAgB,AAAhB,iBAAgB,AAEhB,sBAAsB,AACtB,wBAAwB,AACxB,yBAAyB,AACzB,mBAAoB,CAgFpB,AAzcF,qDA4XG,sBAAqB,AACrB,wBAAuB,AACvB,sBAA2B,AAE3B,gBAAgB,AAEhB,6BAAyD,AAUzD,6BAhaiB,AAiajB,0BAjaiB,AAmajB,eAAgB,CAMhB,AArZH,oEAqYI,4BAAyD,CAKzD,AA1YJ,iGAwYK,YAAa,CACb,AAzYL,gEAkZI,mBAAkB,AAClB,kBAAkB,CAClB,AApZJ,kDAwZG,WAhakB,AAialB,oBAAmB,AACnB,oBAAmB,AACnB,iBAAiB,CACjB,AA5ZH,kDAgaG,qBAAoB,AAEpB,aAAY,AACZ,gBAAe,AAEf,sBA5aoB,AA6apB,iBAAiB,CACjB,AAvaH,8CA0aG,YAAY,CACZ,AA3aH,6CA+aG,qBAAoB,AAEpB,aAAY,AACZ,gBAAe,AAEf,sBA3boB,AA4bpB,kBAAiB,AAEjB,6BAA+B,CAiB/B,AAxcH,oDA0bI,UA/bmB,CAgcnB,AA3bJ,sDA8bI,UAAU,CACV,AA/bJ,kEAmcK,eAAc,AACd,0BAAyB,AACzB,UAAU,CACV,AAtcL,wCA6cE,kBAAiB,AACjB,QAAO,AACP,MAAK,AACL,SAAQ,AACR,SAAS,CAUT,AA3dF,6CAodG,OAAM,AACN,UAAU,CACV,AAtdH,8CAydG,gBAAgB,CAChB,AA1dH,6BAgeE,kBAAiB,AACjB,oBAAa,AAAb,aAAa,AACb,sBAAkB,AAAlB,mBAAkB,AAElB,MAAK,AACL,OAAM,AACN,YAAW,AAEX,YAAW,AACX,WAAU,AACV,0BAAyB,AACzB,iBAAiB,CA2BjB,AAtgBF,mDA+eG,qBAAoB,AAEpB,cAAa,AACb,kBAAiB,AAEjB,mBAAkB,AAElB,gBAAe,AACf,gBAAgB,AAChB,cAAc,CAad,AArgBH,qEA4fI,sBAAqB,AACrB,UAAU,CACV,AA9fJ,mEAkgBI,sBAAqB,AACrB,aAAa,CACb,AAMJ,eACC,kBAAkB,AAClB,sBAAsB,AACtB,gBAA0C,AAC1C,qBApiBuB,CAo5BvB,AApXD,kCAQE,wBAviB4B,CAwiB5B,AATF,0CAYE,sBAxiBsB,AAyiBtB,cAAe,CACf,AAdF,kCAiBE,wBA3iB6B,CA4iB7B,AAlBF,wCAqBE,yBA9iBkC,AA+iBlC,cAAe,CACf,AAvBF,oCA0BE,sBAAqB,AACrB,eAAe,CACf,AA5BF,gCA+BE,kBAAkB,AAElB,0BA/jBkB,AAgkBlB,6BAhkBkB,AAkkBlB,oBAAoB,AACpB,UAAU,CACV,AAtCF,4CA0CE,kBAAiB,AACjB,QAAO,AACP,SAAQ,AACR,OAAM,AACN,UAAU,CAUV,AAxDF,iDAiDG,MAAK,AACL,WAAW,CACX,AAnDH,kDAsDG,gBAAgB,CAChB,AAvDH,iCA2DE,qBAAqB,AACrB,kBAAkB,AAElB,yBAAyB,AAEzB,UAAW,CASX,AAzEF,uDAmEG,2BAjmBiB,CAkmBjB,AApEH,wDAuEG,0BArmBiB,CAsmBjB,AAxEH,8CA4EE,sBAAqB,AAErB,YAAW,AAEX,0BA9mBkB,AA+mBlB,4BA/mBkB,CAkoBlB,AApGF,oDAoFG,YAAY,CACZ,AArFH,oDAwFG,cAtoBW,CAipBX,AAnGH,0DA4FK,iBAAkB,CAKlB,AAjGL,wEA+FM,kBAAkB,CAClB,AAhGN,+BAwGE,qBAAoB,AACpB,kBAAkB,AAClB,sBAAqB,AACrB,YAAW,AACX,4BA1oBkB,AA2oBlB,sBAAqB,AACrB,mBAAkB,AAClB,gBAAe,AACf,sBAAsB,CAyLtB,AAzSF,iDAmHG,yBA1oBkB,AA2oBlB,SAAU,CAMV,AA1HH,+GAuHI,WAAU,AACV,sBAAsB,CACtB,AAzHJ,yDA6HG,qBAnpBgB,CA0pBhB,AApIH,+HA+HI,WAAU,AACV,uBAAsB,AAEtB,UAxpBe,CAypBf,AAnIJ,6EAyII,YAAa,CACb,AA1IJ,oDA+IG,2BAAoB,AAApB,oBAAoB,AACpB,sBAAkB,AAAlB,mBAAkB,AAClB,qBAAsB,AAAtB,uBAAsB,AAEtB,sBAAsB,AACtB,wBAAwB,AACxB,yBAAyB,AACzB,mBAAoB,CAcpB,AApKH,8EA0JI,SAAS,CAST,AAnKJ,wGA8JK,WAAU,AACV,WAAU,AACV,eAAc,AACd,eAAe,CACf,AAlKL,2DAuKG,qBAAoB,AACpB,sBAAqB,AAErB,WAAU,AACV,UAAS,AAET,gBAAe,AACf,iBAAgB,AAEhB,8BAA6B,AAE7B,2BAhtBiB,AAitBjB,4BAjtBiB,CAktBjB,AApLH,4DAwLG,2BAAmB,AAAnB,oBAAmB,AACnB,qBAAsB,AAAtB,uBAAsB,AACtB,sBAAkB,AAAlB,mBAAkB,AAClB,sBAAqB,AAErB,YAAW,AACX,WAAU,AAEV,iBAAgB,AAEhB,sBA/tBe,AAguBf,kBAAiB,AACjB,0BAA4B,AAE5B,eAAe,CAmDf,AAzPH,kEAyMI,eAAc,AACd,yBAA4B,CAC5B,AA3MJ,kGA8MI,qBAAoB,AACpB,kBAAkB,AAElB,WAAW,AACX,UAAU,AAEV,sBAAuB,CAavB,AAjOJ,wGAuNK,kBAAkB,AAClB,WAAW,AACX,UAAU,AACV,QAAQ,AAER,WAAW,AACX,UAAU,AAEV,eA5vBa,CA6vBb,AAhOL,gGAoOI,qBAAoB,AACpB,kBAAkB,AAElB,WAAW,AACX,UAAU,AAEV,eAvwBc,CAoxBd,AAvPJ,sGA6OK,kBAAkB,AAClB,WAAW,AACX,UAAU,AACV,QAAQ,AAER,WAAW,AACX,UAAU,AAEV,eAlxBa,CAmxBb,AAtPL,qEA4PG,2BAAoB,AAApB,oBAAoB,AACpB,sBAAkB,AAAlB,mBAAkB,AAClB,qBAAsB,AAAtB,uBAAsB,AAEtB,sBAAsB,AACtB,wBAAwB,AACxB,yBAAyB,AACzB,oBAAoB,AAEpB,YAAW,AACX,WAAU,AAEV,mBAAkB,AAClB,gBAAe,AAEf,WA3yBqB,AA4yBrB,gBAAgB,AAChB,eAAe,CAmBf,AAhSH,2EAgRI,UAAU,CACV,AAjRJ,sHAqRK,eAAe,CACf,AAtRL,sOA8RI,YAAY,CACZ,AA/RJ,wDAmSG,qBAAqB,AACrB,YAAW,AACX,WAAU,AAEV,kBAAkB,CAClB,AAxSH,+BA6SE,sBAAqB,AACrB,6BAA4B,AAC5B,4BA70BkB,AA80BlB,0BAAyB,AACzB,YAAW,AACX,kBAAiB,AACjB,gBAAe,AACf,gBAAgB,AAEhB,cAAe,CA4Df,AAlXF,qCAyTG,eAAc,AACd,+BAA+B,CAC/B,AA3TH,wEAgUI,kBAAiB,AACjB,kCAAkC,AAClC,mCAAmC,AACnC,0BAv2BkB,AAw2BlB,eAAgB,CAChB,AArUJ,uDA0UG,iBAAiB,CACjB,AA3UH,uDA8UG,iBAAiB,CACjB,AA/UH,uDAkVG,iBAAiB,CACjB,AAnVH,uDAsVG,iBAAiB,CACjB,AAvVH,uDA0VG,kBAAkB,CAClB,AA3VH,uDA8VG,oBAAqB,CACrB,AA/VH,gDAmWG,qBAAqB,AACrB,QAAQ,AACR,SAAS,AACT,kBAAiB,AACjB,iCAAiC,AACjC,oCAAoC,AACpC,eAAe,AACf,2BA94BmB,AA+4BnB,qBAAqB,CACrB,AA5WH,oCA+WG,iBAAgB,AAChB,UAAU,CACV,AAKH,gBACC,kBAAkB,AAClB,qBAAoB,AACpB,sBAAqB,AAErB,gBA35BuB,AA45BvB,sBA15BmB,AA25BnB,oCAAuC,AAEvC,eA76Ba,AA+6Bb,gBAAe,AACf,iCAAiC,AAEjC,aAAc,CAqBd,AAnCD,qCAkBE,iBAAgB,AAEhB,yBAAiB,AAAjB,qBAAiB,AAAjB,gBAAiB,CAUjB,AA9BF,kEAuBG,UAAW,CACX,AAxBH,8EA2BG,eAAe,AACf,kBAj7B2B,CAk7B3B,AA7BH,0CAiCE,yBAr7BkB,CAs7BlB,AAGF,4BACC,kBAAkB,AAClB,qBAAoB,AACpB,sBAAqB,AAErB,iBAAgB,AAEhB,gBAl8BuB,AAm8BvB,sBAj8BmB,AAm8BnB,eAn9Ba,AAq9Bb,gBAAe,AACf,iCAAiC,AAEjC,aAAc,CA4Cd,AA3DD,6DAkBE,YAAW,AAEX,UA58BgB,CAi+BhB,AAzCF,oEAuBG,WAl9BqB,AAm9BrB,kBA18BkB,CA+8BlB,AA7BH,4EA2BI,oCAt9BoB,CAu9BpB,AA5BJ,qEAgCG,yBAl9BkB,CAm9BlB,AAjCH,mEAoCG,eAAc,AAEd,WAj+BqB,AAk+BrB,kBAz9BkB,CA09BlB,AAxCH,+DA4CE,YAAW,AAEX,WAt+BgB,AAu+BhB,iBAAkB,CAClB,AAhDF,8DAmDE,6BA5+BkB,AA8+BlB,YAAW,AACX,gBAAe,AAEf,WAh/BgB,AAi/BhB,eAAgB,CAChB,AAKF,4BACC,kBAAkB,AAClB,MAAK,AACL,SAAQ,AACR,OAAM,AACN,QAAO,AAEP,aAAc,CACd,AAED,uEACC,sBAAuB,CACvB,AAED,uBACC,wBAAyB,CAwKzB,AAzKD,mDAIE,qBAAoB,AACpB,sBAAqB,AAErB,WAAU,AACV,UAAS,AAET,gBAAe,AACf,iBAAgB,AAEhB,8BAA6B,AAE7B,2BArhCkB,AAshClB,4BAthCkB,CAuhClB,AAjBF,oDAqBE,sBAAqB,AACrB,6BAA4B,AAC5B,4BA7hCkB,AA8hClB,0BAAyB,AACzB,YAAW,AACX,kBAAiB,AACjB,gBAAe,AACf,gBAAgB,AAEhB,cAAe,CAsEf,AApGF,0DAiCG,eAAc,AACd,+BAA+B,CAC/B,AAnCH,6FAwCI,kBAAiB,AACjB,kCAAkC,AAClC,mCAAmC,AACnC,0BAvjCkB,AAwjClB,eAAgB,CAChB,AA7CJ,+EAmDI,2BAA4B,CAC5B,AApDJ,+EAyDI,2BAA4B,CAC5B,AA1DJ,+EA+DI,2BAA4B,CAC5B,AAhEJ,+EAqEI,2BAA4B,CAC5B,AAtEJ,+EA2EI,4BAA6B,CAC7B,AA5EJ,4EAgFG,oBAAqB,CACrB,AAjFH,qEAqFG,qBAAqB,AACrB,QAAQ,AACR,SAAS,AACT,kBAAiB,AACjB,iCAAiC,AACjC,oCAAoC,AACpC,eAAe,AACf,2BAxmCmB,AAymCnB,qBAAqB,CACrB,AA9FH,yDAiGG,iBAAgB,AAChB,UAAU,CACV,AAnGH,oDAwGE,2BAAmB,AAAnB,oBAAmB,AACnB,qBAAsB,AAAtB,uBAAsB,AACtB,sBAAkB,AAAlB,mBAAkB,AAClB,sBAAqB,AAErB,YAAW,AACX,WAAU,AAEV,iBAAgB,AAEhB,sBAvnCgB,AAwnChB,kBAAiB,AACjB,0BAA4B,AAE5B,eAAe,CAkDf,AAxKF,0DAyHG,eAAc,AACd,yBAA4B,CAC5B,AA3HH,0FA8HG,qBAAoB,AACpB,kBAAkB,AAElB,WAAW,AACX,UAAU,AAEV,sBAAuB,CAavB,AAjJH,gGAuII,kBAAkB,AAClB,WAAW,AACX,UAAU,AACV,QAAQ,AAER,WAAW,AACX,UAAU,AAEV,eAppCc,CAqpCd,AAhJJ,wFAoJG,qBAAoB,AACpB,kBAAkB,AAElB,WAAW,AACX,UAAU,AAEV,eA/pCe,CA4qCf,AAvKH,8FA6JI,kBAAkB,AAClB,WAAW,AACX,UAAU,AACV,QAAQ,AAER,WAAW,AACX,UAAU,AAEV,eA1qCc,CA2qCd","file":"tabulator.min.css","sourcesContent":["/* Tabulator v4.7.0 (c) Oliver Folkerd */\n\n\r\n//Main Theme Variables\r\n$backgroundColor: #888 !default; //background color of tabulator\r\n$borderColor:#999 !default; //border to tabulator\r\n$textSize:14px !default; //table text size\r\n\r\n//header themeing\r\n$headerBackgroundColor:#e6e6e6 !default; //border to tabulator\r\n$headerTextColor:#555 !default; //header text colour\r\n$headerBorderColor:#aaa !default; //header border color\r\n$headerSeperatorColor:#999 !default; //header bottom seperator color\r\n$headerMargin:4px !default; //padding round header\r\n\r\n//column header arrows\r\n$sortArrowActive: #666 !default;\r\n$sortArrowInactive: #bbb !default;\r\n\r\n//row themeing\r\n$rowBackgroundColor:#fff !default; //table row background color\r\n$rowAltBackgroundColor:#EFEFEF !default; //table row background color\r\n$rowBorderColor:#aaa !default; //table border color\r\n$rowTextColor:#333 !default; //table text color\r\n$rowHoverBackground:#bbb !default; //row background color on hover\r\n\r\n$rowSelectedBackground: #9ABCEA !default; //row background color when selected\r\n$rowSelectedBackgroundHover: #769BCC !default;//row background color when selected and hovered\r\n\r\n$editBoxColor:#1D68CD !default; //border color for edit boxes\r\n$errorColor:#dd0000 !default; //error indication\r\n\r\n//footer themeing\r\n$footerBackgroundColor:#e6e6e6 !default; //border to tabulator\r\n$footerTextColor:#555 !default; //footer text colour\r\n$footerBorderColor:#aaa !default; //footer border color\r\n$footerSeperatorColor:#999 !default; //footer bottom seperator color\r\n$footerActiveColor:#d00 !default; //footer bottom active text color\r\n\r\n\r\n\r\n//Tabulator Containing Element\r\n.tabulator{\r\n\tposition: relative;\r\n\r\n\tborder: 1px solid $borderColor;\r\n\r\n\tbackground-color: $backgroundColor;\r\n\r\n\tfont-size:$textSize;\r\n\ttext-align: left;\r\n\toverflow:hidden;\r\n\r\n\t-webkit-transform: translatez(0);\r\n\t-moz-transform: translatez(0);\r\n\t-ms-transform: translatez(0);\r\n\t-o-transform: translatez(0);\r\n\ttransform: translatez(0);\r\n\r\n\t&[tabulator-layout=\"fitDataFill\"]{\r\n\t\t.tabulator-tableHolder{\r\n\t\t\t.tabulator-table{\r\n\t\t\t\tmin-width:100%;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\t&[tabulator-layout=\"fitDataTable\"]{\r\n\t\tdisplay: inline-block;\r\n\t}\r\n\r\n\t&.tabulator-block-select{\r\n\t\tuser-select: none;\r\n\t}\r\n\r\n\t//column header containing element\r\n\t.tabulator-header{\r\n\t\tposition:relative;\r\n\t\tbox-sizing: border-box;\r\n\r\n\t\twidth:100%;\r\n\r\n\t\tborder-bottom:1px solid $headerSeperatorColor;\r\n\t\tbackground-color: $headerBackgroundColor;\r\n\t\tcolor: $headerTextColor;\r\n\t\tfont-weight:bold;\r\n\r\n\t\twhite-space: nowrap;\r\n\t\toverflow:hidden;\r\n\r\n\t\t-moz-user-select: none;\r\n\t\t-khtml-user-select: none;\r\n\t\t-webkit-user-select: none;\r\n\t\t-o-user-select: none;\r\n\r\n\t\t&.tabulator-header-hidden{\r\n\t\t\tdisplay:none;\r\n\t\t}\r\n\r\n\t\t//individual column header element\r\n\t\t.tabulator-col{\r\n\t\t\tdisplay:inline-block;\r\n\t\t\tposition:relative;\r\n\t\t\tbox-sizing:border-box;\r\n\t\t\tborder-right:1px solid $headerBorderColor;\r\n\t\t\tbackground:$headerBackgroundColor;\r\n\t\t\ttext-align:left;\r\n\t\t\tvertical-align: bottom;\r\n\t\t\toverflow: hidden;\r\n\r\n\t\t\t&.tabulator-moving{\r\n\t\t\t\tposition: absolute;\r\n\t\t\t\tborder:1px solid $headerSeperatorColor;\r\n\t\t\t\tbackground:darken($headerBackgroundColor, 10%);\r\n\t\t\t\tpointer-events: none;\r\n\t\t\t}\r\n\r\n\t\t\t//hold content of column header\r\n\t\t\t.tabulator-col-content{\r\n\t\t\t\tbox-sizing:border-box;\r\n\t\t\t\tposition: relative;\r\n\t\t\t\tpadding:4px;\r\n\r\n\t\t\t\t//header menu button\r\n\t\t\t\t.tabulator-header-menu-button{\r\n\t\t\t\t\tpadding: 0 8px;\r\n\r\n\t\t\t\t\t&:hover{\r\n\t\t\t\t\t\tcursor: pointer;\r\n\t\t\t\t\t\topacity: .6;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\r\n\t\t\t\t//hold title of column header\r\n\t\t\t\t.tabulator-col-title{\r\n\t\t\t\t\tbox-sizing:border-box;\r\n\t\t\t\t\twidth: 100%;\r\n\r\n\t\t\t\t\twhite-space: nowrap;\r\n\t\t\t\t\toverflow: hidden;\r\n\t\t\t\t\ttext-overflow: ellipsis;\r\n\t\t\t\t\tvertical-align:bottom;\r\n\r\n\t\t\t\t\t//element to hold title editor\r\n\t\t\t\t\t.tabulator-title-editor{\r\n\t\t\t\t\t\tbox-sizing: border-box;\r\n\t\t\t\t\t\twidth: 100%;\r\n\r\n\t\t\t\t\t\tborder:1px solid #999;\r\n\r\n\t\t\t\t\t\tpadding:1px;\r\n\r\n\t\t\t\t\t\tbackground: #fff;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\r\n\t\t\t\t//column sorter arrow\r\n\t\t\t\t.tabulator-arrow{\r\n\t\t\t\t\tdisplay: inline-block;\r\n\t\t\t\t\tposition: absolute;\r\n\t\t\t\t\ttop:9px;\r\n\t\t\t\t\tright:8px;\r\n\t\t\t\t\twidth: 0;\r\n\t\t\t\t\theight: 0;\r\n\t\t\t\t\tborder-left: 6px solid transparent;\r\n\t\t\t\t\tborder-right: 6px solid transparent;\r\n\t\t\t\t\tborder-bottom: 6px solid $sortArrowInactive;\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t\t//complex header column group\r\n\t\t\t&.tabulator-col-group{\r\n\r\n\t\t\t\t//gelement to hold sub columns in column group\r\n\t\t\t\t.tabulator-col-group-cols{\r\n\t\t\t\t\tposition:relative;\r\n\t\t\t\t\tdisplay: flex;\r\n\r\n\t\t\t\t\tborder-top:1px solid $headerBorderColor;\r\n\t\t\t\t\toverflow: hidden;\r\n\r\n\t\t\t\t\tmargin-right:-1px;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\t//hide left resize handle on first column\r\n\t\t\t&:first-child{\r\n\t\t\t\t.tabulator-col-resize-handle.prev{\r\n\t\t\t\t\tdisplay: none;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\t//header filter containing element\r\n\t\t\t.tabulator-header-filter{\r\n\t\t\t\tposition: relative;\r\n\t\t\t\tbox-sizing: border-box;\r\n\t\t\t\tmargin-top:2px;\r\n\t\t\t\twidth:100%;\r\n\t\t\t\ttext-align: center;\r\n\r\n\t\t\t\t//styling adjustment for inbuilt editors\r\n\t\t\t\ttextarea{\r\n\t\t\t\t\theight:auto !important;\r\n\t\t\t\t}\r\n\r\n\t\t\t\tsvg{\r\n\t\t\t\t\tmargin-top: 3px;\r\n\t\t\t\t}\r\n\r\n\t\t\t\tinput{\r\n\t\t\t\t\t&::-ms-clear {\r\n\t\t\t\t\t\twidth : 0;\r\n\t\t\t\t\t\theight: 0;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\t//styling child elements for sortable columns\r\n\t\t\t&.tabulator-sortable{\r\n\t\t\t\t.tabulator-col-title{\r\n\t\t\t\t\tpadding-right:25px;\r\n\t\t\t\t}\r\n\r\n\t\t\t\t&:hover{\r\n\t\t\t\t\tcursor:pointer;\r\n\t\t\t\t\tbackground-color:darken($headerBackgroundColor, 10%);\r\n\t\t\t\t}\r\n\r\n\t\t\t\t&[aria-sort=\"none\"]{\r\n\t\t\t\t\t.tabulator-col-content .tabulator-arrow{\r\n\t\t\t\t\t\tborder-top: none;\r\n\t\t\t\t\t\tborder-bottom: 6px solid $sortArrowInactive;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\r\n\t\t\t\t&[aria-sort=\"asc\"]{\r\n\t\t\t\t\t.tabulator-col-content .tabulator-arrow{\r\n\t\t\t\t\t\tborder-top: none;\r\n\t\t\t\t\t\tborder-bottom: 6px solid $sortArrowActive;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\r\n\t\t\t\t&[aria-sort=\"desc\"]{\r\n\t\t\t\t\t.tabulator-col-content .tabulator-arrow{\r\n\t\t\t\t\t\tborder-top: 6px solid $sortArrowActive;\r\n\t\t\t\t\t\tborder-bottom: none;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\r\n\t\t\t&.tabulator-col-vertical{\r\n\t\t\t\t.tabulator-col-content{\r\n\t\t\t\t\t.tabulator-col-title{\r\n\t\t\t\t\t\twriting-mode: vertical-rl;\r\n\t\t\t\t\t\ttext-orientation: mixed;\r\n\r\n\t\t\t\t\t\tdisplay:flex;\r\n\t\t\t\t\t\talign-items:center;\r\n\t\t\t\t\t\tjustify-content:center;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\r\n\t\t\t\t&.tabulator-col-vertical-flip{\r\n\t\t\t\t\t.tabulator-col-title{\r\n\t\t\t\t\t\ttransform: rotate(180deg);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\r\n\t\t\t\t&.tabulator-sortable{\r\n\t\t\t\t\t.tabulator-col-title{\r\n\t\t\t\t\t\tpadding-right:0;\r\n\t\t\t\t\t\tpadding-top:20px;\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\t&.tabulator-col-vertical-flip{\r\n\t\t\t\t\t\t.tabulator-col-title{\r\n\t\t\t\t\t\t\tpadding-right:0;\r\n\t\t\t\t\t\t\tpadding-bottom:20px;\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\t.tabulator-arrow{\r\n\t\t\t\t\t\tright:calc(50% - 6px);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t.tabulator-frozen{\r\n\t\t\tdisplay: inline-block;\r\n\t\t\tposition: absolute;\r\n\r\n\t\t\t// background-color: inherit;\r\n\r\n\t\t\tz-index: 10;\r\n\r\n\t\t\t&.tabulator-frozen-left{\r\n\t\t\t\tborder-right:2px solid $rowBorderColor;\r\n\t\t\t}\r\n\r\n\t\t\t&.tabulator-frozen-right{\r\n\t\t\t\tborder-left:2px solid $rowBorderColor;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\r\n\t\t.tabulator-calcs-holder{\r\n\t\t\tbox-sizing:border-box;\r\n\t\t\tmin-width:600%;\r\n\r\n\t\t\tbackground:lighten($headerBackgroundColor, 5%) !important;\r\n\r\n\t\t\t.tabulator-row{\r\n\t\t\t\tbackground:lighten($headerBackgroundColor, 5%) !important;\r\n\r\n\t\t\t\t.tabulator-col-resize-handle{\r\n\t\t\t\t\tdisplay: none;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\tborder-top:1px solid $rowBorderColor;\r\n\t\t\tborder-bottom:1px solid $headerBorderColor;\r\n\r\n\t\t\toverflow: hidden;\r\n\t\t}\r\n\r\n\t\t.tabulator-frozen-rows-holder{\r\n\t\t\tmin-width:600%;\r\n\r\n\t\t\t&:empty{\r\n\t\t\t\tdisplay: none;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\t//scrolling element to hold table\r\n\t.tabulator-tableHolder{\r\n\t\tposition:relative;\r\n\t\twidth:100%;\r\n\t\twhite-space: nowrap;\r\n\t\toverflow:auto;\r\n\t\t-webkit-overflow-scrolling: touch;\r\n\r\n\t\t&:focus{\r\n\t\t\toutline: none;\r\n\t\t}\r\n\r\n\t\t//default placeholder element\r\n\t\t.tabulator-placeholder{\r\n\t\t\tbox-sizing:border-box;\r\n\t\t\tdisplay: flex;\r\n\t\t\talign-items:center;\r\n\r\n\t\t\t&[tabulator-render-mode=\"virtual\"]{\r\n\t\t\t\tmin-height:100%;\r\n\t\t\t\tmin-width:100%;\r\n\t\t\t}\r\n\r\n\t\t\twidth:100%;\r\n\r\n\t\t\tspan{\r\n\t\t\t\tdisplay: inline-block;\r\n\r\n\t\t\t\tmargin:0 auto;\r\n\t\t\t\tpadding:10px;\r\n\r\n\t\t\t\tcolor:#ccc;\r\n\t\t\t\tfont-weight: bold;\r\n\t\t\t\tfont-size: 20px;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t//element to hold table rows\r\n\t\t.tabulator-table{\r\n\t\t\tposition:relative;\r\n\t\t\tdisplay:inline-block;\r\n\t\t\tbackground-color:$rowBackgroundColor;\r\n\t\t\twhite-space: nowrap;\r\n\t\t\toverflow:visible;\r\n\t\t\tcolor:$rowTextColor;\r\n\r\n\t\t\t//row element\r\n\t\t\t.tabulator-row{\r\n\t\t\t\t&.tabulator-calcs{\r\n\t\t\t\t\tfont-weight: bold;\r\n\t\t\t\t\tbackground:darken($rowAltBackgroundColor, 5%) !important;\r\n\r\n\t\t\t\t\t&.tabulator-calcs-top{\r\n\t\t\t\t\t\tborder-bottom:2px solid $rowBorderColor;\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\t&.tabulator-calcs-bottom{\r\n\t\t\t\t\t\tborder-top:2px solid $rowBorderColor;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t}\r\n\t}\r\n\r\n\r\n\r\n\t//footer element\r\n\t.tabulator-footer{\r\n\t\tpadding:5px 10px;\r\n\t\tborder-top:1px solid $footerSeperatorColor;\r\n\t\tbackground-color: $footerBackgroundColor;\r\n\t\ttext-align: right;\r\n\t\tcolor: $footerTextColor;\r\n\t\tfont-weight:bold;\r\n\t\twhite-space:nowrap;\r\n\t\tuser-select:none;\r\n\r\n\t\t-moz-user-select: none;\r\n\t\t-khtml-user-select: none;\r\n\t\t-webkit-user-select: none;\r\n\t\t-o-user-select: none;\r\n\r\n\t\t.tabulator-calcs-holder{\r\n\t\t\tbox-sizing:border-box;\r\n\t\t\twidth:calc(100% + 20px);\r\n\t\t\tmargin:-5px -10px 5px -10px;\r\n\r\n\t\t\ttext-align: left;\r\n\r\n\t\t\tbackground:lighten($footerBackgroundColor, 5%) !important;\r\n\r\n\t\t\t.tabulator-row{\r\n\t\t\t\tbackground:lighten($footerBackgroundColor, 5%) !important;\r\n\r\n\t\t\t\t.tabulator-col-resize-handle{\r\n\t\t\t\t\tdisplay: none;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\tborder-bottom:1px solid $rowBorderColor;\r\n\t\t\tborder-top:1px solid $rowBorderColor;\r\n\r\n\t\t\toverflow: hidden;\r\n\r\n\t\t\t&:only-child{\r\n\t\t\t\tmargin-bottom:-5px;\r\n\t\t\t\tborder-bottom:none;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t.tabulator-paginator{\r\n\t\t\tcolor: $footerTextColor;\r\n\t\t\tfont-family:inherit;\r\n\t\t\tfont-weight:inherit;\r\n\t\t\tfont-size:inherit;\r\n\t\t}\r\n\r\n\t\t//pagination container element\r\n\t\t.tabulator-page-size{\r\n\t\t\tdisplay:inline-block;\r\n\r\n\t\t\tmargin:0 5px;\r\n\t\t\tpadding:2px 5px;\r\n\r\n\t\t\tborder:1px solid $footerBorderColor;\r\n\t\t\tborder-radius:3px;\r\n\t\t}\r\n\r\n\t\t.tabulator-pages{\r\n\t\t\tmargin:0 7px;\r\n\t\t}\r\n\r\n\t\t//pagination button\r\n\t\t.tabulator-page{\r\n\t\t\tdisplay:inline-block;\r\n\r\n\t\t\tmargin:0 2px;\r\n\t\t\tpadding:2px 5px;\r\n\r\n\t\t\tborder:1px solid $footerBorderColor;\r\n\t\t\tborder-radius:3px;\r\n\r\n\t\t\tbackground:rgba(255,255,255,.2);\r\n\r\n\t\t\t&.active{\r\n\t\t\t\tcolor:$footerActiveColor;\r\n\t\t\t}\r\n\r\n\t\t\t&:disabled{\r\n\t\t\t\topacity:.5;\r\n\t\t\t}\r\n\r\n\t\t\t&:not(.disabled){\r\n\t\t\t\t&:hover{\r\n\t\t\t\t\tcursor:pointer;\r\n\t\t\t\t\tbackground:rgba(0,0,0,.2);\r\n\t\t\t\t\tcolor:#fff;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\t//column resize handles\r\n\t.tabulator-col-resize-handle{\r\n\t\tposition:absolute;\r\n\t\tright:0;\r\n\t\ttop:0;\r\n\t\tbottom:0;\r\n\t\twidth:5px;\r\n\r\n\t\t&.prev{\r\n\t\t\tleft:0;\r\n\t\t\tright:auto;\r\n\t\t}\r\n\r\n\t\t&:hover{\r\n\t\t\tcursor:ew-resize;\r\n\t\t}\r\n\t}\r\n\r\n\r\n\t//holding div that contains loader and covers tabulator element to prevent interaction\r\n\t.tabulator-loader{\r\n\t\tposition:absolute;\r\n\t\tdisplay: flex;\r\n\t\talign-items:center;\r\n\r\n\t\ttop:0;\r\n\t\tleft:0;\r\n\t\tz-index:100;\r\n\r\n\t\theight:100%;\r\n\t\twidth:100%;\r\n\t\tbackground:rgba(0,0,0,.4);\r\n\t\ttext-align:center;\r\n\r\n\t\t//loading message element\r\n\t\t.tabulator-loader-msg{\r\n\t\t\tdisplay:inline-block;\r\n\r\n\t\t\tmargin:0 auto;\r\n\t\t\tpadding:10px 20px;\r\n\r\n\t\t\tborder-radius:10px;\r\n\r\n\t\t\tbackground:#fff;\r\n\t\t\tfont-weight:bold;\r\n\t\t\tfont-size:16px;\r\n\r\n\t\t\t//loading message\r\n\t\t\t&.tabulator-loading{\r\n\t\t\t\tborder:4px solid #333;\r\n\t\t\t\tcolor:#000;\r\n\t\t\t}\r\n\r\n\t\t\t//error message\r\n\t\t\t&.tabulator-error{\r\n\t\t\t\tborder:4px solid #D00;\r\n\t\t\t\tcolor:#590000;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n}\r\n\r\n//row element\r\n.tabulator-row{\r\n\tposition: relative;\r\n\tbox-sizing: border-box;\r\n\tmin-height:$textSize + ($headerMargin * 2);\r\n\tbackground-color: $rowBackgroundColor;\r\n\r\n\r\n\t&.tabulator-row-even{\r\n\t\tbackground-color: $rowAltBackgroundColor;\r\n\t}\r\n\r\n\t&.tabulator-selectable:hover{\r\n\t\tbackground-color:$rowHoverBackground;\r\n\t\tcursor: pointer;\r\n\t}\r\n\r\n\t&.tabulator-selected{\r\n\t\tbackground-color:$rowSelectedBackground;\r\n\t}\r\n\r\n\t&.tabulator-selected:hover{\r\n\t\tbackground-color:$rowSelectedBackgroundHover;\r\n\t\tcursor: pointer;\r\n\t}\r\n\r\n\t&.tabulator-row-moving{\r\n\t\tborder:1px solid #000;\r\n\t\tbackground:#fff;\r\n\t}\r\n\r\n\t&.tabulator-moving{\r\n\t\tposition: absolute;\r\n\r\n\t\tborder-top:1px solid $rowBorderColor;\r\n\t\tborder-bottom:1px solid $rowBorderColor;\r\n\r\n\t\tpointer-events: none;\r\n\t\tz-index:15;\r\n\t}\r\n\r\n\t//row resize handles\r\n\t.tabulator-row-resize-handle{\r\n\t\tposition:absolute;\r\n\t\tright:0;\r\n\t\tbottom:0;\r\n\t\tleft:0;\r\n\t\theight:5px;\r\n\r\n\t\t&.prev{\r\n\t\t\ttop:0;\r\n\t\t\tbottom:auto;\r\n\t\t}\r\n\r\n\t\t&:hover{\r\n\t\t\tcursor:ns-resize;\r\n\t\t}\r\n\t}\r\n\r\n\t.tabulator-frozen{\r\n\t\tdisplay: inline-block;\r\n\t\tposition: absolute;\r\n\r\n\t\tbackground-color: inherit;\r\n\r\n\t\tz-index: 10;\r\n\r\n\t\t&.tabulator-frozen-left{\r\n\t\t\tborder-right:2px solid $rowBorderColor;\r\n\t\t}\r\n\r\n\t\t&.tabulator-frozen-right{\r\n\t\t\tborder-left:2px solid $rowBorderColor;\r\n\t\t}\r\n\t}\r\n\r\n\t.tabulator-responsive-collapse{\r\n\t\tbox-sizing:border-box;\r\n\r\n\t\tpadding:5px;\r\n\r\n\t\tborder-top:1px solid $rowBorderColor;\r\n\t\tborder-bottom:1px solid $rowBorderColor;\r\n\r\n\t\t&:empty{\r\n\t\t\tdisplay:none;\r\n\t\t}\r\n\r\n\t\ttable{\r\n\t\t\tfont-size:$textSize;\r\n\r\n\t\t\ttr{\r\n\t\t\t\ttd{\r\n\t\t\t\t\tposition: relative;\r\n\r\n\t\t\t\t\t&:first-of-type{\r\n\t\t\t\t\t\tpadding-right:10px;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\t//cell element\r\n\t.tabulator-cell{\r\n\t\tdisplay:inline-block;\r\n\t\tposition: relative;\r\n\t\tbox-sizing:border-box;\r\n\t\tpadding:4px;\r\n\t\tborder-right:1px solid $rowBorderColor;\r\n\t\tvertical-align:middle;\r\n\t\twhite-space:nowrap;\r\n\t\toverflow:hidden;\r\n\t\ttext-overflow:ellipsis;\r\n\r\n\t\t&.tabulator-editing{\r\n\t\t\tborder:1px solid $editBoxColor;\r\n\t\t\tpadding: 0;\r\n\r\n\t\t\tinput, select{\r\n\t\t\t\tborder:1px;\r\n\t\t\t\tbackground:transparent;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t&.tabulator-validation-fail{\r\n\t\t\tborder:1px solid $errorColor;\r\n\t\t\tinput, select{\r\n\t\t\t\tborder:1px;\r\n\t\t\t\tbackground:transparent;\r\n\r\n\t\t\t\tcolor: $errorColor;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t//hide left resize handle on first column\r\n\t\t&:first-child{\r\n\t\t\t.tabulator-col-resize-handle.prev{\r\n\t\t\t\tdisplay: none;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t//movable row handle\r\n\t\t&.tabulator-row-handle{\r\n\t\t\tdisplay: inline-flex;\r\n\t\t\talign-items:center;\r\n\t\t\tjustify-content:center;\r\n\r\n\t\t\t-moz-user-select: none;\r\n\t\t\t-khtml-user-select: none;\r\n\t\t\t-webkit-user-select: none;\r\n\t\t\t-o-user-select: none;\r\n\r\n\t\t\t//handle holder\r\n\t\t\t.tabulator-row-handle-box{\r\n\t\t\t\twidth:80%;\r\n\r\n\t\t\t\t//Hamburger element\r\n\t\t\t\t.tabulator-row-handle-bar{\r\n\t\t\t\t\twidth:100%;\r\n\t\t\t\t\theight:3px;\r\n\t\t\t\t\tmargin-top:2px;\r\n\t\t\t\t\tbackground:#666;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t.tabulator-data-tree-branch{\r\n\t\t\tdisplay:inline-block;\r\n\t\t\tvertical-align:middle;\r\n\r\n\t\t\theight:9px;\r\n\t\t\twidth:7px;\r\n\r\n\t\t\tmargin-top:-9px;\r\n\t\t\tmargin-right:5px;\r\n\r\n\t\t\tborder-bottom-left-radius:1px;\r\n\r\n\t\t\tborder-left:2px solid $rowBorderColor;\r\n\t\t\tborder-bottom:2px solid $rowBorderColor;\r\n\t\t}\r\n\r\n\t\t.tabulator-data-tree-control{\r\n\r\n\t\t\tdisplay:inline-flex;\r\n\t\t\tjustify-content:center;\r\n\t\t\talign-items:center;\r\n\t\t\tvertical-align:middle;\r\n\r\n\t\t\theight:11px;\r\n\t\t\twidth:11px;\r\n\r\n\t\t\tmargin-right:5px;\r\n\r\n\t\t\tborder:1px solid $rowTextColor;\r\n\t\t\tborder-radius:2px;\r\n\t\t\tbackground:rgba(0, 0, 0, .1);\r\n\r\n\t\t\toverflow:hidden;\r\n\r\n\t\t\t&:hover{\r\n\t\t\t\tcursor:pointer;\r\n\t\t\t\tbackground:rgba(0, 0, 0, .2);\r\n\t\t\t}\r\n\r\n\t\t\t.tabulator-data-tree-control-collapse{\r\n\t\t\t\tdisplay:inline-block;\r\n\t\t\t\tposition: relative;\r\n\r\n\t\t\t\theight: 7px;\r\n\t\t\t\twidth: 1px;\r\n\r\n\t\t\t\tbackground: transparent;\r\n\r\n\t\t\t\t&:after {\r\n\t\t\t\t\tposition: absolute;\r\n\t\t\t\t\tcontent: \"\";\r\n\t\t\t\t\tleft: -3px;\r\n\t\t\t\t\ttop: 3px;\r\n\r\n\t\t\t\t\theight: 1px;\r\n\t\t\t\t\twidth: 7px;\r\n\r\n\t\t\t\t\tbackground: $rowTextColor;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\t.tabulator-data-tree-control-expand{\r\n\t\t\t\tdisplay:inline-block;\r\n\t\t\t\tposition: relative;\r\n\r\n\t\t\t\theight: 7px;\r\n\t\t\t\twidth: 1px;\r\n\r\n\t\t\t\tbackground: $rowTextColor;\r\n\r\n\t\t\t\t&:after {\r\n\t\t\t\t\tposition: absolute;\r\n\t\t\t\t\tcontent: \"\";\r\n\t\t\t\t\tleft: -3px;\r\n\t\t\t\t\ttop: 3px;\r\n\r\n\t\t\t\t\theight: 1px;\r\n\t\t\t\t\twidth: 7px;\r\n\r\n\t\t\t\t\tbackground: $rowTextColor;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\t.tabulator-responsive-collapse-toggle{\r\n\t\t\tdisplay: inline-flex;\r\n\t\t\talign-items:center;\r\n\t\t\tjustify-content:center;\r\n\r\n\t\t\t-moz-user-select: none;\r\n\t\t\t-khtml-user-select: none;\r\n\t\t\t-webkit-user-select: none;\r\n\t\t\t-o-user-select: none;\r\n\r\n\t\t\theight:15px;\r\n\t\t\twidth:15px;\r\n\r\n\t\t\tborder-radius:20px;\r\n\t\t\tbackground:#666;\r\n\r\n\t\t\tcolor:$rowBackgroundColor;\r\n\t\t\tfont-weight:bold;\r\n\t\t\tfont-size:1.1em;\r\n\r\n\t\t\t&:hover{\r\n\t\t\t\topacity:.7;\r\n\t\t\t}\r\n\r\n\t\t\t&.open{\r\n\t\t\t\t.tabulator-responsive-collapse-toggle-close{\r\n\t\t\t\t\tdisplay:initial;\r\n\t\t\t\t}\r\n\r\n\t\t\t\t.tabulator-responsive-collapse-toggle-open{\r\n\t\t\t\t\tdisplay:none;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\t.tabulator-responsive-collapse-toggle-close{\r\n\t\t\t\tdisplay:none;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t.tabulator-traffic-light{\r\n\t\t\tdisplay: inline-block;\r\n\t\t\theight:14px;\r\n\t\t\twidth:14px;\r\n\r\n\t\t\tborder-radius:14px;\r\n\t\t}\r\n\t}\r\n\r\n\t//row grouping element\r\n\t&.tabulator-group{\r\n\t\tbox-sizing:border-box;\r\n\t\tborder-bottom:1px solid #999;\r\n\t\tborder-right:1px solid $rowBorderColor;\r\n\t\tborder-top:1px solid #999;\r\n\t\tpadding:5px;\r\n\t\tpadding-left:10px;\r\n\t\tbackground:#ccc;\r\n\t\tfont-weight:bold;\r\n\r\n\t\tmin-width: 100%;\r\n\r\n\t\t&:hover{\r\n\t\t\tcursor:pointer;\r\n\t\t\tbackground-color:rgba(0,0,0,.1);\r\n\t\t}\r\n\r\n\t\t&.tabulator-group-visible{\r\n\r\n\t\t\t.tabulator-arrow{\r\n\t\t\t\tmargin-right:10px;\r\n\t\t\t\tborder-left: 6px solid transparent;\r\n\t\t\t\tborder-right: 6px solid transparent;\r\n\t\t\t\tborder-top: 6px solid $sortArrowActive;\r\n\t\t\t\tborder-bottom: 0;\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\t&.tabulator-group-level-1{\r\n\t\t\tpadding-left:30px;\r\n\t\t}\r\n\r\n\t\t&.tabulator-group-level-2{\r\n\t\t\tpadding-left:50px;\r\n\t\t}\r\n\r\n\t\t&.tabulator-group-level-3{\r\n\t\t\tpadding-left:70px;\r\n\t\t}\r\n\r\n\t\t&.tabulator-group-level-4{\r\n\t\t\tpadding-left:90px;\r\n\t\t}\r\n\r\n\t\t&.tabulator-group-level-5{\r\n\t\t\tpadding-left:110px;\r\n\t\t}\r\n\r\n\t\t.tabulator-group-toggle{\r\n\t\t\tdisplay: inline-block;\r\n\t\t}\r\n\r\n\t\t//sorting arrow\r\n\t\t.tabulator-arrow{\r\n\t\t\tdisplay: inline-block;\r\n\t\t\twidth: 0;\r\n\t\t\theight: 0;\r\n\t\t\tmargin-right:16px;\r\n\t\t\tborder-top: 6px solid transparent;\r\n\t\t\tborder-bottom: 6px solid transparent;\r\n\t\t\tborder-right: 0;\r\n\t\t\tborder-left: 6px solid $sortArrowActive;\r\n\t\t\tvertical-align:middle;\r\n\t\t}\r\n\r\n\t\tspan{\r\n\t\t\tmargin-left:10px;\r\n\t\t\tcolor:#d00;\r\n\t\t}\r\n\t}\r\n\r\n}\r\n\r\n.tabulator-menu{\r\n\tposition: absolute;\r\n\tdisplay:inline-block;\r\n\tbox-sizing:border-box;\r\n\r\n\tbackground:$rowBackgroundColor;\r\n\tborder:1px solid $rowBorderColor;\r\n\tbox-shadow: 0 0 5px 0 rgba(0, 0, 0, .2);\r\n\r\n\tfont-size:$textSize;\r\n\r\n\toverflow-y:auto;\r\n\t-webkit-overflow-scrolling: touch;\r\n\r\n\tz-index: 10000;\r\n\r\n\t.tabulator-menu-item{\r\n\r\n\t\tpadding:5px 10px;\r\n\r\n\t\tuser-select: none;\r\n\r\n\t\t&.tabulator-menu-item-disabled{\r\n\t\t\topacity: .5;\r\n\t\t}\r\n\r\n\t\t&:not(.tabulator-menu-item-disabled):hover{\r\n\t\t\tcursor: pointer;\r\n\t\t\tbackground: $rowAltBackgroundColor;\r\n\t\t}\r\n\t}\r\n\r\n\t.tabulator-menu-separator{\r\n\t\tborder-top:1px solid $rowBorderColor;\r\n\t}\r\n}\r\n\r\n.tabulator-edit-select-list{\r\n\tposition: absolute;\r\n\tdisplay:inline-block;\r\n\tbox-sizing:border-box;\r\n\r\n\tmax-height:200px;\r\n\r\n\tbackground:$rowBackgroundColor;\r\n\tborder:1px solid $rowBorderColor;\r\n\r\n\tfont-size:$textSize;\r\n\r\n\toverflow-y:auto;\r\n\t-webkit-overflow-scrolling: touch;\r\n\r\n\tz-index: 10000;\r\n\r\n\t.tabulator-edit-select-list-item{\r\n\t\tpadding:4px;\r\n\r\n\t\tcolor:$rowTextColor;\r\n\r\n\t\t&.active{\r\n\t\t\tcolor:$rowBackgroundColor;\r\n\t\t\tbackground:$editBoxColor;\r\n\r\n\t\t\t&.focused{\r\n\t\t\t\toutline:1px solid rgba($rowBackgroundColor, .5);\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t&.focused{\r\n\t\t\toutline:1px solid $editBoxColor;\r\n\t\t}\r\n\r\n\t\t&:hover{\r\n\t\t\tcursor:pointer;\r\n\r\n\t\t\tcolor:$rowBackgroundColor;\r\n\t\t\tbackground:$editBoxColor;\r\n\t\t}\r\n\t}\r\n\r\n\t.tabulator-edit-select-list-notice{\r\n\t\tpadding:4px;\r\n\r\n\t\tcolor:$rowTextColor;\r\n\t\ttext-align: center;\r\n\t}\r\n\r\n\t.tabulator-edit-select-list-group{\r\n\t\tborder-bottom:1px solid $rowBorderColor;\r\n\r\n\t\tpadding:4px;\r\n\t\tpadding-top:6px;\r\n\r\n\t\tcolor:$rowTextColor;\r\n\t\tfont-weight:bold;\r\n\t}\r\n}\r\n\r\n// Table print styling\r\n\r\n.tabulator-print-fullscreen{\r\n\tposition: absolute;\r\n\ttop:0;\r\n\tbottom:0;\r\n\tleft:0;\r\n\tright:0;\r\n\r\n\tz-index: 10000;\r\n}\r\n\r\nbody.tabulator-print-fullscreen-hide>*:not(.tabulator-print-fullscreen){\r\n\tdisplay:none !important;\r\n}\r\n\r\n.tabulator-print-table{\r\n\tborder-collapse: collapse;\r\n\r\n\t.tabulator-data-tree-branch{\r\n\t\tdisplay:inline-block;\r\n\t\tvertical-align:middle;\r\n\r\n\t\theight:9px;\r\n\t\twidth:7px;\r\n\r\n\t\tmargin-top:-9px;\r\n\t\tmargin-right:5px;\r\n\r\n\t\tborder-bottom-left-radius:1px;\r\n\r\n\t\tborder-left:2px solid $rowBorderColor;\r\n\t\tborder-bottom:2px solid $rowBorderColor;\r\n\t}\r\n\r\n\t//row grouping element\r\n\t.tabulator-print-table-group{\r\n\t\tbox-sizing:border-box;\r\n\t\tborder-bottom:1px solid #999;\r\n\t\tborder-right:1px solid $rowBorderColor;\r\n\t\tborder-top:1px solid #999;\r\n\t\tpadding:5px;\r\n\t\tpadding-left:10px;\r\n\t\tbackground:#ccc;\r\n\t\tfont-weight:bold;\r\n\r\n\t\tmin-width: 100%;\r\n\r\n\t\t&:hover{\r\n\t\t\tcursor:pointer;\r\n\t\t\tbackground-color:rgba(0,0,0,.1);\r\n\t\t}\r\n\r\n\t\t&.tabulator-group-visible{\r\n\r\n\t\t\t.tabulator-arrow{\r\n\t\t\t\tmargin-right:10px;\r\n\t\t\t\tborder-left: 6px solid transparent;\r\n\t\t\t\tborder-right: 6px solid transparent;\r\n\t\t\t\tborder-top: 6px solid $sortArrowActive;\r\n\t\t\t\tborder-bottom: 0;\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\t&.tabulator-group-level-1{\r\n\t\t\ttd{\r\n\t\t\t\tpadding-left:30px !important;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t&.tabulator-group-level-2{\r\n\t\t\ttd{\r\n\t\t\t\tpadding-left:50px !important;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t&.tabulator-group-level-3{\r\n\t\t\ttd{\r\n\t\t\t\tpadding-left:70px !important;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t&.tabulator-group-level-4{\r\n\t\t\ttd{\r\n\t\t\t\tpadding-left:90px !important;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t&.tabulator-group-level-5{\r\n\t\t\ttd{\r\n\t\t\t\tpadding-left:110px !important;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t.tabulator-group-toggle{\r\n\t\t\tdisplay: inline-block;\r\n\t\t}\r\n\r\n\t\t//sorting arrow\r\n\t\t.tabulator-arrow{\r\n\t\t\tdisplay: inline-block;\r\n\t\t\twidth: 0;\r\n\t\t\theight: 0;\r\n\t\t\tmargin-right:16px;\r\n\t\t\tborder-top: 6px solid transparent;\r\n\t\t\tborder-bottom: 6px solid transparent;\r\n\t\t\tborder-right: 0;\r\n\t\t\tborder-left: 6px solid $sortArrowActive;\r\n\t\t\tvertical-align:middle;\r\n\t\t}\r\n\r\n\t\tspan{\r\n\t\t\tmargin-left:10px;\r\n\t\t\tcolor:#d00;\r\n\t\t}\r\n\t}\r\n\r\n\t.tabulator-data-tree-control{\r\n\r\n\t\tdisplay:inline-flex;\r\n\t\tjustify-content:center;\r\n\t\talign-items:center;\r\n\t\tvertical-align:middle;\r\n\r\n\t\theight:11px;\r\n\t\twidth:11px;\r\n\r\n\t\tmargin-right:5px;\r\n\r\n\t\tborder:1px solid $rowTextColor;\r\n\t\tborder-radius:2px;\r\n\t\tbackground:rgba(0, 0, 0, .1);\r\n\r\n\t\toverflow:hidden;\r\n\r\n\t\t&:hover{\r\n\t\t\tcursor:pointer;\r\n\t\t\tbackground:rgba(0, 0, 0, .2);\r\n\t\t}\r\n\r\n\t\t.tabulator-data-tree-control-collapse{\r\n\t\t\tdisplay:inline-block;\r\n\t\t\tposition: relative;\r\n\r\n\t\t\theight: 7px;\r\n\t\t\twidth: 1px;\r\n\r\n\t\t\tbackground: transparent;\r\n\r\n\t\t\t&:after {\r\n\t\t\t\tposition: absolute;\r\n\t\t\t\tcontent: \"\";\r\n\t\t\t\tleft: -3px;\r\n\t\t\t\ttop: 3px;\r\n\r\n\t\t\t\theight: 1px;\r\n\t\t\t\twidth: 7px;\r\n\r\n\t\t\t\tbackground: $rowTextColor;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t.tabulator-data-tree-control-expand{\r\n\t\t\tdisplay:inline-block;\r\n\t\t\tposition: relative;\r\n\r\n\t\t\theight: 7px;\r\n\t\t\twidth: 1px;\r\n\r\n\t\t\tbackground: $rowTextColor;\r\n\r\n\t\t\t&:after {\r\n\t\t\t\tposition: absolute;\r\n\t\t\t\tcontent: \"\";\r\n\t\t\t\tleft: -3px;\r\n\t\t\t\ttop: 3px;\r\n\r\n\t\t\t\theight: 1px;\r\n\t\t\t\twidth: 7px;\r\n\r\n\t\t\t\tbackground: $rowTextColor;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n}\r\n\r\n"]} \ No newline at end of file diff --git a/admin/js/vendors/tabulator/css/tabulator_site.css b/admin/js/vendors/tabulator/css/tabulator_site.css new file mode 100644 index 0000000..7139757 --- /dev/null +++ b/admin/js/vendors/tabulator/css/tabulator_site.css @@ -0,0 +1,993 @@ +/* Tabulator v4.7.0 (c) Oliver Folkerd */ +.tabulator { + position: relative; + border-bottom: 5px solid #293146; + background-color: #fff; + font-size: 14px; + text-align: left; + overflow: hidden; + -ms-transform: translatez(0); + transform: translatez(0); +} + +.tabulator[tabulator-layout="fitDataFill"] .tabulator-tableHolder .tabulator-table { + min-width: 100%; +} + +.tabulator[tabulator-layout="fitDataTable"] { + display: inline-block; +} + +.tabulator[tabulator-layout="fitColumns"] .tabulator-row .tabulator-cell:last-of-type { + border-right: none; +} + +.tabulator.tabulator-block-select { + -webkit-user-select: none; + -ms-user-select: none; + user-select: none; +} + +.tabulator .tabulator-header { + position: relative; + box-sizing: border-box; + width: 100%; + /* border-bottom: 3px solid #003268; */ + background-color: #293146; + color: #fff; + font-weight: bold; + white-space: nowrap; + overflow: hidden; + -moz-user-select: none; + -khtml-user-select: none; + -webkit-user-select: none; + -o-user-select: none; +} + +.tabulator .tabulator-header.tabulator-header-hidden { + display: none; +} + +.tabulator .tabulator-header .tabulator-col { + display: inline-block; + position: relative; + box-sizing: border-box; + border-right: 1px solid #aaa; + background-color: #293146; + text-align: left; + vertical-align: bottom; + overflow: hidden; +} + +.tabulator .tabulator-header .tabulator-col.tabulator-moving { + position: absolute; + /* border: 1px solid #3FB449; */ + background: #090909; + pointer-events: none; +} + +.tabulator .tabulator-header .tabulator-col .tabulator-col-content { + box-sizing: border-box; + position: relative; + padding: 8px; +} + +.tabulator .tabulator-header .tabulator-col .tabulator-col-content .tabulator-header-menu-button { + padding: 0 8px; +} + +.tabulator .tabulator-header .tabulator-col .tabulator-col-content .tabulator-header-menu-button:hover { + cursor: pointer; + opacity: .6; +} + +.tabulator .tabulator-header .tabulator-col .tabulator-col-content .tabulator-col-title { + box-sizing: border-box; + width: 100%; + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; + vertical-align: bottom; +} + +.tabulator .tabulator-header .tabulator-col .tabulator-col-content .tabulator-col-title .tabulator-title-editor { + box-sizing: border-box; + width: 100%; + border: 1px solid #999; + padding: 1px; + background: #fff; +} + +.tabulator .tabulator-header .tabulator-col .tabulator-col-content .tabulator-arrow { + display: inline-block; + position: absolute; + top: 14px; + right: 8px; + width: 0; + height: 0; + border-left: 6px solid transparent; + border-right: 6px solid transparent; + border-bottom: 6px solid #bbb; +} + +.tabulator .tabulator-header .tabulator-col.tabulator-col-group .tabulator-col-group-cols { + position: relative; + display: -ms-flexbox; + display: flex; + border-top: 1px solid #aaa; + overflow: hidden; + margin-right: -1px; +} + +.tabulator .tabulator-header .tabulator-col:first-child .tabulator-col-resize-handle.prev { + display: none; +} + +.tabulator .tabulator-header .tabulator-col .tabulator-header-filter { + position: relative; + box-sizing: border-box; + margin-top: 2px; + width: 100%; + text-align: center; +} + +.tabulator .tabulator-header .tabulator-col .tabulator-header-filter textarea { + height: auto !important; +} + +.tabulator .tabulator-header .tabulator-col .tabulator-header-filter svg { + margin-top: 3px; +} + +.tabulator .tabulator-header .tabulator-col .tabulator-header-filter input::-ms-clear { + width: 0; + height: 0; +} + +.tabulator .tabulator-header .tabulator-col.tabulator-sortable .tabulator-col-title { + padding-right: 25px; +} + +.tabulator .tabulator-header .tabulator-col.tabulator-sortable:hover { + cursor: pointer; + background-color: #090909; +} + +.tabulator .tabulator-header .tabulator-col.tabulator-sortable[aria-sort="none"] .tabulator-col-content .tabulator-arrow { + border-top: none; + border-bottom: 6px solid #bbb; +} + +.tabulator .tabulator-header .tabulator-col.tabulator-sortable[aria-sort="asc"] .tabulator-col-content .tabulator-arrow { + border-top: none; + /* border-bottom: 6px solid #3FB449; */ +} + +.tabulator .tabulator-header .tabulator-col.tabulator-sortable[aria-sort="desc"] .tabulator-col-content .tabulator-arrow { + border-top: 6px solid #3FB449; + border-bottom: none; +} + +.tabulator .tabulator-header .tabulator-col.tabulator-col-vertical .tabulator-col-content .tabulator-col-title { + -ms-writing-mode: tb-rl; + writing-mode: vertical-rl; + text-orientation: mixed; + display: -ms-flexbox; + display: flex; + -ms-flex-align: center; + align-items: center; + -ms-flex-pack: center; + justify-content: center; +} + +.tabulator .tabulator-header .tabulator-col.tabulator-col-vertical.tabulator-col-vertical-flip .tabulator-col-title { + -ms-transform: rotate(180deg); + transform: rotate(180deg); +} + +.tabulator .tabulator-header .tabulator-col.tabulator-col-vertical.tabulator-sortable .tabulator-col-title { + padding-right: 0; + padding-top: 20px; +} + +.tabulator .tabulator-header .tabulator-col.tabulator-col-vertical.tabulator-sortable.tabulator-col-vertical-flip .tabulator-col-title { + padding-right: 0; + padding-bottom: 20px; +} + +.tabulator .tabulator-header .tabulator-col.tabulator-col-vertical.tabulator-sortable .tabulator-arrow { + right: calc(50% - 6px); +} + +.tabulator .tabulator-header .tabulator-frozen { + display: inline-block; + position: absolute; + z-index: 10; +} + +.tabulator .tabulator-header .tabulator-frozen.tabulator-frozen-left { + border-right: 2px solid #aaa; +} + +.tabulator .tabulator-header .tabulator-frozen.tabulator-frozen-right { + border-left: 2px solid #aaa; +} + +.tabulator .tabulator-header .tabulator-calcs-holder { + box-sizing: border-box; + min-width: 600%; + background: #3c3c3c !important; + border-top: 1px solid #aaa; + overflow: hidden; +} + +.tabulator .tabulator-header .tabulator-calcs-holder .tabulator-row { + background: #3c3c3c !important; +} + +.tabulator .tabulator-header .tabulator-calcs-holder .tabulator-row .tabulator-col-resize-handle { + display: none; +} + +.tabulator .tabulator-header .tabulator-frozen-rows-holder { + min-width: 600%; +} + +.tabulator .tabulator-header .tabulator-frozen-rows-holder:empty { + display: none; +} + +.tabulator .tabulator-tableHolder { + position: relative; + width: 100%; + white-space: nowrap; + overflow: auto; + -webkit-overflow-scrolling: touch; +} + +.tabulator .tabulator-tableHolder:focus { + outline: none; +} + +.tabulator .tabulator-tableHolder .tabulator-placeholder { + box-sizing: border-box; + display: -ms-flexbox; + display: flex; + -ms-flex-align: center; + align-items: center; + width: 100%; +} + +.tabulator .tabulator-tableHolder .tabulator-placeholder[tabulator-render-mode="virtual"] { + min-height: 100%; + min-width: 100%; +} + +.tabulator .tabulator-tableHolder .tabulator-placeholder span { + display: inline-block; + margin: 0 auto; + padding: 10px; + color: #3FB449; + font-weight: bold; + font-size: 20px; +} + +.tabulator .tabulator-tableHolder .tabulator-table { + position: relative; + display: inline-block; + background-color: #fff; + white-space: nowrap; + overflow: visible; + color: #333; +} + +.tabulator .tabulator-tableHolder .tabulator-table .tabulator-row.tabulator-calcs { + font-weight: bold; + background: #484848 !important; + color: #fff; +} + +.tabulator .tabulator-footer { + padding: 5px 10px; + padding-top: 8px; + /* border-top: 3px solid #3FB449; */ + background-color: #293146; + text-align: right; + color: #293146; + font-weight: bold; + white-space: nowrap; + -ms-user-select: none; + user-select: none; + -moz-user-select: none; + -khtml-user-select: none; + -webkit-user-select: none; + -o-user-select: none; +} + +.tabulator .tabulator-footer .tabulator-calcs-holder { + box-sizing: border-box; + width: calc(100% + 20px); + margin: -8px -10px 8px -10px; + text-align: left; + background: #3c3c3c !important; + border-bottom: 1px solid #aaa; + overflow: hidden; +} + +.tabulator .tabulator-footer .tabulator-calcs-holder .tabulator-row { + background: #3c3c3c !important; + color: #fff !important; +} + +.tabulator .tabulator-footer .tabulator-calcs-holder .tabulator-row .tabulator-col-resize-handle { + display: none; +} + +.tabulator .tabulator-footer .tabulator-calcs-holder:only-child { + margin-bottom: -5px; + border-bottom: none; +} + +.tabulator .tabulator-footer .tabulator-paginator label { + color: #fff; +} + +.tabulator .tabulator-footer .tabulator-page-size { + display: inline-block; + margin: 0 5px; + padding: 2px 5px; + border: 1px solid #aaa; + border-radius: 3px; +} + +.tabulator .tabulator-footer .tabulator-pages { + margin: 0 7px; +} + +.tabulator .tabulator-footer .tabulator-page { + display: inline-block; + margin: 0 2px; + padding: 2px 5px; + border: 1px solid #aaa; + border-radius: 3px; + background: #fff; + color: #293146; + font-family: inherit; + font-weight: inherit; + font-size: inherit; +} + +.tabulator .tabulator-footer .tabulator-page.active { + /* color: #3FB449; */ +} + +.tabulator .tabulator-footer .tabulator-page:disabled { + opacity: .5; +} + +.tabulator .tabulator-footer .tabulator-page:not(.disabled):hover { + cursor: pointer; + background: rgba(0, 0, 0, 0.2); + color: #fff; +} + +.tabulator .tabulator-col-resize-handle { + position: absolute; + right: 0; + top: 0; + bottom: 0; + width: 5px; +} + +.tabulator .tabulator-col-resize-handle.prev { + left: 0; + right: auto; +} + +.tabulator .tabulator-col-resize-handle:hover { + cursor: ew-resize; +} + +.tabulator .tabulator-loader { + position: absolute; + display: -ms-flexbox; + display: flex; + -ms-flex-align: center; + align-items: center; + top: 0; + left: 0; + z-index: 100; + height: 100%; + width: 100%; + background: rgba(0, 0, 0, 0.4); + text-align: center; +} + +.tabulator .tabulator-loader .tabulator-loader-msg { + display: inline-block; + margin: 0 auto; + padding: 10px 20px; + border-radius: 10px; + background: #fff; + font-weight: bold; + font-size: 16px; +} + +.tabulator .tabulator-loader .tabulator-loader-msg.tabulator-loading { + border: 4px solid #333; + color: #000; +} + +.tabulator .tabulator-loader .tabulator-loader-msg.tabulator-error { + border: 4px solid #D00; + color: #590000; +} + +.tabulator-row { + position: relative; + box-sizing: border-box; + min-height: 22px; + background-color: #fff; +} + +.tabulator-row.tabulator-row-even { + background-color: #EFEFEF; +} + +.tabulator-row.tabulator-selectable:hover { + background-color: #bbb; + cursor: pointer; +} + +.tabulator-row.tabulator-selected { + background-color: #9ABCEA; +} + +.tabulator-row.tabulator-selected:hover { + background-color: #769BCC; + cursor: pointer; +} + +.tabulator-row.tabulator-row-moving { + border: 1px solid #000; + background: #fff; +} + +.tabulator-row.tabulator-moving { + position: absolute; + border-top: 1px solid #aaa; + border-bottom: 1px solid #aaa; + pointer-events: none !important; + z-index: 15; +} + +.tabulator-row .tabulator-row-resize-handle { + position: absolute; + right: 0; + bottom: 0; + left: 0; + height: 5px; +} + +.tabulator-row .tabulator-row-resize-handle.prev { + top: 0; + bottom: auto; +} + +.tabulator-row .tabulator-row-resize-handle:hover { + cursor: ns-resize; +} + +.tabulator-row .tabulator-frozen { + display: inline-block; + position: absolute; + background-color: inherit; + z-index: 10; +} + +.tabulator-row .tabulator-frozen.tabulator-frozen-left { + border-right: 2px solid #aaa; +} + +.tabulator-row .tabulator-frozen.tabulator-frozen-right { + border-left: 2px solid #aaa; +} + +.tabulator-row .tabulator-responsive-collapse { + box-sizing: border-box; + padding: 5px; + border-top: 1px solid #aaa; + border-bottom: 1px solid #aaa; +} + +.tabulator-row .tabulator-responsive-collapse:empty { + display: none; +} + +.tabulator-row .tabulator-responsive-collapse table { + font-size: 14px; +} + +.tabulator-row .tabulator-responsive-collapse table tr td { + position: relative; +} + +.tabulator-row .tabulator-responsive-collapse table tr td:first-of-type { + padding-right: 10px; +} + +.tabulator-row .tabulator-cell { + display: inline-block; + position: relative; + box-sizing: border-box; + padding: 6px; + border-right: 1px solid #aaa; + vertical-align: middle; + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; +} + +.tabulator-row .tabulator-cell.tabulator-editing { + border: 1px solid #1D68CD; + padding: 0; +} + +.tabulator-row .tabulator-cell.tabulator-editing input, .tabulator-row .tabulator-cell.tabulator-editing select { + border: 1px; + background: transparent; +} + +.tabulator-row .tabulator-cell.tabulator-validation-fail { + border: 1px solid #dd0000; +} + +.tabulator-row .tabulator-cell.tabulator-validation-fail input, .tabulator-row .tabulator-cell.tabulator-validation-fail select { + border: 1px; + background: transparent; + color: #dd0000; +} + +.tabulator-row .tabulator-cell:first-child .tabulator-col-resize-handle.prev { + display: none; +} + +.tabulator-row .tabulator-cell.tabulator-row-handle { + display: -ms-inline-flexbox; + display: inline-flex; + -ms-flex-align: center; + align-items: center; + -moz-user-select: none; + -khtml-user-select: none; + -webkit-user-select: none; + -o-user-select: none; +} + +.tabulator-row .tabulator-cell.tabulator-row-handle .tabulator-row-handle-box { + width: 80%; +} + +.tabulator-row .tabulator-cell.tabulator-row-handle .tabulator-row-handle-box .tabulator-row-handle-bar { + width: 100%; + height: 3px; + margin-top: 2px; + background: #3FB449; +} + +.tabulator-row .tabulator-cell .tabulator-data-tree-branch { + display: inline-block; + vertical-align: middle; + height: 9px; + width: 7px; + margin-top: -9px; + margin-right: 5px; + border-bottom-left-radius: 1px; + border-left: 2px solid #aaa; + border-bottom: 2px solid #aaa; +} + +.tabulator-row .tabulator-cell .tabulator-data-tree-control { + display: -ms-inline-flexbox; + display: inline-flex; + -ms-flex-pack: center; + justify-content: center; + -ms-flex-align: center; + align-items: center; + vertical-align: middle; + height: 11px; + width: 11px; + margin-right: 5px; + border: 1px solid #333; + border-radius: 2px; + background: rgba(0, 0, 0, 0.1); + overflow: hidden; +} + +.tabulator-row .tabulator-cell .tabulator-data-tree-control:hover { + cursor: pointer; + background: rgba(0, 0, 0, 0.2); +} + +.tabulator-row .tabulator-cell .tabulator-data-tree-control .tabulator-data-tree-control-collapse { + display: inline-block; + position: relative; + height: 7px; + width: 1px; + background: transparent; +} + +.tabulator-row .tabulator-cell .tabulator-data-tree-control .tabulator-data-tree-control-collapse:after { + position: absolute; + content: ""; + left: -3px; + top: 3px; + height: 1px; + width: 7px; + background: #333; +} + +.tabulator-row .tabulator-cell .tabulator-data-tree-control .tabulator-data-tree-control-expand { + display: inline-block; + position: relative; + height: 7px; + width: 1px; + background: #333; +} + +.tabulator-row .tabulator-cell .tabulator-data-tree-control .tabulator-data-tree-control-expand:after { + position: absolute; + content: ""; + left: -3px; + top: 3px; + height: 1px; + width: 7px; + background: #333; +} + +.tabulator-row .tabulator-cell .tabulator-responsive-collapse-toggle { + display: -ms-inline-flexbox; + display: inline-flex; + -ms-flex-align: center; + align-items: center; + -ms-flex-pack: center; + justify-content: center; + -moz-user-select: none; + -khtml-user-select: none; + -webkit-user-select: none; + -o-user-select: none; + height: 15px; + width: 15px; + border-radius: 20px; + background: #666; + color: #fff; + font-weight: bold; + font-size: 1.1em; +} + +.tabulator-row .tabulator-cell .tabulator-responsive-collapse-toggle:hover { + opacity: .7; +} + +.tabulator-row .tabulator-cell .tabulator-responsive-collapse-toggle.open .tabulator-responsive-collapse-toggle-close { + display: initial; +} + +.tabulator-row .tabulator-cell .tabulator-responsive-collapse-toggle.open .tabulator-responsive-collapse-toggle-open { + display: none; +} + +.tabulator-row .tabulator-cell .tabulator-responsive-collapse-toggle .tabulator-responsive-collapse-toggle-close { + display: none; +} + +.tabulator-row .tabulator-cell .tabulator-traffic-light { + display: inline-block; + height: 14px; + width: 14px; + border-radius: 14px; +} + +.tabulator-row.tabulator-group { + box-sizing: border-box; + border-right: 1px solid #aaa; + border-top: 1px solid #000; + /* border-bottom: 2px solid #3FB449; */ + padding: 5px; + padding-left: 10px; + background: #293146; + color: #fff; + font-weight: bold; + min-width: 100%; +} + +.tabulator-row.tabulator-group:hover { + cursor: pointer; + background-color: #090909; +} + +.tabulator-row.tabulator-group.tabulator-group-visible .tabulator-arrow { + margin-right: 10px; + border-left: 6px solid transparent; + border-right: 6px solid transparent; + border-top: 6px solid #bbb; + border-bottom: 0; +} + +.tabulator-row.tabulator-group.tabulator-group-level-1 { + padding-left: 30px; +} + +.tabulator-row.tabulator-group.tabulator-group-level-2 { + padding-left: 50px; +} + +.tabulator-row.tabulator-group.tabulator-group-level-3 { + padding-left: 70px; +} + +.tabulator-row.tabulator-group.tabulator-group-level-4 { + padding-left: 90px; +} + +.tabulator-row.tabulator-group.tabulator-group-level-5 { + padding-left: 110px; +} + +.tabulator-row.tabulator-group .tabulator-group-toggle { + display: inline-block; +} + +.tabulator-row.tabulator-group .tabulator-arrow { + display: inline-block; + width: 0; + height: 0; + margin-right: 16px; + border-top: 6px solid transparent; + border-bottom: 6px solid transparent; + border-right: 0; + border-left: 6px solid #bbb; + vertical-align: middle; +} + +.tabulator-row.tabulator-group span { + margin-left: 10px; + color: #bbb; +} + +.tabulator-menu { + position: absolute; + display: inline-block; + box-sizing: border-box; + background: #fff; + border: 1px solid #aaa; + box-shadow: 0 0 5px 0 rgba(0, 0, 0, 0.2); + font-size: 14px; + overflow-y: auto; + -webkit-overflow-scrolling: touch; + z-index: 10000; +} + +.tabulator-menu .tabulator-menu-item { + padding: 5px 10px; + -webkit-user-select: none; + -ms-user-select: none; + user-select: none; +} + +.tabulator-menu .tabulator-menu-item.tabulator-menu-item-disabled { + opacity: .5; +} + +.tabulator-menu .tabulator-menu-item:not(.tabulator-menu-item-disabled):hover { + cursor: pointer; + background: #EFEFEF; +} + +.tabulator-menu .tabulator-menu-separator { + border-top: 1px solid #aaa; +} + +.tabulator-edit-select-list { + position: absolute; + display: inline-block; + box-sizing: border-box; + max-height: 200px; + background: #fff; + border: 1px solid #aaa; + font-size: 14px; + overflow-y: auto; + -webkit-overflow-scrolling: touch; + z-index: 10000; +} + +.tabulator-edit-select-list .tabulator-edit-select-list-item { + padding: 4px; + color: #333; +} + +.tabulator-edit-select-list .tabulator-edit-select-list-item.active { + color: #fff; + background: #1D68CD; +} + +.tabulator-edit-select-list .tabulator-edit-select-list-item.active.focused { + outline: 1px solid rgba(255, 255, 255, 0.5); +} + +.tabulator-edit-select-list .tabulator-edit-select-list-item.focused { + outline: 1px solid #1D68CD; +} + +.tabulator-edit-select-list .tabulator-edit-select-list-item:hover { + cursor: pointer; + color: #fff; + background: #1D68CD; +} + +.tabulator-edit-select-list .tabulator-edit-select-list-notice { + padding: 4px; + color: #333; + text-align: center; +} + +.tabulator-edit-select-list .tabulator-edit-select-list-group { + border-bottom: 1px solid #aaa; + padding: 4px; + padding-top: 6px; + color: #333; + font-weight: bold; +} + +.tabulator-print-fullscreen { + position: absolute; + top: 0; + bottom: 0; + left: 0; + right: 0; + z-index: 10000; +} + +body.tabulator-print-fullscreen-hide > *:not(.tabulator-print-fullscreen) { + display: none !important; +} + +.tabulator-print-table { + border-collapse: collapse; +} + +.tabulator-print-table .tabulator-print-table-group { + box-sizing: border-box; + border-right: 1px solid #aaa; + border-top: 1px solid #000; + border-bottom: 2px solid #3FB449; + padding: 5px; + padding-left: 10px; + background: #293146; + color: #fff; + font-weight: bold; + min-width: 100%; +} + +.tabulator-print-table .tabulator-print-table-group:hover { + cursor: pointer; + background-color: #090909; +} + +.tabulator-print-table .tabulator-print-table-group.tabulator-group-visible .tabulator-arrow { + margin-right: 10px; + border-left: 6px solid transparent; + border-right: 6px solid transparent; + border-top: 6px solid #3FB449; + border-bottom: 0; +} + +.tabulator-print-table .tabulator-print-table-group.tabulator-group-level-1 td { + padding-left: 30px !important; +} + +.tabulator-print-table .tabulator-print-table-group.tabulator-group-level-2 td { + padding-left: 50px !important; +} + +.tabulator-print-table .tabulator-print-table-group.tabulator-group-level-3 td { + padding-left: 70px !important; +} + +.tabulator-print-table .tabulator-print-table-group.tabulator-group-level-4 td { + padding-left: 90px !important; +} + +.tabulator-print-table .tabulator-print-table-group.tabulator-group-level-5 td { + padding-left: 110px !important; +} + +.tabulator-print-table .tabulator-print-table-group .tabulator-group-toggle { + display: inline-block; +} + +.tabulator-print-table .tabulator-print-table-group .tabulator-arrow { + display: inline-block; + width: 0; + height: 0; + margin-right: 16px; + border-top: 6px solid transparent; + border-bottom: 6px solid transparent; + border-right: 0; + border-left: 6px solid #3FB449; + vertical-align: middle; +} + +.tabulator-print-table .tabulator-print-table-group span { + margin-left: 10px; + color: #3FB449; +} + +.tabulator-print-table .tabulator-data-tree-branch { + display: inline-block; + vertical-align: middle; + height: 9px; + width: 7px; + margin-top: -9px; + margin-right: 5px; + border-bottom-left-radius: 1px; + border-left: 2px solid #aaa; + border-bottom: 2px solid #aaa; +} + +.tabulator-print-table .tabulator-data-tree-control { + display: -ms-inline-flexbox; + display: inline-flex; + -ms-flex-pack: center; + justify-content: center; + -ms-flex-align: center; + align-items: center; + vertical-align: middle; + height: 11px; + width: 11px; + margin-right: 5px; + border: 1px solid #333; + border-radius: 2px; + background: rgba(0, 0, 0, 0.1); + overflow: hidden; +} + +.tabulator-print-table .tabulator-data-tree-control:hover { + cursor: pointer; + background: rgba(0, 0, 0, 0.2); +} + +.tabulator-print-table .tabulator-data-tree-control .tabulator-data-tree-control-collapse { + display: inline-block; + position: relative; + height: 7px; + width: 1px; + background: transparent; +} + +.tabulator-print-table .tabulator-data-tree-control .tabulator-data-tree-control-collapse:after { + position: absolute; + content: ""; + left: -3px; + top: 3px; + height: 1px; + width: 7px; + background: #333; +} + +.tabulator-print-table .tabulator-data-tree-control .tabulator-data-tree-control-expand { + display: inline-block; + position: relative; + height: 7px; + width: 1px; + background: #333; +} + +.tabulator-print-table .tabulator-data-tree-control .tabulator-data-tree-control-expand:after { + position: absolute; + content: ""; + left: -3px; + top: 3px; + height: 1px; + width: 7px; + background: #333; +} diff --git a/admin/js/vendors/tabulator/css/tabulator_site.min.css b/admin/js/vendors/tabulator/css/tabulator_site.min.css new file mode 100644 index 0000000..67f5443 --- /dev/null +++ b/admin/js/vendors/tabulator/css/tabulator_site.min.css @@ -0,0 +1 @@ +.tabulator{position:relative;border-bottom:5px solid #293146;background-color:#fff;font-size:14px;text-align:left;overflow:hidden;-ms-transform:translatez(0);transform:translatez(0)}.tabulator[tabulator-layout=fitDataFill] .tabulator-tableHolder .tabulator-table{min-width:100%}.tabulator[tabulator-layout=fitDataTable]{display:inline-block}.tabulator[tabulator-layout=fitColumns] .tabulator-row .tabulator-cell:last-of-type{border-right:none}.tabulator.tabulator-block-select{-webkit-user-select:none;-ms-user-select:none;user-select:none}.tabulator .tabulator-header{position:relative;box-sizing:border-box;width:100%;background-color:#293146;color:#fff;font-weight:700;white-space:nowrap;overflow:hidden;-moz-user-select:none;-khtml-user-select:none;-webkit-user-select:none;-o-user-select:none}.tabulator .tabulator-header.tabulator-header-hidden{display:none}.tabulator .tabulator-header .tabulator-col{display:inline-block;position:relative;box-sizing:border-box;border-right:1px solid #aaa;background-color:#293146;text-align:left;vertical-align:bottom;overflow:hidden}.tabulator .tabulator-header .tabulator-col.tabulator-moving{position:absolute;background:#090909;pointer-events:none}.tabulator .tabulator-header .tabulator-col .tabulator-col-content{box-sizing:border-box;position:relative;padding:8px}.tabulator .tabulator-header .tabulator-col .tabulator-col-content .tabulator-header-menu-button{padding:0 8px}.tabulator .tabulator-header .tabulator-col .tabulator-col-content .tabulator-header-menu-button:hover{cursor:pointer;opacity:.6}.tabulator .tabulator-header .tabulator-col .tabulator-col-content .tabulator-col-title{box-sizing:border-box;width:100%;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;vertical-align:bottom}.tabulator .tabulator-header .tabulator-col .tabulator-col-content .tabulator-col-title .tabulator-title-editor{box-sizing:border-box;width:100%;border:1px solid #999;padding:1px;background:#fff}.tabulator .tabulator-header .tabulator-col .tabulator-col-content .tabulator-arrow{display:inline-block;position:absolute;top:14px;right:8px;width:0;height:0;border-left:6px solid transparent;border-right:6px solid transparent;border-bottom:6px solid #bbb}.tabulator .tabulator-header .tabulator-col.tabulator-col-group .tabulator-col-group-cols{position:relative;display:-ms-flexbox;display:flex;border-top:1px solid #aaa;overflow:hidden;margin-right:-1px}.tabulator .tabulator-header .tabulator-col:first-child .tabulator-col-resize-handle.prev{display:none}.tabulator .tabulator-header .tabulator-col .tabulator-header-filter{position:relative;box-sizing:border-box;margin-top:2px;width:100%;text-align:center}.tabulator .tabulator-header .tabulator-col .tabulator-header-filter textarea{height:auto!important}.tabulator .tabulator-header .tabulator-col .tabulator-header-filter svg{margin-top:3px}.tabulator .tabulator-header .tabulator-col .tabulator-header-filter input::-ms-clear{width:0;height:0}.tabulator .tabulator-header .tabulator-col.tabulator-sortable .tabulator-col-title{padding-right:25px}.tabulator .tabulator-header .tabulator-col.tabulator-sortable:hover{cursor:pointer;background-color:#090909}.tabulator .tabulator-header .tabulator-col.tabulator-sortable[aria-sort=none] .tabulator-col-content .tabulator-arrow{border-top:none;border-bottom:6px solid #bbb}.tabulator .tabulator-header .tabulator-col.tabulator-sortable[aria-sort=asc] .tabulator-col-content .tabulator-arrow{border-top:none}.tabulator .tabulator-header .tabulator-col.tabulator-sortable[aria-sort=desc] .tabulator-col-content .tabulator-arrow{border-top:6px solid #3fb449;border-bottom:none}.tabulator .tabulator-header .tabulator-col.tabulator-col-vertical .tabulator-col-content .tabulator-col-title{-ms-writing-mode:tb-rl;writing-mode:vertical-rl;text-orientation:mixed;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center}.tabulator .tabulator-header .tabulator-col.tabulator-col-vertical.tabulator-col-vertical-flip .tabulator-col-title{-ms-transform:rotate(180deg);transform:rotate(180deg)}.tabulator .tabulator-header .tabulator-col.tabulator-col-vertical.tabulator-sortable .tabulator-col-title{padding-right:0;padding-top:20px}.tabulator .tabulator-header .tabulator-col.tabulator-col-vertical.tabulator-sortable.tabulator-col-vertical-flip .tabulator-col-title{padding-right:0;padding-bottom:20px}.tabulator .tabulator-header .tabulator-col.tabulator-col-vertical.tabulator-sortable .tabulator-arrow{right:calc(50% - 6px)}.tabulator .tabulator-header .tabulator-frozen{display:inline-block;position:absolute;z-index:10}.tabulator .tabulator-header .tabulator-frozen.tabulator-frozen-left{border-right:2px solid #aaa}.tabulator .tabulator-header .tabulator-frozen.tabulator-frozen-right{border-left:2px solid #aaa}.tabulator .tabulator-header .tabulator-calcs-holder{box-sizing:border-box;min-width:600%;background:#3c3c3c!important;border-top:1px solid #aaa;overflow:hidden}.tabulator .tabulator-header .tabulator-calcs-holder .tabulator-row{background:#3c3c3c!important}.tabulator .tabulator-header .tabulator-calcs-holder .tabulator-row .tabulator-col-resize-handle{display:none}.tabulator .tabulator-header .tabulator-frozen-rows-holder{min-width:600%}.tabulator .tabulator-header .tabulator-frozen-rows-holder:empty{display:none}.tabulator .tabulator-tableHolder{position:relative;width:100%;white-space:nowrap;overflow:auto;-webkit-overflow-scrolling:touch}.tabulator .tabulator-tableHolder:focus{outline:0}.tabulator .tabulator-tableHolder .tabulator-placeholder{box-sizing:border-box;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;width:100%}.tabulator .tabulator-tableHolder .tabulator-placeholder[tabulator-render-mode=virtual]{min-height:100%;min-width:100%}.tabulator .tabulator-tableHolder .tabulator-placeholder span{display:inline-block;margin:0 auto;padding:10px;color:#3fb449;font-weight:700;font-size:20px}.tabulator .tabulator-tableHolder .tabulator-table{position:relative;display:inline-block;background-color:#fff;white-space:nowrap;overflow:visible;color:#333}.tabulator .tabulator-tableHolder .tabulator-table .tabulator-row.tabulator-calcs{font-weight:700;background:#484848!important;color:#fff}.tabulator .tabulator-footer{padding:5px 10px;padding-top:8px;background-color:#293146;text-align:right;color:#293146;font-weight:700;white-space:nowrap;-ms-user-select:none;user-select:none;-moz-user-select:none;-khtml-user-select:none;-webkit-user-select:none;-o-user-select:none}.tabulator .tabulator-footer .tabulator-calcs-holder{box-sizing:border-box;width:calc(100% + 20px);margin:-8px -10px 8px -10px;text-align:left;background:#3c3c3c!important;border-bottom:1px solid #aaa;overflow:hidden}.tabulator .tabulator-footer .tabulator-calcs-holder .tabulator-row{background:#3c3c3c!important;color:#fff!important}.tabulator .tabulator-footer .tabulator-calcs-holder .tabulator-row .tabulator-col-resize-handle{display:none}.tabulator .tabulator-footer .tabulator-calcs-holder:only-child{margin-bottom:-5px;border-bottom:none}.tabulator .tabulator-footer .tabulator-paginator label{color:#fff}.tabulator .tabulator-footer .tabulator-page-size{display:inline-block;margin:0 5px;padding:2px 5px;border:1px solid #aaa;border-radius:3px}.tabulator .tabulator-footer .tabulator-pages{margin:0 7px}.tabulator .tabulator-footer .tabulator-page{display:inline-block;margin:0 2px;padding:2px 5px;border:1px solid #aaa;border-radius:3px;background:#fff;color:#293146;font-family:inherit;font-weight:inherit;font-size:inherit}.tabulator .tabulator-footer .tabulator-page:disabled{opacity:.5}.tabulator .tabulator-footer .tabulator-page:not(.disabled):hover{cursor:pointer;background:rgba(0,0,0,.2);color:#fff}.tabulator .tabulator-col-resize-handle{position:absolute;right:0;top:0;bottom:0;width:5px}.tabulator .tabulator-col-resize-handle.prev{left:0;right:auto}.tabulator .tabulator-col-resize-handle:hover{cursor:ew-resize}.tabulator .tabulator-loader{position:absolute;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;top:0;left:0;z-index:100;height:100%;width:100%;background:rgba(0,0,0,.4);text-align:center}.tabulator .tabulator-loader .tabulator-loader-msg{display:inline-block;margin:0 auto;padding:10px 20px;border-radius:10px;background:#fff;font-weight:700;font-size:16px}.tabulator .tabulator-loader .tabulator-loader-msg.tabulator-loading{border:4px solid #333;color:#000}.tabulator .tabulator-loader .tabulator-loader-msg.tabulator-error{border:4px solid #d00;color:#590000}.tabulator-row{position:relative;box-sizing:border-box;min-height:22px;background-color:#fff}.tabulator-row.tabulator-row-even{background-color:#efefef}.tabulator-row.tabulator-selectable:hover{background-color:#bbb;cursor:pointer}.tabulator-row.tabulator-selected{background-color:#9abcea}.tabulator-row.tabulator-selected:hover{background-color:#769bcc;cursor:pointer}.tabulator-row.tabulator-row-moving{border:1px solid #000;background:#fff}.tabulator-row.tabulator-moving{position:absolute;border-top:1px solid #aaa;border-bottom:1px solid #aaa;pointer-events:none!important;z-index:15}.tabulator-row .tabulator-row-resize-handle{position:absolute;right:0;bottom:0;left:0;height:5px}.tabulator-row .tabulator-row-resize-handle.prev{top:0;bottom:auto}.tabulator-row .tabulator-row-resize-handle:hover{cursor:ns-resize}.tabulator-row .tabulator-frozen{display:inline-block;position:absolute;background-color:inherit;z-index:10}.tabulator-row .tabulator-frozen.tabulator-frozen-left{border-right:2px solid #aaa}.tabulator-row .tabulator-frozen.tabulator-frozen-right{border-left:2px solid #aaa}.tabulator-row .tabulator-responsive-collapse{box-sizing:border-box;padding:5px;border-top:1px solid #aaa;border-bottom:1px solid #aaa}.tabulator-row .tabulator-responsive-collapse:empty{display:none}.tabulator-row .tabulator-responsive-collapse table{font-size:14px}.tabulator-row .tabulator-responsive-collapse table tr td{position:relative}.tabulator-row .tabulator-responsive-collapse table tr td:first-of-type{padding-right:10px}.tabulator-row .tabulator-cell{display:inline-block;position:relative;box-sizing:border-box;padding:6px;border-right:1px solid #aaa;vertical-align:middle;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.tabulator-row .tabulator-cell.tabulator-editing{border:1px solid #1d68cd;padding:0}.tabulator-row .tabulator-cell.tabulator-editing input,.tabulator-row .tabulator-cell.tabulator-editing select{border:1px;background:0 0}.tabulator-row .tabulator-cell.tabulator-validation-fail{border:1px solid #d00}.tabulator-row .tabulator-cell.tabulator-validation-fail input,.tabulator-row .tabulator-cell.tabulator-validation-fail select{border:1px;background:0 0;color:#d00}.tabulator-row .tabulator-cell:first-child .tabulator-col-resize-handle.prev{display:none}.tabulator-row .tabulator-cell.tabulator-row-handle{display:-ms-inline-flexbox;display:inline-flex;-ms-flex-align:center;align-items:center;-moz-user-select:none;-khtml-user-select:none;-webkit-user-select:none;-o-user-select:none}.tabulator-row .tabulator-cell.tabulator-row-handle .tabulator-row-handle-box{width:80%}.tabulator-row .tabulator-cell.tabulator-row-handle .tabulator-row-handle-box .tabulator-row-handle-bar{width:100%;height:3px;margin-top:2px;background:#3fb449}.tabulator-row .tabulator-cell .tabulator-data-tree-branch{display:inline-block;vertical-align:middle;height:9px;width:7px;margin-top:-9px;margin-right:5px;border-bottom-left-radius:1px;border-left:2px solid #aaa;border-bottom:2px solid #aaa}.tabulator-row .tabulator-cell .tabulator-data-tree-control{display:-ms-inline-flexbox;display:inline-flex;-ms-flex-pack:center;justify-content:center;-ms-flex-align:center;align-items:center;vertical-align:middle;height:11px;width:11px;margin-right:5px;border:1px solid #333;border-radius:2px;background:rgba(0,0,0,.1);overflow:hidden}.tabulator-row .tabulator-cell .tabulator-data-tree-control:hover{cursor:pointer;background:rgba(0,0,0,.2)}.tabulator-row .tabulator-cell .tabulator-data-tree-control .tabulator-data-tree-control-collapse{display:inline-block;position:relative;height:7px;width:1px;background:0 0}.tabulator-row .tabulator-cell .tabulator-data-tree-control .tabulator-data-tree-control-collapse:after{position:absolute;content:"";left:-3px;top:3px;height:1px;width:7px;background:#333}.tabulator-row .tabulator-cell .tabulator-data-tree-control .tabulator-data-tree-control-expand{display:inline-block;position:relative;height:7px;width:1px;background:#333}.tabulator-row .tabulator-cell .tabulator-data-tree-control .tabulator-data-tree-control-expand:after{position:absolute;content:"";left:-3px;top:3px;height:1px;width:7px;background:#333}.tabulator-row .tabulator-cell .tabulator-responsive-collapse-toggle{display:-ms-inline-flexbox;display:inline-flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;-moz-user-select:none;-khtml-user-select:none;-webkit-user-select:none;-o-user-select:none;height:15px;width:15px;border-radius:20px;background:#666;color:#fff;font-weight:700;font-size:1.1em}.tabulator-row .tabulator-cell .tabulator-responsive-collapse-toggle:hover{opacity:.7}.tabulator-row .tabulator-cell .tabulator-responsive-collapse-toggle.open .tabulator-responsive-collapse-toggle-close{display:initial}.tabulator-row .tabulator-cell .tabulator-responsive-collapse-toggle.open .tabulator-responsive-collapse-toggle-open{display:none}.tabulator-row .tabulator-cell .tabulator-responsive-collapse-toggle .tabulator-responsive-collapse-toggle-close{display:none}.tabulator-row .tabulator-cell .tabulator-traffic-light{display:inline-block;height:14px;width:14px;border-radius:14px}.tabulator-row.tabulator-group{box-sizing:border-box;border-right:1px solid #aaa;border-top:1px solid #000;padding:5px;padding-left:10px;background:#293146;color:#fff;font-weight:700;min-width:100%}.tabulator-row.tabulator-group:hover{cursor:pointer;background-color:#090909}.tabulator-row.tabulator-group.tabulator-group-visible .tabulator-arrow{margin-right:10px;border-left:6px solid transparent;border-right:6px solid transparent;border-top:6px solid #bbb;border-bottom:0}.tabulator-row.tabulator-group.tabulator-group-level-1{padding-left:30px}.tabulator-row.tabulator-group.tabulator-group-level-2{padding-left:50px}.tabulator-row.tabulator-group.tabulator-group-level-3{padding-left:70px}.tabulator-row.tabulator-group.tabulator-group-level-4{padding-left:90px}.tabulator-row.tabulator-group.tabulator-group-level-5{padding-left:110px}.tabulator-row.tabulator-group .tabulator-group-toggle{display:inline-block}.tabulator-row.tabulator-group .tabulator-arrow{display:inline-block;width:0;height:0;margin-right:16px;border-top:6px solid transparent;border-bottom:6px solid transparent;border-right:0;border-left:6px solid #bbb;vertical-align:middle}.tabulator-row.tabulator-group span{margin-left:10px;color:#bbb}.tabulator-menu{position:absolute;display:inline-block;box-sizing:border-box;background:#fff;border:1px solid #aaa;box-shadow:0 0 5px 0 rgba(0,0,0,.2);font-size:14px;overflow-y:auto;-webkit-overflow-scrolling:touch;z-index:10000}.tabulator-menu .tabulator-menu-item{padding:5px 10px;-webkit-user-select:none;-ms-user-select:none;user-select:none}.tabulator-menu .tabulator-menu-item.tabulator-menu-item-disabled{opacity:.5}.tabulator-menu .tabulator-menu-item:not(.tabulator-menu-item-disabled):hover{cursor:pointer;background:#efefef}.tabulator-menu .tabulator-menu-separator{border-top:1px solid #aaa}.tabulator-edit-select-list{position:absolute;display:inline-block;box-sizing:border-box;max-height:200px;background:#fff;border:1px solid #aaa;font-size:14px;overflow-y:auto;-webkit-overflow-scrolling:touch;z-index:10000}.tabulator-edit-select-list .tabulator-edit-select-list-item{padding:4px;color:#333}.tabulator-edit-select-list .tabulator-edit-select-list-item.active{color:#fff;background:#1d68cd}.tabulator-edit-select-list .tabulator-edit-select-list-item.active.focused{outline:1px solid rgba(255,255,255,.5)}.tabulator-edit-select-list .tabulator-edit-select-list-item.focused{outline:1px solid #1d68cd}.tabulator-edit-select-list .tabulator-edit-select-list-item:hover{cursor:pointer;color:#fff;background:#1d68cd}.tabulator-edit-select-list .tabulator-edit-select-list-notice{padding:4px;color:#333;text-align:center}.tabulator-edit-select-list .tabulator-edit-select-list-group{border-bottom:1px solid #aaa;padding:4px;padding-top:6px;color:#333;font-weight:700}.tabulator-print-fullscreen{position:absolute;top:0;bottom:0;left:0;right:0;z-index:10000}body.tabulator-print-fullscreen-hide>:not(.tabulator-print-fullscreen){display:none!important}.tabulator-print-table{border-collapse:collapse}.tabulator-print-table .tabulator-print-table-group{box-sizing:border-box;border-right:1px solid #aaa;border-top:1px solid #000;border-bottom:2px solid #3fb449;padding:5px;padding-left:10px;background:#293146;color:#fff;font-weight:700;min-width:100%}.tabulator-print-table .tabulator-print-table-group:hover{cursor:pointer;background-color:#090909}.tabulator-print-table .tabulator-print-table-group.tabulator-group-visible .tabulator-arrow{margin-right:10px;border-left:6px solid transparent;border-right:6px solid transparent;border-top:6px solid #3fb449;border-bottom:0}.tabulator-print-table .tabulator-print-table-group.tabulator-group-level-1 td{padding-left:30px!important}.tabulator-print-table .tabulator-print-table-group.tabulator-group-level-2 td{padding-left:50px!important}.tabulator-print-table .tabulator-print-table-group.tabulator-group-level-3 td{padding-left:70px!important}.tabulator-print-table .tabulator-print-table-group.tabulator-group-level-4 td{padding-left:90px!important}.tabulator-print-table .tabulator-print-table-group.tabulator-group-level-5 td{padding-left:110px!important}.tabulator-print-table .tabulator-print-table-group .tabulator-group-toggle{display:inline-block}.tabulator-print-table .tabulator-print-table-group .tabulator-arrow{display:inline-block;width:0;height:0;margin-right:16px;border-top:6px solid transparent;border-bottom:6px solid transparent;border-right:0;border-left:6px solid #3fb449;vertical-align:middle}.tabulator-print-table .tabulator-print-table-group span{margin-left:10px;color:#3fb449}.tabulator-print-table .tabulator-data-tree-branch{display:inline-block;vertical-align:middle;height:9px;width:7px;margin-top:-9px;margin-right:5px;border-bottom-left-radius:1px;border-left:2px solid #aaa;border-bottom:2px solid #aaa}.tabulator-print-table .tabulator-data-tree-control{display:-ms-inline-flexbox;display:inline-flex;-ms-flex-pack:center;justify-content:center;-ms-flex-align:center;align-items:center;vertical-align:middle;height:11px;width:11px;margin-right:5px;border:1px solid #333;border-radius:2px;background:rgba(0,0,0,.1);overflow:hidden}.tabulator-print-table .tabulator-data-tree-control:hover{cursor:pointer;background:rgba(0,0,0,.2)}.tabulator-print-table .tabulator-data-tree-control .tabulator-data-tree-control-collapse{display:inline-block;position:relative;height:7px;width:1px;background:0 0}.tabulator-print-table .tabulator-data-tree-control .tabulator-data-tree-control-collapse:after{position:absolute;content:"";left:-3px;top:3px;height:1px;width:7px;background:#333}.tabulator-print-table .tabulator-data-tree-control .tabulator-data-tree-control-expand{display:inline-block;position:relative;height:7px;width:1px;background:#333}.tabulator-print-table .tabulator-data-tree-control .tabulator-data-tree-control-expand:after{position:absolute;content:"";left:-3px;top:3px;height:1px;width:7px;background:#333} \ No newline at end of file diff --git a/admin/js/vendors/tabulator/css/tabulator_site.min.css.map b/admin/js/vendors/tabulator/css/tabulator_site.min.css.map new file mode 100644 index 0000000..6970f0b --- /dev/null +++ b/admin/js/vendors/tabulator/css/tabulator_site.min.css.map @@ -0,0 +1 @@ +{"version":3,"sources":["tabulator_site.scss"],"names":[],"mappings":"AAyCA,WACC,kBAAkB,AAElB,6BAvCgB,AAyChB,sBA1CqB,AA4CrB,eA1Ca,AA2Cb,gBAAgB,AAChB,gBAAe,AAMf,uBAAwB,CAigBxB,AAhhBD,iFAoBI,cAAc,CACd,AArBJ,0CA0BE,oBAAqB,CACrB,AA3BF,oFAiCK,iBAAkB,CAClB,AAlCL,kCAyCE,yBAAiB,AAAjB,qBAAiB,AAAjB,gBAAiB,CACjB,AA1CF,6BA8CE,kBAAiB,AACjB,sBAAsB,AAEtB,WAAU,AAEV,gCAhF2B,AAiF3B,sBApFyB,AAqFzB,WApFmB,AAqFnB,gBAAgB,AAEhB,mBAAmB,AACnB,gBAAe,AAEf,sBAAsB,AACtB,wBAAwB,AACxB,yBAAyB,AACzB,mBAAoB,CAmPpB,AAjTF,qDAiEG,YAAY,CACZ,AAlEH,4CAsEG,qBAAoB,AAEpB,kBAAiB,AACjB,sBAAqB,AACrB,4BAxGoB,AAyGpB,sBA3GwB,AA4GxB,gBAAe,AACf,sBAAsB,AACtB,eAAgB,CAqLhB,AAnQH,6DAiFI,kBAAkB,AAClB,yBA/GyB,AAgHzB,mBAA8C,AAC9C,mBAAoB,CACpB,AArFJ,mEAyFI,sBAAqB,AACrB,kBAAkB,AAClB,WAAW,CAgDX,AA3IJ,iGA+FK,aAAc,CAMd,AArGL,uGAkGM,eAAe,AACf,UAAW,CACX,AApGN,wFAyGK,sBAAqB,AACrB,WAAW,AAEX,mBAAmB,AACnB,gBAAgB,AAChB,uBAAuB,AACvB,qBAAqB,CAarB,AA5HL,gHAmHM,sBAAsB,AACtB,WAAW,AAEX,sBAAqB,AAErB,YAAW,AAEX,eAAgB,CAChB,AA3HN,oFAgIK,qBAAqB,AACrB,kBAAkB,AAClB,SAAQ,AACR,UAAS,AACT,QAAQ,AACR,SAAS,AACT,kCAAkC,AAClC,mCAAmC,AACnC,4BAhKmB,CAiKnB,AAzIL,0FAkJK,kBAAiB,AACjB,oBAAa,AAAb,aAAa,AAEb,0BAnLkB,AAoLlB,gBAAgB,AAEhB,iBAAiB,CACjB,AAzJL,0FA+JK,YAAa,CACb,AAhKL,qEAqKI,kBAAkB,AAClB,sBAAsB,AACtB,eAAc,AACd,WAAU,AACV,iBAAkB,CAiBlB,AA1LJ,8EA6KK,qBAAsB,CACtB,AA9KL,yEAiLK,cAAe,CACf,AAlLL,sFAsLO,QAAS,AACT,QAAS,CACV,AAxLN,oFA+LK,kBAAkB,CAClB,AAhML,qEAmMK,eAAc,AACd,wBAAoD,CACpD,AArML,uHAyMM,gBAAgB,AAChB,4BAlOkB,CAmOlB,AA3MN,sHAgNM,gBAAgB,AAChB,+BA1OmB,CA2OnB,AAlNN,uHAuNM,6BAhPmB,AAiPnB,kBAAmB,CACnB,AAzNN,+GAgOM,uBAAyB,AAAzB,yBAAyB,AACzB,uBAAuB,AAEvB,oBAAY,AAAZ,aAAY,AACZ,sBAAkB,AAAlB,mBAAkB,AAClB,qBAAsB,AAAtB,sBAAsB,CACtB,AAtON,oHA2OM,wBAAyB,CACzB,AA5ON,2GAiPM,gBAAe,AACf,gBAAgB,CAChB,AAnPN,uIAuPO,gBAAe,AACf,mBAAmB,CACnB,AAzPP,uGA8PM,qBAAqB,CACrB,AA/PN,+CAsQG,qBAAqB,AACrB,kBAAkB,AAIlB,UAAW,CASX,AApRH,qEA8QI,2BAjSgB,CAkShB,AA/QJ,sEAkRI,0BArSgB,CAsShB,AAnRJ,qDAuRG,sBAAqB,AACrB,eAAc,AAEd,6BAA0D,AAU1D,0BAvTiB,AA0TjB,eAAgB,CAChB,AAxSH,oEA6RI,4BAA0D,CAK1D,AAlSJ,iGAgSK,YAAa,CACb,AAjSL,2DA2SG,cAAc,CAKd,AAhTH,iEA8SI,YAAa,CACb,AA/SJ,kCAqTE,kBAAiB,AACjB,WAAU,AACV,mBAAmB,AACnB,cAAa,AACb,gCAAiC,CAgDjC,AAzWF,wCA4TG,YAAa,CACb,AA7TH,yDAiUG,sBAAqB,AACrB,oBAAa,AAAb,aAAa,AACb,sBAAkB,AAAlB,mBAAkB,AAOlB,UAAU,CAYV,AAtVH,wFAsUI,gBAAe,AACf,cAAc,CACd,AAxUJ,8DA6UI,qBAAqB,AAErB,cAAa,AACb,aAAY,AAEZ,cA/WyB,AAgXzB,gBAAiB,AACjB,cAAe,CACf,AArVJ,mDA0VG,kBAAiB,AACjB,qBAAoB,AACpB,sBAjXqB,AAkXrB,mBAAmB,AACnB,iBAAgB,AAChB,UAjXe,CA0Xf,AAxWH,kFAmWK,gBAAiB,AACjB,6BAA0D,AAC1D,UApYgB,CAqYhB,AAtWL,6BA8WE,iBAAgB,AAChB,gBAAe,AACf,6BArX2B,AAsX3B,sBAzXyB,AA0XzB,iBAAgB,AAChB,WA1XmB,AA2XnB,gBAAgB,AAChB,mBAAkB,AAClB,qBAAgB,AAAhB,iBAAgB,AAEhB,sBAAsB,AACtB,wBAAwB,AACxB,yBAAyB,AACzB,mBAAoB,CAuFpB,AAldF,qDA8XG,sBAAqB,AACrB,wBAAuB,AACvB,sBAA2B,AAE3B,gBAAgB,AAEhB,6BAA0D,AAY1D,6BAnaiB,AAqajB,eAAgB,CAMhB,AAxZH,oEAuYI,6BAA0D,AAC1D,oBAAiC,CAKjC,AA7YJ,iGA2YK,YAAa,CACb,AA5YL,gEAqZI,mBAAkB,AAClB,kBAAkB,CAClB,AAvZJ,wDA6ZI,UAAU,CACV,AA9ZJ,kDAmaG,qBAAoB,AAEpB,aAAY,AACZ,gBAAe,AAEf,sBA9aoB,AA+apB,iBAAiB,CACjB,AA1aH,8CA8aG,YAAY,CACZ,AA/aH,6CAmbG,qBAAoB,AAEpB,aAAY,AACZ,gBAAe,AAEf,sBA9boB,AA+bpB,kBAAiB,AAEjB,gBAAe,AAEf,WApckB,AAqclB,oBAAmB,AACnB,oBAAmB,AACnB,iBAAiB,CAiBjB,AAjdH,oDAmcI,aAxcyB,CAyczB,AApcJ,sDAucI,UAAU,CACV,AAxcJ,kEA4cK,eAAc,AACd,0BAAyB,AACzB,UAAU,CACV,AA/cL,wCAsdE,kBAAiB,AACjB,QAAO,AACP,MAAK,AACL,SAAQ,AACR,SAAS,CAUT,AApeF,6CA6dG,OAAM,AACN,UAAU,CACV,AA/dH,8CAkeG,gBAAgB,CAChB,AAneH,6BAyeE,kBAAiB,AACjB,oBAAa,AAAb,aAAa,AACb,sBAAkB,AAAlB,mBAAkB,AAElB,MAAK,AACL,OAAM,AACN,YAAW,AAEX,YAAW,AACX,WAAU,AACV,0BAAyB,AACzB,iBAAiB,CA2BjB,AA/gBF,mDAwfG,qBAAoB,AAEpB,cAAa,AACb,kBAAiB,AAEjB,mBAAkB,AAElB,gBAAe,AACf,gBAAgB,AAChB,cAAc,CAad,AA9gBH,qEAqgBI,sBAAqB,AACrB,UAAU,CACV,AAvgBJ,mEA2gBI,sBAAqB,AACrB,aAAa,CACb,AAMJ,eACC,kBAAkB,AAClB,sBAAsB,AACtB,gBAA0C,AAC1C,qBA5iBuB,CA45BvB,AApXD,kCAQE,wBA/iB4B,CAgjB5B,AATF,0CAYE,sBAhjBsB,AAijBtB,cAAe,CACf,AAdF,kCAiBE,wBAnjB6B,CAojB7B,AAlBF,wCAqBE,yBAtjBkC,AAujBlC,cAAe,CACf,AAvBF,oCA0BE,sBAAqB,AACrB,eAAe,CACf,AA5BF,gCA+BE,kBAAkB,AAElB,0BAvkBkB,AAwkBlB,6BAxkBkB,AA0kBlB,8BAA+B,AAC/B,UAAU,CACV,AAtCF,4CA0CE,kBAAiB,AACjB,QAAO,AACP,SAAQ,AACR,OAAM,AACN,UAAU,CAUV,AAxDF,iDAiDG,MAAK,AACL,WAAW,CACX,AAnDH,kDAsDG,gBAAgB,CAChB,AAvDH,iCA2DE,qBAAqB,AACrB,kBAAkB,AAElB,yBAAyB,AAEzB,UAAW,CASX,AAzEF,uDAmEG,2BAzmBiB,CA0mBjB,AApEH,wDAuEG,0BA7mBiB,CA8mBjB,AAxEH,8CA4EE,sBAAqB,AAErB,YAAW,AAEX,0BAtnBkB,AAunBlB,4BAvnBkB,CA0oBlB,AApGF,oDAoFG,YAAY,CACZ,AArFH,oDAwFG,cA9oBW,CAypBX,AAnGH,0DA4FK,iBAAkB,CAKlB,AAjGL,wEA+FM,kBAAkB,CAClB,AAhGN,+BAwGE,qBAAoB,AACpB,kBAAkB,AAClB,sBAAqB,AACrB,YAAW,AACX,4BAlpBkB,AAmpBlB,sBAAqB,AACrB,mBAAkB,AAClB,gBAAe,AACf,sBAAsB,CA0LtB,AA1SF,iDAoHG,yBAnpBkB,AAopBlB,SAAU,CAMV,AA3HH,+GAwHI,WAAU,AACV,sBAAsB,CACtB,AA1HJ,yDA8HG,qBA5pBgB,CAmqBhB,AArIH,+HAgII,WAAU,AACV,uBAAsB,AAEtB,UAjqBe,CAkqBf,AApIJ,6EA0II,YAAa,CACb,AA3IJ,oDAiJG,2BAAoB,AAApB,oBAAoB,AACpB,sBAAkB,AAAlB,mBAAkB,AAElB,sBAAsB,AACtB,wBAAwB,AACxB,yBAAyB,AACzB,mBAAoB,CAcpB,AArKH,8EA2JI,SAAS,CAST,AApKJ,wGA+JK,WAAU,AACV,WAAU,AACV,eAAc,AACd,kBA9sBoB,CA+sBpB,AAnKL,2DAwKG,qBAAoB,AACpB,sBAAqB,AAErB,WAAU,AACV,UAAS,AAET,gBAAe,AACf,iBAAgB,AAEhB,8BAA6B,AAE7B,2BAztBiB,AA0tBjB,4BA1tBiB,CA2tBjB,AArLH,4DAyLG,2BAAmB,AAAnB,oBAAmB,AACnB,qBAAsB,AAAtB,uBAAsB,AACtB,sBAAkB,AAAlB,mBAAkB,AAClB,sBAAqB,AAErB,YAAW,AACX,WAAU,AAEV,iBAAgB,AAEhB,sBAxuBe,AAyuBf,kBAAiB,AACjB,0BAA4B,AAE5B,eAAe,CAmDf,AA1PH,kEA0MI,eAAc,AACd,yBAA4B,CAC5B,AA5MJ,kGA+MI,qBAAoB,AACpB,kBAAkB,AAElB,WAAW,AACX,UAAU,AAEV,sBAAuB,CAavB,AAlOJ,wGAwNK,kBAAkB,AAClB,WAAW,AACX,UAAU,AACV,QAAQ,AAER,WAAW,AACX,UAAU,AAEV,eArwBa,CAswBb,AAjOL,gGAqOI,qBAAoB,AACpB,kBAAkB,AAElB,WAAW,AACX,UAAU,AAEV,eAhxBc,CA6xBd,AAxPJ,sGA8OK,kBAAkB,AAClB,WAAW,AACX,UAAU,AACV,QAAQ,AAER,WAAW,AACX,UAAU,AAEV,eA3xBa,CA4xBb,AAvPL,qEA6PG,2BAAoB,AAApB,oBAAoB,AACpB,sBAAkB,AAAlB,mBAAkB,AAClB,qBAAsB,AAAtB,uBAAsB,AAEtB,sBAAsB,AACtB,wBAAwB,AACxB,yBAAyB,AACzB,oBAAoB,AAEpB,YAAW,AACX,WAAU,AAEV,mBAAkB,AAClB,gBAAe,AAEf,WApzBqB,AAqzBrB,gBAAgB,AAChB,eAAe,CAmBf,AAjSH,2EAiRI,UAAU,CACV,AAlRJ,sHAsRK,eAAe,CACf,AAvRL,sOA+RI,YAAY,CACZ,AAhSJ,wDAoSG,qBAAqB,AACrB,YAAW,AACX,WAAU,AAEV,kBAAkB,CAClB,AAzSH,+BA8SE,sBAAqB,AACrB,4BAr1BkB,AAs1BlB,0BAAyB,AACzB,gCAj2B2B,AAk2B3B,YAAW,AACX,kBAAiB,AACjB,gBAv2ByB,AAw2BzB,WAv2BmB,AAw2BnB,gBAAgB,AAEhB,cAAe,CA0Df,AAlXF,qCA2TG,eAAc,AACd,wBAAoD,CACpD,AA7TH,wEAiUI,kBAAiB,AACjB,kCAAkC,AAClC,mCAAmC,AACnC,6BAh3BqB,AAi3BrB,eAAgB,CAChB,AAtUJ,uDA0UG,iBAAiB,CACjB,AA3UH,uDA8UG,iBAAiB,CACjB,AA/UH,uDAkVG,iBAAiB,CACjB,AAnVH,uDAsVG,iBAAiB,CACjB,AAvVH,uDA0VG,kBAAkB,CAClB,AA3VH,uDA8VG,oBAAqB,CACrB,AA/VH,gDAmWG,qBAAqB,AACrB,QAAQ,AACR,SAAS,AACT,kBAAiB,AACjB,iCAAiC,AACjC,oCAAoC,AACpC,eAAe,AACf,8BAt5BsB,AAu5BtB,qBAAqB,CACrB,AA5WH,oCA+WG,iBAAgB,AAChB,aAh6B0B,CAi6B1B,AAKH,gBACC,kBAAkB,AAClB,qBAAoB,AACpB,sBAAqB,AAErB,gBAn6BuB,AAo6BvB,sBAl6BmB,AAm6BnB,oCAAuC,AAEvC,eAr7Ba,AAu7Bb,gBAAe,AACf,iCAAiC,AAEjC,aAAc,CAqBd,AAnCD,qCAkBE,iBAAgB,AAEhB,yBAAiB,AAAjB,qBAAiB,AAAjB,gBAAiB,CAUjB,AA9BF,kEAuBG,UAAW,CACX,AAxBH,8EA2BG,eAAe,AACf,kBAz7B2B,CA07B3B,AA7BH,0CAiCE,yBA77BkB,CA87BlB,AAGF,4BACC,kBAAkB,AAClB,qBAAoB,AACpB,sBAAqB,AAErB,iBAAgB,AAEhB,gBA18BuB,AA28BvB,sBAz8BmB,AA28BnB,eA39Ba,AA69Bb,gBAAe,AACf,iCAAiC,AAEjC,aAAc,CA6Cd,AA5DD,6DAkBE,YAAW,AAEX,UAp9BgB,CA0+BhB,AA1CF,oEAuBG,WA19BqB,AA29BrB,kBAl9BkB,CAu9BlB,AA7BH,4EA2BI,oCA99BoB,CA+9BpB,AA5BJ,qEAgCG,yBA19BkB,CA29BlB,AAjCH,mEAqCG,eAAc,AAEd,WA1+BqB,AA2+BrB,kBAl+BkB,CAm+BlB,AAzCH,+DA6CE,YAAW,AAEX,WA/+BgB,AAg/BhB,iBAAkB,CAClB,AAjDF,8DAoDE,6BAr/BkB,AAu/BlB,YAAW,AACX,gBAAe,AAEf,WAz/BgB,AA0/BhB,eAAgB,CAChB,AAKF,4BACC,kBAAkB,AAClB,MAAK,AACL,SAAQ,AACR,OAAM,AACN,QAAO,AAEP,aAAc,CACd,AAED,uEACC,sBAAuB,CACvB,AAED,uBACC,wBAAyB,CAsKzB,AAvKD,oDAKE,sBAAqB,AACrB,4BArhCkB,AAshClB,0BAAyB,AACzB,gCAjiC2B,AAkiC3B,YAAW,AACX,kBAAiB,AACjB,gBAviCyB,AAwiCzB,WAviCmB,AAwiCnB,gBAAgB,AAEhB,cAAe,CAmEf,AAlFF,0DAkBG,eAAc,AACd,wBAAoD,CACpD,AApBH,6FAwBI,kBAAiB,AACjB,kCAAkC,AAClC,mCAAmC,AACnC,6BAhjCqB,AAijCrB,eAAgB,CAChB,AA7BJ,+EAkCI,2BAA4B,CAC5B,AAnCJ,+EAwCI,2BAA4B,CAC5B,AAzCJ,+EA8CI,2BAA4B,CAC5B,AA/CJ,+EAoDI,2BAA4B,CAC5B,AArDJ,+EA0DI,4BAA6B,CAC7B,AA3DJ,4EA8DG,oBAAqB,CACrB,AA/DH,qEAmEG,qBAAqB,AACrB,QAAQ,AACR,SAAS,AACT,kBAAiB,AACjB,iCAAiC,AACjC,oCAAoC,AACpC,eAAe,AACf,8BA/lCsB,AAgmCtB,qBAAqB,CACrB,AA5EH,yDA+EG,iBAAgB,AAChB,aAzmC0B,CA0mC1B,AAjFH,mDAqFE,qBAAoB,AACpB,sBAAqB,AAErB,WAAU,AACV,UAAS,AAET,gBAAe,AACf,iBAAgB,AAEhB,8BAA6B,AAE7B,2BA/mCkB,AAgnClB,4BAhnCkB,CAinClB,AAlGF,oDAsGE,2BAAmB,AAAnB,oBAAmB,AACnB,qBAAsB,AAAtB,uBAAsB,AACtB,sBAAkB,AAAlB,mBAAkB,AAClB,sBAAqB,AAErB,YAAW,AACX,WAAU,AAEV,iBAAgB,AAEhB,sBA9nCgB,AA+nChB,kBAAiB,AACjB,0BAA4B,AAE5B,eAAe,CAkDf,AAtKF,0DAuHG,eAAc,AACd,yBAA4B,CAC5B,AAzHH,0FA4HG,qBAAoB,AACpB,kBAAkB,AAElB,WAAW,AACX,UAAU,AAEV,sBAAuB,CAavB,AA/IH,gGAqII,kBAAkB,AAClB,WAAW,AACX,UAAU,AACV,QAAQ,AAER,WAAW,AACX,UAAU,AAEV,eA3pCc,CA4pCd,AA9IJ,wFAkJG,qBAAoB,AACpB,kBAAkB,AAElB,WAAW,AACX,UAAU,AAEV,eAtqCe,CAmrCf,AArKH,8FA2JI,kBAAkB,AAClB,WAAW,AACX,UAAU,AACV,QAAQ,AAER,WAAW,AACX,UAAU,AAEV,eAjrCc,CAkrCd","file":"tabulator_site.min.css","sourcesContent":["/* Tabulator v4.7.0 (c) Oliver Folkerd */\n\n\r\n//Main Theme Variables\r\n$backgroundColor: #fff !default; //background color of tabulator\r\n$borderColor:#222 !default; //border to tabulator\r\n$textSize:14px !default; //table text size\r\n\r\n//header themeing\r\n$headerBackgroundColor:#222 !default; //border to tabulator\r\n$headerTextColor:#fff !default; //header text colour\r\n$headerBorderColor:#aaa !default; //header border color\r\n$headerSeperatorColor:#3FB449 !default; //header bottom seperator color\r\n$headerMargin:4px !default; //padding round header\r\n\r\n//column header arrows\r\n$sortArrowActive: #3FB449 !default;\r\n$sortArrowInactive: #bbb !default;\r\n\r\n//row themeing\r\n$rowBackgroundColor:#fff !default; //table row background color\r\n$rowAltBackgroundColor:#EFEFEF !default; //table row background color\r\n$rowBorderColor:#aaa !default; //table border color\r\n$rowTextColor:#333 !default; //table text color\r\n$rowHoverBackground:#bbb !default; //row background color on hover\r\n\r\n$rowSelectedBackground: #9ABCEA !default; //row background color when selected\r\n$rowSelectedBackgroundHover: #769BCC !default;//row background color when selected and hovered\r\n\r\n$editBoxColor:#1D68CD !default; //border color for edit boxes\r\n$errorColor:#dd0000 !default; //error indication\r\n\r\n//footer themeing\r\n$footerBackgroundColor:#222 !default; //border to tabulator\r\n$footerTextColor:#222 !default; //footer text colour\r\n$footerBorderColor:#aaa !default; //footer border color\r\n$footerSeperatorColor:#3FB449 !default; //footer bottom seperator color\r\n$footerActiveColor:$footerSeperatorColor !default; //footer bottom active text color\r\n\r\n\r\n//Tabulator Containing Element\r\n.tabulator{\r\n\tposition: relative;\r\n\r\n\tborder-bottom: 5px solid $borderColor;\r\n\r\n\tbackground-color: $backgroundColor;\r\n\r\n\tfont-size:$textSize;\r\n\ttext-align: left;\r\n\toverflow:hidden;\r\n\r\n\t-webkit-transform: translatez(0);\r\n\t-moz-transform: translatez(0);\r\n\t-ms-transform: translatez(0);\r\n\t-o-transform: translatez(0);\r\n\ttransform: translatez(0);\r\n\r\n\t&[tabulator-layout=\"fitDataFill\"]{\r\n\t\t.tabulator-tableHolder{\r\n\t\t\t.tabulator-table{\r\n\t\t\t\tmin-width:100%;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\t&[tabulator-layout=\"fitDataTable\"]{\r\n\t\tdisplay: inline-block;\r\n\t}\r\n\r\n\t&[tabulator-layout=\"fitColumns\"]{\r\n\t\t.tabulator-row{\r\n\t\t\t.tabulator-cell{\r\n\t\t\t\t&:last-of-type{\r\n\t\t\t\t\tborder-right: none;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\r\n\t&.tabulator-block-select{\r\n\t\tuser-select: none;\r\n\t}\r\n\r\n\t//column header containing element\r\n\t.tabulator-header{\r\n\t\tposition:relative;\r\n\t\tbox-sizing: border-box;\r\n\r\n\t\twidth:100%;\r\n\r\n\t\tborder-bottom:3px solid $headerSeperatorColor;\r\n\t\tbackground-color: $headerBackgroundColor;\r\n\t\tcolor: $headerTextColor;\r\n\t\tfont-weight:bold;\r\n\r\n\t\twhite-space: nowrap;\r\n\t\toverflow:hidden;\r\n\r\n\t\t-moz-user-select: none;\r\n\t\t-khtml-user-select: none;\r\n\t\t-webkit-user-select: none;\r\n\t\t-o-user-select: none;\r\n\r\n\t\t&.tabulator-header-hidden{\r\n\t\t\tdisplay:none;\r\n\t\t}\r\n\r\n\t\t//individual column header element\r\n\t\t.tabulator-col{\r\n\t\t\tdisplay:inline-block;\r\n\r\n\t\t\tposition:relative;\r\n\t\t\tbox-sizing:border-box;\r\n\t\t\tborder-right:1px solid $headerBorderColor;\r\n\t\t\tbackground-color: $headerBackgroundColor;\r\n\t\t\ttext-align:left;\r\n\t\t\tvertical-align: bottom;\r\n\t\t\toverflow: hidden;\r\n\r\n\t\t\t&.tabulator-moving{\r\n\t\t\t\tposition: absolute;\r\n\t\t\t\tborder:1px solid $headerSeperatorColor;\r\n\t\t\t\tbackground:darken($headerBackgroundColor, 10%);\r\n\t\t\t\tpointer-events: none;\r\n\t\t\t}\r\n\r\n\t\t\t//hold content of column header\r\n\t\t\t.tabulator-col-content{\r\n\t\t\t\tbox-sizing:border-box;\r\n\t\t\t\tposition: relative;\r\n\t\t\t\tpadding:8px;\r\n\r\n\t\t\t\t//header menu button\r\n\t\t\t\t.tabulator-header-menu-button{\r\n\t\t\t\t\tpadding: 0 8px;\r\n\r\n\t\t\t\t\t&:hover{\r\n\t\t\t\t\t\tcursor: pointer;\r\n\t\t\t\t\t\topacity: .6;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\r\n\t\t\t\t//hold title of column header\r\n\t\t\t\t.tabulator-col-title{\r\n\t\t\t\t\tbox-sizing:border-box;\r\n\t\t\t\t\twidth: 100%;\r\n\r\n\t\t\t\t\twhite-space: nowrap;\r\n\t\t\t\t\toverflow: hidden;\r\n\t\t\t\t\ttext-overflow: ellipsis;\r\n\t\t\t\t\tvertical-align:bottom;\r\n\r\n\t\t\t\t\t//element to hold title editor\r\n\t\t\t\t\t.tabulator-title-editor{\r\n\t\t\t\t\t\tbox-sizing: border-box;\r\n\t\t\t\t\t\twidth: 100%;\r\n\r\n\t\t\t\t\t\tborder:1px solid #999;\r\n\r\n\t\t\t\t\t\tpadding:1px;\r\n\r\n\t\t\t\t\t\tbackground: #fff;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\r\n\t\t\t\t//column sorter arrow\r\n\t\t\t\t.tabulator-arrow{\r\n\t\t\t\t\tdisplay: inline-block;\r\n\t\t\t\t\tposition: absolute;\r\n\t\t\t\t\ttop:14px;\r\n\t\t\t\t\tright:8px;\r\n\t\t\t\t\twidth: 0;\r\n\t\t\t\t\theight: 0;\r\n\t\t\t\t\tborder-left: 6px solid transparent;\r\n\t\t\t\t\tborder-right: 6px solid transparent;\r\n\t\t\t\t\tborder-bottom: 6px solid $sortArrowInactive;\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t\t//complex header column group\r\n\t\t\t&.tabulator-col-group{\r\n\r\n\t\t\t\t//gelement to hold sub columns in column group\r\n\t\t\t\t.tabulator-col-group-cols{\r\n\t\t\t\t\tposition:relative;\r\n\t\t\t\t\tdisplay: flex;\r\n\r\n\t\t\t\t\tborder-top:1px solid $headerBorderColor;\r\n\t\t\t\t\toverflow: hidden;\r\n\r\n\t\t\t\t\tmargin-right:-1px;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\t//hide left resize handle on first column\r\n\t\t\t&:first-child{\r\n\t\t\t\t.tabulator-col-resize-handle.prev{\r\n\t\t\t\t\tdisplay: none;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\t//header filter containing element\r\n\t\t\t.tabulator-header-filter{\r\n\t\t\t\tposition: relative;\r\n\t\t\t\tbox-sizing: border-box;\r\n\t\t\t\tmargin-top:2px;\r\n\t\t\t\twidth:100%;\r\n\t\t\t\ttext-align: center;\r\n\r\n\t\t\t\t//styling adjustment for inbuilt editors\r\n\t\t\t\ttextarea{\r\n\t\t\t\t\theight:auto !important;\r\n\t\t\t\t}\r\n\r\n\t\t\t\tsvg{\r\n\t\t\t\t\tmargin-top: 3px;\r\n\t\t\t\t}\r\n\r\n\t\t\t\tinput{\r\n\t\t\t\t\t&::-ms-clear {\r\n\t\t\t\t\t width : 0;\r\n\t\t\t\t\t height: 0;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\t//styling child elements for sortable columns\r\n\t\t\t&.tabulator-sortable{\r\n\t\t\t\t.tabulator-col-title{\r\n\t\t\t\t\tpadding-right:25px;\r\n\t\t\t\t}\r\n\r\n\t\t\t\t&:hover{\r\n\t\t\t\t\tcursor:pointer;\r\n\t\t\t\t\tbackground-color:darken($headerBackgroundColor, 10%);\r\n\t\t\t\t}\r\n\r\n\t\t\t\t&[aria-sort=\"none\"]{\r\n\t\t\t\t\t.tabulator-col-content .tabulator-arrow{\r\n\t\t\t\t\t\tborder-top: none;\r\n\t\t\t\t\t\tborder-bottom: 6px solid $sortArrowInactive;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\r\n\t\t\t\t&[aria-sort=\"asc\"]{\r\n\t\t\t\t\t.tabulator-col-content .tabulator-arrow{\r\n\t\t\t\t\t\tborder-top: none;\r\n\t\t\t\t\t\tborder-bottom: 6px solid $sortArrowActive;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\r\n\t\t\t\t&[aria-sort=\"desc\"]{\r\n\t\t\t\t\t.tabulator-col-content .tabulator-arrow{\r\n\t\t\t\t\t\tborder-top: 6px solid $sortArrowActive;\r\n\t\t\t\t\t\tborder-bottom: none;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\t&.tabulator-col-vertical{\r\n\t\t\t\t.tabulator-col-content{\r\n\t\t\t\t\t.tabulator-col-title{\r\n\t\t\t\t\t\twriting-mode: vertical-rl;\r\n\t\t\t\t\t\ttext-orientation: mixed;\r\n\r\n\t\t\t\t\t\tdisplay:flex;\r\n\t\t\t\t\t\talign-items:center;\r\n\t\t\t\t\t\tjustify-content:center;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\r\n\t\t\t\t&.tabulator-col-vertical-flip{\r\n\t\t\t\t\t.tabulator-col-title{\r\n\t\t\t\t\t\ttransform: rotate(180deg);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\r\n\t\t\t\t&.tabulator-sortable{\r\n\t\t\t\t\t.tabulator-col-title{\r\n\t\t\t\t\t\tpadding-right:0;\r\n\t\t\t\t\t\tpadding-top:20px;\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\t&.tabulator-col-vertical-flip{\r\n\t\t\t\t\t\t.tabulator-col-title{\r\n\t\t\t\t\t\t\tpadding-right:0;\r\n\t\t\t\t\t\t\tpadding-bottom:20px;\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\t.tabulator-arrow{\r\n\t\t\t\t\t\tright:calc(50% - 6px);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\t.tabulator-frozen{\r\n\t\t\tdisplay: inline-block;\r\n\t\t\tposition: absolute;\r\n\r\n\t\t\t// background-color: inherit;\r\n\r\n\t\t\tz-index: 10;\r\n\r\n\t\t\t&.tabulator-frozen-left{\r\n\t\t\t\tborder-right:2px solid $rowBorderColor;\r\n\t\t\t}\r\n\r\n\t\t\t&.tabulator-frozen-right{\r\n\t\t\t\tborder-left:2px solid $rowBorderColor;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t.tabulator-calcs-holder{\r\n\t\t\tbox-sizing:border-box;\r\n\t\t\tmin-width:600%;\r\n\r\n\t\t\tbackground:lighten($headerBackgroundColor, 10%) !important;\r\n\r\n\t\t\t.tabulator-row{\r\n\t\t\t\tbackground:lighten($headerBackgroundColor, 10%) !important;\r\n\r\n\t\t\t\t.tabulator-col-resize-handle{\r\n\t\t\t\t\tdisplay: none;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\tborder-top:1px solid $rowBorderColor;\r\n\t\t\t// border-bottom:1px solid $headerBorderColor;\r\n\r\n\t\t\toverflow: hidden;\r\n\t\t}\r\n\r\n\t\t.tabulator-frozen-rows-holder{\r\n\t\t\tmin-width:600%;\r\n\r\n\t\t\t&:empty{\r\n\t\t\t\tdisplay: none;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\t//scrolling element to hold table\r\n\t.tabulator-tableHolder{\r\n\t\tposition:relative;\r\n\t\twidth:100%;\r\n\t\twhite-space: nowrap;\r\n\t\toverflow:auto;\r\n\t\t-webkit-overflow-scrolling: touch;\r\n\r\n\t\t&:focus{\r\n\t\t\toutline: none;\r\n\t\t}\r\n\r\n\t\t//default placeholder element\r\n\t\t.tabulator-placeholder{\r\n\t\t\tbox-sizing:border-box;\r\n\t\t\tdisplay: flex;\r\n\t\t\talign-items:center;\r\n\r\n\t\t\t&[tabulator-render-mode=\"virtual\"]{\r\n\t\t\t\tmin-height:100%;\r\n\t\t\t\tmin-width:100%;\r\n\t\t\t}\r\n\r\n\t\t\twidth:100%;\r\n\r\n\t\t\tspan{\r\n\t\t\t\tdisplay: inline-block;\r\n\r\n\t\t\t\tmargin:0 auto;\r\n\t\t\t\tpadding:10px;\r\n\r\n\t\t\t\tcolor:$headerSeperatorColor;\r\n\t\t\t\tfont-weight: bold;\r\n\t\t\t\tfont-size: 20px;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t//element to hold table rows\r\n\t\t.tabulator-table{\r\n\t\t\tposition:relative;\r\n\t\t\tdisplay:inline-block;\r\n\t\t\tbackground-color:$rowBackgroundColor;\r\n\t\t\twhite-space: nowrap;\r\n\t\t\toverflow:visible;\r\n\t\t\tcolor:$rowTextColor;\r\n\r\n\t\t\t.tabulator-row{\r\n\t\t\t\t&.tabulator-calcs{\r\n\t\t\t\t\tfont-weight: bold;\r\n\t\t\t\t\tbackground:lighten($headerBackgroundColor, 15%) !important;\r\n\t\t\t\t\tcolor:$headerTextColor;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\r\n\t//footer element\r\n\t.tabulator-footer{\r\n\t\tpadding:5px 10px;\r\n\t\tpadding-top:8px;\r\n\t\tborder-top:3px solid $footerSeperatorColor;\r\n\t\tbackground-color: $footerBackgroundColor;\r\n\t\ttext-align:right;\r\n\t\tcolor: $footerTextColor;\r\n\t\tfont-weight:bold;\r\n\t\twhite-space:nowrap;\r\n\t\tuser-select:none;\r\n\r\n\t\t-moz-user-select: none;\r\n\t\t-khtml-user-select: none;\r\n\t\t-webkit-user-select: none;\r\n\t\t-o-user-select: none;\r\n\r\n\t\t.tabulator-calcs-holder{\r\n\t\t\tbox-sizing:border-box;\r\n\t\t\twidth:calc(100% + 20px);\r\n\t\t\tmargin:-8px -10px 8px -10px;\r\n\r\n\t\t\ttext-align: left;\r\n\r\n\t\t\tbackground:lighten($footerBackgroundColor, 10%) !important;\r\n\r\n\t\t\t.tabulator-row{\r\n\t\t\t\tbackground:lighten($footerBackgroundColor, 10%) !important;\r\n\t\t\t\tcolor:$headerTextColor !important;\r\n\r\n\t\t\t\t.tabulator-col-resize-handle{\r\n\t\t\t\t\tdisplay: none;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\t// border-top:1px solid $rowBorderColor;\r\n\t\t\tborder-bottom:1px solid $rowBorderColor;\r\n\r\n\t\t\toverflow: hidden;\r\n\r\n\t\t\t&:only-child{\r\n\t\t\t\tmargin-bottom:-5px;\r\n\t\t\t\tborder-bottom:none;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t//pagination container element\r\n\t\t.tabulator-paginator{\r\n\t\t\tlabel{\r\n\t\t\t\tcolor:#fff;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t//page size select element\r\n\t\t.tabulator-page-size{\r\n\t\t\tdisplay:inline-block;\r\n\r\n\t\t\tmargin:0 5px;\r\n\t\t\tpadding:2px 5px;\r\n\r\n\t\t\tborder:1px solid $footerBorderColor;\r\n\t\t\tborder-radius:3px;\r\n\t\t}\r\n\r\n\t\t//pagination container element\r\n\t\t.tabulator-pages{\r\n\t\t\tmargin:0 7px;\r\n\t\t}\r\n\r\n\t\t//pagination button\r\n\t\t.tabulator-page{\r\n\t\t\tdisplay:inline-block;\r\n\r\n\t\t\tmargin:0 2px;\r\n\t\t\tpadding:2px 5px;\r\n\r\n\t\t\tborder:1px solid $footerBorderColor;\r\n\t\t\tborder-radius:3px;\r\n\r\n\t\t\tbackground:#fff;\r\n\r\n\t\t\tcolor: $footerTextColor;\r\n\t\t\tfont-family:inherit;\r\n\t\t\tfont-weight:inherit;\r\n\t\t\tfont-size:inherit;\r\n\r\n\t\t\t&.active{\r\n\t\t\t\tcolor:$footerActiveColor;\r\n\t\t\t}\r\n\r\n\t\t\t&:disabled{\r\n\t\t\t\topacity:.5;\r\n\t\t\t}\r\n\r\n\t\t\t&:not(.disabled){\r\n\t\t\t\t&:hover{\r\n\t\t\t\t\tcursor:pointer;\r\n\t\t\t\t\tbackground:rgba(0,0,0,.2);\r\n\t\t\t\t\tcolor:#fff;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\t//column resize handles\r\n\t.tabulator-col-resize-handle{\r\n\t\tposition:absolute;\r\n\t\tright:0;\r\n\t\ttop:0;\r\n\t\tbottom:0;\r\n\t\twidth:5px;\r\n\r\n\t\t&.prev{\r\n\t\t\tleft:0;\r\n\t\t\tright:auto;\r\n\t\t}\r\n\r\n\t\t&:hover{\r\n\t\t\tcursor:ew-resize;\r\n\t\t}\r\n\t}\r\n\r\n\r\n\t//holding div that contains loader and covers tabulator element to prevent interaction\r\n\t.tabulator-loader{\r\n\t\tposition:absolute;\r\n\t\tdisplay: flex;\r\n\t\talign-items:center;\r\n\r\n\t\ttop:0;\r\n\t\tleft:0;\r\n\t\tz-index:100;\r\n\r\n\t\theight:100%;\r\n\t\twidth:100%;\r\n\t\tbackground:rgba(0,0,0,.4);\r\n\t\ttext-align:center;\r\n\r\n\t\t//loading message element\r\n\t\t.tabulator-loader-msg{\r\n\t\t\tdisplay:inline-block;\r\n\r\n\t\t\tmargin:0 auto;\r\n\t\t\tpadding:10px 20px;\r\n\r\n\t\t\tborder-radius:10px;\r\n\r\n\t\t\tbackground:#fff;\r\n\t\t\tfont-weight:bold;\r\n\t\t\tfont-size:16px;\r\n\r\n\t\t\t//loading message\r\n\t\t\t&.tabulator-loading{\r\n\t\t\t\tborder:4px solid #333;\r\n\t\t\t\tcolor:#000;\r\n\t\t\t}\r\n\r\n\t\t\t//error message\r\n\t\t\t&.tabulator-error{\r\n\t\t\t\tborder:4px solid #D00;\r\n\t\t\t\tcolor:#590000;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n}\r\n\r\n//row element\r\n.tabulator-row{\r\n\tposition: relative;\r\n\tbox-sizing: border-box;\r\n\tmin-height:$textSize + ($headerMargin * 2);\r\n\tbackground-color: $rowBackgroundColor;\r\n\r\n\r\n\t&.tabulator-row-even{\r\n\t\tbackground-color: $rowAltBackgroundColor;\r\n\t}\r\n\r\n\t&.tabulator-selectable:hover{\r\n\t\tbackground-color:$rowHoverBackground;\r\n\t\tcursor: pointer;\r\n\t}\r\n\r\n\t&.tabulator-selected{\r\n\t\tbackground-color:$rowSelectedBackground;\r\n\t}\r\n\r\n\t&.tabulator-selected:hover{\r\n\t\tbackground-color:$rowSelectedBackgroundHover;\r\n\t\tcursor: pointer;\r\n\t}\r\n\r\n\t&.tabulator-row-moving{\r\n\t\tborder:1px solid #000;\r\n\t\tbackground:#fff;\r\n\t}\r\n\r\n\t&.tabulator-moving{\r\n\t\tposition: absolute;\r\n\r\n\t\tborder-top:1px solid $rowBorderColor;\r\n\t\tborder-bottom:1px solid $rowBorderColor;\r\n\r\n\t\tpointer-events: none !important;\r\n\t\tz-index:15;\r\n\t}\r\n\r\n\t//row resize handles\r\n\t.tabulator-row-resize-handle{\r\n\t\tposition:absolute;\r\n\t\tright:0;\r\n\t\tbottom:0;\r\n\t\tleft:0;\r\n\t\theight:5px;\r\n\r\n\t\t&.prev{\r\n\t\t\ttop:0;\r\n\t\t\tbottom:auto;\r\n\t\t}\r\n\r\n\t\t&:hover{\r\n\t\t\tcursor:ns-resize;\r\n\t\t}\r\n\t}\r\n\r\n\t.tabulator-frozen{\r\n\t\tdisplay: inline-block;\r\n\t\tposition: absolute;\r\n\r\n\t\tbackground-color: inherit;\r\n\r\n\t\tz-index: 10;\r\n\r\n\t\t&.tabulator-frozen-left{\r\n\t\t\tborder-right:2px solid $rowBorderColor;\r\n\t\t}\r\n\r\n\t\t&.tabulator-frozen-right{\r\n\t\t\tborder-left:2px solid $rowBorderColor;\r\n\t\t}\r\n\t}\r\n\r\n\t.tabulator-responsive-collapse{\r\n\t\tbox-sizing:border-box;\r\n\r\n\t\tpadding:5px;\r\n\r\n\t\tborder-top:1px solid $rowBorderColor;\r\n\t\tborder-bottom:1px solid $rowBorderColor;\r\n\r\n\t\t&:empty{\r\n\t\t\tdisplay:none;\r\n\t\t}\r\n\r\n\t\ttable{\r\n\t\t\tfont-size:$textSize;\r\n\r\n\t\t\ttr{\r\n\t\t\t\ttd{\r\n\t\t\t\t\tposition: relative;\r\n\r\n\t\t\t\t\t&:first-of-type{\r\n\t\t\t\t\t\tpadding-right:10px;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\t//cell element\r\n\t.tabulator-cell{\r\n\t\tdisplay:inline-block;\r\n\t\tposition: relative;\r\n\t\tbox-sizing:border-box;\r\n\t\tpadding:6px;\r\n\t\tborder-right:1px solid $rowBorderColor;\r\n\t\tvertical-align:middle;\r\n\t\twhite-space:nowrap;\r\n\t\toverflow:hidden;\r\n\t\ttext-overflow:ellipsis;\r\n\r\n\r\n\t\t&.tabulator-editing{\r\n\t\t\tborder:1px solid $editBoxColor;\r\n\t\t\tpadding: 0;\r\n\r\n\t\t\tinput, select{\r\n\t\t\t\tborder:1px;\r\n\t\t\t\tbackground:transparent;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t&.tabulator-validation-fail{\r\n\t\t\tborder:1px solid $errorColor;\r\n\t\t\tinput, select{\r\n\t\t\t\tborder:1px;\r\n\t\t\t\tbackground:transparent;\r\n\r\n\t\t\t\tcolor: $errorColor;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t//hide left resize handle on first column\r\n\t\t&:first-child{\r\n\t\t\t.tabulator-col-resize-handle.prev{\r\n\t\t\t\tdisplay: none;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t//movable row handle\r\n\t\t&.tabulator-row-handle{\r\n\r\n\t\t\tdisplay: inline-flex;\r\n\t\t\talign-items:center;\r\n\r\n\t\t\t-moz-user-select: none;\r\n\t\t\t-khtml-user-select: none;\r\n\t\t\t-webkit-user-select: none;\r\n\t\t\t-o-user-select: none;\r\n\r\n\t\t\t//handle holder\r\n\t\t\t.tabulator-row-handle-box{\r\n\t\t\t\twidth:80%;\r\n\r\n\t\t\t\t//Hamburger element\r\n\t\t\t\t.tabulator-row-handle-bar{\r\n\t\t\t\t\twidth:100%;\r\n\t\t\t\t\theight:3px;\r\n\t\t\t\t\tmargin-top:2px;\r\n\t\t\t\t\tbackground:$sortArrowActive;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t.tabulator-data-tree-branch{\r\n\t\t\tdisplay:inline-block;\r\n\t\t\tvertical-align:middle;\r\n\r\n\t\t\theight:9px;\r\n\t\t\twidth:7px;\r\n\r\n\t\t\tmargin-top:-9px;\r\n\t\t\tmargin-right:5px;\r\n\r\n\t\t\tborder-bottom-left-radius:1px;\r\n\r\n\t\t\tborder-left:2px solid $rowBorderColor;\r\n\t\t\tborder-bottom:2px solid $rowBorderColor;\r\n\t\t}\r\n\r\n\t\t.tabulator-data-tree-control{\r\n\r\n\t\t\tdisplay:inline-flex;\r\n\t\t\tjustify-content:center;\r\n\t\t\talign-items:center;\r\n\t\t\tvertical-align:middle;\r\n\r\n\t\t\theight:11px;\r\n\t\t\twidth:11px;\r\n\r\n\t\t\tmargin-right:5px;\r\n\r\n\t\t\tborder:1px solid $rowTextColor;\r\n\t\t\tborder-radius:2px;\r\n\t\t\tbackground:rgba(0, 0, 0, .1);\r\n\r\n\t\t\toverflow:hidden;\r\n\r\n\t\t\t&:hover{\r\n\t\t\t\tcursor:pointer;\r\n\t\t\t\tbackground:rgba(0, 0, 0, .2);\r\n\t\t\t}\r\n\r\n\t\t\t.tabulator-data-tree-control-collapse{\r\n\t\t\t\tdisplay:inline-block;\r\n\t\t\t\tposition: relative;\r\n\r\n\t\t\t\theight: 7px;\r\n\t\t\t\twidth: 1px;\r\n\r\n\t\t\t\tbackground: transparent;\r\n\r\n\t\t\t\t&:after {\r\n\t\t\t\t\tposition: absolute;\r\n\t\t\t\t\tcontent: \"\";\r\n\t\t\t\t\tleft: -3px;\r\n\t\t\t\t\ttop: 3px;\r\n\r\n\t\t\t\t\theight: 1px;\r\n\t\t\t\t\twidth: 7px;\r\n\r\n\t\t\t\t\tbackground: $rowTextColor;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\t.tabulator-data-tree-control-expand{\r\n\t\t\t\tdisplay:inline-block;\r\n\t\t\t\tposition: relative;\r\n\r\n\t\t\t\theight: 7px;\r\n\t\t\t\twidth: 1px;\r\n\r\n\t\t\t\tbackground: $rowTextColor;\r\n\r\n\t\t\t\t&:after {\r\n\t\t\t\t\tposition: absolute;\r\n\t\t\t\t\tcontent: \"\";\r\n\t\t\t\t\tleft: -3px;\r\n\t\t\t\t\ttop: 3px;\r\n\r\n\t\t\t\t\theight: 1px;\r\n\t\t\t\t\twidth: 7px;\r\n\r\n\t\t\t\t\tbackground: $rowTextColor;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\t.tabulator-responsive-collapse-toggle{\r\n\t\t\tdisplay: inline-flex;\r\n\t\t\talign-items:center;\r\n\t\t\tjustify-content:center;\r\n\r\n\t\t\t-moz-user-select: none;\r\n\t\t\t-khtml-user-select: none;\r\n\t\t\t-webkit-user-select: none;\r\n\t\t\t-o-user-select: none;\r\n\r\n\t\t\theight:15px;\r\n\t\t\twidth:15px;\r\n\r\n\t\t\tborder-radius:20px;\r\n\t\t\tbackground:#666;\r\n\r\n\t\t\tcolor:$rowBackgroundColor;\r\n\t\t\tfont-weight:bold;\r\n\t\t\tfont-size:1.1em;\r\n\r\n\t\t\t&:hover{\r\n\t\t\t\topacity:.7;\r\n\t\t\t}\r\n\r\n\t\t\t&.open{\r\n\t\t\t\t.tabulator-responsive-collapse-toggle-close{\r\n\t\t\t\t\tdisplay:initial;\r\n\t\t\t\t}\r\n\r\n\t\t\t\t.tabulator-responsive-collapse-toggle-open{\r\n\t\t\t\t\tdisplay:none;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\t.tabulator-responsive-collapse-toggle-close{\r\n\t\t\t\tdisplay:none;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t.tabulator-traffic-light{\r\n\t\t\tdisplay: inline-block;\r\n\t\t\theight:14px;\r\n\t\t\twidth:14px;\r\n\r\n\t\t\tborder-radius:14px;\r\n\t\t}\r\n\t}\r\n\r\n\t//row grouping element\r\n\t&.tabulator-group{\r\n\t\tbox-sizing:border-box;\r\n\t\tborder-right:1px solid $rowBorderColor;\r\n\t\tborder-top:1px solid #000;\r\n\t\tborder-bottom:2px solid $headerSeperatorColor;\r\n\t\tpadding:5px;\r\n\t\tpadding-left:10px;\r\n\t\tbackground:$headerBackgroundColor;\r\n\t\tcolor:$headerTextColor;\r\n\t\tfont-weight:bold;\r\n\r\n\t\tmin-width: 100%;\r\n\r\n\t\t&:hover{\r\n\t\t\tcursor:pointer;\r\n\t\t\tbackground-color:darken($headerBackgroundColor, 10%);\r\n\t\t}\r\n\r\n\t\t&.tabulator-group-visible{\r\n\t\t\t.tabulator-arrow{\r\n\t\t\t\tmargin-right:10px;\r\n\t\t\t\tborder-left: 6px solid transparent;\r\n\t\t\t\tborder-right: 6px solid transparent;\r\n\t\t\t\tborder-top: 6px solid $sortArrowActive;\r\n\t\t\t\tborder-bottom: 0;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t&.tabulator-group-level-1{\r\n\t\t\tpadding-left:30px;\r\n\t\t}\r\n\r\n\t\t&.tabulator-group-level-2{\r\n\t\t\tpadding-left:50px;\r\n\t\t}\r\n\r\n\t\t&.tabulator-group-level-3{\r\n\t\t\tpadding-left:70px;\r\n\t\t}\r\n\r\n\t\t&.tabulator-group-level-4{\r\n\t\t\tpadding-left:90px;\r\n\t\t}\r\n\r\n\t\t&.tabulator-group-level-5{\r\n\t\t\tpadding-left:110px;\r\n\t\t}\r\n\r\n\t\t.tabulator-group-toggle{\r\n\t\t\tdisplay: inline-block;\r\n\t\t}\r\n\r\n\t\t//sorting arrow\r\n\t\t.tabulator-arrow{\r\n\t\t\tdisplay: inline-block;\r\n\t\t\twidth: 0;\r\n\t\t\theight: 0;\r\n\t\t\tmargin-right:16px;\r\n\t\t\tborder-top: 6px solid transparent;\r\n\t\t\tborder-bottom: 6px solid transparent;\r\n\t\t\tborder-right: 0;\r\n\t\t\tborder-left: 6px solid $sortArrowActive;\r\n\t\t\tvertical-align:middle;\r\n\t\t}\r\n\r\n\t\tspan{\r\n\t\t\tmargin-left:10px;\r\n\t\t\tcolor:$headerSeperatorColor;\r\n\t\t}\r\n\t}\r\n\r\n}\r\n\r\n.tabulator-menu{\r\n\tposition: absolute;\r\n\tdisplay:inline-block;\r\n\tbox-sizing:border-box;\r\n\r\n\tbackground:$rowBackgroundColor;\r\n\tborder:1px solid $rowBorderColor;\r\n\tbox-shadow: 0 0 5px 0 rgba(0, 0, 0, .2);\r\n\r\n\tfont-size:$textSize;\r\n\r\n\toverflow-y:auto;\r\n\t-webkit-overflow-scrolling: touch;\r\n\r\n\tz-index: 10000;\r\n\r\n\t.tabulator-menu-item{\r\n\r\n\t\tpadding:5px 10px;\r\n\r\n\t\tuser-select: none;\r\n\r\n\t\t&.tabulator-menu-item-disabled{\r\n\t\t\topacity: .5;\r\n\t\t}\r\n\r\n\t\t&:not(.tabulator-menu-item-disabled):hover{\r\n\t\t\tcursor: pointer;\r\n\t\t\tbackground: $rowAltBackgroundColor;\r\n\t\t}\r\n\t}\r\n\r\n\t.tabulator-menu-separator{\r\n\t\tborder-top:1px solid $rowBorderColor;\r\n\t}\r\n}\r\n\r\n.tabulator-edit-select-list{\r\n\tposition: absolute;\r\n\tdisplay:inline-block;\r\n\tbox-sizing:border-box;\r\n\r\n\tmax-height:200px;\r\n\r\n\tbackground:$rowBackgroundColor;\r\n\tborder:1px solid $rowBorderColor;\r\n\r\n\tfont-size:$textSize;\r\n\r\n\toverflow-y:auto;\r\n\t-webkit-overflow-scrolling: touch;\r\n\r\n\tz-index: 10000;\r\n\r\n\t.tabulator-edit-select-list-item{\r\n\t\tpadding:4px;\r\n\r\n\t\tcolor:$rowTextColor;\r\n\r\n\t\t&.active{\r\n\t\t\tcolor:$rowBackgroundColor;\r\n\t\t\tbackground:$editBoxColor;\r\n\r\n\t\t\t&.focused{\r\n\t\t\t\toutline:1px solid rgba($rowBackgroundColor, .5);\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t&.focused{\r\n\t\t\toutline:1px solid $editBoxColor;\r\n\t\t}\r\n\r\n\r\n\t\t&:hover{\r\n\t\t\tcursor:pointer;\r\n\r\n\t\t\tcolor:$rowBackgroundColor;\r\n\t\t\tbackground:$editBoxColor;\r\n\t\t}\r\n\t}\r\n\r\n\t.tabulator-edit-select-list-notice{\r\n\t\tpadding:4px;\r\n\r\n\t\tcolor:$rowTextColor;\r\n\t\ttext-align: center;\r\n\t}\r\n\r\n\t.tabulator-edit-select-list-group{\r\n\t\tborder-bottom:1px solid $rowBorderColor;\r\n\r\n\t\tpadding:4px;\r\n\t\tpadding-top:6px;\r\n\r\n\t\tcolor:$rowTextColor;\r\n\t\tfont-weight:bold;\r\n\t}\r\n}\r\n\r\n// Table print styling\r\n\r\n.tabulator-print-fullscreen{\r\n\tposition: absolute;\r\n\ttop:0;\r\n\tbottom:0;\r\n\tleft:0;\r\n\tright:0;\r\n\r\n\tz-index: 10000;\r\n}\r\n\r\nbody.tabulator-print-fullscreen-hide>*:not(.tabulator-print-fullscreen){\r\n\tdisplay:none !important;\r\n}\r\n\r\n.tabulator-print-table{\r\n\tborder-collapse: collapse;\r\n\r\n\t//row grouping element\r\n\t.tabulator-print-table-group{\r\n\t\tbox-sizing:border-box;\r\n\t\tborder-right:1px solid $rowBorderColor;\r\n\t\tborder-top:1px solid #000;\r\n\t\tborder-bottom:2px solid $headerSeperatorColor;\r\n\t\tpadding:5px;\r\n\t\tpadding-left:10px;\r\n\t\tbackground:$headerBackgroundColor;\r\n\t\tcolor:$headerTextColor;\r\n\t\tfont-weight:bold;\r\n\r\n\t\tmin-width: 100%;\r\n\r\n\t\t&:hover{\r\n\t\t\tcursor:pointer;\r\n\t\t\tbackground-color:darken($headerBackgroundColor, 10%);\r\n\t\t}\r\n\r\n\t\t&.tabulator-group-visible{\r\n\t\t\t.tabulator-arrow{\r\n\t\t\t\tmargin-right:10px;\r\n\t\t\t\tborder-left: 6px solid transparent;\r\n\t\t\t\tborder-right: 6px solid transparent;\r\n\t\t\t\tborder-top: 6px solid $sortArrowActive;\r\n\t\t\t\tborder-bottom: 0;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t&.tabulator-group-level-1{\r\n\t\t\ttd{\r\n\t\t\t\tpadding-left:30px !important;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t&.tabulator-group-level-2{\r\n\t\t\ttd{\r\n\t\t\t\tpadding-left:50px !important;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t&.tabulator-group-level-3{\r\n\t\t\ttd{\r\n\t\t\t\tpadding-left:70px !important;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t&.tabulator-group-level-4{\r\n\t\t\ttd{\r\n\t\t\t\tpadding-left:90px !important;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t&.tabulator-group-level-5{\r\n\t\t\ttd{\r\n\t\t\t\tpadding-left:110px !important;\r\n\t\t\t}\r\n\t\t}\r\n\t\t.tabulator-group-toggle{\r\n\t\t\tdisplay: inline-block;\r\n\t\t}\r\n\r\n\t\t//sorting arrow\r\n\t\t.tabulator-arrow{\r\n\t\t\tdisplay: inline-block;\r\n\t\t\twidth: 0;\r\n\t\t\theight: 0;\r\n\t\t\tmargin-right:16px;\r\n\t\t\tborder-top: 6px solid transparent;\r\n\t\t\tborder-bottom: 6px solid transparent;\r\n\t\t\tborder-right: 0;\r\n\t\t\tborder-left: 6px solid $sortArrowActive;\r\n\t\t\tvertical-align:middle;\r\n\t\t}\r\n\r\n\t\tspan{\r\n\t\t\tmargin-left:10px;\r\n\t\t\tcolor:$headerSeperatorColor;\r\n\t\t}\r\n\t}\r\n\r\n\t.tabulator-data-tree-branch{\r\n\t\tdisplay:inline-block;\r\n\t\tvertical-align:middle;\r\n\r\n\t\theight:9px;\r\n\t\twidth:7px;\r\n\r\n\t\tmargin-top:-9px;\r\n\t\tmargin-right:5px;\r\n\r\n\t\tborder-bottom-left-radius:1px;\r\n\r\n\t\tborder-left:2px solid $rowBorderColor;\r\n\t\tborder-bottom:2px solid $rowBorderColor;\r\n\t}\r\n\r\n\t.tabulator-data-tree-control{\r\n\r\n\t\tdisplay:inline-flex;\r\n\t\tjustify-content:center;\r\n\t\talign-items:center;\r\n\t\tvertical-align:middle;\r\n\r\n\t\theight:11px;\r\n\t\twidth:11px;\r\n\r\n\t\tmargin-right:5px;\r\n\r\n\t\tborder:1px solid $rowTextColor;\r\n\t\tborder-radius:2px;\r\n\t\tbackground:rgba(0, 0, 0, .1);\r\n\r\n\t\toverflow:hidden;\r\n\r\n\t\t&:hover{\r\n\t\t\tcursor:pointer;\r\n\t\t\tbackground:rgba(0, 0, 0, .2);\r\n\t\t}\r\n\r\n\t\t.tabulator-data-tree-control-collapse{\r\n\t\t\tdisplay:inline-block;\r\n\t\t\tposition: relative;\r\n\r\n\t\t\theight: 7px;\r\n\t\t\twidth: 1px;\r\n\r\n\t\t\tbackground: transparent;\r\n\r\n\t\t\t&:after {\r\n\t\t\t\tposition: absolute;\r\n\t\t\t\tcontent: \"\";\r\n\t\t\t\tleft: -3px;\r\n\t\t\t\ttop: 3px;\r\n\r\n\t\t\t\theight: 1px;\r\n\t\t\t\twidth: 7px;\r\n\r\n\t\t\t\tbackground: $rowTextColor;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t.tabulator-data-tree-control-expand{\r\n\t\t\tdisplay:inline-block;\r\n\t\t\tposition: relative;\r\n\r\n\t\t\theight: 7px;\r\n\t\t\twidth: 1px;\r\n\r\n\t\t\tbackground: $rowTextColor;\r\n\r\n\t\t\t&:after {\r\n\t\t\t\tposition: absolute;\r\n\t\t\t\tcontent: \"\";\r\n\t\t\t\tleft: -3px;\r\n\t\t\t\ttop: 3px;\r\n\r\n\t\t\t\theight: 1px;\r\n\t\t\t\twidth: 7px;\r\n\r\n\t\t\t\tbackground: $rowTextColor;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n}\r\n\r\n"]} \ No newline at end of file diff --git a/admin/js/vendors/tabulator/css/tabulator_site.min.orig.css b/admin/js/vendors/tabulator/css/tabulator_site.min.orig.css new file mode 100644 index 0000000..2fc522d --- /dev/null +++ b/admin/js/vendors/tabulator/css/tabulator_site.min.orig.css @@ -0,0 +1,3 @@ +/* Tabulator v4.7.0 (c) Oliver Folkerd */ +.tabulator{position:relative;border-bottom:5px solid #222;background-color:#fff;font-size:14px;text-align:left;overflow:hidden;transform:translatez(0)}.tabulator[tabulator-layout=fitDataFill] .tabulator-tableHolder .tabulator-table{min-width:100%}.tabulator[tabulator-layout=fitDataTable]{display:inline-block}.tabulator[tabulator-layout=fitColumns] .tabulator-row .tabulator-cell:last-of-type{border-right:none}.tabulator.tabulator-block-select{-webkit-user-select:none;-ms-user-select:none;user-select:none}.tabulator .tabulator-header{position:relative;box-sizing:border-box;width:100%;border-bottom:3px solid #3fb449;background-color:#222;color:#fff;font-weight:700;white-space:nowrap;overflow:hidden;-moz-user-select:none;-khtml-user-select:none;-webkit-user-select:none;-o-user-select:none}.tabulator .tabulator-header.tabulator-header-hidden{display:none}.tabulator .tabulator-header .tabulator-col{display:inline-block;position:relative;box-sizing:border-box;border-right:1px solid #aaa;background-color:#222;text-align:left;vertical-align:bottom;overflow:hidden}.tabulator .tabulator-header .tabulator-col.tabulator-moving{position:absolute;border:1px solid #3fb449;background:#090909;pointer-events:none}.tabulator .tabulator-header .tabulator-col .tabulator-col-content{box-sizing:border-box;position:relative;padding:8px}.tabulator .tabulator-header .tabulator-col .tabulator-col-content .tabulator-header-menu-button{padding:0 8px}.tabulator .tabulator-header .tabulator-col .tabulator-col-content .tabulator-header-menu-button:hover{cursor:pointer;opacity:.6}.tabulator .tabulator-header .tabulator-col .tabulator-col-content .tabulator-col-title{box-sizing:border-box;width:100%;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;vertical-align:bottom}.tabulator .tabulator-header .tabulator-col .tabulator-col-content .tabulator-col-title .tabulator-title-editor{box-sizing:border-box;width:100%;border:1px solid #999;padding:1px;background:#fff}.tabulator .tabulator-header .tabulator-col .tabulator-col-content .tabulator-arrow{display:inline-block;position:absolute;top:14px;right:8px;width:0;height:0;border-left:6px solid transparent;border-right:6px solid transparent;border-bottom:6px solid #bbb}.tabulator .tabulator-header .tabulator-col.tabulator-col-group .tabulator-col-group-cols{position:relative;display:-ms-flexbox;display:flex;border-top:1px solid #aaa;overflow:hidden;margin-right:-1px}.tabulator .tabulator-header .tabulator-col:first-child .tabulator-col-resize-handle.prev{display:none}.tabulator .tabulator-header .tabulator-col .tabulator-header-filter{position:relative;box-sizing:border-box;margin-top:2px;width:100%;text-align:center}.tabulator .tabulator-header .tabulator-col .tabulator-header-filter textarea{height:auto!important}.tabulator .tabulator-header .tabulator-col .tabulator-header-filter svg{margin-top:3px}.tabulator .tabulator-header .tabulator-col .tabulator-header-filter input::-ms-clear{width:0;height:0}.tabulator .tabulator-header .tabulator-col.tabulator-sortable .tabulator-col-title{padding-right:25px}.tabulator .tabulator-header .tabulator-col.tabulator-sortable:hover{cursor:pointer;background-color:#090909}.tabulator .tabulator-header .tabulator-col.tabulator-sortable[aria-sort=none] .tabulator-col-content .tabulator-arrow{border-top:none;border-bottom:6px solid #bbb}.tabulator .tabulator-header .tabulator-col.tabulator-sortable[aria-sort=asc] .tabulator-col-content .tabulator-arrow{border-top:none;border-bottom:6px solid #3fb449}.tabulator .tabulator-header .tabulator-col.tabulator-sortable[aria-sort=desc] .tabulator-col-content .tabulator-arrow{border-top:6px solid #3fb449;border-bottom:none}.tabulator .tabulator-header .tabulator-col.tabulator-col-vertical .tabulator-col-content .tabulator-col-title{-ms-writing-mode:tb-rl;writing-mode:vertical-rl;text-orientation:mixed;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center}.tabulator .tabulator-header .tabulator-col.tabulator-col-vertical.tabulator-col-vertical-flip .tabulator-col-title{transform:rotate(180deg)}.tabulator .tabulator-header .tabulator-col.tabulator-col-vertical.tabulator-sortable .tabulator-col-title{padding-right:0;padding-top:20px}.tabulator .tabulator-header .tabulator-col.tabulator-col-vertical.tabulator-sortable.tabulator-col-vertical-flip .tabulator-col-title{padding-right:0;padding-bottom:20px}.tabulator .tabulator-header .tabulator-col.tabulator-col-vertical.tabulator-sortable .tabulator-arrow{right:calc(50% - 6px)}.tabulator .tabulator-header .tabulator-frozen{display:inline-block;position:absolute;z-index:10}.tabulator .tabulator-header .tabulator-frozen.tabulator-frozen-left{border-right:2px solid #aaa}.tabulator .tabulator-header .tabulator-frozen.tabulator-frozen-right{border-left:2px solid #aaa}.tabulator .tabulator-header .tabulator-calcs-holder{box-sizing:border-box;min-width:600%;background:#3c3c3c!important;border-top:1px solid #aaa;overflow:hidden}.tabulator .tabulator-header .tabulator-calcs-holder .tabulator-row{background:#3c3c3c!important}.tabulator .tabulator-header .tabulator-calcs-holder .tabulator-row .tabulator-col-resize-handle{display:none}.tabulator .tabulator-header .tabulator-frozen-rows-holder{min-width:600%}.tabulator .tabulator-header .tabulator-frozen-rows-holder:empty{display:none}.tabulator .tabulator-tableHolder{position:relative;width:100%;white-space:nowrap;overflow:auto;-webkit-overflow-scrolling:touch}.tabulator .tabulator-tableHolder:focus{outline:none}.tabulator .tabulator-tableHolder .tabulator-placeholder{box-sizing:border-box;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;width:100%}.tabulator .tabulator-tableHolder .tabulator-placeholder[tabulator-render-mode=virtual]{min-height:100%;min-width:100%}.tabulator .tabulator-tableHolder .tabulator-placeholder span{display:inline-block;margin:0 auto;padding:10px;color:#3fb449;font-weight:700;font-size:20px}.tabulator .tabulator-tableHolder .tabulator-table{position:relative;display:inline-block;background-color:#fff;white-space:nowrap;overflow:visible;color:#333}.tabulator .tabulator-tableHolder .tabulator-table .tabulator-row.tabulator-calcs{font-weight:700;background:#484848!important;color:#fff}.tabulator .tabulator-footer{padding:5px 10px;padding-top:8px;border-top:3px solid #3fb449;background-color:#222;text-align:right;color:#222;font-weight:700;white-space:nowrap;-ms-user-select:none;user-select:none;-moz-user-select:none;-khtml-user-select:none;-webkit-user-select:none;-o-user-select:none}.tabulator .tabulator-footer .tabulator-calcs-holder{box-sizing:border-box;width:calc(100% + 20px);margin:-8px -10px 8px;text-align:left;background:#3c3c3c!important;border-bottom:1px solid #aaa;overflow:hidden}.tabulator .tabulator-footer .tabulator-calcs-holder .tabulator-row{background:#3c3c3c!important;color:#fff!important}.tabulator .tabulator-footer .tabulator-calcs-holder .tabulator-row .tabulator-col-resize-handle{display:none}.tabulator .tabulator-footer .tabulator-calcs-holder:only-child{margin-bottom:-5px;border-bottom:none}.tabulator .tabulator-footer .tabulator-paginator label{color:#fff}.tabulator .tabulator-footer .tabulator-page-size{display:inline-block;margin:0 5px;padding:2px 5px;border:1px solid #aaa;border-radius:3px}.tabulator .tabulator-footer .tabulator-pages{margin:0 7px}.tabulator .tabulator-footer .tabulator-page{display:inline-block;margin:0 2px;padding:2px 5px;border:1px solid #aaa;border-radius:3px;background:#fff;color:#222;font-family:inherit;font-weight:inherit;font-size:inherit}.tabulator .tabulator-footer .tabulator-page.active{color:#3fb449}.tabulator .tabulator-footer .tabulator-page:disabled{opacity:.5}.tabulator .tabulator-footer .tabulator-page:not(.disabled):hover{cursor:pointer;background:rgba(0,0,0,.2);color:#fff}.tabulator .tabulator-col-resize-handle{position:absolute;right:0;top:0;bottom:0;width:5px}.tabulator .tabulator-col-resize-handle.prev{left:0;right:auto}.tabulator .tabulator-col-resize-handle:hover{cursor:ew-resize}.tabulator .tabulator-loader{position:absolute;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;top:0;left:0;z-index:100;height:100%;width:100%;background:rgba(0,0,0,.4);text-align:center}.tabulator .tabulator-loader .tabulator-loader-msg{display:inline-block;margin:0 auto;padding:10px 20px;border-radius:10px;background:#fff;font-weight:700;font-size:16px}.tabulator .tabulator-loader .tabulator-loader-msg.tabulator-loading{border:4px solid #333;color:#000}.tabulator .tabulator-loader .tabulator-loader-msg.tabulator-error{border:4px solid #d00;color:#590000}.tabulator-row{position:relative;box-sizing:border-box;min-height:22px;background-color:#fff}.tabulator-row.tabulator-row-even{background-color:#efefef}.tabulator-row.tabulator-selectable:hover{background-color:#bbb;cursor:pointer}.tabulator-row.tabulator-selected{background-color:#9abcea}.tabulator-row.tabulator-selected:hover{background-color:#769bcc;cursor:pointer}.tabulator-row.tabulator-row-moving{border:1px solid #000;background:#fff}.tabulator-row.tabulator-moving{position:absolute;border-top:1px solid #aaa;border-bottom:1px solid #aaa;pointer-events:none!important;z-index:15}.tabulator-row .tabulator-row-resize-handle{position:absolute;right:0;bottom:0;left:0;height:5px}.tabulator-row .tabulator-row-resize-handle.prev{top:0;bottom:auto}.tabulator-row .tabulator-row-resize-handle:hover{cursor:ns-resize}.tabulator-row .tabulator-frozen{display:inline-block;position:absolute;background-color:inherit;z-index:10}.tabulator-row .tabulator-frozen.tabulator-frozen-left{border-right:2px solid #aaa}.tabulator-row .tabulator-frozen.tabulator-frozen-right{border-left:2px solid #aaa}.tabulator-row .tabulator-responsive-collapse{box-sizing:border-box;padding:5px;border-top:1px solid #aaa;border-bottom:1px solid #aaa}.tabulator-row .tabulator-responsive-collapse:empty{display:none}.tabulator-row .tabulator-responsive-collapse table{font-size:14px}.tabulator-row .tabulator-responsive-collapse table tr td{position:relative}.tabulator-row .tabulator-responsive-collapse table tr td:first-of-type{padding-right:10px}.tabulator-row .tabulator-cell{display:inline-block;position:relative;box-sizing:border-box;padding:6px;border-right:1px solid #aaa;vertical-align:middle;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.tabulator-row .tabulator-cell.tabulator-editing{border:1px solid #1d68cd;padding:0}.tabulator-row .tabulator-cell.tabulator-editing input,.tabulator-row .tabulator-cell.tabulator-editing select{border:1px;background:transparent}.tabulator-row .tabulator-cell.tabulator-validation-fail{border:1px solid #d00}.tabulator-row .tabulator-cell.tabulator-validation-fail input,.tabulator-row .tabulator-cell.tabulator-validation-fail select{border:1px;background:transparent;color:#d00}.tabulator-row .tabulator-cell:first-child .tabulator-col-resize-handle.prev{display:none}.tabulator-row .tabulator-cell.tabulator-row-handle{display:-ms-inline-flexbox;display:inline-flex;-ms-flex-align:center;align-items:center;-moz-user-select:none;-khtml-user-select:none;-webkit-user-select:none;-o-user-select:none}.tabulator-row .tabulator-cell.tabulator-row-handle .tabulator-row-handle-box{width:80%}.tabulator-row .tabulator-cell.tabulator-row-handle .tabulator-row-handle-box .tabulator-row-handle-bar{width:100%;height:3px;margin-top:2px;background:#3fb449}.tabulator-row .tabulator-cell .tabulator-data-tree-branch{display:inline-block;vertical-align:middle;height:9px;width:7px;margin-top:-9px;margin-right:5px;border-bottom-left-radius:1px;border-left:2px solid #aaa;border-bottom:2px solid #aaa}.tabulator-row .tabulator-cell .tabulator-data-tree-control{display:-ms-inline-flexbox;display:inline-flex;-ms-flex-pack:center;justify-content:center;-ms-flex-align:center;align-items:center;vertical-align:middle;height:11px;width:11px;margin-right:5px;border:1px solid #333;border-radius:2px;background:rgba(0,0,0,.1);overflow:hidden}.tabulator-row .tabulator-cell .tabulator-data-tree-control:hover{cursor:pointer;background:rgba(0,0,0,.2)}.tabulator-row .tabulator-cell .tabulator-data-tree-control .tabulator-data-tree-control-collapse{display:inline-block;position:relative;height:7px;width:1px;background:transparent}.tabulator-row .tabulator-cell .tabulator-data-tree-control .tabulator-data-tree-control-collapse:after{position:absolute;content:"";left:-3px;top:3px;height:1px;width:7px;background:#333}.tabulator-row .tabulator-cell .tabulator-data-tree-control .tabulator-data-tree-control-expand{display:inline-block;position:relative;height:7px;width:1px;background:#333}.tabulator-row .tabulator-cell .tabulator-data-tree-control .tabulator-data-tree-control-expand:after{position:absolute;content:"";left:-3px;top:3px;height:1px;width:7px;background:#333}.tabulator-row .tabulator-cell .tabulator-responsive-collapse-toggle{display:-ms-inline-flexbox;display:inline-flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;-moz-user-select:none;-khtml-user-select:none;-webkit-user-select:none;-o-user-select:none;height:15px;width:15px;border-radius:20px;background:#666;color:#fff;font-weight:700;font-size:1.1em}.tabulator-row .tabulator-cell .tabulator-responsive-collapse-toggle:hover{opacity:.7}.tabulator-row .tabulator-cell .tabulator-responsive-collapse-toggle.open .tabulator-responsive-collapse-toggle-close{display:initial}.tabulator-row .tabulator-cell .tabulator-responsive-collapse-toggle.open .tabulator-responsive-collapse-toggle-open,.tabulator-row .tabulator-cell .tabulator-responsive-collapse-toggle .tabulator-responsive-collapse-toggle-close{display:none}.tabulator-row .tabulator-cell .tabulator-traffic-light{display:inline-block;height:14px;width:14px;border-radius:14px}.tabulator-row.tabulator-group{box-sizing:border-box;border-right:1px solid #aaa;border-top:1px solid #000;border-bottom:2px solid #3fb449;padding:5px;padding-left:10px;background:#222;color:#fff;font-weight:700;min-width:100%}.tabulator-row.tabulator-group:hover{cursor:pointer;background-color:#090909}.tabulator-row.tabulator-group.tabulator-group-visible .tabulator-arrow{margin-right:10px;border-left:6px solid transparent;border-right:6px solid transparent;border-top:6px solid #3fb449;border-bottom:0}.tabulator-row.tabulator-group.tabulator-group-level-1{padding-left:30px}.tabulator-row.tabulator-group.tabulator-group-level-2{padding-left:50px}.tabulator-row.tabulator-group.tabulator-group-level-3{padding-left:70px}.tabulator-row.tabulator-group.tabulator-group-level-4{padding-left:90px}.tabulator-row.tabulator-group.tabulator-group-level-5{padding-left:110px}.tabulator-row.tabulator-group .tabulator-group-toggle{display:inline-block}.tabulator-row.tabulator-group .tabulator-arrow{display:inline-block;width:0;height:0;margin-right:16px;border-top:6px solid transparent;border-bottom:6px solid transparent;border-right:0;border-left:6px solid #3fb449;vertical-align:middle}.tabulator-row.tabulator-group span{margin-left:10px;color:#3fb449}.tabulator-menu{position:absolute;display:inline-block;box-sizing:border-box;background:#fff;border:1px solid #aaa;box-shadow:0 0 5px 0 rgba(0,0,0,.2);font-size:14px;overflow-y:auto;-webkit-overflow-scrolling:touch;z-index:10000}.tabulator-menu .tabulator-menu-item{padding:5px 10px;-webkit-user-select:none;-ms-user-select:none;user-select:none}.tabulator-menu .tabulator-menu-item.tabulator-menu-item-disabled{opacity:.5}.tabulator-menu .tabulator-menu-item:not(.tabulator-menu-item-disabled):hover{cursor:pointer;background:#efefef}.tabulator-menu .tabulator-menu-separator{border-top:1px solid #aaa}.tabulator-edit-select-list{position:absolute;display:inline-block;box-sizing:border-box;max-height:200px;background:#fff;border:1px solid #aaa;font-size:14px;overflow-y:auto;-webkit-overflow-scrolling:touch;z-index:10000}.tabulator-edit-select-list .tabulator-edit-select-list-item{padding:4px;color:#333}.tabulator-edit-select-list .tabulator-edit-select-list-item.active{color:#fff;background:#1d68cd}.tabulator-edit-select-list .tabulator-edit-select-list-item.active.focused{outline:1px solid hsla(0,0%,100%,.5)}.tabulator-edit-select-list .tabulator-edit-select-list-item.focused{outline:1px solid #1d68cd}.tabulator-edit-select-list .tabulator-edit-select-list-item:hover{cursor:pointer;color:#fff;background:#1d68cd}.tabulator-edit-select-list .tabulator-edit-select-list-notice{padding:4px;color:#333;text-align:center}.tabulator-edit-select-list .tabulator-edit-select-list-group{border-bottom:1px solid #aaa;padding:4px;padding-top:6px;color:#333;font-weight:700}.tabulator-print-fullscreen{position:absolute;top:0;bottom:0;left:0;right:0;z-index:10000}body.tabulator-print-fullscreen-hide>:not(.tabulator-print-fullscreen){display:none!important}.tabulator-print-table{border-collapse:collapse}.tabulator-print-table .tabulator-print-table-group{box-sizing:border-box;border-right:1px solid #aaa;border-top:1px solid #000;border-bottom:2px solid #3fb449;padding:5px;padding-left:10px;background:#222;color:#fff;font-weight:700;min-width:100%}.tabulator-print-table .tabulator-print-table-group:hover{cursor:pointer;background-color:#090909}.tabulator-print-table .tabulator-print-table-group.tabulator-group-visible .tabulator-arrow{margin-right:10px;border-left:6px solid transparent;border-right:6px solid transparent;border-top:6px solid #3fb449;border-bottom:0}.tabulator-print-table .tabulator-print-table-group.tabulator-group-level-1 td{padding-left:30px!important}.tabulator-print-table .tabulator-print-table-group.tabulator-group-level-2 td{padding-left:50px!important}.tabulator-print-table .tabulator-print-table-group.tabulator-group-level-3 td{padding-left:70px!important}.tabulator-print-table .tabulator-print-table-group.tabulator-group-level-4 td{padding-left:90px!important}.tabulator-print-table .tabulator-print-table-group.tabulator-group-level-5 td{padding-left:110px!important}.tabulator-print-table .tabulator-print-table-group .tabulator-group-toggle{display:inline-block}.tabulator-print-table .tabulator-print-table-group .tabulator-arrow{display:inline-block;width:0;height:0;margin-right:16px;border-top:6px solid transparent;border-bottom:6px solid transparent;border-right:0;border-left:6px solid #3fb449;vertical-align:middle}.tabulator-print-table .tabulator-print-table-group span{margin-left:10px;color:#3fb449}.tabulator-print-table .tabulator-data-tree-branch{display:inline-block;vertical-align:middle;height:9px;width:7px;margin-top:-9px;margin-right:5px;border-bottom-left-radius:1px;border-left:2px solid #aaa;border-bottom:2px solid #aaa}.tabulator-print-table .tabulator-data-tree-control{display:-ms-inline-flexbox;display:inline-flex;-ms-flex-pack:center;justify-content:center;-ms-flex-align:center;align-items:center;vertical-align:middle;height:11px;width:11px;margin-right:5px;border:1px solid #333;border-radius:2px;background:rgba(0,0,0,.1);overflow:hidden}.tabulator-print-table .tabulator-data-tree-control:hover{cursor:pointer;background:rgba(0,0,0,.2)}.tabulator-print-table .tabulator-data-tree-control .tabulator-data-tree-control-collapse{display:inline-block;position:relative;height:7px;width:1px;background:transparent}.tabulator-print-table .tabulator-data-tree-control .tabulator-data-tree-control-collapse:after{position:absolute;content:"";left:-3px;top:3px;height:1px;width:7px;background:#333}.tabulator-print-table .tabulator-data-tree-control .tabulator-data-tree-control-expand{display:inline-block;position:relative;height:7px;width:1px;background:#333}.tabulator-print-table .tabulator-data-tree-control .tabulator-data-tree-control-expand:after{position:absolute;content:"";left:-3px;top:3px;height:1px;width:7px;background:#333} +/*# sourceMappingURL=tabulator_site.min.css.map */ diff --git a/admin/js/vendors/tabulator/js/modules/accessor.js b/admin/js/vendors/tabulator/js/modules/accessor.js new file mode 100644 index 0000000..8ffe1bf --- /dev/null +++ b/admin/js/vendors/tabulator/js/modules/accessor.js @@ -0,0 +1,93 @@ +var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; + +/* Tabulator v4.7.0 (c) Oliver Folkerd */ + +var Accessor = function Accessor(table) { + this.table = table; //hold Tabulator object + this.allowedTypes = ["", "data", "download", "clipboard", "print", "htmlOutput"]; //list of accessor types +}; + +//initialize column accessor +Accessor.prototype.initializeColumn = function (column) { + var self = this, + match = false, + config = {}; + + this.allowedTypes.forEach(function (type) { + var key = "accessor" + (type.charAt(0).toUpperCase() + type.slice(1)), + accessor; + + if (column.definition[key]) { + accessor = self.lookupAccessor(column.definition[key]); + + if (accessor) { + match = true; + + config[key] = { + accessor: accessor, + params: column.definition[key + "Params"] || {} + }; + } + } + }); + + if (match) { + column.modules.accessor = config; + } +}; + +Accessor.prototype.lookupAccessor = function (value) { + var accessor = false; + + //set column accessor + switch (typeof value === "undefined" ? "undefined" : _typeof(value)) { + case "string": + if (this.accessors[value]) { + accessor = this.accessors[value]; + } else { + console.warn("Accessor Error - No such accessor found, ignoring: ", value); + } + break; + + case "function": + accessor = value; + break; + } + + return accessor; +}; + +//apply accessor to row +Accessor.prototype.transformRow = function (dataIn, type) { + var self = this, + key = "accessor" + (type.charAt(0).toUpperCase() + type.slice(1)); + + //clone data object with deep copy to isolate internal data from returned result + var data = Tabulator.prototype.helpers.deepClone(dataIn || {}); + + self.table.columnManager.traverse(function (column) { + var value, accessor, params, component; + + if (column.modules.accessor) { + + accessor = column.modules.accessor[key] || column.modules.accessor.accessor || false; + + if (accessor) { + value = column.getFieldValue(data); + + if (value != "undefined") { + component = column.getComponent(); + params = typeof accessor.params === "function" ? accessor.params(value, data, type, component) : accessor.params; + column.setFieldValue(data, accessor.accessor(value, data, type, params, component)); + } + } + } + }); + + return data; +}, + +//default accessors +Accessor.prototype.accessors = {}; + +Tabulator.prototype.registerModule("accessor", Accessor); \ No newline at end of file diff --git a/admin/js/vendors/tabulator/js/modules/accessor.min.js b/admin/js/vendors/tabulator/js/modules/accessor.min.js new file mode 100644 index 0000000..2633b8f --- /dev/null +++ b/admin/js/vendors/tabulator/js/modules/accessor.min.js @@ -0,0 +1,2 @@ +/* Tabulator v4.7.0 (c) Oliver Folkerd */ +var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(o){return typeof o}:function(o){return o&&"function"==typeof Symbol&&o.constructor===Symbol&&o!==Symbol.prototype?"symbol":typeof o},Accessor=function(o){this.table=o,this.allowedTypes=["","data","download","clipboard","print","htmlOutput"]};Accessor.prototype.initializeColumn=function(o){var e=this,s=!1,r={};this.allowedTypes.forEach(function(t){var c,a="accessor"+(t.charAt(0).toUpperCase()+t.slice(1));o.definition[a]&&(c=e.lookupAccessor(o.definition[a]))&&(s=!0,r[a]={accessor:c,params:o.definition[a+"Params"]||{}})}),s&&(o.modules.accessor=r)},Accessor.prototype.lookupAccessor=function(o){var e=!1;switch(void 0===o?"undefined":_typeof(o)){case"string":this.accessors[o]?e=this.accessors[o]:console.warn("Accessor Error - No such accessor found, ignoring: ",o);break;case"function":e=o}return e},Accessor.prototype.transformRow=function(o,e){var s=this,r="accessor"+(e.charAt(0).toUpperCase()+e.slice(1)),t=Tabulator.prototype.helpers.deepClone(o||{});return s.table.columnManager.traverse(function(o){var s,c,a,n;o.modules.accessor&&(c=o.modules.accessor[r]||o.modules.accessor.accessor||!1)&&"undefined"!=(s=o.getFieldValue(t))&&(n=o.getComponent(),a="function"==typeof c.params?c.params(s,t,e,n):c.params,o.setFieldValue(t,c.accessor(s,t,e,a,n)))}),t},Accessor.prototype.accessors={},Tabulator.prototype.registerModule("accessor",Accessor); \ No newline at end of file diff --git a/admin/js/vendors/tabulator/js/modules/ajax.js b/admin/js/vendors/tabulator/js/modules/ajax.js new file mode 100644 index 0000000..7d72604 --- /dev/null +++ b/admin/js/vendors/tabulator/js/modules/ajax.js @@ -0,0 +1,465 @@ +var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; + +/* Tabulator v4.7.0 (c) Oliver Folkerd */ + +var Ajax = function Ajax(table) { + + this.table = table; //hold Tabulator object + this.config = false; //hold config object for ajax request + this.url = ""; //request URL + this.urlGenerator = false; + this.params = false; //request parameters + + this.loaderElement = this.createLoaderElement(); //loader message div + this.msgElement = this.createMsgElement(); //message element + this.loadingElement = false; + this.errorElement = false; + this.loaderPromise = false; + + this.progressiveLoad = false; + this.loading = false; + + this.requestOrder = 0; //prevent requests comming out of sequence if overridden by another load request +}; + +//initialize setup options +Ajax.prototype.initialize = function () { + var template; + + this.loaderElement.appendChild(this.msgElement); + + if (this.table.options.ajaxLoaderLoading) { + if (typeof this.table.options.ajaxLoaderLoading == "string") { + template = document.createElement('template'); + template.innerHTML = this.table.options.ajaxLoaderLoading.trim(); + this.loadingElement = template.content.firstChild; + } else { + this.loadingElement = this.table.options.ajaxLoaderLoading; + } + } + + this.loaderPromise = this.table.options.ajaxRequestFunc || this.defaultLoaderPromise; + + this.urlGenerator = this.table.options.ajaxURLGenerator || this.defaultURLGenerator; + + if (this.table.options.ajaxLoaderError) { + if (typeof this.table.options.ajaxLoaderError == "string") { + template = document.createElement('template'); + template.innerHTML = this.table.options.ajaxLoaderError.trim(); + this.errorElement = template.content.firstChild; + } else { + this.errorElement = this.table.options.ajaxLoaderError; + } + } + + if (this.table.options.ajaxParams) { + this.setParams(this.table.options.ajaxParams); + } + + if (this.table.options.ajaxConfig) { + this.setConfig(this.table.options.ajaxConfig); + } + + if (this.table.options.ajaxURL) { + this.setUrl(this.table.options.ajaxURL); + } + + if (this.table.options.ajaxProgressiveLoad) { + if (this.table.options.pagination) { + this.progressiveLoad = false; + console.error("Progressive Load Error - Pagination and progressive load cannot be used at the same time"); + } else { + if (this.table.modExists("page")) { + this.progressiveLoad = this.table.options.ajaxProgressiveLoad; + this.table.modules.page.initializeProgressive(this.progressiveLoad); + } else { + console.error("Pagination plugin is required for progressive ajax loading"); + } + } + } +}; + +Ajax.prototype.createLoaderElement = function () { + var el = document.createElement("div"); + el.classList.add("tabulator-loader"); + return el; +}; + +Ajax.prototype.createMsgElement = function () { + var el = document.createElement("div"); + + el.classList.add("tabulator-loader-msg"); + el.setAttribute("role", "alert"); + + return el; +}; + +//set ajax params +Ajax.prototype.setParams = function (params, update) { + if (update) { + this.params = this.params || {}; + + for (var key in params) { + this.params[key] = params[key]; + } + } else { + this.params = params; + } +}; + +Ajax.prototype.getParams = function () { + return this.params || {}; +}; + +//load config object +Ajax.prototype.setConfig = function (config) { + this._loadDefaultConfig(); + + if (typeof config == "string") { + this.config.method = config; + } else { + for (var key in config) { + this.config[key] = config[key]; + } + } +}; + +//create config object from default +Ajax.prototype._loadDefaultConfig = function (force) { + var self = this; + if (!self.config || force) { + + self.config = {}; + + //load base config from defaults + for (var key in self.defaultConfig) { + self.config[key] = self.defaultConfig[key]; + } + } +}; + +//set request url +Ajax.prototype.setUrl = function (url) { + this.url = url; +}; + +//get request url +Ajax.prototype.getUrl = function () { + return this.url; +}; + +//lstandard loading function +Ajax.prototype.loadData = function (inPosition, columnsChanged) { + var self = this; + + if (this.progressiveLoad) { + return this._loadDataProgressive(); + } else { + return this._loadDataStandard(inPosition, columnsChanged); + } +}; + +Ajax.prototype.nextPage = function (diff) { + var margin; + + if (!this.loading) { + + margin = this.table.options.ajaxProgressiveLoadScrollMargin || this.table.rowManager.getElement().clientHeight * 2; + + if (diff < margin) { + this.table.modules.page.nextPage().then(function () {}).catch(function () {}); + } + } +}; + +Ajax.prototype.blockActiveRequest = function () { + this.requestOrder++; +}; + +Ajax.prototype._loadDataProgressive = function () { + this.table.rowManager.setData([]); + return this.table.modules.page.setPage(1); +}; + +Ajax.prototype._loadDataStandard = function (inPosition, columnsChanged) { + var _this = this; + + return new Promise(function (resolve, reject) { + _this.sendRequest(inPosition).then(function (data) { + _this.table.rowManager.setData(data, inPosition, columnsChanged).then(function () { + resolve(); + }).catch(function (e) { + reject(e); + }); + }).catch(function (e) { + reject(e); + }); + }); +}; + +Ajax.prototype.generateParamsList = function (data, prefix) { + var self = this, + output = []; + + prefix = prefix || ""; + + if (Array.isArray(data)) { + data.forEach(function (item, i) { + output = output.concat(self.generateParamsList(item, prefix ? prefix + "[" + i + "]" : i)); + }); + } else if ((typeof data === "undefined" ? "undefined" : _typeof(data)) === "object") { + for (var key in data) { + output = output.concat(self.generateParamsList(data[key], prefix ? prefix + "[" + key + "]" : key)); + } + } else { + output.push({ key: prefix, value: data }); + } + + return output; +}; + +Ajax.prototype.serializeParams = function (params) { + var output = this.generateParamsList(params), + encoded = []; + + output.forEach(function (item) { + encoded.push(encodeURIComponent(item.key) + "=" + encodeURIComponent(item.value)); + }); + + return encoded.join("&"); +}; + +//send ajax request +Ajax.prototype.sendRequest = function (silent) { + var _this2 = this; + + var self = this, + url = self.url, + requestNo, + esc, + query; + + self.requestOrder++; + requestNo = self.requestOrder; + + self._loadDefaultConfig(); + + return new Promise(function (resolve, reject) { + if (self.table.options.ajaxRequesting.call(_this2.table, self.url, self.params) !== false) { + + self.loading = true; + + if (!silent) { + self.showLoader(); + } + + _this2.loaderPromise(url, self.config, self.params).then(function (data) { + if (requestNo === self.requestOrder) { + if (self.table.options.ajaxResponse) { + data = self.table.options.ajaxResponse.call(self.table, self.url, self.params, data); + } + resolve(data); + + self.hideLoader(); + self.loading = false; + } else { + console.warn("Ajax Response Blocked - An active ajax request was blocked by an attempt to change table data while the request was being made"); + } + }).catch(function (error) { + console.error("Ajax Load Error: ", error); + self.table.options.ajaxError.call(self.table, error); + + self.showError(); + + setTimeout(function () { + self.hideLoader(); + }, 3000); + + self.loading = false; + + reject(); + }); + } else { + reject(); + } + }); +}; + +Ajax.prototype.showLoader = function () { + var shouldLoad = typeof this.table.options.ajaxLoader === "function" ? this.table.options.ajaxLoader() : this.table.options.ajaxLoader; + + if (shouldLoad) { + + this.hideLoader(); + + while (this.msgElement.firstChild) { + this.msgElement.removeChild(this.msgElement.firstChild); + }this.msgElement.classList.remove("tabulator-error"); + this.msgElement.classList.add("tabulator-loading"); + + if (this.loadingElement) { + this.msgElement.appendChild(this.loadingElement); + } else { + this.msgElement.innerHTML = this.table.modules.localize.getText("ajax|loading"); + } + + this.table.element.appendChild(this.loaderElement); + } +}; + +Ajax.prototype.showError = function () { + this.hideLoader(); + + while (this.msgElement.firstChild) { + this.msgElement.removeChild(this.msgElement.firstChild); + }this.msgElement.classList.remove("tabulator-loading"); + this.msgElement.classList.add("tabulator-error"); + + if (this.errorElement) { + this.msgElement.appendChild(this.errorElement); + } else { + this.msgElement.innerHTML = this.table.modules.localize.getText("ajax|error"); + } + + this.table.element.appendChild(this.loaderElement); +}; + +Ajax.prototype.hideLoader = function () { + if (this.loaderElement.parentNode) { + this.loaderElement.parentNode.removeChild(this.loaderElement); + } +}; + +//default ajax config object +Ajax.prototype.defaultConfig = { + method: "GET" +}; + +Ajax.prototype.defaultURLGenerator = function (url, config, params) { + + if (url) { + if (params && Object.keys(params).length) { + if (!config.method || config.method.toLowerCase() == "get") { + config.method = "get"; + + url += (url.includes("?") ? "&" : "?") + this.serializeParams(params); + } + } + } + + return url; +}; + +Ajax.prototype.defaultLoaderPromise = function (url, config, params) { + var self = this, + contentType; + + return new Promise(function (resolve, reject) { + + //set url + url = self.urlGenerator(url, config, params); + + //set body content if not GET request + if (config.method.toUpperCase() != "GET") { + contentType = _typeof(self.table.options.ajaxContentType) === "object" ? self.table.options.ajaxContentType : self.contentTypeFormatters[self.table.options.ajaxContentType]; + if (contentType) { + + for (var key in contentType.headers) { + if (!config.headers) { + config.headers = {}; + } + + if (typeof config.headers[key] === "undefined") { + config.headers[key] = contentType.headers[key]; + } + } + + config.body = contentType.body.call(self, url, config, params); + } else { + console.warn("Ajax Error - Invalid ajaxContentType value:", self.table.options.ajaxContentType); + } + } + + if (url) { + + //configure headers + if (typeof config.headers === "undefined") { + config.headers = {}; + } + + if (typeof config.headers.Accept === "undefined") { + config.headers.Accept = "application/json"; + } + + if (typeof config.headers["X-Requested-With"] === "undefined") { + config.headers["X-Requested-With"] = "XMLHttpRequest"; + } + + if (typeof config.mode === "undefined") { + config.mode = "cors"; + } + + if (config.mode == "cors") { + + if (typeof config.headers["Access-Control-Allow-Origin"] === "undefined") { + config.headers["Access-Control-Allow-Origin"] = window.location.origin; + } + + if (typeof config.credentials === "undefined") { + config.credentials = 'same-origin'; + } + } else { + if (typeof config.credentials === "undefined") { + config.credentials = 'include'; + } + } + + //send request + fetch(url, config).then(function (response) { + if (response.ok) { + response.json().then(function (data) { + resolve(data); + }).catch(function (error) { + reject(error); + console.warn("Ajax Load Error - Invalid JSON returned", error); + }); + } else { + console.error("Ajax Load Error - Connection Error: " + response.status, response.statusText); + reject(response); + } + }).catch(function (error) { + console.error("Ajax Load Error - Connection Error: ", error); + reject(error); + }); + } else { + console.warn("Ajax Load Error - No URL Set"); + resolve([]); + } + }); +}; + +Ajax.prototype.contentTypeFormatters = { + "json": { + headers: { + 'Content-Type': 'application/json' + }, + body: function body(url, config, params) { + return JSON.stringify(params); + } + }, + "form": { + headers: {}, + body: function body(url, config, params) { + var output = this.generateParamsList(params), + form = new FormData(); + + output.forEach(function (item) { + form.append(item.key, item.value); + }); + + return form; + } + } +}; + +Tabulator.prototype.registerModule("ajax", Ajax); \ No newline at end of file diff --git a/admin/js/vendors/tabulator/js/modules/ajax.min.js b/admin/js/vendors/tabulator/js/modules/ajax.min.js new file mode 100644 index 0000000..a5dae29 --- /dev/null +++ b/admin/js/vendors/tabulator/js/modules/ajax.min.js @@ -0,0 +1,2 @@ +/* Tabulator v4.7.0 (c) Oliver Folkerd */ +var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Ajax=function(e){this.table=e,this.config=!1,this.url="",this.urlGenerator=!1,this.params=!1,this.loaderElement=this.createLoaderElement(),this.msgElement=this.createMsgElement(),this.loadingElement=!1,this.errorElement=!1,this.loaderPromise=!1,this.progressiveLoad=!1,this.loading=!1,this.requestOrder=0};Ajax.prototype.initialize=function(){var e;this.loaderElement.appendChild(this.msgElement),this.table.options.ajaxLoaderLoading&&("string"==typeof this.table.options.ajaxLoaderLoading?(e=document.createElement("template"),e.innerHTML=this.table.options.ajaxLoaderLoading.trim(),this.loadingElement=e.content.firstChild):this.loadingElement=this.table.options.ajaxLoaderLoading),this.loaderPromise=this.table.options.ajaxRequestFunc||this.defaultLoaderPromise,this.urlGenerator=this.table.options.ajaxURLGenerator||this.defaultURLGenerator,this.table.options.ajaxLoaderError&&("string"==typeof this.table.options.ajaxLoaderError?(e=document.createElement("template"),e.innerHTML=this.table.options.ajaxLoaderError.trim(),this.errorElement=e.content.firstChild):this.errorElement=this.table.options.ajaxLoaderError),this.table.options.ajaxParams&&this.setParams(this.table.options.ajaxParams),this.table.options.ajaxConfig&&this.setConfig(this.table.options.ajaxConfig),this.table.options.ajaxURL&&this.setUrl(this.table.options.ajaxURL),this.table.options.ajaxProgressiveLoad&&(this.table.options.pagination?(this.progressiveLoad=!1,console.error("Progressive Load Error - Pagination and progressive load cannot be used at the same time")):this.table.modExists("page")?(this.progressiveLoad=this.table.options.ajaxProgressiveLoad,this.table.modules.page.initializeProgressive(this.progressiveLoad)):console.error("Pagination plugin is required for progressive ajax loading"))},Ajax.prototype.createLoaderElement=function(){var e=document.createElement("div");return e.classList.add("tabulator-loader"),e},Ajax.prototype.createMsgElement=function(){var e=document.createElement("div");return e.classList.add("tabulator-loader-msg"),e.setAttribute("role","alert"),e},Ajax.prototype.setParams=function(e,t){if(t){this.params=this.params||{};for(var o in e)this.params[o]=e[o]}else this.params=e},Ajax.prototype.getParams=function(){return this.params||{}},Ajax.prototype.setConfig=function(e){if(this._loadDefaultConfig(),"string"==typeof e)this.config.method=e;else for(var t in e)this.config[t]=e[t]},Ajax.prototype._loadDefaultConfig=function(e){var t=this;if(!t.config||e){t.config={};for(var o in t.defaultConfig)t.config[o]=t.defaultConfig[o]}},Ajax.prototype.setUrl=function(e){this.url=e},Ajax.prototype.getUrl=function(){return this.url},Ajax.prototype.loadData=function(e,t){return this.progressiveLoad?this._loadDataProgressive():this._loadDataStandard(e,t)},Ajax.prototype.nextPage=function(e){var t;this.loading||(t=this.table.options.ajaxProgressiveLoadScrollMargin||2*this.table.rowManager.getElement().clientHeight,e output || output === null) { + output = value; + } + }); + + return output !== null ? precision !== false ? output.toFixed(precision) : output : ""; + }, + "min": function min(values, data, calcParams) { + var output = null, + precision = typeof calcParams.precision !== "undefined" ? calcParams.precision : false; + + values.forEach(function (value) { + + value = Number(value); + + if (value < output || output === null) { + output = value; + } + }); + + return output !== null ? precision !== false ? output.toFixed(precision) : output : ""; + }, + "sum": function sum(values, data, calcParams) { + var output = 0, + precision = typeof calcParams.precision !== "undefined" ? calcParams.precision : false; + + if (values.length) { + values.forEach(function (value) { + value = Number(value); + + output += !isNaN(value) ? Number(value) : 0; + }); + } + + return precision !== false ? output.toFixed(precision) : output; + }, + "concat": function concat(values, data, calcParams) { + var output = 0; + + if (values.length) { + output = values.reduce(function (sum, value) { + return String(sum) + String(value); + }); + } + + return output; + }, + "count": function count(values, data, calcParams) { + var output = 0; + + if (values.length) { + values.forEach(function (value) { + if (value) { + output++; + } + }); + } + + return output; + } +}; + +Tabulator.prototype.registerModule("columnCalcs", ColumnCalcs); \ No newline at end of file diff --git a/admin/js/vendors/tabulator/js/modules/calculation_colums.min.js b/admin/js/vendors/tabulator/js/modules/calculation_colums.min.js new file mode 100644 index 0000000..33464d5 --- /dev/null +++ b/admin/js/vendors/tabulator/js/modules/calculation_colums.min.js @@ -0,0 +1,2 @@ +/* Tabulator v4.7.0 (c) Oliver Folkerd */ +var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ColumnCalcs=function(t){this.table=t,this.topCalcs=[],this.botCalcs=[],this.genColumn=!1,this.topElement=this.createElement(),this.botElement=this.createElement(),this.topRow=!1,this.botRow=!1,this.topInitialized=!1,this.botInitialized=!1,this.initialize()};ColumnCalcs.prototype.createElement=function(){var t=document.createElement("div");return t.classList.add("tabulator-calcs-holder"),t},ColumnCalcs.prototype.initialize=function(){this.genColumn=new Column({field:"value"},this)},ColumnCalcs.prototype.registerColumnField=function(){},ColumnCalcs.prototype.initializeColumn=function(t){var o=t.definition,e={topCalcParams:o.topCalcParams||{},botCalcParams:o.bottomCalcParams||{}};if(o.topCalc){switch(_typeof(o.topCalc)){case"string":this.calculations[o.topCalc]?e.topCalc=this.calculations[o.topCalc]:console.warn("Column Calc Error - No such calculation found, ignoring: ",o.topCalc);break;case"function":e.topCalc=o.topCalc}e.topCalc&&(t.modules.columnCalcs=e,this.topCalcs.push(t),"group"!=this.table.options.columnCalcs&&this.initializeTopRow())}if(o.bottomCalc){switch(_typeof(o.bottomCalc)){case"string":this.calculations[o.bottomCalc]?e.botCalc=this.calculations[o.bottomCalc]:console.warn("Column Calc Error - No such calculation found, ignoring: ",o.bottomCalc);break;case"function":e.botCalc=o.bottomCalc}e.botCalc&&(t.modules.columnCalcs=e,this.botCalcs.push(t),"group"!=this.table.options.columnCalcs&&this.initializeBottomRow())}},ColumnCalcs.prototype.removeCalcs=function(){var t=!1;this.topInitialized&&(this.topInitialized=!1,this.topElement.parentNode.removeChild(this.topElement),t=!0),this.botInitialized&&(this.botInitialized=!1,this.table.footerManager.remove(this.botElement),t=!0),t&&this.table.rowManager.adjustTableSize()},ColumnCalcs.prototype.initializeTopRow=function(){this.topInitialized||(this.table.columnManager.getElement().insertBefore(this.topElement,this.table.columnManager.headersElement.nextSibling),this.topInitialized=!0)},ColumnCalcs.prototype.initializeBottomRow=function(){this.botInitialized||(this.table.footerManager.prepend(this.botElement),this.botInitialized=!0)},ColumnCalcs.prototype.scrollHorizontal=function(t){this.table.columnManager.getElement().scrollWidth,this.table.element.clientWidth;this.botInitialized&&(this.botRow.getElement().style.marginLeft=-t+"px")},ColumnCalcs.prototype.recalc=function(t){var o;if(this.topInitialized||this.botInitialized){if(this.rowsToData(t),this.topInitialized){for(this.topRow&&this.topRow.deleteCells(),o=this.generateRow("top",this.rowsToData(t)),this.topRow=o;this.topElement.firstChild;)this.topElement.removeChild(this.topElement.firstChild);this.topElement.appendChild(o.getElement()),o.initialize(!0)}if(this.botInitialized){for(this.botRow&&this.botRow.deleteCells(),o=this.generateRow("bottom",this.rowsToData(t)),this.botRow=o;this.botElement.firstChild;)this.botElement.removeChild(this.botElement.firstChild);this.botElement.appendChild(o.getElement()),o.initialize(!0)}this.table.rowManager.adjustTableSize(),this.table.modExists("frozenColumns")&&this.table.modules.frozenColumns.layout()}},ColumnCalcs.prototype.recalcRowGroup=function(t){this.recalcGroup(this.table.modules.groupRows.getRowGroup(t))},ColumnCalcs.prototype.recalcAll=function(){var t=this;if((this.topCalcs.length||this.botCalcs.length)&&("group"!==this.table.options.columnCalcs&&this.recalc(this.table.rowManager.activeRows),this.table.options.groupBy&&"table"!==this.table.options.columnCalcs)){table.modules.groupRows.getChildGroups().forEach(function(o){t.recalcGroup(o)})}},ColumnCalcs.prototype.recalcGroup=function(t){var o,e;t&&t.calcs&&(t.calcs.bottom&&(o=this.rowsToData(t.rows),e=this.generateRowData("bottom",o),t.calcs.bottom.updateData(e),t.calcs.bottom.reinitialize()),t.calcs.top&&(o=this.rowsToData(t.rows),e=this.generateRowData("top",o),t.calcs.top.updateData(e),t.calcs.top.reinitialize()))},ColumnCalcs.prototype.generateTopRow=function(t){return this.generateRow("top",this.rowsToData(t))},ColumnCalcs.prototype.generateBottomRow=function(t){return this.generateRow("bottom",this.rowsToData(t))},ColumnCalcs.prototype.rowsToData=function(t){var o=this,e=[];return t.forEach(function(t){if(e.push(t.getData()),o.table.options.dataTree&&o.table.options.dataTreeChildColumnCalcs&&t.modules.dataTree.open){var l=o.rowsToData(o.table.modules.dataTree.getFilteredTreeChildren(t));e=e.concat(l)}}),e},ColumnCalcs.prototype.generateRow=function(t,o){var e,l=this,i=this.generateRowData(t,o);return l.table.modExists("mutator")&&l.table.modules.mutator.disable(),e=new Row(i,this,"calc"),l.table.modExists("mutator")&&l.table.modules.mutator.enable(),e.getElement().classList.add("tabulator-calcs","tabulator-calcs-"+t),e.generateCells=function(){var o=[];l.table.columnManager.columnsByIndex.forEach(function(i){l.genColumn.setField(i.getField()),l.genColumn.hozAlign=i.hozAlign,i.definition[t+"CalcFormatter"]&&l.table.modExists("format")?l.genColumn.modules.format={formatter:l.table.modules.format.getFormatter(i.definition[t+"CalcFormatter"]),params:i.definition[t+"CalcFormatterParams"]}:l.genColumn.modules.format={formatter:l.table.modules.format.getFormatter("plaintext"),params:{}},l.genColumn.definition.cssClass=i.definition.cssClass;var a=new Cell(l.genColumn,e);a.column=i,a.setWidth(),i.cells.push(a),o.push(a),i.visible||a.hide()}),this.cells=o},e},ColumnCalcs.prototype.generateRowData=function(t,o){var e,l,i={},a="top"==t?this.topCalcs:this.botCalcs,n="top"==t?"topCalc":"botCalc";return a.forEach(function(t){var a=[];t.modules.columnCalcs&&t.modules.columnCalcs[n]&&(o.forEach(function(o){a.push(t.getFieldValue(o))}),l=n+"Params",e="function"==typeof t.modules.columnCalcs[l]?t.modules.columnCalcs[l](a,o):t.modules.columnCalcs[l],t.setFieldValue(i,t.modules.columnCalcs[n](a,o,e)))}),i},ColumnCalcs.prototype.hasTopCalcs=function(){return!!this.topCalcs.length},ColumnCalcs.prototype.hasBottomCalcs=function(){return!!this.botCalcs.length},ColumnCalcs.prototype.redraw=function(){this.topRow&&this.topRow.normalizeHeight(!0),this.botRow&&this.botRow.normalizeHeight(!0)},ColumnCalcs.prototype.getResults=function(){var t,o=this,e={};return this.table.options.groupBy&&this.table.modExists("groupRows")?(t=this.table.modules.groupRows.getGroups(!0),t.forEach(function(t){e[t.getKey()]=o.getGroupResults(t)})):e={top:this.topRow?this.topRow.getData():{},bottom:this.botRow?this.botRow.getData():{}},e},ColumnCalcs.prototype.getGroupResults=function(t){var o=this,e=t._getSelf(),l=t.getSubGroups(),i={};return l.forEach(function(t){i[t.getKey()]=o.getGroupResults(t)}),{top:e.calcs.top?e.calcs.top.getData():{},bottom:e.calcs.bottom?e.calcs.bottom.getData():{},groups:i}},ColumnCalcs.prototype.calculations={avg:function(t,o,e){var l=0,i=void 0!==e.precision?e.precision:2;return t.length&&(l=t.reduce(function(t,o){return o=Number(o),t+o}),l/=t.length,l=!1!==i?l.toFixed(i):l),parseFloat(l).toString()},max:function(t,o,e){var l=null,i=void 0!==e.precision&&e.precision;return t.forEach(function(t){((t=Number(t))>l||null===l)&&(l=t)}),null!==l?!1!==i?l.toFixed(i):l:""},min:function(t,o,e){var l=null,i=void 0!==e.precision&&e.precision;return t.forEach(function(t){((t=Number(t))"),a.dataTreeExpandElement?"string"==typeof a.dataTreeExpandElement?(e=document.createElement("div"),e.innerHTML=a.dataTreeExpandElement,this.expandEl=e.firstChild):this.expandEl=a.dataTreeExpandElement:(this.expandEl=document.createElement("div"),this.expandEl.classList.add("tabulator-data-tree-control"),this.expandEl.tabIndex=0,this.expandEl.innerHTML="
"),_typeof(a.dataTreeStartExpanded)){case"boolean":this.startOpen=function(e,t){return a.dataTreeStartExpanded};break;case"function":this.startOpen=a.dataTreeStartExpanded;break;default:this.startOpen=function(e,t){return a.dataTreeStartExpanded[t]}}},DataTree.prototype.initializeRow=function(e){var t=e.getData()[this.field],a=Array.isArray(t),n=a||!a&&"object"===(void 0===t?"undefined":_typeof(t))&&null!==t;!n&&e.modules.dataTree&&e.modules.dataTree.branchEl&&e.modules.dataTree.branchEl.parentNode.removeChild(e.modules.dataTree.branchEl),!n&&e.modules.dataTree&&e.modules.dataTree.controlEl&&e.modules.dataTree.controlEl.parentNode.removeChild(e.modules.dataTree.controlEl),e.modules.dataTree={index:e.modules.dataTree?e.modules.dataTree.index:0,open:!!n&&(e.modules.dataTree?e.modules.dataTree.open:this.startOpen(e.getComponent(),0)),controlEl:!(!e.modules.dataTree||!n)&&e.modules.dataTree.controlEl,branchEl:!(!e.modules.dataTree||!n)&&e.modules.dataTree.branchEl,parent:!!e.modules.dataTree&&e.modules.dataTree.parent,children:n}},DataTree.prototype.layoutRow=function(e){var t=this.elementField?e.getCell(this.elementField):e.getCells()[0],a=t.getElement(),n=e.modules.dataTree;n.branchEl&&(n.branchEl.parentNode&&n.branchEl.parentNode.removeChild(n.branchEl),n.branchEl=!1),n.controlEl&&(n.controlEl.parentNode&&n.controlEl.parentNode.removeChild(n.controlEl),n.controlEl=!1),this.generateControlElement(e,a),e.element.classList.add("tabulator-tree-level-"+n.index),n.index&&(this.branchEl?(n.branchEl=this.branchEl.cloneNode(!0),a.insertBefore(n.branchEl,a.firstChild),n.branchEl.style.marginLeft=(n.branchEl.offsetWidth+n.branchEl.style.marginRight)*(n.index-1)+n.index*this.indent+"px"):a.style.paddingLeft=parseInt(window.getComputedStyle(a,null).getPropertyValue("padding-left"))+n.index*this.indent+"px")},DataTree.prototype.generateControlElement=function(e,t){var a=this,n=e.modules.dataTree,t=t||e.getCells()[0].getElement(),r=n.controlEl;!1!==n.children&&(n.open?(n.controlEl=this.collapseEl.cloneNode(!0),n.controlEl.addEventListener("click",function(t){t.stopPropagation(),a.collapseRow(e)})):(n.controlEl=this.expandEl.cloneNode(!0),n.controlEl.addEventListener("click",function(t){t.stopPropagation(),a.expandRow(e)})),n.controlEl.addEventListener("mousedown",function(e){e.stopPropagation()}),r&&r.parentNode===t?r.parentNode.replaceChild(n.controlEl,r):t.insertBefore(n.controlEl,t.firstChild))},DataTree.prototype.setDisplayIndex=function(e){this.displayIndex=e},DataTree.prototype.getDisplayIndex=function(){return this.displayIndex},DataTree.prototype.getRows=function(e){var t=this,a=[];return e.forEach(function(e,n){var r,l;a.push(e),e instanceof Row&&(r=e.modules.dataTree.children,r.index||!1===r.children||(l=t.getChildren(e),l.forEach(function(e){a.push(e)})))}),a},DataTree.prototype.getChildren=function(e){var t=this,a=e.modules.dataTree,n=[],r=[];return!1!==a.children&&a.open&&(Array.isArray(a.children)||(a.children=this.generateChildren(e)),n=this.table.modExists("filter")?this.table.modules.filter.filter(a.children):a.children,this.table.modExists("sort")&&this.table.modules.sort.sort(n),n.forEach(function(e){r.push(e),t.getChildren(e).forEach(function(e){r.push(e)})})),r},DataTree.prototype.generateChildren=function(e){var t=this,a=[],n=e.getData()[this.field];return Array.isArray(n)||(n=[n]),n.forEach(function(n){var r=new Row(n||{},t.table.rowManager);r.modules.dataTree.index=e.modules.dataTree.index+1,r.modules.dataTree.parent=e,r.modules.dataTree.children&&(r.modules.dataTree.open=t.startOpen(r.getComponent(),r.modules.dataTree.index)),a.push(r)}),a},DataTree.prototype.expandRow=function(e,t){var a=e.modules.dataTree;!1!==a.children&&(a.open=!0,e.reinitialize(),this.table.rowManager.refreshActiveData("tree",!1,!0),this.table.options.dataTreeRowExpanded(e.getComponent(),e.modules.dataTree.index))},DataTree.prototype.collapseRow=function(e){var t=e.modules.dataTree;!1!==t.children&&(t.open=!1,e.reinitialize(),this.table.rowManager.refreshActiveData("tree",!1,!0),this.table.options.dataTreeRowCollapsed(e.getComponent(),e.modules.dataTree.index))},DataTree.prototype.toggleRow=function(e){var t=e.modules.dataTree;!1!==t.children&&(t.open?this.collapseRow(e):this.expandRow(e))},DataTree.prototype.getTreeParent=function(e){return!!e.modules.dataTree.parent&&e.modules.dataTree.parent.getComponent()},DataTree.prototype.getFilteredTreeChildren=function(e){var t,a=e.modules.dataTree,n=[];return a.children&&(Array.isArray(a.children)||(a.children=this.generateChildren(e)),t=this.table.modExists("filter")?this.table.modules.filter.filter(a.children):a.children,t.forEach(function(e){e instanceof Row&&n.push(e)})),n},DataTree.prototype.rowDelete=function(e){var t,a=e.modules.dataTree.parent;a&&(t=this.findChildIndex(e,a),!1!==t&&a.data[this.field].splice(t,1),a.data[this.field].length||delete a.data[this.field],this.initializeRow(a),this.layoutRow(a)),this.table.rowManager.refreshActiveData("tree",!1,!0)},DataTree.prototype.addTreeChildRow=function(e,t,a,n){var r=!1;"string"==typeof t&&(t=JSON.parse(t)),Array.isArray(e.data[this.field])||(e.data[this.field]=[],e.modules.dataTree.open=this.startOpen(e.getComponent(),e.modules.dataTree.index)),void 0!==n&&!1!==(r=this.findChildIndex(n,e))&&e.data[this.field].splice(a?r:r+1,0,t),!1===r&&(a?e.data[this.field].unshift(t):e.data[this.field].push(t)),this.initializeRow(e),this.layoutRow(e),this.table.rowManager.refreshActiveData("tree",!1,!0)},DataTree.prototype.findChildIndex=function(e,t){var a=this,n=!1;return"object"==(void 0===e?"undefined":_typeof(e))?e instanceof Row?n=e.data:e instanceof RowComponent?n=e._getSelf().data:"undefined"!=typeof HTMLElement&&e instanceof HTMLElement&&t.modules.dataTree&&(n=t.modules.dataTree.children.find(function(t){return t instanceof Row&&t.element===e}))&&(n=n.data):n=void 0!==e&&null!==e&&t.data[this.field].find(function(t){return t.data[a.table.options.index]==e}),n&&(Array.isArray(t.data[this.field])&&(n=t.data[this.field].indexOf(n)),-1==n&&(n=!1)),n},DataTree.prototype.getTreeChildren=function(e){var t=e.modules.dataTree,a=[];return t.children&&(Array.isArray(t.children)||(t.children=this.generateChildren(e)),t.children.forEach(function(e){e instanceof Row&&a.push(e.getComponent())})),a},DataTree.prototype.checkForRestyle=function(e){e.row.cells.indexOf(e)||e.row.reinitialize()},DataTree.prototype.getChildField=function(){return this.field},DataTree.prototype.redrawNeeded=function(e){return!!this.field&&void 0!==e[this.field]||!!this.elementField&&void 0!==e[this.elementField]},Tabulator.prototype.registerModule("dataTree",DataTree); \ No newline at end of file diff --git a/admin/js/vendors/tabulator/js/modules/download.js b/admin/js/vendors/tabulator/js/modules/download.js new file mode 100644 index 0000000..9954910 --- /dev/null +++ b/admin/js/vendors/tabulator/js/modules/download.js @@ -0,0 +1,433 @@ +var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; + +/* Tabulator v4.7.0 (c) Oliver Folkerd */ + +var Download = function Download(table) { + this.table = table; //hold Tabulator object +}; + +//trigger file download +Download.prototype.download = function (type, filename, options, range, interceptCallback) { + var self = this, + downloadFunc = false; + + function buildLink(data, mime) { + if (interceptCallback) { + if (interceptCallback === true) { + self.triggerDownload(data, mime, type, filename, true); + } else { + interceptCallback(data); + } + } else { + self.triggerDownload(data, mime, type, filename); + } + } + + if (typeof type == "function") { + downloadFunc = type; + } else { + if (self.downloaders[type]) { + downloadFunc = self.downloaders[type]; + } else { + console.warn("Download Error - No such download type found: ", type); + } + } + + if (downloadFunc) { + var list = this.generateExportList(range); + + downloadFunc.call(this.table, list, options || {}, buildLink); + } +}; + +Download.prototype.generateExportList = function (range) { + var list = this.table.modules.export.generateExportList(this.table.options.downloadConfig, false, range || this.table.options.downloadRowRange, "download"); + + //assign group header formatter + var groupHeader = this.table.options.groupHeaderDownload; + + if (groupHeader && !Array.isArray(groupHeader)) { + groupHeader = [groupHeader]; + } + + list.forEach(function (row) { + var group; + + if (row.type === "group") { + group = row.columns[0]; + + if (groupHeader && groupHeader[row.indent]) { + group.value = groupHeader[row.indent](group.value, row.component._group.getRowCount(), row.component._group.getData(), row.component); + } + } + }); + + return list; +}; + +Download.prototype.triggerDownload = function (data, mime, type, filename, newTab) { + var element = document.createElement('a'), + blob = new Blob([data], { type: mime }), + filename = filename || "Tabulator." + (typeof type === "function" ? "txt" : type); + + blob = this.table.options.downloadReady.call(this.table, data, blob); + + if (blob) { + + if (newTab) { + window.open(window.URL.createObjectURL(blob)); + } else { + if (navigator.msSaveOrOpenBlob) { + navigator.msSaveOrOpenBlob(blob, filename); + } else { + element.setAttribute('href', window.URL.createObjectURL(blob)); + + //set file title + element.setAttribute('download', filename); + + //trigger download + element.style.display = 'none'; + document.body.appendChild(element); + element.click(); + + //remove temporary link element + document.body.removeChild(element); + } + } + + if (this.table.options.downloadComplete) { + this.table.options.downloadComplete(); + } + } +}; + +Download.prototype.commsReceived = function (table, action, data) { + switch (action) { + case "intercept": + this.download(data.type, "", data.options, data.active, data.intercept); + break; + } +}; + +//downloaders +Download.prototype.downloaders = { + csv: function csv(list, options, setFileContents) { + var delimiter = options && options.delimiter ? options.delimiter : ",", + fileContents = [], + headers = []; + + list.forEach(function (row) { + var item = []; + + switch (row.type) { + case "group": + console.warn("Download Warning - CSV downloader cannot process row groups"); + break; + + case "calc": + console.warn("Download Warning - CSV downloader cannot process column calculations"); + break; + + case "header": + row.columns.forEach(function (col, i) { + if (col && col.depth === 1) { + headers[i] = typeof col.value == "undefined" || typeof col.value == "null" ? "" : col.value; + } + }); + break; + + case "row": + row.columns.forEach(function (col) { + + if (col) { + + switch (_typeof(col.value)) { + case "object": + col.value = JSON.stringify(col.value); + break; + + case "undefined": + case "null": + col.value = ""; + break; + } + + item.push('"' + String(col.value).split('"').join('""') + '"'); + } + }); + + fileContents.push(item.join(delimiter)); + break; + } + }); + + if (headers.length) { + fileContents = [headers].concat(fileContents); + } + + fileContents = fileContents.join("\n"); + + if (options.bom) { + fileContents = "\uFEFF" + fileContents; + } + + setFileContents(fileContents, "text/csv"); + }, + + json: function json(list, options, setFileContents) { + var fileContents = []; + + list.forEach(function (row) { + var item = {}; + + switch (row.type) { + case "header": + break; + + case "group": + console.warn("Download Warning - JSON downloader cannot process row groups"); + break; + + case "calc": + console.warn("Download Warning - JSON downloader cannot process column calculations"); + break; + + case "row": + row.columns.forEach(function (col) { + if (col) { + item[col.component.getField()] = col.value; + } + }); + + fileContents.push(item); + break; + } + }); + + fileContents = JSON.stringify(fileContents, null, '\t'); + + setFileContents(fileContents, "application/json"); + }, + + pdf: function pdf(list, options, setFileContents) { + var header = [], + body = [], + autoTableParams = {}, + rowGroupStyles = options.rowGroupStyles || { + fontStyle: "bold", + fontSize: 12, + cellPadding: 6, + fillColor: 220 + }, + rowCalcStyles = options.rowCalcStyles || { + fontStyle: "bold", + fontSize: 10, + cellPadding: 4, + fillColor: 232 + }, + jsPDFParams = options.jsPDF || {}, + title = options && options.title ? options.title : ""; + + if (!jsPDFParams.orientation) { + jsPDFParams.orientation = options.orientation || "landscape"; + } + + if (!jsPDFParams.unit) { + jsPDFParams.unit = "pt"; + } + + //parse row list + list.forEach(function (row) { + var item = {}; + + switch (row.type) { + case "header": + header.push(parseRow(row)); + break; + + case "group": + body.push(parseRow(row, rowGroupStyles)); + break; + + case "calc": + body.push(parseRow(row, rowCalcStyles)); + break; + + case "row": + body.push(parseRow(row)); + break; + } + }); + + function parseRow(row, styles) { + var rowData = []; + + row.columns.forEach(function (col) { + var cell; + + if (col) { + switch (_typeof(col.value)) { + case "object": + col.value = JSON.stringify(col.value); + break; + + case "undefined": + case "null": + col.value = ""; + break; + } + + cell = { + content: col.value, + colSpan: col.width, + rowSpan: col.height + }; + + if (styles) { + cell.styles = styles; + } + + rowData.push(cell); + } else { + rowData.push(""); + } + }); + + return rowData; + } + + //configure PDF + var doc = new jsPDF(jsPDFParams); //set document to landscape, better for most tables + + if (options && options.autoTable) { + if (typeof options.autoTable === "function") { + autoTableParams = options.autoTable(doc) || {}; + } else { + autoTableParams = options.autoTable; + } + } + + if (title) { + autoTableParams.addPageContent = function (data) { + doc.text(title, 40, 30); + }; + } + + autoTableParams.head = header; + autoTableParams.body = body; + + doc.autoTable(autoTableParams); + + if (options && options.documentProcessing) { + options.documentProcessing(doc); + } + + setFileContents(doc.output("arraybuffer"), "application/pdf"); + }, + + xlsx: function xlsx(list, options, setFileContents) { + var self = this, + sheetName = options.sheetName || "Sheet1", + workbook = XLSX.utils.book_new(), + output; + + workbook.SheetNames = []; + workbook.Sheets = {}; + + function generateSheet() { + var rows = [], + merges = [], + worksheet = {}, + range = { s: { c: 0, r: 0 }, e: { c: list[0] ? list[0].columns.reduce(function (a, b) { + return a + (b && b.width ? b.width : 1); + }, 0) : 0, r: list.length } }; + + //parse row list + list.forEach(function (row, i) { + var rowData = []; + + row.columns.forEach(function (col, j) { + + if (col) { + rowData.push(!(col.value instanceof Date) && _typeof(col.value) === "object" ? JSON.stringify(col.value) : col.value); + + if (col.width > 1 || col.height > -1) { + merges.push({ s: { r: i, c: j }, e: { r: i + col.height - 1, c: j + col.width - 1 } }); + } + } else { + rowData.push(""); + } + }); + + rows.push(rowData); + }); + + //convert rows to worksheet + XLSX.utils.sheet_add_aoa(worksheet, rows); + + worksheet['!ref'] = XLSX.utils.encode_range(range); + + if (merges.length) { + worksheet["!merges"] = merges; + } + + return worksheet; + } + + if (options.sheetOnly) { + setFileContents(generateSheet()); + return; + } + + if (options.sheets) { + for (var sheet in options.sheets) { + + if (options.sheets[sheet] === true) { + workbook.SheetNames.push(sheet); + workbook.Sheets[sheet] = generateSheet(); + } else { + + workbook.SheetNames.push(sheet); + + this.table.modules.comms.send(options.sheets[sheet], "download", "intercept", { + type: "xlsx", + options: { sheetOnly: true }, + active: self.active, + intercept: function intercept(data) { + workbook.Sheets[sheet] = data; + } + }); + } + } + } else { + workbook.SheetNames.push(sheetName); + workbook.Sheets[sheetName] = generateSheet(); + } + + if (options.documentProcessing) { + workbook = options.documentProcessing(workbook); + } + + //convert workbook to binary array + function s2ab(s) { + var buf = new ArrayBuffer(s.length); + var view = new Uint8Array(buf); + for (var i = 0; i != s.length; ++i) { + view[i] = s.charCodeAt(i) & 0xFF; + }return buf; + } + + output = XLSX.write(workbook, { bookType: 'xlsx', bookSST: true, type: 'binary' }); + + setFileContents(s2ab(output), "application/octet-stream"); + }, + + html: function html(list, options, setFileContents) { + if (this.modExists("export", true)) { + setFileContents(this.modules.export.genereateHTMLTable(list), "text/html"); + } + } + +}; + +Tabulator.prototype.registerModule("download", Download); \ No newline at end of file diff --git a/admin/js/vendors/tabulator/js/modules/download.min.js b/admin/js/vendors/tabulator/js/modules/download.min.js new file mode 100644 index 0000000..b3b776c --- /dev/null +++ b/admin/js/vendors/tabulator/js/modules/download.min.js @@ -0,0 +1,2 @@ +/* Tabulator v4.7.0 (c) Oliver Folkerd */ +var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Download=function(e){this.table=e};Download.prototype.download=function(e,o,t,n,a){function r(t,n){a?!0===a?l.triggerDownload(t,n,e,o,!0):a(t):l.triggerDownload(t,n,e,o)}var l=this,s=!1;if("function"==typeof e?s=e:l.downloaders[e]?s=l.downloaders[e]:console.warn("Download Error - No such download type found: ",e),s){var i=this.generateExportList(n);s.call(this.table,i,t||{},r)}},Download.prototype.generateExportList=function(e){var o=this.table.modules.export.generateExportList(this.table.options.downloadConfig,!1,e||this.table.options.downloadRowRange,"download"),t=this.table.options.groupHeaderDownload;return t&&!Array.isArray(t)&&(t=[t]),o.forEach(function(e){var o;"group"===e.type&&(o=e.columns[0],t&&t[e.indent]&&(o.value=t[e.indent](o.value,e.component._group.getRowCount(),e.component._group.getData(),e.component)))}),o},Download.prototype.triggerDownload=function(e,o,t,n,a){var r=document.createElement("a"),l=new Blob([e],{type:o}),n=n||"Tabulator."+("function"==typeof t?"txt":t);(l=this.table.options.downloadReady.call(this.table,e,l))&&(a?window.open(window.URL.createObjectURL(l)):navigator.msSaveOrOpenBlob?navigator.msSaveOrOpenBlob(l,n):(r.setAttribute("href",window.URL.createObjectURL(l)),r.setAttribute("download",n),r.style.display="none",document.body.appendChild(r),r.click(),document.body.removeChild(r)),this.table.options.downloadComplete&&this.table.options.downloadComplete())},Download.prototype.commsReceived=function(e,o,t){switch(o){case"intercept":this.download(t.type,"",t.options,t.active,t.intercept)}},Download.prototype.downloaders={csv:function(e,o,t){var n=o&&o.delimiter?o.delimiter:",",a=[],r=[];e.forEach(function(e){var o=[];switch(e.type){case"group":console.warn("Download Warning - CSV downloader cannot process row groups");break;case"calc":console.warn("Download Warning - CSV downloader cannot process column calculations");break;case"header":e.columns.forEach(function(e,o){e&&1===e.depth&&(r[o]=void 0===e.value||"null"==typeof e.value?"":e.value)});break;case"row":e.columns.forEach(function(e){if(e){switch(_typeof(e.value)){case"object":e.value=JSON.stringify(e.value);break;case"undefined":case"null":e.value=""}o.push('"'+String(e.value).split('"').join('""')+'"')}}),a.push(o.join(n))}}),r.length&&(a=[r].concat(a)),a=a.join("\n"),o.bom&&(a="\ufeff"+a),t(a,"text/csv")},json:function(e,o,t){var n=[];e.forEach(function(e){var o={};switch(e.type){case"header":break;case"group":console.warn("Download Warning - JSON downloader cannot process row groups");break;case"calc":console.warn("Download Warning - JSON downloader cannot process column calculations");break;case"row":e.columns.forEach(function(e){e&&(o[e.component.getField()]=e.value)}),n.push(o)}}),n=JSON.stringify(n,null,"\t"),t(n,"application/json")},pdf:function(e,o,t){function n(e,o){var t=[];return e.columns.forEach(function(e){var n;if(e){switch(_typeof(e.value)){case"object":e.value=JSON.stringify(e.value);break;case"undefined":case"null":e.value=""}n={content:e.value,colSpan:e.width,rowSpan:e.height},o&&(n.styles=o),t.push(n)}else t.push("")}),t}var a=[],r=[],l={},s=o.rowGroupStyles||{fontStyle:"bold",fontSize:12,cellPadding:6,fillColor:220},i=o.rowCalcStyles||{fontStyle:"bold",fontSize:10,cellPadding:4,fillColor:232},c=o.jsPDF||{},u=o&&o.title?o.title:"";c.orientation||(c.orientation=o.orientation||"landscape"),c.unit||(c.unit="pt"),e.forEach(function(e){switch(e.type){case"header":a.push(n(e));break;case"group":r.push(n(e,s));break;case"calc":r.push(n(e,i));break;case"row":r.push(n(e))}});var d=new jsPDF(c);o&&o.autoTable&&(l="function"==typeof o.autoTable?o.autoTable(d)||{}:o.autoTable),u&&(l.addPageContent=function(e){d.text(u,40,30)}),l.head=a,l.body=r,d.autoTable(l),o&&o.documentProcessing&&o.documentProcessing(d),t(d.output("arraybuffer"),"application/pdf")},xlsx:function(e,o,t){function n(){var o=[],t=[],n={},a={s:{c:0,r:0},e:{c:e[0]?e[0].columns.reduce(function(e,o){return e+(o&&o.width?o.width:1)},0):0,r:e.length}};return e.forEach(function(e,n){var a=[];e.columns.forEach(function(e,o){e?(a.push(e.value instanceof Date||"object"!==_typeof(e.value)?e.value:JSON.stringify(e.value)),(e.width>1||e.height>-1)&&t.push({s:{r:n,c:o},e:{r:n+e.height-1,c:o+e.width-1}})):a.push("")}),o.push(a)}),XLSX.utils.sheet_add_aoa(n,o),n["!ref"]=XLSX.utils.encode_range(a),t.length&&(n["!merges"]=t),n}var a,r=this,l=o.sheetName||"Sheet1",s=XLSX.utils.book_new();if(s.SheetNames=[],s.Sheets={},o.sheetOnly)return void t(n());if(o.sheets)for(var i in o.sheets)!0===o.sheets[i]?(s.SheetNames.push(i),s.Sheets[i]=n()):(s.SheetNames.push(i),this.table.modules.comms.send(o.sheets[i],"download","intercept",{type:"xlsx",options:{sheetOnly:!0},active:r.active,intercept:function(e){s.Sheets[i]=e}}));else s.SheetNames.push(l),s.Sheets[l]=n();o.documentProcessing&&(s=o.documentProcessing(s)),a=XLSX.write(s,{bookType:"xlsx",bookSST:!0,type:"binary"}),t(function(e){for(var o=new ArrayBuffer(e.length),t=new Uint8Array(o),n=0;n!=e.length;++n)t[n]=255&e.charCodeAt(n);return o}(a),"application/octet-stream")},html:function(e,o,t){this.modExists("export",!0)&&t(this.modules.export.genereateHTMLTable(e),"text/html")}},Tabulator.prototype.registerModule("download",Download); \ No newline at end of file diff --git a/admin/js/vendors/tabulator/js/modules/edit.js b/admin/js/vendors/tabulator/js/modules/edit.js new file mode 100644 index 0000000..e35dd84 --- /dev/null +++ b/admin/js/vendors/tabulator/js/modules/edit.js @@ -0,0 +1,2109 @@ +var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; + +/* Tabulator v4.7.0 (c) Oliver Folkerd */ + +var Edit = function Edit(table) { + this.table = table; //hold Tabulator object + this.currentCell = false; //hold currently editing cell + this.mouseClick = false; //hold mousedown state to prevent click binding being overriden by editor opening + this.recursionBlock = false; //prevent focus recursion + this.invalidEdit = false; + this.editedCells = []; +}; + +//initialize column editor +Edit.prototype.initializeColumn = function (column) { + var self = this, + config = { + editor: false, + blocked: false, + check: column.definition.editable, + params: column.definition.editorParams || {} + }; + + //set column editor + switch (_typeof(column.definition.editor)) { + case "string": + + if (column.definition.editor === "tick") { + column.definition.editor = "tickCross"; + console.warn("DEPRECATION WARNING - the tick editor has been deprecated, please use the tickCross editor"); + } + + if (self.editors[column.definition.editor]) { + config.editor = self.editors[column.definition.editor]; + } else { + console.warn("Editor Error - No such editor found: ", column.definition.editor); + } + break; + + case "function": + config.editor = column.definition.editor; + break; + + case "boolean": + + if (column.definition.editor === true) { + + if (typeof column.definition.formatter !== "function") { + + if (column.definition.formatter === "tick") { + column.definition.formatter = "tickCross"; + console.warn("DEPRECATION WARNING - the tick editor has been deprecated, please use the tickCross editor"); + } + + if (self.editors[column.definition.formatter]) { + config.editor = self.editors[column.definition.formatter]; + } else { + config.editor = self.editors["input"]; + } + } else { + console.warn("Editor Error - Cannot auto lookup editor for a custom formatter: ", column.definition.formatter); + } + } + break; + } + + if (config.editor) { + column.modules.edit = config; + } +}; + +Edit.prototype.getCurrentCell = function () { + return this.currentCell ? this.currentCell.getComponent() : false; +}; + +Edit.prototype.clearEditor = function (cancel) { + var cell = this.currentCell, + cellEl; + + this.invalidEdit = false; + + if (cell) { + this.currentCell = false; + + cellEl = cell.getElement(); + + if (cancel) { + cell.validate(); + } else { + cellEl.classList.remove("tabulator-validation-fail"); + } + + cellEl.classList.remove("tabulator-editing"); + while (cellEl.firstChild) { + cellEl.removeChild(cellEl.firstChild); + }cell.row.getElement().classList.remove("tabulator-row-editing"); + } +}; + +Edit.prototype.cancelEdit = function () { + + if (this.currentCell) { + var cell = this.currentCell; + var component = this.currentCell.getComponent(); + + this.clearEditor(true); + cell.setValueActual(cell.getValue()); + cell.cellRendered(); + + if (cell.column.cellEvents.cellEditCancelled) { + cell.column.cellEvents.cellEditCancelled.call(this.table, component); + } + + this.table.options.cellEditCancelled.call(this.table, component); + } +}; + +//return a formatted value for a cell +Edit.prototype.bindEditor = function (cell) { + var self = this, + element = cell.getElement(); + + element.setAttribute("tabindex", 0); + + element.addEventListener("click", function (e) { + if (!element.classList.contains("tabulator-editing")) { + element.focus({ preventScroll: true }); + } + }); + + element.addEventListener("mousedown", function (e) { + self.mouseClick = true; + }); + + element.addEventListener("focus", function (e) { + if (!self.recursionBlock) { + self.edit(cell, e, false); + } + }); +}; + +Edit.prototype.focusCellNoEvent = function (cell, block) { + this.recursionBlock = true; + if (!(block && this.table.browser === "ie")) { + cell.getElement().focus({ preventScroll: true }); + } + this.recursionBlock = false; +}; + +Edit.prototype.editCell = function (cell, forceEdit) { + this.focusCellNoEvent(cell); + this.edit(cell, false, forceEdit); +}; + +Edit.prototype.focusScrollAdjust = function (cell) { + if (this.table.rowManager.getRenderMode() == "virtual") { + var topEdge = this.table.rowManager.element.scrollTop, + bottomEdge = this.table.rowManager.element.clientHeight + this.table.rowManager.element.scrollTop, + rowEl = cell.row.getElement(), + offset = rowEl.offsetTop; + + if (rowEl.offsetTop < topEdge) { + this.table.rowManager.element.scrollTop -= topEdge - rowEl.offsetTop; + } else { + if (rowEl.offsetTop + rowEl.offsetHeight > bottomEdge) { + this.table.rowManager.element.scrollTop += rowEl.offsetTop + rowEl.offsetHeight - bottomEdge; + } + } + } +}; + +Edit.prototype.edit = function (cell, e, forceEdit) { + var self = this, + allowEdit = true, + rendered = function rendered() {}, + element = cell.getElement(), + cellEditor, + component, + params; + + //prevent editing if another cell is refusing to leave focus (eg. validation fail) + if (this.currentCell) { + if (!this.invalidEdit) { + this.cancelEdit(); + } + return; + } + + //handle successfull value change + function success(value) { + if (self.currentCell === cell) { + var valid = true; + + if (cell.column.modules.validate && self.table.modExists("validate") && self.table.options.validationMode != "manual") { + valid = self.table.modules.validate.validate(cell.column.modules.validate, cell, value); + } + + if (valid === true || self.table.options.validationMode === "highlight") { + self.clearEditor(); + cell.setValue(value, true); + + if (!cell.modules.edit) { + cell.modules.edit = {}; + } + + cell.modules.edit.edited = true; + + if (self.editedCells.indexOf(cell) == -1) { + self.editedCells.push(cell); + } + + if (self.table.options.dataTree && self.table.modExists("dataTree")) { + self.table.modules.dataTree.checkForRestyle(cell); + } + + if (valid !== true) { + element.classList.add("tabulator-validation-fail"); + return false; + } + + return true; + } else { + self.invalidEdit = true; + element.classList.add("tabulator-validation-fail"); + self.focusCellNoEvent(cell, true); + rendered(); + self.table.options.validationFailed.call(self.table, cell.getComponent(), value, valid); + + return false; + } + } else { + // console.warn("Edit Success Error - cannot call success on a cell that is no longer being edited"); + } + } + + //handle aborted edit + function cancel() { + if (self.currentCell === cell) { + self.cancelEdit(); + + if (self.table.options.dataTree && self.table.modExists("dataTree")) { + self.table.modules.dataTree.checkForRestyle(cell); + } + } else { + // console.warn("Edit Success Error - cannot call cancel on a cell that is no longer being edited"); + } + } + + function onRendered(callback) { + rendered = callback; + } + + if (!cell.column.modules.edit.blocked) { + if (e) { + e.stopPropagation(); + } + + switch (_typeof(cell.column.modules.edit.check)) { + case "function": + allowEdit = cell.column.modules.edit.check(cell.getComponent()); + break; + + case "boolean": + allowEdit = cell.column.modules.edit.check; + break; + } + + if (allowEdit || forceEdit) { + + self.cancelEdit(); + + self.currentCell = cell; + + this.focusScrollAdjust(cell); + + component = cell.getComponent(); + + if (this.mouseClick) { + this.mouseClick = false; + + if (cell.column.cellEvents.cellClick) { + cell.column.cellEvents.cellClick.call(this.table, e, component); + } + } + + if (cell.column.cellEvents.cellEditing) { + cell.column.cellEvents.cellEditing.call(this.table, component); + } + + self.table.options.cellEditing.call(this.table, component); + + params = typeof cell.column.modules.edit.params === "function" ? cell.column.modules.edit.params(component) : cell.column.modules.edit.params; + + cellEditor = cell.column.modules.edit.editor.call(self, component, onRendered, success, cancel, params); + + //if editor returned, add to DOM, if false, abort edit + if (cellEditor !== false) { + + if (cellEditor instanceof Node) { + element.classList.add("tabulator-editing"); + cell.row.getElement().classList.add("tabulator-row-editing"); + while (element.firstChild) { + element.removeChild(element.firstChild); + }element.appendChild(cellEditor); + + //trigger onRendered Callback + rendered(); + + //prevent editing from triggering rowClick event + var children = element.children; + + for (var i = 0; i < children.length; i++) { + children[i].addEventListener("click", function (e) { + e.stopPropagation(); + }); + } + } else { + console.warn("Edit Error - Editor should return an instance of Node, the editor returned:", cellEditor); + element.blur(); + return false; + } + } else { + element.blur(); + return false; + } + + return true; + } else { + this.mouseClick = false; + element.blur(); + return false; + } + } else { + this.mouseClick = false; + element.blur(); + return false; + } +}; + +Edit.prototype.maskInput = function (el, options) { + var mask = options.mask, + maskLetter = typeof options.maskLetterChar !== "undefined" ? options.maskLetterChar : "A", + maskNumber = typeof options.maskNumberChar !== "undefined" ? options.maskNumberChar : "9", + maskWildcard = typeof options.maskWildcardChar !== "undefined" ? options.maskWildcardChar : "*", + success = false; + + function fillSymbols(index) { + var symbol = mask[index]; + if (typeof symbol !== "undefined" && symbol !== maskWildcard && symbol !== maskLetter && symbol !== maskNumber) { + el.value = el.value + "" + symbol; + fillSymbols(index + 1); + } + } + + el.addEventListener("keydown", function (e) { + var index = el.value.length, + char = e.key; + + if (e.keyCode > 46) { + if (index >= mask.length) { + e.preventDefault(); + e.stopPropagation(); + success = false; + return false; + } else { + switch (mask[index]) { + case maskLetter: + if (char.toUpperCase() == char.toLowerCase()) { + e.preventDefault(); + e.stopPropagation(); + success = false; + return false; + } + break; + + case maskNumber: + if (isNaN(char)) { + e.preventDefault(); + e.stopPropagation(); + success = false; + return false; + } + break; + + case maskWildcard: + break; + + default: + if (char !== mask[index]) { + e.preventDefault(); + e.stopPropagation(); + success = false; + return false; + } + } + } + + success = true; + } + + return; + }); + + el.addEventListener("keyup", function (e) { + if (e.keyCode > 46) { + if (options.maskAutoFill) { + fillSymbols(el.value.length); + } + } + }); + + if (!el.placeholder) { + el.placeholder = mask; + } + + if (options.maskAutoFill) { + fillSymbols(el.value.length); + } +}; + +Edit.prototype.getEditedCells = function () { + var output = []; + + this.editedCells.forEach(function (cell) { + output.push(cell.getComponent()); + }); + + return output; +}; + +Edit.prototype.clearEdited = function (cell) { + var editIndex; + + if (cell.modules.edit && cell.modules.edit.edited) { + cell.modules.validate.invalid = false; + + editIndex = this.editedCells.indexOf(cell); + + if (editIndex > -1) { + this.editedCells.splice(editIndex, 1); + } + } +}; + +//default data editors +Edit.prototype.editors = { + + //input element + input: function input(cell, onRendered, success, cancel, editorParams) { + + //create and style input + var cellValue = cell.getValue(), + input = document.createElement("input"); + + input.setAttribute("type", editorParams.search ? "search" : "text"); + + input.style.padding = "4px"; + input.style.width = "100%"; + input.style.boxSizing = "border-box"; + + if (editorParams.elementAttributes && _typeof(editorParams.elementAttributes) == "object") { + for (var key in editorParams.elementAttributes) { + if (key.charAt(0) == "+") { + key = key.slice(1); + input.setAttribute(key, input.getAttribute(key) + editorParams.elementAttributes["+" + key]); + } else { + input.setAttribute(key, editorParams.elementAttributes[key]); + } + } + } + + input.value = typeof cellValue !== "undefined" ? cellValue : ""; + + onRendered(function () { + input.focus({ preventScroll: true }); + input.style.height = "100%"; + }); + + function onChange(e) { + if ((cellValue === null || typeof cellValue === "undefined") && input.value !== "" || input.value !== cellValue) { + if (success(input.value)) { + cellValue = input.value; //persist value if successfully validated incase editor is used as header filter + } + } else { + cancel(); + } + } + + //submit new value on blur or change + input.addEventListener("change", onChange); + input.addEventListener("blur", onChange); + + //submit new value on enter + input.addEventListener("keydown", function (e) { + switch (e.keyCode) { + // case 9: + case 13: + onChange(e); + break; + + case 27: + cancel(); + break; + } + }); + + if (editorParams.mask) { + this.table.modules.edit.maskInput(input, editorParams); + } + + return input; + }, + + //resizable text area element + textarea: function textarea(cell, onRendered, success, cancel, editorParams) { + var self = this, + cellValue = cell.getValue(), + vertNav = editorParams.verticalNavigation || "hybrid", + value = String(cellValue !== null && typeof cellValue !== "undefined" ? cellValue : ""), + count = (value.match(/(?:\r\n|\r|\n)/g) || []).length + 1, + input = document.createElement("textarea"), + scrollHeight = 0; + + //create and style input + input.style.display = "block"; + input.style.padding = "2px"; + input.style.height = "100%"; + input.style.width = "100%"; + input.style.boxSizing = "border-box"; + input.style.whiteSpace = "pre-wrap"; + input.style.resize = "none"; + + if (editorParams.elementAttributes && _typeof(editorParams.elementAttributes) == "object") { + for (var key in editorParams.elementAttributes) { + if (key.charAt(0) == "+") { + key = key.slice(1); + input.setAttribute(key, input.getAttribute(key) + editorParams.elementAttributes["+" + key]); + } else { + input.setAttribute(key, editorParams.elementAttributes[key]); + } + } + } + + input.value = value; + + onRendered(function () { + input.focus({ preventScroll: true }); + input.style.height = "100%"; + }); + + function onChange(e) { + + if ((cellValue === null || typeof cellValue === "undefined") && input.value !== "" || input.value !== cellValue) { + + if (success(input.value)) { + cellValue = input.value; //persist value if successfully validated incase editor is used as header filter + } + + setTimeout(function () { + cell.getRow().normalizeHeight(); + }, 300); + } else { + cancel(); + } + } + + //submit new value on blur or change + input.addEventListener("change", onChange); + input.addEventListener("blur", onChange); + + input.addEventListener("keyup", function () { + + input.style.height = ""; + + var heightNow = input.scrollHeight; + + input.style.height = heightNow + "px"; + + if (heightNow != scrollHeight) { + scrollHeight = heightNow; + cell.getRow().normalizeHeight(); + } + }); + + input.addEventListener("keydown", function (e) { + + switch (e.keyCode) { + case 27: + cancel(); + break; + + case 38: + //up arrow + if (vertNav == "editor" || vertNav == "hybrid" && input.selectionStart) { + e.stopImmediatePropagation(); + e.stopPropagation(); + } + + break; + + case 40: + //down arrow + if (vertNav == "editor" || vertNav == "hybrid" && input.selectionStart !== input.value.length) { + e.stopImmediatePropagation(); + e.stopPropagation(); + } + break; + } + }); + + if (editorParams.mask) { + this.table.modules.edit.maskInput(input, editorParams); + } + + return input; + }, + + //input element with type of number + number: function number(cell, onRendered, success, cancel, editorParams) { + + var cellValue = cell.getValue(), + vertNav = editorParams.verticalNavigation || "editor", + input = document.createElement("input"); + + input.setAttribute("type", "number"); + + if (typeof editorParams.max != "undefined") { + input.setAttribute("max", editorParams.max); + } + + if (typeof editorParams.min != "undefined") { + input.setAttribute("min", editorParams.min); + } + + if (typeof editorParams.step != "undefined") { + input.setAttribute("step", editorParams.step); + } + + //create and style input + input.style.padding = "4px"; + input.style.width = "100%"; + input.style.boxSizing = "border-box"; + + if (editorParams.elementAttributes && _typeof(editorParams.elementAttributes) == "object") { + for (var key in editorParams.elementAttributes) { + if (key.charAt(0) == "+") { + key = key.slice(1); + input.setAttribute(key, input.getAttribute(key) + editorParams.elementAttributes["+" + key]); + } else { + input.setAttribute(key, editorParams.elementAttributes[key]); + } + } + } + + input.value = cellValue; + + var blurFunc = function blurFunc(e) { + onChange(); + }; + + onRendered(function () { + //submit new value on blur + input.removeEventListener("blur", blurFunc); + + input.focus({ preventScroll: true }); + input.style.height = "100%"; + + //submit new value on blur + input.addEventListener("blur", blurFunc); + }); + + function onChange() { + var value = input.value; + + if (!isNaN(value) && value !== "") { + value = Number(value); + } + + if (value !== cellValue) { + if (success(value)) { + cellValue = value; //persist value if successfully validated incase editor is used as header filter + } + } else { + cancel(); + } + } + + //submit new value on enter + input.addEventListener("keydown", function (e) { + switch (e.keyCode) { + case 13: + // case 9: + onChange(); + break; + + case 27: + cancel(); + break; + + case 38: //up arrow + case 40: + //down arrow + if (vertNav == "editor") { + e.stopImmediatePropagation(); + e.stopPropagation(); + } + break; + } + }); + + if (editorParams.mask) { + this.table.modules.edit.maskInput(input, editorParams); + } + + return input; + }, + + //input element with type of number + range: function range(cell, onRendered, success, cancel, editorParams) { + + var cellValue = cell.getValue(), + input = document.createElement("input"); + + input.setAttribute("type", "range"); + + if (typeof editorParams.max != "undefined") { + input.setAttribute("max", editorParams.max); + } + + if (typeof editorParams.min != "undefined") { + input.setAttribute("min", editorParams.min); + } + + if (typeof editorParams.step != "undefined") { + input.setAttribute("step", editorParams.step); + } + + //create and style input + input.style.padding = "4px"; + input.style.width = "100%"; + input.style.boxSizing = "border-box"; + + if (editorParams.elementAttributes && _typeof(editorParams.elementAttributes) == "object") { + for (var key in editorParams.elementAttributes) { + if (key.charAt(0) == "+") { + key = key.slice(1); + input.setAttribute(key, input.getAttribute(key) + editorParams.elementAttributes["+" + key]); + } else { + input.setAttribute(key, editorParams.elementAttributes[key]); + } + } + } + + input.value = cellValue; + + onRendered(function () { + input.focus({ preventScroll: true }); + input.style.height = "100%"; + }); + + function onChange() { + var value = input.value; + + if (!isNaN(value) && value !== "") { + value = Number(value); + } + + if (value != cellValue) { + if (success(value)) { + cellValue = value; //persist value if successfully validated incase editor is used as header filter + } + } else { + cancel(); + } + } + + //submit new value on blur + input.addEventListener("blur", function (e) { + onChange(); + }); + + //submit new value on enter + input.addEventListener("keydown", function (e) { + switch (e.keyCode) { + case 13: + // case 9: + onChange(); + break; + + case 27: + cancel(); + break; + } + }); + + return input; + }, + + //select + select: function select(cell, onRendered, success, cancel, editorParams) { + var self = this, + cellEl = cell.getElement(), + initialValue = cell.getValue(), + vertNav = editorParams.verticalNavigation || "editor", + initialDisplayValue = typeof initialValue !== "undefined" || initialValue === null ? initialValue : typeof editorParams.defaultValue !== "undefined" ? editorParams.defaultValue : [], + input = document.createElement("input"), + listEl = document.createElement("div"), + multiselect = editorParams.multiselect, + dataItems = [], + currentItem = {}, + displayItems = [], + currentItems = [], + blurable = true; + + this.table.rowManager.element.addEventListener("scroll", cancelItem); + + if (Array.isArray(editorParams) || !Array.isArray(editorParams) && (typeof editorParams === "undefined" ? "undefined" : _typeof(editorParams)) === "object" && !editorParams.values) { + console.warn("DEPRECATION WARNING - values for the select editor must now be passed into the values property of the editorParams object, not as the editorParams object"); + editorParams = { values: editorParams }; + } + + function getUniqueColumnValues(field) { + var output = {}, + data = self.table.getData(), + column; + + if (field) { + column = self.table.columnManager.getColumnByField(field); + } else { + column = cell.getColumn()._getSelf(); + } + + if (column) { + data.forEach(function (row) { + var val = column.getFieldValue(row); + + if (val !== null && typeof val !== "undefined" && val !== "") { + output[val] = true; + } + }); + + if (editorParams.sortValuesList) { + if (editorParams.sortValuesList == "asc") { + output = Object.keys(output).sort(); + } else { + output = Object.keys(output).sort().reverse(); + } + } else { + output = Object.keys(output); + } + } else { + console.warn("unable to find matching column to create select lookup list:", field); + } + + return output; + } + + function parseItems(inputValues, curentValues) { + var dataList = []; + var displayList = []; + + function processComplexListItem(item) { + var item = { + label: item.label, + value: item.value, + itemParams: item.itemParams, + elementAttributes: item.elementAttributes, + element: false + }; + + // if(item.value === curentValue || (!isNaN(parseFloat(item.value)) && !isNaN(parseFloat(item.value)) && parseFloat(item.value) === parseFloat(curentValue))){ + // setCurrentItem(item); + // } + + if (curentValues.indexOf(item.value) > -1) { + setItem(item); + } + + dataList.push(item); + displayList.push(item); + + return item; + } + + if (typeof inputValues == "function") { + inputValues = inputValues(cell); + } + + if (Array.isArray(inputValues)) { + inputValues.forEach(function (value) { + var item; + + if ((typeof value === "undefined" ? "undefined" : _typeof(value)) === "object") { + + if (value.options) { + item = { + label: value.label, + group: true, + itemParams: value.itemParams, + elementAttributes: value.elementAttributes, + element: false + }; + + displayList.push(item); + + value.options.forEach(function (item) { + processComplexListItem(item); + }); + } else { + processComplexListItem(value); + } + } else { + + item = { + label: value, + value: value, + element: false + }; + + // if(item.value === curentValue || (!isNaN(parseFloat(item.value)) && !isNaN(parseFloat(item.value)) && parseFloat(item.value) === parseFloat(curentValue))){ + // setCurrentItem(item); + // } + + if (curentValues.indexOf(item.value) > -1) { + setItem(item); + } + + dataList.push(item); + displayList.push(item); + } + }); + } else { + for (var key in inputValues) { + var item = { + label: inputValues[key], + value: key, + element: false + }; + + // if(item.value === curentValue || (!isNaN(parseFloat(item.value)) && !isNaN(parseFloat(item.value)) && parseFloat(item.value) === parseFloat(curentValue))){ + // setCurrentItem(item); + // } + + if (curentValues.indexOf(item.value) > -1) { + setItem(item); + } + + dataList.push(item); + displayList.push(item); + } + } + + dataItems = dataList; + displayItems = displayList; + + fillList(); + } + + function fillList() { + while (listEl.firstChild) { + listEl.removeChild(listEl.firstChild); + }displayItems.forEach(function (item) { + + var el = item.element; + + if (!el) { + el = document.createElement("div"); + item.label = editorParams.listItemFormatter ? editorParams.listItemFormatter(item.value, item.label, cell, el, item.itemParams) : item.label; + if (item.group) { + el.classList.add("tabulator-edit-select-list-group"); + el.tabIndex = 0; + el.innerHTML = item.label === "" ? " " : item.label; + } else { + el.classList.add("tabulator-edit-select-list-item"); + el.tabIndex = 0; + el.innerHTML = item.label === "" ? " " : item.label; + + el.addEventListener("click", function () { + // setCurrentItem(item); + // chooseItem(); + if (multiselect) { + toggleItem(item); + input.focus(); + } else { + chooseItem(item); + } + }); + + // if(item === currentItem){ + // el.classList.add("active"); + // } + + if (currentItems.indexOf(item) > -1) { + el.classList.add("active"); + } + } + + if (item.elementAttributes && _typeof(item.elementAttributes) == "object") { + for (var key in item.elementAttributes) { + if (key.charAt(0) == "+") { + key = key.slice(1); + el.setAttribute(key, input.getAttribute(key) + item.elementAttributes["+" + key]); + } else { + el.setAttribute(key, item.elementAttributes[key]); + } + } + } + el.addEventListener("mousedown", function () { + blurable = false; + + setTimeout(function () { + blurable = true; + }, 10); + }); + + item.element = el; + } + + listEl.appendChild(el); + }); + } + + function setCurrentItem(item, active) { + + if (!multiselect && currentItem && currentItem.element) { + currentItem.element.classList.remove("active"); + } + + if (currentItem && currentItem.element) { + currentItem.element.classList.remove("focused"); + } + + currentItem = item; + + if (item.element) { + item.element.classList.add("focused"); + if (active) { + item.element.classList.add("active"); + } + } + } + + // function chooseItem(){ + // hideList(); + + // if(initialValue !== currentItem.value){ + // initialValue = currentItem.value; + // success(currentItem.value); + // }else{ + // cancel(); + // } + // } + + function setItem(item) { + var index = currentItems.indexOf(item); + + if (index == -1) { + currentItems.push(item); + setCurrentItem(item, true); + } + + fillInput(); + } + + function unsetItem(index) { + var item = currentItems[index]; + + if (index > -1) { + currentItems.splice(index, 1); + if (item.element) { + item.element.classList.remove("active"); + } + } + } + + function toggleItem(item) { + if (!item) { + item = currentItem; + } + + var index = currentItems.indexOf(item); + + if (index > -1) { + unsetItem(index); + } else { + if (multiselect !== true && currentItems.length >= multiselect) { + unsetItem(0); + } + + setItem(item); + } + + fillInput(); + } + + function chooseItem(item) { + hideList(); + + if (!item) { + item = currentItem; + } + + if (item) { + success(item.value); + } + } + + function chooseItems() { + hideList(); + + var output = []; + + currentItems.forEach(function (item) { + output.push(item.value); + }); + + success(output); + } + + function fillInput() { + var output = []; + + currentItems.forEach(function (item) { + output.push(item.label); + }); + + input.value = output.join(", "); + } + + function cancelItem() { + hideList(); + cancel(); + } + + function showList() { + if (!listEl.parentNode) { + + if (editorParams.values === true) { + parseItems(getUniqueColumnValues(), initialDisplayValue); + } else if (typeof editorParams.values === "string") { + parseItems(getUniqueColumnValues(editorParams.values), initialDisplayValue); + } else { + parseItems(editorParams.values || [], initialDisplayValue); + } + + var offset = Tabulator.prototype.helpers.elOffset(cellEl); + + listEl.style.minWidth = cellEl.offsetWidth + "px"; + + listEl.style.top = offset.top + cellEl.offsetHeight + "px"; + listEl.style.left = offset.left + "px"; + + listEl.addEventListener("mousedown", function (e) { + blurable = false; + + setTimeout(function () { + blurable = true; + }, 10); + }); + + document.body.appendChild(listEl); + } + } + + function hideList() { + if (listEl.parentNode) { + listEl.parentNode.removeChild(listEl); + } + + removeScrollListener(); + } + + function removeScrollListener() { + self.table.rowManager.element.removeEventListener("scroll", cancelItem); + } + + //style input + input.setAttribute("type", "text"); + + input.style.padding = "4px"; + input.style.width = "100%"; + input.style.boxSizing = "border-box"; + input.style.cursor = "default"; + input.readOnly = this.currentCell != false; + + if (editorParams.elementAttributes && _typeof(editorParams.elementAttributes) == "object") { + for (var key in editorParams.elementAttributes) { + if (key.charAt(0) == "+") { + key = key.slice(1); + input.setAttribute(key, input.getAttribute(key) + editorParams.elementAttributes["+" + key]); + } else { + input.setAttribute(key, editorParams.elementAttributes[key]); + } + } + } + + input.value = typeof initialValue !== "undefined" || initialValue === null ? initialValue : ""; + + // if(editorParams.values === true){ + // parseItems(getUniqueColumnValues(), initialValue); + // }else if(typeof editorParams.values === "string"){ + // parseItems(getUniqueColumnValues(editorParams.values), initialValue); + // }else{ + // parseItems(editorParams.values || [], initialValue); + // } + + //allow key based navigation + input.addEventListener("keydown", function (e) { + var index; + + switch (e.keyCode) { + case 38: + //up arrow + index = dataItems.indexOf(currentItem); + + if (vertNav == "editor" || vertNav == "hybrid" && index) { + e.stopImmediatePropagation(); + e.stopPropagation(); + e.preventDefault(); + + if (index > 0) { + setCurrentItem(dataItems[index - 1], !multiselect); + } + } + break; + + case 40: + //down arrow + index = dataItems.indexOf(currentItem); + + if (vertNav == "editor" || vertNav == "hybrid" && index < dataItems.length - 1) { + e.stopImmediatePropagation(); + e.stopPropagation(); + e.preventDefault(); + + if (index < dataItems.length - 1) { + if (index == -1) { + setCurrentItem(dataItems[0], !multiselect); + } else { + setCurrentItem(dataItems[index + 1], !multiselect); + } + } + } + break; + + case 37: //left arrow + case 39: + //right arrow + e.stopImmediatePropagation(); + e.stopPropagation(); + e.preventDefault(); + break; + + case 13: + //enter + // chooseItem(); + + if (multiselect) { + toggleItem(); + } else { + chooseItem(); + } + + break; + + case 27: + //escape + cancelItem(); + break; + } + }); + + input.addEventListener("blur", function (e) { + if (blurable) { + if (multiselect) { + chooseItems(); + } else { + cancelItem(); + } + } + }); + + input.addEventListener("focus", function (e) { + showList(); + }); + + //style list element + listEl = document.createElement("div"); + listEl.classList.add("tabulator-edit-select-list"); + + onRendered(function () { + input.style.height = "100%"; + input.focus({ preventScroll: true }); + }); + + return input; + }, + + //autocomplete + autocomplete: function autocomplete(cell, onRendered, success, cancel, editorParams) { + var self = this, + cellEl = cell.getElement(), + initialValue = cell.getValue(), + vertNav = editorParams.verticalNavigation || "editor", + initialDisplayValue = typeof initialValue !== "undefined" || initialValue === null ? initialValue : typeof editorParams.defaultValue !== "undefined" ? editorParams.defaultValue : "", + input = document.createElement("input"), + listEl = document.createElement("div"), + allItems = [], + displayItems = [], + values = [], + currentItem = false, + blurable = true, + uniqueColumnValues = false; + + this.table.rowManager.element.addEventListener("scroll", cancelItem); + + //style input + input.setAttribute("type", "search"); + + input.style.padding = "4px"; + input.style.width = "100%"; + input.style.boxSizing = "border-box"; + + if (editorParams.elementAttributes && _typeof(editorParams.elementAttributes) == "object") { + for (var key in editorParams.elementAttributes) { + if (key.charAt(0) == "+") { + key = key.slice(1); + input.setAttribute(key, input.getAttribute(key) + editorParams.elementAttributes["+" + key]); + } else { + input.setAttribute(key, editorParams.elementAttributes[key]); + } + } + } + + //style list element + listEl.classList.add("tabulator-edit-select-list"); + + listEl.addEventListener("mousedown", function (e) { + blurable = false; + + setTimeout(function () { + blurable = true; + }, 10); + }); + + function genUniqueColumnValues() { + if (editorParams.values === true) { + uniqueColumnValues = getUniqueColumnValues(); + } else if (typeof editorParams.values === "string") { + uniqueColumnValues = getUniqueColumnValues(editorParams.values); + } + } + + function getUniqueColumnValues(field) { + var output = {}, + data = self.table.getData(), + column; + + if (field) { + column = self.table.columnManager.getColumnByField(field); + } else { + column = cell.getColumn()._getSelf(); + } + + if (column) { + data.forEach(function (row) { + var val = column.getFieldValue(row); + + if (val !== null && typeof val !== "undefined" && val !== "") { + output[val] = true; + } + }); + + if (editorParams.sortValuesList) { + if (editorParams.sortValuesList == "asc") { + output = Object.keys(output).sort(); + } else { + output = Object.keys(output).sort().reverse(); + } + } else { + output = Object.keys(output); + } + } else { + console.warn("unable to find matching column to create autocomplete lookup list:", field); + } + + return output; + } + + function filterList(term, intialLoad) { + var matches = [], + values, + items, + searchEl; + + //lookup base values list + if (uniqueColumnValues) { + values = uniqueColumnValues; + } else { + values = editorParams.values || []; + } + + if (editorParams.searchFunc) { + matches = editorParams.searchFunc(term, values); + + if (matches instanceof Promise) { + + addNotice(typeof editorParams.searchingPlaceholder !== "undefined" ? editorParams.searchingPlaceholder : "Searching..."); + + matches.then(function (result) { + fillListIfNotEmpty(parseItems(result), intialLoad); + }).catch(function (err) { + console.err("error in autocomplete search promise:", err); + }); + } else { + fillListIfNotEmpty(parseItems(matches), intialLoad); + } + } else { + items = parseItems(values); + + if (term === "") { + if (editorParams.showListOnEmpty) { + matches = items; + } + } else { + items.forEach(function (item) { + if (item.value !== null || typeof item.value !== "undefined") { + if (String(item.value).toLowerCase().indexOf(String(term).toLowerCase()) > -1 || String(item.title).toLowerCase().indexOf(String(term).toLowerCase()) > -1) { + matches.push(item); + } + } + }); + } + + fillListIfNotEmpty(matches, intialLoad); + } + } + + function addNotice(notice) { + var searchEl = document.createElement("div"); + + clearList(); + + if (notice !== false) { + searchEl.classList.add("tabulator-edit-select-list-notice"); + searchEl.tabIndex = 0; + + if (notice instanceof Node) { + searchEl.appendChild(notice); + } else { + searchEl.innerHTML = notice; + } + + listEl.appendChild(searchEl); + } + } + + function parseItems(inputValues) { + var itemList = []; + + if (Array.isArray(inputValues)) { + inputValues.forEach(function (value) { + + var item = {}; + + if ((typeof value === "undefined" ? "undefined" : _typeof(value)) === "object") { + item.title = editorParams.listItemFormatter ? editorParams.listItemFormatter(value.value, value.label) : value.label; + item.value = value.value; + } else { + item.title = editorParams.listItemFormatter ? editorParams.listItemFormatter(value, value) : value; + item.value = value; + } + + itemList.push(item); + }); + } else { + for (var key in inputValues) { + var item = { + title: editorParams.listItemFormatter ? editorParams.listItemFormatter(key, inputValues[key]) : inputValues[key], + value: key + }; + + itemList.push(item); + } + } + + return itemList; + } + + function clearList() { + while (listEl.firstChild) { + listEl.removeChild(listEl.firstChild); + } + } + + function fillListIfNotEmpty(items, intialLoad) { + if (items.length) { + fillList(items, intialLoad); + } else { + if (editorParams.emptyPlaceholder) { + addNotice(editorParams.emptyPlaceholder); + } + } + } + + function fillList(items, intialLoad) { + var current = false; + + clearList(); + + displayItems = items; + + displayItems.forEach(function (item) { + var el = item.element; + + if (!el) { + el = document.createElement("div"); + el.classList.add("tabulator-edit-select-list-item"); + el.tabIndex = 0; + el.innerHTML = item.title; + + el.addEventListener("click", function (e) { + setCurrentItem(item); + chooseItem(); + }); + + el.addEventListener("mousedown", function (e) { + blurable = false; + + setTimeout(function () { + blurable = true; + }, 10); + }); + + item.element = el; + + if (intialLoad && item.value == initialValue) { + input.value = item.title; + item.element.classList.add("active"); + current = true; + } + + if (item === currentItem) { + item.element.classList.add("active"); + current = true; + } + } + + listEl.appendChild(el); + }); + + if (!current) { + setCurrentItem(false); + } + } + + function chooseItem() { + hideList(); + + if (currentItem) { + if (initialValue !== currentItem.value) { + initialValue = currentItem.value; + input.value = currentItem.title; + success(currentItem.value); + } else { + cancel(); + } + } else { + if (editorParams.freetext) { + initialValue = input.value; + success(input.value); + } else { + if (editorParams.allowEmpty && input.value === "") { + initialValue = input.value; + success(input.value); + } else { + cancel(); + } + } + } + } + + function showList() { + if (!listEl.parentNode) { + while (listEl.firstChild) { + listEl.removeChild(listEl.firstChild); + }var offset = Tabulator.prototype.helpers.elOffset(cellEl); + + listEl.style.minWidth = cellEl.offsetWidth + "px"; + + listEl.style.top = offset.top + cellEl.offsetHeight + "px"; + listEl.style.left = offset.left + "px"; + document.body.appendChild(listEl); + } + } + + function setCurrentItem(item, showInputValue) { + if (currentItem && currentItem.element) { + currentItem.element.classList.remove("active"); + } + + currentItem = item; + + if (item && item.element) { + item.element.classList.add("active"); + } + } + + function hideList() { + if (listEl.parentNode) { + listEl.parentNode.removeChild(listEl); + } + + removeScrollListener(); + } + + function cancelItem() { + hideList(); + cancel(); + } + + function removeScrollListener() { + self.table.rowManager.element.removeEventListener("scroll", cancelItem); + } + + //allow key based navigation + input.addEventListener("keydown", function (e) { + var index; + + switch (e.keyCode) { + case 38: + //up arrow + index = displayItems.indexOf(currentItem); + + if (vertNav == "editor" || vertNav == "hybrid" && index) { + e.stopImmediatePropagation(); + e.stopPropagation(); + e.preventDefault(); + + if (index > 0) { + setCurrentItem(displayItems[index - 1]); + } else { + setCurrentItem(false); + } + } + break; + + case 40: + //down arrow + + index = displayItems.indexOf(currentItem); + + if (vertNav == "editor" || vertNav == "hybrid" && index < displayItems.length - 1) { + + e.stopImmediatePropagation(); + e.stopPropagation(); + e.preventDefault(); + + if (index < displayItems.length - 1) { + if (index == -1) { + setCurrentItem(displayItems[0]); + } else { + setCurrentItem(displayItems[index + 1]); + } + } + } + break; + + case 37: //left arrow + case 39: + //right arrow + e.stopImmediatePropagation(); + e.stopPropagation(); + // e.preventDefault(); + break; + + case 13: + //enter + chooseItem(); + break; + + case 27: + //escape + cancelItem(); + break; + + case 36: //home + case 35: + //end + //prevent table navigation while using input element + e.stopImmediatePropagation(); + break; + } + }); + + input.addEventListener("keyup", function (e) { + + switch (e.keyCode) { + case 38: //up arrow + case 37: //left arrow + case 39: //up arrow + case 40: //right arrow + case 13: //enter + case 27: + //escape + break; + + default: + filterList(input.value); + } + }); + + input.addEventListener("search", function (e) { + filterList(input.value); + }); + + input.addEventListener("blur", function (e) { + if (blurable) { + chooseItem(); + } + }); + + input.addEventListener("focus", function (e) { + var value = initialDisplayValue; + genUniqueColumnValues(); + showList(); + input.value = value; + filterList(value, true); + }); + + onRendered(function () { + input.style.height = "100%"; + input.focus({ preventScroll: true }); + }); + + if (editorParams.mask) { + this.table.modules.edit.maskInput(input, editorParams); + } + + return input; + }, + + //star rating + star: function star(cell, onRendered, success, cancel, editorParams) { + var self = this, + element = cell.getElement(), + value = cell.getValue(), + maxStars = element.getElementsByTagName("svg").length || 5, + size = element.getElementsByTagName("svg")[0] ? element.getElementsByTagName("svg")[0].getAttribute("width") : 14, + stars = [], + starsHolder = document.createElement("div"), + star = document.createElementNS('http://www.w3.org/2000/svg', "svg"); + + //change star type + function starChange(val) { + stars.forEach(function (star, i) { + if (i < val) { + if (self.table.browser == "ie") { + star.setAttribute("class", "tabulator-star-active"); + } else { + star.classList.replace("tabulator-star-inactive", "tabulator-star-active"); + } + + star.innerHTML = ''; + } else { + if (self.table.browser == "ie") { + star.setAttribute("class", "tabulator-star-inactive"); + } else { + star.classList.replace("tabulator-star-active", "tabulator-star-inactive"); + } + + star.innerHTML = ''; + } + }); + } + + //build stars + function buildStar(i) { + + var starHolder = document.createElement("span"); + var nextStar = star.cloneNode(true); + + stars.push(nextStar); + + starHolder.addEventListener("mouseenter", function (e) { + e.stopPropagation(); + e.stopImmediatePropagation(); + starChange(i); + }); + + starHolder.addEventListener("mousemove", function (e) { + e.stopPropagation(); + e.stopImmediatePropagation(); + }); + + starHolder.addEventListener("click", function (e) { + e.stopPropagation(); + e.stopImmediatePropagation(); + success(i); + element.blur(); + }); + + starHolder.appendChild(nextStar); + starsHolder.appendChild(starHolder); + } + + //handle keyboard navigation value change + function changeValue(val) { + value = val; + starChange(val); + } + + //style cell + element.style.whiteSpace = "nowrap"; + element.style.overflow = "hidden"; + element.style.textOverflow = "ellipsis"; + + //style holding element + starsHolder.style.verticalAlign = "middle"; + starsHolder.style.display = "inline-block"; + starsHolder.style.padding = "4px"; + + //style star + star.setAttribute("width", size); + star.setAttribute("height", size); + star.setAttribute("viewBox", "0 0 512 512"); + star.setAttribute("xml:space", "preserve"); + star.style.padding = "0 1px"; + + if (editorParams.elementAttributes && _typeof(editorParams.elementAttributes) == "object") { + for (var key in editorParams.elementAttributes) { + if (key.charAt(0) == "+") { + key = key.slice(1); + starsHolder.setAttribute(key, starsHolder.getAttribute(key) + editorParams.elementAttributes["+" + key]); + } else { + starsHolder.setAttribute(key, editorParams.elementAttributes[key]); + } + } + } + + //create correct number of stars + for (var i = 1; i <= maxStars; i++) { + buildStar(i); + } + + //ensure value does not exceed number of stars + value = Math.min(parseInt(value), maxStars); + + // set initial styling of stars + starChange(value); + + starsHolder.addEventListener("mousemove", function (e) { + starChange(0); + }); + + starsHolder.addEventListener("click", function (e) { + success(0); + }); + + element.addEventListener("blur", function (e) { + cancel(); + }); + + //allow key based navigation + element.addEventListener("keydown", function (e) { + switch (e.keyCode) { + case 39: + //right arrow + changeValue(value + 1); + break; + + case 37: + //left arrow + changeValue(value - 1); + break; + + case 13: + //enter + success(value); + break; + + case 27: + //escape + cancel(); + break; + } + }); + + return starsHolder; + }, + + //draggable progress bar + progress: function progress(cell, onRendered, success, cancel, editorParams) { + var element = cell.getElement(), + max = typeof editorParams.max === "undefined" ? element.getElementsByTagName("div")[0].getAttribute("max") || 100 : editorParams.max, + min = typeof editorParams.min === "undefined" ? element.getElementsByTagName("div")[0].getAttribute("min") || 0 : editorParams.min, + percent = (max - min) / 100, + value = cell.getValue() || 0, + handle = document.createElement("div"), + bar = document.createElement("div"), + mouseDrag, + mouseDragWidth; + + //set new value + function updateValue() { + var calcVal = percent * Math.round(bar.offsetWidth / (element.clientWidth / 100)) + min; + success(calcVal); + element.setAttribute("aria-valuenow", calcVal); + element.setAttribute("aria-label", value); + } + + //style handle + handle.style.position = "absolute"; + handle.style.right = "0"; + handle.style.top = "0"; + handle.style.bottom = "0"; + handle.style.width = "5px"; + handle.classList.add("tabulator-progress-handle"); + + //style bar + bar.style.display = "inline-block"; + bar.style.position = "relative"; + // bar.style.top = "8px"; + // bar.style.bottom = "8px"; + // bar.style.left = "4px"; + // bar.style.marginRight = "4px"; + bar.style.height = "100%"; + bar.style.backgroundColor = "#488CE9"; + bar.style.maxWidth = "100%"; + bar.style.minWidth = "0%"; + + if (editorParams.elementAttributes && _typeof(editorParams.elementAttributes) == "object") { + for (var key in editorParams.elementAttributes) { + if (key.charAt(0) == "+") { + key = key.slice(1); + bar.setAttribute(key, bar.getAttribute(key) + editorParams.elementAttributes["+" + key]); + } else { + bar.setAttribute(key, editorParams.elementAttributes[key]); + } + } + } + + //style cell + element.style.padding = "4px 4px"; + + //make sure value is in range + value = Math.min(parseFloat(value), max); + value = Math.max(parseFloat(value), min); + + //workout percentage + value = Math.round((value - min) / percent); + // bar.style.right = value + "%"; + bar.style.width = value + "%"; + + element.setAttribute("aria-valuemin", min); + element.setAttribute("aria-valuemax", max); + + bar.appendChild(handle); + + handle.addEventListener("mousedown", function (e) { + mouseDrag = e.screenX; + mouseDragWidth = bar.offsetWidth; + }); + + handle.addEventListener("mouseover", function () { + handle.style.cursor = "ew-resize"; + }); + + element.addEventListener("mousemove", function (e) { + if (mouseDrag) { + bar.style.width = mouseDragWidth + e.screenX - mouseDrag + "px"; + } + }); + + element.addEventListener("mouseup", function (e) { + if (mouseDrag) { + e.stopPropagation(); + e.stopImmediatePropagation(); + + mouseDrag = false; + mouseDragWidth = false; + + updateValue(); + } + }); + + //allow key based navigation + element.addEventListener("keydown", function (e) { + switch (e.keyCode) { + case 39: + //right arrow + e.preventDefault(); + bar.style.width = bar.clientWidth + element.clientWidth / 100 + "px"; + break; + + case 37: + //left arrow + e.preventDefault(); + bar.style.width = bar.clientWidth - element.clientWidth / 100 + "px"; + break; + + case 9: //tab + case 13: + //enter + updateValue(); + break; + + case 27: + //escape + cancel(); + break; + + } + }); + + element.addEventListener("blur", function () { + cancel(); + }); + + return bar; + }, + + //checkbox + tickCross: function tickCross(cell, onRendered, success, cancel, editorParams) { + var value = cell.getValue(), + input = document.createElement("input"), + tristate = editorParams.tristate, + indetermValue = typeof editorParams.indeterminateValue === "undefined" ? null : editorParams.indeterminateValue, + indetermState = false; + + input.setAttribute("type", "checkbox"); + input.style.marginTop = "5px"; + input.style.boxSizing = "border-box"; + + if (editorParams.elementAttributes && _typeof(editorParams.elementAttributes) == "object") { + for (var key in editorParams.elementAttributes) { + if (key.charAt(0) == "+") { + key = key.slice(1); + input.setAttribute(key, input.getAttribute(key) + editorParams.elementAttributes["+" + key]); + } else { + input.setAttribute(key, editorParams.elementAttributes[key]); + } + } + } + + input.value = value; + + if (tristate && (typeof value === "undefined" || value === indetermValue || value === "")) { + indetermState = true; + input.indeterminate = true; + } + + if (this.table.browser != "firefox") { + //prevent blur issue on mac firefox + onRendered(function () { + input.focus({ preventScroll: true }); + }); + } + + input.checked = value === true || value === "true" || value === "True" || value === 1; + + function setValue(blur) { + if (tristate) { + if (!blur) { + if (input.checked && !indetermState) { + input.checked = false; + input.indeterminate = true; + indetermState = true; + return indetermValue; + } else { + indetermState = false; + return input.checked; + } + } else { + if (indetermState) { + return indetermValue; + } else { + return input.checked; + } + } + } else { + return input.checked; + } + } + + //submit new value on blur + input.addEventListener("change", function (e) { + success(setValue()); + }); + + input.addEventListener("blur", function (e) { + success(setValue(true)); + }); + + //submit new value on enter + input.addEventListener("keydown", function (e) { + if (e.keyCode == 13) { + success(setValue()); + } + if (e.keyCode == 27) { + cancel(); + } + }); + + return input; + } +}; + +Tabulator.prototype.registerModule("edit", Edit); \ No newline at end of file diff --git a/admin/js/vendors/tabulator/js/modules/edit.min.js b/admin/js/vendors/tabulator/js/modules/edit.min.js new file mode 100644 index 0000000..8e256be --- /dev/null +++ b/admin/js/vendors/tabulator/js/modules/edit.min.js @@ -0,0 +1,2 @@ +/* Tabulator v4.7.0 (c) Oliver Folkerd */ +var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Edit=function(e){this.table=e,this.currentCell=!1,this.mouseClick=!1,this.recursionBlock=!1,this.invalidEdit=!1,this.editedCells=[]};Edit.prototype.initializeColumn=function(e){var t=this,i={editor:!1,blocked:!1,check:e.definition.editable,params:e.definition.editorParams||{}};switch(_typeof(e.definition.editor)){case"string":"tick"===e.definition.editor&&(e.definition.editor="tickCross",console.warn("DEPRECATION WARNING - the tick editor has been deprecated, please use the tickCross editor")),t.editors[e.definition.editor]?i.editor=t.editors[e.definition.editor]:console.warn("Editor Error - No such editor found: ",e.definition.editor);break;case"function":i.editor=e.definition.editor;break;case"boolean":!0===e.definition.editor&&("function"!=typeof e.definition.formatter?("tick"===e.definition.formatter&&(e.definition.formatter="tickCross",console.warn("DEPRECATION WARNING - the tick editor has been deprecated, please use the tickCross editor")),t.editors[e.definition.formatter]?i.editor=t.editors[e.definition.formatter]:i.editor=t.editors.input):console.warn("Editor Error - Cannot auto lookup editor for a custom formatter: ",e.definition.formatter))}i.editor&&(e.modules.edit=i)},Edit.prototype.getCurrentCell=function(){return!!this.currentCell&&this.currentCell.getComponent()},Edit.prototype.clearEditor=function(e){var t,i=this.currentCell;if(this.invalidEdit=!1,i){for(this.currentCell=!1,t=i.getElement(),e?i.validate():t.classList.remove("tabulator-validation-fail"),t.classList.remove("tabulator-editing");t.firstChild;)t.removeChild(t.firstChild);i.row.getElement().classList.remove("tabulator-row-editing")}},Edit.prototype.cancelEdit=function(){if(this.currentCell){var e=this.currentCell,t=this.currentCell.getComponent();this.clearEditor(!0),e.setValueActual(e.getValue()),e.cellRendered(),e.column.cellEvents.cellEditCancelled&&e.column.cellEvents.cellEditCancelled.call(this.table,t),this.table.options.cellEditCancelled.call(this.table,t)}},Edit.prototype.bindEditor=function(e){var t=this,i=e.getElement();i.setAttribute("tabindex",0),i.addEventListener("click",function(e){i.classList.contains("tabulator-editing")||i.focus({preventScroll:!0})}),i.addEventListener("mousedown",function(e){t.mouseClick=!0}),i.addEventListener("focus",function(i){t.recursionBlock||t.edit(e,i,!1)})},Edit.prototype.focusCellNoEvent=function(e,t){this.recursionBlock=!0,t&&"ie"===this.table.browser||e.getElement().focus({preventScroll:!0}),this.recursionBlock=!1},Edit.prototype.editCell=function(e,t){this.focusCellNoEvent(e),this.edit(e,!1,t)},Edit.prototype.focusScrollAdjust=function(e){if("virtual"==this.table.rowManager.getRenderMode()){var t=this.table.rowManager.element.scrollTop,i=this.table.rowManager.element.clientHeight+this.table.rowManager.element.scrollTop,n=e.row.getElement();n.offsetTop;n.offsetTopi&&(this.table.rowManager.element.scrollTop+=n.offsetTop+n.offsetHeight-i)}},Edit.prototype.edit=function(e,t,i){function n(t){if(u.currentCell===e){var i=!0;return e.column.modules.validate&&u.table.modExists("validate")&&"manual"!=u.table.options.validationMode&&(i=u.table.modules.validate.validate(e.column.modules.validate,e,t)),!0===i||"highlight"===u.table.options.validationMode?(u.clearEditor(),e.setValue(t,!0),e.modules.edit||(e.modules.edit={}),e.modules.edit.edited=!0,-1==u.editedCells.indexOf(e)&&u.editedCells.push(e),u.table.options.dataTree&&u.table.modExists("dataTree")&&u.table.modules.dataTree.checkForRestyle(e),!0===i||(m.classList.add("tabulator-validation-fail"),!1)):(u.invalidEdit=!0,m.classList.add("tabulator-validation-fail"),u.focusCellNoEvent(e,!0),c(),u.table.options.validationFailed.call(u.table,e.getComponent(),t,i),!1)}}function o(){u.currentCell===e&&(u.cancelEdit(),u.table.options.dataTree&&u.table.modExists("dataTree")&&u.table.modules.dataTree.checkForRestyle(e))}function a(e){c=e}var r,l,s,u=this,d=!0,c=function(){},m=e.getElement();if(this.currentCell)return void(this.invalidEdit||this.cancelEdit());if(e.column.modules.edit.blocked)return this.mouseClick=!1,m.blur(),!1;switch(t&&t.stopPropagation(),_typeof(e.column.modules.edit.check)){case"function":d=e.column.modules.edit.check(e.getComponent());break;case"boolean":d=e.column.modules.edit.check}if(d||i){if(u.cancelEdit(),u.currentCell=e,this.focusScrollAdjust(e),l=e.getComponent(),this.mouseClick&&(this.mouseClick=!1,e.column.cellEvents.cellClick&&e.column.cellEvents.cellClick.call(this.table,t,l)),e.column.cellEvents.cellEditing&&e.column.cellEvents.cellEditing.call(this.table,l),u.table.options.cellEditing.call(this.table,l),s="function"==typeof e.column.modules.edit.params?e.column.modules.edit.params(l):e.column.modules.edit.params,!1===(r=e.column.modules.edit.editor.call(u,l,a,n,o,s)))return m.blur(),!1;if(!(r instanceof Node))return console.warn("Edit Error - Editor should return an instance of Node, the editor returned:",r),m.blur(),!1;for(m.classList.add("tabulator-editing"),e.row.getElement().classList.add("tabulator-row-editing");m.firstChild;)m.removeChild(m.firstChild);m.appendChild(r),c();for(var f=m.children,p=0;p46){if(i>=n.length)return t.preventDefault(),t.stopPropagation(),l=!1,!1;switch(n[i]){case o:if(s.toUpperCase()==s.toLowerCase())return t.preventDefault(),t.stopPropagation(),l=!1,!1;break;case a:if(isNaN(s))return t.preventDefault(),t.stopPropagation(),l=!1,!1;break;case r:break;default:if(s!==n[i])return t.preventDefault(),t.stopPropagation(),l=!1,!1}l=!0}}),e.addEventListener("keyup",function(n){n.keyCode>46&&t.maskAutoFill&&i(e.value.length)}),e.placeholder||(e.placeholder=n),t.maskAutoFill&&i(e.value.length)},Edit.prototype.getEditedCells=function(){var e=[];return this.editedCells.forEach(function(t){e.push(t.getComponent())}),e},Edit.prototype.clearEdited=function(e){var t;e.modules.edit&&e.modules.edit.edited&&(e.modules.validate.invalid=!1,(t=this.editedCells.indexOf(e))>-1&&this.editedCells.splice(t,1))},Edit.prototype.editors={input:function(e,t,i,n,o){function a(e){(null===r||void 0===r)&&""!==l.value||l.value!==r?i(l.value)&&(r=l.value):n()}var r=e.getValue(),l=document.createElement("input");if(l.setAttribute("type",o.search?"search":"text"),l.style.padding="4px",l.style.width="100%",l.style.boxSizing="border-box",o.elementAttributes&&"object"==_typeof(o.elementAttributes))for(var s in o.elementAttributes)"+"==s.charAt(0)?(s=s.slice(1),l.setAttribute(s,l.getAttribute(s)+o.elementAttributes["+"+s])):l.setAttribute(s,o.elementAttributes[s]);return l.value=void 0!==r?r:"",t(function(){l.focus({preventScroll:!0}),l.style.height="100%"}),l.addEventListener("change",a),l.addEventListener("blur",a),l.addEventListener("keydown",function(e){switch(e.keyCode){case 13:a(e);break;case 27:n()}}),o.mask&&this.table.modules.edit.maskInput(l,o),l},textarea:function(e,t,i,n,o){function a(t){(null===r||void 0===r)&&""!==u.value||u.value!==r?(i(u.value)&&(r=u.value),setTimeout(function(){e.getRow().normalizeHeight()},300)):n()}var r=e.getValue(),l=o.verticalNavigation||"hybrid",s=String(null!==r&&void 0!==r?r:""),u=(s.match(/(?:\r\n|\r|\n)/g),document.createElement("textarea")),d=0;if(u.style.display="block",u.style.padding="2px",u.style.height="100%",u.style.width="100%",u.style.boxSizing="border-box",u.style.whiteSpace="pre-wrap",u.style.resize="none",o.elementAttributes&&"object"==_typeof(o.elementAttributes))for(var c in o.elementAttributes)"+"==c.charAt(0)?(c=c.slice(1),u.setAttribute(c,u.getAttribute(c)+o.elementAttributes["+"+c])):u.setAttribute(c,o.elementAttributes[c]);return u.value=s,t(function(){u.focus({preventScroll:!0}),u.style.height="100%"}),u.addEventListener("change",a),u.addEventListener("blur",a),u.addEventListener("keyup",function(){u.style.height="";var t=u.scrollHeight;u.style.height=t+"px",t!=d&&(d=t,e.getRow().normalizeHeight())}),u.addEventListener("keydown",function(e){switch(e.keyCode){case 27:n();break;case 38:("editor"==l||"hybrid"==l&&u.selectionStart)&&(e.stopImmediatePropagation(),e.stopPropagation());break;case 40:("editor"==l||"hybrid"==l&&u.selectionStart!==u.value.length)&&(e.stopImmediatePropagation(),e.stopPropagation())}}),o.mask&&this.table.modules.edit.maskInput(u,o),u},number:function(e,t,i,n,o){function a(){var e=s.value;isNaN(e)||""===e||(e=Number(e)),e!==r?i(e)&&(r=e):n()}var r=e.getValue(),l=o.verticalNavigation||"editor",s=document.createElement("input");if(s.setAttribute("type","number"),void 0!==o.max&&s.setAttribute("max",o.max),void 0!==o.min&&s.setAttribute("min",o.min),void 0!==o.step&&s.setAttribute("step",o.step),s.style.padding="4px",s.style.width="100%",s.style.boxSizing="border-box",o.elementAttributes&&"object"==_typeof(o.elementAttributes))for(var u in o.elementAttributes)"+"==u.charAt(0)?(u=u.slice(1),s.setAttribute(u,s.getAttribute(u)+o.elementAttributes["+"+u])):s.setAttribute(u,o.elementAttributes[u]);s.value=r;var d=function(e){a()};return t(function(){s.removeEventListener("blur",d),s.focus({preventScroll:!0}),s.style.height="100%",s.addEventListener("blur",d)}),s.addEventListener("keydown",function(e){switch(e.keyCode){case 13:a();break;case 27:n();break;case 38:case 40:"editor"==l&&(e.stopImmediatePropagation(),e.stopPropagation())}}),o.mask&&this.table.modules.edit.maskInput(s,o),s},range:function(e,t,i,n,o){function a(){var e=l.value;isNaN(e)||""===e||(e=Number(e)),e!=r?i(e)&&(r=e):n()}var r=e.getValue(),l=document.createElement("input");if(l.setAttribute("type","range"),void 0!==o.max&&l.setAttribute("max",o.max),void 0!==o.min&&l.setAttribute("min",o.min),void 0!==o.step&&l.setAttribute("step",o.step),l.style.padding="4px",l.style.width="100%",l.style.boxSizing="border-box",o.elementAttributes&&"object"==_typeof(o.elementAttributes))for(var s in o.elementAttributes)"+"==s.charAt(0)?(s=s.slice(1),l.setAttribute(s,l.getAttribute(s)+o.elementAttributes["+"+s])):l.setAttribute(s,o.elementAttributes[s]);return l.value=r,t(function(){l.focus({preventScroll:!0}),l.style.height="100%"}),l.addEventListener("blur",function(e){a()}),l.addEventListener("keydown",function(e){switch(e.keyCode){case 13:a();break;case 27:n()}}),l},select:function(e,t,i,n,o){function a(t){var i,n={},a=y.table.getData();return i=t?y.table.columnManager.getColumnByField(t):e.getColumn()._getSelf(),i?(a.forEach(function(e){var t=i.getFieldValue(e);null!==t&&void 0!==t&&""!==t&&(n[t]=!0)}),n=o.sortValuesList?"asc"==o.sortValuesList?Object.keys(n).sort():Object.keys(n).sort().reverse():Object.keys(n)):console.warn("unable to find matching column to create select lookup list:",t),n}function r(t,i){function n(e){var e={label:e.label,value:e.value,itemParams:e.itemParams,elementAttributes:e.elementAttributes,element:!1};return i.indexOf(e.value)>-1&&u(e),o.push(e),a.push(e),e}var o=[],a=[];if("function"==typeof t&&(t=t(e)),Array.isArray(t))t.forEach(function(e){var t;"object"===(void 0===e?"undefined":_typeof(e))?e.options?(t={label:e.label,group:!0,itemParams:e.itemParams,elementAttributes:e.elementAttributes,element:!1},a.push(t),e.options.forEach(function(e){n(e)})):n(e):(t={label:e,value:e,element:!1},i.indexOf(t.value)>-1&&u(t),o.push(t),a.push(t))});else for(var r in t){var s={label:t[r],value:r,element:!1};i.indexOf(s.value)>-1&&u(s),o.push(s),a.push(s)}P=o,T=a,l()}function l(){for(;w.firstChild;)w.removeChild(w.firstChild);T.forEach(function(t){var i=t.element;if(!i){if(i=document.createElement("div"),t.label=o.listItemFormatter?o.listItemFormatter(t.value,t.label,e,i,t.itemParams):t.label,t.group?(i.classList.add("tabulator-edit-select-list-group"),i.tabIndex=0,i.innerHTML=""===t.label?" ":t.label):(i.classList.add("tabulator-edit-select-list-item"),i.tabIndex=0,i.innerHTML=""===t.label?" ":t.label,i.addEventListener("click",function(){x?(c(t),L.focus()):m(t)}),I.indexOf(t)>-1&&i.classList.add("active")),t.elementAttributes&&"object"==_typeof(t.elementAttributes))for(var n in t.elementAttributes)"+"==n.charAt(0)?(n=n.slice(1),i.setAttribute(n,L.getAttribute(n)+t.elementAttributes["+"+n])):i.setAttribute(n,t.elementAttributes[n]);i.addEventListener("mousedown",function(){S=!1,setTimeout(function(){S=!0},10)}),t.element=i}w.appendChild(i)})}function s(e,t){!x&&N&&N.element&&N.element.classList.remove("active"),N&&N.element&&N.element.classList.remove("focused"),N=e,e.element&&(e.element.classList.add("focused"),t&&e.element.classList.add("active"))}function u(e){-1==I.indexOf(e)&&(I.push(e),s(e,!0)),p()}function d(e){var t=I[e];e>-1&&(I.splice(e,1),t.element&&t.element.classList.remove("active"))}function c(e){e||(e=N);var t=I.indexOf(e);t>-1?d(t):(!0!==x&&I.length>=x&&d(0),u(e)),p()}function m(e){h(),e||(e=N),e&&i(e.value)}function f(){h();var e=[];I.forEach(function(t){e.push(t.value)}),i(e)}function p(){var e=[];I.forEach(function(t){e.push(t.label)}),L.value=e.join(", ")}function v(){h(),n()}function b(){if(!w.parentNode){!0===o.values?r(a(),C):"string"==typeof o.values?r(a(o.values),C):r(o.values||[],C);var e=Tabulator.prototype.helpers.elOffset(E);w.style.minWidth=E.offsetWidth+"px",w.style.top=e.top+E.offsetHeight+"px",w.style.left=e.left+"px",w.addEventListener("mousedown",function(e){S=!1,setTimeout(function(){S=!0},10)}),document.body.appendChild(w)}}function h(){w.parentNode&&w.parentNode.removeChild(w),g()}function g(){y.table.rowManager.element.removeEventListener("scroll",v)}var y=this,E=e.getElement(),A=e.getValue(),k=o.verticalNavigation||"editor",C=void 0!==A||null===A?A:void 0!==o.defaultValue?o.defaultValue:[],L=document.createElement("input"),w=document.createElement("div"),x=o.multiselect,P=[],N={},T=[],I=[],S=!0;if(this.table.rowManager.element.addEventListener("scroll",v),(Array.isArray(o)||!Array.isArray(o)&&"object"===(void 0===o?"undefined":_typeof(o))&&!o.values)&&(console.warn("DEPRECATION WARNING - values for the select editor must now be passed into the values property of the editorParams object, not as the editorParams object"),o={values:o}),L.setAttribute("type","text"),L.style.padding="4px",L.style.width="100%",L.style.boxSizing="border-box",L.style.cursor="default",L.readOnly=0!=this.currentCell,o.elementAttributes&&"object"==_typeof(o.elementAttributes))for(var O in o.elementAttributes)"+"==O.charAt(0)?(O=O.slice(1),L.setAttribute(O,L.getAttribute(O)+o.elementAttributes["+"+O])):L.setAttribute(O,o.elementAttributes[O]);return L.value=void 0!==A||null===A?A:"",L.addEventListener("keydown",function(e){var t;switch(e.keyCode){case 38:t=P.indexOf(N),("editor"==k||"hybrid"==k&&t)&&(e.stopImmediatePropagation(),e.stopPropagation(),e.preventDefault(),t>0&&s(P[t-1],!x));break;case 40:t=P.indexOf(N),("editor"==k||"hybrid"==k&&t-1||String(t.title).toLowerCase().indexOf(String(e).toLowerCase())>-1)&&a.push(t)}),c(a,t))}function s(e){var t=document.createElement("div");d(),!1!==e&&(t.classList.add("tabulator-edit-select-list-notice"),t.tabIndex=0,e instanceof Node?t.appendChild(e):t.innerHTML=e,w.appendChild(t))}function u(e){var t=[];if(Array.isArray(e))e.forEach(function(e){var i={};"object"===(void 0===e?"undefined":_typeof(e))?(i.title=o.listItemFormatter?o.listItemFormatter(e.value,e.label):e.label,i.value=e.value):(i.title=o.listItemFormatter?o.listItemFormatter(e,e):e,i.value=e),t.push(i)});else for(var i in e){var n={title:o.listItemFormatter?o.listItemFormatter(i,e[i]):e[i],value:i};t.push(n)}return t}function d(){for(;w.firstChild;)w.removeChild(w.firstChild)}function c(e,t){e.length?m(e,t):o.emptyPlaceholder&&s(o.emptyPlaceholder)}function m(e,t){var i=!1;d(),x=e,x.forEach(function(e){var n=e.element;n||(n=document.createElement("div"),n.classList.add("tabulator-edit-select-list-item"),n.tabIndex=0,n.innerHTML=e.title,n.addEventListener("click",function(t){v(e),f()}),n.addEventListener("mousedown",function(e){N=!1,setTimeout(function(){N=!0},10)}),e.element=n,t&&e.value==A&&(L.value=e.title,e.element.classList.add("active"),i=!0),e===P&&(e.element.classList.add("active"),i=!0)),w.appendChild(n)}),i||v(!1)}function f(){b(),P?A!==P.value?(A=P.value,L.value=P.title,i(P.value)):n():o.freetext?(A=L.value,i(L.value)):o.allowEmpty&&""===L.value?(A=L.value,i(L.value)):n()}function p(){if(!w.parentNode){for(;w.firstChild;)w.removeChild(w.firstChild);var e=Tabulator.prototype.helpers.elOffset(E);w.style.minWidth=E.offsetWidth+"px",w.style.top=e.top+E.offsetHeight+"px",w.style.left=e.left+"px",document.body.appendChild(w)}}function v(e,t){P&&P.element&&P.element.classList.remove("active"),P=e,e&&e.element&&e.element.classList.add("active")}function b(){w.parentNode&&w.parentNode.removeChild(w),g()}function h(){b(),n()}function g(){y.table.rowManager.element.removeEventListener("scroll",h)}var y=this,E=e.getElement(),A=e.getValue(),k=o.verticalNavigation||"editor",C=void 0!==A||null===A?A:void 0!==o.defaultValue?o.defaultValue:"",L=document.createElement("input"),w=document.createElement("div"),x=[],P=!1,N=!0,T=!1;if(this.table.rowManager.element.addEventListener("scroll",h),L.setAttribute("type","search"),L.style.padding="4px",L.style.width="100%",L.style.boxSizing="border-box",o.elementAttributes&&"object"==_typeof(o.elementAttributes))for(var I in o.elementAttributes)"+"==I.charAt(0)?(I=I.slice(1),L.setAttribute(I,L.getAttribute(I)+o.elementAttributes["+"+I])):L.setAttribute(I,o.elementAttributes[I]);return w.classList.add("tabulator-edit-select-list"),w.addEventListener("mousedown",function(e){N=!1,setTimeout(function(){N=!0},10)}),L.addEventListener("keydown",function(e){var t;switch(e.keyCode){case 38:t=x.indexOf(P),("editor"==k||"hybrid"==k&&t)&&(e.stopImmediatePropagation(),e.stopPropagation(),e.preventDefault(),v(t>0?x[t-1]:!1));break;case 40:t=x.indexOf(P),("editor"==k||"hybrid"==k&&t'):("ie"==l.table.browser?t.setAttribute("class","tabulator-star-inactive"):t.classList.replace("tabulator-star-active","tabulator-star-inactive"),t.innerHTML='')})}function r(e){u=e,a(e)}var l=this,s=e.getElement(),u=e.getValue(),d=s.getElementsByTagName("svg").length||5,c=s.getElementsByTagName("svg")[0]?s.getElementsByTagName("svg")[0].getAttribute("width"):14,m=[],f=document.createElement("div"),p=document.createElementNS("http://www.w3.org/2000/svg","svg");if(s.style.whiteSpace="nowrap",s.style.overflow="hidden",s.style.textOverflow="ellipsis",f.style.verticalAlign="middle",f.style.display="inline-block",f.style.padding="4px",p.setAttribute("width",c),p.setAttribute("height",c),p.setAttribute("viewBox","0 0 512 512"),p.setAttribute("xml:space","preserve"),p.style.padding="0 1px",o.elementAttributes&&"object"==_typeof(o.elementAttributes))for(var v in o.elementAttributes)"+"==v.charAt(0)?(v=v.slice(1),f.setAttribute(v,f.getAttribute(v)+o.elementAttributes["+"+v])):f.setAttribute(v,o.elementAttributes[v]);for(var b=1;b<=d;b++)!function(e){var t=document.createElement("span"),n=p.cloneNode(!0);m.push(n),t.addEventListener("mouseenter",function(t){t.stopPropagation(),t.stopImmediatePropagation(),a(e)}),t.addEventListener("mousemove",function(e){e.stopPropagation(),e.stopImmediatePropagation()}),t.addEventListener("click",function(t){t.stopPropagation(),t.stopImmediatePropagation(),i(e),s.blur()}),t.appendChild(n),f.appendChild(t)}(b);return u=Math.min(parseInt(u),d),a(u),f.addEventListener("mousemove",function(e){a(0)}),f.addEventListener("click",function(e){i(0)}),s.addEventListener("blur",function(e){n()}),s.addEventListener("keydown",function(e){switch(e.keyCode){case 39:r(u+1);break;case 37:r(u-1);break;case 13:i(u);break;case 27:n()}}),f},progress:function(e,t,i,n,o){function a(){var e=c*Math.round(p.offsetWidth/(s.clientWidth/100))+d;i(e),s.setAttribute("aria-valuenow",e),s.setAttribute("aria-label",m)}var r,l,s=e.getElement(),u=void 0===o.max?s.getElementsByTagName("div")[0].getAttribute("max")||100:o.max,d=void 0===o.min?s.getElementsByTagName("div")[0].getAttribute("min")||0:o.min,c=(u-d)/100,m=e.getValue()||0,f=document.createElement("div"),p=document.createElement("div");if(f.style.position="absolute",f.style.right="0",f.style.top="0",f.style.bottom="0",f.style.width="5px",f.classList.add("tabulator-progress-handle"),p.style.display="inline-block",p.style.position="relative",p.style.height="100%",p.style.backgroundColor="#488CE9",p.style.maxWidth="100%",p.style.minWidth="0%",o.elementAttributes&&"object"==_typeof(o.elementAttributes))for(var v in o.elementAttributes)"+"==v.charAt(0)?(v=v.slice(1),p.setAttribute(v,p.getAttribute(v)+o.elementAttributes["+"+v])):p.setAttribute(v,o.elementAttributes[v]);return s.style.padding="4px 4px",m=Math.min(parseFloat(m),u),m=Math.max(parseFloat(m),d),m=Math.round((m-d)/c),p.style.width=m+"%",s.setAttribute("aria-valuemin",d),s.setAttribute("aria-valuemax",u),p.appendChild(f),f.addEventListener("mousedown",function(e){r=e.screenX,l=p.offsetWidth}),f.addEventListener("mouseover",function(){f.style.cursor="ew-resize"}),s.addEventListener("mousemove",function(e){r&&(p.style.width=l+e.screenX-r+"px")}),s.addEventListener("mouseup",function(e){r&&(e.stopPropagation(),e.stopImmediatePropagation(),r=!1,l=!1,a())}),s.addEventListener("keydown",function(e){switch(e.keyCode){case 39:e.preventDefault(),p.style.width=p.clientWidth+s.clientWidth/100+"px";break;case 37:e.preventDefault(),p.style.width=p.clientWidth-s.clientWidth/100+"px";break;case 9:case 13:a();break;case 27:n()}}),s.addEventListener("blur",function(){n()}),p},tickCross:function(e,t,i,n,o){function a(e){return s?e?d?u:l.checked:l.checked&&!d?(l.checked=!1,l.indeterminate=!0,d=!0,u):(d=!1,l.checked):l.checked}var r=e.getValue(),l=document.createElement("input"),s=o.tristate,u=void 0===o.indeterminateValue?null:o.indeterminateValue,d=!1;if(l.setAttribute("type","checkbox"),l.style.marginTop="5px",l.style.boxSizing="border-box",o.elementAttributes&&"object"==_typeof(o.elementAttributes))for(var c in o.elementAttributes)"+"==c.charAt(0)?(c=c.slice(1),l.setAttribute(c,l.getAttribute(c)+o.elementAttributes["+"+c])):l.setAttribute(c,o.elementAttributes[c]);return l.value=r,!s||void 0!==r&&r!==u&&""!==r||(d=!0,l.indeterminate=!0),"firefox"!=this.table.browser&&t(function(){l.focus({preventScroll:!0})}),l.checked=!0===r||"true"===r||"True"===r||1===r,l.addEventListener("change",function(e){i(a())}),l.addEventListener("blur",function(e){i(a(!0))}),l.addEventListener("keydown",function(e){13==e.keyCode&&i(a()),27==e.keyCode&&n()}),l}},Tabulator.prototype.registerModule("edit",Edit); \ No newline at end of file diff --git a/admin/js/vendors/tabulator/js/modules/export.js b/admin/js/vendors/tabulator/js/modules/export.js new file mode 100644 index 0000000..18d3f6c --- /dev/null +++ b/admin/js/vendors/tabulator/js/modules/export.js @@ -0,0 +1,616 @@ +var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; + +/* Tabulator v4.7.0 (c) Oliver Folkerd */ + +var ExportRow = function ExportRow(type, columns, component, indent) { + this.type = type; + this.columns = columns; + this.component = component || false; + this.indent = indent || 0; +}; + +var ExportColumn = function ExportColumn(value, component, width, height, depth) { + this.value = value; + this.component = component || false; + this.width = width; + this.height = height; + this.depth = depth; +}; + +var Export = function Export(table) { + this.table = table; //hold Tabulator object + this.config = {}; + this.cloneTableStyle = true; + this.colVisProp = ""; +}; + +Export.prototype.generateExportList = function (config, style, range, colVisProp) { + this.cloneTableStyle = style; + this.config = config || {}; + this.colVisProp = colVisProp; + + var headers = this.config.columnHeaders !== false ? this.headersToExportRows(this.generateColumnGroupHeaders()) : []; + var body = this.bodyToExportRows(this.rowLookup(range)); + + return headers.concat(body); +}; + +Export.prototype.genereateTable = function (config, style, range, colVisProp) { + var list = this.generateExportList(config, style, range, colVisProp); + + return this.genereateTableElement(list); +}; + +Export.prototype.rowLookup = function (range) { + var _this = this; + + var rows = []; + + if (typeof range == "function") { + range.call(this.table).forEach(function (row) { + row = _this.table.rowManager.findRow(row); + + if (row) { + rows.push(row); + } + }); + } else { + switch (range) { + case true: + case "visible": + rows = this.table.rowManager.getVisibleRows(true); + break; + + case "all": + rows = this.table.rowManager.rows; + break; + + case "selected": + rows = this.table.modules.selectRow.selectedRows; + break; + + case "active": + default: + rows = this.table.rowManager.getDisplayRows(); + } + } + + return Object.assign([], rows); +}; + +Export.prototype.generateColumnGroupHeaders = function () { + var _this2 = this; + + var output = []; + + var columns = this.config.columnGroups !== false ? this.table.columnManager.columns : this.table.columnManager.columnsByIndex; + + columns.forEach(function (column) { + var colData = _this2.processColumnGroup(column); + + if (colData) { + output.push(colData); + } + }); + + return output; +}; + +Export.prototype.processColumnGroup = function (column) { + var _this3 = this; + + var subGroups = column.columns, + maxDepth = 0, + title = column.definition["title" + (this.colVisProp.charAt(0).toUpperCase() + this.colVisProp.slice(1))] || column.definition.title; + + var groupData = { + title: title, + column: column, + depth: 1 + }; + + if (subGroups.length) { + groupData.subGroups = []; + groupData.width = 0; + + subGroups.forEach(function (subGroup) { + var subGroupData = _this3.processColumnGroup(subGroup); + + if (subGroupData) { + groupData.width += subGroupData.width; + groupData.subGroups.push(subGroupData); + + if (subGroupData.depth > maxDepth) { + maxDepth = subGroupData.depth; + } + } + }); + + groupData.depth += maxDepth; + + if (!groupData.width) { + return false; + } + } else { + if (this.columnVisCheck(column)) { + groupData.width = 1; + } else { + return false; + } + } + + return groupData; +}; + +Export.prototype.columnVisCheck = function (column) { + return column.definition[this.colVisProp] !== false && (column.visible || !column.visible && column.definition[this.colVisProp]); +}; + +Export.prototype.headersToExportRows = function (columns) { + var headers = [], + headerDepth = 0, + exportRows = []; + + function parseColumnGroup(column, level) { + + var depth = headerDepth - level; + + if (typeof headers[level] === "undefined") { + headers[level] = []; + } + + column.height = column.subGroups ? 1 : depth - column.depth + 1; + + headers[level].push(column); + + if (column.height > 1) { + for (var _i = 1; _i < column.height; _i++) { + + if (typeof headers[level + _i] === "undefined") { + headers[level + _i] = []; + } + + headers[level + _i].push(false); + } + } + + if (column.width > 1) { + for (var _i2 = 1; _i2 < column.width; _i2++) { + headers[level].push(false); + } + } + + if (column.subGroups) { + column.subGroups.forEach(function (subGroup) { + parseColumnGroup(subGroup, level + 1); + }); + } + } + + //calculate maximum header debth + columns.forEach(function (column) { + if (column.depth > headerDepth) { + headerDepth = column.depth; + } + }); + + columns.forEach(function (column) { + parseColumnGroup(column, 0); + }); + + headers.forEach(function (header) { + var columns = []; + + header.forEach(function (col) { + if (col) { + columns.push(new ExportColumn(col.title, col.column.getComponent(), col.width, col.height, col.depth)); + } else { + columns.push(null); + } + }); + + exportRows.push(new ExportRow("header", columns)); + }); + + return exportRows; +}; + +Export.prototype.bodyToExportRows = function (rows) { + var _this4 = this; + + var columns = []; + var exportRows = []; + + this.table.columnManager.columnsByIndex.forEach(function (column) { + if (_this4.columnVisCheck(column)) { + columns.push(column.getComponent()); + } + }); + + if (this.config.columnCalcs !== false && this.table.modExists("columnCalcs")) { + if (this.table.modules.columnCalcs.topInitialized) { + rows.unshift(this.table.modules.columnCalcs.topRow); + } + + if (this.table.modules.columnCalcs.botInitialized) { + rows.push(this.table.modules.columnCalcs.botRow); + } + } + + rows = rows.filter(function (row) { + switch (row.type) { + case "group": + return _this4.config.rowGroups !== false; + break; + + case "calc": + return _this4.config.columnCalcs !== false; + break; + + case "row": + return !(_this4.table.options.dataTree && _this4.config.dataTree === false && row.modules.dataTree.parent); + break; + } + + return true; + }); + + rows.forEach(function (row, i) { + var rowData = row.getData(_this4.colVisProp); + var exportCols = []; + var indent = 0; + + switch (row.type) { + case "group": + indent = row.level; + exportCols.push(new ExportColumn(row.key, row.getComponent(), columns.length, 1)); + break; + + case "calc": + case "row": + columns.forEach(function (col) { + exportCols.push(new ExportColumn(col._column.getFieldValue(rowData), col, 1, 1)); + }); + + if (_this4.table.options.dataTree && _this4.config.dataTree !== false) { + indent = row.modules.dataTree.index; + } + break; + } + + exportRows.push(new ExportRow(row.type, exportCols, row.getComponent(), indent)); + }); + + return exportRows; +}; + +Export.prototype.genereateTableElement = function (list) { + var _this5 = this; + + var table = document.createElement("table"), + headerEl = document.createElement("thead"), + bodyEl = document.createElement("tbody"), + styles = this.lookupTableStyles(), + rowFormatter = this.table.options["rowFormatter" + (this.colVisProp.charAt(0).toUpperCase() + this.colVisProp.slice(1))], + setup = {}; + + setup.rowFormatter = rowFormatter !== null ? rowFormatter : this.table.options.rowFormatter; + + if (this.table.options.dataTree && this.config.dataTree !== false && this.table.modExists("columnCalcs")) { + setup.treeElementField = this.table.modules.dataTree.elementField; + } + + //assign group header formatter + setup.groupHeader = this.table.options["groupHeader" + (this.colVisProp.charAt(0).toUpperCase() + this.colVisProp.slice(1))]; + + if (setup.groupHeader && !Array.isArray(setup.groupHeader)) { + setup.groupHeader = [setup.groupHeader]; + } + + table.classList.add("tabulator-print-table"); + + this.mapElementStyles(this.table.columnManager.getHeadersElement(), headerEl, ["border-top", "border-left", "border-right", "border-bottom", "background-color", "color", "font-weight", "font-family", "font-size"]); + + if (list.length > 1000) { + console.warn("It may take a long time to render an HTML table with more than 1000 rows"); + } + + list.forEach(function (row, i) { + switch (row.type) { + case "header": + headerEl.appendChild(_this5.genereateHeaderElement(row, setup, styles)); + break; + + case "group": + bodyEl.appendChild(_this5.genereateGroupElement(row, setup, styles)); + break; + + case "calc": + bodyEl.appendChild(_this5.genereateCalcElement(row, setup, styles)); + break; + + case "row": + var rowEl = _this5.genereateRowElement(row, setup, styles); + _this5.mapElementStyles(i % 2 && styles.evenRow ? styles.evenRow : styles.oddRow, rowEl, ["border-top", "border-left", "border-right", "border-bottom", "color", "font-weight", "font-family", "font-size", "background-color"]); + bodyEl.appendChild(rowEl); + break; + } + }); + + if (headerEl.innerHTML) { + table.appendChild(headerEl); + } + + table.appendChild(bodyEl); + + this.mapElementStyles(this.table.element, table, ["border-top", "border-left", "border-right", "border-bottom"]); + return table; +}; + +Export.prototype.lookupTableStyles = function () { + var styles = {}; + + //lookup row styles + if (this.cloneTableStyle && window.getComputedStyle) { + styles.oddRow = this.table.element.querySelector(".tabulator-row-odd:not(.tabulator-group):not(.tabulator-calcs)"); + styles.evenRow = this.table.element.querySelector(".tabulator-row-even:not(.tabulator-group):not(.tabulator-calcs)"); + styles.calcRow = this.table.element.querySelector(".tabulator-row.tabulator-calcs"); + styles.firstRow = this.table.element.querySelector(".tabulator-row:not(.tabulator-group):not(.tabulator-calcs)"); + styles.firstGroup = this.table.element.getElementsByClassName("tabulator-group")[0]; + + if (styles.firstRow) { + styles.styleCells = styles.firstRow.getElementsByClassName("tabulator-cell"); + styles.firstCell = styles.styleCells[0]; + styles.lastCell = styles.styleCells[styles.styleCells.length - 1]; + } + } + + return styles; +}; + +Export.prototype.genereateHeaderElement = function (row, setup, styles) { + var _this6 = this; + + var rowEl = document.createElement("tr"); + + row.columns.forEach(function (column) { + if (column) { + var cellEl = document.createElement("th"); + var classNames = column.component._column.definition.cssClass ? column.component._column.definition.cssClass.split(" ") : []; + + cellEl.colSpan = column.width; + cellEl.rowSpan = column.height; + + cellEl.innerHTML = column.value; + + if (_this6.cloneTableStyle) { + cellEl.style.boxSizing = "border-box"; + } + + classNames.forEach(function (className) { + cellEl.classList.add(className); + }); + + _this6.mapElementStyles(column.component.getElement(), cellEl, ["text-align", "border-top", "border-left", "border-right", "border-bottom", "background-color", "color", "font-weight", "font-family", "font-size"]); + _this6.mapElementStyles(column.component._column.contentElement, cellEl, ["padding-top", "padding-left", "padding-right", "padding-bottom"]); + + if (column.component._column.visible) { + _this6.mapElementStyles(column.component.getElement(), cellEl, ["width"]); + } else { + if (column.component._column.definition.width) { + cellEl.style.width = column.component._column.definition.width + "px"; + } + } + + if (column.component._column.parent) { + _this6.mapElementStyles(column.component._column.parent.groupElement, cellEl, ["border-top"]); + } + + rowEl.appendChild(cellEl); + } + }); + + return rowEl; +}; + +Export.prototype.genereateGroupElement = function (row, setup, styles) { + + var rowEl = document.createElement("tr"), + cellEl = document.createElement("td"), + group = row.columns[0]; + + rowEl.classList.add("tabulator-print-table-row"); + + if (setup.groupHeader && setup.groupHeader[row.indent]) { + group.value = setup.groupHeader[row.indent](group.value, row.component._group.getRowCount(), row.component._group.getData(), row.component); + } else { + if (setup.groupHeader === false) { + group.value = group.value; + } else { + group.value = row.component._group.generator(group.value, row.component._group.getRowCount(), row.component._group.getData(), row.component); + } + } + + cellEl.colSpan = group.width; + cellEl.innerHTML = group.value; + + rowEl.classList.add("tabulator-print-table-group"); + rowEl.classList.add("tabulator-group-level-" + row.indent); + + if (group.component.getVisibility()) { + rowEl.classList.add("tabulator-group-visible"); + } + + this.mapElementStyles(styles.firstGroup, rowEl, ["border-top", "border-left", "border-right", "border-bottom", "color", "font-weight", "font-family", "font-size", "background-color"]); + this.mapElementStyles(styles.firstGroup, cellEl, ["padding-top", "padding-left", "padding-right", "padding-bottom"]); + + rowEl.appendChild(cellEl); + + return rowEl; +}; + +Export.prototype.genereateCalcElement = function (row, setup, styles) { + var rowEl = this.genereateRowElement(row, setup, styles); + + rowEl.classList.add("tabulator-print-table-calcs"); + this.mapElementStyles(styles.calcRow, rowEl, ["border-top", "border-left", "border-right", "border-bottom", "color", "font-weight", "font-family", "font-size", "background-color"]); + + return rowEl; +}; + +Export.prototype.genereateRowElement = function (row, setup, styles) { + var _this7 = this; + + var rowEl = document.createElement("tr"); + + rowEl.classList.add("tabulator-print-table-row"); + + row.columns.forEach(function (col) { + + if (col) { + var cellEl = document.createElement("td"), + column = col.component._column, + value = col.value; + + var cellWrapper = { + modules: {}, + getValue: function getValue() { + return value; + }, + getField: function getField() { + return column.definition.field; + }, + getElement: function getElement() { + return cellEl; + }, + getColumn: function getColumn() { + return column.getComponent(); + }, + getData: function getData() { + return rowData; + }, + getRow: function getRow() { + return row.getComponent(); + }, + getComponent: function getComponent() { + return cellWrapper; + }, + column: column + }; + + var classNames = column.definition.cssClass ? column.definition.cssClass.split(" ") : []; + + classNames.forEach(function (className) { + cellEl.classList.add(className); + }); + + if (_this7.table.modExists("format") && _this7.config.formatCells !== false) { + value = _this7.table.modules.format.formatExportValue(cellWrapper, _this7.colVisProp); + } else { + switch (typeof value === "undefined" ? "undefined" : _typeof(value)) { + case "object": + value = JSON.stringify(value); + break; + + case "undefined": + case "null": + value = ""; + break; + + default: + value = value; + } + } + + if (value instanceof Node) { + cellEl.appendChild(value); + } else { + cellEl.innerHTML = value; + } + + if (styles.firstCell) { + _this7.mapElementStyles(styles.firstCell, cellEl, ["padding-top", "padding-left", "padding-right", "padding-bottom", "border-top", "border-left", "border-right", "border-bottom", "color", "font-weight", "font-family", "font-size"]); + + if (column.definition.align) { + cellEl.style.textAlign = column.definition.align; + } + } + + if (_this7.table.options.dataTree && _this7.config.dataTree !== false) { + if (setup.treeElementField && setup.treeElementField == column.field || !setup.treeElementField && i == 0) { + if (row.component._row.modules.dataTree.controlEl) { + cellEl.insertBefore(row.component._row.modules.dataTree.controlEl.cloneNode(true), cellEl.firstChild); + } + if (row.component._row.modules.dataTree.branchEl) { + cellEl.insertBefore(row.component._row.modules.dataTree.branchEl.cloneNode(true), cellEl.firstChild); + } + } + } + + rowEl.appendChild(cellEl); + + if (cellWrapper.modules.format && cellWrapper.modules.format.renderedCallback) { + cellWrapper.modules.format.renderedCallback(); + } + + if (setup.rowFormatter && _this7.config.formatCells !== false) { + var rowComponent = row.getComponent(); + + rowComponent.getElement = function () { + return rowEl; + }; + + setup.rowFormatter(rowComponent); + } + } + }); + + return rowEl; +}; + +Export.prototype.genereateHTMLTable = function (list) { + var holder = document.createElement("div"); + + holder.appendChild(this.genereateTableElement(list)); + + return holder.innerHTML; +}; + +Export.prototype.getHtml = function (visible, style, config, colVisProp) { + var list = this.generateExportList(config || this.table.options.htmlOutputConfig, style, visible, colVisProp || "htmlOutput"); + + return this.genereateHTMLTable(list); +}; + +Export.prototype.mapElementStyles = function (from, to, props) { + if (this.cloneTableStyle && from && to) { + + var lookup = { + "background-color": "backgroundColor", + "color": "fontColor", + "width": "width", + "font-weight": "fontWeight", + "font-family": "fontFamily", + "font-size": "fontSize", + "text-align": "textAlign", + "border-top": "borderTop", + "border-left": "borderLeft", + "border-right": "borderRight", + "border-bottom": "borderBottom", + "padding-top": "paddingTop", + "padding-left": "paddingLeft", + "padding-right": "paddingRight", + "padding-bottom": "paddingBottom" + }; + + if (window.getComputedStyle) { + var fromStyle = window.getComputedStyle(from); + + props.forEach(function (prop) { + to.style[lookup[prop]] = fromStyle.getPropertyValue(prop); + }); + } + } +}; + +Tabulator.prototype.registerModule("export", Export); \ No newline at end of file diff --git a/admin/js/vendors/tabulator/js/modules/export.min.js b/admin/js/vendors/tabulator/js/modules/export.min.js new file mode 100644 index 0000000..d0dcccd --- /dev/null +++ b/admin/js/vendors/tabulator/js/modules/export.min.js @@ -0,0 +1,2 @@ +/* Tabulator v4.7.0 (c) Oliver Folkerd */ +var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ExportRow=function(t,e,o,r){this.type=t,this.columns=e,this.component=o||!1,this.indent=r||0},ExportColumn=function(t,e,o,r,n){this.value=t,this.component=e||!1,this.width=o,this.height=r,this.depth=n},Export=function(t){this.table=t,this.config={},this.cloneTableStyle=!0,this.colVisProp=""};Export.prototype.generateExportList=function(t,e,o,r){this.cloneTableStyle=e,this.config=t||{},this.colVisProp=r;var n=!1!==this.config.columnHeaders?this.headersToExportRows(this.generateColumnGroupHeaders()):[],l=this.bodyToExportRows(this.rowLookup(o));return n.concat(l)},Export.prototype.genereateTable=function(t,e,o,r){var n=this.generateExportList(t,e,o,r);return this.genereateTableElement(n)},Export.prototype.rowLookup=function(t){var e=this,o=[];if("function"==typeof t)t.call(this.table).forEach(function(t){(t=e.table.rowManager.findRow(t))&&o.push(t)});else switch(t){case!0:case"visible":o=this.table.rowManager.getVisibleRows(!0);break;case"all":o=this.table.rowManager.rows;break;case"selected":o=this.table.modules.selectRow.selectedRows;break;case"active":default:o=this.table.rowManager.getDisplayRows()}return Object.assign([],o)},Export.prototype.generateColumnGroupHeaders=function(){var t=this,e=[];return(!1!==this.config.columnGroups?this.table.columnManager.columns:this.table.columnManager.columnsByIndex).forEach(function(o){var r=t.processColumnGroup(o);r&&e.push(r)}),e},Export.prototype.processColumnGroup=function(t){var e=this,o=t.columns,r=0,n=t.definition["title"+(this.colVisProp.charAt(0).toUpperCase()+this.colVisProp.slice(1))]||t.definition.title,l={title:n,column:t,depth:1};if(o.length){if(l.subGroups=[],l.width=0,o.forEach(function(t){var o=e.processColumnGroup(t);o&&(l.width+=o.width,l.subGroups.push(o),o.depth>r&&(r=o.depth))}),l.depth+=r,!l.width)return!1}else{if(!this.columnVisCheck(t))return!1;l.width=1}return l},Export.prototype.columnVisCheck=function(t){return!1!==t.definition[this.colVisProp]&&(t.visible||!t.visible&&t.definition[this.colVisProp])},Export.prototype.headersToExportRows=function(t){function e(t,n){var l=r-n;if(void 0===o[n]&&(o[n]=[]),t.height=t.subGroups?1:l-t.depth+1,o[n].push(t),t.height>1)for(var a=1;a1)for(var i=1;ir&&(r=t.depth)}),t.forEach(function(t){e(t,0)}),o.forEach(function(t){var e=[];t.forEach(function(t){t?e.push(new ExportColumn(t.title,t.column.getComponent(),t.width,t.height,t.depth)):e.push(null)}),n.push(new ExportRow("header",e))}),n},Export.prototype.bodyToExportRows=function(t){var e=this,o=[],r=[];return this.table.columnManager.columnsByIndex.forEach(function(t){e.columnVisCheck(t)&&o.push(t.getComponent())}),!1!==this.config.columnCalcs&&this.table.modExists("columnCalcs")&&(this.table.modules.columnCalcs.topInitialized&&t.unshift(this.table.modules.columnCalcs.topRow),this.table.modules.columnCalcs.botInitialized&&t.push(this.table.modules.columnCalcs.botRow)),t=t.filter(function(t){switch(t.type){case"group":return!1!==e.config.rowGroups;case"calc":return!1!==e.config.columnCalcs;case"row":return!(e.table.options.dataTree&&!1===e.config.dataTree&&t.modules.dataTree.parent)}return!0}),t.forEach(function(t,n){var l=t.getData(e.colVisProp),a=[],i=0;switch(t.type){case"group":i=t.level,a.push(new ExportColumn(t.key,t.getComponent(),o.length,1));break;case"calc":case"row":o.forEach(function(t){a.push(new ExportColumn(t._column.getFieldValue(l),t,1,1))}),e.table.options.dataTree&&!1!==e.config.dataTree&&(i=t.modules.dataTree.index)}r.push(new ExportRow(t.type,a,t.getComponent(),i))}),r},Export.prototype.genereateTableElement=function(t){var e=this,o=document.createElement("table"),r=document.createElement("thead"),n=document.createElement("tbody"),l=this.lookupTableStyles(),a=this.table.options["rowFormatter"+(this.colVisProp.charAt(0).toUpperCase()+this.colVisProp.slice(1))],i={};return i.rowFormatter=null!==a?a:this.table.options.rowFormatter,this.table.options.dataTree&&!1!==this.config.dataTree&&this.table.modExists("columnCalcs")&&(i.treeElementField=this.table.modules.dataTree.elementField),i.groupHeader=this.table.options["groupHeader"+(this.colVisProp.charAt(0).toUpperCase()+this.colVisProp.slice(1))],i.groupHeader&&!Array.isArray(i.groupHeader)&&(i.groupHeader=[i.groupHeader]),o.classList.add("tabulator-print-table"),this.mapElementStyles(this.table.columnManager.getHeadersElement(),r,["border-top","border-left","border-right","border-bottom","background-color","color","font-weight","font-family","font-size"]),t.length>1e3&&console.warn("It may take a long time to render an HTML table with more than 1000 rows"),t.forEach(function(t,o){switch(t.type){case"header":r.appendChild(e.genereateHeaderElement(t,i,l));break;case"group":n.appendChild(e.genereateGroupElement(t,i,l));break;case"calc":n.appendChild(e.genereateCalcElement(t,i,l));break;case"row":var a=e.genereateRowElement(t,i,l);e.mapElementStyles(o%2&&l.evenRow?l.evenRow:l.oddRow,a,["border-top","border-left","border-right","border-bottom","color","font-weight","font-family","font-size","background-color"]),n.appendChild(a)}}),r.innerHTML&&o.appendChild(r),o.appendChild(n),this.mapElementStyles(this.table.element,o,["border-top","border-left","border-right","border-bottom"]),o},Export.prototype.lookupTableStyles=function(){var t={};return this.cloneTableStyle&&window.getComputedStyle&&(t.oddRow=this.table.element.querySelector(".tabulator-row-odd:not(.tabulator-group):not(.tabulator-calcs)"),t.evenRow=this.table.element.querySelector(".tabulator-row-even:not(.tabulator-group):not(.tabulator-calcs)"),t.calcRow=this.table.element.querySelector(".tabulator-row.tabulator-calcs"),t.firstRow=this.table.element.querySelector(".tabulator-row:not(.tabulator-group):not(.tabulator-calcs)"),t.firstGroup=this.table.element.getElementsByClassName("tabulator-group")[0],t.firstRow&&(t.styleCells=t.firstRow.getElementsByClassName("tabulator-cell"),t.firstCell=t.styleCells[0],t.lastCell=t.styleCells[t.styleCells.length-1])),t},Export.prototype.genereateHeaderElement=function(t,e,o){var r=this,n=document.createElement("tr");return t.columns.forEach(function(t){if(t){var e=document.createElement("th"),o=t.component._column.definition.cssClass?t.component._column.definition.cssClass.split(" "):[];e.colSpan=t.width,e.rowSpan=t.height,e.innerHTML=t.value,r.cloneTableStyle&&(e.style.boxSizing="border-box"),o.forEach(function(t){e.classList.add(t)}),r.mapElementStyles(t.component.getElement(),e,["text-align","border-top","border-left","border-right","border-bottom","background-color","color","font-weight","font-family","font-size"]),r.mapElementStyles(t.component._column.contentElement,e,["padding-top","padding-left","padding-right","padding-bottom"]),t.component._column.visible?r.mapElementStyles(t.component.getElement(),e,["width"]):t.component._column.definition.width&&(e.style.width=t.component._column.definition.width+"px"),t.component._column.parent&&r.mapElementStyles(t.component._column.parent.groupElement,e,["border-top"]),n.appendChild(e)}}),n},Export.prototype.genereateGroupElement=function(t,e,o){var r=document.createElement("tr"),n=document.createElement("td"),l=t.columns[0];return r.classList.add("tabulator-print-table-row"),e.groupHeader&&e.groupHeader[t.indent]?l.value=e.groupHeader[t.indent](l.value,t.component._group.getRowCount(),t.component._group.getData(),t.component):!1===e.groupHeader?l.value=l.value:l.value=t.component._group.generator(l.value,t.component._group.getRowCount(),t.component._group.getData(),t.component),n.colSpan=l.width,n.innerHTML=l.value,r.classList.add("tabulator-print-table-group"),r.classList.add("tabulator-group-level-"+t.indent),l.component.getVisibility()&&r.classList.add("tabulator-group-visible"),this.mapElementStyles(o.firstGroup,r,["border-top","border-left","border-right","border-bottom","color","font-weight","font-family","font-size","background-color"]),this.mapElementStyles(o.firstGroup,n,["padding-top","padding-left","padding-right","padding-bottom"]),r.appendChild(n),r},Export.prototype.genereateCalcElement=function(t,e,o){var r=this.genereateRowElement(t,e,o);return r.classList.add("tabulator-print-table-calcs"),this.mapElementStyles(o.calcRow,r,["border-top","border-left","border-right","border-bottom","color","font-weight","font-family","font-size","background-color"]),r},Export.prototype.genereateRowElement=function(t,e,o){var r=this,n=document.createElement("tr");return n.classList.add("tabulator-print-table-row"),t.columns.forEach(function(l){if(l){var a=document.createElement("td"),s=l.component._column,p=l.value,c={modules:{},getValue:function(){return p},getField:function(){return s.definition.field},getElement:function(){return a},getColumn:function(){return s.getComponent()},getData:function(){return rowData},getRow:function(){return t.getComponent()},getComponent:function(){return c},column:s};if((s.definition.cssClass?s.definition.cssClass.split(" "):[]).forEach(function(t){a.classList.add(t)}),r.table.modExists("format")&&!1!==r.config.formatCells)p=r.table.modules.format.formatExportValue(c,r.colVisProp);else switch(void 0===p?"undefined":_typeof(p)){case"object":p=JSON.stringify(p);break;case"undefined":case"null":p="";break;default:p=p}if(p instanceof Node?a.appendChild(p):a.innerHTML=p,o.firstCell&&(r.mapElementStyles(o.firstCell,a,["padding-top","padding-left","padding-right","padding-bottom","border-top","border-left","border-right","border-bottom","color","font-weight","font-family","font-size"]),s.definition.align&&(a.style.textAlign=s.definition.align)),r.table.options.dataTree&&!1!==r.config.dataTree&&(e.treeElementField&&e.treeElementField==s.field||!e.treeElementField&&0==i)&&(t.component._row.modules.dataTree.controlEl&&a.insertBefore(t.component._row.modules.dataTree.controlEl.cloneNode(!0),a.firstChild),t.component._row.modules.dataTree.branchEl&&a.insertBefore(t.component._row.modules.dataTree.branchEl.cloneNode(!0),a.firstChild)),n.appendChild(a),c.modules.format&&c.modules.format.renderedCallback&&c.modules.format.renderedCallback(),e.rowFormatter&&!1!==r.config.formatCells){var u=t.getComponent();u.getElement=function(){return n},e.rowFormatter(u)}}}),n},Export.prototype.genereateHTMLTable=function(t){var e=document.createElement("div");return e.appendChild(this.genereateTableElement(t)),e.innerHTML},Export.prototype.getHtml=function(t,e,o,r){var n=this.generateExportList(o||this.table.options.htmlOutputConfig,e,t,r||"htmlOutput");return this.genereateHTMLTable(n)},Export.prototype.mapElementStyles=function(t,e,o){if(this.cloneTableStyle&&t&&e){var r={"background-color":"backgroundColor",color:"fontColor",width:"width","font-weight":"fontWeight","font-family":"fontFamily","font-size":"fontSize","text-align":"textAlign","border-top":"borderTop","border-left":"borderLeft","border-right":"borderRight","border-bottom":"borderBottom","padding-top":"paddingTop","padding-left":"paddingLeft","padding-right":"paddingRight","padding-bottom":"paddingBottom"};if(window.getComputedStyle){var n=window.getComputedStyle(t);o.forEach(function(t){e.style[r[t]]=n.getPropertyValue(t)})}}},Tabulator.prototype.registerModule("export",Export); \ No newline at end of file diff --git a/admin/js/vendors/tabulator/js/modules/filter.js b/admin/js/vendors/tabulator/js/modules/filter.js new file mode 100644 index 0000000..aaed59b --- /dev/null +++ b/admin/js/vendors/tabulator/js/modules/filter.js @@ -0,0 +1,807 @@ +var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; + +/* Tabulator v4.7.0 (c) Oliver Folkerd */ + +var Filter = function Filter(table) { + + this.table = table; //hold Tabulator object + + this.filterList = []; //hold filter list + this.headerFilters = {}; //hold column filters + this.headerFilterColumns = []; //hold columns that use header filters + + this.prevHeaderFilterChangeCheck = ""; + this.prevHeaderFilterChangeCheck = "{}"; + + this.changed = false; //has filtering changed since last render +}; + +//initialize column header filter +Filter.prototype.initializeColumn = function (column, value) { + var self = this, + field = column.getField(), + params; + + //handle successfull value change + function success(value) { + var filterType = column.modules.filter.tagType == "input" && column.modules.filter.attrType == "text" || column.modules.filter.tagType == "textarea" ? "partial" : "match", + type = "", + filterChangeCheck = "", + filterFunc; + + if (typeof column.modules.filter.prevSuccess === "undefined" || column.modules.filter.prevSuccess !== value) { + + column.modules.filter.prevSuccess = value; + + if (!column.modules.filter.emptyFunc(value)) { + column.modules.filter.value = value; + + switch (_typeof(column.definition.headerFilterFunc)) { + case "string": + if (self.filters[column.definition.headerFilterFunc]) { + type = column.definition.headerFilterFunc; + filterFunc = function filterFunc(data) { + var params = column.definition.headerFilterFuncParams || {}; + var fieldVal = column.getFieldValue(data); + + params = typeof params === "function" ? params(value, fieldVal, data) : params; + + return self.filters[column.definition.headerFilterFunc](value, fieldVal, data, params); + }; + } else { + console.warn("Header Filter Error - Matching filter function not found: ", column.definition.headerFilterFunc); + } + break; + + case "function": + filterFunc = function filterFunc(data) { + var params = column.definition.headerFilterFuncParams || {}; + var fieldVal = column.getFieldValue(data); + + params = typeof params === "function" ? params(value, fieldVal, data) : params; + + return column.definition.headerFilterFunc(value, fieldVal, data, params); + }; + + type = filterFunc; + break; + } + + if (!filterFunc) { + switch (filterType) { + case "partial": + filterFunc = function filterFunc(data) { + var colVal = column.getFieldValue(data); + + if (typeof colVal !== 'undefined' && colVal !== null) { + return String(colVal).toLowerCase().indexOf(String(value).toLowerCase()) > -1; + } else { + return false; + } + }; + type = "like"; + break; + + default: + filterFunc = function filterFunc(data) { + return column.getFieldValue(data) == value; + }; + type = "="; + } + } + + self.headerFilters[field] = { value: value, func: filterFunc, type: type, params: params || {} }; + } else { + delete self.headerFilters[field]; + } + + filterChangeCheck = JSON.stringify(self.headerFilters); + + if (self.prevHeaderFilterChangeCheck !== filterChangeCheck) { + self.prevHeaderFilterChangeCheck = filterChangeCheck; + + self.changed = true; + self.table.rowManager.filterRefresh(); + } + } + + return true; + } + + column.modules.filter = { + success: success, + attrType: false, + tagType: false, + emptyFunc: false + }; + + this.generateHeaderFilterElement(column); +}; + +Filter.prototype.generateHeaderFilterElement = function (column, initialValue, reinitialize) { + var _this = this; + + var self = this, + success = column.modules.filter.success, + field = column.getField(), + filterElement, + editor, + editorElement, + cellWrapper, + typingTimer, + searchTrigger, + params; + + //handle aborted edit + function cancel() {} + + if (column.modules.filter.headerElement && column.modules.filter.headerElement.parentNode) { + column.contentElement.removeChild(column.modules.filter.headerElement.parentNode); + } + + if (field) { + + //set empty value function + column.modules.filter.emptyFunc = column.definition.headerFilterEmptyCheck || function (value) { + return !value && value !== "0"; + }; + + filterElement = document.createElement("div"); + filterElement.classList.add("tabulator-header-filter"); + + //set column editor + switch (_typeof(column.definition.headerFilter)) { + case "string": + if (self.table.modules.edit.editors[column.definition.headerFilter]) { + editor = self.table.modules.edit.editors[column.definition.headerFilter]; + + if ((column.definition.headerFilter === "tick" || column.definition.headerFilter === "tickCross") && !column.definition.headerFilterEmptyCheck) { + column.modules.filter.emptyFunc = function (value) { + return value !== true && value !== false; + }; + } + } else { + console.warn("Filter Error - Cannot build header filter, No such editor found: ", column.definition.editor); + } + break; + + case "function": + editor = column.definition.headerFilter; + break; + + case "boolean": + if (column.modules.edit && column.modules.edit.editor) { + editor = column.modules.edit.editor; + } else { + if (column.definition.formatter && self.table.modules.edit.editors[column.definition.formatter]) { + editor = self.table.modules.edit.editors[column.definition.formatter]; + + if ((column.definition.formatter === "tick" || column.definition.formatter === "tickCross") && !column.definition.headerFilterEmptyCheck) { + column.modules.filter.emptyFunc = function (value) { + return value !== true && value !== false; + }; + } + } else { + editor = self.table.modules.edit.editors["input"]; + } + } + break; + } + + if (editor) { + + cellWrapper = { + getValue: function getValue() { + return typeof initialValue !== "undefined" ? initialValue : ""; + }, + getField: function getField() { + return column.definition.field; + }, + getElement: function getElement() { + return filterElement; + }, + getColumn: function getColumn() { + return column.getComponent(); + }, + getRow: function getRow() { + return { + normalizeHeight: function normalizeHeight() {} + }; + } + }; + + params = column.definition.headerFilterParams || {}; + + params = typeof params === "function" ? params.call(self.table) : params; + + editorElement = editor.call(this.table.modules.edit, cellWrapper, function () {}, success, cancel, params); + + if (!editorElement) { + console.warn("Filter Error - Cannot add filter to " + field + " column, editor returned a value of false"); + return; + } + + if (!(editorElement instanceof Node)) { + console.warn("Filter Error - Cannot add filter to " + field + " column, editor should return an instance of Node, the editor returned:", editorElement); + return; + } + + //set Placeholder Text + if (field) { + self.table.modules.localize.bind("headerFilters|columns|" + column.definition.field, function (value) { + editorElement.setAttribute("placeholder", typeof value !== "undefined" && value ? value : self.table.modules.localize.getText("headerFilters|default")); + }); + } else { + self.table.modules.localize.bind("headerFilters|default", function (value) { + editorElement.setAttribute("placeholder", typeof self.column.definition.headerFilterPlaceholder !== "undefined" && self.column.definition.headerFilterPlaceholder ? self.column.definition.headerFilterPlaceholder : value); + }); + } + + //focus on element on click + editorElement.addEventListener("click", function (e) { + e.stopPropagation(); + editorElement.focus(); + }); + + editorElement.addEventListener("focus", function (e) { + var left = _this.table.columnManager.element.scrollLeft; + + if (left !== _this.table.rowManager.element.scrollLeft) { + _this.table.rowManager.scrollHorizontal(left); + _this.table.columnManager.scrollHorizontal(left); + } + }); + + //live update filters as user types + typingTimer = false; + + searchTrigger = function searchTrigger(e) { + if (typingTimer) { + clearTimeout(typingTimer); + } + + typingTimer = setTimeout(function () { + success(editorElement.value); + }, self.table.options.headerFilterLiveFilterDelay); + }; + + column.modules.filter.headerElement = editorElement; + column.modules.filter.attrType = editorElement.hasAttribute("type") ? editorElement.getAttribute("type").toLowerCase() : ""; + column.modules.filter.tagType = editorElement.tagName.toLowerCase(); + + if (column.definition.headerFilterLiveFilter !== false) { + + if (!(column.definition.headerFilter === 'autocomplete' || column.definition.headerFilter === 'tickCross' || (column.definition.editor === 'autocomplete' || column.definition.editor === 'tickCross') && column.definition.headerFilter === true)) { + editorElement.addEventListener("keyup", searchTrigger); + editorElement.addEventListener("search", searchTrigger); + + //update number filtered columns on change + if (column.modules.filter.attrType == "number") { + editorElement.addEventListener("change", function (e) { + success(editorElement.value); + }); + } + + //change text inputs to search inputs to allow for clearing of field + if (column.modules.filter.attrType == "text" && this.table.browser !== "ie") { + editorElement.setAttribute("type", "search"); + // editorElement.off("change blur"); //prevent blur from triggering filter and preventing selection click + } + } + + //prevent input and select elements from propegating click to column sorters etc + if (column.modules.filter.tagType == "input" || column.modules.filter.tagType == "select" || column.modules.filter.tagType == "textarea") { + editorElement.addEventListener("mousedown", function (e) { + e.stopPropagation(); + }); + } + } + + filterElement.appendChild(editorElement); + + column.contentElement.appendChild(filterElement); + + if (!reinitialize) { + self.headerFilterColumns.push(column); + } + } + } else { + console.warn("Filter Error - Cannot add header filter, column has no field set:", column.definition.title); + } +}; + +//hide all header filter elements (used to ensure correct column widths in "fitData" layout mode) +Filter.prototype.hideHeaderFilterElements = function () { + this.headerFilterColumns.forEach(function (column) { + if (column.modules.filter && column.modules.filter.headerElement) { + column.modules.filter.headerElement.style.display = 'none'; + } + }); +}; + +//show all header filter elements (used to ensure correct column widths in "fitData" layout mode) +Filter.prototype.showHeaderFilterElements = function () { + this.headerFilterColumns.forEach(function (column) { + if (column.modules.filter && column.modules.filter.headerElement) { + column.modules.filter.headerElement.style.display = ''; + } + }); +}; + +//programatically set focus of header filter +Filter.prototype.setHeaderFilterFocus = function (column) { + if (column.modules.filter && column.modules.filter.headerElement) { + column.modules.filter.headerElement.focus(); + } else { + console.warn("Column Filter Focus Error - No header filter set on column:", column.getField()); + } +}; + +//programmatically get value of header filter +Filter.prototype.getHeaderFilterValue = function (column) { + if (column.modules.filter && column.modules.filter.headerElement) { + return column.modules.filter.headerElement.value; + } else { + console.warn("Column Filter Error - No header filter set on column:", column.getField()); + } +}; + +//programatically set value of header filter +Filter.prototype.setHeaderFilterValue = function (column, value) { + if (column) { + if (column.modules.filter && column.modules.filter.headerElement) { + this.generateHeaderFilterElement(column, value, true); + column.modules.filter.success(value); + } else { + console.warn("Column Filter Error - No header filter set on column:", column.getField()); + } + } +}; + +Filter.prototype.reloadHeaderFilter = function (column) { + if (column) { + if (column.modules.filter && column.modules.filter.headerElement) { + this.generateHeaderFilterElement(column, column.modules.filter.value, true); + } else { + console.warn("Column Filter Error - No header filter set on column:", column.getField()); + } + } +}; + +//check if the filters has changed since last use +Filter.prototype.hasChanged = function () { + var changed = this.changed; + this.changed = false; + return changed; +}; + +//set standard filters +Filter.prototype.setFilter = function (field, type, value, params) { + var self = this; + + self.filterList = []; + + if (!Array.isArray(field)) { + field = [{ field: field, type: type, value: value, params: params }]; + } + + self.addFilter(field); +}; + +//add filter to array +Filter.prototype.addFilter = function (field, type, value, params) { + var self = this; + + if (!Array.isArray(field)) { + field = [{ field: field, type: type, value: value, params: params }]; + } + + field.forEach(function (filter) { + + filter = self.findFilter(filter); + + if (filter) { + self.filterList.push(filter); + + self.changed = true; + } + }); + + if (this.table.options.persistence && this.table.modExists("persistence", true) && this.table.modules.persistence.config.filter) { + this.table.modules.persistence.save("filter"); + } +}; + +Filter.prototype.findFilter = function (filter) { + var self = this, + column; + + if (Array.isArray(filter)) { + return this.findSubFilters(filter); + } + + var filterFunc = false; + + if (typeof filter.field == "function") { + filterFunc = function filterFunc(data) { + return filter.field(data, filter.type || {}); // pass params to custom filter function + }; + } else { + + if (self.filters[filter.type]) { + + column = self.table.columnManager.getColumnByField(filter.field); + + if (column) { + filterFunc = function filterFunc(data) { + return self.filters[filter.type](filter.value, column.getFieldValue(data), data, filter.params || {}); + }; + } else { + filterFunc = function filterFunc(data) { + return self.filters[filter.type](filter.value, data[filter.field], data, filter.params || {}); + }; + } + } else { + console.warn("Filter Error - No such filter type found, ignoring: ", filter.type); + } + } + + filter.func = filterFunc; + + return filter.func ? filter : false; +}; + +Filter.prototype.findSubFilters = function (filters) { + var self = this, + output = []; + + filters.forEach(function (filter) { + filter = self.findFilter(filter); + + if (filter) { + output.push(filter); + } + }); + + return output.length ? output : false; +}; + +//get all filters +Filter.prototype.getFilters = function (all, ajax) { + var output = []; + + if (all) { + output = this.getHeaderFilters(); + } + + if (ajax) { + output.forEach(function (item) { + if (typeof item.type == "function") { + item.type = "function"; + } + }); + } + + output = output.concat(this.filtersToArray(this.filterList, ajax)); + + return output; +}; + +//filter to Object +Filter.prototype.filtersToArray = function (filterList, ajax) { + var _this2 = this; + + var output = []; + + filterList.forEach(function (filter) { + var item; + + if (Array.isArray(filter)) { + output.push(_this2.filtersToArray(filter, ajax)); + } else { + item = { field: filter.field, type: filter.type, value: filter.value }; + + if (ajax) { + if (typeof item.type == "function") { + item.type = "function"; + } + } + + output.push(item); + } + }); + + return output; +}; + +//get all filters +Filter.prototype.getHeaderFilters = function () { + var self = this, + output = []; + + for (var key in this.headerFilters) { + output.push({ field: key, type: this.headerFilters[key].type, value: this.headerFilters[key].value }); + } + + return output; +}; + +//remove filter from array +Filter.prototype.removeFilter = function (field, type, value) { + var self = this; + + if (!Array.isArray(field)) { + field = [{ field: field, type: type, value: value }]; + } + + field.forEach(function (filter) { + var index = -1; + + if (_typeof(filter.field) == "object") { + index = self.filterList.findIndex(function (element) { + return filter === element; + }); + } else { + index = self.filterList.findIndex(function (element) { + return filter.field === element.field && filter.type === element.type && filter.value === element.value; + }); + } + + if (index > -1) { + self.filterList.splice(index, 1); + self.changed = true; + } else { + console.warn("Filter Error - No matching filter type found, ignoring: ", filter.type); + } + }); + + if (this.table.options.persistence && this.table.modExists("persistence", true) && this.table.modules.persistence.config.filter) { + this.table.modules.persistence.save("filter"); + } +}; + +//clear filters +Filter.prototype.clearFilter = function (all) { + this.filterList = []; + + if (all) { + this.clearHeaderFilter(); + } + + this.changed = true; + + if (this.table.options.persistence && this.table.modExists("persistence", true) && this.table.modules.persistence.config.filter) { + this.table.modules.persistence.save("filter"); + } +}; + +//clear header filters +Filter.prototype.clearHeaderFilter = function () { + var self = this; + + this.headerFilters = {}; + self.prevHeaderFilterChangeCheck = "{}"; + + this.headerFilterColumns.forEach(function (column) { + column.modules.filter.value = null; + column.modules.filter.prevSuccess = undefined; + self.reloadHeaderFilter(column); + }); + + this.changed = true; +}; + +//search data and return matching rows +Filter.prototype.search = function (searchType, field, type, value) { + var self = this, + activeRows = [], + filterList = []; + + if (!Array.isArray(field)) { + field = [{ field: field, type: type, value: value }]; + } + + field.forEach(function (filter) { + filter = self.findFilter(filter); + + if (filter) { + filterList.push(filter); + } + }); + + this.table.rowManager.rows.forEach(function (row) { + var match = true; + + filterList.forEach(function (filter) { + if (!self.filterRecurse(filter, row.getData())) { + match = false; + } + }); + + if (match) { + activeRows.push(searchType === "data" ? row.getData("data") : row.getComponent()); + } + }); + + return activeRows; +}; + +//filter row array +Filter.prototype.filter = function (rowList, filters) { + var self = this, + activeRows = [], + activeRowComponents = []; + + if (self.table.options.dataFiltering) { + self.table.options.dataFiltering.call(self.table, self.getFilters()); + } + + if (!self.table.options.ajaxFiltering && (self.filterList.length || Object.keys(self.headerFilters).length)) { + + rowList.forEach(function (row) { + if (self.filterRow(row)) { + activeRows.push(row); + } + }); + } else { + activeRows = rowList.slice(0); + } + + if (self.table.options.dataFiltered) { + + activeRows.forEach(function (row) { + activeRowComponents.push(row.getComponent()); + }); + + self.table.options.dataFiltered.call(self.table, self.getFilters(), activeRowComponents); + } + + return activeRows; +}; + +//filter individual row +Filter.prototype.filterRow = function (row, filters) { + var self = this, + match = true, + data = row.getData(); + + self.filterList.forEach(function (filter) { + if (!self.filterRecurse(filter, data)) { + match = false; + } + }); + + for (var field in self.headerFilters) { + if (!self.headerFilters[field].func(data)) { + match = false; + } + } + + return match; +}; + +Filter.prototype.filterRecurse = function (filter, data) { + var self = this, + match = false; + + if (Array.isArray(filter)) { + filter.forEach(function (subFilter) { + if (self.filterRecurse(subFilter, data)) { + match = true; + } + }); + } else { + match = filter.func(data); + } + + return match; +}; + +//list of available filters +Filter.prototype.filters = { + + //equal to + "=": function _(filterVal, rowVal, rowData, filterParams) { + return rowVal == filterVal ? true : false; + }, + + //less than + "<": function _(filterVal, rowVal, rowData, filterParams) { + return rowVal < filterVal ? true : false; + }, + + //less than or equal to + "<=": function _(filterVal, rowVal, rowData, filterParams) { + return rowVal <= filterVal ? true : false; + }, + + //greater than + ">": function _(filterVal, rowVal, rowData, filterParams) { + return rowVal > filterVal ? true : false; + }, + + //greater than or equal to + ">=": function _(filterVal, rowVal, rowData, filterParams) { + return rowVal >= filterVal ? true : false; + }, + + //not equal to + "!=": function _(filterVal, rowVal, rowData, filterParams) { + return rowVal != filterVal ? true : false; + }, + + "regex": function regex(filterVal, rowVal, rowData, filterParams) { + + if (typeof filterVal == "string") { + filterVal = new RegExp(filterVal); + } + + return filterVal.test(rowVal); + }, + + //contains the string + "like": function like(filterVal, rowVal, rowData, filterParams) { + if (filterVal === null || typeof filterVal === "undefined") { + return rowVal === filterVal ? true : false; + } else { + if (typeof rowVal !== 'undefined' && rowVal !== null) { + return String(rowVal).toLowerCase().indexOf(filterVal.toLowerCase()) > -1; + } else { + return false; + } + } + }, + + //contains the keywords + "keywords": function keywords(filterVal, rowVal, rowData, filterParams) { + var keywords = filterVal.toLowerCase().split(typeof filterParams.separator === "undefined" ? " " : filterParams.separator), + value = String(rowVal === null || typeof rowVal === "undefined" ? "" : rowVal).toLowerCase(), + matches = []; + + keywords.forEach(function (keyword) { + if (value.includes(keyword)) { + matches.push(true); + } + }); + + return filterParams.matchAll ? matches.length === keywords.length : !!matches.length; + }, + + //starts with the string + "starts": function starts(filterVal, rowVal, rowData, filterParams) { + if (filterVal === null || typeof filterVal === "undefined") { + return rowVal === filterVal ? true : false; + } else { + if (typeof rowVal !== 'undefined' && rowVal !== null) { + return String(rowVal).toLowerCase().startsWith(filterVal.toLowerCase()); + } else { + return false; + } + } + }, + + //ends with the string + "ends": function ends(filterVal, rowVal, rowData, filterParams) { + if (filterVal === null || typeof filterVal === "undefined") { + return rowVal === filterVal ? true : false; + } else { + if (typeof rowVal !== 'undefined' && rowVal !== null) { + return String(rowVal).toLowerCase().endsWith(filterVal.toLowerCase()); + } else { + return false; + } + } + }, + + //in array + "in": function _in(filterVal, rowVal, rowData, filterParams) { + if (Array.isArray(filterVal)) { + return filterVal.indexOf(rowVal) > -1; + } else { + console.warn("Filter Error - filter value is not an array:", filterVal); + return false; + } + } +}; + +Tabulator.prototype.registerModule("filter", Filter); \ No newline at end of file diff --git a/admin/js/vendors/tabulator/js/modules/filter.min.js b/admin/js/vendors/tabulator/js/modules/filter.min.js new file mode 100644 index 0000000..8be2662 --- /dev/null +++ b/admin/js/vendors/tabulator/js/modules/filter.min.js @@ -0,0 +1,2 @@ +/* Tabulator v4.7.0 (c) Oliver Folkerd */ +var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Filter=function(e){this.table=e,this.filterList=[],this.headerFilters={},this.headerFilterColumns=[],this.prevHeaderFilterChangeCheck="",this.prevHeaderFilterChangeCheck="{}",this.changed=!1};Filter.prototype.initializeColumn=function(e,t){function r(t){var r,o="input"==e.modules.filter.tagType&&"text"==e.modules.filter.attrType||"textarea"==e.modules.filter.tagType?"partial":"match",a="",s="";if(void 0===e.modules.filter.prevSuccess||e.modules.filter.prevSuccess!==t){if(e.modules.filter.prevSuccess=t,e.modules.filter.emptyFunc(t))delete n.headerFilters[l];else{switch(e.modules.filter.value=t,_typeof(e.definition.headerFilterFunc)){case"string":n.filters[e.definition.headerFilterFunc]?(a=e.definition.headerFilterFunc,r=function(r){var i=e.definition.headerFilterFuncParams||{},l=e.getFieldValue(r);return i="function"==typeof i?i(t,l,r):i,n.filters[e.definition.headerFilterFunc](t,l,r,i)}):console.warn("Header Filter Error - Matching filter function not found: ",e.definition.headerFilterFunc);break;case"function":r=function(r){var i=e.definition.headerFilterFuncParams||{},n=e.getFieldValue(r);return i="function"==typeof i?i(t,n,r):i,e.definition.headerFilterFunc(t,n,r,i)},a=r}if(!r)switch(o){case"partial":r=function(r){var i=e.getFieldValue(r);return void 0!==i&&null!==i&&String(i).toLowerCase().indexOf(String(t).toLowerCase())>-1},a="like";break;default:r=function(r){return e.getFieldValue(r)==t},a="="}n.headerFilters[l]={value:t,func:r,type:a,params:i||{}}}s=JSON.stringify(n.headerFilters),n.prevHeaderFilterChangeCheck!==s&&(n.prevHeaderFilterChangeCheck=s,n.changed=!0,n.table.rowManager.filterRefresh())}return!0}var i,n=this,l=e.getField();e.modules.filter={success:r,attrType:!1,tagType:!1,emptyFunc:!1},this.generateHeaderFilterElement(e)},Filter.prototype.generateHeaderFilterElement=function(e,t,r){function i(){}var n,l,o,a,s,d,u,f=this,c=this,h=e.modules.filter.success,p=e.getField();if(e.modules.filter.headerElement&&e.modules.filter.headerElement.parentNode&&e.contentElement.removeChild(e.modules.filter.headerElement.parentNode),p){switch(e.modules.filter.emptyFunc=e.definition.headerFilterEmptyCheck||function(e){return!e&&"0"!==e},n=document.createElement("div"),n.classList.add("tabulator-header-filter"),_typeof(e.definition.headerFilter)){case"string":c.table.modules.edit.editors[e.definition.headerFilter]?(l=c.table.modules.edit.editors[e.definition.headerFilter],"tick"!==e.definition.headerFilter&&"tickCross"!==e.definition.headerFilter||e.definition.headerFilterEmptyCheck||(e.modules.filter.emptyFunc=function(e){return!0!==e&&!1!==e})):console.warn("Filter Error - Cannot build header filter, No such editor found: ",e.definition.editor);break;case"function":l=e.definition.headerFilter;break;case"boolean":e.modules.edit&&e.modules.edit.editor?l=e.modules.edit.editor:e.definition.formatter&&c.table.modules.edit.editors[e.definition.formatter]?(l=c.table.modules.edit.editors[e.definition.formatter],"tick"!==e.definition.formatter&&"tickCross"!==e.definition.formatter||e.definition.headerFilterEmptyCheck||(e.modules.filter.emptyFunc=function(e){return!0!==e&&!1!==e})):l=c.table.modules.edit.editors.input}if(l){if(a={getValue:function(){return void 0!==t?t:""},getField:function(){return e.definition.field},getElement:function(){return n},getColumn:function(){return e.getComponent()},getRow:function(){return{normalizeHeight:function(){}}}},u=e.definition.headerFilterParams||{},u="function"==typeof u?u.call(c.table):u,!(o=l.call(this.table.modules.edit,a,function(){},h,i,u)))return void console.warn("Filter Error - Cannot add filter to "+p+" column, editor returned a value of false");if(!(o instanceof Node))return void console.warn("Filter Error - Cannot add filter to "+p+" column, editor should return an instance of Node, the editor returned:",o);p?c.table.modules.localize.bind("headerFilters|columns|"+e.definition.field,function(e){o.setAttribute("placeholder",void 0!==e&&e?e:c.table.modules.localize.getText("headerFilters|default"))}):c.table.modules.localize.bind("headerFilters|default",function(e){o.setAttribute("placeholder",void 0!==c.column.definition.headerFilterPlaceholder&&c.column.definition.headerFilterPlaceholder?c.column.definition.headerFilterPlaceholder:e)}),o.addEventListener("click",function(e){e.stopPropagation(),o.focus()}),o.addEventListener("focus",function(e){var t=f.table.columnManager.element.scrollLeft;t!==f.table.rowManager.element.scrollLeft&&(f.table.rowManager.scrollHorizontal(t),f.table.columnManager.scrollHorizontal(t))}),s=!1,d=function(e){s&&clearTimeout(s),s=setTimeout(function(){h(o.value)},c.table.options.headerFilterLiveFilterDelay)},e.modules.filter.headerElement=o,e.modules.filter.attrType=o.hasAttribute("type")?o.getAttribute("type").toLowerCase():"",e.modules.filter.tagType=o.tagName.toLowerCase(),!1!==e.definition.headerFilterLiveFilter&&("autocomplete"!==e.definition.headerFilter&&"tickCross"!==e.definition.headerFilter&&("autocomplete"!==e.definition.editor&&"tickCross"!==e.definition.editor||!0!==e.definition.headerFilter)&&(o.addEventListener("keyup",d),o.addEventListener("search",d),"number"==e.modules.filter.attrType&&o.addEventListener("change",function(e){h(o.value)}),"text"==e.modules.filter.attrType&&"ie"!==this.table.browser&&o.setAttribute("type","search")),"input"!=e.modules.filter.tagType&&"select"!=e.modules.filter.tagType&&"textarea"!=e.modules.filter.tagType||o.addEventListener("mousedown",function(e){e.stopPropagation()})),n.appendChild(o),e.contentElement.appendChild(n),r||c.headerFilterColumns.push(e)}}else console.warn("Filter Error - Cannot add header filter, column has no field set:",e.definition.title)},Filter.prototype.hideHeaderFilterElements=function(){this.headerFilterColumns.forEach(function(e){e.modules.filter&&e.modules.filter.headerElement&&(e.modules.filter.headerElement.style.display="none")})},Filter.prototype.showHeaderFilterElements=function(){this.headerFilterColumns.forEach(function(e){e.modules.filter&&e.modules.filter.headerElement&&(e.modules.filter.headerElement.style.display="")})},Filter.prototype.setHeaderFilterFocus=function(e){e.modules.filter&&e.modules.filter.headerElement?e.modules.filter.headerElement.focus():console.warn("Column Filter Focus Error - No header filter set on column:",e.getField())},Filter.prototype.getHeaderFilterValue=function(e){if(e.modules.filter&&e.modules.filter.headerElement)return e.modules.filter.headerElement.value;console.warn("Column Filter Error - No header filter set on column:",e.getField())},Filter.prototype.setHeaderFilterValue=function(e,t){e&&(e.modules.filter&&e.modules.filter.headerElement?(this.generateHeaderFilterElement(e,t,!0),e.modules.filter.success(t)):console.warn("Column Filter Error - No header filter set on column:",e.getField()))},Filter.prototype.reloadHeaderFilter=function(e){e&&(e.modules.filter&&e.modules.filter.headerElement?this.generateHeaderFilterElement(e,e.modules.filter.value,!0):console.warn("Column Filter Error - No header filter set on column:",e.getField()))},Filter.prototype.hasChanged=function(){var e=this.changed;return this.changed=!1,e},Filter.prototype.setFilter=function(e,t,r,i){var n=this;n.filterList=[],Array.isArray(e)||(e=[{field:e,type:t,value:r,params:i}]),n.addFilter(e)},Filter.prototype.addFilter=function(e,t,r,i){var n=this;Array.isArray(e)||(e=[{field:e,type:t,value:r,params:i}]),e.forEach(function(e){(e=n.findFilter(e))&&(n.filterList.push(e),n.changed=!0)}),this.table.options.persistence&&this.table.modExists("persistence",!0)&&this.table.modules.persistence.config.filter&&this.table.modules.persistence.save("filter")},Filter.prototype.findFilter=function(e){var t,r=this;if(Array.isArray(e))return this.findSubFilters(e);var i=!1;return"function"==typeof e.field?i=function(t){return e.field(t,e.type||{})}:r.filters[e.type]?(t=r.table.columnManager.getColumnByField(e.field),i=t?function(i){return r.filters[e.type](e.value,t.getFieldValue(i),i,e.params||{})}:function(t){return r.filters[e.type](e.value,t[e.field],t,e.params||{})}):console.warn("Filter Error - No such filter type found, ignoring: ",e.type),e.func=i,!!e.func&&e},Filter.prototype.findSubFilters=function(e){var t=this,r=[];return e.forEach(function(e){(e=t.findFilter(e))&&r.push(e)}),!!r.length&&r},Filter.prototype.getFilters=function(e,t){var r=[];return e&&(r=this.getHeaderFilters()),t&&r.forEach(function(e){"function"==typeof e.type&&(e.type="function")}),r=r.concat(this.filtersToArray(this.filterList,t))},Filter.prototype.filtersToArray=function(e,t){var r=this,i=[];return e.forEach(function(e){var n;Array.isArray(e)?i.push(r.filtersToArray(e,t)):(n={field:e.field,type:e.type,value:e.value},t&&"function"==typeof n.type&&(n.type="function"),i.push(n))}),i},Filter.prototype.getHeaderFilters=function(){var e=[];for(var t in this.headerFilters)e.push({field:t,type:this.headerFilters[t].type,value:this.headerFilters[t].value});return e},Filter.prototype.removeFilter=function(e,t,r){var i=this;Array.isArray(e)||(e=[{field:e,type:t,value:r}]),e.forEach(function(e){var t=-1;t="object"==_typeof(e.field)?i.filterList.findIndex(function(t){return e===t}):i.filterList.findIndex(function(t){return e.field===t.field&&e.type===t.type&&e.value===t.value}),t>-1?(i.filterList.splice(t,1),i.changed=!0):console.warn("Filter Error - No matching filter type found, ignoring: ",e.type)}),this.table.options.persistence&&this.table.modExists("persistence",!0)&&this.table.modules.persistence.config.filter&&this.table.modules.persistence.save("filter")},Filter.prototype.clearFilter=function(e){this.filterList=[],e&&this.clearHeaderFilter(),this.changed=!0,this.table.options.persistence&&this.table.modExists("persistence",!0)&&this.table.modules.persistence.config.filter&&this.table.modules.persistence.save("filter")},Filter.prototype.clearHeaderFilter=function(){var e=this;this.headerFilters={},e.prevHeaderFilterChangeCheck="{}",this.headerFilterColumns.forEach(function(t){t.modules.filter.value=null,t.modules.filter.prevSuccess=void 0,e.reloadHeaderFilter(t)}),this.changed=!0},Filter.prototype.search=function(e,t,r,i){var n=this,l=[],o=[];return Array.isArray(t)||(t=[{field:t,type:r,value:i}]),t.forEach(function(e){(e=n.findFilter(e))&&o.push(e)}),this.table.rowManager.rows.forEach(function(t){var r=!0;o.forEach(function(e){n.filterRecurse(e,t.getData())||(r=!1)}),r&&l.push("data"===e?t.getData("data"):t.getComponent())}),l},Filter.prototype.filter=function(e,t){var r=this,i=[],n=[];return r.table.options.dataFiltering&&r.table.options.dataFiltering.call(r.table,r.getFilters()),r.table.options.ajaxFiltering||!r.filterList.length&&!Object.keys(r.headerFilters).length?i=e.slice(0):e.forEach(function(e){r.filterRow(e)&&i.push(e)}),r.table.options.dataFiltered&&(i.forEach(function(e){n.push(e.getComponent())}),r.table.options.dataFiltered.call(r.table,r.getFilters(),n)),i},Filter.prototype.filterRow=function(e,t){var r=this,i=!0,n=e.getData();r.filterList.forEach(function(e){r.filterRecurse(e,n)||(i=!1)});for(var l in r.headerFilters)r.headerFilters[l].func(n)||(i=!1);return i},Filter.prototype.filterRecurse=function(e,t){var r=this,i=!1;return Array.isArray(e)?e.forEach(function(e){r.filterRecurse(e,t)&&(i=!0)}):i=e.func(t),i},Filter.prototype.filters={"=":function(e,t,r,i){return t==e},"<":function(e,t,r,i){return t":function(e,t,r,i){return t>e},">=":function(e,t,r,i){return t>=e},"!=":function(e,t,r,i){return t!=e},regex:function(e,t,r,i){return"string"==typeof e&&(e=new RegExp(e)),e.test(t)},like:function(e,t,r,i){return null===e||void 0===e?t===e:void 0!==t&&null!==t&&String(t).toLowerCase().indexOf(e.toLowerCase())>-1},keywords:function(e,t,r,i){var n=e.toLowerCase().split(void 0===i.separator?" ":i.separator),l=String(null===t||void 0===t?"":t).toLowerCase(),o=[];return n.forEach(function(e){l.includes(e)&&o.push(!0)}),i.matchAll?o.length===n.length:!!o.length},starts:function(e,t,r,i){return null===e||void 0===e?t===e:void 0!==t&&null!==t&&String(t).toLowerCase().startsWith(e.toLowerCase())},ends:function(e,t,r,i){return null===e||void 0===e?t===e:void 0!==t&&null!==t&&String(t).toLowerCase().endsWith(e.toLowerCase())},in:function(e,t,r,i){return Array.isArray(e)?e.indexOf(t)>-1:(console.warn("Filter Error - filter value is not an array:",e),!1)}},Tabulator.prototype.registerModule("filter",Filter); \ No newline at end of file diff --git a/admin/js/vendors/tabulator/js/modules/format.js b/admin/js/vendors/tabulator/js/modules/format.js new file mode 100644 index 0000000..5714027 --- /dev/null +++ b/admin/js/vendors/tabulator/js/modules/format.js @@ -0,0 +1,725 @@ +var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; + +/* Tabulator v4.7.0 (c) Oliver Folkerd */ + +var Format = function Format(table) { + this.table = table; //hold Tabulator object +}; + +//initialize column formatter +Format.prototype.initializeColumn = function (column) { + column.modules.format = this.lookupFormatter(column, ""); + + if (typeof column.definition.formatterPrint !== "undefined") { + column.modules.format.print = this.lookupFormatter(column, "Print"); + } + + if (typeof column.definition.formatterClipboard !== "undefined") { + column.modules.format.clipboard = this.lookupFormatter(column, "Clipboard"); + } + + if (typeof column.definition.formatterHtmlOutput !== "undefined") { + column.modules.format.htmlOutput = this.lookupFormatter(column, "HtmlOutput"); + } +}; + +Format.prototype.lookupFormatter = function (column, type) { + var config = { params: column.definition["formatter" + type + "Params"] || {} }, + formatter = column.definition["formatter" + type]; + + //set column formatter + switch (typeof formatter === "undefined" ? "undefined" : _typeof(formatter)) { + case "string": + + if (formatter === "tick") { + formatter = "tickCross"; + + if (typeof config.params.crossElement == "undefined") { + config.params.crossElement = false; + } + + console.warn("DEPRECATION WARNING - the tick formatter has been deprecated, please use the tickCross formatter with the crossElement param set to false"); + } + + if (this.formatters[formatter]) { + config.formatter = this.formatters[formatter]; + } else { + console.warn("Formatter Error - No such formatter found: ", formatter); + config.formatter = this.formatters.plaintext; + } + break; + + case "function": + config.formatter = formatter; + break; + + default: + config.formatter = this.formatters.plaintext; + break; + } + + return config; +}; + +Format.prototype.cellRendered = function (cell) { + if (cell.modules.format && cell.modules.format.renderedCallback) { + cell.modules.format.renderedCallback(); + } +}; + +//return a formatted value for a cell +Format.prototype.formatValue = function (cell) { + var component = cell.getComponent(), + params = typeof cell.column.modules.format.params === "function" ? cell.column.modules.format.params(component) : cell.column.modules.format.params; + + function onRendered(callback) { + if (!cell.modules.format) { + cell.modules.format = {}; + } + + cell.modules.format.renderedCallback = callback; + } + + return cell.column.modules.format.formatter.call(this, component, params, onRendered); +}; + +Format.prototype.formatExportValue = function (cell, type) { + var formatter = cell.column.modules.format[type], + params; + + if (formatter) { + var onRendered = function onRendered(callback) { + if (!cell.modules.format) { + cell.modules.format = {}; + } + + cell.modules.format.renderedCallback = callback; + }; + + params = typeof formatter.params === "function" ? formatter.params(component) : formatter.params; + + return formatter.formatter.call(this, cell.getComponent(), params, onRendered); + } else { + return this.formatValue(cell); + } +}; + +Format.prototype.sanitizeHTML = function (value) { + if (value) { + var entityMap = { + '&': '&', + '<': '<', + '>': '>', + '"': '"', + "'": ''', + '/': '/', + '`': '`', + '=': '=' + }; + + return String(value).replace(/[&<>"'`=\/]/g, function (s) { + return entityMap[s]; + }); + } else { + return value; + } +}; + +Format.prototype.emptyToSpace = function (value) { + return value === null || typeof value === "undefined" || value === "" ? " " : value; +}; + +//get formatter for cell +Format.prototype.getFormatter = function (formatter) { + var formatter; + + switch (typeof formatter === "undefined" ? "undefined" : _typeof(formatter)) { + case "string": + if (this.formatters[formatter]) { + formatter = this.formatters[formatter]; + } else { + console.warn("Formatter Error - No such formatter found: ", formatter); + formatter = this.formatters.plaintext; + } + break; + + case "function": + formatter = formatter; + break; + + default: + formatter = this.formatters.plaintext; + break; + } + + return formatter; +}; + +//default data formatters +Format.prototype.formatters = { + //plain text value + plaintext: function plaintext(cell, formatterParams, onRendered) { + return this.emptyToSpace(this.sanitizeHTML(cell.getValue())); + }, + + //html text value + html: function html(cell, formatterParams, onRendered) { + return cell.getValue(); + }, + + //multiline text area + textarea: function textarea(cell, formatterParams, onRendered) { + cell.getElement().style.whiteSpace = "pre-wrap"; + return this.emptyToSpace(this.sanitizeHTML(cell.getValue())); + }, + + //currency formatting + money: function money(cell, formatterParams, onRendered) { + var floatVal = parseFloat(cell.getValue()), + number, + integer, + decimal, + rgx; + + var decimalSym = formatterParams.decimal || "."; + var thousandSym = formatterParams.thousand || ","; + var symbol = formatterParams.symbol || ""; + var after = !!formatterParams.symbolAfter; + var precision = typeof formatterParams.precision !== "undefined" ? formatterParams.precision : 2; + + if (isNaN(floatVal)) { + return this.emptyToSpace(this.sanitizeHTML(cell.getValue())); + } + + number = precision !== false ? floatVal.toFixed(precision) : floatVal; + number = String(number).split("."); + + integer = number[0]; + decimal = number.length > 1 ? decimalSym + number[1] : ""; + + rgx = /(\d+)(\d{3})/; + + while (rgx.test(integer)) { + integer = integer.replace(rgx, "$1" + thousandSym + "$2"); + } + + return after ? integer + decimal + symbol : symbol + integer + decimal; + }, + + //clickable anchor tag + link: function link(cell, formatterParams, onRendered) { + var value = cell.getValue(), + urlPrefix = formatterParams.urlPrefix || "", + download = formatterParams.download, + label = value, + el = document.createElement("a"), + data; + + if (formatterParams.labelField) { + data = cell.getData(); + label = data[formatterParams.labelField]; + } + + if (formatterParams.label) { + switch (_typeof(formatterParams.label)) { + case "string": + label = formatterParams.label; + break; + + case "function": + label = formatterParams.label(cell); + break; + } + } + + if (label) { + if (formatterParams.urlField) { + data = cell.getData(); + value = data[formatterParams.urlField]; + } + + if (formatterParams.url) { + switch (_typeof(formatterParams.url)) { + case "string": + value = formatterParams.url; + break; + + case "function": + value = formatterParams.url(cell); + break; + } + } + + el.setAttribute("href", urlPrefix + value); + + if (formatterParams.target) { + el.setAttribute("target", formatterParams.target); + } + + if (formatterParams.download) { + + if (typeof download == "function") { + download = download(cell); + } else { + download = download === true ? "" : download; + } + + el.setAttribute("download", download); + } + + el.innerHTML = this.emptyToSpace(this.sanitizeHTML(label)); + + return el; + } else { + return " "; + } + }, + + //image element + image: function image(cell, formatterParams, onRendered) { + var el = document.createElement("img"); + el.setAttribute("src", cell.getValue()); + + switch (_typeof(formatterParams.height)) { + case "number": + el.style.height = formatterParams.height + "px"; + break; + + case "string": + el.style.height = formatterParams.height; + break; + } + + switch (_typeof(formatterParams.width)) { + case "number": + el.style.width = formatterParams.width + "px"; + break; + + case "string": + el.style.width = formatterParams.width; + break; + } + + el.addEventListener("load", function () { + cell.getRow().normalizeHeight(); + }); + + return el; + }, + + //tick or cross + tickCross: function tickCross(cell, formatterParams, onRendered) { + var value = cell.getValue(), + element = cell.getElement(), + empty = formatterParams.allowEmpty, + truthy = formatterParams.allowTruthy, + tick = typeof formatterParams.tickElement !== "undefined" ? formatterParams.tickElement : '', + cross = typeof formatterParams.crossElement !== "undefined" ? formatterParams.crossElement : ''; + + if (truthy && value || value === true || value === "true" || value === "True" || value === 1 || value === "1") { + element.setAttribute("aria-checked", true); + return tick || ""; + } else { + if (empty && (value === "null" || value === "" || value === null || typeof value === "undefined")) { + element.setAttribute("aria-checked", "mixed"); + return ""; + } else { + element.setAttribute("aria-checked", false); + return cross || ""; + } + } + }, + + datetime: function datetime(cell, formatterParams, onRendered) { + var inputFormat = formatterParams.inputFormat || "YYYY-MM-DD hh:mm:ss"; + var outputFormat = formatterParams.outputFormat || "DD/MM/YYYY hh:mm:ss"; + var invalid = typeof formatterParams.invalidPlaceholder !== "undefined" ? formatterParams.invalidPlaceholder : ""; + var value = cell.getValue(); + + var newDatetime = moment(value, inputFormat); + + if (newDatetime.isValid()) { + return formatterParams.timezone ? newDatetime.tz(formatterParams.timezone).format(outputFormat) : newDatetime.format(outputFormat); + } else { + + if (invalid === true) { + return value; + } else if (typeof invalid === "function") { + return invalid(value); + } else { + return invalid; + } + } + }, + + datetimediff: function datetime(cell, formatterParams, onRendered) { + var inputFormat = formatterParams.inputFormat || "YYYY-MM-DD hh:mm:ss"; + var invalid = typeof formatterParams.invalidPlaceholder !== "undefined" ? formatterParams.invalidPlaceholder : ""; + var suffix = typeof formatterParams.suffix !== "undefined" ? formatterParams.suffix : false; + var unit = typeof formatterParams.unit !== "undefined" ? formatterParams.unit : undefined; + var humanize = typeof formatterParams.humanize !== "undefined" ? formatterParams.humanize : false; + var date = typeof formatterParams.date !== "undefined" ? formatterParams.date : moment(); + var value = cell.getValue(); + + var newDatetime = moment(value, inputFormat); + + if (newDatetime.isValid()) { + if (humanize) { + return moment.duration(newDatetime.diff(date)).humanize(suffix); + } else { + return newDatetime.diff(date, unit) + (suffix ? " " + suffix : ""); + } + } else { + + if (invalid === true) { + return value; + } else if (typeof invalid === "function") { + return invalid(value); + } else { + return invalid; + } + } + }, + + //select + lookup: function lookup(cell, formatterParams, onRendered) { + var value = cell.getValue(); + + if (typeof formatterParams[value] === "undefined") { + console.warn('Missing display value for ' + value); + return value; + } + + return formatterParams[value]; + }, + + //star rating + star: function star(cell, formatterParams, onRendered) { + var value = cell.getValue(), + element = cell.getElement(), + maxStars = formatterParams && formatterParams.stars ? formatterParams.stars : 5, + stars = document.createElement("span"), + star = document.createElementNS('http://www.w3.org/2000/svg', "svg"), + starActive = '', + starInactive = ''; + + //style stars holder + stars.style.verticalAlign = "middle"; + + //style star + star.setAttribute("width", "14"); + star.setAttribute("height", "14"); + star.setAttribute("viewBox", "0 0 512 512"); + star.setAttribute("xml:space", "preserve"); + star.style.padding = "0 1px"; + + value = value && !isNaN(value) ? parseInt(value) : 0; + + value = Math.max(0, Math.min(value, maxStars)); + + for (var i = 1; i <= maxStars; i++) { + var nextStar = star.cloneNode(true); + nextStar.innerHTML = i <= value ? starActive : starInactive; + + stars.appendChild(nextStar); + } + + element.style.whiteSpace = "nowrap"; + element.style.overflow = "hidden"; + element.style.textOverflow = "ellipsis"; + + element.setAttribute("aria-label", value); + + return stars; + }, + + traffic: function traffic(cell, formatterParams, onRendered) { + var value = this.sanitizeHTML(cell.getValue()) || 0, + el = document.createElement("span"), + max = formatterParams && formatterParams.max ? formatterParams.max : 100, + min = formatterParams && formatterParams.min ? formatterParams.min : 0, + colors = formatterParams && typeof formatterParams.color !== "undefined" ? formatterParams.color : ["red", "orange", "green"], + color = "#666666", + percent, + percentValue; + + if (isNaN(value) || typeof cell.getValue() === "undefined") { + return; + } + + el.classList.add("tabulator-traffic-light"); + + //make sure value is in range + percentValue = parseFloat(value) <= max ? parseFloat(value) : max; + percentValue = parseFloat(percentValue) >= min ? parseFloat(percentValue) : min; + + //workout percentage + percent = (max - min) / 100; + percentValue = Math.round((percentValue - min) / percent); + + //set color + switch (typeof colors === "undefined" ? "undefined" : _typeof(colors)) { + case "string": + color = colors; + break; + case "function": + color = colors(value); + break; + case "object": + if (Array.isArray(colors)) { + var unit = 100 / colors.length; + var index = Math.floor(percentValue / unit); + + index = Math.min(index, colors.length - 1); + index = Math.max(index, 0); + color = colors[index]; + break; + } + } + + el.style.backgroundColor = color; + + return el; + }, + + //progress bar + progress: function progress(cell, formatterParams, onRendered) { + //progress bar + var value = this.sanitizeHTML(cell.getValue()) || 0, + element = cell.getElement(), + max = formatterParams && formatterParams.max ? formatterParams.max : 100, + min = formatterParams && formatterParams.min ? formatterParams.min : 0, + legendAlign = formatterParams && formatterParams.legendAlign ? formatterParams.legendAlign : "center", + percent, + percentValue, + color, + legend, + legendColor, + top, + left, + right, + bottom; + + //make sure value is in range + percentValue = parseFloat(value) <= max ? parseFloat(value) : max; + percentValue = parseFloat(percentValue) >= min ? parseFloat(percentValue) : min; + + //workout percentage + percent = (max - min) / 100; + percentValue = Math.round((percentValue - min) / percent); + + //set bar color + switch (_typeof(formatterParams.color)) { + case "string": + color = formatterParams.color; + break; + case "function": + color = formatterParams.color(value); + break; + case "object": + if (Array.isArray(formatterParams.color)) { + var unit = 100 / formatterParams.color.length; + var index = Math.floor(percentValue / unit); + + index = Math.min(index, formatterParams.color.length - 1); + index = Math.max(index, 0); + color = formatterParams.color[index]; + break; + } + default: + color = "#2DC214"; + } + + //generate legend + switch (_typeof(formatterParams.legend)) { + case "string": + legend = formatterParams.legend; + break; + case "function": + legend = formatterParams.legend(value); + break; + case "boolean": + legend = value; + break; + default: + legend = false; + } + + //set legend color + switch (_typeof(formatterParams.legendColor)) { + case "string": + legendColor = formatterParams.legendColor; + break; + case "function": + legendColor = formatterParams.legendColor(value); + break; + case "object": + if (Array.isArray(formatterParams.legendColor)) { + var unit = 100 / formatterParams.legendColor.length; + var index = Math.floor(percentValue / unit); + + index = Math.min(index, formatterParams.legendColor.length - 1); + index = Math.max(index, 0); + legendColor = formatterParams.legendColor[index]; + } + break; + default: + legendColor = "#000"; + } + + element.style.minWidth = "30px"; + element.style.position = "relative"; + + element.setAttribute("aria-label", percentValue); + + var barEl = document.createElement("div"); + barEl.style.display = "inline-block"; + barEl.style.position = "relative"; + barEl.style.width = percentValue + "%"; + barEl.style.backgroundColor = color; + barEl.style.height = "100%"; + + barEl.setAttribute('data-max', max); + barEl.setAttribute('data-min', min); + + if (legend) { + var legendEl = document.createElement("div"); + legendEl.style.position = "absolute"; + legendEl.style.top = "4px"; + legendEl.style.left = 0; + legendEl.style.textAlign = legendAlign; + legendEl.style.width = "100%"; + legendEl.style.color = legendColor; + legendEl.innerHTML = legend; + } + + onRendered(function () { + + //handle custom element needed if formatter is to be included in printed/downloaded output + if (!(cell instanceof CellComponent)) { + var holderEl = document.createElement("div"); + holderEl.style.position = "absolute"; + holderEl.style.top = "4px"; + holderEl.style.bottom = "4px"; + holderEl.style.left = "4px"; + holderEl.style.right = "4px"; + + element.appendChild(holderEl); + + element = holderEl; + } + + element.appendChild(barEl); + + if (legend) { + element.appendChild(legendEl); + } + }); + + return ""; + }, + + //background color + color: function color(cell, formatterParams, onRendered) { + cell.getElement().style.backgroundColor = this.sanitizeHTML(cell.getValue()); + return ""; + }, + + //tick icon + buttonTick: function buttonTick(cell, formatterParams, onRendered) { + return ''; + }, + + //cross icon + buttonCross: function buttonCross(cell, formatterParams, onRendered) { + return ''; + }, + + //current row number + rownum: function rownum(cell, formatterParams, onRendered) { + return this.table.rowManager.activeRows.indexOf(cell.getRow()._getSelf()) + 1; + }, + + //row handle + handle: function handle(cell, formatterParams, onRendered) { + cell.getElement().classList.add("tabulator-row-handle"); + return "
"; + }, + + responsiveCollapse: function responsiveCollapse(cell, formatterParams, onRendered) { + var self = this, + open = false, + el = document.createElement("div"), + config = cell.getRow()._row.modules.responsiveLayout; + + el.classList.add("tabulator-responsive-collapse-toggle"); + el.innerHTML = "+-"; + + cell.getElement().classList.add("tabulator-row-handle"); + + function toggleList(isOpen) { + var collapseEl = config.element; + + config.open = isOpen; + + if (collapseEl) { + + if (config.open) { + el.classList.add("open"); + collapseEl.style.display = ''; + } else { + el.classList.remove("open"); + collapseEl.style.display = 'none'; + } + } + } + + el.addEventListener("click", function (e) { + e.stopImmediatePropagation(); + toggleList(!config.open); + }); + + toggleList(config.open); + + return el; + }, + + rowSelection: function rowSelection(cell) { + var _this = this; + + var checkbox = document.createElement("input"); + + checkbox.type = 'checkbox'; + + if (this.table.modExists("selectRow", true)) { + + checkbox.addEventListener("click", function (e) { + e.stopPropagation(); + }); + + if (typeof cell.getRow == 'function') { + var row = cell.getRow(); + + checkbox.addEventListener("change", function (e) { + row.toggleSelect(); + }); + + checkbox.checked = row.isSelected(); + this.table.modules.selectRow.registerRowSelectCheckbox(row, checkbox); + } else { + checkbox.addEventListener("change", function (e) { + if (_this.table.modules.selectRow.selectedRows.length) { + _this.table.deselectRow(); + } else { + _this.table.selectRow(); + } + }); + + this.table.modules.selectRow.registerHeaderSelectCheckbox(checkbox); + } + } + return checkbox; + } +}; + +Tabulator.prototype.registerModule("format", Format); \ No newline at end of file diff --git a/admin/js/vendors/tabulator/js/modules/format.min.js b/admin/js/vendors/tabulator/js/modules/format.min.js new file mode 100644 index 0000000..0b39b61 --- /dev/null +++ b/admin/js/vendors/tabulator/js/modules/format.min.js @@ -0,0 +1,2 @@ +/* Tabulator v4.7.0 (c) Oliver Folkerd */ +var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Format=function(e){this.table=e};Format.prototype.initializeColumn=function(e){e.modules.format=this.lookupFormatter(e,""),void 0!==e.definition.formatterPrint&&(e.modules.format.print=this.lookupFormatter(e,"Print")),void 0!==e.definition.formatterClipboard&&(e.modules.format.clipboard=this.lookupFormatter(e,"Clipboard")),void 0!==e.definition.formatterHtmlOutput&&(e.modules.format.htmlOutput=this.lookupFormatter(e,"HtmlOutput"))},Format.prototype.lookupFormatter=function(e,t){var o={params:e.definition["formatter"+t+"Params"]||{}},r=e.definition["formatter"+t];switch(void 0===r?"undefined":_typeof(r)){case"string":"tick"===r&&(r="tickCross",void 0===o.params.crossElement&&(o.params.crossElement=!1),console.warn("DEPRECATION WARNING - the tick formatter has been deprecated, please use the tickCross formatter with the crossElement param set to false")),this.formatters[r]?o.formatter=this.formatters[r]:(console.warn("Formatter Error - No such formatter found: ",r),o.formatter=this.formatters.plaintext);break;case"function":o.formatter=r;break;default:o.formatter=this.formatters.plaintext}return o},Format.prototype.cellRendered=function(e){e.modules.format&&e.modules.format.renderedCallback&&e.modules.format.renderedCallback()},Format.prototype.formatValue=function(e){function t(t){e.modules.format||(e.modules.format={}),e.modules.format.renderedCallback=t}var o=e.getComponent(),r="function"==typeof e.column.modules.format.params?e.column.modules.format.params(o):e.column.modules.format.params;return e.column.modules.format.formatter.call(this,o,r,t)},Format.prototype.formatExportValue=function(e,t){var o,r=e.column.modules.format[t];if(r){var a=function(t){e.modules.format||(e.modules.format={}),e.modules.format.renderedCallback=t};return o="function"==typeof r.params?r.params(component):r.params,r.formatter.call(this,e.getComponent(),o,a)}return this.formatValue(e)},Format.prototype.sanitizeHTML=function(e){if(e){var t={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/","`":"`","=":"="};return String(e).replace(/[&<>"'`=\/]/g,function(e){return t[e]})}return e},Format.prototype.emptyToSpace=function(e){return null===e||void 0===e||""===e?" ":e},Format.prototype.getFormatter=function(e){var e;switch(void 0===e?"undefined":_typeof(e)){case"string":this.formatters[e]?e=this.formatters[e]:(console.warn("Formatter Error - No such formatter found: ",e),e=this.formatters.plaintext);break;case"function":e=e;break;default:e=this.formatters.plaintext}return e},Format.prototype.formatters={plaintext:function(e,t,o){return this.emptyToSpace(this.sanitizeHTML(e.getValue()))},html:function(e,t,o){return e.getValue()},textarea:function(e,t,o){return e.getElement().style.whiteSpace="pre-wrap",this.emptyToSpace(this.sanitizeHTML(e.getValue()))},money:function(e,t,o){var r,a,n,l,i=parseFloat(e.getValue()),s=t.decimal||".",c=t.thousand||",",u=t.symbol||"",d=!!t.symbolAfter,m=void 0!==t.precision?t.precision:2;if(isNaN(i))return this.emptyToSpace(this.sanitizeHTML(e.getValue()));for(r=!1!==m?i.toFixed(m):i,r=String(r).split("."),a=r[0],n=r.length>1?s+r[1]:"",l=/(\d+)(\d{3})/;l.test(a);)a=a.replace(l,"$1"+c+"$2");return d?a+n+u:u+a+n},link:function(e,t,o){var r,a=e.getValue(),n=t.urlPrefix||"",l=t.download,i=a,s=document.createElement("a");if(t.labelField&&(r=e.getData(),i=r[t.labelField]),t.label)switch(_typeof(t.label)){case"string":i=t.label;break;case"function":i=t.label(e)}if(i){if(t.urlField&&(r=e.getData(),a=r[t.urlField]),t.url)switch(_typeof(t.url)){case"string":a=t.url;break;case"function":a=t.url(e)}return s.setAttribute("href",n+a),t.target&&s.setAttribute("target",t.target),t.download&&(l="function"==typeof l?l(e):!0===l?"":l,s.setAttribute("download",l)),s.innerHTML=this.emptyToSpace(this.sanitizeHTML(i)),s}return" "},image:function(e,t,o){var r=document.createElement("img");switch(r.setAttribute("src",e.getValue()),_typeof(t.height)){case"number":r.style.height=t.height+"px";break;case"string":r.style.height=t.height}switch(_typeof(t.width)){case"number":r.style.width=t.width+"px";break;case"string":r.style.width=t.width}return r.addEventListener("load",function(){e.getRow().normalizeHeight()}),r},tickCross:function(e,t,o){var r=e.getValue(),a=e.getElement(),n=t.allowEmpty,l=t.allowTruthy,i=void 0!==t.tickElement?t.tickElement:'',s=void 0!==t.crossElement?t.crossElement:'';return l&&r||!0===r||"true"===r||"True"===r||1===r||"1"===r?(a.setAttribute("aria-checked",!0),i||""):!n||"null"!==r&&""!==r&&null!==r&&void 0!==r?(a.setAttribute("aria-checked",!1),s||""):(a.setAttribute("aria-checked","mixed"),"")},datetime:function(e,t,o){var r=t.inputFormat||"YYYY-MM-DD hh:mm:ss",a=t.outputFormat||"DD/MM/YYYY hh:mm:ss",n=void 0!==t.invalidPlaceholder?t.invalidPlaceholder:"",l=e.getValue(),i=moment(l,r);return i.isValid()?t.timezone?i.tz(t.timezone).format(a):i.format(a):!0===n?l:"function"==typeof n?n(l):n},datetimediff:function(e,t,o){var r=t.inputFormat||"YYYY-MM-DD hh:mm:ss",a=void 0!==t.invalidPlaceholder?t.invalidPlaceholder:"",n=void 0!==t.suffix&&t.suffix,l=void 0!==t.unit?t.unit:void 0,i=void 0!==t.humanize&&t.humanize,s=void 0!==t.date?t.date:moment(),c=e.getValue(),u=moment(c,r);return u.isValid()?i?moment.duration(u.diff(s)).humanize(n):u.diff(s,l)+(n?" "+n:""):!0===a?c:"function"==typeof a?a(c):a},lookup:function(e,t,o){var r=e.getValue();return void 0===t[r]?(console.warn("Missing display value for "+r),r):t[r]},star:function(e,t,o){var r=e.getValue(),a=e.getElement(),n=t&&t.stars?t.stars:5,l=document.createElement("span"),i=document.createElementNS("http://www.w3.org/2000/svg","svg");l.style.verticalAlign="middle",i.setAttribute("width","14"),i.setAttribute("height","14"),i.setAttribute("viewBox","0 0 512 512"),i.setAttribute("xml:space","preserve"),i.style.padding="0 1px",r=r&&!isNaN(r)?parseInt(r):0,r=Math.max(0,Math.min(r,n));for(var s=1;s<=n;s++){var c=i.cloneNode(!0);c.innerHTML=s<=r?'':'',l.appendChild(c)}return a.style.whiteSpace="nowrap",a.style.overflow="hidden",a.style.textOverflow="ellipsis",a.setAttribute("aria-label",r),l},traffic:function(e,t,o){var r,a,n=this.sanitizeHTML(e.getValue())||0,l=document.createElement("span"),i=t&&t.max?t.max:100,s=t&&t.min?t.min:0,c=t&&void 0!==t.color?t.color:["red","orange","green"],u="#666666";if(!isNaN(n)&&void 0!==e.getValue()){switch(l.classList.add("tabulator-traffic-light"),a=parseFloat(n)<=i?parseFloat(n):i,a=parseFloat(a)>=s?parseFloat(a):s,r=(i-s)/100,a=Math.round((a-s)/r),void 0===c?"undefined":_typeof(c)){case"string":u=c;break;case"function":u=c(n);break;case"object":if(Array.isArray(c)){var d=100/c.length,m=Math.floor(a/d);m=Math.min(m,c.length-1),m=Math.max(m,0),u=c[m];break}}return l.style.backgroundColor=u,l}},progress:function(e,t,o){var r,a,n,l,i,s=this.sanitizeHTML(e.getValue())||0,c=e.getElement(),u=t&&t.max?t.max:100,d=t&&t.min?t.min:0,m=t&&t.legendAlign?t.legendAlign:"center";switch(a=parseFloat(s)<=u?parseFloat(s):u,a=parseFloat(a)>=d?parseFloat(a):d,r=(u-d)/100,a=Math.round((a-d)/r),_typeof(t.color)){case"string":n=t.color;break;case"function":n=t.color(s);break;case"object":if(Array.isArray(t.color)){var p=100/t.color.length,f=Math.floor(a/p);f=Math.min(f,t.color.length-1),f=Math.max(f,0),n=t.color[f];break}default:n="#2DC214"}switch(_typeof(t.legend)){case"string":l=t.legend;break;case"function":l=t.legend(s);break;case"boolean":l=s;break;default:l=!1}switch(_typeof(t.legendColor)){case"string":i=t.legendColor;break;case"function":i=t.legendColor(s);break;case"object":if(Array.isArray(t.legendColor)){var p=100/t.legendColor.length,f=Math.floor(a/p);f=Math.min(f,t.legendColor.length-1),f=Math.max(f,0),i=t.legendColor[f]}break;default:i="#000"}c.style.minWidth="30px",c.style.position="relative",c.setAttribute("aria-label",a);var h=document.createElement("div");if(h.style.display="inline-block",h.style.position="relative",h.style.width=a+"%",h.style.backgroundColor=n,h.style.height="100%",h.setAttribute("data-max",u),h.setAttribute("data-min",d),l){var g=document.createElement("div");g.style.position="absolute",g.style.top="4px",g.style.left=0,g.style.textAlign=m,g.style.width="100%",g.style.color=i,g.innerHTML=l}return o(function(){if(!(e instanceof CellComponent)){var t=document.createElement("div");t.style.position="absolute",t.style.top="4px",t.style.bottom="4px",t.style.left="4px",t.style.right="4px",c.appendChild(t),c=t}c.appendChild(h),l&&c.appendChild(g)}),""},color:function(e,t,o){return e.getElement().style.backgroundColor=this.sanitizeHTML(e.getValue()),""},buttonTick:function(e,t,o){return''},buttonCross:function(e,t,o){return''},rownum:function(e,t,o){return this.table.rowManager.activeRows.indexOf(e.getRow()._getSelf())+1},handle:function(e,t,o){return e.getElement().classList.add("tabulator-row-handle"),"
"},responsiveCollapse:function(e,t,o){function r(e){var t=n.element;n.open=e,t&&(n.open?(a.classList.add("open"),t.style.display=""):(a.classList.remove("open"),t.style.display="none"))}var a=document.createElement("div"),n=e.getRow()._row.modules.responsiveLayout;return a.classList.add("tabulator-responsive-collapse-toggle"),a.innerHTML="+-",e.getElement().classList.add("tabulator-row-handle"),a.addEventListener("click",function(e){e.stopImmediatePropagation(),r(!n.open)}),r(n.open),a},rowSelection:function(e){var t=this,o=document.createElement("input");if(o.type="checkbox",this.table.modExists("selectRow",!0))if(o.addEventListener("click",function(e){e.stopPropagation()}),"function"==typeof e.getRow){var r=e.getRow();o.addEventListener("change",function(e){r.toggleSelect()}),o.checked=r.isSelected(),this.table.modules.selectRow.registerRowSelectCheckbox(r,o)}else o.addEventListener("change",function(e){t.table.modules.selectRow.selectedRows.length?t.table.deselectRow():t.table.selectRow()}),this.table.modules.selectRow.registerHeaderSelectCheckbox(o);return o}},Tabulator.prototype.registerModule("format",Format); \ No newline at end of file diff --git a/admin/js/vendors/tabulator/js/modules/frozen_columns.js b/admin/js/vendors/tabulator/js/modules/frozen_columns.js new file mode 100644 index 0000000..fdbc4ab --- /dev/null +++ b/admin/js/vendors/tabulator/js/modules/frozen_columns.js @@ -0,0 +1,275 @@ +/* Tabulator v4.7.0 (c) Oliver Folkerd */ + +var FrozenColumns = function FrozenColumns(table) { + this.table = table; //hold Tabulator object + this.leftColumns = []; + this.rightColumns = []; + this.leftMargin = 0; + this.rightMargin = 0; + this.rightPadding = 0; + this.initializationMode = "left"; + this.active = false; + this.scrollEndTimer = false; +}; + +//reset initial state +FrozenColumns.prototype.reset = function () { + this.initializationMode = "left"; + this.leftColumns = []; + this.rightColumns = []; + this.leftMargin = 0; + this.rightMargin = 0; + this.rightMargin = 0; + this.active = false; + + this.table.columnManager.headersElement.style.marginLeft = 0; + this.table.columnManager.element.style.paddingRight = 0; +}; + +//initialize specific column +FrozenColumns.prototype.initializeColumn = function (column) { + var config = { margin: 0, edge: false }; + + if (!column.isGroup) { + + if (this.frozenCheck(column)) { + + config.position = this.initializationMode; + + if (this.initializationMode == "left") { + this.leftColumns.push(column); + } else { + this.rightColumns.unshift(column); + } + + this.active = true; + + column.modules.frozen = config; + } else { + this.initializationMode = "right"; + } + } +}; + +FrozenColumns.prototype.frozenCheck = function (column) { + var frozen = false; + + if (column.parent.isGroup && column.definition.frozen) { + console.warn("Frozen Column Error - Parent column group must be frozen, not individual columns or sub column groups"); + } + + if (column.parent.isGroup) { + return this.frozenCheck(column.parent); + } else { + return column.definition.frozen; + } + + return frozen; +}; + +//quick layout to smooth horizontal scrolling +FrozenColumns.prototype.scrollHorizontal = function () { + var _this = this; + + var rows; + + if (this.active) { + clearTimeout(this.scrollEndTimer); + + //layout all rows after scroll is complete + this.scrollEndTimer = setTimeout(function () { + _this.layout(); + }, 100); + + rows = this.table.rowManager.getVisibleRows(); + + this.calcMargins(); + + this.layoutColumnPosition(); + + this.layoutCalcRows(); + + rows.forEach(function (row) { + if (row.type === "row") { + _this.layoutRow(row); + } + }); + + this.table.rowManager.tableElement.style.marginRight = this.rightMargin; + } +}; + +//calculate margins for rows +FrozenColumns.prototype.calcMargins = function () { + this.leftMargin = this._calcSpace(this.leftColumns, this.leftColumns.length) + "px"; + this.table.columnManager.headersElement.style.marginLeft = this.leftMargin; + + this.rightMargin = this._calcSpace(this.rightColumns, this.rightColumns.length) + "px"; + this.table.columnManager.element.style.paddingRight = this.rightMargin; + + //calculate right frozen columns + this.rightPadding = this.table.rowManager.element.clientWidth + this.table.columnManager.scrollLeft; +}; + +//layout calculation rows +FrozenColumns.prototype.layoutCalcRows = function () { + if (this.table.modExists("columnCalcs")) { + if (this.table.modules.columnCalcs.topInitialized && this.table.modules.columnCalcs.topRow) { + this.layoutRow(this.table.modules.columnCalcs.topRow); + } + if (this.table.modules.columnCalcs.botInitialized && this.table.modules.columnCalcs.botRow) { + this.layoutRow(this.table.modules.columnCalcs.botRow); + } + } +}; + +//calculate column positions and layout headers +FrozenColumns.prototype.layoutColumnPosition = function (allCells) { + var _this2 = this; + + var leftParents = []; + + this.leftColumns.forEach(function (column, i) { + column.modules.frozen.margin = _this2._calcSpace(_this2.leftColumns, i) + _this2.table.columnManager.scrollLeft + "px"; + + if (i == _this2.leftColumns.length - 1) { + column.modules.frozen.edge = true; + } else { + column.modules.frozen.edge = false; + } + + if (column.parent.isGroup) { + var parentEl = _this2.getColGroupParentElement(column); + if (!leftParents.includes(parentEl)) { + _this2.layoutElement(parentEl, column); + leftParents.push(parentEl); + } + + if (column.modules.frozen.edge) { + parentEl.classList.add("tabulator-frozen-" + column.modules.frozen.position); + } + } else { + _this2.layoutElement(column.getElement(), column); + } + + if (allCells) { + column.cells.forEach(function (cell) { + _this2.layoutElement(cell.getElement(), column); + }); + } + }); + + this.rightColumns.forEach(function (column, i) { + column.modules.frozen.margin = _this2.rightPadding - _this2._calcSpace(_this2.rightColumns, i + 1) + "px"; + + if (i == _this2.rightColumns.length - 1) { + column.modules.frozen.edge = true; + } else { + column.modules.frozen.edge = false; + } + + if (column.parent.isGroup) { + _this2.layoutElement(_this2.getColGroupParentElement(column), column); + } else { + _this2.layoutElement(column.getElement(), column); + } + + if (allCells) { + column.cells.forEach(function (cell) { + _this2.layoutElement(cell.getElement(), column); + }); + } + }); +}; + +FrozenColumns.prototype.getColGroupParentElement = function (column) { + return column.parent.isGroup ? this.getColGroupParentElement(column.parent) : column.getElement(); +}; + +//layout columns appropropriatly +FrozenColumns.prototype.layout = function () { + var self = this, + rightMargin = 0; + + if (self.active) { + + //calculate row padding + this.calcMargins(); + + // self.table.rowManager.activeRows.forEach(function(row){ + // self.layoutRow(row); + // }); + + // if(self.table.options.dataTree){ + self.table.rowManager.getDisplayRows().forEach(function (row) { + if (row.type === "row") { + self.layoutRow(row); + } + }); + // } + + this.layoutCalcRows(); + + //calculate left columns + this.layoutColumnPosition(true); + + // if(tableHolder.scrollHeight > tableHolder.clientHeight){ + // rightMargin -= tableHolder.offsetWidth - tableHolder.clientWidth; + // } + + this.table.rowManager.tableElement.style.marginRight = this.rightMargin; + } +}; + +FrozenColumns.prototype.layoutRow = function (row) { + var _this3 = this; + + var rowEl = row.getElement(); + + rowEl.style.paddingLeft = this.leftMargin; + // rowEl.style.paddingRight = this.rightMargin + "px"; + + this.leftColumns.forEach(function (column) { + var cell = row.getCell(column); + + if (cell) { + _this3.layoutElement(cell.getElement(), column); + } + }); + + this.rightColumns.forEach(function (column) { + var cell = row.getCell(column); + + if (cell) { + _this3.layoutElement(cell.getElement(), column); + } + }); +}; + +FrozenColumns.prototype.layoutElement = function (element, column) { + + if (column.modules.frozen) { + element.style.position = "absolute"; + element.style.left = column.modules.frozen.margin; + + element.classList.add("tabulator-frozen"); + + if (column.modules.frozen.edge) { + element.classList.add("tabulator-frozen-" + column.modules.frozen.position); + } + } +}; + +FrozenColumns.prototype._calcSpace = function (columns, index) { + var width = 0; + + for (var i = 0; i < index; i++) { + if (columns[i].visible) { + width += columns[i].getWidth(); + } + } + + return width; +}; + +Tabulator.prototype.registerModule("frozenColumns", FrozenColumns); \ No newline at end of file diff --git a/admin/js/vendors/tabulator/js/modules/frozen_columns.min.js b/admin/js/vendors/tabulator/js/modules/frozen_columns.min.js new file mode 100644 index 0000000..bf2bb60 --- /dev/null +++ b/admin/js/vendors/tabulator/js/modules/frozen_columns.min.js @@ -0,0 +1,2 @@ +/* Tabulator v4.7.0 (c) Oliver Folkerd */ +var FrozenColumns=function(t){this.table=t,this.leftColumns=[],this.rightColumns=[],this.leftMargin=0,this.rightMargin=0,this.rightPadding=0,this.initializationMode="left",this.active=!1,this.scrollEndTimer=!1};FrozenColumns.prototype.reset=function(){this.initializationMode="left",this.leftColumns=[],this.rightColumns=[],this.leftMargin=0,this.rightMargin=0,this.rightMargin=0,this.active=!1,this.table.columnManager.headersElement.style.marginLeft=0,this.table.columnManager.element.style.paddingRight=0},FrozenColumns.prototype.initializeColumn=function(t){var e={margin:0,edge:!1};t.isGroup||(this.frozenCheck(t)?(e.position=this.initializationMode,"left"==this.initializationMode?this.leftColumns.push(t):this.rightColumns.unshift(t),this.active=!0,t.modules.frozen=e):this.initializationMode="right")},FrozenColumns.prototype.frozenCheck=function(t){return t.parent.isGroup&&t.definition.frozen&&console.warn("Frozen Column Error - Parent column group must be frozen, not individual columns or sub column groups"),t.parent.isGroup?this.frozenCheck(t.parent):t.definition.frozen},FrozenColumns.prototype.scrollHorizontal=function(){var t,e=this;this.active&&(clearTimeout(this.scrollEndTimer),this.scrollEndTimer=setTimeout(function(){e.layout()},100),t=this.table.rowManager.getVisibleRows(),this.calcMargins(),this.layoutColumnPosition(),this.layoutCalcRows(),t.forEach(function(t){"row"===t.type&&e.layoutRow(t)}),this.table.rowManager.tableElement.style.marginRight=this.rightMargin)},FrozenColumns.prototype.calcMargins=function(){this.leftMargin=this._calcSpace(this.leftColumns,this.leftColumns.length)+"px",this.table.columnManager.headersElement.style.marginLeft=this.leftMargin,this.rightMargin=this._calcSpace(this.rightColumns,this.rightColumns.length)+"px",this.table.columnManager.element.style.paddingRight=this.rightMargin,this.rightPadding=this.table.rowManager.element.clientWidth+this.table.columnManager.scrollLeft},FrozenColumns.prototype.layoutCalcRows=function(){this.table.modExists("columnCalcs")&&(this.table.modules.columnCalcs.topInitialized&&this.table.modules.columnCalcs.topRow&&this.layoutRow(this.table.modules.columnCalcs.topRow),this.table.modules.columnCalcs.botInitialized&&this.table.modules.columnCalcs.botRow&&this.layoutRow(this.table.modules.columnCalcs.botRow))},FrozenColumns.prototype.layoutColumnPosition=function(t){var e=this,o=[];this.leftColumns.forEach(function(n,l){if(n.modules.frozen.margin=e._calcSpace(e.leftColumns,l)+e.table.columnManager.scrollLeft+"px",l==e.leftColumns.length-1?n.modules.frozen.edge=!0:n.modules.frozen.edge=!1,n.parent.isGroup){var i=e.getColGroupParentElement(n);o.includes(i)||(e.layoutElement(i,n),o.push(i)),n.modules.frozen.edge&&i.classList.add("tabulator-frozen-"+n.modules.frozen.position)}else e.layoutElement(n.getElement(),n);t&&n.cells.forEach(function(t){e.layoutElement(t.getElement(),n)})}),this.rightColumns.forEach(function(o,n){o.modules.frozen.margin=e.rightPadding-e._calcSpace(e.rightColumns,n+1)+"px",n==e.rightColumns.length-1?o.modules.frozen.edge=!0:o.modules.frozen.edge=!1,o.parent.isGroup?e.layoutElement(e.getColGroupParentElement(o),o):e.layoutElement(o.getElement(),o),t&&o.cells.forEach(function(t){e.layoutElement(t.getElement(),o)})})},FrozenColumns.prototype.getColGroupParentElement=function(t){return t.parent.isGroup?this.getColGroupParentElement(t.parent):t.getElement()},FrozenColumns.prototype.layout=function(){var t=this;t.active&&(this.calcMargins(),t.table.rowManager.getDisplayRows().forEach(function(e){"row"===e.type&&t.layoutRow(e)}),this.layoutCalcRows(),this.layoutColumnPosition(!0),this.table.rowManager.tableElement.style.marginRight=this.rightMargin)},FrozenColumns.prototype.layoutRow=function(t){var e=this;t.getElement().style.paddingLeft=this.leftMargin,this.leftColumns.forEach(function(o){var n=t.getCell(o);n&&e.layoutElement(n.getElement(),o)}),this.rightColumns.forEach(function(o){var n=t.getCell(o);n&&e.layoutElement(n.getElement(),o)})},FrozenColumns.prototype.layoutElement=function(t,e){e.modules.frozen&&(t.style.position="absolute",t.style.left=e.modules.frozen.margin,t.classList.add("tabulator-frozen"),e.modules.frozen.edge&&t.classList.add("tabulator-frozen-"+e.modules.frozen.position))},FrozenColumns.prototype._calcSpace=function(t,e){for(var o=0,n=0;n -1) { + output.splice(index, 1); + } + }); + + return output; +}; + +FrozenRows.prototype.freezeRow = function (row) { + if (!row.modules.frozen) { + row.modules.frozen = true; + this.topElement.appendChild(row.getElement()); + row.initialize(); + row.normalizeHeight(); + this.table.rowManager.adjustTableSize(); + + this.rows.push(row); + + this.table.rowManager.refreshActiveData("display"); + + this.styleRows(); + } else { + console.warn("Freeze Error - Row is already frozen"); + } +}; + +FrozenRows.prototype.unfreezeRow = function (row) { + var index = this.rows.indexOf(row); + + if (row.modules.frozen) { + + row.modules.frozen = false; + + var rowEl = row.getElement(); + rowEl.parentNode.removeChild(rowEl); + + this.table.rowManager.adjustTableSize(); + + this.rows.splice(index, 1); + + this.table.rowManager.refreshActiveData("display"); + + if (this.rows.length) { + this.styleRows(); + } + } else { + console.warn("Freeze Error - Row is already unfrozen"); + } +}; + +FrozenRows.prototype.styleRows = function (row) { + var self = this; + + this.rows.forEach(function (row, i) { + self.table.rowManager.styleRow(row, i); + }); +}; + +Tabulator.prototype.registerModule("frozenRows", FrozenRows); \ No newline at end of file diff --git a/admin/js/vendors/tabulator/js/modules/frozen_rows.min.js b/admin/js/vendors/tabulator/js/modules/frozen_rows.min.js new file mode 100644 index 0000000..c38e992 --- /dev/null +++ b/admin/js/vendors/tabulator/js/modules/frozen_rows.min.js @@ -0,0 +1,2 @@ +/* Tabulator v4.7.0 (c) Oliver Folkerd */ +var FrozenRows=function(e){this.table=e,this.topElement=document.createElement("div"),this.rows=[],this.displayIndex=0};FrozenRows.prototype.initialize=function(){this.rows=[],this.topElement.classList.add("tabulator-frozen-rows-holder"),this.table.columnManager.getElement().insertBefore(this.topElement,this.table.columnManager.headersElement.nextSibling)},FrozenRows.prototype.setDisplayIndex=function(e){this.displayIndex=e},FrozenRows.prototype.getDisplayIndex=function(){return this.displayIndex},FrozenRows.prototype.isFrozen=function(){return!!this.rows.length},FrozenRows.prototype.getRows=function(e){var o=e.slice(0);return this.rows.forEach(function(e){var t=o.indexOf(e);t>-1&&o.splice(t,1)}),o},FrozenRows.prototype.freezeRow=function(e){e.modules.frozen?console.warn("Freeze Error - Row is already frozen"):(e.modules.frozen=!0,this.topElement.appendChild(e.getElement()),e.initialize(),e.normalizeHeight(),this.table.rowManager.adjustTableSize(),this.rows.push(e),this.table.rowManager.refreshActiveData("display"),this.styleRows())},FrozenRows.prototype.unfreezeRow=function(e){var o=this.rows.indexOf(e);if(e.modules.frozen){e.modules.frozen=!1;var t=e.getElement();t.parentNode.removeChild(t),this.table.rowManager.adjustTableSize(),this.rows.splice(o,1),this.table.rowManager.refreshActiveData("display"),this.rows.length&&this.styleRows()}else console.warn("Freeze Error - Row is already unfrozen")},FrozenRows.prototype.styleRows=function(e){var o=this;this.rows.forEach(function(e,t){o.table.rowManager.styleRow(e,t)})},Tabulator.prototype.registerModule("frozenRows",FrozenRows); \ No newline at end of file diff --git a/admin/js/vendors/tabulator/js/modules/group_rows.js b/admin/js/vendors/tabulator/js/modules/group_rows.js new file mode 100644 index 0000000..05731ec --- /dev/null +++ b/admin/js/vendors/tabulator/js/modules/group_rows.js @@ -0,0 +1,1087 @@ +/* Tabulator v4.7.0 (c) Oliver Folkerd */ + +//public group object +var GroupComponent = function GroupComponent(group) { + this._group = group; + this.type = "GroupComponent"; +}; + +GroupComponent.prototype.getKey = function () { + return this._group.key; +}; + +GroupComponent.prototype.getField = function () { + return this._group.field; +}; + +GroupComponent.prototype.getElement = function () { + return this._group.element; +}; + +GroupComponent.prototype.getRows = function () { + return this._group.getRows(true); +}; + +GroupComponent.prototype.getSubGroups = function () { + return this._group.getSubGroups(true); +}; + +GroupComponent.prototype.getParentGroup = function () { + return this._group.parent ? this._group.parent.getComponent() : false; +}; + +GroupComponent.prototype.getVisibility = function () { + console.warn("getVisibility function is deprecated, you should now use the isVisible function"); + return this._group.visible; +}; + +GroupComponent.prototype.isVisible = function () { + return this._group.visible; +}; + +GroupComponent.prototype.show = function () { + this._group.show(); +}; + +GroupComponent.prototype.hide = function () { + this._group.hide(); +}; + +GroupComponent.prototype.toggle = function () { + this._group.toggleVisibility(); +}; + +GroupComponent.prototype._getSelf = function () { + return this._group; +}; + +GroupComponent.prototype.getTable = function () { + return this._group.groupManager.table; +}; + +////////////////////////////////////////////////// +//////////////// Group Functions ///////////////// +////////////////////////////////////////////////// + +var Group = function Group(groupManager, parent, level, key, field, generator, oldGroup) { + + this.groupManager = groupManager; + this.parent = parent; + this.key = key; + this.level = level; + this.field = field; + this.hasSubGroups = level < groupManager.groupIDLookups.length - 1; + this.addRow = this.hasSubGroups ? this._addRowToGroup : this._addRow; + this.type = "group"; //type of element + this.old = oldGroup; + this.rows = []; + this.groups = []; + this.groupList = []; + this.generator = generator; + this.elementContents = false; + this.height = 0; + this.outerHeight = 0; + this.initialized = false; + this.calcs = {}; + this.initialized = false; + this.modules = {}; + this.arrowElement = false; + + this.visible = oldGroup ? oldGroup.visible : typeof groupManager.startOpen[level] !== "undefined" ? groupManager.startOpen[level] : groupManager.startOpen[0]; + + this.component = null; + + this.createElements(); + this.addBindings(); + + this.createValueGroups(); +}; + +Group.prototype.wipe = function () { + if (this.groupList.length) { + this.groupList.forEach(function (group) { + group.wipe(); + }); + } else { + this.element = false; + this.arrowElement = false; + this.elementContents = false; + } +}; + +Group.prototype.createElements = function () { + var arrow = document.createElement("div"); + arrow.classList.add("tabulator-arrow"); + + this.element = document.createElement("div"); + this.element.classList.add("tabulator-row"); + this.element.classList.add("tabulator-group"); + this.element.classList.add("tabulator-group-level-" + this.level); + this.element.setAttribute("role", "rowgroup"); + + this.arrowElement = document.createElement("div"); + this.arrowElement.classList.add("tabulator-group-toggle"); + this.arrowElement.appendChild(arrow); + + //setup movable rows + if (this.groupManager.table.options.movableRows !== false && this.groupManager.table.modExists("moveRow")) { + this.groupManager.table.modules.moveRow.initializeGroupHeader(this); + } +}; + +Group.prototype.createValueGroups = function () { + var _this = this; + + var level = this.level + 1; + if (this.groupManager.allowedValues && this.groupManager.allowedValues[level]) { + this.groupManager.allowedValues[level].forEach(function (value) { + _this._createGroup(value, level); + }); + } +}; + +Group.prototype.addBindings = function () { + var self = this, + dblTap, + tapHold, + tap, + toggleElement; + + //handle group click events + if (self.groupManager.table.options.groupClick) { + self.element.addEventListener("click", function (e) { + self.groupManager.table.options.groupClick.call(self.groupManager.table, e, self.getComponent()); + }); + } + + if (self.groupManager.table.options.groupDblClick) { + self.element.addEventListener("dblclick", function (e) { + self.groupManager.table.options.groupDblClick.call(self.groupManager.table, e, self.getComponent()); + }); + } + + if (self.groupManager.table.options.groupContext) { + self.element.addEventListener("contextmenu", function (e) { + self.groupManager.table.options.groupContext.call(self.groupManager.table, e, self.getComponent()); + }); + } + + if (self.groupManager.table.options.groupContextMenu && self.groupManager.table.modExists("menu")) { + self.groupManager.table.modules.menu.initializeGroup.call(self.groupManager.table.modules.menu, self); + } + + if (self.groupManager.table.options.groupTap) { + + tap = false; + + self.element.addEventListener("touchstart", function (e) { + tap = true; + }, { passive: true }); + + self.element.addEventListener("touchend", function (e) { + if (tap) { + self.groupManager.table.options.groupTap(e, self.getComponent()); + } + + tap = false; + }); + } + + if (self.groupManager.table.options.groupDblTap) { + + dblTap = null; + + self.element.addEventListener("touchend", function (e) { + + if (dblTap) { + clearTimeout(dblTap); + dblTap = null; + + self.groupManager.table.options.groupDblTap(e, self.getComponent()); + } else { + + dblTap = setTimeout(function () { + clearTimeout(dblTap); + dblTap = null; + }, 300); + } + }); + } + + if (self.groupManager.table.options.groupTapHold) { + + tapHold = null; + + self.element.addEventListener("touchstart", function (e) { + clearTimeout(tapHold); + + tapHold = setTimeout(function () { + clearTimeout(tapHold); + tapHold = null; + tap = false; + self.groupManager.table.options.groupTapHold(e, self.getComponent()); + }, 1000); + }, { passive: true }); + + self.element.addEventListener("touchend", function (e) { + clearTimeout(tapHold); + tapHold = null; + }); + } + + if (self.groupManager.table.options.groupToggleElement) { + toggleElement = self.groupManager.table.options.groupToggleElement == "arrow" ? self.arrowElement : self.element; + + toggleElement.addEventListener("click", function (e) { + e.stopPropagation(); + e.stopImmediatePropagation(); + self.toggleVisibility(); + }); + } +}; + +Group.prototype._createGroup = function (groupID, level) { + var groupKey = level + "_" + groupID; + var group = new Group(this.groupManager, this, level, groupID, this.groupManager.groupIDLookups[level].field, this.groupManager.headerGenerator[level] || this.groupManager.headerGenerator[0], this.old ? this.old.groups[groupKey] : false); + + this.groups[groupKey] = group; + this.groupList.push(group); +}; + +Group.prototype._addRowToGroup = function (row) { + + var level = this.level + 1; + + if (this.hasSubGroups) { + var groupID = this.groupManager.groupIDLookups[level].func(row.getData()), + groupKey = level + "_" + groupID; + + if (this.groupManager.allowedValues && this.groupManager.allowedValues[level]) { + if (this.groups[groupKey]) { + this.groups[groupKey].addRow(row); + } + } else { + if (!this.groups[groupKey]) { + this._createGroup(groupID, level); + } + + this.groups[groupKey].addRow(row); + } + } +}; + +Group.prototype._addRow = function (row) { + this.rows.push(row); + row.modules.group = this; +}; + +Group.prototype.insertRow = function (row, to, after) { + var data = this.conformRowData({}); + + row.updateData(data); + + var toIndex = this.rows.indexOf(to); + + if (toIndex > -1) { + if (after) { + this.rows.splice(toIndex + 1, 0, row); + } else { + this.rows.splice(toIndex, 0, row); + } + } else { + if (after) { + this.rows.push(row); + } else { + this.rows.unshift(row); + } + } + + row.modules.group = this; + + this.generateGroupHeaderContents(); + + if (this.groupManager.table.modExists("columnCalcs") && this.groupManager.table.options.columnCalcs != "table") { + this.groupManager.table.modules.columnCalcs.recalcGroup(this); + } + + this.groupManager.updateGroupRows(true); +}; + +Group.prototype.scrollHeader = function (left) { + this.arrowElement.style.marginLeft = left; + + this.groupList.forEach(function (child) { + child.scrollHeader(left); + }); +}; + +Group.prototype.getRowIndex = function (row) {}; + +//update row data to match grouping contraints +Group.prototype.conformRowData = function (data) { + if (this.field) { + data[this.field] = this.key; + } else { + console.warn("Data Conforming Error - Cannot conform row data to match new group as groupBy is a function"); + } + + if (this.parent) { + data = this.parent.conformRowData(data); + } + + return data; +}; + +Group.prototype.removeRow = function (row) { + var index = this.rows.indexOf(row); + var el = row.getElement(); + + if (index > -1) { + this.rows.splice(index, 1); + } + + if (!this.groupManager.table.options.groupValues && !this.rows.length) { + if (this.parent) { + this.parent.removeGroup(this); + } else { + this.groupManager.removeGroup(this); + } + + this.groupManager.updateGroupRows(true); + } else { + + if (el.parentNode) { + el.parentNode.removeChild(el); + } + + this.generateGroupHeaderContents(); + + if (this.groupManager.table.modExists("columnCalcs") && this.groupManager.table.options.columnCalcs != "table") { + this.groupManager.table.modules.columnCalcs.recalcGroup(this); + } + } +}; + +Group.prototype.removeGroup = function (group) { + var groupKey = group.level + "_" + group.key, + index; + + if (this.groups[groupKey]) { + delete this.groups[groupKey]; + + index = this.groupList.indexOf(group); + + if (index > -1) { + this.groupList.splice(index, 1); + } + + if (!this.groupList.length) { + if (this.parent) { + this.parent.removeGroup(this); + } else { + this.groupManager.removeGroup(this); + } + } + } +}; + +Group.prototype.getHeadersAndRows = function (noCalc) { + var output = []; + + output.push(this); + + this._visSet(); + + if (this.visible) { + if (this.groupList.length) { + this.groupList.forEach(function (group) { + output = output.concat(group.getHeadersAndRows(noCalc)); + }); + } else { + if (!noCalc && this.groupManager.table.options.columnCalcs != "table" && this.groupManager.table.modExists("columnCalcs") && this.groupManager.table.modules.columnCalcs.hasTopCalcs()) { + if (this.calcs.top) { + this.calcs.top.detachElement(); + this.calcs.top.deleteCells(); + } + + this.calcs.top = this.groupManager.table.modules.columnCalcs.generateTopRow(this.rows); + output.push(this.calcs.top); + } + + output = output.concat(this.rows); + + if (!noCalc && this.groupManager.table.options.columnCalcs != "table" && this.groupManager.table.modExists("columnCalcs") && this.groupManager.table.modules.columnCalcs.hasBottomCalcs()) { + if (this.calcs.bottom) { + this.calcs.bottom.detachElement(); + this.calcs.bottom.deleteCells(); + } + + this.calcs.bottom = this.groupManager.table.modules.columnCalcs.generateBottomRow(this.rows); + output.push(this.calcs.bottom); + } + } + } else { + if (!this.groupList.length && this.groupManager.table.options.columnCalcs != "table") { + + if (this.groupManager.table.modExists("columnCalcs")) { + + if (!noCalc && this.groupManager.table.modules.columnCalcs.hasTopCalcs()) { + if (this.calcs.top) { + this.calcs.top.detachElement(); + this.calcs.top.deleteCells(); + } + + if (this.groupManager.table.options.groupClosedShowCalcs) { + this.calcs.top = this.groupManager.table.modules.columnCalcs.generateTopRow(this.rows); + output.push(this.calcs.top); + } + } + + if (!noCalc && this.groupManager.table.modules.columnCalcs.hasBottomCalcs()) { + if (this.calcs.bottom) { + this.calcs.bottom.detachElement(); + this.calcs.bottom.deleteCells(); + } + + if (this.groupManager.table.options.groupClosedShowCalcs) { + this.calcs.bottom = this.groupManager.table.modules.columnCalcs.generateBottomRow(this.rows); + output.push(this.calcs.bottom); + } + } + } + } + } + + return output; +}; + +Group.prototype.getData = function (visible, transform) { + var self = this, + output = []; + + this._visSet(); + + if (!visible || visible && this.visible) { + this.rows.forEach(function (row) { + output.push(row.getData(transform || "data")); + }); + } + + return output; +}; + +// Group.prototype.getRows = function(){ +// this._visSet(); + +// return this.visible ? this.rows : []; +// }; + +Group.prototype.getRowCount = function () { + var count = 0; + + if (this.groupList.length) { + this.groupList.forEach(function (group) { + count += group.getRowCount(); + }); + } else { + count = this.rows.length; + } + return count; +}; + +Group.prototype.toggleVisibility = function () { + if (this.visible) { + this.hide(); + } else { + this.show(); + } +}; + +Group.prototype.hide = function () { + this.visible = false; + + if (this.groupManager.table.rowManager.getRenderMode() == "classic" && !this.groupManager.table.options.pagination) { + + this.element.classList.remove("tabulator-group-visible"); + + if (this.groupList.length) { + this.groupList.forEach(function (group) { + + var rows = group.getHeadersAndRows(); + + rows.forEach(function (row) { + row.detachElement(); + }); + }); + } else { + this.rows.forEach(function (row) { + var rowEl = row.getElement(); + rowEl.parentNode.removeChild(rowEl); + }); + } + + this.groupManager.table.rowManager.setDisplayRows(this.groupManager.updateGroupRows(), this.groupManager.getDisplayIndex()); + + this.groupManager.table.rowManager.checkClassicModeGroupHeaderWidth(); + } else { + this.groupManager.updateGroupRows(true); + } + + this.groupManager.table.options.groupVisibilityChanged.call(this.table, this.getComponent(), false); +}; + +Group.prototype.show = function () { + var self = this; + + self.visible = true; + + if (this.groupManager.table.rowManager.getRenderMode() == "classic" && !this.groupManager.table.options.pagination) { + + this.element.classList.add("tabulator-group-visible"); + + var prev = self.getElement(); + + if (this.groupList.length) { + this.groupList.forEach(function (group) { + var rows = group.getHeadersAndRows(); + + rows.forEach(function (row) { + var rowEl = row.getElement(); + prev.parentNode.insertBefore(rowEl, prev.nextSibling); + row.initialize(); + prev = rowEl; + }); + }); + } else { + self.rows.forEach(function (row) { + var rowEl = row.getElement(); + prev.parentNode.insertBefore(rowEl, prev.nextSibling); + row.initialize(); + prev = rowEl; + }); + } + + this.groupManager.table.rowManager.setDisplayRows(this.groupManager.updateGroupRows(), this.groupManager.getDisplayIndex()); + + this.groupManager.table.rowManager.checkClassicModeGroupHeaderWidth(); + } else { + this.groupManager.updateGroupRows(true); + } + + this.groupManager.table.options.groupVisibilityChanged.call(this.table, this.getComponent(), true); +}; + +Group.prototype._visSet = function () { + var data = []; + + if (typeof this.visible == "function") { + + this.rows.forEach(function (row) { + data.push(row.getData()); + }); + + this.visible = this.visible(this.key, this.getRowCount(), data, this.getComponent()); + } +}; + +Group.prototype.getRowGroup = function (row) { + var match = false; + if (this.groupList.length) { + this.groupList.forEach(function (group) { + var result = group.getRowGroup(row); + + if (result) { + match = result; + } + }); + } else { + if (this.rows.find(function (item) { + return item === row; + })) { + match = this; + } + } + + return match; +}; + +Group.prototype.getSubGroups = function (component) { + var output = []; + + this.groupList.forEach(function (child) { + output.push(component ? child.getComponent() : child); + }); + + return output; +}; + +Group.prototype.getRows = function (compoment) { + var output = []; + + this.rows.forEach(function (row) { + output.push(compoment ? row.getComponent() : row); + }); + + return output; +}; + +Group.prototype.generateGroupHeaderContents = function () { + var data = []; + + this.rows.forEach(function (row) { + data.push(row.getData()); + }); + + this.elementContents = this.generator(this.key, this.getRowCount(), data, this.getComponent()); + + while (this.element.firstChild) { + this.element.removeChild(this.element.firstChild); + }if (typeof this.elementContents === "string") { + this.element.innerHTML = this.elementContents; + } else { + this.element.appendChild(this.elementContents); + } + + this.element.insertBefore(this.arrowElement, this.element.firstChild); +}; + +////////////// Standard Row Functions ////////////// + +Group.prototype.getElement = function () { + this.addBindingsd = false; + + this._visSet(); + + if (this.visible) { + this.element.classList.add("tabulator-group-visible"); + } else { + this.element.classList.remove("tabulator-group-visible"); + } + + for (var i = 0; i < this.element.childNodes.length; ++i) { + this.element.childNodes[i].parentNode.removeChild(this.element.childNodes[i]); + } + + this.generateGroupHeaderContents(); + + // this.addBindings(); + + return this.element; +}; + +Group.prototype.detachElement = function () { + if (this.element && this.element.parentNode) { + this.element.parentNode.removeChild(this.element); + } +}; + +//normalize the height of elements in the row +Group.prototype.normalizeHeight = function () { + this.setHeight(this.element.clientHeight); +}; + +Group.prototype.initialize = function (force) { + if (!this.initialized || force) { + this.normalizeHeight(); + this.initialized = true; + } +}; + +Group.prototype.reinitialize = function () { + this.initialized = false; + this.height = 0; + + if (Tabulator.prototype.helpers.elVisible(this.element)) { + this.initialize(true); + } +}; + +Group.prototype.setHeight = function (height) { + if (this.height != height) { + this.height = height; + this.outerHeight = this.element.offsetHeight; + } +}; + +//return rows outer height +Group.prototype.getHeight = function () { + return this.outerHeight; +}; + +Group.prototype.getGroup = function () { + return this; +}; + +Group.prototype.reinitializeHeight = function () {}; +Group.prototype.calcHeight = function () {}; +Group.prototype.setCellHeight = function () {}; +Group.prototype.clearCellHeight = function () {}; + +//////////////// Object Generation ///////////////// +Group.prototype.getComponent = function () { + if (!this.component) { + this.component = new GroupComponent(this); + } + + return this.component; +}; + +////////////////////////////////////////////////// +////////////// Group Row Extension /////////////// +////////////////////////////////////////////////// + +var GroupRows = function GroupRows(table) { + + this.table = table; //hold Tabulator object + + this.groupIDLookups = false; //enable table grouping and set field to group by + this.startOpen = [function () { + return false; + }]; //starting state of group + this.headerGenerator = [function () { + return ""; + }]; + this.groupList = []; //ordered list of groups + this.allowedValues = false; + this.groups = {}; //hold row groups + this.displayIndex = 0; //index in display pipeline +}; + +//initialize group configuration +GroupRows.prototype.initialize = function () { + var self = this, + groupBy = self.table.options.groupBy, + startOpen = self.table.options.groupStartOpen, + groupHeader = self.table.options.groupHeader; + + this.allowedValues = self.table.options.groupValues; + + if (Array.isArray(groupBy) && Array.isArray(groupHeader) && groupBy.length > groupHeader.length) { + console.warn("Error creating group headers, groupHeader array is shorter than groupBy array"); + } + + self.headerGenerator = [function () { + return ""; + }]; + this.startOpen = [function () { + return false; + }]; //starting state of group + + self.table.modules.localize.bind("groups|item", function (langValue, lang) { + self.headerGenerator[0] = function (value, count, data) { + //header layout function + return (typeof value === "undefined" ? "" : value) + "(" + count + " " + (count === 1 ? langValue : lang.groups.items) + ")"; + }; + }); + + this.groupIDLookups = []; + + if (Array.isArray(groupBy) || groupBy) { + if (this.table.modExists("columnCalcs") && this.table.options.columnCalcs != "table" && this.table.options.columnCalcs != "both") { + this.table.modules.columnCalcs.removeCalcs(); + } + } else { + if (this.table.modExists("columnCalcs") && this.table.options.columnCalcs != "group") { + + var cols = this.table.columnManager.getRealColumns(); + + cols.forEach(function (col) { + if (col.definition.topCalc) { + self.table.modules.columnCalcs.initializeTopRow(); + } + + if (col.definition.bottomCalc) { + self.table.modules.columnCalcs.initializeBottomRow(); + } + }); + } + } + + if (!Array.isArray(groupBy)) { + groupBy = [groupBy]; + } + + groupBy.forEach(function (group, i) { + var lookupFunc, column; + + if (typeof group == "function") { + lookupFunc = group; + } else { + column = self.table.columnManager.getColumnByField(group); + + if (column) { + lookupFunc = function lookupFunc(data) { + return column.getFieldValue(data); + }; + } else { + lookupFunc = function lookupFunc(data) { + return data[group]; + }; + } + } + + self.groupIDLookups.push({ + field: typeof group === "function" ? false : group, + func: lookupFunc, + values: self.allowedValues ? self.allowedValues[i] : false + }); + }); + + if (startOpen) { + + if (!Array.isArray(startOpen)) { + startOpen = [startOpen]; + } + + startOpen.forEach(function (level) { + level = typeof level == "function" ? level : function () { + return true; + }; + }); + + self.startOpen = startOpen; + } + + if (groupHeader) { + self.headerGenerator = Array.isArray(groupHeader) ? groupHeader : [groupHeader]; + } + + this.initialized = true; +}; + +GroupRows.prototype.setDisplayIndex = function (index) { + this.displayIndex = index; +}; + +GroupRows.prototype.getDisplayIndex = function () { + return this.displayIndex; +}; + +//return appropriate rows with group headers +GroupRows.prototype.getRows = function (rows) { + if (this.groupIDLookups.length) { + + this.table.options.dataGrouping.call(this.table); + + this.generateGroups(rows); + + if (this.table.options.dataGrouped) { + this.table.options.dataGrouped.call(this.table, this.getGroups(true)); + } + + return this.updateGroupRows(); + } else { + return rows.slice(0); + } +}; + +GroupRows.prototype.getGroups = function (compoment) { + var groupComponents = []; + + this.groupList.forEach(function (group) { + groupComponents.push(compoment ? group.getComponent() : group); + }); + + return groupComponents; +}; + +GroupRows.prototype.getChildGroups = function (group) { + var _this2 = this; + + var groupComponents = []; + + if (!group) { + group = this; + } + + group.groupList.forEach(function (child) { + if (child.groupList.length) { + groupComponents = groupComponents.concat(_this2.getChildGroups(child)); + } else { + groupComponents.push(child); + } + }); + + return groupComponents; +}; + +GroupRows.prototype.wipe = function () { + this.groupList.forEach(function (group) { + group.wipe(); + }); +}; + +GroupRows.prototype.pullGroupListData = function (groupList) { + var self = this; + var groupListData = []; + + groupList.forEach(function (group) { + var groupHeader = {}; + groupHeader.level = 0; + groupHeader.rowCount = 0; + groupHeader.headerContent = ""; + var childData = []; + + if (group.hasSubGroups) { + childData = self.pullGroupListData(group.groupList); + + groupHeader.level = group.level; + groupHeader.rowCount = childData.length - group.groupList.length; // data length minus number of sub-headers + groupHeader.headerContent = group.generator(group.key, groupHeader.rowCount, group.rows, group); + + groupListData.push(groupHeader); + groupListData = groupListData.concat(childData); + } else { + groupHeader.level = group.level; + groupHeader.headerContent = group.generator(group.key, group.rows.length, group.rows, group); + groupHeader.rowCount = group.getRows().length; + + groupListData.push(groupHeader); + + group.getRows().forEach(function (row) { + groupListData.push(row.getData("data")); + }); + } + }); + + return groupListData; +}; + +GroupRows.prototype.getGroupedData = function () { + + return this.pullGroupListData(this.groupList); +}; + +GroupRows.prototype.getRowGroup = function (row) { + var match = false; + + this.groupList.forEach(function (group) { + var result = group.getRowGroup(row); + + if (result) { + match = result; + } + }); + + return match; +}; + +GroupRows.prototype.countGroups = function () { + return this.groupList.length; +}; + +GroupRows.prototype.generateGroups = function (rows) { + var self = this, + oldGroups = self.groups; + + self.groups = {}; + self.groupList = []; + + if (this.allowedValues && this.allowedValues[0]) { + this.allowedValues[0].forEach(function (value) { + self.createGroup(value, 0, oldGroups); + }); + + rows.forEach(function (row) { + self.assignRowToExistingGroup(row, oldGroups); + }); + } else { + rows.forEach(function (row) { + self.assignRowToGroup(row, oldGroups); + }); + } +}; + +GroupRows.prototype.createGroup = function (groupID, level, oldGroups) { + var groupKey = level + "_" + groupID, + group; + + oldGroups = oldGroups || []; + + group = new Group(this, false, level, groupID, this.groupIDLookups[0].field, this.headerGenerator[0], oldGroups[groupKey]); + + this.groups[groupKey] = group; + this.groupList.push(group); +}; + +// GroupRows.prototype.assignRowToGroup = function(row, oldGroups){ +// var groupID = this.groupIDLookups[0].func(row.getData()), +// groupKey = "0_" + groupID; + +// if(!this.groups[groupKey]){ +// this.createGroup(groupID, 0, oldGroups); +// } + +// this.groups[groupKey].addRow(row); +// }; + +GroupRows.prototype.assignRowToExistingGroup = function (row, oldGroups) { + var groupID = this.groupIDLookups[0].func(row.getData()), + groupKey = "0_" + groupID; + + if (this.groups[groupKey]) { + this.groups[groupKey].addRow(row); + } +}; + +GroupRows.prototype.assignRowToGroup = function (row, oldGroups) { + var groupID = this.groupIDLookups[0].func(row.getData()), + newGroupNeeded = !this.groups["0_" + groupID]; + + if (newGroupNeeded) { + this.createGroup(groupID, 0, oldGroups); + } + + this.groups["0_" + groupID].addRow(row); + + return !newGroupNeeded; +}; + +GroupRows.prototype.updateGroupRows = function (force) { + var self = this, + output = [], + oldRowCount; + + self.groupList.forEach(function (group) { + output = output.concat(group.getHeadersAndRows()); + }); + + //force update of table display + if (force) { + + var displayIndex = self.table.rowManager.setDisplayRows(output, this.getDisplayIndex()); + + if (displayIndex !== true) { + this.setDisplayIndex(displayIndex); + } + + self.table.rowManager.refreshActiveData("group", true, true); + } + + return output; +}; + +GroupRows.prototype.scrollHeaders = function (left) { + left = left + "px"; + + this.groupList.forEach(function (group) { + group.scrollHeader(left); + }); +}; + +GroupRows.prototype.removeGroup = function (group) { + var groupKey = group.level + "_" + group.key, + index; + + if (this.groups[groupKey]) { + delete this.groups[groupKey]; + + index = this.groupList.indexOf(group); + + if (index > -1) { + this.groupList.splice(index, 1); + } + } +}; + +Tabulator.prototype.registerModule("groupRows", GroupRows); \ No newline at end of file diff --git a/admin/js/vendors/tabulator/js/modules/group_rows.min.js b/admin/js/vendors/tabulator/js/modules/group_rows.min.js new file mode 100644 index 0000000..6039f2c --- /dev/null +++ b/admin/js/vendors/tabulator/js/modules/group_rows.min.js @@ -0,0 +1,2 @@ +/* Tabulator v4.7.0 (c) Oliver Folkerd */ +var GroupComponent=function(t){this._group=t,this.type="GroupComponent"};GroupComponent.prototype.getKey=function(){return this._group.key},GroupComponent.prototype.getField=function(){return this._group.field},GroupComponent.prototype.getElement=function(){return this._group.element},GroupComponent.prototype.getRows=function(){return this._group.getRows(!0)},GroupComponent.prototype.getSubGroups=function(){return this._group.getSubGroups(!0)},GroupComponent.prototype.getParentGroup=function(){return!!this._group.parent&&this._group.parent.getComponent()},GroupComponent.prototype.getVisibility=function(){return console.warn("getVisibility function is deprecated, you should now use the isVisible function"),this._group.visible},GroupComponent.prototype.isVisible=function(){return this._group.visible},GroupComponent.prototype.show=function(){this._group.show()},GroupComponent.prototype.hide=function(){this._group.hide()},GroupComponent.prototype.toggle=function(){this._group.toggleVisibility()},GroupComponent.prototype._getSelf=function(){return this._group},GroupComponent.prototype.getTable=function(){return this._group.groupManager.table};var Group=function(t,o,e,r,i,s,n){this.groupManager=t,this.parent=o,this.key=r,this.level=e,this.field=i,this.hasSubGroups=e-1?e?this.rows.splice(i+1,0,t):this.rows.splice(i,0,t):e?this.rows.push(t):this.rows.unshift(t),t.modules.group=this,this.generateGroupHeaderContents(),this.groupManager.table.modExists("columnCalcs")&&"table"!=this.groupManager.table.options.columnCalcs&&this.groupManager.table.modules.columnCalcs.recalcGroup(this),this.groupManager.updateGroupRows(!0)},Group.prototype.scrollHeader=function(t){this.arrowElement.style.marginLeft=t,this.groupList.forEach(function(o){o.scrollHeader(t)})},Group.prototype.getRowIndex=function(t){},Group.prototype.conformRowData=function(t){return this.field?t[this.field]=this.key:console.warn("Data Conforming Error - Cannot conform row data to match new group as groupBy is a function"),this.parent&&(t=this.parent.conformRowData(t)),t},Group.prototype.removeRow=function(t){var o=this.rows.indexOf(t),e=t.getElement();o>-1&&this.rows.splice(o,1),this.groupManager.table.options.groupValues||this.rows.length?(e.parentNode&&e.parentNode.removeChild(e),this.generateGroupHeaderContents(),this.groupManager.table.modExists("columnCalcs")&&"table"!=this.groupManager.table.options.columnCalcs&&this.groupManager.table.modules.columnCalcs.recalcGroup(this)):(this.parent?this.parent.removeGroup(this):this.groupManager.removeGroup(this),this.groupManager.updateGroupRows(!0))},Group.prototype.removeGroup=function(t){var o,e=t.level+"_"+t.key;this.groups[e]&&(delete this.groups[e],o=this.groupList.indexOf(t),o>-1&&this.groupList.splice(o,1),this.groupList.length||(this.parent?this.parent.removeGroup(this):this.groupManager.removeGroup(this)))},Group.prototype.getHeadersAndRows=function(t){var o=[];return o.push(this),this._visSet(),this.visible?this.groupList.length?this.groupList.forEach(function(e){o=o.concat(e.getHeadersAndRows(t))}):(!t&&"table"!=this.groupManager.table.options.columnCalcs&&this.groupManager.table.modExists("columnCalcs")&&this.groupManager.table.modules.columnCalcs.hasTopCalcs()&&(this.calcs.top&&(this.calcs.top.detachElement(),this.calcs.top.deleteCells()),this.calcs.top=this.groupManager.table.modules.columnCalcs.generateTopRow(this.rows),o.push(this.calcs.top)),o=o.concat(this.rows),!t&&"table"!=this.groupManager.table.options.columnCalcs&&this.groupManager.table.modExists("columnCalcs")&&this.groupManager.table.modules.columnCalcs.hasBottomCalcs()&&(this.calcs.bottom&&(this.calcs.bottom.detachElement(),this.calcs.bottom.deleteCells()),this.calcs.bottom=this.groupManager.table.modules.columnCalcs.generateBottomRow(this.rows),o.push(this.calcs.bottom))):this.groupList.length||"table"==this.groupManager.table.options.columnCalcs||this.groupManager.table.modExists("columnCalcs")&&(!t&&this.groupManager.table.modules.columnCalcs.hasTopCalcs()&&(this.calcs.top&&(this.calcs.top.detachElement(),this.calcs.top.deleteCells()),this.groupManager.table.options.groupClosedShowCalcs&&(this.calcs.top=this.groupManager.table.modules.columnCalcs.generateTopRow(this.rows),o.push(this.calcs.top))),!t&&this.groupManager.table.modules.columnCalcs.hasBottomCalcs()&&(this.calcs.bottom&&(this.calcs.bottom.detachElement(),this.calcs.bottom.deleteCells()),this.groupManager.table.options.groupClosedShowCalcs&&(this.calcs.bottom=this.groupManager.table.modules.columnCalcs.generateBottomRow(this.rows),o.push(this.calcs.bottom)))),o},Group.prototype.getData=function(t,o){var e=[];return this._visSet(),(!t||t&&this.visible)&&this.rows.forEach(function(t){e.push(t.getData(o||"data"))}),e},Group.prototype.getRowCount=function(){var t=0;return this.groupList.length?this.groupList.forEach(function(o){t+=o.getRowCount()}):t=this.rows.length,t},Group.prototype.toggleVisibility=function(){this.visible?this.hide():this.show()},Group.prototype.hide=function(){this.visible=!1,"classic"!=this.groupManager.table.rowManager.getRenderMode()||this.groupManager.table.options.pagination?this.groupManager.updateGroupRows(!0):(this.element.classList.remove("tabulator-group-visible"),this.groupList.length?this.groupList.forEach(function(t){t.getHeadersAndRows().forEach(function(t){t.detachElement()})}):this.rows.forEach(function(t){var o=t.getElement();o.parentNode.removeChild(o)}),this.groupManager.table.rowManager.setDisplayRows(this.groupManager.updateGroupRows(),this.groupManager.getDisplayIndex()),this.groupManager.table.rowManager.checkClassicModeGroupHeaderWidth()),this.groupManager.table.options.groupVisibilityChanged.call(this.table,this.getComponent(),!1)},Group.prototype.show=function(){var t=this;if(t.visible=!0,"classic"!=this.groupManager.table.rowManager.getRenderMode()||this.groupManager.table.options.pagination)this.groupManager.updateGroupRows(!0);else{this.element.classList.add("tabulator-group-visible");var o=t.getElement();this.groupList.length?this.groupList.forEach(function(t){t.getHeadersAndRows().forEach(function(t){var e=t.getElement();o.parentNode.insertBefore(e,o.nextSibling),t.initialize(),o=e})}):t.rows.forEach(function(t){var e=t.getElement();o.parentNode.insertBefore(e,o.nextSibling),t.initialize(),o=e}),this.groupManager.table.rowManager.setDisplayRows(this.groupManager.updateGroupRows(),this.groupManager.getDisplayIndex()),this.groupManager.table.rowManager.checkClassicModeGroupHeaderWidth()}this.groupManager.table.options.groupVisibilityChanged.call(this.table,this.getComponent(),!0)},Group.prototype._visSet=function(){var t=[];"function"==typeof this.visible&&(this.rows.forEach(function(o){t.push(o.getData())}),this.visible=this.visible(this.key,this.getRowCount(),t,this.getComponent()))},Group.prototype.getRowGroup=function(t){var o=!1;return this.groupList.length?this.groupList.forEach(function(e){var r=e.getRowGroup(t);r&&(o=r)}):this.rows.find(function(o){return o===t})&&(o=this),o},Group.prototype.getSubGroups=function(t){var o=[];return this.groupList.forEach(function(e){o.push(t?e.getComponent():e)}),o},Group.prototype.getRows=function(t){var o=[];return this.rows.forEach(function(e){o.push(t?e.getComponent():e)}),o},Group.prototype.generateGroupHeaderContents=function(){var t=[];for(this.rows.forEach(function(o){t.push(o.getData())}),this.elementContents=this.generator(this.key,this.getRowCount(),t,this.getComponent());this.element.firstChild;)this.element.removeChild(this.element.firstChild);"string"==typeof this.elementContents?this.element.innerHTML=this.elementContents:this.element.appendChild(this.elementContents),this.element.insertBefore(this.arrowElement,this.element.firstChild)},Group.prototype.getElement=function(){this.addBindingsd=!1,this._visSet(),this.visible?this.element.classList.add("tabulator-group-visible"):this.element.classList.remove("tabulator-group-visible");for(var t=0;tr.length&&console.warn("Error creating group headers, groupHeader array is shorter than groupBy array"),t.headerGenerator=[function(){return""}],this.startOpen=[function(){return!1}],t.table.modules.localize.bind("groups|item",function(o,e){t.headerGenerator[0]=function(t,r,i){return(void 0===t?"":t)+"("+r+" "+(1===r?o:e.groups.items)+")"}}),this.groupIDLookups=[],Array.isArray(o)||o)this.table.modExists("columnCalcs")&&"table"!=this.table.options.columnCalcs&&"both"!=this.table.options.columnCalcs&&this.table.modules.columnCalcs.removeCalcs();else if(this.table.modExists("columnCalcs")&&"group"!=this.table.options.columnCalcs){var i=this.table.columnManager.getRealColumns();i.forEach(function(o){o.definition.topCalc&&t.table.modules.columnCalcs.initializeTopRow(),o.definition.bottomCalc&&t.table.modules.columnCalcs.initializeBottomRow()})}Array.isArray(o)||(o=[o]),o.forEach(function(o,e){var r,i;"function"==typeof o?r=o:(i=t.table.columnManager.getColumnByField(o),r=i?function(t){return i.getFieldValue(t)}:function(t){return t[o]}),t.groupIDLookups.push({field:"function"!=typeof o&&o,func:r,values:!!t.allowedValues&&t.allowedValues[e]})}),e&&(Array.isArray(e)||(e=[e]),e.forEach(function(t){t="function"==typeof t?t:function(){return!0}}),t.startOpen=e),r&&(t.headerGenerator=Array.isArray(r)?r:[r]),this.initialized=!0},GroupRows.prototype.setDisplayIndex=function(t){this.displayIndex=t},GroupRows.prototype.getDisplayIndex=function(){return this.displayIndex},GroupRows.prototype.getRows=function(t){return this.groupIDLookups.length?(this.table.options.dataGrouping.call(this.table),this.generateGroups(t),this.table.options.dataGrouped&&this.table.options.dataGrouped.call(this.table,this.getGroups(!0)),this.updateGroupRows()):t.slice(0)},GroupRows.prototype.getGroups=function(t){var o=[];return this.groupList.forEach(function(e){o.push(t?e.getComponent():e)}),o},GroupRows.prototype.getChildGroups=function(t){var o=this,e=[];return t||(t=this),t.groupList.forEach(function(t){t.groupList.length?e=e.concat(o.getChildGroups(t)):e.push(t)}),e},GroupRows.prototype.wipe=function(){this.groupList.forEach(function(t){t.wipe()})},GroupRows.prototype.pullGroupListData=function(t){var o=this,e=[];return t.forEach(function(t){var r={};r.level=0,r.rowCount=0,r.headerContent="";var i=[];t.hasSubGroups?(i=o.pullGroupListData(t.groupList),r.level=t.level,r.rowCount=i.length-t.groupList.length,r.headerContent=t.generator(t.key,r.rowCount,t.rows,t),e.push(r),e=e.concat(i)):(r.level=t.level,r.headerContent=t.generator(t.key,t.rows.length,t.rows,t),r.rowCount=t.getRows().length,e.push(r),t.getRows().forEach(function(t){e.push(t.getData("data"))}))}),e},GroupRows.prototype.getGroupedData=function(){return this.pullGroupListData(this.groupList)},GroupRows.prototype.getRowGroup=function(t){var o=!1;return this.groupList.forEach(function(e){var r=e.getRowGroup(t);r&&(o=r)}),o},GroupRows.prototype.countGroups=function(){return this.groupList.length},GroupRows.prototype.generateGroups=function(t){var o=this,e=o.groups;o.groups={},o.groupList=[],this.allowedValues&&this.allowedValues[0]?(this.allowedValues[0].forEach(function(t){o.createGroup(t,0,e)}),t.forEach(function(t){o.assignRowToExistingGroup(t,e)})):t.forEach(function(t){o.assignRowToGroup(t,e)})},GroupRows.prototype.createGroup=function(t,o,e){var r,i=o+"_"+t;e=e||[],r=new Group(this,!1,o,t,this.groupIDLookups[0].field,this.headerGenerator[0],e[i]),this.groups[i]=r,this.groupList.push(r)},GroupRows.prototype.assignRowToExistingGroup=function(t,o){var e=this.groupIDLookups[0].func(t.getData()),r="0_"+e;this.groups[r]&&this.groups[r].addRow(t)},GroupRows.prototype.assignRowToGroup=function(t,o){var e=this.groupIDLookups[0].func(t.getData()),r=!this.groups["0_"+e];return r&&this.createGroup(e,0,o),this.groups["0_"+e].addRow(t),!r},GroupRows.prototype.updateGroupRows=function(t){var o=this,e=[];if(o.groupList.forEach(function(t){e=e.concat(t.getHeadersAndRows())}),t){var r=o.table.rowManager.setDisplayRows(e,this.getDisplayIndex());!0!==r&&this.setDisplayIndex(r),o.table.rowManager.refreshActiveData("group",!0,!0)}return e},GroupRows.prototype.scrollHeaders=function(t){t+="px",this.groupList.forEach(function(o){o.scrollHeader(t)})},GroupRows.prototype.removeGroup=function(t){var o,e=t.level+"_"+t.key;this.groups[e]&&(delete this.groups[e],(o=this.groupList.indexOf(t))>-1&&this.groupList.splice(o,1))},Tabulator.prototype.registerModule("groupRows",GroupRows); \ No newline at end of file diff --git a/admin/js/vendors/tabulator/js/modules/history.js b/admin/js/vendors/tabulator/js/modules/history.js new file mode 100644 index 0000000..1c3ae3e --- /dev/null +++ b/admin/js/vendors/tabulator/js/modules/history.js @@ -0,0 +1,141 @@ +/* Tabulator v4.7.0 (c) Oliver Folkerd */ + +var History = function History(table) { + this.table = table; //hold Tabulator object + + this.history = []; + this.index = -1; +}; + +History.prototype.clear = function () { + this.history = []; + this.index = -1; +}; + +History.prototype.action = function (type, component, data) { + + this.history = this.history.slice(0, this.index + 1); + + this.history.push({ + type: type, + component: component, + data: data + }); + + this.index++; +}; + +History.prototype.getHistoryUndoSize = function () { + return this.index + 1; +}; + +History.prototype.getHistoryRedoSize = function () { + return this.history.length - (this.index + 1); +}; + +History.prototype.undo = function () { + + if (this.index > -1) { + var action = this.history[this.index]; + + this.undoers[action.type].call(this, action); + + this.index--; + + this.table.options.historyUndo.call(this.table, action.type, action.component.getComponent(), action.data); + + return true; + } else { + console.warn("History Undo Error - No more history to undo"); + return false; + } +}; + +History.prototype.redo = function () { + if (this.history.length - 1 > this.index) { + + this.index++; + + var action = this.history[this.index]; + + this.redoers[action.type].call(this, action); + + this.table.options.historyRedo.call(this.table, action.type, action.component.getComponent(), action.data); + + return true; + } else { + console.warn("History Redo Error - No more history to redo"); + return false; + } +}; + +History.prototype.undoers = { + cellEdit: function cellEdit(action) { + action.component.setValueProcessData(action.data.oldValue); + }, + + rowAdd: function rowAdd(action) { + action.component.deleteActual(); + }, + + rowDelete: function rowDelete(action) { + var newRow = this.table.rowManager.addRowActual(action.data.data, action.data.pos, action.data.index); + + if (this.table.options.groupBy && this.table.modExists("groupRows")) { + this.table.modules.groupRows.updateGroupRows(true); + } + + this._rebindRow(action.component, newRow); + }, + + rowMove: function rowMove(action) { + this.table.rowManager.moveRowActual(action.component, this.table.rowManager.rows[action.data.posFrom], !action.data.after); + this.table.rowManager.redraw(); + } +}; + +History.prototype.redoers = { + cellEdit: function cellEdit(action) { + action.component.setValueProcessData(action.data.newValue); + }, + + rowAdd: function rowAdd(action) { + var newRow = this.table.rowManager.addRowActual(action.data.data, action.data.pos, action.data.index); + + if (this.table.options.groupBy && this.table.modExists("groupRows")) { + this.table.modules.groupRows.updateGroupRows(true); + } + + this._rebindRow(action.component, newRow); + }, + + rowDelete: function rowDelete(action) { + action.component.deleteActual(); + }, + + rowMove: function rowMove(action) { + this.table.rowManager.moveRowActual(action.component, this.table.rowManager.rows[action.data.posTo], action.data.after); + this.table.rowManager.redraw(); + } +}; + +//rebind rows to new element after deletion +History.prototype._rebindRow = function (oldRow, newRow) { + this.history.forEach(function (action) { + if (action.component instanceof Row) { + if (action.component === oldRow) { + action.component = newRow; + } + } else if (action.component instanceof Cell) { + if (action.component.row === oldRow) { + var field = action.component.column.getField(); + + if (field) { + action.component = newRow.getCell(field); + } + } + } + }); +}; + +Tabulator.prototype.registerModule("history", History); \ No newline at end of file diff --git a/admin/js/vendors/tabulator/js/modules/history.min.js b/admin/js/vendors/tabulator/js/modules/history.min.js new file mode 100644 index 0000000..5df3187 --- /dev/null +++ b/admin/js/vendors/tabulator/js/modules/history.min.js @@ -0,0 +1,2 @@ +/* Tabulator v4.7.0 (c) Oliver Folkerd */ +var History=function(t){this.table=t,this.history=[],this.index=-1};History.prototype.clear=function(){this.history=[],this.index=-1},History.prototype.action=function(t,o,e){this.history=this.history.slice(0,this.index+1),this.history.push({type:t,component:o,data:e}),this.index++},History.prototype.getHistoryUndoSize=function(){return this.index+1},History.prototype.getHistoryRedoSize=function(){return this.history.length-(this.index+1)},History.prototype.undo=function(){if(this.index>-1){var t=this.history[this.index];return this.undoers[t.type].call(this,t),this.index--,this.table.options.historyUndo.call(this.table,t.type,t.component.getComponent(),t.data),!0}return console.warn("History Undo Error - No more history to undo"),!1},History.prototype.redo=function(){if(this.history.length-1>this.index){this.index++;var t=this.history[this.index];return this.redoers[t.type].call(this,t),this.table.options.historyRedo.call(this.table,t.type,t.component.getComponent(),t.data),!0}return console.warn("History Redo Error - No more history to redo"),!1},History.prototype.undoers={cellEdit:function(t){t.component.setValueProcessData(t.data.oldValue)},rowAdd:function(t){t.component.deleteActual()},rowDelete:function(t){var o=this.table.rowManager.addRowActual(t.data.data,t.data.pos,t.data.index);this.table.options.groupBy&&this.table.modExists("groupRows")&&this.table.modules.groupRows.updateGroupRows(!0),this._rebindRow(t.component,o)},rowMove:function(t){this.table.rowManager.moveRowActual(t.component,this.table.rowManager.rows[t.data.posFrom],!t.data.after),this.table.rowManager.redraw()}},History.prototype.redoers={cellEdit:function(t){t.component.setValueProcessData(t.data.newValue)},rowAdd:function(t){var o=this.table.rowManager.addRowActual(t.data.data,t.data.pos,t.data.index);this.table.options.groupBy&&this.table.modExists("groupRows")&&this.table.modules.groupRows.updateGroupRows(!0),this._rebindRow(t.component,o)},rowDelete:function(t){t.component.deleteActual()},rowMove:function(t){this.table.rowManager.moveRowActual(t.component,this.table.rowManager.rows[t.data.posTo],t.data.after),this.table.rowManager.redraw()}},History.prototype._rebindRow=function(t,o){this.history.forEach(function(e){if(e.component instanceof Row)e.component===t&&(e.component=o);else if(e.component instanceof Cell&&e.component.row===t){var i=e.component.column.getField();i&&(e.component=o.getCell(i))}})},Tabulator.prototype.registerModule("history",History); \ No newline at end of file diff --git a/admin/js/vendors/tabulator/js/modules/html_table_import.js b/admin/js/vendors/tabulator/js/modules/html_table_import.js new file mode 100644 index 0000000..34fed7c --- /dev/null +++ b/admin/js/vendors/tabulator/js/modules/html_table_import.js @@ -0,0 +1,191 @@ +var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; + +/* Tabulator v4.7.0 (c) Oliver Folkerd */ + +var HtmlTableImport = function HtmlTableImport(table) { + this.table = table; //hold Tabulator object + this.fieldIndex = []; + this.hasIndex = false; +}; + +HtmlTableImport.prototype.parseTable = function () { + var self = this, + element = self.table.element, + options = self.table.options, + columns = options.columns, + headers = element.getElementsByTagName("th"), + rows = element.getElementsByTagName("tbody")[0], + data = [], + newTable; + + self.hasIndex = false; + + self.table.options.htmlImporting.call(this.table); + + rows = rows ? rows.getElementsByTagName("tr") : []; + + //check for tablator inline options + self._extractOptions(element, options); + + if (headers.length) { + self._extractHeaders(headers, rows); + } else { + self._generateBlankHeaders(headers, rows); + } + + //iterate through table rows and build data set + for (var index = 0; index < rows.length; index++) { + var row = rows[index], + cells = row.getElementsByTagName("td"), + item = {}; + + //create index if the dont exist in table + if (!self.hasIndex) { + item[options.index] = index; + } + + for (var i = 0; i < cells.length; i++) { + var cell = cells[i]; + if (typeof this.fieldIndex[i] !== "undefined") { + item[this.fieldIndex[i]] = cell.innerHTML; + } + } + + //add row data to item + data.push(item); + } + + //create new element + var newElement = document.createElement("div"); + + //transfer attributes to new element + var attributes = element.attributes; + + // loop through attributes and apply them on div + + for (var i in attributes) { + if (_typeof(attributes[i]) == "object") { + newElement.setAttribute(attributes[i].name, attributes[i].value); + } + } + + // replace table with div element + element.parentNode.replaceChild(newElement, element); + + options.data = data; + + self.table.options.htmlImported.call(this.table); + + // // newElement.tabulator(options); + + this.table.element = newElement; +}; + +//extract tabulator attribute options +HtmlTableImport.prototype._extractOptions = function (element, options, defaultOptions) { + var attributes = element.attributes; + var optionsArr = defaultOptions ? Object.assign([], defaultOptions) : Object.keys(options); + var optionsList = {}; + + optionsArr.forEach(function (item) { + optionsList[item.toLowerCase()] = item; + }); + + for (var index in attributes) { + var attrib = attributes[index]; + var name; + + if (attrib && (typeof attrib === "undefined" ? "undefined" : _typeof(attrib)) == "object" && attrib.name && attrib.name.indexOf("tabulator-") === 0) { + name = attrib.name.replace("tabulator-", ""); + + if (typeof optionsList[name] !== "undefined") { + options[optionsList[name]] = this._attribValue(attrib.value); + } + } + } +}; + +//get value of attribute +HtmlTableImport.prototype._attribValue = function (value) { + if (value === "true") { + return true; + } + + if (value === "false") { + return false; + } + + return value; +}; + +//find column if it has already been defined +HtmlTableImport.prototype._findCol = function (title) { + var match = this.table.options.columns.find(function (column) { + return column.title === title; + }); + + return match || false; +}; + +//extract column from headers +HtmlTableImport.prototype._extractHeaders = function (headers, rows) { + for (var index = 0; index < headers.length; index++) { + var header = headers[index], + exists = false, + col = this._findCol(header.textContent), + width, + attributes; + + if (col) { + exists = true; + } else { + col = { title: header.textContent.trim() }; + } + + if (!col.field) { + col.field = header.textContent.trim().toLowerCase().replace(" ", "_"); + } + + width = header.getAttribute("width"); + + if (width && !col.width) { + col.width = width; + } + + //check for tablator inline options + attributes = header.attributes; + + // //check for tablator inline options + this._extractOptions(header, col, Column.prototype.defaultOptionList); + + this.fieldIndex[index] = col.field; + + if (col.field == this.table.options.index) { + this.hasIndex = true; + } + + if (!exists) { + this.table.options.columns.push(col); + } + } +}; + +//generate blank headers +HtmlTableImport.prototype._generateBlankHeaders = function (headers, rows) { + for (var index = 0; index < headers.length; index++) { + var header = headers[index], + col = { title: "", field: "col" + index }; + + this.fieldIndex[index] = col.field; + + var width = header.getAttribute("width"); + + if (width) { + col.width = width; + } + + this.table.options.columns.push(col); + } +}; + +Tabulator.prototype.registerModule("htmlTableImport", HtmlTableImport); \ No newline at end of file diff --git a/admin/js/vendors/tabulator/js/modules/html_table_import.min.js b/admin/js/vendors/tabulator/js/modules/html_table_import.min.js new file mode 100644 index 0000000..aef2b5c --- /dev/null +++ b/admin/js/vendors/tabulator/js/modules/html_table_import.min.js @@ -0,0 +1,2 @@ +/* Tabulator v4.7.0 (c) Oliver Folkerd */ +var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},HtmlTableImport=function(t){this.table=t,this.fieldIndex=[],this.hasIndex=!1};HtmlTableImport.prototype.parseTable=function(){var t=this,e=t.table.element,o=t.table.options,a=(o.columns,e.getElementsByTagName("th")),n=e.getElementsByTagName("tbody")[0],l=[];t.hasIndex=!1,t.table.options.htmlImporting.call(this.table),n=n?n.getElementsByTagName("tr"):[],t._extractOptions(e,o),a.length?t._extractHeaders(a,n):t._generateBlankHeaders(a,n);for(var r=0;r -1) { + self.pressedKeys.splice(index, 1); + } + } + }; + + this.table.element.addEventListener("keydown", this.keyupBinding); + + this.table.element.addEventListener("keyup", this.keydownBinding); +}; + +Keybindings.prototype.clearBindings = function () { + if (this.keyupBinding) { + this.table.element.removeEventListener("keydown", this.keyupBinding); + } + + if (this.keydownBinding) { + this.table.element.removeEventListener("keyup", this.keydownBinding); + } +}; + +Keybindings.prototype.checkBinding = function (e, binding) { + var self = this, + match = true; + + if (e.ctrlKey == binding.ctrl && e.shiftKey == binding.shift && e.metaKey == binding.meta) { + binding.keys.forEach(function (key) { + var index = self.pressedKeys.indexOf(key); + + if (index == -1) { + match = false; + } + }); + + if (match) { + binding.action.call(self, e); + } + + return true; + } + + return false; +}; + +//default bindings +Keybindings.prototype.bindings = { + navPrev: "shift + 9", + navNext: 9, + navUp: 38, + navDown: 40, + scrollPageUp: 33, + scrollPageDown: 34, + scrollToStart: 36, + scrollToEnd: 35, + undo: "ctrl + 90", + redo: "ctrl + 89", + copyToClipboard: "ctrl + 67" +}; + +//default actions +Keybindings.prototype.actions = { + keyBlock: function keyBlock(e) { + e.stopPropagation(); + e.preventDefault(); + }, + scrollPageUp: function scrollPageUp(e) { + var rowManager = this.table.rowManager, + newPos = rowManager.scrollTop - rowManager.height, + scrollMax = rowManager.element.scrollHeight; + + e.preventDefault(); + + if (rowManager.displayRowsCount) { + if (newPos >= 0) { + rowManager.element.scrollTop = newPos; + } else { + rowManager.scrollToRow(rowManager.getDisplayRows()[0]); + } + } + + this.table.element.focus(); + }, + scrollPageDown: function scrollPageDown(e) { + var rowManager = this.table.rowManager, + newPos = rowManager.scrollTop + rowManager.height, + scrollMax = rowManager.element.scrollHeight; + + e.preventDefault(); + + if (rowManager.displayRowsCount) { + if (newPos <= scrollMax) { + rowManager.element.scrollTop = newPos; + } else { + rowManager.scrollToRow(rowManager.getDisplayRows()[rowManager.displayRowsCount - 1]); + } + } + + this.table.element.focus(); + }, + scrollToStart: function scrollToStart(e) { + var rowManager = this.table.rowManager; + + e.preventDefault(); + + if (rowManager.displayRowsCount) { + rowManager.scrollToRow(rowManager.getDisplayRows()[0]); + } + + this.table.element.focus(); + }, + scrollToEnd: function scrollToEnd(e) { + var rowManager = this.table.rowManager; + + e.preventDefault(); + + if (rowManager.displayRowsCount) { + rowManager.scrollToRow(rowManager.getDisplayRows()[rowManager.displayRowsCount - 1]); + } + + this.table.element.focus(); + }, + navPrev: function navPrev(e) { + var cell = false; + + if (this.table.modExists("edit")) { + cell = this.table.modules.edit.currentCell; + + if (cell) { + e.preventDefault(); + cell.nav().prev(); + } + } + }, + + navNext: function navNext(e) { + var cell = false; + var newRow = this.table.options.tabEndNewRow; + var nav; + + if (this.table.modExists("edit")) { + cell = this.table.modules.edit.currentCell; + + if (cell) { + e.preventDefault(); + + nav = cell.nav(); + + if (!nav.next()) { + if (newRow) { + + cell.getElement().firstChild.blur(); + + if (newRow === true) { + newRow = this.table.addRow({}); + } else { + if (typeof newRow == "function") { + newRow = this.table.addRow(newRow(cell.row.getComponent())); + } else { + newRow = this.table.addRow(Object.assign({}, newRow)); + } + } + + newRow.then(function () { + setTimeout(function () { + nav.next(); + }); + }); + } + } + } + } + }, + + navLeft: function navLeft(e) { + var cell = false; + + if (this.table.modExists("edit")) { + cell = this.table.modules.edit.currentCell; + + if (cell) { + e.preventDefault(); + cell.nav().left(); + } + } + }, + + navRight: function navRight(e) { + var cell = false; + + if (this.table.modExists("edit")) { + cell = this.table.modules.edit.currentCell; + + if (cell) { + e.preventDefault(); + cell.nav().right(); + } + } + }, + + navUp: function navUp(e) { + var cell = false; + + if (this.table.modExists("edit")) { + cell = this.table.modules.edit.currentCell; + + if (cell) { + e.preventDefault(); + cell.nav().up(); + } + } + }, + + navDown: function navDown(e) { + var cell = false; + + if (this.table.modExists("edit")) { + cell = this.table.modules.edit.currentCell; + + if (cell) { + e.preventDefault(); + cell.nav().down(); + } + } + }, + + undo: function undo(e) { + var cell = false; + if (this.table.options.history && this.table.modExists("history") && this.table.modExists("edit")) { + + cell = this.table.modules.edit.currentCell; + + if (!cell) { + e.preventDefault(); + this.table.modules.history.undo(); + } + } + }, + + redo: function redo(e) { + var cell = false; + if (this.table.options.history && this.table.modExists("history") && this.table.modExists("edit")) { + + cell = this.table.modules.edit.currentCell; + + if (!cell) { + e.preventDefault(); + this.table.modules.history.redo(); + } + } + }, + + copyToClipboard: function copyToClipboard(e) { + if (!this.table.modules.edit.currentCell) { + if (this.table.modExists("clipboard", true)) { + this.table.modules.clipboard.copy(false, true); + } + } + } +}; + +Tabulator.prototype.registerModule("keybindings", Keybindings); \ No newline at end of file diff --git a/admin/js/vendors/tabulator/js/modules/keybindings.min.js b/admin/js/vendors/tabulator/js/modules/keybindings.min.js new file mode 100644 index 0000000..3535b88 --- /dev/null +++ b/admin/js/vendors/tabulator/js/modules/keybindings.min.js @@ -0,0 +1,2 @@ +/* Tabulator v4.7.0 (c) Oliver Folkerd */ +var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Keybindings=function(t){this.table=t,this.watchKeys=null,this.pressedKeys=null,this.keyupBinding=!1,this.keydownBinding=!1};Keybindings.prototype.initialize=function(){var t=this.table.options.keybindings,e={};if(this.watchKeys={},this.pressedKeys=[],!1!==t){for(var i in this.bindings)e[i]=this.bindings[i];if(Object.keys(t).length)for(var n in t)e[n]=t[n];this.mapBindings(e),this.bindEvents()}},Keybindings.prototype.mapBindings=function(t){var e=this,i=this;for(var n in t)!function(n){e.actions[n]?t[n]&&("object"!==_typeof(t[n])&&(t[n]=[t[n]]),t[n].forEach(function(t){i.mapBinding(n,t)})):console.warn("Key Binding Error - no such action:",n)}(n)},Keybindings.prototype.mapBinding=function(t,e){var i=this,n={action:this.actions[t],keys:[],ctrl:!1,shift:!1,meta:!1};e.toString().toLowerCase().split(" ").join("").split("+").forEach(function(t){switch(t){case"ctrl":n.ctrl=!0;break;case"shift":n.shift=!0;break;case"meta":n.meta=!0;break;default:t=parseInt(t),n.keys.push(t),i.watchKeys[t]||(i.watchKeys[t]=[]),i.watchKeys[t].push(n)}})},Keybindings.prototype.bindEvents=function(){var t=this;this.keyupBinding=function(e){var i=e.keyCode,n=t.watchKeys[i];n&&(t.pressedKeys.push(i),n.forEach(function(i){t.checkBinding(e,i)}))},this.keydownBinding=function(e){var i=e.keyCode;if(t.watchKeys[i]){var n=t.pressedKeys.indexOf(i);n>-1&&t.pressedKeys.splice(n,1)}},this.table.element.addEventListener("keydown",this.keyupBinding),this.table.element.addEventListener("keyup",this.keydownBinding)},Keybindings.prototype.clearBindings=function(){this.keyupBinding&&this.table.element.removeEventListener("keydown",this.keyupBinding),this.keydownBinding&&this.table.element.removeEventListener("keyup",this.keydownBinding)},Keybindings.prototype.checkBinding=function(t,e){var i=this,n=!0;return t.ctrlKey==e.ctrl&&t.shiftKey==e.shift&&t.metaKey==e.meta&&(e.keys.forEach(function(t){-1==i.pressedKeys.indexOf(t)&&(n=!1)}),n&&e.action.call(i,t),!0)},Keybindings.prototype.bindings={navPrev:"shift + 9",navNext:9,navUp:38,navDown:40,scrollPageUp:33,scrollPageDown:34,scrollToStart:36,scrollToEnd:35,undo:"ctrl + 90",redo:"ctrl + 89",copyToClipboard:"ctrl + 67"},Keybindings.prototype.actions={keyBlock:function(t){t.stopPropagation(),t.preventDefault()},scrollPageUp:function(t){var e=this.table.rowManager,i=e.scrollTop-e.height;e.element.scrollHeight;t.preventDefault(),e.displayRowsCount&&(i>=0?e.element.scrollTop=i:e.scrollToRow(e.getDisplayRows()[0])),this.table.element.focus()},scrollPageDown:function(t){var e=this.table.rowManager,i=e.scrollTop+e.height,n=e.element.scrollHeight;t.preventDefault(),e.displayRowsCount&&(i<=n?e.element.scrollTop=i:e.scrollToRow(e.getDisplayRows()[e.displayRowsCount-1])),this.table.element.focus()},scrollToStart:function(t){var e=this.table.rowManager;t.preventDefault(),e.displayRowsCount&&e.scrollToRow(e.getDisplayRows()[0]),this.table.element.focus()},scrollToEnd:function(t){var e=this.table.rowManager;t.preventDefault(),e.displayRowsCount&&e.scrollToRow(e.getDisplayRows()[e.displayRowsCount-1]),this.table.element.focus()},navPrev:function(t){var e=!1;this.table.modExists("edit")&&(e=this.table.modules.edit.currentCell)&&(t.preventDefault(),e.nav().prev())},navNext:function(t){var e,i=!1,n=this.table.options.tabEndNewRow;this.table.modExists("edit")&&(i=this.table.modules.edit.currentCell)&&(t.preventDefault(),e=i.nav(),e.next()||n&&(i.getElement().firstChild.blur(),n=!0===n?this.table.addRow({}):"function"==typeof n?this.table.addRow(n(i.row.getComponent())):this.table.addRow(Object.assign({},n)),n.then(function(){setTimeout(function(){e.next()})})))},navLeft:function(t){var e=!1;this.table.modExists("edit")&&(e=this.table.modules.edit.currentCell)&&(t.preventDefault(),e.nav().left())},navRight:function(t){var e=!1;this.table.modExists("edit")&&(e=this.table.modules.edit.currentCell)&&(t.preventDefault(),e.nav().right())},navUp:function(t){var e=!1;this.table.modExists("edit")&&(e=this.table.modules.edit.currentCell)&&(t.preventDefault(),e.nav().up())},navDown:function(t){var e=!1;this.table.modExists("edit")&&(e=this.table.modules.edit.currentCell)&&(t.preventDefault(),e.nav().down())},undo:function(t){this.table.options.history&&this.table.modExists("history")&&this.table.modExists("edit")&&(this.table.modules.edit.currentCell||(t.preventDefault(),this.table.modules.history.undo()))},redo:function(t){this.table.options.history&&this.table.modExists("history")&&this.table.modExists("edit")&&(this.table.modules.edit.currentCell||(t.preventDefault(),this.table.modules.history.redo()))},copyToClipboard:function(t){this.table.modules.edit.currentCell||this.table.modExists("clipboard",!0)&&this.table.modules.clipboard.copy(!1,!0)}},Tabulator.prototype.registerModule("keybindings",Keybindings); \ No newline at end of file diff --git a/admin/js/vendors/tabulator/js/modules/menu.js b/admin/js/vendors/tabulator/js/modules/menu.js new file mode 100644 index 0000000..d86575f --- /dev/null +++ b/admin/js/vendors/tabulator/js/modules/menu.js @@ -0,0 +1,200 @@ +/* Tabulator v4.7.0 (c) Oliver Folkerd */ + +var Menu = function Menu(table) { + this.table = table; //hold Tabulator object + this.menuEl = false; + this.blurEvent = this.hideMenu.bind(this); + this.escEvent = this.escMenu.bind(this); + this.nestedMenuBlock = false; +}; + +Menu.prototype.initializeColumnHeader = function (column) { + var _this = this; + + var headerMenuEl; + + if (column.definition.headerContextMenu) { + column.getElement().addEventListener("contextmenu", function (e) { + var menu = typeof column.definition.headerContextMenu == "function" ? column.definition.headerContextMenu(column.getComponent()) : column.definition.headerContextMenu; + + e.preventDefault(); + + _this.loadMenu(e, column, menu); + }); + } + + if (column.definition.headerMenu) { + + headerMenuEl = document.createElement("span"); + headerMenuEl.classList.add("tabulator-header-menu-button"); + headerMenuEl.innerHTML = "⋮"; + + headerMenuEl.addEventListener("click", function (e) { + var menu = typeof column.definition.headerMenu == "function" ? column.definition.headerMenu(column.getComponent()) : column.definition.headerMenu; + e.stopPropagation(); + e.preventDefault(); + + _this.loadMenu(e, column, menu); + }); + + column.titleElement.insertBefore(headerMenuEl, column.titleElement.firstChild); + } +}; + +Menu.prototype.initializeCell = function (cell) { + var _this2 = this; + + cell.getElement().addEventListener("contextmenu", function (e) { + var menu = typeof cell.column.definition.contextMenu == "function" ? cell.column.definition.contextMenu(cell.getComponent()) : cell.column.definition.contextMenu; + + e.stopImmediatePropagation(); + + _this2.loadMenu(e, cell, menu); + }); +}; + +Menu.prototype.initializeRow = function (row) { + var _this3 = this; + + row.getElement().addEventListener("contextmenu", function (e) { + var menu = typeof _this3.table.options.rowContextMenu == "function" ? _this3.table.options.rowContextMenu(row.getComponent()) : _this3.table.options.rowContextMenu; + + _this3.loadMenu(e, row, menu); + }); +}; + +Menu.prototype.initializeGroup = function (group) { + var _this4 = this; + + group.getElement().addEventListener("contextmenu", function (e) { + var menu = typeof _this4.table.options.groupContextMenu == "function" ? _this4.table.options.groupContextMenu(group.getComponent()) : _this4.table.options.groupContextMenu; + + _this4.loadMenu(e, group, menu); + }); +}; + +Menu.prototype.loadMenu = function (e, component, menu) { + var _this5 = this; + + var docHeight = Math.max(document.body.offsetHeight, window.innerHeight); + + e.preventDefault(); + + //abort if no menu set + if (!menu || !menu.length) { + return; + } + + if (this.nestedMenuBlock) { + //abort if child menu already open + if (this.isOpen()) { + return; + } + } else { + this.nestedMenuBlock = setTimeout(function () { + _this5.nestedMenuBlock = false; + }, 100); + } + + this.hideMenu(); + + this.menuEl = document.createElement("div"); + this.menuEl.classList.add("tabulator-menu"); + + menu.forEach(function (item) { + var itemEl = document.createElement("div"); + var label = item.label; + var disabled = item.disabled; + + if (item.separator) { + itemEl.classList.add("tabulator-menu-separator"); + } else { + itemEl.classList.add("tabulator-menu-item"); + + if (typeof label == "function") { + label = label(component.getComponent()); + } + + if (label instanceof Node) { + itemEl.appendChild(label); + } else { + itemEl.innerHTML = label; + } + + if (typeof disabled == "function") { + disabled = disabled(component.getComponent()); + } + + if (disabled) { + itemEl.classList.add("tabulator-menu-item-disabled"); + itemEl.addEventListener("click", function (e) { + e.stopPropagation(); + }); + } else { + itemEl.addEventListener("click", function (e) { + _this5.hideMenu(); + item.action(e, component.getComponent()); + }); + } + } + + _this5.menuEl.appendChild(itemEl); + }); + + this.menuEl.style.top = e.pageY + "px"; + this.menuEl.style.left = e.pageX + "px"; + + document.body.addEventListener("click", this.blurEvent); + this.table.rowManager.element.addEventListener("scroll", this.blurEvent); + + setTimeout(function () { + document.body.addEventListener("contextmenu", _this5.blurEvent); + }, 100); + + document.body.addEventListener("keydown", this.escEvent); + + document.body.appendChild(this.menuEl); + + //move menu to start on right edge if it is too close to the edge of the screen + if (e.pageX + this.menuEl.offsetWidth >= document.body.offsetWidth) { + this.menuEl.style.left = ""; + this.menuEl.style.right = document.body.offsetWidth - e.pageX + "px"; + } + + //move menu to start on bottom edge if it is too close to the edge of the screen + if (e.pageY + this.menuEl.offsetHeight >= docHeight) { + this.menuEl.style.top = ""; + this.menuEl.style.bottom = docHeight - e.pageY + "px"; + } +}; + +Menu.prototype.isOpen = function () { + return !!this.menuEl.parentNode; +}; + +Menu.prototype.escMenu = function (e) { + if (e.keyCode == 27) { + this.hideMenu(); + } +}; + +Menu.prototype.hideMenu = function () { + if (this.menuEl.parentNode) { + this.menuEl.parentNode.removeChild(this.menuEl); + } + + if (this.escEvent) { + document.body.removeEventListener("keydown", this.escEvent); + } + + if (this.blurEvent) { + document.body.removeEventListener("click", this.blurEvent); + document.body.removeEventListener("contextmenu", this.blurEvent); + this.table.rowManager.element.removeEventListener("scroll", this.blurEvent); + } +}; + +//default accessors +Menu.prototype.menus = {}; + +Tabulator.prototype.registerModule("menu", Menu); \ No newline at end of file diff --git a/admin/js/vendors/tabulator/js/modules/menu.min.js b/admin/js/vendors/tabulator/js/modules/menu.min.js new file mode 100644 index 0000000..40b8241 --- /dev/null +++ b/admin/js/vendors/tabulator/js/modules/menu.min.js @@ -0,0 +1,2 @@ +/* Tabulator v4.7.0 (c) Oliver Folkerd */ +var Menu=function(e){this.table=e,this.menuEl=!1,this.blurEvent=this.hideMenu.bind(this),this.escEvent=this.escMenu.bind(this),this.nestedMenuBlock=!1};Menu.prototype.initializeColumnHeader=function(e){var t,n=this;e.definition.headerContextMenu&&e.getElement().addEventListener("contextmenu",function(t){var o="function"==typeof e.definition.headerContextMenu?e.definition.headerContextMenu(e.getComponent()):e.definition.headerContextMenu;t.preventDefault(),n.loadMenu(t,e,o)}),e.definition.headerMenu&&(t=document.createElement("span"),t.classList.add("tabulator-header-menu-button"),t.innerHTML="⋮",t.addEventListener("click",function(t){var o="function"==typeof e.definition.headerMenu?e.definition.headerMenu(e.getComponent()):e.definition.headerMenu;t.stopPropagation(),t.preventDefault(),n.loadMenu(t,e,o)}),e.titleElement.insertBefore(t,e.titleElement.firstChild))},Menu.prototype.initializeCell=function(e){var t=this;e.getElement().addEventListener("contextmenu",function(n){var o="function"==typeof e.column.definition.contextMenu?e.column.definition.contextMenu(e.getComponent()):e.column.definition.contextMenu;n.stopImmediatePropagation(),t.loadMenu(n,e,o)})},Menu.prototype.initializeRow=function(e){var t=this;e.getElement().addEventListener("contextmenu",function(n){var o="function"==typeof t.table.options.rowContextMenu?t.table.options.rowContextMenu(e.getComponent()):t.table.options.rowContextMenu;t.loadMenu(n,e,o)})},Menu.prototype.initializeGroup=function(e){var t=this;e.getElement().addEventListener("contextmenu",function(n){var o="function"==typeof t.table.options.groupContextMenu?t.table.options.groupContextMenu(e.getComponent()):t.table.options.groupContextMenu;t.loadMenu(n,e,o)})},Menu.prototype.loadMenu=function(e,t,n){var o=this,i=Math.max(document.body.offsetHeight,window.innerHeight);if(e.preventDefault(),n&&n.length){if(this.nestedMenuBlock){if(this.isOpen())return}else this.nestedMenuBlock=setTimeout(function(){o.nestedMenuBlock=!1},100);this.hideMenu(),this.menuEl=document.createElement("div"),this.menuEl.classList.add("tabulator-menu"),n.forEach(function(e){var n=document.createElement("div"),i=e.label,u=e.disabled;e.separator?n.classList.add("tabulator-menu-separator"):(n.classList.add("tabulator-menu-item"),"function"==typeof i&&(i=i(t.getComponent())),i instanceof Node?n.appendChild(i):n.innerHTML=i,"function"==typeof u&&(u=u(t.getComponent())),u?(n.classList.add("tabulator-menu-item-disabled"),n.addEventListener("click",function(e){e.stopPropagation()})):n.addEventListener("click",function(n){o.hideMenu(),e.action(n,t.getComponent())})),o.menuEl.appendChild(n)}),this.menuEl.style.top=e.pageY+"px",this.menuEl.style.left=e.pageX+"px",document.body.addEventListener("click",this.blurEvent),this.table.rowManager.element.addEventListener("scroll",this.blurEvent),setTimeout(function(){document.body.addEventListener("contextmenu",o.blurEvent)},100),document.body.addEventListener("keydown",this.escEvent),document.body.appendChild(this.menuEl),e.pageX+this.menuEl.offsetWidth>=document.body.offsetWidth&&(this.menuEl.style.left="",this.menuEl.style.right=document.body.offsetWidth-e.pageX+"px"),e.pageY+this.menuEl.offsetHeight>=i&&(this.menuEl.style.top="",this.menuEl.style.bottom=i-e.pageY+"px")}},Menu.prototype.isOpen=function(){return!!this.menuEl.parentNode},Menu.prototype.escMenu=function(e){27==e.keyCode&&this.hideMenu()},Menu.prototype.hideMenu=function(){this.menuEl.parentNode&&this.menuEl.parentNode.removeChild(this.menuEl),this.escEvent&&document.body.removeEventListener("keydown",this.escEvent),this.blurEvent&&(document.body.removeEventListener("click",this.blurEvent),document.body.removeEventListener("contextmenu",this.blurEvent),this.table.rowManager.element.removeEventListener("scroll",this.blurEvent))},Menu.prototype.menus={},Tabulator.prototype.registerModule("menu",Menu); \ No newline at end of file diff --git a/admin/js/vendors/tabulator/js/modules/moveable_columns.js b/admin/js/vendors/tabulator/js/modules/moveable_columns.js new file mode 100644 index 0000000..5244016 --- /dev/null +++ b/admin/js/vendors/tabulator/js/modules/moveable_columns.js @@ -0,0 +1,289 @@ +/* Tabulator v4.7.0 (c) Oliver Folkerd */ + +var MoveColumns = function MoveColumns(table) { + this.table = table; //hold Tabulator object + this.placeholderElement = this.createPlaceholderElement(); + this.hoverElement = false; //floating column header element + this.checkTimeout = false; //click check timeout holder + this.checkPeriod = 250; //period to wait on mousedown to consider this a move and not a click + this.moving = false; //currently moving column + this.toCol = false; //destination column + this.toColAfter = false; //position of moving column relative to the desitnation column + this.startX = 0; //starting position within header element + this.autoScrollMargin = 40; //auto scroll on edge when within margin + this.autoScrollStep = 5; //auto scroll distance in pixels + this.autoScrollTimeout = false; //auto scroll timeout + this.touchMove = false; + + this.moveHover = this.moveHover.bind(this); + this.endMove = this.endMove.bind(this); +}; + +MoveColumns.prototype.createPlaceholderElement = function () { + var el = document.createElement("div"); + + el.classList.add("tabulator-col"); + el.classList.add("tabulator-col-placeholder"); + + return el; +}; + +MoveColumns.prototype.initializeColumn = function (column) { + var self = this, + config = {}, + colEl; + + if (!column.modules.frozen) { + + colEl = column.getElement(); + + config.mousemove = function (e) { + if (column.parent === self.moving.parent) { + if ((self.touchMove ? e.touches[0].pageX : e.pageX) - Tabulator.prototype.helpers.elOffset(colEl).left + self.table.columnManager.element.scrollLeft > column.getWidth() / 2) { + if (self.toCol !== column || !self.toColAfter) { + colEl.parentNode.insertBefore(self.placeholderElement, colEl.nextSibling); + self.moveColumn(column, true); + } + } else { + if (self.toCol !== column || self.toColAfter) { + colEl.parentNode.insertBefore(self.placeholderElement, colEl); + self.moveColumn(column, false); + } + } + } + }.bind(self); + + colEl.addEventListener("mousedown", function (e) { + self.touchMove = false; + if (e.which === 1) { + self.checkTimeout = setTimeout(function () { + self.startMove(e, column); + }, self.checkPeriod); + } + }); + + colEl.addEventListener("mouseup", function (e) { + if (e.which === 1) { + if (self.checkTimeout) { + clearTimeout(self.checkTimeout); + } + } + }); + + self.bindTouchEvents(column); + } + + column.modules.moveColumn = config; +}; + +MoveColumns.prototype.bindTouchEvents = function (column) { + var self = this, + colEl = column.getElement(), + startXMove = false, + //shifting center position of the cell + dir = false, + currentCol, + nextCol, + prevCol, + nextColWidth, + prevColWidth, + nextColWidthLast, + prevColWidthLast; + + colEl.addEventListener("touchstart", function (e) { + self.checkTimeout = setTimeout(function () { + self.touchMove = true; + currentCol = column; + nextCol = column.nextColumn(); + nextColWidth = nextCol ? nextCol.getWidth() / 2 : 0; + prevCol = column.prevColumn(); + prevColWidth = prevCol ? prevCol.getWidth() / 2 : 0; + nextColWidthLast = 0; + prevColWidthLast = 0; + startXMove = false; + + self.startMove(e, column); + }, self.checkPeriod); + }, { passive: true }); + + colEl.addEventListener("touchmove", function (e) { + var halfCol, diff, moveToCol; + + if (self.moving) { + self.moveHover(e); + + if (!startXMove) { + startXMove = e.touches[0].pageX; + } + + diff = e.touches[0].pageX - startXMove; + + if (diff > 0) { + if (nextCol && diff - nextColWidthLast > nextColWidth) { + moveToCol = nextCol; + + if (moveToCol !== column) { + startXMove = e.touches[0].pageX; + moveToCol.getElement().parentNode.insertBefore(self.placeholderElement, moveToCol.getElement().nextSibling); + self.moveColumn(moveToCol, true); + } + } + } else { + if (prevCol && -diff - prevColWidthLast > prevColWidth) { + moveToCol = prevCol; + + if (moveToCol !== column) { + startXMove = e.touches[0].pageX; + moveToCol.getElement().parentNode.insertBefore(self.placeholderElement, moveToCol.getElement()); + self.moveColumn(moveToCol, false); + } + } + } + + if (moveToCol) { + currentCol = moveToCol; + nextCol = moveToCol.nextColumn(); + nextColWidthLast = nextColWidth; + nextColWidth = nextCol ? nextCol.getWidth() / 2 : 0; + prevCol = moveToCol.prevColumn(); + prevColWidthLast = prevColWidth; + prevColWidth = prevCol ? prevCol.getWidth() / 2 : 0; + } + } + }, { passive: true }); + + colEl.addEventListener("touchend", function (e) { + if (self.checkTimeout) { + clearTimeout(self.checkTimeout); + } + if (self.moving) { + self.endMove(e); + } + }); +}; + +MoveColumns.prototype.startMove = function (e, column) { + var element = column.getElement(); + + this.moving = column; + this.startX = (this.touchMove ? e.touches[0].pageX : e.pageX) - Tabulator.prototype.helpers.elOffset(element).left; + + this.table.element.classList.add("tabulator-block-select"); + + //create placeholder + this.placeholderElement.style.width = column.getWidth() + "px"; + this.placeholderElement.style.height = column.getHeight() + "px"; + + element.parentNode.insertBefore(this.placeholderElement, element); + element.parentNode.removeChild(element); + + //create hover element + this.hoverElement = element.cloneNode(true); + this.hoverElement.classList.add("tabulator-moving"); + + this.table.columnManager.getElement().appendChild(this.hoverElement); + + this.hoverElement.style.left = "0"; + this.hoverElement.style.bottom = "0"; + + if (!this.touchMove) { + this._bindMouseMove(); + + document.body.addEventListener("mousemove", this.moveHover); + document.body.addEventListener("mouseup", this.endMove); + } + + this.moveHover(e); +}; + +MoveColumns.prototype._bindMouseMove = function () { + this.table.columnManager.columnsByIndex.forEach(function (column) { + if (column.modules.moveColumn.mousemove) { + column.getElement().addEventListener("mousemove", column.modules.moveColumn.mousemove); + } + }); +}; + +MoveColumns.prototype._unbindMouseMove = function () { + this.table.columnManager.columnsByIndex.forEach(function (column) { + if (column.modules.moveColumn.mousemove) { + column.getElement().removeEventListener("mousemove", column.modules.moveColumn.mousemove); + } + }); +}; + +MoveColumns.prototype.moveColumn = function (column, after) { + var movingCells = this.moving.getCells(); + + this.toCol = column; + this.toColAfter = after; + + if (after) { + column.getCells().forEach(function (cell, i) { + var cellEl = cell.getElement(); + cellEl.parentNode.insertBefore(movingCells[i].getElement(), cellEl.nextSibling); + }); + } else { + column.getCells().forEach(function (cell, i) { + var cellEl = cell.getElement(); + cellEl.parentNode.insertBefore(movingCells[i].getElement(), cellEl); + }); + } +}; + +MoveColumns.prototype.endMove = function (e) { + if (e.which === 1 || this.touchMove) { + this._unbindMouseMove(); + + this.placeholderElement.parentNode.insertBefore(this.moving.getElement(), this.placeholderElement.nextSibling); + this.placeholderElement.parentNode.removeChild(this.placeholderElement); + this.hoverElement.parentNode.removeChild(this.hoverElement); + + this.table.element.classList.remove("tabulator-block-select"); + + if (this.toCol) { + this.table.columnManager.moveColumnActual(this.moving, this.toCol, this.toColAfter); + } + + this.moving = false; + this.toCol = false; + this.toColAfter = false; + + if (!this.touchMove) { + document.body.removeEventListener("mousemove", this.moveHover); + document.body.removeEventListener("mouseup", this.endMove); + } + } +}; + +MoveColumns.prototype.moveHover = function (e) { + var self = this, + columnHolder = self.table.columnManager.getElement(), + scrollLeft = columnHolder.scrollLeft, + xPos = (self.touchMove ? e.touches[0].pageX : e.pageX) - Tabulator.prototype.helpers.elOffset(columnHolder).left + scrollLeft, + scrollPos; + + self.hoverElement.style.left = xPos - self.startX + "px"; + + if (xPos - scrollLeft < self.autoScrollMargin) { + if (!self.autoScrollTimeout) { + self.autoScrollTimeout = setTimeout(function () { + scrollPos = Math.max(0, scrollLeft - 5); + self.table.rowManager.getElement().scrollLeft = scrollPos; + self.autoScrollTimeout = false; + }, 1); + } + } + + if (scrollLeft + columnHolder.clientWidth - xPos < self.autoScrollMargin) { + if (!self.autoScrollTimeout) { + self.autoScrollTimeout = setTimeout(function () { + scrollPos = Math.min(columnHolder.clientWidth, scrollLeft + 5); + self.table.rowManager.getElement().scrollLeft = scrollPos; + self.autoScrollTimeout = false; + }, 1); + } + } +}; + +Tabulator.prototype.registerModule("moveColumn", MoveColumns); \ No newline at end of file diff --git a/admin/js/vendors/tabulator/js/modules/moveable_columns.min.js b/admin/js/vendors/tabulator/js/modules/moveable_columns.min.js new file mode 100644 index 0000000..0135a3b --- /dev/null +++ b/admin/js/vendors/tabulator/js/modules/moveable_columns.min.js @@ -0,0 +1,2 @@ +/* Tabulator v4.7.0 (c) Oliver Folkerd */ +var MoveColumns=function(e){this.table=e,this.placeholderElement=this.createPlaceholderElement(),this.hoverElement=!1,this.checkTimeout=!1,this.checkPeriod=250,this.moving=!1,this.toCol=!1,this.toColAfter=!1,this.startX=0,this.autoScrollMargin=40,this.autoScrollStep=5,this.autoScrollTimeout=!1,this.touchMove=!1,this.moveHover=this.moveHover.bind(this),this.endMove=this.endMove.bind(this)};MoveColumns.prototype.createPlaceholderElement=function(){var e=document.createElement("div");return e.classList.add("tabulator-col"),e.classList.add("tabulator-col-placeholder"),e},MoveColumns.prototype.initializeColumn=function(e){var t,o=this,n={};e.modules.frozen||(t=e.getElement(),n.mousemove=function(n){e.parent===o.moving.parent&&((o.touchMove?n.touches[0].pageX:n.pageX)-Tabulator.prototype.helpers.elOffset(t).left+o.table.columnManager.element.scrollLeft>e.getWidth()/2?o.toCol===e&&o.toColAfter||(t.parentNode.insertBefore(o.placeholderElement,t.nextSibling),o.moveColumn(e,!0)):(o.toCol!==e||o.toColAfter)&&(t.parentNode.insertBefore(o.placeholderElement,t),o.moveColumn(e,!1)))}.bind(o),t.addEventListener("mousedown",function(t){o.touchMove=!1,1===t.which&&(o.checkTimeout=setTimeout(function(){o.startMove(t,e)},o.checkPeriod))}),t.addEventListener("mouseup",function(e){1===e.which&&o.checkTimeout&&clearTimeout(o.checkTimeout)}),o.bindTouchEvents(e)),e.modules.moveColumn=n},MoveColumns.prototype.bindTouchEvents=function(e){var t,o,n,l,i,s,m,r=this,u=e.getElement(),h=!1;u.addEventListener("touchstart",function(u){r.checkTimeout=setTimeout(function(){r.touchMove=!0,t=e,o=e.nextColumn(),l=o?o.getWidth()/2:0,n=e.prevColumn(),i=n?n.getWidth()/2:0,s=0,m=0,h=!1,r.startMove(u,e)},r.checkPeriod)},{passive:!0}),u.addEventListener("touchmove",function(u){var a,c;r.moving&&(r.moveHover(u),h||(h=u.touches[0].pageX),a=u.touches[0].pageX-h,a>0?o&&a-s>l&&(c=o)!==e&&(h=u.touches[0].pageX,c.getElement().parentNode.insertBefore(r.placeholderElement,c.getElement().nextSibling),r.moveColumn(c,!0)):n&&-a-m>i&&(c=n)!==e&&(h=u.touches[0].pageX,c.getElement().parentNode.insertBefore(r.placeholderElement,c.getElement()),r.moveColumn(c,!1)),c&&(t=c,o=c.nextColumn(),s=l,l=o?o.getWidth()/2:0,n=c.prevColumn(),m=i,i=n?n.getWidth()/2:0))},{passive:!0}),u.addEventListener("touchend",function(e){r.checkTimeout&&clearTimeout(r.checkTimeout),r.moving&&r.endMove(e)})},MoveColumns.prototype.startMove=function(e,t){var o=t.getElement();this.moving=t,this.startX=(this.touchMove?e.touches[0].pageX:e.pageX)-Tabulator.prototype.helpers.elOffset(o).left,this.table.element.classList.add("tabulator-block-select"),this.placeholderElement.style.width=t.getWidth()+"px",this.placeholderElement.style.height=t.getHeight()+"px",o.parentNode.insertBefore(this.placeholderElement,o),o.parentNode.removeChild(o),this.hoverElement=o.cloneNode(!0),this.hoverElement.classList.add("tabulator-moving"),this.table.columnManager.getElement().appendChild(this.hoverElement),this.hoverElement.style.left="0",this.hoverElement.style.bottom="0",this.touchMove||(this._bindMouseMove(),document.body.addEventListener("mousemove",this.moveHover),document.body.addEventListener("mouseup",this.endMove)),this.moveHover(e)},MoveColumns.prototype._bindMouseMove=function(){this.table.columnManager.columnsByIndex.forEach(function(e){e.modules.moveColumn.mousemove&&e.getElement().addEventListener("mousemove",e.modules.moveColumn.mousemove)})},MoveColumns.prototype._unbindMouseMove=function(){this.table.columnManager.columnsByIndex.forEach(function(e){e.modules.moveColumn.mousemove&&e.getElement().removeEventListener("mousemove",e.modules.moveColumn.mousemove)})},MoveColumns.prototype.moveColumn=function(e,t){var o=this.moving.getCells();this.toCol=e,this.toColAfter=t,t?e.getCells().forEach(function(e,t){var n=e.getElement();n.parentNode.insertBefore(o[t].getElement(),n.nextSibling)}):e.getCells().forEach(function(e,t){var n=e.getElement();n.parentNode.insertBefore(o[t].getElement(),n)})},MoveColumns.prototype.endMove=function(e){(1===e.which||this.touchMove)&&(this._unbindMouseMove(),this.placeholderElement.parentNode.insertBefore(this.moving.getElement(),this.placeholderElement.nextSibling),this.placeholderElement.parentNode.removeChild(this.placeholderElement),this.hoverElement.parentNode.removeChild(this.hoverElement),this.table.element.classList.remove("tabulator-block-select"),this.toCol&&this.table.columnManager.moveColumnActual(this.moving,this.toCol,this.toColAfter),this.moving=!1,this.toCol=!1,this.toColAfter=!1,this.touchMove||(document.body.removeEventListener("mousemove",this.moveHover),document.body.removeEventListener("mouseup",this.endMove)))},MoveColumns.prototype.moveHover=function(e){var t,o=this,n=o.table.columnManager.getElement(),l=n.scrollLeft,i=(o.touchMove?e.touches[0].pageX:e.pageX)-Tabulator.prototype.helpers.elOffset(n).left+l;o.hoverElement.style.left=i-o.startX+"px",i-l group.getHeight() / 2) { + if (self.toRow !== group || !self.toRowAfter) { + var rowEl = group.getElement(); + rowEl.parentNode.insertBefore(self.placeholderElement, rowEl.nextSibling); + self.moveRow(group, true); + } + } else { + if (self.toRow !== group || self.toRowAfter) { + var rowEl = group.getElement(); + if (rowEl.previousSibling) { + rowEl.parentNode.insertBefore(self.placeholderElement, rowEl); + self.moveRow(group, false); + } + } + } + }.bind(self); + + group.modules.moveRow = config; +}; + +MoveRows.prototype.initializeRow = function (row) { + var self = this, + config = {}, + rowEl; + + //inter table drag drop + config.mouseup = function (e) { + self.tableRowDrop(e, row); + }.bind(self); + + //same table drag drop + config.mousemove = function (e) { + if (e.pageY - Tabulator.prototype.helpers.elOffset(row.element).top + self.table.rowManager.element.scrollTop > row.getHeight() / 2) { + if (self.toRow !== row || !self.toRowAfter) { + var rowEl = row.getElement(); + rowEl.parentNode.insertBefore(self.placeholderElement, rowEl.nextSibling); + self.moveRow(row, true); + } + } else { + if (self.toRow !== row || self.toRowAfter) { + var rowEl = row.getElement(); + rowEl.parentNode.insertBefore(self.placeholderElement, rowEl); + self.moveRow(row, false); + } + } + }.bind(self); + + if (!this.hasHandle) { + + rowEl = row.getElement(); + + rowEl.addEventListener("mousedown", function (e) { + if (e.which === 1) { + self.checkTimeout = setTimeout(function () { + self.startMove(e, row); + }, self.checkPeriod); + } + }); + + rowEl.addEventListener("mouseup", function (e) { + if (e.which === 1) { + if (self.checkTimeout) { + clearTimeout(self.checkTimeout); + } + } + }); + + this.bindTouchEvents(row, row.getElement()); + } + + row.modules.moveRow = config; +}; + +MoveRows.prototype.initializeCell = function (cell) { + var self = this, + cellEl = cell.getElement(); + + cellEl.addEventListener("mousedown", function (e) { + if (e.which === 1) { + self.checkTimeout = setTimeout(function () { + self.startMove(e, cell.row); + }, self.checkPeriod); + } + }); + + cellEl.addEventListener("mouseup", function (e) { + if (e.which === 1) { + if (self.checkTimeout) { + clearTimeout(self.checkTimeout); + } + } + }); + + this.bindTouchEvents(cell.row, cell.getElement()); +}; + +MoveRows.prototype.bindTouchEvents = function (row, element) { + var self = this, + startYMove = false, + //shifting center position of the cell + dir = false, + currentRow, + nextRow, + prevRow, + nextRowHeight, + prevRowHeight, + nextRowHeightLast, + prevRowHeightLast; + + element.addEventListener("touchstart", function (e) { + self.checkTimeout = setTimeout(function () { + self.touchMove = true; + currentRow = row; + nextRow = row.nextRow(); + nextRowHeight = nextRow ? nextRow.getHeight() / 2 : 0; + prevRow = row.prevRow(); + prevRowHeight = prevRow ? prevRow.getHeight() / 2 : 0; + nextRowHeightLast = 0; + prevRowHeightLast = 0; + startYMove = false; + + self.startMove(e, row); + }, self.checkPeriod); + }, { passive: true }); + this.moving, this.toRow, this.toRowAfter; + element.addEventListener("touchmove", function (e) { + + var halfCol, diff, moveToRow; + + if (self.moving) { + e.preventDefault(); + + self.moveHover(e); + + if (!startYMove) { + startYMove = e.touches[0].pageY; + } + + diff = e.touches[0].pageY - startYMove; + + if (diff > 0) { + if (nextRow && diff - nextRowHeightLast > nextRowHeight) { + moveToRow = nextRow; + + if (moveToRow !== row) { + startYMove = e.touches[0].pageY; + moveToRow.getElement().parentNode.insertBefore(self.placeholderElement, moveToRow.getElement().nextSibling); + self.moveRow(moveToRow, true); + } + } + } else { + if (prevRow && -diff - prevRowHeightLast > prevRowHeight) { + moveToRow = prevRow; + + if (moveToRow !== row) { + startYMove = e.touches[0].pageY; + moveToRow.getElement().parentNode.insertBefore(self.placeholderElement, moveToRow.getElement()); + self.moveRow(moveToRow, false); + } + } + } + + if (moveToRow) { + currentRow = moveToRow; + nextRow = moveToRow.nextRow(); + nextRowHeightLast = nextRowHeight; + nextRowHeight = nextRow ? nextRow.getHeight() / 2 : 0; + prevRow = moveToRow.prevRow(); + prevRowHeightLast = prevRowHeight; + prevRowHeight = prevRow ? prevRow.getHeight() / 2 : 0; + } + } + }); + + element.addEventListener("touchend", function (e) { + if (self.checkTimeout) { + clearTimeout(self.checkTimeout); + } + if (self.moving) { + self.endMove(e); + self.touchMove = false; + } + }); +}; + +MoveRows.prototype._bindMouseMove = function () { + var self = this; + + self.table.rowManager.getDisplayRows().forEach(function (row) { + if ((row.type === "row" || row.type === "group") && row.modules.moveRow.mousemove) { + row.getElement().addEventListener("mousemove", row.modules.moveRow.mousemove); + } + }); +}; + +MoveRows.prototype._unbindMouseMove = function () { + var self = this; + + self.table.rowManager.getDisplayRows().forEach(function (row) { + if ((row.type === "row" || row.type === "group") && row.modules.moveRow.mousemove) { + row.getElement().removeEventListener("mousemove", row.modules.moveRow.mousemove); + } + }); +}; + +MoveRows.prototype.startMove = function (e, row) { + var element = row.getElement(); + + this.setStartPosition(e, row); + + this.moving = row; + + this.table.element.classList.add("tabulator-block-select"); + + //create placeholder + this.placeholderElement.style.width = row.getWidth() + "px"; + this.placeholderElement.style.height = row.getHeight() + "px"; + + if (!this.connection) { + element.parentNode.insertBefore(this.placeholderElement, element); + element.parentNode.removeChild(element); + } else { + this.table.element.classList.add("tabulator-movingrow-sending"); + this.connectToTables(row); + } + + //create hover element + this.hoverElement = element.cloneNode(true); + this.hoverElement.classList.add("tabulator-moving"); + + if (this.connection) { + document.body.appendChild(this.hoverElement); + this.hoverElement.style.left = "0"; + this.hoverElement.style.top = "0"; + this.hoverElement.style.width = this.table.element.clientWidth + "px"; + this.hoverElement.style.whiteSpace = "nowrap"; + this.hoverElement.style.overflow = "hidden"; + this.hoverElement.style.pointerEvents = "none"; + } else { + this.table.rowManager.getTableElement().appendChild(this.hoverElement); + + this.hoverElement.style.left = "0"; + this.hoverElement.style.top = "0"; + + this._bindMouseMove(); + } + + document.body.addEventListener("mousemove", this.moveHover); + document.body.addEventListener("mouseup", this.endMove); + + this.moveHover(e); +}; + +MoveRows.prototype.setStartPosition = function (e, row) { + var pageX = this.touchMove ? e.touches[0].pageX : e.pageX, + pageY = this.touchMove ? e.touches[0].pageY : e.pageY, + element, + position; + + element = row.getElement(); + if (this.connection) { + position = element.getBoundingClientRect(); + + this.startX = position.left - pageX + window.pageXOffset; + this.startY = position.top - pageY + window.pageYOffset; + } else { + this.startY = pageY - element.getBoundingClientRect().top; + } +}; + +MoveRows.prototype.endMove = function (e) { + if (!e || e.which === 1 || this.touchMove) { + this._unbindMouseMove(); + + if (!this.connection) { + this.placeholderElement.parentNode.insertBefore(this.moving.getElement(), this.placeholderElement.nextSibling); + this.placeholderElement.parentNode.removeChild(this.placeholderElement); + } + + this.hoverElement.parentNode.removeChild(this.hoverElement); + + this.table.element.classList.remove("tabulator-block-select"); + + if (this.toRow) { + this.table.rowManager.moveRow(this.moving, this.toRow, this.toRowAfter); + } + + this.moving = false; + this.toRow = false; + this.toRowAfter = false; + + document.body.removeEventListener("mousemove", this.moveHover); + document.body.removeEventListener("mouseup", this.endMove); + + if (this.connection) { + this.table.element.classList.remove("tabulator-movingrow-sending"); + this.disconnectFromTables(); + } + } +}; + +MoveRows.prototype.moveRow = function (row, after) { + this.toRow = row; + this.toRowAfter = after; +}; + +MoveRows.prototype.moveHover = function (e) { + if (this.connection) { + this.moveHoverConnections.call(this, e); + } else { + this.moveHoverTable.call(this, e); + } +}; + +MoveRows.prototype.moveHoverTable = function (e) { + var rowHolder = this.table.rowManager.getElement(), + scrollTop = rowHolder.scrollTop, + yPos = (this.touchMove ? e.touches[0].pageY : e.pageY) - rowHolder.getBoundingClientRect().top + scrollTop, + scrollPos; + + this.hoverElement.style.top = yPos - this.startY + "px"; +}; + +MoveRows.prototype.moveHoverConnections = function (e) { + this.hoverElement.style.left = this.startX + (this.touchMove ? e.touches[0].pageX : e.pageX) + "px"; + this.hoverElement.style.top = this.startY + (this.touchMove ? e.touches[0].pageY : e.pageY) + "px"; +}; + +MoveRows.prototype.elementRowDrop = function (e, element, row) { + if (this.table.options.movableRowsElementDrop) { + this.table.options.movableRowsElementDrop(e, element, row ? row.getComponent() : false); + } +}; + +//establish connection with other tables +MoveRows.prototype.connectToTables = function (row) { + var _this = this; + + var connectionTables; + + if (this.connectionSelectorsTables) { + connectionTables = this.table.modules.comms.getConnections(this.connectionSelectorsTables); + + this.table.options.movableRowsSendingStart.call(this.table, connectionTables); + + this.table.modules.comms.send(this.connectionSelectorsTables, "moveRow", "connect", { + row: row + }); + } + + if (this.connectionSelectorsElements) { + + this.connectionElements = []; + + if (!Array.isArray(this.connectionSelectorsElements)) { + this.connectionSelectorsElements = [this.connectionSelectorsElements]; + } + + this.connectionSelectorsElements.forEach(function (query) { + if (typeof query === "string") { + _this.connectionElements = _this.connectionElements.concat(Array.prototype.slice.call(document.querySelectorAll(query))); + } else { + _this.connectionElements.push(query); + } + }); + + this.connectionElements.forEach(function (element) { + var dropEvent = function dropEvent(e) { + _this.elementRowDrop(e, element, _this.moving); + }; + + element.addEventListener("mouseup", dropEvent); + element.tabulatorElementDropEvent = dropEvent; + + element.classList.add("tabulator-movingrow-receiving"); + }); + } +}; + +//disconnect from other tables +MoveRows.prototype.disconnectFromTables = function () { + var connectionTables; + + if (this.connectionSelectorsTables) { + connectionTables = this.table.modules.comms.getConnections(this.connectionSelectorsTables); + + this.table.options.movableRowsSendingStop.call(this.table, connectionTables); + + this.table.modules.comms.send(this.connectionSelectorsTables, "moveRow", "disconnect"); + } + + this.connectionElements.forEach(function (element) { + element.classList.remove("tabulator-movingrow-receiving"); + element.removeEventListener("mouseup", element.tabulatorElementDropEvent); + delete element.tabulatorElementDropEvent; + }); +}; + +//accept incomming connection +MoveRows.prototype.connect = function (table, row) { + var self = this; + if (!this.connectedTable) { + this.connectedTable = table; + this.connectedRow = row; + + this.table.element.classList.add("tabulator-movingrow-receiving"); + + self.table.rowManager.getDisplayRows().forEach(function (row) { + if (row.type === "row" && row.modules.moveRow && row.modules.moveRow.mouseup) { + row.getElement().addEventListener("mouseup", row.modules.moveRow.mouseup); + } + }); + + self.tableRowDropEvent = self.tableRowDrop.bind(self); + + self.table.element.addEventListener("mouseup", self.tableRowDropEvent); + + this.table.options.movableRowsReceivingStart.call(this.table, row, table); + + return true; + } else { + console.warn("Move Row Error - Table cannot accept connection, already connected to table:", this.connectedTable); + return false; + } +}; + +//close incomming connection +MoveRows.prototype.disconnect = function (table) { + var self = this; + if (table === this.connectedTable) { + this.connectedTable = false; + this.connectedRow = false; + + this.table.element.classList.remove("tabulator-movingrow-receiving"); + + self.table.rowManager.getDisplayRows().forEach(function (row) { + if (row.type === "row" && row.modules.moveRow && row.modules.moveRow.mouseup) { + row.getElement().removeEventListener("mouseup", row.modules.moveRow.mouseup); + } + }); + + self.table.element.removeEventListener("mouseup", self.tableRowDropEvent); + + this.table.options.movableRowsReceivingStop.call(this.table, table); + } else { + console.warn("Move Row Error - trying to disconnect from non connected table"); + } +}; + +MoveRows.prototype.dropComplete = function (table, row, success) { + var sender = false; + + if (success) { + + switch (_typeof(this.table.options.movableRowsSender)) { + case "string": + sender = this.senders[this.table.options.movableRowsSender]; + break; + + case "function": + sender = this.table.options.movableRowsSender; + break; + } + + if (sender) { + sender.call(this, this.moving.getComponent(), row ? row.getComponent() : undefined, table); + } else { + if (this.table.options.movableRowsSender) { + console.warn("Mover Row Error - no matching sender found:", this.table.options.movableRowsSender); + } + } + + this.table.options.movableRowsSent.call(this.table, this.moving.getComponent(), row ? row.getComponent() : undefined, table); + } else { + this.table.options.movableRowsSentFailed.call(this.table, this.moving.getComponent(), row ? row.getComponent() : undefined, table); + } + + this.endMove(); +}; + +MoveRows.prototype.tableRowDrop = function (e, row) { + var receiver = false, + success = false; + + console.trace("drop"); + + e.stopImmediatePropagation(); + + switch (_typeof(this.table.options.movableRowsReceiver)) { + case "string": + receiver = this.receivers[this.table.options.movableRowsReceiver]; + break; + + case "function": + receiver = this.table.options.movableRowsReceiver; + break; + } + + if (receiver) { + success = receiver.call(this, this.connectedRow.getComponent(), row ? row.getComponent() : undefined, this.connectedTable); + } else { + console.warn("Mover Row Error - no matching receiver found:", this.table.options.movableRowsReceiver); + } + + if (success) { + this.table.options.movableRowsReceived.call(this.table, this.connectedRow.getComponent(), row ? row.getComponent() : undefined, this.connectedTable); + } else { + this.table.options.movableRowsReceivedFailed.call(this.table, this.connectedRow.getComponent(), row ? row.getComponent() : undefined, this.connectedTable); + } + + this.table.modules.comms.send(this.connectedTable, "moveRow", "dropcomplete", { + row: row, + success: success + }); +}; + +MoveRows.prototype.receivers = { + insert: function insert(fromRow, toRow, fromTable) { + this.table.addRow(fromRow.getData(), undefined, toRow); + return true; + }, + + add: function add(fromRow, toRow, fromTable) { + this.table.addRow(fromRow.getData()); + return true; + }, + + update: function update(fromRow, toRow, fromTable) { + if (toRow) { + toRow.update(fromRow.getData()); + return true; + } + + return false; + }, + + replace: function replace(fromRow, toRow, fromTable) { + if (toRow) { + this.table.addRow(fromRow.getData(), undefined, toRow); + toRow.delete(); + return true; + } + + return false; + } +}; + +MoveRows.prototype.senders = { + delete: function _delete(fromRow, toRow, toTable) { + fromRow.delete(); + } +}; + +MoveRows.prototype.commsReceived = function (table, action, data) { + switch (action) { + case "connect": + return this.connect(table, data.row); + break; + + case "disconnect": + return this.disconnect(table); + break; + + case "dropcomplete": + return this.dropComplete(table, data.row, data.success); + break; + } +}; + +Tabulator.prototype.registerModule("moveRow", MoveRows); \ No newline at end of file diff --git a/admin/js/vendors/tabulator/js/modules/moveable_rows.min.js b/admin/js/vendors/tabulator/js/modules/moveable_rows.min.js new file mode 100644 index 0000000..f928535 --- /dev/null +++ b/admin/js/vendors/tabulator/js/modules/moveable_rows.min.js @@ -0,0 +1,2 @@ +/* Tabulator v4.7.0 (c) Oliver Folkerd */ +var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},MoveRows=function(e){this.table=e,this.placeholderElement=this.createPlaceholderElement(),this.hoverElement=!1,this.checkTimeout=!1,this.checkPeriod=150,this.moving=!1,this.toRow=!1,this.toRowAfter=!1,this.hasHandle=!1,this.startY=0,this.startX=0,this.moveHover=this.moveHover.bind(this),this.endMove=this.endMove.bind(this),this.tableRowDropEvent=!1,this.touchMove=!1,this.connection=!1,this.connectionSelectorsTables=!1,this.connectionSelectorsElements=!1,this.connectionElements=[],this.connections=[],this.connectedTable=!1,this.connectedRow=!1};MoveRows.prototype.createPlaceholderElement=function(){var e=document.createElement("div");return e.classList.add("tabulator-row"),e.classList.add("tabulator-row-placeholder"),e},MoveRows.prototype.initialize=function(e){this.connectionSelectorsTables=this.table.options.movableRowsConnectedTables,this.connectionSelectorsElements=this.table.options.movableRowsConnectedElements,this.connection=this.connectionSelectorsTables||this.connectionSelectorsElements},MoveRows.prototype.setHandle=function(e){this.hasHandle=e},MoveRows.prototype.initializeGroupHeader=function(e){var t=this,o={};o.mouseup=function(e){t.tableRowDrop(e,row)}.bind(t),o.mousemove=function(o){if(o.pageY-Tabulator.prototype.helpers.elOffset(e.element).top+t.table.rowManager.element.scrollTop>e.getHeight()/2){if(t.toRow!==e||!t.toRowAfter){var n=e.getElement();n.parentNode.insertBefore(t.placeholderElement,n.nextSibling),t.moveRow(e,!0)}}else if(t.toRow!==e||t.toRowAfter){var n=e.getElement();n.previousSibling&&(n.parentNode.insertBefore(t.placeholderElement,n),t.moveRow(e,!1))}}.bind(t),e.modules.moveRow=o},MoveRows.prototype.initializeRow=function(e){var t,o=this,n={};n.mouseup=function(t){o.tableRowDrop(t,e)}.bind(o),n.mousemove=function(t){if(t.pageY-Tabulator.prototype.helpers.elOffset(e.element).top+o.table.rowManager.element.scrollTop>e.getHeight()/2){if(o.toRow!==e||!o.toRowAfter){var n=e.getElement();n.parentNode.insertBefore(o.placeholderElement,n.nextSibling),o.moveRow(e,!0)}}else if(o.toRow!==e||o.toRowAfter){var n=e.getElement();n.parentNode.insertBefore(o.placeholderElement,n),o.moveRow(e,!1)}}.bind(o),this.hasHandle||(t=e.getElement(),t.addEventListener("mousedown",function(t){1===t.which&&(o.checkTimeout=setTimeout(function(){o.startMove(t,e)},o.checkPeriod))}),t.addEventListener("mouseup",function(e){1===e.which&&o.checkTimeout&&clearTimeout(o.checkTimeout)}),this.bindTouchEvents(e,e.getElement())),e.modules.moveRow=n},MoveRows.prototype.initializeCell=function(e){var t=this,o=e.getElement();o.addEventListener("mousedown",function(o){1===o.which&&(t.checkTimeout=setTimeout(function(){t.startMove(o,e.row)},t.checkPeriod))}),o.addEventListener("mouseup",function(e){1===e.which&&t.checkTimeout&&clearTimeout(t.checkTimeout)}),this.bindTouchEvents(e.row,e.getElement())},MoveRows.prototype.bindTouchEvents=function(e,t){var o,n,s,i,l,c,r,a=this,h=!1;t.addEventListener("touchstart",function(t){a.checkTimeout=setTimeout(function(){a.touchMove=!0,o=e,n=e.nextRow(),i=n?n.getHeight()/2:0,s=e.prevRow(),l=s?s.getHeight()/2:0,c=0,r=0,h=!1,a.startMove(t,e)},a.checkPeriod)},{passive:!0}),this.moving,this.toRow,this.toRowAfter,t.addEventListener("touchmove",function(t){var m,v;a.moving&&(t.preventDefault(),a.moveHover(t),h||(h=t.touches[0].pageY),m=t.touches[0].pageY-h,m>0?n&&m-c>i&&(v=n)!==e&&(h=t.touches[0].pageY,v.getElement().parentNode.insertBefore(a.placeholderElement,v.getElement().nextSibling),a.moveRow(v,!0)):s&&-m-r>l&&(v=s)!==e&&(h=t.touches[0].pageY,v.getElement().parentNode.insertBefore(a.placeholderElement,v.getElement()),a.moveRow(v,!1)),v&&(o=v,n=v.nextRow(),c=i,i=n?n.getHeight()/2:0,s=v.prevRow(),r=l,l=s?s.getHeight()/2:0))}),t.addEventListener("touchend",function(e){a.checkTimeout&&clearTimeout(a.checkTimeout),a.moving&&(a.endMove(e),a.touchMove=!1)})},MoveRows.prototype._bindMouseMove=function(){this.table.rowManager.getDisplayRows().forEach(function(e){"row"!==e.type&&"group"!==e.type||!e.modules.moveRow.mousemove||e.getElement().addEventListener("mousemove",e.modules.moveRow.mousemove)})},MoveRows.prototype._unbindMouseMove=function(){this.table.rowManager.getDisplayRows().forEach(function(e){"row"!==e.type&&"group"!==e.type||!e.modules.moveRow.mousemove||e.getElement().removeEventListener("mousemove",e.modules.moveRow.mousemove)})},MoveRows.prototype.startMove=function(e,t){var o=t.getElement();this.setStartPosition(e,t),this.moving=t,this.table.element.classList.add("tabulator-block-select"),this.placeholderElement.style.width=t.getWidth()+"px",this.placeholderElement.style.height=t.getHeight()+"px",this.connection?(this.table.element.classList.add("tabulator-movingrow-sending"),this.connectToTables(t)):(o.parentNode.insertBefore(this.placeholderElement,o),o.parentNode.removeChild(o)),this.hoverElement=o.cloneNode(!0),this.hoverElement.classList.add("tabulator-moving"),this.connection?(document.body.appendChild(this.hoverElement),this.hoverElement.style.left="0",this.hoverElement.style.top="0",this.hoverElement.style.width=this.table.element.clientWidth+"px",this.hoverElement.style.whiteSpace="nowrap",this.hoverElement.style.overflow="hidden",this.hoverElement.style.pointerEvents="none"):(this.table.rowManager.getTableElement().appendChild(this.hoverElement),this.hoverElement.style.left="0",this.hoverElement.style.top="0",this._bindMouseMove()),document.body.addEventListener("mousemove",this.moveHover),document.body.addEventListener("mouseup",this.endMove),this.moveHover(e)},MoveRows.prototype.setStartPosition=function(e,t){var o,n,s=this.touchMove?e.touches[0].pageX:e.pageX,i=this.touchMove?e.touches[0].pageY:e.pageY;o=t.getElement(),this.connection?(n=o.getBoundingClientRect(),this.startX=n.left-s+window.pageXOffset,this.startY=n.top-i+window.pageYOffset):this.startY=i-o.getBoundingClientRect().top},MoveRows.prototype.endMove=function(e){e&&1!==e.which&&!this.touchMove||(this._unbindMouseMove(),this.connection||(this.placeholderElement.parentNode.insertBefore(this.moving.getElement(),this.placeholderElement.nextSibling),this.placeholderElement.parentNode.removeChild(this.placeholderElement)),this.hoverElement.parentNode.removeChild(this.hoverElement),this.table.element.classList.remove("tabulator-block-select"),this.toRow&&this.table.rowManager.moveRow(this.moving,this.toRow,this.toRowAfter),this.moving=!1,this.toRow=!1,this.toRowAfter=!1,document.body.removeEventListener("mousemove",this.moveHover),document.body.removeEventListener("mouseup",this.endMove),this.connection&&(this.table.element.classList.remove("tabulator-movingrow-sending"),this.disconnectFromTables()))},MoveRows.prototype.moveRow=function(e,t){this.toRow=e,this.toRowAfter=t},MoveRows.prototype.moveHover=function(e){this.connection?this.moveHoverConnections.call(this,e):this.moveHoverTable.call(this,e)},MoveRows.prototype.moveHoverTable=function(e){var t=this.table.rowManager.getElement(),o=t.scrollTop,n=(this.touchMove?e.touches[0].pageY:e.pageY)-t.getBoundingClientRect().top+o;this.hoverElement.style.top=n-this.startY+"px"},MoveRows.prototype.moveHoverConnections=function(e){this.hoverElement.style.left=this.startX+(this.touchMove?e.touches[0].pageX:e.pageX)+"px",this.hoverElement.style.top=this.startY+(this.touchMove?e.touches[0].pageY:e.pageY)+"px"},MoveRows.prototype.elementRowDrop=function(e,t,o){this.table.options.movableRowsElementDrop&&this.table.options.movableRowsElementDrop(e,t,!!o&&o.getComponent())},MoveRows.prototype.connectToTables=function(e){var t,o=this;this.connectionSelectorsTables&&(t=this.table.modules.comms.getConnections(this.connectionSelectorsTables),this.table.options.movableRowsSendingStart.call(this.table,t),this.table.modules.comms.send(this.connectionSelectorsTables,"moveRow","connect",{row:e})),this.connectionSelectorsElements&&(this.connectionElements=[],Array.isArray(this.connectionSelectorsElements)||(this.connectionSelectorsElements=[this.connectionSelectorsElements]),this.connectionSelectorsElements.forEach(function(e){"string"==typeof e?o.connectionElements=o.connectionElements.concat(Array.prototype.slice.call(document.querySelectorAll(e))):o.connectionElements.push(e)}),this.connectionElements.forEach(function(e){var t=function(t){o.elementRowDrop(t,e,o.moving)};e.addEventListener("mouseup",t),e.tabulatorElementDropEvent=t,e.classList.add("tabulator-movingrow-receiving")}))},MoveRows.prototype.disconnectFromTables=function(){var e;this.connectionSelectorsTables&&(e=this.table.modules.comms.getConnections(this.connectionSelectorsTables),this.table.options.movableRowsSendingStop.call(this.table,e),this.table.modules.comms.send(this.connectionSelectorsTables,"moveRow","disconnect")),this.connectionElements.forEach(function(e){e.classList.remove("tabulator-movingrow-receiving"),e.removeEventListener("mouseup",e.tabulatorElementDropEvent),delete e.tabulatorElementDropEvent})},MoveRows.prototype.connect=function(e,t){var o=this;return this.connectedTable?(console.warn("Move Row Error - Table cannot accept connection, already connected to table:",this.connectedTable),!1):(this.connectedTable=e,this.connectedRow=t,this.table.element.classList.add("tabulator-movingrow-receiving"),o.table.rowManager.getDisplayRows().forEach(function(e){"row"===e.type&&e.modules.moveRow&&e.modules.moveRow.mouseup&&e.getElement().addEventListener("mouseup",e.modules.moveRow.mouseup)}),o.tableRowDropEvent=o.tableRowDrop.bind(o),o.table.element.addEventListener("mouseup",o.tableRowDropEvent),this.table.options.movableRowsReceivingStart.call(this.table,t,e),!0)},MoveRows.prototype.disconnect=function(e){var t=this;e===this.connectedTable?(this.connectedTable=!1,this.connectedRow=!1,this.table.element.classList.remove("tabulator-movingrow-receiving"),t.table.rowManager.getDisplayRows().forEach(function(e){"row"===e.type&&e.modules.moveRow&&e.modules.moveRow.mouseup&&e.getElement().removeEventListener("mouseup",e.modules.moveRow.mouseup)}),t.table.element.removeEventListener("mouseup",t.tableRowDropEvent),this.table.options.movableRowsReceivingStop.call(this.table,e)):console.warn("Move Row Error - trying to disconnect from non connected table")},MoveRows.prototype.dropComplete=function(e,t,o){var n=!1;if(o){switch(_typeof(this.table.options.movableRowsSender)){case"string":n=this.senders[this.table.options.movableRowsSender];break;case"function":n=this.table.options.movableRowsSender}n?n.call(this,this.moving.getComponent(),t?t.getComponent():void 0,e):this.table.options.movableRowsSender&&console.warn("Mover Row Error - no matching sender found:",this.table.options.movableRowsSender),this.table.options.movableRowsSent.call(this.table,this.moving.getComponent(),t?t.getComponent():void 0,e)}else this.table.options.movableRowsSentFailed.call(this.table,this.moving.getComponent(),t?t.getComponent():void 0,e);this.endMove()},MoveRows.prototype.tableRowDrop=function(e,t){var o=!1,n=!1;switch(console.trace("drop"),e.stopImmediatePropagation(),_typeof(this.table.options.movableRowsReceiver)){case"string":o=this.receivers[this.table.options.movableRowsReceiver];break;case"function":o=this.table.options.movableRowsReceiver}o?n=o.call(this,this.connectedRow.getComponent(),t?t.getComponent():void 0,this.connectedTable):console.warn("Mover Row Error - no matching receiver found:",this.table.options.movableRowsReceiver),n?this.table.options.movableRowsReceived.call(this.table,this.connectedRow.getComponent(),t?t.getComponent():void 0,this.connectedTable):this.table.options.movableRowsReceivedFailed.call(this.table,this.connectedRow.getComponent(),t?t.getComponent():void 0,this.connectedTable),this.table.modules.comms.send(this.connectedTable,"moveRow","dropcomplete",{row:t,success:n})},MoveRows.prototype.receivers={insert:function(e,t,o){return this.table.addRow(e.getData(),void 0,t),!0},add:function(e,t,o){return this.table.addRow(e.getData()),!0},update:function(e,t,o){return!!t&&(t.update(e.getData()),!0)},replace:function(e,t,o){return!!t&&(this.table.addRow(e.getData(),void 0,t),t.delete(),!0)}},MoveRows.prototype.senders={delete:function(e,t,o){e.delete()}},MoveRows.prototype.commsReceived=function(e,t,o){switch(t){case"connect":return this.connect(e,o.row);case"disconnect":return this.disconnect(e);case"dropcomplete":return this.dropComplete(e,o.row,o.success)}},Tabulator.prototype.registerModule("moveRow",MoveRows); \ No newline at end of file diff --git a/admin/js/vendors/tabulator/js/modules/mutator.js b/admin/js/vendors/tabulator/js/modules/mutator.js new file mode 100644 index 0000000..e5b5dad --- /dev/null +++ b/admin/js/vendors/tabulator/js/modules/mutator.js @@ -0,0 +1,116 @@ +var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; + +/* Tabulator v4.7.0 (c) Oliver Folkerd */ + +var Mutator = function Mutator(table) { + this.table = table; //hold Tabulator object + this.allowedTypes = ["", "data", "edit", "clipboard"]; //list of muatation types + this.enabled = true; +}; + +//initialize column mutator +Mutator.prototype.initializeColumn = function (column) { + var self = this, + match = false, + config = {}; + + this.allowedTypes.forEach(function (type) { + var key = "mutator" + (type.charAt(0).toUpperCase() + type.slice(1)), + mutator; + + if (column.definition[key]) { + mutator = self.lookupMutator(column.definition[key]); + + if (mutator) { + match = true; + + config[key] = { + mutator: mutator, + params: column.definition[key + "Params"] || {} + }; + } + } + }); + + if (match) { + column.modules.mutate = config; + } +}; + +Mutator.prototype.lookupMutator = function (value) { + var mutator = false; + + //set column mutator + switch (typeof value === "undefined" ? "undefined" : _typeof(value)) { + case "string": + if (this.mutators[value]) { + mutator = this.mutators[value]; + } else { + console.warn("Mutator Error - No such mutator found, ignoring: ", value); + } + break; + + case "function": + mutator = value; + break; + } + + return mutator; +}; + +//apply mutator to row +Mutator.prototype.transformRow = function (data, type, updatedData) { + var self = this, + key = "mutator" + (type.charAt(0).toUpperCase() + type.slice(1)), + value; + + if (this.enabled) { + + self.table.columnManager.traverse(function (column) { + var mutator, params, component; + + if (column.modules.mutate) { + mutator = column.modules.mutate[key] || column.modules.mutate.mutator || false; + + if (mutator) { + value = column.getFieldValue(typeof updatedData !== "undefined" ? updatedData : data); + + if (type == "data" || typeof value !== "undefined") { + component = column.getComponent(); + params = typeof mutator.params === "function" ? mutator.params(value, data, type, component) : mutator.params; + column.setFieldValue(data, mutator.mutator(value, data, type, params, component)); + } + } + } + }); + } + + return data; +}; + +//apply mutator to new cell value +Mutator.prototype.transformCell = function (cell, value) { + var mutator = cell.column.modules.mutate.mutatorEdit || cell.column.modules.mutate.mutator || false, + tempData = {}; + + if (mutator) { + tempData = Object.assign(tempData, cell.row.getData()); + cell.column.setFieldValue(tempData, value); + return mutator.mutator(value, tempData, "edit", mutator.params, cell.getComponent()); + } else { + return value; + } +}; + +Mutator.prototype.enable = function () { + this.enabled = true; +}; + +Mutator.prototype.disable = function () { + this.enabled = false; +}; + +//default mutators +Mutator.prototype.mutators = {}; + +Tabulator.prototype.registerModule("mutator", Mutator); \ No newline at end of file diff --git a/admin/js/vendors/tabulator/js/modules/mutator.min.js b/admin/js/vendors/tabulator/js/modules/mutator.min.js new file mode 100644 index 0000000..00005d1 --- /dev/null +++ b/admin/js/vendors/tabulator/js/modules/mutator.min.js @@ -0,0 +1,2 @@ +/* Tabulator v4.7.0 (c) Oliver Folkerd */ +var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Mutator=function(t){this.table=t,this.allowedTypes=["","data","edit","clipboard"],this.enabled=!0};Mutator.prototype.initializeColumn=function(t){var o=this,e=!1,a={};this.allowedTypes.forEach(function(r){var u,n="mutator"+(r.charAt(0).toUpperCase()+r.slice(1));t.definition[n]&&(u=o.lookupMutator(t.definition[n]))&&(e=!0,a[n]={mutator:u,params:t.definition[n+"Params"]||{}})}),e&&(t.modules.mutate=a)},Mutator.prototype.lookupMutator=function(t){var o=!1;switch(void 0===t?"undefined":_typeof(t)){case"string":this.mutators[t]?o=this.mutators[t]:console.warn("Mutator Error - No such mutator found, ignoring: ",t);break;case"function":o=t}return o},Mutator.prototype.transformRow=function(t,o,e){var a,r=this,u="mutator"+(o.charAt(0).toUpperCase()+o.slice(1));return this.enabled&&r.table.columnManager.traverse(function(r){var n,i,s;r.modules.mutate&&(n=r.modules.mutate[u]||r.modules.mutate.mutator||!1)&&(a=r.getFieldValue(void 0!==e?e:t),"data"!=o&&void 0===a||(s=r.getComponent(),i="function"==typeof n.params?n.params(a,t,o,s):n.params,r.setFieldValue(t,n.mutator(a,t,o,i,s))))}),t},Mutator.prototype.transformCell=function(t,o){var e=t.column.modules.mutate.mutatorEdit||t.column.modules.mutate.mutator||!1,a={};return e?(a=Object.assign(a,t.row.getData()),t.column.setFieldValue(a,o),e.mutator(o,a,"edit",e.params,t.getComponent())):o},Mutator.prototype.enable=function(){this.enabled=!0},Mutator.prototype.disable=function(){this.enabled=!1},Mutator.prototype.mutators={},Tabulator.prototype.registerModule("mutator",Mutator); \ No newline at end of file diff --git a/admin/js/vendors/tabulator/js/modules/page.js b/admin/js/vendors/tabulator/js/modules/page.js new file mode 100644 index 0000000..d37b814 --- /dev/null +++ b/admin/js/vendors/tabulator/js/modules/page.js @@ -0,0 +1,730 @@ +/* Tabulator v4.7.0 (c) Oliver Folkerd */ + +var Page = function Page(table) { + + this.table = table; //hold Tabulator object + + this.mode = "local"; + this.progressiveLoad = false; + + this.size = 0; + this.page = 1; + this.count = 5; + this.max = 1; + + this.displayIndex = 0; //index in display pipeline + + this.initialLoad = true; + + this.pageSizes = []; + + this.dataReceivedNames = {}; + this.dataSentNames = {}; + + this.createElements(); +}; + +Page.prototype.createElements = function () { + + var button; + + this.element = document.createElement("span"); + this.element.classList.add("tabulator-paginator"); + + this.pagesElement = document.createElement("span"); + this.pagesElement.classList.add("tabulator-pages"); + + button = document.createElement("button"); + button.classList.add("tabulator-page"); + button.setAttribute("type", "button"); + button.setAttribute("role", "button"); + button.setAttribute("aria-label", ""); + button.setAttribute("title", ""); + + this.firstBut = button.cloneNode(true); + this.firstBut.setAttribute("data-page", "first"); + + this.prevBut = button.cloneNode(true); + this.prevBut.setAttribute("data-page", "prev"); + + this.nextBut = button.cloneNode(true); + this.nextBut.setAttribute("data-page", "next"); + + this.lastBut = button.cloneNode(true); + this.lastBut.setAttribute("data-page", "last"); + + if (this.table.options.paginationSizeSelector) { + this.pageSizeSelect = document.createElement("select"); + this.pageSizeSelect.classList.add("tabulator-page-size"); + } +}; + +Page.prototype.generatePageSizeSelectList = function () { + var _this = this; + + var pageSizes = []; + + if (this.pageSizeSelect) { + + if (Array.isArray(this.table.options.paginationSizeSelector)) { + pageSizes = this.table.options.paginationSizeSelector; + this.pageSizes = pageSizes; + + if (this.pageSizes.indexOf(this.size) == -1) { + pageSizes.unshift(this.size); + } + } else { + + if (this.pageSizes.indexOf(this.size) == -1) { + pageSizes = []; + + for (var i = 1; i < 5; i++) { + pageSizes.push(this.size * i); + } + + this.pageSizes = pageSizes; + } else { + pageSizes = this.pageSizes; + } + } + + while (this.pageSizeSelect.firstChild) { + this.pageSizeSelect.removeChild(this.pageSizeSelect.firstChild); + }pageSizes.forEach(function (item) { + var itemEl = document.createElement("option"); + itemEl.value = item; + + if (item === true) { + _this.table.modules.localize.bind("pagination|all", function (value) { + itemEl.innerHTML = value; + }); + } else { + itemEl.innerHTML = item; + } + + _this.pageSizeSelect.appendChild(itemEl); + }); + + this.pageSizeSelect.value = this.size; + } +}; + +//setup pageination +Page.prototype.initialize = function (hidden) { + var self = this, + pageSelectLabel, + testElRow, + testElCell; + + //update param names + this.dataSentNames = Object.assign({}, this.paginationDataSentNames); + this.dataSentNames = Object.assign(this.dataSentNames, this.table.options.paginationDataSent); + + this.dataReceivedNames = Object.assign({}, this.paginationDataReceivedNames); + this.dataReceivedNames = Object.assign(this.dataReceivedNames, this.table.options.paginationDataReceived); + + //build pagination element + + //bind localizations + self.table.modules.localize.bind("pagination|first", function (value) { + self.firstBut.innerHTML = value; + }); + + self.table.modules.localize.bind("pagination|first_title", function (value) { + self.firstBut.setAttribute("aria-label", value); + self.firstBut.setAttribute("title", value); + }); + + self.table.modules.localize.bind("pagination|prev", function (value) { + self.prevBut.innerHTML = value; + }); + + self.table.modules.localize.bind("pagination|prev_title", function (value) { + self.prevBut.setAttribute("aria-label", value); + self.prevBut.setAttribute("title", value); + }); + + self.table.modules.localize.bind("pagination|next", function (value) { + self.nextBut.innerHTML = value; + }); + + self.table.modules.localize.bind("pagination|next_title", function (value) { + self.nextBut.setAttribute("aria-label", value); + self.nextBut.setAttribute("title", value); + }); + + self.table.modules.localize.bind("pagination|last", function (value) { + self.lastBut.innerHTML = value; + }); + + self.table.modules.localize.bind("pagination|last_title", function (value) { + self.lastBut.setAttribute("aria-label", value); + self.lastBut.setAttribute("title", value); + }); + + //click bindings + self.firstBut.addEventListener("click", function () { + self.setPage(1); + }); + + self.prevBut.addEventListener("click", function () { + self.previousPage(); + }); + + self.nextBut.addEventListener("click", function () { + self.nextPage().then(function () {}).catch(function () {}); + }); + + self.lastBut.addEventListener("click", function () { + self.setPage(self.max); + }); + + if (self.table.options.paginationElement) { + self.element = self.table.options.paginationElement; + } + + if (this.pageSizeSelect) { + pageSelectLabel = document.createElement("label"); + + self.table.modules.localize.bind("pagination|page_size", function (value) { + self.pageSizeSelect.setAttribute("aria-label", value); + self.pageSizeSelect.setAttribute("title", value); + pageSelectLabel.innerHTML = value; + }); + + self.element.appendChild(pageSelectLabel); + self.element.appendChild(self.pageSizeSelect); + + self.pageSizeSelect.addEventListener("change", function (e) { + self.setPageSize(self.pageSizeSelect.value == "true" ? true : self.pageSizeSelect.value); + self.setPage(1).then(function () {}).catch(function () {}); + }); + } + + //append to DOM + self.element.appendChild(self.firstBut); + self.element.appendChild(self.prevBut); + self.element.appendChild(self.pagesElement); + self.element.appendChild(self.nextBut); + self.element.appendChild(self.lastBut); + + if (!self.table.options.paginationElement && !hidden) { + self.table.footerManager.append(self.element, self); + } + + //set default values + self.mode = self.table.options.pagination; + + if (self.table.options.paginationSize) { + self.size = self.table.options.paginationSize; + } else { + testElRow = document.createElement("div"); + testElRow.classList.add("tabulator-row"); + testElRow.style.visibility = hidden; + + testElCell = document.createElement("div"); + testElCell.classList.add("tabulator-cell"); + testElCell.innerHTML = "Page Row Test"; + + testElRow.appendChild(testElCell); + + self.table.rowManager.getTableElement().appendChild(testElRow); + + self.size = Math.floor(self.table.rowManager.getElement().clientHeight / testElRow.offsetHeight); + + self.table.rowManager.getTableElement().removeChild(testElRow); + } + + // self.page = self.table.options.paginationInitialPage || 1; + self.count = self.table.options.paginationButtonCount; + + self.generatePageSizeSelectList(); +}; + +Page.prototype.initializeProgressive = function (mode) { + this.initialize(true); + this.mode = "progressive_" + mode; + this.progressiveLoad = true; +}; + +Page.prototype.setDisplayIndex = function (index) { + this.displayIndex = index; +}; + +Page.prototype.getDisplayIndex = function () { + return this.displayIndex; +}; + +//calculate maximum page from number of rows +Page.prototype.setMaxRows = function (rowCount) { + if (!rowCount) { + this.max = 1; + } else { + this.max = this.size === true ? 1 : Math.ceil(rowCount / this.size); + } + + if (this.page > this.max) { + this.page = this.max; + } +}; + +//reset to first page without triggering action +Page.prototype.reset = function (force, columnsChanged) { + if (this.mode == "local" || force) { + this.page = 1; + } + + if (columnsChanged) { + this.initialLoad = true; + } + + return true; +}; + +//set the maxmum page +Page.prototype.setMaxPage = function (max) { + + max = parseInt(max); + + this.max = max || 1; + + if (this.page > this.max) { + this.page = this.max; + this.trigger(); + } +}; + +//set current page number +Page.prototype.setPage = function (page) { + var _this2 = this; + + var self = this; + + switch (page) { + case "first": + return this.setPage(1); + break; + + case "prev": + return this.previousPage(); + break; + + case "next": + return this.nextPage(); + break; + + case "last": + return this.setPage(this.max); + break; + } + + return new Promise(function (resolve, reject) { + + page = parseInt(page); + + if (page > 0 && page <= _this2.max) { + _this2.page = page; + _this2.trigger().then(function () { + resolve(); + }).catch(function () { + reject(); + }); + + if (self.table.options.persistence && self.table.modExists("persistence", true) && self.table.modules.persistence.config.page) { + self.table.modules.persistence.save("page"); + } + } else { + console.warn("Pagination Error - Requested page is out of range of 1 - " + _this2.max + ":", page); + reject(); + } + }); +}; + +Page.prototype.setPageToRow = function (row) { + var _this3 = this; + + return new Promise(function (resolve, reject) { + + var rows = _this3.table.rowManager.getDisplayRows(_this3.displayIndex - 1); + var index = rows.indexOf(row); + + if (index > -1) { + var page = _this3.size === true ? 1 : Math.ceil((index + 1) / _this3.size); + + _this3.setPage(page).then(function () { + resolve(); + }).catch(function () { + reject(); + }); + } else { + console.warn("Pagination Error - Requested row is not visible"); + reject(); + } + }); +}; + +Page.prototype.setPageSize = function (size) { + if (size !== true) { + size = parseInt(size); + } + + if (size > 0) { + this.size = size; + } + + if (this.pageSizeSelect) { + // this.pageSizeSelect.value = size; + this.generatePageSizeSelectList(); + } + + if (this.table.options.persistence && this.table.modExists("persistence", true) && this.table.modules.persistence.config.page) { + this.table.modules.persistence.save("page"); + } +}; + +//setup the pagination buttons +Page.prototype._setPageButtons = function () { + var self = this; + + var leftSize = Math.floor((this.count - 1) / 2); + var rightSize = Math.ceil((this.count - 1) / 2); + var min = this.max - this.page + leftSize + 1 < this.count ? this.max - this.count + 1 : Math.max(this.page - leftSize, 1); + var max = this.page <= rightSize ? Math.min(this.count, this.max) : Math.min(this.page + rightSize, this.max); + + while (self.pagesElement.firstChild) { + self.pagesElement.removeChild(self.pagesElement.firstChild); + }if (self.page == 1) { + self.firstBut.disabled = true; + self.prevBut.disabled = true; + } else { + self.firstBut.disabled = false; + self.prevBut.disabled = false; + } + + if (self.page == self.max) { + self.lastBut.disabled = true; + self.nextBut.disabled = true; + } else { + self.lastBut.disabled = false; + self.nextBut.disabled = false; + } + + for (var i = min; i <= max; i++) { + if (i > 0 && i <= self.max) { + self.pagesElement.appendChild(self._generatePageButton(i)); + } + } + + this.footerRedraw(); +}; + +Page.prototype._generatePageButton = function (page) { + var self = this, + button = document.createElement("button"); + + button.classList.add("tabulator-page"); + if (page == self.page) { + button.classList.add("active"); + } + + button.setAttribute("type", "button"); + button.setAttribute("role", "button"); + + self.table.modules.localize.bind("pagination|page_title", function (value) { + button.setAttribute("aria-label", value + " " + page); + button.setAttribute("title", value + " " + page); + }); + + button.setAttribute("data-page", page); + button.textContent = page; + + button.addEventListener("click", function (e) { + self.setPage(page); + }); + + return button; +}; + +//previous page +Page.prototype.previousPage = function () { + var _this4 = this; + + return new Promise(function (resolve, reject) { + if (_this4.page > 1) { + _this4.page--; + _this4.trigger().then(function () { + resolve(); + }).catch(function () { + reject(); + }); + + if (_this4.table.options.persistence && _this4.table.modExists("persistence", true) && _this4.table.modules.persistence.config.page) { + _this4.table.modules.persistence.save("page"); + } + } else { + console.warn("Pagination Error - Previous page would be less than page 1:", 0); + reject(); + } + }); +}; + +//next page +Page.prototype.nextPage = function () { + var _this5 = this; + + return new Promise(function (resolve, reject) { + if (_this5.page < _this5.max) { + _this5.page++; + _this5.trigger().then(function () { + resolve(); + }).catch(function () { + reject(); + }); + + if (_this5.table.options.persistence && _this5.table.modExists("persistence", true) && _this5.table.modules.persistence.config.page) { + _this5.table.modules.persistence.save("page"); + } + } else { + if (!_this5.progressiveLoad) { + console.warn("Pagination Error - Next page would be greater than maximum page of " + _this5.max + ":", _this5.max + 1); + } + reject(); + } + }); +}; + +//return current page number +Page.prototype.getPage = function () { + return this.page; +}; + +//return max page number +Page.prototype.getPageMax = function () { + return this.max; +}; + +Page.prototype.getPageSize = function (size) { + return this.size; +}; + +Page.prototype.getMode = function () { + return this.mode; +}; + +//return appropriate rows for current page +Page.prototype.getRows = function (data) { + var output, start, end; + + if (this.mode == "local") { + output = []; + + if (this.size === true) { + start = 0; + end = data.length - 1; + } else { + start = this.size * (this.page - 1); + end = start + parseInt(this.size); + } + + this._setPageButtons(); + + for (var i = start; i < end; i++) { + if (data[i]) { + output.push(data[i]); + } + } + + return output; + } else { + + this._setPageButtons(); + + return data.slice(0); + } +}; + +Page.prototype.trigger = function () { + var _this6 = this; + + var left; + + return new Promise(function (resolve, reject) { + + switch (_this6.mode) { + case "local": + left = _this6.table.rowManager.scrollLeft; + + _this6.table.rowManager.refreshActiveData("page"); + _this6.table.rowManager.scrollHorizontal(left); + + _this6.table.options.pageLoaded.call(_this6.table, _this6.getPage()); + resolve(); + break; + + case "remote": + case "progressive_load": + case "progressive_scroll": + _this6.table.modules.ajax.blockActiveRequest(); + _this6._getRemotePage().then(function () { + resolve(); + }).catch(function () { + reject(); + }); + break; + + default: + console.warn("Pagination Error - no such pagination mode:", _this6.mode); + reject(); + } + }); +}; + +Page.prototype._getRemotePage = function () { + var _this7 = this; + + var self = this, + oldParams, + pageParams; + + return new Promise(function (resolve, reject) { + + if (!self.table.modExists("ajax", true)) { + reject(); + } + + //record old params and restore after request has been made + oldParams = Tabulator.prototype.helpers.deepClone(self.table.modules.ajax.getParams() || {}); + pageParams = self.table.modules.ajax.getParams(); + + //configure request params + pageParams[_this7.dataSentNames.page] = self.page; + + //set page size if defined + if (_this7.size) { + pageParams[_this7.dataSentNames.size] = _this7.size; + } + + //set sort data if defined + if (_this7.table.options.ajaxSorting && _this7.table.modExists("sort")) { + var sorters = self.table.modules.sort.getSort(); + + sorters.forEach(function (item) { + delete item.column; + }); + + pageParams[_this7.dataSentNames.sorters] = sorters; + } + + //set filter data if defined + if (_this7.table.options.ajaxFiltering && _this7.table.modExists("filter")) { + var filters = self.table.modules.filter.getFilters(true, true); + pageParams[_this7.dataSentNames.filters] = filters; + } + + self.table.modules.ajax.setParams(pageParams); + + self.table.modules.ajax.sendRequest(_this7.progressiveLoad).then(function (data) { + self._parseRemoteData(data); + resolve(); + }).catch(function (e) { + reject(); + }); + + self.table.modules.ajax.setParams(oldParams); + }); +}; + +Page.prototype._parseRemoteData = function (data) { + var self = this, + left, + data, + margin; + + if (typeof data[this.dataReceivedNames.last_page] === "undefined") { + console.warn("Remote Pagination Error - Server response missing '" + this.dataReceivedNames.last_page + "' property"); + } + + if (data[this.dataReceivedNames.data]) { + this.max = parseInt(data[this.dataReceivedNames.last_page]) || 1; + + if (this.progressiveLoad) { + switch (this.mode) { + case "progressive_load": + + if (this.page == 1) { + this.table.rowManager.setData(data[this.dataReceivedNames.data], false, this.initialLoad && this.page == 1); + } else { + this.table.rowManager.addRows(data[this.dataReceivedNames.data]); + } + + if (this.page < this.max) { + setTimeout(function () { + self.nextPage().then(function () {}).catch(function () {}); + }, self.table.options.ajaxProgressiveLoadDelay); + } + break; + + case "progressive_scroll": + data = this.table.rowManager.getData().concat(data[this.dataReceivedNames.data]); + + this.table.rowManager.setData(data, true, this.initialLoad && this.page == 1); + + margin = this.table.options.ajaxProgressiveLoadScrollMargin || this.table.rowManager.element.clientHeight * 2; + + if (self.table.rowManager.element.scrollHeight <= self.table.rowManager.element.clientHeight + margin) { + self.nextPage().then(function () {}).catch(function () {}); + } + break; + } + } else { + left = this.table.rowManager.scrollLeft; + + this.table.rowManager.setData(data[this.dataReceivedNames.data], false, this.initialLoad && this.page == 1); + + this.table.rowManager.scrollHorizontal(left); + + this.table.columnManager.scrollHorizontal(left); + + this.table.options.pageLoaded.call(this.table, this.getPage()); + } + + this.initialLoad = false; + } else { + console.warn("Remote Pagination Error - Server response missing '" + this.dataReceivedNames.data + "' property"); + } +}; + +//handle the footer element being redrawn +Page.prototype.footerRedraw = function () { + var footer = this.table.footerManager.element; + + if (Math.ceil(footer.clientWidth) - footer.scrollWidth < 0) { + this.pagesElement.style.display = 'none'; + } else { + this.pagesElement.style.display = ''; + + if (Math.ceil(footer.clientWidth) - footer.scrollWidth < 0) { + this.pagesElement.style.display = 'none'; + } + } +}; + +//set the paramter names for pagination requests +Page.prototype.paginationDataSentNames = { + "page": "page", + "size": "size", + "sorters": "sorters", + // "sort_dir":"sort_dir", + "filters": "filters" + // "filter_value":"filter_value", + // "filter_type":"filter_type", +}; + +//set the property names for pagination responses +Page.prototype.paginationDataReceivedNames = { + "current_page": "current_page", + "last_page": "last_page", + "data": "data" +}; + +Tabulator.prototype.registerModule("page", Page); \ No newline at end of file diff --git a/admin/js/vendors/tabulator/js/modules/page.min.js b/admin/js/vendors/tabulator/js/modules/page.min.js new file mode 100644 index 0000000..c2835ba --- /dev/null +++ b/admin/js/vendors/tabulator/js/modules/page.min.js @@ -0,0 +1,2 @@ +/* Tabulator v4.7.0 (c) Oliver Folkerd */ +var Page=function(e){this.table=e,this.mode="local",this.progressiveLoad=!1,this.size=0,this.page=1,this.count=5,this.max=1,this.displayIndex=0,this.initialLoad=!0,this.pageSizes=[],this.dataReceivedNames={},this.dataSentNames={},this.createElements()};Page.prototype.createElements=function(){var e;this.element=document.createElement("span"),this.element.classList.add("tabulator-paginator"),this.pagesElement=document.createElement("span"),this.pagesElement.classList.add("tabulator-pages"),e=document.createElement("button"),e.classList.add("tabulator-page"),e.setAttribute("type","button"),e.setAttribute("role","button"),e.setAttribute("aria-label",""),e.setAttribute("title",""),this.firstBut=e.cloneNode(!0),this.firstBut.setAttribute("data-page","first"),this.prevBut=e.cloneNode(!0),this.prevBut.setAttribute("data-page","prev"),this.nextBut=e.cloneNode(!0),this.nextBut.setAttribute("data-page","next"),this.lastBut=e.cloneNode(!0),this.lastBut.setAttribute("data-page","last"),this.table.options.paginationSizeSelector&&(this.pageSizeSelect=document.createElement("select"),this.pageSizeSelect.classList.add("tabulator-page-size"))},Page.prototype.generatePageSizeSelectList=function(){var e=this,t=[];if(this.pageSizeSelect){if(Array.isArray(this.table.options.paginationSizeSelector))t=this.table.options.paginationSizeSelector,this.pageSizes=t,-1==this.pageSizes.indexOf(this.size)&&t.unshift(this.size);else if(-1==this.pageSizes.indexOf(this.size)){t=[];for(var a=1;a<5;a++)t.push(this.size*a);this.pageSizes=t}else t=this.pageSizes;for(;this.pageSizeSelect.firstChild;)this.pageSizeSelect.removeChild(this.pageSizeSelect.firstChild);t.forEach(function(t){var a=document.createElement("option");a.value=t,!0===t?e.table.modules.localize.bind("pagination|all",function(e){a.innerHTML=e}):a.innerHTML=t,e.pageSizeSelect.appendChild(a)}),this.pageSizeSelect.value=this.size}},Page.prototype.initialize=function(e){var t,a,i,s=this;this.dataSentNames=Object.assign({},this.paginationDataSentNames),this.dataSentNames=Object.assign(this.dataSentNames,this.table.options.paginationDataSent),this.dataReceivedNames=Object.assign({},this.paginationDataReceivedNames),this.dataReceivedNames=Object.assign(this.dataReceivedNames,this.table.options.paginationDataReceived),s.table.modules.localize.bind("pagination|first",function(e){s.firstBut.innerHTML=e}),s.table.modules.localize.bind("pagination|first_title",function(e){s.firstBut.setAttribute("aria-label",e),s.firstBut.setAttribute("title",e)}),s.table.modules.localize.bind("pagination|prev",function(e){s.prevBut.innerHTML=e}),s.table.modules.localize.bind("pagination|prev_title",function(e){s.prevBut.setAttribute("aria-label",e),s.prevBut.setAttribute("title",e)}),s.table.modules.localize.bind("pagination|next",function(e){s.nextBut.innerHTML=e}),s.table.modules.localize.bind("pagination|next_title",function(e){s.nextBut.setAttribute("aria-label",e),s.nextBut.setAttribute("title",e)}),s.table.modules.localize.bind("pagination|last",function(e){s.lastBut.innerHTML=e}),s.table.modules.localize.bind("pagination|last_title",function(e){s.lastBut.setAttribute("aria-label",e),s.lastBut.setAttribute("title",e)}),s.firstBut.addEventListener("click",function(){s.setPage(1)}),s.prevBut.addEventListener("click",function(){s.previousPage()}),s.nextBut.addEventListener("click",function(){s.nextPage().then(function(){}).catch(function(){})}),s.lastBut.addEventListener("click",function(){s.setPage(s.max)}),s.table.options.paginationElement&&(s.element=s.table.options.paginationElement),this.pageSizeSelect&&(t=document.createElement("label"),s.table.modules.localize.bind("pagination|page_size",function(e){s.pageSizeSelect.setAttribute("aria-label",e),s.pageSizeSelect.setAttribute("title",e),t.innerHTML=e}),s.element.appendChild(t),s.element.appendChild(s.pageSizeSelect),s.pageSizeSelect.addEventListener("change",function(e){s.setPageSize("true"==s.pageSizeSelect.value||s.pageSizeSelect.value),s.setPage(1).then(function(){}).catch(function(){})})),s.element.appendChild(s.firstBut),s.element.appendChild(s.prevBut),s.element.appendChild(s.pagesElement),s.element.appendChild(s.nextBut),s.element.appendChild(s.lastBut),s.table.options.paginationElement||e||s.table.footerManager.append(s.element,s),s.mode=s.table.options.pagination,s.table.options.paginationSize?s.size=s.table.options.paginationSize:(a=document.createElement("div"),a.classList.add("tabulator-row"),a.style.visibility=e,i=document.createElement("div"),i.classList.add("tabulator-cell"),i.innerHTML="Page Row Test",a.appendChild(i),s.table.rowManager.getTableElement().appendChild(a),s.size=Math.floor(s.table.rowManager.getElement().clientHeight/a.offsetHeight),s.table.rowManager.getTableElement().removeChild(a)),s.count=s.table.options.paginationButtonCount,s.generatePageSizeSelectList()},Page.prototype.initializeProgressive=function(e){this.initialize(!0),this.mode="progressive_"+e,this.progressiveLoad=!0},Page.prototype.setDisplayIndex=function(e){this.displayIndex=e},Page.prototype.getDisplayIndex=function(){return this.displayIndex},Page.prototype.setMaxRows=function(e){this.max=e?!0===this.size?1:Math.ceil(e/this.size):1,this.page>this.max&&(this.page=this.max)},Page.prototype.reset=function(e,t){return("local"==this.mode||e)&&(this.page=1),t&&(this.initialLoad=!0),!0},Page.prototype.setMaxPage=function(e){e=parseInt(e),this.max=e||1,this.page>this.max&&(this.page=this.max,this.trigger())},Page.prototype.setPage=function(e){var t=this,a=this;switch(e){case"first":return this.setPage(1);case"prev":return this.previousPage();case"next":return this.nextPage();case"last":return this.setPage(this.max)}return new Promise(function(i,s){e=parseInt(e),e>0&&e<=t.max?(t.page=e,t.trigger().then(function(){i()}).catch(function(){s()}),a.table.options.persistence&&a.table.modExists("persistence",!0)&&a.table.modules.persistence.config.page&&a.table.modules.persistence.save("page")):(console.warn("Pagination Error - Requested page is out of range of 1 - "+t.max+":",e),s())})},Page.prototype.setPageToRow=function(e){var t=this;return new Promise(function(a,i){var s=t.table.rowManager.getDisplayRows(t.displayIndex-1),n=s.indexOf(e);if(n>-1){var o=!0===t.size?1:Math.ceil((n+1)/t.size);t.setPage(o).then(function(){a()}).catch(function(){i()})}else console.warn("Pagination Error - Requested row is not visible"),i()})},Page.prototype.setPageSize=function(e){!0!==e&&(e=parseInt(e)),e>0&&(this.size=e),this.pageSizeSelect&&this.generatePageSizeSelectList(),this.table.options.persistence&&this.table.modExists("persistence",!0)&&this.table.modules.persistence.config.page&&this.table.modules.persistence.save("page")},Page.prototype._setPageButtons=function(){for(var e=this,t=Math.floor((this.count-1)/2),a=Math.ceil((this.count-1)/2),i=this.max-this.page+t+10&&n<=e.max&&e.pagesElement.appendChild(e._generatePageButton(n));this.footerRedraw()},Page.prototype._generatePageButton=function(e){var t=this,a=document.createElement("button");return a.classList.add("tabulator-page"),e==t.page&&a.classList.add("active"),a.setAttribute("type","button"),a.setAttribute("role","button"),t.table.modules.localize.bind("pagination|page_title",function(t){a.setAttribute("aria-label",t+" "+e),a.setAttribute("title",t+" "+e)}),a.setAttribute("data-page",e),a.textContent=e,a.addEventListener("click",function(a){t.setPage(e)}),a},Page.prototype.previousPage=function(){var e=this;return new Promise(function(t,a){e.page>1?(e.page--,e.trigger().then(function(){t()}).catch(function(){a()}),e.table.options.persistence&&e.table.modExists("persistence",!0)&&e.table.modules.persistence.config.page&&e.table.modules.persistence.save("page")):(console.warn("Pagination Error - Previous page would be less than page 1:",0),a())})},Page.prototype.nextPage=function(){var e=this;return new Promise(function(t,a){e.page i) { + output.splice(i, 0, column); + } else { + output.push(column); + } + } + }); + + return output; +}; + +//find matching columns +Persistence.prototype._findColumn = function (columns, subject) { + var type = subject.columns ? "group" : subject.field ? "field" : "object"; + + return columns.find(function (col) { + switch (type) { + case "group": + return col.title === subject.title && col.columns.length === subject.columns.length; + break; + + case "field": + return col.field === subject.field; + break; + + case "object": + return col === subject; + break; + } + }); +}; + +//save data +Persistence.prototype.save = function (type) { + var data = {}; + + switch (type) { + case "columns": + data = this.parseColumns(this.table.columnManager.getColumns()); + break; + + case "filter": + data = this.table.modules.filter.getFilters(); + break; + + case "sort": + data = this.validateSorters(this.table.modules.sort.getSort()); + break; + + case "group": + data = this.getGroupConfig(); + break; + + case "page": + data = this.getPageConfig(); + break; + } + + if (this.writeFunc) { + this.writeFunc(this.id, type, data); + } +}; + +//ensure sorters contain no function data +Persistence.prototype.validateSorters = function (data) { + data.forEach(function (item) { + item.column = item.field; + delete item.field; + }); + + return data; +}; + +Persistence.prototype.getGroupConfig = function () { + if (this.config.group) { + if (this.config.group === true || this.config.group.groupBy) { + data.groupBy = this.table.options.groupBy; + } + + if (this.config.group === true || this.config.group.groupStartOpen) { + data.groupStartOpen = this.table.options.groupStartOpen; + } + + if (this.config.group === true || this.config.group.groupHeader) { + data.groupHeader = this.table.options.groupHeader; + } + } + + return data; +}; + +Persistence.prototype.getPageConfig = function () { + var data = {}; + + if (this.config.page) { + if (this.config.page === true || this.config.page.size) { + data.paginationSize = this.table.modules.page.getPageSize(); + } + + if (this.config.page === true || this.config.page.page) { + data.paginationInitialPage = this.table.modules.page.getPage(); + } + } + + return data; +}; + +//parse columns for data to store +Persistence.prototype.parseColumns = function (columns) { + var self = this, + definitions = []; + + columns.forEach(function (column) { + var defStore = {}, + colDef = column.getDefinition(), + keys; + + if (column.isGroup) { + defStore.title = colDef.title; + defStore.columns = self.parseColumns(column.getColumns()); + } else { + defStore.field = column.getField(); + + if (self.config.columns === true || self.config.columns == undefined) { + keys = Object.keys(colDef); + keys.push("width"); + } else { + keys = self.config.columns; + } + + keys.forEach(function (key) { + + switch (key) { + case "width": + defStore.width = column.getWidth(); + break; + case "visible": + defStore.visible = column.visible; + break; + + default: + defStore[key] = colDef[key]; + } + }); + } + + definitions.push(defStore); + }); + + return definitions; +}; + +// read peristence information from storage +Persistence.prototype.readers = { + local: function local(id, type) { + var data = localStorage.getItem(id + "-" + type); + + return data ? JSON.parse(data) : false; + }, + cookie: function cookie(id, type) { + var cookie = document.cookie, + key = id + "-" + type, + cookiePos = cookie.indexOf(key + "="), + end, + data; + + //if cookie exists, decode and load column data into tabulator + if (cookiePos > -1) { + cookie = cookie.substr(cookiePos); + + end = cookie.indexOf(";"); + + if (end > -1) { + cookie = cookie.substr(0, end); + } + + data = cookie.replace(key + "=", ""); + } + + return data ? JSON.parse(data) : false; + } +}; + +//write persistence information to storage +Persistence.prototype.writers = { + local: function local(id, type, data) { + localStorage.setItem(id + "-" + type, JSON.stringify(data)); + }, + cookie: function cookie(id, type, data) { + var expireDate = new Date(); + + expireDate.setDate(expireDate.getDate() + 10000); + + document.cookie = id + "-" + type + "=" + JSON.stringify(data) + "; expires=" + expireDate.toUTCString(); + } +}; + +Tabulator.prototype.registerModule("persistence", Persistence); \ No newline at end of file diff --git a/admin/js/vendors/tabulator/js/modules/persistence.min.js b/admin/js/vendors/tabulator/js/modules/persistence.min.js new file mode 100644 index 0000000..8d87ab3 --- /dev/null +++ b/admin/js/vendors/tabulator/js/modules/persistence.min.js @@ -0,0 +1,2 @@ +/* Tabulator v4.7.0 (c) Oliver Folkerd */ +var Persistence=function(e){this.table=e,this.mode="",this.id="",this.defWatcherBlock=!1,this.config={},this.readFunc=!1,this.writeFunc=!1};Persistence.prototype.localStorageTest=function(){var e="_tabulator_test";try{return window.localStorage.setItem(e,e),window.localStorage.removeItem(e),!0}catch(e){return!1}},Persistence.prototype.initialize=function(){var e,t=this.table.options.persistenceMode,i=this.table.options.persistenceID;this.mode=!0!==t?t:this.localStorageTest()?"local":"cookie",this.table.options.persistenceReaderFunc?"function"==typeof this.table.options.persistenceReaderFunc?this.readFunc=this.table.options.persistenceReaderFunc:this.readers[this.table.options.persistenceReaderFunc]?this.readFunc=this.readers[this.table.options.persistenceReaderFunc]:console.warn("Persistence Read Error - invalid reader set",this.table.options.persistenceReaderFunc):this.readers[this.mode]?this.readFunc=this.readers[this.mode]:console.warn("Persistence Read Error - invalid reader set",this.mode),this.table.options.persistenceWriterFunc?"function"==typeof this.table.options.persistenceWriterFunc?this.writeFunc=this.table.options.persistenceWriterFunc:this.readers[this.table.options.persistenceWriterFunc]?this.writeFunc=this.readers[this.table.options.persistenceWriterFunc]:console.warn("Persistence Write Error - invalid reader set",this.table.options.persistenceWriterFunc):this.writers[this.mode]?this.writeFunc=this.writers[this.mode]:console.warn("Persistence Write Error - invalid writer set",this.mode),this.id="tabulator-"+(i||this.table.element.getAttribute("id")||""),this.config={sort:!0===this.table.options.persistence||this.table.options.persistence.sort,filter:!0===this.table.options.persistence||this.table.options.persistence.filter,group:!0===this.table.options.persistence||this.table.options.persistence.group,page:!0===this.table.options.persistence||this.table.options.persistence.page,columns:!0===this.table.options.persistence?["title","width","visible"]:this.table.options.persistence.columns},this.config.page&&(e=this.retreiveData("page"))&&(void 0===e.paginationSize||!0!==this.config.page&&!this.config.page.size||(this.table.options.paginationSize=e.paginationSize),void 0===e.paginationInitialPage||!0!==this.config.page&&!this.config.page.page||(this.table.options.paginationInitialPage=e.paginationInitialPage)),this.config.group&&(e=this.retreiveData("group"))&&(void 0===e.groupBy||!0!==this.config.group&&!this.config.group.groupBy||(this.table.options.groupBy=e.groupBy),void 0===e.groupStartOpen||!0!==this.config.group&&!this.config.group.groupStartOpen||(this.table.options.groupStartOpen=e.groupStartOpen),void 0===e.groupHeader||!0!==this.config.group&&!this.config.group.groupHeader||(this.table.options.groupHeader=e.groupHeader))},Persistence.prototype.initializeColumn=function(e){var t,i,s=this;this.config.columns&&(this.defWatcherBlock=!0,t=e.getDefinition(),i=!0===this.config.columns?Object.keys(t):this.config.columns,i.forEach(function(e){var i=Object.getOwnPropertyDescriptor(t,e),o=t[e];i&&Object.defineProperty(t,e,{set:function(e){o=e,s.defWatcherBlock||s.save("columns"),i.set&&i.set(e)},get:function(){return i.get&&i.get(),o}})}),this.defWatcherBlock=!1)},Persistence.prototype.load=function(e,t){var i=this.retreiveData(e);return t&&(i=i?this.mergeDefinition(t,i):t),i},Persistence.prototype.retreiveData=function(e){return!!this.readFunc&&this.readFunc(this.id,e)},Persistence.prototype.mergeDefinition=function(e,t){var i=this,s=[];return t=t||[],t.forEach(function(t,o){var n,r=i._findColumn(e,t);r&&(!0===i.config.columns||void 0==i.config.columns?(n=Object.keys(r),n.push("width")):n=i.config.columns,n.forEach(function(e){void 0!==t[e]&&(r[e]=t[e])}),r.columns&&(r.columns=i.mergeDefinition(r.columns,t.columns)),s.push(r))}),e.forEach(function(e,o){i._findColumn(t,e)||(s.length>o?s.splice(o,0,e):s.push(e))}),s},Persistence.prototype._findColumn=function(e,t){var i=t.columns?"group":t.field?"field":"object";return e.find(function(e){switch(i){case"group":return e.title===t.title&&e.columns.length===t.columns.length;case"field":return e.field===t.field;case"object":return e===t}})},Persistence.prototype.save=function(e){var t={};switch(e){case"columns":t=this.parseColumns(this.table.columnManager.getColumns());break;case"filter":t=this.table.modules.filter.getFilters();break;case"sort":t=this.validateSorters(this.table.modules.sort.getSort());break;case"group":t=this.getGroupConfig();break;case"page":t=this.getPageConfig()}this.writeFunc&&this.writeFunc(this.id,e,t)},Persistence.prototype.validateSorters=function(e){return e.forEach(function(e){e.column=e.field,delete e.field}),e},Persistence.prototype.getGroupConfig=function(){return this.config.group&&((!0===this.config.group||this.config.group.groupBy)&&(data.groupBy=this.table.options.groupBy),(!0===this.config.group||this.config.group.groupStartOpen)&&(data.groupStartOpen=this.table.options.groupStartOpen),(!0===this.config.group||this.config.group.groupHeader)&&(data.groupHeader=this.table.options.groupHeader)),data},Persistence.prototype.getPageConfig=function(){var e={};return this.config.page&&((!0===this.config.page||this.config.page.size)&&(e.paginationSize=this.table.modules.page.getPageSize()),(!0===this.config.page||this.config.page.page)&&(e.paginationInitialPage=this.table.modules.page.getPage())),e},Persistence.prototype.parseColumns=function(e){var t=this,i=[];return e.forEach(function(e){var s,o={},n=e.getDefinition();e.isGroup?(o.title=n.title,o.columns=t.parseColumns(e.getColumns())):(o.field=e.getField(),!0===t.config.columns||void 0==t.config.columns?(s=Object.keys(n),s.push("width")):s=t.config.columns,s.forEach(function(t){switch(t){case"width":o.width=e.getWidth();break;case"visible":o.visible=e.visible;break;default:o[t]=n[t]}})),i.push(o)}),i},Persistence.prototype.readers={local:function(e,t){var i=localStorage.getItem(e+"-"+t);return!!i&&JSON.parse(i)},cookie:function(e,t){var i,s,o=document.cookie,n=e+"-"+t,r=o.indexOf(n+"=");return r>-1&&(o=o.substr(r),i=o.indexOf(";"),i>-1&&(o=o.substr(0,i)),s=o.replace(n+"=","")),!!s&&JSON.parse(s)}},Persistence.prototype.writers={local:function(e,t,i){localStorage.setItem(e+"-"+t,JSON.stringify(i))},cookie:function(e,t,i){var s=new Date;s.setDate(s.getDate()+1e4),document.cookie=e+"-"+t+"="+JSON.stringify(i)+"; expires="+s.toUTCString()}},Tabulator.prototype.registerModule("persistence",Persistence); \ No newline at end of file diff --git a/admin/js/vendors/tabulator/js/modules/print.js b/admin/js/vendors/tabulator/js/modules/print.js new file mode 100644 index 0000000..940f1a9 --- /dev/null +++ b/admin/js/vendors/tabulator/js/modules/print.js @@ -0,0 +1,96 @@ +/* Tabulator v4.7.0 (c) Oliver Folkerd */ + +var Print = function Print(table) { + this.table = table; //hold Tabulator object + this.element = false; + this.manualBlock = false; +}; + +Print.prototype.initialize = function () { + window.addEventListener("beforeprint", this.replaceTable.bind(this)); + window.addEventListener("afterprint", this.cleanup.bind(this)); +}; + +Print.prototype.replaceTable = function () { + if (!this.manualBlock) { + this.element = document.createElement("div"); + this.element.classList.add("tabulator-print-table"); + + this.element.appendChild(this.table.modules.export.genereateTable(this.table.options.printConfig, this.table.options.printStyled, this.table.options.printRowRange, "print")); + + this.table.element.style.display = "none"; + + this.table.element.parentNode.insertBefore(this.element, this.table.element); + } +}; + +Print.prototype.cleanup = function () { + document.body.classList.remove("tabulator-print-fullscreen-hide"); + + if (this.element && this.element.parentNode) { + this.element.parentNode.removeChild(this.element); + this.table.element.style.display = ""; + } +}; + +Print.prototype.printFullscreen = function (visible, style, config) { + var scrollX = window.scrollX, + scrollY = window.scrollY, + headerEl = document.createElement("div"), + footerEl = document.createElement("div"), + tableEl = this.table.modules.export.genereateTable(typeof config != "undefined" ? config : this.table.options.printConfig, typeof style != "undefined" ? style : this.table.options.printStyled, visible, "print"), + headerContent, + footerContent; + + this.manualBlock = true; + + this.element = document.createElement("div"); + this.element.classList.add("tabulator-print-fullscreen"); + + if (this.table.options.printHeader) { + headerEl.classList.add("tabulator-print-header"); + + headerContent = typeof this.table.options.printHeader == "function" ? this.table.options.printHeader.call(this.table) : this.table.options.printHeader; + + if (typeof headerContent == "string") { + headerEl.innerHTML = headerContent; + } else { + headerEl.appendChild(headerContent); + } + + this.element.appendChild(headerEl); + } + + this.element.appendChild(tableEl); + + if (this.table.options.printFooter) { + footerEl.classList.add("tabulator-print-footer"); + + footerContent = typeof this.table.options.printFooter == "function" ? this.table.options.printFooter.call(this.table) : this.table.options.printFooter; + + if (typeof footerContent == "string") { + footerEl.innerHTML = footerContent; + } else { + footerEl.appendChild(footerContent); + } + + this.element.appendChild(footerEl); + } + + document.body.classList.add("tabulator-print-fullscreen-hide"); + document.body.appendChild(this.element); + + if (this.table.options.printFormatter) { + this.table.options.printFormatter(this.element, tableEl); + } + + window.print(); + + this.cleanup(); + + window.scrollTo(scrollX, scrollY); + + this.manualBlock = false; +}; + +Tabulator.prototype.registerModule("print", Print); \ No newline at end of file diff --git a/admin/js/vendors/tabulator/js/modules/print.min.js b/admin/js/vendors/tabulator/js/modules/print.min.js new file mode 100644 index 0000000..b46279c --- /dev/null +++ b/admin/js/vendors/tabulator/js/modules/print.min.js @@ -0,0 +1,2 @@ +/* Tabulator v4.7.0 (c) Oliver Folkerd */ +var Print=function(t){this.table=t,this.element=!1,this.manualBlock=!1};Print.prototype.initialize=function(){window.addEventListener("beforeprint",this.replaceTable.bind(this)),window.addEventListener("afterprint",this.cleanup.bind(this))},Print.prototype.replaceTable=function(){this.manualBlock||(this.element=document.createElement("div"),this.element.classList.add("tabulator-print-table"),this.element.appendChild(this.table.modules.export.genereateTable(this.table.options.printConfig,this.table.options.printStyled,this.table.options.printRowRange,"print")),this.table.element.style.display="none",this.table.element.parentNode.insertBefore(this.element,this.table.element))},Print.prototype.cleanup=function(){document.body.classList.remove("tabulator-print-fullscreen-hide"),this.element&&this.element.parentNode&&(this.element.parentNode.removeChild(this.element),this.table.element.style.display="")},Print.prototype.printFullscreen=function(t,e,i){var n,l,o=window.scrollX,a=window.scrollY,s=document.createElement("div"),r=document.createElement("div"),p=this.table.modules.export.genereateTable(void 0!==i?i:this.table.options.printConfig,void 0!==e?e:this.table.options.printStyled,t,"print");this.manualBlock=!0,this.element=document.createElement("div"),this.element.classList.add("tabulator-print-fullscreen"),this.table.options.printHeader&&(s.classList.add("tabulator-print-header"),n="function"==typeof this.table.options.printHeader?this.table.options.printHeader.call(this.table):this.table.options.printHeader,"string"==typeof n?s.innerHTML=n:s.appendChild(n),this.element.appendChild(s)),this.element.appendChild(p),this.table.options.printFooter&&(r.classList.add("tabulator-print-footer"),l="function"==typeof this.table.options.printFooter?this.table.options.printFooter.call(this.table):this.table.options.printFooter,"string"==typeof l?r.innerHTML=l:r.appendChild(l),this.element.appendChild(r)),document.body.classList.add("tabulator-print-fullscreen-hide"),document.body.appendChild(this.element),this.table.options.printFormatter&&this.table.options.printFormatter(this.element,p),window.print(),this.cleanup(),window.scrollTo(o,a),this.manualBlock=!1},Tabulator.prototype.registerModule("print",Print); \ No newline at end of file diff --git a/admin/js/vendors/tabulator/js/modules/reactive_data.js b/admin/js/vendors/tabulator/js/modules/reactive_data.js new file mode 100644 index 0000000..eb73971 --- /dev/null +++ b/admin/js/vendors/tabulator/js/modules/reactive_data.js @@ -0,0 +1,235 @@ +/* Tabulator v4.7.0 (c) Oliver Folkerd */ + +var ReactiveData = function ReactiveData(table) { + this.table = table; //hold Tabulator object + this.data = false; + this.blocked = false; //block reactivity while performing update + this.origFuncs = {}; // hold original data array functions to allow replacement after data is done with + this.currentVersion = 0; +}; + +ReactiveData.prototype.watchData = function (data) { + var self = this, + pushFunc, + version; + + this.currentVersion++; + + version = this.currentVersion; + + self.unwatchData(); + + self.data = data; + + //override array push function + self.origFuncs.push = data.push; + + Object.defineProperty(self.data, "push", { + enumerable: false, + configurable: true, + value: function value() { + var args = Array.from(arguments); + + if (!self.blocked && version === self.currentVersion) { + args.forEach(function (arg) { + self.table.rowManager.addRowActual(arg, false); + }); + } + + return self.origFuncs.push.apply(data, arguments); + } + }); + + //override array unshift function + self.origFuncs.unshift = data.unshift; + + Object.defineProperty(self.data, "unshift", { + enumerable: false, + configurable: true, + value: function value() { + var args = Array.from(arguments); + + if (!self.blocked && version === self.currentVersion) { + args.forEach(function (arg) { + self.table.rowManager.addRowActual(arg, true); + }); + } + + return self.origFuncs.unshift.apply(data, arguments); + } + }); + + //override array shift function + self.origFuncs.shift = data.shift; + + Object.defineProperty(self.data, "shift", { + enumerable: false, + configurable: true, + value: function value() { + var row; + + if (!self.blocked && version === self.currentVersion) { + if (self.data.length) { + row = self.table.rowManager.getRowFromDataObject(self.data[0]); + + if (row) { + row.deleteActual(); + } + } + } + + return self.origFuncs.shift.call(data); + } + }); + + //override array pop function + self.origFuncs.pop = data.pop; + + Object.defineProperty(self.data, "pop", { + enumerable: false, + configurable: true, + value: function value() { + var row; + if (!self.blocked && version === self.currentVersion) { + if (self.data.length) { + row = self.table.rowManager.getRowFromDataObject(self.data[self.data.length - 1]); + + if (row) { + row.deleteActual(); + } + } + } + return self.origFuncs.pop.call(data); + } + }); + + //override array splice function + self.origFuncs.splice = data.splice; + + Object.defineProperty(self.data, "splice", { + enumerable: false, + configurable: true, + value: function value() { + var args = Array.from(arguments), + start = args[0] < 0 ? data.length + args[0] : args[0], + end = args[1], + newRows = args[2] ? args.slice(2) : false, + startRow; + + if (!self.blocked && version === self.currentVersion) { + + //add new rows + if (newRows) { + startRow = data[start] ? self.table.rowManager.getRowFromDataObject(data[start]) : false; + + if (startRow) { + newRows.forEach(function (rowData) { + self.table.rowManager.addRowActual(rowData, true, startRow, true); + }); + } else { + newRows = newRows.slice().reverse(); + + newRows.forEach(function (rowData) { + self.table.rowManager.addRowActual(rowData, true, false, true); + }); + } + } + + //delete removed rows + if (end !== 0) { + var oldRows = data.slice(start, typeof args[1] === "undefined" ? args[1] : start + end); + + oldRows.forEach(function (rowData, i) { + var row = self.table.rowManager.getRowFromDataObject(rowData); + + if (row) { + row.deleteActual(i !== oldRows.length - 1); + } + }); + } + + if (newRows || end !== 0) { + self.table.rowManager.reRenderInPosition(); + } + } + + return self.origFuncs.splice.apply(data, arguments); + } + }); +}; + +ReactiveData.prototype.unwatchData = function () { + if (this.data !== false) { + for (var key in this.origFuncs) { + Object.defineProperty(this.data, key, { + enumerable: true, + configurable: true, + writable: true, + value: this.origFuncs.key + }); + } + } +}; + +ReactiveData.prototype.watchRow = function (row) { + var self = this, + data = row.getData(); + + this.blocked = true; + + for (var key in data) { + this.watchKey(row, data, key); + } + + this.blocked = false; +}; + +ReactiveData.prototype.watchKey = function (row, data, key) { + var self = this, + props = Object.getOwnPropertyDescriptor(data, key), + value = data[key], + version = this.currentVersion; + + Object.defineProperty(data, key, { + set: function set(newValue) { + value = newValue; + if (!self.blocked && version === self.currentVersion) { + var update = {}; + update[key] = newValue; + row.updateData(update); + } + + if (props.set) { + props.set(newValue); + } + }, + get: function get() { + + if (props.get) { + props.get(); + } + + return value; + } + }); +}; + +ReactiveData.prototype.unwatchRow = function (row) { + var data = row.getData(); + + for (var key in data) { + Object.defineProperty(data, key, { + value: data[key] + }); + } +}; + +ReactiveData.prototype.block = function () { + this.blocked = true; +}; + +ReactiveData.prototype.unblock = function () { + this.blocked = false; +}; + +Tabulator.prototype.registerModule("reactiveData", ReactiveData); \ No newline at end of file diff --git a/admin/js/vendors/tabulator/js/modules/reactive_data.min.js b/admin/js/vendors/tabulator/js/modules/reactive_data.min.js new file mode 100644 index 0000000..c5dc047 --- /dev/null +++ b/admin/js/vendors/tabulator/js/modules/reactive_data.min.js @@ -0,0 +1,2 @@ +/* Tabulator v4.7.0 (c) Oliver Folkerd */ +var ReactiveData=function(e){this.table=e,this.data=!1,this.blocked=!1,this.origFuncs={},this.currentVersion=0};ReactiveData.prototype.watchData=function(e){var t,a=this;this.currentVersion++,t=this.currentVersion,a.unwatchData(),a.data=e,a.origFuncs.push=e.push,Object.defineProperty(a.data,"push",{enumerable:!1,configurable:!0,value:function(){var r=Array.from(arguments);return a.blocked||t!==a.currentVersion||r.forEach(function(e){a.table.rowManager.addRowActual(e,!1)}),a.origFuncs.push.apply(e,arguments)}}),a.origFuncs.unshift=e.unshift,Object.defineProperty(a.data,"unshift",{enumerable:!1,configurable:!0,value:function(){var r=Array.from(arguments);return a.blocked||t!==a.currentVersion||r.forEach(function(e){a.table.rowManager.addRowActual(e,!0)}),a.origFuncs.unshift.apply(e,arguments)}}),a.origFuncs.shift=e.shift,Object.defineProperty(a.data,"shift",{enumerable:!1,configurable:!0,value:function(){var r;return a.blocked||t!==a.currentVersion||a.data.length&&(r=a.table.rowManager.getRowFromDataObject(a.data[0]))&&r.deleteActual(),a.origFuncs.shift.call(e)}}),a.origFuncs.pop=e.pop,Object.defineProperty(a.data,"pop",{enumerable:!1,configurable:!0,value:function(){var r;return a.blocked||t!==a.currentVersion||a.data.length&&(r=a.table.rowManager.getRowFromDataObject(a.data[a.data.length-1]))&&r.deleteActual(),a.origFuncs.pop.call(e)}}),a.origFuncs.splice=e.splice,Object.defineProperty(a.data,"splice",{enumerable:!1,configurable:!0,value:function(){var r,o=Array.from(arguments),n=o[0]<0?e.length+o[0]:o[0],c=o[1],i=!!o[2]&&o.slice(2);if(!a.blocked&&t===a.currentVersion){if(i&&(r=!!e[n]&&a.table.rowManager.getRowFromDataObject(e[n]),r?i.forEach(function(e){a.table.rowManager.addRowActual(e,!0,r,!0)}):(i=i.slice().reverse(),i.forEach(function(e){a.table.rowManager.addRowActual(e,!0,!1,!0)}))),0!==c){var u=e.slice(n,void 0===o[1]?o[1]:n+c);u.forEach(function(e,t){var r=a.table.rowManager.getRowFromDataObject(e);r&&r.deleteActual(t!==u.length-1)})}(i||0!==c)&&a.table.rowManager.reRenderInPosition()}return a.origFuncs.splice.apply(e,arguments)}})},ReactiveData.prototype.unwatchData=function(){if(!1!==this.data)for(var e in this.origFuncs)Object.defineProperty(this.data,e,{enumerable:!0,configurable:!0,writable:!0,value:this.origFuncs.key})},ReactiveData.prototype.watchRow=function(e){var t=e.getData();this.blocked=!0;for(var a in t)this.watchKey(e,t,a);this.blocked=!1},ReactiveData.prototype.watchKey=function(e,t,a){var r=this,o=Object.getOwnPropertyDescriptor(t,a),n=t[a],c=this.currentVersion;Object.defineProperty(t,a,{set:function(t){if(n=t,!r.blocked&&c===r.currentVersion){var i={};i[a]=t,e.updateData(i)}o.set&&o.set(t)},get:function(){return o.get&&o.get(),n}})},ReactiveData.prototype.unwatchRow=function(e){var t=e.getData();for(var a in t)Object.defineProperty(t,a,{value:t[a]})},ReactiveData.prototype.block=function(){this.blocked=!0},ReactiveData.prototype.unblock=function(){this.blocked=!1},Tabulator.prototype.registerModule("reactiveData",ReactiveData); \ No newline at end of file diff --git a/admin/js/vendors/tabulator/js/modules/resize_columns.js b/admin/js/vendors/tabulator/js/modules/resize_columns.js new file mode 100644 index 0000000..753c02b --- /dev/null +++ b/admin/js/vendors/tabulator/js/modules/resize_columns.js @@ -0,0 +1,163 @@ +/* Tabulator v4.7.0 (c) Oliver Folkerd */ + +var ResizeColumns = function ResizeColumns(table) { + this.table = table; //hold Tabulator object + this.startColumn = false; + this.startX = false; + this.startWidth = false; + this.handle = null; + this.prevHandle = null; +}; + +ResizeColumns.prototype.initializeColumn = function (type, column, element) { + var self = this, + variableHeight = false, + mode = this.table.options.resizableColumns; + + //set column resize mode + if (type === "header") { + variableHeight = column.definition.formatter == "textarea" || column.definition.variableHeight; + column.modules.resize = { variableHeight: variableHeight }; + } + + if (mode === true || mode == type) { + + var handle = document.createElement('div'); + handle.className = "tabulator-col-resize-handle"; + + var prevHandle = document.createElement('div'); + prevHandle.className = "tabulator-col-resize-handle prev"; + + handle.addEventListener("click", function (e) { + e.stopPropagation(); + }); + + var handleDown = function handleDown(e) { + var nearestColumn = column.getLastColumn(); + + if (nearestColumn && self._checkResizability(nearestColumn)) { + self.startColumn = column; + self._mouseDown(e, nearestColumn, handle); + } + }; + + handle.addEventListener("mousedown", handleDown); + handle.addEventListener("touchstart", handleDown, { passive: true }); + + //reszie column on double click + handle.addEventListener("dblclick", function (e) { + var col = column.getLastColumn(); + + if (col && self._checkResizability(col)) { + e.stopPropagation(); + col.reinitializeWidth(true); + } + }); + + prevHandle.addEventListener("click", function (e) { + e.stopPropagation(); + }); + + var prevHandleDown = function prevHandleDown(e) { + var nearestColumn, colIndex, prevColumn; + + nearestColumn = column.getFirstColumn(); + + if (nearestColumn) { + colIndex = self.table.columnManager.findColumnIndex(nearestColumn); + prevColumn = colIndex > 0 ? self.table.columnManager.getColumnByIndex(colIndex - 1) : false; + + if (prevColumn && self._checkResizability(prevColumn)) { + self.startColumn = column; + self._mouseDown(e, prevColumn, prevHandle); + } + } + }; + + prevHandle.addEventListener("mousedown", prevHandleDown); + prevHandle.addEventListener("touchstart", prevHandleDown, { passive: true }); + + //resize column on double click + prevHandle.addEventListener("dblclick", function (e) { + var nearestColumn, colIndex, prevColumn; + + nearestColumn = column.getFirstColumn(); + + if (nearestColumn) { + colIndex = self.table.columnManager.findColumnIndex(nearestColumn); + prevColumn = colIndex > 0 ? self.table.columnManager.getColumnByIndex(colIndex - 1) : false; + + if (prevColumn && self._checkResizability(prevColumn)) { + e.stopPropagation(); + prevColumn.reinitializeWidth(true); + } + } + }); + + element.appendChild(handle); + element.appendChild(prevHandle); + } +}; + +ResizeColumns.prototype._checkResizability = function (column) { + return typeof column.definition.resizable != "undefined" ? column.definition.resizable : this.table.options.resizableColumns; +}; + +ResizeColumns.prototype._mouseDown = function (e, column, handle) { + var self = this; + + self.table.element.classList.add("tabulator-block-select"); + + function mouseMove(e) { + // self.table.columnManager.tempScrollBlock(); + + column.setWidth(self.startWidth + ((typeof e.screenX === "undefined" ? e.touches[0].screenX : e.screenX) - self.startX)); + + if (!self.table.browserSlow && column.modules.resize && column.modules.resize.variableHeight) { + column.checkCellHeights(); + } + } + + function mouseUp(e) { + + //block editor from taking action while resizing is taking place + if (self.startColumn.modules.edit) { + self.startColumn.modules.edit.blocked = false; + } + + if (self.table.browserSlow && column.modules.resize && column.modules.resize.variableHeight) { + column.checkCellHeights(); + } + + document.body.removeEventListener("mouseup", mouseUp); + document.body.removeEventListener("mousemove", mouseMove); + + handle.removeEventListener("touchmove", mouseMove); + handle.removeEventListener("touchend", mouseUp); + + self.table.element.classList.remove("tabulator-block-select"); + + if (self.table.options.persistence && self.table.modExists("persistence", true) && self.table.modules.persistence.config.columns) { + self.table.modules.persistence.save("columns"); + } + + self.table.options.columnResized.call(self.table, column.getComponent()); + } + + e.stopPropagation(); //prevent resize from interfereing with movable columns + + //block editor from taking action while resizing is taking place + if (self.startColumn.modules.edit) { + self.startColumn.modules.edit.blocked = true; + } + + self.startX = typeof e.screenX === "undefined" ? e.touches[0].screenX : e.screenX; + self.startWidth = column.getWidth(); + + document.body.addEventListener("mousemove", mouseMove); + document.body.addEventListener("mouseup", mouseUp); + handle.addEventListener("touchmove", mouseMove, { passive: true }); + handle.addEventListener("touchend", mouseUp); +}; + +Tabulator.prototype.registerModule("resizeColumns", ResizeColumns); \ No newline at end of file diff --git a/admin/js/vendors/tabulator/js/modules/resize_columns.min.js b/admin/js/vendors/tabulator/js/modules/resize_columns.min.js new file mode 100644 index 0000000..7ae0e38 --- /dev/null +++ b/admin/js/vendors/tabulator/js/modules/resize_columns.min.js @@ -0,0 +1,2 @@ +/* Tabulator v4.7.0 (c) Oliver Folkerd */ +var ResizeColumns=function(e){this.table=e,this.startColumn=!1,this.startX=!1,this.startWidth=!1,this.handle=null,this.prevHandle=null};ResizeColumns.prototype.initializeColumn=function(e,t,n){var o=this,i=!1,s=this.table.options.resizableColumns;if("header"===e&&(i="textarea"==t.definition.formatter||t.definition.variableHeight,t.modules.resize={variableHeight:i}),!0===s||s==e){var a=document.createElement("div");a.className="tabulator-col-resize-handle";var l=document.createElement("div");l.className="tabulator-col-resize-handle prev",a.addEventListener("click",function(e){e.stopPropagation()});var r=function(e){var n=t.getLastColumn();n&&o._checkResizability(n)&&(o.startColumn=t,o._mouseDown(e,n,a))};a.addEventListener("mousedown",r),a.addEventListener("touchstart",r,{passive:!0}),a.addEventListener("dblclick",function(e){var n=t.getLastColumn();n&&o._checkResizability(n)&&(e.stopPropagation(),n.reinitializeWidth(!0))}),l.addEventListener("click",function(e){e.stopPropagation()});var d=function(e){var n,i,s;(n=t.getFirstColumn())&&(i=o.table.columnManager.findColumnIndex(n),(s=i>0&&o.table.columnManager.getColumnByIndex(i-1))&&o._checkResizability(s)&&(o.startColumn=t,o._mouseDown(e,s,l)))};l.addEventListener("mousedown",d),l.addEventListener("touchstart",d,{passive:!0}),l.addEventListener("dblclick",function(e){var n,i,s;(n=t.getFirstColumn())&&(i=o.table.columnManager.findColumnIndex(n),(s=i>0&&o.table.columnManager.getColumnByIndex(i-1))&&o._checkResizability(s)&&(e.stopPropagation(),s.reinitializeWidth(!0)))}),n.appendChild(a),n.appendChild(l)}},ResizeColumns.prototype._checkResizability=function(e){return void 0!==e.definition.resizable?e.definition.resizable:this.table.options.resizableColumns},ResizeColumns.prototype._mouseDown=function(e,t,n){function o(e){t.setWidth(s.startWidth+((void 0===e.screenX?e.touches[0].screenX:e.screenX)-s.startX)),!s.table.browserSlow&&t.modules.resize&&t.modules.resize.variableHeight&&t.checkCellHeights()}function i(e){s.startColumn.modules.edit&&(s.startColumn.modules.edit.blocked=!1),s.table.browserSlow&&t.modules.resize&&t.modules.resize.variableHeight&&t.checkCellHeights(),document.body.removeEventListener("mouseup",i),document.body.removeEventListener("mousemove",o),n.removeEventListener("touchmove",o),n.removeEventListener("touchend",i),s.table.element.classList.remove("tabulator-block-select"),s.table.options.persistence&&s.table.modExists("persistence",!0)&&s.table.modules.persistence.config.columns&&s.table.modules.persistence.save("columns"),s.table.options.columnResized.call(s.table,t.getComponent())}var s=this;s.table.element.classList.add("tabulator-block-select"),e.stopPropagation(),s.startColumn.modules.edit&&(s.startColumn.modules.edit.blocked=!0),s.startX=void 0===e.screenX?e.touches[0].screenX:e.screenX,s.startWidth=t.getWidth(),document.body.addEventListener("mousemove",o),document.body.addEventListener("mouseup",i),n.addEventListener("touchmove",o,{passive:!0}),n.addEventListener("touchend",i)},Tabulator.prototype.registerModule("resizeColumns",ResizeColumns); \ No newline at end of file diff --git a/admin/js/vendors/tabulator/js/modules/resize_rows.js b/admin/js/vendors/tabulator/js/modules/resize_rows.js new file mode 100644 index 0000000..8d39fcd --- /dev/null +++ b/admin/js/vendors/tabulator/js/modules/resize_rows.js @@ -0,0 +1,98 @@ +/* Tabulator v4.7.0 (c) Oliver Folkerd */ + +var ResizeRows = function ResizeRows(table) { + this.table = table; //hold Tabulator object + this.startColumn = false; + this.startY = false; + this.startHeight = false; + this.handle = null; + this.prevHandle = null; +}; + +ResizeRows.prototype.initializeRow = function (row) { + var self = this, + rowEl = row.getElement(); + + var handle = document.createElement('div'); + handle.className = "tabulator-row-resize-handle"; + + var prevHandle = document.createElement('div'); + prevHandle.className = "tabulator-row-resize-handle prev"; + + handle.addEventListener("click", function (e) { + e.stopPropagation(); + }); + + var handleDown = function handleDown(e) { + self.startRow = row; + self._mouseDown(e, row, handle); + }; + + handle.addEventListener("mousedown", handleDown); + handle.addEventListener("touchstart", handleDown, { passive: true }); + + prevHandle.addEventListener("click", function (e) { + e.stopPropagation(); + }); + + var prevHandleDown = function prevHandleDown(e) { + var prevRow = self.table.rowManager.prevDisplayRow(row); + + if (prevRow) { + self.startRow = prevRow; + self._mouseDown(e, prevRow, prevHandle); + } + }; + + prevHandle.addEventListener("mousedown", prevHandleDown); + prevHandle.addEventListener("touchstart", prevHandleDown, { passive: true }); + + rowEl.appendChild(handle); + rowEl.appendChild(prevHandle); +}; + +ResizeRows.prototype._mouseDown = function (e, row, handle) { + var self = this; + + self.table.element.classList.add("tabulator-block-select"); + + function mouseMove(e) { + row.setHeight(self.startHeight + ((typeof e.screenY === "undefined" ? e.touches[0].screenY : e.screenY) - self.startY)); + } + + function mouseUp(e) { + + // //block editor from taking action while resizing is taking place + // if(self.startColumn.modules.edit){ + // self.startColumn.modules.edit.blocked = false; + // } + + document.body.removeEventListener("mouseup", mouseMove); + document.body.removeEventListener("mousemove", mouseMove); + + handle.removeEventListener("touchmove", mouseMove); + handle.removeEventListener("touchend", mouseUp); + + self.table.element.classList.remove("tabulator-block-select"); + + self.table.options.rowResized.call(this.table, row.getComponent()); + } + + e.stopPropagation(); //prevent resize from interfereing with movable columns + + //block editor from taking action while resizing is taking place + // if(self.startColumn.modules.edit){ + // self.startColumn.modules.edit.blocked = true; + // } + + self.startY = typeof e.screenY === "undefined" ? e.touches[0].screenY : e.screenY; + self.startHeight = row.getHeight(); + + document.body.addEventListener("mousemove", mouseMove); + document.body.addEventListener("mouseup", mouseUp); + + handle.addEventListener("touchmove", mouseMove, { passive: true }); + handle.addEventListener("touchend", mouseUp); +}; + +Tabulator.prototype.registerModule("resizeRows", ResizeRows); \ No newline at end of file diff --git a/admin/js/vendors/tabulator/js/modules/resize_rows.min.js b/admin/js/vendors/tabulator/js/modules/resize_rows.min.js new file mode 100644 index 0000000..fb0db00 --- /dev/null +++ b/admin/js/vendors/tabulator/js/modules/resize_rows.min.js @@ -0,0 +1,2 @@ +/* Tabulator v4.7.0 (c) Oliver Folkerd */ +var ResizeRows=function(e){this.table=e,this.startColumn=!1,this.startY=!1,this.startHeight=!1,this.handle=null,this.prevHandle=null};ResizeRows.prototype.initializeRow=function(e){var t=this,o=e.getElement(),s=document.createElement("div");s.className="tabulator-row-resize-handle";var n=document.createElement("div");n.className="tabulator-row-resize-handle prev",s.addEventListener("click",function(e){e.stopPropagation()});var a=function(o){t.startRow=e,t._mouseDown(o,e,s)};s.addEventListener("mousedown",a),s.addEventListener("touchstart",a,{passive:!0}),n.addEventListener("click",function(e){e.stopPropagation()});var r=function(o){var s=t.table.rowManager.prevDisplayRow(e);s&&(t.startRow=s,t._mouseDown(o,s,n))};n.addEventListener("mousedown",r),n.addEventListener("touchstart",r,{passive:!0}),o.appendChild(s),o.appendChild(n)},ResizeRows.prototype._mouseDown=function(e,t,o){function s(e){t.setHeight(a.startHeight+((void 0===e.screenY?e.touches[0].screenY:e.screenY)-a.startY))}function n(e){document.body.removeEventListener("mouseup",s),document.body.removeEventListener("mousemove",s),o.removeEventListener("touchmove",s),o.removeEventListener("touchend",n),a.table.element.classList.remove("tabulator-block-select"),a.table.options.rowResized.call(this.table,t.getComponent())}var a=this;a.table.element.classList.add("tabulator-block-select"),e.stopPropagation(),a.startY=void 0===e.screenY?e.touches[0].screenY:e.screenY,a.startHeight=t.getHeight(),document.body.addEventListener("mousemove",s),document.body.addEventListener("mouseup",n),o.addEventListener("touchmove",s,{passive:!0}),o.addEventListener("touchend",n)},Tabulator.prototype.registerModule("resizeRows",ResizeRows); \ No newline at end of file diff --git a/admin/js/vendors/tabulator/js/modules/resize_table.js b/admin/js/vendors/tabulator/js/modules/resize_table.js new file mode 100644 index 0000000..1286641 --- /dev/null +++ b/admin/js/vendors/tabulator/js/modules/resize_table.js @@ -0,0 +1,107 @@ +/* Tabulator v4.7.0 (c) Oliver Folkerd */ + +var ResizeTable = function ResizeTable(table) { + this.table = table; //hold Tabulator object + this.binding = false; + this.observer = false; + this.containerObserver = false; + + this.tableHeight = 0; + this.tableWidth = 0; + this.containerHeight = 0; + this.containerWidth = 0; + + this.autoResize = false; +}; + +ResizeTable.prototype.initialize = function (row) { + var _this = this; + + var table = this.table, + tableStyle; + + this.tableHeight = table.element.clientHeight; + this.tableWidth = table.element.clientWidth; + + if (table.element.parentNode) { + this.containerHeight = table.element.parentNode.clientHeight; + this.containerWidth = table.element.parentNode.clientWidth; + } + + if (typeof ResizeObserver !== "undefined" && table.rowManager.getRenderMode() === "virtual") { + + this.autoResize = true; + + this.observer = new ResizeObserver(function (entry) { + if (!table.browserMobile || table.browserMobile && !table.modules.edit.currentCell) { + + var nodeHeight = Math.floor(entry[0].contentRect.height); + var nodeWidth = Math.floor(entry[0].contentRect.width); + + if (_this.tableHeight != nodeHeight || _this.tableWidth != nodeWidth) { + _this.tableHeight = nodeHeight; + _this.tableWidth = nodeWidth; + + if (table.element.parentNode) { + _this.containerHeight = table.element.parentNode.clientHeight; + _this.containerWidth = table.element.parentNode.clientWidth; + } + + table.redraw(); + } + } + }); + + this.observer.observe(table.element); + + tableStyle = window.getComputedStyle(table.element); + + if (this.table.element.parentNode && !this.table.rowManager.fixedHeight && (tableStyle.getPropertyValue("max-height") || tableStyle.getPropertyValue("min-height"))) { + + this.containerObserver = new ResizeObserver(function (entry) { + if (!table.browserMobile || table.browserMobile && !table.modules.edit.currentCell) { + + var nodeHeight = Math.floor(entry[0].contentRect.height); + var nodeWidth = Math.floor(entry[0].contentRect.width); + + if (_this.containerHeight != nodeHeight || _this.containerWidth != nodeWidth) { + _this.containerHeight = nodeHeight; + _this.containerWidth = nodeWidth; + _this.tableHeight = table.element.clientHeight; + _this.tableWidth = table.element.clientWidth; + + table.redraw(); + } + + table.redraw(); + } + }); + + this.containerObserver.observe(this.table.element.parentNode); + } + } else { + this.binding = function () { + if (!table.browserMobile || table.browserMobile && !table.modules.edit.currentCell) { + table.redraw(); + } + }; + + window.addEventListener("resize", this.binding); + } +}; + +ResizeTable.prototype.clearBindings = function (row) { + if (this.binding) { + window.removeEventListener("resize", this.binding); + } + + if (this.observer) { + this.observer.unobserve(this.table.element); + } + + if (this.containerObserver) { + this.containerObserver.unobserve(this.table.element.parentNode); + } +}; + +Tabulator.prototype.registerModule("resizeTable", ResizeTable); \ No newline at end of file diff --git a/admin/js/vendors/tabulator/js/modules/resize_table.min.js b/admin/js/vendors/tabulator/js/modules/resize_table.min.js new file mode 100644 index 0000000..e992d75 --- /dev/null +++ b/admin/js/vendors/tabulator/js/modules/resize_table.min.js @@ -0,0 +1,2 @@ +/* Tabulator v4.7.0 (c) Oliver Folkerd */ +var ResizeTable=function(e){this.table=e,this.binding=!1,this.observer=!1,this.containerObserver=!1,this.tableHeight=0,this.tableWidth=0,this.containerHeight=0,this.containerWidth=0,this.autoResize=!1};ResizeTable.prototype.initialize=function(e){var t,i=this,n=this.table;this.tableHeight=n.element.clientHeight,this.tableWidth=n.element.clientWidth,n.element.parentNode&&(this.containerHeight=n.element.parentNode.clientHeight,this.containerWidth=n.element.parentNode.clientWidth),"undefined"!=typeof ResizeObserver&&"virtual"===n.rowManager.getRenderMode()?(this.autoResize=!0,this.observer=new ResizeObserver(function(e){if(!n.browserMobile||n.browserMobile&&!n.modules.edit.currentCell){var t=Math.floor(e[0].contentRect.height),r=Math.floor(e[0].contentRect.width);i.tableHeight==t&&i.tableWidth==r||(i.tableHeight=t,i.tableWidth=r,n.element.parentNode&&(i.containerHeight=n.element.parentNode.clientHeight,i.containerWidth=n.element.parentNode.clientWidth),n.redraw())}}),this.observer.observe(n.element),t=window.getComputedStyle(n.element),this.table.element.parentNode&&!this.table.rowManager.fixedHeight&&(t.getPropertyValue("max-height")||t.getPropertyValue("min-height"))&&(this.containerObserver=new ResizeObserver(function(e){if(!n.browserMobile||n.browserMobile&&!n.modules.edit.currentCell){var t=Math.floor(e[0].contentRect.height),r=Math.floor(e[0].contentRect.width);i.containerHeight==t&&i.containerWidth==r||(i.containerHeight=t,i.containerWidth=r,i.tableHeight=n.element.clientHeight,i.tableWidth=n.element.clientWidth,n.redraw()),n.redraw()}}),this.containerObserver.observe(this.table.element.parentNode))):(this.binding=function(){(!n.browserMobile||n.browserMobile&&!n.modules.edit.currentCell)&&n.redraw()},window.addEventListener("resize",this.binding))},ResizeTable.prototype.clearBindings=function(e){this.binding&&window.removeEventListener("resize",this.binding),this.observer&&this.observer.unobserve(this.table.element),this.containerObserver&&this.containerObserver.unobserve(this.table.element.parentNode)},Tabulator.prototype.registerModule("resizeTable",ResizeTable); \ No newline at end of file diff --git a/admin/js/vendors/tabulator/js/modules/responsive_layout.js b/admin/js/vendors/tabulator/js/modules/responsive_layout.js new file mode 100644 index 0000000..329f2a6 --- /dev/null +++ b/admin/js/vendors/tabulator/js/modules/responsive_layout.js @@ -0,0 +1,301 @@ +/* Tabulator v4.7.0 (c) Oliver Folkerd */ + +var ResponsiveLayout = function ResponsiveLayout(table) { + this.table = table; //hold Tabulator object + this.columns = []; + this.hiddenColumns = []; + this.mode = ""; + this.index = 0; + this.collapseFormatter = []; + this.collapseStartOpen = true; + this.collapseHandleColumn = false; +}; + +//generate resposive columns list +ResponsiveLayout.prototype.initialize = function () { + var self = this, + columns = []; + + this.mode = this.table.options.responsiveLayout; + this.collapseFormatter = this.table.options.responsiveLayoutCollapseFormatter || this.formatCollapsedData; + this.collapseStartOpen = this.table.options.responsiveLayoutCollapseStartOpen; + this.hiddenColumns = []; + + //detemine level of responsivity for each column + this.table.columnManager.columnsByIndex.forEach(function (column, i) { + if (column.modules.responsive) { + if (column.modules.responsive.order && column.modules.responsive.visible) { + column.modules.responsive.index = i; + columns.push(column); + + if (!column.visible && self.mode === "collapse") { + self.hiddenColumns.push(column); + } + } + } + }); + + //sort list by responsivity + columns = columns.reverse(); + columns = columns.sort(function (a, b) { + var diff = b.modules.responsive.order - a.modules.responsive.order; + return diff || b.modules.responsive.index - a.modules.responsive.index; + }); + + this.columns = columns; + + if (this.mode === "collapse") { + this.generateCollapsedContent(); + } + + //assign collapse column + for (var _iterator = this.table.columnManager.columnsByIndex, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) { + var _ref; + + if (_isArray) { + if (_i >= _iterator.length) break; + _ref = _iterator[_i++]; + } else { + _i = _iterator.next(); + if (_i.done) break; + _ref = _i.value; + } + + var col = _ref; + + if (col.definition.formatter == "responsiveCollapse") { + this.collapseHandleColumn = col; + break; + } + } + + if (this.collapseHandleColumn) { + if (this.hiddenColumns.length) { + this.collapseHandleColumn.show(); + } else { + this.collapseHandleColumn.hide(); + } + } +}; + +//define layout information +ResponsiveLayout.prototype.initializeColumn = function (column) { + var def = column.getDefinition(); + + column.modules.responsive = { order: typeof def.responsive === "undefined" ? 1 : def.responsive, visible: def.visible === false ? false : true }; +}; + +ResponsiveLayout.prototype.initializeRow = function (row) { + var el; + + if (row.type !== "calc") { + el = document.createElement("div"); + el.classList.add("tabulator-responsive-collapse"); + + row.modules.responsiveLayout = { + element: el, + open: this.collapseStartOpen + }; + + if (!this.collapseStartOpen) { + el.style.display = 'none'; + } + } +}; + +ResponsiveLayout.prototype.layoutRow = function (row) { + var rowEl = row.getElement(); + + if (row.modules.responsiveLayout) { + rowEl.appendChild(row.modules.responsiveLayout.element); + this.generateCollapsedRowContent(row); + } +}; + +//update column visibility +ResponsiveLayout.prototype.updateColumnVisibility = function (column, visible) { + var index; + if (column.modules.responsive) { + column.modules.responsive.visible = visible; + this.initialize(); + } +}; + +ResponsiveLayout.prototype.hideColumn = function (column) { + var colCount = this.hiddenColumns.length; + + column.hide(false, true); + + if (this.mode === "collapse") { + this.hiddenColumns.unshift(column); + this.generateCollapsedContent(); + + if (this.collapseHandleColumn && !colCount) { + this.collapseHandleColumn.show(); + } + } +}; + +ResponsiveLayout.prototype.showColumn = function (column) { + var index; + + column.show(false, true); + //set column width to prevent calculation loops on uninitialized columns + column.setWidth(column.getWidth()); + + if (this.mode === "collapse") { + index = this.hiddenColumns.indexOf(column); + + if (index > -1) { + this.hiddenColumns.splice(index, 1); + } + + this.generateCollapsedContent(); + + if (this.collapseHandleColumn && !this.hiddenColumns.length) { + this.collapseHandleColumn.hide(); + } + } +}; + +//redraw columns to fit space +ResponsiveLayout.prototype.update = function () { + var self = this, + working = true; + + while (working) { + + var width = self.table.modules.layout.getMode() == "fitColumns" ? self.table.columnManager.getFlexBaseWidth() : self.table.columnManager.getWidth(); + + var diff = (self.table.options.headerVisible ? self.table.columnManager.element.clientWidth : self.table.element.clientWidth) - width; + + if (diff < 0) { + //table is too wide + var column = self.columns[self.index]; + + if (column) { + self.hideColumn(column); + self.index++; + } else { + working = false; + } + } else { + + //table has spare space + var _column = self.columns[self.index - 1]; + + if (_column) { + if (diff > 0) { + if (diff >= _column.getWidth()) { + self.showColumn(_column); + self.index--; + } else { + working = false; + } + } else { + working = false; + } + } else { + working = false; + } + } + + if (!self.table.rowManager.activeRowsCount) { + self.table.rowManager.renderEmptyScroll(); + } + } +}; + +ResponsiveLayout.prototype.generateCollapsedContent = function () { + var self = this, + rows = this.table.rowManager.getDisplayRows(); + + rows.forEach(function (row) { + self.generateCollapsedRowContent(row); + }); +}; + +ResponsiveLayout.prototype.generateCollapsedRowContent = function (row) { + var el, contents; + + if (row.modules.responsiveLayout) { + el = row.modules.responsiveLayout.element; + + while (el.firstChild) { + el.removeChild(el.firstChild); + }contents = this.collapseFormatter(this.generateCollapsedRowData(row)); + if (contents) { + el.appendChild(contents); + } + } +}; + +ResponsiveLayout.prototype.generateCollapsedRowData = function (row) { + var self = this, + data = row.getData(), + output = [], + mockCellComponent; + + this.hiddenColumns.forEach(function (column) { + var value = column.getFieldValue(data); + + if (column.definition.title && column.field) { + if (column.modules.format && self.table.options.responsiveLayoutCollapseUseFormatters) { + + mockCellComponent = { + value: false, + data: {}, + getValue: function getValue() { + return value; + }, + getData: function getData() { + return data; + }, + getElement: function getElement() { + return document.createElement("div"); + }, + getRow: function getRow() { + return row.getComponent(); + }, + getColumn: function getColumn() { + return column.getComponent(); + } + }; + + output.push({ + title: column.definition.title, + value: column.modules.format.formatter.call(self.table.modules.format, mockCellComponent, column.modules.format.params) + }); + } else { + output.push({ + title: column.definition.title, + value: value + }); + } + } + }); + + return output; +}; + +ResponsiveLayout.prototype.formatCollapsedData = function (data) { + var list = document.createElement("table"), + listContents = ""; + + data.forEach(function (item) { + var div = document.createElement("div"); + + if (item.value instanceof Node) { + div.appendChild(item.value); + item.value = div.innerHTML; + } + + listContents += "" + item.title + "" + item.value + ""; + }); + + list.innerHTML = listContents; + + return Object.keys(data).length ? list : ""; +}; + +Tabulator.prototype.registerModule("responsiveLayout", ResponsiveLayout); \ No newline at end of file diff --git a/admin/js/vendors/tabulator/js/modules/responsive_layout.min.js b/admin/js/vendors/tabulator/js/modules/responsive_layout.min.js new file mode 100644 index 0000000..4ef6538 --- /dev/null +++ b/admin/js/vendors/tabulator/js/modules/responsive_layout.min.js @@ -0,0 +1,2 @@ +/* Tabulator v4.7.0 (c) Oliver Folkerd */ +var ResponsiveLayout=function(e){this.table=e,this.columns=[],this.hiddenColumns=[],this.mode="",this.index=0,this.collapseFormatter=[],this.collapseStartOpen=!0,this.collapseHandleColumn=!1};ResponsiveLayout.prototype.initialize=function(){var e=this,t=[];this.mode=this.table.options.responsiveLayout,this.collapseFormatter=this.table.options.responsiveLayoutCollapseFormatter||this.formatCollapsedData,this.collapseStartOpen=this.table.options.responsiveLayoutCollapseStartOpen,this.hiddenColumns=[],this.table.columnManager.columnsByIndex.forEach(function(o,n){o.modules.responsive&&o.modules.responsive.order&&o.modules.responsive.visible&&(o.modules.responsive.index=n,t.push(o),o.visible||"collapse"!==e.mode||e.hiddenColumns.push(o))}),t=t.reverse(),t=t.sort(function(e,t){return t.modules.responsive.order-e.modules.responsive.order||t.modules.responsive.index-e.modules.responsive.index}),this.columns=t,"collapse"===this.mode&&this.generateCollapsedContent();for(var o=this.table.columnManager.columnsByIndex,n=Array.isArray(o),s=0,o=n?o:o[Symbol.iterator]();;){var i;if(n){if(s>=o.length)break;i=o[s++]}else{if(s=o.next(),s.done)break;i=s.value}var l=i;if("responsiveCollapse"==l.definition.formatter){this.collapseHandleColumn=l;break}}this.collapseHandleColumn&&(this.hiddenColumns.length?this.collapseHandleColumn.show():this.collapseHandleColumn.hide())},ResponsiveLayout.prototype.initializeColumn=function(e){var t=e.getDefinition();e.modules.responsive={order:void 0===t.responsive?1:t.responsive,visible:!1!==t.visible}},ResponsiveLayout.prototype.initializeRow=function(e){var t;"calc"!==e.type&&(t=document.createElement("div"),t.classList.add("tabulator-responsive-collapse"),e.modules.responsiveLayout={element:t,open:this.collapseStartOpen},this.collapseStartOpen||(t.style.display="none"))},ResponsiveLayout.prototype.layoutRow=function(e){var t=e.getElement();e.modules.responsiveLayout&&(t.appendChild(e.modules.responsiveLayout.element),this.generateCollapsedRowContent(e))},ResponsiveLayout.prototype.updateColumnVisibility=function(e,t){e.modules.responsive&&(e.modules.responsive.visible=t,this.initialize())},ResponsiveLayout.prototype.hideColumn=function(e){var t=this.hiddenColumns.length;e.hide(!1,!0),"collapse"===this.mode&&(this.hiddenColumns.unshift(e),this.generateCollapsedContent(),this.collapseHandleColumn&&!t&&this.collapseHandleColumn.show())},ResponsiveLayout.prototype.showColumn=function(e){var t;e.show(!1,!0),e.setWidth(e.getWidth()),"collapse"===this.mode&&(t=this.hiddenColumns.indexOf(e),t>-1&&this.hiddenColumns.splice(t,1),this.generateCollapsedContent(),this.collapseHandleColumn&&!this.hiddenColumns.length&&this.collapseHandleColumn.hide())},ResponsiveLayout.prototype.update=function(){for(var e=this,t=!0;t;){var o="fitColumns"==e.table.modules.layout.getMode()?e.table.columnManager.getFlexBaseWidth():e.table.columnManager.getWidth(),n=(e.table.options.headerVisible?e.table.columnManager.element.clientWidth:e.table.element.clientWidth)-o;if(n<0){var s=e.columns[e.index];s?(e.hideColumn(s),e.index++):t=!1}else{var i=e.columns[e.index-1];i&&n>0&&n>=i.getWidth()?(e.showColumn(i),e.index--):t=!1}e.table.rowManager.activeRowsCount||e.table.rowManager.renderEmptyScroll()}},ResponsiveLayout.prototype.generateCollapsedContent=function(){var e=this;this.table.rowManager.getDisplayRows().forEach(function(t){e.generateCollapsedRowContent(t)})},ResponsiveLayout.prototype.generateCollapsedRowContent=function(e){var t,o;if(e.modules.responsiveLayout){for(t=e.modules.responsiveLayout.element;t.firstChild;)t.removeChild(t.firstChild);o=this.collapseFormatter(this.generateCollapsedRowData(e)),o&&t.appendChild(o)}},ResponsiveLayout.prototype.generateCollapsedRowData=function(e){var t,o=this,n=e.getData(),s=[];return this.hiddenColumns.forEach(function(i){var l=i.getFieldValue(n);i.definition.title&&i.field&&(i.modules.format&&o.table.options.responsiveLayoutCollapseUseFormatters?(t={value:!1,data:{},getValue:function(){return l},getData:function(){return n},getElement:function(){return document.createElement("div")},getRow:function(){return e.getComponent()},getColumn:function(){return i.getComponent()}},s.push({title:i.definition.title,value:i.modules.format.formatter.call(o.table.modules.format,t,i.modules.format.params)})):s.push({title:i.definition.title,value:l}))}),s},ResponsiveLayout.prototype.formatCollapsedData=function(e){var t=document.createElement("table"),o="";return e.forEach(function(e){var t=document.createElement("div");e.value instanceof Node&&(t.appendChild(e.value),e.value=t.innerHTML),o+=""+e.title+""+e.value+""}),t.innerHTML=o,Object.keys(e).length?t:""},Tabulator.prototype.registerModule("responsiveLayout",ResponsiveLayout); \ No newline at end of file diff --git a/admin/js/vendors/tabulator/js/modules/select_row.js b/admin/js/vendors/tabulator/js/modules/select_row.js new file mode 100644 index 0000000..2869429 --- /dev/null +++ b/admin/js/vendors/tabulator/js/modules/select_row.js @@ -0,0 +1,417 @@ +var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; + +/* Tabulator v4.7.0 (c) Oliver Folkerd */ + +var SelectRow = function SelectRow(table) { + this.table = table; //hold Tabulator object + this.selecting = false; //flag selecting in progress + this.lastClickedRow = false; //last clicked row + this.selectPrev = []; //hold previously selected element for drag drop selection + this.selectedRows = []; //hold selected rows + this.headerCheckboxElement = null; // hold header select element +}; + +SelectRow.prototype.clearSelectionData = function (silent) { + this.selecting = false; + this.lastClickedRow = false; + this.selectPrev = []; + this.selectedRows = []; + + if (!silent) { + this._rowSelectionChanged(); + } +}; + +SelectRow.prototype.initializeRow = function (row) { + var self = this, + element = row.getElement(); + + // trigger end of row selection + var endSelect = function endSelect() { + + setTimeout(function () { + self.selecting = false; + }, 50); + + document.body.removeEventListener("mouseup", endSelect); + }; + + row.modules.select = { selected: false }; + + //set row selection class + if (self.table.options.selectableCheck.call(this.table, row.getComponent())) { + element.classList.add("tabulator-selectable"); + element.classList.remove("tabulator-unselectable"); + + if (self.table.options.selectable && self.table.options.selectable != "highlight") { + if (self.table.options.selectableRangeMode === "click") { + element.addEventListener("click", function (e) { + if (e.shiftKey) { + self.table._clearSelection(); + self.lastClickedRow = self.lastClickedRow || row; + + var lastClickedRowIdx = self.table.rowManager.getDisplayRowIndex(self.lastClickedRow); + var rowIdx = self.table.rowManager.getDisplayRowIndex(row); + + var fromRowIdx = lastClickedRowIdx <= rowIdx ? lastClickedRowIdx : rowIdx; + var toRowIdx = lastClickedRowIdx >= rowIdx ? lastClickedRowIdx : rowIdx; + + var rows = self.table.rowManager.getDisplayRows().slice(0); + var toggledRows = rows.splice(fromRowIdx, toRowIdx - fromRowIdx + 1); + + if (e.ctrlKey || e.metaKey) { + toggledRows.forEach(function (toggledRow) { + if (toggledRow !== self.lastClickedRow) { + + if (self.table.options.selectable !== true && !self.isRowSelected(row)) { + if (self.selectedRows.length < self.table.options.selectable) { + self.toggleRow(toggledRow); + } + } else { + self.toggleRow(toggledRow); + } + } + }); + self.lastClickedRow = row; + } else { + self.deselectRows(undefined, true); + + if (self.table.options.selectable !== true) { + if (toggledRows.length > self.table.options.selectable) { + toggledRows = toggledRows.slice(0, self.table.options.selectable); + } + } + + self.selectRows(toggledRows); + } + self.table._clearSelection(); + } else if (e.ctrlKey || e.metaKey) { + self.toggleRow(row); + self.lastClickedRow = row; + } else { + self.deselectRows(undefined, true); + self.selectRows(row); + self.lastClickedRow = row; + } + }); + } else { + element.addEventListener("click", function (e) { + if (!self.table.modExists("edit") || !self.table.modules.edit.getCurrentCell()) { + self.table._clearSelection(); + } + + if (!self.selecting) { + self.toggleRow(row); + } + }); + + element.addEventListener("mousedown", function (e) { + if (e.shiftKey) { + self.table._clearSelection(); + + self.selecting = true; + + self.selectPrev = []; + + document.body.addEventListener("mouseup", endSelect); + document.body.addEventListener("keyup", endSelect); + + self.toggleRow(row); + + return false; + } + }); + + element.addEventListener("mouseenter", function (e) { + if (self.selecting) { + self.table._clearSelection(); + self.toggleRow(row); + + if (self.selectPrev[1] == row) { + self.toggleRow(self.selectPrev[0]); + } + } + }); + + element.addEventListener("mouseout", function (e) { + if (self.selecting) { + self.table._clearSelection(); + self.selectPrev.unshift(row); + } + }); + } + } + } else { + element.classList.add("tabulator-unselectable"); + element.classList.remove("tabulator-selectable"); + } +}; + +//toggle row selection +SelectRow.prototype.toggleRow = function (row) { + if (this.table.options.selectableCheck.call(this.table, row.getComponent())) { + if (row.modules.select && row.modules.select.selected) { + this._deselectRow(row); + } else { + this._selectRow(row); + } + } +}; + +//select a number of rows +SelectRow.prototype.selectRows = function (rows) { + var _this = this; + + var rowMatch; + + switch (typeof rows === "undefined" ? "undefined" : _typeof(rows)) { + case "undefined": + this.table.rowManager.rows.forEach(function (row) { + _this._selectRow(row, true, true); + }); + + this._rowSelectionChanged(); + break; + + case "string": + + rowMatch = this.table.rowManager.findRow(rows); + + if (rowMatch) { + this._selectRow(rowMatch, true, true); + } else { + this.table.rowManager.getRows(rows).forEach(function (row) { + _this._selectRow(row, true, true); + }); + } + + this._rowSelectionChanged(); + break; + + default: + if (Array.isArray(rows)) { + rows.forEach(function (row) { + _this._selectRow(row, true, true); + }); + + this._rowSelectionChanged(); + } else { + this._selectRow(rows, false, true); + } + break; + } +}; + +//select an individual row +SelectRow.prototype._selectRow = function (rowInfo, silent, force) { + var index; + + //handle max row count + if (!isNaN(this.table.options.selectable) && this.table.options.selectable !== true && !force) { + if (this.selectedRows.length >= this.table.options.selectable) { + if (this.table.options.selectableRollingSelection) { + this._deselectRow(this.selectedRows[0]); + } else { + return false; + } + } + } + + var row = this.table.rowManager.findRow(rowInfo); + + if (row) { + if (this.selectedRows.indexOf(row) == -1) { + if (!row.modules.select) { + row.modules.select = {}; + } + + row.modules.select.selected = true; + if (row.modules.select.checkboxEl) { + row.modules.select.checkboxEl.checked = true; + } + row.getElement().classList.add("tabulator-selected"); + + this.selectedRows.push(row); + + if (this.table.options.dataTreeSelectPropagate) { + this.childRowSelection(row, true); + } + + if (!silent) { + this.table.options.rowSelected.call(this.table, row.getComponent()); + } + + this._rowSelectionChanged(silent); + } + } else { + if (!silent) { + console.warn("Selection Error - No such row found, ignoring selection:" + rowInfo); + } + } +}; + +SelectRow.prototype.isRowSelected = function (row) { + return this.selectedRows.indexOf(row) !== -1; +}; + +//deselect a number of rows +SelectRow.prototype.deselectRows = function (rows, silent) { + var self = this, + rowCount; + + if (typeof rows == "undefined") { + + rowCount = self.selectedRows.length; + + for (var i = 0; i < rowCount; i++) { + self._deselectRow(self.selectedRows[0], true); + } + + self._rowSelectionChanged(silent); + } else { + if (Array.isArray(rows)) { + rows.forEach(function (row) { + self._deselectRow(row, true); + }); + + self._rowSelectionChanged(silent); + } else { + self._deselectRow(rows, silent); + } + } +}; + +//deselect an individual row +SelectRow.prototype._deselectRow = function (rowInfo, silent) { + var self = this, + row = self.table.rowManager.findRow(rowInfo), + index; + + if (row) { + index = self.selectedRows.findIndex(function (selectedRow) { + return selectedRow == row; + }); + + if (index > -1) { + + if (!row.modules.select) { + row.modules.select = {}; + } + + row.modules.select.selected = false; + if (row.modules.select.checkboxEl) { + row.modules.select.checkboxEl.checked = false; + } + row.getElement().classList.remove("tabulator-selected"); + self.selectedRows.splice(index, 1); + + if (this.table.options.dataTreeSelectPropagate) { + this.childRowSelection(row, false); + } + + if (!silent) { + self.table.options.rowDeselected.call(this.table, row.getComponent()); + } + + self._rowSelectionChanged(silent); + } + } else { + if (!silent) { + console.warn("Deselection Error - No such row found, ignoring selection:" + rowInfo); + } + } +}; + +SelectRow.prototype.getSelectedData = function () { + var data = []; + + this.selectedRows.forEach(function (row) { + data.push(row.getData()); + }); + + return data; +}; + +SelectRow.prototype.getSelectedRows = function () { + + var rows = []; + + this.selectedRows.forEach(function (row) { + rows.push(row.getComponent()); + }); + + return rows; +}; + +SelectRow.prototype._rowSelectionChanged = function (silent) { + if (this.headerCheckboxElement) { + if (this.selectedRows.length === 0) { + this.headerCheckboxElement.checked = false; + this.headerCheckboxElement.indeterminate = false; + } else if (this.table.rowManager.rows.length === this.selectedRows.length) { + this.headerCheckboxElement.checked = true; + this.headerCheckboxElement.indeterminate = false; + } else { + this.headerCheckboxElement.indeterminate = true; + this.headerCheckboxElement.checked = false; + } + } + + if (!silent) { + this.table.options.rowSelectionChanged.call(this.table, this.getSelectedData(), this.getSelectedRows()); + } +}; + +SelectRow.prototype.registerRowSelectCheckbox = function (row, element) { + if (!row._row.modules.select) { + row._row.modules.select = {}; + } + + row._row.modules.select.checkboxEl = element; +}; + +SelectRow.prototype.registerHeaderSelectCheckbox = function (element) { + this.headerCheckboxElement = element; +}; + +SelectRow.prototype.childRowSelection = function (row, select) { + var children = this.table.modules.dataTree.getChildren(row); + + if (select) { + for (var _iterator = children, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) { + var _ref; + + if (_isArray) { + if (_i >= _iterator.length) break; + _ref = _iterator[_i++]; + } else { + _i = _iterator.next(); + if (_i.done) break; + _ref = _i.value; + } + + var child = _ref; + + this._selectRow(child, true); + } + } else { + for (var _iterator2 = children, _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : _iterator2[Symbol.iterator]();;) { + var _ref2; + + if (_isArray2) { + if (_i2 >= _iterator2.length) break; + _ref2 = _iterator2[_i2++]; + } else { + _i2 = _iterator2.next(); + if (_i2.done) break; + _ref2 = _i2.value; + } + + var _child = _ref2; + + this._deselectRow(_child, true); + } + } +}; + +Tabulator.prototype.registerModule("selectRow", SelectRow); \ No newline at end of file diff --git a/admin/js/vendors/tabulator/js/modules/select_row.min.js b/admin/js/vendors/tabulator/js/modules/select_row.min.js new file mode 100644 index 0000000..488d7e6 --- /dev/null +++ b/admin/js/vendors/tabulator/js/modules/select_row.min.js @@ -0,0 +1,2 @@ +/* Tabulator v4.7.0 (c) Oliver Folkerd */ +var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},SelectRow=function(e){this.table=e,this.selecting=!1,this.lastClickedRow=!1,this.selectPrev=[],this.selectedRows=[],this.headerCheckboxElement=null};SelectRow.prototype.clearSelectionData=function(e){this.selecting=!1,this.lastClickedRow=!1,this.selectPrev=[],this.selectedRows=[],e||this._rowSelectionChanged()},SelectRow.prototype.initializeRow=function(e){var t=this,o=e.getElement(),l=function e(){setTimeout(function(){t.selecting=!1},50),document.body.removeEventListener("mouseup",e)};e.modules.select={selected:!1},t.table.options.selectableCheck.call(this.table,e.getComponent())?(o.classList.add("tabulator-selectable"),o.classList.remove("tabulator-unselectable"),t.table.options.selectable&&"highlight"!=t.table.options.selectable&&("click"===t.table.options.selectableRangeMode?o.addEventListener("click",function(o){if(o.shiftKey){t.table._clearSelection(),t.lastClickedRow=t.lastClickedRow||e;var l=t.table.rowManager.getDisplayRowIndex(t.lastClickedRow),s=t.table.rowManager.getDisplayRowIndex(e),c=l<=s?l:s,i=l>=s?l:s,n=t.table.rowManager.getDisplayRows().slice(0),a=n.splice(c,i-c+1);o.ctrlKey||o.metaKey?(a.forEach(function(o){o!==t.lastClickedRow&&(!0===t.table.options.selectable||t.isRowSelected(e)?t.toggleRow(o):t.selectedRows.lengtht.table.options.selectable&&(a=a.slice(0,t.table.options.selectable)),t.selectRows(a)),t.table._clearSelection()}else o.ctrlKey||o.metaKey?(t.toggleRow(e),t.lastClickedRow=e):(t.deselectRows(void 0,!0),t.selectRows(e),t.lastClickedRow=e)}):(o.addEventListener("click",function(o){t.table.modExists("edit")&&t.table.modules.edit.getCurrentCell()||t.table._clearSelection(),t.selecting||t.toggleRow(e)}),o.addEventListener("mousedown",function(o){if(o.shiftKey)return t.table._clearSelection(),t.selecting=!0,t.selectPrev=[],document.body.addEventListener("mouseup",l),document.body.addEventListener("keyup",l),t.toggleRow(e),!1}),o.addEventListener("mouseenter",function(o){t.selecting&&(t.table._clearSelection(),t.toggleRow(e),t.selectPrev[1]==e&&t.toggleRow(t.selectPrev[0]))}),o.addEventListener("mouseout",function(o){t.selecting&&(t.table._clearSelection(),t.selectPrev.unshift(e))})))):(o.classList.add("tabulator-unselectable"),o.classList.remove("tabulator-selectable"))},SelectRow.prototype.toggleRow=function(e){this.table.options.selectableCheck.call(this.table,e.getComponent())&&(e.modules.select&&e.modules.select.selected?this._deselectRow(e):this._selectRow(e))},SelectRow.prototype.selectRows=function(e){var t,o=this;switch(void 0===e?"undefined":_typeof(e)){case"undefined":this.table.rowManager.rows.forEach(function(e){o._selectRow(e,!0,!0)}),this._rowSelectionChanged();break;case"string":t=this.table.rowManager.findRow(e),t?this._selectRow(t,!0,!0):this.table.rowManager.getRows(e).forEach(function(e){o._selectRow(e,!0,!0)}),this._rowSelectionChanged();break;default:Array.isArray(e)?(e.forEach(function(e){o._selectRow(e,!0,!0)}),this._rowSelectionChanged()):this._selectRow(e,!1,!0)}},SelectRow.prototype._selectRow=function(e,t,o){if(!isNaN(this.table.options.selectable)&&!0!==this.table.options.selectable&&!o&&this.selectedRows.length>=this.table.options.selectable){if(!this.table.options.selectableRollingSelection)return!1;this._deselectRow(this.selectedRows[0])}var l=this.table.rowManager.findRow(e);l?-1==this.selectedRows.indexOf(l)&&(l.modules.select||(l.modules.select={}),l.modules.select.selected=!0,l.modules.select.checkboxEl&&(l.modules.select.checkboxEl.checked=!0),l.getElement().classList.add("tabulator-selected"),this.selectedRows.push(l),this.table.options.dataTreeSelectPropagate&&this.childRowSelection(l,!0),t||this.table.options.rowSelected.call(this.table,l.getComponent()),this._rowSelectionChanged(t)):t||console.warn("Selection Error - No such row found, ignoring selection:"+e)},SelectRow.prototype.isRowSelected=function(e){return-1!==this.selectedRows.indexOf(e)},SelectRow.prototype.deselectRows=function(e,t){var o,l=this;if(void 0===e){o=l.selectedRows.length;for(var s=0;s-1&&(s.modules.select||(s.modules.select={}),s.modules.select.selected=!1,s.modules.select.checkboxEl&&(s.modules.select.checkboxEl.checked=!1),s.getElement().classList.remove("tabulator-selected"),l.selectedRows.splice(o,1),this.table.options.dataTreeSelectPropagate&&this.childRowSelection(s,!1),t||l.table.options.rowDeselected.call(this.table,s.getComponent()),l._rowSelectionChanged(t)):t||console.warn("Deselection Error - No such row found, ignoring selection:"+e)},SelectRow.prototype.getSelectedData=function(){var e=[];return this.selectedRows.forEach(function(t){e.push(t.getData())}),e},SelectRow.prototype.getSelectedRows=function(){var e=[];return this.selectedRows.forEach(function(t){e.push(t.getComponent())}),e},SelectRow.prototype._rowSelectionChanged=function(e){this.headerCheckboxElement&&(0===this.selectedRows.length?(this.headerCheckboxElement.checked=!1,this.headerCheckboxElement.indeterminate=!1):this.table.rowManager.rows.length===this.selectedRows.length?(this.headerCheckboxElement.checked=!0,this.headerCheckboxElement.indeterminate=!1):(this.headerCheckboxElement.indeterminate=!0,this.headerCheckboxElement.checked=!1)),e||this.table.options.rowSelectionChanged.call(this.table,this.getSelectedData(),this.getSelectedRows())},SelectRow.prototype.registerRowSelectCheckbox=function(e,t){e._row.modules.select||(e._row.modules.select={}),e._row.modules.select.checkboxEl=t},SelectRow.prototype.registerHeaderSelectCheckbox=function(e){this.headerCheckboxElement=e},SelectRow.prototype.childRowSelection=function(e,t){var o=this.table.modules.dataTree.getChildren(e);if(t)for(var l=o,s=Array.isArray(l),c=0,l=s?l:l[Symbol.iterator]();;){var i;if(s){if(c>=l.length)break;i=l[c++]}else{if(c=l.next(),c.done)break;i=c.value}var n=i;this._selectRow(n,!0)}else for(var a=o,r=Array.isArray(a),d=0,a=r?a:a[Symbol.iterator]();;){var h;if(r){if(d>=a.length)break;h=a[d++]}else{if(d=a.next(),d.done)break;h=d.value}var w=h;this._deselectRow(w,!0)}},Tabulator.prototype.registerModule("selectRow",SelectRow); \ No newline at end of file diff --git a/admin/js/vendors/tabulator/js/modules/sort.js b/admin/js/vendors/tabulator/js/modules/sort.js new file mode 100644 index 0000000..2422968 --- /dev/null +++ b/admin/js/vendors/tabulator/js/modules/sort.js @@ -0,0 +1,571 @@ +var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; + +/* Tabulator v4.7.0 (c) Oliver Folkerd */ + +var Sort = function Sort(table) { + this.table = table; //hold Tabulator object + this.sortList = []; //holder current sort + this.changed = false; //has the sort changed since last render +}; + +//initialize column header for sorting +Sort.prototype.initializeColumn = function (column, content) { + var self = this, + sorter = false, + colEl, + arrowEl; + + switch (_typeof(column.definition.sorter)) { + case "string": + if (self.sorters[column.definition.sorter]) { + sorter = self.sorters[column.definition.sorter]; + } else { + console.warn("Sort Error - No such sorter found: ", column.definition.sorter); + } + break; + + case "function": + sorter = column.definition.sorter; + break; + } + + column.modules.sort = { + sorter: sorter, dir: "none", + params: column.definition.sorterParams || {}, + startingDir: column.definition.headerSortStartingDir || "asc", + tristate: typeof column.definition.headerSortTristate !== "undefined" ? column.definition.headerSortTristate : this.table.options.headerSortTristate + }; + + if (typeof column.definition.headerSort === "undefined" ? this.table.options.headerSort !== false : column.definition.headerSort !== false) { + + colEl = column.getElement(); + + colEl.classList.add("tabulator-sortable"); + + arrowEl = document.createElement("div"); + arrowEl.classList.add("tabulator-arrow"); + //create sorter arrow + content.appendChild(arrowEl); + + //sort on click + colEl.addEventListener("click", function (e) { + var dir = "", + sorters = [], + match = false; + + if (column.modules.sort) { + if (column.modules.sort.tristate) { + if (column.modules.sort.dir == "none") { + dir = column.modules.sort.startingDir; + } else { + if (column.modules.sort.dir == column.modules.sort.startingDir) { + dir = column.modules.sort.dir == "asc" ? "desc" : "asc"; + } else { + dir = "none"; + } + } + } else { + switch (column.modules.sort.dir) { + case "asc": + dir = "desc"; + break; + + case "desc": + dir = "asc"; + break; + + default: + dir = column.modules.sort.startingDir; + } + } + + if (self.table.options.columnHeaderSortMulti && (e.shiftKey || e.ctrlKey)) { + sorters = self.getSort(); + + match = sorters.findIndex(function (sorter) { + return sorter.field === column.getField(); + }); + + if (match > -1) { + sorters[match].dir = dir; + + if (match != sorters.length - 1) { + match = sorters.splice(match, 1)[0]; + if (dir != "none") { + sorters.push(match); + } + } + } else { + if (dir != "none") { + sorters.push({ column: column, dir: dir }); + } + } + + //add to existing sort + self.setSort(sorters); + } else { + if (dir == "none") { + self.clear(); + } else { + //sort by column only + self.setSort(column, dir); + } + } + + self.table.rowManager.sorterRefresh(!self.sortList.length); + } + }); + } +}; + +//check if the sorters have changed since last use +Sort.prototype.hasChanged = function () { + var changed = this.changed; + this.changed = false; + return changed; +}; + +//return current sorters +Sort.prototype.getSort = function () { + var self = this, + sorters = []; + + self.sortList.forEach(function (item) { + if (item.column) { + sorters.push({ column: item.column.getComponent(), field: item.column.getField(), dir: item.dir }); + } + }); + + return sorters; +}; + +//change sort list and trigger sort +Sort.prototype.setSort = function (sortList, dir) { + var self = this, + newSortList = []; + + if (!Array.isArray(sortList)) { + sortList = [{ column: sortList, dir: dir }]; + } + + sortList.forEach(function (item) { + var column; + + column = self.table.columnManager.findColumn(item.column); + + if (column) { + item.column = column; + newSortList.push(item); + self.changed = true; + } else { + console.warn("Sort Warning - Sort field does not exist and is being ignored: ", item.column); + } + }); + + self.sortList = newSortList; + + if (this.table.options.persistence && this.table.modExists("persistence", true) && this.table.modules.persistence.config.sort) { + this.table.modules.persistence.save("sort"); + } +}; + +//clear sorters +Sort.prototype.clear = function () { + this.setSort([]); +}; + +//find appropriate sorter for column +Sort.prototype.findSorter = function (column) { + var row = this.table.rowManager.activeRows[0], + sorter = "string", + field, + value; + + if (row) { + row = row.getData(); + field = column.getField(); + + if (field) { + + value = column.getFieldValue(row); + + switch (typeof value === "undefined" ? "undefined" : _typeof(value)) { + case "undefined": + sorter = "string"; + break; + + case "boolean": + sorter = "boolean"; + break; + + default: + if (!isNaN(value) && value !== "") { + sorter = "number"; + } else { + if (value.match(/((^[0-9]+[a-z]+)|(^[a-z]+[0-9]+))+$/i)) { + sorter = "alphanum"; + } + } + break; + } + } + } + + return this.sorters[sorter]; +}; + +//work through sort list sorting data +Sort.prototype.sort = function (data) { + var self = this, + sortList = this.table.options.sortOrderReverse ? self.sortList.slice().reverse() : self.sortList, + sortListActual = [], + rowComponents = [], + lastSort; + + if (self.table.options.dataSorting) { + self.table.options.dataSorting.call(self.table, self.getSort()); + } + + self.clearColumnHeaders(); + + if (!self.table.options.ajaxSorting) { + + //build list of valid sorters and trigger column specific callbacks before sort begins + sortList.forEach(function (item, i) { + var sortObj = item.column.modules.sort; + + if (item.column && sortObj) { + + //if no sorter has been defined, take a guess + if (!sortObj.sorter) { + sortObj.sorter = self.findSorter(item.column); + } + + item.params = typeof sortObj.params === "function" ? sortObj.params(item.column.getComponent(), item.dir) : sortObj.params; + + sortListActual.push(item); + } + + self.setColumnHeader(item.column, item.dir); + }); + + //sort data + if (sortListActual.length) { + self._sortItems(data, sortListActual); + } + } else { + sortList.forEach(function (item, i) { + self.setColumnHeader(item.column, item.dir); + }); + } + + if (self.table.options.dataSorted) { + data.forEach(function (row) { + rowComponents.push(row.getComponent()); + }); + + self.table.options.dataSorted.call(self.table, self.getSort(), rowComponents); + } +}; + +//clear sort arrows on columns +Sort.prototype.clearColumnHeaders = function () { + this.table.columnManager.getRealColumns().forEach(function (column) { + if (column.modules.sort) { + column.modules.sort.dir = "none"; + column.getElement().setAttribute("aria-sort", "none"); + } + }); +}; + +//set the column header sort direction +Sort.prototype.setColumnHeader = function (column, dir) { + column.modules.sort.dir = dir; + column.getElement().setAttribute("aria-sort", dir); +}; + +//sort each item in sort list +Sort.prototype._sortItems = function (data, sortList) { + var _this = this; + + var sorterCount = sortList.length - 1; + + data.sort(function (a, b) { + var result; + + for (var i = sorterCount; i >= 0; i--) { + var sortItem = sortList[i]; + + result = _this._sortRow(a, b, sortItem.column, sortItem.dir, sortItem.params); + + if (result !== 0) { + break; + } + } + + return result; + }); +}; + +//process individual rows for a sort function on active data +Sort.prototype._sortRow = function (a, b, column, dir, params) { + var el1Comp, el2Comp, colComp; + + //switch elements depending on search direction + var el1 = dir == "asc" ? a : b; + var el2 = dir == "asc" ? b : a; + + a = column.getFieldValue(el1.getData()); + b = column.getFieldValue(el2.getData()); + + a = typeof a !== "undefined" ? a : ""; + b = typeof b !== "undefined" ? b : ""; + + el1Comp = el1.getComponent(); + el2Comp = el2.getComponent(); + + return column.modules.sort.sorter.call(this, a, b, el1Comp, el2Comp, column.getComponent(), dir, params); +}; + +//default data sorters +Sort.prototype.sorters = { + + //sort numbers + number: function number(a, b, aRow, bRow, column, dir, params) { + var alignEmptyValues = params.alignEmptyValues; + var decimal = params.decimalSeparator || "."; + var thousand = params.thousandSeparator || ","; + var emptyAlign = 0; + + a = parseFloat(String(a).split(thousand).join("").split(decimal).join(".")); + b = parseFloat(String(b).split(thousand).join("").split(decimal).join(".")); + + //handle non numeric values + if (isNaN(a)) { + emptyAlign = isNaN(b) ? 0 : -1; + } else if (isNaN(b)) { + emptyAlign = 1; + } else { + //compare valid values + return a - b; + } + + //fix empty values in position + if (alignEmptyValues === "top" && dir === "desc" || alignEmptyValues === "bottom" && dir === "asc") { + emptyAlign *= -1; + } + + return emptyAlign; + }, + + //sort strings + string: function string(a, b, aRow, bRow, column, dir, params) { + var alignEmptyValues = params.alignEmptyValues; + var emptyAlign = 0; + var locale; + + //handle empty values + if (!a) { + emptyAlign = !b ? 0 : -1; + } else if (!b) { + emptyAlign = 1; + } else { + //compare valid values + switch (_typeof(params.locale)) { + case "boolean": + if (params.locale) { + locale = this.table.modules.localize.getLocale(); + } + break; + case "string": + locale = params.locale; + break; + } + + return String(a).toLowerCase().localeCompare(String(b).toLowerCase(), locale); + } + + //fix empty values in position + if (alignEmptyValues === "top" && dir === "desc" || alignEmptyValues === "bottom" && dir === "asc") { + emptyAlign *= -1; + } + + return emptyAlign; + }, + + //sort date + date: function date(a, b, aRow, bRow, column, dir, params) { + if (!params.format) { + params.format = "DD/MM/YYYY"; + } + + return this.sorters.datetime.call(this, a, b, aRow, bRow, column, dir, params); + }, + + //sort HH:mm formatted times + time: function time(a, b, aRow, bRow, column, dir, params) { + if (!params.format) { + params.format = "HH:mm"; + } + + return this.sorters.datetime.call(this, a, b, aRow, bRow, column, dir, params); + }, + + //sort datetime + datetime: function datetime(a, b, aRow, bRow, column, dir, params) { + var format = params.format || "DD/MM/YYYY HH:mm:ss", + alignEmptyValues = params.alignEmptyValues, + emptyAlign = 0; + + if (typeof moment != "undefined") { + a = moment(a, format); + b = moment(b, format); + + if (!a.isValid()) { + emptyAlign = !b.isValid() ? 0 : -1; + } else if (!b.isValid()) { + emptyAlign = 1; + } else { + //compare valid values + return a - b; + } + + //fix empty values in position + if (alignEmptyValues === "top" && dir === "desc" || alignEmptyValues === "bottom" && dir === "asc") { + emptyAlign *= -1; + } + + return emptyAlign; + } else { + console.error("Sort Error - 'datetime' sorter is dependant on moment.js"); + } + }, + + //sort booleans + boolean: function boolean(a, b, aRow, bRow, column, dir, params) { + var el1 = a === true || a === "true" || a === "True" || a === 1 ? 1 : 0; + var el2 = b === true || b === "true" || b === "True" || b === 1 ? 1 : 0; + + return el1 - el2; + }, + + //sort if element contains any data + array: function array(a, b, aRow, bRow, column, dir, params) { + var el1 = 0; + var el2 = 0; + var type = params.type || "length"; + var alignEmptyValues = params.alignEmptyValues; + var emptyAlign = 0; + + function calc(value) { + + switch (type) { + case "length": + return value.length; + break; + + case "sum": + return value.reduce(function (c, d) { + return c + d; + }); + break; + + case "max": + return Math.max.apply(null, value); + break; + + case "min": + return Math.min.apply(null, value); + break; + + case "avg": + return value.reduce(function (c, d) { + return c + d; + }) / value.length; + break; + } + } + + //handle non array values + if (!Array.isArray(a)) { + alignEmptyValues = !Array.isArray(b) ? 0 : -1; + } else if (!Array.isArray(b)) { + alignEmptyValues = 1; + } else { + + //compare valid values + el1 = a ? calc(a) : 0; + el2 = b ? calc(b) : 0; + + return el1 - el2; + } + + //fix empty values in position + if (alignEmptyValues === "top" && dir === "desc" || alignEmptyValues === "bottom" && dir === "asc") { + emptyAlign *= -1; + } + + return emptyAlign; + }, + + //sort if element contains any data + exists: function exists(a, b, aRow, bRow, column, dir, params) { + var el1 = typeof a == "undefined" ? 0 : 1; + var el2 = typeof b == "undefined" ? 0 : 1; + + return el1 - el2; + }, + + //sort alpha numeric strings + alphanum: function alphanum(as, bs, aRow, bRow, column, dir, params) { + var a, + b, + a1, + b1, + i = 0, + L, + rx = /(\d+)|(\D+)/g, + rd = /\d/; + var alignEmptyValues = params.alignEmptyValues; + var emptyAlign = 0; + + //handle empty values + if (!as && as !== 0) { + emptyAlign = !bs && bs !== 0 ? 0 : -1; + } else if (!bs && bs !== 0) { + emptyAlign = 1; + } else { + + if (isFinite(as) && isFinite(bs)) return as - bs; + a = String(as).toLowerCase(); + b = String(bs).toLowerCase(); + if (a === b) return 0; + if (!(rd.test(a) && rd.test(b))) return a > b ? 1 : -1; + a = a.match(rx); + b = b.match(rx); + L = a.length > b.length ? b.length : a.length; + while (i < L) { + a1 = a[i]; + b1 = b[i++]; + if (a1 !== b1) { + if (isFinite(a1) && isFinite(b1)) { + if (a1.charAt(0) === "0") a1 = "." + a1; + if (b1.charAt(0) === "0") b1 = "." + b1; + return a1 - b1; + } else return a1 > b1 ? 1 : -1; + } + } + + return a.length > b.length; + } + + //fix empty values in position + if (alignEmptyValues === "top" && dir === "desc" || alignEmptyValues === "bottom" && dir === "asc") { + emptyAlign *= -1; + } + + return emptyAlign; + } +}; + +Tabulator.prototype.registerModule("sort", Sort); \ No newline at end of file diff --git a/admin/js/vendors/tabulator/js/modules/sort.min.js b/admin/js/vendors/tabulator/js/modules/sort.min.js new file mode 100644 index 0000000..d0b4cb0 --- /dev/null +++ b/admin/js/vendors/tabulator/js/modules/sort.min.js @@ -0,0 +1,2 @@ +/* Tabulator v4.7.0 (c) Oliver Folkerd */ +var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Sort=function(t){this.table=t,this.sortList=[],this.changed=!1};Sort.prototype.initializeColumn=function(t,e){var r,o,n=this,i=!1;switch(_typeof(t.definition.sorter)){case"string":n.sorters[t.definition.sorter]?i=n.sorters[t.definition.sorter]:console.warn("Sort Error - No such sorter found: ",t.definition.sorter);break;case"function":i=t.definition.sorter}t.modules.sort={sorter:i,dir:"none",params:t.definition.sorterParams||{},startingDir:t.definition.headerSortStartingDir||"asc",tristate:void 0!==t.definition.headerSortTristate?t.definition.headerSortTristate:this.table.options.headerSortTristate},(void 0===t.definition.headerSort?!1!==this.table.options.headerSort:!1!==t.definition.headerSort)&&(r=t.getElement(),r.classList.add("tabulator-sortable"),o=document.createElement("div"),o.classList.add("tabulator-arrow"),e.appendChild(o),r.addEventListener("click",function(e){var r="",o=[],i=!1;if(t.modules.sort){if(t.modules.sort.tristate)r="none"==t.modules.sort.dir?t.modules.sort.startingDir:t.modules.sort.dir==t.modules.sort.startingDir?"asc"==t.modules.sort.dir?"desc":"asc":"none";else switch(t.modules.sort.dir){case"asc":r="desc";break;case"desc":r="asc";break;default:r=t.modules.sort.startingDir}n.table.options.columnHeaderSortMulti&&(e.shiftKey||e.ctrlKey)?(o=n.getSort(),i=o.findIndex(function(e){return e.field===t.getField()}),i>-1?(o[i].dir=r,i!=o.length-1&&(i=o.splice(i,1)[0],"none"!=r&&o.push(i))):"none"!=r&&o.push({column:t,dir:r}),n.setSort(o)):"none"==r?n.clear():n.setSort(t,r),n.table.rowManager.sorterRefresh(!n.sortList.length)}}))},Sort.prototype.hasChanged=function(){var t=this.changed;return this.changed=!1,t},Sort.prototype.getSort=function(){var t=this,e=[];return t.sortList.forEach(function(t){t.column&&e.push({column:t.column.getComponent(),field:t.column.getField(),dir:t.dir})}),e},Sort.prototype.setSort=function(t,e){var r=this,o=[];Array.isArray(t)||(t=[{column:t,dir:e}]),t.forEach(function(t){var e;e=r.table.columnManager.findColumn(t.column),e?(t.column=e,o.push(t),r.changed=!0):console.warn("Sort Warning - Sort field does not exist and is being ignored: ",t.column)}),r.sortList=o,this.table.options.persistence&&this.table.modExists("persistence",!0)&&this.table.modules.persistence.config.sort&&this.table.modules.persistence.save("sort")},Sort.prototype.clear=function(){this.setSort([])},Sort.prototype.findSorter=function(t){var e,r=this.table.rowManager.activeRows[0],o="string";if(r&&(r=r.getData(),t.getField()))switch(e=t.getFieldValue(r),void 0===e?"undefined":_typeof(e)){case"undefined":o="string";break;case"boolean":o="boolean";break;default:isNaN(e)||""===e?e.match(/((^[0-9]+[a-z]+)|(^[a-z]+[0-9]+))+$/i)&&(o="alphanum"):o="number"}return this.sorters[o]},Sort.prototype.sort=function(t){var e=this,r=this.table.options.sortOrderReverse?e.sortList.slice().reverse():e.sortList,o=[],n=[];e.table.options.dataSorting&&e.table.options.dataSorting.call(e.table,e.getSort()),e.clearColumnHeaders(),e.table.options.ajaxSorting?r.forEach(function(t,r){e.setColumnHeader(t.column,t.dir)}):(r.forEach(function(t,r){var n=t.column.modules.sort;t.column&&n&&(n.sorter||(n.sorter=e.findSorter(t.column)),t.params="function"==typeof n.params?n.params(t.column.getComponent(),t.dir):n.params,o.push(t)),e.setColumnHeader(t.column,t.dir)}),o.length&&e._sortItems(t,o)),e.table.options.dataSorted&&(t.forEach(function(t){n.push(t.getComponent())}),e.table.options.dataSorted.call(e.table,e.getSort(),n))},Sort.prototype.clearColumnHeaders=function(){this.table.columnManager.getRealColumns().forEach(function(t){t.modules.sort&&(t.modules.sort.dir="none",t.getElement().setAttribute("aria-sort","none"))})},Sort.prototype.setColumnHeader=function(t,e){t.modules.sort.dir=e,t.getElement().setAttribute("aria-sort",e)},Sort.prototype._sortItems=function(t,e){var r=this,o=e.length-1;t.sort(function(t,n){for(var i,s=o;s>=0;s--){var a=e[s];if(0!==(i=r._sortRow(t,n,a.column,a.dir,a.params)))break}return i})},Sort.prototype._sortRow=function(t,e,r,o,n){var i,s,a="asc"==o?t:e,l="asc"==o?e:t;return t=r.getFieldValue(a.getData()),e=r.getFieldValue(l.getData()),t=void 0!==t?t:"",e=void 0!==e?e:"",i=a.getComponent(),s=l.getComponent(),r.modules.sort.sorter.call(this,t,e,i,s,r.getComponent(),o,n)},Sort.prototype.sorters={number:function(t,e,r,o,n,i,s){var a=s.alignEmptyValues,l=s.decimalSeparator||".",u=s.thousandSeparator||",",c=0;if(t=parseFloat(String(t).split(u).join("").split(l).join(".")),e=parseFloat(String(e).split(u).join("").split(l).join(".")),isNaN(t))c=isNaN(e)?0:-1;else{if(!isNaN(e))return t-e;c=1}return("top"===a&&"desc"===i||"bottom"===a&&"asc"===i)&&(c*=-1),c},string:function(t,e,r,o,n,i,s){var a,l=s.alignEmptyValues,u=0;if(t){if(e){switch(_typeof(s.locale)){case"boolean":s.locale&&(a=this.table.modules.localize.getLocale());break;case"string":a=s.locale}return String(t).toLowerCase().localeCompare(String(e).toLowerCase(),a)}u=1}else u=e?-1:0;return("top"===l&&"desc"===i||"bottom"===l&&"asc"===i)&&(u*=-1),u},date:function(t,e,r,o,n,i,s){return s.format||(s.format="DD/MM/YYYY"),this.sorters.datetime.call(this,t,e,r,o,n,i,s)},time:function(t,e,r,o,n,i,s){return s.format||(s.format="HH:mm"),this.sorters.datetime.call(this,t,e,r,o,n,i,s)},datetime:function(t,e,r,o,n,i,s){var a=s.format||"DD/MM/YYYY HH:mm:ss",l=s.alignEmptyValues,u=0;if("undefined"!=typeof moment){if(t=moment(t,a),e=moment(e,a),t.isValid()){if(e.isValid())return t-e;u=1}else u=e.isValid()?-1:0;return("top"===l&&"desc"===i||"bottom"===l&&"asc"===i)&&(u*=-1),u}console.error("Sort Error - 'datetime' sorter is dependant on moment.js")},boolean:function(t,e,r,o,n,i,s){return(!0===t||"true"===t||"True"===t||1===t?1:0)-(!0===e||"true"===e||"True"===e||1===e?1:0)},array:function(t,e,r,o,n,i,s){function a(t){switch(c){case"length":return t.length;case"sum":return t.reduce(function(t,e){return t+e});case"max":return Math.max.apply(null,t);case"min":return Math.min.apply(null,t);case"avg":return t.reduce(function(t,e){return t+e})/t.length}}var l=0,u=0,c=s.type||"length",d=s.alignEmptyValues,m=0;if(Array.isArray(t)){if(Array.isArray(e))return l=t?a(t):0,u=e?a(e):0,l-u;d=1}else d=Array.isArray(e)?-1:0;return("top"===d&&"desc"===i||"bottom"===d&&"asc"===i)&&(m*=-1),m},exists:function(t,e,r,o,n,i,s){return(void 0===t?0:1)-(void 0===e?0:1)},alphanum:function(t,e,r,o,n,i,s){var a,l,u,c,d,m=0,f=/(\d+)|(\D+)/g,p=/\d/,h=s.alignEmptyValues,g=0;if(t||0===t){if(e||0===e){if(isFinite(t)&&isFinite(e))return t-e;if(a=String(t).toLowerCase(),l=String(e).toLowerCase(),a===l)return 0;if(!p.test(a)||!p.test(l))return a>l?1:-1;for(a=a.match(f),l=l.match(f),d=a.length>l.length?l.length:a.length;mc?1:-1;return a.length>l.length}g=1}else g=e||0===e?-1:0;return("top"===h&&"desc"===i||"bottom"===h&&"asc"===i)&&(g*=-1),g}},Tabulator.prototype.registerModule("sort",Sort); \ No newline at end of file diff --git a/admin/js/vendors/tabulator/js/modules/validate.js b/admin/js/vendors/tabulator/js/modules/validate.js new file mode 100644 index 0000000..b5f6182 --- /dev/null +++ b/admin/js/vendors/tabulator/js/modules/validate.js @@ -0,0 +1,286 @@ +var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; + +/* Tabulator v4.7.0 (c) Oliver Folkerd */ + +var Validate = function Validate(table) { + this.table = table; + this.invalidCells = []; +}; + +//validate +Validate.prototype.initializeColumn = function (column) { + var self = this, + config = [], + validator; + + if (column.definition.validator) { + + if (Array.isArray(column.definition.validator)) { + column.definition.validator.forEach(function (item) { + validator = self._extractValidator(item); + + if (validator) { + config.push(validator); + } + }); + } else { + validator = this._extractValidator(column.definition.validator); + + if (validator) { + config.push(validator); + } + } + + column.modules.validate = config.length ? config : false; + } +}; + +Validate.prototype._extractValidator = function (value) { + var type, params, pos; + + switch (typeof value === "undefined" ? "undefined" : _typeof(value)) { + case "string": + pos = value.indexOf(':'); + + if (pos > -1) { + type = value.substring(0, pos); + params = value.substring(pos + 1); + } else { + type = value; + } + + return this._buildValidator(type, params); + break; + + case "function": + return this._buildValidator(value); + break; + + case "object": + return this._buildValidator(value.type, value.parameters); + break; + } +}; + +Validate.prototype._buildValidator = function (type, params) { + + var func = typeof type == "function" ? type : this.validators[type]; + + if (!func) { + console.warn("Validator Setup Error - No matching validator found:", type); + return false; + } else { + return { + type: typeof type == "function" ? "function" : type, + func: func, + params: params + }; + } +}; + +Validate.prototype.validate = function (validators, cell, value) { + var self = this, + valid = [], + invalidIndex = this.invalidCells.indexOf(cell); + + if (validators) { + validators.forEach(function (item) { + if (!item.func.call(self, cell.getComponent(), value, item.params)) { + valid.push({ + type: item.type, + parameters: item.params + }); + } + }); + } + + valid = valid.length ? valid : true; + + if (!cell.modules.validate) { + cell.modules.validate = {}; + } + + if (valid === true) { + cell.modules.validate.invalid = false; + cell.getElement().classList.remove("tabulator-validation-fail"); + + if (invalidIndex > -1) { + this.invalidCells.splice(invalidIndex, 1); + } + } else { + cell.modules.validate.invalid = true; + + if (this.table.options.validationMode !== "manual") { + cell.getElement().classList.add("tabulator-validation-fail"); + } + + if (invalidIndex == -1) { + this.invalidCells.push(cell); + } + } + + return valid; +}; + +Validate.prototype.getInvalidCells = function () { + var output = []; + + this.invalidCells.forEach(function (cell) { + output.push(cell.getComponent()); + }); + + return output; +}; + +Validate.prototype.clearValidation = function (cell) { + var invalidIndex; + + if (cell.modules.validate && cell.modules.validate.invalid) { + + cell.element.classList.remove("tabulator-validation-fail"); + cell.modules.validate.invalid = false; + + invalidIndex = this.invalidCells.indexOf(cell); + + if (invalidIndex > -1) { + this.invalidCells.splice(invalidIndex, 1); + } + } +}; + +Validate.prototype.validators = { + + //is integer + integer: function integer(cell, value, parameters) { + if (value === "" || value === null || typeof value === "undefined") { + return true; + } + value = Number(value); + return typeof value === 'number' && isFinite(value) && Math.floor(value) === value; + }, + + //is float + float: function float(cell, value, parameters) { + if (value === "" || value === null || typeof value === "undefined") { + return true; + } + value = Number(value); + return typeof value === 'number' && isFinite(value) && value % 1 !== 0; + }, + + //must be a number + numeric: function numeric(cell, value, parameters) { + if (value === "" || value === null || typeof value === "undefined") { + return true; + } + return !isNaN(value); + }, + + //must be a string + string: function string(cell, value, parameters) { + if (value === "" || value === null || typeof value === "undefined") { + return true; + } + return isNaN(value); + }, + + //maximum value + max: function max(cell, value, parameters) { + if (value === "" || value === null || typeof value === "undefined") { + return true; + } + return parseFloat(value) <= parameters; + }, + + //minimum value + min: function min(cell, value, parameters) { + if (value === "" || value === null || typeof value === "undefined") { + return true; + } + return parseFloat(value) >= parameters; + }, + + //starts with value + starts: function starts(cell, value, parameters) { + if (value === "" || value === null || typeof value === "undefined") { + return true; + } + return String(value).toLowerCase().startsWith(String(parameters).toLowerCase()); + }, + + //ends with value + ends: function ends(cell, value, parameters) { + if (value === "" || value === null || typeof value === "undefined") { + return true; + } + return String(value).toLowerCase().endsWith(String(parameters).toLowerCase()); + }, + + //minimum string length + minLength: function minLength(cell, value, parameters) { + if (value === "" || value === null || typeof value === "undefined") { + return true; + } + return String(value).length >= parameters; + }, + + //maximum string length + maxLength: function maxLength(cell, value, parameters) { + if (value === "" || value === null || typeof value === "undefined") { + return true; + } + return String(value).length <= parameters; + }, + + //in provided value list + in: function _in(cell, value, parameters) { + if (value === "" || value === null || typeof value === "undefined") { + return true; + } + if (typeof parameters == "string") { + parameters = parameters.split("|"); + } + + return value === "" || parameters.indexOf(value) > -1; + }, + + //must match provided regex + regex: function regex(cell, value, parameters) { + if (value === "" || value === null || typeof value === "undefined") { + return true; + } + var reg = new RegExp(parameters); + + return reg.test(value); + }, + + //value must be unique in this column + unique: function unique(cell, value, parameters) { + if (value === "" || value === null || typeof value === "undefined") { + return true; + } + var unique = true; + + var cellData = cell.getData(); + var column = cell.getColumn()._getSelf(); + + this.table.rowManager.rows.forEach(function (row) { + var data = row.getData(); + + if (data !== cellData) { + if (value == column.getFieldValue(data)) { + unique = false; + } + } + }); + + return unique; + }, + + //must have a value + required: function required(cell, value, parameters) { + return value !== "" && value !== null && typeof value !== "undefined"; + } +}; + +Tabulator.prototype.registerModule("validate", Validate); \ No newline at end of file diff --git a/admin/js/vendors/tabulator/js/modules/validate.min.js b/admin/js/vendors/tabulator/js/modules/validate.min.js new file mode 100644 index 0000000..fc189c0 --- /dev/null +++ b/admin/js/vendors/tabulator/js/modules/validate.min.js @@ -0,0 +1,2 @@ +/* Tabulator v4.7.0 (c) Oliver Folkerd */ +var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Validate=function(t){this.table=t,this.invalidCells=[]};Validate.prototype.initializeColumn=function(t){var i,n=this,e=[];t.definition.validator&&(Array.isArray(t.definition.validator)?t.definition.validator.forEach(function(t){(i=n._extractValidator(t))&&e.push(i)}):(i=this._extractValidator(t.definition.validator))&&e.push(i),t.modules.validate=!!e.length&&e)},Validate.prototype._extractValidator=function(t){var i,n,e;switch(void 0===t?"undefined":_typeof(t)){case"string":return e=t.indexOf(":"),e>-1?(i=t.substring(0,e),n=t.substring(e+1)):i=t,this._buildValidator(i,n);case"function":return this._buildValidator(t);case"object":return this._buildValidator(t.type,t.parameters)}},Validate.prototype._buildValidator=function(t,i){var n="function"==typeof t?t:this.validators[t];return n?{type:"function"==typeof t?"function":t,func:n,params:i}:(console.warn("Validator Setup Error - No matching validator found:",t),!1)},Validate.prototype.validate=function(t,i,n){var e=this,a=[],o=this.invalidCells.indexOf(i);return t&&t.forEach(function(t){t.func.call(e,i.getComponent(),n,t.params)||a.push({type:t.type,parameters:t.params})}),a=!a.length||a,i.modules.validate||(i.modules.validate={}),!0===a?(i.modules.validate.invalid=!1,i.getElement().classList.remove("tabulator-validation-fail"),o>-1&&this.invalidCells.splice(o,1)):(i.modules.validate.invalid=!0,"manual"!==this.table.options.validationMode&&i.getElement().classList.add("tabulator-validation-fail"),-1==o&&this.invalidCells.push(i)),a},Validate.prototype.getInvalidCells=function(){var t=[];return this.invalidCells.forEach(function(i){t.push(i.getComponent())}),t},Validate.prototype.clearValidation=function(t){var i;t.modules.validate&&t.modules.validate.invalid&&(t.element.classList.remove("tabulator-validation-fail"),t.modules.validate.invalid=!1,(i=this.invalidCells.indexOf(t))>-1&&this.invalidCells.splice(i,1))},Validate.prototype.validators={integer:function(t,i,n){return""===i||null===i||void 0===i||"number"==typeof(i=Number(i))&&isFinite(i)&&Math.floor(i)===i},float:function(t,i,n){return""===i||null===i||void 0===i||"number"==typeof(i=Number(i))&&isFinite(i)&&i%1!=0},numeric:function(t,i,n){return""===i||null===i||void 0===i||!isNaN(i)},string:function(t,i,n){return""===i||null===i||void 0===i||isNaN(i)},max:function(t,i,n){return""===i||null===i||void 0===i||parseFloat(i)<=n},min:function(t,i,n){return""===i||null===i||void 0===i||parseFloat(i)>=n},starts:function(t,i,n){return""===i||null===i||void 0===i||String(i).toLowerCase().startsWith(String(n).toLowerCase())},ends:function(t,i,n){return""===i||null===i||void 0===i||String(i).toLowerCase().endsWith(String(n).toLowerCase())},minLength:function(t,i,n){return""===i||null===i||void 0===i||String(i).length>=n},maxLength:function(t,i,n){return""===i||null===i||void 0===i||String(i).length<=n},in:function(t,i,n){return""===i||null===i||void 0===i||("string"==typeof n&&(n=n.split("|")),""===i||n.indexOf(i)>-1)},regex:function(t,i,n){return""===i||null===i||void 0===i||new RegExp(n).test(i)},unique:function(t,i,n){if(""===i||null===i||void 0===i)return!0;var e=!0,a=t.getData(),o=t.getColumn()._getSelf();return this.table.rowManager.rows.forEach(function(t){var n=t.getData();n!==a&&i==o.getFieldValue(n)&&(e=!1)}),e},required:function(t,i,n){return""!==i&&null!==i&&void 0!==i}},Tabulator.prototype.registerModule("validate",Validate); \ No newline at end of file diff --git a/admin/js/vendors/tabulator/js/tabulator.js b/admin/js/vendors/tabulator/js/tabulator.js new file mode 100644 index 0000000..256e565 --- /dev/null +++ b/admin/js/vendors/tabulator/js/tabulator.js @@ -0,0 +1,24907 @@ +var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; + +/* Tabulator v4.7.0 (c) Oliver Folkerd */ + +;(function (global, factory) { + if ((typeof exports === 'undefined' ? 'undefined' : _typeof(exports)) === 'object' && typeof module !== 'undefined') { + module.exports = factory(); + } else if (typeof define === 'function' && define.amd) { + define(factory); + } else { + global.Tabulator = factory(); + } +})(this, function () { + + 'use strict'; + + // https://tc39.github.io/ecma262/#sec-array.prototype.findIndex + + + if (!Array.prototype.findIndex) { + + Object.defineProperty(Array.prototype, 'findIndex', { + + value: function value(predicate) { + + // 1. Let O be ? ToObject(this value). + + + if (this == null) { + + throw new TypeError('"this" is null or not defined'); + } + + var o = Object(this); + + // 2. Let len be ? ToLength(? Get(O, "length")). + + + var len = o.length >>> 0; + + // 3. If IsCallable(predicate) is false, throw a TypeError exception. + + + if (typeof predicate !== 'function') { + + throw new TypeError('predicate must be a function'); + } + + // 4. If thisArg was supplied, let T be thisArg; else let T be undefined. + + + var thisArg = arguments[1]; + + // 5. Let k be 0. + + + var k = 0; + + // 6. Repeat, while k < len + + + while (k < len) { + + // a. Let Pk be ! ToString(k). + + + // b. Let kValue be ? Get(O, Pk). + + + // c. Let testResult be ToBoolean(? Call(predicate, T, « kValue, k, O »)). + + + // d. If testResult is true, return k. + + + var kValue = o[k]; + + if (predicate.call(thisArg, kValue, k, o)) { + + return k; + } + + // e. Increase k by 1. + + + k++; + } + + // 7. Return -1. + + + return -1; + } + + }); + } + + // https://tc39.github.io/ecma262/#sec-array.prototype.find + + + if (!Array.prototype.find) { + + Object.defineProperty(Array.prototype, 'find', { + + value: function value(predicate) { + + // 1. Let O be ? ToObject(this value). + + + if (this == null) { + + throw new TypeError('"this" is null or not defined'); + } + + var o = Object(this); + + // 2. Let len be ? ToLength(? Get(O, "length")). + + + var len = o.length >>> 0; + + // 3. If IsCallable(predicate) is false, throw a TypeError exception. + + + if (typeof predicate !== 'function') { + + throw new TypeError('predicate must be a function'); + } + + // 4. If thisArg was supplied, let T be thisArg; else let T be undefined. + + + var thisArg = arguments[1]; + + // 5. Let k be 0. + + + var k = 0; + + // 6. Repeat, while k < len + + + while (k < len) { + + // a. Let Pk be ! ToString(k). + + + // b. Let kValue be ? Get(O, Pk). + + + // c. Let testResult be ToBoolean(? Call(predicate, T, « kValue, k, O »)). + + + // d. If testResult is true, return kValue. + + + var kValue = o[k]; + + if (predicate.call(thisArg, kValue, k, o)) { + + return kValue; + } + + // e. Increase k by 1. + + + k++; + } + + // 7. Return undefined. + + + return undefined; + } + + }); + } + + // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/includes#Polyfill + + + if (!String.prototype.includes) { + + String.prototype.includes = function (search, start) { + + 'use strict'; + + if (search instanceof RegExp) { + + throw TypeError('first argument must not be a RegExp'); + } + + if (start === undefined) { + start = 0; + } + + return this.indexOf(search, start) !== -1; + }; + } + + // https://tc39.github.io/ecma262/#sec-array.prototype.includes + + + if (!Array.prototype.includes) { + + Object.defineProperty(Array.prototype, 'includes', { + + value: function value(searchElement, fromIndex) { + + if (this == null) { + + throw new TypeError('"this" is null or not defined'); + } + + // 1. Let O be ? ToObject(this value). + + + var o = Object(this); + + // 2. Let len be ? ToLength(? Get(O, "length")). + + + var len = o.length >>> 0; + + // 3. If len is 0, return false. + + + if (len === 0) { + + return false; + } + + // 4. Let n be ? ToInteger(fromIndex). + + + // (If fromIndex is undefined, this step produces the value 0.) + + + var n = fromIndex | 0; + + // 5. If n ≥ 0, then + + + // a. Let k be n. + + + // 6. Else n < 0, + + + // a. Let k be len + n. + + + // b. If k < 0, let k be 0. + + + var k = Math.max(n >= 0 ? n : len - Math.abs(n), 0); + + function sameValueZero(x, y) { + + return x === y || typeof x === 'number' && typeof y === 'number' && isNaN(x) && isNaN(y); + } + + // 7. Repeat, while k < len + + + while (k < len) { + + // a. Let elementK be the result of ? Get(O, ! ToString(k)). + + + // b. If SameValueZero(searchElement, elementK) is true, return true. + + + if (sameValueZero(o[k], searchElement)) { + + return true; + } + + // c. Increase k by 1. + + + k++; + } + + // 8. Return false + + + return false; + } + + }); + } + + // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/assign#Polyfill + + + if (typeof Object.assign !== 'function') { + + // Must be writable: true, enumerable: false, configurable: true + + + Object.defineProperty(Object, "assign", { + + value: function assign(target, varArgs) { + // .length of function is 2 + + + 'use strict'; + + if (target === null || target === undefined) { + + throw new TypeError('Cannot convert undefined or null to object'); + } + + var to = Object(target); + + for (var index = 1; index < arguments.length; index++) { + + var nextSource = arguments[index]; + + if (nextSource !== null && nextSource !== undefined) { + + for (var nextKey in nextSource) { + + // Avoid bugs when hasOwnProperty is shadowed + + + if (Object.prototype.hasOwnProperty.call(nextSource, nextKey)) { + + to[nextKey] = nextSource[nextKey]; + } + } + } + } + + return to; + }, + + writable: true, + + configurable: true + + }); + } + + var ColumnManager = function ColumnManager(table) { + + this.table = table; //hold parent table + + + this.blockHozScrollEvent = false; + + this.headersElement = this.createHeadersElement(); + + this.element = this.createHeaderElement(); //containing element + + + this.rowManager = null; //hold row manager object + + + this.columns = []; // column definition object + + + this.columnsByIndex = []; //columns by index + + + this.columnsByField = {}; //columns by field + + + this.scrollLeft = 0; + + this.element.insertBefore(this.headersElement, this.element.firstChild); + }; + + ////////////// Setup Functions ///////////////// + + + ColumnManager.prototype.createHeadersElement = function () { + + var el = document.createElement("div"); + + el.classList.add("tabulator-headers"); + + return el; + }; + + ColumnManager.prototype.createHeaderElement = function () { + + var el = document.createElement("div"); + + el.classList.add("tabulator-header"); + + if (!this.table.options.headerVisible) { + + el.classList.add("tabulator-header-hidden"); + } + + return el; + }; + + ColumnManager.prototype.initialize = function () { + + var self = this; + + //scroll body along with header + + + // self.element.addEventListener("scroll", function(e){ + + + // if(!self.blockHozScrollEvent){ + + + // self.table.rowManager.scrollHorizontal(self.element.scrollLeft); + + + // } + + + // }); + + }; + + //link to row manager + + + ColumnManager.prototype.setRowManager = function (manager) { + + this.rowManager = manager; + }; + + //return containing element + + + ColumnManager.prototype.getElement = function () { + + return this.element; + }; + + //return header containing element + + + ColumnManager.prototype.getHeadersElement = function () { + + return this.headersElement; + }; + + // ColumnManager.prototype.tempScrollBlock = function(){ + + + // clearTimeout(this.blockHozScrollEvent); + + + // this.blockHozScrollEvent = setTimeout(() => {this.blockHozScrollEvent = false;}, 50); + + + // } + + + //scroll horizontally to match table body + + + ColumnManager.prototype.scrollHorizontal = function (left) { + + var hozAdjust = 0, + scrollWidth = this.element.scrollWidth - this.table.element.clientWidth; + + // this.tempScrollBlock(); + + + this.element.scrollLeft = left; + + //adjust for vertical scrollbar moving table when present + + + if (left > scrollWidth) { + + hozAdjust = left - scrollWidth; + + this.element.style.marginLeft = -hozAdjust + "px"; + } else { + + this.element.style.marginLeft = 0; + } + + //keep frozen columns fixed in position + + + //this._calcFrozenColumnsPos(hozAdjust + 3); + + + this.scrollLeft = left; + + if (this.table.modExists("frozenColumns")) { + + this.table.modules.frozenColumns.scrollHorizontal(); + } + }; + + ///////////// Column Setup Functions ///////////// + + + ColumnManager.prototype.generateColumnsFromRowData = function (data) { + + var cols = [], + row, + sorter; + + if (data && data.length) { + + row = data[0]; + + for (var key in row) { + + var col = { + + field: key, + + title: key + + }; + + var value = row[key]; + + switch (typeof value === 'undefined' ? 'undefined' : _typeof(value)) { + + case "undefined": + + sorter = "string"; + + break; + + case "boolean": + + sorter = "boolean"; + + break; + + case "object": + + if (Array.isArray(value)) { + + sorter = "array"; + } else { + + sorter = "string"; + } + + break; + + default: + + if (!isNaN(value) && value !== "") { + + sorter = "number"; + } else { + + if (value.match(/((^[0-9]+[a-z]+)|(^[a-z]+[0-9]+))+$/i)) { + + sorter = "alphanum"; + } else { + + sorter = "string"; + } + } + + break; + + } + + col.sorter = sorter; + + cols.push(col); + } + + this.table.options.columns = cols; + + this.setColumns(this.table.options.columns); + } + }; + + ColumnManager.prototype.setColumns = function (cols, row) { + + var self = this; + + while (self.headersElement.firstChild) { + self.headersElement.removeChild(self.headersElement.firstChild); + }self.columns = []; + + self.columnsByIndex = []; + + self.columnsByField = {}; + + //reset frozen columns + + + if (self.table.modExists("frozenColumns")) { + + self.table.modules.frozenColumns.reset(); + } + + cols.forEach(function (def, i) { + + self._addColumn(def); + }); + + self._reIndexColumns(); + + if (self.table.options.responsiveLayout && self.table.modExists("responsiveLayout", true)) { + + self.table.modules.responsiveLayout.initialize(); + } + + self.redraw(true); + }; + + ColumnManager.prototype._addColumn = function (definition, before, nextToColumn) { + + var column = new Column(definition, this), + colEl = column.getElement(), + index = nextToColumn ? this.findColumnIndex(nextToColumn) : nextToColumn; + + if (nextToColumn && index > -1) { + + var parentIndex = this.columns.indexOf(nextToColumn.getTopColumn()); + + var nextEl = nextToColumn.getElement(); + + if (before) { + + this.columns.splice(parentIndex, 0, column); + + nextEl.parentNode.insertBefore(colEl, nextEl); + } else { + + this.columns.splice(parentIndex + 1, 0, column); + + nextEl.parentNode.insertBefore(colEl, nextEl.nextSibling); + } + } else { + + if (before) { + + this.columns.unshift(column); + + this.headersElement.insertBefore(column.getElement(), this.headersElement.firstChild); + } else { + + this.columns.push(column); + + this.headersElement.appendChild(column.getElement()); + } + + column.columnRendered(); + } + + return column; + }; + + ColumnManager.prototype.registerColumnField = function (col) { + + if (col.definition.field) { + + this.columnsByField[col.definition.field] = col; + } + }; + + ColumnManager.prototype.registerColumnPosition = function (col) { + + this.columnsByIndex.push(col); + }; + + ColumnManager.prototype._reIndexColumns = function () { + + this.columnsByIndex = []; + + this.columns.forEach(function (column) { + + column.reRegisterPosition(); + }); + }; + + //ensure column headers take up the correct amount of space in column groups + + + ColumnManager.prototype._verticalAlignHeaders = function () { + + var self = this, + minHeight = 0; + + self.columns.forEach(function (column) { + + var height; + + column.clearVerticalAlign(); + + height = column.getHeight(); + + if (height > minHeight) { + + minHeight = height; + } + }); + + self.columns.forEach(function (column) { + + column.verticalAlign(self.table.options.columnHeaderVertAlign, minHeight); + }); + + self.rowManager.adjustTableSize(); + }; + + //////////////// Column Details ///////////////// + + + ColumnManager.prototype.findColumn = function (subject) { + + var self = this; + + if ((typeof subject === 'undefined' ? 'undefined' : _typeof(subject)) == "object") { + + if (subject instanceof Column) { + + //subject is column element + + + return subject; + } else if (subject instanceof ColumnComponent) { + + //subject is public column component + + + return subject._getSelf() || false; + } else if (typeof HTMLElement !== "undefined" && subject instanceof HTMLElement) { + + //subject is a HTML element of the column header + + + var match = self.columns.find(function (column) { + + return column.element === subject; + }); + + return match || false; + } + } else { + + //subject should be treated as the field name of the column + + + return this.columnsByField[subject] || false; + } + + //catch all for any other type of input + + + return false; + }; + + ColumnManager.prototype.getColumnByField = function (field) { + + return this.columnsByField[field]; + }; + + ColumnManager.prototype.getColumnsByFieldRoot = function (root) { + var _this = this; + + var matches = []; + + Object.keys(this.columnsByField).forEach(function (field) { + + var fieldRoot = field.split(".")[0]; + + if (fieldRoot === root) { + + matches.push(_this.columnsByField[field]); + } + }); + + return matches; + }; + + ColumnManager.prototype.getColumnByIndex = function (index) { + + return this.columnsByIndex[index]; + }; + + ColumnManager.prototype.getFirstVisibileColumn = function (index) { + + var index = this.columnsByIndex.findIndex(function (col) { + + return col.visible; + }); + + return index > -1 ? this.columnsByIndex[index] : false; + }; + + ColumnManager.prototype.getColumns = function () { + + return this.columns; + }; + + ColumnManager.prototype.findColumnIndex = function (column) { + + return this.columnsByIndex.findIndex(function (col) { + + return column === col; + }); + }; + + //return all columns that are not groups + + + ColumnManager.prototype.getRealColumns = function () { + + return this.columnsByIndex; + }; + + //travers across columns and call action + + + ColumnManager.prototype.traverse = function (callback) { + + var self = this; + + self.columnsByIndex.forEach(function (column, i) { + + callback(column, i); + }); + }; + + //get defintions of actual columns + + + ColumnManager.prototype.getDefinitions = function (active) { + + var self = this, + output = []; + + self.columnsByIndex.forEach(function (column) { + + if (!active || active && column.visible) { + + output.push(column.getDefinition()); + } + }); + + return output; + }; + + //get full nested definition tree + + + ColumnManager.prototype.getDefinitionTree = function () { + + var self = this, + output = []; + + self.columns.forEach(function (column) { + + output.push(column.getDefinition(true)); + }); + + return output; + }; + + ColumnManager.prototype.getComponents = function (structured) { + + var self = this, + output = [], + columns = structured ? self.columns : self.columnsByIndex; + + columns.forEach(function (column) { + + output.push(column.getComponent()); + }); + + return output; + }; + + ColumnManager.prototype.getWidth = function () { + + var width = 0; + + this.columnsByIndex.forEach(function (column) { + + if (column.visible) { + + width += column.getWidth(); + } + }); + + return width; + }; + + ColumnManager.prototype.moveColumn = function (from, to, after) { + + this.moveColumnActual(from, to, after); + + if (this.table.options.responsiveLayout && this.table.modExists("responsiveLayout", true)) { + + this.table.modules.responsiveLayout.initialize(); + } + + if (this.table.modExists("columnCalcs")) { + + this.table.modules.columnCalcs.recalc(this.table.rowManager.activeRows); + } + + to.element.parentNode.insertBefore(from.element, to.element); + + if (after) { + + to.element.parentNode.insertBefore(to.element, from.element); + } + + this._verticalAlignHeaders(); + + this.table.rowManager.reinitialize(); + }; + + ColumnManager.prototype.moveColumnActual = function (from, to, after) { + + if (from.parent.isGroup) { + + this._moveColumnInArray(from.parent.columns, from, to, after); + } else { + + this._moveColumnInArray(this.columns, from, to, after); + } + + this._moveColumnInArray(this.columnsByIndex, from, to, after, true); + + if (this.table.options.responsiveLayout && this.table.modExists("responsiveLayout", true)) { + + this.table.modules.responsiveLayout.initialize(); + } + + if (this.table.options.columnMoved) { + + this.table.options.columnMoved.call(this.table, from.getComponent(), this.table.columnManager.getComponents()); + } + + if (this.table.options.persistence && this.table.modExists("persistence", true) && this.table.modules.persistence.config.columns) { + + this.table.modules.persistence.save("columns"); + } + }; + + ColumnManager.prototype._moveColumnInArray = function (columns, from, to, after, updateRows) { + + var fromIndex = columns.indexOf(from), + toIndex; + + if (fromIndex > -1) { + + columns.splice(fromIndex, 1); + + toIndex = columns.indexOf(to); + + if (toIndex > -1) { + + if (after) { + + toIndex = toIndex + 1; + } + } else { + + toIndex = fromIndex; + } + + columns.splice(toIndex, 0, from); + + if (updateRows) { + + this.table.rowManager.rows.forEach(function (row) { + + if (row.cells.length) { + + var cell = row.cells.splice(fromIndex, 1)[0]; + + row.cells.splice(toIndex, 0, cell); + } + }); + } + } + }; + + ColumnManager.prototype.scrollToColumn = function (column, position, ifVisible) { + var _this2 = this; + + var left = 0, + offset = 0, + adjust = 0, + colEl = column.getElement(); + + return new Promise(function (resolve, reject) { + + if (typeof position === "undefined") { + + position = _this2.table.options.scrollToColumnPosition; + } + + if (typeof ifVisible === "undefined") { + + ifVisible = _this2.table.options.scrollToColumnIfVisible; + } + + if (column.visible) { + + //align to correct position + + + switch (position) { + + case "middle": + + case "center": + + adjust = -_this2.element.clientWidth / 2; + + break; + + case "right": + + adjust = colEl.clientWidth - _this2.headersElement.clientWidth; + + break; + + } + + //check column visibility + + + if (!ifVisible) { + + offset = colEl.offsetLeft; + + if (offset > 0 && offset + colEl.offsetWidth < _this2.element.clientWidth) { + + return false; + } + } + + //calculate scroll position + + + left = colEl.offsetLeft + _this2.element.scrollLeft + adjust; + + left = Math.max(Math.min(left, _this2.table.rowManager.element.scrollWidth - _this2.table.rowManager.element.clientWidth), 0); + + _this2.table.rowManager.scrollHorizontal(left); + + _this2.scrollHorizontal(left); + + resolve(); + } else { + + console.warn("Scroll Error - Column not visible"); + + reject("Scroll Error - Column not visible"); + } + }); + }; + + //////////////// Cell Management ///////////////// + + + ColumnManager.prototype.generateCells = function (row) { + + var self = this; + + var cells = []; + + self.columnsByIndex.forEach(function (column) { + + cells.push(column.generateCell(row)); + }); + + return cells; + }; + + //////////////// Column Management ///////////////// + + + ColumnManager.prototype.getFlexBaseWidth = function () { + + var self = this, + totalWidth = self.table.element.clientWidth, + //table element width + + + fixedWidth = 0; + + //adjust for vertical scrollbar if present + + + if (self.rowManager.element.scrollHeight > self.rowManager.element.clientHeight) { + + totalWidth -= self.rowManager.element.offsetWidth - self.rowManager.element.clientWidth; + } + + this.columnsByIndex.forEach(function (column) { + + var width, minWidth, colWidth; + + if (column.visible) { + + width = column.definition.width || 0; + + minWidth = typeof column.minWidth == "undefined" ? self.table.options.columnMinWidth : parseInt(column.minWidth); + + if (typeof width == "string") { + + if (width.indexOf("%") > -1) { + + colWidth = totalWidth / 100 * parseInt(width); + } else { + + colWidth = parseInt(width); + } + } else { + + colWidth = width; + } + + fixedWidth += colWidth > minWidth ? colWidth : minWidth; + } + }); + + return fixedWidth; + }; + + ColumnManager.prototype.addColumn = function (definition, before, nextToColumn) { + var _this3 = this; + + return new Promise(function (resolve, reject) { + + var column = _this3._addColumn(definition, before, nextToColumn); + + _this3._reIndexColumns(); + + if (_this3.table.options.responsiveLayout && _this3.table.modExists("responsiveLayout", true)) { + + _this3.table.modules.responsiveLayout.initialize(); + } + + if (_this3.table.modExists("columnCalcs")) { + + _this3.table.modules.columnCalcs.recalc(_this3.table.rowManager.activeRows); + } + + _this3.redraw(); + + if (_this3.table.modules.layout.getMode() != "fitColumns") { + + column.reinitializeWidth(); + } + + _this3._verticalAlignHeaders(); + + _this3.table.rowManager.reinitialize(); + + resolve(column); + }); + }; + + //remove column from system + + + ColumnManager.prototype.deregisterColumn = function (column) { + + var field = column.getField(), + index; + + //remove from field list + + + if (field) { + + delete this.columnsByField[field]; + } + + //remove from index list + + + index = this.columnsByIndex.indexOf(column); + + if (index > -1) { + + this.columnsByIndex.splice(index, 1); + } + + //remove from column list + + + index = this.columns.indexOf(column); + + if (index > -1) { + + this.columns.splice(index, 1); + } + + if (this.table.options.responsiveLayout && this.table.modExists("responsiveLayout", true)) { + + this.table.modules.responsiveLayout.initialize(); + } + + this.redraw(); + }; + + //redraw columns + + + ColumnManager.prototype.redraw = function (force) { + + if (force) { + + if (Tabulator.prototype.helpers.elVisible(this.element)) { + + this._verticalAlignHeaders(); + } + + this.table.rowManager.resetScroll(); + + this.table.rowManager.reinitialize(); + } + + if (["fitColumns", "fitDataStretch"].indexOf(this.table.modules.layout.getMode()) > -1) { + + this.table.modules.layout.layout(); + } else { + + if (force) { + + this.table.modules.layout.layout(); + } else { + + if (this.table.options.responsiveLayout && this.table.modExists("responsiveLayout", true)) { + + this.table.modules.responsiveLayout.update(); + } + } + } + + if (this.table.modExists("frozenColumns")) { + + this.table.modules.frozenColumns.layout(); + } + + if (this.table.modExists("columnCalcs")) { + + this.table.modules.columnCalcs.recalc(this.table.rowManager.activeRows); + } + + if (force) { + + if (this.table.options.persistence && this.table.modExists("persistence", true) && this.table.modules.persistence.config.columns) { + + this.table.modules.persistence.save("columns"); + } + + if (this.table.modExists("columnCalcs")) { + + this.table.modules.columnCalcs.redraw(); + } + } + + this.table.footerManager.redraw(); + }; + + //public column object + + var ColumnComponent = function ColumnComponent(column) { + + this._column = column; + + this.type = "ColumnComponent"; + }; + + ColumnComponent.prototype.getElement = function () { + + return this._column.getElement(); + }; + + ColumnComponent.prototype.getDefinition = function () { + + return this._column.getDefinition(); + }; + + ColumnComponent.prototype.getField = function () { + + return this._column.getField(); + }; + + ColumnComponent.prototype.getCells = function () { + + var cells = []; + + this._column.cells.forEach(function (cell) { + + cells.push(cell.getComponent()); + }); + + return cells; + }; + + ColumnComponent.prototype.getVisibility = function () { + + console.warn("getVisibility function is deprecated, you should now use the isVisible function"); + + return this._column.visible; + }; + + ColumnComponent.prototype.isVisible = function () { + + return this._column.visible; + }; + + ColumnComponent.prototype.show = function () { + + if (this._column.isGroup) { + + this._column.columns.forEach(function (column) { + + column.show(); + }); + } else { + + this._column.show(); + } + }; + + ColumnComponent.prototype.hide = function () { + + if (this._column.isGroup) { + + this._column.columns.forEach(function (column) { + + column.hide(); + }); + } else { + + this._column.hide(); + } + }; + + ColumnComponent.prototype.toggle = function () { + + if (this._column.visible) { + + this.hide(); + } else { + + this.show(); + } + }; + + ColumnComponent.prototype.delete = function () { + + return this._column.delete(); + }; + + ColumnComponent.prototype.getSubColumns = function () { + + var output = []; + + if (this._column.columns.length) { + + this._column.columns.forEach(function (column) { + + output.push(column.getComponent()); + }); + } + + return output; + }; + + ColumnComponent.prototype.getParentColumn = function () { + + return this._column.parent instanceof Column ? this._column.parent.getComponent() : false; + }; + + ColumnComponent.prototype._getSelf = function () { + + return this._column; + }; + + ColumnComponent.prototype.scrollTo = function () { + + return this._column.table.columnManager.scrollToColumn(this._column); + }; + + ColumnComponent.prototype.getTable = function () { + + return this._column.table; + }; + + ColumnComponent.prototype.headerFilterFocus = function () { + + if (this._column.table.modExists("filter", true)) { + + this._column.table.modules.filter.setHeaderFilterFocus(this._column); + } + }; + + ColumnComponent.prototype.reloadHeaderFilter = function () { + + if (this._column.table.modExists("filter", true)) { + + this._column.table.modules.filter.reloadHeaderFilter(this._column); + } + }; + + ColumnComponent.prototype.getHeaderFilterValue = function () { + + if (this._column.table.modExists("filter", true)) { + + return this._column.table.modules.filter.getHeaderFilterValue(this._column); + } + }; + + ColumnComponent.prototype.setHeaderFilterValue = function (value) { + + if (this._column.table.modExists("filter", true)) { + + this._column.table.modules.filter.setHeaderFilterValue(this._column, value); + } + }; + + ColumnComponent.prototype.move = function (to, after) { + + var toColumn = this._column.table.columnManager.findColumn(to); + + if (toColumn) { + + this._column.table.columnManager.moveColumn(this._column, toColumn, after); + } else { + + console.warn("Move Error - No matching column found:", toColumn); + } + }; + + ColumnComponent.prototype.getNextColumn = function () { + + var nextCol = this._column.nextColumn(); + + return nextCol ? nextCol.getComponent() : false; + }; + + ColumnComponent.prototype.getPrevColumn = function () { + + var prevCol = this._column.prevColumn(); + + return prevCol ? prevCol.getComponent() : false; + }; + + ColumnComponent.prototype.updateDefinition = function (updates) { + + return this._column.updateDefinition(updates); + }; + + ColumnComponent.prototype.getWidth = function () { + + return this._column.getWidth(); + }; + + ColumnComponent.prototype.setWidth = function (width) { + + if (width === true) { + + return this._column.reinitializeWidth(true); + } else { + + return this._column.setWidth(width); + } + }; + + ColumnComponent.prototype.validate = function () { + + return this._column.validate(); + }; + + var Column = function Column(def, parent) { + + var self = this; + + this.table = parent.table; + + this.definition = def; //column definition + + this.parent = parent; //hold parent object + + this.type = "column"; //type of element + + this.columns = []; //child columns + + this.cells = []; //cells bound to this column + + this.element = this.createElement(); //column header element + + this.contentElement = false; + + this.titleElement = false; + + this.groupElement = this.createGroupElement(); //column group holder element + + this.isGroup = false; + + this.tooltip = false; //hold column tooltip + + this.hozAlign = ""; //horizontal text alignment + + this.vertAlign = ""; //vert text alignment + + + //multi dimensional filed handling + + this.field = ""; + + this.fieldStructure = ""; + + this.getFieldValue = ""; + + this.setFieldValue = ""; + + this.titleFormatterRendered = false; + + this.setField(this.definition.field); + + if (this.table.options.invalidOptionWarnings) { + + this.checkDefinition(); + } + + this.modules = {}; //hold module variables; + + + this.cellEvents = { + + cellClick: false, + + cellDblClick: false, + + cellContext: false, + + cellTap: false, + + cellDblTap: false, + + cellTapHold: false, + + cellMouseEnter: false, + + cellMouseLeave: false, + + cellMouseOver: false, + + cellMouseOut: false, + + cellMouseMove: false + + }; + + this.width = null; //column width + + this.widthStyled = ""; //column width prestyled to improve render efficiency + + this.minWidth = null; //column minimum width + + this.minWidthStyled = ""; //column minimum prestyled to improve render efficiency + + this.widthFixed = false; //user has specified a width for this column + + + this.visible = true; //default visible state + + + this.component = null; + + this._mapDepricatedFunctionality(); + + //initialize column + + if (def.columns) { + + this.isGroup = true; + + def.columns.forEach(function (def, i) { + + var newCol = new Column(def, self); + + self.attachColumn(newCol); + }); + + self.checkColumnVisibility(); + } else { + + parent.registerColumnField(this); + } + + if (def.rowHandle && this.table.options.movableRows !== false && this.table.modExists("moveRow")) { + + this.table.modules.moveRow.setHandle(true); + } + + this._buildHeader(); + + this.bindModuleColumns(); + }; + + Column.prototype.createElement = function () { + + var el = document.createElement("div"); + + el.classList.add("tabulator-col"); + + el.setAttribute("role", "columnheader"); + + el.setAttribute("aria-sort", "none"); + + return el; + }; + + Column.prototype.createGroupElement = function () { + + var el = document.createElement("div"); + + el.classList.add("tabulator-col-group-cols"); + + return el; + }; + + Column.prototype.checkDefinition = function () { + var _this4 = this; + + Object.keys(this.definition).forEach(function (key) { + + if (_this4.defaultOptionList.indexOf(key) === -1) { + + console.warn("Invalid column definition option in '" + (_this4.field || _this4.definition.title) + "' column:", key); + } + }); + }; + + Column.prototype.setField = function (field) { + + this.field = field; + + this.fieldStructure = field ? this.table.options.nestedFieldSeparator ? field.split(this.table.options.nestedFieldSeparator) : [field] : []; + + this.getFieldValue = this.fieldStructure.length > 1 ? this._getNestedData : this._getFlatData; + + this.setFieldValue = this.fieldStructure.length > 1 ? this._setNestedData : this._setFlatData; + }; + + //register column position with column manager + + Column.prototype.registerColumnPosition = function (column) { + + this.parent.registerColumnPosition(column); + }; + + //register column position with column manager + + Column.prototype.registerColumnField = function (column) { + + this.parent.registerColumnField(column); + }; + + //trigger position registration + + Column.prototype.reRegisterPosition = function () { + + if (this.isGroup) { + + this.columns.forEach(function (column) { + + column.reRegisterPosition(); + }); + } else { + + this.registerColumnPosition(this); + } + }; + + Column.prototype._mapDepricatedFunctionality = function () { + + if (typeof this.definition.hideInHtml !== "undefined") { + + this.definition.htmlOutput = !this.definition.hideInHtml; + + console.warn("hideInHtml column definition property is deprecated, you should now use htmlOutput"); + } + + if (typeof this.definition.align !== "undefined") { + + this.definition.hozAlign = this.definition.align; + + console.warn("align column definition property is deprecated, you should now use hozAlign"); + } + + if (typeof this.definition.downloadTitle !== "undefined") { + + this.definition.titleDownload = this.definition.downloadTitle; + + console.warn("downloadTitle definition property is deprecated, you should now use titleDownload"); + } + }; + + Column.prototype.setTooltip = function () { + + var self = this, + def = self.definition; + + //set header tooltips + + var tooltip = def.headerTooltip || def.tooltip === false ? def.headerTooltip : self.table.options.tooltipsHeader; + + if (tooltip) { + + if (tooltip === true) { + + if (def.field) { + + self.table.modules.localize.bind("columns|" + def.field, function (value) { + + self.element.setAttribute("title", value || def.title); + }); + } else { + + self.element.setAttribute("title", def.title); + } + } else { + + if (typeof tooltip == "function") { + + tooltip = tooltip(self.getComponent()); + + if (tooltip === false) { + + tooltip = ""; + } + } + + self.element.setAttribute("title", tooltip); + } + } else { + + self.element.setAttribute("title", ""); + } + }; + + //build header element + + Column.prototype._buildHeader = function () { + + var self = this, + def = self.definition; + + while (self.element.firstChild) { + self.element.removeChild(self.element.firstChild); + }if (def.headerVertical) { + + self.element.classList.add("tabulator-col-vertical"); + + if (def.headerVertical === "flip") { + + self.element.classList.add("tabulator-col-vertical-flip"); + } + } + + self.contentElement = self._bindEvents(); + + self.contentElement = self._buildColumnHeaderContent(); + + self.element.appendChild(self.contentElement); + + if (self.isGroup) { + + self._buildGroupHeader(); + } else { + + self._buildColumnHeader(); + } + + self.setTooltip(); + + //set resizable handles + + if (self.table.options.resizableColumns && self.table.modExists("resizeColumns")) { + + self.table.modules.resizeColumns.initializeColumn("header", self, self.element); + } + + //set resizable handles + + if (def.headerFilter && self.table.modExists("filter") && self.table.modExists("edit")) { + + if (typeof def.headerFilterPlaceholder !== "undefined" && def.field) { + + self.table.modules.localize.setHeaderFilterColumnPlaceholder(def.field, def.headerFilterPlaceholder); + } + + self.table.modules.filter.initializeColumn(self); + } + + //set resizable handles + + if (self.table.modExists("frozenColumns")) { + + self.table.modules.frozenColumns.initializeColumn(self); + } + + //set movable column + + if (self.table.options.movableColumns && !self.isGroup && self.table.modExists("moveColumn")) { + + self.table.modules.moveColumn.initializeColumn(self); + } + + //set calcs column + + if ((def.topCalc || def.bottomCalc) && self.table.modExists("columnCalcs")) { + + self.table.modules.columnCalcs.initializeColumn(self); + } + + //handle persistence + + if (self.table.modExists("persistence") && self.table.modules.persistence.config.columns) { + + self.table.modules.persistence.initializeColumn(self); + } + + //update header tooltip on mouse enter + + self.element.addEventListener("mouseenter", function (e) { + + self.setTooltip(); + }); + }; + + Column.prototype._bindEvents = function () { + + var self = this, + def = self.definition, + dblTap, + tapHold, + tap; + + //setup header click event bindings + + if (typeof def.headerClick == "function") { + + self.element.addEventListener("click", function (e) { + def.headerClick(e, self.getComponent()); + }); + } + + if (typeof def.headerDblClick == "function") { + + self.element.addEventListener("dblclick", function (e) { + def.headerDblClick(e, self.getComponent()); + }); + } + + if (typeof def.headerContext == "function") { + + self.element.addEventListener("contextmenu", function (e) { + def.headerContext(e, self.getComponent()); + }); + } + + //setup header tap event bindings + + if (typeof def.headerTap == "function") { + + tap = false; + + self.element.addEventListener("touchstart", function (e) { + + tap = true; + }, { passive: true }); + + self.element.addEventListener("touchend", function (e) { + + if (tap) { + + def.headerTap(e, self.getComponent()); + } + + tap = false; + }); + } + + if (typeof def.headerDblTap == "function") { + + dblTap = null; + + self.element.addEventListener("touchend", function (e) { + + if (dblTap) { + + clearTimeout(dblTap); + + dblTap = null; + + def.headerDblTap(e, self.getComponent()); + } else { + + dblTap = setTimeout(function () { + + clearTimeout(dblTap); + + dblTap = null; + }, 300); + } + }); + } + + if (typeof def.headerTapHold == "function") { + + tapHold = null; + + self.element.addEventListener("touchstart", function (e) { + + clearTimeout(tapHold); + + tapHold = setTimeout(function () { + + clearTimeout(tapHold); + + tapHold = null; + + tap = false; + + def.headerTapHold(e, self.getComponent()); + }, 1000); + }, { passive: true }); + + self.element.addEventListener("touchend", function (e) { + + clearTimeout(tapHold); + + tapHold = null; + }); + } + + //store column cell click event bindings + + if (typeof def.cellClick == "function") { + + self.cellEvents.cellClick = def.cellClick; + } + + if (typeof def.cellDblClick == "function") { + + self.cellEvents.cellDblClick = def.cellDblClick; + } + + if (typeof def.cellContext == "function") { + + self.cellEvents.cellContext = def.cellContext; + } + + //store column mouse event bindings + + if (typeof def.cellMouseEnter == "function") { + + self.cellEvents.cellMouseEnter = def.cellMouseEnter; + } + + if (typeof def.cellMouseLeave == "function") { + + self.cellEvents.cellMouseLeave = def.cellMouseLeave; + } + + if (typeof def.cellMouseOver == "function") { + + self.cellEvents.cellMouseOver = def.cellMouseOver; + } + + if (typeof def.cellMouseOut == "function") { + + self.cellEvents.cellMouseOut = def.cellMouseOut; + } + + if (typeof def.cellMouseMove == "function") { + + self.cellEvents.cellMouseMove = def.cellMouseMove; + } + + //setup column cell tap event bindings + + if (typeof def.cellTap == "function") { + + self.cellEvents.cellTap = def.cellTap; + } + + if (typeof def.cellDblTap == "function") { + + self.cellEvents.cellDblTap = def.cellDblTap; + } + + if (typeof def.cellTapHold == "function") { + + self.cellEvents.cellTapHold = def.cellTapHold; + } + + //setup column cell edit callbacks + + if (typeof def.cellEdited == "function") { + + self.cellEvents.cellEdited = def.cellEdited; + } + + if (typeof def.cellEditing == "function") { + + self.cellEvents.cellEditing = def.cellEditing; + } + + if (typeof def.cellEditCancelled == "function") { + + self.cellEvents.cellEditCancelled = def.cellEditCancelled; + } + }; + + //build header element for header + + Column.prototype._buildColumnHeader = function () { + + var self = this, + def = self.definition, + table = self.table, + sortable; + + //set column sorter + + if (table.modExists("sort")) { + + table.modules.sort.initializeColumn(self, self.contentElement); + } + + //set column header context menu + + if ((def.headerContextMenu || def.headerMenu) && table.modExists("menu")) { + + table.modules.menu.initializeColumnHeader(self); + } + + //set column formatter + + if (table.modExists("format")) { + + table.modules.format.initializeColumn(self); + } + + //set column editor + + if (typeof def.editor != "undefined" && table.modExists("edit")) { + + table.modules.edit.initializeColumn(self); + } + + //set colum validator + + if (typeof def.validator != "undefined" && table.modExists("validate")) { + + table.modules.validate.initializeColumn(self); + } + + //set column mutator + + if (table.modExists("mutator")) { + + table.modules.mutator.initializeColumn(self); + } + + //set column accessor + + if (table.modExists("accessor")) { + + table.modules.accessor.initializeColumn(self); + } + + //set respoviveLayout + + if (_typeof(table.options.responsiveLayout) && table.modExists("responsiveLayout")) { + + table.modules.responsiveLayout.initializeColumn(self); + } + + //set column visibility + + if (typeof def.visible != "undefined") { + + if (def.visible) { + + self.show(true); + } else { + + self.hide(true); + } + } + + //asign additional css classes to column header + + if (def.cssClass) { + + var classeNames = def.cssClass.split(" "); + + classeNames.forEach(function (className) { + + self.element.classList.add(className); + }); + } + + if (def.field) { + + this.element.setAttribute("tabulator-field", def.field); + } + + //set min width if present + + self.setMinWidth(typeof def.minWidth == "undefined" ? self.table.options.columnMinWidth : parseInt(def.minWidth)); + + self.reinitializeWidth(); + + //set tooltip if present + + self.tooltip = self.definition.tooltip || self.definition.tooltip === false ? self.definition.tooltip : self.table.options.tooltips; + + //set orizontal text alignment + + self.hozAlign = typeof self.definition.hozAlign == "undefined" ? self.table.options.cellHozAlign : self.definition.hozAlign; + + self.vertAlign = typeof self.definition.vertAlign == "undefined" ? self.table.options.cellVertAlign : self.definition.vertAlign; + }; + + Column.prototype._buildColumnHeaderContent = function () { + + var def = this.definition, + table = this.table; + + var contentElement = document.createElement("div"); + + contentElement.classList.add("tabulator-col-content"); + + this.titleElement = this._buildColumnHeaderTitle(); + + contentElement.appendChild(this.titleElement); + + return contentElement; + }; + + //build title element of column + + Column.prototype._buildColumnHeaderTitle = function () { + + var self = this, + def = self.definition, + table = self.table, + title; + + var titleHolderElement = document.createElement("div"); + + titleHolderElement.classList.add("tabulator-col-title"); + + if (def.editableTitle) { + + var titleElement = document.createElement("input"); + + titleElement.classList.add("tabulator-title-editor"); + + titleElement.addEventListener("click", function (e) { + + e.stopPropagation(); + + titleElement.focus(); + }); + + titleElement.addEventListener("change", function () { + + def.title = titleElement.value; + + table.options.columnTitleChanged.call(self.table, self.getComponent()); + }); + + titleHolderElement.appendChild(titleElement); + + if (def.field) { + + table.modules.localize.bind("columns|" + def.field, function (text) { + + titleElement.value = text || def.title || " "; + }); + } else { + + titleElement.value = def.title || " "; + } + } else { + + if (def.field) { + + table.modules.localize.bind("columns|" + def.field, function (text) { + + self._formatColumnHeaderTitle(titleHolderElement, text || def.title || " "); + }); + } else { + + self._formatColumnHeaderTitle(titleHolderElement, def.title || " "); + } + } + + return titleHolderElement; + }; + + Column.prototype._formatColumnHeaderTitle = function (el, title) { + var _this5 = this; + + var formatter, contents, params, mockCell, onRendered; + + if (this.definition.titleFormatter && this.table.modExists("format")) { + + formatter = this.table.modules.format.getFormatter(this.definition.titleFormatter); + + onRendered = function onRendered(callback) { + + _this5.titleFormatterRendered = callback; + }; + + mockCell = { + + getValue: function getValue() { + + return title; + }, + + getElement: function getElement() { + + return el; + } + + }; + + params = this.definition.titleFormatterParams || {}; + + params = typeof params === "function" ? params() : params; + + contents = formatter.call(this.table.modules.format, mockCell, params, onRendered); + + switch (typeof contents === 'undefined' ? 'undefined' : _typeof(contents)) { + + case "object": + + if (contents instanceof Node) { + + el.appendChild(contents); + } else { + + el.innerHTML = ""; + + console.warn("Format Error - Title formatter has returned a type of object, the only valid formatter object return is an instance of Node, the formatter returned:", contents); + } + + break; + + case "undefined": + + case "null": + + el.innerHTML = ""; + + break; + + default: + + el.innerHTML = contents; + + } + } else { + + el.innerHTML = title; + } + }; + + //build header element for column group + + Column.prototype._buildGroupHeader = function () { + var _this6 = this; + + this.element.classList.add("tabulator-col-group"); + + this.element.setAttribute("role", "columngroup"); + + this.element.setAttribute("aria-title", this.definition.title); + + //asign additional css classes to column header + + if (this.definition.cssClass) { + + var classeNames = this.definition.cssClass.split(" "); + + classeNames.forEach(function (className) { + + _this6.element.classList.add(className); + }); + } + + //set column header context menu + + if ((this.definition.headerContextMenu || this.definition.headerMenu) && this.table.modExists("menu")) { + + this.table.modules.menu.initializeColumnHeader(this); + } + + this.element.appendChild(this.groupElement); + }; + + //flat field lookup + + Column.prototype._getFlatData = function (data) { + + return data[this.field]; + }; + + //nested field lookup + + Column.prototype._getNestedData = function (data) { + + var dataObj = data, + structure = this.fieldStructure, + length = structure.length, + output; + + for (var _i = 0; _i < length; _i++) { + + dataObj = dataObj[structure[_i]]; + + output = dataObj; + + if (!dataObj) { + + break; + } + } + + return output; + }; + + //flat field set + + Column.prototype._setFlatData = function (data, value) { + + if (this.field) { + + data[this.field] = value; + } + }; + + //nested field set + + Column.prototype._setNestedData = function (data, value) { + + var dataObj = data, + structure = this.fieldStructure, + length = structure.length; + + for (var _i2 = 0; _i2 < length; _i2++) { + + if (_i2 == length - 1) { + + dataObj[structure[_i2]] = value; + } else { + + if (!dataObj[structure[_i2]]) { + + if (typeof value !== "undefined") { + + dataObj[structure[_i2]] = {}; + } else { + + break; + } + } + + dataObj = dataObj[structure[_i2]]; + } + } + }; + + //attach column to this group + + Column.prototype.attachColumn = function (column) { + + var self = this; + + if (self.groupElement) { + + self.columns.push(column); + + self.groupElement.appendChild(column.getElement()); + } else { + + console.warn("Column Warning - Column being attached to another column instead of column group"); + } + }; + + //vertically align header in column + + Column.prototype.verticalAlign = function (alignment, height) { + + //calculate height of column header and group holder element + + var parentHeight = this.parent.isGroup ? this.parent.getGroupElement().clientHeight : height || this.parent.getHeadersElement().clientHeight; + + // var parentHeight = this.parent.isGroup ? this.parent.getGroupElement().clientHeight : this.parent.getHeadersElement().clientHeight; + + + this.element.style.height = parentHeight + "px"; + + if (this.isGroup) { + + this.groupElement.style.minHeight = parentHeight - this.contentElement.offsetHeight + "px"; + } + + //vertically align cell contents + + if (!this.isGroup && alignment !== "top") { + + if (alignment === "bottom") { + + this.element.style.paddingTop = this.element.clientHeight - this.contentElement.offsetHeight + "px"; + } else { + + this.element.style.paddingTop = (this.element.clientHeight - this.contentElement.offsetHeight) / 2 + "px"; + } + } + + this.columns.forEach(function (column) { + + column.verticalAlign(alignment); + }); + }; + + //clear vertical alignmenet + + Column.prototype.clearVerticalAlign = function () { + + this.element.style.paddingTop = ""; + + this.element.style.height = ""; + + this.element.style.minHeight = ""; + + this.groupElement.style.minHeight = ""; + + this.columns.forEach(function (column) { + + column.clearVerticalAlign(); + }); + }; + + Column.prototype.bindModuleColumns = function () { + + //check if rownum formatter is being used on a column + + if (this.definition.formatter == "rownum") { + + this.table.rowManager.rowNumColumn = this; + } + }; + + //// Retreive Column Information //// + + + //return column header element + + Column.prototype.getElement = function () { + + return this.element; + }; + + //return colunm group element + + Column.prototype.getGroupElement = function () { + + return this.groupElement; + }; + + //return field name + + Column.prototype.getField = function () { + + return this.field; + }; + + //return the first column in a group + + Column.prototype.getFirstColumn = function () { + + if (!this.isGroup) { + + return this; + } else { + + if (this.columns.length) { + + return this.columns[0].getFirstColumn(); + } else { + + return false; + } + } + }; + + //return the last column in a group + + Column.prototype.getLastColumn = function () { + + if (!this.isGroup) { + + return this; + } else { + + if (this.columns.length) { + + return this.columns[this.columns.length - 1].getLastColumn(); + } else { + + return false; + } + } + }; + + //return all columns in a group + + Column.prototype.getColumns = function () { + + return this.columns; + }; + + //return all columns in a group + + Column.prototype.getCells = function () { + + return this.cells; + }; + + //retreive the top column in a group of columns + + Column.prototype.getTopColumn = function () { + + if (this.parent.isGroup) { + + return this.parent.getTopColumn(); + } else { + + return this; + } + }; + + //return column definition object + + Column.prototype.getDefinition = function (updateBranches) { + + var colDefs = []; + + if (this.isGroup && updateBranches) { + + this.columns.forEach(function (column) { + + colDefs.push(column.getDefinition(true)); + }); + + this.definition.columns = colDefs; + } + + return this.definition; + }; + + //////////////////// Actions //////////////////// + + + Column.prototype.checkColumnVisibility = function () { + + var visible = false; + + this.columns.forEach(function (column) { + + if (column.visible) { + + visible = true; + } + }); + + if (visible) { + + this.show(); + + this.parent.table.options.columnVisibilityChanged.call(this.table, this.getComponent(), false); + } else { + + this.hide(); + } + }; + + //show column + + Column.prototype.show = function (silent, responsiveToggle) { + + if (!this.visible) { + + this.visible = true; + + this.element.style.display = ""; + + if (this.parent.isGroup) { + + this.parent.checkColumnVisibility(); + } + + this.cells.forEach(function (cell) { + + cell.show(); + }); + + if (!this.isGroup && this.width === null) { + + this.reinitializeWidth(); + } + + this.table.columnManager._verticalAlignHeaders(); + + if (this.table.options.persistence && this.table.modExists("persistence", true) && this.table.modules.persistence.config.columns) { + + this.table.modules.persistence.save("columns"); + } + + if (!responsiveToggle && this.table.options.responsiveLayout && this.table.modExists("responsiveLayout", true)) { + + this.table.modules.responsiveLayout.updateColumnVisibility(this, this.visible); + } + + if (!silent) { + + this.table.options.columnVisibilityChanged.call(this.table, this.getComponent(), true); + } + + if (this.parent.isGroup) { + + this.parent.matchChildWidths(); + } + } + }; + + //hide column + + Column.prototype.hide = function (silent, responsiveToggle) { + + if (this.visible) { + + this.visible = false; + + this.element.style.display = "none"; + + this.table.columnManager._verticalAlignHeaders(); + + if (this.parent.isGroup) { + + this.parent.checkColumnVisibility(); + } + + this.cells.forEach(function (cell) { + + cell.hide(); + }); + + if (this.table.options.persistence && this.table.modExists("persistence", true) && this.table.modules.persistence.config.columns) { + + this.table.modules.persistence.save("columns"); + } + + if (!responsiveToggle && this.table.options.responsiveLayout && this.table.modExists("responsiveLayout", true)) { + + this.table.modules.responsiveLayout.updateColumnVisibility(this, this.visible); + } + + if (!silent) { + + this.table.options.columnVisibilityChanged.call(this.table, this.getComponent(), false); + } + + if (this.parent.isGroup) { + + this.parent.matchChildWidths(); + } + } + }; + + Column.prototype.matchChildWidths = function () { + + var childWidth = 0; + + if (this.contentElement && this.columns.length) { + + this.columns.forEach(function (column) { + + if (column.visible) { + + childWidth += column.getWidth(); + } + }); + + this.contentElement.style.maxWidth = childWidth - 1 + "px"; + + if (this.parent.isGroup) { + + this.parent.matchChildWidths(); + } + } + }; + + Column.prototype.setWidth = function (width) { + + this.widthFixed = true; + + this.setWidthActual(width); + }; + + Column.prototype.setWidthActual = function (width) { + + if (isNaN(width)) { + + width = Math.floor(this.table.element.clientWidth / 100 * parseInt(width)); + } + + width = Math.max(this.minWidth, width); + + this.width = width; + + this.widthStyled = width ? width + "px" : ""; + + this.element.style.width = this.widthStyled; + + if (!this.isGroup) { + + this.cells.forEach(function (cell) { + + cell.setWidth(); + }); + } + + if (this.parent.isGroup) { + + this.parent.matchChildWidths(); + } + + //set resizable handles + + if (this.table.modExists("frozenColumns")) { + + this.table.modules.frozenColumns.layout(); + } + }; + + Column.prototype.checkCellHeights = function () { + + var rows = []; + + this.cells.forEach(function (cell) { + + if (cell.row.heightInitialized) { + + if (cell.row.getElement().offsetParent !== null) { + + rows.push(cell.row); + + cell.row.clearCellHeight(); + } else { + + cell.row.heightInitialized = false; + } + } + }); + + rows.forEach(function (row) { + + row.calcHeight(); + }); + + rows.forEach(function (row) { + + row.setCellHeight(); + }); + }; + + Column.prototype.getWidth = function () { + + var width = 0; + + if (this.isGroup) { + + this.columns.forEach(function (column) { + + if (column.visible) { + + width += column.getWidth(); + } + }); + } else { + + width = this.width; + } + + return width; + }; + + Column.prototype.getHeight = function () { + + return this.element.offsetHeight; + }; + + Column.prototype.setMinWidth = function (minWidth) { + + this.minWidth = minWidth; + + this.minWidthStyled = minWidth ? minWidth + "px" : ""; + + this.element.style.minWidth = this.minWidthStyled; + + this.cells.forEach(function (cell) { + + cell.setMinWidth(); + }); + }; + + Column.prototype.delete = function () { + var _this7 = this; + + return new Promise(function (resolve, reject) { + + if (_this7.isGroup) { + + _this7.columns.forEach(function (column) { + + column.delete(); + }); + } + + //cancel edit if column is currently being edited + + if (_this7.table.modExists("edit")) { + + if (_this7.table.modules.edit.currentCell.column === _this7) { + + _this7.table.modules.edit.cancelEdit(); + } + } + + var cellCount = _this7.cells.length; + + for (var _i3 = 0; _i3 < cellCount; _i3++) { + + _this7.cells[0].delete(); + } + + _this7.element.parentNode.removeChild(_this7.element); + + _this7.table.columnManager.deregisterColumn(_this7); + + resolve(); + }); + }; + + Column.prototype.columnRendered = function () { + + if (this.titleFormatterRendered) { + + this.titleFormatterRendered(); + } + }; + + Column.prototype.validate = function () { + + var invalid = []; + + this.cells.forEach(function (cell) { + + if (!cell.validate()) { + + invalid.push(cell.getComponent()); + } + }); + + return invalid.length ? invalid : true; + }; + + //////////////// Cell Management ///////////////// + + + //generate cell for this column + + Column.prototype.generateCell = function (row) { + + var self = this; + + var cell = new Cell(self, row); + + this.cells.push(cell); + + return cell; + }; + + Column.prototype.nextColumn = function () { + + var index = this.table.columnManager.findColumnIndex(this); + + return index > -1 ? this._nextVisibleColumn(index + 1) : false; + }; + + Column.prototype._nextVisibleColumn = function (index) { + + var column = this.table.columnManager.getColumnByIndex(index); + + return !column || column.visible ? column : this._nextVisibleColumn(index + 1); + }; + + Column.prototype.prevColumn = function () { + + var index = this.table.columnManager.findColumnIndex(this); + + return index > -1 ? this._prevVisibleColumn(index - 1) : false; + }; + + Column.prototype._prevVisibleColumn = function (index) { + + var column = this.table.columnManager.getColumnByIndex(index); + + return !column || column.visible ? column : this._prevVisibleColumn(index - 1); + }; + + Column.prototype.reinitializeWidth = function (force) { + + this.widthFixed = false; + + //set width if present + + if (typeof this.definition.width !== "undefined" && !force) { + + this.setWidth(this.definition.width); + } + + //hide header filters to prevent them altering column width + + if (this.table.modExists("filter")) { + + this.table.modules.filter.hideHeaderFilterElements(); + } + + this.fitToData(); + + //show header filters again after layout is complete + + if (this.table.modExists("filter")) { + + this.table.modules.filter.showHeaderFilterElements(); + } + }; + + //set column width to maximum cell width + + Column.prototype.fitToData = function () { + + var self = this; + + if (!this.widthFixed) { + + this.element.style.width = ""; + + self.cells.forEach(function (cell) { + + cell.clearWidth(); + }); + } + + var maxWidth = this.element.offsetWidth; + + if (!self.width || !this.widthFixed) { + + self.cells.forEach(function (cell) { + + var width = cell.getWidth(); + + if (width > maxWidth) { + + maxWidth = width; + } + }); + + if (maxWidth) { + + self.setWidthActual(maxWidth + 1); + } + } + }; + + Column.prototype.updateDefinition = function (updates) { + var _this8 = this; + + return new Promise(function (resolve, reject) { + + var definition; + + if (!_this8.isGroup) { + + definition = Object.assign({}, _this8.getDefinition()); + + definition = Object.assign(definition, updates); + + _this8.table.columnManager.addColumn(definition, false, _this8).then(function (column) { + + if (definition.field == _this8.field) { + + _this8.field = false; //cleair field name to prevent deletion of duplicate column from arrays + } + + _this8.delete().then(function () { + + resolve(column.getComponent()); + }).catch(function (err) { + + reject(err); + }); + }).catch(function (err) { + + reject(err); + }); + } else { + + console.warn("Column Update Error - The updateDefintion function is only available on columns, not column groups"); + + reject("Column Update Error - The updateDefintion function is only available on columns, not column groups"); + } + }); + }; + + Column.prototype.deleteCell = function (cell) { + + var index = this.cells.indexOf(cell); + + if (index > -1) { + + this.cells.splice(index, 1); + } + }; + + Column.prototype.defaultOptionList = ["title", "field", "columns", "visible", "align", "hozAlign", "vertAlign", "width", "minWidth", "widthGrow", "widthShrink", "resizable", "frozen", "responsive", "tooltip", "cssClass", "rowHandle", "hideInHtml", "print", "htmlOutput", "sorter", "sorterParams", "formatter", "formatterParams", "variableHeight", "editable", "editor", "editorParams", "validator", "mutator", "mutatorParams", "mutatorData", "mutatorDataParams", "mutatorEdit", "mutatorEditParams", "mutatorClipboard", "mutatorClipboardParams", "accessor", "accessorParams", "accessorData", "accessorDataParams", "accessorDownload", "accessorDownloadParams", "accessorClipboard", "accessorClipboardParams", "accessorPrint", "accessorPrintParams", "accessorHtmlOutput", "accessorHtmlOutputParams", "clipboard", "download", "downloadTitle", "topCalc", "topCalcParams", "topCalcFormatter", "topCalcFormatterParams", "bottomCalc", "bottomCalcParams", "bottomCalcFormatter", "bottomCalcFormatterParams", "cellClick", "cellDblClick", "cellContext", "cellTap", "cellDblTap", "cellTapHold", "cellMouseEnter", "cellMouseLeave", "cellMouseOver", "cellMouseOut", "cellMouseMove", "cellEditing", "cellEdited", "cellEditCancelled", "headerSort", "headerSortStartingDir", "headerSortTristate", "headerClick", "headerDblClick", "headerContext", "headerTap", "headerDblTap", "headerTapHold", "headerTooltip", "headerVertical", "editableTitle", "titleFormatter", "titleFormatterParams", "headerFilter", "headerFilterPlaceholder", "headerFilterParams", "headerFilterEmptyCheck", "headerFilterFunc", "headerFilterFuncParams", "headerFilterLiveFilter", "print", "headerContextMenu", "headerMenu", "contextMenu", "formatterPrint", "formatterPrintParams", "formatterClipboard", "formatterClipboardParams", "formatterHtmlOutput", "formatterHtmlOutputParams", "titlePrint", "titleClipboard", "titleHtmlOutput", "titleDownload"]; + + //////////////// Event Bindings ///////////////// + + + //////////////// Object Generation ///////////////// + + Column.prototype.getComponent = function () { + + if (!this.component) { + + this.component = new ColumnComponent(this); + } + + return this.component; + }; + + var RowManager = function RowManager(table) { + + this.table = table; + + this.element = this.createHolderElement(); //containing element + + this.tableElement = this.createTableElement(); //table element + + this.heightFixer = this.createTableElement(); //table element + + this.columnManager = null; //hold column manager object + + this.height = 0; //hold height of table element + + + this.firstRender = false; //handle first render + + this.renderMode = "virtual"; //current rendering mode + + this.fixedHeight = false; //current rendering mode + + + this.rows = []; //hold row data objects + + this.activeRows = []; //rows currently available to on display in the table + + this.activeRowsCount = 0; //count of active rows + + + this.displayRows = []; //rows currently on display in the table + + this.displayRowsCount = 0; //count of display rows + + + this.scrollTop = 0; + + this.scrollLeft = 0; + + this.vDomRowHeight = 20; //approximation of row heights for padding + + + this.vDomTop = 0; //hold position for first rendered row in the virtual DOM + + this.vDomBottom = 0; //hold possition for last rendered row in the virtual DOM + + + this.vDomScrollPosTop = 0; //last scroll position of the vDom top; + + this.vDomScrollPosBottom = 0; //last scroll position of the vDom bottom; + + + this.vDomTopPad = 0; //hold value of padding for top of virtual DOM + + this.vDomBottomPad = 0; //hold value of padding for bottom of virtual DOM + + + this.vDomMaxRenderChain = 90; //the maximum number of dom elements that can be rendered in 1 go + + + this.vDomWindowBuffer = 0; //window row buffer before removing elements, to smooth scrolling + + + this.vDomWindowMinTotalRows = 20; //minimum number of rows to be generated in virtual dom (prevent buffering issues on tables with tall rows) + + this.vDomWindowMinMarginRows = 5; //minimum number of rows to be generated in virtual dom margin + + + this.vDomTopNewRows = []; //rows to normalize after appending to optimize render speed + + this.vDomBottomNewRows = []; //rows to normalize after appending to optimize render speed + + + this.rowNumColumn = false; //hold column component for row number column + + + this.redrawBlock = false; //prevent redraws to allow multiple data manipulations becore continuing + + this.redrawBlockRestoreConfig = false; //store latest redraw function calls for when redraw is needed + + this.redrawBlockRederInPosition = false; //store latest redraw function calls for when redraw is needed + }; + + //////////////// Setup Functions ///////////////// + + + RowManager.prototype.createHolderElement = function () { + + var el = document.createElement("div"); + + el.classList.add("tabulator-tableHolder"); + + el.setAttribute("tabindex", 0); + + return el; + }; + + RowManager.prototype.createTableElement = function () { + + var el = document.createElement("div"); + + el.classList.add("tabulator-table"); + + return el; + }; + + //return containing element + + RowManager.prototype.getElement = function () { + + return this.element; + }; + + //return table element + + RowManager.prototype.getTableElement = function () { + + return this.tableElement; + }; + + //return position of row in table + + RowManager.prototype.getRowPosition = function (row, active) { + + if (active) { + + return this.activeRows.indexOf(row); + } else { + + return this.rows.indexOf(row); + } + }; + + //link to column manager + + RowManager.prototype.setColumnManager = function (manager) { + + this.columnManager = manager; + }; + + RowManager.prototype.initialize = function () { + + var self = this; + + self.setRenderMode(); + + //initialize manager + + self.element.appendChild(self.tableElement); + + self.firstRender = true; + + //scroll header along with table body + + self.element.addEventListener("scroll", function () { + + var left = self.element.scrollLeft; + + //handle horizontal scrolling + + if (self.scrollLeft != left) { + + self.columnManager.scrollHorizontal(left); + + if (self.table.options.groupBy) { + + self.table.modules.groupRows.scrollHeaders(left); + } + + if (self.table.modExists("columnCalcs")) { + + self.table.modules.columnCalcs.scrollHorizontal(left); + } + + self.table.options.scrollHorizontal(left); + } + + self.scrollLeft = left; + }); + + //handle virtual dom scrolling + + if (this.renderMode === "virtual") { + + self.element.addEventListener("scroll", function () { + + var top = self.element.scrollTop; + + var dir = self.scrollTop > top; + + //handle verical scrolling + + if (self.scrollTop != top) { + + self.scrollTop = top; + + self.scrollVertical(dir); + + if (self.table.options.ajaxProgressiveLoad == "scroll") { + + self.table.modules.ajax.nextPage(self.element.scrollHeight - self.element.clientHeight - top); + } + + self.table.options.scrollVertical(top); + } else { + + self.scrollTop = top; + } + }); + } + }; + + ////////////////// Row Manipulation ////////////////// + + + RowManager.prototype.findRow = function (subject) { + + var self = this; + + if ((typeof subject === 'undefined' ? 'undefined' : _typeof(subject)) == "object") { + + if (subject instanceof Row) { + + //subject is row element + + return subject; + } else if (subject instanceof RowComponent) { + + //subject is public row component + + return subject._getSelf() || false; + } else if (typeof HTMLElement !== "undefined" && subject instanceof HTMLElement) { + + //subject is a HTML element of the row + + var match = self.rows.find(function (row) { + + return row.element === subject; + }); + + return match || false; + } + } else if (typeof subject == "undefined" || subject === null) { + + return false; + } else { + + //subject should be treated as the index of the row + + var _match = self.rows.find(function (row) { + + return row.data[self.table.options.index] == subject; + }); + + return _match || false; + } + + //catch all for any other type of input + + + return false; + }; + + RowManager.prototype.getRowFromDataObject = function (data) { + + var match = this.rows.find(function (row) { + + return row.data === data; + }); + + return match || false; + }; + + RowManager.prototype.getRowFromPosition = function (position, active) { + + if (active) { + + return this.activeRows[position]; + } else { + + return this.rows[position]; + } + }; + + RowManager.prototype.scrollToRow = function (row, position, ifVisible) { + var _this9 = this; + + var rowIndex = this.getDisplayRows().indexOf(row), + rowEl = row.getElement(), + rowTop, + offset = 0; + + return new Promise(function (resolve, reject) { + + if (rowIndex > -1) { + + if (typeof position === "undefined") { + + position = _this9.table.options.scrollToRowPosition; + } + + if (typeof ifVisible === "undefined") { + + ifVisible = _this9.table.options.scrollToRowIfVisible; + } + + if (position === "nearest") { + + switch (_this9.renderMode) { + + case "classic": + + rowTop = Tabulator.prototype.helpers.elOffset(rowEl).top; + + position = Math.abs(_this9.element.scrollTop - rowTop) > Math.abs(_this9.element.scrollTop + _this9.element.clientHeight - rowTop) ? "bottom" : "top"; + + break; + + case "virtual": + + position = Math.abs(_this9.vDomTop - rowIndex) > Math.abs(_this9.vDomBottom - rowIndex) ? "bottom" : "top"; + + break; + + } + } + + //check row visibility + + if (!ifVisible) { + + if (Tabulator.prototype.helpers.elVisible(rowEl)) { + + offset = Tabulator.prototype.helpers.elOffset(rowEl).top - Tabulator.prototype.helpers.elOffset(_this9.element).top; + + if (offset > 0 && offset < _this9.element.clientHeight - rowEl.offsetHeight) { + + return false; + } + } + } + + //scroll to row + + switch (_this9.renderMode) { + + case "classic": + + _this9.element.scrollTop = Tabulator.prototype.helpers.elOffset(rowEl).top - Tabulator.prototype.helpers.elOffset(_this9.element).top + _this9.element.scrollTop; + + break; + + case "virtual": + + _this9._virtualRenderFill(rowIndex, true); + + break; + + } + + //align to correct position + + switch (position) { + + case "middle": + + case "center": + + if (_this9.element.scrollHeight - _this9.element.scrollTop == _this9.element.clientHeight) { + + _this9.element.scrollTop = _this9.element.scrollTop + (rowEl.offsetTop - _this9.element.scrollTop) - (_this9.element.scrollHeight - rowEl.offsetTop) / 2; + } else { + + _this9.element.scrollTop = _this9.element.scrollTop - _this9.element.clientHeight / 2; + } + + break; + + case "bottom": + + if (_this9.element.scrollHeight - _this9.element.scrollTop == _this9.element.clientHeight) { + + _this9.element.scrollTop = _this9.element.scrollTop - (_this9.element.scrollHeight - rowEl.offsetTop) + rowEl.offsetHeight; + } else { + + _this9.element.scrollTop = _this9.element.scrollTop - _this9.element.clientHeight + rowEl.offsetHeight; + } + + break; + + } + + resolve(); + } else { + + console.warn("Scroll Error - Row not visible"); + + reject("Scroll Error - Row not visible"); + } + }); + }; + + ////////////////// Data Handling ////////////////// + + + RowManager.prototype.setData = function (data, renderInPosition, columnsChanged) { + var _this10 = this; + + var self = this; + + return new Promise(function (resolve, reject) { + + if (renderInPosition && _this10.getDisplayRows().length) { + + if (self.table.options.pagination) { + + self._setDataActual(data, true); + } else { + + _this10.reRenderInPosition(function () { + + self._setDataActual(data); + }); + } + } else { + + if (_this10.table.options.autoColumns && columnsChanged) { + + _this10.table.columnManager.generateColumnsFromRowData(data); + } + + _this10.resetScroll(); + + _this10._setDataActual(data); + } + + resolve(); + }); + }; + + RowManager.prototype._setDataActual = function (data, renderInPosition) { + + var self = this; + + self.table.options.dataLoading.call(this.table, data); + + this._wipeElements(); + + if (this.table.options.history && this.table.modExists("history")) { + + this.table.modules.history.clear(); + } + + if (Array.isArray(data)) { + + if (this.table.modExists("selectRow")) { + + this.table.modules.selectRow.clearSelectionData(); + } + + if (this.table.options.reactiveData && this.table.modExists("reactiveData", true)) { + + this.table.modules.reactiveData.watchData(data); + } + + data.forEach(function (def, i) { + + if (def && (typeof def === 'undefined' ? 'undefined' : _typeof(def)) === "object") { + + var row = new Row(def, self); + + self.rows.push(row); + } else { + + console.warn("Data Loading Warning - Invalid row data detected and ignored, expecting object but received:", def); + } + }); + + self.table.options.dataLoaded.call(this.table, data); + + self.refreshActiveData(false, false, renderInPosition); + } else { + + console.error("Data Loading Error - Unable to process data due to invalid data type \nExpecting: array \nReceived: ", typeof data === 'undefined' ? 'undefined' : _typeof(data), "\nData: ", data); + } + }; + + RowManager.prototype._wipeElements = function () { + + this.rows.forEach(function (row) { + + row.wipe(); + }); + + if (this.table.options.groupBy && this.table.modExists("groupRows")) { + + this.table.modules.groupRows.wipe(); + } + + this.rows = []; + }; + + RowManager.prototype.deleteRow = function (row, blockRedraw) { + + var allIndex = this.rows.indexOf(row), + activeIndex = this.activeRows.indexOf(row); + + if (activeIndex > -1) { + + this.activeRows.splice(activeIndex, 1); + } + + if (allIndex > -1) { + + this.rows.splice(allIndex, 1); + } + + this.setActiveRows(this.activeRows); + + this.displayRowIterator(function (rows) { + + var displayIndex = rows.indexOf(row); + + if (displayIndex > -1) { + + rows.splice(displayIndex, 1); + } + }); + + if (!blockRedraw) { + + this.reRenderInPosition(); + } + + this.regenerateRowNumbers(); + + this.table.options.rowDeleted.call(this.table, row.getComponent()); + + this.table.options.dataEdited.call(this.table, this.getData()); + + if (this.table.options.groupBy && this.table.modExists("groupRows")) { + + this.table.modules.groupRows.updateGroupRows(true); + } else if (this.table.options.pagination && this.table.modExists("page")) { + + this.refreshActiveData(false, false, true); + } else { + + if (this.table.options.pagination && this.table.modExists("page")) { + + this.refreshActiveData("page"); + } + } + }; + + RowManager.prototype.addRow = function (data, pos, index, blockRedraw) { + + var row = this.addRowActual(data, pos, index, blockRedraw); + + if (this.table.options.history && this.table.modExists("history")) { + + this.table.modules.history.action("rowAdd", row, { data: data, pos: pos, index: index }); + } + + return row; + }; + + //add multiple rows + + RowManager.prototype.addRows = function (data, pos, index) { + var _this11 = this; + + var self = this, + length = 0, + rows = []; + + return new Promise(function (resolve, reject) { + + pos = _this11.findAddRowPos(pos); + + if (!Array.isArray(data)) { + + data = [data]; + } + + length = data.length - 1; + + if (typeof index == "undefined" && pos || typeof index !== "undefined" && !pos) { + + data.reverse(); + } + + data.forEach(function (item, i) { + + var row = self.addRow(item, pos, index, true); + + rows.push(row); + }); + + if (_this11.table.options.groupBy && _this11.table.modExists("groupRows")) { + + _this11.table.modules.groupRows.updateGroupRows(true); + } else if (_this11.table.options.pagination && _this11.table.modExists("page")) { + + _this11.refreshActiveData(false, false, true); + } else { + + _this11.reRenderInPosition(); + } + + //recalc column calculations if present + + if (_this11.table.modExists("columnCalcs")) { + + _this11.table.modules.columnCalcs.recalc(_this11.table.rowManager.activeRows); + } + + _this11.regenerateRowNumbers(); + + resolve(rows); + }); + }; + + RowManager.prototype.findAddRowPos = function (pos) { + + if (typeof pos === "undefined") { + + pos = this.table.options.addRowPos; + } + + if (pos === "pos") { + + pos = true; + } + + if (pos === "bottom") { + + pos = false; + } + + return pos; + }; + + RowManager.prototype.addRowActual = function (data, pos, index, blockRedraw) { + + var row = data instanceof Row ? data : new Row(data || {}, this), + top = this.findAddRowPos(pos), + allIndex = -1, + activeIndex, + dispRows; + + if (!index && this.table.options.pagination && this.table.options.paginationAddRow == "page") { + + dispRows = this.getDisplayRows(); + + if (top) { + + if (dispRows.length) { + + index = dispRows[0]; + } else { + + if (this.activeRows.length) { + + index = this.activeRows[this.activeRows.length - 1]; + + top = false; + } + } + } else { + + if (dispRows.length) { + + index = dispRows[dispRows.length - 1]; + + top = dispRows.length < this.table.modules.page.getPageSize() ? false : true; + } + } + } + + if (typeof index !== "undefined") { + + index = this.findRow(index); + } + + if (this.table.options.groupBy && this.table.modExists("groupRows")) { + + this.table.modules.groupRows.assignRowToGroup(row); + + var groupRows = row.getGroup().rows; + + if (groupRows.length > 1) { + + if (!index || index && groupRows.indexOf(index) == -1) { + + if (top) { + + if (groupRows[0] !== row) { + + index = groupRows[0]; + + this._moveRowInArray(row.getGroup().rows, row, index, !top); + } + } else { + + if (groupRows[groupRows.length - 1] !== row) { + + index = groupRows[groupRows.length - 1]; + + this._moveRowInArray(row.getGroup().rows, row, index, !top); + } + } + } else { + + this._moveRowInArray(row.getGroup().rows, row, index, !top); + } + } + } + + if (index) { + + allIndex = this.rows.indexOf(index); + } + + if (index && allIndex > -1) { + + activeIndex = this.activeRows.indexOf(index); + + this.displayRowIterator(function (rows) { + + var displayIndex = rows.indexOf(index); + + if (displayIndex > -1) { + + rows.splice(top ? displayIndex : displayIndex + 1, 0, row); + } + }); + + if (activeIndex > -1) { + + this.activeRows.splice(top ? activeIndex : activeIndex + 1, 0, row); + } + + this.rows.splice(top ? allIndex : allIndex + 1, 0, row); + } else { + + if (top) { + + this.displayRowIterator(function (rows) { + + rows.unshift(row); + }); + + this.activeRows.unshift(row); + + this.rows.unshift(row); + } else { + + this.displayRowIterator(function (rows) { + + rows.push(row); + }); + + this.activeRows.push(row); + + this.rows.push(row); + } + } + + this.setActiveRows(this.activeRows); + + this.table.options.rowAdded.call(this.table, row.getComponent()); + + this.table.options.dataEdited.call(this.table, this.getData()); + + if (!blockRedraw) { + + this.reRenderInPosition(); + } + + return row; + }; + + RowManager.prototype.moveRow = function (from, to, after) { + + if (this.table.options.history && this.table.modExists("history")) { + + this.table.modules.history.action("rowMove", from, { posFrom: this.getRowPosition(from), posTo: this.getRowPosition(to), to: to, after: after }); + } + + this.moveRowActual(from, to, after); + + this.regenerateRowNumbers(); + + this.table.options.rowMoved.call(this.table, from.getComponent()); + }; + + RowManager.prototype.moveRowActual = function (from, to, after) { + var _this12 = this; + + this._moveRowInArray(this.rows, from, to, after); + + this._moveRowInArray(this.activeRows, from, to, after); + + this.displayRowIterator(function (rows) { + + _this12._moveRowInArray(rows, from, to, after); + }); + + if (this.table.options.groupBy && this.table.modExists("groupRows")) { + + if (!after && to instanceof Group) { + + to = this.table.rowManager.prevDisplayRow(from) || to; + } + + var toGroup = to.getGroup(); + + var fromGroup = from.getGroup(); + + if (toGroup === fromGroup) { + + this._moveRowInArray(toGroup.rows, from, to, after); + } else { + + if (fromGroup) { + + fromGroup.removeRow(from); + } + + toGroup.insertRow(from, to, after); + } + } + }; + + RowManager.prototype._moveRowInArray = function (rows, from, to, after) { + + var fromIndex, toIndex, start, end; + + if (from !== to) { + + fromIndex = rows.indexOf(from); + + if (fromIndex > -1) { + + rows.splice(fromIndex, 1); + + toIndex = rows.indexOf(to); + + if (toIndex > -1) { + + if (after) { + + rows.splice(toIndex + 1, 0, from); + } else { + + rows.splice(toIndex, 0, from); + } + } else { + + rows.splice(fromIndex, 0, from); + } + } + + //restyle rows + + if (rows === this.getDisplayRows()) { + + start = fromIndex < toIndex ? fromIndex : toIndex; + + end = toIndex > fromIndex ? toIndex : fromIndex + 1; + + for (var _i4 = start; _i4 <= end; _i4++) { + + if (rows[_i4]) { + + this.styleRow(rows[_i4], _i4); + } + } + } + } + }; + + RowManager.prototype.clearData = function () { + + this.setData([]); + }; + + RowManager.prototype.getRowIndex = function (row) { + + return this.findRowIndex(row, this.rows); + }; + + RowManager.prototype.getDisplayRowIndex = function (row) { + + var index = this.getDisplayRows().indexOf(row); + + return index > -1 ? index : false; + }; + + RowManager.prototype.nextDisplayRow = function (row, rowOnly) { + + var index = this.getDisplayRowIndex(row), + nextRow = false; + + if (index !== false && index < this.displayRowsCount - 1) { + + nextRow = this.getDisplayRows()[index + 1]; + } + + if (nextRow && (!(nextRow instanceof Row) || nextRow.type != "row")) { + + return this.nextDisplayRow(nextRow, rowOnly); + } + + return nextRow; + }; + + RowManager.prototype.prevDisplayRow = function (row, rowOnly) { + + var index = this.getDisplayRowIndex(row), + prevRow = false; + + if (index) { + + prevRow = this.getDisplayRows()[index - 1]; + } + + if (rowOnly && prevRow && (!(prevRow instanceof Row) || prevRow.type != "row")) { + + return this.prevDisplayRow(prevRow, rowOnly); + } + + return prevRow; + }; + + RowManager.prototype.findRowIndex = function (row, list) { + + var rowIndex; + + row = this.findRow(row); + + if (row) { + + rowIndex = list.indexOf(row); + + if (rowIndex > -1) { + + return rowIndex; + } + } + + return false; + }; + + RowManager.prototype.getData = function (active, transform) { + + var output = [], + rows = this.getRows(active); + + rows.forEach(function (row) { + + if (row.type == "row") { + + output.push(row.getData(transform || "data")); + } + }); + + return output; + }; + + RowManager.prototype.getComponents = function (active) { + + var output = [], + rows = this.getRows(active); + + rows.forEach(function (row) { + + output.push(row.getComponent()); + }); + + return output; + }; + + RowManager.prototype.getDataCount = function (active) { + + var rows = this.getRows(active); + + return rows.length; + }; + + RowManager.prototype._genRemoteRequest = function () { + var _this13 = this; + + var table = this.table, + options = table.options, + params = {}; + + if (table.modExists("page")) { + + //set sort data if defined + + if (options.ajaxSorting) { + + var sorters = this.table.modules.sort.getSort(); + + sorters.forEach(function (item) { + + delete item.column; + }); + + params[this.table.modules.page.paginationDataSentNames.sorters] = sorters; + } + + //set filter data if defined + + if (options.ajaxFiltering) { + + var filters = this.table.modules.filter.getFilters(true, true); + + params[this.table.modules.page.paginationDataSentNames.filters] = filters; + } + + this.table.modules.ajax.setParams(params, true); + } + + table.modules.ajax.sendRequest().then(function (data) { + + _this13._setDataActual(data, true); + }).catch(function (e) {}); + }; + + //choose the path to refresh data after a filter update + + RowManager.prototype.filterRefresh = function () { + + var table = this.table, + options = table.options, + left = this.scrollLeft; + + if (options.ajaxFiltering) { + + if (options.pagination == "remote" && table.modExists("page")) { + + table.modules.page.reset(true); + + table.modules.page.setPage(1).then(function () {}).catch(function () {}); + } else if (options.ajaxProgressiveLoad) { + + table.modules.ajax.loadData().then(function () {}).catch(function () {}); + } else { + + //assume data is url, make ajax call to url to get data + + this._genRemoteRequest(); + } + } else { + + this.refreshActiveData("filter"); + } + + this.scrollHorizontal(left); + }; + + //choose the path to refresh data after a sorter update + + RowManager.prototype.sorterRefresh = function (loadOrignalData) { + + var table = this.table, + options = this.table.options, + left = this.scrollLeft; + + if (options.ajaxSorting) { + + if ((options.pagination == "remote" || options.progressiveLoad) && table.modExists("page")) { + + table.modules.page.reset(true); + + table.modules.page.setPage(1).then(function () {}).catch(function () {}); + } else if (options.ajaxProgressiveLoad) { + + table.modules.ajax.loadData().then(function () {}).catch(function () {}); + } else { + + //assume data is url, make ajax call to url to get data + + this._genRemoteRequest(); + } + } else { + + this.refreshActiveData(loadOrignalData ? "filter" : "sort"); + } + + this.scrollHorizontal(left); + }; + + RowManager.prototype.scrollHorizontal = function (left) { + + this.scrollLeft = left; + + this.element.scrollLeft = left; + + if (this.table.options.groupBy) { + + this.table.modules.groupRows.scrollHeaders(left); + } + + if (this.table.modExists("columnCalcs")) { + + this.table.modules.columnCalcs.scrollHorizontal(left); + } + }; + + //set active data set + + RowManager.prototype.refreshActiveData = function (stage, skipStage, renderInPosition) { + + var self = this, + table = this.table, + cascadeOrder = ["all", "filter", "sort", "display", "freeze", "group", "tree", "page"], + displayIndex; + + if (this.redrawBlock) { + + if (!this.redrawBlockRestoreConfig || cascadeOrder.indexOf(stage) < cascadeOrder.indexOf(this.redrawBlockRestoreConfig.stage)) { + + this.redrawBlockRestoreConfig = { + + stage: stage, + + skipStage: skipStage, + + renderInPosition: renderInPosition + + }; + } + + return; + } else { + + if (self.table.modExists("edit")) { + + self.table.modules.edit.cancelEdit(); + } + + if (!stage) { + + stage = "all"; + } + + if (table.options.selectable && !table.options.selectablePersistence && table.modExists("selectRow")) { + + table.modules.selectRow.deselectRows(); + } + + //cascade through data refresh stages + + switch (stage) { + + case "all": + + case "filter": + + if (!skipStage) { + + if (table.modExists("filter")) { + + self.setActiveRows(table.modules.filter.filter(self.rows)); + } else { + + self.setActiveRows(self.rows.slice(0)); + } + } else { + + skipStage = false; + } + + case "sort": + + if (!skipStage) { + + if (table.modExists("sort")) { + + table.modules.sort.sort(this.activeRows); + } + } else { + + skipStage = false; + } + + //regenerate row numbers for row number formatter if in use + + this.regenerateRowNumbers(); + + //generic stage to allow for pipeline trigger after the data manipulation stage + + case "display": + + this.resetDisplayRows(); + + case "freeze": + + if (!skipStage) { + + if (this.table.modExists("frozenRows")) { + + if (table.modules.frozenRows.isFrozen()) { + + if (!table.modules.frozenRows.getDisplayIndex()) { + + table.modules.frozenRows.setDisplayIndex(this.getNextDisplayIndex()); + } + + displayIndex = table.modules.frozenRows.getDisplayIndex(); + + displayIndex = self.setDisplayRows(table.modules.frozenRows.getRows(this.getDisplayRows(displayIndex - 1)), displayIndex); + + if (displayIndex !== true) { + + table.modules.frozenRows.setDisplayIndex(displayIndex); + } + } + } + } else { + + skipStage = false; + } + + case "group": + + if (!skipStage) { + + if (table.options.groupBy && table.modExists("groupRows")) { + + if (!table.modules.groupRows.getDisplayIndex()) { + + table.modules.groupRows.setDisplayIndex(this.getNextDisplayIndex()); + } + + displayIndex = table.modules.groupRows.getDisplayIndex(); + + displayIndex = self.setDisplayRows(table.modules.groupRows.getRows(this.getDisplayRows(displayIndex - 1)), displayIndex); + + if (displayIndex !== true) { + + table.modules.groupRows.setDisplayIndex(displayIndex); + } + } + } else { + + skipStage = false; + } + + case "tree": + + if (!skipStage) { + + if (table.options.dataTree && table.modExists("dataTree")) { + + if (!table.modules.dataTree.getDisplayIndex()) { + + table.modules.dataTree.setDisplayIndex(this.getNextDisplayIndex()); + } + + displayIndex = table.modules.dataTree.getDisplayIndex(); + + displayIndex = self.setDisplayRows(table.modules.dataTree.getRows(this.getDisplayRows(displayIndex - 1)), displayIndex); + + if (displayIndex !== true) { + + table.modules.dataTree.setDisplayIndex(displayIndex); + } + } + } else { + + skipStage = false; + } + + if (table.options.pagination && table.modExists("page") && !renderInPosition) { + + if (table.modules.page.getMode() == "local") { + + table.modules.page.reset(); + } + } + + case "page": + + if (!skipStage) { + + if (table.options.pagination && table.modExists("page")) { + + if (!table.modules.page.getDisplayIndex()) { + + table.modules.page.setDisplayIndex(this.getNextDisplayIndex()); + } + + displayIndex = table.modules.page.getDisplayIndex(); + + if (table.modules.page.getMode() == "local") { + + table.modules.page.setMaxRows(this.getDisplayRows(displayIndex - 1).length); + } + + displayIndex = self.setDisplayRows(table.modules.page.getRows(this.getDisplayRows(displayIndex - 1)), displayIndex); + + if (displayIndex !== true) { + + table.modules.page.setDisplayIndex(displayIndex); + } + } + } else { + + skipStage = false; + } + + } + + if (Tabulator.prototype.helpers.elVisible(self.element)) { + + if (renderInPosition) { + + self.reRenderInPosition(); + } else { + + self.renderTable(); + + if (table.options.layoutColumnsOnNewData) { + + self.table.columnManager.redraw(true); + } + } + } + + if (table.modExists("columnCalcs")) { + + table.modules.columnCalcs.recalc(this.activeRows); + } + } + }; + + //regenerate row numbers for row number formatter if in use + + RowManager.prototype.regenerateRowNumbers = function () { + var _this14 = this; + + if (this.rowNumColumn) { + + this.activeRows.forEach(function (row) { + + var cell = row.getCell(_this14.rowNumColumn); + + if (cell) { + + cell._generateContents(); + } + }); + } + }; + + RowManager.prototype.setActiveRows = function (activeRows) { + + this.activeRows = activeRows; + + this.activeRowsCount = this.activeRows.length; + }; + + //reset display rows array + + RowManager.prototype.resetDisplayRows = function () { + + this.displayRows = []; + + this.displayRows.push(this.activeRows.slice(0)); + + this.displayRowsCount = this.displayRows[0].length; + + if (this.table.modExists("frozenRows")) { + + this.table.modules.frozenRows.setDisplayIndex(0); + } + + if (this.table.options.groupBy && this.table.modExists("groupRows")) { + + this.table.modules.groupRows.setDisplayIndex(0); + } + + if (this.table.options.pagination && this.table.modExists("page")) { + + this.table.modules.page.setDisplayIndex(0); + } + }; + + RowManager.prototype.getNextDisplayIndex = function () { + + return this.displayRows.length; + }; + + //set display row pipeline data + + RowManager.prototype.setDisplayRows = function (displayRows, index) { + + var output = true; + + if (index && typeof this.displayRows[index] != "undefined") { + + this.displayRows[index] = displayRows; + + output = true; + } else { + + this.displayRows.push(displayRows); + + output = index = this.displayRows.length - 1; + } + + if (index == this.displayRows.length - 1) { + + this.displayRowsCount = this.displayRows[this.displayRows.length - 1].length; + } + + return output; + }; + + RowManager.prototype.getDisplayRows = function (index) { + + if (typeof index == "undefined") { + + return this.displayRows.length ? this.displayRows[this.displayRows.length - 1] : []; + } else { + + return this.displayRows[index] || []; + } + }; + + RowManager.prototype.getVisibleRows = function (viewable) { + + var topEdge = this.element.scrollTop, + bottomEdge = this.element.clientHeight + topEdge, + topFound = false, + topRow = 0, + bottomRow = 0, + rows = this.getDisplayRows(); + + if (viewable) { + + this.getDisplayRows(); + + for (var i = this.vDomTop; i <= this.vDomBottom; i++) { + + if (rows[i]) { + + if (!topFound) { + + if (topEdge - rows[i].getElement().offsetTop >= 0) { + + topRow = i; + } else { + + topFound = true; + + if (bottomEdge - rows[i].getElement().offsetTop >= 0) { + + bottomRow = i; + } else { + + break; + } + } + } else { + + if (bottomEdge - rows[i].getElement().offsetTop >= 0) { + + bottomRow = i; + } else { + + break; + } + } + } + } + } else { + + topRow = this.vDomTop; + + bottomRow = this.vDomBottom; + } + + return rows.slice(topRow, bottomRow + 1); + }; + + //repeat action accross display rows + + RowManager.prototype.displayRowIterator = function (callback) { + + this.displayRows.forEach(callback); + + this.displayRowsCount = this.displayRows[this.displayRows.length - 1].length; + }; + + //return only actual rows (not group headers etc) + + RowManager.prototype.getRows = function (active) { + + var rows; + + switch (active) { + + case "active": + + rows = this.activeRows; + + break; + + case "display": + + rows = this.table.rowManager.getDisplayRows(); + + break; + + case "visible": + + rows = this.getVisibleRows(true); + + break; + + default: + + rows = this.rows; + + } + + return rows; + }; + + ///////////////// Table Rendering ///////////////// + + + //trigger rerender of table in current position + + RowManager.prototype.reRenderInPosition = function (callback) { + + if (this.getRenderMode() == "virtual") { + + if (this.redrawBlock) { + + if (callback) { + + callback(); + } else { + + this.redrawBlockRederInPosition = true; + } + } else { + + var scrollTop = this.element.scrollTop; + + var topRow = false; + + var topOffset = false; + + var left = this.scrollLeft; + + var rows = this.getDisplayRows(); + + for (var i = this.vDomTop; i <= this.vDomBottom; i++) { + + if (rows[i]) { + + var diff = scrollTop - rows[i].getElement().offsetTop; + + if (topOffset === false || Math.abs(diff) < topOffset) { + + topOffset = diff; + + topRow = i; + } else { + + break; + } + } + } + + if (callback) { + + callback(); + } + + this._virtualRenderFill(topRow === false ? this.displayRowsCount - 1 : topRow, true, topOffset || 0); + + this.scrollHorizontal(left); + } + } else { + + this.renderTable(); + + if (callback) { + + callback(); + } + } + }; + + RowManager.prototype.setRenderMode = function () { + + if (this.table.options.virtualDom) { + + this.renderMode = "virtual"; + + if (this.table.element.clientHeight || this.table.options.height) { + + this.fixedHeight = true; + } else { + + this.fixedHeight = false; + } + } else { + + this.renderMode = "classic"; + } + }; + + RowManager.prototype.getRenderMode = function () { + + return this.renderMode; + }; + + RowManager.prototype.renderTable = function () { + + this.table.options.renderStarted.call(this.table); + + this.element.scrollTop = 0; + + switch (this.renderMode) { + + case "classic": + + this._simpleRender(); + + break; + + case "virtual": + + this._virtualRenderFill(); + + break; + + } + + if (this.firstRender) { + + if (this.displayRowsCount) { + + this.firstRender = false; + + this.table.modules.layout.layout(); + } else { + + this.renderEmptyScroll(); + } + } + + if (this.table.modExists("frozenColumns")) { + + this.table.modules.frozenColumns.layout(); + } + + if (!this.displayRowsCount) { + + if (this.table.options.placeholder) { + + this.table.options.placeholder.setAttribute("tabulator-render-mode", this.renderMode); + + this.getElement().appendChild(this.table.options.placeholder); + + this.table.options.placeholder.style.width = this.table.columnManager.getWidth() + "px"; + } + } + + this.table.options.renderComplete.call(this.table); + }; + + //simple render on heightless table + + RowManager.prototype._simpleRender = function () { + + this._clearVirtualDom(); + + if (this.displayRowsCount) { + + this.checkClassicModeGroupHeaderWidth(); + } else { + + this.renderEmptyScroll(); + } + }; + + RowManager.prototype.checkClassicModeGroupHeaderWidth = function () { + + var self = this, + element = this.tableElement, + onlyGroupHeaders = true; + + self.getDisplayRows().forEach(function (row, index) { + + self.styleRow(row, index); + + element.appendChild(row.getElement()); + + row.initialize(true); + + if (row.type !== "group") { + + onlyGroupHeaders = false; + } + }); + + if (onlyGroupHeaders) { + + element.style.minWidth = self.table.columnManager.getWidth() + "px"; + } else { + + element.style.minWidth = ""; + } + }; + + //show scrollbars on empty table div + + RowManager.prototype.renderEmptyScroll = function () { + + if (this.table.options.placeholder) { + + this.tableElement.style.display = "none"; + } else { + + this.tableElement.style.minWidth = this.table.columnManager.getWidth() + "px"; + + this.tableElement.style.minHeight = "1px"; + + this.tableElement.style.visibility = "hidden"; + } + }; + + RowManager.prototype._clearVirtualDom = function () { + + var element = this.tableElement; + + if (this.table.options.placeholder && this.table.options.placeholder.parentNode) { + + this.table.options.placeholder.parentNode.removeChild(this.table.options.placeholder); + } + + // element.children.detach(); + + while (element.firstChild) { + element.removeChild(element.firstChild); + }element.style.paddingTop = ""; + + element.style.paddingBottom = ""; + + element.style.minWidth = ""; + + element.style.minHeight = ""; + + element.style.display = ""; + + element.style.visibility = ""; + + this.scrollTop = 0; + + this.scrollLeft = 0; + + this.vDomTop = 0; + + this.vDomBottom = 0; + + this.vDomTopPad = 0; + + this.vDomBottomPad = 0; + }; + + RowManager.prototype.styleRow = function (row, index) { + + var rowEl = row.getElement(); + + if (index % 2) { + + rowEl.classList.add("tabulator-row-even"); + + rowEl.classList.remove("tabulator-row-odd"); + } else { + + rowEl.classList.add("tabulator-row-odd"); + + rowEl.classList.remove("tabulator-row-even"); + } + }; + + //full virtual render + + RowManager.prototype._virtualRenderFill = function (position, forceMove, offset) { + + var self = this, + element = self.tableElement, + holder = self.element, + topPad = 0, + rowsHeight = 0, + topPadHeight = 0, + i = 0, + onlyGroupHeaders = true, + rows = self.getDisplayRows(); + + position = position || 0; + + offset = offset || 0; + + if (!position) { + + self._clearVirtualDom(); + } else { + + while (element.firstChild) { + element.removeChild(element.firstChild); + } //check if position is too close to bottom of table + + var heightOccupied = (self.displayRowsCount - position + 1) * self.vDomRowHeight; + + if (heightOccupied < self.height) { + + position -= Math.ceil((self.height - heightOccupied) / self.vDomRowHeight); + + if (position < 0) { + + position = 0; + } + } + + //calculate initial pad + + topPad = Math.min(Math.max(Math.floor(self.vDomWindowBuffer / self.vDomRowHeight), self.vDomWindowMinMarginRows), position); + + position -= topPad; + } + + if (self.displayRowsCount && Tabulator.prototype.helpers.elVisible(self.element)) { + + self.vDomTop = position; + + self.vDomBottom = position - 1; + + while ((rowsHeight <= self.height + self.vDomWindowBuffer || i < self.vDomWindowMinTotalRows) && self.vDomBottom < self.displayRowsCount - 1) { + + var index = self.vDomBottom + 1, + row = rows[index], + rowHeight = 0; + + self.styleRow(row, index); + + element.appendChild(row.getElement()); + + if (!row.initialized) { + + row.initialize(true); + } else { + + if (!row.heightInitialized) { + + row.normalizeHeight(true); + } + } + + rowHeight = row.getHeight(); + + if (i < topPad) { + + topPadHeight += rowHeight; + } else { + + rowsHeight += rowHeight; + } + + if (rowHeight > this.vDomWindowBuffer) { + + this.vDomWindowBuffer = rowHeight * 2; + } + + if (row.type !== "group") { + + onlyGroupHeaders = false; + } + + self.vDomBottom++; + + i++; + } + + if (!position) { + + this.vDomTopPad = 0; + + //adjust rowheight to match average of rendered elements + + self.vDomRowHeight = Math.floor((rowsHeight + topPadHeight) / i); + + self.vDomBottomPad = self.vDomRowHeight * (self.displayRowsCount - self.vDomBottom - 1); + + self.vDomScrollHeight = topPadHeight + rowsHeight + self.vDomBottomPad - self.height; + } else { + + self.vDomTopPad = !forceMove ? self.scrollTop - topPadHeight : self.vDomRowHeight * this.vDomTop + offset; + + self.vDomBottomPad = self.vDomBottom == self.displayRowsCount - 1 ? 0 : Math.max(self.vDomScrollHeight - self.vDomTopPad - rowsHeight - topPadHeight, 0); + } + + element.style.paddingTop = self.vDomTopPad + "px"; + + element.style.paddingBottom = self.vDomBottomPad + "px"; + + if (forceMove) { + + this.scrollTop = self.vDomTopPad + topPadHeight + offset - (this.element.scrollWidth > this.element.clientWidth ? this.element.offsetHeight - this.element.clientHeight : 0); + } + + this.scrollTop = Math.min(this.scrollTop, this.element.scrollHeight - this.height); + + //adjust for horizontal scrollbar if present (and not at top of table) + + if (this.element.scrollWidth > this.element.offsetWidth && forceMove) { + + this.scrollTop += this.element.offsetHeight - this.element.clientHeight; + } + + this.vDomScrollPosTop = this.scrollTop; + + this.vDomScrollPosBottom = this.scrollTop; + + holder.scrollTop = this.scrollTop; + + element.style.minWidth = onlyGroupHeaders ? self.table.columnManager.getWidth() + "px" : ""; + + if (self.table.options.groupBy) { + + if (self.table.modules.layout.getMode() != "fitDataFill" && self.displayRowsCount == self.table.modules.groupRows.countGroups()) { + + self.tableElement.style.minWidth = self.table.columnManager.getWidth(); + } + } + } else { + + this.renderEmptyScroll(); + } + + if (!this.fixedHeight) { + + this.adjustTableSize(); + } + }; + + //handle vertical scrolling + + RowManager.prototype.scrollVertical = function (dir) { + + var topDiff = this.scrollTop - this.vDomScrollPosTop; + + var bottomDiff = this.scrollTop - this.vDomScrollPosBottom; + + var margin = this.vDomWindowBuffer * 2; + + if (-topDiff > margin || bottomDiff > margin) { + + //if big scroll redraw table; + + var left = this.scrollLeft; + + this._virtualRenderFill(Math.floor(this.element.scrollTop / this.element.scrollHeight * this.displayRowsCount)); + + this.scrollHorizontal(left); + } else { + + if (dir) { + + //scrolling up + + if (topDiff < 0) { + + this._addTopRow(-topDiff); + } + + if (bottomDiff < 0) { + + //hide bottom row if needed + + if (this.vDomScrollHeight - this.scrollTop > this.vDomWindowBuffer) { + + this._removeBottomRow(-bottomDiff); + } else { + + this.vDomScrollPosBottom = this.scrollTop; + } + } + } else { + + //scrolling down + + if (topDiff >= 0) { + + //hide top row if needed + + if (this.scrollTop > this.vDomWindowBuffer) { + + this._removeTopRow(topDiff); + } else { + + this.vDomScrollPosTop = this.scrollTop; + } + } + + if (bottomDiff >= 0) { + + this._addBottomRow(bottomDiff); + } + } + } + }; + + RowManager.prototype._addTopRow = function (topDiff) { + var i = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0; + + + var table = this.tableElement, + rows = this.getDisplayRows(); + + if (this.vDomTop) { + + var index = this.vDomTop - 1, + topRow = rows[index], + topRowHeight = topRow.getHeight() || this.vDomRowHeight; + + //hide top row if needed + + if (topDiff >= topRowHeight) { + + this.styleRow(topRow, index); + + table.insertBefore(topRow.getElement(), table.firstChild); + + if (!topRow.initialized || !topRow.heightInitialized) { + + this.vDomTopNewRows.push(topRow); + + if (!topRow.heightInitialized) { + + topRow.clearCellHeight(); + } + } + + topRow.initialize(); + + this.vDomTopPad -= topRowHeight; + + if (this.vDomTopPad < 0) { + + this.vDomTopPad = index * this.vDomRowHeight; + } + + if (!index) { + + this.vDomTopPad = 0; + } + + table.style.paddingTop = this.vDomTopPad + "px"; + + this.vDomScrollPosTop -= topRowHeight; + + this.vDomTop--; + } + + topDiff = -(this.scrollTop - this.vDomScrollPosTop); + + if (topRow.getHeight() > this.vDomWindowBuffer) { + + this.vDomWindowBuffer = topRow.getHeight() * 2; + } + + if (i < this.vDomMaxRenderChain && this.vDomTop && topDiff >= (rows[this.vDomTop - 1].getHeight() || this.vDomRowHeight)) { + + this._addTopRow(topDiff, i + 1); + } else { + + this._quickNormalizeRowHeight(this.vDomTopNewRows); + } + } + }; + + RowManager.prototype._removeTopRow = function (topDiff) { + + var table = this.tableElement, + topRow = this.getDisplayRows()[this.vDomTop], + topRowHeight = topRow.getHeight() || this.vDomRowHeight; + + if (topDiff >= topRowHeight) { + + var rowEl = topRow.getElement(); + + rowEl.parentNode.removeChild(rowEl); + + this.vDomTopPad += topRowHeight; + + table.style.paddingTop = this.vDomTopPad + "px"; + + this.vDomScrollPosTop += this.vDomTop ? topRowHeight : topRowHeight + this.vDomWindowBuffer; + + this.vDomTop++; + + topDiff = this.scrollTop - this.vDomScrollPosTop; + + this._removeTopRow(topDiff); + } + }; + + RowManager.prototype._addBottomRow = function (bottomDiff) { + var i = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0; + + + var table = this.tableElement, + rows = this.getDisplayRows(); + + if (this.vDomBottom < this.displayRowsCount - 1) { + + var index = this.vDomBottom + 1, + bottomRow = rows[index], + bottomRowHeight = bottomRow.getHeight() || this.vDomRowHeight; + + //hide bottom row if needed + + if (bottomDiff >= bottomRowHeight) { + + this.styleRow(bottomRow, index); + + table.appendChild(bottomRow.getElement()); + + if (!bottomRow.initialized || !bottomRow.heightInitialized) { + + this.vDomBottomNewRows.push(bottomRow); + + if (!bottomRow.heightInitialized) { + + bottomRow.clearCellHeight(); + } + } + + bottomRow.initialize(); + + this.vDomBottomPad -= bottomRowHeight; + + if (this.vDomBottomPad < 0 || index == this.displayRowsCount - 1) { + + this.vDomBottomPad = 0; + } + + table.style.paddingBottom = this.vDomBottomPad + "px"; + + this.vDomScrollPosBottom += bottomRowHeight; + + this.vDomBottom++; + } + + bottomDiff = this.scrollTop - this.vDomScrollPosBottom; + + if (bottomRow.getHeight() > this.vDomWindowBuffer) { + + this.vDomWindowBuffer = bottomRow.getHeight() * 2; + } + + if (i < this.vDomMaxRenderChain && this.vDomBottom < this.displayRowsCount - 1 && bottomDiff >= (rows[this.vDomBottom + 1].getHeight() || this.vDomRowHeight)) { + + this._addBottomRow(bottomDiff, i + 1); + } else { + + this._quickNormalizeRowHeight(this.vDomBottomNewRows); + } + } + }; + + RowManager.prototype._removeBottomRow = function (bottomDiff) { + + var table = this.tableElement, + bottomRow = this.getDisplayRows()[this.vDomBottom], + bottomRowHeight = bottomRow.getHeight() || this.vDomRowHeight; + + if (bottomDiff >= bottomRowHeight) { + + var rowEl = bottomRow.getElement(); + + if (rowEl.parentNode) { + + rowEl.parentNode.removeChild(rowEl); + } + + this.vDomBottomPad += bottomRowHeight; + + if (this.vDomBottomPad < 0) { + + this.vDomBottomPad = 0; + } + + table.style.paddingBottom = this.vDomBottomPad + "px"; + + this.vDomScrollPosBottom -= bottomRowHeight; + + this.vDomBottom--; + + bottomDiff = -(this.scrollTop - this.vDomScrollPosBottom); + + this._removeBottomRow(bottomDiff); + } + }; + + RowManager.prototype._quickNormalizeRowHeight = function (rows) { + + rows.forEach(function (row) { + + row.calcHeight(); + }); + + rows.forEach(function (row) { + + row.setCellHeight(); + }); + + rows.length = 0; + }; + + //normalize height of active rows + + RowManager.prototype.normalizeHeight = function () { + + this.activeRows.forEach(function (row) { + + row.normalizeHeight(); + }); + }; + + //adjust the height of the table holder to fit in the Tabulator element + + RowManager.prototype.adjustTableSize = function () { + + var initialHeight = this.element.clientHeight, + modExists; + + if (this.renderMode === "virtual") { + + var otherHeight = this.columnManager.getElement().offsetHeight + (this.table.footerManager && !this.table.footerManager.external ? this.table.footerManager.getElement().offsetHeight : 0); + + if (this.fixedHeight) { + + this.element.style.minHeight = "calc(100% - " + otherHeight + "px)"; + + this.element.style.height = "calc(100% - " + otherHeight + "px)"; + + this.element.style.maxHeight = "calc(100% - " + otherHeight + "px)"; + } else { + + this.element.style.height = ""; + + this.element.style.height = this.table.element.clientHeight - otherHeight + "px"; + + this.element.scrollTop = this.scrollTop; + } + + this.height = this.element.clientHeight; + + this.vDomWindowBuffer = this.table.options.virtualDomBuffer || this.height; + + //check if the table has changed size when dealing with variable height tables + + if (!this.fixedHeight && initialHeight != this.element.clientHeight) { + + modExists = this.table.modExists("resizeTable"); + + if (modExists && !this.table.modules.resizeTable.autoResize || !modExists) { + + this.redraw(); + } + } + } + }; + + //renitialize all rows + + RowManager.prototype.reinitialize = function () { + + this.rows.forEach(function (row) { + + row.reinitialize(); + }); + }; + + //prevent table from being redrawn + + RowManager.prototype.blockRedraw = function () { + + this.redrawBlock = true; + + this.redrawBlockRestoreConfig = false; + }; + + //restore table redrawing + + RowManager.prototype.restoreRedraw = function () { + + this.redrawBlock = false; + + if (this.redrawBlockRestoreConfig) { + + this.refreshActiveData(this.redrawBlockRestoreConfig.stage, this.redrawBlockRestoreConfig.skipStage, this.redrawBlockRestoreConfig.renderInPosition); + + this.redrawBlockRestoreConfig = false; + } else { + + if (this.redrawBlockRederInPosition) { + + this.reRenderInPosition(); + } + } + + this.redrawBlockRederInPosition = false; + }; + + //redraw table + + RowManager.prototype.redraw = function (force) { + + var pos = 0, + left = this.scrollLeft; + + this.adjustTableSize(); + + this.table.tableWidth = this.table.element.clientWidth; + + if (!force) { + + if (this.renderMode == "classic") { + + if (this.table.options.groupBy) { + + this.refreshActiveData("group", false, false); + } else { + + this._simpleRender(); + } + } else { + + this.reRenderInPosition(); + + this.scrollHorizontal(left); + } + + if (!this.displayRowsCount) { + + if (this.table.options.placeholder) { + + this.getElement().appendChild(this.table.options.placeholder); + } + } + } else { + + this.renderTable(); + } + }; + + RowManager.prototype.resetScroll = function () { + + this.element.scrollLeft = 0; + + this.element.scrollTop = 0; + + if (this.table.browser === "ie") { + + var event = document.createEvent("Event"); + + event.initEvent("scroll", false, true); + + this.element.dispatchEvent(event); + } else { + + this.element.dispatchEvent(new Event('scroll')); + } + }; + + //public row object + + var RowComponent = function RowComponent(row) { + + this._row = row; + }; + + RowComponent.prototype.getData = function (transform) { + + return this._row.getData(transform); + }; + + RowComponent.prototype.getElement = function () { + + return this._row.getElement(); + }; + + RowComponent.prototype.getCells = function () { + + var cells = []; + + this._row.getCells().forEach(function (cell) { + + cells.push(cell.getComponent()); + }); + + return cells; + }; + + RowComponent.prototype.getCell = function (column) { + + var cell = this._row.getCell(column); + + return cell ? cell.getComponent() : false; + }; + + RowComponent.prototype.getIndex = function () { + + return this._row.getData("data")[this._row.table.options.index]; + }; + + RowComponent.prototype.getPosition = function (active) { + + return this._row.table.rowManager.getRowPosition(this._row, active); + }; + + RowComponent.prototype.delete = function () { + + return this._row.delete(); + }; + + RowComponent.prototype.scrollTo = function () { + + return this._row.table.rowManager.scrollToRow(this._row); + }; + + RowComponent.prototype.pageTo = function () { + + if (this._row.table.modExists("page", true)) { + + return this._row.table.modules.page.setPageToRow(this._row); + } + }; + + RowComponent.prototype.move = function (to, after) { + + this._row.moveToRow(to, after); + }; + + RowComponent.prototype.update = function (data) { + + return this._row.updateData(data); + }; + + RowComponent.prototype.normalizeHeight = function () { + + this._row.normalizeHeight(true); + }; + + RowComponent.prototype.select = function () { + + this._row.table.modules.selectRow.selectRows(this._row); + }; + + RowComponent.prototype.deselect = function () { + + this._row.table.modules.selectRow.deselectRows(this._row); + }; + + RowComponent.prototype.toggleSelect = function () { + + this._row.table.modules.selectRow.toggleRow(this._row); + }; + + RowComponent.prototype.isSelected = function () { + + return this._row.table.modules.selectRow.isRowSelected(this._row); + }; + + RowComponent.prototype._getSelf = function () { + + return this._row; + }; + + RowComponent.prototype.validate = function () { + + return this._row.validate(); + }; + + RowComponent.prototype.freeze = function () { + + if (this._row.table.modExists("frozenRows", true)) { + + this._row.table.modules.frozenRows.freezeRow(this._row); + } + }; + + RowComponent.prototype.unfreeze = function () { + + if (this._row.table.modExists("frozenRows", true)) { + + this._row.table.modules.frozenRows.unfreezeRow(this._row); + } + }; + + RowComponent.prototype.isFrozen = function () { + + if (this._row.table.modExists("frozenRows", true)) { + + var index = this._row.table.modules.frozenRows.rows.indexOf(this._row); + + return index > -1; + } + + return false; + }; + + RowComponent.prototype.treeCollapse = function () { + + if (this._row.table.modExists("dataTree", true)) { + + this._row.table.modules.dataTree.collapseRow(this._row); + } + }; + + RowComponent.prototype.treeExpand = function () { + + if (this._row.table.modExists("dataTree", true)) { + + this._row.table.modules.dataTree.expandRow(this._row); + } + }; + + RowComponent.prototype.treeToggle = function () { + + if (this._row.table.modExists("dataTree", true)) { + + this._row.table.modules.dataTree.toggleRow(this._row); + } + }; + + RowComponent.prototype.getTreeParent = function () { + + if (this._row.table.modExists("dataTree", true)) { + + return this._row.table.modules.dataTree.getTreeParent(this._row); + } + + return false; + }; + + RowComponent.prototype.getTreeChildren = function () { + + if (this._row.table.modExists("dataTree", true)) { + + return this._row.table.modules.dataTree.getTreeChildren(this._row); + } + + return false; + }; + + RowComponent.prototype.addTreeChild = function (data, pos, index) { + + if (this._row.table.modExists("dataTree", true)) { + + return this._row.table.modules.dataTree.addTreeChildRow(this._row, data, pos, index); + } + + return false; + }; + + RowComponent.prototype.reformat = function () { + + return this._row.reinitialize(); + }; + + RowComponent.prototype.getGroup = function () { + + return this._row.getGroup().getComponent(); + }; + + RowComponent.prototype.getTable = function () { + + return this._row.table; + }; + + RowComponent.prototype.getNextRow = function () { + + var row = this._row.nextRow(); + + return row ? row.getComponent() : row; + }; + + RowComponent.prototype.getPrevRow = function () { + + var row = this._row.prevRow(); + + return row ? row.getComponent() : row; + }; + + var Row = function Row(data, parent) { + var type = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : "row"; + + + this.table = parent.table; + + this.parent = parent; + + this.data = {}; + + this.type = type; //type of element + + this.element = this.createElement(); + + this.modules = {}; //hold module variables; + + this.cells = []; + + this.height = 0; //hold element height + + this.heightStyled = ""; //hold element height prestyled to improve render efficiency + + this.manualHeight = false; //user has manually set row height + + this.outerHeight = 0; //holde lements outer height + + this.initialized = false; //element has been rendered + + this.heightInitialized = false; //element has resized cells to fit + + + this.component = null; + + this.setData(data); + + this.generateElement(); + }; + + Row.prototype.createElement = function () { + + var el = document.createElement("div"); + + el.classList.add("tabulator-row"); + + el.setAttribute("role", "row"); + + return el; + }; + + Row.prototype.getElement = function () { + + return this.element; + }; + + Row.prototype.detachElement = function () { + + if (this.element && this.element.parentNode) { + + this.element.parentNode.removeChild(this.element); + } + }; + + Row.prototype.generateElement = function () { + + var self = this, + dblTap, + tapHold, + tap; + + //set row selection characteristics + + if (self.table.options.selectable !== false && self.table.modExists("selectRow")) { + + self.table.modules.selectRow.initializeRow(this); + } + + //setup movable rows + + if (self.table.options.movableRows !== false && self.table.modExists("moveRow")) { + + self.table.modules.moveRow.initializeRow(this); + } + + //setup data tree + + if (self.table.options.dataTree !== false && self.table.modExists("dataTree")) { + + self.table.modules.dataTree.initializeRow(this); + } + + //setup column colapse container + + if (self.table.options.responsiveLayout === "collapse" && self.table.modExists("responsiveLayout")) { + + self.table.modules.responsiveLayout.initializeRow(this); + } + + //set column menu + + if (self.table.options.rowContextMenu && this.table.modExists("menu")) { + + self.table.modules.menu.initializeRow(this); + } + + //handle row click events + + if (self.table.options.rowClick) { + + self.element.addEventListener("click", function (e) { + + self.table.options.rowClick(e, self.getComponent()); + }); + } + + if (self.table.options.rowDblClick) { + + self.element.addEventListener("dblclick", function (e) { + + self.table.options.rowDblClick(e, self.getComponent()); + }); + } + + if (self.table.options.rowContext) { + + self.element.addEventListener("contextmenu", function (e) { + + self.table.options.rowContext(e, self.getComponent()); + }); + } + + //handle mouse events + + if (self.table.options.rowMouseEnter) { + + self.element.addEventListener("mouseenter", function (e) { + + self.table.options.rowMouseEnter(e, self.getComponent()); + }); + } + + if (self.table.options.rowMouseLeave) { + + self.element.addEventListener("mouseleave", function (e) { + + self.table.options.rowMouseLeave(e, self.getComponent()); + }); + } + + if (self.table.options.rowMouseOver) { + + self.element.addEventListener("mouseover", function (e) { + + self.table.options.rowMouseOver(e, self.getComponent()); + }); + } + + if (self.table.options.rowMouseOut) { + + self.element.addEventListener("mouseout", function (e) { + + self.table.options.rowMouseOut(e, self.getComponent()); + }); + } + + if (self.table.options.rowMouseMove) { + + self.element.addEventListener("mousemove", function (e) { + + self.table.options.rowMouseMove(e, self.getComponent()); + }); + } + + if (self.table.options.rowTap) { + + tap = false; + + self.element.addEventListener("touchstart", function (e) { + + tap = true; + }, { passive: true }); + + self.element.addEventListener("touchend", function (e) { + + if (tap) { + + self.table.options.rowTap(e, self.getComponent()); + } + + tap = false; + }); + } + + if (self.table.options.rowDblTap) { + + dblTap = null; + + self.element.addEventListener("touchend", function (e) { + + if (dblTap) { + + clearTimeout(dblTap); + + dblTap = null; + + self.table.options.rowDblTap(e, self.getComponent()); + } else { + + dblTap = setTimeout(function () { + + clearTimeout(dblTap); + + dblTap = null; + }, 300); + } + }); + } + + if (self.table.options.rowTapHold) { + + tapHold = null; + + self.element.addEventListener("touchstart", function (e) { + + clearTimeout(tapHold); + + tapHold = setTimeout(function () { + + clearTimeout(tapHold); + + tapHold = null; + + tap = false; + + self.table.options.rowTapHold(e, self.getComponent()); + }, 1000); + }, { passive: true }); + + self.element.addEventListener("touchend", function (e) { + + clearTimeout(tapHold); + + tapHold = null; + }); + } + }; + + Row.prototype.generateCells = function () { + + this.cells = this.table.columnManager.generateCells(this); + }; + + //functions to setup on first render + + Row.prototype.initialize = function (force) { + + var self = this; + + if (!self.initialized || force) { + + self.deleteCells(); + + while (self.element.firstChild) { + self.element.removeChild(self.element.firstChild); + } //handle frozen cells + + if (this.table.modExists("frozenColumns")) { + + this.table.modules.frozenColumns.layoutRow(this); + } + + this.generateCells(); + + self.cells.forEach(function (cell) { + + self.element.appendChild(cell.getElement()); + + cell.cellRendered(); + }); + + if (force) { + + self.normalizeHeight(); + } + + //setup movable rows + + if (self.table.options.dataTree && self.table.modExists("dataTree")) { + + self.table.modules.dataTree.layoutRow(this); + } + + //setup column colapse container + + if (self.table.options.responsiveLayout === "collapse" && self.table.modExists("responsiveLayout")) { + + self.table.modules.responsiveLayout.layoutRow(this); + } + + if (self.table.options.rowFormatter) { + + self.table.options.rowFormatter(self.getComponent()); + } + + //set resizable handles + + if (self.table.options.resizableRows && self.table.modExists("resizeRows")) { + + self.table.modules.resizeRows.initializeRow(self); + } + + self.initialized = true; + } + }; + + Row.prototype.reinitializeHeight = function () { + + this.heightInitialized = false; + + if (this.element.offsetParent !== null) { + + this.normalizeHeight(true); + } + }; + + Row.prototype.reinitialize = function () { + + this.initialized = false; + + this.heightInitialized = false; + + if (!this.manualHeight) { + + this.height = 0; + + this.heightStyled = ""; + } + + if (this.element.offsetParent !== null) { + + this.initialize(true); + } + }; + + //get heights when doing bulk row style calcs in virtual DOM + + Row.prototype.calcHeight = function (force) { + + var maxHeight = 0, + minHeight = this.table.options.resizableRows ? this.element.clientHeight : 0; + + this.cells.forEach(function (cell) { + + var height = cell.getHeight(); + + if (height > maxHeight) { + + maxHeight = height; + } + }); + + if (force) { + + this.height = Math.max(maxHeight, minHeight); + } else { + + this.height = this.manualHeight ? this.height : Math.max(maxHeight, minHeight); + } + + this.heightStyled = this.height ? this.height + "px" : ""; + + this.outerHeight = this.element.offsetHeight; + }; + + //set of cells + + Row.prototype.setCellHeight = function () { + + this.cells.forEach(function (cell) { + + cell.setHeight(); + }); + + this.heightInitialized = true; + }; + + Row.prototype.clearCellHeight = function () { + + this.cells.forEach(function (cell) { + + cell.clearHeight(); + }); + }; + + //normalize the height of elements in the row + + Row.prototype.normalizeHeight = function (force) { + + if (force) { + + this.clearCellHeight(); + } + + this.calcHeight(force); + + this.setCellHeight(); + }; + + // Row.prototype.setHeight = function(height){ + + // this.height = height; + + + // this.setCellHeight(); + + // }; + + + //set height of rows + + Row.prototype.setHeight = function (height, force) { + + if (this.height != height || force) { + + this.manualHeight = true; + + this.height = height; + + this.heightStyled = height ? height + "px" : ""; + + this.setCellHeight(); + + // this.outerHeight = this.element.outerHeight(); + + this.outerHeight = this.element.offsetHeight; + } + }; + + //return rows outer height + + Row.prototype.getHeight = function () { + + return this.outerHeight; + }; + + //return rows outer Width + + Row.prototype.getWidth = function () { + + return this.element.offsetWidth; + }; + + //////////////// Cell Management ///////////////// + + + Row.prototype.deleteCell = function (cell) { + + var index = this.cells.indexOf(cell); + + if (index > -1) { + + this.cells.splice(index, 1); + } + }; + + //////////////// Data Management ///////////////// + + + Row.prototype.setData = function (data) { + + if (this.table.modExists("mutator")) { + + data = this.table.modules.mutator.transformRow(data, "data"); + } + + this.data = data; + + if (this.table.options.reactiveData && this.table.modExists("reactiveData", true)) { + + this.table.modules.reactiveData.watchRow(this); + } + }; + + //update the rows data + + Row.prototype.updateData = function (updatedData) { + var _this15 = this; + + var visible = Tabulator.prototype.helpers.elVisible(this.element), + tempData = {}, + newRowData; + + return new Promise(function (resolve, reject) { + + if (typeof updatedData === "string") { + + updatedData = JSON.parse(updatedData); + } + + if (_this15.table.options.reactiveData && _this15.table.modExists("reactiveData", true)) { + + _this15.table.modules.reactiveData.block(); + } + + //mutate incomming data if needed + + if (_this15.table.modExists("mutator")) { + + tempData = Object.assign(tempData, _this15.data); + + tempData = Object.assign(tempData, updatedData); + + newRowData = _this15.table.modules.mutator.transformRow(tempData, "data", updatedData); + } else { + + newRowData = updatedData; + } + + //set data + + for (var attrname in newRowData) { + + _this15.data[attrname] = newRowData[attrname]; + } + + if (_this15.table.options.reactiveData && _this15.table.modExists("reactiveData", true)) { + + _this15.table.modules.reactiveData.unblock(); + } + + //update affected cells only + + for (var attrname in updatedData) { + + var columns = _this15.table.columnManager.getColumnsByFieldRoot(attrname); + + columns.forEach(function (column) { + + var cell = _this15.getCell(column.getField()); + + if (cell) { + + var value = column.getFieldValue(newRowData); + + if (cell.getValue() != value) { + + cell.setValueProcessData(value); + + if (visible) { + + cell.cellRendered(); + } + } + } + }); + } + + //Partial reinitialization if visible + + if (visible) { + + _this15.normalizeHeight(true); + + if (_this15.table.options.rowFormatter) { + + _this15.table.options.rowFormatter(_this15.getComponent()); + } + } else { + + _this15.initialized = false; + + _this15.height = 0; + + _this15.heightStyled = ""; + } + + if (_this15.table.options.dataTree !== false && _this15.table.modExists("dataTree") && _this15.table.modules.dataTree.redrawNeeded(updatedData)) { + + _this15.table.modules.dataTree.initializeRow(_this15); + + _this15.table.modules.dataTree.layoutRow(_this15); + + _this15.table.rowManager.refreshActiveData("tree", false, true); + } + + //this.reinitialize(); + + + _this15.table.options.rowUpdated.call(_this15.table, _this15.getComponent()); + + resolve(); + }); + }; + + Row.prototype.getData = function (transform) { + + var self = this; + + if (transform) { + + if (self.table.modExists("accessor")) { + + return self.table.modules.accessor.transformRow(self.data, transform); + } + } else { + + return this.data; + } + }; + + Row.prototype.getCell = function (column) { + + var match = false; + + column = this.table.columnManager.findColumn(column); + + match = this.cells.find(function (cell) { + + return cell.column === column; + }); + + return match; + }; + + Row.prototype.getCellIndex = function (findCell) { + + return this.cells.findIndex(function (cell) { + + return cell === findCell; + }); + }; + + Row.prototype.findNextEditableCell = function (index) { + + var nextCell = false; + + if (index < this.cells.length - 1) { + + for (var i = index + 1; i < this.cells.length; i++) { + + var cell = this.cells[i]; + + if (cell.column.modules.edit && Tabulator.prototype.helpers.elVisible(cell.getElement())) { + + var allowEdit = true; + + if (typeof cell.column.modules.edit.check == "function") { + + allowEdit = cell.column.modules.edit.check(cell.getComponent()); + } + + if (allowEdit) { + + nextCell = cell; + + break; + } + } + } + } + + return nextCell; + }; + + Row.prototype.findPrevEditableCell = function (index) { + + var prevCell = false; + + if (index > 0) { + + for (var i = index - 1; i >= 0; i--) { + + var cell = this.cells[i], + allowEdit = true; + + if (cell.column.modules.edit && Tabulator.prototype.helpers.elVisible(cell.getElement())) { + + if (typeof cell.column.modules.edit.check == "function") { + + allowEdit = cell.column.modules.edit.check(cell.getComponent()); + } + + if (allowEdit) { + + prevCell = cell; + + break; + } + } + } + } + + return prevCell; + }; + + Row.prototype.getCells = function () { + + return this.cells; + }; + + Row.prototype.nextRow = function () { + + var row = this.table.rowManager.nextDisplayRow(this, true); + + return row || false; + }; + + Row.prototype.prevRow = function () { + + var row = this.table.rowManager.prevDisplayRow(this, true); + + return row || false; + }; + + Row.prototype.moveToRow = function (to, before) { + + var toRow = this.table.rowManager.findRow(to); + + if (toRow) { + + this.table.rowManager.moveRowActual(this, toRow, !before); + + this.table.rowManager.refreshActiveData("display", false, true); + } else { + + console.warn("Move Error - No matching row found:", to); + } + }; + + Row.prototype.validate = function () { + + var invalid = []; + + this.cells.forEach(function (cell) { + + if (!cell.validate()) { + + invalid.push(cell.getComponent()); + } + }); + + return invalid.length ? invalid : true; + }; + + ///////////////////// Actions ///////////////////// + + + Row.prototype.delete = function () { + var _this16 = this; + + return new Promise(function (resolve, reject) { + + var index, rows; + + if (_this16.table.options.history && _this16.table.modExists("history")) { + + if (_this16.table.options.groupBy && _this16.table.modExists("groupRows")) { + + rows = _this16.getGroup().rows; + + index = rows.indexOf(_this16); + + if (index) { + + index = rows[index - 1]; + } + } else { + + index = _this16.table.rowManager.getRowIndex(_this16); + + if (index) { + + index = _this16.table.rowManager.rows[index - 1]; + } + } + + _this16.table.modules.history.action("rowDelete", _this16, { data: _this16.getData(), pos: !index, index: index }); + } + + _this16.deleteActual(); + + resolve(); + }); + }; + + Row.prototype.deleteActual = function (blockRedraw) { + + var index = this.table.rowManager.getRowIndex(this); + + //deselect row if it is selected + + if (this.table.modExists("selectRow")) { + + this.table.modules.selectRow._deselectRow(this, true); + } + + //cancel edit if row is currently being edited + + if (this.table.modExists("edit")) { + + if (this.table.modules.edit.currentCell.row === this) { + + this.table.modules.edit.cancelEdit(); + } + } + + // if(this.table.options.dataTree && this.table.modExists("dataTree")){ + + // this.table.modules.dataTree.collapseRow(this, true); + + // } + + + //remove any reactive data watchers from row object + + if (this.table.options.reactiveData && this.table.modExists("reactiveData", true)) {} + + // this.table.modules.reactiveData.unwatchRow(this); + + //remove from group + + if (this.modules.group) { + + this.modules.group.removeRow(this); + } + + this.table.rowManager.deleteRow(this, blockRedraw); + + this.deleteCells(); + + this.initialized = false; + + this.heightInitialized = false; + + if (this.table.options.dataTree && this.table.modExists("dataTree", true)) { + + this.table.modules.dataTree.rowDelete(this); + } + + //recalc column calculations if present + + if (this.table.modExists("columnCalcs")) { + + if (this.table.options.groupBy && this.table.modExists("groupRows")) { + + this.table.modules.columnCalcs.recalcRowGroup(this); + } else { + + this.table.modules.columnCalcs.recalc(this.table.rowManager.activeRows); + } + } + }; + + Row.prototype.deleteCells = function () { + + var cellCount = this.cells.length; + + for (var _i5 = 0; _i5 < cellCount; _i5++) { + + this.cells[0].delete(); + } + }; + + Row.prototype.wipe = function () { + + this.deleteCells(); + + while (this.element.firstChild) { + this.element.removeChild(this.element.firstChild); + }this.element = false; + + this.modules = {}; + + if (this.element.parentNode) { + + this.element.parentNode.removeChild(this.element); + } + }; + + Row.prototype.getGroup = function () { + + return this.modules.group || false; + }; + + //////////////// Object Generation ///////////////// + + Row.prototype.getComponent = function () { + + if (!this.component) { + + this.component = new RowComponent(this); + } + + return this.component; + }; + + //public row object + + var CellComponent = function CellComponent(cell) { + + this._cell = cell; + }; + + CellComponent.prototype.getValue = function () { + + return this._cell.getValue(); + }; + + CellComponent.prototype.getOldValue = function () { + + return this._cell.getOldValue(); + }; + + CellComponent.prototype.getElement = function () { + + return this._cell.getElement(); + }; + + CellComponent.prototype.getRow = function () { + + return this._cell.row.getComponent(); + }; + + CellComponent.prototype.getData = function () { + + return this._cell.row.getData(); + }; + + CellComponent.prototype.getField = function () { + + return this._cell.column.getField(); + }; + + CellComponent.prototype.getColumn = function () { + + return this._cell.column.getComponent(); + }; + + CellComponent.prototype.setValue = function (value, mutate) { + + if (typeof mutate == "undefined") { + + mutate = true; + } + + this._cell.setValue(value, mutate); + }; + + CellComponent.prototype.restoreOldValue = function () { + + this._cell.setValueActual(this._cell.getOldValue()); + }; + + CellComponent.prototype.edit = function (force) { + + return this._cell.edit(force); + }; + + CellComponent.prototype.cancelEdit = function () { + + this._cell.cancelEdit(); + }; + + CellComponent.prototype.isEdited = function () { + + return !!this._cell.modules.edit && this._cell.modules.edit.edited; + }; + + CellComponent.prototype.clearEdited = function () { + + if (self.table.modExists("edit", true)) { + + this._cell.table.modules.edit.clearEdited(this._cell); + } + }; + + CellComponent.prototype.isValid = function () { + + return this._cell.modules.validate ? !this._cell.modules.validate.invalid : true; + }; + + CellComponent.prototype.validate = function () { + + return this._cell.validate(); + }; + + CellComponent.prototype.clearValidation = function () { + + if (self.table.modExists("validate", true)) { + + this._cell.table.modules.validate.clearValidation(this._cell); + } + }; + + CellComponent.prototype.nav = function () { + + return this._cell.nav(); + }; + + CellComponent.prototype.checkHeight = function () { + + this._cell.checkHeight(); + }; + + CellComponent.prototype.getTable = function () { + + return this._cell.table; + }; + + CellComponent.prototype._getSelf = function () { + + return this._cell; + }; + + var Cell = function Cell(column, row) { + + this.table = column.table; + + this.column = column; + + this.row = row; + + this.element = null; + + this.value = null; + + this.oldValue = null; + + this.modules = {}; + + this.height = null; + + this.width = null; + + this.minWidth = null; + + this.component = null; + + this.build(); + }; + + //////////////// Setup Functions ///////////////// + + + //generate element + + Cell.prototype.build = function () { + + this.generateElement(); + + this.setWidth(); + + this._configureCell(); + + this.setValueActual(this.column.getFieldValue(this.row.data)); + }; + + Cell.prototype.generateElement = function () { + + this.element = document.createElement('div'); + + this.element.className = "tabulator-cell"; + + this.element.setAttribute("role", "gridcell"); + + this.element = this.element; + }; + + Cell.prototype._configureCell = function () { + + var self = this, + cellEvents = self.column.cellEvents, + element = self.element, + field = this.column.getField(), + vertAligns = { + + top: "flex-start", + + bottom: "flex-end", + + middle: "center" + + }, + hozAligns = { + + left: "flex-start", + + right: "flex-end", + + center: "center" + + }; + + //set text alignment + + element.style.textAlign = self.column.hozAlign; + + if (self.column.vertAlign) { + + element.style.display = "inline-flex"; + + element.style.alignItems = vertAligns[self.column.vertAlign] || ""; + + if (self.column.hozAlign) { + + element.style.justifyContent = hozAligns[self.column.hozAlign] || ""; + } + } + + if (field) { + + element.setAttribute("tabulator-field", field); + } + + //add class to cell if needed + + if (self.column.definition.cssClass) { + + var classNames = self.column.definition.cssClass.split(" "); + + classNames.forEach(function (className) { + + element.classList.add(className); + }); + } + + //update tooltip on mouse enter + + if (this.table.options.tooltipGenerationMode === "hover") { + + element.addEventListener("mouseenter", function (e) { + + self._generateTooltip(); + }); + } + + self._bindClickEvents(cellEvents); + + self._bindTouchEvents(cellEvents); + + self._bindMouseEvents(cellEvents); + + if (self.column.modules.edit) { + + self.table.modules.edit.bindEditor(self); + } + + if (self.column.definition.rowHandle && self.table.options.movableRows !== false && self.table.modExists("moveRow")) { + + self.table.modules.moveRow.initializeCell(self); + } + + //hide cell if not visible + + if (!self.column.visible) { + + self.hide(); + } + }; + + Cell.prototype._bindClickEvents = function (cellEvents) { + + var self = this, + element = self.element; + + //set event bindings + + if (cellEvents.cellClick || self.table.options.cellClick) { + + element.addEventListener("click", function (e) { + + var component = self.getComponent(); + + if (cellEvents.cellClick) { + + cellEvents.cellClick.call(self.table, e, component); + } + + if (self.table.options.cellClick) { + + self.table.options.cellClick.call(self.table, e, component); + } + }); + } + + if (cellEvents.cellDblClick || this.table.options.cellDblClick) { + + element.addEventListener("dblclick", function (e) { + + var component = self.getComponent(); + + if (cellEvents.cellDblClick) { + + cellEvents.cellDblClick.call(self.table, e, component); + } + + if (self.table.options.cellDblClick) { + + self.table.options.cellDblClick.call(self.table, e, component); + } + }); + } else { + + element.addEventListener("dblclick", function (e) { + + if (self.table.modExists("edit")) { + + if (self.table.modules.edit.currentCell === self) { + + return; //prevent instant selection of editor content + } + } + + e.preventDefault(); + + try { + + if (document.selection) { + // IE + + var range = document.body.createTextRange(); + + range.moveToElementText(self.element); + + range.select(); + } else if (window.getSelection) { + + var range = document.createRange(); + + range.selectNode(self.element); + + window.getSelection().removeAllRanges(); + + window.getSelection().addRange(range); + } + } catch (e) {} + }); + } + + if (cellEvents.cellContext || this.table.options.cellContext) { + + element.addEventListener("contextmenu", function (e) { + + var component = self.getComponent(); + + if (cellEvents.cellContext) { + + cellEvents.cellContext.call(self.table, e, component); + } + + if (self.table.options.cellContext) { + + self.table.options.cellContext.call(self.table, e, component); + } + }); + } + }; + + Cell.prototype._bindMouseEvents = function (cellEvents) { + + var self = this, + element = self.element; + + if (cellEvents.cellMouseEnter || self.table.options.cellMouseEnter) { + + element.addEventListener("mouseenter", function (e) { + + var component = self.getComponent(); + + if (cellEvents.cellMouseEnter) { + + cellEvents.cellMouseEnter.call(self.table, e, component); + } + + if (self.table.options.cellMouseEnter) { + + self.table.options.cellMouseEnter.call(self.table, e, component); + } + }); + } + + if (cellEvents.cellMouseLeave || self.table.options.cellMouseLeave) { + + element.addEventListener("mouseleave", function (e) { + + var component = self.getComponent(); + + if (cellEvents.cellMouseLeave) { + + cellEvents.cellMouseLeave.call(self.table, e, component); + } + + if (self.table.options.cellMouseLeave) { + + self.table.options.cellMouseLeave.call(self.table, e, component); + } + }); + } + + if (cellEvents.cellMouseOver || self.table.options.cellMouseOver) { + + element.addEventListener("mouseover", function (e) { + + var component = self.getComponent(); + + if (cellEvents.cellMouseOver) { + + cellEvents.cellMouseOver.call(self.table, e, component); + } + + if (self.table.options.cellMouseOver) { + + self.table.options.cellMouseOver.call(self.table, e, component); + } + }); + } + + if (cellEvents.cellMouseOut || self.table.options.cellMouseOut) { + + element.addEventListener("mouseout", function (e) { + + var component = self.getComponent(); + + if (cellEvents.cellMouseOut) { + + cellEvents.cellMouseOut.call(self.table, e, component); + } + + if (self.table.options.cellMouseOut) { + + self.table.options.cellMouseOut.call(self.table, e, component); + } + }); + } + + if (cellEvents.cellMouseMove || self.table.options.cellMouseMove) { + + element.addEventListener("mousemove", function (e) { + + var component = self.getComponent(); + + if (cellEvents.cellMouseMove) { + + cellEvents.cellMouseMove.call(self.table, e, component); + } + + if (self.table.options.cellMouseMove) { + + self.table.options.cellMouseMove.call(self.table, e, component); + } + }); + } + }; + + Cell.prototype._bindTouchEvents = function (cellEvents) { + + var self = this, + element = self.element, + dblTap, + tapHold, + tap; + + if (cellEvents.cellTap || this.table.options.cellTap) { + + tap = false; + + element.addEventListener("touchstart", function (e) { + + tap = true; + }, { passive: true }); + + element.addEventListener("touchend", function (e) { + + if (tap) { + + var component = self.getComponent(); + + if (cellEvents.cellTap) { + + cellEvents.cellTap.call(self.table, e, component); + } + + if (self.table.options.cellTap) { + + self.table.options.cellTap.call(self.table, e, component); + } + } + + tap = false; + }); + } + + if (cellEvents.cellDblTap || this.table.options.cellDblTap) { + + dblTap = null; + + element.addEventListener("touchend", function (e) { + + if (dblTap) { + + clearTimeout(dblTap); + + dblTap = null; + + var component = self.getComponent(); + + if (cellEvents.cellDblTap) { + + cellEvents.cellDblTap.call(self.table, e, component); + } + + if (self.table.options.cellDblTap) { + + self.table.options.cellDblTap.call(self.table, e, component); + } + } else { + + dblTap = setTimeout(function () { + + clearTimeout(dblTap); + + dblTap = null; + }, 300); + } + }); + } + + if (cellEvents.cellTapHold || this.table.options.cellTapHold) { + + tapHold = null; + + element.addEventListener("touchstart", function (e) { + + clearTimeout(tapHold); + + tapHold = setTimeout(function () { + + clearTimeout(tapHold); + + tapHold = null; + + tap = false; + + var component = self.getComponent(); + + if (cellEvents.cellTapHold) { + + cellEvents.cellTapHold.call(self.table, e, component); + } + + if (self.table.options.cellTapHold) { + + self.table.options.cellTapHold.call(self.table, e, component); + } + }, 1000); + }, { passive: true }); + + element.addEventListener("touchend", function (e) { + + clearTimeout(tapHold); + + tapHold = null; + }); + } + }; + + //generate cell contents + + Cell.prototype._generateContents = function () { + + var val; + + if (this.table.modExists("format")) { + + val = this.table.modules.format.formatValue(this); + } else { + + val = this.element.innerHTML = this.value; + } + + switch (typeof val === 'undefined' ? 'undefined' : _typeof(val)) { + + case "object": + + if (val instanceof Node) { + + //clear previous cell contents + + while (this.element.firstChild) { + this.element.removeChild(this.element.firstChild); + }this.element.appendChild(val); + } else { + + this.element.innerHTML = ""; + + if (val != null) { + + console.warn("Format Error - Formatter has returned a type of object, the only valid formatter object return is an instance of Node, the formatter returned:", val); + } + } + + break; + + case "undefined": + + case "null": + + this.element.innerHTML = ""; + + break; + + default: + + this.element.innerHTML = val; + + } + }; + + Cell.prototype.cellRendered = function () { + + if (this.table.modExists("format") && this.table.modules.format.cellRendered) { + + this.table.modules.format.cellRendered(this); + } + }; + + //generate tooltip text + + Cell.prototype._generateTooltip = function () { + + var tooltip = this.column.tooltip; + + if (tooltip) { + + if (tooltip === true) { + + tooltip = this.value; + } else if (typeof tooltip == "function") { + + tooltip = tooltip(this.getComponent()); + + if (tooltip === false) { + + tooltip = ""; + } + } + + if (typeof tooltip === "undefined") { + + tooltip = ""; + } + + this.element.setAttribute("title", tooltip); + } else { + + this.element.setAttribute("title", ""); + } + }; + + //////////////////// Getters //////////////////// + + Cell.prototype.getElement = function () { + + return this.element; + }; + + Cell.prototype.getValue = function () { + + return this.value; + }; + + Cell.prototype.getOldValue = function () { + + return this.oldValue; + }; + + //////////////////// Actions //////////////////// + + + Cell.prototype.setValue = function (value, mutate) { + + var changed = this.setValueProcessData(value, mutate), + component; + + if (changed) { + + if (this.table.options.history && this.table.modExists("history")) { + + this.table.modules.history.action("cellEdit", this, { oldValue: this.oldValue, newValue: this.value }); + } + + component = this.getComponent(); + + if (this.column.cellEvents.cellEdited) { + + this.column.cellEvents.cellEdited.call(this.table, component); + } + + this.cellRendered(); + + this.table.options.cellEdited.call(this.table, component); + + this.table.options.dataEdited.call(this.table, this.table.rowManager.getData()); + } + }; + + Cell.prototype.setValueProcessData = function (value, mutate) { + + var changed = false; + + if (this.value != value) { + + changed = true; + + if (mutate) { + + if (this.column.modules.mutate) { + + value = this.table.modules.mutator.transformCell(this, value); + } + } + } + + this.setValueActual(value); + + if (changed && this.table.modExists("columnCalcs")) { + + if (this.column.definition.topCalc || this.column.definition.bottomCalc) { + + if (this.table.options.groupBy && this.table.modExists("groupRows")) { + + if (this.table.options.columnCalcs == "table" || this.table.options.columnCalcs == "both") { + + this.table.modules.columnCalcs.recalc(this.table.rowManager.activeRows); + } + + if (this.table.options.columnCalcs != "table") { + + this.table.modules.columnCalcs.recalcRowGroup(this.row); + } + } else { + + this.table.modules.columnCalcs.recalc(this.table.rowManager.activeRows); + } + } + } + + return changed; + }; + + Cell.prototype.setValueActual = function (value) { + + this.oldValue = this.value; + + this.value = value; + + if (this.table.options.reactiveData && this.table.modExists("reactiveData")) { + + this.table.modules.reactiveData.block(); + } + + this.column.setFieldValue(this.row.data, value); + + if (this.table.options.reactiveData && this.table.modExists("reactiveData")) { + + this.table.modules.reactiveData.unblock(); + } + + this._generateContents(); + + this._generateTooltip(); + + //set resizable handles + + if (this.table.options.resizableColumns && this.table.modExists("resizeColumns")) { + + this.table.modules.resizeColumns.initializeColumn("cell", this.column, this.element); + } + + //set column menu + + if (this.column.definition.contextMenu && this.table.modExists("menu")) { + + this.table.modules.menu.initializeCell(this); + } + + //handle frozen cells + + if (this.table.modExists("frozenColumns")) { + + this.table.modules.frozenColumns.layoutElement(this.element, this.column); + } + }; + + Cell.prototype.setWidth = function () { + + this.width = this.column.width; + + this.element.style.width = this.column.widthStyled; + }; + + Cell.prototype.clearWidth = function () { + + this.width = ""; + + this.element.style.width = ""; + }; + + Cell.prototype.getWidth = function () { + + return this.width || this.element.offsetWidth; + }; + + Cell.prototype.setMinWidth = function () { + + this.minWidth = this.column.minWidth; + + this.element.style.minWidth = this.column.minWidthStyled; + }; + + Cell.prototype.checkHeight = function () { + + // var height = this.element.css("height"); + + this.row.reinitializeHeight(); + }; + + Cell.prototype.clearHeight = function () { + + this.element.style.height = ""; + + this.height = null; + }; + + Cell.prototype.setHeight = function () { + + this.height = this.row.height; + + this.element.style.height = this.row.heightStyled; + }; + + Cell.prototype.getHeight = function () { + + return this.height || this.element.offsetHeight; + }; + + Cell.prototype.show = function () { + + this.element.style.display = ""; + }; + + Cell.prototype.hide = function () { + + this.element.style.display = "none"; + }; + + Cell.prototype.edit = function (force) { + + if (this.table.modExists("edit", true)) { + + return this.table.modules.edit.editCell(this, force); + } + }; + + Cell.prototype.cancelEdit = function () { + + if (this.table.modExists("edit", true)) { + + var editing = this.table.modules.edit.getCurrentCell(); + + if (editing && editing._getSelf() === this) { + + this.table.modules.edit.cancelEdit(); + } else { + + console.warn("Cancel Editor Error - This cell is not currently being edited "); + } + } + }; + + Cell.prototype.validate = function () { + + if (this.column.modules.validate && this.table.modExists("validate", true)) { + + var valid = this.table.modules.validate.validate(this.column.modules.validate, this, this.getValue()); + + return valid === true; + } else { + + return true; + } + }; + + Cell.prototype.delete = function () { + + if (!this.table.rowManager.redrawBlock) { + + this.element.parentNode.removeChild(this.element); + } + + if (this.modules.validate && this.modules.validate.invalid) { + + this.table.modules.validate.clearValidation(this); + } + + if (this.modules.edit && this.modules.edit.edited) { + + this.table.modules.edit.clearEdited(this); + } + + this.element = false; + + this.column.deleteCell(this); + + this.row.deleteCell(this); + + this.calcs = {}; + }; + + //////////////// Navigation ///////////////// + + + Cell.prototype.nav = function () { + + var self = this, + nextCell = false, + index = this.row.getCellIndex(this); + + return { + + next: function next() { + + var nextCell = this.right(), + nextRow; + + if (!nextCell) { + + nextRow = self.table.rowManager.nextDisplayRow(self.row, true); + + if (nextRow) { + + nextCell = nextRow.findNextEditableCell(-1); + + if (nextCell) { + + nextCell.edit(); + + return true; + } + } + } else { + + return true; + } + + return false; + }, + + prev: function prev() { + + var nextCell = this.left(), + prevRow; + + if (!nextCell) { + + prevRow = self.table.rowManager.prevDisplayRow(self.row, true); + + if (prevRow) { + + nextCell = prevRow.findPrevEditableCell(prevRow.cells.length); + + if (nextCell) { + + nextCell.edit(); + + return true; + } + } + } else { + + return true; + } + + return false; + }, + + left: function left() { + + nextCell = self.row.findPrevEditableCell(index); + + if (nextCell) { + + nextCell.edit(); + + return true; + } else { + + return false; + } + }, + + right: function right() { + + nextCell = self.row.findNextEditableCell(index); + + if (nextCell) { + + nextCell.edit(); + + return true; + } else { + + return false; + } + }, + + up: function up() { + + var nextRow = self.table.rowManager.prevDisplayRow(self.row, true); + + if (nextRow) { + + nextRow.cells[index].edit(); + } + }, + + down: function down() { + + var nextRow = self.table.rowManager.nextDisplayRow(self.row, true); + + if (nextRow) { + + nextRow.cells[index].edit(); + } + } + + }; + }; + + Cell.prototype.getIndex = function () { + + this.row.getCellIndex(this); + }; + + //////////////// Object Generation ///////////////// + + Cell.prototype.getComponent = function () { + + if (!this.component) { + + this.component = new CellComponent(this); + } + + return this.component; + }; + + var FooterManager = function FooterManager(table) { + + this.table = table; + + this.active = false; + + this.element = this.createElement(); //containing element + + this.external = false; + + this.links = []; + + this._initialize(); + }; + + FooterManager.prototype.createElement = function () { + + var el = document.createElement("div"); + + el.classList.add("tabulator-footer"); + + return el; + }; + + FooterManager.prototype._initialize = function (element) { + + if (this.table.options.footerElement) { + + switch (_typeof(this.table.options.footerElement)) { + + case "string": + + if (this.table.options.footerElement[0] === "<") { + + this.element.innerHTML = this.table.options.footerElement; + } else { + + this.external = true; + + this.element = document.querySelector(this.table.options.footerElement); + } + + break; + + default: + + this.element = this.table.options.footerElement; + + break; + + } + } + }; + + FooterManager.prototype.getElement = function () { + + return this.element; + }; + + FooterManager.prototype.append = function (element, parent) { + + this.activate(parent); + + this.element.appendChild(element); + + this.table.rowManager.adjustTableSize(); + }; + + FooterManager.prototype.prepend = function (element, parent) { + + this.activate(parent); + + this.element.insertBefore(element, this.element.firstChild); + + this.table.rowManager.adjustTableSize(); + }; + + FooterManager.prototype.remove = function (element) { + + element.parentNode.removeChild(element); + + this.deactivate(); + }; + + FooterManager.prototype.deactivate = function (force) { + + if (!this.element.firstChild || force) { + + if (!this.external) { + + this.element.parentNode.removeChild(this.element); + } + + this.active = false; + } + + // this.table.rowManager.adjustTableSize(); + }; + + FooterManager.prototype.activate = function (parent) { + + if (!this.active) { + + this.active = true; + + if (!this.external) { + + this.table.element.appendChild(this.getElement()); + + this.table.element.style.display = ''; + } + } + + if (parent) { + + this.links.push(parent); + } + }; + + FooterManager.prototype.redraw = function () { + + this.links.forEach(function (link) { + + link.footerRedraw(); + }); + }; + + var Tabulator = function Tabulator(element, options) { + + this.options = {}; + + this.columnManager = null; // hold Column Manager + + this.rowManager = null; //hold Row Manager + + this.footerManager = null; //holder Footer Manager + + this.browser = ""; //hold current browser type + + this.browserSlow = false; //handle reduced functionality for slower browsers + + this.browserMobile = false; //check if running on moble, prevent resize cancelling edit on keyboard appearence + + + this.modules = {}; //hold all modules bound to this table + + + this.initializeElement(element); + + this.initializeOptions(options || {}); + + this._create(); + + Tabulator.prototype.comms.register(this); //register table for inderdevice communication + }; + + //default setup options + + Tabulator.prototype.defaultOptions = { + + height: false, //height of tabulator + + minHeight: false, //minimum height of tabulator + + maxHeight: false, //maximum height of tabulator + + + layout: "fitData", ///layout type "fitColumns" | "fitData" + + layoutColumnsOnNewData: false, //update column widths on setData + + + columnMinWidth: 40, //minimum global width for a column + + columnHeaderVertAlign: "top", //vertical alignment of column headers + + columnVertAlign: false, // DEPRECATED - Left to allow warning + + + resizableColumns: true, //resizable columns + + resizableRows: false, //resizable rows + + autoResize: true, //auto resize table + + + columns: [], //store for colum header info + + + cellHozAlign: "", //horizontal align columns + + cellVertAlign: "", //certical align columns + + + data: [], //default starting data + + + autoColumns: false, //build columns from data row structure + + + reactiveData: false, //enable data reactivity + + + nestedFieldSeparator: ".", //seperatpr for nested data + + + tooltips: false, //Tool tip value + + tooltipsHeader: false, //Tool tip for headers + + tooltipGenerationMode: "load", //when to generate tooltips + + + initialSort: false, //initial sorting criteria + + initialFilter: false, //initial filtering criteria + + initialHeaderFilter: false, //initial header filtering criteria + + + columnHeaderSortMulti: true, //multiple or single column sorting + + + sortOrderReverse: false, //reverse internal sort ordering + + + headerSort: true, //set default global header sort + + headerSortTristate: false, //set default tristate header sorting + + + footerElement: false, //hold footer element + + + index: "id", //filed for row index + + + keybindings: [], //array for keybindings + + + tabEndNewRow: false, //create new row when tab to end of table + + + invalidOptionWarnings: true, //allow toggling of invalid option warnings + + + clipboard: false, //enable clipboard + + clipboardCopyStyled: true, //formatted table data + + clipboardCopyConfig: false, //clipboard config + + clipboardCopyFormatter: false, //DEPRICATED - REMOVE in 5.0 + + clipboardCopyRowRange: "active", //restrict clipboard to visible rows only + + clipboardPasteParser: "table", //convert pasted clipboard data to rows + + clipboardPasteAction: "insert", //how to insert pasted data into the table + + + clipboardCopied: function clipboardCopied() {}, //data has been copied to the clipboard + + clipboardPasted: function clipboardPasted() {}, //data has been pasted into the table + + clipboardPasteError: function clipboardPasteError() {}, //data has not successfully been pasted into the table + + + downloadDataFormatter: false, //function to manipulate table data before it is downloaded + + downloadReady: function downloadReady(data, blob) { + return blob; + }, //function to manipulate download data + + downloadComplete: false, //function to manipulate download data + + downloadConfig: {}, //download config + + downloadRowRange: "active", //restrict download to active rows only + + + dataTree: false, //enable data tree + + dataTreeElementColumn: false, + + dataTreeBranchElement: true, //show data tree branch element + + dataTreeChildIndent: 9, //data tree child indent in px + + dataTreeChildField: "_children", //data tre column field to look for child rows + + dataTreeCollapseElement: false, //data tree row collapse element + + dataTreeExpandElement: false, //data tree row expand element + + dataTreeStartExpanded: false, + + dataTreeRowExpanded: function dataTreeRowExpanded() {}, //row has been expanded + + dataTreeRowCollapsed: function dataTreeRowCollapsed() {}, //row has been collapsed + + dataTreeChildColumnCalcs: false, //include visible data tree rows in column calculations + + dataTreeSelectPropagate: false, //seleccting a parent row selects its children + + + printAsHtml: false, //enable print as html + + printFormatter: false, //printing page formatter + + printHeader: false, //page header contents + + printFooter: false, //page footer contents + + printCopyStyle: true, //DEPRICATED - REMOVE in 5.0 + + printStyled: true, //enable print as html styling + + printVisibleRows: true, //DEPRICATED - REMOVE in 5.0 + + printRowRange: "visible", //restrict print to visible rows only + + printConfig: {}, //print config options + + + addRowPos: "bottom", //position to insert blank rows, top|bottom + + + selectable: "highlight", //highlight rows on hover + + selectableRangeMode: "drag", //highlight rows on hover + + selectableRollingSelection: true, //roll selection once maximum number of selectable rows is reached + + selectablePersistence: true, // maintain selection when table view is updated + + selectableCheck: function selectableCheck(data, row) { + return true; + }, //check wheather row is selectable + + + headerFilterLiveFilterDelay: 300, //delay before updating column after user types in header filter + + headerFilterPlaceholder: false, //placeholder text to display in header filters + + + headerVisible: true, //hide header + + + history: false, //enable edit history + + + locale: false, //current system language + + langs: {}, + + virtualDom: true, //enable DOM virtualization + + virtualDomBuffer: 0, // set virtual DOM buffer size + + + persistentLayout: false, //DEPRICATED - REMOVE in 5.0 + + persistentSort: false, //DEPRICATED - REMOVE in 5.0 + + persistentFilter: false, //DEPRICATED - REMOVE in 5.0 + + persistenceID: "", //key for persistent storage + + persistenceMode: true, //mode for storing persistence information + + persistenceReaderFunc: false, //function for handling persistence data reading + + persistenceWriterFunc: false, //function for handling persistence data writing + + + persistence: false, + + responsiveLayout: false, //responsive layout flags + + responsiveLayoutCollapseStartOpen: true, //start showing collapsed data + + responsiveLayoutCollapseUseFormatters: true, //responsive layout collapse formatter + + responsiveLayoutCollapseFormatter: false, //responsive layout collapse formatter + + + pagination: false, //set pagination type + + paginationSize: false, //set number of rows to a page + + paginationInitialPage: 1, //initail page to show on load + + paginationButtonCount: 5, // set count of page button + + paginationSizeSelector: false, //add pagination size selector element + + paginationElement: false, //element to hold pagination numbers + + paginationDataSent: {}, //pagination data sent to the server + + paginationDataReceived: {}, //pagination data received from the server + + paginationAddRow: "page", //add rows on table or page + + + ajaxURL: false, //url for ajax loading + + ajaxURLGenerator: false, + + ajaxParams: {}, //params for ajax loading + + ajaxConfig: "get", //ajax request type + + ajaxContentType: "form", //ajax request type + + ajaxRequestFunc: false, //promise function + + ajaxLoader: true, //show loader + + ajaxLoaderLoading: false, //loader element + + ajaxLoaderError: false, //loader element + + ajaxFiltering: false, + + ajaxSorting: false, + + ajaxProgressiveLoad: false, //progressive loading + + ajaxProgressiveLoadDelay: 0, //delay between requests + + ajaxProgressiveLoadScrollMargin: 0, //margin before scroll begins + + + groupBy: false, //enable table grouping and set field to group by + + groupStartOpen: true, //starting state of group + + groupValues: false, + + groupHeader: false, //header generation function + + groupHeaderPrint: null, + + groupHeaderClipboard: null, + + groupHeaderHtmlOutput: null, + + groupHeaderDownload: null, + + htmlOutputConfig: false, //html outypu config + + + movableColumns: false, //enable movable columns + + + movableRows: false, //enable movable rows + + movableRowsConnectedTables: false, //tables for movable rows to be connected to + + movableRowsConnectedElements: false, //other elements for movable rows to be connected to + + movableRowsSender: false, + + movableRowsReceiver: "insert", + + movableRowsSendingStart: function movableRowsSendingStart() {}, + + movableRowsSent: function movableRowsSent() {}, + + movableRowsSentFailed: function movableRowsSentFailed() {}, + + movableRowsSendingStop: function movableRowsSendingStop() {}, + + movableRowsReceivingStart: function movableRowsReceivingStart() {}, + + movableRowsReceived: function movableRowsReceived() {}, + + movableRowsReceivedFailed: function movableRowsReceivedFailed() {}, + + movableRowsReceivingStop: function movableRowsReceivingStop() {}, + + movableRowsElementDrop: function movableRowsElementDrop() {}, + + scrollToRowPosition: "top", + + scrollToRowIfVisible: true, + + scrollToColumnPosition: "left", + + scrollToColumnIfVisible: true, + + rowFormatter: false, + + rowFormatterPrint: null, + + rowFormatterClipboard: null, + + rowFormatterHtmlOutput: null, + + placeholder: false, + + //table building callbacks + + tableBuilding: function tableBuilding() {}, + + tableBuilt: function tableBuilt() {}, + + //render callbacks + + renderStarted: function renderStarted() {}, + + renderComplete: function renderComplete() {}, + + //row callbacks + + rowClick: false, + + rowDblClick: false, + + rowContext: false, + + rowTap: false, + + rowDblTap: false, + + rowTapHold: false, + + rowMouseEnter: false, + + rowMouseLeave: false, + + rowMouseOver: false, + + rowMouseOut: false, + + rowMouseMove: false, + + rowContextMenu: false, + + rowAdded: function rowAdded() {}, + + rowDeleted: function rowDeleted() {}, + + rowMoved: function rowMoved() {}, + + rowUpdated: function rowUpdated() {}, + + rowSelectionChanged: function rowSelectionChanged() {}, + + rowSelected: function rowSelected() {}, + + rowDeselected: function rowDeselected() {}, + + rowResized: function rowResized() {}, + + //cell callbacks + + //row callbacks + + cellClick: false, + + cellDblClick: false, + + cellContext: false, + + cellTap: false, + + cellDblTap: false, + + cellTapHold: false, + + cellMouseEnter: false, + + cellMouseLeave: false, + + cellMouseOver: false, + + cellMouseOut: false, + + cellMouseMove: false, + + cellEditing: function cellEditing() {}, + + cellEdited: function cellEdited() {}, + + cellEditCancelled: function cellEditCancelled() {}, + + //column callbacks + + columnMoved: false, + + columnResized: function columnResized() {}, + + columnTitleChanged: function columnTitleChanged() {}, + + columnVisibilityChanged: function columnVisibilityChanged() {}, + + //HTML iport callbacks + + htmlImporting: function htmlImporting() {}, + + htmlImported: function htmlImported() {}, + + //data callbacks + + dataLoading: function dataLoading() {}, + + dataLoaded: function dataLoaded() {}, + + dataEdited: function dataEdited() {}, + + //ajax callbacks + + ajaxRequesting: function ajaxRequesting() {}, + + ajaxResponse: false, + + ajaxError: function ajaxError() {}, + + //filtering callbacks + + dataFiltering: false, + + dataFiltered: false, + + //sorting callbacks + + dataSorting: function dataSorting() {}, + + dataSorted: function dataSorted() {}, + + //grouping callbacks + + groupToggleElement: "arrow", + + groupClosedShowCalcs: false, + + dataGrouping: function dataGrouping() {}, + + dataGrouped: false, + + groupVisibilityChanged: function groupVisibilityChanged() {}, + + groupClick: false, + + groupDblClick: false, + + groupContext: false, + + groupContextMenu: false, + + groupTap: false, + + groupDblTap: false, + + groupTapHold: false, + + columnCalcs: true, + + //pagination callbacks + + pageLoaded: function pageLoaded() {}, + + //localization callbacks + + localized: function localized() {}, + + //validation callbacks + + validationMode: "blocking", + + validationFailed: function validationFailed() {}, + + //history callbacks + + historyUndo: function historyUndo() {}, + + historyRedo: function historyRedo() {}, + + //scroll callbacks + + scrollHorizontal: function scrollHorizontal() {}, + + scrollVertical: function scrollVertical() {} + + }; + + Tabulator.prototype.initializeOptions = function (options) { + + //warn user if option is not available + + if (options.invalidOptionWarnings !== false) { + + for (var key in options) { + + if (typeof this.defaultOptions[key] === "undefined") { + + console.warn("Invalid table constructor option:", key); + } + } + } + + //assign options to table + + for (var key in this.defaultOptions) { + + if (key in options) { + + this.options[key] = options[key]; + } else { + + if (Array.isArray(this.defaultOptions[key])) { + + this.options[key] = []; + } else if (_typeof(this.defaultOptions[key]) === "object" && this.defaultOptions[key] !== null) { + + this.options[key] = {}; + } else { + + this.options[key] = this.defaultOptions[key]; + } + } + } + }; + + Tabulator.prototype.initializeElement = function (element) { + + if (typeof HTMLElement !== "undefined" && element instanceof HTMLElement) { + + this.element = element; + + return true; + } else if (typeof element === "string") { + + this.element = document.querySelector(element); + + if (this.element) { + + return true; + } else { + + console.error("Tabulator Creation Error - no element found matching selector: ", element); + + return false; + } + } else { + + console.error("Tabulator Creation Error - Invalid element provided:", element); + + return false; + } + }; + + //convert depricated functionality to new functions + + Tabulator.prototype._mapDepricatedFunctionality = function () { + + //map depricated persistance setup options + + if (this.options.persistentLayout || this.options.persistentSort || this.options.persistentFilter) { + + if (!this.options.persistence) { + + this.options.persistence = {}; + } + } + + if (this.options.downloadDataFormatter) { + + console.warn("DEPRECATION WARNING - downloadDataFormatter option has been deprecated"); + } + + if (typeof this.options.clipboardCopyHeader !== "undefined") { + + this.options.columnHeaders = this.options.clipboardCopyHeader; + + console.warn("DEPRECATION WARNING - clipboardCopyHeader option has been deprecated, please use the columnHeaders property on the clipboardCopyConfig option"); + } + + if (this.options.printVisibleRows !== true) { + + console.warn("printVisibleRows option is deprecated, you should now use the printRowRange option"); + + this.options.persistence.printRowRange = "active"; + } + + if (this.options.printCopyStyle !== true) { + + console.warn("printCopyStyle option is deprecated, you should now use the printStyled option"); + + this.options.persistence.printStyled = this.options.printCopyStyle; + } + + if (this.options.persistentLayout) { + + console.warn("persistentLayout option is deprecated, you should now use the persistence option"); + + if (this.options.persistence !== true && typeof this.options.persistence.columns === "undefined") { + + this.options.persistence.columns = true; + } + } + + if (this.options.persistentSort) { + + console.warn("persistentSort option is deprecated, you should now use the persistence option"); + + if (this.options.persistence !== true && typeof this.options.persistence.sort === "undefined") { + + this.options.persistence.sort = true; + } + } + + if (this.options.persistentFilter) { + + console.warn("persistentFilter option is deprecated, you should now use the persistence option"); + + if (this.options.persistence !== true && typeof this.options.persistence.filter === "undefined") { + + this.options.persistence.filter = true; + } + } + + if (this.options.columnVertAlign) { + + console.warn("columnVertAlign option is deprecated, you should now use the columnHeaderVertAlign option"); + + this.options.columnHeaderVertAlign = this.options.columnVertAlign; + } + }; + + Tabulator.prototype._clearSelection = function () { + + this.element.classList.add("tabulator-block-select"); + + if (window.getSelection) { + + if (window.getSelection().empty) { + // Chrome + + window.getSelection().empty(); + } else if (window.getSelection().removeAllRanges) { + // Firefox + + window.getSelection().removeAllRanges(); + } + } else if (document.selection) { + // IE? + + document.selection.empty(); + } + + this.element.classList.remove("tabulator-block-select"); + }; + + //concreate table + + Tabulator.prototype._create = function () { + + this._clearObjectPointers(); + + this._mapDepricatedFunctionality(); + + this.bindModules(); + + if (this.element.tagName === "TABLE") { + + if (this.modExists("htmlTableImport", true)) { + + this.modules.htmlTableImport.parseTable(); + } + } + + this.columnManager = new ColumnManager(this); + + this.rowManager = new RowManager(this); + + this.footerManager = new FooterManager(this); + + this.columnManager.setRowManager(this.rowManager); + + this.rowManager.setColumnManager(this.columnManager); + + this._buildElement(); + + this._loadInitialData(); + }; + + //clear pointers to objects in default config object + + Tabulator.prototype._clearObjectPointers = function () { + + this.options.columns = this.options.columns.slice(0); + + if (!this.options.reactiveData) { + + this.options.data = this.options.data.slice(0); + } + }; + + //build tabulator element + + Tabulator.prototype._buildElement = function () { + var _this17 = this; + + var element = this.element, + mod = this.modules, + options = this.options; + + options.tableBuilding.call(this); + + element.classList.add("tabulator"); + + element.setAttribute("role", "grid"); + + //empty element + + while (element.firstChild) { + element.removeChild(element.firstChild); + } //set table height + + if (options.height) { + + options.height = isNaN(options.height) ? options.height : options.height + "px"; + + element.style.height = options.height; + } + + //set table min height + + if (options.minHeight !== false) { + + options.minHeight = isNaN(options.minHeight) ? options.minHeight : options.minHeight + "px"; + + element.style.minHeight = options.minHeight; + } + + //set table maxHeight + + if (options.maxHeight !== false) { + + options.maxHeight = isNaN(options.maxHeight) ? options.maxHeight : options.maxHeight + "px"; + + element.style.maxHeight = options.maxHeight; + } + + this.columnManager.initialize(); + + this.rowManager.initialize(); + + this._detectBrowser(); + + if (this.modExists("layout", true)) { + + mod.layout.initialize(options.layout); + } + + //set localization + + if (options.headerFilterPlaceholder !== false) { + + mod.localize.setHeaderFilterPlaceholder(options.headerFilterPlaceholder); + } + + for (var locale in options.langs) { + + mod.localize.installLang(locale, options.langs[locale]); + } + + mod.localize.setLocale(options.locale); + + //configure placeholder element + + if (typeof options.placeholder == "string") { + + var el = document.createElement("div"); + + el.classList.add("tabulator-placeholder"); + + var span = document.createElement("span"); + + span.innerHTML = options.placeholder; + + el.appendChild(span); + + options.placeholder = el; + } + + //build table elements + + element.appendChild(this.columnManager.getElement()); + + element.appendChild(this.rowManager.getElement()); + + if (options.footerElement) { + + this.footerManager.activate(); + } + + if (options.persistence && this.modExists("persistence", true)) { + + mod.persistence.initialize(); + } + + if (options.persistence && this.modExists("persistence", true) && mod.persistence.config.columns) { + + options.columns = mod.persistence.load("columns", options.columns); + } + + if (options.movableRows && this.modExists("moveRow")) { + + mod.moveRow.initialize(); + } + + if (options.autoColumns && this.options.data) { + + this.columnManager.generateColumnsFromRowData(this.options.data); + } + + if (this.modExists("columnCalcs")) { + + mod.columnCalcs.initialize(); + } + + this.columnManager.setColumns(options.columns); + + if (options.dataTree && this.modExists("dataTree", true)) { + + mod.dataTree.initialize(); + } + + if (this.modExists("frozenRows")) { + + this.modules.frozenRows.initialize(); + } + + if ((options.persistence && this.modExists("persistence", true) && mod.persistence.config.sort || options.initialSort) && this.modExists("sort", true)) { + + var sorters = []; + + if (options.persistence && this.modExists("persistence", true) && mod.persistence.config.sort) { + + sorters = mod.persistence.load("sort"); + + if (sorters === false && options.initialSort) { + + sorters = options.initialSort; + } + } else if (options.initialSort) { + + sorters = options.initialSort; + } + + mod.sort.setSort(sorters); + } + + if ((options.persistence && this.modExists("persistence", true) && mod.persistence.config.filter || options.initialFilter) && this.modExists("filter", true)) { + + var filters = []; + + if (options.persistence && this.modExists("persistence", true) && mod.persistence.config.filter) { + + filters = mod.persistence.load("filter"); + + if (filters === false && options.initialFilter) { + + filters = options.initialFilter; + } + } else if (options.initialFilter) { + + filters = options.initialFilter; + } + + mod.filter.setFilter(filters); + } + + if (options.initialHeaderFilter && this.modExists("filter", true)) { + + options.initialHeaderFilter.forEach(function (item) { + + var column = _this17.columnManager.findColumn(item.field); + + if (column) { + + mod.filter.setHeaderFilterValue(column, item.value); + } else { + + console.warn("Column Filter Error - No matching column found:", item.field); + + return false; + } + }); + } + + if (this.modExists("ajax")) { + + mod.ajax.initialize(); + } + + if (options.pagination && this.modExists("page", true)) { + + mod.page.initialize(); + } + + if (options.groupBy && this.modExists("groupRows", true)) { + + mod.groupRows.initialize(); + } + + if (this.modExists("keybindings")) { + + mod.keybindings.initialize(); + } + + if (this.modExists("selectRow")) { + + mod.selectRow.clearSelectionData(true); + } + + if (options.autoResize && this.modExists("resizeTable")) { + + mod.resizeTable.initialize(); + } + + if (this.modExists("clipboard")) { + + mod.clipboard.initialize(); + } + + if (options.printAsHtml && this.modExists("print")) { + + mod.print.initialize(); + } + + options.tableBuilt.call(this); + }; + + Tabulator.prototype._loadInitialData = function () { + + var self = this; + + if (self.options.pagination && self.modExists("page")) { + + self.modules.page.reset(true, true); + + if (self.options.pagination == "local") { + + if (self.options.data.length) { + + self.rowManager.setData(self.options.data, false, true); + } else { + + if ((self.options.ajaxURL || self.options.ajaxURLGenerator) && self.modExists("ajax")) { + + self.modules.ajax.loadData(false, true).then(function () {}).catch(function () { + + if (self.options.paginationInitialPage) { + + self.modules.page.setPage(self.options.paginationInitialPage); + } + }); + + return; + } else { + + self.rowManager.setData(self.options.data, false, true); + } + } + + if (self.options.paginationInitialPage) { + + self.modules.page.setPage(self.options.paginationInitialPage); + } + } else { + + if (self.options.ajaxURL) { + + self.modules.page.setPage(self.options.paginationInitialPage).then(function () {}).catch(function () {}); + } else { + + self.rowManager.setData([], false, true); + } + } + } else { + + if (self.options.data.length) { + + self.rowManager.setData(self.options.data); + } else { + + if ((self.options.ajaxURL || self.options.ajaxURLGenerator) && self.modExists("ajax")) { + + self.modules.ajax.loadData(false, true).then(function () {}).catch(function () {}); + } else { + + self.rowManager.setData(self.options.data, false, true); + } + } + } + }; + + //deconstructor + + Tabulator.prototype.destroy = function () { + + var element = this.element; + + Tabulator.prototype.comms.deregister(this); //deregister table from inderdevice communication + + + if (this.options.reactiveData && this.modExists("reactiveData", true)) { + + this.modules.reactiveData.unwatchData(); + } + + //clear row data + + this.rowManager.rows.forEach(function (row) { + + row.wipe(); + }); + + this.rowManager.rows = []; + + this.rowManager.activeRows = []; + + this.rowManager.displayRows = []; + + //clear event bindings + + if (this.options.autoResize && this.modExists("resizeTable")) { + + this.modules.resizeTable.clearBindings(); + } + + if (this.modExists("keybindings")) { + + this.modules.keybindings.clearBindings(); + } + + //clear DOM + + while (element.firstChild) { + element.removeChild(element.firstChild); + }element.classList.remove("tabulator"); + }; + + Tabulator.prototype._detectBrowser = function () { + + var ua = navigator.userAgent || navigator.vendor || window.opera; + + if (ua.indexOf("Trident") > -1) { + + this.browser = "ie"; + + this.browserSlow = true; + } else if (ua.indexOf("Edge") > -1) { + + this.browser = "edge"; + + this.browserSlow = true; + } else if (ua.indexOf("Firefox") > -1) { + + this.browser = "firefox"; + + this.browserSlow = false; + } else { + + this.browser = "other"; + + this.browserSlow = false; + } + + this.browserMobile = /(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino|android|ipad|playbook|silk/i.test(ua) || /1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(ua.substr(0, 4)); + }; + + ////////////////// Data Handling ////////////////// + + + //block table redrawing + + Tabulator.prototype.blockRedraw = function () { + + return this.rowManager.blockRedraw(); + }; + + //restore table redrawing + + Tabulator.prototype.restoreRedraw = function () { + + return this.rowManager.restoreRedraw(); + }; + + //local data from local file + + Tabulator.prototype.setDataFromLocalFile = function (extensions) { + var _this18 = this; + + return new Promise(function (resolve, reject) { + + var input = document.createElement("input"); + + input.type = "file"; + + input.accept = extensions || ".json,application/json"; + + input.addEventListener("change", function (e) { + + var file = input.files[0], + reader = new FileReader(), + data; + + reader.readAsText(file); + + reader.onload = function (e) { + + try { + + data = JSON.parse(reader.result); + } catch (e) { + + console.warn("File Load Error - File contents is invalid JSON", e); + + reject(e); + + return; + } + + _this18._setData(data).then(function (data) { + + resolve(data); + }).catch(function (err) { + + resolve(err); + }); + }; + + reader.onerror = function (e) { + + console.warn("File Load Error - Unable to read file"); + + reject(); + }; + }); + + input.click(); + }); + }; + + //load data + + Tabulator.prototype.setData = function (data, params, config) { + + if (this.modExists("ajax")) { + + this.modules.ajax.blockActiveRequest(); + } + + return this._setData(data, params, config, false, true); + }; + + Tabulator.prototype._setData = function (data, params, config, inPosition, columnsChanged) { + + var self = this; + + if (typeof data === "string") { + + if (data.indexOf("{") == 0 || data.indexOf("[") == 0) { + + //data is a json encoded string + + return self.rowManager.setData(JSON.parse(data), inPosition, columnsChanged); + } else { + + if (self.modExists("ajax", true)) { + + if (params) { + + self.modules.ajax.setParams(params); + } + + if (config) { + + self.modules.ajax.setConfig(config); + } + + self.modules.ajax.setUrl(data); + + if (self.options.pagination == "remote" && self.modExists("page", true)) { + + self.modules.page.reset(true, true); + + return self.modules.page.setPage(1); + } else { + + //assume data is url, make ajax call to url to get data + + return self.modules.ajax.loadData(inPosition, columnsChanged); + } + } + } + } else { + + if (data) { + + //asume data is already an object + + return self.rowManager.setData(data, inPosition, columnsChanged); + } else { + + //no data provided, check if ajaxURL is present; + + if (self.modExists("ajax") && (self.modules.ajax.getUrl || self.options.ajaxURLGenerator)) { + + if (self.options.pagination == "remote" && self.modExists("page", true)) { + + self.modules.page.reset(true, true); + + return self.modules.page.setPage(1); + } else { + + return self.modules.ajax.loadData(inPosition, columnsChanged); + } + } else { + + //empty data + + return self.rowManager.setData([], inPosition, columnsChanged); + } + } + } + }; + + //clear data + + Tabulator.prototype.clearData = function () { + + if (this.modExists("ajax")) { + + this.modules.ajax.blockActiveRequest(); + } + + this.rowManager.clearData(); + }; + + //get table data array + + Tabulator.prototype.getData = function (active) { + + if (active === true) { + + console.warn("passing a boolean to the getData function is deprecated, you should now pass the string 'active'"); + + active = "active"; + } + + return this.rowManager.getData(active); + }; + + //get table data array count + + Tabulator.prototype.getDataCount = function (active) { + + if (active === true) { + + console.warn("passing a boolean to the getDataCount function is deprecated, you should now pass the string 'active'"); + + active = "active"; + } + + return this.rowManager.getDataCount(active); + }; + + //search for specific row components + + Tabulator.prototype.searchRows = function (field, type, value) { + + if (this.modExists("filter", true)) { + + return this.modules.filter.search("rows", field, type, value); + } + }; + + //search for specific data + + Tabulator.prototype.searchData = function (field, type, value) { + + if (this.modExists("filter", true)) { + + return this.modules.filter.search("data", field, type, value); + } + }; + + //get table html + + Tabulator.prototype.getHtml = function (visible, style, config) { + + if (this.modExists("export", true)) { + + return this.modules.export.getHtml(visible, style, config); + } + }; + + //get print html + + Tabulator.prototype.print = function (visible, style, config) { + + if (this.modExists("print", true)) { + + return this.modules.print.printFullscreen(visible, style, config); + } + }; + + //retrieve Ajax URL + + Tabulator.prototype.getAjaxUrl = function () { + + if (this.modExists("ajax", true)) { + + return this.modules.ajax.getUrl(); + } + }; + + //replace data, keeping table in position with same sort + + Tabulator.prototype.replaceData = function (data, params, config) { + + if (this.modExists("ajax")) { + + this.modules.ajax.blockActiveRequest(); + } + + return this._setData(data, params, config, true); + }; + + //update table data + + Tabulator.prototype.updateData = function (data) { + var _this19 = this; + + var self = this; + + var responses = 0; + + return new Promise(function (resolve, reject) { + + if (_this19.modExists("ajax")) { + + _this19.modules.ajax.blockActiveRequest(); + } + + if (typeof data === "string") { + + data = JSON.parse(data); + } + + if (data) { + + data.forEach(function (item) { + + var row = self.rowManager.findRow(item[self.options.index]); + + if (row) { + + responses++; + + row.updateData(item).then(function () { + + responses--; + + if (!responses) { + + resolve(); + } + }); + } + }); + } else { + + console.warn("Update Error - No data provided"); + + reject("Update Error - No data provided"); + } + }); + }; + + Tabulator.prototype.addData = function (data, pos, index) { + var _this20 = this; + + return new Promise(function (resolve, reject) { + + if (_this20.modExists("ajax")) { + + _this20.modules.ajax.blockActiveRequest(); + } + + if (typeof data === "string") { + + data = JSON.parse(data); + } + + if (data) { + + _this20.rowManager.addRows(data, pos, index).then(function (rows) { + + var output = []; + + rows.forEach(function (row) { + + output.push(row.getComponent()); + }); + + resolve(output); + }); + } else { + + console.warn("Update Error - No data provided"); + + reject("Update Error - No data provided"); + } + }); + }; + + //update table data + + Tabulator.prototype.updateOrAddData = function (data) { + var _this21 = this; + + var self = this, + rows = [], + responses = 0; + + return new Promise(function (resolve, reject) { + + if (_this21.modExists("ajax")) { + + _this21.modules.ajax.blockActiveRequest(); + } + + if (typeof data === "string") { + + data = JSON.parse(data); + } + + if (data) { + + data.forEach(function (item) { + + var row = self.rowManager.findRow(item[self.options.index]); + + responses++; + + if (row) { + + row.updateData(item).then(function () { + + responses--; + + rows.push(row.getComponent()); + + if (!responses) { + + resolve(rows); + } + }); + } else { + + self.rowManager.addRows(item).then(function (newRows) { + + responses--; + + rows.push(newRows[0].getComponent()); + + if (!responses) { + + resolve(rows); + } + }); + } + }); + } else { + + console.warn("Update Error - No data provided"); + + reject("Update Error - No data provided"); + } + }); + }; + + //get row object + + Tabulator.prototype.getRow = function (index) { + + var row = this.rowManager.findRow(index); + + if (row) { + + return row.getComponent(); + } else { + + console.warn("Find Error - No matching row found:", index); + + return false; + } + }; + + //get row object + + Tabulator.prototype.getRowFromPosition = function (position, active) { + + var row = this.rowManager.getRowFromPosition(position, active); + + if (row) { + + return row.getComponent(); + } else { + + console.warn("Find Error - No matching row found:", position); + + return false; + } + }; + + //delete row from table + + Tabulator.prototype.deleteRow = function (index) { + var _this22 = this; + + return new Promise(function (resolve, reject) { + + var self = _this22, + count = 0, + successCount = 0, + foundRows = []; + + function doneCheck() { + + count++; + + if (count == index.length) { + + if (successCount) { + + self.rowManager.reRenderInPosition(); + + resolve(); + } + } + } + + if (!Array.isArray(index)) { + + index = [index]; + } + + //find matching rows + + index.forEach(function (item) { + + var row = _this22.rowManager.findRow(item, true); + + if (row) { + + foundRows.push(row); + } else { + + console.warn("Delete Error - No matching row found:", item); + + reject("Delete Error - No matching row found"); + + doneCheck(); + } + }); + + //sort rows into correct order to ensure smooth delete from table + + foundRows.sort(function (a, b) { + + return _this22.rowManager.rows.indexOf(a) > _this22.rowManager.rows.indexOf(b) ? 1 : -1; + }); + + foundRows.forEach(function (row) { + + row.delete().then(function () { + + successCount++; + + doneCheck(); + }).catch(function (err) { + + doneCheck(); + + reject(err); + }); + }); + }); + }; + + //add row to table + + Tabulator.prototype.addRow = function (data, pos, index) { + var _this23 = this; + + return new Promise(function (resolve, reject) { + + if (typeof data === "string") { + + data = JSON.parse(data); + } + + _this23.rowManager.addRows(data, pos, index).then(function (rows) { + + //recalc column calculations if present + + if (_this23.modExists("columnCalcs")) { + + _this23.modules.columnCalcs.recalc(_this23.rowManager.activeRows); + } + + resolve(rows[0].getComponent()); + }); + }); + }; + + //update a row if it exitsts otherwise create it + + Tabulator.prototype.updateOrAddRow = function (index, data) { + var _this24 = this; + + return new Promise(function (resolve, reject) { + + var row = _this24.rowManager.findRow(index); + + if (typeof data === "string") { + + data = JSON.parse(data); + } + + if (row) { + + row.updateData(data).then(function () { + + //recalc column calculations if present + + if (_this24.modExists("columnCalcs")) { + + _this24.modules.columnCalcs.recalc(_this24.rowManager.activeRows); + } + + resolve(row.getComponent()); + }).catch(function (err) { + + reject(err); + }); + } else { + + row = _this24.rowManager.addRows(data).then(function (rows) { + + //recalc column calculations if present + + if (_this24.modExists("columnCalcs")) { + + _this24.modules.columnCalcs.recalc(_this24.rowManager.activeRows); + } + + resolve(rows[0].getComponent()); + }).catch(function (err) { + + reject(err); + }); + } + }); + }; + + //update row data + + Tabulator.prototype.updateRow = function (index, data) { + var _this25 = this; + + return new Promise(function (resolve, reject) { + + var row = _this25.rowManager.findRow(index); + + if (typeof data === "string") { + + data = JSON.parse(data); + } + + if (row) { + + row.updateData(data).then(function () { + + resolve(row.getComponent()); + }).catch(function (err) { + + reject(err); + }); + } else { + + console.warn("Update Error - No matching row found:", index); + + reject("Update Error - No matching row found"); + } + }); + }; + + //scroll to row in DOM + + Tabulator.prototype.scrollToRow = function (index, position, ifVisible) { + var _this26 = this; + + return new Promise(function (resolve, reject) { + + var row = _this26.rowManager.findRow(index); + + if (row) { + + _this26.rowManager.scrollToRow(row, position, ifVisible).then(function () { + + resolve(); + }).catch(function (err) { + + reject(err); + }); + } else { + + console.warn("Scroll Error - No matching row found:", index); + + reject("Scroll Error - No matching row found"); + } + }); + }; + + Tabulator.prototype.moveRow = function (from, to, after) { + + var fromRow = this.rowManager.findRow(from); + + if (fromRow) { + + fromRow.moveToRow(to, after); + } else { + + console.warn("Move Error - No matching row found:", from); + } + }; + + Tabulator.prototype.getRows = function (active) { + + if (active === true) { + + console.warn("passing a boolean to the getRows function is deprecated, you should now pass the string 'active'"); + + active = "active"; + } + + return this.rowManager.getComponents(active); + }; + + //get position of row in table + + Tabulator.prototype.getRowPosition = function (index, active) { + + var row = this.rowManager.findRow(index); + + if (row) { + + return this.rowManager.getRowPosition(row, active); + } else { + + console.warn("Position Error - No matching row found:", index); + + return false; + } + }; + + //copy table data to clipboard + + Tabulator.prototype.copyToClipboard = function (selector) { + + if (this.modExists("clipboard", true)) { + + this.modules.clipboard.copy(selector); + } + }; + + /////////////// Column Functions /////////////// + + + Tabulator.prototype.setColumns = function (definition) { + + this.columnManager.setColumns(definition); + }; + + Tabulator.prototype.getColumns = function (structured) { + + return this.columnManager.getComponents(structured); + }; + + Tabulator.prototype.getColumn = function (field) { + + var col = this.columnManager.findColumn(field); + + if (col) { + + return col.getComponent(); + } else { + + console.warn("Find Error - No matching column found:", field); + + return false; + } + }; + + Tabulator.prototype.getColumnDefinitions = function () { + + return this.columnManager.getDefinitionTree(); + }; + + Tabulator.prototype.getColumnLayout = function () { + + if (this.modExists("persistence", true)) { + + return this.modules.persistence.parseColumns(this.columnManager.getColumns()); + } + }; + + Tabulator.prototype.setColumnLayout = function (layout) { + + if (this.modExists("persistence", true)) { + + this.columnManager.setColumns(this.modules.persistence.mergeDefinition(this.options.columns, layout)); + + return true; + } + + return false; + }; + + Tabulator.prototype.showColumn = function (field) { + + var column = this.columnManager.findColumn(field); + + if (column) { + + column.show(); + + if (this.options.responsiveLayout && this.modExists("responsiveLayout", true)) { + + this.modules.responsiveLayout.update(); + } + } else { + + console.warn("Column Show Error - No matching column found:", field); + + return false; + } + }; + + Tabulator.prototype.hideColumn = function (field) { + + var column = this.columnManager.findColumn(field); + + if (column) { + + column.hide(); + + if (this.options.responsiveLayout && this.modExists("responsiveLayout", true)) { + + this.modules.responsiveLayout.update(); + } + } else { + + console.warn("Column Hide Error - No matching column found:", field); + + return false; + } + }; + + Tabulator.prototype.toggleColumn = function (field) { + + var column = this.columnManager.findColumn(field); + + if (column) { + + if (column.visible) { + + column.hide(); + } else { + + column.show(); + } + } else { + + console.warn("Column Visibility Toggle Error - No matching column found:", field); + + return false; + } + }; + + Tabulator.prototype.addColumn = function (definition, before, field) { + var _this27 = this; + + return new Promise(function (resolve, reject) { + + var column = _this27.columnManager.findColumn(field); + + _this27.columnManager.addColumn(definition, before, column).then(function (column) { + + resolve(column.getComponent()); + }).catch(function (err) { + + reject(err); + }); + }); + }; + + Tabulator.prototype.deleteColumn = function (field) { + var _this28 = this; + + return new Promise(function (resolve, reject) { + + var column = _this28.columnManager.findColumn(field); + + if (column) { + + column.delete().then(function () { + + resolve(); + }).catch(function (err) { + + reject(err); + }); + } else { + + console.warn("Column Delete Error - No matching column found:", field); + + reject(); + } + }); + }; + + Tabulator.prototype.updateColumnDefinition = function (field, definition) { + var _this29 = this; + + return new Promise(function (resolve, reject) { + + var column = _this29.columnManager.findColumn(field); + + if (column) { + + column.updateDefinition(definition).then(function (col) { + + resolve(col); + }).catch(function (err) { + + reject(err); + }); + } else { + + console.warn("Column Update Error - No matching column found:", field); + + reject(); + } + }); + }; + + Tabulator.prototype.moveColumn = function (from, to, after) { + + var fromColumn = this.columnManager.findColumn(from); + + var toColumn = this.columnManager.findColumn(to); + + if (fromColumn) { + + if (toColumn) { + + this.columnManager.moveColumn(fromColumn, toColumn, after); + } else { + + console.warn("Move Error - No matching column found:", toColumn); + } + } else { + + console.warn("Move Error - No matching column found:", from); + } + }; + + //scroll to column in DOM + + Tabulator.prototype.scrollToColumn = function (field, position, ifVisible) { + var _this30 = this; + + return new Promise(function (resolve, reject) { + + var column = _this30.columnManager.findColumn(field); + + if (column) { + + _this30.columnManager.scrollToColumn(column, position, ifVisible).then(function () { + + resolve(); + }).catch(function (err) { + + reject(err); + }); + } else { + + console.warn("Scroll Error - No matching column found:", field); + + reject("Scroll Error - No matching column found"); + } + }); + }; + + //////////// Localization Functions //////////// + + Tabulator.prototype.setLocale = function (locale) { + + this.modules.localize.setLocale(locale); + }; + + Tabulator.prototype.getLocale = function () { + + return this.modules.localize.getLocale(); + }; + + Tabulator.prototype.getLang = function (locale) { + + return this.modules.localize.getLang(locale); + }; + + //////////// General Public Functions //////////// + + + //redraw list without updating data + + Tabulator.prototype.redraw = function (force) { + + this.columnManager.redraw(force); + + this.rowManager.redraw(force); + }; + + Tabulator.prototype.setHeight = function (height) { + + if (this.rowManager.renderMode !== "classic") { + + this.options.height = isNaN(height) ? height : height + "px"; + + this.element.style.height = this.options.height; + + this.rowManager.setRenderMode(); + + this.rowManager.redraw(); + } else { + + console.warn("setHeight function is not available in classic render mode"); + } + }; + + ///////////////////// Sorting //////////////////// + + + //trigger sort + + Tabulator.prototype.setSort = function (sortList, dir) { + + if (this.modExists("sort", true)) { + + this.modules.sort.setSort(sortList, dir); + + this.rowManager.sorterRefresh(); + } + }; + + Tabulator.prototype.getSorters = function () { + + if (this.modExists("sort", true)) { + + return this.modules.sort.getSort(); + } + }; + + Tabulator.prototype.clearSort = function () { + + if (this.modExists("sort", true)) { + + this.modules.sort.clear(); + + this.rowManager.sorterRefresh(); + } + }; + + ///////////////////// Filtering //////////////////// + + + //set standard filters + + Tabulator.prototype.setFilter = function (field, type, value, params) { + + if (this.modExists("filter", true)) { + + this.modules.filter.setFilter(field, type, value, params); + + this.rowManager.filterRefresh(); + } + }; + + //add filter to array + + Tabulator.prototype.addFilter = function (field, type, value, params) { + + if (this.modExists("filter", true)) { + + this.modules.filter.addFilter(field, type, value, params); + + this.rowManager.filterRefresh(); + } + }; + + //get all filters + + Tabulator.prototype.getFilters = function (all) { + + if (this.modExists("filter", true)) { + + return this.modules.filter.getFilters(all); + } + }; + + Tabulator.prototype.setHeaderFilterFocus = function (field) { + + if (this.modExists("filter", true)) { + + var column = this.columnManager.findColumn(field); + + if (column) { + + this.modules.filter.setHeaderFilterFocus(column); + } else { + + console.warn("Column Filter Focus Error - No matching column found:", field); + + return false; + } + } + }; + + Tabulator.prototype.getHeaderFilterValue = function (field) { + + if (this.modExists("filter", true)) { + + var column = this.columnManager.findColumn(field); + + if (column) { + + return this.modules.filter.getHeaderFilterValue(column); + } else { + + console.warn("Column Filter Error - No matching column found:", field); + } + } + }; + + Tabulator.prototype.setHeaderFilterValue = function (field, value) { + + if (this.modExists("filter", true)) { + + var column = this.columnManager.findColumn(field); + + if (column) { + + this.modules.filter.setHeaderFilterValue(column, value); + } else { + + console.warn("Column Filter Error - No matching column found:", field); + + return false; + } + } + }; + + Tabulator.prototype.getHeaderFilters = function () { + + if (this.modExists("filter", true)) { + + return this.modules.filter.getHeaderFilters(); + } + }; + + //remove filter from array + + Tabulator.prototype.removeFilter = function (field, type, value) { + + if (this.modExists("filter", true)) { + + this.modules.filter.removeFilter(field, type, value); + + this.rowManager.filterRefresh(); + } + }; + + //clear filters + + Tabulator.prototype.clearFilter = function (all) { + + if (this.modExists("filter", true)) { + + this.modules.filter.clearFilter(all); + + this.rowManager.filterRefresh(); + } + }; + + //clear header filters + + Tabulator.prototype.clearHeaderFilter = function () { + + if (this.modExists("filter", true)) { + + this.modules.filter.clearHeaderFilter(); + + this.rowManager.filterRefresh(); + } + }; + + ///////////////////// select //////////////////// + + Tabulator.prototype.selectRow = function (rows) { + + if (this.modExists("selectRow", true)) { + + if (rows === true) { + + console.warn("passing a boolean to the selectRowselectRow function is deprecated, you should now pass the string 'active'"); + + rows = "active"; + } + + this.modules.selectRow.selectRows(rows); + } + }; + + Tabulator.prototype.deselectRow = function (rows) { + + if (this.modExists("selectRow", true)) { + + this.modules.selectRow.deselectRows(rows); + } + }; + + Tabulator.prototype.toggleSelectRow = function (row) { + + if (this.modExists("selectRow", true)) { + + this.modules.selectRow.toggleRow(row); + } + }; + + Tabulator.prototype.getSelectedRows = function () { + + if (this.modExists("selectRow", true)) { + + return this.modules.selectRow.getSelectedRows(); + } + }; + + Tabulator.prototype.getSelectedData = function () { + + if (this.modExists("selectRow", true)) { + + return this.modules.selectRow.getSelectedData(); + } + }; + + ///////////////////// validation //////////////////// + + Tabulator.prototype.getInvalidCells = function () { + + if (this.modExists("validate", true)) { + + return this.modules.validate.getInvalidCells(); + } + }; + + Tabulator.prototype.clearCellValidation = function (cells) { + var _this31 = this; + + if (this.modExists("validate", true)) { + + if (!cells) { + + cells = this.modules.validate.getInvalidCells(); + } + + if (!Array.isArray(cells)) { + + cells = [cells]; + } + + cells.forEach(function (cell) { + + _this31.modules.validate.clearValidation(cell._getSelf()); + }); + } + }; + + Tabulator.prototype.validate = function (cells) { + + var output = []; + + //clear row data + + this.rowManager.rows.forEach(function (row) { + + var valid = row.validate(); + + if (valid !== true) { + + output = output.concat(valid); + } + }); + + return output.length ? output : true; + }; + + //////////// Pagination Functions //////////// + + + Tabulator.prototype.setMaxPage = function (max) { + + if (this.options.pagination && this.modExists("page")) { + + this.modules.page.setMaxPage(max); + } else { + + return false; + } + }; + + Tabulator.prototype.setPage = function (page) { + + if (this.options.pagination && this.modExists("page")) { + + return this.modules.page.setPage(page); + } else { + + return new Promise(function (resolve, reject) { + reject(); + }); + } + }; + + Tabulator.prototype.setPageToRow = function (row) { + var _this32 = this; + + return new Promise(function (resolve, reject) { + + if (_this32.options.pagination && _this32.modExists("page")) { + + row = _this32.rowManager.findRow(row); + + if (row) { + + _this32.modules.page.setPageToRow(row).then(function () { + + resolve(); + }).catch(function () { + + reject(); + }); + } else { + + reject(); + } + } else { + + reject(); + } + }); + }; + + Tabulator.prototype.setPageSize = function (size) { + + if (this.options.pagination && this.modExists("page")) { + + this.modules.page.setPageSize(size); + + this.modules.page.setPage(1).then(function () {}).catch(function () {}); + } else { + + return false; + } + }; + + Tabulator.prototype.getPageSize = function () { + + if (this.options.pagination && this.modExists("page", true)) { + + return this.modules.page.getPageSize(); + } + }; + + Tabulator.prototype.previousPage = function () { + + if (this.options.pagination && this.modExists("page")) { + + this.modules.page.previousPage(); + } else { + + return false; + } + }; + + Tabulator.prototype.nextPage = function () { + + if (this.options.pagination && this.modExists("page")) { + + this.modules.page.nextPage(); + } else { + + return false; + } + }; + + Tabulator.prototype.getPage = function () { + + if (this.options.pagination && this.modExists("page")) { + + return this.modules.page.getPage(); + } else { + + return false; + } + }; + + Tabulator.prototype.getPageMax = function () { + + if (this.options.pagination && this.modExists("page")) { + + return this.modules.page.getPageMax(); + } else { + + return false; + } + }; + + ///////////////// Grouping Functions /////////////// + + + Tabulator.prototype.setGroupBy = function (groups) { + + if (this.modExists("groupRows", true)) { + + this.options.groupBy = groups; + + this.modules.groupRows.initialize(); + + this.rowManager.refreshActiveData("display"); + + if (this.options.persistence && this.modExists("persistence", true) && this.modules.persistence.config.group) { + + this.modules.persistence.save("group"); + } + } else { + + return false; + } + }; + + Tabulator.prototype.setGroupStartOpen = function (values) { + + if (this.modExists("groupRows", true)) { + + this.options.groupStartOpen = values; + + this.modules.groupRows.initialize(); + + if (this.options.groupBy) { + + this.rowManager.refreshActiveData("group"); + + if (this.options.persistence && this.modExists("persistence", true) && this.modules.persistence.config.group) { + + this.modules.persistence.save("group"); + } + } else { + + console.warn("Grouping Update - cant refresh view, no groups have been set"); + } + } else { + + return false; + } + }; + + Tabulator.prototype.setGroupHeader = function (values) { + + if (this.modExists("groupRows", true)) { + + this.options.groupHeader = values; + + this.modules.groupRows.initialize(); + + if (this.options.groupBy) { + + this.rowManager.refreshActiveData("group"); + + if (this.options.persistence && this.modExists("persistence", true) && this.modules.persistence.config.group) { + + this.modules.persistence.save("group"); + } + } else { + + console.warn("Grouping Update - cant refresh view, no groups have been set"); + } + } else { + + return false; + } + }; + + Tabulator.prototype.getGroups = function (values) { + + if (this.modExists("groupRows", true)) { + + return this.modules.groupRows.getGroups(true); + } else { + + return false; + } + }; + + // get grouped table data in the same format as getData() + + Tabulator.prototype.getGroupedData = function () { + + if (this.modExists("groupRows", true)) { + + return this.options.groupBy ? this.modules.groupRows.getGroupedData() : this.getData(); + } + }; + + Tabulator.prototype.getEditedCells = function () { + + if (this.modExists("edit", true)) { + + return this.modules.edit.getEditedCells(); + } + }; + + Tabulator.prototype.clearCellEdited = function (cells) { + var _this33 = this; + + if (this.modExists("edit", true)) { + + if (!cells) { + + cells = this.modules.edit.getEditedCells(); + } + + if (!Array.isArray(cells)) { + + cells = [cells]; + } + + cells.forEach(function (cell) { + + _this33.modules.edit.clearEdited(cell._getSelf()); + }); + } + }; + + ///////////////// Column Calculation Functions /////////////// + + Tabulator.prototype.getCalcResults = function () { + + if (this.modExists("columnCalcs", true)) { + + return this.modules.columnCalcs.getResults(); + } else { + + return false; + } + }; + + Tabulator.prototype.recalc = function () { + + if (this.modExists("columnCalcs", true)) { + + this.modules.columnCalcs.recalcAll(this.rowManager.activeRows); + } + }; + + /////////////// Navigation Management ////////////// + + + Tabulator.prototype.navigatePrev = function () { + + var cell = false; + + if (this.modExists("edit", true)) { + + cell = this.modules.edit.currentCell; + + if (cell) { + + return cell.nav().prev(); + } + } + + return false; + }; + + Tabulator.prototype.navigateNext = function () { + + var cell = false; + + if (this.modExists("edit", true)) { + + cell = this.modules.edit.currentCell; + + if (cell) { + + return cell.nav().next(); + } + } + + return false; + }; + + Tabulator.prototype.navigateLeft = function () { + + var cell = false; + + if (this.modExists("edit", true)) { + + cell = this.modules.edit.currentCell; + + if (cell) { + + e.preventDefault(); + + return cell.nav().left(); + } + } + + return false; + }; + + Tabulator.prototype.navigateRight = function () { + + var cell = false; + + if (this.modExists("edit", true)) { + + cell = this.modules.edit.currentCell; + + if (cell) { + + e.preventDefault(); + + return cell.nav().right(); + } + } + + return false; + }; + + Tabulator.prototype.navigateUp = function () { + + var cell = false; + + if (this.modExists("edit", true)) { + + cell = this.modules.edit.currentCell; + + if (cell) { + + e.preventDefault(); + + return cell.nav().up(); + } + } + + return false; + }; + + Tabulator.prototype.navigateDown = function () { + + var cell = false; + + if (this.modExists("edit", true)) { + + cell = this.modules.edit.currentCell; + + if (cell) { + + e.preventDefault(); + + return cell.nav().down(); + } + } + + return false; + }; + + /////////////// History Management ////////////// + + Tabulator.prototype.undo = function () { + + if (this.options.history && this.modExists("history", true)) { + + return this.modules.history.undo(); + } else { + + return false; + } + }; + + Tabulator.prototype.redo = function () { + + if (this.options.history && this.modExists("history", true)) { + + return this.modules.history.redo(); + } else { + + return false; + } + }; + + Tabulator.prototype.getHistoryUndoSize = function () { + + if (this.options.history && this.modExists("history", true)) { + + return this.modules.history.getHistoryUndoSize(); + } else { + + return false; + } + }; + + Tabulator.prototype.getHistoryRedoSize = function () { + + if (this.options.history && this.modExists("history", true)) { + + return this.modules.history.getHistoryRedoSize(); + } else { + + return false; + } + }; + + /////////////// Download Management ////////////// + + + Tabulator.prototype.download = function (type, filename, options, active) { + + if (this.modExists("download", true)) { + + this.modules.download.download(type, filename, options, active); + } + }; + + Tabulator.prototype.downloadToTab = function (type, filename, options, active) { + + if (this.modExists("download", true)) { + + this.modules.download.download(type, filename, options, active, true); + } + }; + + /////////// Inter Table Communications /////////// + + + Tabulator.prototype.tableComms = function (table, module, action, data) { + + this.modules.comms.receive(table, module, action, data); + }; + + ////////////// Extension Management ////////////// + + + //object to hold module + + Tabulator.prototype.moduleBindings = {}; + + //extend module + + Tabulator.prototype.extendModule = function (name, property, values) { + + if (Tabulator.prototype.moduleBindings[name]) { + + var source = Tabulator.prototype.moduleBindings[name].prototype[property]; + + if (source) { + + if ((typeof values === 'undefined' ? 'undefined' : _typeof(values)) == "object") { + + for (var key in values) { + + source[key] = values[key]; + } + } else { + + console.warn("Module Error - Invalid value type, it must be an object"); + } + } else { + + console.warn("Module Error - property does not exist:", property); + } + } else { + + console.warn("Module Error - module does not exist:", name); + } + }; + + //add module to tabulator + + Tabulator.prototype.registerModule = function (name, module) { + + var self = this; + + Tabulator.prototype.moduleBindings[name] = module; + }; + + //ensure that module are bound to instantiated function + + Tabulator.prototype.bindModules = function () { + + this.modules = {}; + + for (var name in Tabulator.prototype.moduleBindings) { + + this.modules[name] = new Tabulator.prototype.moduleBindings[name](this); + } + }; + + //Check for module + + Tabulator.prototype.modExists = function (plugin, required) { + + if (this.modules[plugin]) { + + return true; + } else { + + if (required) { + + console.error("Tabulator Module Not Installed: " + plugin); + } + + return false; + } + }; + + Tabulator.prototype.helpers = { + + elVisible: function elVisible(el) { + + return !(el.offsetWidth <= 0 && el.offsetHeight <= 0); + }, + + elOffset: function elOffset(el) { + + var box = el.getBoundingClientRect(); + + return { + + top: box.top + window.pageYOffset - document.documentElement.clientTop, + + left: box.left + window.pageXOffset - document.documentElement.clientLeft + + }; + }, + + deepClone: function deepClone(obj) { + + var clone = Array.isArray(obj) ? [] : {}; + + for (var i in obj) { + + if (obj[i] != null && _typeof(obj[i]) === "object") { + + if (obj[i] instanceof Date) { + + clone[i] = new Date(obj[i]); + } else { + + clone[i] = this.deepClone(obj[i]); + } + } else { + + clone[i] = obj[i]; + } + } + + return clone; + } + + }; + + Tabulator.prototype.comms = { + + tables: [], + + register: function register(table) { + + Tabulator.prototype.comms.tables.push(table); + }, + + deregister: function deregister(table) { + + var index = Tabulator.prototype.comms.tables.indexOf(table); + + if (index > -1) { + + Tabulator.prototype.comms.tables.splice(index, 1); + } + }, + + lookupTable: function lookupTable(query, silent) { + + var results = [], + matches, + match; + + if (typeof query === "string") { + + matches = document.querySelectorAll(query); + + if (matches.length) { + + for (var i = 0; i < matches.length; i++) { + + match = Tabulator.prototype.comms.matchElement(matches[i]); + + if (match) { + + results.push(match); + } + } + } + } else if (typeof HTMLElement !== "undefined" && query instanceof HTMLElement || query instanceof Tabulator) { + + match = Tabulator.prototype.comms.matchElement(query); + + if (match) { + + results.push(match); + } + } else if (Array.isArray(query)) { + + query.forEach(function (item) { + + results = results.concat(Tabulator.prototype.comms.lookupTable(item)); + }); + } else { + + if (!silent) { + + console.warn("Table Connection Error - Invalid Selector", query); + } + } + + return results; + }, + + matchElement: function matchElement(element) { + + return Tabulator.prototype.comms.tables.find(function (table) { + + return element instanceof Tabulator ? table === element : table.element === element; + }); + } + + }; + + Tabulator.prototype.findTable = function (query) { + + var results = Tabulator.prototype.comms.lookupTable(query, true); + + return Array.isArray(results) && !results.length ? false : results; + }; + + var Layout = function Layout(table) { + + this.table = table; + + this.mode = null; + }; + + //initialize layout system + + + Layout.prototype.initialize = function (layout) { + + if (this.modes[layout]) { + + this.mode = layout; + } else { + + console.warn("Layout Error - invalid mode set, defaulting to 'fitData' : " + layout); + + this.mode = 'fitData'; + } + + this.table.element.setAttribute("tabulator-layout", this.mode); + }; + + Layout.prototype.getMode = function () { + + return this.mode; + }; + + //trigger table layout + + + Layout.prototype.layout = function () { + + this.modes[this.mode].call(this, this.table.columnManager.columnsByIndex); + }; + + //layout render functions + + + Layout.prototype.modes = { + + //resize columns to fit data they contain + + + "fitData": function fitData(columns) { + + columns.forEach(function (column) { + + column.reinitializeWidth(); + }); + + if (this.table.options.responsiveLayout && this.table.modExists("responsiveLayout", true)) { + + this.table.modules.responsiveLayout.update(); + } + }, + + //resize columns to fit data they contain and stretch row to fill table + + + "fitDataFill": function fitDataFill(columns) { + + columns.forEach(function (column) { + + column.reinitializeWidth(); + }); + + if (this.table.options.responsiveLayout && this.table.modExists("responsiveLayout", true)) { + + this.table.modules.responsiveLayout.update(); + } + }, + + //resize columns to fit data they contain + + + "fitDataTable": function fitDataTable(columns) { + + columns.forEach(function (column) { + + column.reinitializeWidth(); + }); + + if (this.table.options.responsiveLayout && this.table.modExists("responsiveLayout", true)) { + + this.table.modules.responsiveLayout.update(); + } + }, + + //resize columns to fit data the contain and stretch last column to fill table + + + "fitDataStretch": function fitDataStretch(columns) { + var _this34 = this; + + var colsWidth = 0, + tableWidth = this.table.rowManager.element.clientWidth, + gap = 0, + lastCol = false; + + columns.forEach(function (column, i) { + + if (!column.widthFixed) { + + column.reinitializeWidth(); + } + + if (_this34.table.options.responsiveLayout ? column.modules.responsive.visible : column.visible) { + + lastCol = column; + } + + if (column.visible) { + + colsWidth += column.getWidth(); + } + }); + + if (lastCol) { + + gap = tableWidth - colsWidth + lastCol.getWidth(); + + if (this.table.options.responsiveLayout && this.table.modExists("responsiveLayout", true)) { + + lastCol.setWidth(0); + + this.table.modules.responsiveLayout.update(); + } + + if (gap > 0) { + + lastCol.setWidth(gap); + } else { + + lastCol.reinitializeWidth(); + } + } else { + + if (this.table.options.responsiveLayout && this.table.modExists("responsiveLayout", true)) { + + this.table.modules.responsiveLayout.update(); + } + } + }, + + //resize columns to fit + + + "fitColumns": function fitColumns(columns) { + + var self = this; + + var totalWidth = self.table.element.clientWidth; //table element width + + + var fixedWidth = 0; //total width of columns with a defined width + + + var flexWidth = 0; //total width available to flexible columns + + + var flexGrowUnits = 0; //total number of widthGrow blocks accross all columns + + + var flexColWidth = 0; //desired width of flexible columns + + + var flexColumns = []; //array of flexible width columns + + + var fixedShrinkColumns = []; //array of fixed width columns that can shrink + + + var flexShrinkUnits = 0; //total number of widthShrink blocks accross all columns + + + var overflowWidth = 0; //horizontal overflow width + + + var gapFill = 0; //number of pixels to be added to final column to close and half pixel gaps + + + function calcWidth(width) { + + var colWidth; + + if (typeof width == "string") { + + if (width.indexOf("%") > -1) { + + colWidth = totalWidth / 100 * parseInt(width); + } else { + + colWidth = parseInt(width); + } + } else { + + colWidth = width; + } + + return colWidth; + } + + //ensure columns resize to take up the correct amount of space + + + function scaleColumns(columns, freeSpace, colWidth, shrinkCols) { + + var oversizeCols = [], + oversizeSpace = 0, + remainingSpace = 0, + nextColWidth = 0, + gap = 0, + changeUnits = 0, + undersizeCols = []; + + function calcGrow(col) { + + return colWidth * (col.column.definition.widthGrow || 1); + } + + function calcShrink(col) { + + return calcWidth(col.width) - colWidth * (col.column.definition.widthShrink || 0); + } + + columns.forEach(function (col, i) { + + var width = shrinkCols ? calcShrink(col) : calcGrow(col); + + if (col.column.minWidth >= width) { + + oversizeCols.push(col); + } else { + + undersizeCols.push(col); + + changeUnits += shrinkCols ? col.column.definition.widthShrink || 1 : col.column.definition.widthGrow || 1; + } + }); + + if (oversizeCols.length) { + + oversizeCols.forEach(function (col) { + + oversizeSpace += shrinkCols ? col.width - col.column.minWidth : col.column.minWidth; + + col.width = col.column.minWidth; + }); + + remainingSpace = freeSpace - oversizeSpace; + + nextColWidth = changeUnits ? Math.floor(remainingSpace / changeUnits) : remainingSpace; + + gap = remainingSpace - nextColWidth * changeUnits; + + gap += scaleColumns(undersizeCols, remainingSpace, nextColWidth, shrinkCols); + } else { + + gap = changeUnits ? freeSpace - Math.floor(freeSpace / changeUnits) * changeUnits : freeSpace; + + undersizeCols.forEach(function (column) { + + column.width = shrinkCols ? calcShrink(column) : calcGrow(column); + }); + } + + return gap; + } + + if (this.table.options.responsiveLayout && this.table.modExists("responsiveLayout", true)) { + + this.table.modules.responsiveLayout.update(); + } + + //adjust for vertical scrollbar if present + + + if (this.table.rowManager.element.scrollHeight > this.table.rowManager.element.clientHeight) { + + totalWidth -= this.table.rowManager.element.offsetWidth - this.table.rowManager.element.clientWidth; + } + + columns.forEach(function (column) { + + var width, minWidth, colWidth; + + if (column.visible) { + + width = column.definition.width; + + minWidth = parseInt(column.minWidth); + + if (width) { + + colWidth = calcWidth(width); + + fixedWidth += colWidth > minWidth ? colWidth : minWidth; + + if (column.definition.widthShrink) { + + fixedShrinkColumns.push({ + + column: column, + + width: colWidth > minWidth ? colWidth : minWidth + + }); + + flexShrinkUnits += column.definition.widthShrink; + } + } else { + + flexColumns.push({ + + column: column, + + width: 0 + + }); + + flexGrowUnits += column.definition.widthGrow || 1; + } + } + }); + + //calculate available space + + + flexWidth = totalWidth - fixedWidth; + + //calculate correct column size + + + flexColWidth = Math.floor(flexWidth / flexGrowUnits); + + //generate column widths + + + var gapFill = scaleColumns(flexColumns, flexWidth, flexColWidth, false); + + //increase width of last column to account for rounding errors + + + if (flexColumns.length && gapFill > 0) { + + flexColumns[flexColumns.length - 1].width += +gapFill; + } + + //caculate space for columns to be shrunk into + + + flexColumns.forEach(function (col) { + + flexWidth -= col.width; + }); + + overflowWidth = Math.abs(gapFill) + flexWidth; + + //shrink oversize columns if there is no available space + + + if (overflowWidth > 0 && flexShrinkUnits) { + + gapFill = scaleColumns(fixedShrinkColumns, overflowWidth, Math.floor(overflowWidth / flexShrinkUnits), true); + } + + //decrease width of last column to account for rounding errors + + + if (fixedShrinkColumns.length) { + + fixedShrinkColumns[fixedShrinkColumns.length - 1].width -= gapFill; + } + + flexColumns.forEach(function (col) { + + col.column.setWidth(col.width); + }); + + fixedShrinkColumns.forEach(function (col) { + + col.column.setWidth(col.width); + }); + } + + }; + + Tabulator.prototype.registerModule("layout", Layout); + + var Localize = function Localize(table) { + + this.table = table; //hold Tabulator object + + this.locale = "default"; //current locale + + this.lang = false; //current language + + this.bindings = {}; //update events to call when locale is changed + }; + + //set header placehoder + + Localize.prototype.setHeaderFilterPlaceholder = function (placeholder) { + + this.langs.default.headerFilters.default = placeholder; + }; + + //set header filter placeholder by column + + Localize.prototype.setHeaderFilterColumnPlaceholder = function (column, placeholder) { + + this.langs.default.headerFilters.columns[column] = placeholder; + + if (this.lang && !this.lang.headerFilters.columns[column]) { + + this.lang.headerFilters.columns[column] = placeholder; + } + }; + + //setup a lang description object + + Localize.prototype.installLang = function (locale, lang) { + + if (this.langs[locale]) { + + this._setLangProp(this.langs[locale], lang); + } else { + + this.langs[locale] = lang; + } + }; + + Localize.prototype._setLangProp = function (lang, values) { + + for (var key in values) { + + if (lang[key] && _typeof(lang[key]) == "object") { + + this._setLangProp(lang[key], values[key]); + } else { + + lang[key] = values[key]; + } + } + }; + + //set current locale + + Localize.prototype.setLocale = function (desiredLocale) { + + var self = this; + + desiredLocale = desiredLocale || "default"; + + //fill in any matching languge values + + function traverseLang(trans, path) { + + for (var prop in trans) { + + if (_typeof(trans[prop]) == "object") { + + if (!path[prop]) { + + path[prop] = {}; + } + + traverseLang(trans[prop], path[prop]); + } else { + + path[prop] = trans[prop]; + } + } + } + + //determing correct locale to load + + if (desiredLocale === true && navigator.language) { + + //get local from system + + desiredLocale = navigator.language.toLowerCase(); + } + + if (desiredLocale) { + + //if locale is not set, check for matching top level locale else use default + + if (!self.langs[desiredLocale]) { + + var prefix = desiredLocale.split("-")[0]; + + if (self.langs[prefix]) { + + console.warn("Localization Error - Exact matching locale not found, using closest match: ", desiredLocale, prefix); + + desiredLocale = prefix; + } else { + + console.warn("Localization Error - Matching locale not found, using default: ", desiredLocale); + + desiredLocale = "default"; + } + } + } + + self.locale = desiredLocale; + + //load default lang template + + self.lang = Tabulator.prototype.helpers.deepClone(self.langs.default || {}); + + if (desiredLocale != "default") { + + traverseLang(self.langs[desiredLocale], self.lang); + } + + self.table.options.localized.call(self.table, self.locale, self.lang); + + self._executeBindings(); + }; + + //get current locale + + Localize.prototype.getLocale = function (locale) { + + return self.locale; + }; + + //get lang object for given local or current if none provided + + Localize.prototype.getLang = function (locale) { + + return locale ? this.langs[locale] : this.lang; + }; + + //get text for current locale + + Localize.prototype.getText = function (path, value) { + + var path = value ? path + "|" + value : path, + pathArray = path.split("|"), + text = this._getLangElement(pathArray, this.locale); + + // if(text === false){ + + // console.warn("Localization Error - Matching localized text not found for given path: ", path); + + // } + + + return text || ""; + }; + + //traverse langs object and find localized copy + + Localize.prototype._getLangElement = function (path, locale) { + + var self = this; + + var root = self.lang; + + path.forEach(function (level) { + + var rootPath; + + if (root) { + + rootPath = root[level]; + + if (typeof rootPath != "undefined") { + + root = rootPath; + } else { + + root = false; + } + } + }); + + return root; + }; + + //set update binding + + Localize.prototype.bind = function (path, callback) { + + if (!this.bindings[path]) { + + this.bindings[path] = []; + } + + this.bindings[path].push(callback); + + callback(this.getText(path), this.lang); + }; + + //itterate through bindings and trigger updates + + Localize.prototype._executeBindings = function () { + + var self = this; + + var _loop = function _loop(path) { + + self.bindings[path].forEach(function (binding) { + + binding(self.getText(path), self.lang); + }); + }; + + for (var path in self.bindings) { + _loop(path); + } + }; + + //Localized text listings + + Localize.prototype.langs = { + + "default": { //hold default locale text + + "groups": { + + "item": "item", + + "items": "items" + + }, + + "columns": {}, + + "ajax": { + + "loading": "Loading", + + "error": "Error" + + }, + + "pagination": { + + "page_size": "Page Size", + + "page_title": "Show Page", + + "first": "First", + + "first_title": "First Page", + + "last": "Last", + + "last_title": "Last Page", + + "prev": "Prev", + + "prev_title": "Prev Page", + + "next": "Next", + + "next_title": "Next Page", + + "all": "All" + + }, + + "headerFilters": { + + "default": "filter column...", + + "columns": {} + + } + + } + + }; + + Tabulator.prototype.registerModule("localize", Localize); + + var Comms = function Comms(table) { + + this.table = table; + }; + + Comms.prototype.getConnections = function (selectors) { + + var self = this, + connections = [], + connection; + + connection = Tabulator.prototype.comms.lookupTable(selectors); + + connection.forEach(function (con) { + + if (self.table !== con) { + + connections.push(con); + } + }); + + return connections; + }; + + Comms.prototype.send = function (selectors, module, action, data) { + + var self = this, + connections = this.getConnections(selectors); + + connections.forEach(function (connection) { + + connection.tableComms(self.table.element, module, action, data); + }); + + if (!connections.length && selectors) { + + console.warn("Table Connection Error - No tables matching selector found", selectors); + } + }; + + Comms.prototype.receive = function (table, module, action, data) { + + if (this.table.modExists(module)) { + + return this.table.modules[module].commsReceived(table, action, data); + } else { + + console.warn("Inter-table Comms Error - no such module:", module); + } + }; + + Tabulator.prototype.registerModule("comms", Comms); + + var Accessor = function Accessor(table) { + this.table = table; //hold Tabulator object + this.allowedTypes = ["", "data", "download", "clipboard", "print", "htmlOutput"]; //list of accessor types + }; + + //initialize column accessor + Accessor.prototype.initializeColumn = function (column) { + var self = this, + match = false, + config = {}; + + this.allowedTypes.forEach(function (type) { + var key = "accessor" + (type.charAt(0).toUpperCase() + type.slice(1)), + accessor; + + if (column.definition[key]) { + accessor = self.lookupAccessor(column.definition[key]); + + if (accessor) { + match = true; + + config[key] = { + accessor: accessor, + params: column.definition[key + "Params"] || {} + }; + } + } + }); + + if (match) { + column.modules.accessor = config; + } + }; + + Accessor.prototype.lookupAccessor = function (value) { + var accessor = false; + + //set column accessor + switch (typeof value === 'undefined' ? 'undefined' : _typeof(value)) { + case "string": + if (this.accessors[value]) { + accessor = this.accessors[value]; + } else { + console.warn("Accessor Error - No such accessor found, ignoring: ", value); + } + break; + + case "function": + accessor = value; + break; + } + + return accessor; + }; + + //apply accessor to row + Accessor.prototype.transformRow = function (dataIn, type) { + var self = this, + key = "accessor" + (type.charAt(0).toUpperCase() + type.slice(1)); + + //clone data object with deep copy to isolate internal data from returned result + var data = Tabulator.prototype.helpers.deepClone(dataIn || {}); + + self.table.columnManager.traverse(function (column) { + var value, accessor, params, component; + + if (column.modules.accessor) { + + accessor = column.modules.accessor[key] || column.modules.accessor.accessor || false; + + if (accessor) { + value = column.getFieldValue(data); + + if (value != "undefined") { + component = column.getComponent(); + params = typeof accessor.params === "function" ? accessor.params(value, data, type, component) : accessor.params; + column.setFieldValue(data, accessor.accessor(value, data, type, params, component)); + } + } + } + }); + + return data; + }, + + //default accessors + Accessor.prototype.accessors = {}; + + Tabulator.prototype.registerModule("accessor", Accessor); + var Ajax = function Ajax(table) { + + this.table = table; //hold Tabulator object + this.config = false; //hold config object for ajax request + this.url = ""; //request URL + this.urlGenerator = false; + this.params = false; //request parameters + + this.loaderElement = this.createLoaderElement(); //loader message div + this.msgElement = this.createMsgElement(); //message element + this.loadingElement = false; + this.errorElement = false; + this.loaderPromise = false; + + this.progressiveLoad = false; + this.loading = false; + + this.requestOrder = 0; //prevent requests comming out of sequence if overridden by another load request + }; + + //initialize setup options + Ajax.prototype.initialize = function () { + var template; + + this.loaderElement.appendChild(this.msgElement); + + if (this.table.options.ajaxLoaderLoading) { + if (typeof this.table.options.ajaxLoaderLoading == "string") { + template = document.createElement('template'); + template.innerHTML = this.table.options.ajaxLoaderLoading.trim(); + this.loadingElement = template.content.firstChild; + } else { + this.loadingElement = this.table.options.ajaxLoaderLoading; + } + } + + this.loaderPromise = this.table.options.ajaxRequestFunc || this.defaultLoaderPromise; + + this.urlGenerator = this.table.options.ajaxURLGenerator || this.defaultURLGenerator; + + if (this.table.options.ajaxLoaderError) { + if (typeof this.table.options.ajaxLoaderError == "string") { + template = document.createElement('template'); + template.innerHTML = this.table.options.ajaxLoaderError.trim(); + this.errorElement = template.content.firstChild; + } else { + this.errorElement = this.table.options.ajaxLoaderError; + } + } + + if (this.table.options.ajaxParams) { + this.setParams(this.table.options.ajaxParams); + } + + if (this.table.options.ajaxConfig) { + this.setConfig(this.table.options.ajaxConfig); + } + + if (this.table.options.ajaxURL) { + this.setUrl(this.table.options.ajaxURL); + } + + if (this.table.options.ajaxProgressiveLoad) { + if (this.table.options.pagination) { + this.progressiveLoad = false; + console.error("Progressive Load Error - Pagination and progressive load cannot be used at the same time"); + } else { + if (this.table.modExists("page")) { + this.progressiveLoad = this.table.options.ajaxProgressiveLoad; + this.table.modules.page.initializeProgressive(this.progressiveLoad); + } else { + console.error("Pagination plugin is required for progressive ajax loading"); + } + } + } + }; + + Ajax.prototype.createLoaderElement = function () { + var el = document.createElement("div"); + el.classList.add("tabulator-loader"); + return el; + }; + + Ajax.prototype.createMsgElement = function () { + var el = document.createElement("div"); + + el.classList.add("tabulator-loader-msg"); + el.setAttribute("role", "alert"); + + return el; + }; + + //set ajax params + Ajax.prototype.setParams = function (params, update) { + if (update) { + this.params = this.params || {}; + + for (var key in params) { + this.params[key] = params[key]; + } + } else { + this.params = params; + } + }; + + Ajax.prototype.getParams = function () { + return this.params || {}; + }; + + //load config object + Ajax.prototype.setConfig = function (config) { + this._loadDefaultConfig(); + + if (typeof config == "string") { + this.config.method = config; + } else { + for (var key in config) { + this.config[key] = config[key]; + } + } + }; + + //create config object from default + Ajax.prototype._loadDefaultConfig = function (force) { + var self = this; + if (!self.config || force) { + + self.config = {}; + + //load base config from defaults + for (var key in self.defaultConfig) { + self.config[key] = self.defaultConfig[key]; + } + } + }; + + //set request url + Ajax.prototype.setUrl = function (url) { + this.url = url; + }; + + //get request url + Ajax.prototype.getUrl = function () { + return this.url; + }; + + //lstandard loading function + Ajax.prototype.loadData = function (inPosition, columnsChanged) { + var self = this; + + if (this.progressiveLoad) { + return this._loadDataProgressive(); + } else { + return this._loadDataStandard(inPosition, columnsChanged); + } + }; + + Ajax.prototype.nextPage = function (diff) { + var margin; + + if (!this.loading) { + + margin = this.table.options.ajaxProgressiveLoadScrollMargin || this.table.rowManager.getElement().clientHeight * 2; + + if (diff < margin) { + this.table.modules.page.nextPage().then(function () {}).catch(function () {}); + } + } + }; + + Ajax.prototype.blockActiveRequest = function () { + this.requestOrder++; + }; + + Ajax.prototype._loadDataProgressive = function () { + this.table.rowManager.setData([]); + return this.table.modules.page.setPage(1); + }; + + Ajax.prototype._loadDataStandard = function (inPosition, columnsChanged) { + var _this35 = this; + + return new Promise(function (resolve, reject) { + _this35.sendRequest(inPosition).then(function (data) { + _this35.table.rowManager.setData(data, inPosition, columnsChanged).then(function () { + resolve(); + }).catch(function (e) { + reject(e); + }); + }).catch(function (e) { + reject(e); + }); + }); + }; + + Ajax.prototype.generateParamsList = function (data, prefix) { + var self = this, + output = []; + + prefix = prefix || ""; + + if (Array.isArray(data)) { + data.forEach(function (item, i) { + output = output.concat(self.generateParamsList(item, prefix ? prefix + "[" + i + "]" : i)); + }); + } else if ((typeof data === 'undefined' ? 'undefined' : _typeof(data)) === "object") { + for (var key in data) { + output = output.concat(self.generateParamsList(data[key], prefix ? prefix + "[" + key + "]" : key)); + } + } else { + output.push({ key: prefix, value: data }); + } + + return output; + }; + + Ajax.prototype.serializeParams = function (params) { + var output = this.generateParamsList(params), + encoded = []; + + output.forEach(function (item) { + encoded.push(encodeURIComponent(item.key) + "=" + encodeURIComponent(item.value)); + }); + + return encoded.join("&"); + }; + + //send ajax request + Ajax.prototype.sendRequest = function (silent) { + var _this36 = this; + + var self = this, + url = self.url, + requestNo, + esc, + query; + + self.requestOrder++; + requestNo = self.requestOrder; + + self._loadDefaultConfig(); + + return new Promise(function (resolve, reject) { + if (self.table.options.ajaxRequesting.call(_this36.table, self.url, self.params) !== false) { + + self.loading = true; + + if (!silent) { + self.showLoader(); + } + + _this36.loaderPromise(url, self.config, self.params).then(function (data) { + if (requestNo === self.requestOrder) { + if (self.table.options.ajaxResponse) { + data = self.table.options.ajaxResponse.call(self.table, self.url, self.params, data); + } + resolve(data); + + self.hideLoader(); + self.loading = false; + } else { + console.warn("Ajax Response Blocked - An active ajax request was blocked by an attempt to change table data while the request was being made"); + } + }).catch(function (error) { + console.error("Ajax Load Error: ", error); + self.table.options.ajaxError.call(self.table, error); + + self.showError(); + + setTimeout(function () { + self.hideLoader(); + }, 3000); + + self.loading = false; + + reject(); + }); + } else { + reject(); + } + }); + }; + + Ajax.prototype.showLoader = function () { + var shouldLoad = typeof this.table.options.ajaxLoader === "function" ? this.table.options.ajaxLoader() : this.table.options.ajaxLoader; + + if (shouldLoad) { + + this.hideLoader(); + + while (this.msgElement.firstChild) { + this.msgElement.removeChild(this.msgElement.firstChild); + }this.msgElement.classList.remove("tabulator-error"); + this.msgElement.classList.add("tabulator-loading"); + + if (this.loadingElement) { + this.msgElement.appendChild(this.loadingElement); + } else { + this.msgElement.innerHTML = this.table.modules.localize.getText("ajax|loading"); + } + + this.table.element.appendChild(this.loaderElement); + } + }; + + Ajax.prototype.showError = function () { + this.hideLoader(); + + while (this.msgElement.firstChild) { + this.msgElement.removeChild(this.msgElement.firstChild); + }this.msgElement.classList.remove("tabulator-loading"); + this.msgElement.classList.add("tabulator-error"); + + if (this.errorElement) { + this.msgElement.appendChild(this.errorElement); + } else { + this.msgElement.innerHTML = this.table.modules.localize.getText("ajax|error"); + } + + this.table.element.appendChild(this.loaderElement); + }; + + Ajax.prototype.hideLoader = function () { + if (this.loaderElement.parentNode) { + this.loaderElement.parentNode.removeChild(this.loaderElement); + } + }; + + //default ajax config object + Ajax.prototype.defaultConfig = { + method: "GET" + }; + + Ajax.prototype.defaultURLGenerator = function (url, config, params) { + + if (url) { + if (params && Object.keys(params).length) { + if (!config.method || config.method.toLowerCase() == "get") { + config.method = "get"; + + url += (url.includes("?") ? "&" : "?") + this.serializeParams(params); + } + } + } + + return url; + }; + + Ajax.prototype.defaultLoaderPromise = function (url, config, params) { + var self = this, + contentType; + + return new Promise(function (resolve, reject) { + + //set url + url = self.urlGenerator(url, config, params); + + //set body content if not GET request + if (config.method.toUpperCase() != "GET") { + contentType = _typeof(self.table.options.ajaxContentType) === "object" ? self.table.options.ajaxContentType : self.contentTypeFormatters[self.table.options.ajaxContentType]; + if (contentType) { + + for (var key in contentType.headers) { + if (!config.headers) { + config.headers = {}; + } + + if (typeof config.headers[key] === "undefined") { + config.headers[key] = contentType.headers[key]; + } + } + + config.body = contentType.body.call(self, url, config, params); + } else { + console.warn("Ajax Error - Invalid ajaxContentType value:", self.table.options.ajaxContentType); + } + } + + if (url) { + + //configure headers + if (typeof config.headers === "undefined") { + config.headers = {}; + } + + if (typeof config.headers.Accept === "undefined") { + config.headers.Accept = "application/json"; + } + + if (typeof config.headers["X-Requested-With"] === "undefined") { + config.headers["X-Requested-With"] = "XMLHttpRequest"; + } + + if (typeof config.mode === "undefined") { + config.mode = "cors"; + } + + if (config.mode == "cors") { + + if (typeof config.headers["Access-Control-Allow-Origin"] === "undefined") { + config.headers["Access-Control-Allow-Origin"] = window.location.origin; + } + + if (typeof config.credentials === "undefined") { + config.credentials = 'same-origin'; + } + } else { + if (typeof config.credentials === "undefined") { + config.credentials = 'include'; + } + } + + //send request + fetch(url, config).then(function (response) { + if (response.ok) { + response.json().then(function (data) { + resolve(data); + }).catch(function (error) { + reject(error); + console.warn("Ajax Load Error - Invalid JSON returned", error); + }); + } else { + console.error("Ajax Load Error - Connection Error: " + response.status, response.statusText); + reject(response); + } + }).catch(function (error) { + console.error("Ajax Load Error - Connection Error: ", error); + reject(error); + }); + } else { + console.warn("Ajax Load Error - No URL Set"); + resolve([]); + } + }); + }; + + Ajax.prototype.contentTypeFormatters = { + "json": { + headers: { + 'Content-Type': 'application/json' + }, + body: function body(url, config, params) { + return JSON.stringify(params); + } + }, + "form": { + headers: {}, + body: function body(url, config, params) { + var output = this.generateParamsList(params), + form = new FormData(); + + output.forEach(function (item) { + form.append(item.key, item.value); + }); + + return form; + } + } + }; + + Tabulator.prototype.registerModule("ajax", Ajax); + + var ColumnCalcs = function ColumnCalcs(table) { + this.table = table; //hold Tabulator object + this.topCalcs = []; + this.botCalcs = []; + this.genColumn = false; + this.topElement = this.createElement(); + this.botElement = this.createElement(); + this.topRow = false; + this.botRow = false; + this.topInitialized = false; + this.botInitialized = false; + + this.initialize(); + }; + + ColumnCalcs.prototype.createElement = function () { + var el = document.createElement("div"); + el.classList.add("tabulator-calcs-holder"); + return el; + }; + + ColumnCalcs.prototype.initialize = function () { + this.genColumn = new Column({ field: "value" }, this); + }; + + //dummy functions to handle being mock column manager + ColumnCalcs.prototype.registerColumnField = function () {}; + + //initialize column calcs + ColumnCalcs.prototype.initializeColumn = function (column) { + var def = column.definition; + + var config = { + topCalcParams: def.topCalcParams || {}, + botCalcParams: def.bottomCalcParams || {} + }; + + if (def.topCalc) { + + switch (_typeof(def.topCalc)) { + case "string": + if (this.calculations[def.topCalc]) { + config.topCalc = this.calculations[def.topCalc]; + } else { + console.warn("Column Calc Error - No such calculation found, ignoring: ", def.topCalc); + } + break; + + case "function": + config.topCalc = def.topCalc; + break; + + } + + if (config.topCalc) { + column.modules.columnCalcs = config; + this.topCalcs.push(column); + + if (this.table.options.columnCalcs != "group") { + this.initializeTopRow(); + } + } + } + + if (def.bottomCalc) { + switch (_typeof(def.bottomCalc)) { + case "string": + if (this.calculations[def.bottomCalc]) { + config.botCalc = this.calculations[def.bottomCalc]; + } else { + console.warn("Column Calc Error - No such calculation found, ignoring: ", def.bottomCalc); + } + break; + + case "function": + config.botCalc = def.bottomCalc; + break; + + } + + if (config.botCalc) { + column.modules.columnCalcs = config; + this.botCalcs.push(column); + + if (this.table.options.columnCalcs != "group") { + this.initializeBottomRow(); + } + } + } + }; + + ColumnCalcs.prototype.removeCalcs = function () { + var changed = false; + + if (this.topInitialized) { + this.topInitialized = false; + this.topElement.parentNode.removeChild(this.topElement); + changed = true; + } + + if (this.botInitialized) { + this.botInitialized = false; + this.table.footerManager.remove(this.botElement); + changed = true; + } + + if (changed) { + this.table.rowManager.adjustTableSize(); + } + }; + + ColumnCalcs.prototype.initializeTopRow = function () { + if (!this.topInitialized) { + // this.table.columnManager.headersElement.after(this.topElement); + this.table.columnManager.getElement().insertBefore(this.topElement, this.table.columnManager.headersElement.nextSibling); + this.topInitialized = true; + } + }; + + ColumnCalcs.prototype.initializeBottomRow = function () { + if (!this.botInitialized) { + this.table.footerManager.prepend(this.botElement); + this.botInitialized = true; + } + }; + + ColumnCalcs.prototype.scrollHorizontal = function (left) { + var hozAdjust = 0, + scrollWidth = this.table.columnManager.getElement().scrollWidth - this.table.element.clientWidth; + + if (this.botInitialized) { + this.botRow.getElement().style.marginLeft = -left + "px"; + } + }; + + ColumnCalcs.prototype.recalc = function (rows) { + var data, row; + + if (this.topInitialized || this.botInitialized) { + data = this.rowsToData(rows); + + if (this.topInitialized) { + if (this.topRow) { + this.topRow.deleteCells(); + } + + row = this.generateRow("top", this.rowsToData(rows)); + this.topRow = row; + while (this.topElement.firstChild) { + this.topElement.removeChild(this.topElement.firstChild); + }this.topElement.appendChild(row.getElement()); + row.initialize(true); + } + + if (this.botInitialized) { + if (this.botRow) { + this.botRow.deleteCells(); + } + + row = this.generateRow("bottom", this.rowsToData(rows)); + this.botRow = row; + while (this.botElement.firstChild) { + this.botElement.removeChild(this.botElement.firstChild); + }this.botElement.appendChild(row.getElement()); + row.initialize(true); + } + + this.table.rowManager.adjustTableSize(); + + //set resizable handles + if (this.table.modExists("frozenColumns")) { + this.table.modules.frozenColumns.layout(); + } + } + }; + + ColumnCalcs.prototype.recalcRowGroup = function (row) { + this.recalcGroup(this.table.modules.groupRows.getRowGroup(row)); + }; + + ColumnCalcs.prototype.recalcAll = function () { + var _this37 = this; + + if (this.topCalcs.length || this.botCalcs.length) { + if (this.table.options.columnCalcs !== "group") { + this.recalc(this.table.rowManager.activeRows); + } + + if (this.table.options.groupBy && this.table.options.columnCalcs !== "table") { + + var groups = table.modules.groupRows.getChildGroups(); + + groups.forEach(function (group) { + _this37.recalcGroup(group); + }); + } + } + }; + + ColumnCalcs.prototype.recalcGroup = function (group) { + var data, rowData; + + if (group) { + if (group.calcs) { + if (group.calcs.bottom) { + data = this.rowsToData(group.rows); + rowData = this.generateRowData("bottom", data); + + group.calcs.bottom.updateData(rowData); + group.calcs.bottom.reinitialize(); + } + + if (group.calcs.top) { + data = this.rowsToData(group.rows); + rowData = this.generateRowData("top", data); + + group.calcs.top.updateData(rowData); + group.calcs.top.reinitialize(); + } + } + } + }; + + //generate top stats row + ColumnCalcs.prototype.generateTopRow = function (rows) { + return this.generateRow("top", this.rowsToData(rows)); + }; + //generate bottom stats row + ColumnCalcs.prototype.generateBottomRow = function (rows) { + return this.generateRow("bottom", this.rowsToData(rows)); + }; + + ColumnCalcs.prototype.rowsToData = function (rows) { + var _this38 = this; + + var data = []; + + rows.forEach(function (row) { + data.push(row.getData()); + + if (_this38.table.options.dataTree && _this38.table.options.dataTreeChildColumnCalcs) { + if (row.modules.dataTree.open) { + var children = _this38.rowsToData(_this38.table.modules.dataTree.getFilteredTreeChildren(row)); + data = data.concat(children); + } + } + }); + + return data; + }; + + //generate stats row + ColumnCalcs.prototype.generateRow = function (pos, data) { + var self = this, + rowData = this.generateRowData(pos, data), + row; + + if (self.table.modExists("mutator")) { + self.table.modules.mutator.disable(); + } + + row = new Row(rowData, this, "calc"); + + if (self.table.modExists("mutator")) { + self.table.modules.mutator.enable(); + } + + row.getElement().classList.add("tabulator-calcs", "tabulator-calcs-" + pos); + + row.generateCells = function () { + + var cells = []; + + self.table.columnManager.columnsByIndex.forEach(function (column) { + + //set field name of mock column + self.genColumn.setField(column.getField()); + self.genColumn.hozAlign = column.hozAlign; + + if (column.definition[pos + "CalcFormatter"] && self.table.modExists("format")) { + + self.genColumn.modules.format = { + formatter: self.table.modules.format.getFormatter(column.definition[pos + "CalcFormatter"]), + params: column.definition[pos + "CalcFormatterParams"] + }; + } else { + self.genColumn.modules.format = { + formatter: self.table.modules.format.getFormatter("plaintext"), + params: {} + }; + } + + //ensure css class defintion is replicated to calculation cell + self.genColumn.definition.cssClass = column.definition.cssClass; + + //generate cell and assign to correct column + var cell = new Cell(self.genColumn, row); + cell.column = column; + cell.setWidth(); + + column.cells.push(cell); + cells.push(cell); + + if (!column.visible) { + cell.hide(); + } + }); + + this.cells = cells; + }; + + return row; + }; + + //generate stats row + ColumnCalcs.prototype.generateRowData = function (pos, data) { + var rowData = {}, + calcs = pos == "top" ? this.topCalcs : this.botCalcs, + type = pos == "top" ? "topCalc" : "botCalc", + params, + paramKey; + + calcs.forEach(function (column) { + var values = []; + + if (column.modules.columnCalcs && column.modules.columnCalcs[type]) { + data.forEach(function (item) { + values.push(column.getFieldValue(item)); + }); + + paramKey = type + "Params"; + params = typeof column.modules.columnCalcs[paramKey] === "function" ? column.modules.columnCalcs[paramKey](values, data) : column.modules.columnCalcs[paramKey]; + + column.setFieldValue(rowData, column.modules.columnCalcs[type](values, data, params)); + } + }); + + return rowData; + }; + + ColumnCalcs.prototype.hasTopCalcs = function () { + return !!this.topCalcs.length; + }; + + ColumnCalcs.prototype.hasBottomCalcs = function () { + return !!this.botCalcs.length; + }; + + //handle table redraw + ColumnCalcs.prototype.redraw = function () { + if (this.topRow) { + this.topRow.normalizeHeight(true); + } + if (this.botRow) { + this.botRow.normalizeHeight(true); + } + }; + + //return the calculated + ColumnCalcs.prototype.getResults = function () { + var self = this, + results = {}, + groups; + + if (this.table.options.groupBy && this.table.modExists("groupRows")) { + groups = this.table.modules.groupRows.getGroups(true); + + groups.forEach(function (group) { + results[group.getKey()] = self.getGroupResults(group); + }); + } else { + results = { + top: this.topRow ? this.topRow.getData() : {}, + bottom: this.botRow ? this.botRow.getData() : {} + }; + } + + return results; + }; + + //get results from a group + ColumnCalcs.prototype.getGroupResults = function (group) { + var self = this, + groupObj = group._getSelf(), + subGroups = group.getSubGroups(), + subGroupResults = {}, + results = {}; + + subGroups.forEach(function (subgroup) { + subGroupResults[subgroup.getKey()] = self.getGroupResults(subgroup); + }); + + results = { + top: groupObj.calcs.top ? groupObj.calcs.top.getData() : {}, + bottom: groupObj.calcs.bottom ? groupObj.calcs.bottom.getData() : {}, + groups: subGroupResults + }; + + return results; + }; + + //default calculations + ColumnCalcs.prototype.calculations = { + "avg": function avg(values, data, calcParams) { + var output = 0, + precision = typeof calcParams.precision !== "undefined" ? calcParams.precision : 2; + + if (values.length) { + output = values.reduce(function (sum, value) { + value = Number(value); + return sum + value; + }); + + output = output / values.length; + + output = precision !== false ? output.toFixed(precision) : output; + } + + return parseFloat(output).toString(); + }, + "max": function max(values, data, calcParams) { + var output = null, + precision = typeof calcParams.precision !== "undefined" ? calcParams.precision : false; + + values.forEach(function (value) { + + value = Number(value); + + if (value > output || output === null) { + output = value; + } + }); + + return output !== null ? precision !== false ? output.toFixed(precision) : output : ""; + }, + "min": function min(values, data, calcParams) { + var output = null, + precision = typeof calcParams.precision !== "undefined" ? calcParams.precision : false; + + values.forEach(function (value) { + + value = Number(value); + + if (value < output || output === null) { + output = value; + } + }); + + return output !== null ? precision !== false ? output.toFixed(precision) : output : ""; + }, + "sum": function sum(values, data, calcParams) { + var output = 0, + precision = typeof calcParams.precision !== "undefined" ? calcParams.precision : false; + + if (values.length) { + values.forEach(function (value) { + value = Number(value); + + output += !isNaN(value) ? Number(value) : 0; + }); + } + + return precision !== false ? output.toFixed(precision) : output; + }, + "concat": function concat(values, data, calcParams) { + var output = 0; + + if (values.length) { + output = values.reduce(function (sum, value) { + return String(sum) + String(value); + }); + } + + return output; + }, + "count": function count(values, data, calcParams) { + var output = 0; + + if (values.length) { + values.forEach(function (value) { + if (value) { + output++; + } + }); + } + + return output; + } + }; + + Tabulator.prototype.registerModule("columnCalcs", ColumnCalcs); + + var Clipboard = function Clipboard(table) { + this.table = table; + this.mode = true; + + this.pasteParser = function () {}; + this.pasteAction = function () {}; + this.customSelection = false; + this.rowRange = false; + this.blocked = true; //block copy actions not originating from this command + }; + + Clipboard.prototype.initialize = function () { + var _this39 = this; + + this.mode = this.table.options.clipboard; + + this.rowRange = this.table.options.clipboardCopyRowRange; + + if (this.mode === true || this.mode === "copy") { + this.table.element.addEventListener("copy", function (e) { + var plain, html, list; + + if (!_this39.blocked) { + e.preventDefault(); + + if (_this39.customSelection) { + plain = _this39.customSelection; + + if (_this39.table.options.clipboardCopyFormatter) { + plain = _this39.table.options.clipboardCopyFormatter("plain", plain); + } + } else { + + var list = _this39.table.modules.export.generateExportList(_this39.rowRange, _this39.table.options.clipboardCopyStyled, _this39.table.options.clipboardCopyConfig, "clipboard"); + + html = _this39.table.modules.export.genereateHTMLTable(list); + plain = html ? _this39.generatePlainContent(list) : ""; + + if (_this39.table.options.clipboardCopyFormatter) { + plain = _this39.table.options.clipboardCopyFormatter("plain", plain); + html = _this39.table.options.clipboardCopyFormatter("html", html); + } + } + + if (window.clipboardData && window.clipboardData.setData) { + window.clipboardData.setData('Text', plain); + } else if (e.clipboardData && e.clipboardData.setData) { + e.clipboardData.setData('text/plain', plain); + if (html) { + e.clipboardData.setData('text/html', html); + } + } else if (e.originalEvent && e.originalEvent.clipboardData.setData) { + e.originalEvent.clipboardData.setData('text/plain', plain); + if (html) { + e.originalEvent.clipboardData.setData('text/html', html); + } + } + + _this39.table.options.clipboardCopied.call(_this39.table, plain, html); + + _this39.reset(); + } + }); + } + + if (this.mode === true || this.mode === "paste") { + this.table.element.addEventListener("paste", function (e) { + _this39.paste(e); + }); + } + + this.setPasteParser(this.table.options.clipboardPasteParser); + this.setPasteAction(this.table.options.clipboardPasteAction); + }; + + Clipboard.prototype.reset = function () { + this.blocked = false; + this.originalSelectionText = ""; + }; + + Clipboard.prototype.generatePlainContent = function (list) { + var output = []; + + list.forEach(function (row) { + var rowData = []; + + row.columns.forEach(function (col) { + var value = ""; + + if (col) { + + if (row.type === "group") { + col.value = col.component.getKey(); + } + + switch (_typeof(col.value)) { + case "object": + value = JSON.stringify(col.value); + break; + + case "undefined": + case "null": + value = ""; + break; + + default: + value = col.value; + } + } + + rowData.push(value); + }); + + output.push(rowData.join("\t")); + }); + + return output.join("\n"); + }; + + Clipboard.prototype.copy = function (range, internal) { + var range, sel, textRange; + this.blocked = false; + this.customSelection = false; + + if (this.mode === true || this.mode === "copy") { + + this.rowRange = range || this.table.options.clipboardCopyRowRange; + + if (typeof window.getSelection != "undefined" && typeof document.createRange != "undefined") { + range = document.createRange(); + range.selectNodeContents(this.table.element); + sel = window.getSelection(); + + if (sel.toString() && internal) { + this.customSelection = sel.toString(); + } + + sel.removeAllRanges(); + sel.addRange(range); + } else if (typeof document.selection != "undefined" && typeof document.body.createTextRange != "undefined") { + textRange = document.body.createTextRange(); + textRange.moveToElementText(this.table.element); + textRange.select(); + } + + document.execCommand('copy'); + + if (sel) { + sel.removeAllRanges(); + } + } + }; + + //PASTE EVENT HANDLING + + Clipboard.prototype.setPasteAction = function (action) { + + switch (typeof action === 'undefined' ? 'undefined' : _typeof(action)) { + case "string": + this.pasteAction = this.pasteActions[action]; + + if (!this.pasteAction) { + console.warn("Clipboard Error - No such paste action found:", action); + } + break; + + case "function": + this.pasteAction = action; + break; + } + }; + + Clipboard.prototype.setPasteParser = function (parser) { + switch (typeof parser === 'undefined' ? 'undefined' : _typeof(parser)) { + case "string": + this.pasteParser = this.pasteParsers[parser]; + + if (!this.pasteParser) { + console.warn("Clipboard Error - No such paste parser found:", parser); + } + break; + + case "function": + this.pasteParser = parser; + break; + } + }; + + Clipboard.prototype.paste = function (e) { + var data, rowData, rows; + + if (this.checkPaseOrigin(e)) { + + data = this.getPasteData(e); + + rowData = this.pasteParser.call(this, data); + + if (rowData) { + e.preventDefault(); + + if (this.table.modExists("mutator")) { + rowData = this.mutateData(rowData); + } + + rows = this.pasteAction.call(this, rowData); + this.table.options.clipboardPasted.call(this.table, data, rowData, rows); + } else { + this.table.options.clipboardPasteError.call(this.table, data); + } + } + }; + + Clipboard.prototype.mutateData = function (data) { + var self = this, + output = []; + + if (Array.isArray(data)) { + data.forEach(function (row) { + output.push(self.table.modules.mutator.transformRow(row, "clipboard")); + }); + } else { + output = data; + } + + return output; + }; + + Clipboard.prototype.checkPaseOrigin = function (e) { + var valid = true; + + if (e.target.tagName != "DIV" || this.table.modules.edit.currentCell) { + valid = false; + } + + return valid; + }; + + Clipboard.prototype.getPasteData = function (e) { + var data; + + if (window.clipboardData && window.clipboardData.getData) { + data = window.clipboardData.getData('Text'); + } else if (e.clipboardData && e.clipboardData.getData) { + data = e.clipboardData.getData('text/plain'); + } else if (e.originalEvent && e.originalEvent.clipboardData.getData) { + data = e.originalEvent.clipboardData.getData('text/plain'); + } + + return data; + }; + + Clipboard.prototype.pasteParsers = { + table: function table(clipboard) { + var data = [], + success = false, + headerFindSuccess = true, + columns = this.table.columnManager.columns, + columnMap = [], + rows = []; + + //get data from clipboard into array of columns and rows. + clipboard = clipboard.split("\n"); + + clipboard.forEach(function (row) { + data.push(row.split("\t")); + }); + + if (data.length && !(data.length === 1 && data[0].length < 2)) { + success = true; + + //check if headers are present by title + data[0].forEach(function (value) { + var column = columns.find(function (column) { + return value && column.definition.title && value.trim() && column.definition.title.trim() === value.trim(); + }); + + if (column) { + columnMap.push(column); + } else { + headerFindSuccess = false; + } + }); + + //check if column headers are present by field + if (!headerFindSuccess) { + headerFindSuccess = true; + columnMap = []; + + data[0].forEach(function (value) { + var column = columns.find(function (column) { + return value && column.field && value.trim() && column.field.trim() === value.trim(); + }); + + if (column) { + columnMap.push(column); + } else { + headerFindSuccess = false; + } + }); + + if (!headerFindSuccess) { + columnMap = this.table.columnManager.columnsByIndex; + } + } + + //remove header row if found + if (headerFindSuccess) { + data.shift(); + } + + data.forEach(function (item) { + var row = {}; + + item.forEach(function (value, i) { + if (columnMap[i]) { + row[columnMap[i].field] = value; + } + }); + + rows.push(row); + }); + + return rows; + } else { + return false; + } + } + }; + + Clipboard.prototype.pasteActions = { + replace: function replace(rows) { + return this.table.setData(rows); + }, + update: function update(rows) { + return this.table.updateOrAddData(rows); + }, + insert: function insert(rows) { + return this.table.addData(rows); + } + }; + + Tabulator.prototype.registerModule("clipboard", Clipboard); + + var DataTree = function DataTree(table) { + this.table = table; + this.indent = 10; + this.field = ""; + this.collapseEl = null; + this.expandEl = null; + this.branchEl = null; + this.elementField = false; + + this.startOpen = function () {}; + + this.displayIndex = 0; + }; + + DataTree.prototype.initialize = function () { + var dummyEl = null, + firstCol = this.table.columnManager.getFirstVisibileColumn(), + options = this.table.options; + + this.field = options.dataTreeChildField; + this.indent = options.dataTreeChildIndent; + this.elementField = options.dataTreeElementColumn || (firstCol ? firstCol.field : false); + + if (options.dataTreeBranchElement) { + + if (options.dataTreeBranchElement === true) { + this.branchEl = document.createElement("div"); + this.branchEl.classList.add("tabulator-data-tree-branch"); + } else { + if (typeof options.dataTreeBranchElement === "string") { + dummyEl = document.createElement("div"); + dummyEl.innerHTML = options.dataTreeBranchElement; + this.branchEl = dummyEl.firstChild; + } else { + this.branchEl = options.dataTreeBranchElement; + } + } + } + + if (options.dataTreeCollapseElement) { + if (typeof options.dataTreeCollapseElement === "string") { + dummyEl = document.createElement("div"); + dummyEl.innerHTML = options.dataTreeCollapseElement; + this.collapseEl = dummyEl.firstChild; + } else { + this.collapseEl = options.dataTreeCollapseElement; + } + } else { + this.collapseEl = document.createElement("div"); + this.collapseEl.classList.add("tabulator-data-tree-control"); + this.collapseEl.tabIndex = 0; + this.collapseEl.innerHTML = "
"; + } + + if (options.dataTreeExpandElement) { + if (typeof options.dataTreeExpandElement === "string") { + dummyEl = document.createElement("div"); + dummyEl.innerHTML = options.dataTreeExpandElement; + this.expandEl = dummyEl.firstChild; + } else { + this.expandEl = options.dataTreeExpandElement; + } + } else { + this.expandEl = document.createElement("div"); + this.expandEl.classList.add("tabulator-data-tree-control"); + this.expandEl.tabIndex = 0; + this.expandEl.innerHTML = "
"; + } + + switch (_typeof(options.dataTreeStartExpanded)) { + case "boolean": + this.startOpen = function (row, index) { + return options.dataTreeStartExpanded; + }; + break; + + case "function": + this.startOpen = options.dataTreeStartExpanded; + break; + + default: + this.startOpen = function (row, index) { + return options.dataTreeStartExpanded[index]; + }; + break; + } + }; + + DataTree.prototype.initializeRow = function (row) { + var childArray = row.getData()[this.field]; + var isArray = Array.isArray(childArray); + + var children = isArray || !isArray && (typeof childArray === 'undefined' ? 'undefined' : _typeof(childArray)) === "object" && childArray !== null; + + if (!children && row.modules.dataTree && row.modules.dataTree.branchEl) { + row.modules.dataTree.branchEl.parentNode.removeChild(row.modules.dataTree.branchEl); + } + + if (!children && row.modules.dataTree && row.modules.dataTree.controlEl) { + row.modules.dataTree.controlEl.parentNode.removeChild(row.modules.dataTree.controlEl); + } + + row.modules.dataTree = { + index: row.modules.dataTree ? row.modules.dataTree.index : 0, + open: children ? row.modules.dataTree ? row.modules.dataTree.open : this.startOpen(row.getComponent(), 0) : false, + controlEl: row.modules.dataTree && children ? row.modules.dataTree.controlEl : false, + branchEl: row.modules.dataTree && children ? row.modules.dataTree.branchEl : false, + parent: row.modules.dataTree ? row.modules.dataTree.parent : false, + children: children + }; + }; + + DataTree.prototype.layoutRow = function (row) { + var cell = this.elementField ? row.getCell(this.elementField) : row.getCells()[0], + el = cell.getElement(), + config = row.modules.dataTree; + + if (config.branchEl) { + if (config.branchEl.parentNode) { + config.branchEl.parentNode.removeChild(config.branchEl); + } + config.branchEl = false; + } + + if (config.controlEl) { + if (config.controlEl.parentNode) { + config.controlEl.parentNode.removeChild(config.controlEl); + } + config.controlEl = false; + } + + this.generateControlElement(row, el); + + row.element.classList.add("tabulator-tree-level-" + config.index); + + if (config.index) { + if (this.branchEl) { + config.branchEl = this.branchEl.cloneNode(true); + el.insertBefore(config.branchEl, el.firstChild); + config.branchEl.style.marginLeft = (config.branchEl.offsetWidth + config.branchEl.style.marginRight) * (config.index - 1) + config.index * this.indent + "px"; + } else { + el.style.paddingLeft = parseInt(window.getComputedStyle(el, null).getPropertyValue('padding-left')) + config.index * this.indent + "px"; + } + } + }; + + DataTree.prototype.generateControlElement = function (row, el) { + var _this40 = this; + + var config = row.modules.dataTree, + el = el || row.getCells()[0].getElement(), + oldControl = config.controlEl; + + if (config.children !== false) { + + if (config.open) { + config.controlEl = this.collapseEl.cloneNode(true); + config.controlEl.addEventListener("click", function (e) { + e.stopPropagation(); + _this40.collapseRow(row); + }); + } else { + config.controlEl = this.expandEl.cloneNode(true); + config.controlEl.addEventListener("click", function (e) { + e.stopPropagation(); + _this40.expandRow(row); + }); + } + + config.controlEl.addEventListener("mousedown", function (e) { + e.stopPropagation(); + }); + + if (oldControl && oldControl.parentNode === el) { + oldControl.parentNode.replaceChild(config.controlEl, oldControl); + } else { + el.insertBefore(config.controlEl, el.firstChild); + } + } + }; + + DataTree.prototype.setDisplayIndex = function (index) { + this.displayIndex = index; + }; + + DataTree.prototype.getDisplayIndex = function () { + return this.displayIndex; + }; + + DataTree.prototype.getRows = function (rows) { + var _this41 = this; + + var output = []; + + rows.forEach(function (row, i) { + var config, children; + + output.push(row); + + if (row instanceof Row) { + + config = row.modules.dataTree.children; + + if (!config.index && config.children !== false) { + children = _this41.getChildren(row); + + children.forEach(function (child) { + output.push(child); + }); + } + } + }); + + return output; + }; + + DataTree.prototype.getChildren = function (row) { + var _this42 = this; + + var config = row.modules.dataTree, + children = [], + output = []; + + if (config.children !== false && config.open) { + if (!Array.isArray(config.children)) { + config.children = this.generateChildren(row); + } + + if (this.table.modExists("filter")) { + children = this.table.modules.filter.filter(config.children); + } else { + children = config.children; + } + + if (this.table.modExists("sort")) { + this.table.modules.sort.sort(children); + } + + children.forEach(function (child) { + output.push(child); + + var subChildren = _this42.getChildren(child); + + subChildren.forEach(function (sub) { + output.push(sub); + }); + }); + } + + return output; + }; + + DataTree.prototype.generateChildren = function (row) { + var _this43 = this; + + var children = []; + + var childArray = row.getData()[this.field]; + + if (!Array.isArray(childArray)) { + childArray = [childArray]; + } + + childArray.forEach(function (childData) { + var childRow = new Row(childData || {}, _this43.table.rowManager); + childRow.modules.dataTree.index = row.modules.dataTree.index + 1; + childRow.modules.dataTree.parent = row; + if (childRow.modules.dataTree.children) { + childRow.modules.dataTree.open = _this43.startOpen(childRow.getComponent(), childRow.modules.dataTree.index); + } + children.push(childRow); + }); + + return children; + }; + + DataTree.prototype.expandRow = function (row, silent) { + var config = row.modules.dataTree; + + if (config.children !== false) { + config.open = true; + + row.reinitialize(); + + this.table.rowManager.refreshActiveData("tree", false, true); + + this.table.options.dataTreeRowExpanded(row.getComponent(), row.modules.dataTree.index); + } + }; + + DataTree.prototype.collapseRow = function (row) { + var config = row.modules.dataTree; + + if (config.children !== false) { + config.open = false; + + row.reinitialize(); + + this.table.rowManager.refreshActiveData("tree", false, true); + + this.table.options.dataTreeRowCollapsed(row.getComponent(), row.modules.dataTree.index); + } + }; + + DataTree.prototype.toggleRow = function (row) { + var config = row.modules.dataTree; + + if (config.children !== false) { + if (config.open) { + this.collapseRow(row); + } else { + this.expandRow(row); + } + } + }; + + DataTree.prototype.getTreeParent = function (row) { + return row.modules.dataTree.parent ? row.modules.dataTree.parent.getComponent() : false; + }; + + DataTree.prototype.getFilteredTreeChildren = function (row) { + var config = row.modules.dataTree, + output = [], + children; + + if (config.children) { + + if (!Array.isArray(config.children)) { + config.children = this.generateChildren(row); + } + + if (this.table.modExists("filter")) { + children = this.table.modules.filter.filter(config.children); + } else { + children = config.children; + } + + children.forEach(function (childRow) { + if (childRow instanceof Row) { + output.push(childRow); + } + }); + } + + return output; + }; + + DataTree.prototype.rowDelete = function (row) { + var parent = row.modules.dataTree.parent, + childIndex; + + if (parent) { + childIndex = this.findChildIndex(row, parent); + + if (childIndex !== false) { + parent.data[this.field].splice(childIndex, 1); + } + + if (!parent.data[this.field].length) { + delete parent.data[this.field]; + } + + this.initializeRow(parent); + this.layoutRow(parent); + } + + this.table.rowManager.refreshActiveData("tree", false, true); + }; + + DataTree.prototype.addTreeChildRow = function (row, data, top, index) { + var childIndex = false; + + if (typeof data === "string") { + data = JSON.parse(data); + } + + if (!Array.isArray(row.data[this.field])) { + row.data[this.field] = []; + + row.modules.dataTree.open = this.startOpen(row.getComponent(), row.modules.dataTree.index); + } + + if (typeof index !== "undefined") { + childIndex = this.findChildIndex(index, row); + + if (childIndex !== false) { + row.data[this.field].splice(top ? childIndex : childIndex + 1, 0, data); + } + } + + if (childIndex === false) { + if (top) { + row.data[this.field].unshift(data); + } else { + row.data[this.field].push(data); + } + } + + this.initializeRow(row); + this.layoutRow(row); + + this.table.rowManager.refreshActiveData("tree", false, true); + }; + + DataTree.prototype.findChildIndex = function (subject, parent) { + var _this44 = this; + + var match = false; + + if ((typeof subject === 'undefined' ? 'undefined' : _typeof(subject)) == "object") { + + if (subject instanceof Row) { + //subject is row element + match = subject.data; + } else if (subject instanceof RowComponent) { + //subject is public row component + match = subject._getSelf().data; + } else if (typeof HTMLElement !== "undefined" && subject instanceof HTMLElement) { + if (parent.modules.dataTree) { + match = parent.modules.dataTree.children.find(function (childRow) { + return childRow instanceof Row ? childRow.element === subject : false; + }); + + if (match) { + match = match.data; + } + } + } + } else if (typeof subject == "undefined" || subject === null) { + match = false; + } else { + //subject should be treated as the index of the row + match = parent.data[this.field].find(function (row) { + return row.data[_this44.table.options.index] == subject; + }); + } + + if (match) { + + if (Array.isArray(parent.data[this.field])) { + match = parent.data[this.field].indexOf(match); + } + + if (match == -1) { + match = false; + } + } + + //catch all for any other type of input + + return match; + }; + + DataTree.prototype.getTreeChildren = function (row) { + var config = row.modules.dataTree, + output = []; + + if (config.children) { + + if (!Array.isArray(config.children)) { + config.children = this.generateChildren(row); + } + + config.children.forEach(function (childRow) { + if (childRow instanceof Row) { + output.push(childRow.getComponent()); + } + }); + } + + return output; + }; + + DataTree.prototype.checkForRestyle = function (cell) { + if (!cell.row.cells.indexOf(cell)) { + cell.row.reinitialize(); + } + }; + + DataTree.prototype.getChildField = function () { + return this.field; + }; + + DataTree.prototype.redrawNeeded = function (data) { + return (this.field ? typeof data[this.field] !== "undefined" : false) || (this.elementField ? typeof data[this.elementField] !== "undefined" : false); + }; + + Tabulator.prototype.registerModule("dataTree", DataTree); + + var Download = function Download(table) { + this.table = table; //hold Tabulator object + }; + + //trigger file download + Download.prototype.download = function (type, filename, options, range, interceptCallback) { + var self = this, + downloadFunc = false; + + function buildLink(data, mime) { + if (interceptCallback) { + if (interceptCallback === true) { + self.triggerDownload(data, mime, type, filename, true); + } else { + interceptCallback(data); + } + } else { + self.triggerDownload(data, mime, type, filename); + } + } + + if (typeof type == "function") { + downloadFunc = type; + } else { + if (self.downloaders[type]) { + downloadFunc = self.downloaders[type]; + } else { + console.warn("Download Error - No such download type found: ", type); + } + } + + if (downloadFunc) { + var list = this.generateExportList(range); + + downloadFunc.call(this.table, list, options || {}, buildLink); + } + }; + + Download.prototype.generateExportList = function (range) { + var list = this.table.modules.export.generateExportList(this.table.options.downloadConfig, false, range || this.table.options.downloadRowRange, "download"); + + //assign group header formatter + var groupHeader = this.table.options.groupHeaderDownload; + + if (groupHeader && !Array.isArray(groupHeader)) { + groupHeader = [groupHeader]; + } + + list.forEach(function (row) { + var group; + + if (row.type === "group") { + group = row.columns[0]; + + if (groupHeader && groupHeader[row.indent]) { + group.value = groupHeader[row.indent](group.value, row.component._group.getRowCount(), row.component._group.getData(), row.component); + } + } + }); + + return list; + }; + + Download.prototype.triggerDownload = function (data, mime, type, filename, newTab) { + var element = document.createElement('a'), + blob = new Blob([data], { type: mime }), + filename = filename || "Tabulator." + (typeof type === "function" ? "txt" : type); + + blob = this.table.options.downloadReady.call(this.table, data, blob); + + if (blob) { + + if (newTab) { + window.open(window.URL.createObjectURL(blob)); + } else { + if (navigator.msSaveOrOpenBlob) { + navigator.msSaveOrOpenBlob(blob, filename); + } else { + element.setAttribute('href', window.URL.createObjectURL(blob)); + + //set file title + element.setAttribute('download', filename); + + //trigger download + element.style.display = 'none'; + document.body.appendChild(element); + element.click(); + + //remove temporary link element + document.body.removeChild(element); + } + } + + if (this.table.options.downloadComplete) { + this.table.options.downloadComplete(); + } + } + }; + + Download.prototype.commsReceived = function (table, action, data) { + switch (action) { + case "intercept": + this.download(data.type, "", data.options, data.active, data.intercept); + break; + } + }; + + //downloaders + Download.prototype.downloaders = { + csv: function csv(list, options, setFileContents) { + var delimiter = options && options.delimiter ? options.delimiter : ",", + fileContents = [], + headers = []; + + list.forEach(function (row) { + var item = []; + + switch (row.type) { + case "group": + console.warn("Download Warning - CSV downloader cannot process row groups"); + break; + + case "calc": + console.warn("Download Warning - CSV downloader cannot process column calculations"); + break; + + case "header": + row.columns.forEach(function (col, i) { + if (col && col.depth === 1) { + headers[i] = typeof col.value == "undefined" || typeof col.value == "null" ? "" : col.value; + } + }); + break; + + case "row": + row.columns.forEach(function (col) { + + if (col) { + + switch (_typeof(col.value)) { + case "object": + col.value = JSON.stringify(col.value); + break; + + case "undefined": + case "null": + col.value = ""; + break; + } + + item.push('"' + String(col.value).split('"').join('""') + '"'); + } + }); + + fileContents.push(item.join(delimiter)); + break; + } + }); + + if (headers.length) { + fileContents = [headers].concat(fileContents); + } + + fileContents = fileContents.join("\n"); + + if (options.bom) { + fileContents = '\uFEFF' + fileContents; + } + + setFileContents(fileContents, "text/csv"); + }, + + json: function json(list, options, setFileContents) { + var fileContents = []; + + list.forEach(function (row) { + var item = {}; + + switch (row.type) { + case "header": + break; + + case "group": + console.warn("Download Warning - JSON downloader cannot process row groups"); + break; + + case "calc": + console.warn("Download Warning - JSON downloader cannot process column calculations"); + break; + + case "row": + row.columns.forEach(function (col) { + if (col) { + item[col.component.getField()] = col.value; + } + }); + + fileContents.push(item); + break; + } + }); + + fileContents = JSON.stringify(fileContents, null, '\t'); + + setFileContents(fileContents, "application/json"); + }, + + pdf: function pdf(list, options, setFileContents) { + var header = [], + body = [], + autoTableParams = {}, + rowGroupStyles = options.rowGroupStyles || { + fontStyle: "bold", + fontSize: 12, + cellPadding: 6, + fillColor: 220 + }, + rowCalcStyles = options.rowCalcStyles || { + fontStyle: "bold", + fontSize: 10, + cellPadding: 4, + fillColor: 232 + }, + jsPDFParams = options.jsPDF || {}, + title = options && options.title ? options.title : ""; + + if (!jsPDFParams.orientation) { + jsPDFParams.orientation = options.orientation || "landscape"; + } + + if (!jsPDFParams.unit) { + jsPDFParams.unit = "pt"; + } + + //parse row list + list.forEach(function (row) { + var item = {}; + + switch (row.type) { + case "header": + header.push(parseRow(row)); + break; + + case "group": + body.push(parseRow(row, rowGroupStyles)); + break; + + case "calc": + body.push(parseRow(row, rowCalcStyles)); + break; + + case "row": + body.push(parseRow(row)); + break; + } + }); + + function parseRow(row, styles) { + var rowData = []; + + row.columns.forEach(function (col) { + var cell; + + if (col) { + switch (_typeof(col.value)) { + case "object": + col.value = JSON.stringify(col.value); + break; + + case "undefined": + case "null": + col.value = ""; + break; + } + + cell = { + content: col.value, + colSpan: col.width, + rowSpan: col.height + }; + + if (styles) { + cell.styles = styles; + } + + rowData.push(cell); + } else { + rowData.push(""); + } + }); + + return rowData; + } + + //configure PDF + var doc = new jsPDF(jsPDFParams); //set document to landscape, better for most tables + + if (options && options.autoTable) { + if (typeof options.autoTable === "function") { + autoTableParams = options.autoTable(doc) || {}; + } else { + autoTableParams = options.autoTable; + } + } + + if (title) { + autoTableParams.addPageContent = function (data) { + doc.text(title, 40, 30); + }; + } + + autoTableParams.head = header; + autoTableParams.body = body; + + doc.autoTable(autoTableParams); + + if (options && options.documentProcessing) { + options.documentProcessing(doc); + } + + setFileContents(doc.output("arraybuffer"), "application/pdf"); + }, + + xlsx: function xlsx(list, options, setFileContents) { + var self = this, + sheetName = options.sheetName || "Sheet1", + workbook = XLSX.utils.book_new(), + output; + + workbook.SheetNames = []; + workbook.Sheets = {}; + + function generateSheet() { + var rows = [], + merges = [], + worksheet = {}, + range = { s: { c: 0, r: 0 }, e: { c: list[0] ? list[0].columns.reduce(function (a, b) { + return a + (b && b.width ? b.width : 1); + }, 0) : 0, r: list.length } }; + + //parse row list + list.forEach(function (row, i) { + var rowData = []; + + row.columns.forEach(function (col, j) { + + if (col) { + rowData.push(!(col.value instanceof Date) && _typeof(col.value) === "object" ? JSON.stringify(col.value) : col.value); + + if (col.width > 1 || col.height > -1) { + merges.push({ s: { r: i, c: j }, e: { r: i + col.height - 1, c: j + col.width - 1 } }); + } + } else { + rowData.push(""); + } + }); + + rows.push(rowData); + }); + + //convert rows to worksheet + XLSX.utils.sheet_add_aoa(worksheet, rows); + + worksheet['!ref'] = XLSX.utils.encode_range(range); + + if (merges.length) { + worksheet["!merges"] = merges; + } + + return worksheet; + } + + if (options.sheetOnly) { + setFileContents(generateSheet()); + return; + } + + if (options.sheets) { + for (var sheet in options.sheets) { + + if (options.sheets[sheet] === true) { + workbook.SheetNames.push(sheet); + workbook.Sheets[sheet] = generateSheet(); + } else { + + workbook.SheetNames.push(sheet); + + this.table.modules.comms.send(options.sheets[sheet], "download", "intercept", { + type: "xlsx", + options: { sheetOnly: true }, + active: self.active, + intercept: function intercept(data) { + workbook.Sheets[sheet] = data; + } + }); + } + } + } else { + workbook.SheetNames.push(sheetName); + workbook.Sheets[sheetName] = generateSheet(); + } + + if (options.documentProcessing) { + workbook = options.documentProcessing(workbook); + } + + //convert workbook to binary array + function s2ab(s) { + var buf = new ArrayBuffer(s.length); + var view = new Uint8Array(buf); + for (var i = 0; i != s.length; ++i) { + view[i] = s.charCodeAt(i) & 0xFF; + }return buf; + } + + output = XLSX.write(workbook, { bookType: 'xlsx', bookSST: true, type: 'binary' }); + + setFileContents(s2ab(output), "application/octet-stream"); + }, + + html: function html(list, options, setFileContents) { + if (this.modExists("export", true)) { + setFileContents(this.modules.export.genereateHTMLTable(list), "text/html"); + } + } + + }; + + Tabulator.prototype.registerModule("download", Download); + + var Edit = function Edit(table) { + this.table = table; //hold Tabulator object + this.currentCell = false; //hold currently editing cell + this.mouseClick = false; //hold mousedown state to prevent click binding being overriden by editor opening + this.recursionBlock = false; //prevent focus recursion + this.invalidEdit = false; + this.editedCells = []; + }; + + //initialize column editor + Edit.prototype.initializeColumn = function (column) { + var self = this, + config = { + editor: false, + blocked: false, + check: column.definition.editable, + params: column.definition.editorParams || {} + }; + + //set column editor + switch (_typeof(column.definition.editor)) { + case "string": + + if (column.definition.editor === "tick") { + column.definition.editor = "tickCross"; + console.warn("DEPRECATION WARNING - the tick editor has been deprecated, please use the tickCross editor"); + } + + if (self.editors[column.definition.editor]) { + config.editor = self.editors[column.definition.editor]; + } else { + console.warn("Editor Error - No such editor found: ", column.definition.editor); + } + break; + + case "function": + config.editor = column.definition.editor; + break; + + case "boolean": + + if (column.definition.editor === true) { + + if (typeof column.definition.formatter !== "function") { + + if (column.definition.formatter === "tick") { + column.definition.formatter = "tickCross"; + console.warn("DEPRECATION WARNING - the tick editor has been deprecated, please use the tickCross editor"); + } + + if (self.editors[column.definition.formatter]) { + config.editor = self.editors[column.definition.formatter]; + } else { + config.editor = self.editors["input"]; + } + } else { + console.warn("Editor Error - Cannot auto lookup editor for a custom formatter: ", column.definition.formatter); + } + } + break; + } + + if (config.editor) { + column.modules.edit = config; + } + }; + + Edit.prototype.getCurrentCell = function () { + return this.currentCell ? this.currentCell.getComponent() : false; + }; + + Edit.prototype.clearEditor = function (cancel) { + var cell = this.currentCell, + cellEl; + + this.invalidEdit = false; + + if (cell) { + this.currentCell = false; + + cellEl = cell.getElement(); + + if (cancel) { + cell.validate(); + } else { + cellEl.classList.remove("tabulator-validation-fail"); + } + + cellEl.classList.remove("tabulator-editing"); + while (cellEl.firstChild) { + cellEl.removeChild(cellEl.firstChild); + }cell.row.getElement().classList.remove("tabulator-row-editing"); + } + }; + + Edit.prototype.cancelEdit = function () { + + if (this.currentCell) { + var cell = this.currentCell; + var component = this.currentCell.getComponent(); + + this.clearEditor(true); + cell.setValueActual(cell.getValue()); + cell.cellRendered(); + + if (cell.column.cellEvents.cellEditCancelled) { + cell.column.cellEvents.cellEditCancelled.call(this.table, component); + } + + this.table.options.cellEditCancelled.call(this.table, component); + } + }; + + //return a formatted value for a cell + Edit.prototype.bindEditor = function (cell) { + var self = this, + element = cell.getElement(); + + element.setAttribute("tabindex", 0); + + element.addEventListener("click", function (e) { + if (!element.classList.contains("tabulator-editing")) { + element.focus({ preventScroll: true }); + } + }); + + element.addEventListener("mousedown", function (e) { + self.mouseClick = true; + }); + + element.addEventListener("focus", function (e) { + if (!self.recursionBlock) { + self.edit(cell, e, false); + } + }); + }; + + Edit.prototype.focusCellNoEvent = function (cell, block) { + this.recursionBlock = true; + if (!(block && this.table.browser === "ie")) { + cell.getElement().focus({ preventScroll: true }); + } + this.recursionBlock = false; + }; + + Edit.prototype.editCell = function (cell, forceEdit) { + this.focusCellNoEvent(cell); + this.edit(cell, false, forceEdit); + }; + + Edit.prototype.focusScrollAdjust = function (cell) { + if (this.table.rowManager.getRenderMode() == "virtual") { + var topEdge = this.table.rowManager.element.scrollTop, + bottomEdge = this.table.rowManager.element.clientHeight + this.table.rowManager.element.scrollTop, + rowEl = cell.row.getElement(), + offset = rowEl.offsetTop; + + if (rowEl.offsetTop < topEdge) { + this.table.rowManager.element.scrollTop -= topEdge - rowEl.offsetTop; + } else { + if (rowEl.offsetTop + rowEl.offsetHeight > bottomEdge) { + this.table.rowManager.element.scrollTop += rowEl.offsetTop + rowEl.offsetHeight - bottomEdge; + } + } + } + }; + + Edit.prototype.edit = function (cell, e, forceEdit) { + var self = this, + allowEdit = true, + rendered = function rendered() {}, + element = cell.getElement(), + cellEditor, + component, + params; + + //prevent editing if another cell is refusing to leave focus (eg. validation fail) + if (this.currentCell) { + if (!this.invalidEdit) { + this.cancelEdit(); + } + return; + } + + //handle successfull value change + function success(value) { + if (self.currentCell === cell) { + var valid = true; + + if (cell.column.modules.validate && self.table.modExists("validate") && self.table.options.validationMode != "manual") { + valid = self.table.modules.validate.validate(cell.column.modules.validate, cell, value); + } + + if (valid === true || self.table.options.validationMode === "highlight") { + self.clearEditor(); + cell.setValue(value, true); + + if (!cell.modules.edit) { + cell.modules.edit = {}; + } + + cell.modules.edit.edited = true; + + if (self.editedCells.indexOf(cell) == -1) { + self.editedCells.push(cell); + } + + if (self.table.options.dataTree && self.table.modExists("dataTree")) { + self.table.modules.dataTree.checkForRestyle(cell); + } + + if (valid !== true) { + element.classList.add("tabulator-validation-fail"); + return false; + } + + return true; + } else { + self.invalidEdit = true; + element.classList.add("tabulator-validation-fail"); + self.focusCellNoEvent(cell, true); + rendered(); + self.table.options.validationFailed.call(self.table, cell.getComponent(), value, valid); + + return false; + } + } else { + // console.warn("Edit Success Error - cannot call success on a cell that is no longer being edited"); + } + } + + //handle aborted edit + function cancel() { + if (self.currentCell === cell) { + self.cancelEdit(); + + if (self.table.options.dataTree && self.table.modExists("dataTree")) { + self.table.modules.dataTree.checkForRestyle(cell); + } + } else { + // console.warn("Edit Success Error - cannot call cancel on a cell that is no longer being edited"); + } + } + + function onRendered(callback) { + rendered = callback; + } + + if (!cell.column.modules.edit.blocked) { + if (e) { + e.stopPropagation(); + } + + switch (_typeof(cell.column.modules.edit.check)) { + case "function": + allowEdit = cell.column.modules.edit.check(cell.getComponent()); + break; + + case "boolean": + allowEdit = cell.column.modules.edit.check; + break; + } + + if (allowEdit || forceEdit) { + + self.cancelEdit(); + + self.currentCell = cell; + + this.focusScrollAdjust(cell); + + component = cell.getComponent(); + + if (this.mouseClick) { + this.mouseClick = false; + + if (cell.column.cellEvents.cellClick) { + cell.column.cellEvents.cellClick.call(this.table, e, component); + } + } + + if (cell.column.cellEvents.cellEditing) { + cell.column.cellEvents.cellEditing.call(this.table, component); + } + + self.table.options.cellEditing.call(this.table, component); + + params = typeof cell.column.modules.edit.params === "function" ? cell.column.modules.edit.params(component) : cell.column.modules.edit.params; + + cellEditor = cell.column.modules.edit.editor.call(self, component, onRendered, success, cancel, params); + + //if editor returned, add to DOM, if false, abort edit + if (cellEditor !== false) { + + if (cellEditor instanceof Node) { + element.classList.add("tabulator-editing"); + cell.row.getElement().classList.add("tabulator-row-editing"); + while (element.firstChild) { + element.removeChild(element.firstChild); + }element.appendChild(cellEditor); + + //trigger onRendered Callback + rendered(); + + //prevent editing from triggering rowClick event + var children = element.children; + + for (var i = 0; i < children.length; i++) { + children[i].addEventListener("click", function (e) { + e.stopPropagation(); + }); + } + } else { + console.warn("Edit Error - Editor should return an instance of Node, the editor returned:", cellEditor); + element.blur(); + return false; + } + } else { + element.blur(); + return false; + } + + return true; + } else { + this.mouseClick = false; + element.blur(); + return false; + } + } else { + this.mouseClick = false; + element.blur(); + return false; + } + }; + + Edit.prototype.maskInput = function (el, options) { + var mask = options.mask, + maskLetter = typeof options.maskLetterChar !== "undefined" ? options.maskLetterChar : "A", + maskNumber = typeof options.maskNumberChar !== "undefined" ? options.maskNumberChar : "9", + maskWildcard = typeof options.maskWildcardChar !== "undefined" ? options.maskWildcardChar : "*", + success = false; + + function fillSymbols(index) { + var symbol = mask[index]; + if (typeof symbol !== "undefined" && symbol !== maskWildcard && symbol !== maskLetter && symbol !== maskNumber) { + el.value = el.value + "" + symbol; + fillSymbols(index + 1); + } + } + + el.addEventListener("keydown", function (e) { + var index = el.value.length, + char = e.key; + + if (e.keyCode > 46) { + if (index >= mask.length) { + e.preventDefault(); + e.stopPropagation(); + success = false; + return false; + } else { + switch (mask[index]) { + case maskLetter: + if (char.toUpperCase() == char.toLowerCase()) { + e.preventDefault(); + e.stopPropagation(); + success = false; + return false; + } + break; + + case maskNumber: + if (isNaN(char)) { + e.preventDefault(); + e.stopPropagation(); + success = false; + return false; + } + break; + + case maskWildcard: + break; + + default: + if (char !== mask[index]) { + e.preventDefault(); + e.stopPropagation(); + success = false; + return false; + } + } + } + + success = true; + } + + return; + }); + + el.addEventListener("keyup", function (e) { + if (e.keyCode > 46) { + if (options.maskAutoFill) { + fillSymbols(el.value.length); + } + } + }); + + if (!el.placeholder) { + el.placeholder = mask; + } + + if (options.maskAutoFill) { + fillSymbols(el.value.length); + } + }; + + Edit.prototype.getEditedCells = function () { + var output = []; + + this.editedCells.forEach(function (cell) { + output.push(cell.getComponent()); + }); + + return output; + }; + + Edit.prototype.clearEdited = function (cell) { + var editIndex; + + if (cell.modules.edit && cell.modules.edit.edited) { + cell.modules.validate.invalid = false; + + editIndex = this.editedCells.indexOf(cell); + + if (editIndex > -1) { + this.editedCells.splice(editIndex, 1); + } + } + }; + + //default data editors + Edit.prototype.editors = { + + //input element + input: function input(cell, onRendered, success, cancel, editorParams) { + + //create and style input + var cellValue = cell.getValue(), + input = document.createElement("input"); + + input.setAttribute("type", editorParams.search ? "search" : "text"); + + input.style.padding = "4px"; + input.style.width = "100%"; + input.style.boxSizing = "border-box"; + + if (editorParams.elementAttributes && _typeof(editorParams.elementAttributes) == "object") { + for (var key in editorParams.elementAttributes) { + if (key.charAt(0) == "+") { + key = key.slice(1); + input.setAttribute(key, input.getAttribute(key) + editorParams.elementAttributes["+" + key]); + } else { + input.setAttribute(key, editorParams.elementAttributes[key]); + } + } + } + + input.value = typeof cellValue !== "undefined" ? cellValue : ""; + + onRendered(function () { + input.focus({ preventScroll: true }); + input.style.height = "100%"; + }); + + function onChange(e) { + if ((cellValue === null || typeof cellValue === "undefined") && input.value !== "" || input.value !== cellValue) { + if (success(input.value)) { + cellValue = input.value; //persist value if successfully validated incase editor is used as header filter + } + } else { + cancel(); + } + } + + //submit new value on blur or change + input.addEventListener("change", onChange); + input.addEventListener("blur", onChange); + + //submit new value on enter + input.addEventListener("keydown", function (e) { + switch (e.keyCode) { + // case 9: + case 13: + onChange(e); + break; + + case 27: + cancel(); + break; + } + }); + + if (editorParams.mask) { + this.table.modules.edit.maskInput(input, editorParams); + } + + return input; + }, + + //resizable text area element + textarea: function textarea(cell, onRendered, success, cancel, editorParams) { + var self = this, + cellValue = cell.getValue(), + vertNav = editorParams.verticalNavigation || "hybrid", + value = String(cellValue !== null && typeof cellValue !== "undefined" ? cellValue : ""), + count = (value.match(/(?:\r\n|\r|\n)/g) || []).length + 1, + input = document.createElement("textarea"), + scrollHeight = 0; + + //create and style input + input.style.display = "block"; + input.style.padding = "2px"; + input.style.height = "100%"; + input.style.width = "100%"; + input.style.boxSizing = "border-box"; + input.style.whiteSpace = "pre-wrap"; + input.style.resize = "none"; + + if (editorParams.elementAttributes && _typeof(editorParams.elementAttributes) == "object") { + for (var key in editorParams.elementAttributes) { + if (key.charAt(0) == "+") { + key = key.slice(1); + input.setAttribute(key, input.getAttribute(key) + editorParams.elementAttributes["+" + key]); + } else { + input.setAttribute(key, editorParams.elementAttributes[key]); + } + } + } + + input.value = value; + + onRendered(function () { + input.focus({ preventScroll: true }); + input.style.height = "100%"; + }); + + function onChange(e) { + + if ((cellValue === null || typeof cellValue === "undefined") && input.value !== "" || input.value !== cellValue) { + + if (success(input.value)) { + cellValue = input.value; //persist value if successfully validated incase editor is used as header filter + } + + setTimeout(function () { + cell.getRow().normalizeHeight(); + }, 300); + } else { + cancel(); + } + } + + //submit new value on blur or change + input.addEventListener("change", onChange); + input.addEventListener("blur", onChange); + + input.addEventListener("keyup", function () { + + input.style.height = ""; + + var heightNow = input.scrollHeight; + + input.style.height = heightNow + "px"; + + if (heightNow != scrollHeight) { + scrollHeight = heightNow; + cell.getRow().normalizeHeight(); + } + }); + + input.addEventListener("keydown", function (e) { + + switch (e.keyCode) { + case 27: + cancel(); + break; + + case 38: + //up arrow + if (vertNav == "editor" || vertNav == "hybrid" && input.selectionStart) { + e.stopImmediatePropagation(); + e.stopPropagation(); + } + + break; + + case 40: + //down arrow + if (vertNav == "editor" || vertNav == "hybrid" && input.selectionStart !== input.value.length) { + e.stopImmediatePropagation(); + e.stopPropagation(); + } + break; + } + }); + + if (editorParams.mask) { + this.table.modules.edit.maskInput(input, editorParams); + } + + return input; + }, + + //input element with type of number + number: function number(cell, onRendered, success, cancel, editorParams) { + + var cellValue = cell.getValue(), + vertNav = editorParams.verticalNavigation || "editor", + input = document.createElement("input"); + + input.setAttribute("type", "number"); + + if (typeof editorParams.max != "undefined") { + input.setAttribute("max", editorParams.max); + } + + if (typeof editorParams.min != "undefined") { + input.setAttribute("min", editorParams.min); + } + + if (typeof editorParams.step != "undefined") { + input.setAttribute("step", editorParams.step); + } + + //create and style input + input.style.padding = "4px"; + input.style.width = "100%"; + input.style.boxSizing = "border-box"; + + if (editorParams.elementAttributes && _typeof(editorParams.elementAttributes) == "object") { + for (var key in editorParams.elementAttributes) { + if (key.charAt(0) == "+") { + key = key.slice(1); + input.setAttribute(key, input.getAttribute(key) + editorParams.elementAttributes["+" + key]); + } else { + input.setAttribute(key, editorParams.elementAttributes[key]); + } + } + } + + input.value = cellValue; + + var blurFunc = function blurFunc(e) { + onChange(); + }; + + onRendered(function () { + //submit new value on blur + input.removeEventListener("blur", blurFunc); + + input.focus({ preventScroll: true }); + input.style.height = "100%"; + + //submit new value on blur + input.addEventListener("blur", blurFunc); + }); + + function onChange() { + var value = input.value; + + if (!isNaN(value) && value !== "") { + value = Number(value); + } + + if (value !== cellValue) { + if (success(value)) { + cellValue = value; //persist value if successfully validated incase editor is used as header filter + } + } else { + cancel(); + } + } + + //submit new value on enter + input.addEventListener("keydown", function (e) { + switch (e.keyCode) { + case 13: + // case 9: + onChange(); + break; + + case 27: + cancel(); + break; + + case 38: //up arrow + case 40: + //down arrow + if (vertNav == "editor") { + e.stopImmediatePropagation(); + e.stopPropagation(); + } + break; + } + }); + + if (editorParams.mask) { + this.table.modules.edit.maskInput(input, editorParams); + } + + return input; + }, + + //input element with type of number + range: function range(cell, onRendered, success, cancel, editorParams) { + + var cellValue = cell.getValue(), + input = document.createElement("input"); + + input.setAttribute("type", "range"); + + if (typeof editorParams.max != "undefined") { + input.setAttribute("max", editorParams.max); + } + + if (typeof editorParams.min != "undefined") { + input.setAttribute("min", editorParams.min); + } + + if (typeof editorParams.step != "undefined") { + input.setAttribute("step", editorParams.step); + } + + //create and style input + input.style.padding = "4px"; + input.style.width = "100%"; + input.style.boxSizing = "border-box"; + + if (editorParams.elementAttributes && _typeof(editorParams.elementAttributes) == "object") { + for (var key in editorParams.elementAttributes) { + if (key.charAt(0) == "+") { + key = key.slice(1); + input.setAttribute(key, input.getAttribute(key) + editorParams.elementAttributes["+" + key]); + } else { + input.setAttribute(key, editorParams.elementAttributes[key]); + } + } + } + + input.value = cellValue; + + onRendered(function () { + input.focus({ preventScroll: true }); + input.style.height = "100%"; + }); + + function onChange() { + var value = input.value; + + if (!isNaN(value) && value !== "") { + value = Number(value); + } + + if (value != cellValue) { + if (success(value)) { + cellValue = value; //persist value if successfully validated incase editor is used as header filter + } + } else { + cancel(); + } + } + + //submit new value on blur + input.addEventListener("blur", function (e) { + onChange(); + }); + + //submit new value on enter + input.addEventListener("keydown", function (e) { + switch (e.keyCode) { + case 13: + // case 9: + onChange(); + break; + + case 27: + cancel(); + break; + } + }); + + return input; + }, + + //select + select: function select(cell, onRendered, success, cancel, editorParams) { + var self = this, + cellEl = cell.getElement(), + initialValue = cell.getValue(), + vertNav = editorParams.verticalNavigation || "editor", + initialDisplayValue = typeof initialValue !== "undefined" || initialValue === null ? initialValue : typeof editorParams.defaultValue !== "undefined" ? editorParams.defaultValue : [], + input = document.createElement("input"), + listEl = document.createElement("div"), + multiselect = editorParams.multiselect, + dataItems = [], + currentItem = {}, + displayItems = [], + currentItems = [], + blurable = true; + + this.table.rowManager.element.addEventListener("scroll", cancelItem); + + if (Array.isArray(editorParams) || !Array.isArray(editorParams) && (typeof editorParams === 'undefined' ? 'undefined' : _typeof(editorParams)) === "object" && !editorParams.values) { + console.warn("DEPRECATION WARNING - values for the select editor must now be passed into the values property of the editorParams object, not as the editorParams object"); + editorParams = { values: editorParams }; + } + + function getUniqueColumnValues(field) { + var output = {}, + data = self.table.getData(), + column; + + if (field) { + column = self.table.columnManager.getColumnByField(field); + } else { + column = cell.getColumn()._getSelf(); + } + + if (column) { + data.forEach(function (row) { + var val = column.getFieldValue(row); + + if (val !== null && typeof val !== "undefined" && val !== "") { + output[val] = true; + } + }); + + if (editorParams.sortValuesList) { + if (editorParams.sortValuesList == "asc") { + output = Object.keys(output).sort(); + } else { + output = Object.keys(output).sort().reverse(); + } + } else { + output = Object.keys(output); + } + } else { + console.warn("unable to find matching column to create select lookup list:", field); + } + + return output; + } + + function parseItems(inputValues, curentValues) { + var dataList = []; + var displayList = []; + + function processComplexListItem(item) { + var item = { + label: item.label, + value: item.value, + itemParams: item.itemParams, + elementAttributes: item.elementAttributes, + element: false + }; + + // if(item.value === curentValue || (!isNaN(parseFloat(item.value)) && !isNaN(parseFloat(item.value)) && parseFloat(item.value) === parseFloat(curentValue))){ + // setCurrentItem(item); + // } + + if (curentValues.indexOf(item.value) > -1) { + setItem(item); + } + + dataList.push(item); + displayList.push(item); + + return item; + } + + if (typeof inputValues == "function") { + inputValues = inputValues(cell); + } + + if (Array.isArray(inputValues)) { + inputValues.forEach(function (value) { + var item; + + if ((typeof value === 'undefined' ? 'undefined' : _typeof(value)) === "object") { + + if (value.options) { + item = { + label: value.label, + group: true, + itemParams: value.itemParams, + elementAttributes: value.elementAttributes, + element: false + }; + + displayList.push(item); + + value.options.forEach(function (item) { + processComplexListItem(item); + }); + } else { + processComplexListItem(value); + } + } else { + + item = { + label: value, + value: value, + element: false + }; + + // if(item.value === curentValue || (!isNaN(parseFloat(item.value)) && !isNaN(parseFloat(item.value)) && parseFloat(item.value) === parseFloat(curentValue))){ + // setCurrentItem(item); + // } + + if (curentValues.indexOf(item.value) > -1) { + setItem(item); + } + + dataList.push(item); + displayList.push(item); + } + }); + } else { + for (var key in inputValues) { + var item = { + label: inputValues[key], + value: key, + element: false + }; + + // if(item.value === curentValue || (!isNaN(parseFloat(item.value)) && !isNaN(parseFloat(item.value)) && parseFloat(item.value) === parseFloat(curentValue))){ + // setCurrentItem(item); + // } + + if (curentValues.indexOf(item.value) > -1) { + setItem(item); + } + + dataList.push(item); + displayList.push(item); + } + } + + dataItems = dataList; + displayItems = displayList; + + fillList(); + } + + function fillList() { + while (listEl.firstChild) { + listEl.removeChild(listEl.firstChild); + }displayItems.forEach(function (item) { + + var el = item.element; + + if (!el) { + el = document.createElement("div"); + item.label = editorParams.listItemFormatter ? editorParams.listItemFormatter(item.value, item.label, cell, el, item.itemParams) : item.label; + if (item.group) { + el.classList.add("tabulator-edit-select-list-group"); + el.tabIndex = 0; + el.innerHTML = item.label === "" ? " " : item.label; + } else { + el.classList.add("tabulator-edit-select-list-item"); + el.tabIndex = 0; + el.innerHTML = item.label === "" ? " " : item.label; + + el.addEventListener("click", function () { + // setCurrentItem(item); + // chooseItem(); + if (multiselect) { + toggleItem(item); + input.focus(); + } else { + chooseItem(item); + } + }); + + // if(item === currentItem){ + // el.classList.add("active"); + // } + + if (currentItems.indexOf(item) > -1) { + el.classList.add("active"); + } + } + + if (item.elementAttributes && _typeof(item.elementAttributes) == "object") { + for (var key in item.elementAttributes) { + if (key.charAt(0) == "+") { + key = key.slice(1); + el.setAttribute(key, input.getAttribute(key) + item.elementAttributes["+" + key]); + } else { + el.setAttribute(key, item.elementAttributes[key]); + } + } + } + el.addEventListener("mousedown", function () { + blurable = false; + + setTimeout(function () { + blurable = true; + }, 10); + }); + + item.element = el; + } + + listEl.appendChild(el); + }); + } + + function setCurrentItem(item, active) { + + if (!multiselect && currentItem && currentItem.element) { + currentItem.element.classList.remove("active"); + } + + if (currentItem && currentItem.element) { + currentItem.element.classList.remove("focused"); + } + + currentItem = item; + + if (item.element) { + item.element.classList.add("focused"); + if (active) { + item.element.classList.add("active"); + } + } + } + + // function chooseItem(){ + // hideList(); + + // if(initialValue !== currentItem.value){ + // initialValue = currentItem.value; + // success(currentItem.value); + // }else{ + // cancel(); + // } + // } + + function setItem(item) { + var index = currentItems.indexOf(item); + + if (index == -1) { + currentItems.push(item); + setCurrentItem(item, true); + } + + fillInput(); + } + + function unsetItem(index) { + var item = currentItems[index]; + + if (index > -1) { + currentItems.splice(index, 1); + if (item.element) { + item.element.classList.remove("active"); + } + } + } + + function toggleItem(item) { + if (!item) { + item = currentItem; + } + + var index = currentItems.indexOf(item); + + if (index > -1) { + unsetItem(index); + } else { + if (multiselect !== true && currentItems.length >= multiselect) { + unsetItem(0); + } + + setItem(item); + } + + fillInput(); + } + + function chooseItem(item) { + hideList(); + + if (!item) { + item = currentItem; + } + + if (item) { + success(item.value); + } + } + + function chooseItems() { + hideList(); + + var output = []; + + currentItems.forEach(function (item) { + output.push(item.value); + }); + + success(output); + } + + function fillInput() { + var output = []; + + currentItems.forEach(function (item) { + output.push(item.label); + }); + + input.value = output.join(", "); + } + + function cancelItem() { + hideList(); + cancel(); + } + + function showList() { + if (!listEl.parentNode) { + + if (editorParams.values === true) { + parseItems(getUniqueColumnValues(), initialDisplayValue); + } else if (typeof editorParams.values === "string") { + parseItems(getUniqueColumnValues(editorParams.values), initialDisplayValue); + } else { + parseItems(editorParams.values || [], initialDisplayValue); + } + + var offset = Tabulator.prototype.helpers.elOffset(cellEl); + + listEl.style.minWidth = cellEl.offsetWidth + "px"; + + listEl.style.top = offset.top + cellEl.offsetHeight + "px"; + listEl.style.left = offset.left + "px"; + + listEl.addEventListener("mousedown", function (e) { + blurable = false; + + setTimeout(function () { + blurable = true; + }, 10); + }); + + document.body.appendChild(listEl); + } + } + + function hideList() { + if (listEl.parentNode) { + listEl.parentNode.removeChild(listEl); + } + + removeScrollListener(); + } + + function removeScrollListener() { + self.table.rowManager.element.removeEventListener("scroll", cancelItem); + } + + //style input + input.setAttribute("type", "text"); + + input.style.padding = "4px"; + input.style.width = "100%"; + input.style.boxSizing = "border-box"; + input.style.cursor = "default"; + input.readOnly = this.currentCell != false; + + if (editorParams.elementAttributes && _typeof(editorParams.elementAttributes) == "object") { + for (var key in editorParams.elementAttributes) { + if (key.charAt(0) == "+") { + key = key.slice(1); + input.setAttribute(key, input.getAttribute(key) + editorParams.elementAttributes["+" + key]); + } else { + input.setAttribute(key, editorParams.elementAttributes[key]); + } + } + } + + input.value = typeof initialValue !== "undefined" || initialValue === null ? initialValue : ""; + + // if(editorParams.values === true){ + // parseItems(getUniqueColumnValues(), initialValue); + // }else if(typeof editorParams.values === "string"){ + // parseItems(getUniqueColumnValues(editorParams.values), initialValue); + // }else{ + // parseItems(editorParams.values || [], initialValue); + // } + + //allow key based navigation + input.addEventListener("keydown", function (e) { + var index; + + switch (e.keyCode) { + case 38: + //up arrow + index = dataItems.indexOf(currentItem); + + if (vertNav == "editor" || vertNav == "hybrid" && index) { + e.stopImmediatePropagation(); + e.stopPropagation(); + e.preventDefault(); + + if (index > 0) { + setCurrentItem(dataItems[index - 1], !multiselect); + } + } + break; + + case 40: + //down arrow + index = dataItems.indexOf(currentItem); + + if (vertNav == "editor" || vertNav == "hybrid" && index < dataItems.length - 1) { + e.stopImmediatePropagation(); + e.stopPropagation(); + e.preventDefault(); + + if (index < dataItems.length - 1) { + if (index == -1) { + setCurrentItem(dataItems[0], !multiselect); + } else { + setCurrentItem(dataItems[index + 1], !multiselect); + } + } + } + break; + + case 37: //left arrow + case 39: + //right arrow + e.stopImmediatePropagation(); + e.stopPropagation(); + e.preventDefault(); + break; + + case 13: + //enter + // chooseItem(); + + if (multiselect) { + toggleItem(); + } else { + chooseItem(); + } + + break; + + case 27: + //escape + cancelItem(); + break; + } + }); + + input.addEventListener("blur", function (e) { + if (blurable) { + if (multiselect) { + chooseItems(); + } else { + cancelItem(); + } + } + }); + + input.addEventListener("focus", function (e) { + showList(); + }); + + //style list element + listEl = document.createElement("div"); + listEl.classList.add("tabulator-edit-select-list"); + + onRendered(function () { + input.style.height = "100%"; + input.focus({ preventScroll: true }); + }); + + return input; + }, + + //autocomplete + autocomplete: function autocomplete(cell, onRendered, success, cancel, editorParams) { + var self = this, + cellEl = cell.getElement(), + initialValue = cell.getValue(), + vertNav = editorParams.verticalNavigation || "editor", + initialDisplayValue = typeof initialValue !== "undefined" || initialValue === null ? initialValue : typeof editorParams.defaultValue !== "undefined" ? editorParams.defaultValue : "", + input = document.createElement("input"), + listEl = document.createElement("div"), + allItems = [], + displayItems = [], + values = [], + currentItem = false, + blurable = true, + uniqueColumnValues = false; + + this.table.rowManager.element.addEventListener("scroll", cancelItem); + + //style input + input.setAttribute("type", "search"); + + input.style.padding = "4px"; + input.style.width = "100%"; + input.style.boxSizing = "border-box"; + + if (editorParams.elementAttributes && _typeof(editorParams.elementAttributes) == "object") { + for (var key in editorParams.elementAttributes) { + if (key.charAt(0) == "+") { + key = key.slice(1); + input.setAttribute(key, input.getAttribute(key) + editorParams.elementAttributes["+" + key]); + } else { + input.setAttribute(key, editorParams.elementAttributes[key]); + } + } + } + + //style list element + listEl.classList.add("tabulator-edit-select-list"); + + listEl.addEventListener("mousedown", function (e) { + blurable = false; + + setTimeout(function () { + blurable = true; + }, 10); + }); + + function genUniqueColumnValues() { + if (editorParams.values === true) { + uniqueColumnValues = getUniqueColumnValues(); + } else if (typeof editorParams.values === "string") { + uniqueColumnValues = getUniqueColumnValues(editorParams.values); + } + } + + function getUniqueColumnValues(field) { + var output = {}, + data = self.table.getData(), + column; + + if (field) { + column = self.table.columnManager.getColumnByField(field); + } else { + column = cell.getColumn()._getSelf(); + } + + if (column) { + data.forEach(function (row) { + var val = column.getFieldValue(row); + + if (val !== null && typeof val !== "undefined" && val !== "") { + output[val] = true; + } + }); + + if (editorParams.sortValuesList) { + if (editorParams.sortValuesList == "asc") { + output = Object.keys(output).sort(); + } else { + output = Object.keys(output).sort().reverse(); + } + } else { + output = Object.keys(output); + } + } else { + console.warn("unable to find matching column to create autocomplete lookup list:", field); + } + + return output; + } + + function filterList(term, intialLoad) { + var matches = [], + values, + items, + searchEl; + + //lookup base values list + if (uniqueColumnValues) { + values = uniqueColumnValues; + } else { + values = editorParams.values || []; + } + + if (editorParams.searchFunc) { + matches = editorParams.searchFunc(term, values); + + if (matches instanceof Promise) { + + addNotice(typeof editorParams.searchingPlaceholder !== "undefined" ? editorParams.searchingPlaceholder : "Searching..."); + + matches.then(function (result) { + fillListIfNotEmpty(parseItems(result), intialLoad); + }).catch(function (err) { + console.err("error in autocomplete search promise:", err); + }); + } else { + fillListIfNotEmpty(parseItems(matches), intialLoad); + } + } else { + items = parseItems(values); + + if (term === "") { + if (editorParams.showListOnEmpty) { + matches = items; + } + } else { + items.forEach(function (item) { + if (item.value !== null || typeof item.value !== "undefined") { + if (String(item.value).toLowerCase().indexOf(String(term).toLowerCase()) > -1 || String(item.title).toLowerCase().indexOf(String(term).toLowerCase()) > -1) { + matches.push(item); + } + } + }); + } + + fillListIfNotEmpty(matches, intialLoad); + } + } + + function addNotice(notice) { + var searchEl = document.createElement("div"); + + clearList(); + + if (notice !== false) { + searchEl.classList.add("tabulator-edit-select-list-notice"); + searchEl.tabIndex = 0; + + if (notice instanceof Node) { + searchEl.appendChild(notice); + } else { + searchEl.innerHTML = notice; + } + + listEl.appendChild(searchEl); + } + } + + function parseItems(inputValues) { + var itemList = []; + + if (Array.isArray(inputValues)) { + inputValues.forEach(function (value) { + + var item = {}; + + if ((typeof value === 'undefined' ? 'undefined' : _typeof(value)) === "object") { + item.title = editorParams.listItemFormatter ? editorParams.listItemFormatter(value.value, value.label) : value.label; + item.value = value.value; + } else { + item.title = editorParams.listItemFormatter ? editorParams.listItemFormatter(value, value) : value; + item.value = value; + } + + itemList.push(item); + }); + } else { + for (var key in inputValues) { + var item = { + title: editorParams.listItemFormatter ? editorParams.listItemFormatter(key, inputValues[key]) : inputValues[key], + value: key + }; + + itemList.push(item); + } + } + + return itemList; + } + + function clearList() { + while (listEl.firstChild) { + listEl.removeChild(listEl.firstChild); + } + } + + function fillListIfNotEmpty(items, intialLoad) { + if (items.length) { + fillList(items, intialLoad); + } else { + if (editorParams.emptyPlaceholder) { + addNotice(editorParams.emptyPlaceholder); + } + } + } + + function fillList(items, intialLoad) { + var current = false; + + clearList(); + + displayItems = items; + + displayItems.forEach(function (item) { + var el = item.element; + + if (!el) { + el = document.createElement("div"); + el.classList.add("tabulator-edit-select-list-item"); + el.tabIndex = 0; + el.innerHTML = item.title; + + el.addEventListener("click", function (e) { + setCurrentItem(item); + chooseItem(); + }); + + el.addEventListener("mousedown", function (e) { + blurable = false; + + setTimeout(function () { + blurable = true; + }, 10); + }); + + item.element = el; + + if (intialLoad && item.value == initialValue) { + input.value = item.title; + item.element.classList.add("active"); + current = true; + } + + if (item === currentItem) { + item.element.classList.add("active"); + current = true; + } + } + + listEl.appendChild(el); + }); + + if (!current) { + setCurrentItem(false); + } + } + + function chooseItem() { + hideList(); + + if (currentItem) { + if (initialValue !== currentItem.value) { + initialValue = currentItem.value; + input.value = currentItem.title; + success(currentItem.value); + } else { + cancel(); + } + } else { + if (editorParams.freetext) { + initialValue = input.value; + success(input.value); + } else { + if (editorParams.allowEmpty && input.value === "") { + initialValue = input.value; + success(input.value); + } else { + cancel(); + } + } + } + } + + function showList() { + if (!listEl.parentNode) { + while (listEl.firstChild) { + listEl.removeChild(listEl.firstChild); + }var offset = Tabulator.prototype.helpers.elOffset(cellEl); + + listEl.style.minWidth = cellEl.offsetWidth + "px"; + + listEl.style.top = offset.top + cellEl.offsetHeight + "px"; + listEl.style.left = offset.left + "px"; + document.body.appendChild(listEl); + } + } + + function setCurrentItem(item, showInputValue) { + if (currentItem && currentItem.element) { + currentItem.element.classList.remove("active"); + } + + currentItem = item; + + if (item && item.element) { + item.element.classList.add("active"); + } + } + + function hideList() { + if (listEl.parentNode) { + listEl.parentNode.removeChild(listEl); + } + + removeScrollListener(); + } + + function cancelItem() { + hideList(); + cancel(); + } + + function removeScrollListener() { + self.table.rowManager.element.removeEventListener("scroll", cancelItem); + } + + //allow key based navigation + input.addEventListener("keydown", function (e) { + var index; + + switch (e.keyCode) { + case 38: + //up arrow + index = displayItems.indexOf(currentItem); + + if (vertNav == "editor" || vertNav == "hybrid" && index) { + e.stopImmediatePropagation(); + e.stopPropagation(); + e.preventDefault(); + + if (index > 0) { + setCurrentItem(displayItems[index - 1]); + } else { + setCurrentItem(false); + } + } + break; + + case 40: + //down arrow + + index = displayItems.indexOf(currentItem); + + if (vertNav == "editor" || vertNav == "hybrid" && index < displayItems.length - 1) { + + e.stopImmediatePropagation(); + e.stopPropagation(); + e.preventDefault(); + + if (index < displayItems.length - 1) { + if (index == -1) { + setCurrentItem(displayItems[0]); + } else { + setCurrentItem(displayItems[index + 1]); + } + } + } + break; + + case 37: //left arrow + case 39: + //right arrow + e.stopImmediatePropagation(); + e.stopPropagation(); + // e.preventDefault(); + break; + + case 13: + //enter + chooseItem(); + break; + + case 27: + //escape + cancelItem(); + break; + + case 36: //home + case 35: + //end + //prevent table navigation while using input element + e.stopImmediatePropagation(); + break; + } + }); + + input.addEventListener("keyup", function (e) { + + switch (e.keyCode) { + case 38: //up arrow + case 37: //left arrow + case 39: //up arrow + case 40: //right arrow + case 13: //enter + case 27: + //escape + break; + + default: + filterList(input.value); + } + }); + + input.addEventListener("search", function (e) { + filterList(input.value); + }); + + input.addEventListener("blur", function (e) { + if (blurable) { + chooseItem(); + } + }); + + input.addEventListener("focus", function (e) { + var value = initialDisplayValue; + genUniqueColumnValues(); + showList(); + input.value = value; + filterList(value, true); + }); + + onRendered(function () { + input.style.height = "100%"; + input.focus({ preventScroll: true }); + }); + + if (editorParams.mask) { + this.table.modules.edit.maskInput(input, editorParams); + } + + return input; + }, + + //star rating + star: function star(cell, onRendered, success, cancel, editorParams) { + var self = this, + element = cell.getElement(), + value = cell.getValue(), + maxStars = element.getElementsByTagName("svg").length || 5, + size = element.getElementsByTagName("svg")[0] ? element.getElementsByTagName("svg")[0].getAttribute("width") : 14, + stars = [], + starsHolder = document.createElement("div"), + star = document.createElementNS('http://www.w3.org/2000/svg', "svg"); + + //change star type + function starChange(val) { + stars.forEach(function (star, i) { + if (i < val) { + if (self.table.browser == "ie") { + star.setAttribute("class", "tabulator-star-active"); + } else { + star.classList.replace("tabulator-star-inactive", "tabulator-star-active"); + } + + star.innerHTML = ''; + } else { + if (self.table.browser == "ie") { + star.setAttribute("class", "tabulator-star-inactive"); + } else { + star.classList.replace("tabulator-star-active", "tabulator-star-inactive"); + } + + star.innerHTML = ''; + } + }); + } + + //build stars + function buildStar(i) { + + var starHolder = document.createElement("span"); + var nextStar = star.cloneNode(true); + + stars.push(nextStar); + + starHolder.addEventListener("mouseenter", function (e) { + e.stopPropagation(); + e.stopImmediatePropagation(); + starChange(i); + }); + + starHolder.addEventListener("mousemove", function (e) { + e.stopPropagation(); + e.stopImmediatePropagation(); + }); + + starHolder.addEventListener("click", function (e) { + e.stopPropagation(); + e.stopImmediatePropagation(); + success(i); + element.blur(); + }); + + starHolder.appendChild(nextStar); + starsHolder.appendChild(starHolder); + } + + //handle keyboard navigation value change + function changeValue(val) { + value = val; + starChange(val); + } + + //style cell + element.style.whiteSpace = "nowrap"; + element.style.overflow = "hidden"; + element.style.textOverflow = "ellipsis"; + + //style holding element + starsHolder.style.verticalAlign = "middle"; + starsHolder.style.display = "inline-block"; + starsHolder.style.padding = "4px"; + + //style star + star.setAttribute("width", size); + star.setAttribute("height", size); + star.setAttribute("viewBox", "0 0 512 512"); + star.setAttribute("xml:space", "preserve"); + star.style.padding = "0 1px"; + + if (editorParams.elementAttributes && _typeof(editorParams.elementAttributes) == "object") { + for (var key in editorParams.elementAttributes) { + if (key.charAt(0) == "+") { + key = key.slice(1); + starsHolder.setAttribute(key, starsHolder.getAttribute(key) + editorParams.elementAttributes["+" + key]); + } else { + starsHolder.setAttribute(key, editorParams.elementAttributes[key]); + } + } + } + + //create correct number of stars + for (var i = 1; i <= maxStars; i++) { + buildStar(i); + } + + //ensure value does not exceed number of stars + value = Math.min(parseInt(value), maxStars); + + // set initial styling of stars + starChange(value); + + starsHolder.addEventListener("mousemove", function (e) { + starChange(0); + }); + + starsHolder.addEventListener("click", function (e) { + success(0); + }); + + element.addEventListener("blur", function (e) { + cancel(); + }); + + //allow key based navigation + element.addEventListener("keydown", function (e) { + switch (e.keyCode) { + case 39: + //right arrow + changeValue(value + 1); + break; + + case 37: + //left arrow + changeValue(value - 1); + break; + + case 13: + //enter + success(value); + break; + + case 27: + //escape + cancel(); + break; + } + }); + + return starsHolder; + }, + + //draggable progress bar + progress: function progress(cell, onRendered, success, cancel, editorParams) { + var element = cell.getElement(), + max = typeof editorParams.max === "undefined" ? element.getElementsByTagName("div")[0].getAttribute("max") || 100 : editorParams.max, + min = typeof editorParams.min === "undefined" ? element.getElementsByTagName("div")[0].getAttribute("min") || 0 : editorParams.min, + percent = (max - min) / 100, + value = cell.getValue() || 0, + handle = document.createElement("div"), + bar = document.createElement("div"), + mouseDrag, + mouseDragWidth; + + //set new value + function updateValue() { + var calcVal = percent * Math.round(bar.offsetWidth / (element.clientWidth / 100)) + min; + success(calcVal); + element.setAttribute("aria-valuenow", calcVal); + element.setAttribute("aria-label", value); + } + + //style handle + handle.style.position = "absolute"; + handle.style.right = "0"; + handle.style.top = "0"; + handle.style.bottom = "0"; + handle.style.width = "5px"; + handle.classList.add("tabulator-progress-handle"); + + //style bar + bar.style.display = "inline-block"; + bar.style.position = "relative"; + // bar.style.top = "8px"; + // bar.style.bottom = "8px"; + // bar.style.left = "4px"; + // bar.style.marginRight = "4px"; + bar.style.height = "100%"; + bar.style.backgroundColor = "#488CE9"; + bar.style.maxWidth = "100%"; + bar.style.minWidth = "0%"; + + if (editorParams.elementAttributes && _typeof(editorParams.elementAttributes) == "object") { + for (var key in editorParams.elementAttributes) { + if (key.charAt(0) == "+") { + key = key.slice(1); + bar.setAttribute(key, bar.getAttribute(key) + editorParams.elementAttributes["+" + key]); + } else { + bar.setAttribute(key, editorParams.elementAttributes[key]); + } + } + } + + //style cell + element.style.padding = "4px 4px"; + + //make sure value is in range + value = Math.min(parseFloat(value), max); + value = Math.max(parseFloat(value), min); + + //workout percentage + value = Math.round((value - min) / percent); + // bar.style.right = value + "%"; + bar.style.width = value + "%"; + + element.setAttribute("aria-valuemin", min); + element.setAttribute("aria-valuemax", max); + + bar.appendChild(handle); + + handle.addEventListener("mousedown", function (e) { + mouseDrag = e.screenX; + mouseDragWidth = bar.offsetWidth; + }); + + handle.addEventListener("mouseover", function () { + handle.style.cursor = "ew-resize"; + }); + + element.addEventListener("mousemove", function (e) { + if (mouseDrag) { + bar.style.width = mouseDragWidth + e.screenX - mouseDrag + "px"; + } + }); + + element.addEventListener("mouseup", function (e) { + if (mouseDrag) { + e.stopPropagation(); + e.stopImmediatePropagation(); + + mouseDrag = false; + mouseDragWidth = false; + + updateValue(); + } + }); + + //allow key based navigation + element.addEventListener("keydown", function (e) { + switch (e.keyCode) { + case 39: + //right arrow + e.preventDefault(); + bar.style.width = bar.clientWidth + element.clientWidth / 100 + "px"; + break; + + case 37: + //left arrow + e.preventDefault(); + bar.style.width = bar.clientWidth - element.clientWidth / 100 + "px"; + break; + + case 9: //tab + case 13: + //enter + updateValue(); + break; + + case 27: + //escape + cancel(); + break; + + } + }); + + element.addEventListener("blur", function () { + cancel(); + }); + + return bar; + }, + + //checkbox + tickCross: function tickCross(cell, onRendered, success, cancel, editorParams) { + var value = cell.getValue(), + input = document.createElement("input"), + tristate = editorParams.tristate, + indetermValue = typeof editorParams.indeterminateValue === "undefined" ? null : editorParams.indeterminateValue, + indetermState = false; + + input.setAttribute("type", "checkbox"); + input.style.marginTop = "5px"; + input.style.boxSizing = "border-box"; + + if (editorParams.elementAttributes && _typeof(editorParams.elementAttributes) == "object") { + for (var key in editorParams.elementAttributes) { + if (key.charAt(0) == "+") { + key = key.slice(1); + input.setAttribute(key, input.getAttribute(key) + editorParams.elementAttributes["+" + key]); + } else { + input.setAttribute(key, editorParams.elementAttributes[key]); + } + } + } + + input.value = value; + + if (tristate && (typeof value === "undefined" || value === indetermValue || value === "")) { + indetermState = true; + input.indeterminate = true; + } + + if (this.table.browser != "firefox") { + //prevent blur issue on mac firefox + onRendered(function () { + input.focus({ preventScroll: true }); + }); + } + + input.checked = value === true || value === "true" || value === "True" || value === 1; + + function setValue(blur) { + if (tristate) { + if (!blur) { + if (input.checked && !indetermState) { + input.checked = false; + input.indeterminate = true; + indetermState = true; + return indetermValue; + } else { + indetermState = false; + return input.checked; + } + } else { + if (indetermState) { + return indetermValue; + } else { + return input.checked; + } + } + } else { + return input.checked; + } + } + + //submit new value on blur + input.addEventListener("change", function (e) { + success(setValue()); + }); + + input.addEventListener("blur", function (e) { + success(setValue(true)); + }); + + //submit new value on enter + input.addEventListener("keydown", function (e) { + if (e.keyCode == 13) { + success(setValue()); + } + if (e.keyCode == 27) { + cancel(); + } + }); + + return input; + } + }; + + Tabulator.prototype.registerModule("edit", Edit); + + var ExportRow = function ExportRow(type, columns, component, indent) { + this.type = type; + this.columns = columns; + this.component = component || false; + this.indent = indent || 0; + }; + + var ExportColumn = function ExportColumn(value, component, width, height, depth) { + this.value = value; + this.component = component || false; + this.width = width; + this.height = height; + this.depth = depth; + }; + + var Export = function Export(table) { + this.table = table; //hold Tabulator object + this.config = {}; + this.cloneTableStyle = true; + this.colVisProp = ""; + }; + + Export.prototype.generateExportList = function (config, style, range, colVisProp) { + this.cloneTableStyle = style; + this.config = config || {}; + this.colVisProp = colVisProp; + + var headers = this.config.columnHeaders !== false ? this.headersToExportRows(this.generateColumnGroupHeaders()) : []; + var body = this.bodyToExportRows(this.rowLookup(range)); + + return headers.concat(body); + }; + + Export.prototype.genereateTable = function (config, style, range, colVisProp) { + var list = this.generateExportList(config, style, range, colVisProp); + + return this.genereateTableElement(list); + }; + + Export.prototype.rowLookup = function (range) { + var _this45 = this; + + var rows = []; + + if (typeof range == "function") { + range.call(this.table).forEach(function (row) { + row = _this45.table.rowManager.findRow(row); + + if (row) { + rows.push(row); + } + }); + } else { + switch (range) { + case true: + case "visible": + rows = this.table.rowManager.getVisibleRows(true); + break; + + case "all": + rows = this.table.rowManager.rows; + break; + + case "selected": + rows = this.table.modules.selectRow.selectedRows; + break; + + case "active": + default: + rows = this.table.rowManager.getDisplayRows(); + } + } + + return Object.assign([], rows); + }; + + Export.prototype.generateColumnGroupHeaders = function () { + var _this46 = this; + + var output = []; + + var columns = this.config.columnGroups !== false ? this.table.columnManager.columns : this.table.columnManager.columnsByIndex; + + columns.forEach(function (column) { + var colData = _this46.processColumnGroup(column); + + if (colData) { + output.push(colData); + } + }); + + return output; + }; + + Export.prototype.processColumnGroup = function (column) { + var _this47 = this; + + var subGroups = column.columns, + maxDepth = 0, + title = column.definition["title" + (this.colVisProp.charAt(0).toUpperCase() + this.colVisProp.slice(1))] || column.definition.title; + + var groupData = { + title: title, + column: column, + depth: 1 + }; + + if (subGroups.length) { + groupData.subGroups = []; + groupData.width = 0; + + subGroups.forEach(function (subGroup) { + var subGroupData = _this47.processColumnGroup(subGroup); + + if (subGroupData) { + groupData.width += subGroupData.width; + groupData.subGroups.push(subGroupData); + + if (subGroupData.depth > maxDepth) { + maxDepth = subGroupData.depth; + } + } + }); + + groupData.depth += maxDepth; + + if (!groupData.width) { + return false; + } + } else { + if (this.columnVisCheck(column)) { + groupData.width = 1; + } else { + return false; + } + } + + return groupData; + }; + + Export.prototype.columnVisCheck = function (column) { + return column.definition[this.colVisProp] !== false && (column.visible || !column.visible && column.definition[this.colVisProp]); + }; + + Export.prototype.headersToExportRows = function (columns) { + var headers = [], + headerDepth = 0, + exportRows = []; + + function parseColumnGroup(column, level) { + + var depth = headerDepth - level; + + if (typeof headers[level] === "undefined") { + headers[level] = []; + } + + column.height = column.subGroups ? 1 : depth - column.depth + 1; + + headers[level].push(column); + + if (column.height > 1) { + for (var _i6 = 1; _i6 < column.height; _i6++) { + + if (typeof headers[level + _i6] === "undefined") { + headers[level + _i6] = []; + } + + headers[level + _i6].push(false); + } + } + + if (column.width > 1) { + for (var _i7 = 1; _i7 < column.width; _i7++) { + headers[level].push(false); + } + } + + if (column.subGroups) { + column.subGroups.forEach(function (subGroup) { + parseColumnGroup(subGroup, level + 1); + }); + } + } + + //calculate maximum header debth + columns.forEach(function (column) { + if (column.depth > headerDepth) { + headerDepth = column.depth; + } + }); + + columns.forEach(function (column) { + parseColumnGroup(column, 0); + }); + + headers.forEach(function (header) { + var columns = []; + + header.forEach(function (col) { + if (col) { + columns.push(new ExportColumn(col.title, col.column.getComponent(), col.width, col.height, col.depth)); + } else { + columns.push(null); + } + }); + + exportRows.push(new ExportRow("header", columns)); + }); + + return exportRows; + }; + + Export.prototype.bodyToExportRows = function (rows) { + var _this48 = this; + + var columns = []; + var exportRows = []; + + this.table.columnManager.columnsByIndex.forEach(function (column) { + if (_this48.columnVisCheck(column)) { + columns.push(column.getComponent()); + } + }); + + if (this.config.columnCalcs !== false && this.table.modExists("columnCalcs")) { + if (this.table.modules.columnCalcs.topInitialized) { + rows.unshift(this.table.modules.columnCalcs.topRow); + } + + if (this.table.modules.columnCalcs.botInitialized) { + rows.push(this.table.modules.columnCalcs.botRow); + } + } + + rows = rows.filter(function (row) { + switch (row.type) { + case "group": + return _this48.config.rowGroups !== false; + break; + + case "calc": + return _this48.config.columnCalcs !== false; + break; + + case "row": + return !(_this48.table.options.dataTree && _this48.config.dataTree === false && row.modules.dataTree.parent); + break; + } + + return true; + }); + + rows.forEach(function (row, i) { + var rowData = row.getData(_this48.colVisProp); + var exportCols = []; + var indent = 0; + + switch (row.type) { + case "group": + indent = row.level; + exportCols.push(new ExportColumn(row.key, row.getComponent(), columns.length, 1)); + break; + + case "calc": + case "row": + columns.forEach(function (col) { + exportCols.push(new ExportColumn(col._column.getFieldValue(rowData), col, 1, 1)); + }); + + if (_this48.table.options.dataTree && _this48.config.dataTree !== false) { + indent = row.modules.dataTree.index; + } + break; + } + + exportRows.push(new ExportRow(row.type, exportCols, row.getComponent(), indent)); + }); + + return exportRows; + }; + + Export.prototype.genereateTableElement = function (list) { + var _this49 = this; + + var table = document.createElement("table"), + headerEl = document.createElement("thead"), + bodyEl = document.createElement("tbody"), + styles = this.lookupTableStyles(), + rowFormatter = this.table.options["rowFormatter" + (this.colVisProp.charAt(0).toUpperCase() + this.colVisProp.slice(1))], + setup = {}; + + setup.rowFormatter = rowFormatter !== null ? rowFormatter : this.table.options.rowFormatter; + + if (this.table.options.dataTree && this.config.dataTree !== false && this.table.modExists("columnCalcs")) { + setup.treeElementField = this.table.modules.dataTree.elementField; + } + + //assign group header formatter + setup.groupHeader = this.table.options["groupHeader" + (this.colVisProp.charAt(0).toUpperCase() + this.colVisProp.slice(1))]; + + if (setup.groupHeader && !Array.isArray(setup.groupHeader)) { + setup.groupHeader = [setup.groupHeader]; + } + + table.classList.add("tabulator-print-table"); + + this.mapElementStyles(this.table.columnManager.getHeadersElement(), headerEl, ["border-top", "border-left", "border-right", "border-bottom", "background-color", "color", "font-weight", "font-family", "font-size"]); + + if (list.length > 1000) { + console.warn("It may take a long time to render an HTML table with more than 1000 rows"); + } + + list.forEach(function (row, i) { + switch (row.type) { + case "header": + headerEl.appendChild(_this49.genereateHeaderElement(row, setup, styles)); + break; + + case "group": + bodyEl.appendChild(_this49.genereateGroupElement(row, setup, styles)); + break; + + case "calc": + bodyEl.appendChild(_this49.genereateCalcElement(row, setup, styles)); + break; + + case "row": + var rowEl = _this49.genereateRowElement(row, setup, styles); + _this49.mapElementStyles(i % 2 && styles.evenRow ? styles.evenRow : styles.oddRow, rowEl, ["border-top", "border-left", "border-right", "border-bottom", "color", "font-weight", "font-family", "font-size", "background-color"]); + bodyEl.appendChild(rowEl); + break; + } + }); + + if (headerEl.innerHTML) { + table.appendChild(headerEl); + } + + table.appendChild(bodyEl); + + this.mapElementStyles(this.table.element, table, ["border-top", "border-left", "border-right", "border-bottom"]); + return table; + }; + + Export.prototype.lookupTableStyles = function () { + var styles = {}; + + //lookup row styles + if (this.cloneTableStyle && window.getComputedStyle) { + styles.oddRow = this.table.element.querySelector(".tabulator-row-odd:not(.tabulator-group):not(.tabulator-calcs)"); + styles.evenRow = this.table.element.querySelector(".tabulator-row-even:not(.tabulator-group):not(.tabulator-calcs)"); + styles.calcRow = this.table.element.querySelector(".tabulator-row.tabulator-calcs"); + styles.firstRow = this.table.element.querySelector(".tabulator-row:not(.tabulator-group):not(.tabulator-calcs)"); + styles.firstGroup = this.table.element.getElementsByClassName("tabulator-group")[0]; + + if (styles.firstRow) { + styles.styleCells = styles.firstRow.getElementsByClassName("tabulator-cell"); + styles.firstCell = styles.styleCells[0]; + styles.lastCell = styles.styleCells[styles.styleCells.length - 1]; + } + } + + return styles; + }; + + Export.prototype.genereateHeaderElement = function (row, setup, styles) { + var _this50 = this; + + var rowEl = document.createElement("tr"); + + row.columns.forEach(function (column) { + if (column) { + var cellEl = document.createElement("th"); + var classNames = column.component._column.definition.cssClass ? column.component._column.definition.cssClass.split(" ") : []; + + cellEl.colSpan = column.width; + cellEl.rowSpan = column.height; + + cellEl.innerHTML = column.value; + + if (_this50.cloneTableStyle) { + cellEl.style.boxSizing = "border-box"; + } + + classNames.forEach(function (className) { + cellEl.classList.add(className); + }); + + _this50.mapElementStyles(column.component.getElement(), cellEl, ["text-align", "border-top", "border-left", "border-right", "border-bottom", "background-color", "color", "font-weight", "font-family", "font-size"]); + _this50.mapElementStyles(column.component._column.contentElement, cellEl, ["padding-top", "padding-left", "padding-right", "padding-bottom"]); + + if (column.component._column.visible) { + _this50.mapElementStyles(column.component.getElement(), cellEl, ["width"]); + } else { + if (column.component._column.definition.width) { + cellEl.style.width = column.component._column.definition.width + "px"; + } + } + + if (column.component._column.parent) { + _this50.mapElementStyles(column.component._column.parent.groupElement, cellEl, ["border-top"]); + } + + rowEl.appendChild(cellEl); + } + }); + + return rowEl; + }; + + Export.prototype.genereateGroupElement = function (row, setup, styles) { + + var rowEl = document.createElement("tr"), + cellEl = document.createElement("td"), + group = row.columns[0]; + + rowEl.classList.add("tabulator-print-table-row"); + + if (setup.groupHeader && setup.groupHeader[row.indent]) { + group.value = setup.groupHeader[row.indent](group.value, row.component._group.getRowCount(), row.component._group.getData(), row.component); + } else { + if (setup.groupHeader === false) { + group.value = group.value; + } else { + group.value = row.component._group.generator(group.value, row.component._group.getRowCount(), row.component._group.getData(), row.component); + } + } + + cellEl.colSpan = group.width; + cellEl.innerHTML = group.value; + + rowEl.classList.add("tabulator-print-table-group"); + rowEl.classList.add("tabulator-group-level-" + row.indent); + + if (group.component.getVisibility()) { + rowEl.classList.add("tabulator-group-visible"); + } + + this.mapElementStyles(styles.firstGroup, rowEl, ["border-top", "border-left", "border-right", "border-bottom", "color", "font-weight", "font-family", "font-size", "background-color"]); + this.mapElementStyles(styles.firstGroup, cellEl, ["padding-top", "padding-left", "padding-right", "padding-bottom"]); + + rowEl.appendChild(cellEl); + + return rowEl; + }; + + Export.prototype.genereateCalcElement = function (row, setup, styles) { + var rowEl = this.genereateRowElement(row, setup, styles); + + rowEl.classList.add("tabulator-print-table-calcs"); + this.mapElementStyles(styles.calcRow, rowEl, ["border-top", "border-left", "border-right", "border-bottom", "color", "font-weight", "font-family", "font-size", "background-color"]); + + return rowEl; + }; + + Export.prototype.genereateRowElement = function (row, setup, styles) { + var _this51 = this; + + var rowEl = document.createElement("tr"); + + rowEl.classList.add("tabulator-print-table-row"); + + row.columns.forEach(function (col) { + + if (col) { + var cellEl = document.createElement("td"), + column = col.component._column, + value = col.value; + + var cellWrapper = { + modules: {}, + getValue: function getValue() { + return value; + }, + getField: function getField() { + return column.definition.field; + }, + getElement: function getElement() { + return cellEl; + }, + getColumn: function getColumn() { + return column.getComponent(); + }, + getData: function getData() { + return rowData; + }, + getRow: function getRow() { + return row.getComponent(); + }, + getComponent: function getComponent() { + return cellWrapper; + }, + column: column + }; + + var classNames = column.definition.cssClass ? column.definition.cssClass.split(" ") : []; + + classNames.forEach(function (className) { + cellEl.classList.add(className); + }); + + if (_this51.table.modExists("format") && _this51.config.formatCells !== false) { + value = _this51.table.modules.format.formatExportValue(cellWrapper, _this51.colVisProp); + } else { + switch (typeof value === 'undefined' ? 'undefined' : _typeof(value)) { + case "object": + value = JSON.stringify(value); + break; + + case "undefined": + case "null": + value = ""; + break; + + default: + value = value; + } + } + + if (value instanceof Node) { + cellEl.appendChild(value); + } else { + cellEl.innerHTML = value; + } + + if (styles.firstCell) { + _this51.mapElementStyles(styles.firstCell, cellEl, ["padding-top", "padding-left", "padding-right", "padding-bottom", "border-top", "border-left", "border-right", "border-bottom", "color", "font-weight", "font-family", "font-size"]); + + if (column.definition.align) { + cellEl.style.textAlign = column.definition.align; + } + } + + if (_this51.table.options.dataTree && _this51.config.dataTree !== false) { + if (setup.treeElementField && setup.treeElementField == column.field || !setup.treeElementField && i == 0) { + if (row.component._row.modules.dataTree.controlEl) { + cellEl.insertBefore(row.component._row.modules.dataTree.controlEl.cloneNode(true), cellEl.firstChild); + } + if (row.component._row.modules.dataTree.branchEl) { + cellEl.insertBefore(row.component._row.modules.dataTree.branchEl.cloneNode(true), cellEl.firstChild); + } + } + } + + rowEl.appendChild(cellEl); + + if (cellWrapper.modules.format && cellWrapper.modules.format.renderedCallback) { + cellWrapper.modules.format.renderedCallback(); + } + + if (setup.rowFormatter && _this51.config.formatCells !== false) { + var rowComponent = row.getComponent(); + + rowComponent.getElement = function () { + return rowEl; + }; + + setup.rowFormatter(rowComponent); + } + } + }); + + return rowEl; + }; + + Export.prototype.genereateHTMLTable = function (list) { + var holder = document.createElement("div"); + + holder.appendChild(this.genereateTableElement(list)); + + return holder.innerHTML; + }; + + Export.prototype.getHtml = function (visible, style, config, colVisProp) { + var list = this.generateExportList(config || this.table.options.htmlOutputConfig, style, visible, colVisProp || "htmlOutput"); + + return this.genereateHTMLTable(list); + }; + + Export.prototype.mapElementStyles = function (from, to, props) { + if (this.cloneTableStyle && from && to) { + + var lookup = { + "background-color": "backgroundColor", + "color": "fontColor", + "width": "width", + "font-weight": "fontWeight", + "font-family": "fontFamily", + "font-size": "fontSize", + "text-align": "textAlign", + "border-top": "borderTop", + "border-left": "borderLeft", + "border-right": "borderRight", + "border-bottom": "borderBottom", + "padding-top": "paddingTop", + "padding-left": "paddingLeft", + "padding-right": "paddingRight", + "padding-bottom": "paddingBottom" + }; + + if (window.getComputedStyle) { + var fromStyle = window.getComputedStyle(from); + + props.forEach(function (prop) { + to.style[lookup[prop]] = fromStyle.getPropertyValue(prop); + }); + } + } + }; + + Tabulator.prototype.registerModule("export", Export); + + var Filter = function Filter(table) { + + this.table = table; //hold Tabulator object + + this.filterList = []; //hold filter list + this.headerFilters = {}; //hold column filters + this.headerFilterColumns = []; //hold columns that use header filters + + this.prevHeaderFilterChangeCheck = ""; + this.prevHeaderFilterChangeCheck = "{}"; + + this.changed = false; //has filtering changed since last render + }; + + //initialize column header filter + Filter.prototype.initializeColumn = function (column, value) { + var self = this, + field = column.getField(), + params; + + //handle successfull value change + function success(value) { + var filterType = column.modules.filter.tagType == "input" && column.modules.filter.attrType == "text" || column.modules.filter.tagType == "textarea" ? "partial" : "match", + type = "", + filterChangeCheck = "", + filterFunc; + + if (typeof column.modules.filter.prevSuccess === "undefined" || column.modules.filter.prevSuccess !== value) { + + column.modules.filter.prevSuccess = value; + + if (!column.modules.filter.emptyFunc(value)) { + column.modules.filter.value = value; + + switch (_typeof(column.definition.headerFilterFunc)) { + case "string": + if (self.filters[column.definition.headerFilterFunc]) { + type = column.definition.headerFilterFunc; + filterFunc = function filterFunc(data) { + var params = column.definition.headerFilterFuncParams || {}; + var fieldVal = column.getFieldValue(data); + + params = typeof params === "function" ? params(value, fieldVal, data) : params; + + return self.filters[column.definition.headerFilterFunc](value, fieldVal, data, params); + }; + } else { + console.warn("Header Filter Error - Matching filter function not found: ", column.definition.headerFilterFunc); + } + break; + + case "function": + filterFunc = function filterFunc(data) { + var params = column.definition.headerFilterFuncParams || {}; + var fieldVal = column.getFieldValue(data); + + params = typeof params === "function" ? params(value, fieldVal, data) : params; + + return column.definition.headerFilterFunc(value, fieldVal, data, params); + }; + + type = filterFunc; + break; + } + + if (!filterFunc) { + switch (filterType) { + case "partial": + filterFunc = function filterFunc(data) { + var colVal = column.getFieldValue(data); + + if (typeof colVal !== 'undefined' && colVal !== null) { + return String(colVal).toLowerCase().indexOf(String(value).toLowerCase()) > -1; + } else { + return false; + } + }; + type = "like"; + break; + + default: + filterFunc = function filterFunc(data) { + return column.getFieldValue(data) == value; + }; + type = "="; + } + } + + self.headerFilters[field] = { value: value, func: filterFunc, type: type, params: params || {} }; + } else { + delete self.headerFilters[field]; + } + + filterChangeCheck = JSON.stringify(self.headerFilters); + + if (self.prevHeaderFilterChangeCheck !== filterChangeCheck) { + self.prevHeaderFilterChangeCheck = filterChangeCheck; + + self.changed = true; + self.table.rowManager.filterRefresh(); + } + } + + return true; + } + + column.modules.filter = { + success: success, + attrType: false, + tagType: false, + emptyFunc: false + }; + + this.generateHeaderFilterElement(column); + }; + + Filter.prototype.generateHeaderFilterElement = function (column, initialValue, reinitialize) { + var _this52 = this; + + var self = this, + success = column.modules.filter.success, + field = column.getField(), + filterElement, + editor, + editorElement, + cellWrapper, + typingTimer, + searchTrigger, + params; + + //handle aborted edit + function cancel() {} + + if (column.modules.filter.headerElement && column.modules.filter.headerElement.parentNode) { + column.contentElement.removeChild(column.modules.filter.headerElement.parentNode); + } + + if (field) { + + //set empty value function + column.modules.filter.emptyFunc = column.definition.headerFilterEmptyCheck || function (value) { + return !value && value !== "0"; + }; + + filterElement = document.createElement("div"); + filterElement.classList.add("tabulator-header-filter"); + + //set column editor + switch (_typeof(column.definition.headerFilter)) { + case "string": + if (self.table.modules.edit.editors[column.definition.headerFilter]) { + editor = self.table.modules.edit.editors[column.definition.headerFilter]; + + if ((column.definition.headerFilter === "tick" || column.definition.headerFilter === "tickCross") && !column.definition.headerFilterEmptyCheck) { + column.modules.filter.emptyFunc = function (value) { + return value !== true && value !== false; + }; + } + } else { + console.warn("Filter Error - Cannot build header filter, No such editor found: ", column.definition.editor); + } + break; + + case "function": + editor = column.definition.headerFilter; + break; + + case "boolean": + if (column.modules.edit && column.modules.edit.editor) { + editor = column.modules.edit.editor; + } else { + if (column.definition.formatter && self.table.modules.edit.editors[column.definition.formatter]) { + editor = self.table.modules.edit.editors[column.definition.formatter]; + + if ((column.definition.formatter === "tick" || column.definition.formatter === "tickCross") && !column.definition.headerFilterEmptyCheck) { + column.modules.filter.emptyFunc = function (value) { + return value !== true && value !== false; + }; + } + } else { + editor = self.table.modules.edit.editors["input"]; + } + } + break; + } + + if (editor) { + + cellWrapper = { + getValue: function getValue() { + return typeof initialValue !== "undefined" ? initialValue : ""; + }, + getField: function getField() { + return column.definition.field; + }, + getElement: function getElement() { + return filterElement; + }, + getColumn: function getColumn() { + return column.getComponent(); + }, + getRow: function getRow() { + return { + normalizeHeight: function normalizeHeight() {} + }; + } + }; + + params = column.definition.headerFilterParams || {}; + + params = typeof params === "function" ? params.call(self.table) : params; + + editorElement = editor.call(this.table.modules.edit, cellWrapper, function () {}, success, cancel, params); + + if (!editorElement) { + console.warn("Filter Error - Cannot add filter to " + field + " column, editor returned a value of false"); + return; + } + + if (!(editorElement instanceof Node)) { + console.warn("Filter Error - Cannot add filter to " + field + " column, editor should return an instance of Node, the editor returned:", editorElement); + return; + } + + //set Placeholder Text + if (field) { + self.table.modules.localize.bind("headerFilters|columns|" + column.definition.field, function (value) { + editorElement.setAttribute("placeholder", typeof value !== "undefined" && value ? value : self.table.modules.localize.getText("headerFilters|default")); + }); + } else { + self.table.modules.localize.bind("headerFilters|default", function (value) { + editorElement.setAttribute("placeholder", typeof self.column.definition.headerFilterPlaceholder !== "undefined" && self.column.definition.headerFilterPlaceholder ? self.column.definition.headerFilterPlaceholder : value); + }); + } + + //focus on element on click + editorElement.addEventListener("click", function (e) { + e.stopPropagation(); + editorElement.focus(); + }); + + editorElement.addEventListener("focus", function (e) { + var left = _this52.table.columnManager.element.scrollLeft; + + if (left !== _this52.table.rowManager.element.scrollLeft) { + _this52.table.rowManager.scrollHorizontal(left); + _this52.table.columnManager.scrollHorizontal(left); + } + }); + + //live update filters as user types + typingTimer = false; + + searchTrigger = function searchTrigger(e) { + if (typingTimer) { + clearTimeout(typingTimer); + } + + typingTimer = setTimeout(function () { + success(editorElement.value); + }, self.table.options.headerFilterLiveFilterDelay); + }; + + column.modules.filter.headerElement = editorElement; + column.modules.filter.attrType = editorElement.hasAttribute("type") ? editorElement.getAttribute("type").toLowerCase() : ""; + column.modules.filter.tagType = editorElement.tagName.toLowerCase(); + + if (column.definition.headerFilterLiveFilter !== false) { + + if (!(column.definition.headerFilter === 'autocomplete' || column.definition.headerFilter === 'tickCross' || (column.definition.editor === 'autocomplete' || column.definition.editor === 'tickCross') && column.definition.headerFilter === true)) { + editorElement.addEventListener("keyup", searchTrigger); + editorElement.addEventListener("search", searchTrigger); + + //update number filtered columns on change + if (column.modules.filter.attrType == "number") { + editorElement.addEventListener("change", function (e) { + success(editorElement.value); + }); + } + + //change text inputs to search inputs to allow for clearing of field + if (column.modules.filter.attrType == "text" && this.table.browser !== "ie") { + editorElement.setAttribute("type", "search"); + // editorElement.off("change blur"); //prevent blur from triggering filter and preventing selection click + } + } + + //prevent input and select elements from propegating click to column sorters etc + if (column.modules.filter.tagType == "input" || column.modules.filter.tagType == "select" || column.modules.filter.tagType == "textarea") { + editorElement.addEventListener("mousedown", function (e) { + e.stopPropagation(); + }); + } + } + + filterElement.appendChild(editorElement); + + column.contentElement.appendChild(filterElement); + + if (!reinitialize) { + self.headerFilterColumns.push(column); + } + } + } else { + console.warn("Filter Error - Cannot add header filter, column has no field set:", column.definition.title); + } + }; + + //hide all header filter elements (used to ensure correct column widths in "fitData" layout mode) + Filter.prototype.hideHeaderFilterElements = function () { + this.headerFilterColumns.forEach(function (column) { + if (column.modules.filter && column.modules.filter.headerElement) { + column.modules.filter.headerElement.style.display = 'none'; + } + }); + }; + + //show all header filter elements (used to ensure correct column widths in "fitData" layout mode) + Filter.prototype.showHeaderFilterElements = function () { + this.headerFilterColumns.forEach(function (column) { + if (column.modules.filter && column.modules.filter.headerElement) { + column.modules.filter.headerElement.style.display = ''; + } + }); + }; + + //programatically set focus of header filter + Filter.prototype.setHeaderFilterFocus = function (column) { + if (column.modules.filter && column.modules.filter.headerElement) { + column.modules.filter.headerElement.focus(); + } else { + console.warn("Column Filter Focus Error - No header filter set on column:", column.getField()); + } + }; + + //programmatically get value of header filter + Filter.prototype.getHeaderFilterValue = function (column) { + if (column.modules.filter && column.modules.filter.headerElement) { + return column.modules.filter.headerElement.value; + } else { + console.warn("Column Filter Error - No header filter set on column:", column.getField()); + } + }; + + //programatically set value of header filter + Filter.prototype.setHeaderFilterValue = function (column, value) { + if (column) { + if (column.modules.filter && column.modules.filter.headerElement) { + this.generateHeaderFilterElement(column, value, true); + column.modules.filter.success(value); + } else { + console.warn("Column Filter Error - No header filter set on column:", column.getField()); + } + } + }; + + Filter.prototype.reloadHeaderFilter = function (column) { + if (column) { + if (column.modules.filter && column.modules.filter.headerElement) { + this.generateHeaderFilterElement(column, column.modules.filter.value, true); + } else { + console.warn("Column Filter Error - No header filter set on column:", column.getField()); + } + } + }; + + //check if the filters has changed since last use + Filter.prototype.hasChanged = function () { + var changed = this.changed; + this.changed = false; + return changed; + }; + + //set standard filters + Filter.prototype.setFilter = function (field, type, value, params) { + var self = this; + + self.filterList = []; + + if (!Array.isArray(field)) { + field = [{ field: field, type: type, value: value, params: params }]; + } + + self.addFilter(field); + }; + + //add filter to array + Filter.prototype.addFilter = function (field, type, value, params) { + var self = this; + + if (!Array.isArray(field)) { + field = [{ field: field, type: type, value: value, params: params }]; + } + + field.forEach(function (filter) { + + filter = self.findFilter(filter); + + if (filter) { + self.filterList.push(filter); + + self.changed = true; + } + }); + + if (this.table.options.persistence && this.table.modExists("persistence", true) && this.table.modules.persistence.config.filter) { + this.table.modules.persistence.save("filter"); + } + }; + + Filter.prototype.findFilter = function (filter) { + var self = this, + column; + + if (Array.isArray(filter)) { + return this.findSubFilters(filter); + } + + var filterFunc = false; + + if (typeof filter.field == "function") { + filterFunc = function filterFunc(data) { + return filter.field(data, filter.type || {}); // pass params to custom filter function + }; + } else { + + if (self.filters[filter.type]) { + + column = self.table.columnManager.getColumnByField(filter.field); + + if (column) { + filterFunc = function filterFunc(data) { + return self.filters[filter.type](filter.value, column.getFieldValue(data), data, filter.params || {}); + }; + } else { + filterFunc = function filterFunc(data) { + return self.filters[filter.type](filter.value, data[filter.field], data, filter.params || {}); + }; + } + } else { + console.warn("Filter Error - No such filter type found, ignoring: ", filter.type); + } + } + + filter.func = filterFunc; + + return filter.func ? filter : false; + }; + + Filter.prototype.findSubFilters = function (filters) { + var self = this, + output = []; + + filters.forEach(function (filter) { + filter = self.findFilter(filter); + + if (filter) { + output.push(filter); + } + }); + + return output.length ? output : false; + }; + + //get all filters + Filter.prototype.getFilters = function (all, ajax) { + var output = []; + + if (all) { + output = this.getHeaderFilters(); + } + + if (ajax) { + output.forEach(function (item) { + if (typeof item.type == "function") { + item.type = "function"; + } + }); + } + + output = output.concat(this.filtersToArray(this.filterList, ajax)); + + return output; + }; + + //filter to Object + Filter.prototype.filtersToArray = function (filterList, ajax) { + var _this53 = this; + + var output = []; + + filterList.forEach(function (filter) { + var item; + + if (Array.isArray(filter)) { + output.push(_this53.filtersToArray(filter, ajax)); + } else { + item = { field: filter.field, type: filter.type, value: filter.value }; + + if (ajax) { + if (typeof item.type == "function") { + item.type = "function"; + } + } + + output.push(item); + } + }); + + return output; + }; + + //get all filters + Filter.prototype.getHeaderFilters = function () { + var self = this, + output = []; + + for (var key in this.headerFilters) { + output.push({ field: key, type: this.headerFilters[key].type, value: this.headerFilters[key].value }); + } + + return output; + }; + + //remove filter from array + Filter.prototype.removeFilter = function (field, type, value) { + var self = this; + + if (!Array.isArray(field)) { + field = [{ field: field, type: type, value: value }]; + } + + field.forEach(function (filter) { + var index = -1; + + if (_typeof(filter.field) == "object") { + index = self.filterList.findIndex(function (element) { + return filter === element; + }); + } else { + index = self.filterList.findIndex(function (element) { + return filter.field === element.field && filter.type === element.type && filter.value === element.value; + }); + } + + if (index > -1) { + self.filterList.splice(index, 1); + self.changed = true; + } else { + console.warn("Filter Error - No matching filter type found, ignoring: ", filter.type); + } + }); + + if (this.table.options.persistence && this.table.modExists("persistence", true) && this.table.modules.persistence.config.filter) { + this.table.modules.persistence.save("filter"); + } + }; + + //clear filters + Filter.prototype.clearFilter = function (all) { + this.filterList = []; + + if (all) { + this.clearHeaderFilter(); + } + + this.changed = true; + + if (this.table.options.persistence && this.table.modExists("persistence", true) && this.table.modules.persistence.config.filter) { + this.table.modules.persistence.save("filter"); + } + }; + + //clear header filters + Filter.prototype.clearHeaderFilter = function () { + var self = this; + + this.headerFilters = {}; + self.prevHeaderFilterChangeCheck = "{}"; + + this.headerFilterColumns.forEach(function (column) { + column.modules.filter.value = null; + column.modules.filter.prevSuccess = undefined; + self.reloadHeaderFilter(column); + }); + + this.changed = true; + }; + + //search data and return matching rows + Filter.prototype.search = function (searchType, field, type, value) { + var self = this, + activeRows = [], + filterList = []; + + if (!Array.isArray(field)) { + field = [{ field: field, type: type, value: value }]; + } + + field.forEach(function (filter) { + filter = self.findFilter(filter); + + if (filter) { + filterList.push(filter); + } + }); + + this.table.rowManager.rows.forEach(function (row) { + var match = true; + + filterList.forEach(function (filter) { + if (!self.filterRecurse(filter, row.getData())) { + match = false; + } + }); + + if (match) { + activeRows.push(searchType === "data" ? row.getData("data") : row.getComponent()); + } + }); + + return activeRows; + }; + + //filter row array + Filter.prototype.filter = function (rowList, filters) { + var self = this, + activeRows = [], + activeRowComponents = []; + + if (self.table.options.dataFiltering) { + self.table.options.dataFiltering.call(self.table, self.getFilters()); + } + + if (!self.table.options.ajaxFiltering && (self.filterList.length || Object.keys(self.headerFilters).length)) { + + rowList.forEach(function (row) { + if (self.filterRow(row)) { + activeRows.push(row); + } + }); + } else { + activeRows = rowList.slice(0); + } + + if (self.table.options.dataFiltered) { + + activeRows.forEach(function (row) { + activeRowComponents.push(row.getComponent()); + }); + + self.table.options.dataFiltered.call(self.table, self.getFilters(), activeRowComponents); + } + + return activeRows; + }; + + //filter individual row + Filter.prototype.filterRow = function (row, filters) { + var self = this, + match = true, + data = row.getData(); + + self.filterList.forEach(function (filter) { + if (!self.filterRecurse(filter, data)) { + match = false; + } + }); + + for (var field in self.headerFilters) { + if (!self.headerFilters[field].func(data)) { + match = false; + } + } + + return match; + }; + + Filter.prototype.filterRecurse = function (filter, data) { + var self = this, + match = false; + + if (Array.isArray(filter)) { + filter.forEach(function (subFilter) { + if (self.filterRecurse(subFilter, data)) { + match = true; + } + }); + } else { + match = filter.func(data); + } + + return match; + }; + + //list of available filters + Filter.prototype.filters = { + + //equal to + "=": function _(filterVal, rowVal, rowData, filterParams) { + return rowVal == filterVal ? true : false; + }, + + //less than + "<": function _(filterVal, rowVal, rowData, filterParams) { + return rowVal < filterVal ? true : false; + }, + + //less than or equal to + "<=": function _(filterVal, rowVal, rowData, filterParams) { + return rowVal <= filterVal ? true : false; + }, + + //greater than + ">": function _(filterVal, rowVal, rowData, filterParams) { + return rowVal > filterVal ? true : false; + }, + + //greater than or equal to + ">=": function _(filterVal, rowVal, rowData, filterParams) { + return rowVal >= filterVal ? true : false; + }, + + //not equal to + "!=": function _(filterVal, rowVal, rowData, filterParams) { + return rowVal != filterVal ? true : false; + }, + + "regex": function regex(filterVal, rowVal, rowData, filterParams) { + + if (typeof filterVal == "string") { + filterVal = new RegExp(filterVal); + } + + return filterVal.test(rowVal); + }, + + //contains the string + "like": function like(filterVal, rowVal, rowData, filterParams) { + if (filterVal === null || typeof filterVal === "undefined") { + return rowVal === filterVal ? true : false; + } else { + if (typeof rowVal !== 'undefined' && rowVal !== null) { + return String(rowVal).toLowerCase().indexOf(filterVal.toLowerCase()) > -1; + } else { + return false; + } + } + }, + + //contains the keywords + "keywords": function keywords(filterVal, rowVal, rowData, filterParams) { + var keywords = filterVal.toLowerCase().split(typeof filterParams.separator === "undefined" ? " " : filterParams.separator), + value = String(rowVal === null || typeof rowVal === "undefined" ? "" : rowVal).toLowerCase(), + matches = []; + + keywords.forEach(function (keyword) { + if (value.includes(keyword)) { + matches.push(true); + } + }); + + return filterParams.matchAll ? matches.length === keywords.length : !!matches.length; + }, + + //starts with the string + "starts": function starts(filterVal, rowVal, rowData, filterParams) { + if (filterVal === null || typeof filterVal === "undefined") { + return rowVal === filterVal ? true : false; + } else { + if (typeof rowVal !== 'undefined' && rowVal !== null) { + return String(rowVal).toLowerCase().startsWith(filterVal.toLowerCase()); + } else { + return false; + } + } + }, + + //ends with the string + "ends": function ends(filterVal, rowVal, rowData, filterParams) { + if (filterVal === null || typeof filterVal === "undefined") { + return rowVal === filterVal ? true : false; + } else { + if (typeof rowVal !== 'undefined' && rowVal !== null) { + return String(rowVal).toLowerCase().endsWith(filterVal.toLowerCase()); + } else { + return false; + } + } + }, + + //in array + "in": function _in(filterVal, rowVal, rowData, filterParams) { + if (Array.isArray(filterVal)) { + return filterVal.indexOf(rowVal) > -1; + } else { + console.warn("Filter Error - filter value is not an array:", filterVal); + return false; + } + } + }; + + Tabulator.prototype.registerModule("filter", Filter); + + var Format = function Format(table) { + this.table = table; //hold Tabulator object + }; + + //initialize column formatter + Format.prototype.initializeColumn = function (column) { + column.modules.format = this.lookupFormatter(column, ""); + + if (typeof column.definition.formatterPrint !== "undefined") { + column.modules.format.print = this.lookupFormatter(column, "Print"); + } + + if (typeof column.definition.formatterClipboard !== "undefined") { + column.modules.format.clipboard = this.lookupFormatter(column, "Clipboard"); + } + + if (typeof column.definition.formatterHtmlOutput !== "undefined") { + column.modules.format.htmlOutput = this.lookupFormatter(column, "HtmlOutput"); + } + }; + + Format.prototype.lookupFormatter = function (column, type) { + var config = { params: column.definition["formatter" + type + "Params"] || {} }, + formatter = column.definition["formatter" + type]; + + //set column formatter + switch (typeof formatter === 'undefined' ? 'undefined' : _typeof(formatter)) { + case "string": + + if (formatter === "tick") { + formatter = "tickCross"; + + if (typeof config.params.crossElement == "undefined") { + config.params.crossElement = false; + } + + console.warn("DEPRECATION WARNING - the tick formatter has been deprecated, please use the tickCross formatter with the crossElement param set to false"); + } + + if (this.formatters[formatter]) { + config.formatter = this.formatters[formatter]; + } else { + console.warn("Formatter Error - No such formatter found: ", formatter); + config.formatter = this.formatters.plaintext; + } + break; + + case "function": + config.formatter = formatter; + break; + + default: + config.formatter = this.formatters.plaintext; + break; + } + + return config; + }; + + Format.prototype.cellRendered = function (cell) { + if (cell.modules.format && cell.modules.format.renderedCallback) { + cell.modules.format.renderedCallback(); + } + }; + + //return a formatted value for a cell + Format.prototype.formatValue = function (cell) { + var component = cell.getComponent(), + params = typeof cell.column.modules.format.params === "function" ? cell.column.modules.format.params(component) : cell.column.modules.format.params; + + function onRendered(callback) { + if (!cell.modules.format) { + cell.modules.format = {}; + } + + cell.modules.format.renderedCallback = callback; + } + + return cell.column.modules.format.formatter.call(this, component, params, onRendered); + }; + + Format.prototype.formatExportValue = function (cell, type) { + var formatter = cell.column.modules.format[type], + params; + + if (formatter) { + var onRendered = function onRendered(callback) { + if (!cell.modules.format) { + cell.modules.format = {}; + } + + cell.modules.format.renderedCallback = callback; + }; + + params = typeof formatter.params === "function" ? formatter.params(component) : formatter.params; + + return formatter.formatter.call(this, cell.getComponent(), params, onRendered); + } else { + return this.formatValue(cell); + } + }; + + Format.prototype.sanitizeHTML = function (value) { + if (value) { + var entityMap = { + '&': '&', + '<': '<', + '>': '>', + '"': '"', + "'": ''', + '/': '/', + '`': '`', + '=': '=' + }; + + return String(value).replace(/[&<>"'`=\/]/g, function (s) { + return entityMap[s]; + }); + } else { + return value; + } + }; + + Format.prototype.emptyToSpace = function (value) { + return value === null || typeof value === "undefined" || value === "" ? " " : value; + }; + + //get formatter for cell + Format.prototype.getFormatter = function (formatter) { + var formatter; + + switch (typeof formatter === 'undefined' ? 'undefined' : _typeof(formatter)) { + case "string": + if (this.formatters[formatter]) { + formatter = this.formatters[formatter]; + } else { + console.warn("Formatter Error - No such formatter found: ", formatter); + formatter = this.formatters.plaintext; + } + break; + + case "function": + formatter = formatter; + break; + + default: + formatter = this.formatters.plaintext; + break; + } + + return formatter; + }; + + //default data formatters + Format.prototype.formatters = { + //plain text value + plaintext: function plaintext(cell, formatterParams, onRendered) { + return this.emptyToSpace(this.sanitizeHTML(cell.getValue())); + }, + + //html text value + html: function html(cell, formatterParams, onRendered) { + return cell.getValue(); + }, + + //multiline text area + textarea: function textarea(cell, formatterParams, onRendered) { + cell.getElement().style.whiteSpace = "pre-wrap"; + return this.emptyToSpace(this.sanitizeHTML(cell.getValue())); + }, + + //currency formatting + money: function money(cell, formatterParams, onRendered) { + var floatVal = parseFloat(cell.getValue()), + number, + integer, + decimal, + rgx; + + var decimalSym = formatterParams.decimal || "."; + var thousandSym = formatterParams.thousand || ","; + var symbol = formatterParams.symbol || ""; + var after = !!formatterParams.symbolAfter; + var precision = typeof formatterParams.precision !== "undefined" ? formatterParams.precision : 2; + + if (isNaN(floatVal)) { + return this.emptyToSpace(this.sanitizeHTML(cell.getValue())); + } + + number = precision !== false ? floatVal.toFixed(precision) : floatVal; + number = String(number).split("."); + + integer = number[0]; + decimal = number.length > 1 ? decimalSym + number[1] : ""; + + rgx = /(\d+)(\d{3})/; + + while (rgx.test(integer)) { + integer = integer.replace(rgx, "$1" + thousandSym + "$2"); + } + + return after ? integer + decimal + symbol : symbol + integer + decimal; + }, + + //clickable anchor tag + link: function link(cell, formatterParams, onRendered) { + var value = cell.getValue(), + urlPrefix = formatterParams.urlPrefix || "", + download = formatterParams.download, + label = value, + el = document.createElement("a"), + data; + + if (formatterParams.labelField) { + data = cell.getData(); + label = data[formatterParams.labelField]; + } + + if (formatterParams.label) { + switch (_typeof(formatterParams.label)) { + case "string": + label = formatterParams.label; + break; + + case "function": + label = formatterParams.label(cell); + break; + } + } + + if (label) { + if (formatterParams.urlField) { + data = cell.getData(); + value = data[formatterParams.urlField]; + } + + if (formatterParams.url) { + switch (_typeof(formatterParams.url)) { + case "string": + value = formatterParams.url; + break; + + case "function": + value = formatterParams.url(cell); + break; + } + } + + el.setAttribute("href", urlPrefix + value); + + if (formatterParams.target) { + el.setAttribute("target", formatterParams.target); + } + + if (formatterParams.download) { + + if (typeof download == "function") { + download = download(cell); + } else { + download = download === true ? "" : download; + } + + el.setAttribute("download", download); + } + + el.innerHTML = this.emptyToSpace(this.sanitizeHTML(label)); + + return el; + } else { + return " "; + } + }, + + //image element + image: function image(cell, formatterParams, onRendered) { + var el = document.createElement("img"); + el.setAttribute("src", cell.getValue()); + + switch (_typeof(formatterParams.height)) { + case "number": + el.style.height = formatterParams.height + "px"; + break; + + case "string": + el.style.height = formatterParams.height; + break; + } + + switch (_typeof(formatterParams.width)) { + case "number": + el.style.width = formatterParams.width + "px"; + break; + + case "string": + el.style.width = formatterParams.width; + break; + } + + el.addEventListener("load", function () { + cell.getRow().normalizeHeight(); + }); + + return el; + }, + + //tick or cross + tickCross: function tickCross(cell, formatterParams, onRendered) { + var value = cell.getValue(), + element = cell.getElement(), + empty = formatterParams.allowEmpty, + truthy = formatterParams.allowTruthy, + tick = typeof formatterParams.tickElement !== "undefined" ? formatterParams.tickElement : '', + cross = typeof formatterParams.crossElement !== "undefined" ? formatterParams.crossElement : ''; + + if (truthy && value || value === true || value === "true" || value === "True" || value === 1 || value === "1") { + element.setAttribute("aria-checked", true); + return tick || ""; + } else { + if (empty && (value === "null" || value === "" || value === null || typeof value === "undefined")) { + element.setAttribute("aria-checked", "mixed"); + return ""; + } else { + element.setAttribute("aria-checked", false); + return cross || ""; + } + } + }, + + datetime: function datetime(cell, formatterParams, onRendered) { + var inputFormat = formatterParams.inputFormat || "YYYY-MM-DD hh:mm:ss"; + var outputFormat = formatterParams.outputFormat || "DD/MM/YYYY hh:mm:ss"; + var invalid = typeof formatterParams.invalidPlaceholder !== "undefined" ? formatterParams.invalidPlaceholder : ""; + var value = cell.getValue(); + + var newDatetime = moment(value, inputFormat); + + if (newDatetime.isValid()) { + return formatterParams.timezone ? newDatetime.tz(formatterParams.timezone).format(outputFormat) : newDatetime.format(outputFormat); + } else { + + if (invalid === true) { + return value; + } else if (typeof invalid === "function") { + return invalid(value); + } else { + return invalid; + } + } + }, + + datetimediff: function datetime(cell, formatterParams, onRendered) { + var inputFormat = formatterParams.inputFormat || "YYYY-MM-DD hh:mm:ss"; + var invalid = typeof formatterParams.invalidPlaceholder !== "undefined" ? formatterParams.invalidPlaceholder : ""; + var suffix = typeof formatterParams.suffix !== "undefined" ? formatterParams.suffix : false; + var unit = typeof formatterParams.unit !== "undefined" ? formatterParams.unit : undefined; + var humanize = typeof formatterParams.humanize !== "undefined" ? formatterParams.humanize : false; + var date = typeof formatterParams.date !== "undefined" ? formatterParams.date : moment(); + var value = cell.getValue(); + + var newDatetime = moment(value, inputFormat); + + if (newDatetime.isValid()) { + if (humanize) { + return moment.duration(newDatetime.diff(date)).humanize(suffix); + } else { + return newDatetime.diff(date, unit) + (suffix ? " " + suffix : ""); + } + } else { + + if (invalid === true) { + return value; + } else if (typeof invalid === "function") { + return invalid(value); + } else { + return invalid; + } + } + }, + + //select + lookup: function lookup(cell, formatterParams, onRendered) { + var value = cell.getValue(); + + if (typeof formatterParams[value] === "undefined") { + console.warn('Missing display value for ' + value); + return value; + } + + return formatterParams[value]; + }, + + //star rating + star: function star(cell, formatterParams, onRendered) { + var value = cell.getValue(), + element = cell.getElement(), + maxStars = formatterParams && formatterParams.stars ? formatterParams.stars : 5, + stars = document.createElement("span"), + star = document.createElementNS('http://www.w3.org/2000/svg', "svg"), + starActive = '', + starInactive = ''; + + //style stars holder + stars.style.verticalAlign = "middle"; + + //style star + star.setAttribute("width", "14"); + star.setAttribute("height", "14"); + star.setAttribute("viewBox", "0 0 512 512"); + star.setAttribute("xml:space", "preserve"); + star.style.padding = "0 1px"; + + value = value && !isNaN(value) ? parseInt(value) : 0; + + value = Math.max(0, Math.min(value, maxStars)); + + for (var i = 1; i <= maxStars; i++) { + var nextStar = star.cloneNode(true); + nextStar.innerHTML = i <= value ? starActive : starInactive; + + stars.appendChild(nextStar); + } + + element.style.whiteSpace = "nowrap"; + element.style.overflow = "hidden"; + element.style.textOverflow = "ellipsis"; + + element.setAttribute("aria-label", value); + + return stars; + }, + + traffic: function traffic(cell, formatterParams, onRendered) { + var value = this.sanitizeHTML(cell.getValue()) || 0, + el = document.createElement("span"), + max = formatterParams && formatterParams.max ? formatterParams.max : 100, + min = formatterParams && formatterParams.min ? formatterParams.min : 0, + colors = formatterParams && typeof formatterParams.color !== "undefined" ? formatterParams.color : ["red", "orange", "green"], + color = "#666666", + percent, + percentValue; + + if (isNaN(value) || typeof cell.getValue() === "undefined") { + return; + } + + el.classList.add("tabulator-traffic-light"); + + //make sure value is in range + percentValue = parseFloat(value) <= max ? parseFloat(value) : max; + percentValue = parseFloat(percentValue) >= min ? parseFloat(percentValue) : min; + + //workout percentage + percent = (max - min) / 100; + percentValue = Math.round((percentValue - min) / percent); + + //set color + switch (typeof colors === 'undefined' ? 'undefined' : _typeof(colors)) { + case "string": + color = colors; + break; + case "function": + color = colors(value); + break; + case "object": + if (Array.isArray(colors)) { + var unit = 100 / colors.length; + var index = Math.floor(percentValue / unit); + + index = Math.min(index, colors.length - 1); + index = Math.max(index, 0); + color = colors[index]; + break; + } + } + + el.style.backgroundColor = color; + + return el; + }, + + //progress bar + progress: function progress(cell, formatterParams, onRendered) { + //progress bar + var value = this.sanitizeHTML(cell.getValue()) || 0, + element = cell.getElement(), + max = formatterParams && formatterParams.max ? formatterParams.max : 100, + min = formatterParams && formatterParams.min ? formatterParams.min : 0, + legendAlign = formatterParams && formatterParams.legendAlign ? formatterParams.legendAlign : "center", + percent, + percentValue, + color, + legend, + legendColor, + top, + left, + right, + bottom; + + //make sure value is in range + percentValue = parseFloat(value) <= max ? parseFloat(value) : max; + percentValue = parseFloat(percentValue) >= min ? parseFloat(percentValue) : min; + + //workout percentage + percent = (max - min) / 100; + percentValue = Math.round((percentValue - min) / percent); + + //set bar color + switch (_typeof(formatterParams.color)) { + case "string": + color = formatterParams.color; + break; + case "function": + color = formatterParams.color(value); + break; + case "object": + if (Array.isArray(formatterParams.color)) { + var unit = 100 / formatterParams.color.length; + var index = Math.floor(percentValue / unit); + + index = Math.min(index, formatterParams.color.length - 1); + index = Math.max(index, 0); + color = formatterParams.color[index]; + break; + } + default: + color = "#2DC214"; + } + + //generate legend + switch (_typeof(formatterParams.legend)) { + case "string": + legend = formatterParams.legend; + break; + case "function": + legend = formatterParams.legend(value); + break; + case "boolean": + legend = value; + break; + default: + legend = false; + } + + //set legend color + switch (_typeof(formatterParams.legendColor)) { + case "string": + legendColor = formatterParams.legendColor; + break; + case "function": + legendColor = formatterParams.legendColor(value); + break; + case "object": + if (Array.isArray(formatterParams.legendColor)) { + var unit = 100 / formatterParams.legendColor.length; + var index = Math.floor(percentValue / unit); + + index = Math.min(index, formatterParams.legendColor.length - 1); + index = Math.max(index, 0); + legendColor = formatterParams.legendColor[index]; + } + break; + default: + legendColor = "#000"; + } + + element.style.minWidth = "30px"; + element.style.position = "relative"; + + element.setAttribute("aria-label", percentValue); + + var barEl = document.createElement("div"); + barEl.style.display = "inline-block"; + barEl.style.position = "relative"; + barEl.style.width = percentValue + "%"; + barEl.style.backgroundColor = color; + barEl.style.height = "100%"; + + barEl.setAttribute('data-max', max); + barEl.setAttribute('data-min', min); + + if (legend) { + var legendEl = document.createElement("div"); + legendEl.style.position = "absolute"; + legendEl.style.top = "4px"; + legendEl.style.left = 0; + legendEl.style.textAlign = legendAlign; + legendEl.style.width = "100%"; + legendEl.style.color = legendColor; + legendEl.innerHTML = legend; + } + + onRendered(function () { + + //handle custom element needed if formatter is to be included in printed/downloaded output + if (!(cell instanceof CellComponent)) { + var holderEl = document.createElement("div"); + holderEl.style.position = "absolute"; + holderEl.style.top = "4px"; + holderEl.style.bottom = "4px"; + holderEl.style.left = "4px"; + holderEl.style.right = "4px"; + + element.appendChild(holderEl); + + element = holderEl; + } + + element.appendChild(barEl); + + if (legend) { + element.appendChild(legendEl); + } + }); + + return ""; + }, + + //background color + color: function color(cell, formatterParams, onRendered) { + cell.getElement().style.backgroundColor = this.sanitizeHTML(cell.getValue()); + return ""; + }, + + //tick icon + buttonTick: function buttonTick(cell, formatterParams, onRendered) { + return ''; + }, + + //cross icon + buttonCross: function buttonCross(cell, formatterParams, onRendered) { + return ''; + }, + + //current row number + rownum: function rownum(cell, formatterParams, onRendered) { + return this.table.rowManager.activeRows.indexOf(cell.getRow()._getSelf()) + 1; + }, + + //row handle + handle: function handle(cell, formatterParams, onRendered) { + cell.getElement().classList.add("tabulator-row-handle"); + return "
"; + }, + + responsiveCollapse: function responsiveCollapse(cell, formatterParams, onRendered) { + var self = this, + open = false, + el = document.createElement("div"), + config = cell.getRow()._row.modules.responsiveLayout; + + el.classList.add("tabulator-responsive-collapse-toggle"); + el.innerHTML = "+-"; + + cell.getElement().classList.add("tabulator-row-handle"); + + function toggleList(isOpen) { + var collapseEl = config.element; + + config.open = isOpen; + + if (collapseEl) { + + if (config.open) { + el.classList.add("open"); + collapseEl.style.display = ''; + } else { + el.classList.remove("open"); + collapseEl.style.display = 'none'; + } + } + } + + el.addEventListener("click", function (e) { + e.stopImmediatePropagation(); + toggleList(!config.open); + }); + + toggleList(config.open); + + return el; + }, + + rowSelection: function rowSelection(cell) { + var _this54 = this; + + var checkbox = document.createElement("input"); + + checkbox.type = 'checkbox'; + + if (this.table.modExists("selectRow", true)) { + + checkbox.addEventListener("click", function (e) { + e.stopPropagation(); + }); + + if (typeof cell.getRow == 'function') { + var row = cell.getRow(); + + checkbox.addEventListener("change", function (e) { + row.toggleSelect(); + }); + + checkbox.checked = row.isSelected(); + this.table.modules.selectRow.registerRowSelectCheckbox(row, checkbox); + } else { + checkbox.addEventListener("change", function (e) { + if (_this54.table.modules.selectRow.selectedRows.length) { + _this54.table.deselectRow(); + } else { + _this54.table.selectRow(); + } + }); + + this.table.modules.selectRow.registerHeaderSelectCheckbox(checkbox); + } + } + return checkbox; + } + }; + + Tabulator.prototype.registerModule("format", Format); + + var FrozenColumns = function FrozenColumns(table) { + this.table = table; //hold Tabulator object + this.leftColumns = []; + this.rightColumns = []; + this.leftMargin = 0; + this.rightMargin = 0; + this.rightPadding = 0; + this.initializationMode = "left"; + this.active = false; + this.scrollEndTimer = false; + }; + + //reset initial state + FrozenColumns.prototype.reset = function () { + this.initializationMode = "left"; + this.leftColumns = []; + this.rightColumns = []; + this.leftMargin = 0; + this.rightMargin = 0; + this.rightMargin = 0; + this.active = false; + + this.table.columnManager.headersElement.style.marginLeft = 0; + this.table.columnManager.element.style.paddingRight = 0; + }; + + //initialize specific column + FrozenColumns.prototype.initializeColumn = function (column) { + var config = { margin: 0, edge: false }; + + if (!column.isGroup) { + + if (this.frozenCheck(column)) { + + config.position = this.initializationMode; + + if (this.initializationMode == "left") { + this.leftColumns.push(column); + } else { + this.rightColumns.unshift(column); + } + + this.active = true; + + column.modules.frozen = config; + } else { + this.initializationMode = "right"; + } + } + }; + + FrozenColumns.prototype.frozenCheck = function (column) { + var frozen = false; + + if (column.parent.isGroup && column.definition.frozen) { + console.warn("Frozen Column Error - Parent column group must be frozen, not individual columns or sub column groups"); + } + + if (column.parent.isGroup) { + return this.frozenCheck(column.parent); + } else { + return column.definition.frozen; + } + + return frozen; + }; + + //quick layout to smooth horizontal scrolling + FrozenColumns.prototype.scrollHorizontal = function () { + var _this55 = this; + + var rows; + + if (this.active) { + clearTimeout(this.scrollEndTimer); + + //layout all rows after scroll is complete + this.scrollEndTimer = setTimeout(function () { + _this55.layout(); + }, 100); + + rows = this.table.rowManager.getVisibleRows(); + + this.calcMargins(); + + this.layoutColumnPosition(); + + this.layoutCalcRows(); + + rows.forEach(function (row) { + if (row.type === "row") { + _this55.layoutRow(row); + } + }); + + this.table.rowManager.tableElement.style.marginRight = this.rightMargin; + } + }; + + //calculate margins for rows + FrozenColumns.prototype.calcMargins = function () { + this.leftMargin = this._calcSpace(this.leftColumns, this.leftColumns.length) + "px"; + this.table.columnManager.headersElement.style.marginLeft = this.leftMargin; + + this.rightMargin = this._calcSpace(this.rightColumns, this.rightColumns.length) + "px"; + this.table.columnManager.element.style.paddingRight = this.rightMargin; + + //calculate right frozen columns + this.rightPadding = this.table.rowManager.element.clientWidth + this.table.columnManager.scrollLeft; + }; + + //layout calculation rows + FrozenColumns.prototype.layoutCalcRows = function () { + if (this.table.modExists("columnCalcs")) { + if (this.table.modules.columnCalcs.topInitialized && this.table.modules.columnCalcs.topRow) { + this.layoutRow(this.table.modules.columnCalcs.topRow); + } + if (this.table.modules.columnCalcs.botInitialized && this.table.modules.columnCalcs.botRow) { + this.layoutRow(this.table.modules.columnCalcs.botRow); + } + } + }; + + //calculate column positions and layout headers + FrozenColumns.prototype.layoutColumnPosition = function (allCells) { + var _this56 = this; + + var leftParents = []; + + this.leftColumns.forEach(function (column, i) { + column.modules.frozen.margin = _this56._calcSpace(_this56.leftColumns, i) + _this56.table.columnManager.scrollLeft + "px"; + + if (i == _this56.leftColumns.length - 1) { + column.modules.frozen.edge = true; + } else { + column.modules.frozen.edge = false; + } + + if (column.parent.isGroup) { + var parentEl = _this56.getColGroupParentElement(column); + if (!leftParents.includes(parentEl)) { + _this56.layoutElement(parentEl, column); + leftParents.push(parentEl); + } + + if (column.modules.frozen.edge) { + parentEl.classList.add("tabulator-frozen-" + column.modules.frozen.position); + } + } else { + _this56.layoutElement(column.getElement(), column); + } + + if (allCells) { + column.cells.forEach(function (cell) { + _this56.layoutElement(cell.getElement(), column); + }); + } + }); + + this.rightColumns.forEach(function (column, i) { + column.modules.frozen.margin = _this56.rightPadding - _this56._calcSpace(_this56.rightColumns, i + 1) + "px"; + + if (i == _this56.rightColumns.length - 1) { + column.modules.frozen.edge = true; + } else { + column.modules.frozen.edge = false; + } + + if (column.parent.isGroup) { + _this56.layoutElement(_this56.getColGroupParentElement(column), column); + } else { + _this56.layoutElement(column.getElement(), column); + } + + if (allCells) { + column.cells.forEach(function (cell) { + _this56.layoutElement(cell.getElement(), column); + }); + } + }); + }; + + FrozenColumns.prototype.getColGroupParentElement = function (column) { + return column.parent.isGroup ? this.getColGroupParentElement(column.parent) : column.getElement(); + }; + + //layout columns appropropriatly + FrozenColumns.prototype.layout = function () { + var self = this, + rightMargin = 0; + + if (self.active) { + + //calculate row padding + this.calcMargins(); + + // self.table.rowManager.activeRows.forEach(function(row){ + // self.layoutRow(row); + // }); + + // if(self.table.options.dataTree){ + self.table.rowManager.getDisplayRows().forEach(function (row) { + if (row.type === "row") { + self.layoutRow(row); + } + }); + // } + + this.layoutCalcRows(); + + //calculate left columns + this.layoutColumnPosition(true); + + // if(tableHolder.scrollHeight > tableHolder.clientHeight){ + // rightMargin -= tableHolder.offsetWidth - tableHolder.clientWidth; + // } + + this.table.rowManager.tableElement.style.marginRight = this.rightMargin; + } + }; + + FrozenColumns.prototype.layoutRow = function (row) { + var _this57 = this; + + var rowEl = row.getElement(); + + rowEl.style.paddingLeft = this.leftMargin; + // rowEl.style.paddingRight = this.rightMargin + "px"; + + this.leftColumns.forEach(function (column) { + var cell = row.getCell(column); + + if (cell) { + _this57.layoutElement(cell.getElement(), column); + } + }); + + this.rightColumns.forEach(function (column) { + var cell = row.getCell(column); + + if (cell) { + _this57.layoutElement(cell.getElement(), column); + } + }); + }; + + FrozenColumns.prototype.layoutElement = function (element, column) { + + if (column.modules.frozen) { + element.style.position = "absolute"; + element.style.left = column.modules.frozen.margin; + + element.classList.add("tabulator-frozen"); + + if (column.modules.frozen.edge) { + element.classList.add("tabulator-frozen-" + column.modules.frozen.position); + } + } + }; + + FrozenColumns.prototype._calcSpace = function (columns, index) { + var width = 0; + + for (var _i8 = 0; _i8 < index; _i8++) { + if (columns[_i8].visible) { + width += columns[_i8].getWidth(); + } + } + + return width; + }; + + Tabulator.prototype.registerModule("frozenColumns", FrozenColumns); + var FrozenRows = function FrozenRows(table) { + this.table = table; //hold Tabulator object + this.topElement = document.createElement("div"); + this.rows = []; + this.displayIndex = 0; //index in display pipeline + }; + + FrozenRows.prototype.initialize = function () { + this.rows = []; + + this.topElement.classList.add("tabulator-frozen-rows-holder"); + + // this.table.columnManager.element.append(this.topElement); + this.table.columnManager.getElement().insertBefore(this.topElement, this.table.columnManager.headersElement.nextSibling); + }; + + FrozenRows.prototype.setDisplayIndex = function (index) { + this.displayIndex = index; + }; + + FrozenRows.prototype.getDisplayIndex = function () { + return this.displayIndex; + }; + + FrozenRows.prototype.isFrozen = function () { + return !!this.rows.length; + }; + + //filter frozen rows out of display data + FrozenRows.prototype.getRows = function (rows) { + var self = this, + frozen = [], + output = rows.slice(0); + + this.rows.forEach(function (row) { + var index = output.indexOf(row); + + if (index > -1) { + output.splice(index, 1); + } + }); + + return output; + }; + + FrozenRows.prototype.freezeRow = function (row) { + if (!row.modules.frozen) { + row.modules.frozen = true; + this.topElement.appendChild(row.getElement()); + row.initialize(); + row.normalizeHeight(); + this.table.rowManager.adjustTableSize(); + + this.rows.push(row); + + this.table.rowManager.refreshActiveData("display"); + + this.styleRows(); + } else { + console.warn("Freeze Error - Row is already frozen"); + } + }; + + FrozenRows.prototype.unfreezeRow = function (row) { + var index = this.rows.indexOf(row); + + if (row.modules.frozen) { + + row.modules.frozen = false; + + var rowEl = row.getElement(); + rowEl.parentNode.removeChild(rowEl); + + this.table.rowManager.adjustTableSize(); + + this.rows.splice(index, 1); + + this.table.rowManager.refreshActiveData("display"); + + if (this.rows.length) { + this.styleRows(); + } + } else { + console.warn("Freeze Error - Row is already unfrozen"); + } + }; + + FrozenRows.prototype.styleRows = function (row) { + var self = this; + + this.rows.forEach(function (row, i) { + self.table.rowManager.styleRow(row, i); + }); + }; + + Tabulator.prototype.registerModule("frozenRows", FrozenRows); + + //public group object + var GroupComponent = function GroupComponent(group) { + this._group = group; + this.type = "GroupComponent"; + }; + + GroupComponent.prototype.getKey = function () { + return this._group.key; + }; + + GroupComponent.prototype.getField = function () { + return this._group.field; + }; + + GroupComponent.prototype.getElement = function () { + return this._group.element; + }; + + GroupComponent.prototype.getRows = function () { + return this._group.getRows(true); + }; + + GroupComponent.prototype.getSubGroups = function () { + return this._group.getSubGroups(true); + }; + + GroupComponent.prototype.getParentGroup = function () { + return this._group.parent ? this._group.parent.getComponent() : false; + }; + + GroupComponent.prototype.getVisibility = function () { + console.warn("getVisibility function is deprecated, you should now use the isVisible function"); + return this._group.visible; + }; + + GroupComponent.prototype.isVisible = function () { + return this._group.visible; + }; + + GroupComponent.prototype.show = function () { + this._group.show(); + }; + + GroupComponent.prototype.hide = function () { + this._group.hide(); + }; + + GroupComponent.prototype.toggle = function () { + this._group.toggleVisibility(); + }; + + GroupComponent.prototype._getSelf = function () { + return this._group; + }; + + GroupComponent.prototype.getTable = function () { + return this._group.groupManager.table; + }; + + ////////////////////////////////////////////////// + //////////////// Group Functions ///////////////// + ////////////////////////////////////////////////// + + var Group = function Group(groupManager, parent, level, key, field, generator, oldGroup) { + + this.groupManager = groupManager; + this.parent = parent; + this.key = key; + this.level = level; + this.field = field; + this.hasSubGroups = level < groupManager.groupIDLookups.length - 1; + this.addRow = this.hasSubGroups ? this._addRowToGroup : this._addRow; + this.type = "group"; //type of element + this.old = oldGroup; + this.rows = []; + this.groups = []; + this.groupList = []; + this.generator = generator; + this.elementContents = false; + this.height = 0; + this.outerHeight = 0; + this.initialized = false; + this.calcs = {}; + this.initialized = false; + this.modules = {}; + this.arrowElement = false; + + this.visible = oldGroup ? oldGroup.visible : typeof groupManager.startOpen[level] !== "undefined" ? groupManager.startOpen[level] : groupManager.startOpen[0]; + + this.component = null; + + this.createElements(); + this.addBindings(); + + this.createValueGroups(); + }; + + Group.prototype.wipe = function () { + if (this.groupList.length) { + this.groupList.forEach(function (group) { + group.wipe(); + }); + } else { + this.element = false; + this.arrowElement = false; + this.elementContents = false; + } + }; + + Group.prototype.createElements = function () { + var arrow = document.createElement("div"); + arrow.classList.add("tabulator-arrow"); + + this.element = document.createElement("div"); + this.element.classList.add("tabulator-row"); + this.element.classList.add("tabulator-group"); + this.element.classList.add("tabulator-group-level-" + this.level); + this.element.setAttribute("role", "rowgroup"); + + this.arrowElement = document.createElement("div"); + this.arrowElement.classList.add("tabulator-group-toggle"); + this.arrowElement.appendChild(arrow); + + //setup movable rows + if (this.groupManager.table.options.movableRows !== false && this.groupManager.table.modExists("moveRow")) { + this.groupManager.table.modules.moveRow.initializeGroupHeader(this); + } + }; + + Group.prototype.createValueGroups = function () { + var _this58 = this; + + var level = this.level + 1; + if (this.groupManager.allowedValues && this.groupManager.allowedValues[level]) { + this.groupManager.allowedValues[level].forEach(function (value) { + _this58._createGroup(value, level); + }); + } + }; + + Group.prototype.addBindings = function () { + var self = this, + dblTap, + tapHold, + tap, + toggleElement; + + //handle group click events + if (self.groupManager.table.options.groupClick) { + self.element.addEventListener("click", function (e) { + self.groupManager.table.options.groupClick.call(self.groupManager.table, e, self.getComponent()); + }); + } + + if (self.groupManager.table.options.groupDblClick) { + self.element.addEventListener("dblclick", function (e) { + self.groupManager.table.options.groupDblClick.call(self.groupManager.table, e, self.getComponent()); + }); + } + + if (self.groupManager.table.options.groupContext) { + self.element.addEventListener("contextmenu", function (e) { + self.groupManager.table.options.groupContext.call(self.groupManager.table, e, self.getComponent()); + }); + } + + if (self.groupManager.table.options.groupContextMenu && self.groupManager.table.modExists("menu")) { + self.groupManager.table.modules.menu.initializeGroup.call(self.groupManager.table.modules.menu, self); + } + + if (self.groupManager.table.options.groupTap) { + + tap = false; + + self.element.addEventListener("touchstart", function (e) { + tap = true; + }, { passive: true }); + + self.element.addEventListener("touchend", function (e) { + if (tap) { + self.groupManager.table.options.groupTap(e, self.getComponent()); + } + + tap = false; + }); + } + + if (self.groupManager.table.options.groupDblTap) { + + dblTap = null; + + self.element.addEventListener("touchend", function (e) { + + if (dblTap) { + clearTimeout(dblTap); + dblTap = null; + + self.groupManager.table.options.groupDblTap(e, self.getComponent()); + } else { + + dblTap = setTimeout(function () { + clearTimeout(dblTap); + dblTap = null; + }, 300); + } + }); + } + + if (self.groupManager.table.options.groupTapHold) { + + tapHold = null; + + self.element.addEventListener("touchstart", function (e) { + clearTimeout(tapHold); + + tapHold = setTimeout(function () { + clearTimeout(tapHold); + tapHold = null; + tap = false; + self.groupManager.table.options.groupTapHold(e, self.getComponent()); + }, 1000); + }, { passive: true }); + + self.element.addEventListener("touchend", function (e) { + clearTimeout(tapHold); + tapHold = null; + }); + } + + if (self.groupManager.table.options.groupToggleElement) { + toggleElement = self.groupManager.table.options.groupToggleElement == "arrow" ? self.arrowElement : self.element; + + toggleElement.addEventListener("click", function (e) { + e.stopPropagation(); + e.stopImmediatePropagation(); + self.toggleVisibility(); + }); + } + }; + + Group.prototype._createGroup = function (groupID, level) { + var groupKey = level + "_" + groupID; + var group = new Group(this.groupManager, this, level, groupID, this.groupManager.groupIDLookups[level].field, this.groupManager.headerGenerator[level] || this.groupManager.headerGenerator[0], this.old ? this.old.groups[groupKey] : false); + + this.groups[groupKey] = group; + this.groupList.push(group); + }; + + Group.prototype._addRowToGroup = function (row) { + + var level = this.level + 1; + + if (this.hasSubGroups) { + var groupID = this.groupManager.groupIDLookups[level].func(row.getData()), + groupKey = level + "_" + groupID; + + if (this.groupManager.allowedValues && this.groupManager.allowedValues[level]) { + if (this.groups[groupKey]) { + this.groups[groupKey].addRow(row); + } + } else { + if (!this.groups[groupKey]) { + this._createGroup(groupID, level); + } + + this.groups[groupKey].addRow(row); + } + } + }; + + Group.prototype._addRow = function (row) { + this.rows.push(row); + row.modules.group = this; + }; + + Group.prototype.insertRow = function (row, to, after) { + var data = this.conformRowData({}); + + row.updateData(data); + + var toIndex = this.rows.indexOf(to); + + if (toIndex > -1) { + if (after) { + this.rows.splice(toIndex + 1, 0, row); + } else { + this.rows.splice(toIndex, 0, row); + } + } else { + if (after) { + this.rows.push(row); + } else { + this.rows.unshift(row); + } + } + + row.modules.group = this; + + this.generateGroupHeaderContents(); + + if (this.groupManager.table.modExists("columnCalcs") && this.groupManager.table.options.columnCalcs != "table") { + this.groupManager.table.modules.columnCalcs.recalcGroup(this); + } + + this.groupManager.updateGroupRows(true); + }; + + Group.prototype.scrollHeader = function (left) { + this.arrowElement.style.marginLeft = left; + + this.groupList.forEach(function (child) { + child.scrollHeader(left); + }); + }; + + Group.prototype.getRowIndex = function (row) {}; + + //update row data to match grouping contraints + Group.prototype.conformRowData = function (data) { + if (this.field) { + data[this.field] = this.key; + } else { + console.warn("Data Conforming Error - Cannot conform row data to match new group as groupBy is a function"); + } + + if (this.parent) { + data = this.parent.conformRowData(data); + } + + return data; + }; + + Group.prototype.removeRow = function (row) { + var index = this.rows.indexOf(row); + var el = row.getElement(); + + if (index > -1) { + this.rows.splice(index, 1); + } + + if (!this.groupManager.table.options.groupValues && !this.rows.length) { + if (this.parent) { + this.parent.removeGroup(this); + } else { + this.groupManager.removeGroup(this); + } + + this.groupManager.updateGroupRows(true); + } else { + + if (el.parentNode) { + el.parentNode.removeChild(el); + } + + this.generateGroupHeaderContents(); + + if (this.groupManager.table.modExists("columnCalcs") && this.groupManager.table.options.columnCalcs != "table") { + this.groupManager.table.modules.columnCalcs.recalcGroup(this); + } + } + }; + + Group.prototype.removeGroup = function (group) { + var groupKey = group.level + "_" + group.key, + index; + + if (this.groups[groupKey]) { + delete this.groups[groupKey]; + + index = this.groupList.indexOf(group); + + if (index > -1) { + this.groupList.splice(index, 1); + } + + if (!this.groupList.length) { + if (this.parent) { + this.parent.removeGroup(this); + } else { + this.groupManager.removeGroup(this); + } + } + } + }; + + Group.prototype.getHeadersAndRows = function (noCalc) { + var output = []; + + output.push(this); + + this._visSet(); + + if (this.visible) { + if (this.groupList.length) { + this.groupList.forEach(function (group) { + output = output.concat(group.getHeadersAndRows(noCalc)); + }); + } else { + if (!noCalc && this.groupManager.table.options.columnCalcs != "table" && this.groupManager.table.modExists("columnCalcs") && this.groupManager.table.modules.columnCalcs.hasTopCalcs()) { + if (this.calcs.top) { + this.calcs.top.detachElement(); + this.calcs.top.deleteCells(); + } + + this.calcs.top = this.groupManager.table.modules.columnCalcs.generateTopRow(this.rows); + output.push(this.calcs.top); + } + + output = output.concat(this.rows); + + if (!noCalc && this.groupManager.table.options.columnCalcs != "table" && this.groupManager.table.modExists("columnCalcs") && this.groupManager.table.modules.columnCalcs.hasBottomCalcs()) { + if (this.calcs.bottom) { + this.calcs.bottom.detachElement(); + this.calcs.bottom.deleteCells(); + } + + this.calcs.bottom = this.groupManager.table.modules.columnCalcs.generateBottomRow(this.rows); + output.push(this.calcs.bottom); + } + } + } else { + if (!this.groupList.length && this.groupManager.table.options.columnCalcs != "table") { + + if (this.groupManager.table.modExists("columnCalcs")) { + + if (!noCalc && this.groupManager.table.modules.columnCalcs.hasTopCalcs()) { + if (this.calcs.top) { + this.calcs.top.detachElement(); + this.calcs.top.deleteCells(); + } + + if (this.groupManager.table.options.groupClosedShowCalcs) { + this.calcs.top = this.groupManager.table.modules.columnCalcs.generateTopRow(this.rows); + output.push(this.calcs.top); + } + } + + if (!noCalc && this.groupManager.table.modules.columnCalcs.hasBottomCalcs()) { + if (this.calcs.bottom) { + this.calcs.bottom.detachElement(); + this.calcs.bottom.deleteCells(); + } + + if (this.groupManager.table.options.groupClosedShowCalcs) { + this.calcs.bottom = this.groupManager.table.modules.columnCalcs.generateBottomRow(this.rows); + output.push(this.calcs.bottom); + } + } + } + } + } + + return output; + }; + + Group.prototype.getData = function (visible, transform) { + var self = this, + output = []; + + this._visSet(); + + if (!visible || visible && this.visible) { + this.rows.forEach(function (row) { + output.push(row.getData(transform || "data")); + }); + } + + return output; + }; + + // Group.prototype.getRows = function(){ + // this._visSet(); + + // return this.visible ? this.rows : []; + // }; + + Group.prototype.getRowCount = function () { + var count = 0; + + if (this.groupList.length) { + this.groupList.forEach(function (group) { + count += group.getRowCount(); + }); + } else { + count = this.rows.length; + } + return count; + }; + + Group.prototype.toggleVisibility = function () { + if (this.visible) { + this.hide(); + } else { + this.show(); + } + }; + + Group.prototype.hide = function () { + this.visible = false; + + if (this.groupManager.table.rowManager.getRenderMode() == "classic" && !this.groupManager.table.options.pagination) { + + this.element.classList.remove("tabulator-group-visible"); + + if (this.groupList.length) { + this.groupList.forEach(function (group) { + + var rows = group.getHeadersAndRows(); + + rows.forEach(function (row) { + row.detachElement(); + }); + }); + } else { + this.rows.forEach(function (row) { + var rowEl = row.getElement(); + rowEl.parentNode.removeChild(rowEl); + }); + } + + this.groupManager.table.rowManager.setDisplayRows(this.groupManager.updateGroupRows(), this.groupManager.getDisplayIndex()); + + this.groupManager.table.rowManager.checkClassicModeGroupHeaderWidth(); + } else { + this.groupManager.updateGroupRows(true); + } + + this.groupManager.table.options.groupVisibilityChanged.call(this.table, this.getComponent(), false); + }; + + Group.prototype.show = function () { + var self = this; + + self.visible = true; + + if (this.groupManager.table.rowManager.getRenderMode() == "classic" && !this.groupManager.table.options.pagination) { + + this.element.classList.add("tabulator-group-visible"); + + var prev = self.getElement(); + + if (this.groupList.length) { + this.groupList.forEach(function (group) { + var rows = group.getHeadersAndRows(); + + rows.forEach(function (row) { + var rowEl = row.getElement(); + prev.parentNode.insertBefore(rowEl, prev.nextSibling); + row.initialize(); + prev = rowEl; + }); + }); + } else { + self.rows.forEach(function (row) { + var rowEl = row.getElement(); + prev.parentNode.insertBefore(rowEl, prev.nextSibling); + row.initialize(); + prev = rowEl; + }); + } + + this.groupManager.table.rowManager.setDisplayRows(this.groupManager.updateGroupRows(), this.groupManager.getDisplayIndex()); + + this.groupManager.table.rowManager.checkClassicModeGroupHeaderWidth(); + } else { + this.groupManager.updateGroupRows(true); + } + + this.groupManager.table.options.groupVisibilityChanged.call(this.table, this.getComponent(), true); + }; + + Group.prototype._visSet = function () { + var data = []; + + if (typeof this.visible == "function") { + + this.rows.forEach(function (row) { + data.push(row.getData()); + }); + + this.visible = this.visible(this.key, this.getRowCount(), data, this.getComponent()); + } + }; + + Group.prototype.getRowGroup = function (row) { + var match = false; + if (this.groupList.length) { + this.groupList.forEach(function (group) { + var result = group.getRowGroup(row); + + if (result) { + match = result; + } + }); + } else { + if (this.rows.find(function (item) { + return item === row; + })) { + match = this; + } + } + + return match; + }; + + Group.prototype.getSubGroups = function (component) { + var output = []; + + this.groupList.forEach(function (child) { + output.push(component ? child.getComponent() : child); + }); + + return output; + }; + + Group.prototype.getRows = function (compoment) { + var output = []; + + this.rows.forEach(function (row) { + output.push(compoment ? row.getComponent() : row); + }); + + return output; + }; + + Group.prototype.generateGroupHeaderContents = function () { + var data = []; + + this.rows.forEach(function (row) { + data.push(row.getData()); + }); + + this.elementContents = this.generator(this.key, this.getRowCount(), data, this.getComponent()); + + while (this.element.firstChild) { + this.element.removeChild(this.element.firstChild); + }if (typeof this.elementContents === "string") { + this.element.innerHTML = this.elementContents; + } else { + this.element.appendChild(this.elementContents); + } + + this.element.insertBefore(this.arrowElement, this.element.firstChild); + }; + + ////////////// Standard Row Functions ////////////// + + Group.prototype.getElement = function () { + this.addBindingsd = false; + + this._visSet(); + + if (this.visible) { + this.element.classList.add("tabulator-group-visible"); + } else { + this.element.classList.remove("tabulator-group-visible"); + } + + for (var i = 0; i < this.element.childNodes.length; ++i) { + this.element.childNodes[i].parentNode.removeChild(this.element.childNodes[i]); + } + + this.generateGroupHeaderContents(); + + // this.addBindings(); + + return this.element; + }; + + Group.prototype.detachElement = function () { + if (this.element && this.element.parentNode) { + this.element.parentNode.removeChild(this.element); + } + }; + + //normalize the height of elements in the row + Group.prototype.normalizeHeight = function () { + this.setHeight(this.element.clientHeight); + }; + + Group.prototype.initialize = function (force) { + if (!this.initialized || force) { + this.normalizeHeight(); + this.initialized = true; + } + }; + + Group.prototype.reinitialize = function () { + this.initialized = false; + this.height = 0; + + if (Tabulator.prototype.helpers.elVisible(this.element)) { + this.initialize(true); + } + }; + + Group.prototype.setHeight = function (height) { + if (this.height != height) { + this.height = height; + this.outerHeight = this.element.offsetHeight; + } + }; + + //return rows outer height + Group.prototype.getHeight = function () { + return this.outerHeight; + }; + + Group.prototype.getGroup = function () { + return this; + }; + + Group.prototype.reinitializeHeight = function () {}; + Group.prototype.calcHeight = function () {}; + Group.prototype.setCellHeight = function () {}; + Group.prototype.clearCellHeight = function () {}; + + //////////////// Object Generation ///////////////// + Group.prototype.getComponent = function () { + if (!this.component) { + this.component = new GroupComponent(this); + } + + return this.component; + }; + + ////////////////////////////////////////////////// + ////////////// Group Row Extension /////////////// + ////////////////////////////////////////////////// + + var GroupRows = function GroupRows(table) { + + this.table = table; //hold Tabulator object + + this.groupIDLookups = false; //enable table grouping and set field to group by + this.startOpen = [function () { + return false; + }]; //starting state of group + this.headerGenerator = [function () { + return ""; + }]; + this.groupList = []; //ordered list of groups + this.allowedValues = false; + this.groups = {}; //hold row groups + this.displayIndex = 0; //index in display pipeline + }; + + //initialize group configuration + GroupRows.prototype.initialize = function () { + var self = this, + groupBy = self.table.options.groupBy, + startOpen = self.table.options.groupStartOpen, + groupHeader = self.table.options.groupHeader; + + this.allowedValues = self.table.options.groupValues; + + if (Array.isArray(groupBy) && Array.isArray(groupHeader) && groupBy.length > groupHeader.length) { + console.warn("Error creating group headers, groupHeader array is shorter than groupBy array"); + } + + self.headerGenerator = [function () { + return ""; + }]; + this.startOpen = [function () { + return false; + }]; //starting state of group + + self.table.modules.localize.bind("groups|item", function (langValue, lang) { + self.headerGenerator[0] = function (value, count, data) { + //header layout function + return (typeof value === "undefined" ? "" : value) + "(" + count + " " + (count === 1 ? langValue : lang.groups.items) + ")"; + }; + }); + + this.groupIDLookups = []; + + if (Array.isArray(groupBy) || groupBy) { + if (this.table.modExists("columnCalcs") && this.table.options.columnCalcs != "table" && this.table.options.columnCalcs != "both") { + this.table.modules.columnCalcs.removeCalcs(); + } + } else { + if (this.table.modExists("columnCalcs") && this.table.options.columnCalcs != "group") { + + var cols = this.table.columnManager.getRealColumns(); + + cols.forEach(function (col) { + if (col.definition.topCalc) { + self.table.modules.columnCalcs.initializeTopRow(); + } + + if (col.definition.bottomCalc) { + self.table.modules.columnCalcs.initializeBottomRow(); + } + }); + } + } + + if (!Array.isArray(groupBy)) { + groupBy = [groupBy]; + } + + groupBy.forEach(function (group, i) { + var lookupFunc, column; + + if (typeof group == "function") { + lookupFunc = group; + } else { + column = self.table.columnManager.getColumnByField(group); + + if (column) { + lookupFunc = function lookupFunc(data) { + return column.getFieldValue(data); + }; + } else { + lookupFunc = function lookupFunc(data) { + return data[group]; + }; + } + } + + self.groupIDLookups.push({ + field: typeof group === "function" ? false : group, + func: lookupFunc, + values: self.allowedValues ? self.allowedValues[i] : false + }); + }); + + if (startOpen) { + + if (!Array.isArray(startOpen)) { + startOpen = [startOpen]; + } + + startOpen.forEach(function (level) { + level = typeof level == "function" ? level : function () { + return true; + }; + }); + + self.startOpen = startOpen; + } + + if (groupHeader) { + self.headerGenerator = Array.isArray(groupHeader) ? groupHeader : [groupHeader]; + } + + this.initialized = true; + }; + + GroupRows.prototype.setDisplayIndex = function (index) { + this.displayIndex = index; + }; + + GroupRows.prototype.getDisplayIndex = function () { + return this.displayIndex; + }; + + //return appropriate rows with group headers + GroupRows.prototype.getRows = function (rows) { + if (this.groupIDLookups.length) { + + this.table.options.dataGrouping.call(this.table); + + this.generateGroups(rows); + + if (this.table.options.dataGrouped) { + this.table.options.dataGrouped.call(this.table, this.getGroups(true)); + } + + return this.updateGroupRows(); + } else { + return rows.slice(0); + } + }; + + GroupRows.prototype.getGroups = function (compoment) { + var groupComponents = []; + + this.groupList.forEach(function (group) { + groupComponents.push(compoment ? group.getComponent() : group); + }); + + return groupComponents; + }; + + GroupRows.prototype.getChildGroups = function (group) { + var _this59 = this; + + var groupComponents = []; + + if (!group) { + group = this; + } + + group.groupList.forEach(function (child) { + if (child.groupList.length) { + groupComponents = groupComponents.concat(_this59.getChildGroups(child)); + } else { + groupComponents.push(child); + } + }); + + return groupComponents; + }; + + GroupRows.prototype.wipe = function () { + this.groupList.forEach(function (group) { + group.wipe(); + }); + }; + + GroupRows.prototype.pullGroupListData = function (groupList) { + var self = this; + var groupListData = []; + + groupList.forEach(function (group) { + var groupHeader = {}; + groupHeader.level = 0; + groupHeader.rowCount = 0; + groupHeader.headerContent = ""; + var childData = []; + + if (group.hasSubGroups) { + childData = self.pullGroupListData(group.groupList); + + groupHeader.level = group.level; + groupHeader.rowCount = childData.length - group.groupList.length; // data length minus number of sub-headers + groupHeader.headerContent = group.generator(group.key, groupHeader.rowCount, group.rows, group); + + groupListData.push(groupHeader); + groupListData = groupListData.concat(childData); + } else { + groupHeader.level = group.level; + groupHeader.headerContent = group.generator(group.key, group.rows.length, group.rows, group); + groupHeader.rowCount = group.getRows().length; + + groupListData.push(groupHeader); + + group.getRows().forEach(function (row) { + groupListData.push(row.getData("data")); + }); + } + }); + + return groupListData; + }; + + GroupRows.prototype.getGroupedData = function () { + + return this.pullGroupListData(this.groupList); + }; + + GroupRows.prototype.getRowGroup = function (row) { + var match = false; + + this.groupList.forEach(function (group) { + var result = group.getRowGroup(row); + + if (result) { + match = result; + } + }); + + return match; + }; + + GroupRows.prototype.countGroups = function () { + return this.groupList.length; + }; + + GroupRows.prototype.generateGroups = function (rows) { + var self = this, + oldGroups = self.groups; + + self.groups = {}; + self.groupList = []; + + if (this.allowedValues && this.allowedValues[0]) { + this.allowedValues[0].forEach(function (value) { + self.createGroup(value, 0, oldGroups); + }); + + rows.forEach(function (row) { + self.assignRowToExistingGroup(row, oldGroups); + }); + } else { + rows.forEach(function (row) { + self.assignRowToGroup(row, oldGroups); + }); + } + }; + + GroupRows.prototype.createGroup = function (groupID, level, oldGroups) { + var groupKey = level + "_" + groupID, + group; + + oldGroups = oldGroups || []; + + group = new Group(this, false, level, groupID, this.groupIDLookups[0].field, this.headerGenerator[0], oldGroups[groupKey]); + + this.groups[groupKey] = group; + this.groupList.push(group); + }; + + // GroupRows.prototype.assignRowToGroup = function(row, oldGroups){ + // var groupID = this.groupIDLookups[0].func(row.getData()), + // groupKey = "0_" + groupID; + + // if(!this.groups[groupKey]){ + // this.createGroup(groupID, 0, oldGroups); + // } + + // this.groups[groupKey].addRow(row); + // }; + + GroupRows.prototype.assignRowToExistingGroup = function (row, oldGroups) { + var groupID = this.groupIDLookups[0].func(row.getData()), + groupKey = "0_" + groupID; + + if (this.groups[groupKey]) { + this.groups[groupKey].addRow(row); + } + }; + + GroupRows.prototype.assignRowToGroup = function (row, oldGroups) { + var groupID = this.groupIDLookups[0].func(row.getData()), + newGroupNeeded = !this.groups["0_" + groupID]; + + if (newGroupNeeded) { + this.createGroup(groupID, 0, oldGroups); + } + + this.groups["0_" + groupID].addRow(row); + + return !newGroupNeeded; + }; + + GroupRows.prototype.updateGroupRows = function (force) { + var self = this, + output = [], + oldRowCount; + + self.groupList.forEach(function (group) { + output = output.concat(group.getHeadersAndRows()); + }); + + //force update of table display + if (force) { + + var displayIndex = self.table.rowManager.setDisplayRows(output, this.getDisplayIndex()); + + if (displayIndex !== true) { + this.setDisplayIndex(displayIndex); + } + + self.table.rowManager.refreshActiveData("group", true, true); + } + + return output; + }; + + GroupRows.prototype.scrollHeaders = function (left) { + left = left + "px"; + + this.groupList.forEach(function (group) { + group.scrollHeader(left); + }); + }; + + GroupRows.prototype.removeGroup = function (group) { + var groupKey = group.level + "_" + group.key, + index; + + if (this.groups[groupKey]) { + delete this.groups[groupKey]; + + index = this.groupList.indexOf(group); + + if (index > -1) { + this.groupList.splice(index, 1); + } + } + }; + + Tabulator.prototype.registerModule("groupRows", GroupRows); + var History = function History(table) { + this.table = table; //hold Tabulator object + + this.history = []; + this.index = -1; + }; + + History.prototype.clear = function () { + this.history = []; + this.index = -1; + }; + + History.prototype.action = function (type, component, data) { + + this.history = this.history.slice(0, this.index + 1); + + this.history.push({ + type: type, + component: component, + data: data + }); + + this.index++; + }; + + History.prototype.getHistoryUndoSize = function () { + return this.index + 1; + }; + + History.prototype.getHistoryRedoSize = function () { + return this.history.length - (this.index + 1); + }; + + History.prototype.undo = function () { + + if (this.index > -1) { + var action = this.history[this.index]; + + this.undoers[action.type].call(this, action); + + this.index--; + + this.table.options.historyUndo.call(this.table, action.type, action.component.getComponent(), action.data); + + return true; + } else { + console.warn("History Undo Error - No more history to undo"); + return false; + } + }; + + History.prototype.redo = function () { + if (this.history.length - 1 > this.index) { + + this.index++; + + var action = this.history[this.index]; + + this.redoers[action.type].call(this, action); + + this.table.options.historyRedo.call(this.table, action.type, action.component.getComponent(), action.data); + + return true; + } else { + console.warn("History Redo Error - No more history to redo"); + return false; + } + }; + + History.prototype.undoers = { + cellEdit: function cellEdit(action) { + action.component.setValueProcessData(action.data.oldValue); + }, + + rowAdd: function rowAdd(action) { + action.component.deleteActual(); + }, + + rowDelete: function rowDelete(action) { + var newRow = this.table.rowManager.addRowActual(action.data.data, action.data.pos, action.data.index); + + if (this.table.options.groupBy && this.table.modExists("groupRows")) { + this.table.modules.groupRows.updateGroupRows(true); + } + + this._rebindRow(action.component, newRow); + }, + + rowMove: function rowMove(action) { + this.table.rowManager.moveRowActual(action.component, this.table.rowManager.rows[action.data.posFrom], !action.data.after); + this.table.rowManager.redraw(); + } + }; + + History.prototype.redoers = { + cellEdit: function cellEdit(action) { + action.component.setValueProcessData(action.data.newValue); + }, + + rowAdd: function rowAdd(action) { + var newRow = this.table.rowManager.addRowActual(action.data.data, action.data.pos, action.data.index); + + if (this.table.options.groupBy && this.table.modExists("groupRows")) { + this.table.modules.groupRows.updateGroupRows(true); + } + + this._rebindRow(action.component, newRow); + }, + + rowDelete: function rowDelete(action) { + action.component.deleteActual(); + }, + + rowMove: function rowMove(action) { + this.table.rowManager.moveRowActual(action.component, this.table.rowManager.rows[action.data.posTo], action.data.after); + this.table.rowManager.redraw(); + } + }; + + //rebind rows to new element after deletion + History.prototype._rebindRow = function (oldRow, newRow) { + this.history.forEach(function (action) { + if (action.component instanceof Row) { + if (action.component === oldRow) { + action.component = newRow; + } + } else if (action.component instanceof Cell) { + if (action.component.row === oldRow) { + var field = action.component.column.getField(); + + if (field) { + action.component = newRow.getCell(field); + } + } + } + }); + }; + + Tabulator.prototype.registerModule("history", History); + var HtmlTableImport = function HtmlTableImport(table) { + this.table = table; //hold Tabulator object + this.fieldIndex = []; + this.hasIndex = false; + }; + + HtmlTableImport.prototype.parseTable = function () { + var self = this, + element = self.table.element, + options = self.table.options, + columns = options.columns, + headers = element.getElementsByTagName("th"), + rows = element.getElementsByTagName("tbody")[0], + data = [], + newTable; + + self.hasIndex = false; + + self.table.options.htmlImporting.call(this.table); + + rows = rows ? rows.getElementsByTagName("tr") : []; + + //check for tablator inline options + self._extractOptions(element, options); + + if (headers.length) { + self._extractHeaders(headers, rows); + } else { + self._generateBlankHeaders(headers, rows); + } + + //iterate through table rows and build data set + for (var index = 0; index < rows.length; index++) { + var row = rows[index], + cells = row.getElementsByTagName("td"), + item = {}; + + //create index if the dont exist in table + if (!self.hasIndex) { + item[options.index] = index; + } + + for (var i = 0; i < cells.length; i++) { + var cell = cells[i]; + if (typeof this.fieldIndex[i] !== "undefined") { + item[this.fieldIndex[i]] = cell.innerHTML; + } + } + + //add row data to item + data.push(item); + } + + //create new element + var newElement = document.createElement("div"); + + //transfer attributes to new element + var attributes = element.attributes; + + // loop through attributes and apply them on div + + for (var i in attributes) { + if (_typeof(attributes[i]) == "object") { + newElement.setAttribute(attributes[i].name, attributes[i].value); + } + } + + // replace table with div element + element.parentNode.replaceChild(newElement, element); + + options.data = data; + + self.table.options.htmlImported.call(this.table); + + // // newElement.tabulator(options); + + this.table.element = newElement; + }; + + //extract tabulator attribute options + HtmlTableImport.prototype._extractOptions = function (element, options, defaultOptions) { + var attributes = element.attributes; + var optionsArr = defaultOptions ? Object.assign([], defaultOptions) : Object.keys(options); + var optionsList = {}; + + optionsArr.forEach(function (item) { + optionsList[item.toLowerCase()] = item; + }); + + for (var index in attributes) { + var attrib = attributes[index]; + var name; + + if (attrib && (typeof attrib === 'undefined' ? 'undefined' : _typeof(attrib)) == "object" && attrib.name && attrib.name.indexOf("tabulator-") === 0) { + name = attrib.name.replace("tabulator-", ""); + + if (typeof optionsList[name] !== "undefined") { + options[optionsList[name]] = this._attribValue(attrib.value); + } + } + } + }; + + //get value of attribute + HtmlTableImport.prototype._attribValue = function (value) { + if (value === "true") { + return true; + } + + if (value === "false") { + return false; + } + + return value; + }; + + //find column if it has already been defined + HtmlTableImport.prototype._findCol = function (title) { + var match = this.table.options.columns.find(function (column) { + return column.title === title; + }); + + return match || false; + }; + + //extract column from headers + HtmlTableImport.prototype._extractHeaders = function (headers, rows) { + for (var index = 0; index < headers.length; index++) { + var header = headers[index], + exists = false, + col = this._findCol(header.textContent), + width, + attributes; + + if (col) { + exists = true; + } else { + col = { title: header.textContent.trim() }; + } + + if (!col.field) { + col.field = header.textContent.trim().toLowerCase().replace(" ", "_"); + } + + width = header.getAttribute("width"); + + if (width && !col.width) { + col.width = width; + } + + //check for tablator inline options + attributes = header.attributes; + + // //check for tablator inline options + this._extractOptions(header, col, Column.prototype.defaultOptionList); + + this.fieldIndex[index] = col.field; + + if (col.field == this.table.options.index) { + this.hasIndex = true; + } + + if (!exists) { + this.table.options.columns.push(col); + } + } + }; + + //generate blank headers + HtmlTableImport.prototype._generateBlankHeaders = function (headers, rows) { + for (var index = 0; index < headers.length; index++) { + var header = headers[index], + col = { title: "", field: "col" + index }; + + this.fieldIndex[index] = col.field; + + var width = header.getAttribute("width"); + + if (width) { + col.width = width; + } + + this.table.options.columns.push(col); + } + }; + + Tabulator.prototype.registerModule("htmlTableImport", HtmlTableImport); + var Keybindings = function Keybindings(table) { + this.table = table; //hold Tabulator object + this.watchKeys = null; + this.pressedKeys = null; + this.keyupBinding = false; + this.keydownBinding = false; + }; + + Keybindings.prototype.initialize = function () { + var bindings = this.table.options.keybindings, + mergedBindings = {}; + + this.watchKeys = {}; + this.pressedKeys = []; + + if (bindings !== false) { + + for (var key in this.bindings) { + mergedBindings[key] = this.bindings[key]; + } + + if (Object.keys(bindings).length) { + + for (var _key in bindings) { + mergedBindings[_key] = bindings[_key]; + } + } + + this.mapBindings(mergedBindings); + this.bindEvents(); + } + }; + + Keybindings.prototype.mapBindings = function (bindings) { + var _this60 = this; + + var self = this; + + var _loop2 = function _loop2(key) { + + if (_this60.actions[key]) { + + if (bindings[key]) { + + if (_typeof(bindings[key]) !== "object") { + bindings[key] = [bindings[key]]; + } + + bindings[key].forEach(function (binding) { + self.mapBinding(key, binding); + }); + } + } else { + console.warn("Key Binding Error - no such action:", key); + } + }; + + for (var key in bindings) { + _loop2(key); + } + }; + + Keybindings.prototype.mapBinding = function (action, symbolsList) { + var self = this; + + var binding = { + action: this.actions[action], + keys: [], + ctrl: false, + shift: false, + meta: false + }; + + var symbols = symbolsList.toString().toLowerCase().split(" ").join("").split("+"); + + symbols.forEach(function (symbol) { + switch (symbol) { + case "ctrl": + binding.ctrl = true; + break; + + case "shift": + binding.shift = true; + break; + + case "meta": + binding.meta = true; + break; + + default: + symbol = parseInt(symbol); + binding.keys.push(symbol); + + if (!self.watchKeys[symbol]) { + self.watchKeys[symbol] = []; + } + + self.watchKeys[symbol].push(binding); + } + }); + }; + + Keybindings.prototype.bindEvents = function () { + var self = this; + + this.keyupBinding = function (e) { + var code = e.keyCode; + var bindings = self.watchKeys[code]; + + if (bindings) { + + self.pressedKeys.push(code); + + bindings.forEach(function (binding) { + self.checkBinding(e, binding); + }); + } + }; + + this.keydownBinding = function (e) { + var code = e.keyCode; + var bindings = self.watchKeys[code]; + + if (bindings) { + + var index = self.pressedKeys.indexOf(code); + + if (index > -1) { + self.pressedKeys.splice(index, 1); + } + } + }; + + this.table.element.addEventListener("keydown", this.keyupBinding); + + this.table.element.addEventListener("keyup", this.keydownBinding); + }; + + Keybindings.prototype.clearBindings = function () { + if (this.keyupBinding) { + this.table.element.removeEventListener("keydown", this.keyupBinding); + } + + if (this.keydownBinding) { + this.table.element.removeEventListener("keyup", this.keydownBinding); + } + }; + + Keybindings.prototype.checkBinding = function (e, binding) { + var self = this, + match = true; + + if (e.ctrlKey == binding.ctrl && e.shiftKey == binding.shift && e.metaKey == binding.meta) { + binding.keys.forEach(function (key) { + var index = self.pressedKeys.indexOf(key); + + if (index == -1) { + match = false; + } + }); + + if (match) { + binding.action.call(self, e); + } + + return true; + } + + return false; + }; + + //default bindings + Keybindings.prototype.bindings = { + navPrev: "shift + 9", + navNext: 9, + navUp: 38, + navDown: 40, + scrollPageUp: 33, + scrollPageDown: 34, + scrollToStart: 36, + scrollToEnd: 35, + undo: "ctrl + 90", + redo: "ctrl + 89", + copyToClipboard: "ctrl + 67" + }; + + //default actions + Keybindings.prototype.actions = { + keyBlock: function keyBlock(e) { + e.stopPropagation(); + e.preventDefault(); + }, + scrollPageUp: function scrollPageUp(e) { + var rowManager = this.table.rowManager, + newPos = rowManager.scrollTop - rowManager.height, + scrollMax = rowManager.element.scrollHeight; + + e.preventDefault(); + + if (rowManager.displayRowsCount) { + if (newPos >= 0) { + rowManager.element.scrollTop = newPos; + } else { + rowManager.scrollToRow(rowManager.getDisplayRows()[0]); + } + } + + this.table.element.focus(); + }, + scrollPageDown: function scrollPageDown(e) { + var rowManager = this.table.rowManager, + newPos = rowManager.scrollTop + rowManager.height, + scrollMax = rowManager.element.scrollHeight; + + e.preventDefault(); + + if (rowManager.displayRowsCount) { + if (newPos <= scrollMax) { + rowManager.element.scrollTop = newPos; + } else { + rowManager.scrollToRow(rowManager.getDisplayRows()[rowManager.displayRowsCount - 1]); + } + } + + this.table.element.focus(); + }, + scrollToStart: function scrollToStart(e) { + var rowManager = this.table.rowManager; + + e.preventDefault(); + + if (rowManager.displayRowsCount) { + rowManager.scrollToRow(rowManager.getDisplayRows()[0]); + } + + this.table.element.focus(); + }, + scrollToEnd: function scrollToEnd(e) { + var rowManager = this.table.rowManager; + + e.preventDefault(); + + if (rowManager.displayRowsCount) { + rowManager.scrollToRow(rowManager.getDisplayRows()[rowManager.displayRowsCount - 1]); + } + + this.table.element.focus(); + }, + navPrev: function navPrev(e) { + var cell = false; + + if (this.table.modExists("edit")) { + cell = this.table.modules.edit.currentCell; + + if (cell) { + e.preventDefault(); + cell.nav().prev(); + } + } + }, + + navNext: function navNext(e) { + var cell = false; + var newRow = this.table.options.tabEndNewRow; + var nav; + + if (this.table.modExists("edit")) { + cell = this.table.modules.edit.currentCell; + + if (cell) { + e.preventDefault(); + + nav = cell.nav(); + + if (!nav.next()) { + if (newRow) { + + cell.getElement().firstChild.blur(); + + if (newRow === true) { + newRow = this.table.addRow({}); + } else { + if (typeof newRow == "function") { + newRow = this.table.addRow(newRow(cell.row.getComponent())); + } else { + newRow = this.table.addRow(Object.assign({}, newRow)); + } + } + + newRow.then(function () { + setTimeout(function () { + nav.next(); + }); + }); + } + } + } + } + }, + + navLeft: function navLeft(e) { + var cell = false; + + if (this.table.modExists("edit")) { + cell = this.table.modules.edit.currentCell; + + if (cell) { + e.preventDefault(); + cell.nav().left(); + } + } + }, + + navRight: function navRight(e) { + var cell = false; + + if (this.table.modExists("edit")) { + cell = this.table.modules.edit.currentCell; + + if (cell) { + e.preventDefault(); + cell.nav().right(); + } + } + }, + + navUp: function navUp(e) { + var cell = false; + + if (this.table.modExists("edit")) { + cell = this.table.modules.edit.currentCell; + + if (cell) { + e.preventDefault(); + cell.nav().up(); + } + } + }, + + navDown: function navDown(e) { + var cell = false; + + if (this.table.modExists("edit")) { + cell = this.table.modules.edit.currentCell; + + if (cell) { + e.preventDefault(); + cell.nav().down(); + } + } + }, + + undo: function undo(e) { + var cell = false; + if (this.table.options.history && this.table.modExists("history") && this.table.modExists("edit")) { + + cell = this.table.modules.edit.currentCell; + + if (!cell) { + e.preventDefault(); + this.table.modules.history.undo(); + } + } + }, + + redo: function redo(e) { + var cell = false; + if (this.table.options.history && this.table.modExists("history") && this.table.modExists("edit")) { + + cell = this.table.modules.edit.currentCell; + + if (!cell) { + e.preventDefault(); + this.table.modules.history.redo(); + } + } + }, + + copyToClipboard: function copyToClipboard(e) { + if (!this.table.modules.edit.currentCell) { + if (this.table.modExists("clipboard", true)) { + this.table.modules.clipboard.copy(false, true); + } + } + } + }; + + Tabulator.prototype.registerModule("keybindings", Keybindings); + var Menu = function Menu(table) { + this.table = table; //hold Tabulator object + this.menuEl = false; + this.blurEvent = this.hideMenu.bind(this); + this.escEvent = this.escMenu.bind(this); + this.nestedMenuBlock = false; + }; + + Menu.prototype.initializeColumnHeader = function (column) { + var _this61 = this; + + var headerMenuEl; + + if (column.definition.headerContextMenu) { + column.getElement().addEventListener("contextmenu", function (e) { + var menu = typeof column.definition.headerContextMenu == "function" ? column.definition.headerContextMenu(column.getComponent()) : column.definition.headerContextMenu; + + e.preventDefault(); + + _this61.loadMenu(e, column, menu); + }); + } + + if (column.definition.headerMenu) { + + headerMenuEl = document.createElement("span"); + headerMenuEl.classList.add("tabulator-header-menu-button"); + headerMenuEl.innerHTML = "⋮"; + + headerMenuEl.addEventListener("click", function (e) { + var menu = typeof column.definition.headerMenu == "function" ? column.definition.headerMenu(column.getComponent()) : column.definition.headerMenu; + e.stopPropagation(); + e.preventDefault(); + + _this61.loadMenu(e, column, menu); + }); + + column.titleElement.insertBefore(headerMenuEl, column.titleElement.firstChild); + } + }; + + Menu.prototype.initializeCell = function (cell) { + var _this62 = this; + + cell.getElement().addEventListener("contextmenu", function (e) { + var menu = typeof cell.column.definition.contextMenu == "function" ? cell.column.definition.contextMenu(cell.getComponent()) : cell.column.definition.contextMenu; + + e.stopImmediatePropagation(); + + _this62.loadMenu(e, cell, menu); + }); + }; + + Menu.prototype.initializeRow = function (row) { + var _this63 = this; + + row.getElement().addEventListener("contextmenu", function (e) { + var menu = typeof _this63.table.options.rowContextMenu == "function" ? _this63.table.options.rowContextMenu(row.getComponent()) : _this63.table.options.rowContextMenu; + + _this63.loadMenu(e, row, menu); + }); + }; + + Menu.prototype.initializeGroup = function (group) { + var _this64 = this; + + group.getElement().addEventListener("contextmenu", function (e) { + var menu = typeof _this64.table.options.groupContextMenu == "function" ? _this64.table.options.groupContextMenu(group.getComponent()) : _this64.table.options.groupContextMenu; + + _this64.loadMenu(e, group, menu); + }); + }; + + Menu.prototype.loadMenu = function (e, component, menu) { + var _this65 = this; + + var docHeight = Math.max(document.body.offsetHeight, window.innerHeight); + + e.preventDefault(); + + //abort if no menu set + if (!menu || !menu.length) { + return; + } + + if (this.nestedMenuBlock) { + //abort if child menu already open + if (this.isOpen()) { + return; + } + } else { + this.nestedMenuBlock = setTimeout(function () { + _this65.nestedMenuBlock = false; + }, 100); + } + + this.hideMenu(); + + this.menuEl = document.createElement("div"); + this.menuEl.classList.add("tabulator-menu"); + + menu.forEach(function (item) { + var itemEl = document.createElement("div"); + var label = item.label; + var disabled = item.disabled; + + if (item.separator) { + itemEl.classList.add("tabulator-menu-separator"); + } else { + itemEl.classList.add("tabulator-menu-item"); + + if (typeof label == "function") { + label = label(component.getComponent()); + } + + if (label instanceof Node) { + itemEl.appendChild(label); + } else { + itemEl.innerHTML = label; + } + + if (typeof disabled == "function") { + disabled = disabled(component.getComponent()); + } + + if (disabled) { + itemEl.classList.add("tabulator-menu-item-disabled"); + itemEl.addEventListener("click", function (e) { + e.stopPropagation(); + }); + } else { + itemEl.addEventListener("click", function (e) { + _this65.hideMenu(); + item.action(e, component.getComponent()); + }); + } + } + + _this65.menuEl.appendChild(itemEl); + }); + + this.menuEl.style.top = e.pageY + "px"; + this.menuEl.style.left = e.pageX + "px"; + + document.body.addEventListener("click", this.blurEvent); + this.table.rowManager.element.addEventListener("scroll", this.blurEvent); + + setTimeout(function () { + document.body.addEventListener("contextmenu", _this65.blurEvent); + }, 100); + + document.body.addEventListener("keydown", this.escEvent); + + document.body.appendChild(this.menuEl); + + //move menu to start on right edge if it is too close to the edge of the screen + if (e.pageX + this.menuEl.offsetWidth >= document.body.offsetWidth) { + this.menuEl.style.left = ""; + this.menuEl.style.right = document.body.offsetWidth - e.pageX + "px"; + } + + //move menu to start on bottom edge if it is too close to the edge of the screen + if (e.pageY + this.menuEl.offsetHeight >= docHeight) { + this.menuEl.style.top = ""; + this.menuEl.style.bottom = docHeight - e.pageY + "px"; + } + }; + + Menu.prototype.isOpen = function () { + return !!this.menuEl.parentNode; + }; + + Menu.prototype.escMenu = function (e) { + if (e.keyCode == 27) { + this.hideMenu(); + } + }; + + Menu.prototype.hideMenu = function () { + if (this.menuEl.parentNode) { + this.menuEl.parentNode.removeChild(this.menuEl); + } + + if (this.escEvent) { + document.body.removeEventListener("keydown", this.escEvent); + } + + if (this.blurEvent) { + document.body.removeEventListener("click", this.blurEvent); + document.body.removeEventListener("contextmenu", this.blurEvent); + this.table.rowManager.element.removeEventListener("scroll", this.blurEvent); + } + }; + + //default accessors + Menu.prototype.menus = {}; + + Tabulator.prototype.registerModule("menu", Menu); + var MoveColumns = function MoveColumns(table) { + this.table = table; //hold Tabulator object + this.placeholderElement = this.createPlaceholderElement(); + this.hoverElement = false; //floating column header element + this.checkTimeout = false; //click check timeout holder + this.checkPeriod = 250; //period to wait on mousedown to consider this a move and not a click + this.moving = false; //currently moving column + this.toCol = false; //destination column + this.toColAfter = false; //position of moving column relative to the desitnation column + this.startX = 0; //starting position within header element + this.autoScrollMargin = 40; //auto scroll on edge when within margin + this.autoScrollStep = 5; //auto scroll distance in pixels + this.autoScrollTimeout = false; //auto scroll timeout + this.touchMove = false; + + this.moveHover = this.moveHover.bind(this); + this.endMove = this.endMove.bind(this); + }; + + MoveColumns.prototype.createPlaceholderElement = function () { + var el = document.createElement("div"); + + el.classList.add("tabulator-col"); + el.classList.add("tabulator-col-placeholder"); + + return el; + }; + + MoveColumns.prototype.initializeColumn = function (column) { + var self = this, + config = {}, + colEl; + + if (!column.modules.frozen) { + + colEl = column.getElement(); + + config.mousemove = function (e) { + if (column.parent === self.moving.parent) { + if ((self.touchMove ? e.touches[0].pageX : e.pageX) - Tabulator.prototype.helpers.elOffset(colEl).left + self.table.columnManager.element.scrollLeft > column.getWidth() / 2) { + if (self.toCol !== column || !self.toColAfter) { + colEl.parentNode.insertBefore(self.placeholderElement, colEl.nextSibling); + self.moveColumn(column, true); + } + } else { + if (self.toCol !== column || self.toColAfter) { + colEl.parentNode.insertBefore(self.placeholderElement, colEl); + self.moveColumn(column, false); + } + } + } + }.bind(self); + + colEl.addEventListener("mousedown", function (e) { + self.touchMove = false; + if (e.which === 1) { + self.checkTimeout = setTimeout(function () { + self.startMove(e, column); + }, self.checkPeriod); + } + }); + + colEl.addEventListener("mouseup", function (e) { + if (e.which === 1) { + if (self.checkTimeout) { + clearTimeout(self.checkTimeout); + } + } + }); + + self.bindTouchEvents(column); + } + + column.modules.moveColumn = config; + }; + + MoveColumns.prototype.bindTouchEvents = function (column) { + var self = this, + colEl = column.getElement(), + startXMove = false, + //shifting center position of the cell + dir = false, + currentCol, + nextCol, + prevCol, + nextColWidth, + prevColWidth, + nextColWidthLast, + prevColWidthLast; + + colEl.addEventListener("touchstart", function (e) { + self.checkTimeout = setTimeout(function () { + self.touchMove = true; + currentCol = column; + nextCol = column.nextColumn(); + nextColWidth = nextCol ? nextCol.getWidth() / 2 : 0; + prevCol = column.prevColumn(); + prevColWidth = prevCol ? prevCol.getWidth() / 2 : 0; + nextColWidthLast = 0; + prevColWidthLast = 0; + startXMove = false; + + self.startMove(e, column); + }, self.checkPeriod); + }, { passive: true }); + + colEl.addEventListener("touchmove", function (e) { + var halfCol, diff, moveToCol; + + if (self.moving) { + self.moveHover(e); + + if (!startXMove) { + startXMove = e.touches[0].pageX; + } + + diff = e.touches[0].pageX - startXMove; + + if (diff > 0) { + if (nextCol && diff - nextColWidthLast > nextColWidth) { + moveToCol = nextCol; + + if (moveToCol !== column) { + startXMove = e.touches[0].pageX; + moveToCol.getElement().parentNode.insertBefore(self.placeholderElement, moveToCol.getElement().nextSibling); + self.moveColumn(moveToCol, true); + } + } + } else { + if (prevCol && -diff - prevColWidthLast > prevColWidth) { + moveToCol = prevCol; + + if (moveToCol !== column) { + startXMove = e.touches[0].pageX; + moveToCol.getElement().parentNode.insertBefore(self.placeholderElement, moveToCol.getElement()); + self.moveColumn(moveToCol, false); + } + } + } + + if (moveToCol) { + currentCol = moveToCol; + nextCol = moveToCol.nextColumn(); + nextColWidthLast = nextColWidth; + nextColWidth = nextCol ? nextCol.getWidth() / 2 : 0; + prevCol = moveToCol.prevColumn(); + prevColWidthLast = prevColWidth; + prevColWidth = prevCol ? prevCol.getWidth() / 2 : 0; + } + } + }, { passive: true }); + + colEl.addEventListener("touchend", function (e) { + if (self.checkTimeout) { + clearTimeout(self.checkTimeout); + } + if (self.moving) { + self.endMove(e); + } + }); + }; + + MoveColumns.prototype.startMove = function (e, column) { + var element = column.getElement(); + + this.moving = column; + this.startX = (this.touchMove ? e.touches[0].pageX : e.pageX) - Tabulator.prototype.helpers.elOffset(element).left; + + this.table.element.classList.add("tabulator-block-select"); + + //create placeholder + this.placeholderElement.style.width = column.getWidth() + "px"; + this.placeholderElement.style.height = column.getHeight() + "px"; + + element.parentNode.insertBefore(this.placeholderElement, element); + element.parentNode.removeChild(element); + + //create hover element + this.hoverElement = element.cloneNode(true); + this.hoverElement.classList.add("tabulator-moving"); + + this.table.columnManager.getElement().appendChild(this.hoverElement); + + this.hoverElement.style.left = "0"; + this.hoverElement.style.bottom = "0"; + + if (!this.touchMove) { + this._bindMouseMove(); + + document.body.addEventListener("mousemove", this.moveHover); + document.body.addEventListener("mouseup", this.endMove); + } + + this.moveHover(e); + }; + + MoveColumns.prototype._bindMouseMove = function () { + this.table.columnManager.columnsByIndex.forEach(function (column) { + if (column.modules.moveColumn.mousemove) { + column.getElement().addEventListener("mousemove", column.modules.moveColumn.mousemove); + } + }); + }; + + MoveColumns.prototype._unbindMouseMove = function () { + this.table.columnManager.columnsByIndex.forEach(function (column) { + if (column.modules.moveColumn.mousemove) { + column.getElement().removeEventListener("mousemove", column.modules.moveColumn.mousemove); + } + }); + }; + + MoveColumns.prototype.moveColumn = function (column, after) { + var movingCells = this.moving.getCells(); + + this.toCol = column; + this.toColAfter = after; + + if (after) { + column.getCells().forEach(function (cell, i) { + var cellEl = cell.getElement(); + cellEl.parentNode.insertBefore(movingCells[i].getElement(), cellEl.nextSibling); + }); + } else { + column.getCells().forEach(function (cell, i) { + var cellEl = cell.getElement(); + cellEl.parentNode.insertBefore(movingCells[i].getElement(), cellEl); + }); + } + }; + + MoveColumns.prototype.endMove = function (e) { + if (e.which === 1 || this.touchMove) { + this._unbindMouseMove(); + + this.placeholderElement.parentNode.insertBefore(this.moving.getElement(), this.placeholderElement.nextSibling); + this.placeholderElement.parentNode.removeChild(this.placeholderElement); + this.hoverElement.parentNode.removeChild(this.hoverElement); + + this.table.element.classList.remove("tabulator-block-select"); + + if (this.toCol) { + this.table.columnManager.moveColumnActual(this.moving, this.toCol, this.toColAfter); + } + + this.moving = false; + this.toCol = false; + this.toColAfter = false; + + if (!this.touchMove) { + document.body.removeEventListener("mousemove", this.moveHover); + document.body.removeEventListener("mouseup", this.endMove); + } + } + }; + + MoveColumns.prototype.moveHover = function (e) { + var self = this, + columnHolder = self.table.columnManager.getElement(), + scrollLeft = columnHolder.scrollLeft, + xPos = (self.touchMove ? e.touches[0].pageX : e.pageX) - Tabulator.prototype.helpers.elOffset(columnHolder).left + scrollLeft, + scrollPos; + + self.hoverElement.style.left = xPos - self.startX + "px"; + + if (xPos - scrollLeft < self.autoScrollMargin) { + if (!self.autoScrollTimeout) { + self.autoScrollTimeout = setTimeout(function () { + scrollPos = Math.max(0, scrollLeft - 5); + self.table.rowManager.getElement().scrollLeft = scrollPos; + self.autoScrollTimeout = false; + }, 1); + } + } + + if (scrollLeft + columnHolder.clientWidth - xPos < self.autoScrollMargin) { + if (!self.autoScrollTimeout) { + self.autoScrollTimeout = setTimeout(function () { + scrollPos = Math.min(columnHolder.clientWidth, scrollLeft + 5); + self.table.rowManager.getElement().scrollLeft = scrollPos; + self.autoScrollTimeout = false; + }, 1); + } + } + }; + + Tabulator.prototype.registerModule("moveColumn", MoveColumns); + + var MoveRows = function MoveRows(table) { + + this.table = table; //hold Tabulator object + this.placeholderElement = this.createPlaceholderElement(); + this.hoverElement = false; //floating row header element + this.checkTimeout = false; //click check timeout holder + this.checkPeriod = 150; //period to wait on mousedown to consider this a move and not a click + this.moving = false; //currently moving row + this.toRow = false; //destination row + this.toRowAfter = false; //position of moving row relative to the desitnation row + this.hasHandle = false; //row has handle instead of fully movable row + this.startY = 0; //starting Y position within header element + this.startX = 0; //starting X position within header element + + this.moveHover = this.moveHover.bind(this); + this.endMove = this.endMove.bind(this); + this.tableRowDropEvent = false; + + this.touchMove = false; + + this.connection = false; + this.connectionSelectorsTables = false; + this.connectionSelectorsElements = false; + this.connectionElements = []; + this.connections = []; + + this.connectedTable = false; + this.connectedRow = false; + }; + + MoveRows.prototype.createPlaceholderElement = function () { + var el = document.createElement("div"); + + el.classList.add("tabulator-row"); + el.classList.add("tabulator-row-placeholder"); + + return el; + }; + + MoveRows.prototype.initialize = function (handle) { + this.connectionSelectorsTables = this.table.options.movableRowsConnectedTables; + this.connectionSelectorsElements = this.table.options.movableRowsConnectedElements; + + this.connection = this.connectionSelectorsTables || this.connectionSelectorsElements; + }; + + MoveRows.prototype.setHandle = function (handle) { + this.hasHandle = handle; + }; + + MoveRows.prototype.initializeGroupHeader = function (group) { + var self = this, + config = {}, + rowEl; + + //inter table drag drop + config.mouseup = function (e) { + self.tableRowDrop(e, row); + }.bind(self); + + //same table drag drop + config.mousemove = function (e) { + if (e.pageY - Tabulator.prototype.helpers.elOffset(group.element).top + self.table.rowManager.element.scrollTop > group.getHeight() / 2) { + if (self.toRow !== group || !self.toRowAfter) { + var rowEl = group.getElement(); + rowEl.parentNode.insertBefore(self.placeholderElement, rowEl.nextSibling); + self.moveRow(group, true); + } + } else { + if (self.toRow !== group || self.toRowAfter) { + var rowEl = group.getElement(); + if (rowEl.previousSibling) { + rowEl.parentNode.insertBefore(self.placeholderElement, rowEl); + self.moveRow(group, false); + } + } + } + }.bind(self); + + group.modules.moveRow = config; + }; + + MoveRows.prototype.initializeRow = function (row) { + var self = this, + config = {}, + rowEl; + + //inter table drag drop + config.mouseup = function (e) { + self.tableRowDrop(e, row); + }.bind(self); + + //same table drag drop + config.mousemove = function (e) { + if (e.pageY - Tabulator.prototype.helpers.elOffset(row.element).top + self.table.rowManager.element.scrollTop > row.getHeight() / 2) { + if (self.toRow !== row || !self.toRowAfter) { + var rowEl = row.getElement(); + rowEl.parentNode.insertBefore(self.placeholderElement, rowEl.nextSibling); + self.moveRow(row, true); + } + } else { + if (self.toRow !== row || self.toRowAfter) { + var rowEl = row.getElement(); + rowEl.parentNode.insertBefore(self.placeholderElement, rowEl); + self.moveRow(row, false); + } + } + }.bind(self); + + if (!this.hasHandle) { + + rowEl = row.getElement(); + + rowEl.addEventListener("mousedown", function (e) { + if (e.which === 1) { + self.checkTimeout = setTimeout(function () { + self.startMove(e, row); + }, self.checkPeriod); + } + }); + + rowEl.addEventListener("mouseup", function (e) { + if (e.which === 1) { + if (self.checkTimeout) { + clearTimeout(self.checkTimeout); + } + } + }); + + this.bindTouchEvents(row, row.getElement()); + } + + row.modules.moveRow = config; + }; + + MoveRows.prototype.initializeCell = function (cell) { + var self = this, + cellEl = cell.getElement(); + + cellEl.addEventListener("mousedown", function (e) { + if (e.which === 1) { + self.checkTimeout = setTimeout(function () { + self.startMove(e, cell.row); + }, self.checkPeriod); + } + }); + + cellEl.addEventListener("mouseup", function (e) { + if (e.which === 1) { + if (self.checkTimeout) { + clearTimeout(self.checkTimeout); + } + } + }); + + this.bindTouchEvents(cell.row, cell.getElement()); + }; + + MoveRows.prototype.bindTouchEvents = function (row, element) { + var self = this, + startYMove = false, + //shifting center position of the cell + dir = false, + currentRow, + nextRow, + prevRow, + nextRowHeight, + prevRowHeight, + nextRowHeightLast, + prevRowHeightLast; + + element.addEventListener("touchstart", function (e) { + self.checkTimeout = setTimeout(function () { + self.touchMove = true; + currentRow = row; + nextRow = row.nextRow(); + nextRowHeight = nextRow ? nextRow.getHeight() / 2 : 0; + prevRow = row.prevRow(); + prevRowHeight = prevRow ? prevRow.getHeight() / 2 : 0; + nextRowHeightLast = 0; + prevRowHeightLast = 0; + startYMove = false; + + self.startMove(e, row); + }, self.checkPeriod); + }, { passive: true }); + this.moving, this.toRow, this.toRowAfter; + element.addEventListener("touchmove", function (e) { + + var halfCol, diff, moveToRow; + + if (self.moving) { + e.preventDefault(); + + self.moveHover(e); + + if (!startYMove) { + startYMove = e.touches[0].pageY; + } + + diff = e.touches[0].pageY - startYMove; + + if (diff > 0) { + if (nextRow && diff - nextRowHeightLast > nextRowHeight) { + moveToRow = nextRow; + + if (moveToRow !== row) { + startYMove = e.touches[0].pageY; + moveToRow.getElement().parentNode.insertBefore(self.placeholderElement, moveToRow.getElement().nextSibling); + self.moveRow(moveToRow, true); + } + } + } else { + if (prevRow && -diff - prevRowHeightLast > prevRowHeight) { + moveToRow = prevRow; + + if (moveToRow !== row) { + startYMove = e.touches[0].pageY; + moveToRow.getElement().parentNode.insertBefore(self.placeholderElement, moveToRow.getElement()); + self.moveRow(moveToRow, false); + } + } + } + + if (moveToRow) { + currentRow = moveToRow; + nextRow = moveToRow.nextRow(); + nextRowHeightLast = nextRowHeight; + nextRowHeight = nextRow ? nextRow.getHeight() / 2 : 0; + prevRow = moveToRow.prevRow(); + prevRowHeightLast = prevRowHeight; + prevRowHeight = prevRow ? prevRow.getHeight() / 2 : 0; + } + } + }); + + element.addEventListener("touchend", function (e) { + if (self.checkTimeout) { + clearTimeout(self.checkTimeout); + } + if (self.moving) { + self.endMove(e); + self.touchMove = false; + } + }); + }; + + MoveRows.prototype._bindMouseMove = function () { + var self = this; + + self.table.rowManager.getDisplayRows().forEach(function (row) { + if ((row.type === "row" || row.type === "group") && row.modules.moveRow.mousemove) { + row.getElement().addEventListener("mousemove", row.modules.moveRow.mousemove); + } + }); + }; + + MoveRows.prototype._unbindMouseMove = function () { + var self = this; + + self.table.rowManager.getDisplayRows().forEach(function (row) { + if ((row.type === "row" || row.type === "group") && row.modules.moveRow.mousemove) { + row.getElement().removeEventListener("mousemove", row.modules.moveRow.mousemove); + } + }); + }; + + MoveRows.prototype.startMove = function (e, row) { + var element = row.getElement(); + + this.setStartPosition(e, row); + + this.moving = row; + + this.table.element.classList.add("tabulator-block-select"); + + //create placeholder + this.placeholderElement.style.width = row.getWidth() + "px"; + this.placeholderElement.style.height = row.getHeight() + "px"; + + if (!this.connection) { + element.parentNode.insertBefore(this.placeholderElement, element); + element.parentNode.removeChild(element); + } else { + this.table.element.classList.add("tabulator-movingrow-sending"); + this.connectToTables(row); + } + + //create hover element + this.hoverElement = element.cloneNode(true); + this.hoverElement.classList.add("tabulator-moving"); + + if (this.connection) { + document.body.appendChild(this.hoverElement); + this.hoverElement.style.left = "0"; + this.hoverElement.style.top = "0"; + this.hoverElement.style.width = this.table.element.clientWidth + "px"; + this.hoverElement.style.whiteSpace = "nowrap"; + this.hoverElement.style.overflow = "hidden"; + this.hoverElement.style.pointerEvents = "none"; + } else { + this.table.rowManager.getTableElement().appendChild(this.hoverElement); + + this.hoverElement.style.left = "0"; + this.hoverElement.style.top = "0"; + + this._bindMouseMove(); + } + + document.body.addEventListener("mousemove", this.moveHover); + document.body.addEventListener("mouseup", this.endMove); + + this.moveHover(e); + }; + + MoveRows.prototype.setStartPosition = function (e, row) { + var pageX = this.touchMove ? e.touches[0].pageX : e.pageX, + pageY = this.touchMove ? e.touches[0].pageY : e.pageY, + element, + position; + + element = row.getElement(); + if (this.connection) { + position = element.getBoundingClientRect(); + + this.startX = position.left - pageX + window.pageXOffset; + this.startY = position.top - pageY + window.pageYOffset; + } else { + this.startY = pageY - element.getBoundingClientRect().top; + } + }; + + MoveRows.prototype.endMove = function (e) { + if (!e || e.which === 1 || this.touchMove) { + this._unbindMouseMove(); + + if (!this.connection) { + this.placeholderElement.parentNode.insertBefore(this.moving.getElement(), this.placeholderElement.nextSibling); + this.placeholderElement.parentNode.removeChild(this.placeholderElement); + } + + this.hoverElement.parentNode.removeChild(this.hoverElement); + + this.table.element.classList.remove("tabulator-block-select"); + + if (this.toRow) { + this.table.rowManager.moveRow(this.moving, this.toRow, this.toRowAfter); + } + + this.moving = false; + this.toRow = false; + this.toRowAfter = false; + + document.body.removeEventListener("mousemove", this.moveHover); + document.body.removeEventListener("mouseup", this.endMove); + + if (this.connection) { + this.table.element.classList.remove("tabulator-movingrow-sending"); + this.disconnectFromTables(); + } + } + }; + + MoveRows.prototype.moveRow = function (row, after) { + this.toRow = row; + this.toRowAfter = after; + }; + + MoveRows.prototype.moveHover = function (e) { + if (this.connection) { + this.moveHoverConnections.call(this, e); + } else { + this.moveHoverTable.call(this, e); + } + }; + + MoveRows.prototype.moveHoverTable = function (e) { + var rowHolder = this.table.rowManager.getElement(), + scrollTop = rowHolder.scrollTop, + yPos = (this.touchMove ? e.touches[0].pageY : e.pageY) - rowHolder.getBoundingClientRect().top + scrollTop, + scrollPos; + + this.hoverElement.style.top = yPos - this.startY + "px"; + }; + + MoveRows.prototype.moveHoverConnections = function (e) { + this.hoverElement.style.left = this.startX + (this.touchMove ? e.touches[0].pageX : e.pageX) + "px"; + this.hoverElement.style.top = this.startY + (this.touchMove ? e.touches[0].pageY : e.pageY) + "px"; + }; + + MoveRows.prototype.elementRowDrop = function (e, element, row) { + if (this.table.options.movableRowsElementDrop) { + this.table.options.movableRowsElementDrop(e, element, row ? row.getComponent() : false); + } + }; + + //establish connection with other tables + MoveRows.prototype.connectToTables = function (row) { + var _this66 = this; + + var connectionTables; + + if (this.connectionSelectorsTables) { + connectionTables = this.table.modules.comms.getConnections(this.connectionSelectorsTables); + + this.table.options.movableRowsSendingStart.call(this.table, connectionTables); + + this.table.modules.comms.send(this.connectionSelectorsTables, "moveRow", "connect", { + row: row + }); + } + + if (this.connectionSelectorsElements) { + + this.connectionElements = []; + + if (!Array.isArray(this.connectionSelectorsElements)) { + this.connectionSelectorsElements = [this.connectionSelectorsElements]; + } + + this.connectionSelectorsElements.forEach(function (query) { + if (typeof query === "string") { + _this66.connectionElements = _this66.connectionElements.concat(Array.prototype.slice.call(document.querySelectorAll(query))); + } else { + _this66.connectionElements.push(query); + } + }); + + this.connectionElements.forEach(function (element) { + var dropEvent = function dropEvent(e) { + _this66.elementRowDrop(e, element, _this66.moving); + }; + + element.addEventListener("mouseup", dropEvent); + element.tabulatorElementDropEvent = dropEvent; + + element.classList.add("tabulator-movingrow-receiving"); + }); + } + }; + + //disconnect from other tables + MoveRows.prototype.disconnectFromTables = function () { + var connectionTables; + + if (this.connectionSelectorsTables) { + connectionTables = this.table.modules.comms.getConnections(this.connectionSelectorsTables); + + this.table.options.movableRowsSendingStop.call(this.table, connectionTables); + + this.table.modules.comms.send(this.connectionSelectorsTables, "moveRow", "disconnect"); + } + + this.connectionElements.forEach(function (element) { + element.classList.remove("tabulator-movingrow-receiving"); + element.removeEventListener("mouseup", element.tabulatorElementDropEvent); + delete element.tabulatorElementDropEvent; + }); + }; + + //accept incomming connection + MoveRows.prototype.connect = function (table, row) { + var self = this; + if (!this.connectedTable) { + this.connectedTable = table; + this.connectedRow = row; + + this.table.element.classList.add("tabulator-movingrow-receiving"); + + self.table.rowManager.getDisplayRows().forEach(function (row) { + if (row.type === "row" && row.modules.moveRow && row.modules.moveRow.mouseup) { + row.getElement().addEventListener("mouseup", row.modules.moveRow.mouseup); + } + }); + + self.tableRowDropEvent = self.tableRowDrop.bind(self); + + self.table.element.addEventListener("mouseup", self.tableRowDropEvent); + + this.table.options.movableRowsReceivingStart.call(this.table, row, table); + + return true; + } else { + console.warn("Move Row Error - Table cannot accept connection, already connected to table:", this.connectedTable); + return false; + } + }; + + //close incomming connection + MoveRows.prototype.disconnect = function (table) { + var self = this; + if (table === this.connectedTable) { + this.connectedTable = false; + this.connectedRow = false; + + this.table.element.classList.remove("tabulator-movingrow-receiving"); + + self.table.rowManager.getDisplayRows().forEach(function (row) { + if (row.type === "row" && row.modules.moveRow && row.modules.moveRow.mouseup) { + row.getElement().removeEventListener("mouseup", row.modules.moveRow.mouseup); + } + }); + + self.table.element.removeEventListener("mouseup", self.tableRowDropEvent); + + this.table.options.movableRowsReceivingStop.call(this.table, table); + } else { + console.warn("Move Row Error - trying to disconnect from non connected table"); + } + }; + + MoveRows.prototype.dropComplete = function (table, row, success) { + var sender = false; + + if (success) { + + switch (_typeof(this.table.options.movableRowsSender)) { + case "string": + sender = this.senders[this.table.options.movableRowsSender]; + break; + + case "function": + sender = this.table.options.movableRowsSender; + break; + } + + if (sender) { + sender.call(this, this.moving.getComponent(), row ? row.getComponent() : undefined, table); + } else { + if (this.table.options.movableRowsSender) { + console.warn("Mover Row Error - no matching sender found:", this.table.options.movableRowsSender); + } + } + + this.table.options.movableRowsSent.call(this.table, this.moving.getComponent(), row ? row.getComponent() : undefined, table); + } else { + this.table.options.movableRowsSentFailed.call(this.table, this.moving.getComponent(), row ? row.getComponent() : undefined, table); + } + + this.endMove(); + }; + + MoveRows.prototype.tableRowDrop = function (e, row) { + var receiver = false, + success = false; + + console.trace("drop"); + + e.stopImmediatePropagation(); + + switch (_typeof(this.table.options.movableRowsReceiver)) { + case "string": + receiver = this.receivers[this.table.options.movableRowsReceiver]; + break; + + case "function": + receiver = this.table.options.movableRowsReceiver; + break; + } + + if (receiver) { + success = receiver.call(this, this.connectedRow.getComponent(), row ? row.getComponent() : undefined, this.connectedTable); + } else { + console.warn("Mover Row Error - no matching receiver found:", this.table.options.movableRowsReceiver); + } + + if (success) { + this.table.options.movableRowsReceived.call(this.table, this.connectedRow.getComponent(), row ? row.getComponent() : undefined, this.connectedTable); + } else { + this.table.options.movableRowsReceivedFailed.call(this.table, this.connectedRow.getComponent(), row ? row.getComponent() : undefined, this.connectedTable); + } + + this.table.modules.comms.send(this.connectedTable, "moveRow", "dropcomplete", { + row: row, + success: success + }); + }; + + MoveRows.prototype.receivers = { + insert: function insert(fromRow, toRow, fromTable) { + this.table.addRow(fromRow.getData(), undefined, toRow); + return true; + }, + + add: function add(fromRow, toRow, fromTable) { + this.table.addRow(fromRow.getData()); + return true; + }, + + update: function update(fromRow, toRow, fromTable) { + if (toRow) { + toRow.update(fromRow.getData()); + return true; + } + + return false; + }, + + replace: function replace(fromRow, toRow, fromTable) { + if (toRow) { + this.table.addRow(fromRow.getData(), undefined, toRow); + toRow.delete(); + return true; + } + + return false; + } + }; + + MoveRows.prototype.senders = { + delete: function _delete(fromRow, toRow, toTable) { + fromRow.delete(); + } + }; + + MoveRows.prototype.commsReceived = function (table, action, data) { + switch (action) { + case "connect": + return this.connect(table, data.row); + break; + + case "disconnect": + return this.disconnect(table); + break; + + case "dropcomplete": + return this.dropComplete(table, data.row, data.success); + break; + } + }; + + Tabulator.prototype.registerModule("moveRow", MoveRows); + var Mutator = function Mutator(table) { + this.table = table; //hold Tabulator object + this.allowedTypes = ["", "data", "edit", "clipboard"]; //list of muatation types + this.enabled = true; + }; + + //initialize column mutator + Mutator.prototype.initializeColumn = function (column) { + var self = this, + match = false, + config = {}; + + this.allowedTypes.forEach(function (type) { + var key = "mutator" + (type.charAt(0).toUpperCase() + type.slice(1)), + mutator; + + if (column.definition[key]) { + mutator = self.lookupMutator(column.definition[key]); + + if (mutator) { + match = true; + + config[key] = { + mutator: mutator, + params: column.definition[key + "Params"] || {} + }; + } + } + }); + + if (match) { + column.modules.mutate = config; + } + }; + + Mutator.prototype.lookupMutator = function (value) { + var mutator = false; + + //set column mutator + switch (typeof value === 'undefined' ? 'undefined' : _typeof(value)) { + case "string": + if (this.mutators[value]) { + mutator = this.mutators[value]; + } else { + console.warn("Mutator Error - No such mutator found, ignoring: ", value); + } + break; + + case "function": + mutator = value; + break; + } + + return mutator; + }; + + //apply mutator to row + Mutator.prototype.transformRow = function (data, type, updatedData) { + var self = this, + key = "mutator" + (type.charAt(0).toUpperCase() + type.slice(1)), + value; + + if (this.enabled) { + + self.table.columnManager.traverse(function (column) { + var mutator, params, component; + + if (column.modules.mutate) { + mutator = column.modules.mutate[key] || column.modules.mutate.mutator || false; + + if (mutator) { + value = column.getFieldValue(typeof updatedData !== "undefined" ? updatedData : data); + + if (type == "data" || typeof value !== "undefined") { + component = column.getComponent(); + params = typeof mutator.params === "function" ? mutator.params(value, data, type, component) : mutator.params; + column.setFieldValue(data, mutator.mutator(value, data, type, params, component)); + } + } + } + }); + } + + return data; + }; + + //apply mutator to new cell value + Mutator.prototype.transformCell = function (cell, value) { + var mutator = cell.column.modules.mutate.mutatorEdit || cell.column.modules.mutate.mutator || false, + tempData = {}; + + if (mutator) { + tempData = Object.assign(tempData, cell.row.getData()); + cell.column.setFieldValue(tempData, value); + return mutator.mutator(value, tempData, "edit", mutator.params, cell.getComponent()); + } else { + return value; + } + }; + + Mutator.prototype.enable = function () { + this.enabled = true; + }; + + Mutator.prototype.disable = function () { + this.enabled = false; + }; + + //default mutators + Mutator.prototype.mutators = {}; + + Tabulator.prototype.registerModule("mutator", Mutator); + var Page = function Page(table) { + + this.table = table; //hold Tabulator object + + this.mode = "local"; + this.progressiveLoad = false; + + this.size = 0; + this.page = 1; + this.count = 5; + this.max = 1; + + this.displayIndex = 0; //index in display pipeline + + this.initialLoad = true; + + this.pageSizes = []; + + this.dataReceivedNames = {}; + this.dataSentNames = {}; + + this.createElements(); + }; + + Page.prototype.createElements = function () { + + var button; + + this.element = document.createElement("span"); + this.element.classList.add("tabulator-paginator"); + + this.pagesElement = document.createElement("span"); + this.pagesElement.classList.add("tabulator-pages"); + + button = document.createElement("button"); + button.classList.add("tabulator-page"); + button.setAttribute("type", "button"); + button.setAttribute("role", "button"); + button.setAttribute("aria-label", ""); + button.setAttribute("title", ""); + + this.firstBut = button.cloneNode(true); + this.firstBut.setAttribute("data-page", "first"); + + this.prevBut = button.cloneNode(true); + this.prevBut.setAttribute("data-page", "prev"); + + this.nextBut = button.cloneNode(true); + this.nextBut.setAttribute("data-page", "next"); + + this.lastBut = button.cloneNode(true); + this.lastBut.setAttribute("data-page", "last"); + + if (this.table.options.paginationSizeSelector) { + this.pageSizeSelect = document.createElement("select"); + this.pageSizeSelect.classList.add("tabulator-page-size"); + } + }; + + Page.prototype.generatePageSizeSelectList = function () { + var _this67 = this; + + var pageSizes = []; + + if (this.pageSizeSelect) { + + if (Array.isArray(this.table.options.paginationSizeSelector)) { + pageSizes = this.table.options.paginationSizeSelector; + this.pageSizes = pageSizes; + + if (this.pageSizes.indexOf(this.size) == -1) { + pageSizes.unshift(this.size); + } + } else { + + if (this.pageSizes.indexOf(this.size) == -1) { + pageSizes = []; + + for (var _i9 = 1; _i9 < 5; _i9++) { + pageSizes.push(this.size * _i9); + } + + this.pageSizes = pageSizes; + } else { + pageSizes = this.pageSizes; + } + } + + while (this.pageSizeSelect.firstChild) { + this.pageSizeSelect.removeChild(this.pageSizeSelect.firstChild); + }pageSizes.forEach(function (item) { + var itemEl = document.createElement("option"); + itemEl.value = item; + + if (item === true) { + _this67.table.modules.localize.bind("pagination|all", function (value) { + itemEl.innerHTML = value; + }); + } else { + itemEl.innerHTML = item; + } + + _this67.pageSizeSelect.appendChild(itemEl); + }); + + this.pageSizeSelect.value = this.size; + } + }; + + //setup pageination + Page.prototype.initialize = function (hidden) { + var self = this, + pageSelectLabel, + testElRow, + testElCell; + + //update param names + this.dataSentNames = Object.assign({}, this.paginationDataSentNames); + this.dataSentNames = Object.assign(this.dataSentNames, this.table.options.paginationDataSent); + + this.dataReceivedNames = Object.assign({}, this.paginationDataReceivedNames); + this.dataReceivedNames = Object.assign(this.dataReceivedNames, this.table.options.paginationDataReceived); + + //build pagination element + + //bind localizations + self.table.modules.localize.bind("pagination|first", function (value) { + self.firstBut.innerHTML = value; + }); + + self.table.modules.localize.bind("pagination|first_title", function (value) { + self.firstBut.setAttribute("aria-label", value); + self.firstBut.setAttribute("title", value); + }); + + self.table.modules.localize.bind("pagination|prev", function (value) { + self.prevBut.innerHTML = value; + }); + + self.table.modules.localize.bind("pagination|prev_title", function (value) { + self.prevBut.setAttribute("aria-label", value); + self.prevBut.setAttribute("title", value); + }); + + self.table.modules.localize.bind("pagination|next", function (value) { + self.nextBut.innerHTML = value; + }); + + self.table.modules.localize.bind("pagination|next_title", function (value) { + self.nextBut.setAttribute("aria-label", value); + self.nextBut.setAttribute("title", value); + }); + + self.table.modules.localize.bind("pagination|last", function (value) { + self.lastBut.innerHTML = value; + }); + + self.table.modules.localize.bind("pagination|last_title", function (value) { + self.lastBut.setAttribute("aria-label", value); + self.lastBut.setAttribute("title", value); + }); + + //click bindings + self.firstBut.addEventListener("click", function () { + self.setPage(1); + }); + + self.prevBut.addEventListener("click", function () { + self.previousPage(); + }); + + self.nextBut.addEventListener("click", function () { + self.nextPage().then(function () {}).catch(function () {}); + }); + + self.lastBut.addEventListener("click", function () { + self.setPage(self.max); + }); + + if (self.table.options.paginationElement) { + self.element = self.table.options.paginationElement; + } + + if (this.pageSizeSelect) { + pageSelectLabel = document.createElement("label"); + + self.table.modules.localize.bind("pagination|page_size", function (value) { + self.pageSizeSelect.setAttribute("aria-label", value); + self.pageSizeSelect.setAttribute("title", value); + pageSelectLabel.innerHTML = value; + }); + + self.element.appendChild(pageSelectLabel); + self.element.appendChild(self.pageSizeSelect); + + self.pageSizeSelect.addEventListener("change", function (e) { + self.setPageSize(self.pageSizeSelect.value == "true" ? true : self.pageSizeSelect.value); + self.setPage(1).then(function () {}).catch(function () {}); + }); + } + + //append to DOM + self.element.appendChild(self.firstBut); + self.element.appendChild(self.prevBut); + self.element.appendChild(self.pagesElement); + self.element.appendChild(self.nextBut); + self.element.appendChild(self.lastBut); + + if (!self.table.options.paginationElement && !hidden) { + self.table.footerManager.append(self.element, self); + } + + //set default values + self.mode = self.table.options.pagination; + + if (self.table.options.paginationSize) { + self.size = self.table.options.paginationSize; + } else { + testElRow = document.createElement("div"); + testElRow.classList.add("tabulator-row"); + testElRow.style.visibility = hidden; + + testElCell = document.createElement("div"); + testElCell.classList.add("tabulator-cell"); + testElCell.innerHTML = "Page Row Test"; + + testElRow.appendChild(testElCell); + + self.table.rowManager.getTableElement().appendChild(testElRow); + + self.size = Math.floor(self.table.rowManager.getElement().clientHeight / testElRow.offsetHeight); + + self.table.rowManager.getTableElement().removeChild(testElRow); + } + + // self.page = self.table.options.paginationInitialPage || 1; + self.count = self.table.options.paginationButtonCount; + + self.generatePageSizeSelectList(); + }; + + Page.prototype.initializeProgressive = function (mode) { + this.initialize(true); + this.mode = "progressive_" + mode; + this.progressiveLoad = true; + }; + + Page.prototype.setDisplayIndex = function (index) { + this.displayIndex = index; + }; + + Page.prototype.getDisplayIndex = function () { + return this.displayIndex; + }; + + //calculate maximum page from number of rows + Page.prototype.setMaxRows = function (rowCount) { + if (!rowCount) { + this.max = 1; + } else { + this.max = this.size === true ? 1 : Math.ceil(rowCount / this.size); + } + + if (this.page > this.max) { + this.page = this.max; + } + }; + + //reset to first page without triggering action + Page.prototype.reset = function (force, columnsChanged) { + if (this.mode == "local" || force) { + this.page = 1; + } + + if (columnsChanged) { + this.initialLoad = true; + } + + return true; + }; + + //set the maxmum page + Page.prototype.setMaxPage = function (max) { + + max = parseInt(max); + + this.max = max || 1; + + if (this.page > this.max) { + this.page = this.max; + this.trigger(); + } + }; + + //set current page number + Page.prototype.setPage = function (page) { + var _this68 = this; + + var self = this; + + switch (page) { + case "first": + return this.setPage(1); + break; + + case "prev": + return this.previousPage(); + break; + + case "next": + return this.nextPage(); + break; + + case "last": + return this.setPage(this.max); + break; + } + + return new Promise(function (resolve, reject) { + + page = parseInt(page); + + if (page > 0 && page <= _this68.max) { + _this68.page = page; + _this68.trigger().then(function () { + resolve(); + }).catch(function () { + reject(); + }); + + if (self.table.options.persistence && self.table.modExists("persistence", true) && self.table.modules.persistence.config.page) { + self.table.modules.persistence.save("page"); + } + } else { + console.warn("Pagination Error - Requested page is out of range of 1 - " + _this68.max + ":", page); + reject(); + } + }); + }; + + Page.prototype.setPageToRow = function (row) { + var _this69 = this; + + return new Promise(function (resolve, reject) { + + var rows = _this69.table.rowManager.getDisplayRows(_this69.displayIndex - 1); + var index = rows.indexOf(row); + + if (index > -1) { + var page = _this69.size === true ? 1 : Math.ceil((index + 1) / _this69.size); + + _this69.setPage(page).then(function () { + resolve(); + }).catch(function () { + reject(); + }); + } else { + console.warn("Pagination Error - Requested row is not visible"); + reject(); + } + }); + }; + + Page.prototype.setPageSize = function (size) { + if (size !== true) { + size = parseInt(size); + } + + if (size > 0) { + this.size = size; + } + + if (this.pageSizeSelect) { + // this.pageSizeSelect.value = size; + this.generatePageSizeSelectList(); + } + + if (this.table.options.persistence && this.table.modExists("persistence", true) && this.table.modules.persistence.config.page) { + this.table.modules.persistence.save("page"); + } + }; + + //setup the pagination buttons + Page.prototype._setPageButtons = function () { + var self = this; + + var leftSize = Math.floor((this.count - 1) / 2); + var rightSize = Math.ceil((this.count - 1) / 2); + var min = this.max - this.page + leftSize + 1 < this.count ? this.max - this.count + 1 : Math.max(this.page - leftSize, 1); + var max = this.page <= rightSize ? Math.min(this.count, this.max) : Math.min(this.page + rightSize, this.max); + + while (self.pagesElement.firstChild) { + self.pagesElement.removeChild(self.pagesElement.firstChild); + }if (self.page == 1) { + self.firstBut.disabled = true; + self.prevBut.disabled = true; + } else { + self.firstBut.disabled = false; + self.prevBut.disabled = false; + } + + if (self.page == self.max) { + self.lastBut.disabled = true; + self.nextBut.disabled = true; + } else { + self.lastBut.disabled = false; + self.nextBut.disabled = false; + } + + for (var _i10 = min; _i10 <= max; _i10++) { + if (_i10 > 0 && _i10 <= self.max) { + self.pagesElement.appendChild(self._generatePageButton(_i10)); + } + } + + this.footerRedraw(); + }; + + Page.prototype._generatePageButton = function (page) { + var self = this, + button = document.createElement("button"); + + button.classList.add("tabulator-page"); + if (page == self.page) { + button.classList.add("active"); + } + + button.setAttribute("type", "button"); + button.setAttribute("role", "button"); + + self.table.modules.localize.bind("pagination|page_title", function (value) { + button.setAttribute("aria-label", value + " " + page); + button.setAttribute("title", value + " " + page); + }); + + button.setAttribute("data-page", page); + button.textContent = page; + + button.addEventListener("click", function (e) { + self.setPage(page); + }); + + return button; + }; + + //previous page + Page.prototype.previousPage = function () { + var _this70 = this; + + return new Promise(function (resolve, reject) { + if (_this70.page > 1) { + _this70.page--; + _this70.trigger().then(function () { + resolve(); + }).catch(function () { + reject(); + }); + + if (_this70.table.options.persistence && _this70.table.modExists("persistence", true) && _this70.table.modules.persistence.config.page) { + _this70.table.modules.persistence.save("page"); + } + } else { + console.warn("Pagination Error - Previous page would be less than page 1:", 0); + reject(); + } + }); + }; + + //next page + Page.prototype.nextPage = function () { + var _this71 = this; + + return new Promise(function (resolve, reject) { + if (_this71.page < _this71.max) { + _this71.page++; + _this71.trigger().then(function () { + resolve(); + }).catch(function () { + reject(); + }); + + if (_this71.table.options.persistence && _this71.table.modExists("persistence", true) && _this71.table.modules.persistence.config.page) { + _this71.table.modules.persistence.save("page"); + } + } else { + if (!_this71.progressiveLoad) { + console.warn("Pagination Error - Next page would be greater than maximum page of " + _this71.max + ":", _this71.max + 1); + } + reject(); + } + }); + }; + + //return current page number + Page.prototype.getPage = function () { + return this.page; + }; + + //return max page number + Page.prototype.getPageMax = function () { + return this.max; + }; + + Page.prototype.getPageSize = function (size) { + return this.size; + }; + + Page.prototype.getMode = function () { + return this.mode; + }; + + //return appropriate rows for current page + Page.prototype.getRows = function (data) { + var output, start, end; + + if (this.mode == "local") { + output = []; + + if (this.size === true) { + start = 0; + end = data.length - 1; + } else { + start = this.size * (this.page - 1); + end = start + parseInt(this.size); + } + + this._setPageButtons(); + + for (var _i11 = start; _i11 < end; _i11++) { + if (data[_i11]) { + output.push(data[_i11]); + } + } + + return output; + } else { + + this._setPageButtons(); + + return data.slice(0); + } + }; + + Page.prototype.trigger = function () { + var _this72 = this; + + var left; + + return new Promise(function (resolve, reject) { + + switch (_this72.mode) { + case "local": + left = _this72.table.rowManager.scrollLeft; + + _this72.table.rowManager.refreshActiveData("page"); + _this72.table.rowManager.scrollHorizontal(left); + + _this72.table.options.pageLoaded.call(_this72.table, _this72.getPage()); + resolve(); + break; + + case "remote": + case "progressive_load": + case "progressive_scroll": + _this72.table.modules.ajax.blockActiveRequest(); + _this72._getRemotePage().then(function () { + resolve(); + }).catch(function () { + reject(); + }); + break; + + default: + console.warn("Pagination Error - no such pagination mode:", _this72.mode); + reject(); + } + }); + }; + + Page.prototype._getRemotePage = function () { + var _this73 = this; + + var self = this, + oldParams, + pageParams; + + return new Promise(function (resolve, reject) { + + if (!self.table.modExists("ajax", true)) { + reject(); + } + + //record old params and restore after request has been made + oldParams = Tabulator.prototype.helpers.deepClone(self.table.modules.ajax.getParams() || {}); + pageParams = self.table.modules.ajax.getParams(); + + //configure request params + pageParams[_this73.dataSentNames.page] = self.page; + + //set page size if defined + if (_this73.size) { + pageParams[_this73.dataSentNames.size] = _this73.size; + } + + //set sort data if defined + if (_this73.table.options.ajaxSorting && _this73.table.modExists("sort")) { + var sorters = self.table.modules.sort.getSort(); + + sorters.forEach(function (item) { + delete item.column; + }); + + pageParams[_this73.dataSentNames.sorters] = sorters; + } + + //set filter data if defined + if (_this73.table.options.ajaxFiltering && _this73.table.modExists("filter")) { + var filters = self.table.modules.filter.getFilters(true, true); + pageParams[_this73.dataSentNames.filters] = filters; + } + + self.table.modules.ajax.setParams(pageParams); + + self.table.modules.ajax.sendRequest(_this73.progressiveLoad).then(function (data) { + self._parseRemoteData(data); + resolve(); + }).catch(function (e) { + reject(); + }); + + self.table.modules.ajax.setParams(oldParams); + }); + }; + + Page.prototype._parseRemoteData = function (data) { + var self = this, + left, + data, + margin; + + if (typeof data[this.dataReceivedNames.last_page] === "undefined") { + console.warn("Remote Pagination Error - Server response missing '" + this.dataReceivedNames.last_page + "' property"); + } + + if (data[this.dataReceivedNames.data]) { + this.max = parseInt(data[this.dataReceivedNames.last_page]) || 1; + + if (this.progressiveLoad) { + switch (this.mode) { + case "progressive_load": + + if (this.page == 1) { + this.table.rowManager.setData(data[this.dataReceivedNames.data], false, this.initialLoad && this.page == 1); + } else { + this.table.rowManager.addRows(data[this.dataReceivedNames.data]); + } + + if (this.page < this.max) { + setTimeout(function () { + self.nextPage().then(function () {}).catch(function () {}); + }, self.table.options.ajaxProgressiveLoadDelay); + } + break; + + case "progressive_scroll": + data = this.table.rowManager.getData().concat(data[this.dataReceivedNames.data]); + + this.table.rowManager.setData(data, true, this.initialLoad && this.page == 1); + + margin = this.table.options.ajaxProgressiveLoadScrollMargin || this.table.rowManager.element.clientHeight * 2; + + if (self.table.rowManager.element.scrollHeight <= self.table.rowManager.element.clientHeight + margin) { + self.nextPage().then(function () {}).catch(function () {}); + } + break; + } + } else { + left = this.table.rowManager.scrollLeft; + + this.table.rowManager.setData(data[this.dataReceivedNames.data], false, this.initialLoad && this.page == 1); + + this.table.rowManager.scrollHorizontal(left); + + this.table.columnManager.scrollHorizontal(left); + + this.table.options.pageLoaded.call(this.table, this.getPage()); + } + + this.initialLoad = false; + } else { + console.warn("Remote Pagination Error - Server response missing '" + this.dataReceivedNames.data + "' property"); + } + }; + + //handle the footer element being redrawn + Page.prototype.footerRedraw = function () { + var footer = this.table.footerManager.element; + + if (Math.ceil(footer.clientWidth) - footer.scrollWidth < 0) { + this.pagesElement.style.display = 'none'; + } else { + this.pagesElement.style.display = ''; + + if (Math.ceil(footer.clientWidth) - footer.scrollWidth < 0) { + this.pagesElement.style.display = 'none'; + } + } + }; + + //set the paramter names for pagination requests + Page.prototype.paginationDataSentNames = { + "page": "page", + "size": "size", + "sorters": "sorters", + // "sort_dir":"sort_dir", + "filters": "filters" + // "filter_value":"filter_value", + // "filter_type":"filter_type", + }; + + //set the property names for pagination responses + Page.prototype.paginationDataReceivedNames = { + "current_page": "current_page", + "last_page": "last_page", + "data": "data" + }; + + Tabulator.prototype.registerModule("page", Page); + + var Persistence = function Persistence(table) { + this.table = table; //hold Tabulator object + this.mode = ""; + this.id = ""; + // this.persistProps = ["field", "width", "visible"]; + this.defWatcherBlock = false; + this.config = {}; + this.readFunc = false; + this.writeFunc = false; + }; + + // Test for whether localStorage is available for use. + Persistence.prototype.localStorageTest = function () { + var testKey = "_tabulator_test"; + + try { + window.localStorage.setItem(testKey, testKey); + window.localStorage.removeItem(testKey); + return true; + } catch (e) { + return false; + } + }; + + //setup parameters + Persistence.prototype.initialize = function () { + //determine persistent layout storage type + + var mode = this.table.options.persistenceMode, + id = this.table.options.persistenceID, + retreivedData; + + this.mode = mode !== true ? mode : this.localStorageTest() ? "local" : "cookie"; + + if (this.table.options.persistenceReaderFunc) { + if (typeof this.table.options.persistenceReaderFunc === "function") { + this.readFunc = this.table.options.persistenceReaderFunc; + } else { + if (this.readers[this.table.options.persistenceReaderFunc]) { + this.readFunc = this.readers[this.table.options.persistenceReaderFunc]; + } else { + console.warn("Persistence Read Error - invalid reader set", this.table.options.persistenceReaderFunc); + } + } + } else { + if (this.readers[this.mode]) { + this.readFunc = this.readers[this.mode]; + } else { + console.warn("Persistence Read Error - invalid reader set", this.mode); + } + } + + if (this.table.options.persistenceWriterFunc) { + if (typeof this.table.options.persistenceWriterFunc === "function") { + this.writeFunc = this.table.options.persistenceWriterFunc; + } else { + if (this.readers[this.table.options.persistenceWriterFunc]) { + this.writeFunc = this.readers[this.table.options.persistenceWriterFunc]; + } else { + console.warn("Persistence Write Error - invalid reader set", this.table.options.persistenceWriterFunc); + } + } + } else { + if (this.writers[this.mode]) { + this.writeFunc = this.writers[this.mode]; + } else { + console.warn("Persistence Write Error - invalid writer set", this.mode); + } + } + + //set storage tag + this.id = "tabulator-" + (id || this.table.element.getAttribute("id") || ""); + + this.config = { + sort: this.table.options.persistence === true || this.table.options.persistence.sort, + filter: this.table.options.persistence === true || this.table.options.persistence.filter, + group: this.table.options.persistence === true || this.table.options.persistence.group, + page: this.table.options.persistence === true || this.table.options.persistence.page, + columns: this.table.options.persistence === true ? ["title", "width", "visible"] : this.table.options.persistence.columns + }; + + //load pagination data if needed + if (this.config.page) { + retreivedData = this.retreiveData("page"); + + if (retreivedData) { + if (typeof retreivedData.paginationSize !== "undefined" && (this.config.page === true || this.config.page.size)) { + this.table.options.paginationSize = retreivedData.paginationSize; + } + + if (typeof retreivedData.paginationInitialPage !== "undefined" && (this.config.page === true || this.config.page.page)) { + this.table.options.paginationInitialPage = retreivedData.paginationInitialPage; + } + } + } + + //load group data if needed + if (this.config.group) { + retreivedData = this.retreiveData("group"); + + if (retreivedData) { + if (typeof retreivedData.groupBy !== "undefined" && (this.config.group === true || this.config.group.groupBy)) { + this.table.options.groupBy = retreivedData.groupBy; + } + if (typeof retreivedData.groupStartOpen !== "undefined" && (this.config.group === true || this.config.group.groupStartOpen)) { + this.table.options.groupStartOpen = retreivedData.groupStartOpen; + } + if (typeof retreivedData.groupHeader !== "undefined" && (this.config.group === true || this.config.group.groupHeader)) { + this.table.options.groupHeader = retreivedData.groupHeader; + } + } + } + }; + + Persistence.prototype.initializeColumn = function (column) { + var self = this, + def, + keys; + + if (this.config.columns) { + this.defWatcherBlock = true; + + def = column.getDefinition(); + + keys = this.config.columns === true ? Object.keys(def) : this.config.columns; + + keys.forEach(function (key) { + var props = Object.getOwnPropertyDescriptor(def, key); + var value = def[key]; + if (props) { + Object.defineProperty(def, key, { + set: function set(newValue) { + value = newValue; + + if (!self.defWatcherBlock) { + self.save("columns"); + } + + if (props.set) { + props.set(newValue); + } + }, + get: function get() { + if (props.get) { + props.get(); + } + return value; + } + }); + } + }); + + this.defWatcherBlock = false; + } + }; + + //load saved definitions + Persistence.prototype.load = function (type, current) { + var data = this.retreiveData(type); + + if (current) { + data = data ? this.mergeDefinition(current, data) : current; + } + + return data; + }; + + //retreive data from memory + Persistence.prototype.retreiveData = function (type) { + return this.readFunc ? this.readFunc(this.id, type) : false; + }; + + //merge old and new column definitions + Persistence.prototype.mergeDefinition = function (oldCols, newCols) { + var self = this, + output = []; + + // oldCols = oldCols || []; + newCols = newCols || []; + + newCols.forEach(function (column, to) { + + var from = self._findColumn(oldCols, column), + keys; + + if (from) { + + if (self.config.columns === true || self.config.columns == undefined) { + keys = Object.keys(from); + keys.push("width"); + } else { + keys = self.config.columns; + } + + keys.forEach(function (key) { + if (typeof column[key] !== "undefined") { + from[key] = column[key]; + } + }); + + if (from.columns) { + from.columns = self.mergeDefinition(from.columns, column.columns); + } + + output.push(from); + } + }); + + oldCols.forEach(function (column, i) { + var from = self._findColumn(newCols, column); + if (!from) { + if (output.length > i) { + output.splice(i, 0, column); + } else { + output.push(column); + } + } + }); + + return output; + }; + + //find matching columns + Persistence.prototype._findColumn = function (columns, subject) { + var type = subject.columns ? "group" : subject.field ? "field" : "object"; + + return columns.find(function (col) { + switch (type) { + case "group": + return col.title === subject.title && col.columns.length === subject.columns.length; + break; + + case "field": + return col.field === subject.field; + break; + + case "object": + return col === subject; + break; + } + }); + }; + + //save data + Persistence.prototype.save = function (type) { + var data = {}; + + switch (type) { + case "columns": + data = this.parseColumns(this.table.columnManager.getColumns()); + break; + + case "filter": + data = this.table.modules.filter.getFilters(); + break; + + case "sort": + data = this.validateSorters(this.table.modules.sort.getSort()); + break; + + case "group": + data = this.getGroupConfig(); + break; + + case "page": + data = this.getPageConfig(); + break; + } + + if (this.writeFunc) { + this.writeFunc(this.id, type, data); + } + }; + + //ensure sorters contain no function data + Persistence.prototype.validateSorters = function (data) { + data.forEach(function (item) { + item.column = item.field; + delete item.field; + }); + + return data; + }; + + Persistence.prototype.getGroupConfig = function () { + if (this.config.group) { + if (this.config.group === true || this.config.group.groupBy) { + data.groupBy = this.table.options.groupBy; + } + + if (this.config.group === true || this.config.group.groupStartOpen) { + data.groupStartOpen = this.table.options.groupStartOpen; + } + + if (this.config.group === true || this.config.group.groupHeader) { + data.groupHeader = this.table.options.groupHeader; + } + } + + return data; + }; + + Persistence.prototype.getPageConfig = function () { + var data = {}; + + if (this.config.page) { + if (this.config.page === true || this.config.page.size) { + data.paginationSize = this.table.modules.page.getPageSize(); + } + + if (this.config.page === true || this.config.page.page) { + data.paginationInitialPage = this.table.modules.page.getPage(); + } + } + + return data; + }; + + //parse columns for data to store + Persistence.prototype.parseColumns = function (columns) { + var self = this, + definitions = []; + + columns.forEach(function (column) { + var defStore = {}, + colDef = column.getDefinition(), + keys; + + if (column.isGroup) { + defStore.title = colDef.title; + defStore.columns = self.parseColumns(column.getColumns()); + } else { + defStore.field = column.getField(); + + if (self.config.columns === true || self.config.columns == undefined) { + keys = Object.keys(colDef); + keys.push("width"); + } else { + keys = self.config.columns; + } + + keys.forEach(function (key) { + + switch (key) { + case "width": + defStore.width = column.getWidth(); + break; + case "visible": + defStore.visible = column.visible; + break; + + default: + defStore[key] = colDef[key]; + } + }); + } + + definitions.push(defStore); + }); + + return definitions; + }; + + // read peristence information from storage + Persistence.prototype.readers = { + local: function local(id, type) { + var data = localStorage.getItem(id + "-" + type); + + return data ? JSON.parse(data) : false; + }, + cookie: function cookie(id, type) { + var cookie = document.cookie, + key = id + "-" + type, + cookiePos = cookie.indexOf(key + "="), + end, + data; + + //if cookie exists, decode and load column data into tabulator + if (cookiePos > -1) { + cookie = cookie.substr(cookiePos); + + end = cookie.indexOf(";"); + + if (end > -1) { + cookie = cookie.substr(0, end); + } + + data = cookie.replace(key + "=", ""); + } + + return data ? JSON.parse(data) : false; + } + }; + + //write persistence information to storage + Persistence.prototype.writers = { + local: function local(id, type, data) { + localStorage.setItem(id + "-" + type, JSON.stringify(data)); + }, + cookie: function cookie(id, type, data) { + var expireDate = new Date(); + + expireDate.setDate(expireDate.getDate() + 10000); + + document.cookie = id + "-" + type + "=" + JSON.stringify(data) + "; expires=" + expireDate.toUTCString(); + } + }; + + Tabulator.prototype.registerModule("persistence", Persistence); + + var Print = function Print(table) { + this.table = table; //hold Tabulator object + this.element = false; + this.manualBlock = false; + }; + + Print.prototype.initialize = function () { + window.addEventListener("beforeprint", this.replaceTable.bind(this)); + window.addEventListener("afterprint", this.cleanup.bind(this)); + }; + + Print.prototype.replaceTable = function () { + if (!this.manualBlock) { + this.element = document.createElement("div"); + this.element.classList.add("tabulator-print-table"); + + this.element.appendChild(this.table.modules.export.genereateTable(this.table.options.printConfig, this.table.options.printStyled, this.table.options.printRowRange, "print")); + + this.table.element.style.display = "none"; + + this.table.element.parentNode.insertBefore(this.element, this.table.element); + } + }; + + Print.prototype.cleanup = function () { + document.body.classList.remove("tabulator-print-fullscreen-hide"); + + if (this.element && this.element.parentNode) { + this.element.parentNode.removeChild(this.element); + this.table.element.style.display = ""; + } + }; + + Print.prototype.printFullscreen = function (visible, style, config) { + var scrollX = window.scrollX, + scrollY = window.scrollY, + headerEl = document.createElement("div"), + footerEl = document.createElement("div"), + tableEl = this.table.modules.export.genereateTable(typeof config != "undefined" ? config : this.table.options.printConfig, typeof style != "undefined" ? style : this.table.options.printStyled, visible, "print"), + headerContent, + footerContent; + + this.manualBlock = true; + + this.element = document.createElement("div"); + this.element.classList.add("tabulator-print-fullscreen"); + + if (this.table.options.printHeader) { + headerEl.classList.add("tabulator-print-header"); + + headerContent = typeof this.table.options.printHeader == "function" ? this.table.options.printHeader.call(this.table) : this.table.options.printHeader; + + if (typeof headerContent == "string") { + headerEl.innerHTML = headerContent; + } else { + headerEl.appendChild(headerContent); + } + + this.element.appendChild(headerEl); + } + + this.element.appendChild(tableEl); + + if (this.table.options.printFooter) { + footerEl.classList.add("tabulator-print-footer"); + + footerContent = typeof this.table.options.printFooter == "function" ? this.table.options.printFooter.call(this.table) : this.table.options.printFooter; + + if (typeof footerContent == "string") { + footerEl.innerHTML = footerContent; + } else { + footerEl.appendChild(footerContent); + } + + this.element.appendChild(footerEl); + } + + document.body.classList.add("tabulator-print-fullscreen-hide"); + document.body.appendChild(this.element); + + if (this.table.options.printFormatter) { + this.table.options.printFormatter(this.element, tableEl); + } + + window.print(); + + this.cleanup(); + + window.scrollTo(scrollX, scrollY); + + this.manualBlock = false; + }; + + Tabulator.prototype.registerModule("print", Print); + var ReactiveData = function ReactiveData(table) { + this.table = table; //hold Tabulator object + this.data = false; + this.blocked = false; //block reactivity while performing update + this.origFuncs = {}; // hold original data array functions to allow replacement after data is done with + this.currentVersion = 0; + }; + + ReactiveData.prototype.watchData = function (data) { + var self = this, + pushFunc, + version; + + this.currentVersion++; + + version = this.currentVersion; + + self.unwatchData(); + + self.data = data; + + //override array push function + self.origFuncs.push = data.push; + + Object.defineProperty(self.data, "push", { + enumerable: false, + configurable: true, + value: function value() { + var args = Array.from(arguments); + + if (!self.blocked && version === self.currentVersion) { + args.forEach(function (arg) { + self.table.rowManager.addRowActual(arg, false); + }); + } + + return self.origFuncs.push.apply(data, arguments); + } + }); + + //override array unshift function + self.origFuncs.unshift = data.unshift; + + Object.defineProperty(self.data, "unshift", { + enumerable: false, + configurable: true, + value: function value() { + var args = Array.from(arguments); + + if (!self.blocked && version === self.currentVersion) { + args.forEach(function (arg) { + self.table.rowManager.addRowActual(arg, true); + }); + } + + return self.origFuncs.unshift.apply(data, arguments); + } + }); + + //override array shift function + self.origFuncs.shift = data.shift; + + Object.defineProperty(self.data, "shift", { + enumerable: false, + configurable: true, + value: function value() { + var row; + + if (!self.blocked && version === self.currentVersion) { + if (self.data.length) { + row = self.table.rowManager.getRowFromDataObject(self.data[0]); + + if (row) { + row.deleteActual(); + } + } + } + + return self.origFuncs.shift.call(data); + } + }); + + //override array pop function + self.origFuncs.pop = data.pop; + + Object.defineProperty(self.data, "pop", { + enumerable: false, + configurable: true, + value: function value() { + var row; + if (!self.blocked && version === self.currentVersion) { + if (self.data.length) { + row = self.table.rowManager.getRowFromDataObject(self.data[self.data.length - 1]); + + if (row) { + row.deleteActual(); + } + } + } + return self.origFuncs.pop.call(data); + } + }); + + //override array splice function + self.origFuncs.splice = data.splice; + + Object.defineProperty(self.data, "splice", { + enumerable: false, + configurable: true, + value: function value() { + var args = Array.from(arguments), + start = args[0] < 0 ? data.length + args[0] : args[0], + end = args[1], + newRows = args[2] ? args.slice(2) : false, + startRow; + + if (!self.blocked && version === self.currentVersion) { + + //add new rows + if (newRows) { + startRow = data[start] ? self.table.rowManager.getRowFromDataObject(data[start]) : false; + + if (startRow) { + newRows.forEach(function (rowData) { + self.table.rowManager.addRowActual(rowData, true, startRow, true); + }); + } else { + newRows = newRows.slice().reverse(); + + newRows.forEach(function (rowData) { + self.table.rowManager.addRowActual(rowData, true, false, true); + }); + } + } + + //delete removed rows + if (end !== 0) { + var oldRows = data.slice(start, typeof args[1] === "undefined" ? args[1] : start + end); + + oldRows.forEach(function (rowData, i) { + var row = self.table.rowManager.getRowFromDataObject(rowData); + + if (row) { + row.deleteActual(i !== oldRows.length - 1); + } + }); + } + + if (newRows || end !== 0) { + self.table.rowManager.reRenderInPosition(); + } + } + + return self.origFuncs.splice.apply(data, arguments); + } + }); + }; + + ReactiveData.prototype.unwatchData = function () { + if (this.data !== false) { + for (var key in this.origFuncs) { + Object.defineProperty(this.data, key, { + enumerable: true, + configurable: true, + writable: true, + value: this.origFuncs.key + }); + } + } + }; + + ReactiveData.prototype.watchRow = function (row) { + var self = this, + data = row.getData(); + + this.blocked = true; + + for (var key in data) { + this.watchKey(row, data, key); + } + + this.blocked = false; + }; + + ReactiveData.prototype.watchKey = function (row, data, key) { + var self = this, + props = Object.getOwnPropertyDescriptor(data, key), + value = data[key], + version = this.currentVersion; + + Object.defineProperty(data, key, { + set: function set(newValue) { + value = newValue; + if (!self.blocked && version === self.currentVersion) { + var update = {}; + update[key] = newValue; + row.updateData(update); + } + + if (props.set) { + props.set(newValue); + } + }, + get: function get() { + + if (props.get) { + props.get(); + } + + return value; + } + }); + }; + + ReactiveData.prototype.unwatchRow = function (row) { + var data = row.getData(); + + for (var key in data) { + Object.defineProperty(data, key, { + value: data[key] + }); + } + }; + + ReactiveData.prototype.block = function () { + this.blocked = true; + }; + + ReactiveData.prototype.unblock = function () { + this.blocked = false; + }; + + Tabulator.prototype.registerModule("reactiveData", ReactiveData); + + var ResizeColumns = function ResizeColumns(table) { + this.table = table; //hold Tabulator object + this.startColumn = false; + this.startX = false; + this.startWidth = false; + this.handle = null; + this.prevHandle = null; + }; + + ResizeColumns.prototype.initializeColumn = function (type, column, element) { + var self = this, + variableHeight = false, + mode = this.table.options.resizableColumns; + + //set column resize mode + if (type === "header") { + variableHeight = column.definition.formatter == "textarea" || column.definition.variableHeight; + column.modules.resize = { variableHeight: variableHeight }; + } + + if (mode === true || mode == type) { + + var handle = document.createElement('div'); + handle.className = "tabulator-col-resize-handle"; + + var prevHandle = document.createElement('div'); + prevHandle.className = "tabulator-col-resize-handle prev"; + + handle.addEventListener("click", function (e) { + e.stopPropagation(); + }); + + var handleDown = function handleDown(e) { + var nearestColumn = column.getLastColumn(); + + if (nearestColumn && self._checkResizability(nearestColumn)) { + self.startColumn = column; + self._mouseDown(e, nearestColumn, handle); + } + }; + + handle.addEventListener("mousedown", handleDown); + handle.addEventListener("touchstart", handleDown, { passive: true }); + + //reszie column on double click + handle.addEventListener("dblclick", function (e) { + var col = column.getLastColumn(); + + if (col && self._checkResizability(col)) { + e.stopPropagation(); + col.reinitializeWidth(true); + } + }); + + prevHandle.addEventListener("click", function (e) { + e.stopPropagation(); + }); + + var prevHandleDown = function prevHandleDown(e) { + var nearestColumn, colIndex, prevColumn; + + nearestColumn = column.getFirstColumn(); + + if (nearestColumn) { + colIndex = self.table.columnManager.findColumnIndex(nearestColumn); + prevColumn = colIndex > 0 ? self.table.columnManager.getColumnByIndex(colIndex - 1) : false; + + if (prevColumn && self._checkResizability(prevColumn)) { + self.startColumn = column; + self._mouseDown(e, prevColumn, prevHandle); + } + } + }; + + prevHandle.addEventListener("mousedown", prevHandleDown); + prevHandle.addEventListener("touchstart", prevHandleDown, { passive: true }); + + //resize column on double click + prevHandle.addEventListener("dblclick", function (e) { + var nearestColumn, colIndex, prevColumn; + + nearestColumn = column.getFirstColumn(); + + if (nearestColumn) { + colIndex = self.table.columnManager.findColumnIndex(nearestColumn); + prevColumn = colIndex > 0 ? self.table.columnManager.getColumnByIndex(colIndex - 1) : false; + + if (prevColumn && self._checkResizability(prevColumn)) { + e.stopPropagation(); + prevColumn.reinitializeWidth(true); + } + } + }); + + element.appendChild(handle); + element.appendChild(prevHandle); + } + }; + + ResizeColumns.prototype._checkResizability = function (column) { + return typeof column.definition.resizable != "undefined" ? column.definition.resizable : this.table.options.resizableColumns; + }; + + ResizeColumns.prototype._mouseDown = function (e, column, handle) { + var self = this; + + self.table.element.classList.add("tabulator-block-select"); + + function mouseMove(e) { + // self.table.columnManager.tempScrollBlock(); + + column.setWidth(self.startWidth + ((typeof e.screenX === "undefined" ? e.touches[0].screenX : e.screenX) - self.startX)); + + if (!self.table.browserSlow && column.modules.resize && column.modules.resize.variableHeight) { + column.checkCellHeights(); + } + } + + function mouseUp(e) { + + //block editor from taking action while resizing is taking place + if (self.startColumn.modules.edit) { + self.startColumn.modules.edit.blocked = false; + } + + if (self.table.browserSlow && column.modules.resize && column.modules.resize.variableHeight) { + column.checkCellHeights(); + } + + document.body.removeEventListener("mouseup", mouseUp); + document.body.removeEventListener("mousemove", mouseMove); + + handle.removeEventListener("touchmove", mouseMove); + handle.removeEventListener("touchend", mouseUp); + + self.table.element.classList.remove("tabulator-block-select"); + + if (self.table.options.persistence && self.table.modExists("persistence", true) && self.table.modules.persistence.config.columns) { + self.table.modules.persistence.save("columns"); + } + + self.table.options.columnResized.call(self.table, column.getComponent()); + } + + e.stopPropagation(); //prevent resize from interfereing with movable columns + + //block editor from taking action while resizing is taking place + if (self.startColumn.modules.edit) { + self.startColumn.modules.edit.blocked = true; + } + + self.startX = typeof e.screenX === "undefined" ? e.touches[0].screenX : e.screenX; + self.startWidth = column.getWidth(); + + document.body.addEventListener("mousemove", mouseMove); + document.body.addEventListener("mouseup", mouseUp); + handle.addEventListener("touchmove", mouseMove, { passive: true }); + handle.addEventListener("touchend", mouseUp); + }; + + Tabulator.prototype.registerModule("resizeColumns", ResizeColumns); + var ResizeRows = function ResizeRows(table) { + this.table = table; //hold Tabulator object + this.startColumn = false; + this.startY = false; + this.startHeight = false; + this.handle = null; + this.prevHandle = null; + }; + + ResizeRows.prototype.initializeRow = function (row) { + var self = this, + rowEl = row.getElement(); + + var handle = document.createElement('div'); + handle.className = "tabulator-row-resize-handle"; + + var prevHandle = document.createElement('div'); + prevHandle.className = "tabulator-row-resize-handle prev"; + + handle.addEventListener("click", function (e) { + e.stopPropagation(); + }); + + var handleDown = function handleDown(e) { + self.startRow = row; + self._mouseDown(e, row, handle); + }; + + handle.addEventListener("mousedown", handleDown); + handle.addEventListener("touchstart", handleDown, { passive: true }); + + prevHandle.addEventListener("click", function (e) { + e.stopPropagation(); + }); + + var prevHandleDown = function prevHandleDown(e) { + var prevRow = self.table.rowManager.prevDisplayRow(row); + + if (prevRow) { + self.startRow = prevRow; + self._mouseDown(e, prevRow, prevHandle); + } + }; + + prevHandle.addEventListener("mousedown", prevHandleDown); + prevHandle.addEventListener("touchstart", prevHandleDown, { passive: true }); + + rowEl.appendChild(handle); + rowEl.appendChild(prevHandle); + }; + + ResizeRows.prototype._mouseDown = function (e, row, handle) { + var self = this; + + self.table.element.classList.add("tabulator-block-select"); + + function mouseMove(e) { + row.setHeight(self.startHeight + ((typeof e.screenY === "undefined" ? e.touches[0].screenY : e.screenY) - self.startY)); + } + + function mouseUp(e) { + + // //block editor from taking action while resizing is taking place + // if(self.startColumn.modules.edit){ + // self.startColumn.modules.edit.blocked = false; + // } + + document.body.removeEventListener("mouseup", mouseMove); + document.body.removeEventListener("mousemove", mouseMove); + + handle.removeEventListener("touchmove", mouseMove); + handle.removeEventListener("touchend", mouseUp); + + self.table.element.classList.remove("tabulator-block-select"); + + self.table.options.rowResized.call(this.table, row.getComponent()); + } + + e.stopPropagation(); //prevent resize from interfereing with movable columns + + //block editor from taking action while resizing is taking place + // if(self.startColumn.modules.edit){ + // self.startColumn.modules.edit.blocked = true; + // } + + self.startY = typeof e.screenY === "undefined" ? e.touches[0].screenY : e.screenY; + self.startHeight = row.getHeight(); + + document.body.addEventListener("mousemove", mouseMove); + document.body.addEventListener("mouseup", mouseUp); + + handle.addEventListener("touchmove", mouseMove, { passive: true }); + handle.addEventListener("touchend", mouseUp); + }; + + Tabulator.prototype.registerModule("resizeRows", ResizeRows); + var ResizeTable = function ResizeTable(table) { + this.table = table; //hold Tabulator object + this.binding = false; + this.observer = false; + this.containerObserver = false; + + this.tableHeight = 0; + this.tableWidth = 0; + this.containerHeight = 0; + this.containerWidth = 0; + + this.autoResize = false; + }; + + ResizeTable.prototype.initialize = function (row) { + var _this74 = this; + + var table = this.table, + tableStyle; + + this.tableHeight = table.element.clientHeight; + this.tableWidth = table.element.clientWidth; + + if (table.element.parentNode) { + this.containerHeight = table.element.parentNode.clientHeight; + this.containerWidth = table.element.parentNode.clientWidth; + } + + if (typeof ResizeObserver !== "undefined" && table.rowManager.getRenderMode() === "virtual") { + + this.autoResize = true; + + this.observer = new ResizeObserver(function (entry) { + if (!table.browserMobile || table.browserMobile && !table.modules.edit.currentCell) { + + var nodeHeight = Math.floor(entry[0].contentRect.height); + var nodeWidth = Math.floor(entry[0].contentRect.width); + + if (_this74.tableHeight != nodeHeight || _this74.tableWidth != nodeWidth) { + _this74.tableHeight = nodeHeight; + _this74.tableWidth = nodeWidth; + + if (table.element.parentNode) { + _this74.containerHeight = table.element.parentNode.clientHeight; + _this74.containerWidth = table.element.parentNode.clientWidth; + } + + table.redraw(); + } + } + }); + + this.observer.observe(table.element); + + tableStyle = window.getComputedStyle(table.element); + + if (this.table.element.parentNode && !this.table.rowManager.fixedHeight && (tableStyle.getPropertyValue("max-height") || tableStyle.getPropertyValue("min-height"))) { + + this.containerObserver = new ResizeObserver(function (entry) { + if (!table.browserMobile || table.browserMobile && !table.modules.edit.currentCell) { + + var nodeHeight = Math.floor(entry[0].contentRect.height); + var nodeWidth = Math.floor(entry[0].contentRect.width); + + if (_this74.containerHeight != nodeHeight || _this74.containerWidth != nodeWidth) { + _this74.containerHeight = nodeHeight; + _this74.containerWidth = nodeWidth; + _this74.tableHeight = table.element.clientHeight; + _this74.tableWidth = table.element.clientWidth; + + table.redraw(); + } + + table.redraw(); + } + }); + + this.containerObserver.observe(this.table.element.parentNode); + } + } else { + this.binding = function () { + if (!table.browserMobile || table.browserMobile && !table.modules.edit.currentCell) { + table.redraw(); + } + }; + + window.addEventListener("resize", this.binding); + } + }; + + ResizeTable.prototype.clearBindings = function (row) { + if (this.binding) { + window.removeEventListener("resize", this.binding); + } + + if (this.observer) { + this.observer.unobserve(this.table.element); + } + + if (this.containerObserver) { + this.containerObserver.unobserve(this.table.element.parentNode); + } + }; + + Tabulator.prototype.registerModule("resizeTable", ResizeTable); + var ResponsiveLayout = function ResponsiveLayout(table) { + this.table = table; //hold Tabulator object + this.columns = []; + this.hiddenColumns = []; + this.mode = ""; + this.index = 0; + this.collapseFormatter = []; + this.collapseStartOpen = true; + this.collapseHandleColumn = false; + }; + + //generate resposive columns list + ResponsiveLayout.prototype.initialize = function () { + var self = this, + columns = []; + + this.mode = this.table.options.responsiveLayout; + this.collapseFormatter = this.table.options.responsiveLayoutCollapseFormatter || this.formatCollapsedData; + this.collapseStartOpen = this.table.options.responsiveLayoutCollapseStartOpen; + this.hiddenColumns = []; + + //detemine level of responsivity for each column + this.table.columnManager.columnsByIndex.forEach(function (column, i) { + if (column.modules.responsive) { + if (column.modules.responsive.order && column.modules.responsive.visible) { + column.modules.responsive.index = i; + columns.push(column); + + if (!column.visible && self.mode === "collapse") { + self.hiddenColumns.push(column); + } + } + } + }); + + //sort list by responsivity + columns = columns.reverse(); + columns = columns.sort(function (a, b) { + var diff = b.modules.responsive.order - a.modules.responsive.order; + return diff || b.modules.responsive.index - a.modules.responsive.index; + }); + + this.columns = columns; + + if (this.mode === "collapse") { + this.generateCollapsedContent(); + } + + //assign collapse column + for (var _iterator = this.table.columnManager.columnsByIndex, _isArray = Array.isArray(_iterator), _i12 = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) { + var _ref; + + if (_isArray) { + if (_i12 >= _iterator.length) break; + _ref = _iterator[_i12++]; + } else { + _i12 = _iterator.next(); + if (_i12.done) break; + _ref = _i12.value; + } + + var col = _ref; + + if (col.definition.formatter == "responsiveCollapse") { + this.collapseHandleColumn = col; + break; + } + } + + if (this.collapseHandleColumn) { + if (this.hiddenColumns.length) { + this.collapseHandleColumn.show(); + } else { + this.collapseHandleColumn.hide(); + } + } + }; + + //define layout information + ResponsiveLayout.prototype.initializeColumn = function (column) { + var def = column.getDefinition(); + + column.modules.responsive = { order: typeof def.responsive === "undefined" ? 1 : def.responsive, visible: def.visible === false ? false : true }; + }; + + ResponsiveLayout.prototype.initializeRow = function (row) { + var el; + + if (row.type !== "calc") { + el = document.createElement("div"); + el.classList.add("tabulator-responsive-collapse"); + + row.modules.responsiveLayout = { + element: el, + open: this.collapseStartOpen + }; + + if (!this.collapseStartOpen) { + el.style.display = 'none'; + } + } + }; + + ResponsiveLayout.prototype.layoutRow = function (row) { + var rowEl = row.getElement(); + + if (row.modules.responsiveLayout) { + rowEl.appendChild(row.modules.responsiveLayout.element); + this.generateCollapsedRowContent(row); + } + }; + + //update column visibility + ResponsiveLayout.prototype.updateColumnVisibility = function (column, visible) { + var index; + if (column.modules.responsive) { + column.modules.responsive.visible = visible; + this.initialize(); + } + }; + + ResponsiveLayout.prototype.hideColumn = function (column) { + var colCount = this.hiddenColumns.length; + + column.hide(false, true); + + if (this.mode === "collapse") { + this.hiddenColumns.unshift(column); + this.generateCollapsedContent(); + + if (this.collapseHandleColumn && !colCount) { + this.collapseHandleColumn.show(); + } + } + }; + + ResponsiveLayout.prototype.showColumn = function (column) { + var index; + + column.show(false, true); + //set column width to prevent calculation loops on uninitialized columns + column.setWidth(column.getWidth()); + + if (this.mode === "collapse") { + index = this.hiddenColumns.indexOf(column); + + if (index > -1) { + this.hiddenColumns.splice(index, 1); + } + + this.generateCollapsedContent(); + + if (this.collapseHandleColumn && !this.hiddenColumns.length) { + this.collapseHandleColumn.hide(); + } + } + }; + + //redraw columns to fit space + ResponsiveLayout.prototype.update = function () { + var self = this, + working = true; + + while (working) { + + var width = self.table.modules.layout.getMode() == "fitColumns" ? self.table.columnManager.getFlexBaseWidth() : self.table.columnManager.getWidth(); + + var diff = (self.table.options.headerVisible ? self.table.columnManager.element.clientWidth : self.table.element.clientWidth) - width; + + if (diff < 0) { + //table is too wide + var column = self.columns[self.index]; + + if (column) { + self.hideColumn(column); + self.index++; + } else { + working = false; + } + } else { + + //table has spare space + var _column = self.columns[self.index - 1]; + + if (_column) { + if (diff > 0) { + if (diff >= _column.getWidth()) { + self.showColumn(_column); + self.index--; + } else { + working = false; + } + } else { + working = false; + } + } else { + working = false; + } + } + + if (!self.table.rowManager.activeRowsCount) { + self.table.rowManager.renderEmptyScroll(); + } + } + }; + + ResponsiveLayout.prototype.generateCollapsedContent = function () { + var self = this, + rows = this.table.rowManager.getDisplayRows(); + + rows.forEach(function (row) { + self.generateCollapsedRowContent(row); + }); + }; + + ResponsiveLayout.prototype.generateCollapsedRowContent = function (row) { + var el, contents; + + if (row.modules.responsiveLayout) { + el = row.modules.responsiveLayout.element; + + while (el.firstChild) { + el.removeChild(el.firstChild); + }contents = this.collapseFormatter(this.generateCollapsedRowData(row)); + if (contents) { + el.appendChild(contents); + } + } + }; + + ResponsiveLayout.prototype.generateCollapsedRowData = function (row) { + var self = this, + data = row.getData(), + output = [], + mockCellComponent; + + this.hiddenColumns.forEach(function (column) { + var value = column.getFieldValue(data); + + if (column.definition.title && column.field) { + if (column.modules.format && self.table.options.responsiveLayoutCollapseUseFormatters) { + + mockCellComponent = { + value: false, + data: {}, + getValue: function getValue() { + return value; + }, + getData: function getData() { + return data; + }, + getElement: function getElement() { + return document.createElement("div"); + }, + getRow: function getRow() { + return row.getComponent(); + }, + getColumn: function getColumn() { + return column.getComponent(); + } + }; + + output.push({ + title: column.definition.title, + value: column.modules.format.formatter.call(self.table.modules.format, mockCellComponent, column.modules.format.params) + }); + } else { + output.push({ + title: column.definition.title, + value: value + }); + } + } + }); + + return output; + }; + + ResponsiveLayout.prototype.formatCollapsedData = function (data) { + var list = document.createElement("table"), + listContents = ""; + + data.forEach(function (item) { + var div = document.createElement("div"); + + if (item.value instanceof Node) { + div.appendChild(item.value); + item.value = div.innerHTML; + } + + listContents += "" + item.title + "" + item.value + ""; + }); + + list.innerHTML = listContents; + + return Object.keys(data).length ? list : ""; + }; + + Tabulator.prototype.registerModule("responsiveLayout", ResponsiveLayout); + + var SelectRow = function SelectRow(table) { + this.table = table; //hold Tabulator object + this.selecting = false; //flag selecting in progress + this.lastClickedRow = false; //last clicked row + this.selectPrev = []; //hold previously selected element for drag drop selection + this.selectedRows = []; //hold selected rows + this.headerCheckboxElement = null; // hold header select element + }; + + SelectRow.prototype.clearSelectionData = function (silent) { + this.selecting = false; + this.lastClickedRow = false; + this.selectPrev = []; + this.selectedRows = []; + + if (!silent) { + this._rowSelectionChanged(); + } + }; + + SelectRow.prototype.initializeRow = function (row) { + var self = this, + element = row.getElement(); + + // trigger end of row selection + var endSelect = function endSelect() { + + setTimeout(function () { + self.selecting = false; + }, 50); + + document.body.removeEventListener("mouseup", endSelect); + }; + + row.modules.select = { selected: false }; + + //set row selection class + if (self.table.options.selectableCheck.call(this.table, row.getComponent())) { + element.classList.add("tabulator-selectable"); + element.classList.remove("tabulator-unselectable"); + + if (self.table.options.selectable && self.table.options.selectable != "highlight") { + if (self.table.options.selectableRangeMode === "click") { + element.addEventListener("click", function (e) { + if (e.shiftKey) { + self.table._clearSelection(); + self.lastClickedRow = self.lastClickedRow || row; + + var lastClickedRowIdx = self.table.rowManager.getDisplayRowIndex(self.lastClickedRow); + var rowIdx = self.table.rowManager.getDisplayRowIndex(row); + + var fromRowIdx = lastClickedRowIdx <= rowIdx ? lastClickedRowIdx : rowIdx; + var toRowIdx = lastClickedRowIdx >= rowIdx ? lastClickedRowIdx : rowIdx; + + var rows = self.table.rowManager.getDisplayRows().slice(0); + var toggledRows = rows.splice(fromRowIdx, toRowIdx - fromRowIdx + 1); + + if (e.ctrlKey || e.metaKey) { + toggledRows.forEach(function (toggledRow) { + if (toggledRow !== self.lastClickedRow) { + + if (self.table.options.selectable !== true && !self.isRowSelected(row)) { + if (self.selectedRows.length < self.table.options.selectable) { + self.toggleRow(toggledRow); + } + } else { + self.toggleRow(toggledRow); + } + } + }); + self.lastClickedRow = row; + } else { + self.deselectRows(undefined, true); + + if (self.table.options.selectable !== true) { + if (toggledRows.length > self.table.options.selectable) { + toggledRows = toggledRows.slice(0, self.table.options.selectable); + } + } + + self.selectRows(toggledRows); + } + self.table._clearSelection(); + } else if (e.ctrlKey || e.metaKey) { + self.toggleRow(row); + self.lastClickedRow = row; + } else { + self.deselectRows(undefined, true); + self.selectRows(row); + self.lastClickedRow = row; + } + }); + } else { + element.addEventListener("click", function (e) { + if (!self.table.modExists("edit") || !self.table.modules.edit.getCurrentCell()) { + self.table._clearSelection(); + } + + if (!self.selecting) { + self.toggleRow(row); + } + }); + + element.addEventListener("mousedown", function (e) { + if (e.shiftKey) { + self.table._clearSelection(); + + self.selecting = true; + + self.selectPrev = []; + + document.body.addEventListener("mouseup", endSelect); + document.body.addEventListener("keyup", endSelect); + + self.toggleRow(row); + + return false; + } + }); + + element.addEventListener("mouseenter", function (e) { + if (self.selecting) { + self.table._clearSelection(); + self.toggleRow(row); + + if (self.selectPrev[1] == row) { + self.toggleRow(self.selectPrev[0]); + } + } + }); + + element.addEventListener("mouseout", function (e) { + if (self.selecting) { + self.table._clearSelection(); + self.selectPrev.unshift(row); + } + }); + } + } + } else { + element.classList.add("tabulator-unselectable"); + element.classList.remove("tabulator-selectable"); + } + }; + + //toggle row selection + SelectRow.prototype.toggleRow = function (row) { + if (this.table.options.selectableCheck.call(this.table, row.getComponent())) { + if (row.modules.select && row.modules.select.selected) { + this._deselectRow(row); + } else { + this._selectRow(row); + } + } + }; + + //select a number of rows + SelectRow.prototype.selectRows = function (rows) { + var _this75 = this; + + var rowMatch; + + switch (typeof rows === 'undefined' ? 'undefined' : _typeof(rows)) { + case "undefined": + this.table.rowManager.rows.forEach(function (row) { + _this75._selectRow(row, true, true); + }); + + this._rowSelectionChanged(); + break; + + case "string": + + rowMatch = this.table.rowManager.findRow(rows); + + if (rowMatch) { + this._selectRow(rowMatch, true, true); + } else { + this.table.rowManager.getRows(rows).forEach(function (row) { + _this75._selectRow(row, true, true); + }); + } + + this._rowSelectionChanged(); + break; + + default: + if (Array.isArray(rows)) { + rows.forEach(function (row) { + _this75._selectRow(row, true, true); + }); + + this._rowSelectionChanged(); + } else { + this._selectRow(rows, false, true); + } + break; + } + }; + + //select an individual row + SelectRow.prototype._selectRow = function (rowInfo, silent, force) { + var index; + + //handle max row count + if (!isNaN(this.table.options.selectable) && this.table.options.selectable !== true && !force) { + if (this.selectedRows.length >= this.table.options.selectable) { + if (this.table.options.selectableRollingSelection) { + this._deselectRow(this.selectedRows[0]); + } else { + return false; + } + } + } + + var row = this.table.rowManager.findRow(rowInfo); + + if (row) { + if (this.selectedRows.indexOf(row) == -1) { + if (!row.modules.select) { + row.modules.select = {}; + } + + row.modules.select.selected = true; + if (row.modules.select.checkboxEl) { + row.modules.select.checkboxEl.checked = true; + } + row.getElement().classList.add("tabulator-selected"); + + this.selectedRows.push(row); + + if (this.table.options.dataTreeSelectPropagate) { + this.childRowSelection(row, true); + } + + if (!silent) { + this.table.options.rowSelected.call(this.table, row.getComponent()); + } + + this._rowSelectionChanged(silent); + } + } else { + if (!silent) { + console.warn("Selection Error - No such row found, ignoring selection:" + rowInfo); + } + } + }; + + SelectRow.prototype.isRowSelected = function (row) { + return this.selectedRows.indexOf(row) !== -1; + }; + + //deselect a number of rows + SelectRow.prototype.deselectRows = function (rows, silent) { + var self = this, + rowCount; + + if (typeof rows == "undefined") { + + rowCount = self.selectedRows.length; + + for (var _i13 = 0; _i13 < rowCount; _i13++) { + self._deselectRow(self.selectedRows[0], true); + } + + self._rowSelectionChanged(silent); + } else { + if (Array.isArray(rows)) { + rows.forEach(function (row) { + self._deselectRow(row, true); + }); + + self._rowSelectionChanged(silent); + } else { + self._deselectRow(rows, silent); + } + } + }; + + //deselect an individual row + SelectRow.prototype._deselectRow = function (rowInfo, silent) { + var self = this, + row = self.table.rowManager.findRow(rowInfo), + index; + + if (row) { + index = self.selectedRows.findIndex(function (selectedRow) { + return selectedRow == row; + }); + + if (index > -1) { + + if (!row.modules.select) { + row.modules.select = {}; + } + + row.modules.select.selected = false; + if (row.modules.select.checkboxEl) { + row.modules.select.checkboxEl.checked = false; + } + row.getElement().classList.remove("tabulator-selected"); + self.selectedRows.splice(index, 1); + + if (this.table.options.dataTreeSelectPropagate) { + this.childRowSelection(row, false); + } + + if (!silent) { + self.table.options.rowDeselected.call(this.table, row.getComponent()); + } + + self._rowSelectionChanged(silent); + } + } else { + if (!silent) { + console.warn("Deselection Error - No such row found, ignoring selection:" + rowInfo); + } + } + }; + + SelectRow.prototype.getSelectedData = function () { + var data = []; + + this.selectedRows.forEach(function (row) { + data.push(row.getData()); + }); + + return data; + }; + + SelectRow.prototype.getSelectedRows = function () { + + var rows = []; + + this.selectedRows.forEach(function (row) { + rows.push(row.getComponent()); + }); + + return rows; + }; + + SelectRow.prototype._rowSelectionChanged = function (silent) { + if (this.headerCheckboxElement) { + if (this.selectedRows.length === 0) { + this.headerCheckboxElement.checked = false; + this.headerCheckboxElement.indeterminate = false; + } else if (this.table.rowManager.rows.length === this.selectedRows.length) { + this.headerCheckboxElement.checked = true; + this.headerCheckboxElement.indeterminate = false; + } else { + this.headerCheckboxElement.indeterminate = true; + this.headerCheckboxElement.checked = false; + } + } + + if (!silent) { + this.table.options.rowSelectionChanged.call(this.table, this.getSelectedData(), this.getSelectedRows()); + } + }; + + SelectRow.prototype.registerRowSelectCheckbox = function (row, element) { + if (!row._row.modules.select) { + row._row.modules.select = {}; + } + + row._row.modules.select.checkboxEl = element; + }; + + SelectRow.prototype.registerHeaderSelectCheckbox = function (element) { + this.headerCheckboxElement = element; + }; + + SelectRow.prototype.childRowSelection = function (row, select) { + var children = this.table.modules.dataTree.getChildren(row); + + if (select) { + for (var _iterator2 = children, _isArray2 = Array.isArray(_iterator2), _i14 = 0, _iterator2 = _isArray2 ? _iterator2 : _iterator2[Symbol.iterator]();;) { + var _ref2; + + if (_isArray2) { + if (_i14 >= _iterator2.length) break; + _ref2 = _iterator2[_i14++]; + } else { + _i14 = _iterator2.next(); + if (_i14.done) break; + _ref2 = _i14.value; + } + + var child = _ref2; + + this._selectRow(child, true); + } + } else { + for (var _iterator3 = children, _isArray3 = Array.isArray(_iterator3), _i15 = 0, _iterator3 = _isArray3 ? _iterator3 : _iterator3[Symbol.iterator]();;) { + var _ref3; + + if (_isArray3) { + if (_i15 >= _iterator3.length) break; + _ref3 = _iterator3[_i15++]; + } else { + _i15 = _iterator3.next(); + if (_i15.done) break; + _ref3 = _i15.value; + } + + var _child = _ref3; + + this._deselectRow(_child, true); + } + } + }; + + Tabulator.prototype.registerModule("selectRow", SelectRow); + + var Sort = function Sort(table) { + this.table = table; //hold Tabulator object + this.sortList = []; //holder current sort + this.changed = false; //has the sort changed since last render + }; + + //initialize column header for sorting + Sort.prototype.initializeColumn = function (column, content) { + var self = this, + sorter = false, + colEl, + arrowEl; + + switch (_typeof(column.definition.sorter)) { + case "string": + if (self.sorters[column.definition.sorter]) { + sorter = self.sorters[column.definition.sorter]; + } else { + console.warn("Sort Error - No such sorter found: ", column.definition.sorter); + } + break; + + case "function": + sorter = column.definition.sorter; + break; + } + + column.modules.sort = { + sorter: sorter, dir: "none", + params: column.definition.sorterParams || {}, + startingDir: column.definition.headerSortStartingDir || "asc", + tristate: typeof column.definition.headerSortTristate !== "undefined" ? column.definition.headerSortTristate : this.table.options.headerSortTristate + }; + + if (typeof column.definition.headerSort === "undefined" ? this.table.options.headerSort !== false : column.definition.headerSort !== false) { + + colEl = column.getElement(); + + colEl.classList.add("tabulator-sortable"); + + arrowEl = document.createElement("div"); + arrowEl.classList.add("tabulator-arrow"); + //create sorter arrow + content.appendChild(arrowEl); + + //sort on click + colEl.addEventListener("click", function (e) { + var dir = "", + sorters = [], + match = false; + + if (column.modules.sort) { + if (column.modules.sort.tristate) { + if (column.modules.sort.dir == "none") { + dir = column.modules.sort.startingDir; + } else { + if (column.modules.sort.dir == column.modules.sort.startingDir) { + dir = column.modules.sort.dir == "asc" ? "desc" : "asc"; + } else { + dir = "none"; + } + } + } else { + switch (column.modules.sort.dir) { + case "asc": + dir = "desc"; + break; + + case "desc": + dir = "asc"; + break; + + default: + dir = column.modules.sort.startingDir; + } + } + + if (self.table.options.columnHeaderSortMulti && (e.shiftKey || e.ctrlKey)) { + sorters = self.getSort(); + + match = sorters.findIndex(function (sorter) { + return sorter.field === column.getField(); + }); + + if (match > -1) { + sorters[match].dir = dir; + + if (match != sorters.length - 1) { + match = sorters.splice(match, 1)[0]; + if (dir != "none") { + sorters.push(match); + } + } + } else { + if (dir != "none") { + sorters.push({ column: column, dir: dir }); + } + } + + //add to existing sort + self.setSort(sorters); + } else { + if (dir == "none") { + self.clear(); + } else { + //sort by column only + self.setSort(column, dir); + } + } + + self.table.rowManager.sorterRefresh(!self.sortList.length); + } + }); + } + }; + + //check if the sorters have changed since last use + Sort.prototype.hasChanged = function () { + var changed = this.changed; + this.changed = false; + return changed; + }; + + //return current sorters + Sort.prototype.getSort = function () { + var self = this, + sorters = []; + + self.sortList.forEach(function (item) { + if (item.column) { + sorters.push({ column: item.column.getComponent(), field: item.column.getField(), dir: item.dir }); + } + }); + + return sorters; + }; + + //change sort list and trigger sort + Sort.prototype.setSort = function (sortList, dir) { + var self = this, + newSortList = []; + + if (!Array.isArray(sortList)) { + sortList = [{ column: sortList, dir: dir }]; + } + + sortList.forEach(function (item) { + var column; + + column = self.table.columnManager.findColumn(item.column); + + if (column) { + item.column = column; + newSortList.push(item); + self.changed = true; + } else { + console.warn("Sort Warning - Sort field does not exist and is being ignored: ", item.column); + } + }); + + self.sortList = newSortList; + + if (this.table.options.persistence && this.table.modExists("persistence", true) && this.table.modules.persistence.config.sort) { + this.table.modules.persistence.save("sort"); + } + }; + + //clear sorters + Sort.prototype.clear = function () { + this.setSort([]); + }; + + //find appropriate sorter for column + Sort.prototype.findSorter = function (column) { + var row = this.table.rowManager.activeRows[0], + sorter = "string", + field, + value; + + if (row) { + row = row.getData(); + field = column.getField(); + + if (field) { + + value = column.getFieldValue(row); + + switch (typeof value === 'undefined' ? 'undefined' : _typeof(value)) { + case "undefined": + sorter = "string"; + break; + + case "boolean": + sorter = "boolean"; + break; + + default: + if (!isNaN(value) && value !== "") { + sorter = "number"; + } else { + if (value.match(/((^[0-9]+[a-z]+)|(^[a-z]+[0-9]+))+$/i)) { + sorter = "alphanum"; + } + } + break; + } + } + } + + return this.sorters[sorter]; + }; + + //work through sort list sorting data + Sort.prototype.sort = function (data) { + var self = this, + sortList = this.table.options.sortOrderReverse ? self.sortList.slice().reverse() : self.sortList, + sortListActual = [], + rowComponents = [], + lastSort; + + if (self.table.options.dataSorting) { + self.table.options.dataSorting.call(self.table, self.getSort()); + } + + self.clearColumnHeaders(); + + if (!self.table.options.ajaxSorting) { + + //build list of valid sorters and trigger column specific callbacks before sort begins + sortList.forEach(function (item, i) { + var sortObj = item.column.modules.sort; + + if (item.column && sortObj) { + + //if no sorter has been defined, take a guess + if (!sortObj.sorter) { + sortObj.sorter = self.findSorter(item.column); + } + + item.params = typeof sortObj.params === "function" ? sortObj.params(item.column.getComponent(), item.dir) : sortObj.params; + + sortListActual.push(item); + } + + self.setColumnHeader(item.column, item.dir); + }); + + //sort data + if (sortListActual.length) { + self._sortItems(data, sortListActual); + } + } else { + sortList.forEach(function (item, i) { + self.setColumnHeader(item.column, item.dir); + }); + } + + if (self.table.options.dataSorted) { + data.forEach(function (row) { + rowComponents.push(row.getComponent()); + }); + + self.table.options.dataSorted.call(self.table, self.getSort(), rowComponents); + } + }; + + //clear sort arrows on columns + Sort.prototype.clearColumnHeaders = function () { + this.table.columnManager.getRealColumns().forEach(function (column) { + if (column.modules.sort) { + column.modules.sort.dir = "none"; + column.getElement().setAttribute("aria-sort", "none"); + } + }); + }; + + //set the column header sort direction + Sort.prototype.setColumnHeader = function (column, dir) { + column.modules.sort.dir = dir; + column.getElement().setAttribute("aria-sort", dir); + }; + + //sort each item in sort list + Sort.prototype._sortItems = function (data, sortList) { + var _this76 = this; + + var sorterCount = sortList.length - 1; + + data.sort(function (a, b) { + var result; + + for (var i = sorterCount; i >= 0; i--) { + var sortItem = sortList[i]; + + result = _this76._sortRow(a, b, sortItem.column, sortItem.dir, sortItem.params); + + if (result !== 0) { + break; + } + } + + return result; + }); + }; + + //process individual rows for a sort function on active data + Sort.prototype._sortRow = function (a, b, column, dir, params) { + var el1Comp, el2Comp, colComp; + + //switch elements depending on search direction + var el1 = dir == "asc" ? a : b; + var el2 = dir == "asc" ? b : a; + + a = column.getFieldValue(el1.getData()); + b = column.getFieldValue(el2.getData()); + + a = typeof a !== "undefined" ? a : ""; + b = typeof b !== "undefined" ? b : ""; + + el1Comp = el1.getComponent(); + el2Comp = el2.getComponent(); + + return column.modules.sort.sorter.call(this, a, b, el1Comp, el2Comp, column.getComponent(), dir, params); + }; + + //default data sorters + Sort.prototype.sorters = { + + //sort numbers + number: function number(a, b, aRow, bRow, column, dir, params) { + var alignEmptyValues = params.alignEmptyValues; + var decimal = params.decimalSeparator || "."; + var thousand = params.thousandSeparator || ","; + var emptyAlign = 0; + + a = parseFloat(String(a).split(thousand).join("").split(decimal).join(".")); + b = parseFloat(String(b).split(thousand).join("").split(decimal).join(".")); + + //handle non numeric values + if (isNaN(a)) { + emptyAlign = isNaN(b) ? 0 : -1; + } else if (isNaN(b)) { + emptyAlign = 1; + } else { + //compare valid values + return a - b; + } + + //fix empty values in position + if (alignEmptyValues === "top" && dir === "desc" || alignEmptyValues === "bottom" && dir === "asc") { + emptyAlign *= -1; + } + + return emptyAlign; + }, + + //sort strings + string: function string(a, b, aRow, bRow, column, dir, params) { + var alignEmptyValues = params.alignEmptyValues; + var emptyAlign = 0; + var locale; + + //handle empty values + if (!a) { + emptyAlign = !b ? 0 : -1; + } else if (!b) { + emptyAlign = 1; + } else { + //compare valid values + switch (_typeof(params.locale)) { + case "boolean": + if (params.locale) { + locale = this.table.modules.localize.getLocale(); + } + break; + case "string": + locale = params.locale; + break; + } + + return String(a).toLowerCase().localeCompare(String(b).toLowerCase(), locale); + } + + //fix empty values in position + if (alignEmptyValues === "top" && dir === "desc" || alignEmptyValues === "bottom" && dir === "asc") { + emptyAlign *= -1; + } + + return emptyAlign; + }, + + //sort date + date: function date(a, b, aRow, bRow, column, dir, params) { + if (!params.format) { + params.format = "DD/MM/YYYY"; + } + + return this.sorters.datetime.call(this, a, b, aRow, bRow, column, dir, params); + }, + + //sort HH:mm formatted times + time: function time(a, b, aRow, bRow, column, dir, params) { + if (!params.format) { + params.format = "HH:mm"; + } + + return this.sorters.datetime.call(this, a, b, aRow, bRow, column, dir, params); + }, + + //sort datetime + datetime: function datetime(a, b, aRow, bRow, column, dir, params) { + var format = params.format || "DD/MM/YYYY HH:mm:ss", + alignEmptyValues = params.alignEmptyValues, + emptyAlign = 0; + + if (typeof moment != "undefined") { + a = moment(a, format); + b = moment(b, format); + + if (!a.isValid()) { + emptyAlign = !b.isValid() ? 0 : -1; + } else if (!b.isValid()) { + emptyAlign = 1; + } else { + //compare valid values + return a - b; + } + + //fix empty values in position + if (alignEmptyValues === "top" && dir === "desc" || alignEmptyValues === "bottom" && dir === "asc") { + emptyAlign *= -1; + } + + return emptyAlign; + } else { + console.error("Sort Error - 'datetime' sorter is dependant on moment.js"); + } + }, + + //sort booleans + boolean: function boolean(a, b, aRow, bRow, column, dir, params) { + var el1 = a === true || a === "true" || a === "True" || a === 1 ? 1 : 0; + var el2 = b === true || b === "true" || b === "True" || b === 1 ? 1 : 0; + + return el1 - el2; + }, + + //sort if element contains any data + array: function array(a, b, aRow, bRow, column, dir, params) { + var el1 = 0; + var el2 = 0; + var type = params.type || "length"; + var alignEmptyValues = params.alignEmptyValues; + var emptyAlign = 0; + + function calc(value) { + + switch (type) { + case "length": + return value.length; + break; + + case "sum": + return value.reduce(function (c, d) { + return c + d; + }); + break; + + case "max": + return Math.max.apply(null, value); + break; + + case "min": + return Math.min.apply(null, value); + break; + + case "avg": + return value.reduce(function (c, d) { + return c + d; + }) / value.length; + break; + } + } + + //handle non array values + if (!Array.isArray(a)) { + alignEmptyValues = !Array.isArray(b) ? 0 : -1; + } else if (!Array.isArray(b)) { + alignEmptyValues = 1; + } else { + + //compare valid values + el1 = a ? calc(a) : 0; + el2 = b ? calc(b) : 0; + + return el1 - el2; + } + + //fix empty values in position + if (alignEmptyValues === "top" && dir === "desc" || alignEmptyValues === "bottom" && dir === "asc") { + emptyAlign *= -1; + } + + return emptyAlign; + }, + + //sort if element contains any data + exists: function exists(a, b, aRow, bRow, column, dir, params) { + var el1 = typeof a == "undefined" ? 0 : 1; + var el2 = typeof b == "undefined" ? 0 : 1; + + return el1 - el2; + }, + + //sort alpha numeric strings + alphanum: function alphanum(as, bs, aRow, bRow, column, dir, params) { + var a, + b, + a1, + b1, + i = 0, + L, + rx = /(\d+)|(\D+)/g, + rd = /\d/; + var alignEmptyValues = params.alignEmptyValues; + var emptyAlign = 0; + + //handle empty values + if (!as && as !== 0) { + emptyAlign = !bs && bs !== 0 ? 0 : -1; + } else if (!bs && bs !== 0) { + emptyAlign = 1; + } else { + + if (isFinite(as) && isFinite(bs)) return as - bs; + a = String(as).toLowerCase(); + b = String(bs).toLowerCase(); + if (a === b) return 0; + if (!(rd.test(a) && rd.test(b))) return a > b ? 1 : -1; + a = a.match(rx); + b = b.match(rx); + L = a.length > b.length ? b.length : a.length; + while (i < L) { + a1 = a[i]; + b1 = b[i++]; + if (a1 !== b1) { + if (isFinite(a1) && isFinite(b1)) { + if (a1.charAt(0) === "0") a1 = "." + a1; + if (b1.charAt(0) === "0") b1 = "." + b1; + return a1 - b1; + } else return a1 > b1 ? 1 : -1; + } + } + + return a.length > b.length; + } + + //fix empty values in position + if (alignEmptyValues === "top" && dir === "desc" || alignEmptyValues === "bottom" && dir === "asc") { + emptyAlign *= -1; + } + + return emptyAlign; + } + }; + + Tabulator.prototype.registerModule("sort", Sort); + + var Validate = function Validate(table) { + this.table = table; + this.invalidCells = []; + }; + + //validate + Validate.prototype.initializeColumn = function (column) { + var self = this, + config = [], + validator; + + if (column.definition.validator) { + + if (Array.isArray(column.definition.validator)) { + column.definition.validator.forEach(function (item) { + validator = self._extractValidator(item); + + if (validator) { + config.push(validator); + } + }); + } else { + validator = this._extractValidator(column.definition.validator); + + if (validator) { + config.push(validator); + } + } + + column.modules.validate = config.length ? config : false; + } + }; + + Validate.prototype._extractValidator = function (value) { + var type, params, pos; + + switch (typeof value === 'undefined' ? 'undefined' : _typeof(value)) { + case "string": + pos = value.indexOf(':'); + + if (pos > -1) { + type = value.substring(0, pos); + params = value.substring(pos + 1); + } else { + type = value; + } + + return this._buildValidator(type, params); + break; + + case "function": + return this._buildValidator(value); + break; + + case "object": + return this._buildValidator(value.type, value.parameters); + break; + } + }; + + Validate.prototype._buildValidator = function (type, params) { + + var func = typeof type == "function" ? type : this.validators[type]; + + if (!func) { + console.warn("Validator Setup Error - No matching validator found:", type); + return false; + } else { + return { + type: typeof type == "function" ? "function" : type, + func: func, + params: params + }; + } + }; + + Validate.prototype.validate = function (validators, cell, value) { + var self = this, + valid = [], + invalidIndex = this.invalidCells.indexOf(cell); + + if (validators) { + validators.forEach(function (item) { + if (!item.func.call(self, cell.getComponent(), value, item.params)) { + valid.push({ + type: item.type, + parameters: item.params + }); + } + }); + } + + valid = valid.length ? valid : true; + + if (!cell.modules.validate) { + cell.modules.validate = {}; + } + + if (valid === true) { + cell.modules.validate.invalid = false; + cell.getElement().classList.remove("tabulator-validation-fail"); + + if (invalidIndex > -1) { + this.invalidCells.splice(invalidIndex, 1); + } + } else { + cell.modules.validate.invalid = true; + + if (this.table.options.validationMode !== "manual") { + cell.getElement().classList.add("tabulator-validation-fail"); + } + + if (invalidIndex == -1) { + this.invalidCells.push(cell); + } + } + + return valid; + }; + + Validate.prototype.getInvalidCells = function () { + var output = []; + + this.invalidCells.forEach(function (cell) { + output.push(cell.getComponent()); + }); + + return output; + }; + + Validate.prototype.clearValidation = function (cell) { + var invalidIndex; + + if (cell.modules.validate && cell.modules.validate.invalid) { + + cell.element.classList.remove("tabulator-validation-fail"); + cell.modules.validate.invalid = false; + + invalidIndex = this.invalidCells.indexOf(cell); + + if (invalidIndex > -1) { + this.invalidCells.splice(invalidIndex, 1); + } + } + }; + + Validate.prototype.validators = { + + //is integer + integer: function integer(cell, value, parameters) { + if (value === "" || value === null || typeof value === "undefined") { + return true; + } + value = Number(value); + return typeof value === 'number' && isFinite(value) && Math.floor(value) === value; + }, + + //is float + float: function float(cell, value, parameters) { + if (value === "" || value === null || typeof value === "undefined") { + return true; + } + value = Number(value); + return typeof value === 'number' && isFinite(value) && value % 1 !== 0; + }, + + //must be a number + numeric: function numeric(cell, value, parameters) { + if (value === "" || value === null || typeof value === "undefined") { + return true; + } + return !isNaN(value); + }, + + //must be a string + string: function string(cell, value, parameters) { + if (value === "" || value === null || typeof value === "undefined") { + return true; + } + return isNaN(value); + }, + + //maximum value + max: function max(cell, value, parameters) { + if (value === "" || value === null || typeof value === "undefined") { + return true; + } + return parseFloat(value) <= parameters; + }, + + //minimum value + min: function min(cell, value, parameters) { + if (value === "" || value === null || typeof value === "undefined") { + return true; + } + return parseFloat(value) >= parameters; + }, + + //starts with value + starts: function starts(cell, value, parameters) { + if (value === "" || value === null || typeof value === "undefined") { + return true; + } + return String(value).toLowerCase().startsWith(String(parameters).toLowerCase()); + }, + + //ends with value + ends: function ends(cell, value, parameters) { + if (value === "" || value === null || typeof value === "undefined") { + return true; + } + return String(value).toLowerCase().endsWith(String(parameters).toLowerCase()); + }, + + //minimum string length + minLength: function minLength(cell, value, parameters) { + if (value === "" || value === null || typeof value === "undefined") { + return true; + } + return String(value).length >= parameters; + }, + + //maximum string length + maxLength: function maxLength(cell, value, parameters) { + if (value === "" || value === null || typeof value === "undefined") { + return true; + } + return String(value).length <= parameters; + }, + + //in provided value list + in: function _in(cell, value, parameters) { + if (value === "" || value === null || typeof value === "undefined") { + return true; + } + if (typeof parameters == "string") { + parameters = parameters.split("|"); + } + + return value === "" || parameters.indexOf(value) > -1; + }, + + //must match provided regex + regex: function regex(cell, value, parameters) { + if (value === "" || value === null || typeof value === "undefined") { + return true; + } + var reg = new RegExp(parameters); + + return reg.test(value); + }, + + //value must be unique in this column + unique: function unique(cell, value, parameters) { + if (value === "" || value === null || typeof value === "undefined") { + return true; + } + var unique = true; + + var cellData = cell.getData(); + var column = cell.getColumn()._getSelf(); + + this.table.rowManager.rows.forEach(function (row) { + var data = row.getData(); + + if (data !== cellData) { + if (value == column.getFieldValue(data)) { + unique = false; + } + } + }); + + return unique; + }, + + //must have a value + required: function required(cell, value, parameters) { + return value !== "" && value !== null && typeof value !== "undefined"; + } + }; + + Tabulator.prototype.registerModule("validate", Validate); + + return Tabulator; +}); \ No newline at end of file diff --git a/admin/js/vendors/tabulator/js/tabulator.min.js b/admin/js/vendors/tabulator/js/tabulator.min.js new file mode 100644 index 0000000..425389a --- /dev/null +++ b/admin/js/vendors/tabulator/js/tabulator.min.js @@ -0,0 +1 @@ +var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj};!function(global,factory){"object"===("undefined"==typeof exports?"undefined":_typeof(exports))&&"undefined"!=typeof module?module.exports=factory():"function"==typeof define&&define.amd?define(factory):global.Tabulator=factory()}(this,(function(){"use strict";Array.prototype.findIndex||Object.defineProperty(Array.prototype,"findIndex",{value:function value(predicate){if(null==this)throw new TypeError('"this" is null or not defined');var o=Object(this),len=o.length>>>0;if("function"!=typeof predicate)throw new TypeError("predicate must be a function");for(var thisArg=arguments[1],k=0;k>>0;if("function"!=typeof predicate)throw new TypeError("predicate must be a function");for(var thisArg=arguments[1],k=0;k>>0;if(0===len)return!1;var n=0|fromIndex,k=Math.max(n>=0?n:len-Math.abs(n),0);function sameValueZero(x,y){return x===y||"number"==typeof x&&"number"==typeof y&&isNaN(x)&&isNaN(y)}for(;kscrollWidth?(hozAdjust=left-scrollWidth,this.element.style.marginLeft=-hozAdjust+"px"):this.element.style.marginLeft=0,this.scrollLeft=left,this.table.modExists("frozenColumns")&&this.table.modules.frozenColumns.scrollHorizontal()},ColumnManager.prototype.generateColumnsFromRowData=function(data){var cols=[],row,sorter;if(data&&data.length){for(var key in row=data[0]){var col={field:key,title:key},value=row[key];switch(void 0===value?"undefined":_typeof(value)){case"undefined":sorter="string";break;case"boolean":sorter="boolean";break;case"object":sorter=Array.isArray(value)?"array":"string";break;default:sorter=isNaN(value)||""===value?value.match(/((^[0-9]+[a-z]+)|(^[a-z]+[0-9]+))+$/i)?"alphanum":"string":"number"}col.sorter=sorter,cols.push(col)}this.table.options.columns=cols,this.setColumns(this.table.options.columns)}},ColumnManager.prototype.setColumns=function(cols,row){for(var self=this;self.headersElement.firstChild;)self.headersElement.removeChild(self.headersElement.firstChild);self.columns=[],self.columnsByIndex=[],self.columnsByField={},self.table.modExists("frozenColumns")&&self.table.modules.frozenColumns.reset(),cols.forEach((function(def,i){self._addColumn(def)})),self._reIndexColumns(),self.table.options.responsiveLayout&&self.table.modExists("responsiveLayout",!0)&&self.table.modules.responsiveLayout.initialize(),self.redraw(!0)},ColumnManager.prototype._addColumn=function(definition,before,nextToColumn){var column=new Column(definition,this),colEl=column.getElement(),index=nextToColumn?this.findColumnIndex(nextToColumn):nextToColumn;if(nextToColumn&&index>-1){var parentIndex=this.columns.indexOf(nextToColumn.getTopColumn()),nextEl=nextToColumn.getElement();before?(this.columns.splice(parentIndex,0,column),nextEl.parentNode.insertBefore(colEl,nextEl)):(this.columns.splice(parentIndex+1,0,column),nextEl.parentNode.insertBefore(colEl,nextEl.nextSibling))}else before?(this.columns.unshift(column),this.headersElement.insertBefore(column.getElement(),this.headersElement.firstChild)):(this.columns.push(column),this.headersElement.appendChild(column.getElement())),column.columnRendered();return column},ColumnManager.prototype.registerColumnField=function(col){col.definition.field&&(this.columnsByField[col.definition.field]=col)},ColumnManager.prototype.registerColumnPosition=function(col){this.columnsByIndex.push(col)},ColumnManager.prototype._reIndexColumns=function(){this.columnsByIndex=[],this.columns.forEach((function(column){column.reRegisterPosition()}))},ColumnManager.prototype._verticalAlignHeaders=function(){var self=this,minHeight=0;self.columns.forEach((function(column){var height;column.clearVerticalAlign(),(height=column.getHeight())>minHeight&&(minHeight=height)})),self.columns.forEach((function(column){column.verticalAlign(self.table.options.columnHeaderVertAlign,minHeight)})),self.rowManager.adjustTableSize()},ColumnManager.prototype.findColumn=function(subject){var self=this,match;return"object"!=(void 0===subject?"undefined":_typeof(subject))?this.columnsByField[subject]||!1:subject instanceof Column?subject:subject instanceof ColumnComponent?subject._getSelf()||!1:"undefined"!=typeof HTMLElement&&subject instanceof HTMLElement&&this.columns.find((function(column){return column.element===subject}))||!1},ColumnManager.prototype.getColumnByField=function(field){return this.columnsByField[field]},ColumnManager.prototype.getColumnsByFieldRoot=function(root){var _this=this,matches=[];return Object.keys(this.columnsByField).forEach((function(field){var fieldRoot;field.split(".")[0]===root&&matches.push(_this.columnsByField[field])})),matches},ColumnManager.prototype.getColumnByIndex=function(index){return this.columnsByIndex[index]},ColumnManager.prototype.getFirstVisibileColumn=function(index){var index;return(index=this.columnsByIndex.findIndex((function(col){return col.visible})))>-1&&this.columnsByIndex[index]},ColumnManager.prototype.getColumns=function(){return this.columns},ColumnManager.prototype.findColumnIndex=function(column){return this.columnsByIndex.findIndex((function(col){return column===col}))},ColumnManager.prototype.getRealColumns=function(){return this.columnsByIndex},ColumnManager.prototype.traverse=function(callback){var self=this;this.columnsByIndex.forEach((function(column,i){callback(column,i)}))},ColumnManager.prototype.getDefinitions=function(active){var self=this,output=[];return this.columnsByIndex.forEach((function(column){(!active||active&&column.visible)&&output.push(column.getDefinition())})),output},ColumnManager.prototype.getDefinitionTree=function(){var self=this,output=[];return this.columns.forEach((function(column){output.push(column.getDefinition(!0))})),output},ColumnManager.prototype.getComponents=function(structured){var self=this,output=[],columns;return(structured?this.columns:this.columnsByIndex).forEach((function(column){output.push(column.getComponent())})),output},ColumnManager.prototype.getWidth=function(){var width=0;return this.columnsByIndex.forEach((function(column){column.visible&&(width+=column.getWidth())})),width},ColumnManager.prototype.moveColumn=function(from,to,after){this.moveColumnActual(from,to,after),this.table.options.responsiveLayout&&this.table.modExists("responsiveLayout",!0)&&this.table.modules.responsiveLayout.initialize(),this.table.modExists("columnCalcs")&&this.table.modules.columnCalcs.recalc(this.table.rowManager.activeRows),to.element.parentNode.insertBefore(from.element,to.element),after&&to.element.parentNode.insertBefore(to.element,from.element),this._verticalAlignHeaders(),this.table.rowManager.reinitialize()},ColumnManager.prototype.moveColumnActual=function(from,to,after){from.parent.isGroup?this._moveColumnInArray(from.parent.columns,from,to,after):this._moveColumnInArray(this.columns,from,to,after),this._moveColumnInArray(this.columnsByIndex,from,to,after,!0),this.table.options.responsiveLayout&&this.table.modExists("responsiveLayout",!0)&&this.table.modules.responsiveLayout.initialize(),this.table.options.columnMoved&&this.table.options.columnMoved.call(this.table,from.getComponent(),this.table.columnManager.getComponents()),this.table.options.persistence&&this.table.modExists("persistence",!0)&&this.table.modules.persistence.config.columns&&this.table.modules.persistence.save("columns")},ColumnManager.prototype._moveColumnInArray=function(columns,from,to,after,updateRows){var fromIndex=columns.indexOf(from),toIndex;fromIndex>-1&&(columns.splice(fromIndex,1),(toIndex=columns.indexOf(to))>-1?after&&(toIndex+=1):toIndex=fromIndex,columns.splice(toIndex,0,from),updateRows&&this.table.rowManager.rows.forEach((function(row){if(row.cells.length){var cell=row.cells.splice(fromIndex,1)[0];row.cells.splice(toIndex,0,cell)}})))},ColumnManager.prototype.scrollToColumn=function(column,position,ifVisible){var _this2=this,left=0,offset=0,adjust=0,colEl=column.getElement();return new Promise((function(resolve,reject){if(void 0===position&&(position=_this2.table.options.scrollToColumnPosition),void 0===ifVisible&&(ifVisible=_this2.table.options.scrollToColumnIfVisible),column.visible){switch(position){case"middle":case"center":adjust=-_this2.element.clientWidth/2;break;case"right":adjust=colEl.clientWidth-_this2.headersElement.clientWidth}if(!ifVisible&&(offset=colEl.offsetLeft)>0&&offset+colEl.offsetWidth<_this2.element.clientWidth)return!1;left=colEl.offsetLeft+_this2.element.scrollLeft+adjust,left=Math.max(Math.min(left,_this2.table.rowManager.element.scrollWidth-_this2.table.rowManager.element.clientWidth),0),_this2.table.rowManager.scrollHorizontal(left),_this2.scrollHorizontal(left),resolve()}else console.warn("Scroll Error - Column not visible"),reject("Scroll Error - Column not visible")}))},ColumnManager.prototype.generateCells=function(row){var self=this,cells=[];return this.columnsByIndex.forEach((function(column){cells.push(column.generateCell(row))})),cells},ColumnManager.prototype.getFlexBaseWidth=function(){var self=this,totalWidth=self.table.element.clientWidth,fixedWidth=0;return self.rowManager.element.scrollHeight>self.rowManager.element.clientHeight&&(totalWidth-=self.rowManager.element.offsetWidth-self.rowManager.element.clientWidth),this.columnsByIndex.forEach((function(column){var width,minWidth,colWidth;column.visible&&(width=column.definition.width||0,minWidth=void 0===column.minWidth?self.table.options.columnMinWidth:parseInt(column.minWidth),colWidth="string"==typeof width?width.indexOf("%")>-1?totalWidth/100*parseInt(width):parseInt(width):width,fixedWidth+=colWidth>minWidth?colWidth:minWidth)})),fixedWidth},ColumnManager.prototype.addColumn=function(definition,before,nextToColumn){var _this3=this;return new Promise((function(resolve,reject){var column=_this3._addColumn(definition,before,nextToColumn);_this3._reIndexColumns(),_this3.table.options.responsiveLayout&&_this3.table.modExists("responsiveLayout",!0)&&_this3.table.modules.responsiveLayout.initialize(),_this3.table.modExists("columnCalcs")&&_this3.table.modules.columnCalcs.recalc(_this3.table.rowManager.activeRows),_this3.redraw(),"fitColumns"!=_this3.table.modules.layout.getMode()&&column.reinitializeWidth(),_this3._verticalAlignHeaders(),_this3.table.rowManager.reinitialize(),resolve(column)}))},ColumnManager.prototype.deregisterColumn=function(column){var field=column.getField(),index;field&&delete this.columnsByField[field],(index=this.columnsByIndex.indexOf(column))>-1&&this.columnsByIndex.splice(index,1),(index=this.columns.indexOf(column))>-1&&this.columns.splice(index,1),this.table.options.responsiveLayout&&this.table.modExists("responsiveLayout",!0)&&this.table.modules.responsiveLayout.initialize(),this.redraw()},ColumnManager.prototype.redraw=function(force){force&&(Tabulator.prototype.helpers.elVisible(this.element)&&this._verticalAlignHeaders(),this.table.rowManager.resetScroll(),this.table.rowManager.reinitialize()),["fitColumns","fitDataStretch"].indexOf(this.table.modules.layout.getMode())>-1?this.table.modules.layout.layout():force?this.table.modules.layout.layout():this.table.options.responsiveLayout&&this.table.modExists("responsiveLayout",!0)&&this.table.modules.responsiveLayout.update(),this.table.modExists("frozenColumns")&&this.table.modules.frozenColumns.layout(),this.table.modExists("columnCalcs")&&this.table.modules.columnCalcs.recalc(this.table.rowManager.activeRows),force&&(this.table.options.persistence&&this.table.modExists("persistence",!0)&&this.table.modules.persistence.config.columns&&this.table.modules.persistence.save("columns"),this.table.modExists("columnCalcs")&&this.table.modules.columnCalcs.redraw()),this.table.footerManager.redraw()};var ColumnComponent=function ColumnComponent(column){this._column=column,this.type="ColumnComponent"};ColumnComponent.prototype.getElement=function(){return this._column.getElement()},ColumnComponent.prototype.getDefinition=function(){return this._column.getDefinition()},ColumnComponent.prototype.getField=function(){return this._column.getField()},ColumnComponent.prototype.getCells=function(){var cells=[];return this._column.cells.forEach((function(cell){cells.push(cell.getComponent())})),cells},ColumnComponent.prototype.getVisibility=function(){return console.warn("getVisibility function is deprecated, you should now use the isVisible function"),this._column.visible},ColumnComponent.prototype.isVisible=function(){return this._column.visible},ColumnComponent.prototype.show=function(){this._column.isGroup?this._column.columns.forEach((function(column){column.show()})):this._column.show()},ColumnComponent.prototype.hide=function(){this._column.isGroup?this._column.columns.forEach((function(column){column.hide()})):this._column.hide()},ColumnComponent.prototype.toggle=function(){this._column.visible?this.hide():this.show()},ColumnComponent.prototype.delete=function(){return this._column.delete()},ColumnComponent.prototype.getSubColumns=function(){var output=[];return this._column.columns.length&&this._column.columns.forEach((function(column){output.push(column.getComponent())})),output},ColumnComponent.prototype.getParentColumn=function(){return this._column.parent instanceof Column&&this._column.parent.getComponent()},ColumnComponent.prototype._getSelf=function(){return this._column},ColumnComponent.prototype.scrollTo=function(){return this._column.table.columnManager.scrollToColumn(this._column)},ColumnComponent.prototype.getTable=function(){return this._column.table},ColumnComponent.prototype.headerFilterFocus=function(){this._column.table.modExists("filter",!0)&&this._column.table.modules.filter.setHeaderFilterFocus(this._column)},ColumnComponent.prototype.reloadHeaderFilter=function(){this._column.table.modExists("filter",!0)&&this._column.table.modules.filter.reloadHeaderFilter(this._column)},ColumnComponent.prototype.getHeaderFilterValue=function(){if(this._column.table.modExists("filter",!0))return this._column.table.modules.filter.getHeaderFilterValue(this._column)},ColumnComponent.prototype.setHeaderFilterValue=function(value){this._column.table.modExists("filter",!0)&&this._column.table.modules.filter.setHeaderFilterValue(this._column,value)},ColumnComponent.prototype.move=function(to,after){var toColumn=this._column.table.columnManager.findColumn(to);toColumn?this._column.table.columnManager.moveColumn(this._column,toColumn,after):console.warn("Move Error - No matching column found:",toColumn)},ColumnComponent.prototype.getNextColumn=function(){var nextCol=this._column.nextColumn();return!!nextCol&&nextCol.getComponent()},ColumnComponent.prototype.getPrevColumn=function(){var prevCol=this._column.prevColumn();return!!prevCol&&prevCol.getComponent()},ColumnComponent.prototype.updateDefinition=function(updates){return this._column.updateDefinition(updates)},ColumnComponent.prototype.getWidth=function(){return this._column.getWidth()},ColumnComponent.prototype.setWidth=function(width){return!0===width?this._column.reinitializeWidth(!0):this._column.setWidth(width)},ColumnComponent.prototype.validate=function(){return this._column.validate()};var Column=function Column(def,parent){var self=this;this.table=parent.table,this.definition=def,this.parent=parent,this.type="column",this.columns=[],this.cells=[],this.element=this.createElement(),this.contentElement=!1,this.titleElement=!1,this.groupElement=this.createGroupElement(),this.isGroup=!1,this.tooltip=!1,this.hozAlign="",this.vertAlign="",this.field="",this.fieldStructure="",this.getFieldValue="",this.setFieldValue="",this.titleFormatterRendered=!1,this.setField(this.definition.field),this.table.options.invalidOptionWarnings&&this.checkDefinition(),this.modules={},this.cellEvents={cellClick:!1,cellDblClick:!1,cellContext:!1,cellTap:!1,cellDblTap:!1,cellTapHold:!1,cellMouseEnter:!1,cellMouseLeave:!1,cellMouseOver:!1,cellMouseOut:!1,cellMouseMove:!1},this.width=null,this.widthStyled="",this.minWidth=null,this.minWidthStyled="",this.widthFixed=!1,this.visible=!0,this.component=null,this._mapDepricatedFunctionality(),def.columns?(this.isGroup=!0,def.columns.forEach((function(def,i){var newCol=new Column(def,self);self.attachColumn(newCol)})),self.checkColumnVisibility()):parent.registerColumnField(this),def.rowHandle&&!1!==this.table.options.movableRows&&this.table.modExists("moveRow")&&this.table.modules.moveRow.setHandle(!0),this._buildHeader(),this.bindModuleColumns()};Column.prototype.createElement=function(){var el=document.createElement("div");return el.classList.add("tabulator-col"),el.setAttribute("role","columnheader"),el.setAttribute("aria-sort","none"),el},Column.prototype.createGroupElement=function(){var el=document.createElement("div");return el.classList.add("tabulator-col-group-cols"),el},Column.prototype.checkDefinition=function(){var _this4=this;Object.keys(this.definition).forEach((function(key){-1===_this4.defaultOptionList.indexOf(key)&&console.warn("Invalid column definition option in '"+(_this4.field||_this4.definition.title)+"' column:",key)}))},Column.prototype.setField=function(field){this.field=field,this.fieldStructure=field?this.table.options.nestedFieldSeparator?field.split(this.table.options.nestedFieldSeparator):[field]:[],this.getFieldValue=this.fieldStructure.length>1?this._getNestedData:this._getFlatData,this.setFieldValue=this.fieldStructure.length>1?this._setNestedData:this._setFlatData},Column.prototype.registerColumnPosition=function(column){this.parent.registerColumnPosition(column)},Column.prototype.registerColumnField=function(column){this.parent.registerColumnField(column)},Column.prototype.reRegisterPosition=function(){this.isGroup?this.columns.forEach((function(column){column.reRegisterPosition()})):this.registerColumnPosition(this)},Column.prototype._mapDepricatedFunctionality=function(){void 0!==this.definition.hideInHtml&&(this.definition.htmlOutput=!this.definition.hideInHtml,console.warn("hideInHtml column definition property is deprecated, you should now use htmlOutput")),void 0!==this.definition.align&&(this.definition.hozAlign=this.definition.align,console.warn("align column definition property is deprecated, you should now use hozAlign")),void 0!==this.definition.downloadTitle&&(this.definition.titleDownload=this.definition.downloadTitle,console.warn("downloadTitle definition property is deprecated, you should now use titleDownload"))},Column.prototype.setTooltip=function(){var self=this,def=self.definition,tooltip=def.headerTooltip||!1===def.tooltip?def.headerTooltip:self.table.options.tooltipsHeader;tooltip?!0===tooltip?def.field?self.table.modules.localize.bind("columns|"+def.field,(function(value){self.element.setAttribute("title",value||def.title)})):self.element.setAttribute("title",def.title):("function"==typeof tooltip&&!1===(tooltip=tooltip(self.getComponent()))&&(tooltip=""),self.element.setAttribute("title",tooltip)):self.element.setAttribute("title","")},Column.prototype._buildHeader=function(){for(var self=this,def=self.definition;self.element.firstChild;)self.element.removeChild(self.element.firstChild);def.headerVertical&&(self.element.classList.add("tabulator-col-vertical"),"flip"===def.headerVertical&&self.element.classList.add("tabulator-col-vertical-flip")),self.contentElement=self._bindEvents(),self.contentElement=self._buildColumnHeaderContent(),self.element.appendChild(self.contentElement),self.isGroup?self._buildGroupHeader():self._buildColumnHeader(),self.setTooltip(),self.table.options.resizableColumns&&self.table.modExists("resizeColumns")&&self.table.modules.resizeColumns.initializeColumn("header",self,self.element),def.headerFilter&&self.table.modExists("filter")&&self.table.modExists("edit")&&(void 0!==def.headerFilterPlaceholder&&def.field&&self.table.modules.localize.setHeaderFilterColumnPlaceholder(def.field,def.headerFilterPlaceholder),self.table.modules.filter.initializeColumn(self)),self.table.modExists("frozenColumns")&&self.table.modules.frozenColumns.initializeColumn(self),self.table.options.movableColumns&&!self.isGroup&&self.table.modExists("moveColumn")&&self.table.modules.moveColumn.initializeColumn(self),(def.topCalc||def.bottomCalc)&&self.table.modExists("columnCalcs")&&self.table.modules.columnCalcs.initializeColumn(self),self.table.modExists("persistence")&&self.table.modules.persistence.config.columns&&self.table.modules.persistence.initializeColumn(self),self.element.addEventListener("mouseenter",(function(e){self.setTooltip()}))},Column.prototype._bindEvents=function(){var self=this,def=self.definition,dblTap,tapHold,tap;"function"==typeof def.headerClick&&self.element.addEventListener("click",(function(e){def.headerClick(e,self.getComponent())})),"function"==typeof def.headerDblClick&&self.element.addEventListener("dblclick",(function(e){def.headerDblClick(e,self.getComponent())})),"function"==typeof def.headerContext&&self.element.addEventListener("contextmenu",(function(e){def.headerContext(e,self.getComponent())})),"function"==typeof def.headerTap&&(tap=!1,self.element.addEventListener("touchstart",(function(e){tap=!0}),{passive:!0}),self.element.addEventListener("touchend",(function(e){tap&&def.headerTap(e,self.getComponent()),tap=!1}))),"function"==typeof def.headerDblTap&&(dblTap=null,self.element.addEventListener("touchend",(function(e){dblTap?(clearTimeout(dblTap),dblTap=null,def.headerDblTap(e,self.getComponent())):dblTap=setTimeout((function(){clearTimeout(dblTap),dblTap=null}),300)}))),"function"==typeof def.headerTapHold&&(tapHold=null,self.element.addEventListener("touchstart",(function(e){clearTimeout(tapHold),tapHold=setTimeout((function(){clearTimeout(tapHold),tapHold=null,tap=!1,def.headerTapHold(e,self.getComponent())}),1e3)}),{passive:!0}),self.element.addEventListener("touchend",(function(e){clearTimeout(tapHold),tapHold=null}))),"function"==typeof def.cellClick&&(self.cellEvents.cellClick=def.cellClick),"function"==typeof def.cellDblClick&&(self.cellEvents.cellDblClick=def.cellDblClick),"function"==typeof def.cellContext&&(self.cellEvents.cellContext=def.cellContext),"function"==typeof def.cellMouseEnter&&(self.cellEvents.cellMouseEnter=def.cellMouseEnter),"function"==typeof def.cellMouseLeave&&(self.cellEvents.cellMouseLeave=def.cellMouseLeave),"function"==typeof def.cellMouseOver&&(self.cellEvents.cellMouseOver=def.cellMouseOver),"function"==typeof def.cellMouseOut&&(self.cellEvents.cellMouseOut=def.cellMouseOut),"function"==typeof def.cellMouseMove&&(self.cellEvents.cellMouseMove=def.cellMouseMove),"function"==typeof def.cellTap&&(self.cellEvents.cellTap=def.cellTap),"function"==typeof def.cellDblTap&&(self.cellEvents.cellDblTap=def.cellDblTap),"function"==typeof def.cellTapHold&&(self.cellEvents.cellTapHold=def.cellTapHold),"function"==typeof def.cellEdited&&(self.cellEvents.cellEdited=def.cellEdited),"function"==typeof def.cellEditing&&(self.cellEvents.cellEditing=def.cellEditing),"function"==typeof def.cellEditCancelled&&(self.cellEvents.cellEditCancelled=def.cellEditCancelled)},Column.prototype._buildColumnHeader=function(){var self=this,def=self.definition,table=self.table,sortable,classeNames;(table.modExists("sort")&&table.modules.sort.initializeColumn(self,self.contentElement),(def.headerContextMenu||def.headerMenu)&&table.modExists("menu")&&table.modules.menu.initializeColumnHeader(self),table.modExists("format")&&table.modules.format.initializeColumn(self),void 0!==def.editor&&table.modExists("edit")&&table.modules.edit.initializeColumn(self),void 0!==def.validator&&table.modExists("validate")&&table.modules.validate.initializeColumn(self),table.modExists("mutator")&&table.modules.mutator.initializeColumn(self),table.modExists("accessor")&&table.modules.accessor.initializeColumn(self),_typeof(table.options.responsiveLayout)&&table.modExists("responsiveLayout")&&table.modules.responsiveLayout.initializeColumn(self),void 0!==def.visible&&(def.visible?self.show(!0):self.hide(!0)),def.cssClass)&&def.cssClass.split(" ").forEach((function(className){self.element.classList.add(className)}));def.field&&this.element.setAttribute("tabulator-field",def.field),self.setMinWidth(void 0===def.minWidth?self.table.options.columnMinWidth:parseInt(def.minWidth)),self.reinitializeWidth(),self.tooltip=self.definition.tooltip||!1===self.definition.tooltip?self.definition.tooltip:self.table.options.tooltips,self.hozAlign=void 0===self.definition.hozAlign?self.table.options.cellHozAlign:self.definition.hozAlign,self.vertAlign=void 0===self.definition.vertAlign?self.table.options.cellVertAlign:self.definition.vertAlign},Column.prototype._buildColumnHeaderContent=function(){var def=this.definition,table=this.table,contentElement=document.createElement("div");return contentElement.classList.add("tabulator-col-content"),this.titleElement=this._buildColumnHeaderTitle(),contentElement.appendChild(this.titleElement),contentElement},Column.prototype._buildColumnHeaderTitle=function(){var self=this,def=self.definition,table=self.table,title,titleHolderElement=document.createElement("div");if(titleHolderElement.classList.add("tabulator-col-title"),def.editableTitle){var titleElement=document.createElement("input");titleElement.classList.add("tabulator-title-editor"),titleElement.addEventListener("click",(function(e){e.stopPropagation(),titleElement.focus()})),titleElement.addEventListener("change",(function(){def.title=titleElement.value,table.options.columnTitleChanged.call(self.table,self.getComponent())})),titleHolderElement.appendChild(titleElement),def.field?table.modules.localize.bind("columns|"+def.field,(function(text){titleElement.value=text||def.title||" "})):titleElement.value=def.title||" "}else def.field?table.modules.localize.bind("columns|"+def.field,(function(text){self._formatColumnHeaderTitle(titleHolderElement,text||def.title||" ")})):self._formatColumnHeaderTitle(titleHolderElement,def.title||" ");return titleHolderElement},Column.prototype._formatColumnHeaderTitle=function(el,title){var _this5=this,formatter,contents,params,mockCell,onRendered;if(this.definition.titleFormatter&&this.table.modExists("format"))switch(formatter=this.table.modules.format.getFormatter(this.definition.titleFormatter),onRendered=function onRendered(callback){_this5.titleFormatterRendered=callback},mockCell={getValue:function getValue(){return title},getElement:function getElement(){return el}},params="function"==typeof(params=this.definition.titleFormatterParams||{})?params():params,void 0===(contents=formatter.call(this.table.modules.format,mockCell,params,onRendered))?"undefined":_typeof(contents)){case"object":contents instanceof Node?el.appendChild(contents):(el.innerHTML="",console.warn("Format Error - Title formatter has returned a type of object, the only valid formatter object return is an instance of Node, the formatter returned:",contents));break;case"undefined":case"null":el.innerHTML="";break;default:el.innerHTML=contents}else el.innerHTML=title},Column.prototype._buildGroupHeader=function(){var _this6=this,classeNames;(this.element.classList.add("tabulator-col-group"),this.element.setAttribute("role","columngroup"),this.element.setAttribute("aria-title",this.definition.title),this.definition.cssClass)&&this.definition.cssClass.split(" ").forEach((function(className){_this6.element.classList.add(className)}));(this.definition.headerContextMenu||this.definition.headerMenu)&&this.table.modExists("menu")&&this.table.modules.menu.initializeColumnHeader(this),this.element.appendChild(this.groupElement)},Column.prototype._getFlatData=function(data){return data[this.field]},Column.prototype._getNestedData=function(data){for(var dataObj=data,structure=this.fieldStructure,length=structure.length,output,_i=0;_i-1&&this._nextVisibleColumn(index+1)},Column.prototype._nextVisibleColumn=function(index){var column=this.table.columnManager.getColumnByIndex(index);return!column||column.visible?column:this._nextVisibleColumn(index+1)},Column.prototype.prevColumn=function(){var index=this.table.columnManager.findColumnIndex(this);return index>-1&&this._prevVisibleColumn(index-1)},Column.prototype._prevVisibleColumn=function(index){var column=this.table.columnManager.getColumnByIndex(index);return!column||column.visible?column:this._prevVisibleColumn(index-1)},Column.prototype.reinitializeWidth=function(force){this.widthFixed=!1,void 0===this.definition.width||force||this.setWidth(this.definition.width),this.table.modExists("filter")&&this.table.modules.filter.hideHeaderFilterElements(),this.fitToData(),this.table.modExists("filter")&&this.table.modules.filter.showHeaderFilterElements()},Column.prototype.fitToData=function(){var self=this;this.widthFixed||(this.element.style.width="",this.cells.forEach((function(cell){cell.clearWidth()})));var maxWidth=this.element.offsetWidth;this.width&&this.widthFixed||(this.cells.forEach((function(cell){var width=cell.getWidth();width>maxWidth&&(maxWidth=width)})),maxWidth&&this.setWidthActual(maxWidth+1))},Column.prototype.updateDefinition=function(updates){var _this8=this;return new Promise((function(resolve,reject){var definition;_this8.isGroup?(console.warn("Column Update Error - The updateDefintion function is only available on columns, not column groups"),reject("Column Update Error - The updateDefintion function is only available on columns, not column groups")):(definition=Object.assign({},_this8.getDefinition()),definition=Object.assign(definition,updates),_this8.table.columnManager.addColumn(definition,!1,_this8).then((function(column){definition.field==_this8.field&&(_this8.field=!1),_this8.delete().then((function(){resolve(column.getComponent())})).catch((function(err){reject(err)}))})).catch((function(err){reject(err)})))}))},Column.prototype.deleteCell=function(cell){var index=this.cells.indexOf(cell);index>-1&&this.cells.splice(index,1)},Column.prototype.defaultOptionList=["title","field","columns","visible","align","hozAlign","vertAlign","width","minWidth","widthGrow","widthShrink","resizable","frozen","responsive","tooltip","cssClass","rowHandle","hideInHtml","print","htmlOutput","sorter","sorterParams","formatter","formatterParams","variableHeight","editable","editor","editorParams","validator","mutator","mutatorParams","mutatorData","mutatorDataParams","mutatorEdit","mutatorEditParams","mutatorClipboard","mutatorClipboardParams","accessor","accessorParams","accessorData","accessorDataParams","accessorDownload","accessorDownloadParams","accessorClipboard","accessorClipboardParams","accessorPrint","accessorPrintParams","accessorHtmlOutput","accessorHtmlOutputParams","clipboard","download","downloadTitle","topCalc","topCalcParams","topCalcFormatter","topCalcFormatterParams","bottomCalc","bottomCalcParams","bottomCalcFormatter","bottomCalcFormatterParams","cellClick","cellDblClick","cellContext","cellTap","cellDblTap","cellTapHold","cellMouseEnter","cellMouseLeave","cellMouseOver","cellMouseOut","cellMouseMove","cellEditing","cellEdited","cellEditCancelled","headerSort","headerSortStartingDir","headerSortTristate","headerClick","headerDblClick","headerContext","headerTap","headerDblTap","headerTapHold","headerTooltip","headerVertical","editableTitle","titleFormatter","titleFormatterParams","headerFilter","headerFilterPlaceholder","headerFilterParams","headerFilterEmptyCheck","headerFilterFunc","headerFilterFuncParams","headerFilterLiveFilter","print","headerContextMenu","headerMenu","contextMenu","formatterPrint","formatterPrintParams","formatterClipboard","formatterClipboardParams","formatterHtmlOutput","formatterHtmlOutputParams","titlePrint","titleClipboard","titleHtmlOutput","titleDownload"],Column.prototype.getComponent=function(){return this.component||(this.component=new ColumnComponent(this)),this.component};var RowManager=function RowManager(table){this.table=table,this.element=this.createHolderElement(),this.tableElement=this.createTableElement(),this.heightFixer=this.createTableElement(),this.columnManager=null,this.height=0,this.firstRender=!1,this.renderMode="virtual",this.fixedHeight=!1,this.rows=[],this.activeRows=[],this.activeRowsCount=0,this.displayRows=[],this.displayRowsCount=0,this.scrollTop=0,this.scrollLeft=0,this.vDomRowHeight=20,this.vDomTop=0,this.vDomBottom=0,this.vDomScrollPosTop=0,this.vDomScrollPosBottom=0,this.vDomTopPad=0,this.vDomBottomPad=0,this.vDomMaxRenderChain=90,this.vDomWindowBuffer=0,this.vDomWindowMinTotalRows=20,this.vDomWindowMinMarginRows=5,this.vDomTopNewRows=[],this.vDomBottomNewRows=[],this.rowNumColumn=!1,this.redrawBlock=!1,this.redrawBlockRestoreConfig=!1,this.redrawBlockRederInPosition=!1};RowManager.prototype.createHolderElement=function(){var el=document.createElement("div");return el.classList.add("tabulator-tableHolder"),el.setAttribute("tabindex",0),el},RowManager.prototype.createTableElement=function(){var el=document.createElement("div");return el.classList.add("tabulator-table"),el},RowManager.prototype.getElement=function(){return this.element},RowManager.prototype.getTableElement=function(){return this.tableElement},RowManager.prototype.getRowPosition=function(row,active){return active?this.activeRows.indexOf(row):this.rows.indexOf(row)},RowManager.prototype.setColumnManager=function(manager){this.columnManager=manager},RowManager.prototype.initialize=function(){var self=this;self.setRenderMode(),self.element.appendChild(self.tableElement),self.firstRender=!0,self.element.addEventListener("scroll",(function(){var left=self.element.scrollLeft;self.scrollLeft!=left&&(self.columnManager.scrollHorizontal(left),self.table.options.groupBy&&self.table.modules.groupRows.scrollHeaders(left),self.table.modExists("columnCalcs")&&self.table.modules.columnCalcs.scrollHorizontal(left),self.table.options.scrollHorizontal(left)),self.scrollLeft=left})),"virtual"===this.renderMode&&self.element.addEventListener("scroll",(function(){var top=self.element.scrollTop,dir=self.scrollTop>top;self.scrollTop!=top?(self.scrollTop=top,self.scrollVertical(dir),"scroll"==self.table.options.ajaxProgressiveLoad&&self.table.modules.ajax.nextPage(self.element.scrollHeight-self.element.clientHeight-top),self.table.options.scrollVertical(top)):self.scrollTop=top}))},RowManager.prototype.findRow=function(subject){var self=this,_match,match;return"object"!=(void 0===subject?"undefined":_typeof(subject))?null!=subject&&(self.rows.find((function(row){return row.data[self.table.options.index]==subject}))||!1):subject instanceof Row?subject:subject instanceof RowComponent?subject._getSelf()||!1:"undefined"!=typeof HTMLElement&&subject instanceof HTMLElement&&self.rows.find((function(row){return row.element===subject}))||!1},RowManager.prototype.getRowFromDataObject=function(data){var match;return this.rows.find((function(row){return row.data===data}))||!1},RowManager.prototype.getRowFromPosition=function(position,active){return active?this.activeRows[position]:this.rows[position]},RowManager.prototype.scrollToRow=function(row,position,ifVisible){var _this9=this,rowIndex=this.getDisplayRows().indexOf(row),rowEl=row.getElement(),rowTop,offset=0;return new Promise((function(resolve,reject){if(rowIndex>-1){if(void 0===position&&(position=_this9.table.options.scrollToRowPosition),void 0===ifVisible&&(ifVisible=_this9.table.options.scrollToRowIfVisible),"nearest"===position)switch(_this9.renderMode){case"classic":rowTop=Tabulator.prototype.helpers.elOffset(rowEl).top,position=Math.abs(_this9.element.scrollTop-rowTop)>Math.abs(_this9.element.scrollTop+_this9.element.clientHeight-rowTop)?"bottom":"top";break;case"virtual":position=Math.abs(_this9.vDomTop-rowIndex)>Math.abs(_this9.vDomBottom-rowIndex)?"bottom":"top"}if(!ifVisible&&Tabulator.prototype.helpers.elVisible(rowEl)&&(offset=Tabulator.prototype.helpers.elOffset(rowEl).top-Tabulator.prototype.helpers.elOffset(_this9.element).top)>0&&offset<_this9.element.clientHeight-rowEl.offsetHeight)return!1;switch(_this9.renderMode){case"classic":_this9.element.scrollTop=Tabulator.prototype.helpers.elOffset(rowEl).top-Tabulator.prototype.helpers.elOffset(_this9.element).top+_this9.element.scrollTop;break;case"virtual":_this9._virtualRenderFill(rowIndex,!0)}switch(position){case"middle":case"center":_this9.element.scrollHeight-_this9.element.scrollTop==_this9.element.clientHeight?_this9.element.scrollTop=_this9.element.scrollTop+(rowEl.offsetTop-_this9.element.scrollTop)-(_this9.element.scrollHeight-rowEl.offsetTop)/2:_this9.element.scrollTop=_this9.element.scrollTop-_this9.element.clientHeight/2;break;case"bottom":_this9.element.scrollHeight-_this9.element.scrollTop==_this9.element.clientHeight?_this9.element.scrollTop=_this9.element.scrollTop-(_this9.element.scrollHeight-rowEl.offsetTop)+rowEl.offsetHeight:_this9.element.scrollTop=_this9.element.scrollTop-_this9.element.clientHeight+rowEl.offsetHeight}resolve()}else console.warn("Scroll Error - Row not visible"),reject("Scroll Error - Row not visible")}))},RowManager.prototype.setData=function(data,renderInPosition,columnsChanged){var _this10=this,self=this;return new Promise((function(resolve,reject){renderInPosition&&_this10.getDisplayRows().length?self.table.options.pagination?self._setDataActual(data,!0):_this10.reRenderInPosition((function(){self._setDataActual(data)})):(_this10.table.options.autoColumns&&columnsChanged&&_this10.table.columnManager.generateColumnsFromRowData(data),_this10.resetScroll(),_this10._setDataActual(data)),resolve()}))},RowManager.prototype._setDataActual=function(data,renderInPosition){var self=this;self.table.options.dataLoading.call(this.table,data),this._wipeElements(),this.table.options.history&&this.table.modExists("history")&&this.table.modules.history.clear(),Array.isArray(data)?(this.table.modExists("selectRow")&&this.table.modules.selectRow.clearSelectionData(),this.table.options.reactiveData&&this.table.modExists("reactiveData",!0)&&this.table.modules.reactiveData.watchData(data),data.forEach((function(def,i){if(def&&"object"===(void 0===def?"undefined":_typeof(def))){var row=new Row(def,self);self.rows.push(row)}else console.warn("Data Loading Warning - Invalid row data detected and ignored, expecting object but received:",def)})),self.table.options.dataLoaded.call(this.table,data),self.refreshActiveData(!1,!1,renderInPosition)):console.error("Data Loading Error - Unable to process data due to invalid data type \nExpecting: array \nReceived: ",void 0===data?"undefined":_typeof(data),"\nData: ",data)},RowManager.prototype._wipeElements=function(){this.rows.forEach((function(row){row.wipe()})),this.table.options.groupBy&&this.table.modExists("groupRows")&&this.table.modules.groupRows.wipe(),this.rows=[]},RowManager.prototype.deleteRow=function(row,blockRedraw){var allIndex=this.rows.indexOf(row),activeIndex=this.activeRows.indexOf(row);activeIndex>-1&&this.activeRows.splice(activeIndex,1),allIndex>-1&&this.rows.splice(allIndex,1),this.setActiveRows(this.activeRows),this.displayRowIterator((function(rows){var displayIndex=rows.indexOf(row);displayIndex>-1&&rows.splice(displayIndex,1)})),blockRedraw||this.reRenderInPosition(),this.regenerateRowNumbers(),this.table.options.rowDeleted.call(this.table,row.getComponent()),this.table.options.dataEdited.call(this.table,this.getData()),this.table.options.groupBy&&this.table.modExists("groupRows")?this.table.modules.groupRows.updateGroupRows(!0):this.table.options.pagination&&this.table.modExists("page")?this.refreshActiveData(!1,!1,!0):this.table.options.pagination&&this.table.modExists("page")&&this.refreshActiveData("page")},RowManager.prototype.addRow=function(data,pos,index,blockRedraw){var row=this.addRowActual(data,pos,index,blockRedraw);return this.table.options.history&&this.table.modExists("history")&&this.table.modules.history.action("rowAdd",row,{data:data,pos:pos,index:index}),row},RowManager.prototype.addRows=function(data,pos,index){var _this11=this,self=this,length=0,rows=[];return new Promise((function(resolve,reject){pos=_this11.findAddRowPos(pos),Array.isArray(data)||(data=[data]),length=data.length-1,(void 0===index&&pos||void 0!==index&&!pos)&&data.reverse(),data.forEach((function(item,i){var row=self.addRow(item,pos,index,!0);rows.push(row)})),_this11.table.options.groupBy&&_this11.table.modExists("groupRows")?_this11.table.modules.groupRows.updateGroupRows(!0):_this11.table.options.pagination&&_this11.table.modExists("page")?_this11.refreshActiveData(!1,!1,!0):_this11.reRenderInPosition(),_this11.table.modExists("columnCalcs")&&_this11.table.modules.columnCalcs.recalc(_this11.table.rowManager.activeRows),_this11.regenerateRowNumbers(),resolve(rows)}))},RowManager.prototype.findAddRowPos=function(pos){return void 0===pos&&(pos=this.table.options.addRowPos),"pos"===pos&&(pos=!0),"bottom"===pos&&(pos=!1),pos},RowManager.prototype.addRowActual=function(data,pos,index,blockRedraw){var row=data instanceof Row?data:new Row(data||{},this),top=this.findAddRowPos(pos),allIndex=-1,activeIndex,dispRows;if(!index&&this.table.options.pagination&&"page"==this.table.options.paginationAddRow&&(dispRows=this.getDisplayRows(),top?dispRows.length?index=dispRows[0]:this.activeRows.length&&(index=this.activeRows[this.activeRows.length-1],top=!1):dispRows.length&&(index=dispRows[dispRows.length-1],top=!(dispRows.length1&&(!index||index&&-1==groupRows.indexOf(index)?top?groupRows[0]!==row&&(index=groupRows[0],this._moveRowInArray(row.getGroup().rows,row,index,!top)):groupRows[groupRows.length-1]!==row&&(index=groupRows[groupRows.length-1],this._moveRowInArray(row.getGroup().rows,row,index,!top)):this._moveRowInArray(row.getGroup().rows,row,index,!top))}return index&&(allIndex=this.rows.indexOf(index)),index&&allIndex>-1?(activeIndex=this.activeRows.indexOf(index),this.displayRowIterator((function(rows){var displayIndex=rows.indexOf(index);displayIndex>-1&&rows.splice(top?displayIndex:displayIndex+1,0,row)})),activeIndex>-1&&this.activeRows.splice(top?activeIndex:activeIndex+1,0,row),this.rows.splice(top?allIndex:allIndex+1,0,row)):top?(this.displayRowIterator((function(rows){rows.unshift(row)})),this.activeRows.unshift(row),this.rows.unshift(row)):(this.displayRowIterator((function(rows){rows.push(row)})),this.activeRows.push(row),this.rows.push(row)),this.setActiveRows(this.activeRows),this.table.options.rowAdded.call(this.table,row.getComponent()),this.table.options.dataEdited.call(this.table,this.getData()),blockRedraw||this.reRenderInPosition(),row},RowManager.prototype.moveRow=function(from,to,after){this.table.options.history&&this.table.modExists("history")&&this.table.modules.history.action("rowMove",from,{posFrom:this.getRowPosition(from),posTo:this.getRowPosition(to),to:to,after:after}),this.moveRowActual(from,to,after),this.regenerateRowNumbers(),this.table.options.rowMoved.call(this.table,from.getComponent())},RowManager.prototype.moveRowActual=function(from,to,after){var _this12=this;if(this._moveRowInArray(this.rows,from,to,after),this._moveRowInArray(this.activeRows,from,to,after),this.displayRowIterator((function(rows){_this12._moveRowInArray(rows,from,to,after)})),this.table.options.groupBy&&this.table.modExists("groupRows")){!after&&to instanceof Group&&(to=this.table.rowManager.prevDisplayRow(from)||to);var toGroup=to.getGroup(),fromGroup=from.getGroup();toGroup===fromGroup?this._moveRowInArray(toGroup.rows,from,to,after):(fromGroup&&fromGroup.removeRow(from),toGroup.insertRow(from,to,after))}},RowManager.prototype._moveRowInArray=function(rows,from,to,after){var fromIndex,toIndex,start,end;if(from!==to&&((fromIndex=rows.indexOf(from))>-1&&(rows.splice(fromIndex,1),(toIndex=rows.indexOf(to))>-1?after?rows.splice(toIndex+1,0,from):rows.splice(toIndex,0,from):rows.splice(fromIndex,0,from)),rows===this.getDisplayRows())){end=toIndex>fromIndex?toIndex:fromIndex+1;for(var _i4=start=fromIndex-1&&index},RowManager.prototype.nextDisplayRow=function(row,rowOnly){var index=this.getDisplayRowIndex(row),nextRow=!1;return!1!==index&&index-1)&&rowIndex},RowManager.prototype.getData=function(active,transform){var output=[],rows;return this.getRows(active).forEach((function(row){"row"==row.type&&output.push(row.getData(transform||"data"))})),output},RowManager.prototype.getComponents=function(active){var output=[],rows;return this.getRows(active).forEach((function(row){output.push(row.getComponent())})),output},RowManager.prototype.getDataCount=function(active){var rows;return this.getRows(active).length},RowManager.prototype._genRemoteRequest=function(){var _this13=this,table=this.table,options=table.options,params={};if(table.modExists("page")){if(options.ajaxSorting){var sorters=this.table.modules.sort.getSort();sorters.forEach((function(item){delete item.column})),params[this.table.modules.page.paginationDataSentNames.sorters]=sorters}if(options.ajaxFiltering){var filters=this.table.modules.filter.getFilters(!0,!0);params[this.table.modules.page.paginationDataSentNames.filters]=filters}this.table.modules.ajax.setParams(params,!0)}table.modules.ajax.sendRequest().then((function(data){_this13._setDataActual(data,!0)})).catch((function(e){}))},RowManager.prototype.filterRefresh=function(){var table=this.table,options=table.options,left=this.scrollLeft;options.ajaxFiltering?"remote"==options.pagination&&table.modExists("page")?(table.modules.page.reset(!0),table.modules.page.setPage(1).then((function(){})).catch((function(){}))):options.ajaxProgressiveLoad?table.modules.ajax.loadData().then((function(){})).catch((function(){})):this._genRemoteRequest():this.refreshActiveData("filter"),this.scrollHorizontal(left)},RowManager.prototype.sorterRefresh=function(loadOrignalData){var table=this.table,options=this.table.options,left=this.scrollLeft;options.ajaxSorting?("remote"==options.pagination||options.progressiveLoad)&&table.modExists("page")?(table.modules.page.reset(!0),table.modules.page.setPage(1).then((function(){})).catch((function(){}))):options.ajaxProgressiveLoad?table.modules.ajax.loadData().then((function(){})).catch((function(){})):this._genRemoteRequest():this.refreshActiveData(loadOrignalData?"filter":"sort"),this.scrollHorizontal(left)},RowManager.prototype.scrollHorizontal=function(left){this.scrollLeft=left,this.element.scrollLeft=left,this.table.options.groupBy&&this.table.modules.groupRows.scrollHeaders(left),this.table.modExists("columnCalcs")&&this.table.modules.columnCalcs.scrollHorizontal(left)},RowManager.prototype.refreshActiveData=function(stage,skipStage,renderInPosition){var self=this,table=this.table,cascadeOrder=["all","filter","sort","display","freeze","group","tree","page"],displayIndex;if(this.redrawBlock)(!this.redrawBlockRestoreConfig||cascadeOrder.indexOf(stage)=0))break;bottomRow=i}else if(topEdge-rows[i].getElement().offsetTop>=0)topRow=i;else{if(topFound=!0,!(bottomEdge-rows[i].getElement().offsetTop>=0))break;bottomRow=i}}else topRow=this.vDomTop,bottomRow=this.vDomBottom;return rows.slice(topRow,bottomRow+1)},RowManager.prototype.displayRowIterator=function(callback){this.displayRows.forEach(callback),this.displayRowsCount=this.displayRows[this.displayRows.length-1].length},RowManager.prototype.getRows=function(active){var rows;switch(active){case"active":rows=this.activeRows;break;case"display":rows=this.table.rowManager.getDisplayRows();break;case"visible":rows=this.getVisibleRows(!0);break;default:rows=this.rows}return rows},RowManager.prototype.reRenderInPosition=function(callback){if("virtual"==this.getRenderMode())if(this.redrawBlock)callback?callback():this.redrawBlockRederInPosition=!0;else{for(var scrollTop=this.element.scrollTop,topRow=!1,topOffset=!1,left=this.scrollLeft,rows=this.getDisplayRows(),i=this.vDomTop;i<=this.vDomBottom;i++)if(rows[i]){var diff=scrollTop-rows[i].getElement().offsetTop;if(!(!1===topOffset||Math.abs(diff)this.vDomWindowBuffer&&(this.vDomWindowBuffer=2*rowHeight),"group"!==row.type&&(onlyGroupHeaders=!1),this.vDomBottom++,i++}position?(this.vDomTopPad=forceMove?this.vDomRowHeight*this.vDomTop+offset:this.scrollTop-topPadHeight,this.vDomBottomPad=this.vDomBottom==this.displayRowsCount-1?0:Math.max(this.vDomScrollHeight-this.vDomTopPad-rowsHeight-topPadHeight,0)):(this.vDomTopPad=0,this.vDomRowHeight=Math.floor((rowsHeight+topPadHeight)/i),this.vDomBottomPad=this.vDomRowHeight*(this.displayRowsCount-this.vDomBottom-1),this.vDomScrollHeight=topPadHeight+rowsHeight+this.vDomBottomPad-this.height),element.style.paddingTop=this.vDomTopPad+"px",element.style.paddingBottom=this.vDomBottomPad+"px",forceMove&&(this.scrollTop=this.vDomTopPad+topPadHeight+offset-(this.element.scrollWidth>this.element.clientWidth?this.element.offsetHeight-this.element.clientHeight:0)),this.scrollTop=Math.min(this.scrollTop,this.element.scrollHeight-this.height),this.element.scrollWidth>this.element.offsetWidth&&forceMove&&(this.scrollTop+=this.element.offsetHeight-this.element.clientHeight),this.vDomScrollPosTop=this.scrollTop,this.vDomScrollPosBottom=this.scrollTop,holder.scrollTop=this.scrollTop,element.style.minWidth=onlyGroupHeaders?this.table.columnManager.getWidth()+"px":"",this.table.options.groupBy&&"fitDataFill"!=this.table.modules.layout.getMode()&&this.displayRowsCount==this.table.modules.groupRows.countGroups()&&(this.tableElement.style.minWidth=this.table.columnManager.getWidth())}else this.renderEmptyScroll();this.fixedHeight||this.adjustTableSize()},RowManager.prototype.scrollVertical=function(dir){var topDiff=this.scrollTop-this.vDomScrollPosTop,bottomDiff=this.scrollTop-this.vDomScrollPosBottom,margin=2*this.vDomWindowBuffer;if(-topDiff>margin||bottomDiff>margin){var left=this.scrollLeft;this._virtualRenderFill(Math.floor(this.element.scrollTop/this.element.scrollHeight*this.displayRowsCount)),this.scrollHorizontal(left)}else dir?(topDiff<0&&this._addTopRow(-topDiff),bottomDiff<0&&(this.vDomScrollHeight-this.scrollTop>this.vDomWindowBuffer?this._removeBottomRow(-bottomDiff):this.vDomScrollPosBottom=this.scrollTop)):(topDiff>=0&&(this.scrollTop>this.vDomWindowBuffer?this._removeTopRow(topDiff):this.vDomScrollPosTop=this.scrollTop),bottomDiff>=0&&this._addBottomRow(bottomDiff))},RowManager.prototype._addTopRow=function(topDiff){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,table=this.tableElement,rows=this.getDisplayRows();if(this.vDomTop){var index=this.vDomTop-1,topRow=rows[index],topRowHeight=topRow.getHeight()||this.vDomRowHeight;topDiff>=topRowHeight&&(this.styleRow(topRow,index),table.insertBefore(topRow.getElement(),table.firstChild),topRow.initialized&&topRow.heightInitialized||(this.vDomTopNewRows.push(topRow),topRow.heightInitialized||topRow.clearCellHeight()),topRow.initialize(),this.vDomTopPad-=topRowHeight,this.vDomTopPad<0&&(this.vDomTopPad=index*this.vDomRowHeight),index||(this.vDomTopPad=0),table.style.paddingTop=this.vDomTopPad+"px",this.vDomScrollPosTop-=topRowHeight,this.vDomTop--),topDiff=-(this.scrollTop-this.vDomScrollPosTop),topRow.getHeight()>this.vDomWindowBuffer&&(this.vDomWindowBuffer=2*topRow.getHeight()),i=(rows[this.vDomTop-1].getHeight()||this.vDomRowHeight)?this._addTopRow(topDiff,i+1):this._quickNormalizeRowHeight(this.vDomTopNewRows)}},RowManager.prototype._removeTopRow=function(topDiff){var table=this.tableElement,topRow=this.getDisplayRows()[this.vDomTop],topRowHeight=topRow.getHeight()||this.vDomRowHeight;if(topDiff>=topRowHeight){var rowEl=topRow.getElement();rowEl.parentNode.removeChild(rowEl),this.vDomTopPad+=topRowHeight,table.style.paddingTop=this.vDomTopPad+"px",this.vDomScrollPosTop+=this.vDomTop?topRowHeight:topRowHeight+this.vDomWindowBuffer,this.vDomTop++,topDiff=this.scrollTop-this.vDomScrollPosTop,this._removeTopRow(topDiff)}},RowManager.prototype._addBottomRow=function(bottomDiff){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,table=this.tableElement,rows=this.getDisplayRows();if(this.vDomBottom=bottomRowHeight&&(this.styleRow(bottomRow,index),table.appendChild(bottomRow.getElement()),bottomRow.initialized&&bottomRow.heightInitialized||(this.vDomBottomNewRows.push(bottomRow),bottomRow.heightInitialized||bottomRow.clearCellHeight()),bottomRow.initialize(),this.vDomBottomPad-=bottomRowHeight,(this.vDomBottomPad<0||index==this.displayRowsCount-1)&&(this.vDomBottomPad=0),table.style.paddingBottom=this.vDomBottomPad+"px",this.vDomScrollPosBottom+=bottomRowHeight,this.vDomBottom++),bottomDiff=this.scrollTop-this.vDomScrollPosBottom,bottomRow.getHeight()>this.vDomWindowBuffer&&(this.vDomWindowBuffer=2*bottomRow.getHeight()),i=(rows[this.vDomBottom+1].getHeight()||this.vDomRowHeight)?this._addBottomRow(bottomDiff,i+1):this._quickNormalizeRowHeight(this.vDomBottomNewRows)}},RowManager.prototype._removeBottomRow=function(bottomDiff){var table=this.tableElement,bottomRow=this.getDisplayRows()[this.vDomBottom],bottomRowHeight=bottomRow.getHeight()||this.vDomRowHeight;if(bottomDiff>=bottomRowHeight){var rowEl=bottomRow.getElement();rowEl.parentNode&&rowEl.parentNode.removeChild(rowEl),this.vDomBottomPad+=bottomRowHeight,this.vDomBottomPad<0&&(this.vDomBottomPad=0),table.style.paddingBottom=this.vDomBottomPad+"px",this.vDomScrollPosBottom-=bottomRowHeight,this.vDomBottom--,bottomDiff=-(this.scrollTop-this.vDomScrollPosBottom),this._removeBottomRow(bottomDiff)}},RowManager.prototype._quickNormalizeRowHeight=function(rows){rows.forEach((function(row){row.calcHeight()})),rows.forEach((function(row){row.setCellHeight()})),rows.length=0},RowManager.prototype.normalizeHeight=function(){this.activeRows.forEach((function(row){row.normalizeHeight()}))},RowManager.prototype.adjustTableSize=function(){var initialHeight=this.element.clientHeight,modExists;if("virtual"===this.renderMode){var otherHeight=this.columnManager.getElement().offsetHeight+(this.table.footerManager&&!this.table.footerManager.external?this.table.footerManager.getElement().offsetHeight:0);this.fixedHeight?(this.element.style.minHeight="calc(100% - "+otherHeight+"px)",this.element.style.height="calc(100% - "+otherHeight+"px)",this.element.style.maxHeight="calc(100% - "+otherHeight+"px)"):(this.element.style.height="",this.element.style.height=this.table.element.clientHeight-otherHeight+"px",this.element.scrollTop=this.scrollTop),this.height=this.element.clientHeight,this.vDomWindowBuffer=this.table.options.virtualDomBuffer||this.height,this.fixedHeight||initialHeight==this.element.clientHeight||((modExists=this.table.modExists("resizeTable"))&&!this.table.modules.resizeTable.autoResize||!modExists)&&this.redraw()}},RowManager.prototype.reinitialize=function(){this.rows.forEach((function(row){row.reinitialize()}))},RowManager.prototype.blockRedraw=function(){this.redrawBlock=!0,this.redrawBlockRestoreConfig=!1},RowManager.prototype.restoreRedraw=function(){this.redrawBlock=!1,this.redrawBlockRestoreConfig?(this.refreshActiveData(this.redrawBlockRestoreConfig.stage,this.redrawBlockRestoreConfig.skipStage,this.redrawBlockRestoreConfig.renderInPosition),this.redrawBlockRestoreConfig=!1):this.redrawBlockRederInPosition&&this.reRenderInPosition(),this.redrawBlockRederInPosition=!1},RowManager.prototype.redraw=function(force){var pos=0,left=this.scrollLeft;this.adjustTableSize(),this.table.tableWidth=this.table.element.clientWidth,force?this.renderTable():("classic"==this.renderMode?this.table.options.groupBy?this.refreshActiveData("group",!1,!1):this._simpleRender():(this.reRenderInPosition(),this.scrollHorizontal(left)),this.displayRowsCount||this.table.options.placeholder&&this.getElement().appendChild(this.table.options.placeholder))},RowManager.prototype.resetScroll=function(){if(this.element.scrollLeft=0,this.element.scrollTop=0,"ie"===this.table.browser){var event=document.createEvent("Event");event.initEvent("scroll",!1,!0),this.element.dispatchEvent(event)}else this.element.dispatchEvent(new Event("scroll"))};var RowComponent=function RowComponent(row){this._row=row};RowComponent.prototype.getData=function(transform){return this._row.getData(transform)},RowComponent.prototype.getElement=function(){return this._row.getElement()},RowComponent.prototype.getCells=function(){var cells=[];return this._row.getCells().forEach((function(cell){cells.push(cell.getComponent())})),cells},RowComponent.prototype.getCell=function(column){var cell=this._row.getCell(column);return!!cell&&cell.getComponent()},RowComponent.prototype.getIndex=function(){return this._row.getData("data")[this._row.table.options.index]},RowComponent.prototype.getPosition=function(active){return this._row.table.rowManager.getRowPosition(this._row,active)},RowComponent.prototype.delete=function(){return this._row.delete()},RowComponent.prototype.scrollTo=function(){return this._row.table.rowManager.scrollToRow(this._row)},RowComponent.prototype.pageTo=function(){if(this._row.table.modExists("page",!0))return this._row.table.modules.page.setPageToRow(this._row)},RowComponent.prototype.move=function(to,after){this._row.moveToRow(to,after)},RowComponent.prototype.update=function(data){return this._row.updateData(data)},RowComponent.prototype.normalizeHeight=function(){this._row.normalizeHeight(!0)},RowComponent.prototype.select=function(){this._row.table.modules.selectRow.selectRows(this._row)},RowComponent.prototype.deselect=function(){this._row.table.modules.selectRow.deselectRows(this._row)},RowComponent.prototype.toggleSelect=function(){this._row.table.modules.selectRow.toggleRow(this._row)},RowComponent.prototype.isSelected=function(){return this._row.table.modules.selectRow.isRowSelected(this._row)},RowComponent.prototype._getSelf=function(){return this._row},RowComponent.prototype.validate=function(){return this._row.validate()},RowComponent.prototype.freeze=function(){this._row.table.modExists("frozenRows",!0)&&this._row.table.modules.frozenRows.freezeRow(this._row)},RowComponent.prototype.unfreeze=function(){this._row.table.modExists("frozenRows",!0)&&this._row.table.modules.frozenRows.unfreezeRow(this._row)},RowComponent.prototype.isFrozen=function(){var index;return!!this._row.table.modExists("frozenRows",!0)&&this._row.table.modules.frozenRows.rows.indexOf(this._row)>-1},RowComponent.prototype.treeCollapse=function(){this._row.table.modExists("dataTree",!0)&&this._row.table.modules.dataTree.collapseRow(this._row)},RowComponent.prototype.treeExpand=function(){this._row.table.modExists("dataTree",!0)&&this._row.table.modules.dataTree.expandRow(this._row)},RowComponent.prototype.treeToggle=function(){this._row.table.modExists("dataTree",!0)&&this._row.table.modules.dataTree.toggleRow(this._row)},RowComponent.prototype.getTreeParent=function(){return!!this._row.table.modExists("dataTree",!0)&&this._row.table.modules.dataTree.getTreeParent(this._row)},RowComponent.prototype.getTreeChildren=function(){return!!this._row.table.modExists("dataTree",!0)&&this._row.table.modules.dataTree.getTreeChildren(this._row)},RowComponent.prototype.addTreeChild=function(data,pos,index){return!!this._row.table.modExists("dataTree",!0)&&this._row.table.modules.dataTree.addTreeChildRow(this._row,data,pos,index)},RowComponent.prototype.reformat=function(){return this._row.reinitialize()},RowComponent.prototype.getGroup=function(){return this._row.getGroup().getComponent()},RowComponent.prototype.getTable=function(){return this._row.table},RowComponent.prototype.getNextRow=function(){var row=this._row.nextRow();return row?row.getComponent():row},RowComponent.prototype.getPrevRow=function(){var row=this._row.prevRow();return row?row.getComponent():row};var Row=function Row(data,parent){var type=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"row";this.table=parent.table,this.parent=parent,this.data={},this.type=type,this.element=this.createElement(),this.modules={},this.cells=[],this.height=0,this.heightStyled="",this.manualHeight=!1,this.outerHeight=0,this.initialized=!1,this.heightInitialized=!1,this.component=null,this.setData(data),this.generateElement()};Row.prototype.createElement=function(){var el=document.createElement("div");return el.classList.add("tabulator-row"),el.setAttribute("role","row"),el},Row.prototype.getElement=function(){return this.element},Row.prototype.detachElement=function(){this.element&&this.element.parentNode&&this.element.parentNode.removeChild(this.element)},Row.prototype.generateElement=function(){var self=this,dblTap,tapHold,tap;!1!==self.table.options.selectable&&self.table.modExists("selectRow")&&self.table.modules.selectRow.initializeRow(this),!1!==self.table.options.movableRows&&self.table.modExists("moveRow")&&self.table.modules.moveRow.initializeRow(this),!1!==self.table.options.dataTree&&self.table.modExists("dataTree")&&self.table.modules.dataTree.initializeRow(this),"collapse"===self.table.options.responsiveLayout&&self.table.modExists("responsiveLayout")&&self.table.modules.responsiveLayout.initializeRow(this),self.table.options.rowContextMenu&&this.table.modExists("menu")&&self.table.modules.menu.initializeRow(this),self.table.options.rowClick&&self.element.addEventListener("click",(function(e){self.table.options.rowClick(e,self.getComponent())})),self.table.options.rowDblClick&&self.element.addEventListener("dblclick",(function(e){self.table.options.rowDblClick(e,self.getComponent())})),self.table.options.rowContext&&self.element.addEventListener("contextmenu",(function(e){self.table.options.rowContext(e,self.getComponent())})),self.table.options.rowMouseEnter&&self.element.addEventListener("mouseenter",(function(e){self.table.options.rowMouseEnter(e,self.getComponent())})),self.table.options.rowMouseLeave&&self.element.addEventListener("mouseleave",(function(e){self.table.options.rowMouseLeave(e,self.getComponent())})),self.table.options.rowMouseOver&&self.element.addEventListener("mouseover",(function(e){self.table.options.rowMouseOver(e,self.getComponent())})),self.table.options.rowMouseOut&&self.element.addEventListener("mouseout",(function(e){self.table.options.rowMouseOut(e,self.getComponent())})),self.table.options.rowMouseMove&&self.element.addEventListener("mousemove",(function(e){self.table.options.rowMouseMove(e,self.getComponent())})),self.table.options.rowTap&&(tap=!1,self.element.addEventListener("touchstart",(function(e){tap=!0}),{passive:!0}),self.element.addEventListener("touchend",(function(e){tap&&self.table.options.rowTap(e,self.getComponent()),tap=!1}))),self.table.options.rowDblTap&&(dblTap=null,self.element.addEventListener("touchend",(function(e){dblTap?(clearTimeout(dblTap),dblTap=null,self.table.options.rowDblTap(e,self.getComponent())):dblTap=setTimeout((function(){clearTimeout(dblTap),dblTap=null}),300)}))),self.table.options.rowTapHold&&(tapHold=null,self.element.addEventListener("touchstart",(function(e){clearTimeout(tapHold),tapHold=setTimeout((function(){clearTimeout(tapHold),tapHold=null,tap=!1,self.table.options.rowTapHold(e,self.getComponent())}),1e3)}),{passive:!0}),self.element.addEventListener("touchend",(function(e){clearTimeout(tapHold),tapHold=null})))},Row.prototype.generateCells=function(){this.cells=this.table.columnManager.generateCells(this)},Row.prototype.initialize=function(force){var self=this;if(!self.initialized||force){for(self.deleteCells();self.element.firstChild;)self.element.removeChild(self.element.firstChild);this.table.modExists("frozenColumns")&&this.table.modules.frozenColumns.layoutRow(this),this.generateCells(),self.cells.forEach((function(cell){self.element.appendChild(cell.getElement()),cell.cellRendered()})),force&&self.normalizeHeight(),self.table.options.dataTree&&self.table.modExists("dataTree")&&self.table.modules.dataTree.layoutRow(this),"collapse"===self.table.options.responsiveLayout&&self.table.modExists("responsiveLayout")&&self.table.modules.responsiveLayout.layoutRow(this),self.table.options.rowFormatter&&self.table.options.rowFormatter(self.getComponent()),self.table.options.resizableRows&&self.table.modExists("resizeRows")&&self.table.modules.resizeRows.initializeRow(self),self.initialized=!0}},Row.prototype.reinitializeHeight=function(){this.heightInitialized=!1,null!==this.element.offsetParent&&this.normalizeHeight(!0)},Row.prototype.reinitialize=function(){this.initialized=!1,this.heightInitialized=!1,this.manualHeight||(this.height=0,this.heightStyled=""),null!==this.element.offsetParent&&this.initialize(!0)},Row.prototype.calcHeight=function(force){var maxHeight=0,minHeight=this.table.options.resizableRows?this.element.clientHeight:0;this.cells.forEach((function(cell){var height=cell.getHeight();height>maxHeight&&(maxHeight=height)})),this.height=force?Math.max(maxHeight,minHeight):this.manualHeight?this.height:Math.max(maxHeight,minHeight),this.heightStyled=this.height?this.height+"px":"",this.outerHeight=this.element.offsetHeight},Row.prototype.setCellHeight=function(){this.cells.forEach((function(cell){cell.setHeight()})),this.heightInitialized=!0},Row.prototype.clearCellHeight=function(){this.cells.forEach((function(cell){cell.clearHeight()}))},Row.prototype.normalizeHeight=function(force){force&&this.clearCellHeight(),this.calcHeight(force),this.setCellHeight()},Row.prototype.setHeight=function(height,force){(this.height!=height||force)&&(this.manualHeight=!0,this.height=height,this.heightStyled=height?height+"px":"",this.setCellHeight(),this.outerHeight=this.element.offsetHeight)},Row.prototype.getHeight=function(){return this.outerHeight},Row.prototype.getWidth=function(){return this.element.offsetWidth},Row.prototype.deleteCell=function(cell){var index=this.cells.indexOf(cell);index>-1&&this.cells.splice(index,1)},Row.prototype.setData=function(data){this.table.modExists("mutator")&&(data=this.table.modules.mutator.transformRow(data,"data")),this.data=data,this.table.options.reactiveData&&this.table.modExists("reactiveData",!0)&&this.table.modules.reactiveData.watchRow(this)},Row.prototype.updateData=function(updatedData){var _this15=this,visible=Tabulator.prototype.helpers.elVisible(this.element),tempData={},newRowData;return new Promise((function(resolve,reject){for(var attrname in"string"==typeof updatedData&&(updatedData=JSON.parse(updatedData)),_this15.table.options.reactiveData&&_this15.table.modExists("reactiveData",!0)&&_this15.table.modules.reactiveData.block(),_this15.table.modExists("mutator")?(tempData=Object.assign(tempData,_this15.data),tempData=Object.assign(tempData,updatedData),newRowData=_this15.table.modules.mutator.transformRow(tempData,"data",updatedData)):newRowData=updatedData,newRowData)_this15.data[attrname]=newRowData[attrname];for(var attrname in _this15.table.options.reactiveData&&_this15.table.modExists("reactiveData",!0)&&_this15.table.modules.reactiveData.unblock(),updatedData){var columns;_this15.table.columnManager.getColumnsByFieldRoot(attrname).forEach((function(column){var cell=_this15.getCell(column.getField());if(cell){var value=column.getFieldValue(newRowData);cell.getValue()!=value&&(cell.setValueProcessData(value),visible&&cell.cellRendered())}}))}visible?(_this15.normalizeHeight(!0),_this15.table.options.rowFormatter&&_this15.table.options.rowFormatter(_this15.getComponent())):(_this15.initialized=!1,_this15.height=0,_this15.heightStyled=""),!1!==_this15.table.options.dataTree&&_this15.table.modExists("dataTree")&&_this15.table.modules.dataTree.redrawNeeded(updatedData)&&(_this15.table.modules.dataTree.initializeRow(_this15),_this15.table.modules.dataTree.layoutRow(_this15),_this15.table.rowManager.refreshActiveData("tree",!1,!0)),_this15.table.options.rowUpdated.call(_this15.table,_this15.getComponent()),resolve()}))},Row.prototype.getData=function(transform){var self=this;return transform?this.table.modExists("accessor")?this.table.modules.accessor.transformRow(this.data,transform):void 0:this.data},Row.prototype.getCell=function(column){var match=!1;return column=this.table.columnManager.findColumn(column),match=this.cells.find((function(cell){return cell.column===column}))},Row.prototype.getCellIndex=function(findCell){return this.cells.findIndex((function(cell){return cell===findCell}))},Row.prototype.findNextEditableCell=function(index){var nextCell=!1;if(index0)for(var i=index-1;i>=0;i--){var cell=this.cells[i],allowEdit=!0;if(cell.column.modules.edit&&Tabulator.prototype.helpers.elVisible(cell.getElement())&&("function"==typeof cell.column.modules.edit.check&&(allowEdit=cell.column.modules.edit.check(cell.getComponent())),allowEdit)){prevCell=cell;break}}return prevCell},Row.prototype.getCells=function(){return this.cells},Row.prototype.nextRow=function(){var row;return this.table.rowManager.nextDisplayRow(this,!0)||!1},Row.prototype.prevRow=function(){var row;return this.table.rowManager.prevDisplayRow(this,!0)||!1},Row.prototype.moveToRow=function(to,before){var toRow=this.table.rowManager.findRow(to);toRow?(this.table.rowManager.moveRowActual(this,toRow,!before),this.table.rowManager.refreshActiveData("display",!1,!0)):console.warn("Move Error - No matching row found:",to)},Row.prototype.validate=function(){var invalid=[];return this.cells.forEach((function(cell){cell.validate()||invalid.push(cell.getComponent())})),!invalid.length||invalid},Row.prototype.delete=function(){var _this16=this;return new Promise((function(resolve,reject){var index,rows;_this16.table.options.history&&_this16.table.modExists("history")&&(_this16.table.options.groupBy&&_this16.table.modExists("groupRows")?(index=(rows=_this16.getGroup().rows).indexOf(_this16))&&(index=rows[index-1]):(index=_this16.table.rowManager.getRowIndex(_this16))&&(index=_this16.table.rowManager.rows[index-1]),_this16.table.modules.history.action("rowDelete",_this16,{data:_this16.getData(),pos:!index,index:index})),_this16.deleteActual(),resolve()}))},Row.prototype.deleteActual=function(blockRedraw){var index=this.table.rowManager.getRowIndex(this);this.table.modExists("selectRow")&&this.table.modules.selectRow._deselectRow(this,!0),this.table.modExists("edit")&&this.table.modules.edit.currentCell.row===this&&this.table.modules.edit.cancelEdit(),this.table.options.reactiveData&&this.table.modExists("reactiveData",!0),this.modules.group&&this.modules.group.removeRow(this),this.table.rowManager.deleteRow(this,blockRedraw),this.deleteCells(),this.initialized=!1,this.heightInitialized=!1,this.table.options.dataTree&&this.table.modExists("dataTree",!0)&&this.table.modules.dataTree.rowDelete(this),this.table.modExists("columnCalcs")&&(this.table.options.groupBy&&this.table.modExists("groupRows")?this.table.modules.columnCalcs.recalcRowGroup(this):this.table.modules.columnCalcs.recalc(this.table.rowManager.activeRows))},Row.prototype.deleteCells=function(){for(var cellCount=this.cells.length,_i5=0;_i5-1?(this.browser="ie",this.browserSlow=!0):ua.indexOf("Edge")>-1?(this.browser="edge",this.browserSlow=!0):ua.indexOf("Firefox")>-1?(this.browser="firefox",this.browserSlow=!1):(this.browser="other",this.browserSlow=!1),this.browserMobile=/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino|android|ipad|playbook|silk/i.test(ua)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(ua.substr(0,4))},Tabulator.prototype.blockRedraw=function(){return this.rowManager.blockRedraw()},Tabulator.prototype.restoreRedraw=function(){return this.rowManager.restoreRedraw()},Tabulator.prototype.setDataFromLocalFile=function(extensions){var _this18=this;return new Promise((function(resolve,reject){var input=document.createElement("input");input.type="file",input.accept=extensions||".json,application/json",input.addEventListener("change",(function(e){var file=input.files[0],reader=new FileReader,data;reader.readAsText(file),reader.onload=function(e){try{data=JSON.parse(reader.result)}catch(e){return console.warn("File Load Error - File contents is invalid JSON",e),void reject(e)}_this18._setData(data).then((function(data){resolve(data)})).catch((function(err){resolve(err)}))},reader.onerror=function(e){console.warn("File Load Error - Unable to read file"),reject()}})),input.click()}))},Tabulator.prototype.setData=function(data,params,config){return this.modExists("ajax")&&this.modules.ajax.blockActiveRequest(),this._setData(data,params,config,!1,!0)},Tabulator.prototype._setData=function(data,params,config,inPosition,columnsChanged){var self=this;return"string"!=typeof data?data?this.rowManager.setData(data,inPosition,columnsChanged):this.modExists("ajax")&&(this.modules.ajax.getUrl||this.options.ajaxURLGenerator)?"remote"==this.options.pagination&&this.modExists("page",!0)?(this.modules.page.reset(!0,!0),this.modules.page.setPage(1)):this.modules.ajax.loadData(inPosition,columnsChanged):this.rowManager.setData([],inPosition,columnsChanged):0==data.indexOf("{")||0==data.indexOf("[")?this.rowManager.setData(JSON.parse(data),inPosition,columnsChanged):this.modExists("ajax",!0)?(params&&this.modules.ajax.setParams(params),config&&this.modules.ajax.setConfig(config),this.modules.ajax.setUrl(data),"remote"==this.options.pagination&&this.modExists("page",!0)?(this.modules.page.reset(!0,!0),this.modules.page.setPage(1)):this.modules.ajax.loadData(inPosition,columnsChanged)):void 0},Tabulator.prototype.clearData=function(){this.modExists("ajax")&&this.modules.ajax.blockActiveRequest(),this.rowManager.clearData()},Tabulator.prototype.getData=function(active){return!0===active&&(console.warn("passing a boolean to the getData function is deprecated, you should now pass the string 'active'"),active="active"),this.rowManager.getData(active)},Tabulator.prototype.getDataCount=function(active){return!0===active&&(console.warn("passing a boolean to the getDataCount function is deprecated, you should now pass the string 'active'"),active="active"),this.rowManager.getDataCount(active)},Tabulator.prototype.searchRows=function(field,type,value){if(this.modExists("filter",!0))return this.modules.filter.search("rows",field,type,value)},Tabulator.prototype.searchData=function(field,type,value){if(this.modExists("filter",!0))return this.modules.filter.search("data",field,type,value)},Tabulator.prototype.getHtml=function(visible,style,config){if(this.modExists("export",!0))return this.modules.export.getHtml(visible,style,config)},Tabulator.prototype.print=function(visible,style,config){if(this.modExists("print",!0))return this.modules.print.printFullscreen(visible,style,config)},Tabulator.prototype.getAjaxUrl=function(){if(this.modExists("ajax",!0))return this.modules.ajax.getUrl()},Tabulator.prototype.replaceData=function(data,params,config){return this.modExists("ajax")&&this.modules.ajax.blockActiveRequest(),this._setData(data,params,config,!0)},Tabulator.prototype.updateData=function(data){var _this19=this,self=this,responses=0;return new Promise((function(resolve,reject){_this19.modExists("ajax")&&_this19.modules.ajax.blockActiveRequest(),"string"==typeof data&&(data=JSON.parse(data)),data?data.forEach((function(item){var row=self.rowManager.findRow(item[self.options.index]);row&&(responses++,row.updateData(item).then((function(){--responses||resolve()})))})):(console.warn("Update Error - No data provided"),reject("Update Error - No data provided"))}))},Tabulator.prototype.addData=function(data,pos,index){var _this20=this;return new Promise((function(resolve,reject){_this20.modExists("ajax")&&_this20.modules.ajax.blockActiveRequest(),"string"==typeof data&&(data=JSON.parse(data)),data?_this20.rowManager.addRows(data,pos,index).then((function(rows){var output=[];rows.forEach((function(row){output.push(row.getComponent())})),resolve(output)})):(console.warn("Update Error - No data provided"),reject("Update Error - No data provided"))}))},Tabulator.prototype.updateOrAddData=function(data){var _this21=this,self=this,rows=[],responses=0;return new Promise((function(resolve,reject){_this21.modExists("ajax")&&_this21.modules.ajax.blockActiveRequest(),"string"==typeof data&&(data=JSON.parse(data)),data?data.forEach((function(item){var row=self.rowManager.findRow(item[self.options.index]);responses++,row?row.updateData(item).then((function(){responses--,rows.push(row.getComponent()),responses||resolve(rows)})):self.rowManager.addRows(item).then((function(newRows){responses--,rows.push(newRows[0].getComponent()),responses||resolve(rows)}))})):(console.warn("Update Error - No data provided"),reject("Update Error - No data provided"))}))},Tabulator.prototype.getRow=function(index){var row=this.rowManager.findRow(index);return row?row.getComponent():(console.warn("Find Error - No matching row found:",index),!1)},Tabulator.prototype.getRowFromPosition=function(position,active){var row=this.rowManager.getRowFromPosition(position,active);return row?row.getComponent():(console.warn("Find Error - No matching row found:",position),!1)},Tabulator.prototype.deleteRow=function(index){var _this22=this;return new Promise((function(resolve,reject){var self=_this22,count=0,successCount=0,foundRows=[];function doneCheck(){++count==index.length&&successCount&&(self.rowManager.reRenderInPosition(),resolve())}Array.isArray(index)||(index=[index]),index.forEach((function(item){var row=_this22.rowManager.findRow(item,!0);row?foundRows.push(row):(console.warn("Delete Error - No matching row found:",item),reject("Delete Error - No matching row found"),doneCheck())})),foundRows.sort((function(a,b){return _this22.rowManager.rows.indexOf(a)>_this22.rowManager.rows.indexOf(b)?1:-1})),foundRows.forEach((function(row){row.delete().then((function(){successCount++,doneCheck()})).catch((function(err){doneCheck(),reject(err)}))}))}))},Tabulator.prototype.addRow=function(data,pos,index){var _this23=this;return new Promise((function(resolve,reject){"string"==typeof data&&(data=JSON.parse(data)),_this23.rowManager.addRows(data,pos,index).then((function(rows){_this23.modExists("columnCalcs")&&_this23.modules.columnCalcs.recalc(_this23.rowManager.activeRows),resolve(rows[0].getComponent())}))}))},Tabulator.prototype.updateOrAddRow=function(index,data){var _this24=this;return new Promise((function(resolve,reject){var row=_this24.rowManager.findRow(index);"string"==typeof data&&(data=JSON.parse(data)),row?row.updateData(data).then((function(){_this24.modExists("columnCalcs")&&_this24.modules.columnCalcs.recalc(_this24.rowManager.activeRows),resolve(row.getComponent())})).catch((function(err){reject(err)})):row=_this24.rowManager.addRows(data).then((function(rows){_this24.modExists("columnCalcs")&&_this24.modules.columnCalcs.recalc(_this24.rowManager.activeRows),resolve(rows[0].getComponent())})).catch((function(err){reject(err)}))}))},Tabulator.prototype.updateRow=function(index,data){var _this25=this;return new Promise((function(resolve,reject){var row=_this25.rowManager.findRow(index);"string"==typeof data&&(data=JSON.parse(data)),row?row.updateData(data).then((function(){resolve(row.getComponent())})).catch((function(err){reject(err)})):(console.warn("Update Error - No matching row found:",index),reject("Update Error - No matching row found"))}))},Tabulator.prototype.scrollToRow=function(index,position,ifVisible){var _this26=this;return new Promise((function(resolve,reject){var row=_this26.rowManager.findRow(index);row?_this26.rowManager.scrollToRow(row,position,ifVisible).then((function(){resolve()})).catch((function(err){reject(err)})):(console.warn("Scroll Error - No matching row found:",index),reject("Scroll Error - No matching row found"))}))},Tabulator.prototype.moveRow=function(from,to,after){var fromRow=this.rowManager.findRow(from);fromRow?fromRow.moveToRow(to,after):console.warn("Move Error - No matching row found:",from)},Tabulator.prototype.getRows=function(active){return!0===active&&(console.warn("passing a boolean to the getRows function is deprecated, you should now pass the string 'active'"),active="active"),this.rowManager.getComponents(active)},Tabulator.prototype.getRowPosition=function(index,active){var row=this.rowManager.findRow(index);return row?this.rowManager.getRowPosition(row,active):(console.warn("Position Error - No matching row found:",index),!1)},Tabulator.prototype.copyToClipboard=function(selector){this.modExists("clipboard",!0)&&this.modules.clipboard.copy(selector)},Tabulator.prototype.setColumns=function(definition){this.columnManager.setColumns(definition)},Tabulator.prototype.getColumns=function(structured){return this.columnManager.getComponents(structured)},Tabulator.prototype.getColumn=function(field){var col=this.columnManager.findColumn(field);return col?col.getComponent():(console.warn("Find Error - No matching column found:",field),!1)},Tabulator.prototype.getColumnDefinitions=function(){return this.columnManager.getDefinitionTree()},Tabulator.prototype.getColumnLayout=function(){if(this.modExists("persistence",!0))return this.modules.persistence.parseColumns(this.columnManager.getColumns())},Tabulator.prototype.setColumnLayout=function(layout){return!!this.modExists("persistence",!0)&&(this.columnManager.setColumns(this.modules.persistence.mergeDefinition(this.options.columns,layout)),!0)},Tabulator.prototype.showColumn=function(field){var column=this.columnManager.findColumn(field);if(!column)return console.warn("Column Show Error - No matching column found:",field),!1;column.show(),this.options.responsiveLayout&&this.modExists("responsiveLayout",!0)&&this.modules.responsiveLayout.update()},Tabulator.prototype.hideColumn=function(field){var column=this.columnManager.findColumn(field);if(!column)return console.warn("Column Hide Error - No matching column found:",field),!1;column.hide(),this.options.responsiveLayout&&this.modExists("responsiveLayout",!0)&&this.modules.responsiveLayout.update()},Tabulator.prototype.toggleColumn=function(field){var column=this.columnManager.findColumn(field);if(!column)return console.warn("Column Visibility Toggle Error - No matching column found:",field),!1;column.visible?column.hide():column.show()},Tabulator.prototype.addColumn=function(definition,before,field){var _this27=this;return new Promise((function(resolve,reject){var column=_this27.columnManager.findColumn(field);_this27.columnManager.addColumn(definition,before,column).then((function(column){resolve(column.getComponent())})).catch((function(err){reject(err)}))}))},Tabulator.prototype.deleteColumn=function(field){var _this28=this;return new Promise((function(resolve,reject){var column=_this28.columnManager.findColumn(field);column?column.delete().then((function(){resolve()})).catch((function(err){reject(err)})):(console.warn("Column Delete Error - No matching column found:",field),reject())}))},Tabulator.prototype.updateColumnDefinition=function(field,definition){var _this29=this;return new Promise((function(resolve,reject){var column=_this29.columnManager.findColumn(field);column?column.updateDefinition(definition).then((function(col){resolve(col)})).catch((function(err){reject(err)})):(console.warn("Column Update Error - No matching column found:",field),reject())}))},Tabulator.prototype.moveColumn=function(from,to,after){var fromColumn=this.columnManager.findColumn(from),toColumn=this.columnManager.findColumn(to);fromColumn?toColumn?this.columnManager.moveColumn(fromColumn,toColumn,after):console.warn("Move Error - No matching column found:",toColumn):console.warn("Move Error - No matching column found:",from)},Tabulator.prototype.scrollToColumn=function(field,position,ifVisible){var _this30=this;return new Promise((function(resolve,reject){var column=_this30.columnManager.findColumn(field);column?_this30.columnManager.scrollToColumn(column,position,ifVisible).then((function(){resolve()})).catch((function(err){reject(err)})):(console.warn("Scroll Error - No matching column found:",field),reject("Scroll Error - No matching column found"))}))},Tabulator.prototype.setLocale=function(locale){this.modules.localize.setLocale(locale)},Tabulator.prototype.getLocale=function(){return this.modules.localize.getLocale()},Tabulator.prototype.getLang=function(locale){return this.modules.localize.getLang(locale)},Tabulator.prototype.redraw=function(force){this.columnManager.redraw(force),this.rowManager.redraw(force)},Tabulator.prototype.setHeight=function(height){"classic"!==this.rowManager.renderMode?(this.options.height=isNaN(height)?height:height+"px",this.element.style.height=this.options.height,this.rowManager.setRenderMode(),this.rowManager.redraw()):console.warn("setHeight function is not available in classic render mode")},Tabulator.prototype.setSort=function(sortList,dir){this.modExists("sort",!0)&&(this.modules.sort.setSort(sortList,dir),this.rowManager.sorterRefresh())},Tabulator.prototype.getSorters=function(){if(this.modExists("sort",!0))return this.modules.sort.getSort()},Tabulator.prototype.clearSort=function(){this.modExists("sort",!0)&&(this.modules.sort.clear(),this.rowManager.sorterRefresh())},Tabulator.prototype.setFilter=function(field,type,value,params){this.modExists("filter",!0)&&(this.modules.filter.setFilter(field,type,value,params),this.rowManager.filterRefresh())},Tabulator.prototype.addFilter=function(field,type,value,params){this.modExists("filter",!0)&&(this.modules.filter.addFilter(field,type,value,params),this.rowManager.filterRefresh())},Tabulator.prototype.getFilters=function(all){if(this.modExists("filter",!0))return this.modules.filter.getFilters(all)},Tabulator.prototype.setHeaderFilterFocus=function(field){if(this.modExists("filter",!0)){var column=this.columnManager.findColumn(field);if(!column)return console.warn("Column Filter Focus Error - No matching column found:",field),!1;this.modules.filter.setHeaderFilterFocus(column)}},Tabulator.prototype.getHeaderFilterValue=function(field){if(this.modExists("filter",!0)){var column=this.columnManager.findColumn(field);if(column)return this.modules.filter.getHeaderFilterValue(column);console.warn("Column Filter Error - No matching column found:",field)}},Tabulator.prototype.setHeaderFilterValue=function(field,value){if(this.modExists("filter",!0)){var column=this.columnManager.findColumn(field);if(!column)return console.warn("Column Filter Error - No matching column found:",field),!1;this.modules.filter.setHeaderFilterValue(column,value)}},Tabulator.prototype.getHeaderFilters=function(){if(this.modExists("filter",!0))return this.modules.filter.getHeaderFilters()},Tabulator.prototype.removeFilter=function(field,type,value){this.modExists("filter",!0)&&(this.modules.filter.removeFilter(field,type,value),this.rowManager.filterRefresh())},Tabulator.prototype.clearFilter=function(all){this.modExists("filter",!0)&&(this.modules.filter.clearFilter(all),this.rowManager.filterRefresh())},Tabulator.prototype.clearHeaderFilter=function(){this.modExists("filter",!0)&&(this.modules.filter.clearHeaderFilter(),this.rowManager.filterRefresh())},Tabulator.prototype.selectRow=function(rows){this.modExists("selectRow",!0)&&(!0===rows&&(console.warn("passing a boolean to the selectRowselectRow function is deprecated, you should now pass the string 'active'"),rows="active"),this.modules.selectRow.selectRows(rows))},Tabulator.prototype.deselectRow=function(rows){this.modExists("selectRow",!0)&&this.modules.selectRow.deselectRows(rows)},Tabulator.prototype.toggleSelectRow=function(row){this.modExists("selectRow",!0)&&this.modules.selectRow.toggleRow(row)},Tabulator.prototype.getSelectedRows=function(){if(this.modExists("selectRow",!0))return this.modules.selectRow.getSelectedRows()},Tabulator.prototype.getSelectedData=function(){if(this.modExists("selectRow",!0))return this.modules.selectRow.getSelectedData()},Tabulator.prototype.getInvalidCells=function(){if(this.modExists("validate",!0))return this.modules.validate.getInvalidCells()},Tabulator.prototype.clearCellValidation=function(cells){var _this31=this;this.modExists("validate",!0)&&(cells||(cells=this.modules.validate.getInvalidCells()),Array.isArray(cells)||(cells=[cells]),cells.forEach((function(cell){_this31.modules.validate.clearValidation(cell._getSelf())})))},Tabulator.prototype.validate=function(cells){var output=[];return this.rowManager.rows.forEach((function(row){var valid=row.validate();!0!==valid&&(output=output.concat(valid))})),!output.length||output},Tabulator.prototype.setMaxPage=function(max){if(!this.options.pagination||!this.modExists("page"))return!1;this.modules.page.setMaxPage(max)},Tabulator.prototype.setPage=function(page){return this.options.pagination&&this.modExists("page")?this.modules.page.setPage(page):new Promise((function(resolve,reject){reject()}))},Tabulator.prototype.setPageToRow=function(row){var _this32=this;return new Promise((function(resolve,reject){_this32.options.pagination&&_this32.modExists("page")&&(row=_this32.rowManager.findRow(row))?_this32.modules.page.setPageToRow(row).then((function(){resolve()})).catch((function(){reject()})):reject()}))},Tabulator.prototype.setPageSize=function(size){if(!this.options.pagination||!this.modExists("page"))return!1;this.modules.page.setPageSize(size),this.modules.page.setPage(1).then((function(){})).catch((function(){}))},Tabulator.prototype.getPageSize=function(){if(this.options.pagination&&this.modExists("page",!0))return this.modules.page.getPageSize()},Tabulator.prototype.previousPage=function(){if(!this.options.pagination||!this.modExists("page"))return!1;this.modules.page.previousPage()},Tabulator.prototype.nextPage=function(){if(!this.options.pagination||!this.modExists("page"))return!1;this.modules.page.nextPage()},Tabulator.prototype.getPage=function(){return!(!this.options.pagination||!this.modExists("page"))&&this.modules.page.getPage()},Tabulator.prototype.getPageMax=function(){return!(!this.options.pagination||!this.modExists("page"))&&this.modules.page.getPageMax()},Tabulator.prototype.setGroupBy=function(groups){if(!this.modExists("groupRows",!0))return!1;this.options.groupBy=groups,this.modules.groupRows.initialize(),this.rowManager.refreshActiveData("display"),this.options.persistence&&this.modExists("persistence",!0)&&this.modules.persistence.config.group&&this.modules.persistence.save("group")},Tabulator.prototype.setGroupStartOpen=function(values){if(!this.modExists("groupRows",!0))return!1;this.options.groupStartOpen=values,this.modules.groupRows.initialize(),this.options.groupBy?(this.rowManager.refreshActiveData("group"),this.options.persistence&&this.modExists("persistence",!0)&&this.modules.persistence.config.group&&this.modules.persistence.save("group")):console.warn("Grouping Update - cant refresh view, no groups have been set")},Tabulator.prototype.setGroupHeader=function(values){if(!this.modExists("groupRows",!0))return!1;this.options.groupHeader=values,this.modules.groupRows.initialize(),this.options.groupBy?(this.rowManager.refreshActiveData("group"),this.options.persistence&&this.modExists("persistence",!0)&&this.modules.persistence.config.group&&this.modules.persistence.save("group")):console.warn("Grouping Update - cant refresh view, no groups have been set")},Tabulator.prototype.getGroups=function(values){return!!this.modExists("groupRows",!0)&&this.modules.groupRows.getGroups(!0)},Tabulator.prototype.getGroupedData=function(){if(this.modExists("groupRows",!0))return this.options.groupBy?this.modules.groupRows.getGroupedData():this.getData()},Tabulator.prototype.getEditedCells=function(){if(this.modExists("edit",!0))return this.modules.edit.getEditedCells()},Tabulator.prototype.clearCellEdited=function(cells){var _this33=this;this.modExists("edit",!0)&&(cells||(cells=this.modules.edit.getEditedCells()),Array.isArray(cells)||(cells=[cells]),cells.forEach((function(cell){_this33.modules.edit.clearEdited(cell._getSelf())})))},Tabulator.prototype.getCalcResults=function(){return!!this.modExists("columnCalcs",!0)&&this.modules.columnCalcs.getResults()},Tabulator.prototype.recalc=function(){this.modExists("columnCalcs",!0)&&this.modules.columnCalcs.recalcAll(this.rowManager.activeRows)},Tabulator.prototype.navigatePrev=function(){var cell=!1;return!(!this.modExists("edit",!0)||!(cell=this.modules.edit.currentCell))&&cell.nav().prev()},Tabulator.prototype.navigateNext=function(){var cell=!1;return!(!this.modExists("edit",!0)||!(cell=this.modules.edit.currentCell))&&cell.nav().next()},Tabulator.prototype.navigateLeft=function(){var cell=!1;return!(!this.modExists("edit",!0)||!(cell=this.modules.edit.currentCell))&&(e.preventDefault(),cell.nav().left())},Tabulator.prototype.navigateRight=function(){var cell=!1;return!(!this.modExists("edit",!0)||!(cell=this.modules.edit.currentCell))&&(e.preventDefault(),cell.nav().right())},Tabulator.prototype.navigateUp=function(){var cell=!1;return!(!this.modExists("edit",!0)||!(cell=this.modules.edit.currentCell))&&(e.preventDefault(),cell.nav().up())},Tabulator.prototype.navigateDown=function(){var cell=!1;return!(!this.modExists("edit",!0)||!(cell=this.modules.edit.currentCell))&&(e.preventDefault(),cell.nav().down())},Tabulator.prototype.undo=function(){return!(!this.options.history||!this.modExists("history",!0))&&this.modules.history.undo()},Tabulator.prototype.redo=function(){return!(!this.options.history||!this.modExists("history",!0))&&this.modules.history.redo()},Tabulator.prototype.getHistoryUndoSize=function(){return!(!this.options.history||!this.modExists("history",!0))&&this.modules.history.getHistoryUndoSize()},Tabulator.prototype.getHistoryRedoSize=function(){return!(!this.options.history||!this.modExists("history",!0))&&this.modules.history.getHistoryRedoSize()},Tabulator.prototype.download=function(type,filename,options,active){this.modExists("download",!0)&&this.modules.download.download(type,filename,options,active)},Tabulator.prototype.downloadToTab=function(type,filename,options,active){this.modExists("download",!0)&&this.modules.download.download(type,filename,options,active,!0)},Tabulator.prototype.tableComms=function(table,module,action,data){this.modules.comms.receive(table,module,action,data)},Tabulator.prototype.moduleBindings={},Tabulator.prototype.extendModule=function(name,property,values){if(Tabulator.prototype.moduleBindings[name]){var source=Tabulator.prototype.moduleBindings[name].prototype[property];if(source)if("object"==(void 0===values?"undefined":_typeof(values)))for(var key in values)source[key]=values[key];else console.warn("Module Error - Invalid value type, it must be an object");else console.warn("Module Error - property does not exist:",property)}else console.warn("Module Error - module does not exist:",name)},Tabulator.prototype.registerModule=function(name,module){var self=this;Tabulator.prototype.moduleBindings[name]=module},Tabulator.prototype.bindModules=function(){for(var name in this.modules={},Tabulator.prototype.moduleBindings)this.modules[name]=new Tabulator.prototype.moduleBindings[name](this)},Tabulator.prototype.modExists=function(plugin,required){return!!this.modules[plugin]||(required&&console.error("Tabulator Module Not Installed: "+plugin),!1)},Tabulator.prototype.helpers={elVisible:function elVisible(el){return!(el.offsetWidth<=0&&el.offsetHeight<=0)},elOffset:function elOffset(el){var box=el.getBoundingClientRect();return{top:box.top+window.pageYOffset-document.documentElement.clientTop,left:box.left+window.pageXOffset-document.documentElement.clientLeft}},deepClone:function deepClone(obj){var clone=Array.isArray(obj)?[]:{};for(var i in obj)null!=obj[i]&&"object"===_typeof(obj[i])?obj[i]instanceof Date?clone[i]=new Date(obj[i]):clone[i]=this.deepClone(obj[i]):clone[i]=obj[i];return clone}},Tabulator.prototype.comms={tables:[],register:function register(table){Tabulator.prototype.comms.tables.push(table)},deregister:function deregister(table){var index=Tabulator.prototype.comms.tables.indexOf(table);index>-1&&Tabulator.prototype.comms.tables.splice(index,1)},lookupTable:function lookupTable(query,silent){var results=[],matches,match;if("string"==typeof query){if((matches=document.querySelectorAll(query)).length)for(var i=0;i0?lastCol.setWidth(gap):lastCol.reinitializeWidth()):this.table.options.responsiveLayout&&this.table.modExists("responsiveLayout",!0)&&this.table.modules.responsiveLayout.update()},fitColumns:function fitColumns(columns){var self=this,totalWidth=this.table.element.clientWidth,fixedWidth=0,flexWidth=0,flexGrowUnits=0,flexColWidth=0,flexColumns=[],fixedShrinkColumns=[],flexShrinkUnits=0,overflowWidth=0,gapFill=0;function calcWidth(width){var colWidth;return colWidth="string"==typeof width?width.indexOf("%")>-1?totalWidth/100*parseInt(width):parseInt(width):width}function scaleColumns(columns,freeSpace,colWidth,shrinkCols){var oversizeCols=[],oversizeSpace=0,remainingSpace=0,nextColWidth=0,gap=0,changeUnits=0,undersizeCols=[];function calcGrow(col){return colWidth*(col.column.definition.widthGrow||1)}function calcShrink(col){return calcWidth(col.width)-colWidth*(col.column.definition.widthShrink||0)}return columns.forEach((function(col,i){var width=shrinkCols?calcShrink(col):calcGrow(col);col.column.minWidth>=width?oversizeCols.push(col):(undersizeCols.push(col),changeUnits+=shrinkCols?col.column.definition.widthShrink||1:col.column.definition.widthGrow||1)})),oversizeCols.length?(oversizeCols.forEach((function(col){oversizeSpace+=shrinkCols?col.width-col.column.minWidth:col.column.minWidth,col.width=col.column.minWidth})),gap=(remainingSpace=freeSpace-oversizeSpace)-(nextColWidth=changeUnits?Math.floor(remainingSpace/changeUnits):remainingSpace)*changeUnits,gap+=scaleColumns(undersizeCols,remainingSpace,nextColWidth,shrinkCols)):(gap=changeUnits?freeSpace-Math.floor(freeSpace/changeUnits)*changeUnits:freeSpace,undersizeCols.forEach((function(column){column.width=shrinkCols?calcShrink(column):calcGrow(column)}))),gap}this.table.options.responsiveLayout&&this.table.modExists("responsiveLayout",!0)&&this.table.modules.responsiveLayout.update(),this.table.rowManager.element.scrollHeight>this.table.rowManager.element.clientHeight&&(totalWidth-=this.table.rowManager.element.offsetWidth-this.table.rowManager.element.clientWidth),columns.forEach((function(column){var width,minWidth,colWidth;column.visible&&(width=column.definition.width,minWidth=parseInt(column.minWidth),width?(colWidth=calcWidth(width),fixedWidth+=colWidth>minWidth?colWidth:minWidth,column.definition.widthShrink&&(fixedShrinkColumns.push({column:column,width:colWidth>minWidth?colWidth:minWidth}),flexShrinkUnits+=column.definition.widthShrink)):(flexColumns.push({column:column,width:0}),flexGrowUnits+=column.definition.widthGrow||1))})),flexWidth=totalWidth-fixedWidth,flexColWidth=Math.floor(flexWidth/flexGrowUnits);var gapFill=scaleColumns(flexColumns,flexWidth,flexColWidth,!1);flexColumns.length&&gapFill>0&&(flexColumns[flexColumns.length-1].width+=+gapFill),flexColumns.forEach((function(col){flexWidth-=col.width})),(overflowWidth=Math.abs(gapFill)+flexWidth)>0&&flexShrinkUnits&&(gapFill=scaleColumns(fixedShrinkColumns,overflowWidth,Math.floor(overflowWidth/flexShrinkUnits),!0)),fixedShrinkColumns.length&&(fixedShrinkColumns[fixedShrinkColumns.length-1].width-=gapFill),flexColumns.forEach((function(col){col.column.setWidth(col.width)})),fixedShrinkColumns.forEach((function(col){col.column.setWidth(col.width)}))}},Tabulator.prototype.registerModule("layout",Layout);var Localize=function Localize(table){this.table=table,this.locale="default",this.lang=!1,this.bindings={}};Localize.prototype.setHeaderFilterPlaceholder=function(placeholder){this.langs.default.headerFilters.default=placeholder},Localize.prototype.setHeaderFilterColumnPlaceholder=function(column,placeholder){this.langs.default.headerFilters.columns[column]=placeholder,this.lang&&!this.lang.headerFilters.columns[column]&&(this.lang.headerFilters.columns[column]=placeholder)},Localize.prototype.installLang=function(locale,lang){this.langs[locale]?this._setLangProp(this.langs[locale],lang):this.langs[locale]=lang},Localize.prototype._setLangProp=function(lang,values){for(var key in values)lang[key]&&"object"==_typeof(lang[key])?this._setLangProp(lang[key],values[key]):lang[key]=values[key]},Localize.prototype.setLocale=function(desiredLocale){var self=this;function traverseLang(trans,path){for(var prop in trans)"object"==_typeof(trans[prop])?(path[prop]||(path[prop]={}),traverseLang(trans[prop],path[prop])):path[prop]=trans[prop]}if(!0===(desiredLocale=desiredLocale||"default")&&navigator.language&&(desiredLocale=navigator.language.toLowerCase()),desiredLocale&&!this.langs[desiredLocale]){var prefix=desiredLocale.split("-")[0];this.langs[prefix]?(console.warn("Localization Error - Exact matching locale not found, using closest match: ",desiredLocale,prefix),desiredLocale=prefix):(console.warn("Localization Error - Matching locale not found, using default: ",desiredLocale),desiredLocale="default")}this.locale=desiredLocale,this.lang=Tabulator.prototype.helpers.deepClone(this.langs.default||{}),"default"!=desiredLocale&&traverseLang(this.langs[desiredLocale],this.lang),this.table.options.localized.call(this.table,this.locale,this.lang),this._executeBindings()},Localize.prototype.getLocale=function(locale){return self.locale},Localize.prototype.getLang=function(locale){return locale?this.langs[locale]:this.lang},Localize.prototype.getText=function(path,value){var path,pathArray=(path=value?path+"|"+value:path).split("|"),text;return this._getLangElement(pathArray,this.locale)||""},Localize.prototype._getLangElement=function(path,locale){var self=this,root=this.lang;return path.forEach((function(level){var rootPath;root&&(rootPath=root[level],root=void 0!==rootPath&&rootPath)})),root},Localize.prototype.bind=function(path,callback){this.bindings[path]||(this.bindings[path]=[]),this.bindings[path].push(callback),callback(this.getText(path),this.lang)},Localize.prototype._executeBindings=function(){var self=this,_loop=function _loop(path){self.bindings[path].forEach((function(binding){binding(self.getText(path),self.lang)}))};for(var path in self.bindings)_loop(path)},Localize.prototype.langs={default:{groups:{item:"item",items:"items"},columns:{},ajax:{loading:"Loading",error:"Error"},pagination:{page_size:"Page Size",page_title:"Show Page",first:"First",first_title:"First Page",last:"Last",last_title:"Last Page",prev:"Prev",prev_title:"Prev Page",next:"Next",next_title:"Next Page",all:"All"},headerFilters:{default:"filter column...",columns:{}}}},Tabulator.prototype.registerModule("localize",Localize);var Comms=function Comms(table){this.table=table};Comms.prototype.getConnections=function(selectors){var self=this,connections=[],connection;return(connection=Tabulator.prototype.comms.lookupTable(selectors)).forEach((function(con){self.table!==con&&connections.push(con)})),connections},Comms.prototype.send=function(selectors,module,action,data){var self=this,connections=this.getConnections(selectors);connections.forEach((function(connection){connection.tableComms(self.table.element,module,action,data)})),!connections.length&&selectors&&console.warn("Table Connection Error - No tables matching selector found",selectors)},Comms.prototype.receive=function(table,module,action,data){if(this.table.modExists(module))return this.table.modules[module].commsReceived(table,action,data);console.warn("Inter-table Comms Error - no such module:",module)},Tabulator.prototype.registerModule("comms",Comms);var Accessor=function Accessor(table){this.table=table,this.allowedTypes=["","data","download","clipboard","print","htmlOutput"]};Accessor.prototype.initializeColumn=function(column){var self=this,match=!1,config={};this.allowedTypes.forEach((function(type){var key="accessor"+(type.charAt(0).toUpperCase()+type.slice(1)),accessor;column.definition[key]&&(accessor=self.lookupAccessor(column.definition[key]))&&(match=!0,config[key]={accessor:accessor,params:column.definition[key+"Params"]||{}})})),match&&(column.modules.accessor=config)},Accessor.prototype.lookupAccessor=function(value){var accessor=!1;switch(void 0===value?"undefined":_typeof(value)){case"string":this.accessors[value]?accessor=this.accessors[value]:console.warn("Accessor Error - No such accessor found, ignoring: ",value);break;case"function":accessor=value}return accessor},Accessor.prototype.transformRow=function(dataIn,type){var self=this,key="accessor"+(type.charAt(0).toUpperCase()+type.slice(1)),data=Tabulator.prototype.helpers.deepClone(dataIn||{});return this.table.columnManager.traverse((function(column){var value,accessor,params,component;column.modules.accessor&&(accessor=column.modules.accessor[key]||column.modules.accessor.accessor||!1)&&"undefined"!=(value=column.getFieldValue(data))&&(component=column.getComponent(),params="function"==typeof accessor.params?accessor.params(value,data,type,component):accessor.params,column.setFieldValue(data,accessor.accessor(value,data,type,params,component)))})),data},Accessor.prototype.accessors={},Tabulator.prototype.registerModule("accessor",Accessor);var Ajax=function Ajax(table){this.table=table,this.config=!1,this.url="",this.urlGenerator=!1,this.params=!1,this.loaderElement=this.createLoaderElement(),this.msgElement=this.createMsgElement(),this.loadingElement=!1,this.errorElement=!1,this.loaderPromise=!1,this.progressiveLoad=!1,this.loading=!1,this.requestOrder=0};Ajax.prototype.initialize=function(){var template;this.loaderElement.appendChild(this.msgElement),this.table.options.ajaxLoaderLoading&&("string"==typeof this.table.options.ajaxLoaderLoading?((template=document.createElement("template")).innerHTML=this.table.options.ajaxLoaderLoading.trim(),this.loadingElement=template.content.firstChild):this.loadingElement=this.table.options.ajaxLoaderLoading),this.loaderPromise=this.table.options.ajaxRequestFunc||this.defaultLoaderPromise,this.urlGenerator=this.table.options.ajaxURLGenerator||this.defaultURLGenerator,this.table.options.ajaxLoaderError&&("string"==typeof this.table.options.ajaxLoaderError?((template=document.createElement("template")).innerHTML=this.table.options.ajaxLoaderError.trim(),this.errorElement=template.content.firstChild):this.errorElement=this.table.options.ajaxLoaderError),this.table.options.ajaxParams&&this.setParams(this.table.options.ajaxParams),this.table.options.ajaxConfig&&this.setConfig(this.table.options.ajaxConfig),this.table.options.ajaxURL&&this.setUrl(this.table.options.ajaxURL),this.table.options.ajaxProgressiveLoad&&(this.table.options.pagination?(this.progressiveLoad=!1,console.error("Progressive Load Error - Pagination and progressive load cannot be used at the same time")):this.table.modExists("page")?(this.progressiveLoad=this.table.options.ajaxProgressiveLoad,this.table.modules.page.initializeProgressive(this.progressiveLoad)):console.error("Pagination plugin is required for progressive ajax loading"))},Ajax.prototype.createLoaderElement=function(){var el=document.createElement("div");return el.classList.add("tabulator-loader"),el},Ajax.prototype.createMsgElement=function(){var el=document.createElement("div");return el.classList.add("tabulator-loader-msg"),el.setAttribute("role","alert"),el},Ajax.prototype.setParams=function(params,update){if(update)for(var key in this.params=this.params||{},params)this.params[key]=params[key];else this.params=params},Ajax.prototype.getParams=function(){return this.params||{}},Ajax.prototype.setConfig=function(config){if(this._loadDefaultConfig(),"string"==typeof config)this.config.method=config;else for(var key in config)this.config[key]=config[key]},Ajax.prototype._loadDefaultConfig=function(force){var self=this;if(!this.config||force)for(var key in this.config={},this.defaultConfig)this.config[key]=this.defaultConfig[key]},Ajax.prototype.setUrl=function(url){this.url=url},Ajax.prototype.getUrl=function(){return this.url},Ajax.prototype.loadData=function(inPosition,columnsChanged){var self=this;return this.progressiveLoad?this._loadDataProgressive():this._loadDataStandard(inPosition,columnsChanged)},Ajax.prototype.nextPage=function(diff){var margin;this.loading||diff<(margin=this.table.options.ajaxProgressiveLoadScrollMargin||2*this.table.rowManager.getElement().clientHeight)&&this.table.modules.page.nextPage().then((function(){})).catch((function(){}))},Ajax.prototype.blockActiveRequest=function(){this.requestOrder++},Ajax.prototype._loadDataProgressive=function(){return this.table.rowManager.setData([]),this.table.modules.page.setPage(1)},Ajax.prototype._loadDataStandard=function(inPosition,columnsChanged){var _this35=this;return new Promise((function(resolve,reject){_this35.sendRequest(inPosition).then((function(data){_this35.table.rowManager.setData(data,inPosition,columnsChanged).then((function(){resolve()})).catch((function(e){reject(e)}))})).catch((function(e){reject(e)}))}))},Ajax.prototype.generateParamsList=function(data,prefix){var self=this,output=[];if(prefix=prefix||"",Array.isArray(data))data.forEach((function(item,i){output=output.concat(self.generateParamsList(item,prefix?prefix+"["+i+"]":i))}));else if("object"===(void 0===data?"undefined":_typeof(data)))for(var key in data)output=output.concat(self.generateParamsList(data[key],prefix?prefix+"["+key+"]":key));else output.push({key:prefix,value:data});return output},Ajax.prototype.serializeParams=function(params){var output=this.generateParamsList(params),encoded=[];return output.forEach((function(item){encoded.push(encodeURIComponent(item.key)+"="+encodeURIComponent(item.value))})),encoded.join("&")},Ajax.prototype.sendRequest=function(silent){var _this36=this,self=this,url=self.url,requestNo,esc,query;return self.requestOrder++,requestNo=self.requestOrder,self._loadDefaultConfig(),new Promise((function(resolve,reject){!1!==self.table.options.ajaxRequesting.call(_this36.table,self.url,self.params)?(self.loading=!0,silent||self.showLoader(),_this36.loaderPromise(url,self.config,self.params).then((function(data){requestNo===self.requestOrder?(self.table.options.ajaxResponse&&(data=self.table.options.ajaxResponse.call(self.table,self.url,self.params,data)),resolve(data),self.hideLoader(),self.loading=!1):console.warn("Ajax Response Blocked - An active ajax request was blocked by an attempt to change table data while the request was being made")})).catch((function(error){console.error("Ajax Load Error: ",error),self.table.options.ajaxError.call(self.table,error),self.showError(),setTimeout((function(){self.hideLoader()}),3e3),self.loading=!1,reject()}))):reject()}))},Ajax.prototype.showLoader=function(){var shouldLoad;if("function"==typeof this.table.options.ajaxLoader?this.table.options.ajaxLoader():this.table.options.ajaxLoader){for(this.hideLoader();this.msgElement.firstChild;)this.msgElement.removeChild(this.msgElement.firstChild);this.msgElement.classList.remove("tabulator-error"),this.msgElement.classList.add("tabulator-loading"),this.loadingElement?this.msgElement.appendChild(this.loadingElement):this.msgElement.innerHTML=this.table.modules.localize.getText("ajax|loading"),this.table.element.appendChild(this.loaderElement)}},Ajax.prototype.showError=function(){for(this.hideLoader();this.msgElement.firstChild;)this.msgElement.removeChild(this.msgElement.firstChild);this.msgElement.classList.remove("tabulator-loading"),this.msgElement.classList.add("tabulator-error"),this.errorElement?this.msgElement.appendChild(this.errorElement):this.msgElement.innerHTML=this.table.modules.localize.getText("ajax|error"),this.table.element.appendChild(this.loaderElement)},Ajax.prototype.hideLoader=function(){this.loaderElement.parentNode&&this.loaderElement.parentNode.removeChild(this.loaderElement)},Ajax.prototype.defaultConfig={method:"GET"},Ajax.prototype.defaultURLGenerator=function(url,config,params){return url&¶ms&&Object.keys(params).length&&(config.method&&"get"!=config.method.toLowerCase()||(config.method="get",url+=(url.includes("?")?"&":"?")+this.serializeParams(params))),url},Ajax.prototype.defaultLoaderPromise=function(url,config,params){var self=this,contentType;return new Promise((function(resolve,reject){if(url=self.urlGenerator(url,config,params),"GET"!=config.method.toUpperCase())if(contentType="object"===_typeof(self.table.options.ajaxContentType)?self.table.options.ajaxContentType:self.contentTypeFormatters[self.table.options.ajaxContentType]){for(var key in contentType.headers)config.headers||(config.headers={}),void 0===config.headers[key]&&(config.headers[key]=contentType.headers[key]);config.body=contentType.body.call(self,url,config,params)}else console.warn("Ajax Error - Invalid ajaxContentType value:",self.table.options.ajaxContentType);url?(void 0===config.headers&&(config.headers={}),void 0===config.headers.Accept&&(config.headers.Accept="application/json"),void 0===config.headers["X-Requested-With"]&&(config.headers["X-Requested-With"]="XMLHttpRequest"),void 0===config.mode&&(config.mode="cors"),"cors"==config.mode?(void 0===config.headers["Access-Control-Allow-Origin"]&&(config.headers["Access-Control-Allow-Origin"]=window.location.origin),void 0===config.credentials&&(config.credentials="same-origin")):void 0===config.credentials&&(config.credentials="include"),fetch(url,config).then((function(response){response.ok?response.json().then((function(data){resolve(data)})).catch((function(error){reject(error),console.warn("Ajax Load Error - Invalid JSON returned",error)})):(console.error("Ajax Load Error - Connection Error: "+response.status,response.statusText),reject(response))})).catch((function(error){console.error("Ajax Load Error - Connection Error: ",error),reject(error)}))):(console.warn("Ajax Load Error - No URL Set"),resolve([]))}))},Ajax.prototype.contentTypeFormatters={json:{headers:{"Content-Type":"application/json"},body:function body(url,config,params){return JSON.stringify(params)}},form:{headers:{},body:function body(url,config,params){var output=this.generateParamsList(params),form=new FormData;return output.forEach((function(item){form.append(item.key,item.value)})),form}}},Tabulator.prototype.registerModule("ajax",Ajax);var ColumnCalcs=function ColumnCalcs(table){this.table=table,this.topCalcs=[],this.botCalcs=[],this.genColumn=!1,this.topElement=this.createElement(),this.botElement=this.createElement(),this.topRow=!1,this.botRow=!1,this.topInitialized=!1,this.botInitialized=!1,this.initialize()};ColumnCalcs.prototype.createElement=function(){var el=document.createElement("div");return el.classList.add("tabulator-calcs-holder"),el},ColumnCalcs.prototype.initialize=function(){this.genColumn=new Column({field:"value"},this)},ColumnCalcs.prototype.registerColumnField=function(){},ColumnCalcs.prototype.initializeColumn=function(column){var def=column.definition,config={topCalcParams:def.topCalcParams||{},botCalcParams:def.bottomCalcParams||{}};if(def.topCalc){switch(_typeof(def.topCalc)){case"string":this.calculations[def.topCalc]?config.topCalc=this.calculations[def.topCalc]:console.warn("Column Calc Error - No such calculation found, ignoring: ",def.topCalc);break;case"function":config.topCalc=def.topCalc}config.topCalc&&(column.modules.columnCalcs=config,this.topCalcs.push(column),"group"!=this.table.options.columnCalcs&&this.initializeTopRow())}if(def.bottomCalc){switch(_typeof(def.bottomCalc)){case"string":this.calculations[def.bottomCalc]?config.botCalc=this.calculations[def.bottomCalc]:console.warn("Column Calc Error - No such calculation found, ignoring: ",def.bottomCalc);break;case"function":config.botCalc=def.bottomCalc}config.botCalc&&(column.modules.columnCalcs=config,this.botCalcs.push(column),"group"!=this.table.options.columnCalcs&&this.initializeBottomRow())}},ColumnCalcs.prototype.removeCalcs=function(){var changed=!1;this.topInitialized&&(this.topInitialized=!1,this.topElement.parentNode.removeChild(this.topElement),changed=!0),this.botInitialized&&(this.botInitialized=!1,this.table.footerManager.remove(this.botElement),changed=!0),changed&&this.table.rowManager.adjustTableSize()},ColumnCalcs.prototype.initializeTopRow=function(){this.topInitialized||(this.table.columnManager.getElement().insertBefore(this.topElement,this.table.columnManager.headersElement.nextSibling),this.topInitialized=!0)},ColumnCalcs.prototype.initializeBottomRow=function(){this.botInitialized||(this.table.footerManager.prepend(this.botElement),this.botInitialized=!0)},ColumnCalcs.prototype.scrollHorizontal=function(left){var hozAdjust=0,scrollWidth=this.table.columnManager.getElement().scrollWidth-this.table.element.clientWidth;this.botInitialized&&(this.botRow.getElement().style.marginLeft=-left+"px")},ColumnCalcs.prototype.recalc=function(rows){var data,row;if(this.topInitialized||this.botInitialized){if(data=this.rowsToData(rows),this.topInitialized){for(this.topRow&&this.topRow.deleteCells(),row=this.generateRow("top",this.rowsToData(rows)),this.topRow=row;this.topElement.firstChild;)this.topElement.removeChild(this.topElement.firstChild);this.topElement.appendChild(row.getElement()),row.initialize(!0)}if(this.botInitialized){for(this.botRow&&this.botRow.deleteCells(),row=this.generateRow("bottom",this.rowsToData(rows)),this.botRow=row;this.botElement.firstChild;)this.botElement.removeChild(this.botElement.firstChild);this.botElement.appendChild(row.getElement()),row.initialize(!0)}this.table.rowManager.adjustTableSize(),this.table.modExists("frozenColumns")&&this.table.modules.frozenColumns.layout()}},ColumnCalcs.prototype.recalcRowGroup=function(row){this.recalcGroup(this.table.modules.groupRows.getRowGroup(row))},ColumnCalcs.prototype.recalcAll=function(){var _this37=this,groups;(this.topCalcs.length||this.botCalcs.length)&&("group"!==this.table.options.columnCalcs&&this.recalc(this.table.rowManager.activeRows),this.table.options.groupBy&&"table"!==this.table.options.columnCalcs&&table.modules.groupRows.getChildGroups().forEach((function(group){_this37.recalcGroup(group)})))},ColumnCalcs.prototype.recalcGroup=function(group){var data,rowData;group&&group.calcs&&(group.calcs.bottom&&(data=this.rowsToData(group.rows),rowData=this.generateRowData("bottom",data),group.calcs.bottom.updateData(rowData),group.calcs.bottom.reinitialize()),group.calcs.top&&(data=this.rowsToData(group.rows),rowData=this.generateRowData("top",data),group.calcs.top.updateData(rowData),group.calcs.top.reinitialize()))},ColumnCalcs.prototype.generateTopRow=function(rows){return this.generateRow("top",this.rowsToData(rows))},ColumnCalcs.prototype.generateBottomRow=function(rows){return this.generateRow("bottom",this.rowsToData(rows))},ColumnCalcs.prototype.rowsToData=function(rows){var _this38=this,data=[];return rows.forEach((function(row){if(data.push(row.getData()),_this38.table.options.dataTree&&_this38.table.options.dataTreeChildColumnCalcs&&row.modules.dataTree.open){var children=_this38.rowsToData(_this38.table.modules.dataTree.getFilteredTreeChildren(row));data=data.concat(children)}})),data},ColumnCalcs.prototype.generateRow=function(pos,data){var self=this,rowData=this.generateRowData(pos,data),row;return self.table.modExists("mutator")&&self.table.modules.mutator.disable(),row=new Row(rowData,this,"calc"),self.table.modExists("mutator")&&self.table.modules.mutator.enable(),row.getElement().classList.add("tabulator-calcs","tabulator-calcs-"+pos),row.generateCells=function(){var cells=[];self.table.columnManager.columnsByIndex.forEach((function(column){self.genColumn.setField(column.getField()),self.genColumn.hozAlign=column.hozAlign,column.definition[pos+"CalcFormatter"]&&self.table.modExists("format")?self.genColumn.modules.format={formatter:self.table.modules.format.getFormatter(column.definition[pos+"CalcFormatter"]),params:column.definition[pos+"CalcFormatterParams"]}:self.genColumn.modules.format={formatter:self.table.modules.format.getFormatter("plaintext"),params:{}},self.genColumn.definition.cssClass=column.definition.cssClass;var cell=new Cell(self.genColumn,row);cell.column=column,cell.setWidth(),column.cells.push(cell),cells.push(cell),column.visible||cell.hide()})),this.cells=cells},row},ColumnCalcs.prototype.generateRowData=function(pos,data){var rowData={},calcs="top"==pos?this.topCalcs:this.botCalcs,type="top"==pos?"topCalc":"botCalc",params,paramKey;return calcs.forEach((function(column){var values=[];column.modules.columnCalcs&&column.modules.columnCalcs[type]&&(data.forEach((function(item){values.push(column.getFieldValue(item))})),paramKey=type+"Params",params="function"==typeof column.modules.columnCalcs[paramKey]?column.modules.columnCalcs[paramKey](values,data):column.modules.columnCalcs[paramKey],column.setFieldValue(rowData,column.modules.columnCalcs[type](values,data,params)))})),rowData},ColumnCalcs.prototype.hasTopCalcs=function(){return!!this.topCalcs.length},ColumnCalcs.prototype.hasBottomCalcs=function(){return!!this.botCalcs.length},ColumnCalcs.prototype.redraw=function(){this.topRow&&this.topRow.normalizeHeight(!0),this.botRow&&this.botRow.normalizeHeight(!0)},ColumnCalcs.prototype.getResults=function(){var self=this,results={},groups;return this.table.options.groupBy&&this.table.modExists("groupRows")?(groups=this.table.modules.groupRows.getGroups(!0)).forEach((function(group){results[group.getKey()]=self.getGroupResults(group)})):results={top:this.topRow?this.topRow.getData():{},bottom:this.botRow?this.botRow.getData():{}},results},ColumnCalcs.prototype.getGroupResults=function(group){var self=this,groupObj=group._getSelf(),subGroups=group.getSubGroups(),subGroupResults={},results={};return subGroups.forEach((function(subgroup){subGroupResults[subgroup.getKey()]=self.getGroupResults(subgroup)})),results={top:groupObj.calcs.top?groupObj.calcs.top.getData():{},bottom:groupObj.calcs.bottom?groupObj.calcs.bottom.getData():{},groups:subGroupResults}},ColumnCalcs.prototype.calculations={avg:function avg(values,data,calcParams){var output=0,precision=void 0!==calcParams.precision?calcParams.precision:2;return values.length&&(output=values.reduce((function(sum,value){return sum+(value=Number(value))})),output/=values.length,output=!1!==precision?output.toFixed(precision):output),parseFloat(output).toString()},max:function max(values,data,calcParams){var output=null,precision=void 0!==calcParams.precision&&calcParams.precision;return values.forEach((function(value){((value=Number(value))>output||null===output)&&(output=value)})),null!==output?!1!==precision?output.toFixed(precision):output:""},min:function min(values,data,calcParams){var output=null,precision=void 0!==calcParams.precision&&calcParams.precision;return values.forEach((function(value){((value=Number(value))"),options.dataTreeExpandElement?"string"==typeof options.dataTreeExpandElement?((dummyEl=document.createElement("div")).innerHTML=options.dataTreeExpandElement,this.expandEl=dummyEl.firstChild):this.expandEl=options.dataTreeExpandElement:(this.expandEl=document.createElement("div"),this.expandEl.classList.add("tabulator-data-tree-control"),this.expandEl.tabIndex=0,this.expandEl.innerHTML="
"),_typeof(options.dataTreeStartExpanded)){case"boolean":this.startOpen=function(row,index){return options.dataTreeStartExpanded};break;case"function":this.startOpen=options.dataTreeStartExpanded;break;default:this.startOpen=function(row,index){return options.dataTreeStartExpanded[index]}}},DataTree.prototype.initializeRow=function(row){var childArray=row.getData()[this.field],isArray=Array.isArray(childArray),children=isArray||!isArray&&"object"===(void 0===childArray?"undefined":_typeof(childArray))&&null!==childArray;!children&&row.modules.dataTree&&row.modules.dataTree.branchEl&&row.modules.dataTree.branchEl.parentNode.removeChild(row.modules.dataTree.branchEl),!children&&row.modules.dataTree&&row.modules.dataTree.controlEl&&row.modules.dataTree.controlEl.parentNode.removeChild(row.modules.dataTree.controlEl),row.modules.dataTree={index:row.modules.dataTree?row.modules.dataTree.index:0,open:!!children&&(row.modules.dataTree?row.modules.dataTree.open:this.startOpen(row.getComponent(),0)),controlEl:!(!row.modules.dataTree||!children)&&row.modules.dataTree.controlEl,branchEl:!(!row.modules.dataTree||!children)&&row.modules.dataTree.branchEl,parent:!!row.modules.dataTree&&row.modules.dataTree.parent,children:children}},DataTree.prototype.layoutRow=function(row){var cell,el=(this.elementField?row.getCell(this.elementField):row.getCells()[0]).getElement(),config=row.modules.dataTree;config.branchEl&&(config.branchEl.parentNode&&config.branchEl.parentNode.removeChild(config.branchEl),config.branchEl=!1),config.controlEl&&(config.controlEl.parentNode&&config.controlEl.parentNode.removeChild(config.controlEl),config.controlEl=!1),this.generateControlElement(row,el),row.element.classList.add("tabulator-tree-level-"+config.index),config.index&&(this.branchEl?(config.branchEl=this.branchEl.cloneNode(!0),el.insertBefore(config.branchEl,el.firstChild),config.branchEl.style.marginLeft=(config.branchEl.offsetWidth+config.branchEl.style.marginRight)*(config.index-1)+config.index*this.indent+"px"):el.style.paddingLeft=parseInt(window.getComputedStyle(el,null).getPropertyValue("padding-left"))+config.index*this.indent+"px")},DataTree.prototype.generateControlElement=function(row,el){var _this40=this,config=row.modules.dataTree,el=el||row.getCells()[0].getElement(),oldControl=config.controlEl;!1!==config.children&&(config.open?(config.controlEl=this.collapseEl.cloneNode(!0),config.controlEl.addEventListener("click",(function(e){e.stopPropagation(),_this40.collapseRow(row)}))):(config.controlEl=this.expandEl.cloneNode(!0),config.controlEl.addEventListener("click",(function(e){e.stopPropagation(),_this40.expandRow(row)}))),config.controlEl.addEventListener("mousedown",(function(e){e.stopPropagation()})),oldControl&&oldControl.parentNode===el?oldControl.parentNode.replaceChild(config.controlEl,oldControl):el.insertBefore(config.controlEl,el.firstChild))},DataTree.prototype.setDisplayIndex=function(index){this.displayIndex=index},DataTree.prototype.getDisplayIndex=function(){return this.displayIndex},DataTree.prototype.getRows=function(rows){var _this41=this,output=[];return rows.forEach((function(row,i){var config,children;output.push(row),row instanceof Row&&((config=row.modules.dataTree.children).index||!1===config.children||(children=_this41.getChildren(row)).forEach((function(child){output.push(child)})))})),output},DataTree.prototype.getChildren=function(row){var _this42=this,config=row.modules.dataTree,children=[],output=[];return!1!==config.children&&config.open&&(Array.isArray(config.children)||(config.children=this.generateChildren(row)),children=this.table.modExists("filter")?this.table.modules.filter.filter(config.children):config.children,this.table.modExists("sort")&&this.table.modules.sort.sort(children),children.forEach((function(child){var subChildren;output.push(child),_this42.getChildren(child).forEach((function(sub){output.push(sub)}))}))),output},DataTree.prototype.generateChildren=function(row){var _this43=this,children=[],childArray=row.getData()[this.field];return Array.isArray(childArray)||(childArray=[childArray]),childArray.forEach((function(childData){var childRow=new Row(childData||{},_this43.table.rowManager);childRow.modules.dataTree.index=row.modules.dataTree.index+1,childRow.modules.dataTree.parent=row,childRow.modules.dataTree.children&&(childRow.modules.dataTree.open=_this43.startOpen(childRow.getComponent(),childRow.modules.dataTree.index)),children.push(childRow)})),children},DataTree.prototype.expandRow=function(row,silent){var config=row.modules.dataTree;!1!==config.children&&(config.open=!0,row.reinitialize(),this.table.rowManager.refreshActiveData("tree",!1,!0),this.table.options.dataTreeRowExpanded(row.getComponent(),row.modules.dataTree.index))},DataTree.prototype.collapseRow=function(row){var config=row.modules.dataTree;!1!==config.children&&(config.open=!1,row.reinitialize(),this.table.rowManager.refreshActiveData("tree",!1,!0),this.table.options.dataTreeRowCollapsed(row.getComponent(),row.modules.dataTree.index))},DataTree.prototype.toggleRow=function(row){var config=row.modules.dataTree;!1!==config.children&&(config.open?this.collapseRow(row):this.expandRow(row))},DataTree.prototype.getTreeParent=function(row){return!!row.modules.dataTree.parent&&row.modules.dataTree.parent.getComponent()},DataTree.prototype.getFilteredTreeChildren=function(row){var config=row.modules.dataTree,output=[],children;return config.children&&(Array.isArray(config.children)||(config.children=this.generateChildren(row)),(children=this.table.modExists("filter")?this.table.modules.filter.filter(config.children):config.children).forEach((function(childRow){childRow instanceof Row&&output.push(childRow)}))),output},DataTree.prototype.rowDelete=function(row){var parent=row.modules.dataTree.parent,childIndex;parent&&(!1!==(childIndex=this.findChildIndex(row,parent))&&parent.data[this.field].splice(childIndex,1),parent.data[this.field].length||delete parent.data[this.field],this.initializeRow(parent),this.layoutRow(parent)),this.table.rowManager.refreshActiveData("tree",!1,!0)},DataTree.prototype.addTreeChildRow=function(row,data,top,index){var childIndex=!1;"string"==typeof data&&(data=JSON.parse(data)),Array.isArray(row.data[this.field])||(row.data[this.field]=[],row.modules.dataTree.open=this.startOpen(row.getComponent(),row.modules.dataTree.index)),void 0!==index&&!1!==(childIndex=this.findChildIndex(index,row))&&row.data[this.field].splice(top?childIndex:childIndex+1,0,data),!1===childIndex&&(top?row.data[this.field].unshift(data):row.data[this.field].push(data)),this.initializeRow(row),this.layoutRow(row),this.table.rowManager.refreshActiveData("tree",!1,!0)},DataTree.prototype.findChildIndex=function(subject,parent){var _this44=this,match=!1;return"object"==(void 0===subject?"undefined":_typeof(subject))?subject instanceof Row?match=subject.data:subject instanceof RowComponent?match=subject._getSelf().data:"undefined"!=typeof HTMLElement&&subject instanceof HTMLElement&&parent.modules.dataTree&&(match=parent.modules.dataTree.children.find((function(childRow){return childRow instanceof Row&&childRow.element===subject})))&&(match=match.data):match=null!=subject&&parent.data[this.field].find((function(row){return row.data[_this44.table.options.index]==subject})),match&&(Array.isArray(parent.data[this.field])&&(match=parent.data[this.field].indexOf(match)),-1==match&&(match=!1)),match},DataTree.prototype.getTreeChildren=function(row){var config=row.modules.dataTree,output=[];return config.children&&(Array.isArray(config.children)||(config.children=this.generateChildren(row)),config.children.forEach((function(childRow){childRow instanceof Row&&output.push(childRow.getComponent())}))),output},DataTree.prototype.checkForRestyle=function(cell){cell.row.cells.indexOf(cell)||cell.row.reinitialize()},DataTree.prototype.getChildField=function(){return this.field},DataTree.prototype.redrawNeeded=function(data){return!!this.field&&void 0!==data[this.field]||!!this.elementField&&void 0!==data[this.elementField]},Tabulator.prototype.registerModule("dataTree",DataTree);var Download=function Download(table){this.table=table};Download.prototype.download=function(type,filename,options,range,interceptCallback){var self=this,downloadFunc=!1;function buildLink(data,mime){interceptCallback?!0===interceptCallback?self.triggerDownload(data,mime,type,filename,!0):interceptCallback(data):self.triggerDownload(data,mime,type,filename)}if("function"==typeof type?downloadFunc=type:self.downloaders[type]?downloadFunc=self.downloaders[type]:console.warn("Download Error - No such download type found: ",type),downloadFunc){var list=this.generateExportList(range);downloadFunc.call(this.table,list,options||{},buildLink)}},Download.prototype.generateExportList=function(range){var list=this.table.modules.export.generateExportList(this.table.options.downloadConfig,!1,range||this.table.options.downloadRowRange,"download"),groupHeader=this.table.options.groupHeaderDownload;return groupHeader&&!Array.isArray(groupHeader)&&(groupHeader=[groupHeader]),list.forEach((function(row){var group;"group"===row.type&&(group=row.columns[0],groupHeader&&groupHeader[row.indent]&&(group.value=groupHeader[row.indent](group.value,row.component._group.getRowCount(),row.component._group.getData(),row.component)))})),list},Download.prototype.triggerDownload=function(data,mime,type,filename,newTab){var element=document.createElement("a"),blob=new Blob([data],{type:mime}),filename=filename||"Tabulator."+("function"==typeof type?"txt":type);(blob=this.table.options.downloadReady.call(this.table,data,blob))&&(newTab?window.open(window.URL.createObjectURL(blob)):navigator.msSaveOrOpenBlob?navigator.msSaveOrOpenBlob(blob,filename):(element.setAttribute("href",window.URL.createObjectURL(blob)),element.setAttribute("download",filename),element.style.display="none",document.body.appendChild(element),element.click(),document.body.removeChild(element)),this.table.options.downloadComplete&&this.table.options.downloadComplete())},Download.prototype.commsReceived=function(table,action,data){switch(action){case"intercept":this.download(data.type,"",data.options,data.active,data.intercept)}},Download.prototype.downloaders={csv:function csv(list,options,setFileContents){var delimiter=options&&options.delimiter?options.delimiter:",",fileContents=[],headers=[];list.forEach((function(row){var item=[];switch(row.type){case"group":console.warn("Download Warning - CSV downloader cannot process row groups");break;case"calc":console.warn("Download Warning - CSV downloader cannot process column calculations");break;case"header":row.columns.forEach((function(col,i){col&&1===col.depth&&(headers[i]=void 0===col.value||"null"==typeof col.value?"":col.value)}));break;case"row":row.columns.forEach((function(col){if(col){switch(_typeof(col.value)){case"object":col.value=JSON.stringify(col.value);break;case"undefined":case"null":col.value=""}item.push('"'+String(col.value).split('"').join('""')+'"')}})),fileContents.push(item.join(delimiter))}})),headers.length&&(fileContents=[headers].concat(fileContents)),fileContents=fileContents.join("\n"),options.bom&&(fileContents="\ufeff"+fileContents),setFileContents(fileContents,"text/csv")},json:function json(list,options,setFileContents){var fileContents=[];list.forEach((function(row){var item={};switch(row.type){case"header":break;case"group":console.warn("Download Warning - JSON downloader cannot process row groups");break;case"calc":console.warn("Download Warning - JSON downloader cannot process column calculations");break;case"row":row.columns.forEach((function(col){col&&(item[col.component.getField()]=col.value)})),fileContents.push(item)}})),setFileContents(fileContents=JSON.stringify(fileContents,null,"\t"),"application/json")},pdf:function pdf(list,options,setFileContents){var header=[],body=[],autoTableParams={},rowGroupStyles=options.rowGroupStyles||{fontStyle:"bold",fontSize:12,cellPadding:6,fillColor:220},rowCalcStyles=options.rowCalcStyles||{fontStyle:"bold",fontSize:10,cellPadding:4,fillColor:232},jsPDFParams=options.jsPDF||{},title=options&&options.title?options.title:"";function parseRow(row,styles){var rowData=[];return row.columns.forEach((function(col){var cell;if(col){switch(_typeof(col.value)){case"object":col.value=JSON.stringify(col.value);break;case"undefined":case"null":col.value=""}cell={content:col.value,colSpan:col.width,rowSpan:col.height},styles&&(cell.styles=styles),rowData.push(cell)}else rowData.push("")})),rowData}jsPDFParams.orientation||(jsPDFParams.orientation=options.orientation||"landscape"),jsPDFParams.unit||(jsPDFParams.unit="pt"),list.forEach((function(row){switch(row.type){case"header":header.push(parseRow(row));break;case"group":body.push(parseRow(row,rowGroupStyles));break;case"calc":body.push(parseRow(row,rowCalcStyles));break;case"row":body.push(parseRow(row))}}));var doc=new jsPDF(jsPDFParams);options&&options.autoTable&&(autoTableParams="function"==typeof options.autoTable?options.autoTable(doc)||{}:options.autoTable),title&&(autoTableParams.addPageContent=function(data){doc.text(title,40,30)}),autoTableParams.head=header,autoTableParams.body=body,doc.autoTable(autoTableParams),options&&options.documentProcessing&&options.documentProcessing(doc),setFileContents(doc.output("arraybuffer"),"application/pdf")},xlsx:function xlsx(list,options,setFileContents){var self=this,sheetName=options.sheetName||"Sheet1",workbook=XLSX.utils.book_new(),output;function generateSheet(){var rows=[],merges=[],worksheet={},range={s:{c:0,r:0},e:{c:list[0]?list[0].columns.reduce((function(a,b){return a+(b&&b.width?b.width:1)}),0):0,r:list.length}};return list.forEach((function(row,i){var rowData=[];row.columns.forEach((function(col,j){col?(rowData.push(col.value instanceof Date||"object"!==_typeof(col.value)?col.value:JSON.stringify(col.value)),(col.width>1||col.height>-1)&&merges.push({s:{r:i,c:j},e:{r:i+col.height-1,c:j+col.width-1}})):rowData.push("")})),rows.push(rowData)})),XLSX.utils.sheet_add_aoa(worksheet,rows),worksheet["!ref"]=XLSX.utils.encode_range(range),merges.length&&(worksheet["!merges"]=merges),worksheet}if(workbook.SheetNames=[],workbook.Sheets={},options.sheetOnly)setFileContents(generateSheet());else{if(options.sheets)for(var sheet in options.sheets)!0===options.sheets[sheet]?(workbook.SheetNames.push(sheet),workbook.Sheets[sheet]=generateSheet()):(workbook.SheetNames.push(sheet),this.table.modules.comms.send(options.sheets[sheet],"download","intercept",{type:"xlsx",options:{sheetOnly:!0},active:this.active,intercept:function intercept(data){workbook.Sheets[sheet]=data}}));else workbook.SheetNames.push(sheetName),workbook.Sheets[sheetName]=generateSheet();options.documentProcessing&&(workbook=options.documentProcessing(workbook)),setFileContents(s2ab(output=XLSX.write(workbook,{bookType:"xlsx",bookSST:!0,type:"binary"})),"application/octet-stream")}function s2ab(s){for(var buf=new ArrayBuffer(s.length),view=new Uint8Array(buf),i=0;i!=s.length;++i)view[i]=255&s.charCodeAt(i);return buf}},html:function html(list,options,setFileContents){this.modExists("export",!0)&&setFileContents(this.modules.export.genereateHTMLTable(list),"text/html")}},Tabulator.prototype.registerModule("download",Download);var Edit=function Edit(table){this.table=table,this.currentCell=!1,this.mouseClick=!1,this.recursionBlock=!1,this.invalidEdit=!1,this.editedCells=[]};Edit.prototype.initializeColumn=function(column){var self=this,config={editor:!1,blocked:!1,check:column.definition.editable,params:column.definition.editorParams||{}};switch(_typeof(column.definition.editor)){case"string":"tick"===column.definition.editor&&(column.definition.editor="tickCross",console.warn("DEPRECATION WARNING - the tick editor has been deprecated, please use the tickCross editor")),this.editors[column.definition.editor]?config.editor=this.editors[column.definition.editor]:console.warn("Editor Error - No such editor found: ",column.definition.editor);break;case"function":config.editor=column.definition.editor;break;case"boolean":!0===column.definition.editor&&("function"!=typeof column.definition.formatter?("tick"===column.definition.formatter&&(column.definition.formatter="tickCross",console.warn("DEPRECATION WARNING - the tick editor has been deprecated, please use the tickCross editor")),this.editors[column.definition.formatter]?config.editor=this.editors[column.definition.formatter]:config.editor=this.editors.input):console.warn("Editor Error - Cannot auto lookup editor for a custom formatter: ",column.definition.formatter))}config.editor&&(column.modules.edit=config)},Edit.prototype.getCurrentCell=function(){return!!this.currentCell&&this.currentCell.getComponent()},Edit.prototype.clearEditor=function(cancel){var cell=this.currentCell,cellEl;if(this.invalidEdit=!1,cell){for(this.currentCell=!1,cellEl=cell.getElement(),cancel?cell.validate():cellEl.classList.remove("tabulator-validation-fail"),cellEl.classList.remove("tabulator-editing");cellEl.firstChild;)cellEl.removeChild(cellEl.firstChild);cell.row.getElement().classList.remove("tabulator-row-editing")}},Edit.prototype.cancelEdit=function(){if(this.currentCell){var cell=this.currentCell,component=this.currentCell.getComponent();this.clearEditor(!0),cell.setValueActual(cell.getValue()),cell.cellRendered(),cell.column.cellEvents.cellEditCancelled&&cell.column.cellEvents.cellEditCancelled.call(this.table,component),this.table.options.cellEditCancelled.call(this.table,component)}},Edit.prototype.bindEditor=function(cell){var self=this,element=cell.getElement();element.setAttribute("tabindex",0),element.addEventListener("click",(function(e){element.classList.contains("tabulator-editing")||element.focus({preventScroll:!0})})),element.addEventListener("mousedown",(function(e){self.mouseClick=!0})),element.addEventListener("focus",(function(e){self.recursionBlock||self.edit(cell,e,!1)}))},Edit.prototype.focusCellNoEvent=function(cell,block){this.recursionBlock=!0,block&&"ie"===this.table.browser||cell.getElement().focus({preventScroll:!0}),this.recursionBlock=!1},Edit.prototype.editCell=function(cell,forceEdit){this.focusCellNoEvent(cell),this.edit(cell,!1,forceEdit)},Edit.prototype.focusScrollAdjust=function(cell){if("virtual"==this.table.rowManager.getRenderMode()){var topEdge=this.table.rowManager.element.scrollTop,bottomEdge=this.table.rowManager.element.clientHeight+this.table.rowManager.element.scrollTop,rowEl=cell.row.getElement(),offset=rowEl.offsetTop;rowEl.offsetTopbottomEdge&&(this.table.rowManager.element.scrollTop+=rowEl.offsetTop+rowEl.offsetHeight-bottomEdge)}},Edit.prototype.edit=function(cell,e,forceEdit){var self=this,allowEdit=!0,rendered=function rendered(){},element=cell.getElement(),cellEditor,component,params;if(!this.currentCell){if(cell.column.modules.edit.blocked)return this.mouseClick=!1,element.blur(),!1;switch(e&&e.stopPropagation(),_typeof(cell.column.modules.edit.check)){case"function":allowEdit=cell.column.modules.edit.check(cell.getComponent());break;case"boolean":allowEdit=cell.column.modules.edit.check}if(allowEdit||forceEdit){if(self.cancelEdit(),self.currentCell=cell,this.focusScrollAdjust(cell),component=cell.getComponent(),this.mouseClick&&(this.mouseClick=!1,cell.column.cellEvents.cellClick&&cell.column.cellEvents.cellClick.call(this.table,e,component)),cell.column.cellEvents.cellEditing&&cell.column.cellEvents.cellEditing.call(this.table,component),self.table.options.cellEditing.call(this.table,component),params="function"==typeof cell.column.modules.edit.params?cell.column.modules.edit.params(component):cell.column.modules.edit.params,!1===(cellEditor=cell.column.modules.edit.editor.call(self,component,onRendered,success,cancel,params)))return element.blur(),!1;if(!(cellEditor instanceof Node))return console.warn("Edit Error - Editor should return an instance of Node, the editor returned:",cellEditor),element.blur(),!1;for(element.classList.add("tabulator-editing"),cell.row.getElement().classList.add("tabulator-row-editing");element.firstChild;)element.removeChild(element.firstChild);element.appendChild(cellEditor),rendered();for(var children=element.children,i=0;i46){if(index>=mask.length)return e.preventDefault(),e.stopPropagation(),success=!1,!1;switch(mask[index]){case maskLetter:if(char.toUpperCase()==char.toLowerCase())return e.preventDefault(),e.stopPropagation(),success=!1,!1;break;case maskNumber:if(isNaN(char))return e.preventDefault(),e.stopPropagation(),success=!1,!1;break;case maskWildcard:break;default:if(char!==mask[index])return e.preventDefault(),e.stopPropagation(),success=!1,!1}success=!0}})),el.addEventListener("keyup",(function(e){e.keyCode>46&&options.maskAutoFill&&fillSymbols(el.value.length)})),el.placeholder||(el.placeholder=mask),options.maskAutoFill&&fillSymbols(el.value.length)},Edit.prototype.getEditedCells=function(){var output=[];return this.editedCells.forEach((function(cell){output.push(cell.getComponent())})),output},Edit.prototype.clearEdited=function(cell){var editIndex;cell.modules.edit&&cell.modules.edit.edited&&(cell.modules.validate.invalid=!1,(editIndex=this.editedCells.indexOf(cell))>-1&&this.editedCells.splice(editIndex,1))},Edit.prototype.editors={input:function input(cell,onRendered,success,cancel,editorParams){var cellValue=cell.getValue(),input=document.createElement("input");if(input.setAttribute("type",editorParams.search?"search":"text"),input.style.padding="4px",input.style.width="100%",input.style.boxSizing="border-box",editorParams.elementAttributes&&"object"==_typeof(editorParams.elementAttributes))for(var key in editorParams.elementAttributes)"+"==key.charAt(0)?(key=key.slice(1),input.setAttribute(key,input.getAttribute(key)+editorParams.elementAttributes["+"+key])):input.setAttribute(key,editorParams.elementAttributes[key]);function onChange(e){null==cellValue&&""!==input.value||input.value!==cellValue?success(input.value)&&(cellValue=input.value):cancel()}return input.value=void 0!==cellValue?cellValue:"",onRendered((function(){input.focus({preventScroll:!0}),input.style.height="100%"})),input.addEventListener("change",onChange),input.addEventListener("blur",onChange),input.addEventListener("keydown",(function(e){switch(e.keyCode){case 13:onChange(e);break;case 27:cancel()}})),editorParams.mask&&this.table.modules.edit.maskInput(input,editorParams),input},textarea:function textarea(cell,onRendered,success,cancel,editorParams){var self=this,cellValue=cell.getValue(),vertNav=editorParams.verticalNavigation||"hybrid",value=String(null!=cellValue?cellValue:""),count=(value.match(/(?:\r\n|\r|\n)/g)||[]).length+1,input=document.createElement("textarea"),scrollHeight=0;if(input.style.display="block",input.style.padding="2px",input.style.height="100%",input.style.width="100%",input.style.boxSizing="border-box",input.style.whiteSpace="pre-wrap",input.style.resize="none",editorParams.elementAttributes&&"object"==_typeof(editorParams.elementAttributes))for(var key in editorParams.elementAttributes)"+"==key.charAt(0)?(key=key.slice(1),input.setAttribute(key,input.getAttribute(key)+editorParams.elementAttributes["+"+key])):input.setAttribute(key,editorParams.elementAttributes[key]);function onChange(e){null==cellValue&&""!==input.value||input.value!==cellValue?(success(input.value)&&(cellValue=input.value),setTimeout((function(){cell.getRow().normalizeHeight()}),300)):cancel()}return input.value=value,onRendered((function(){input.focus({preventScroll:!0}),input.style.height="100%"})),input.addEventListener("change",onChange),input.addEventListener("blur",onChange),input.addEventListener("keyup",(function(){input.style.height="";var heightNow=input.scrollHeight;input.style.height=heightNow+"px",heightNow!=scrollHeight&&(scrollHeight=heightNow,cell.getRow().normalizeHeight())})),input.addEventListener("keydown",(function(e){switch(e.keyCode){case 27:cancel();break;case 38:("editor"==vertNav||"hybrid"==vertNav&&input.selectionStart)&&(e.stopImmediatePropagation(),e.stopPropagation());break;case 40:("editor"==vertNav||"hybrid"==vertNav&&input.selectionStart!==input.value.length)&&(e.stopImmediatePropagation(),e.stopPropagation())}})),editorParams.mask&&this.table.modules.edit.maskInput(input,editorParams),input},number:function number(cell,onRendered,success,cancel,editorParams){var cellValue=cell.getValue(),vertNav=editorParams.verticalNavigation||"editor",input=document.createElement("input");if(input.setAttribute("type","number"),void 0!==editorParams.max&&input.setAttribute("max",editorParams.max),void 0!==editorParams.min&&input.setAttribute("min",editorParams.min),void 0!==editorParams.step&&input.setAttribute("step",editorParams.step),input.style.padding="4px",input.style.width="100%",input.style.boxSizing="border-box",editorParams.elementAttributes&&"object"==_typeof(editorParams.elementAttributes))for(var key in editorParams.elementAttributes)"+"==key.charAt(0)?(key=key.slice(1),input.setAttribute(key,input.getAttribute(key)+editorParams.elementAttributes["+"+key])):input.setAttribute(key,editorParams.elementAttributes[key]);input.value=cellValue;var blurFunc=function blurFunc(e){onChange()};function onChange(){var value=input.value;isNaN(value)||""===value||(value=Number(value)),value!==cellValue?success(value)&&(cellValue=value):cancel()}return onRendered((function(){input.removeEventListener("blur",blurFunc),input.focus({preventScroll:!0}),input.style.height="100%",input.addEventListener("blur",blurFunc)})),input.addEventListener("keydown",(function(e){switch(e.keyCode){case 13:onChange();break;case 27:cancel();break;case 38:case 40:"editor"==vertNav&&(e.stopImmediatePropagation(),e.stopPropagation())}})),editorParams.mask&&this.table.modules.edit.maskInput(input,editorParams),input},range:function range(cell,onRendered,success,cancel,editorParams){var cellValue=cell.getValue(),input=document.createElement("input");if(input.setAttribute("type","range"),void 0!==editorParams.max&&input.setAttribute("max",editorParams.max),void 0!==editorParams.min&&input.setAttribute("min",editorParams.min),void 0!==editorParams.step&&input.setAttribute("step",editorParams.step),input.style.padding="4px",input.style.width="100%",input.style.boxSizing="border-box",editorParams.elementAttributes&&"object"==_typeof(editorParams.elementAttributes))for(var key in editorParams.elementAttributes)"+"==key.charAt(0)?(key=key.slice(1),input.setAttribute(key,input.getAttribute(key)+editorParams.elementAttributes["+"+key])):input.setAttribute(key,editorParams.elementAttributes[key]);function onChange(){var value=input.value;isNaN(value)||""===value||(value=Number(value)),value!=cellValue?success(value)&&(cellValue=value):cancel()}return input.value=cellValue,onRendered((function(){input.focus({preventScroll:!0}),input.style.height="100%"})),input.addEventListener("blur",(function(e){onChange()})),input.addEventListener("keydown",(function(e){switch(e.keyCode){case 13:onChange();break;case 27:cancel()}})),input},select:function select(cell,onRendered,success,cancel,editorParams){var self=this,cellEl=cell.getElement(),initialValue=cell.getValue(),vertNav=editorParams.verticalNavigation||"editor",initialDisplayValue=void 0!==initialValue||null===initialValue?initialValue:void 0!==editorParams.defaultValue?editorParams.defaultValue:[],input=document.createElement("input"),listEl=document.createElement("div"),multiselect=editorParams.multiselect,dataItems=[],currentItem={},displayItems=[],currentItems=[],blurable=!0;function getUniqueColumnValues(field){var output={},data=self.table.getData(),column;return(column=field?self.table.columnManager.getColumnByField(field):cell.getColumn()._getSelf())?(data.forEach((function(row){var val=column.getFieldValue(row);null!=val&&""!==val&&(output[val]=!0)})),output=editorParams.sortValuesList?"asc"==editorParams.sortValuesList?Object.keys(output).sort():Object.keys(output).sort().reverse():Object.keys(output)):console.warn("unable to find matching column to create select lookup list:",field),output}function parseItems(inputValues,curentValues){var dataList=[],displayList=[];function processComplexListItem(item){var item={label:item.label,value:item.value,itemParams:item.itemParams,elementAttributes:item.elementAttributes,element:!1};return curentValues.indexOf(item.value)>-1&&setItem(item),dataList.push(item),displayList.push(item),item}if("function"==typeof inputValues&&(inputValues=inputValues(cell)),Array.isArray(inputValues))inputValues.forEach((function(value){var item;"object"===(void 0===value?"undefined":_typeof(value))?value.options?(item={label:value.label,group:!0,itemParams:value.itemParams,elementAttributes:value.elementAttributes,element:!1},displayList.push(item),value.options.forEach((function(item){processComplexListItem(item)}))):processComplexListItem(value):(item={label:value,value:value,element:!1},curentValues.indexOf(item.value)>-1&&setItem(item),dataList.push(item),displayList.push(item))}));else for(var key in inputValues){var item={label:inputValues[key],value:key,element:!1};curentValues.indexOf(item.value)>-1&&setItem(item),dataList.push(item),displayList.push(item)}dataItems=dataList,displayItems=displayList,fillList()}function fillList(){for(;listEl.firstChild;)listEl.removeChild(listEl.firstChild);displayItems.forEach((function(item){var el=item.element;if(!el){if(el=document.createElement("div"),item.label=editorParams.listItemFormatter?editorParams.listItemFormatter(item.value,item.label,cell,el,item.itemParams):item.label,item.group?(el.classList.add("tabulator-edit-select-list-group"),el.tabIndex=0,el.innerHTML=""===item.label?" ":item.label):(el.classList.add("tabulator-edit-select-list-item"),el.tabIndex=0,el.innerHTML=""===item.label?" ":item.label,el.addEventListener("click",(function(){multiselect?(toggleItem(item),input.focus()):chooseItem(item)})),currentItems.indexOf(item)>-1&&el.classList.add("active")),item.elementAttributes&&"object"==_typeof(item.elementAttributes))for(var key in item.elementAttributes)"+"==key.charAt(0)?(key=key.slice(1),el.setAttribute(key,input.getAttribute(key)+item.elementAttributes["+"+key])):el.setAttribute(key,item.elementAttributes[key]);el.addEventListener("mousedown",(function(){blurable=!1,setTimeout((function(){blurable=!0}),10)})),item.element=el}listEl.appendChild(el)}))}function setCurrentItem(item,active){!multiselect&¤tItem&¤tItem.element&¤tItem.element.classList.remove("active"),currentItem&¤tItem.element&¤tItem.element.classList.remove("focused"),currentItem=item,item.element&&(item.element.classList.add("focused"),active&&item.element.classList.add("active"))}function setItem(item){var index;-1==currentItems.indexOf(item)&&(currentItems.push(item),setCurrentItem(item,!0)),fillInput()}function unsetItem(index){var item=currentItems[index];index>-1&&(currentItems.splice(index,1),item.element&&item.element.classList.remove("active"))}function toggleItem(item){item||(item=currentItem);var index=currentItems.indexOf(item);index>-1?unsetItem(index):(!0!==multiselect&¤tItems.length>=multiselect&&unsetItem(0),setItem(item)),fillInput()}function chooseItem(item){hideList(),item||(item=currentItem),item&&success(item.value)}function chooseItems(){hideList();var output=[];currentItems.forEach((function(item){output.push(item.value)})),success(output)}function fillInput(){var output=[];currentItems.forEach((function(item){output.push(item.label)})),input.value=output.join(", ")}function cancelItem(){hideList(),cancel()}function showList(){if(!listEl.parentNode){!0===editorParams.values?parseItems(getUniqueColumnValues(),initialDisplayValue):"string"==typeof editorParams.values?parseItems(getUniqueColumnValues(editorParams.values),initialDisplayValue):parseItems(editorParams.values||[],initialDisplayValue);var offset=Tabulator.prototype.helpers.elOffset(cellEl);listEl.style.minWidth=cellEl.offsetWidth+"px",listEl.style.top=offset.top+cellEl.offsetHeight+"px",listEl.style.left=offset.left+"px",listEl.addEventListener("mousedown",(function(e){blurable=!1,setTimeout((function(){blurable=!0}),10)})),document.body.appendChild(listEl)}}function hideList(){listEl.parentNode&&listEl.parentNode.removeChild(listEl),removeScrollListener()}function removeScrollListener(){self.table.rowManager.element.removeEventListener("scroll",cancelItem)}if(this.table.rowManager.element.addEventListener("scroll",cancelItem),(Array.isArray(editorParams)||!Array.isArray(editorParams)&&"object"===(void 0===editorParams?"undefined":_typeof(editorParams))&&!editorParams.values)&&(console.warn("DEPRECATION WARNING - values for the select editor must now be passed into the values property of the editorParams object, not as the editorParams object"),editorParams={values:editorParams}),input.setAttribute("type","text"),input.style.padding="4px",input.style.width="100%",input.style.boxSizing="border-box",input.style.cursor="default",input.readOnly=0!=this.currentCell,editorParams.elementAttributes&&"object"==_typeof(editorParams.elementAttributes))for(var key in editorParams.elementAttributes)"+"==key.charAt(0)?(key=key.slice(1),input.setAttribute(key,input.getAttribute(key)+editorParams.elementAttributes["+"+key])):input.setAttribute(key,editorParams.elementAttributes[key]);return input.value=void 0!==initialValue||null===initialValue?initialValue:"",input.addEventListener("keydown",(function(e){var index;switch(e.keyCode){case 38:index=dataItems.indexOf(currentItem),("editor"==vertNav||"hybrid"==vertNav&&index)&&(e.stopImmediatePropagation(),e.stopPropagation(),e.preventDefault(),index>0&&setCurrentItem(dataItems[index-1],!multiselect));break;case 40:index=dataItems.indexOf(currentItem),("editor"==vertNav||"hybrid"==vertNav&&index-1||String(item.title).toLowerCase().indexOf(String(term).toLowerCase())>-1)&&matches.push(item)})),fillListIfNotEmpty(matches,intialLoad))}function addNotice(notice){var searchEl=document.createElement("div");clearList(),!1!==notice&&(searchEl.classList.add("tabulator-edit-select-list-notice"),searchEl.tabIndex=0,notice instanceof Node?searchEl.appendChild(notice):searchEl.innerHTML=notice,listEl.appendChild(searchEl))}function parseItems(inputValues){var itemList=[];if(Array.isArray(inputValues))inputValues.forEach((function(value){var item={};"object"===(void 0===value?"undefined":_typeof(value))?(item.title=editorParams.listItemFormatter?editorParams.listItemFormatter(value.value,value.label):value.label,item.value=value.value):(item.title=editorParams.listItemFormatter?editorParams.listItemFormatter(value,value):value,item.value=value),itemList.push(item)}));else for(var key in inputValues){var item={title:editorParams.listItemFormatter?editorParams.listItemFormatter(key,inputValues[key]):inputValues[key],value:key};itemList.push(item)}return itemList}function clearList(){for(;listEl.firstChild;)listEl.removeChild(listEl.firstChild)}function fillListIfNotEmpty(items,intialLoad){items.length?fillList(items,intialLoad):editorParams.emptyPlaceholder&&addNotice(editorParams.emptyPlaceholder)}function fillList(items,intialLoad){var current=!1;clearList(),(displayItems=items).forEach((function(item){var el=item.element;el||((el=document.createElement("div")).classList.add("tabulator-edit-select-list-item"),el.tabIndex=0,el.innerHTML=item.title,el.addEventListener("click",(function(e){setCurrentItem(item),chooseItem()})),el.addEventListener("mousedown",(function(e){blurable=!1,setTimeout((function(){blurable=!0}),10)})),item.element=el,intialLoad&&item.value==initialValue&&(input.value=item.title,item.element.classList.add("active"),current=!0),item===currentItem&&(item.element.classList.add("active"),current=!0)),listEl.appendChild(el)})),current||setCurrentItem(!1)}function chooseItem(){hideList(),currentItem?initialValue!==currentItem.value?(initialValue=currentItem.value,input.value=currentItem.title,success(currentItem.value)):cancel():editorParams.freetext?(initialValue=input.value,success(input.value)):editorParams.allowEmpty&&""===input.value?(initialValue=input.value,success(input.value)):cancel()}function showList(){if(!listEl.parentNode){for(;listEl.firstChild;)listEl.removeChild(listEl.firstChild);var offset=Tabulator.prototype.helpers.elOffset(cellEl);listEl.style.minWidth=cellEl.offsetWidth+"px",listEl.style.top=offset.top+cellEl.offsetHeight+"px",listEl.style.left=offset.left+"px",document.body.appendChild(listEl)}}function setCurrentItem(item,showInputValue){currentItem&¤tItem.element&¤tItem.element.classList.remove("active"),currentItem=item,item&&item.element&&item.element.classList.add("active")}function hideList(){listEl.parentNode&&listEl.parentNode.removeChild(listEl),removeScrollListener()}function cancelItem(){hideList(),cancel()}function removeScrollListener(){self.table.rowManager.element.removeEventListener("scroll",cancelItem)}return listEl.classList.add("tabulator-edit-select-list"),listEl.addEventListener("mousedown",(function(e){blurable=!1,setTimeout((function(){blurable=!0}),10)})),input.addEventListener("keydown",(function(e){var index;switch(e.keyCode){case 38:index=displayItems.indexOf(currentItem),("editor"==vertNav||"hybrid"==vertNav&&index)&&(e.stopImmediatePropagation(),e.stopPropagation(),e.preventDefault(),setCurrentItem(index>0&&displayItems[index-1]));break;case 40:index=displayItems.indexOf(currentItem),("editor"==vertNav||"hybrid"==vertNav&&index'):("ie"==self.table.browser?star.setAttribute("class","tabulator-star-inactive"):star.classList.replace("tabulator-star-active","tabulator-star-inactive"),star.innerHTML='')}))}function buildStar(i){var starHolder=document.createElement("span"),nextStar=star.cloneNode(!0);stars.push(nextStar),starHolder.addEventListener("mouseenter",(function(e){e.stopPropagation(),e.stopImmediatePropagation(),starChange(i)})),starHolder.addEventListener("mousemove",(function(e){e.stopPropagation(),e.stopImmediatePropagation()})),starHolder.addEventListener("click",(function(e){e.stopPropagation(),e.stopImmediatePropagation(),success(i),element.blur()})),starHolder.appendChild(nextStar),starsHolder.appendChild(starHolder)}function changeValue(val){value=val,starChange(val)}if(element.style.whiteSpace="nowrap",element.style.overflow="hidden",element.style.textOverflow="ellipsis",starsHolder.style.verticalAlign="middle",starsHolder.style.display="inline-block",starsHolder.style.padding="4px",star.setAttribute("width",size),star.setAttribute("height",size),star.setAttribute("viewBox","0 0 512 512"),star.setAttribute("xml:space","preserve"),star.style.padding="0 1px",editorParams.elementAttributes&&"object"==_typeof(editorParams.elementAttributes))for(var key in editorParams.elementAttributes)"+"==key.charAt(0)?(key=key.slice(1),starsHolder.setAttribute(key,starsHolder.getAttribute(key)+editorParams.elementAttributes["+"+key])):starsHolder.setAttribute(key,editorParams.elementAttributes[key]);for(var i=1;i<=maxStars;i++)buildStar(i);return starChange(value=Math.min(parseInt(value),maxStars)),starsHolder.addEventListener("mousemove",(function(e){starChange(0)})),starsHolder.addEventListener("click",(function(e){success(0)})),element.addEventListener("blur",(function(e){cancel()})),element.addEventListener("keydown",(function(e){switch(e.keyCode){case 39:changeValue(value+1);break;case 37:changeValue(value-1);break;case 13:success(value);break;case 27:cancel()}})),starsHolder},progress:function progress(cell,onRendered,success,cancel,editorParams){var element=cell.getElement(),max=void 0===editorParams.max?element.getElementsByTagName("div")[0].getAttribute("max")||100:editorParams.max,min=void 0===editorParams.min?element.getElementsByTagName("div")[0].getAttribute("min")||0:editorParams.min,percent=(max-min)/100,value=cell.getValue()||0,handle=document.createElement("div"),bar=document.createElement("div"),mouseDrag,mouseDragWidth;function updateValue(){var calcVal=percent*Math.round(bar.offsetWidth/(element.clientWidth/100))+min;success(calcVal),element.setAttribute("aria-valuenow",calcVal),element.setAttribute("aria-label",value)}if(handle.style.position="absolute",handle.style.right="0",handle.style.top="0",handle.style.bottom="0",handle.style.width="5px",handle.classList.add("tabulator-progress-handle"),bar.style.display="inline-block",bar.style.position="relative",bar.style.height="100%",bar.style.backgroundColor="#488CE9",bar.style.maxWidth="100%",bar.style.minWidth="0%",editorParams.elementAttributes&&"object"==_typeof(editorParams.elementAttributes))for(var key in editorParams.elementAttributes)"+"==key.charAt(0)?(key=key.slice(1),bar.setAttribute(key,bar.getAttribute(key)+editorParams.elementAttributes["+"+key])):bar.setAttribute(key,editorParams.elementAttributes[key]);return element.style.padding="4px 4px",value=Math.min(parseFloat(value),max),value=Math.max(parseFloat(value),min),value=Math.round((value-min)/percent),bar.style.width=value+"%",element.setAttribute("aria-valuemin",min),element.setAttribute("aria-valuemax",max),bar.appendChild(handle),handle.addEventListener("mousedown",(function(e){mouseDrag=e.screenX,mouseDragWidth=bar.offsetWidth})),handle.addEventListener("mouseover",(function(){handle.style.cursor="ew-resize"})),element.addEventListener("mousemove",(function(e){mouseDrag&&(bar.style.width=mouseDragWidth+e.screenX-mouseDrag+"px")})),element.addEventListener("mouseup",(function(e){mouseDrag&&(e.stopPropagation(),e.stopImmediatePropagation(),mouseDrag=!1,mouseDragWidth=!1,updateValue())})),element.addEventListener("keydown",(function(e){switch(e.keyCode){case 39:e.preventDefault(),bar.style.width=bar.clientWidth+element.clientWidth/100+"px";break;case 37:e.preventDefault(),bar.style.width=bar.clientWidth-element.clientWidth/100+"px";break;case 9:case 13:updateValue();break;case 27:cancel()}})),element.addEventListener("blur",(function(){cancel()})),bar},tickCross:function tickCross(cell,onRendered,success,cancel,editorParams){var value=cell.getValue(),input=document.createElement("input"),tristate=editorParams.tristate,indetermValue=void 0===editorParams.indeterminateValue?null:editorParams.indeterminateValue,indetermState=!1;if(input.setAttribute("type","checkbox"),input.style.marginTop="5px",input.style.boxSizing="border-box",editorParams.elementAttributes&&"object"==_typeof(editorParams.elementAttributes))for(var key in editorParams.elementAttributes)"+"==key.charAt(0)?(key=key.slice(1),input.setAttribute(key,input.getAttribute(key)+editorParams.elementAttributes["+"+key])):input.setAttribute(key,editorParams.elementAttributes[key]);function setValue(blur){return tristate?blur?indetermState?indetermValue:input.checked:input.checked&&!indetermState?(input.checked=!1,input.indeterminate=!0,indetermState=!0,indetermValue):(indetermState=!1,input.checked):input.checked}return input.value=value,!tristate||void 0!==value&&value!==indetermValue&&""!==value||(indetermState=!0,input.indeterminate=!0),"firefox"!=this.table.browser&&onRendered((function(){input.focus({preventScroll:!0})})),input.checked=!0===value||"true"===value||"True"===value||1===value,input.addEventListener("change",(function(e){success(setValue())})),input.addEventListener("blur",(function(e){success(setValue(!0))})),input.addEventListener("keydown",(function(e){13==e.keyCode&&success(setValue()),27==e.keyCode&&cancel()})),input}},Tabulator.prototype.registerModule("edit",Edit);var ExportRow=function ExportRow(type,columns,component,indent){this.type=type,this.columns=columns,this.component=component||!1,this.indent=indent||0},ExportColumn=function ExportColumn(value,component,width,height,depth){this.value=value,this.component=component||!1,this.width=width,this.height=height,this.depth=depth},Export=function Export(table){this.table=table,this.config={},this.cloneTableStyle=!0,this.colVisProp=""};Export.prototype.generateExportList=function(config,style,range,colVisProp){this.cloneTableStyle=style,this.config=config||{},this.colVisProp=colVisProp;var headers=!1!==this.config.columnHeaders?this.headersToExportRows(this.generateColumnGroupHeaders()):[],body=this.bodyToExportRows(this.rowLookup(range));return headers.concat(body)},Export.prototype.genereateTable=function(config,style,range,colVisProp){var list=this.generateExportList(config,style,range,colVisProp);return this.genereateTableElement(list)},Export.prototype.rowLookup=function(range){var _this45=this,rows=[];if("function"==typeof range)range.call(this.table).forEach((function(row){(row=_this45.table.rowManager.findRow(row))&&rows.push(row)}));else switch(range){case!0:case"visible":rows=this.table.rowManager.getVisibleRows(!0);break;case"all":rows=this.table.rowManager.rows;break;case"selected":rows=this.table.modules.selectRow.selectedRows;break;case"active":default:rows=this.table.rowManager.getDisplayRows()}return Object.assign([],rows)},Export.prototype.generateColumnGroupHeaders=function(){var _this46=this,output=[],columns;return(!1!==this.config.columnGroups?this.table.columnManager.columns:this.table.columnManager.columnsByIndex).forEach((function(column){var colData=_this46.processColumnGroup(column);colData&&output.push(colData)})),output},Export.prototype.processColumnGroup=function(column){var _this47=this,subGroups=column.columns,maxDepth=0,title,groupData={title:column.definition["title"+(this.colVisProp.charAt(0).toUpperCase()+this.colVisProp.slice(1))]||column.definition.title,column:column,depth:1};if(subGroups.length){if(groupData.subGroups=[],groupData.width=0,subGroups.forEach((function(subGroup){var subGroupData=_this47.processColumnGroup(subGroup);subGroupData&&(groupData.width+=subGroupData.width,groupData.subGroups.push(subGroupData),subGroupData.depth>maxDepth&&(maxDepth=subGroupData.depth))})),groupData.depth+=maxDepth,!groupData.width)return!1}else{if(!this.columnVisCheck(column))return!1;groupData.width=1}return groupData},Export.prototype.columnVisCheck=function(column){return!1!==column.definition[this.colVisProp]&&(column.visible||!column.visible&&column.definition[this.colVisProp])},Export.prototype.headersToExportRows=function(columns){var headers=[],headerDepth=0,exportRows=[];function parseColumnGroup(column,level){var depth=headerDepth-level;if(void 0===headers[level]&&(headers[level]=[]),column.height=column.subGroups?1:depth-column.depth+1,headers[level].push(column),column.height>1)for(var _i6=1;_i61)for(var _i7=1;_i7headerDepth&&(headerDepth=column.depth)})),columns.forEach((function(column){parseColumnGroup(column,0)})),headers.forEach((function(header){var columns=[];header.forEach((function(col){col?columns.push(new ExportColumn(col.title,col.column.getComponent(),col.width,col.height,col.depth)):columns.push(null)})),exportRows.push(new ExportRow("header",columns))})),exportRows},Export.prototype.bodyToExportRows=function(rows){var _this48=this,columns=[],exportRows=[];return this.table.columnManager.columnsByIndex.forEach((function(column){_this48.columnVisCheck(column)&&columns.push(column.getComponent())})),!1!==this.config.columnCalcs&&this.table.modExists("columnCalcs")&&(this.table.modules.columnCalcs.topInitialized&&rows.unshift(this.table.modules.columnCalcs.topRow),this.table.modules.columnCalcs.botInitialized&&rows.push(this.table.modules.columnCalcs.botRow)),(rows=rows.filter((function(row){switch(row.type){case"group":return!1!==_this48.config.rowGroups;case"calc":return!1!==_this48.config.columnCalcs;case"row":return!(_this48.table.options.dataTree&&!1===_this48.config.dataTree&&row.modules.dataTree.parent)}return!0}))).forEach((function(row,i){var rowData=row.getData(_this48.colVisProp),exportCols=[],indent=0;switch(row.type){case"group":indent=row.level,exportCols.push(new ExportColumn(row.key,row.getComponent(),columns.length,1));break;case"calc":case"row":columns.forEach((function(col){exportCols.push(new ExportColumn(col._column.getFieldValue(rowData),col,1,1))})),_this48.table.options.dataTree&&!1!==_this48.config.dataTree&&(indent=row.modules.dataTree.index)}exportRows.push(new ExportRow(row.type,exportCols,row.getComponent(),indent))})),exportRows},Export.prototype.genereateTableElement=function(list){var _this49=this,table=document.createElement("table"),headerEl=document.createElement("thead"),bodyEl=document.createElement("tbody"),styles=this.lookupTableStyles(),rowFormatter=this.table.options["rowFormatter"+(this.colVisProp.charAt(0).toUpperCase()+this.colVisProp.slice(1))],setup={};return setup.rowFormatter=null!==rowFormatter?rowFormatter:this.table.options.rowFormatter,this.table.options.dataTree&&!1!==this.config.dataTree&&this.table.modExists("columnCalcs")&&(setup.treeElementField=this.table.modules.dataTree.elementField),setup.groupHeader=this.table.options["groupHeader"+(this.colVisProp.charAt(0).toUpperCase()+this.colVisProp.slice(1))],setup.groupHeader&&!Array.isArray(setup.groupHeader)&&(setup.groupHeader=[setup.groupHeader]),table.classList.add("tabulator-print-table"),this.mapElementStyles(this.table.columnManager.getHeadersElement(),headerEl,["border-top","border-left","border-right","border-bottom","background-color","color","font-weight","font-family","font-size"]),list.length>1e3&&console.warn("It may take a long time to render an HTML table with more than 1000 rows"),list.forEach((function(row,i){switch(row.type){case"header":headerEl.appendChild(_this49.genereateHeaderElement(row,setup,styles));break;case"group":bodyEl.appendChild(_this49.genereateGroupElement(row,setup,styles));break;case"calc":bodyEl.appendChild(_this49.genereateCalcElement(row,setup,styles));break;case"row":var rowEl=_this49.genereateRowElement(row,setup,styles);_this49.mapElementStyles(i%2&&styles.evenRow?styles.evenRow:styles.oddRow,rowEl,["border-top","border-left","border-right","border-bottom","color","font-weight","font-family","font-size","background-color"]),bodyEl.appendChild(rowEl)}})),headerEl.innerHTML&&table.appendChild(headerEl),table.appendChild(bodyEl),this.mapElementStyles(this.table.element,table,["border-top","border-left","border-right","border-bottom"]),table},Export.prototype.lookupTableStyles=function(){var styles={};return this.cloneTableStyle&&window.getComputedStyle&&(styles.oddRow=this.table.element.querySelector(".tabulator-row-odd:not(.tabulator-group):not(.tabulator-calcs)"),styles.evenRow=this.table.element.querySelector(".tabulator-row-even:not(.tabulator-group):not(.tabulator-calcs)"),styles.calcRow=this.table.element.querySelector(".tabulator-row.tabulator-calcs"),styles.firstRow=this.table.element.querySelector(".tabulator-row:not(.tabulator-group):not(.tabulator-calcs)"),styles.firstGroup=this.table.element.getElementsByClassName("tabulator-group")[0],styles.firstRow&&(styles.styleCells=styles.firstRow.getElementsByClassName("tabulator-cell"),styles.firstCell=styles.styleCells[0],styles.lastCell=styles.styleCells[styles.styleCells.length-1])),styles},Export.prototype.genereateHeaderElement=function(row,setup,styles){var _this50=this,rowEl=document.createElement("tr");return row.columns.forEach((function(column){if(column){var cellEl=document.createElement("th"),classNames=column.component._column.definition.cssClass?column.component._column.definition.cssClass.split(" "):[];cellEl.colSpan=column.width,cellEl.rowSpan=column.height,cellEl.innerHTML=column.value,_this50.cloneTableStyle&&(cellEl.style.boxSizing="border-box"),classNames.forEach((function(className){cellEl.classList.add(className)})),_this50.mapElementStyles(column.component.getElement(),cellEl,["text-align","border-top","border-left","border-right","border-bottom","background-color","color","font-weight","font-family","font-size"]),_this50.mapElementStyles(column.component._column.contentElement,cellEl,["padding-top","padding-left","padding-right","padding-bottom"]),column.component._column.visible?_this50.mapElementStyles(column.component.getElement(),cellEl,["width"]):column.component._column.definition.width&&(cellEl.style.width=column.component._column.definition.width+"px"),column.component._column.parent&&_this50.mapElementStyles(column.component._column.parent.groupElement,cellEl,["border-top"]),rowEl.appendChild(cellEl)}})),rowEl},Export.prototype.genereateGroupElement=function(row,setup,styles){var rowEl=document.createElement("tr"),cellEl=document.createElement("td"),group=row.columns[0];return rowEl.classList.add("tabulator-print-table-row"),setup.groupHeader&&setup.groupHeader[row.indent]?group.value=setup.groupHeader[row.indent](group.value,row.component._group.getRowCount(),row.component._group.getData(),row.component):!1===setup.groupHeader?group.value=group.value:group.value=row.component._group.generator(group.value,row.component._group.getRowCount(),row.component._group.getData(),row.component),cellEl.colSpan=group.width,cellEl.innerHTML=group.value,rowEl.classList.add("tabulator-print-table-group"),rowEl.classList.add("tabulator-group-level-"+row.indent),group.component.getVisibility()&&rowEl.classList.add("tabulator-group-visible"),this.mapElementStyles(styles.firstGroup,rowEl,["border-top","border-left","border-right","border-bottom","color","font-weight","font-family","font-size","background-color"]),this.mapElementStyles(styles.firstGroup,cellEl,["padding-top","padding-left","padding-right","padding-bottom"]),rowEl.appendChild(cellEl),rowEl},Export.prototype.genereateCalcElement=function(row,setup,styles){var rowEl=this.genereateRowElement(row,setup,styles);return rowEl.classList.add("tabulator-print-table-calcs"),this.mapElementStyles(styles.calcRow,rowEl,["border-top","border-left","border-right","border-bottom","color","font-weight","font-family","font-size","background-color"]),rowEl},Export.prototype.genereateRowElement=function(row,setup,styles){var _this51=this,rowEl=document.createElement("tr");return rowEl.classList.add("tabulator-print-table-row"),row.columns.forEach((function(col){if(col){var cellEl=document.createElement("td"),column=col.component._column,value=col.value,cellWrapper={modules:{},getValue:function getValue(){return value},getField:function getField(){return column.definition.field},getElement:function getElement(){return cellEl},getColumn:function getColumn(){return column.getComponent()},getData:function getData(){return rowData},getRow:function getRow(){return row.getComponent()},getComponent:function getComponent(){return cellWrapper},column:column},classNames;if((column.definition.cssClass?column.definition.cssClass.split(" "):[]).forEach((function(className){cellEl.classList.add(className)})),_this51.table.modExists("format")&&!1!==_this51.config.formatCells)value=_this51.table.modules.format.formatExportValue(cellWrapper,_this51.colVisProp);else switch(void 0===value?"undefined":_typeof(value)){case"object":value=JSON.stringify(value);break;case"undefined":case"null":value="";break;default:value=value}if(value instanceof Node?cellEl.appendChild(value):cellEl.innerHTML=value,styles.firstCell&&(_this51.mapElementStyles(styles.firstCell,cellEl,["padding-top","padding-left","padding-right","padding-bottom","border-top","border-left","border-right","border-bottom","color","font-weight","font-family","font-size"]),column.definition.align&&(cellEl.style.textAlign=column.definition.align)),_this51.table.options.dataTree&&!1!==_this51.config.dataTree&&(setup.treeElementField&&setup.treeElementField==column.field||!setup.treeElementField&&0==i)&&(row.component._row.modules.dataTree.controlEl&&cellEl.insertBefore(row.component._row.modules.dataTree.controlEl.cloneNode(!0),cellEl.firstChild),row.component._row.modules.dataTree.branchEl&&cellEl.insertBefore(row.component._row.modules.dataTree.branchEl.cloneNode(!0),cellEl.firstChild)),rowEl.appendChild(cellEl),cellWrapper.modules.format&&cellWrapper.modules.format.renderedCallback&&cellWrapper.modules.format.renderedCallback(),setup.rowFormatter&&!1!==_this51.config.formatCells){var rowComponent=row.getComponent();rowComponent.getElement=function(){return rowEl},setup.rowFormatter(rowComponent)}}})),rowEl},Export.prototype.genereateHTMLTable=function(list){var holder=document.createElement("div");return holder.appendChild(this.genereateTableElement(list)),holder.innerHTML},Export.prototype.getHtml=function(visible,style,config,colVisProp){var list=this.generateExportList(config||this.table.options.htmlOutputConfig,style,visible,colVisProp||"htmlOutput");return this.genereateHTMLTable(list)},Export.prototype.mapElementStyles=function(from,to,props){if(this.cloneTableStyle&&from&&to){var lookup={"background-color":"backgroundColor",color:"fontColor",width:"width","font-weight":"fontWeight","font-family":"fontFamily","font-size":"fontSize","text-align":"textAlign","border-top":"borderTop","border-left":"borderLeft","border-right":"borderRight","border-bottom":"borderBottom","padding-top":"paddingTop","padding-left":"paddingLeft","padding-right":"paddingRight","padding-bottom":"paddingBottom"};if(window.getComputedStyle){var fromStyle=window.getComputedStyle(from);props.forEach((function(prop){to.style[lookup[prop]]=fromStyle.getPropertyValue(prop)}))}}},Tabulator.prototype.registerModule("export",Export);var Filter=function Filter(table){this.table=table,this.filterList=[],this.headerFilters={},this.headerFilterColumns=[],this.prevHeaderFilterChangeCheck="",this.prevHeaderFilterChangeCheck="{}",this.changed=!1};Filter.prototype.initializeColumn=function(column,value){var self=this,field=column.getField(),params;function success(value){var filterType="input"==column.modules.filter.tagType&&"text"==column.modules.filter.attrType||"textarea"==column.modules.filter.tagType?"partial":"match",type="",filterChangeCheck="",filterFunc;if(void 0===column.modules.filter.prevSuccess||column.modules.filter.prevSuccess!==value){if(column.modules.filter.prevSuccess=value,column.modules.filter.emptyFunc(value))delete self.headerFilters[field];else{switch(column.modules.filter.value=value,_typeof(column.definition.headerFilterFunc)){case"string":self.filters[column.definition.headerFilterFunc]?(type=column.definition.headerFilterFunc,filterFunc=function filterFunc(data){var params=column.definition.headerFilterFuncParams||{},fieldVal=column.getFieldValue(data);return params="function"==typeof params?params(value,fieldVal,data):params,self.filters[column.definition.headerFilterFunc](value,fieldVal,data,params)}):console.warn("Header Filter Error - Matching filter function not found: ",column.definition.headerFilterFunc);break;case"function":type=filterFunc=function filterFunc(data){var params=column.definition.headerFilterFuncParams||{},fieldVal=column.getFieldValue(data);return params="function"==typeof params?params(value,fieldVal,data):params,column.definition.headerFilterFunc(value,fieldVal,data,params)}}if(!filterFunc)switch(filterType){case"partial":filterFunc=function filterFunc(data){var colVal=column.getFieldValue(data);return null!=colVal&&String(colVal).toLowerCase().indexOf(String(value).toLowerCase())>-1},type="like";break;default:filterFunc=function filterFunc(data){return column.getFieldValue(data)==value},type="="}self.headerFilters[field]={value:value,func:filterFunc,type:type,params:{}}}filterChangeCheck=JSON.stringify(self.headerFilters),self.prevHeaderFilterChangeCheck!==filterChangeCheck&&(self.prevHeaderFilterChangeCheck=filterChangeCheck,self.changed=!0,self.table.rowManager.filterRefresh())}return!0}column.modules.filter={success:success,attrType:!1,tagType:!1,emptyFunc:!1},this.generateHeaderFilterElement(column)},Filter.prototype.generateHeaderFilterElement=function(column,initialValue,reinitialize){var _this52=this,self=this,success=column.modules.filter.success,field=column.getField(),filterElement,editor,editorElement,cellWrapper,typingTimer,searchTrigger,params;function cancel(){}if(column.modules.filter.headerElement&&column.modules.filter.headerElement.parentNode&&column.contentElement.removeChild(column.modules.filter.headerElement.parentNode),field){switch(column.modules.filter.emptyFunc=column.definition.headerFilterEmptyCheck||function(value){return!value&&"0"!==value},(filterElement=document.createElement("div")).classList.add("tabulator-header-filter"),_typeof(column.definition.headerFilter)){case"string":self.table.modules.edit.editors[column.definition.headerFilter]?(editor=self.table.modules.edit.editors[column.definition.headerFilter],"tick"!==column.definition.headerFilter&&"tickCross"!==column.definition.headerFilter||column.definition.headerFilterEmptyCheck||(column.modules.filter.emptyFunc=function(value){return!0!==value&&!1!==value})):console.warn("Filter Error - Cannot build header filter, No such editor found: ",column.definition.editor);break;case"function":editor=column.definition.headerFilter;break;case"boolean":column.modules.edit&&column.modules.edit.editor?editor=column.modules.edit.editor:column.definition.formatter&&self.table.modules.edit.editors[column.definition.formatter]?(editor=self.table.modules.edit.editors[column.definition.formatter],"tick"!==column.definition.formatter&&"tickCross"!==column.definition.formatter||column.definition.headerFilterEmptyCheck||(column.modules.filter.emptyFunc=function(value){return!0!==value&&!1!==value})):editor=self.table.modules.edit.editors.input}if(editor){if(cellWrapper={getValue:function getValue(){return void 0!==initialValue?initialValue:""},getField:function getField(){return column.definition.field},getElement:function getElement(){return filterElement},getColumn:function getColumn(){return column.getComponent()},getRow:function getRow(){return{normalizeHeight:function normalizeHeight(){}}}},params="function"==typeof(params=column.definition.headerFilterParams||{})?params.call(self.table):params,!(editorElement=editor.call(this.table.modules.edit,cellWrapper,(function(){}),success,cancel,params)))return void console.warn("Filter Error - Cannot add filter to "+field+" column, editor returned a value of false");if(!(editorElement instanceof Node))return void console.warn("Filter Error - Cannot add filter to "+field+" column, editor should return an instance of Node, the editor returned:",editorElement);field?self.table.modules.localize.bind("headerFilters|columns|"+column.definition.field,(function(value){editorElement.setAttribute("placeholder",void 0!==value&&value?value:self.table.modules.localize.getText("headerFilters|default"))})):self.table.modules.localize.bind("headerFilters|default",(function(value){editorElement.setAttribute("placeholder",void 0!==self.column.definition.headerFilterPlaceholder&&self.column.definition.headerFilterPlaceholder?self.column.definition.headerFilterPlaceholder:value)})),editorElement.addEventListener("click",(function(e){e.stopPropagation(),editorElement.focus()})),editorElement.addEventListener("focus",(function(e){var left=_this52.table.columnManager.element.scrollLeft;left!==_this52.table.rowManager.element.scrollLeft&&(_this52.table.rowManager.scrollHorizontal(left),_this52.table.columnManager.scrollHorizontal(left))})),typingTimer=!1,searchTrigger=function searchTrigger(e){typingTimer&&clearTimeout(typingTimer),typingTimer=setTimeout((function(){success(editorElement.value)}),self.table.options.headerFilterLiveFilterDelay)},column.modules.filter.headerElement=editorElement,column.modules.filter.attrType=editorElement.hasAttribute("type")?editorElement.getAttribute("type").toLowerCase():"",column.modules.filter.tagType=editorElement.tagName.toLowerCase(),!1!==column.definition.headerFilterLiveFilter&&("autocomplete"!==column.definition.headerFilter&&"tickCross"!==column.definition.headerFilter&&("autocomplete"!==column.definition.editor&&"tickCross"!==column.definition.editor||!0!==column.definition.headerFilter)&&(editorElement.addEventListener("keyup",searchTrigger),editorElement.addEventListener("search",searchTrigger),"number"==column.modules.filter.attrType&&editorElement.addEventListener("change",(function(e){success(editorElement.value)})),"text"==column.modules.filter.attrType&&"ie"!==this.table.browser&&editorElement.setAttribute("type","search")),"input"!=column.modules.filter.tagType&&"select"!=column.modules.filter.tagType&&"textarea"!=column.modules.filter.tagType||editorElement.addEventListener("mousedown",(function(e){e.stopPropagation()}))),filterElement.appendChild(editorElement),column.contentElement.appendChild(filterElement),reinitialize||self.headerFilterColumns.push(column)}}else console.warn("Filter Error - Cannot add header filter, column has no field set:",column.definition.title)},Filter.prototype.hideHeaderFilterElements=function(){this.headerFilterColumns.forEach((function(column){column.modules.filter&&column.modules.filter.headerElement&&(column.modules.filter.headerElement.style.display="none")}))},Filter.prototype.showHeaderFilterElements=function(){this.headerFilterColumns.forEach((function(column){column.modules.filter&&column.modules.filter.headerElement&&(column.modules.filter.headerElement.style.display="")}))},Filter.prototype.setHeaderFilterFocus=function(column){column.modules.filter&&column.modules.filter.headerElement?column.modules.filter.headerElement.focus():console.warn("Column Filter Focus Error - No header filter set on column:",column.getField())},Filter.prototype.getHeaderFilterValue=function(column){if(column.modules.filter&&column.modules.filter.headerElement)return column.modules.filter.headerElement.value;console.warn("Column Filter Error - No header filter set on column:",column.getField())},Filter.prototype.setHeaderFilterValue=function(column,value){column&&(column.modules.filter&&column.modules.filter.headerElement?(this.generateHeaderFilterElement(column,value,!0),column.modules.filter.success(value)):console.warn("Column Filter Error - No header filter set on column:",column.getField()))},Filter.prototype.reloadHeaderFilter=function(column){column&&(column.modules.filter&&column.modules.filter.headerElement?this.generateHeaderFilterElement(column,column.modules.filter.value,!0):console.warn("Column Filter Error - No header filter set on column:",column.getField()))},Filter.prototype.hasChanged=function(){var changed=this.changed;return this.changed=!1,changed},Filter.prototype.setFilter=function(field,type,value,params){var self=this;this.filterList=[],Array.isArray(field)||(field=[{field:field,type:type,value:value,params:params}]),this.addFilter(field)},Filter.prototype.addFilter=function(field,type,value,params){var self=this;Array.isArray(field)||(field=[{field:field,type:type,value:value,params:params}]),field.forEach((function(filter){(filter=self.findFilter(filter))&&(self.filterList.push(filter),self.changed=!0)})),this.table.options.persistence&&this.table.modExists("persistence",!0)&&this.table.modules.persistence.config.filter&&this.table.modules.persistence.save("filter")},Filter.prototype.findFilter=function(filter){var self=this,column;if(Array.isArray(filter))return this.findSubFilters(filter);var filterFunc=!1;return"function"==typeof filter.field?filterFunc=function filterFunc(data){return filter.field(data,filter.type||{})}:self.filters[filter.type]?filterFunc=(column=self.table.columnManager.getColumnByField(filter.field))?function filterFunc(data){return self.filters[filter.type](filter.value,column.getFieldValue(data),data,filter.params||{})}:function filterFunc(data){return self.filters[filter.type](filter.value,data[filter.field],data,filter.params||{})}:console.warn("Filter Error - No such filter type found, ignoring: ",filter.type),filter.func=filterFunc,!!filter.func&&filter},Filter.prototype.findSubFilters=function(filters){var self=this,output=[];return filters.forEach((function(filter){(filter=self.findFilter(filter))&&output.push(filter)})),!!output.length&&output},Filter.prototype.getFilters=function(all,ajax){var output=[];return all&&(output=this.getHeaderFilters()),ajax&&output.forEach((function(item){"function"==typeof item.type&&(item.type="function")})),output=output.concat(this.filtersToArray(this.filterList,ajax))},Filter.prototype.filtersToArray=function(filterList,ajax){var _this53=this,output=[];return filterList.forEach((function(filter){var item;Array.isArray(filter)?output.push(_this53.filtersToArray(filter,ajax)):(item={field:filter.field,type:filter.type,value:filter.value},ajax&&"function"==typeof item.type&&(item.type="function"),output.push(item))})),output},Filter.prototype.getHeaderFilters=function(){var self=this,output=[];for(var key in this.headerFilters)output.push({field:key,type:this.headerFilters[key].type,value:this.headerFilters[key].value});return output},Filter.prototype.removeFilter=function(field,type,value){var self=this;Array.isArray(field)||(field=[{field:field,type:type,value:value}]),field.forEach((function(filter){var index=-1;(index="object"==_typeof(filter.field)?self.filterList.findIndex((function(element){return filter===element})):self.filterList.findIndex((function(element){return filter.field===element.field&&filter.type===element.type&&filter.value===element.value})))>-1?(self.filterList.splice(index,1),self.changed=!0):console.warn("Filter Error - No matching filter type found, ignoring: ",filter.type)})),this.table.options.persistence&&this.table.modExists("persistence",!0)&&this.table.modules.persistence.config.filter&&this.table.modules.persistence.save("filter")},Filter.prototype.clearFilter=function(all){this.filterList=[],all&&this.clearHeaderFilter(),this.changed=!0,this.table.options.persistence&&this.table.modExists("persistence",!0)&&this.table.modules.persistence.config.filter&&this.table.modules.persistence.save("filter")},Filter.prototype.clearHeaderFilter=function(){var self=this;this.headerFilters={},self.prevHeaderFilterChangeCheck="{}",this.headerFilterColumns.forEach((function(column){column.modules.filter.value=null,column.modules.filter.prevSuccess=void 0,self.reloadHeaderFilter(column)})),this.changed=!0},Filter.prototype.search=function(searchType,field,type,value){var self=this,activeRows=[],filterList=[];return Array.isArray(field)||(field=[{field:field,type:type,value:value}]),field.forEach((function(filter){(filter=self.findFilter(filter))&&filterList.push(filter)})),this.table.rowManager.rows.forEach((function(row){var match=!0;filterList.forEach((function(filter){self.filterRecurse(filter,row.getData())||(match=!1)})),match&&activeRows.push("data"===searchType?row.getData("data"):row.getComponent())})),activeRows},Filter.prototype.filter=function(rowList,filters){var self=this,activeRows=[],activeRowComponents=[];return self.table.options.dataFiltering&&self.table.options.dataFiltering.call(self.table,self.getFilters()),self.table.options.ajaxFiltering||!self.filterList.length&&!Object.keys(self.headerFilters).length?activeRows=rowList.slice(0):rowList.forEach((function(row){self.filterRow(row)&&activeRows.push(row)})),self.table.options.dataFiltered&&(activeRows.forEach((function(row){activeRowComponents.push(row.getComponent())})),self.table.options.dataFiltered.call(self.table,self.getFilters(),activeRowComponents)),activeRows},Filter.prototype.filterRow=function(row,filters){var self=this,match=!0,data=row.getData();for(var field in self.filterList.forEach((function(filter){self.filterRecurse(filter,data)||(match=!1)})),self.headerFilters)self.headerFilters[field].func(data)||(match=!1);return match},Filter.prototype.filterRecurse=function(filter,data){var self=this,match=!1;return Array.isArray(filter)?filter.forEach((function(subFilter){self.filterRecurse(subFilter,data)&&(match=!0)})):match=filter.func(data),match},Filter.prototype.filters={"=":function _(filterVal,rowVal,rowData,filterParams){return rowVal==filterVal},"<":function _(filterVal,rowVal,rowData,filterParams){return rowVal":function _(filterVal,rowVal,rowData,filterParams){return rowVal>filterVal},">=":function _(filterVal,rowVal,rowData,filterParams){return rowVal>=filterVal},"!=":function _(filterVal,rowVal,rowData,filterParams){return rowVal!=filterVal},regex:function regex(filterVal,rowVal,rowData,filterParams){return"string"==typeof filterVal&&(filterVal=new RegExp(filterVal)),filterVal.test(rowVal)},like:function like(filterVal,rowVal,rowData,filterParams){return null==filterVal?rowVal===filterVal:null!=rowVal&&String(rowVal).toLowerCase().indexOf(filterVal.toLowerCase())>-1},keywords:function keywords(filterVal,rowVal,rowData,filterParams){var keywords=filterVal.toLowerCase().split(void 0===filterParams.separator?" ":filterParams.separator),value=String(null==rowVal?"":rowVal).toLowerCase(),matches=[];return keywords.forEach((function(keyword){value.includes(keyword)&&matches.push(!0)})),filterParams.matchAll?matches.length===keywords.length:!!matches.length},starts:function starts(filterVal,rowVal,rowData,filterParams){return null==filterVal?rowVal===filterVal:null!=rowVal&&String(rowVal).toLowerCase().startsWith(filterVal.toLowerCase())},ends:function ends(filterVal,rowVal,rowData,filterParams){return null==filterVal?rowVal===filterVal:null!=rowVal&&String(rowVal).toLowerCase().endsWith(filterVal.toLowerCase())},in:function _in(filterVal,rowVal,rowData,filterParams){return Array.isArray(filterVal)?filterVal.indexOf(rowVal)>-1:(console.warn("Filter Error - filter value is not an array:",filterVal),!1)}},Tabulator.prototype.registerModule("filter",Filter);var Format=function Format(table){this.table=table};Format.prototype.initializeColumn=function(column){column.modules.format=this.lookupFormatter(column,""),void 0!==column.definition.formatterPrint&&(column.modules.format.print=this.lookupFormatter(column,"Print")),void 0!==column.definition.formatterClipboard&&(column.modules.format.clipboard=this.lookupFormatter(column,"Clipboard")),void 0!==column.definition.formatterHtmlOutput&&(column.modules.format.htmlOutput=this.lookupFormatter(column,"HtmlOutput"))},Format.prototype.lookupFormatter=function(column,type){var config={params:column.definition["formatter"+type+"Params"]||{}},formatter=column.definition["formatter"+type];switch(void 0===formatter?"undefined":_typeof(formatter)){case"string":"tick"===formatter&&(formatter="tickCross",void 0===config.params.crossElement&&(config.params.crossElement=!1),console.warn("DEPRECATION WARNING - the tick formatter has been deprecated, please use the tickCross formatter with the crossElement param set to false")),this.formatters[formatter]?config.formatter=this.formatters[formatter]:(console.warn("Formatter Error - No such formatter found: ",formatter),config.formatter=this.formatters.plaintext);break;case"function":config.formatter=formatter;break;default:config.formatter=this.formatters.plaintext}return config},Format.prototype.cellRendered=function(cell){cell.modules.format&&cell.modules.format.renderedCallback&&cell.modules.format.renderedCallback()},Format.prototype.formatValue=function(cell){var component=cell.getComponent(),params="function"==typeof cell.column.modules.format.params?cell.column.modules.format.params(component):cell.column.modules.format.params;function onRendered(callback){cell.modules.format||(cell.modules.format={}),cell.modules.format.renderedCallback=callback}return cell.column.modules.format.formatter.call(this,component,params,onRendered)},Format.prototype.formatExportValue=function(cell,type){var formatter=cell.column.modules.format[type],params;if(formatter){var onRendered=function onRendered(callback){cell.modules.format||(cell.modules.format={}),cell.modules.format.renderedCallback=callback};return params="function"==typeof formatter.params?formatter.params(component):formatter.params,formatter.formatter.call(this,cell.getComponent(),params,onRendered)}return this.formatValue(cell)},Format.prototype.sanitizeHTML=function(value){if(value){var entityMap={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/","`":"`","=":"="};return String(value).replace(/[&<>"'`=\/]/g,(function(s){return entityMap[s]}))}return value},Format.prototype.emptyToSpace=function(value){return null==value||""===value?" ":value},Format.prototype.getFormatter=function(formatter){var formatter;switch(void 0===formatter?"undefined":_typeof(formatter)){case"string":this.formatters[formatter]?formatter=this.formatters[formatter]:(console.warn("Formatter Error - No such formatter found: ",formatter),formatter=this.formatters.plaintext);break;case"function":formatter=formatter;break;default:formatter=this.formatters.plaintext}return formatter},Format.prototype.formatters={plaintext:function plaintext(cell,formatterParams,onRendered){return this.emptyToSpace(this.sanitizeHTML(cell.getValue()))},html:function html(cell,formatterParams,onRendered){return cell.getValue()},textarea:function textarea(cell,formatterParams,onRendered){return cell.getElement().style.whiteSpace="pre-wrap",this.emptyToSpace(this.sanitizeHTML(cell.getValue()))},money:function money(cell,formatterParams,onRendered){var floatVal=parseFloat(cell.getValue()),number,integer,decimal,rgx,decimalSym=formatterParams.decimal||".",thousandSym=formatterParams.thousand||",",symbol=formatterParams.symbol||"",after=!!formatterParams.symbolAfter,precision=void 0!==formatterParams.precision?formatterParams.precision:2;if(isNaN(floatVal))return this.emptyToSpace(this.sanitizeHTML(cell.getValue()));for(number=!1!==precision?floatVal.toFixed(precision):floatVal,integer=(number=String(number).split("."))[0],decimal=number.length>1?decimalSym+number[1]:"",rgx=/(\d+)(\d{3})/;rgx.test(integer);)integer=integer.replace(rgx,"$1"+thousandSym+"$2");return after?integer+decimal+symbol:symbol+integer+decimal},link:function link(cell,formatterParams,onRendered){var value=cell.getValue(),urlPrefix=formatterParams.urlPrefix||"",download=formatterParams.download,label=value,el=document.createElement("a"),data;if(formatterParams.labelField&&(label=(data=cell.getData())[formatterParams.labelField]),formatterParams.label)switch(_typeof(formatterParams.label)){case"string":label=formatterParams.label;break;case"function":label=formatterParams.label(cell)}if(label){if(formatterParams.urlField&&(value=(data=cell.getData())[formatterParams.urlField]),formatterParams.url)switch(_typeof(formatterParams.url)){case"string":value=formatterParams.url;break;case"function":value=formatterParams.url(cell)}return el.setAttribute("href",urlPrefix+value),formatterParams.target&&el.setAttribute("target",formatterParams.target),formatterParams.download&&(download="function"==typeof download?download(cell):!0===download?"":download,el.setAttribute("download",download)),el.innerHTML=this.emptyToSpace(this.sanitizeHTML(label)),el}return" "},image:function image(cell,formatterParams,onRendered){var el=document.createElement("img");switch(el.setAttribute("src",cell.getValue()),_typeof(formatterParams.height)){case"number":el.style.height=formatterParams.height+"px";break;case"string":el.style.height=formatterParams.height}switch(_typeof(formatterParams.width)){case"number":el.style.width=formatterParams.width+"px";break;case"string":el.style.width=formatterParams.width}return el.addEventListener("load",(function(){cell.getRow().normalizeHeight()})),el},tickCross:function tickCross(cell,formatterParams,onRendered){var value=cell.getValue(),element=cell.getElement(),empty=formatterParams.allowEmpty,truthy=formatterParams.allowTruthy,tick=void 0!==formatterParams.tickElement?formatterParams.tickElement:'',cross=void 0!==formatterParams.crossElement?formatterParams.crossElement:'';return truthy&&value||!0===value||"true"===value||"True"===value||1===value||"1"===value?(element.setAttribute("aria-checked",!0),tick||""):!empty||"null"!==value&&""!==value&&null!=value?(element.setAttribute("aria-checked",!1),cross||""):(element.setAttribute("aria-checked","mixed"),"")},datetime:function datetime(cell,formatterParams,onRendered){var inputFormat=formatterParams.inputFormat||"YYYY-MM-DD hh:mm:ss",outputFormat=formatterParams.outputFormat||"DD/MM/YYYY hh:mm:ss",invalid=void 0!==formatterParams.invalidPlaceholder?formatterParams.invalidPlaceholder:"",value=cell.getValue(),newDatetime=moment(value,inputFormat);return newDatetime.isValid()?formatterParams.timezone?newDatetime.tz(formatterParams.timezone).format(outputFormat):newDatetime.format(outputFormat):!0===invalid?value:"function"==typeof invalid?invalid(value):invalid},datetimediff:function datetime(cell,formatterParams,onRendered){var inputFormat=formatterParams.inputFormat||"YYYY-MM-DD hh:mm:ss",invalid=void 0!==formatterParams.invalidPlaceholder?formatterParams.invalidPlaceholder:"",suffix=void 0!==formatterParams.suffix&&formatterParams.suffix,unit=void 0!==formatterParams.unit?formatterParams.unit:void 0,humanize=void 0!==formatterParams.humanize&&formatterParams.humanize,date=void 0!==formatterParams.date?formatterParams.date:moment(),value=cell.getValue(),newDatetime=moment(value,inputFormat);return newDatetime.isValid()?humanize?moment.duration(newDatetime.diff(date)).humanize(suffix):newDatetime.diff(date,unit)+(suffix?" "+suffix:""):!0===invalid?value:"function"==typeof invalid?invalid(value):invalid},lookup:function lookup(cell,formatterParams,onRendered){var value=cell.getValue();return void 0===formatterParams[value]?(console.warn("Missing display value for "+value),value):formatterParams[value]},star:function star(cell,formatterParams,onRendered){var value=cell.getValue(),element=cell.getElement(),maxStars=formatterParams&&formatterParams.stars?formatterParams.stars:5,stars=document.createElement("span"),star=document.createElementNS("http://www.w3.org/2000/svg","svg"),starActive='',starInactive='';stars.style.verticalAlign="middle",star.setAttribute("width","14"),star.setAttribute("height","14"),star.setAttribute("viewBox","0 0 512 512"),star.setAttribute("xml:space","preserve"),star.style.padding="0 1px",value=value&&!isNaN(value)?parseInt(value):0,value=Math.max(0,Math.min(value,maxStars));for(var i=1;i<=maxStars;i++){var nextStar=star.cloneNode(!0);nextStar.innerHTML=i<=value?starActive:starInactive,stars.appendChild(nextStar)}return element.style.whiteSpace="nowrap",element.style.overflow="hidden",element.style.textOverflow="ellipsis",element.setAttribute("aria-label",value),stars},traffic:function traffic(cell,formatterParams,onRendered){var value=this.sanitizeHTML(cell.getValue())||0,el=document.createElement("span"),max=formatterParams&&formatterParams.max?formatterParams.max:100,min=formatterParams&&formatterParams.min?formatterParams.min:0,colors=formatterParams&&void 0!==formatterParams.color?formatterParams.color:["red","orange","green"],color="#666666",percent,percentValue;if(!isNaN(value)&&void 0!==cell.getValue()){switch(el.classList.add("tabulator-traffic-light"),percentValue=parseFloat(value)<=max?parseFloat(value):max,percentValue=parseFloat(percentValue)>=min?parseFloat(percentValue):min,percent=(max-min)/100,percentValue=Math.round((percentValue-min)/percent),void 0===colors?"undefined":_typeof(colors)){case"string":color=colors;break;case"function":color=colors(value);break;case"object":if(Array.isArray(colors)){var unit=100/colors.length,index=Math.floor(percentValue/unit);index=Math.min(index,colors.length-1),color=colors[index=Math.max(index,0)];break}}return el.style.backgroundColor=color,el}},progress:function progress(cell,formatterParams,onRendered){var value=this.sanitizeHTML(cell.getValue())||0,element=cell.getElement(),max=formatterParams&&formatterParams.max?formatterParams.max:100,min=formatterParams&&formatterParams.min?formatterParams.min:0,legendAlign=formatterParams&&formatterParams.legendAlign?formatterParams.legendAlign:"center",percent,percentValue,color,legend,legendColor,top,left,right,bottom;switch(percentValue=parseFloat(value)<=max?parseFloat(value):max,percentValue=parseFloat(percentValue)>=min?parseFloat(percentValue):min,percent=(max-min)/100,percentValue=Math.round((percentValue-min)/percent),_typeof(formatterParams.color)){case"string":color=formatterParams.color;break;case"function":color=formatterParams.color(value);break;case"object":if(Array.isArray(formatterParams.color)){var unit=100/formatterParams.color.length,index=Math.floor(percentValue/unit);index=Math.min(index,formatterParams.color.length-1),index=Math.max(index,0),color=formatterParams.color[index];break}default:color="#2DC214"}switch(_typeof(formatterParams.legend)){case"string":legend=formatterParams.legend;break;case"function":legend=formatterParams.legend(value);break;case"boolean":legend=value;break;default:legend=!1}switch(_typeof(formatterParams.legendColor)){case"string":legendColor=formatterParams.legendColor;break;case"function":legendColor=formatterParams.legendColor(value);break;case"object":if(Array.isArray(formatterParams.legendColor)){var unit=100/formatterParams.legendColor.length,index=Math.floor(percentValue/unit);index=Math.min(index,formatterParams.legendColor.length-1),index=Math.max(index,0),legendColor=formatterParams.legendColor[index]}break;default:legendColor="#000"}element.style.minWidth="30px",element.style.position="relative",element.setAttribute("aria-label",percentValue);var barEl=document.createElement("div");if(barEl.style.display="inline-block",barEl.style.position="relative",barEl.style.width=percentValue+"%",barEl.style.backgroundColor=color,barEl.style.height="100%",barEl.setAttribute("data-max",max),barEl.setAttribute("data-min",min),legend){var legendEl=document.createElement("div");legendEl.style.position="absolute",legendEl.style.top="4px",legendEl.style.left=0,legendEl.style.textAlign=legendAlign,legendEl.style.width="100%",legendEl.style.color=legendColor,legendEl.innerHTML=legend}return onRendered((function(){if(!(cell instanceof CellComponent)){var holderEl=document.createElement("div");holderEl.style.position="absolute",holderEl.style.top="4px",holderEl.style.bottom="4px",holderEl.style.left="4px",holderEl.style.right="4px",element.appendChild(holderEl),element=holderEl}element.appendChild(barEl),legend&&element.appendChild(legendEl)})),""},color:function color(cell,formatterParams,onRendered){return cell.getElement().style.backgroundColor=this.sanitizeHTML(cell.getValue()),""},buttonTick:function buttonTick(cell,formatterParams,onRendered){return''},buttonCross:function buttonCross(cell,formatterParams,onRendered){return''},rownum:function rownum(cell,formatterParams,onRendered){return this.table.rowManager.activeRows.indexOf(cell.getRow()._getSelf())+1},handle:function handle(cell,formatterParams,onRendered){return cell.getElement().classList.add("tabulator-row-handle"),"
"},responsiveCollapse:function responsiveCollapse(cell,formatterParams,onRendered){var self=this,open=!1,el=document.createElement("div"),config=cell.getRow()._row.modules.responsiveLayout;function toggleList(isOpen){var collapseEl=config.element;config.open=isOpen,collapseEl&&(config.open?(el.classList.add("open"),collapseEl.style.display=""):(el.classList.remove("open"),collapseEl.style.display="none"))}return el.classList.add("tabulator-responsive-collapse-toggle"),el.innerHTML="+-",cell.getElement().classList.add("tabulator-row-handle"),el.addEventListener("click",(function(e){e.stopImmediatePropagation(),toggleList(!config.open)})),toggleList(config.open),el},rowSelection:function rowSelection(cell){var _this54=this,checkbox=document.createElement("input");if(checkbox.type="checkbox",this.table.modExists("selectRow",!0))if(checkbox.addEventListener("click",(function(e){e.stopPropagation()})),"function"==typeof cell.getRow){var row=cell.getRow();checkbox.addEventListener("change",(function(e){row.toggleSelect()})),checkbox.checked=row.isSelected(),this.table.modules.selectRow.registerRowSelectCheckbox(row,checkbox)}else checkbox.addEventListener("change",(function(e){_this54.table.modules.selectRow.selectedRows.length?_this54.table.deselectRow():_this54.table.selectRow()})),this.table.modules.selectRow.registerHeaderSelectCheckbox(checkbox);return checkbox}},Tabulator.prototype.registerModule("format",Format);var FrozenColumns=function FrozenColumns(table){this.table=table,this.leftColumns=[],this.rightColumns=[],this.leftMargin=0,this.rightMargin=0,this.rightPadding=0,this.initializationMode="left",this.active=!1,this.scrollEndTimer=!1};FrozenColumns.prototype.reset=function(){this.initializationMode="left",this.leftColumns=[],this.rightColumns=[],this.leftMargin=0,this.rightMargin=0,this.rightMargin=0,this.active=!1,this.table.columnManager.headersElement.style.marginLeft=0,this.table.columnManager.element.style.paddingRight=0},FrozenColumns.prototype.initializeColumn=function(column){var config={margin:0,edge:!1};column.isGroup||(this.frozenCheck(column)?(config.position=this.initializationMode,"left"==this.initializationMode?this.leftColumns.push(column):this.rightColumns.unshift(column),this.active=!0,column.modules.frozen=config):this.initializationMode="right")},FrozenColumns.prototype.frozenCheck=function(column){var frozen=!1;return column.parent.isGroup&&column.definition.frozen&&console.warn("Frozen Column Error - Parent column group must be frozen, not individual columns or sub column groups"),column.parent.isGroup?this.frozenCheck(column.parent):column.definition.frozen},FrozenColumns.prototype.scrollHorizontal=function(){var _this55=this,rows;this.active&&(clearTimeout(this.scrollEndTimer),this.scrollEndTimer=setTimeout((function(){_this55.layout()}),100),rows=this.table.rowManager.getVisibleRows(),this.calcMargins(),this.layoutColumnPosition(),this.layoutCalcRows(),rows.forEach((function(row){"row"===row.type&&_this55.layoutRow(row)})),this.table.rowManager.tableElement.style.marginRight=this.rightMargin)},FrozenColumns.prototype.calcMargins=function(){this.leftMargin=this._calcSpace(this.leftColumns,this.leftColumns.length)+"px",this.table.columnManager.headersElement.style.marginLeft=this.leftMargin,this.rightMargin=this._calcSpace(this.rightColumns,this.rightColumns.length)+"px",this.table.columnManager.element.style.paddingRight=this.rightMargin,this.rightPadding=this.table.rowManager.element.clientWidth+this.table.columnManager.scrollLeft},FrozenColumns.prototype.layoutCalcRows=function(){this.table.modExists("columnCalcs")&&(this.table.modules.columnCalcs.topInitialized&&this.table.modules.columnCalcs.topRow&&this.layoutRow(this.table.modules.columnCalcs.topRow),this.table.modules.columnCalcs.botInitialized&&this.table.modules.columnCalcs.botRow&&this.layoutRow(this.table.modules.columnCalcs.botRow))},FrozenColumns.prototype.layoutColumnPosition=function(allCells){var _this56=this,leftParents=[];this.leftColumns.forEach((function(column,i){if(column.modules.frozen.margin=_this56._calcSpace(_this56.leftColumns,i)+_this56.table.columnManager.scrollLeft+"px",i==_this56.leftColumns.length-1?column.modules.frozen.edge=!0:column.modules.frozen.edge=!1,column.parent.isGroup){var parentEl=_this56.getColGroupParentElement(column);leftParents.includes(parentEl)||(_this56.layoutElement(parentEl,column),leftParents.push(parentEl)),column.modules.frozen.edge&&parentEl.classList.add("tabulator-frozen-"+column.modules.frozen.position)}else _this56.layoutElement(column.getElement(),column);allCells&&column.cells.forEach((function(cell){_this56.layoutElement(cell.getElement(),column)}))})),this.rightColumns.forEach((function(column,i){column.modules.frozen.margin=_this56.rightPadding-_this56._calcSpace(_this56.rightColumns,i+1)+"px",i==_this56.rightColumns.length-1?column.modules.frozen.edge=!0:column.modules.frozen.edge=!1,column.parent.isGroup?_this56.layoutElement(_this56.getColGroupParentElement(column),column):_this56.layoutElement(column.getElement(),column),allCells&&column.cells.forEach((function(cell){_this56.layoutElement(cell.getElement(),column)}))}))},FrozenColumns.prototype.getColGroupParentElement=function(column){return column.parent.isGroup?this.getColGroupParentElement(column.parent):column.getElement()},FrozenColumns.prototype.layout=function(){var self=this,rightMargin=0;self.active&&(this.calcMargins(),self.table.rowManager.getDisplayRows().forEach((function(row){"row"===row.type&&self.layoutRow(row)})),this.layoutCalcRows(),this.layoutColumnPosition(!0),this.table.rowManager.tableElement.style.marginRight=this.rightMargin)},FrozenColumns.prototype.layoutRow=function(row){var _this57=this,rowEl;row.getElement().style.paddingLeft=this.leftMargin,this.leftColumns.forEach((function(column){var cell=row.getCell(column);cell&&_this57.layoutElement(cell.getElement(),column)})),this.rightColumns.forEach((function(column){var cell=row.getCell(column);cell&&_this57.layoutElement(cell.getElement(),column)}))},FrozenColumns.prototype.layoutElement=function(element,column){column.modules.frozen&&(element.style.position="absolute",element.style.left=column.modules.frozen.margin,element.classList.add("tabulator-frozen"),column.modules.frozen.edge&&element.classList.add("tabulator-frozen-"+column.modules.frozen.position))},FrozenColumns.prototype._calcSpace=function(columns,index){for(var width=0,_i8=0;_i8-1&&output.splice(index,1)})),output},FrozenRows.prototype.freezeRow=function(row){row.modules.frozen?console.warn("Freeze Error - Row is already frozen"):(row.modules.frozen=!0,this.topElement.appendChild(row.getElement()),row.initialize(),row.normalizeHeight(),this.table.rowManager.adjustTableSize(),this.rows.push(row),this.table.rowManager.refreshActiveData("display"),this.styleRows())},FrozenRows.prototype.unfreezeRow=function(row){var index=this.rows.indexOf(row);if(row.modules.frozen){row.modules.frozen=!1;var rowEl=row.getElement();rowEl.parentNode.removeChild(rowEl),this.table.rowManager.adjustTableSize(),this.rows.splice(index,1),this.table.rowManager.refreshActiveData("display"),this.rows.length&&this.styleRows()}else console.warn("Freeze Error - Row is already unfrozen")},FrozenRows.prototype.styleRows=function(row){var self=this;this.rows.forEach((function(row,i){self.table.rowManager.styleRow(row,i)}))},Tabulator.prototype.registerModule("frozenRows",FrozenRows);var GroupComponent=function GroupComponent(group){this._group=group,this.type="GroupComponent"};GroupComponent.prototype.getKey=function(){return this._group.key},GroupComponent.prototype.getField=function(){return this._group.field},GroupComponent.prototype.getElement=function(){return this._group.element},GroupComponent.prototype.getRows=function(){return this._group.getRows(!0)},GroupComponent.prototype.getSubGroups=function(){return this._group.getSubGroups(!0)},GroupComponent.prototype.getParentGroup=function(){return!!this._group.parent&&this._group.parent.getComponent()},GroupComponent.prototype.getVisibility=function(){return console.warn("getVisibility function is deprecated, you should now use the isVisible function"),this._group.visible},GroupComponent.prototype.isVisible=function(){return this._group.visible},GroupComponent.prototype.show=function(){this._group.show()},GroupComponent.prototype.hide=function(){this._group.hide()},GroupComponent.prototype.toggle=function(){this._group.toggleVisibility()},GroupComponent.prototype._getSelf=function(){return this._group},GroupComponent.prototype.getTable=function(){return this._group.groupManager.table};var Group=function Group(groupManager,parent,level,key,field,generator,oldGroup){this.groupManager=groupManager,this.parent=parent,this.key=key,this.level=level,this.field=field,this.hasSubGroups=level-1?after?this.rows.splice(toIndex+1,0,row):this.rows.splice(toIndex,0,row):after?this.rows.push(row):this.rows.unshift(row),row.modules.group=this,this.generateGroupHeaderContents(),this.groupManager.table.modExists("columnCalcs")&&"table"!=this.groupManager.table.options.columnCalcs&&this.groupManager.table.modules.columnCalcs.recalcGroup(this),this.groupManager.updateGroupRows(!0)},Group.prototype.scrollHeader=function(left){this.arrowElement.style.marginLeft=left,this.groupList.forEach((function(child){child.scrollHeader(left)}))},Group.prototype.getRowIndex=function(row){},Group.prototype.conformRowData=function(data){return this.field?data[this.field]=this.key:console.warn("Data Conforming Error - Cannot conform row data to match new group as groupBy is a function"),this.parent&&(data=this.parent.conformRowData(data)),data},Group.prototype.removeRow=function(row){var index=this.rows.indexOf(row),el=row.getElement();index>-1&&this.rows.splice(index,1),this.groupManager.table.options.groupValues||this.rows.length?(el.parentNode&&el.parentNode.removeChild(el),this.generateGroupHeaderContents(),this.groupManager.table.modExists("columnCalcs")&&"table"!=this.groupManager.table.options.columnCalcs&&this.groupManager.table.modules.columnCalcs.recalcGroup(this)):(this.parent?this.parent.removeGroup(this):this.groupManager.removeGroup(this),this.groupManager.updateGroupRows(!0))},Group.prototype.removeGroup=function(group){var groupKey=group.level+"_"+group.key,index;this.groups[groupKey]&&(delete this.groups[groupKey],(index=this.groupList.indexOf(group))>-1&&this.groupList.splice(index,1),this.groupList.length||(this.parent?this.parent.removeGroup(this):this.groupManager.removeGroup(this)))},Group.prototype.getHeadersAndRows=function(noCalc){var output=[];return output.push(this),this._visSet(),this.visible?this.groupList.length?this.groupList.forEach((function(group){output=output.concat(group.getHeadersAndRows(noCalc))})):(!noCalc&&"table"!=this.groupManager.table.options.columnCalcs&&this.groupManager.table.modExists("columnCalcs")&&this.groupManager.table.modules.columnCalcs.hasTopCalcs()&&(this.calcs.top&&(this.calcs.top.detachElement(),this.calcs.top.deleteCells()),this.calcs.top=this.groupManager.table.modules.columnCalcs.generateTopRow(this.rows),output.push(this.calcs.top)),output=output.concat(this.rows),!noCalc&&"table"!=this.groupManager.table.options.columnCalcs&&this.groupManager.table.modExists("columnCalcs")&&this.groupManager.table.modules.columnCalcs.hasBottomCalcs()&&(this.calcs.bottom&&(this.calcs.bottom.detachElement(),this.calcs.bottom.deleteCells()),this.calcs.bottom=this.groupManager.table.modules.columnCalcs.generateBottomRow(this.rows),output.push(this.calcs.bottom))):this.groupList.length||"table"==this.groupManager.table.options.columnCalcs||this.groupManager.table.modExists("columnCalcs")&&(!noCalc&&this.groupManager.table.modules.columnCalcs.hasTopCalcs()&&(this.calcs.top&&(this.calcs.top.detachElement(),this.calcs.top.deleteCells()),this.groupManager.table.options.groupClosedShowCalcs&&(this.calcs.top=this.groupManager.table.modules.columnCalcs.generateTopRow(this.rows),output.push(this.calcs.top))),!noCalc&&this.groupManager.table.modules.columnCalcs.hasBottomCalcs()&&(this.calcs.bottom&&(this.calcs.bottom.detachElement(),this.calcs.bottom.deleteCells()),this.groupManager.table.options.groupClosedShowCalcs&&(this.calcs.bottom=this.groupManager.table.modules.columnCalcs.generateBottomRow(this.rows),output.push(this.calcs.bottom)))),output},Group.prototype.getData=function(visible,transform){var self=this,output=[];return this._visSet(),(!visible||visible&&this.visible)&&this.rows.forEach((function(row){output.push(row.getData(transform||"data"))})),output},Group.prototype.getRowCount=function(){var count=0;return this.groupList.length?this.groupList.forEach((function(group){count+=group.getRowCount()})):count=this.rows.length,count},Group.prototype.toggleVisibility=function(){this.visible?this.hide():this.show()},Group.prototype.hide=function(){this.visible=!1,"classic"!=this.groupManager.table.rowManager.getRenderMode()||this.groupManager.table.options.pagination?this.groupManager.updateGroupRows(!0):(this.element.classList.remove("tabulator-group-visible"),this.groupList.length?this.groupList.forEach((function(group){var rows;group.getHeadersAndRows().forEach((function(row){row.detachElement()}))})):this.rows.forEach((function(row){var rowEl=row.getElement();rowEl.parentNode.removeChild(rowEl)})),this.groupManager.table.rowManager.setDisplayRows(this.groupManager.updateGroupRows(),this.groupManager.getDisplayIndex()),this.groupManager.table.rowManager.checkClassicModeGroupHeaderWidth()),this.groupManager.table.options.groupVisibilityChanged.call(this.table,this.getComponent(),!1)},Group.prototype.show=function(){var self=this;if(this.visible=!0,"classic"!=this.groupManager.table.rowManager.getRenderMode()||this.groupManager.table.options.pagination)this.groupManager.updateGroupRows(!0);else{this.element.classList.add("tabulator-group-visible");var prev=this.getElement();this.groupList.length?this.groupList.forEach((function(group){var rows;group.getHeadersAndRows().forEach((function(row){var rowEl=row.getElement();prev.parentNode.insertBefore(rowEl,prev.nextSibling),row.initialize(),prev=rowEl}))})):this.rows.forEach((function(row){var rowEl=row.getElement();prev.parentNode.insertBefore(rowEl,prev.nextSibling),row.initialize(),prev=rowEl})),this.groupManager.table.rowManager.setDisplayRows(this.groupManager.updateGroupRows(),this.groupManager.getDisplayIndex()),this.groupManager.table.rowManager.checkClassicModeGroupHeaderWidth()}this.groupManager.table.options.groupVisibilityChanged.call(this.table,this.getComponent(),!0)},Group.prototype._visSet=function(){var data=[];"function"==typeof this.visible&&(this.rows.forEach((function(row){data.push(row.getData())})),this.visible=this.visible(this.key,this.getRowCount(),data,this.getComponent()))},Group.prototype.getRowGroup=function(row){var match=!1;return this.groupList.length?this.groupList.forEach((function(group){var result=group.getRowGroup(row);result&&(match=result)})):this.rows.find((function(item){return item===row}))&&(match=this),match},Group.prototype.getSubGroups=function(component){var output=[];return this.groupList.forEach((function(child){output.push(component?child.getComponent():child)})),output},Group.prototype.getRows=function(compoment){var output=[];return this.rows.forEach((function(row){output.push(compoment?row.getComponent():row)})),output},Group.prototype.generateGroupHeaderContents=function(){var data=[];for(this.rows.forEach((function(row){data.push(row.getData())})),this.elementContents=this.generator(this.key,this.getRowCount(),data,this.getComponent());this.element.firstChild;)this.element.removeChild(this.element.firstChild);"string"==typeof this.elementContents?this.element.innerHTML=this.elementContents:this.element.appendChild(this.elementContents),this.element.insertBefore(this.arrowElement,this.element.firstChild)},Group.prototype.getElement=function(){this.addBindingsd=!1,this._visSet(),this.visible?this.element.classList.add("tabulator-group-visible"):this.element.classList.remove("tabulator-group-visible");for(var i=0;igroupHeader.length&&console.warn("Error creating group headers, groupHeader array is shorter than groupBy array"),self.headerGenerator=[function(){return""}],this.startOpen=[function(){return!1}],self.table.modules.localize.bind("groups|item",(function(langValue,lang){self.headerGenerator[0]=function(value,count,data){return(void 0===value?"":value)+"("+count+" "+(1===count?langValue:lang.groups.items)+")"}})),this.groupIDLookups=[],Array.isArray(groupBy)||groupBy)?this.table.modExists("columnCalcs")&&"table"!=this.table.options.columnCalcs&&"both"!=this.table.options.columnCalcs&&this.table.modules.columnCalcs.removeCalcs():this.table.modExists("columnCalcs")&&"group"!=this.table.options.columnCalcs&&this.table.columnManager.getRealColumns().forEach((function(col){col.definition.topCalc&&self.table.modules.columnCalcs.initializeTopRow(),col.definition.bottomCalc&&self.table.modules.columnCalcs.initializeBottomRow()}));Array.isArray(groupBy)||(groupBy=[groupBy]),groupBy.forEach((function(group,i){var lookupFunc,column;lookupFunc="function"==typeof group?group:(column=self.table.columnManager.getColumnByField(group))?function lookupFunc(data){return column.getFieldValue(data)}:function lookupFunc(data){return data[group]},self.groupIDLookups.push({field:"function"!=typeof group&&group,func:lookupFunc,values:!!self.allowedValues&&self.allowedValues[i]})})),startOpen&&(Array.isArray(startOpen)||(startOpen=[startOpen]),startOpen.forEach((function(level){level="function"==typeof level?level:function(){return!0}})),self.startOpen=startOpen),groupHeader&&(self.headerGenerator=Array.isArray(groupHeader)?groupHeader:[groupHeader]),this.initialized=!0},GroupRows.prototype.setDisplayIndex=function(index){this.displayIndex=index},GroupRows.prototype.getDisplayIndex=function(){return this.displayIndex},GroupRows.prototype.getRows=function(rows){return this.groupIDLookups.length?(this.table.options.dataGrouping.call(this.table),this.generateGroups(rows),this.table.options.dataGrouped&&this.table.options.dataGrouped.call(this.table,this.getGroups(!0)),this.updateGroupRows()):rows.slice(0)},GroupRows.prototype.getGroups=function(compoment){var groupComponents=[];return this.groupList.forEach((function(group){groupComponents.push(compoment?group.getComponent():group)})),groupComponents},GroupRows.prototype.getChildGroups=function(group){var _this59=this,groupComponents=[];return group||(group=this),group.groupList.forEach((function(child){child.groupList.length?groupComponents=groupComponents.concat(_this59.getChildGroups(child)):groupComponents.push(child)})),groupComponents},GroupRows.prototype.wipe=function(){this.groupList.forEach((function(group){group.wipe()}))},GroupRows.prototype.pullGroupListData=function(groupList){var self=this,groupListData=[];return groupList.forEach((function(group){var groupHeader={level:0,rowCount:0,headerContent:""},childData=[];group.hasSubGroups?(childData=self.pullGroupListData(group.groupList),groupHeader.level=group.level,groupHeader.rowCount=childData.length-group.groupList.length,groupHeader.headerContent=group.generator(group.key,groupHeader.rowCount,group.rows,group),groupListData.push(groupHeader),groupListData=groupListData.concat(childData)):(groupHeader.level=group.level,groupHeader.headerContent=group.generator(group.key,group.rows.length,group.rows,group),groupHeader.rowCount=group.getRows().length,groupListData.push(groupHeader),group.getRows().forEach((function(row){groupListData.push(row.getData("data"))})))})),groupListData},GroupRows.prototype.getGroupedData=function(){return this.pullGroupListData(this.groupList)},GroupRows.prototype.getRowGroup=function(row){var match=!1;return this.groupList.forEach((function(group){var result=group.getRowGroup(row);result&&(match=result)})),match},GroupRows.prototype.countGroups=function(){return this.groupList.length},GroupRows.prototype.generateGroups=function(rows){var self=this,oldGroups=self.groups;self.groups={},self.groupList=[],this.allowedValues&&this.allowedValues[0]?(this.allowedValues[0].forEach((function(value){self.createGroup(value,0,oldGroups)})),rows.forEach((function(row){self.assignRowToExistingGroup(row,oldGroups)}))):rows.forEach((function(row){self.assignRowToGroup(row,oldGroups)}))},GroupRows.prototype.createGroup=function(groupID,level,oldGroups){var groupKey=level+"_"+groupID,group;oldGroups=oldGroups||[],group=new Group(this,!1,level,groupID,this.groupIDLookups[0].field,this.headerGenerator[0],oldGroups[groupKey]),this.groups[groupKey]=group,this.groupList.push(group)},GroupRows.prototype.assignRowToExistingGroup=function(row,oldGroups){var groupID,groupKey="0_"+this.groupIDLookups[0].func(row.getData());this.groups[groupKey]&&this.groups[groupKey].addRow(row)},GroupRows.prototype.assignRowToGroup=function(row,oldGroups){var groupID=this.groupIDLookups[0].func(row.getData()),newGroupNeeded=!this.groups["0_"+groupID];return newGroupNeeded&&this.createGroup(groupID,0,oldGroups),this.groups["0_"+groupID].addRow(row),!newGroupNeeded},GroupRows.prototype.updateGroupRows=function(force){var self=this,output=[],oldRowCount;if(this.groupList.forEach((function(group){output=output.concat(group.getHeadersAndRows())})),force){var displayIndex=this.table.rowManager.setDisplayRows(output,this.getDisplayIndex());!0!==displayIndex&&this.setDisplayIndex(displayIndex),this.table.rowManager.refreshActiveData("group",!0,!0)}return output},GroupRows.prototype.scrollHeaders=function(left){left+="px",this.groupList.forEach((function(group){group.scrollHeader(left)}))},GroupRows.prototype.removeGroup=function(group){var groupKey=group.level+"_"+group.key,index;this.groups[groupKey]&&(delete this.groups[groupKey],(index=this.groupList.indexOf(group))>-1&&this.groupList.splice(index,1))},Tabulator.prototype.registerModule("groupRows",GroupRows);var History=function History(table){this.table=table,this.history=[],this.index=-1};History.prototype.clear=function(){this.history=[],this.index=-1},History.prototype.action=function(type,component,data){this.history=this.history.slice(0,this.index+1),this.history.push({type:type,component:component,data:data}),this.index++},History.prototype.getHistoryUndoSize=function(){return this.index+1},History.prototype.getHistoryRedoSize=function(){return this.history.length-(this.index+1)},History.prototype.undo=function(){if(this.index>-1){var action=this.history[this.index];return this.undoers[action.type].call(this,action),this.index--,this.table.options.historyUndo.call(this.table,action.type,action.component.getComponent(),action.data),!0}return console.warn("History Undo Error - No more history to undo"),!1},History.prototype.redo=function(){if(this.history.length-1>this.index){this.index++;var action=this.history[this.index];return this.redoers[action.type].call(this,action),this.table.options.historyRedo.call(this.table,action.type,action.component.getComponent(),action.data),!0}return console.warn("History Redo Error - No more history to redo"),!1},History.prototype.undoers={cellEdit:function cellEdit(action){action.component.setValueProcessData(action.data.oldValue)},rowAdd:function rowAdd(action){action.component.deleteActual()},rowDelete:function rowDelete(action){var newRow=this.table.rowManager.addRowActual(action.data.data,action.data.pos,action.data.index);this.table.options.groupBy&&this.table.modExists("groupRows")&&this.table.modules.groupRows.updateGroupRows(!0),this._rebindRow(action.component,newRow)},rowMove:function rowMove(action){this.table.rowManager.moveRowActual(action.component,this.table.rowManager.rows[action.data.posFrom],!action.data.after),this.table.rowManager.redraw()}},History.prototype.redoers={cellEdit:function cellEdit(action){action.component.setValueProcessData(action.data.newValue)},rowAdd:function rowAdd(action){var newRow=this.table.rowManager.addRowActual(action.data.data,action.data.pos,action.data.index);this.table.options.groupBy&&this.table.modExists("groupRows")&&this.table.modules.groupRows.updateGroupRows(!0),this._rebindRow(action.component,newRow)},rowDelete:function rowDelete(action){action.component.deleteActual()},rowMove:function rowMove(action){this.table.rowManager.moveRowActual(action.component,this.table.rowManager.rows[action.data.posTo],action.data.after),this.table.rowManager.redraw()}},History.prototype._rebindRow=function(oldRow,newRow){this.history.forEach((function(action){if(action.component instanceof Row)action.component===oldRow&&(action.component=newRow);else if(action.component instanceof Cell&&action.component.row===oldRow){var field=action.component.column.getField();field&&(action.component=newRow.getCell(field))}}))},Tabulator.prototype.registerModule("history",History);var HtmlTableImport=function HtmlTableImport(table){this.table=table,this.fieldIndex=[],this.hasIndex=!1};HtmlTableImport.prototype.parseTable=function(){var self=this,element=this.table.element,options=this.table.options,columns=options.columns,headers=element.getElementsByTagName("th"),rows=element.getElementsByTagName("tbody")[0],data=[],newTable;this.hasIndex=!1,this.table.options.htmlImporting.call(this.table),rows=rows?rows.getElementsByTagName("tr"):[],this._extractOptions(element,options),headers.length?this._extractHeaders(headers,rows):this._generateBlankHeaders(headers,rows);for(var index=0;index-1&&self.pressedKeys.splice(index,1)}},this.table.element.addEventListener("keydown",this.keyupBinding),this.table.element.addEventListener("keyup",this.keydownBinding)},Keybindings.prototype.clearBindings=function(){this.keyupBinding&&this.table.element.removeEventListener("keydown",this.keyupBinding),this.keydownBinding&&this.table.element.removeEventListener("keyup",this.keydownBinding)},Keybindings.prototype.checkBinding=function(e,binding){var self=this,match=!0;return e.ctrlKey==binding.ctrl&&e.shiftKey==binding.shift&&e.metaKey==binding.meta&&(binding.keys.forEach((function(key){var index;-1==self.pressedKeys.indexOf(key)&&(match=!1)})),match&&binding.action.call(self,e),!0)},Keybindings.prototype.bindings={navPrev:"shift + 9",navNext:9,navUp:38,navDown:40,scrollPageUp:33,scrollPageDown:34,scrollToStart:36,scrollToEnd:35,undo:"ctrl + 90",redo:"ctrl + 89",copyToClipboard:"ctrl + 67"},Keybindings.prototype.actions={keyBlock:function keyBlock(e){e.stopPropagation(),e.preventDefault()},scrollPageUp:function scrollPageUp(e){var rowManager=this.table.rowManager,newPos=rowManager.scrollTop-rowManager.height,scrollMax=rowManager.element.scrollHeight;e.preventDefault(),rowManager.displayRowsCount&&(newPos>=0?rowManager.element.scrollTop=newPos:rowManager.scrollToRow(rowManager.getDisplayRows()[0])),this.table.element.focus()},scrollPageDown:function scrollPageDown(e){var rowManager=this.table.rowManager,newPos=rowManager.scrollTop+rowManager.height,scrollMax=rowManager.element.scrollHeight;e.preventDefault(),rowManager.displayRowsCount&&(newPos<=scrollMax?rowManager.element.scrollTop=newPos:rowManager.scrollToRow(rowManager.getDisplayRows()[rowManager.displayRowsCount-1])),this.table.element.focus()},scrollToStart:function scrollToStart(e){var rowManager=this.table.rowManager;e.preventDefault(),rowManager.displayRowsCount&&rowManager.scrollToRow(rowManager.getDisplayRows()[0]),this.table.element.focus()},scrollToEnd:function scrollToEnd(e){var rowManager=this.table.rowManager;e.preventDefault(),rowManager.displayRowsCount&&rowManager.scrollToRow(rowManager.getDisplayRows()[rowManager.displayRowsCount-1]),this.table.element.focus()},navPrev:function navPrev(e){var cell=!1;this.table.modExists("edit")&&(cell=this.table.modules.edit.currentCell)&&(e.preventDefault(),cell.nav().prev())},navNext:function navNext(e){var cell=!1,newRow=this.table.options.tabEndNewRow,nav;this.table.modExists("edit")&&(cell=this.table.modules.edit.currentCell)&&(e.preventDefault(),(nav=cell.nav()).next()||newRow&&(cell.getElement().firstChild.blur(),(newRow=!0===newRow?this.table.addRow({}):"function"==typeof newRow?this.table.addRow(newRow(cell.row.getComponent())):this.table.addRow(Object.assign({},newRow))).then((function(){setTimeout((function(){nav.next()}))}))))},navLeft:function navLeft(e){var cell=!1;this.table.modExists("edit")&&(cell=this.table.modules.edit.currentCell)&&(e.preventDefault(),cell.nav().left())},navRight:function navRight(e){var cell=!1;this.table.modExists("edit")&&(cell=this.table.modules.edit.currentCell)&&(e.preventDefault(),cell.nav().right())},navUp:function navUp(e){var cell=!1;this.table.modExists("edit")&&(cell=this.table.modules.edit.currentCell)&&(e.preventDefault(),cell.nav().up())},navDown:function navDown(e){var cell=!1;this.table.modExists("edit")&&(cell=this.table.modules.edit.currentCell)&&(e.preventDefault(),cell.nav().down())},undo:function undo(e){var cell=!1;this.table.options.history&&this.table.modExists("history")&&this.table.modExists("edit")&&((cell=this.table.modules.edit.currentCell)||(e.preventDefault(),this.table.modules.history.undo()))},redo:function redo(e){var cell=!1;this.table.options.history&&this.table.modExists("history")&&this.table.modExists("edit")&&((cell=this.table.modules.edit.currentCell)||(e.preventDefault(),this.table.modules.history.redo()))},copyToClipboard:function copyToClipboard(e){this.table.modules.edit.currentCell||this.table.modExists("clipboard",!0)&&this.table.modules.clipboard.copy(!1,!0)}},Tabulator.prototype.registerModule("keybindings",Keybindings);var Menu=function Menu(table){this.table=table,this.menuEl=!1,this.blurEvent=this.hideMenu.bind(this),this.escEvent=this.escMenu.bind(this),this.nestedMenuBlock=!1};Menu.prototype.initializeColumnHeader=function(column){var _this61=this,headerMenuEl;column.definition.headerContextMenu&&column.getElement().addEventListener("contextmenu",(function(e){var menu="function"==typeof column.definition.headerContextMenu?column.definition.headerContextMenu(column.getComponent()):column.definition.headerContextMenu;e.preventDefault(),_this61.loadMenu(e,column,menu)})),column.definition.headerMenu&&((headerMenuEl=document.createElement("span")).classList.add("tabulator-header-menu-button"),headerMenuEl.innerHTML="⋮",headerMenuEl.addEventListener("click",(function(e){var menu="function"==typeof column.definition.headerMenu?column.definition.headerMenu(column.getComponent()):column.definition.headerMenu;e.stopPropagation(),e.preventDefault(),_this61.loadMenu(e,column,menu)})),column.titleElement.insertBefore(headerMenuEl,column.titleElement.firstChild))},Menu.prototype.initializeCell=function(cell){var _this62=this;cell.getElement().addEventListener("contextmenu",(function(e){var menu="function"==typeof cell.column.definition.contextMenu?cell.column.definition.contextMenu(cell.getComponent()):cell.column.definition.contextMenu;e.stopImmediatePropagation(),_this62.loadMenu(e,cell,menu)}))},Menu.prototype.initializeRow=function(row){var _this63=this;row.getElement().addEventListener("contextmenu",(function(e){var menu="function"==typeof _this63.table.options.rowContextMenu?_this63.table.options.rowContextMenu(row.getComponent()):_this63.table.options.rowContextMenu;_this63.loadMenu(e,row,menu)}))},Menu.prototype.initializeGroup=function(group){var _this64=this;group.getElement().addEventListener("contextmenu",(function(e){var menu="function"==typeof _this64.table.options.groupContextMenu?_this64.table.options.groupContextMenu(group.getComponent()):_this64.table.options.groupContextMenu;_this64.loadMenu(e,group,menu)}))},Menu.prototype.loadMenu=function(e,component,menu){var _this65=this,docHeight=Math.max(document.body.offsetHeight,window.innerHeight);if(e.preventDefault(),menu&&menu.length){if(this.nestedMenuBlock){if(this.isOpen())return}else this.nestedMenuBlock=setTimeout((function(){_this65.nestedMenuBlock=!1}),100);this.hideMenu(),this.menuEl=document.createElement("div"),this.menuEl.classList.add("tabulator-menu"),menu.forEach((function(item){var itemEl=document.createElement("div"),label=item.label,disabled=item.disabled;item.separator?itemEl.classList.add("tabulator-menu-separator"):(itemEl.classList.add("tabulator-menu-item"),"function"==typeof label&&(label=label(component.getComponent())),label instanceof Node?itemEl.appendChild(label):itemEl.innerHTML=label,"function"==typeof disabled&&(disabled=disabled(component.getComponent())),disabled?(itemEl.classList.add("tabulator-menu-item-disabled"),itemEl.addEventListener("click",(function(e){e.stopPropagation()}))):itemEl.addEventListener("click",(function(e){_this65.hideMenu(),item.action(e,component.getComponent())}))),_this65.menuEl.appendChild(itemEl)})),this.menuEl.style.top=e.pageY+"px",this.menuEl.style.left=e.pageX+"px",document.body.addEventListener("click",this.blurEvent),this.table.rowManager.element.addEventListener("scroll",this.blurEvent),setTimeout((function(){document.body.addEventListener("contextmenu",_this65.blurEvent)}),100),document.body.addEventListener("keydown",this.escEvent),document.body.appendChild(this.menuEl),e.pageX+this.menuEl.offsetWidth>=document.body.offsetWidth&&(this.menuEl.style.left="",this.menuEl.style.right=document.body.offsetWidth-e.pageX+"px"),e.pageY+this.menuEl.offsetHeight>=docHeight&&(this.menuEl.style.top="",this.menuEl.style.bottom=docHeight-e.pageY+"px")}},Menu.prototype.isOpen=function(){return!!this.menuEl.parentNode},Menu.prototype.escMenu=function(e){27==e.keyCode&&this.hideMenu()},Menu.prototype.hideMenu=function(){this.menuEl.parentNode&&this.menuEl.parentNode.removeChild(this.menuEl),this.escEvent&&document.body.removeEventListener("keydown",this.escEvent),this.blurEvent&&(document.body.removeEventListener("click",this.blurEvent),document.body.removeEventListener("contextmenu",this.blurEvent),this.table.rowManager.element.removeEventListener("scroll",this.blurEvent))},Menu.prototype.menus={},Tabulator.prototype.registerModule("menu",Menu);var MoveColumns=function MoveColumns(table){this.table=table,this.placeholderElement=this.createPlaceholderElement(),this.hoverElement=!1,this.checkTimeout=!1,this.checkPeriod=250,this.moving=!1,this.toCol=!1,this.toColAfter=!1,this.startX=0,this.autoScrollMargin=40,this.autoScrollStep=5,this.autoScrollTimeout=!1,this.touchMove=!1,this.moveHover=this.moveHover.bind(this),this.endMove=this.endMove.bind(this)};MoveColumns.prototype.createPlaceholderElement=function(){var el=document.createElement("div");return el.classList.add("tabulator-col"),el.classList.add("tabulator-col-placeholder"),el},MoveColumns.prototype.initializeColumn=function(column){var self=this,config={},colEl;column.modules.frozen||(colEl=column.getElement(),config.mousemove=function(e){column.parent===self.moving.parent&&((self.touchMove?e.touches[0].pageX:e.pageX)-Tabulator.prototype.helpers.elOffset(colEl).left+self.table.columnManager.element.scrollLeft>column.getWidth()/2?self.toCol===column&&self.toColAfter||(colEl.parentNode.insertBefore(self.placeholderElement,colEl.nextSibling),self.moveColumn(column,!0)):(self.toCol!==column||self.toColAfter)&&(colEl.parentNode.insertBefore(self.placeholderElement,colEl),self.moveColumn(column,!1)))}.bind(self),colEl.addEventListener("mousedown",(function(e){self.touchMove=!1,1===e.which&&(self.checkTimeout=setTimeout((function(){self.startMove(e,column)}),self.checkPeriod))})),colEl.addEventListener("mouseup",(function(e){1===e.which&&self.checkTimeout&&clearTimeout(self.checkTimeout)})),self.bindTouchEvents(column)),column.modules.moveColumn=config},MoveColumns.prototype.bindTouchEvents=function(column){var self=this,colEl=column.getElement(),startXMove=!1,dir=!1,currentCol,nextCol,prevCol,nextColWidth,prevColWidth,nextColWidthLast,prevColWidthLast;colEl.addEventListener("touchstart",(function(e){self.checkTimeout=setTimeout((function(){self.touchMove=!0,currentCol=column,nextCol=column.nextColumn(),nextColWidth=nextCol?nextCol.getWidth()/2:0,prevCol=column.prevColumn(),prevColWidth=prevCol?prevCol.getWidth()/2:0,nextColWidthLast=0,prevColWidthLast=0,startXMove=!1,self.startMove(e,column)}),self.checkPeriod)}),{passive:!0}),colEl.addEventListener("touchmove",(function(e){var halfCol,diff,moveToCol;self.moving&&(self.moveHover(e),startXMove||(startXMove=e.touches[0].pageX),(diff=e.touches[0].pageX-startXMove)>0?nextCol&&diff-nextColWidthLast>nextColWidth&&(moveToCol=nextCol)!==column&&(startXMove=e.touches[0].pageX,moveToCol.getElement().parentNode.insertBefore(self.placeholderElement,moveToCol.getElement().nextSibling),self.moveColumn(moveToCol,!0)):prevCol&&-diff-prevColWidthLast>prevColWidth&&(moveToCol=prevCol)!==column&&(startXMove=e.touches[0].pageX,moveToCol.getElement().parentNode.insertBefore(self.placeholderElement,moveToCol.getElement()),self.moveColumn(moveToCol,!1)),moveToCol&&(currentCol=moveToCol,nextCol=moveToCol.nextColumn(),nextColWidthLast=nextColWidth,nextColWidth=nextCol?nextCol.getWidth()/2:0,prevCol=moveToCol.prevColumn(),prevColWidthLast=prevColWidth,prevColWidth=prevCol?prevCol.getWidth()/2:0))}),{passive:!0}),colEl.addEventListener("touchend",(function(e){self.checkTimeout&&clearTimeout(self.checkTimeout),self.moving&&self.endMove(e)}))},MoveColumns.prototype.startMove=function(e,column){var element=column.getElement();this.moving=column,this.startX=(this.touchMove?e.touches[0].pageX:e.pageX)-Tabulator.prototype.helpers.elOffset(element).left,this.table.element.classList.add("tabulator-block-select"),this.placeholderElement.style.width=column.getWidth()+"px",this.placeholderElement.style.height=column.getHeight()+"px",element.parentNode.insertBefore(this.placeholderElement,element),element.parentNode.removeChild(element),this.hoverElement=element.cloneNode(!0),this.hoverElement.classList.add("tabulator-moving"),this.table.columnManager.getElement().appendChild(this.hoverElement),this.hoverElement.style.left="0",this.hoverElement.style.bottom="0",this.touchMove||(this._bindMouseMove(),document.body.addEventListener("mousemove",this.moveHover),document.body.addEventListener("mouseup",this.endMove)),this.moveHover(e)},MoveColumns.prototype._bindMouseMove=function(){this.table.columnManager.columnsByIndex.forEach((function(column){column.modules.moveColumn.mousemove&&column.getElement().addEventListener("mousemove",column.modules.moveColumn.mousemove)}))},MoveColumns.prototype._unbindMouseMove=function(){this.table.columnManager.columnsByIndex.forEach((function(column){column.modules.moveColumn.mousemove&&column.getElement().removeEventListener("mousemove",column.modules.moveColumn.mousemove)}))},MoveColumns.prototype.moveColumn=function(column,after){var movingCells=this.moving.getCells();this.toCol=column,this.toColAfter=after,after?column.getCells().forEach((function(cell,i){var cellEl=cell.getElement();cellEl.parentNode.insertBefore(movingCells[i].getElement(),cellEl.nextSibling)})):column.getCells().forEach((function(cell,i){var cellEl=cell.getElement();cellEl.parentNode.insertBefore(movingCells[i].getElement(),cellEl)}))},MoveColumns.prototype.endMove=function(e){(1===e.which||this.touchMove)&&(this._unbindMouseMove(),this.placeholderElement.parentNode.insertBefore(this.moving.getElement(),this.placeholderElement.nextSibling),this.placeholderElement.parentNode.removeChild(this.placeholderElement),this.hoverElement.parentNode.removeChild(this.hoverElement),this.table.element.classList.remove("tabulator-block-select"),this.toCol&&this.table.columnManager.moveColumnActual(this.moving,this.toCol,this.toColAfter),this.moving=!1,this.toCol=!1,this.toColAfter=!1,this.touchMove||(document.body.removeEventListener("mousemove",this.moveHover),document.body.removeEventListener("mouseup",this.endMove)))},MoveColumns.prototype.moveHover=function(e){var self=this,columnHolder=self.table.columnManager.getElement(),scrollLeft=columnHolder.scrollLeft,xPos=(self.touchMove?e.touches[0].pageX:e.pageX)-Tabulator.prototype.helpers.elOffset(columnHolder).left+scrollLeft,scrollPos;self.hoverElement.style.left=xPos-self.startX+"px",xPos-scrollLeftgroup.getHeight()/2?self.toRow===group&&self.toRowAfter||((rowEl=group.getElement()).parentNode.insertBefore(self.placeholderElement,rowEl.nextSibling),self.moveRow(group,!0)):(self.toRow!==group||self.toRowAfter)&&(rowEl=group.getElement()).previousSibling&&(rowEl.parentNode.insertBefore(self.placeholderElement,rowEl),self.moveRow(group,!1))}.bind(self),group.modules.moveRow=config},MoveRows.prototype.initializeRow=function(row){var self=this,config={},rowEl;config.mouseup=function(e){self.tableRowDrop(e,row)}.bind(self),config.mousemove=function(e){var rowEl,rowEl;e.pageY-Tabulator.prototype.helpers.elOffset(row.element).top+self.table.rowManager.element.scrollTop>row.getHeight()/2?self.toRow===row&&self.toRowAfter||((rowEl=row.getElement()).parentNode.insertBefore(self.placeholderElement,rowEl.nextSibling),self.moveRow(row,!0)):(self.toRow!==row||self.toRowAfter)&&((rowEl=row.getElement()).parentNode.insertBefore(self.placeholderElement,rowEl),self.moveRow(row,!1))}.bind(self),this.hasHandle||((rowEl=row.getElement()).addEventListener("mousedown",(function(e){1===e.which&&(self.checkTimeout=setTimeout((function(){self.startMove(e,row)}),self.checkPeriod))})),rowEl.addEventListener("mouseup",(function(e){1===e.which&&self.checkTimeout&&clearTimeout(self.checkTimeout)})),this.bindTouchEvents(row,row.getElement())),row.modules.moveRow=config},MoveRows.prototype.initializeCell=function(cell){var self=this,cellEl=cell.getElement();cellEl.addEventListener("mousedown",(function(e){1===e.which&&(self.checkTimeout=setTimeout((function(){self.startMove(e,cell.row)}),self.checkPeriod))})),cellEl.addEventListener("mouseup",(function(e){1===e.which&&self.checkTimeout&&clearTimeout(self.checkTimeout)})),this.bindTouchEvents(cell.row,cell.getElement())},MoveRows.prototype.bindTouchEvents=function(row,element){var self=this,startYMove=!1,dir=!1,currentRow,nextRow,prevRow,nextRowHeight,prevRowHeight,nextRowHeightLast,prevRowHeightLast;element.addEventListener("touchstart",(function(e){self.checkTimeout=setTimeout((function(){self.touchMove=!0,currentRow=row,nextRow=row.nextRow(),nextRowHeight=nextRow?nextRow.getHeight()/2:0,prevRow=row.prevRow(),prevRowHeight=prevRow?prevRow.getHeight()/2:0,nextRowHeightLast=0,prevRowHeightLast=0,startYMove=!1,self.startMove(e,row)}),self.checkPeriod)}),{passive:!0}),this.moving,this.toRow,this.toRowAfter,element.addEventListener("touchmove",(function(e){var halfCol,diff,moveToRow;self.moving&&(e.preventDefault(),self.moveHover(e),startYMove||(startYMove=e.touches[0].pageY),(diff=e.touches[0].pageY-startYMove)>0?nextRow&&diff-nextRowHeightLast>nextRowHeight&&(moveToRow=nextRow)!==row&&(startYMove=e.touches[0].pageY,moveToRow.getElement().parentNode.insertBefore(self.placeholderElement,moveToRow.getElement().nextSibling),self.moveRow(moveToRow,!0)):prevRow&&-diff-prevRowHeightLast>prevRowHeight&&(moveToRow=prevRow)!==row&&(startYMove=e.touches[0].pageY,moveToRow.getElement().parentNode.insertBefore(self.placeholderElement,moveToRow.getElement()),self.moveRow(moveToRow,!1)),moveToRow&&(currentRow=moveToRow,nextRow=moveToRow.nextRow(),nextRowHeightLast=nextRowHeight,nextRowHeight=nextRow?nextRow.getHeight()/2:0,prevRow=moveToRow.prevRow(),prevRowHeightLast=prevRowHeight,prevRowHeight=prevRow?prevRow.getHeight()/2:0))})),element.addEventListener("touchend",(function(e){self.checkTimeout&&clearTimeout(self.checkTimeout),self.moving&&(self.endMove(e),self.touchMove=!1)}))},MoveRows.prototype._bindMouseMove=function(){var self=this;this.table.rowManager.getDisplayRows().forEach((function(row){"row"!==row.type&&"group"!==row.type||!row.modules.moveRow.mousemove||row.getElement().addEventListener("mousemove",row.modules.moveRow.mousemove)}))},MoveRows.prototype._unbindMouseMove=function(){var self=this;this.table.rowManager.getDisplayRows().forEach((function(row){"row"!==row.type&&"group"!==row.type||!row.modules.moveRow.mousemove||row.getElement().removeEventListener("mousemove",row.modules.moveRow.mousemove)}))},MoveRows.prototype.startMove=function(e,row){var element=row.getElement();this.setStartPosition(e,row),this.moving=row,this.table.element.classList.add("tabulator-block-select"),this.placeholderElement.style.width=row.getWidth()+"px",this.placeholderElement.style.height=row.getHeight()+"px",this.connection?(this.table.element.classList.add("tabulator-movingrow-sending"),this.connectToTables(row)):(element.parentNode.insertBefore(this.placeholderElement,element),element.parentNode.removeChild(element)),this.hoverElement=element.cloneNode(!0),this.hoverElement.classList.add("tabulator-moving"),this.connection?(document.body.appendChild(this.hoverElement),this.hoverElement.style.left="0",this.hoverElement.style.top="0",this.hoverElement.style.width=this.table.element.clientWidth+"px",this.hoverElement.style.whiteSpace="nowrap",this.hoverElement.style.overflow="hidden",this.hoverElement.style.pointerEvents="none"):(this.table.rowManager.getTableElement().appendChild(this.hoverElement),this.hoverElement.style.left="0",this.hoverElement.style.top="0",this._bindMouseMove()),document.body.addEventListener("mousemove",this.moveHover),document.body.addEventListener("mouseup",this.endMove),this.moveHover(e)},MoveRows.prototype.setStartPosition=function(e,row){var pageX=this.touchMove?e.touches[0].pageX:e.pageX,pageY=this.touchMove?e.touches[0].pageY:e.pageY,element,position;element=row.getElement(),this.connection?(position=element.getBoundingClientRect(),this.startX=position.left-pageX+window.pageXOffset,this.startY=position.top-pageY+window.pageYOffset):this.startY=pageY-element.getBoundingClientRect().top},MoveRows.prototype.endMove=function(e){e&&1!==e.which&&!this.touchMove||(this._unbindMouseMove(),this.connection||(this.placeholderElement.parentNode.insertBefore(this.moving.getElement(),this.placeholderElement.nextSibling),this.placeholderElement.parentNode.removeChild(this.placeholderElement)),this.hoverElement.parentNode.removeChild(this.hoverElement),this.table.element.classList.remove("tabulator-block-select"),this.toRow&&this.table.rowManager.moveRow(this.moving,this.toRow,this.toRowAfter),this.moving=!1,this.toRow=!1,this.toRowAfter=!1,document.body.removeEventListener("mousemove",this.moveHover),document.body.removeEventListener("mouseup",this.endMove),this.connection&&(this.table.element.classList.remove("tabulator-movingrow-sending"),this.disconnectFromTables()))},MoveRows.prototype.moveRow=function(row,after){this.toRow=row,this.toRowAfter=after},MoveRows.prototype.moveHover=function(e){this.connection?this.moveHoverConnections.call(this,e):this.moveHoverTable.call(this,e)},MoveRows.prototype.moveHoverTable=function(e){var rowHolder=this.table.rowManager.getElement(),scrollTop=rowHolder.scrollTop,yPos=(this.touchMove?e.touches[0].pageY:e.pageY)-rowHolder.getBoundingClientRect().top+scrollTop,scrollPos;this.hoverElement.style.top=yPos-this.startY+"px"},MoveRows.prototype.moveHoverConnections=function(e){this.hoverElement.style.left=this.startX+(this.touchMove?e.touches[0].pageX:e.pageX)+"px",this.hoverElement.style.top=this.startY+(this.touchMove?e.touches[0].pageY:e.pageY)+"px"},MoveRows.prototype.elementRowDrop=function(e,element,row){this.table.options.movableRowsElementDrop&&this.table.options.movableRowsElementDrop(e,element,!!row&&row.getComponent())},MoveRows.prototype.connectToTables=function(row){var _this66=this,connectionTables;this.connectionSelectorsTables&&(connectionTables=this.table.modules.comms.getConnections(this.connectionSelectorsTables),this.table.options.movableRowsSendingStart.call(this.table,connectionTables),this.table.modules.comms.send(this.connectionSelectorsTables,"moveRow","connect",{row:row})),this.connectionSelectorsElements&&(this.connectionElements=[],Array.isArray(this.connectionSelectorsElements)||(this.connectionSelectorsElements=[this.connectionSelectorsElements]),this.connectionSelectorsElements.forEach((function(query){"string"==typeof query?_this66.connectionElements=_this66.connectionElements.concat(Array.prototype.slice.call(document.querySelectorAll(query))):_this66.connectionElements.push(query)})),this.connectionElements.forEach((function(element){var dropEvent=function dropEvent(e){_this66.elementRowDrop(e,element,_this66.moving)};element.addEventListener("mouseup",dropEvent),element.tabulatorElementDropEvent=dropEvent,element.classList.add("tabulator-movingrow-receiving")})))},MoveRows.prototype.disconnectFromTables=function(){var connectionTables;this.connectionSelectorsTables&&(connectionTables=this.table.modules.comms.getConnections(this.connectionSelectorsTables),this.table.options.movableRowsSendingStop.call(this.table,connectionTables),this.table.modules.comms.send(this.connectionSelectorsTables,"moveRow","disconnect")),this.connectionElements.forEach((function(element){element.classList.remove("tabulator-movingrow-receiving"),element.removeEventListener("mouseup",element.tabulatorElementDropEvent),delete element.tabulatorElementDropEvent}))},MoveRows.prototype.connect=function(table,row){var self=this;return this.connectedTable?(console.warn("Move Row Error - Table cannot accept connection, already connected to table:",this.connectedTable),!1):(this.connectedTable=table,this.connectedRow=row,this.table.element.classList.add("tabulator-movingrow-receiving"),this.table.rowManager.getDisplayRows().forEach((function(row){"row"===row.type&&row.modules.moveRow&&row.modules.moveRow.mouseup&&row.getElement().addEventListener("mouseup",row.modules.moveRow.mouseup)})),this.tableRowDropEvent=this.tableRowDrop.bind(this),this.table.element.addEventListener("mouseup",this.tableRowDropEvent),this.table.options.movableRowsReceivingStart.call(this.table,row,table),!0)},MoveRows.prototype.disconnect=function(table){var self=this;table===this.connectedTable?(this.connectedTable=!1,this.connectedRow=!1,this.table.element.classList.remove("tabulator-movingrow-receiving"),this.table.rowManager.getDisplayRows().forEach((function(row){"row"===row.type&&row.modules.moveRow&&row.modules.moveRow.mouseup&&row.getElement().removeEventListener("mouseup",row.modules.moveRow.mouseup)})),this.table.element.removeEventListener("mouseup",this.tableRowDropEvent),this.table.options.movableRowsReceivingStop.call(this.table,table)):console.warn("Move Row Error - trying to disconnect from non connected table")},MoveRows.prototype.dropComplete=function(table,row,success){var sender=!1;if(success){switch(_typeof(this.table.options.movableRowsSender)){case"string":sender=this.senders[this.table.options.movableRowsSender];break;case"function":sender=this.table.options.movableRowsSender}sender?sender.call(this,this.moving.getComponent(),row?row.getComponent():void 0,table):this.table.options.movableRowsSender&&console.warn("Mover Row Error - no matching sender found:",this.table.options.movableRowsSender),this.table.options.movableRowsSent.call(this.table,this.moving.getComponent(),row?row.getComponent():void 0,table)}else this.table.options.movableRowsSentFailed.call(this.table,this.moving.getComponent(),row?row.getComponent():void 0,table);this.endMove()},MoveRows.prototype.tableRowDrop=function(e,row){var receiver=!1,success=!1;switch(console.trace("drop"),e.stopImmediatePropagation(),_typeof(this.table.options.movableRowsReceiver)){case"string":receiver=this.receivers[this.table.options.movableRowsReceiver];break;case"function":receiver=this.table.options.movableRowsReceiver}receiver?success=receiver.call(this,this.connectedRow.getComponent(),row?row.getComponent():void 0,this.connectedTable):console.warn("Mover Row Error - no matching receiver found:",this.table.options.movableRowsReceiver),success?this.table.options.movableRowsReceived.call(this.table,this.connectedRow.getComponent(),row?row.getComponent():void 0,this.connectedTable):this.table.options.movableRowsReceivedFailed.call(this.table,this.connectedRow.getComponent(),row?row.getComponent():void 0,this.connectedTable),this.table.modules.comms.send(this.connectedTable,"moveRow","dropcomplete",{row:row,success:success})},MoveRows.prototype.receivers={insert:function insert(fromRow,toRow,fromTable){return this.table.addRow(fromRow.getData(),void 0,toRow),!0},add:function add(fromRow,toRow,fromTable){return this.table.addRow(fromRow.getData()),!0},update:function update(fromRow,toRow,fromTable){return!!toRow&&(toRow.update(fromRow.getData()),!0)},replace:function replace(fromRow,toRow,fromTable){return!!toRow&&(this.table.addRow(fromRow.getData(),void 0,toRow),toRow.delete(),!0)}},MoveRows.prototype.senders={delete:function _delete(fromRow,toRow,toTable){fromRow.delete()}},MoveRows.prototype.commsReceived=function(table,action,data){switch(action){case"connect":return this.connect(table,data.row);case"disconnect":return this.disconnect(table);case"dropcomplete":return this.dropComplete(table,data.row,data.success)}},Tabulator.prototype.registerModule("moveRow",MoveRows);var Mutator=function Mutator(table){this.table=table,this.allowedTypes=["","data","edit","clipboard"],this.enabled=!0};Mutator.prototype.initializeColumn=function(column){var self=this,match=!1,config={};this.allowedTypes.forEach((function(type){var key="mutator"+(type.charAt(0).toUpperCase()+type.slice(1)),mutator;column.definition[key]&&(mutator=self.lookupMutator(column.definition[key]))&&(match=!0,config[key]={mutator:mutator,params:column.definition[key+"Params"]||{}})})),match&&(column.modules.mutate=config)},Mutator.prototype.lookupMutator=function(value){var mutator=!1;switch(void 0===value?"undefined":_typeof(value)){case"string":this.mutators[value]?mutator=this.mutators[value]:console.warn("Mutator Error - No such mutator found, ignoring: ",value);break;case"function":mutator=value}return mutator},Mutator.prototype.transformRow=function(data,type,updatedData){var self=this,key="mutator"+(type.charAt(0).toUpperCase()+type.slice(1)),value;return this.enabled&&this.table.columnManager.traverse((function(column){var mutator,params,component;column.modules.mutate&&(mutator=column.modules.mutate[key]||column.modules.mutate.mutator||!1)&&(value=column.getFieldValue(void 0!==updatedData?updatedData:data),"data"!=type&&void 0===value||(component=column.getComponent(),params="function"==typeof mutator.params?mutator.params(value,data,type,component):mutator.params,column.setFieldValue(data,mutator.mutator(value,data,type,params,component))))})),data},Mutator.prototype.transformCell=function(cell,value){var mutator=cell.column.modules.mutate.mutatorEdit||cell.column.modules.mutate.mutator||!1,tempData={};return mutator?(tempData=Object.assign(tempData,cell.row.getData()),cell.column.setFieldValue(tempData,value),mutator.mutator(value,tempData,"edit",mutator.params,cell.getComponent())):value},Mutator.prototype.enable=function(){this.enabled=!0},Mutator.prototype.disable=function(){this.enabled=!1},Mutator.prototype.mutators={},Tabulator.prototype.registerModule("mutator",Mutator);var Page=function Page(table){this.table=table,this.mode="local",this.progressiveLoad=!1,this.size=0,this.page=1,this.count=5,this.max=1,this.displayIndex=0,this.initialLoad=!0,this.pageSizes=[],this.dataReceivedNames={},this.dataSentNames={},this.createElements()};Page.prototype.createElements=function(){var button;this.element=document.createElement("span"),this.element.classList.add("tabulator-paginator"),this.pagesElement=document.createElement("span"),this.pagesElement.classList.add("tabulator-pages"),(button=document.createElement("button")).classList.add("tabulator-page"),button.setAttribute("type","button"),button.setAttribute("role","button"),button.setAttribute("aria-label",""),button.setAttribute("title",""),this.firstBut=button.cloneNode(!0),this.firstBut.setAttribute("data-page","first"),this.prevBut=button.cloneNode(!0),this.prevBut.setAttribute("data-page","prev"),this.nextBut=button.cloneNode(!0),this.nextBut.setAttribute("data-page","next"),this.lastBut=button.cloneNode(!0),this.lastBut.setAttribute("data-page","last"),this.table.options.paginationSizeSelector&&(this.pageSizeSelect=document.createElement("select"),this.pageSizeSelect.classList.add("tabulator-page-size"))},Page.prototype.generatePageSizeSelectList=function(){var _this67=this,pageSizes=[];if(this.pageSizeSelect){if(Array.isArray(this.table.options.paginationSizeSelector))pageSizes=this.table.options.paginationSizeSelector,this.pageSizes=pageSizes,-1==this.pageSizes.indexOf(this.size)&&pageSizes.unshift(this.size);else if(-1==this.pageSizes.indexOf(this.size)){pageSizes=[];for(var _i9=1;_i9<5;_i9++)pageSizes.push(this.size*_i9);this.pageSizes=pageSizes}else pageSizes=this.pageSizes;for(;this.pageSizeSelect.firstChild;)this.pageSizeSelect.removeChild(this.pageSizeSelect.firstChild);pageSizes.forEach((function(item){var itemEl=document.createElement("option");itemEl.value=item,!0===item?_this67.table.modules.localize.bind("pagination|all",(function(value){itemEl.innerHTML=value})):itemEl.innerHTML=item,_this67.pageSizeSelect.appendChild(itemEl)})),this.pageSizeSelect.value=this.size}},Page.prototype.initialize=function(hidden){var self=this,pageSelectLabel,testElRow,testElCell;this.dataSentNames=Object.assign({},this.paginationDataSentNames),this.dataSentNames=Object.assign(this.dataSentNames,this.table.options.paginationDataSent),this.dataReceivedNames=Object.assign({},this.paginationDataReceivedNames),this.dataReceivedNames=Object.assign(this.dataReceivedNames,this.table.options.paginationDataReceived),self.table.modules.localize.bind("pagination|first",(function(value){self.firstBut.innerHTML=value})),self.table.modules.localize.bind("pagination|first_title",(function(value){self.firstBut.setAttribute("aria-label",value),self.firstBut.setAttribute("title",value)})),self.table.modules.localize.bind("pagination|prev",(function(value){self.prevBut.innerHTML=value})),self.table.modules.localize.bind("pagination|prev_title",(function(value){self.prevBut.setAttribute("aria-label",value),self.prevBut.setAttribute("title",value)})),self.table.modules.localize.bind("pagination|next",(function(value){self.nextBut.innerHTML=value})),self.table.modules.localize.bind("pagination|next_title",(function(value){self.nextBut.setAttribute("aria-label",value),self.nextBut.setAttribute("title",value)})),self.table.modules.localize.bind("pagination|last",(function(value){self.lastBut.innerHTML=value})),self.table.modules.localize.bind("pagination|last_title",(function(value){self.lastBut.setAttribute("aria-label",value),self.lastBut.setAttribute("title",value)})),self.firstBut.addEventListener("click",(function(){self.setPage(1)})),self.prevBut.addEventListener("click",(function(){self.previousPage()})),self.nextBut.addEventListener("click",(function(){self.nextPage().then((function(){})).catch((function(){}))})),self.lastBut.addEventListener("click",(function(){self.setPage(self.max)})),self.table.options.paginationElement&&(self.element=self.table.options.paginationElement),this.pageSizeSelect&&(pageSelectLabel=document.createElement("label"),self.table.modules.localize.bind("pagination|page_size",(function(value){self.pageSizeSelect.setAttribute("aria-label",value),self.pageSizeSelect.setAttribute("title",value),pageSelectLabel.innerHTML=value})),self.element.appendChild(pageSelectLabel),self.element.appendChild(self.pageSizeSelect),self.pageSizeSelect.addEventListener("change",(function(e){self.setPageSize("true"==self.pageSizeSelect.value||self.pageSizeSelect.value),self.setPage(1).then((function(){})).catch((function(){}))}))),self.element.appendChild(self.firstBut),self.element.appendChild(self.prevBut),self.element.appendChild(self.pagesElement),self.element.appendChild(self.nextBut),self.element.appendChild(self.lastBut),self.table.options.paginationElement||hidden||self.table.footerManager.append(self.element,self),self.mode=self.table.options.pagination,self.table.options.paginationSize?self.size=self.table.options.paginationSize:((testElRow=document.createElement("div")).classList.add("tabulator-row"),testElRow.style.visibility=hidden,(testElCell=document.createElement("div")).classList.add("tabulator-cell"),testElCell.innerHTML="Page Row Test",testElRow.appendChild(testElCell),self.table.rowManager.getTableElement().appendChild(testElRow),self.size=Math.floor(self.table.rowManager.getElement().clientHeight/testElRow.offsetHeight),self.table.rowManager.getTableElement().removeChild(testElRow)),self.count=self.table.options.paginationButtonCount,self.generatePageSizeSelectList()},Page.prototype.initializeProgressive=function(mode){this.initialize(!0),this.mode="progressive_"+mode,this.progressiveLoad=!0},Page.prototype.setDisplayIndex=function(index){this.displayIndex=index},Page.prototype.getDisplayIndex=function(){return this.displayIndex},Page.prototype.setMaxRows=function(rowCount){this.max=rowCount?!0===this.size?1:Math.ceil(rowCount/this.size):1,this.page>this.max&&(this.page=this.max)},Page.prototype.reset=function(force,columnsChanged){return("local"==this.mode||force)&&(this.page=1),columnsChanged&&(this.initialLoad=!0),!0},Page.prototype.setMaxPage=function(max){max=parseInt(max),this.max=max||1,this.page>this.max&&(this.page=this.max,this.trigger())},Page.prototype.setPage=function(page){var _this68=this,self=this;switch(page){case"first":return this.setPage(1);case"prev":return this.previousPage();case"next":return this.nextPage();case"last":return this.setPage(this.max)}return new Promise((function(resolve,reject){(page=parseInt(page))>0&&page<=_this68.max?(_this68.page=page,_this68.trigger().then((function(){resolve()})).catch((function(){reject()})),self.table.options.persistence&&self.table.modExists("persistence",!0)&&self.table.modules.persistence.config.page&&self.table.modules.persistence.save("page")):(console.warn("Pagination Error - Requested page is out of range of 1 - "+_this68.max+":",page),reject())}))},Page.prototype.setPageToRow=function(row){var _this69=this;return new Promise((function(resolve,reject){var rows,index=_this69.table.rowManager.getDisplayRows(_this69.displayIndex-1).indexOf(row);if(index>-1){var page=!0===_this69.size?1:Math.ceil((index+1)/_this69.size);_this69.setPage(page).then((function(){resolve()})).catch((function(){reject()}))}else console.warn("Pagination Error - Requested row is not visible"),reject()}))},Page.prototype.setPageSize=function(size){!0!==size&&(size=parseInt(size)),size>0&&(this.size=size),this.pageSizeSelect&&this.generatePageSizeSelectList(),this.table.options.persistence&&this.table.modExists("persistence",!0)&&this.table.modules.persistence.config.page&&this.table.modules.persistence.save("page")},Page.prototype._setPageButtons=function(){for(var self=this,leftSize=Math.floor((this.count-1)/2),rightSize=Math.ceil((this.count-1)/2),min=this.max-this.page+leftSize+10&&_i10<=this.max&&this.pagesElement.appendChild(this._generatePageButton(_i10));this.footerRedraw()},Page.prototype._generatePageButton=function(page){var self=this,button=document.createElement("button");return button.classList.add("tabulator-page"),page==self.page&&button.classList.add("active"),button.setAttribute("type","button"),button.setAttribute("role","button"),self.table.modules.localize.bind("pagination|page_title",(function(value){button.setAttribute("aria-label",value+" "+page),button.setAttribute("title",value+" "+page)})),button.setAttribute("data-page",page),button.textContent=page,button.addEventListener("click",(function(e){self.setPage(page)})),button},Page.prototype.previousPage=function(){var _this70=this;return new Promise((function(resolve,reject){_this70.page>1?(_this70.page--,_this70.trigger().then((function(){resolve()})).catch((function(){reject()})),_this70.table.options.persistence&&_this70.table.modExists("persistence",!0)&&_this70.table.modules.persistence.config.page&&_this70.table.modules.persistence.save("page")):(console.warn("Pagination Error - Previous page would be less than page 1:",0),reject())}))},Page.prototype.nextPage=function(){var _this71=this;return new Promise((function(resolve,reject){_this71.page<_this71.max?(_this71.page++,_this71.trigger().then((function(){resolve()})).catch((function(){reject()})),_this71.table.options.persistence&&_this71.table.modExists("persistence",!0)&&_this71.table.modules.persistence.config.page&&_this71.table.modules.persistence.save("page")):(_this71.progressiveLoad||console.warn("Pagination Error - Next page would be greater than maximum page of "+_this71.max+":",_this71.max+1),reject())}))},Page.prototype.getPage=function(){return this.page},Page.prototype.getPageMax=function(){return this.max},Page.prototype.getPageSize=function(size){return this.size},Page.prototype.getMode=function(){return this.mode},Page.prototype.getRows=function(data){var output,start,end;if("local"==this.mode){output=[],!0===this.size?(start=0,end=data.length-1):end=(start=this.size*(this.page-1))+parseInt(this.size),this._setPageButtons();for(var _i11=start;_i11i?output.splice(i,0,column):output.push(column))})),output},Persistence.prototype._findColumn=function(columns,subject){var type=subject.columns?"group":subject.field?"field":"object";return columns.find((function(col){switch(type){case"group":return col.title===subject.title&&col.columns.length===subject.columns.length;case"field":return col.field===subject.field;case"object":return col===subject}}))},Persistence.prototype.save=function(type){var data={};switch(type){case"columns":data=this.parseColumns(this.table.columnManager.getColumns());break;case"filter":data=this.table.modules.filter.getFilters();break;case"sort":data=this.validateSorters(this.table.modules.sort.getSort());break;case"group":data=this.getGroupConfig();break;case"page":data=this.getPageConfig()}this.writeFunc&&this.writeFunc(this.id,type,data)},Persistence.prototype.validateSorters=function(data){return data.forEach((function(item){item.column=item.field,delete item.field})),data},Persistence.prototype.getGroupConfig=function(){return this.config.group&&((!0===this.config.group||this.config.group.groupBy)&&(data.groupBy=this.table.options.groupBy),(!0===this.config.group||this.config.group.groupStartOpen)&&(data.groupStartOpen=this.table.options.groupStartOpen),(!0===this.config.group||this.config.group.groupHeader)&&(data.groupHeader=this.table.options.groupHeader)),data},Persistence.prototype.getPageConfig=function(){var data={};return this.config.page&&((!0===this.config.page||this.config.page.size)&&(data.paginationSize=this.table.modules.page.getPageSize()),(!0===this.config.page||this.config.page.page)&&(data.paginationInitialPage=this.table.modules.page.getPage())),data},Persistence.prototype.parseColumns=function(columns){var self=this,definitions=[];return columns.forEach((function(column){var defStore={},colDef=column.getDefinition(),keys;column.isGroup?(defStore.title=colDef.title,defStore.columns=self.parseColumns(column.getColumns())):(defStore.field=column.getField(),!0===self.config.columns||null==self.config.columns?(keys=Object.keys(colDef)).push("width"):keys=self.config.columns,keys.forEach((function(key){switch(key){case"width":defStore.width=column.getWidth();break;case"visible":defStore.visible=column.visible;break;default:defStore[key]=colDef[key]}}))),definitions.push(defStore)})),definitions},Persistence.prototype.readers={local:function local(id,type){var data=localStorage.getItem(id+"-"+type);return!!data&&JSON.parse(data)},cookie:function cookie(id,type){var cookie=document.cookie,key=id+"-"+type,cookiePos=cookie.indexOf(key+"="),end,data;return cookiePos>-1&&(cookie=cookie.substr(cookiePos),(end=cookie.indexOf(";"))>-1&&(cookie=cookie.substr(0,end)),data=cookie.replace(key+"=","")),!!data&&JSON.parse(data)}},Persistence.prototype.writers={local:function local(id,type,data){localStorage.setItem(id+"-"+type,JSON.stringify(data))},cookie:function cookie(id,type,data){var expireDate=new Date;expireDate.setDate(expireDate.getDate()+1e4),document.cookie=id+"-"+type+"="+JSON.stringify(data)+"; expires="+expireDate.toUTCString()}},Tabulator.prototype.registerModule("persistence",Persistence);var Print=function Print(table){this.table=table,this.element=!1,this.manualBlock=!1};Print.prototype.initialize=function(){window.addEventListener("beforeprint",this.replaceTable.bind(this)),window.addEventListener("afterprint",this.cleanup.bind(this))},Print.prototype.replaceTable=function(){this.manualBlock||(this.element=document.createElement("div"),this.element.classList.add("tabulator-print-table"),this.element.appendChild(this.table.modules.export.genereateTable(this.table.options.printConfig,this.table.options.printStyled,this.table.options.printRowRange,"print")),this.table.element.style.display="none",this.table.element.parentNode.insertBefore(this.element,this.table.element))},Print.prototype.cleanup=function(){document.body.classList.remove("tabulator-print-fullscreen-hide"),this.element&&this.element.parentNode&&(this.element.parentNode.removeChild(this.element),this.table.element.style.display="")},Print.prototype.printFullscreen=function(visible,style,config){var scrollX=window.scrollX,scrollY=window.scrollY,headerEl=document.createElement("div"),footerEl=document.createElement("div"),tableEl=this.table.modules.export.genereateTable(void 0!==config?config:this.table.options.printConfig,void 0!==style?style:this.table.options.printStyled,visible,"print"),headerContent,footerContent;this.manualBlock=!0,this.element=document.createElement("div"),this.element.classList.add("tabulator-print-fullscreen"),this.table.options.printHeader&&(headerEl.classList.add("tabulator-print-header"),"string"==typeof(headerContent="function"==typeof this.table.options.printHeader?this.table.options.printHeader.call(this.table):this.table.options.printHeader)?headerEl.innerHTML=headerContent:headerEl.appendChild(headerContent),this.element.appendChild(headerEl)),this.element.appendChild(tableEl),this.table.options.printFooter&&(footerEl.classList.add("tabulator-print-footer"),"string"==typeof(footerContent="function"==typeof this.table.options.printFooter?this.table.options.printFooter.call(this.table):this.table.options.printFooter)?footerEl.innerHTML=footerContent:footerEl.appendChild(footerContent),this.element.appendChild(footerEl)),document.body.classList.add("tabulator-print-fullscreen-hide"),document.body.appendChild(this.element),this.table.options.printFormatter&&this.table.options.printFormatter(this.element,tableEl),window.print(),this.cleanup(),window.scrollTo(scrollX,scrollY),this.manualBlock=!1},Tabulator.prototype.registerModule("print",Print);var ReactiveData=function ReactiveData(table){this.table=table,this.data=!1,this.blocked=!1,this.origFuncs={},this.currentVersion=0};ReactiveData.prototype.watchData=function(data){var self=this,pushFunc,version;this.currentVersion++,version=this.currentVersion,self.unwatchData(),self.data=data,self.origFuncs.push=data.push,Object.defineProperty(self.data,"push",{enumerable:!1,configurable:!0,value:function value(){var args=Array.from(arguments);return self.blocked||version!==self.currentVersion||args.forEach((function(arg){self.table.rowManager.addRowActual(arg,!1)})),self.origFuncs.push.apply(data,arguments)}}),self.origFuncs.unshift=data.unshift,Object.defineProperty(self.data,"unshift",{enumerable:!1,configurable:!0,value:function value(){var args=Array.from(arguments);return self.blocked||version!==self.currentVersion||args.forEach((function(arg){self.table.rowManager.addRowActual(arg,!0)})),self.origFuncs.unshift.apply(data,arguments)}}),self.origFuncs.shift=data.shift,Object.defineProperty(self.data,"shift",{enumerable:!1,configurable:!0,value:function value(){var row;return self.blocked||version!==self.currentVersion||self.data.length&&(row=self.table.rowManager.getRowFromDataObject(self.data[0]))&&row.deleteActual(),self.origFuncs.shift.call(data)}}),self.origFuncs.pop=data.pop,Object.defineProperty(self.data,"pop",{enumerable:!1,configurable:!0,value:function value(){var row;return self.blocked||version!==self.currentVersion||self.data.length&&(row=self.table.rowManager.getRowFromDataObject(self.data[self.data.length-1]))&&row.deleteActual(),self.origFuncs.pop.call(data)}}),self.origFuncs.splice=data.splice,Object.defineProperty(self.data,"splice",{enumerable:!1,configurable:!0,value:function value(){var args=Array.from(arguments),start=args[0]<0?data.length+args[0]:args[0],end=args[1],newRows=!!args[2]&&args.slice(2),startRow;if(!self.blocked&&version===self.currentVersion){if(newRows&&((startRow=!!data[start]&&self.table.rowManager.getRowFromDataObject(data[start]))?newRows.forEach((function(rowData){self.table.rowManager.addRowActual(rowData,!0,startRow,!0)})):(newRows=newRows.slice().reverse()).forEach((function(rowData){self.table.rowManager.addRowActual(rowData,!0,!1,!0)}))),0!==end){var oldRows=data.slice(start,void 0===args[1]?args[1]:start+end);oldRows.forEach((function(rowData,i){var row=self.table.rowManager.getRowFromDataObject(rowData);row&&row.deleteActual(i!==oldRows.length-1)}))}(newRows||0!==end)&&self.table.rowManager.reRenderInPosition()}return self.origFuncs.splice.apply(data,arguments)}})},ReactiveData.prototype.unwatchData=function(){if(!1!==this.data)for(var key in this.origFuncs)Object.defineProperty(this.data,key,{enumerable:!0,configurable:!0,writable:!0,value:this.origFuncs.key})},ReactiveData.prototype.watchRow=function(row){var self=this,data=row.getData();for(var key in this.blocked=!0,data)this.watchKey(row,data,key);this.blocked=!1},ReactiveData.prototype.watchKey=function(row,data,key){var self=this,props=Object.getOwnPropertyDescriptor(data,key),value=data[key],version=this.currentVersion;Object.defineProperty(data,key,{set:function set(newValue){if(value=newValue,!self.blocked&&version===self.currentVersion){var update={};update[key]=newValue,row.updateData(update)}props.set&&props.set(newValue)},get:function get(){return props.get&&props.get(),value}})},ReactiveData.prototype.unwatchRow=function(row){var data=row.getData();for(var key in data)Object.defineProperty(data,key,{value:data[key]})},ReactiveData.prototype.block=function(){this.blocked=!0},ReactiveData.prototype.unblock=function(){this.blocked=!1},Tabulator.prototype.registerModule("reactiveData",ReactiveData);var ResizeColumns=function ResizeColumns(table){this.table=table,this.startColumn=!1,this.startX=!1,this.startWidth=!1,this.handle=null,this.prevHandle=null};ResizeColumns.prototype.initializeColumn=function(type,column,element){var self=this,variableHeight=!1,mode=this.table.options.resizableColumns;if("header"===type&&(variableHeight="textarea"==column.definition.formatter||column.definition.variableHeight,column.modules.resize={variableHeight:variableHeight}),!0===mode||mode==type){var handle=document.createElement("div");handle.className="tabulator-col-resize-handle";var prevHandle=document.createElement("div");prevHandle.className="tabulator-col-resize-handle prev",handle.addEventListener("click",(function(e){e.stopPropagation()}));var handleDown=function handleDown(e){var nearestColumn=column.getLastColumn();nearestColumn&&self._checkResizability(nearestColumn)&&(self.startColumn=column,self._mouseDown(e,nearestColumn,handle))};handle.addEventListener("mousedown",handleDown),handle.addEventListener("touchstart",handleDown,{passive:!0}),handle.addEventListener("dblclick",(function(e){var col=column.getLastColumn();col&&self._checkResizability(col)&&(e.stopPropagation(),col.reinitializeWidth(!0))})),prevHandle.addEventListener("click",(function(e){e.stopPropagation()}));var prevHandleDown=function prevHandleDown(e){var nearestColumn,colIndex,prevColumn;(nearestColumn=column.getFirstColumn())&&(prevColumn=(colIndex=self.table.columnManager.findColumnIndex(nearestColumn))>0&&self.table.columnManager.getColumnByIndex(colIndex-1))&&self._checkResizability(prevColumn)&&(self.startColumn=column,self._mouseDown(e,prevColumn,prevHandle))};prevHandle.addEventListener("mousedown",prevHandleDown),prevHandle.addEventListener("touchstart",prevHandleDown,{passive:!0}),prevHandle.addEventListener("dblclick",(function(e){var nearestColumn,colIndex,prevColumn;(nearestColumn=column.getFirstColumn())&&(prevColumn=(colIndex=self.table.columnManager.findColumnIndex(nearestColumn))>0&&self.table.columnManager.getColumnByIndex(colIndex-1))&&self._checkResizability(prevColumn)&&(e.stopPropagation(),prevColumn.reinitializeWidth(!0))})),element.appendChild(handle),element.appendChild(prevHandle)}},ResizeColumns.prototype._checkResizability=function(column){return void 0!==column.definition.resizable?column.definition.resizable:this.table.options.resizableColumns},ResizeColumns.prototype._mouseDown=function(e,column,handle){var self=this;function mouseMove(e){column.setWidth(self.startWidth+((void 0===e.screenX?e.touches[0].screenX:e.screenX)-self.startX)),!self.table.browserSlow&&column.modules.resize&&column.modules.resize.variableHeight&&column.checkCellHeights()}function mouseUp(e){self.startColumn.modules.edit&&(self.startColumn.modules.edit.blocked=!1),self.table.browserSlow&&column.modules.resize&&column.modules.resize.variableHeight&&column.checkCellHeights(),document.body.removeEventListener("mouseup",mouseUp),document.body.removeEventListener("mousemove",mouseMove),handle.removeEventListener("touchmove",mouseMove),handle.removeEventListener("touchend",mouseUp),self.table.element.classList.remove("tabulator-block-select"),self.table.options.persistence&&self.table.modExists("persistence",!0)&&self.table.modules.persistence.config.columns&&self.table.modules.persistence.save("columns"),self.table.options.columnResized.call(self.table,column.getComponent())}self.table.element.classList.add("tabulator-block-select"),e.stopPropagation(),self.startColumn.modules.edit&&(self.startColumn.modules.edit.blocked=!0),self.startX=void 0===e.screenX?e.touches[0].screenX:e.screenX,self.startWidth=column.getWidth(),document.body.addEventListener("mousemove",mouseMove),document.body.addEventListener("mouseup",mouseUp),handle.addEventListener("touchmove",mouseMove,{passive:!0}),handle.addEventListener("touchend",mouseUp)},Tabulator.prototype.registerModule("resizeColumns",ResizeColumns);var ResizeRows=function ResizeRows(table){this.table=table,this.startColumn=!1,this.startY=!1,this.startHeight=!1,this.handle=null,this.prevHandle=null};ResizeRows.prototype.initializeRow=function(row){var self=this,rowEl=row.getElement(),handle=document.createElement("div");handle.className="tabulator-row-resize-handle";var prevHandle=document.createElement("div");prevHandle.className="tabulator-row-resize-handle prev",handle.addEventListener("click",(function(e){e.stopPropagation()}));var handleDown=function handleDown(e){self.startRow=row,self._mouseDown(e,row,handle)};handle.addEventListener("mousedown",handleDown),handle.addEventListener("touchstart",handleDown,{passive:!0}),prevHandle.addEventListener("click",(function(e){e.stopPropagation()}));var prevHandleDown=function prevHandleDown(e){var prevRow=self.table.rowManager.prevDisplayRow(row);prevRow&&(self.startRow=prevRow,self._mouseDown(e,prevRow,prevHandle))};prevHandle.addEventListener("mousedown",prevHandleDown),prevHandle.addEventListener("touchstart",prevHandleDown,{passive:!0}),rowEl.appendChild(handle),rowEl.appendChild(prevHandle)},ResizeRows.prototype._mouseDown=function(e,row,handle){var self=this;function mouseMove(e){row.setHeight(self.startHeight+((void 0===e.screenY?e.touches[0].screenY:e.screenY)-self.startY))}function mouseUp(e){document.body.removeEventListener("mouseup",mouseMove),document.body.removeEventListener("mousemove",mouseMove),handle.removeEventListener("touchmove",mouseMove),handle.removeEventListener("touchend",mouseUp),self.table.element.classList.remove("tabulator-block-select"),self.table.options.rowResized.call(this.table,row.getComponent())}self.table.element.classList.add("tabulator-block-select"),e.stopPropagation(),self.startY=void 0===e.screenY?e.touches[0].screenY:e.screenY,self.startHeight=row.getHeight(),document.body.addEventListener("mousemove",mouseMove),document.body.addEventListener("mouseup",mouseUp),handle.addEventListener("touchmove",mouseMove,{passive:!0}),handle.addEventListener("touchend",mouseUp)},Tabulator.prototype.registerModule("resizeRows",ResizeRows);var ResizeTable=function ResizeTable(table){this.table=table,this.binding=!1,this.observer=!1,this.containerObserver=!1,this.tableHeight=0,this.tableWidth=0,this.containerHeight=0,this.containerWidth=0,this.autoResize=!1};ResizeTable.prototype.initialize=function(row){var _this74=this,table=this.table,tableStyle;this.tableHeight=table.element.clientHeight,this.tableWidth=table.element.clientWidth,table.element.parentNode&&(this.containerHeight=table.element.parentNode.clientHeight,this.containerWidth=table.element.parentNode.clientWidth),"undefined"!=typeof ResizeObserver&&"virtual"===table.rowManager.getRenderMode()?(this.autoResize=!0,this.observer=new ResizeObserver((function(entry){if(!table.browserMobile||table.browserMobile&&!table.modules.edit.currentCell){var nodeHeight=Math.floor(entry[0].contentRect.height),nodeWidth=Math.floor(entry[0].contentRect.width);_this74.tableHeight==nodeHeight&&_this74.tableWidth==nodeWidth||(_this74.tableHeight=nodeHeight,_this74.tableWidth=nodeWidth,table.element.parentNode&&(_this74.containerHeight=table.element.parentNode.clientHeight,_this74.containerWidth=table.element.parentNode.clientWidth),table.redraw())}})),this.observer.observe(table.element),tableStyle=window.getComputedStyle(table.element),this.table.element.parentNode&&!this.table.rowManager.fixedHeight&&(tableStyle.getPropertyValue("max-height")||tableStyle.getPropertyValue("min-height"))&&(this.containerObserver=new ResizeObserver((function(entry){if(!table.browserMobile||table.browserMobile&&!table.modules.edit.currentCell){var nodeHeight=Math.floor(entry[0].contentRect.height),nodeWidth=Math.floor(entry[0].contentRect.width);_this74.containerHeight==nodeHeight&&_this74.containerWidth==nodeWidth||(_this74.containerHeight=nodeHeight,_this74.containerWidth=nodeWidth,_this74.tableHeight=table.element.clientHeight,_this74.tableWidth=table.element.clientWidth,table.redraw()),table.redraw()}})),this.containerObserver.observe(this.table.element.parentNode))):(this.binding=function(){(!table.browserMobile||table.browserMobile&&!table.modules.edit.currentCell)&&table.redraw()},window.addEventListener("resize",this.binding))},ResizeTable.prototype.clearBindings=function(row){this.binding&&window.removeEventListener("resize",this.binding),this.observer&&this.observer.unobserve(this.table.element),this.containerObserver&&this.containerObserver.unobserve(this.table.element.parentNode)},Tabulator.prototype.registerModule("resizeTable",ResizeTable);var ResponsiveLayout=function ResponsiveLayout(table){this.table=table,this.columns=[],this.hiddenColumns=[],this.mode="",this.index=0,this.collapseFormatter=[],this.collapseStartOpen=!0,this.collapseHandleColumn=!1};ResponsiveLayout.prototype.initialize=function(){var self=this,columns=[];this.mode=this.table.options.responsiveLayout,this.collapseFormatter=this.table.options.responsiveLayoutCollapseFormatter||this.formatCollapsedData,this.collapseStartOpen=this.table.options.responsiveLayoutCollapseStartOpen,this.hiddenColumns=[],this.table.columnManager.columnsByIndex.forEach((function(column,i){column.modules.responsive&&column.modules.responsive.order&&column.modules.responsive.visible&&(column.modules.responsive.index=i,columns.push(column),column.visible||"collapse"!==self.mode||self.hiddenColumns.push(column))})),columns=(columns=columns.reverse()).sort((function(a,b){var diff;return b.modules.responsive.order-a.modules.responsive.order||b.modules.responsive.index-a.modules.responsive.index})),this.columns=columns,"collapse"===this.mode&&this.generateCollapsedContent();for(var _iterator=this.table.columnManager.columnsByIndex,_isArray=Array.isArray(_iterator),_i12=0,_iterator=_isArray?_iterator:_iterator[Symbol.iterator]();;){var _ref;if(_isArray){if(_i12>=_iterator.length)break;_ref=_iterator[_i12++]}else{if((_i12=_iterator.next()).done)break;_ref=_i12.value}var col=_ref;if("responsiveCollapse"==col.definition.formatter){this.collapseHandleColumn=col;break}}this.collapseHandleColumn&&(this.hiddenColumns.length?this.collapseHandleColumn.show():this.collapseHandleColumn.hide())},ResponsiveLayout.prototype.initializeColumn=function(column){var def=column.getDefinition();column.modules.responsive={order:void 0===def.responsive?1:def.responsive,visible:!1!==def.visible}},ResponsiveLayout.prototype.initializeRow=function(row){var el;"calc"!==row.type&&((el=document.createElement("div")).classList.add("tabulator-responsive-collapse"),row.modules.responsiveLayout={element:el,open:this.collapseStartOpen},this.collapseStartOpen||(el.style.display="none"))},ResponsiveLayout.prototype.layoutRow=function(row){var rowEl=row.getElement();row.modules.responsiveLayout&&(rowEl.appendChild(row.modules.responsiveLayout.element),this.generateCollapsedRowContent(row))},ResponsiveLayout.prototype.updateColumnVisibility=function(column,visible){var index;column.modules.responsive&&(column.modules.responsive.visible=visible,this.initialize())},ResponsiveLayout.prototype.hideColumn=function(column){var colCount=this.hiddenColumns.length;column.hide(!1,!0),"collapse"===this.mode&&(this.hiddenColumns.unshift(column),this.generateCollapsedContent(),this.collapseHandleColumn&&!colCount&&this.collapseHandleColumn.show())},ResponsiveLayout.prototype.showColumn=function(column){var index;column.show(!1,!0),column.setWidth(column.getWidth()),"collapse"===this.mode&&((index=this.hiddenColumns.indexOf(column))>-1&&this.hiddenColumns.splice(index,1),this.generateCollapsedContent(),this.collapseHandleColumn&&!this.hiddenColumns.length&&this.collapseHandleColumn.hide())},ResponsiveLayout.prototype.update=function(){for(var self=this,working=!0;working;){var width="fitColumns"==this.table.modules.layout.getMode()?this.table.columnManager.getFlexBaseWidth():this.table.columnManager.getWidth(),diff=(this.table.options.headerVisible?this.table.columnManager.element.clientWidth:this.table.element.clientWidth)-width;if(diff<0){var column=this.columns[this.index];column?(this.hideColumn(column),this.index++):working=!1}else{var _column=this.columns[this.index-1];_column&&diff>0&&diff>=_column.getWidth()?(this.showColumn(_column),this.index--):working=!1}this.table.rowManager.activeRowsCount||this.table.rowManager.renderEmptyScroll()}},ResponsiveLayout.prototype.generateCollapsedContent=function(){var self=this,rows;this.table.rowManager.getDisplayRows().forEach((function(row){self.generateCollapsedRowContent(row)}))},ResponsiveLayout.prototype.generateCollapsedRowContent=function(row){var el,contents;if(row.modules.responsiveLayout){for(el=row.modules.responsiveLayout.element;el.firstChild;)el.removeChild(el.firstChild);(contents=this.collapseFormatter(this.generateCollapsedRowData(row)))&&el.appendChild(contents)}},ResponsiveLayout.prototype.generateCollapsedRowData=function(row){var self=this,data=row.getData(),output=[],mockCellComponent;return this.hiddenColumns.forEach((function(column){var value=column.getFieldValue(data);column.definition.title&&column.field&&(column.modules.format&&self.table.options.responsiveLayoutCollapseUseFormatters?(mockCellComponent={value:!1,data:{},getValue:function getValue(){return value},getData:function getData(){return data},getElement:function getElement(){return document.createElement("div")},getRow:function getRow(){return row.getComponent()},getColumn:function getColumn(){return column.getComponent()}},output.push({title:column.definition.title,value:column.modules.format.formatter.call(self.table.modules.format,mockCellComponent,column.modules.format.params)})):output.push({title:column.definition.title,value:value}))})),output},ResponsiveLayout.prototype.formatCollapsedData=function(data){var list=document.createElement("table"),listContents="";return data.forEach((function(item){var div=document.createElement("div");item.value instanceof Node&&(div.appendChild(item.value),item.value=div.innerHTML),listContents+=""+item.title+""+item.value+""})),list.innerHTML=listContents,Object.keys(data).length?list:""},Tabulator.prototype.registerModule("responsiveLayout",ResponsiveLayout);var SelectRow=function SelectRow(table){this.table=table,this.selecting=!1,this.lastClickedRow=!1,this.selectPrev=[],this.selectedRows=[],this.headerCheckboxElement=null};SelectRow.prototype.clearSelectionData=function(silent){this.selecting=!1,this.lastClickedRow=!1,this.selectPrev=[],this.selectedRows=[],silent||this._rowSelectionChanged()},SelectRow.prototype.initializeRow=function(row){var self=this,element=row.getElement(),endSelect=function endSelect(){setTimeout((function(){self.selecting=!1}),50),document.body.removeEventListener("mouseup",endSelect)};row.modules.select={selected:!1},self.table.options.selectableCheck.call(this.table,row.getComponent())?(element.classList.add("tabulator-selectable"),element.classList.remove("tabulator-unselectable"),self.table.options.selectable&&"highlight"!=self.table.options.selectable&&("click"===self.table.options.selectableRangeMode?element.addEventListener("click",(function(e){if(e.shiftKey){self.table._clearSelection(),self.lastClickedRow=self.lastClickedRow||row;var lastClickedRowIdx=self.table.rowManager.getDisplayRowIndex(self.lastClickedRow),rowIdx=self.table.rowManager.getDisplayRowIndex(row),fromRowIdx=lastClickedRowIdx<=rowIdx?lastClickedRowIdx:rowIdx,toRowIdx=lastClickedRowIdx>=rowIdx?lastClickedRowIdx:rowIdx,rows,toggledRows=self.table.rowManager.getDisplayRows().slice(0).splice(fromRowIdx,toRowIdx-fromRowIdx+1);e.ctrlKey||e.metaKey?(toggledRows.forEach((function(toggledRow){toggledRow!==self.lastClickedRow&&(!0===self.table.options.selectable||self.isRowSelected(row)?self.toggleRow(toggledRow):self.selectedRows.lengthself.table.options.selectable&&(toggledRows=toggledRows.slice(0,self.table.options.selectable)),self.selectRows(toggledRows)),self.table._clearSelection()}else e.ctrlKey||e.metaKey?(self.toggleRow(row),self.lastClickedRow=row):(self.deselectRows(void 0,!0),self.selectRows(row),self.lastClickedRow=row)})):(element.addEventListener("click",(function(e){self.table.modExists("edit")&&self.table.modules.edit.getCurrentCell()||self.table._clearSelection(),self.selecting||self.toggleRow(row)})),element.addEventListener("mousedown",(function(e){if(e.shiftKey)return self.table._clearSelection(),self.selecting=!0,self.selectPrev=[],document.body.addEventListener("mouseup",endSelect),document.body.addEventListener("keyup",endSelect),self.toggleRow(row),!1})),element.addEventListener("mouseenter",(function(e){self.selecting&&(self.table._clearSelection(),self.toggleRow(row),self.selectPrev[1]==row&&self.toggleRow(self.selectPrev[0]))})),element.addEventListener("mouseout",(function(e){self.selecting&&(self.table._clearSelection(),self.selectPrev.unshift(row))}))))):(element.classList.add("tabulator-unselectable"),element.classList.remove("tabulator-selectable"))},SelectRow.prototype.toggleRow=function(row){this.table.options.selectableCheck.call(this.table,row.getComponent())&&(row.modules.select&&row.modules.select.selected?this._deselectRow(row):this._selectRow(row))},SelectRow.prototype.selectRows=function(rows){var _this75=this,rowMatch;switch(void 0===rows?"undefined":_typeof(rows)){case"undefined":this.table.rowManager.rows.forEach((function(row){_this75._selectRow(row,!0,!0)})),this._rowSelectionChanged();break;case"string":(rowMatch=this.table.rowManager.findRow(rows))?this._selectRow(rowMatch,!0,!0):this.table.rowManager.getRows(rows).forEach((function(row){_this75._selectRow(row,!0,!0)})),this._rowSelectionChanged();break;default:Array.isArray(rows)?(rows.forEach((function(row){_this75._selectRow(row,!0,!0)})),this._rowSelectionChanged()):this._selectRow(rows,!1,!0)}},SelectRow.prototype._selectRow=function(rowInfo,silent,force){var index;if(!isNaN(this.table.options.selectable)&&!0!==this.table.options.selectable&&!force&&this.selectedRows.length>=this.table.options.selectable){if(!this.table.options.selectableRollingSelection)return!1;this._deselectRow(this.selectedRows[0])}var row=this.table.rowManager.findRow(rowInfo);row?-1==this.selectedRows.indexOf(row)&&(row.modules.select||(row.modules.select={}),row.modules.select.selected=!0,row.modules.select.checkboxEl&&(row.modules.select.checkboxEl.checked=!0),row.getElement().classList.add("tabulator-selected"),this.selectedRows.push(row),this.table.options.dataTreeSelectPropagate&&this.childRowSelection(row,!0),silent||this.table.options.rowSelected.call(this.table,row.getComponent()),this._rowSelectionChanged(silent)):silent||console.warn("Selection Error - No such row found, ignoring selection:"+rowInfo)},SelectRow.prototype.isRowSelected=function(row){return-1!==this.selectedRows.indexOf(row)},SelectRow.prototype.deselectRows=function(rows,silent){var self=this,rowCount;if(void 0===rows){rowCount=self.selectedRows.length;for(var _i13=0;_i13-1&&(row.modules.select||(row.modules.select={}),row.modules.select.selected=!1,row.modules.select.checkboxEl&&(row.modules.select.checkboxEl.checked=!1),row.getElement().classList.remove("tabulator-selected"),this.selectedRows.splice(index,1),this.table.options.dataTreeSelectPropagate&&this.childRowSelection(row,!1),silent||this.table.options.rowDeselected.call(this.table,row.getComponent()),this._rowSelectionChanged(silent)):silent||console.warn("Deselection Error - No such row found, ignoring selection:"+rowInfo)},SelectRow.prototype.getSelectedData=function(){var data=[];return this.selectedRows.forEach((function(row){data.push(row.getData())})),data},SelectRow.prototype.getSelectedRows=function(){var rows=[];return this.selectedRows.forEach((function(row){rows.push(row.getComponent())})),rows},SelectRow.prototype._rowSelectionChanged=function(silent){this.headerCheckboxElement&&(0===this.selectedRows.length?(this.headerCheckboxElement.checked=!1,this.headerCheckboxElement.indeterminate=!1):this.table.rowManager.rows.length===this.selectedRows.length?(this.headerCheckboxElement.checked=!0,this.headerCheckboxElement.indeterminate=!1):(this.headerCheckboxElement.indeterminate=!0,this.headerCheckboxElement.checked=!1)),silent||this.table.options.rowSelectionChanged.call(this.table,this.getSelectedData(),this.getSelectedRows())},SelectRow.prototype.registerRowSelectCheckbox=function(row,element){row._row.modules.select||(row._row.modules.select={}),row._row.modules.select.checkboxEl=element},SelectRow.prototype.registerHeaderSelectCheckbox=function(element){this.headerCheckboxElement=element},SelectRow.prototype.childRowSelection=function(row,select){var children=this.table.modules.dataTree.getChildren(row);if(select)for(var _iterator2=children,_isArray2=Array.isArray(_iterator2),_i14=0,_iterator2=_isArray2?_iterator2:_iterator2[Symbol.iterator]();;){var _ref2;if(_isArray2){if(_i14>=_iterator2.length)break;_ref2=_iterator2[_i14++]}else{if((_i14=_iterator2.next()).done)break;_ref2=_i14.value}var child=_ref2;this._selectRow(child,!0)}else for(var _iterator3=children,_isArray3=Array.isArray(_iterator3),_i15=0,_iterator3=_isArray3?_iterator3:_iterator3[Symbol.iterator]();;){var _ref3;if(_isArray3){if(_i15>=_iterator3.length)break;_ref3=_iterator3[_i15++]}else{if((_i15=_iterator3.next()).done)break;_ref3=_i15.value}var _child=_ref3;this._deselectRow(_child,!0)}},Tabulator.prototype.registerModule("selectRow",SelectRow);var Sort=function Sort(table){this.table=table,this.sortList=[],this.changed=!1};Sort.prototype.initializeColumn=function(column,content){var self=this,sorter=!1,colEl,arrowEl;switch(_typeof(column.definition.sorter)){case"string":self.sorters[column.definition.sorter]?sorter=self.sorters[column.definition.sorter]:console.warn("Sort Error - No such sorter found: ",column.definition.sorter);break;case"function":sorter=column.definition.sorter}column.modules.sort={sorter:sorter,dir:"none",params:column.definition.sorterParams||{},startingDir:column.definition.headerSortStartingDir||"asc",tristate:void 0!==column.definition.headerSortTristate?column.definition.headerSortTristate:this.table.options.headerSortTristate},(void 0===column.definition.headerSort?!1!==this.table.options.headerSort:!1!==column.definition.headerSort)&&((colEl=column.getElement()).classList.add("tabulator-sortable"),(arrowEl=document.createElement("div")).classList.add("tabulator-arrow"),content.appendChild(arrowEl),colEl.addEventListener("click",(function(e){var dir="",sorters=[],match=!1;if(column.modules.sort){if(column.modules.sort.tristate)dir="none"==column.modules.sort.dir?column.modules.sort.startingDir:column.modules.sort.dir==column.modules.sort.startingDir?"asc"==column.modules.sort.dir?"desc":"asc":"none";else switch(column.modules.sort.dir){case"asc":dir="desc";break;case"desc":dir="asc";break;default:dir=column.modules.sort.startingDir}self.table.options.columnHeaderSortMulti&&(e.shiftKey||e.ctrlKey)?((match=(sorters=self.getSort()).findIndex((function(sorter){return sorter.field===column.getField()})))>-1?(sorters[match].dir=dir,match!=sorters.length-1&&(match=sorters.splice(match,1)[0],"none"!=dir&&sorters.push(match))):"none"!=dir&&sorters.push({column:column,dir:dir}),self.setSort(sorters)):"none"==dir?self.clear():self.setSort(column,dir),self.table.rowManager.sorterRefresh(!self.sortList.length)}})))},Sort.prototype.hasChanged=function(){var changed=this.changed;return this.changed=!1,changed},Sort.prototype.getSort=function(){var self=this,sorters=[];return this.sortList.forEach((function(item){item.column&&sorters.push({column:item.column.getComponent(),field:item.column.getField(),dir:item.dir})})),sorters},Sort.prototype.setSort=function(sortList,dir){var self=this,newSortList=[];Array.isArray(sortList)||(sortList=[{column:sortList,dir:dir}]),sortList.forEach((function(item){var column;(column=self.table.columnManager.findColumn(item.column))?(item.column=column,newSortList.push(item),self.changed=!0):console.warn("Sort Warning - Sort field does not exist and is being ignored: ",item.column)})),self.sortList=newSortList,this.table.options.persistence&&this.table.modExists("persistence",!0)&&this.table.modules.persistence.config.sort&&this.table.modules.persistence.save("sort")},Sort.prototype.clear=function(){this.setSort([])},Sort.prototype.findSorter=function(column){var row=this.table.rowManager.activeRows[0],sorter="string",field,value;if(row&&(row=row.getData(),field=column.getField()))switch(void 0===(value=column.getFieldValue(row))?"undefined":_typeof(value)){case"undefined":sorter="string";break;case"boolean":sorter="boolean";break;default:isNaN(value)||""===value?value.match(/((^[0-9]+[a-z]+)|(^[a-z]+[0-9]+))+$/i)&&(sorter="alphanum"):sorter="number"}return this.sorters[sorter]},Sort.prototype.sort=function(data){var self=this,sortList=this.table.options.sortOrderReverse?self.sortList.slice().reverse():self.sortList,sortListActual=[],rowComponents=[],lastSort;self.table.options.dataSorting&&self.table.options.dataSorting.call(self.table,self.getSort()),self.clearColumnHeaders(),self.table.options.ajaxSorting?sortList.forEach((function(item,i){self.setColumnHeader(item.column,item.dir)})):(sortList.forEach((function(item,i){var sortObj=item.column.modules.sort;item.column&&sortObj&&(sortObj.sorter||(sortObj.sorter=self.findSorter(item.column)),item.params="function"==typeof sortObj.params?sortObj.params(item.column.getComponent(),item.dir):sortObj.params,sortListActual.push(item)),self.setColumnHeader(item.column,item.dir)})),sortListActual.length&&self._sortItems(data,sortListActual)),self.table.options.dataSorted&&(data.forEach((function(row){rowComponents.push(row.getComponent())})),self.table.options.dataSorted.call(self.table,self.getSort(),rowComponents))},Sort.prototype.clearColumnHeaders=function(){this.table.columnManager.getRealColumns().forEach((function(column){column.modules.sort&&(column.modules.sort.dir="none",column.getElement().setAttribute("aria-sort","none"))}))},Sort.prototype.setColumnHeader=function(column,dir){column.modules.sort.dir=dir,column.getElement().setAttribute("aria-sort",dir)},Sort.prototype._sortItems=function(data,sortList){var _this76=this,sorterCount=sortList.length-1;data.sort((function(a,b){for(var result,i=sorterCount;i>=0;i--){var sortItem=sortList[i];if(0!==(result=_this76._sortRow(a,b,sortItem.column,sortItem.dir,sortItem.params)))break}return result}))},Sort.prototype._sortRow=function(a,b,column,dir,params){var el1Comp,el2Comp,colComp,el1="asc"==dir?a:b,el2="asc"==dir?b:a;return a=void 0!==(a=column.getFieldValue(el1.getData()))?a:"",b=void 0!==(b=column.getFieldValue(el2.getData()))?b:"",el1Comp=el1.getComponent(),el2Comp=el2.getComponent(),column.modules.sort.sorter.call(this,a,b,el1Comp,el2Comp,column.getComponent(),dir,params)},Sort.prototype.sorters={number:function number(a,b,aRow,bRow,column,dir,params){var alignEmptyValues=params.alignEmptyValues,decimal=params.decimalSeparator||".",thousand=params.thousandSeparator||",",emptyAlign=0;if(a=parseFloat(String(a).split(thousand).join("").split(decimal).join(".")),b=parseFloat(String(b).split(thousand).join("").split(decimal).join(".")),isNaN(a))emptyAlign=isNaN(b)?0:-1;else{if(!isNaN(b))return a-b;emptyAlign=1}return("top"===alignEmptyValues&&"desc"===dir||"bottom"===alignEmptyValues&&"asc"===dir)&&(emptyAlign*=-1),emptyAlign},string:function string(a,b,aRow,bRow,column,dir,params){var alignEmptyValues=params.alignEmptyValues,emptyAlign=0,locale;if(a){if(b){switch(_typeof(params.locale)){case"boolean":params.locale&&(locale=this.table.modules.localize.getLocale());break;case"string":locale=params.locale}return String(a).toLowerCase().localeCompare(String(b).toLowerCase(),locale)}emptyAlign=1}else emptyAlign=b?-1:0;return("top"===alignEmptyValues&&"desc"===dir||"bottom"===alignEmptyValues&&"asc"===dir)&&(emptyAlign*=-1),emptyAlign},date:function date(a,b,aRow,bRow,column,dir,params){return params.format||(params.format="DD/MM/YYYY"),this.sorters.datetime.call(this,a,b,aRow,bRow,column,dir,params)},time:function time(a,b,aRow,bRow,column,dir,params){return params.format||(params.format="HH:mm"),this.sorters.datetime.call(this,a,b,aRow,bRow,column,dir,params)},datetime:function datetime(a,b,aRow,bRow,column,dir,params){var format=params.format||"DD/MM/YYYY HH:mm:ss",alignEmptyValues=params.alignEmptyValues,emptyAlign=0;if("undefined"!=typeof moment){if(a=moment(a,format),b=moment(b,format),a.isValid()){if(b.isValid())return a-b;emptyAlign=1}else emptyAlign=b.isValid()?-1:0;return("top"===alignEmptyValues&&"desc"===dir||"bottom"===alignEmptyValues&&"asc"===dir)&&(emptyAlign*=-1),emptyAlign}console.error("Sort Error - 'datetime' sorter is dependant on moment.js")},boolean:function boolean(a,b,aRow,bRow,column,dir,params){var el1,el2;return(!0===a||"true"===a||"True"===a||1===a?1:0)-(!0===b||"true"===b||"True"===b||1===b?1:0)},array:function array(a,b,aRow,bRow,column,dir,params){var el1=0,el2=0,type=params.type||"length",alignEmptyValues=params.alignEmptyValues,emptyAlign=0;function calc(value){switch(type){case"length":return value.length;case"sum":return value.reduce((function(c,d){return c+d}));case"max":return Math.max.apply(null,value);case"min":return Math.min.apply(null,value);case"avg":return value.reduce((function(c,d){return c+d}))/value.length}}if(Array.isArray(a)){if(Array.isArray(b))return(el1=a?calc(a):0)-(el2=b?calc(b):0);alignEmptyValues=1}else alignEmptyValues=Array.isArray(b)?-1:0;return("top"===alignEmptyValues&&"desc"===dir||"bottom"===alignEmptyValues&&"asc"===dir)&&(emptyAlign*=-1),emptyAlign},exists:function exists(a,b,aRow,bRow,column,dir,params){var el1,el2;return(void 0===a?0:1)-(void 0===b?0:1)},alphanum:function alphanum(as,bs,aRow,bRow,column,dir,params){var a,b,a1,b1,i=0,L,rx=/(\d+)|(\D+)/g,rd=/\d/,alignEmptyValues=params.alignEmptyValues,emptyAlign=0;if(as||0===as){if(bs||0===bs){if(isFinite(as)&&isFinite(bs))return as-bs;if((a=String(as).toLowerCase())===(b=String(bs).toLowerCase()))return 0;if(!rd.test(a)||!rd.test(b))return a>b?1:-1;for(a=a.match(rx),b=b.match(rx),L=a.length>b.length?b.length:a.length;ib1?1:-1;return a.length>b.length}emptyAlign=1}else emptyAlign=bs||0===bs?-1:0;return("top"===alignEmptyValues&&"desc"===dir||"bottom"===alignEmptyValues&&"asc"===dir)&&(emptyAlign*=-1),emptyAlign}},Tabulator.prototype.registerModule("sort",Sort);var Validate=function Validate(table){this.table=table,this.invalidCells=[]};return Validate.prototype.initializeColumn=function(column){var self=this,config=[],validator;column.definition.validator&&(Array.isArray(column.definition.validator)?column.definition.validator.forEach((function(item){(validator=self._extractValidator(item))&&config.push(validator)})):(validator=this._extractValidator(column.definition.validator))&&config.push(validator),column.modules.validate=!!config.length&&config)},Validate.prototype._extractValidator=function(value){var type,params,pos;switch(void 0===value?"undefined":_typeof(value)){case"string":return(pos=value.indexOf(":"))>-1?(type=value.substring(0,pos),params=value.substring(pos+1)):type=value,this._buildValidator(type,params);case"function":return this._buildValidator(value);case"object":return this._buildValidator(value.type,value.parameters)}},Validate.prototype._buildValidator=function(type,params){var func="function"==typeof type?type:this.validators[type];return func?{type:"function"==typeof type?"function":type,func:func,params:params}:(console.warn("Validator Setup Error - No matching validator found:",type),!1)},Validate.prototype.validate=function(validators,cell,value){var self=this,valid=[],invalidIndex=this.invalidCells.indexOf(cell);return validators&&validators.forEach((function(item){item.func.call(self,cell.getComponent(),value,item.params)||valid.push({type:item.type,parameters:item.params})})),valid=!valid.length||valid,cell.modules.validate||(cell.modules.validate={}),!0===valid?(cell.modules.validate.invalid=!1,cell.getElement().classList.remove("tabulator-validation-fail"),invalidIndex>-1&&this.invalidCells.splice(invalidIndex,1)):(cell.modules.validate.invalid=!0,"manual"!==this.table.options.validationMode&&cell.getElement().classList.add("tabulator-validation-fail"),-1==invalidIndex&&this.invalidCells.push(cell)),valid},Validate.prototype.getInvalidCells=function(){var output=[];return this.invalidCells.forEach((function(cell){output.push(cell.getComponent())})),output},Validate.prototype.clearValidation=function(cell){var invalidIndex;cell.modules.validate&&cell.modules.validate.invalid&&(cell.element.classList.remove("tabulator-validation-fail"),cell.modules.validate.invalid=!1,(invalidIndex=this.invalidCells.indexOf(cell))>-1&&this.invalidCells.splice(invalidIndex,1))},Validate.prototype.validators={integer:function integer(cell,value,parameters){return""===value||null==value||"number"==typeof(value=Number(value))&&isFinite(value)&&Math.floor(value)===value},float:function float(cell,value,parameters){return""===value||null==value||"number"==typeof(value=Number(value))&&isFinite(value)&&value%1!=0},numeric:function numeric(cell,value,parameters){return""===value||null==value||!isNaN(value)},string:function string(cell,value,parameters){return""===value||null==value||isNaN(value)},max:function max(cell,value,parameters){return""===value||null==value||parseFloat(value)<=parameters},min:function min(cell,value,parameters){return""===value||null==value||parseFloat(value)>=parameters},starts:function starts(cell,value,parameters){return""===value||null==value||String(value).toLowerCase().startsWith(String(parameters).toLowerCase())},ends:function ends(cell,value,parameters){return""===value||null==value||String(value).toLowerCase().endsWith(String(parameters).toLowerCase())},minLength:function minLength(cell,value,parameters){return""===value||null==value||String(value).length>=parameters},maxLength:function maxLength(cell,value,parameters){return""===value||null==value||String(value).length<=parameters},in:function _in(cell,value,parameters){return""===value||null==value||("string"==typeof parameters&&(parameters=parameters.split("|")),""===value||parameters.indexOf(value)>-1)},regex:function regex(cell,value,parameters){return""===value||null==value||new RegExp(parameters).test(value);var reg},unique:function unique(cell,value,parameters){if(""===value||null==value)return!0;var unique=!0,cellData=cell.getData(),column=cell.getColumn()._getSelf();return this.table.rowManager.rows.forEach((function(row){var data=row.getData();data!==cellData&&value==column.getFieldValue(data)&&(unique=!1)})),unique},required:function required(cell,value,parameters){return""!==value&&null!=value}},Tabulator.prototype.registerModule("validate",Validate),Tabulator})); \ No newline at end of file diff --git a/admin/js/vendors/tabulator/js/tabulator.min.orig.js b/admin/js/vendors/tabulator/js/tabulator.min.orig.js new file mode 100644 index 0000000..74f4780 --- /dev/null +++ b/admin/js/vendors/tabulator/js/tabulator.min.orig.js @@ -0,0 +1,12 @@ +/* Tabulator v4.7.0 (c) Oliver Folkerd */ +var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};!function(e,t){"object"===("undefined"==typeof exports?"undefined":_typeof(exports))&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):e.Tabulator=t()}(this,function(){"use strict";Array.prototype.findIndex||Object.defineProperty(Array.prototype,"findIndex",{value:function(e){if(null==this)throw new TypeError('"this" is null or not defined');var t=Object(this),o=t.length>>>0;if("function"!=typeof e)throw new TypeError("predicate must be a function");for(var i=arguments[1],n=0;n>>0;if("function"!=typeof e)throw new TypeError("predicate must be a function");for(var i=arguments[1],n=0;n>>0;if(0===i)return!1;for(var n=0|t,s=Math.max(n>=0?n:i-Math.abs(n),0);so?(t=e-o,this.element.style.marginLeft=-t+"px"):this.element.style.marginLeft=0,this.scrollLeft=e,this.table.modExists("frozenColumns")&&this.table.modules.frozenColumns.scrollHorizontal()},t.prototype.generateColumnsFromRowData=function(e){var t,o,i=[];if(e&&e.length){t=e[0];for(var n in t){var s={field:n,title:n},r=t[n];switch(void 0===r?"undefined":_typeof(r)){case"undefined":o="string";break;case"boolean":o="boolean";break;case"object":o=Array.isArray(r)?"array":"string";break;default:o=isNaN(r)||""===r?r.match(/((^[0-9]+[a-z]+)|(^[a-z]+[0-9]+))+$/i)?"alphanum":"string":"number"}s.sorter=o,i.push(s)}this.table.options.columns=i,this.setColumns(this.table.options.columns)}},t.prototype.setColumns=function(e,t){for(var o=this;o.headersElement.firstChild;)o.headersElement.removeChild(o.headersElement.firstChild);o.columns=[],o.columnsByIndex=[],o.columnsByField={},o.table.modExists("frozenColumns")&&o.table.modules.frozenColumns.reset(),e.forEach(function(e,t){o._addColumn(e)}),o._reIndexColumns(),o.table.options.responsiveLayout&&o.table.modExists("responsiveLayout",!0)&&o.table.modules.responsiveLayout.initialize(),o.redraw(!0)},t.prototype._addColumn=function(e,t,o){var i=new n(e,this),s=i.getElement(),r=o?this.findColumnIndex(o):o;if(o&&r>-1){var a=this.columns.indexOf(o.getTopColumn()),l=o.getElement();t?(this.columns.splice(a,0,i),l.parentNode.insertBefore(s,l)):(this.columns.splice(a+1,0,i),l.parentNode.insertBefore(s,l.nextSibling))}else t?(this.columns.unshift(i),this.headersElement.insertBefore(i.getElement(),this.headersElement.firstChild)):(this.columns.push(i),this.headersElement.appendChild(i.getElement())),i.columnRendered();return i},t.prototype.registerColumnField=function(e){e.definition.field&&(this.columnsByField[e.definition.field]=e)},t.prototype.registerColumnPosition=function(e){this.columnsByIndex.push(e)},t.prototype._reIndexColumns=function(){this.columnsByIndex=[],this.columns.forEach(function(e){e.reRegisterPosition()})},t.prototype._verticalAlignHeaders=function(){var e=this,t=0;e.columns.forEach(function(e){var o;e.clearVerticalAlign(),(o=e.getHeight())>t&&(t=o)}),e.columns.forEach(function(o){o.verticalAlign(e.table.options.columnHeaderVertAlign,t)}),e.rowManager.adjustTableSize()},t.prototype.findColumn=function(e){var t=this;if("object"!=(void 0===e?"undefined":_typeof(e)))return this.columnsByField[e]||!1;if(e instanceof n)return e;if(e instanceof o)return e._getSelf()||!1;if("undefined"!=typeof HTMLElement&&e instanceof HTMLElement){return t.columns.find(function(t){return t.element===e})||!1}return!1},t.prototype.getColumnByField=function(e){return this.columnsByField[e]},t.prototype.getColumnsByFieldRoot=function(e){var t=this,o=[];return Object.keys(this.columnsByField).forEach(function(i){i.split(".")[0]===e&&o.push(t.columnsByField[i])}),o},t.prototype.getColumnByIndex=function(e){return this.columnsByIndex[e]},t.prototype.getFirstVisibileColumn=function(e){var e=this.columnsByIndex.findIndex(function(e){return e.visible});return e>-1&&this.columnsByIndex[e]},t.prototype.getColumns=function(){return this.columns},t.prototype.findColumnIndex=function(e){return this.columnsByIndex.findIndex(function(t){return e===t})},t.prototype.getRealColumns=function(){return this.columnsByIndex},t.prototype.traverse=function(e){this.columnsByIndex.forEach(function(t,o){e(t,o)})},t.prototype.getDefinitions=function(e){var t=this,o=[];return t.columnsByIndex.forEach(function(t){(!e||e&&t.visible)&&o.push(t.getDefinition())}),o},t.prototype.getDefinitionTree=function(){var e=this,t=[];return e.columns.forEach(function(e){t.push(e.getDefinition(!0))}),t},t.prototype.getComponents=function(e){var t=this,o=[];return(e?t.columns:t.columnsByIndex).forEach(function(e){o.push(e.getComponent())}),o},t.prototype.getWidth=function(){var e=0;return this.columnsByIndex.forEach(function(t){t.visible&&(e+=t.getWidth())}),e},t.prototype.moveColumn=function(e,t,o){this.moveColumnActual(e,t,o),this.table.options.responsiveLayout&&this.table.modExists("responsiveLayout",!0)&&this.table.modules.responsiveLayout.initialize(),this.table.modExists("columnCalcs")&&this.table.modules.columnCalcs.recalc(this.table.rowManager.activeRows),t.element.parentNode.insertBefore(e.element,t.element),o&&t.element.parentNode.insertBefore(t.element,e.element),this._verticalAlignHeaders(),this.table.rowManager.reinitialize()},t.prototype.moveColumnActual=function(e,t,o){e.parent.isGroup?this._moveColumnInArray(e.parent.columns,e,t,o):this._moveColumnInArray(this.columns,e,t,o),this._moveColumnInArray(this.columnsByIndex,e,t,o,!0),this.table.options.responsiveLayout&&this.table.modExists("responsiveLayout",!0)&&this.table.modules.responsiveLayout.initialize(),this.table.options.columnMoved&&this.table.options.columnMoved.call(this.table,e.getComponent(),this.table.columnManager.getComponents()),this.table.options.persistence&&this.table.modExists("persistence",!0)&&this.table.modules.persistence.config.columns&&this.table.modules.persistence.save("columns")},t.prototype._moveColumnInArray=function(e,t,o,i,n){var s,r=e.indexOf(t);r>-1&&(e.splice(r,1),s=e.indexOf(o),s>-1?i&&(s+=1):s=r,e.splice(s,0,t),n&&this.table.rowManager.rows.forEach(function(e){if(e.cells.length){var t=e.cells.splice(r,1)[0];e.cells.splice(s,0,t)}}))},t.prototype.scrollToColumn=function(e,t,o){var i=this,n=0,s=0,r=0,a=e.getElement();return new Promise(function(l,c){if(void 0===t&&(t=i.table.options.scrollToColumnPosition),void 0===o&&(o=i.table.options.scrollToColumnIfVisible),e.visible){switch(t){case"middle":case"center":r=-i.element.clientWidth/2;break;case"right":r=a.clientWidth-i.headersElement.clientWidth}if(!o&&(s=a.offsetLeft)>0&&s+a.offsetWidthe.rowManager.element.clientHeight&&(t-=e.rowManager.element.offsetWidth-e.rowManager.element.clientWidth),this.columnsByIndex.forEach(function(i){var n,s,r;i.visible&&(n=i.definition.width||0,s=void 0===i.minWidth?e.table.options.columnMinWidth:parseInt(i.minWidth),r="string"==typeof n?n.indexOf("%")>-1?t/100*parseInt(n):parseInt(n):n,o+=r>s?r:s)}),o},t.prototype.addColumn=function(e,t,o){var i=this;return new Promise(function(n,s){var r=i._addColumn(e,t,o);i._reIndexColumns(),i.table.options.responsiveLayout&&i.table.modExists("responsiveLayout",!0)&&i.table.modules.responsiveLayout.initialize(),i.table.modExists("columnCalcs")&&i.table.modules.columnCalcs.recalc(i.table.rowManager.activeRows),i.redraw(),"fitColumns"!=i.table.modules.layout.getMode()&&r.reinitializeWidth(),i._verticalAlignHeaders(),i.table.rowManager.reinitialize(),n(r)})},t.prototype.deregisterColumn=function(e){var t,o=e.getField();o&&delete this.columnsByField[o],t=this.columnsByIndex.indexOf(e),t>-1&&this.columnsByIndex.splice(t,1),t=this.columns.indexOf(e),t>-1&&this.columns.splice(t,1),this.table.options.responsiveLayout&&this.table.modExists("responsiveLayout",!0)&&this.table.modules.responsiveLayout.initialize(),this.redraw()},t.prototype.redraw=function(e){e&&(d.prototype.helpers.elVisible(this.element)&&this._verticalAlignHeaders(),this.table.rowManager.resetScroll(),this.table.rowManager.reinitialize()),["fitColumns","fitDataStretch"].indexOf(this.table.modules.layout.getMode())>-1?this.table.modules.layout.layout():e?this.table.modules.layout.layout():this.table.options.responsiveLayout&&this.table.modExists("responsiveLayout",!0)&&this.table.modules.responsiveLayout.update(),this.table.modExists("frozenColumns")&&this.table.modules.frozenColumns.layout(),this.table.modExists("columnCalcs")&&this.table.modules.columnCalcs.recalc(this.table.rowManager.activeRows),e&&(this.table.options.persistence&&this.table.modExists("persistence",!0)&&this.table.modules.persistence.config.columns&&this.table.modules.persistence.save("columns"),this.table.modExists("columnCalcs")&&this.table.modules.columnCalcs.redraw()),this.table.footerManager.redraw()};var o=function(e){this._column=e,this.type="ColumnComponent"};o.prototype.getElement=function(){return this._column.getElement()},o.prototype.getDefinition=function(){return this._column.getDefinition()},o.prototype.getField=function(){return this._column.getField()},o.prototype.getCells=function(){var e=[];return this._column.cells.forEach(function(t){e.push(t.getComponent())}),e},o.prototype.getVisibility=function(){return console.warn("getVisibility function is deprecated, you should now use the isVisible function"),this._column.visible},o.prototype.isVisible=function(){return this._column.visible},o.prototype.show=function(){this._column.isGroup?this._column.columns.forEach(function(e){e.show()}):this._column.show()},o.prototype.hide=function(){this._column.isGroup?this._column.columns.forEach(function(e){e.hide()}):this._column.hide()},o.prototype.toggle=function(){this._column.visible?this.hide():this.show()},o.prototype.delete=function(){return this._column.delete()},o.prototype.getSubColumns=function(){var e=[];return this._column.columns.length&&this._column.columns.forEach(function(t){e.push(t.getComponent())}),e},o.prototype.getParentColumn=function(){return this._column.parent instanceof n&&this._column.parent.getComponent()},o.prototype._getSelf=function(){return this._column},o.prototype.scrollTo=function(){return this._column.table.columnManager.scrollToColumn(this._column)},o.prototype.getTable=function(){return this._column.table},o.prototype.headerFilterFocus=function(){this._column.table.modExists("filter",!0)&&this._column.table.modules.filter.setHeaderFilterFocus(this._column)},o.prototype.reloadHeaderFilter=function(){this._column.table.modExists("filter",!0)&&this._column.table.modules.filter.reloadHeaderFilter(this._column)},o.prototype.getHeaderFilterValue=function(){if(this._column.table.modExists("filter",!0))return this._column.table.modules.filter.getHeaderFilterValue(this._column)},o.prototype.setHeaderFilterValue=function(e){this._column.table.modExists("filter",!0)&&this._column.table.modules.filter.setHeaderFilterValue(this._column,e)},o.prototype.move=function(e,t){var o=this._column.table.columnManager.findColumn(e);o?this._column.table.columnManager.moveColumn(this._column,o,t):console.warn("Move Error - No matching column found:",o)},o.prototype.getNextColumn=function(){var e=this._column.nextColumn();return!!e&&e.getComponent()},o.prototype.getPrevColumn=function(){var e=this._column.prevColumn();return!!e&&e.getComponent()},o.prototype.updateDefinition=function(e){return this._column.updateDefinition(e)},o.prototype.getWidth=function(){return this._column.getWidth()},o.prototype.setWidth=function(e){return!0===e?this._column.reinitializeWidth(!0):this._column.setWidth(e)},o.prototype.validate=function(){return this._column.validate()};var n=function e(t,o){var i=this;this.table=o.table,this.definition=t,this.parent=o,this.type="column",this.columns=[],this.cells=[],this.element=this.createElement(),this.contentElement=!1,this.titleElement=!1,this.groupElement=this.createGroupElement(),this.isGroup=!1,this.tooltip=!1,this.hozAlign="",this.vertAlign="",this.field="",this.fieldStructure="",this.getFieldValue="",this.setFieldValue="",this.titleFormatterRendered=!1,this.setField(this.definition.field),this.table.options.invalidOptionWarnings&&this.checkDefinition(),this.modules={},this.cellEvents={cellClick:!1,cellDblClick:!1,cellContext:!1,cellTap:!1,cellDblTap:!1,cellTapHold:!1,cellMouseEnter:!1,cellMouseLeave:!1,cellMouseOver:!1,cellMouseOut:!1,cellMouseMove:!1},this.width=null,this.widthStyled="",this.minWidth=null,this.minWidthStyled="",this.widthFixed=!1,this.visible=!0,this.component=null,this._mapDepricatedFunctionality(),t.columns?(this.isGroup=!0,t.columns.forEach(function(t,o){var n=new e(t,i);i.attachColumn(n)}),i.checkColumnVisibility()):o.registerColumnField(this),t.rowHandle&&!1!==this.table.options.movableRows&&this.table.modExists("moveRow")&&this.table.modules.moveRow.setHandle(!0),this._buildHeader(),this.bindModuleColumns()};n.prototype.createElement=function(){var e=document.createElement("div");return e.classList.add("tabulator-col"),e.setAttribute("role","columnheader"),e.setAttribute("aria-sort","none"),e},n.prototype.createGroupElement=function(){var e=document.createElement("div");return e.classList.add("tabulator-col-group-cols"),e},n.prototype.checkDefinition=function(){var e=this;Object.keys(this.definition).forEach(function(t){-1===e.defaultOptionList.indexOf(t)&&console.warn("Invalid column definition option in '"+(e.field||e.definition.title)+"' column:",t)})},n.prototype.setField=function(e){this.field=e,this.fieldStructure=e?this.table.options.nestedFieldSeparator?e.split(this.table.options.nestedFieldSeparator):[e]:[],this.getFieldValue=this.fieldStructure.length>1?this._getNestedData:this._getFlatData,this.setFieldValue=this.fieldStructure.length>1?this._setNestedData:this._setFlatData},n.prototype.registerColumnPosition=function(e){this.parent.registerColumnPosition(e)},n.prototype.registerColumnField=function(e){this.parent.registerColumnField(e)},n.prototype.reRegisterPosition=function(){this.isGroup?this.columns.forEach(function(e){e.reRegisterPosition()}):this.registerColumnPosition(this)},n.prototype._mapDepricatedFunctionality=function(){void 0!==this.definition.hideInHtml&&(this.definition.htmlOutput=!this.definition.hideInHtml,console.warn("hideInHtml column definition property is deprecated, you should now use htmlOutput")),void 0!==this.definition.align&&(this.definition.hozAlign=this.definition.align,console.warn("align column definition property is deprecated, you should now use hozAlign")),void 0!==this.definition.downloadTitle&&(this.definition.titleDownload=this.definition.downloadTitle,console.warn("downloadTitle definition property is deprecated, you should now use titleDownload"))},n.prototype.setTooltip=function(){var e=this,t=e.definition,o=t.headerTooltip||!1===t.tooltip?t.headerTooltip:e.table.options.tooltipsHeader;o?!0===o?t.field?e.table.modules.localize.bind("columns|"+t.field,function(o){e.element.setAttribute("title",o||t.title)}):e.element.setAttribute("title",t.title):("function"==typeof o&&!1===(o=o(e.getComponent()))&&(o=""),e.element.setAttribute("title",o)):e.element.setAttribute("title","")},n.prototype._buildHeader=function(){for(var e=this,t=e.definition;e.element.firstChild;)e.element.removeChild(e.element.firstChild);t.headerVertical&&(e.element.classList.add("tabulator-col-vertical"),"flip"===t.headerVertical&&e.element.classList.add("tabulator-col-vertical-flip")),e.contentElement=e._bindEvents(),e.contentElement=e._buildColumnHeaderContent(),e.element.appendChild(e.contentElement),e.isGroup?e._buildGroupHeader():e._buildColumnHeader(),e.setTooltip(),e.table.options.resizableColumns&&e.table.modExists("resizeColumns")&&e.table.modules.resizeColumns.initializeColumn("header",e,e.element),t.headerFilter&&e.table.modExists("filter")&&e.table.modExists("edit")&&(void 0!==t.headerFilterPlaceholder&&t.field&&e.table.modules.localize.setHeaderFilterColumnPlaceholder(t.field,t.headerFilterPlaceholder),e.table.modules.filter.initializeColumn(e)),e.table.modExists("frozenColumns")&&e.table.modules.frozenColumns.initializeColumn(e),e.table.options.movableColumns&&!e.isGroup&&e.table.modExists("moveColumn")&&e.table.modules.moveColumn.initializeColumn(e),(t.topCalc||t.bottomCalc)&&e.table.modExists("columnCalcs")&&e.table.modules.columnCalcs.initializeColumn(e),e.table.modExists("persistence")&&e.table.modules.persistence.config.columns&&e.table.modules.persistence.initializeColumn(e),e.element.addEventListener("mouseenter",function(t){e.setTooltip()})},n.prototype._bindEvents=function(){var e,t,o,i=this,n=i.definition;"function"==typeof n.headerClick&&i.element.addEventListener("click",function(e){n.headerClick(e,i.getComponent())}),"function"==typeof n.headerDblClick&&i.element.addEventListener("dblclick",function(e){n.headerDblClick(e,i.getComponent())}),"function"==typeof n.headerContext&&i.element.addEventListener("contextmenu",function(e){n.headerContext(e,i.getComponent())}),"function"==typeof n.headerTap&&(o=!1,i.element.addEventListener("touchstart",function(e){o=!0},{passive:!0}),i.element.addEventListener("touchend",function(e){o&&n.headerTap(e,i.getComponent()),o=!1})),"function"==typeof n.headerDblTap&&(e=null,i.element.addEventListener("touchend",function(t){e?(clearTimeout(e),e=null,n.headerDblTap(t,i.getComponent())):e=setTimeout(function(){clearTimeout(e),e=null},300)})),"function"==typeof n.headerTapHold&&(t=null,i.element.addEventListener("touchstart",function(e){clearTimeout(t),t=setTimeout(function(){clearTimeout(t),t=null,o=!1,n.headerTapHold(e,i.getComponent())},1e3)},{passive:!0}),i.element.addEventListener("touchend",function(e){clearTimeout(t),t=null})),"function"==typeof n.cellClick&&(i.cellEvents.cellClick=n.cellClick),"function"==typeof n.cellDblClick&&(i.cellEvents.cellDblClick=n.cellDblClick),"function"==typeof n.cellContext&&(i.cellEvents.cellContext=n.cellContext),"function"==typeof n.cellMouseEnter&&(i.cellEvents.cellMouseEnter=n.cellMouseEnter),"function"==typeof n.cellMouseLeave&&(i.cellEvents.cellMouseLeave=n.cellMouseLeave),"function"==typeof n.cellMouseOver&&(i.cellEvents.cellMouseOver=n.cellMouseOver),"function"==typeof n.cellMouseOut&&(i.cellEvents.cellMouseOut=n.cellMouseOut),"function"==typeof n.cellMouseMove&&(i.cellEvents.cellMouseMove=n.cellMouseMove),"function"==typeof n.cellTap&&(i.cellEvents.cellTap=n.cellTap),"function"==typeof n.cellDblTap&&(i.cellEvents.cellDblTap=n.cellDblTap),"function"==typeof n.cellTapHold&&(i.cellEvents.cellTapHold=n.cellTapHold),"function"==typeof n.cellEdited&&(i.cellEvents.cellEdited=n.cellEdited),"function"==typeof n.cellEditing&&(i.cellEvents.cellEditing=n.cellEditing),"function"==typeof n.cellEditCancelled&&(i.cellEvents.cellEditCancelled=n.cellEditCancelled)},n.prototype._buildColumnHeader=function(){var e=this,t=e.definition,o=e.table;if(o.modExists("sort")&&o.modules.sort.initializeColumn(e,e.contentElement),(t.headerContextMenu||t.headerMenu)&&o.modExists("menu")&&o.modules.menu.initializeColumnHeader(e),o.modExists("format")&&o.modules.format.initializeColumn(e),void 0!==t.editor&&o.modExists("edit")&&o.modules.edit.initializeColumn(e),void 0!==t.validator&&o.modExists("validate")&&o.modules.validate.initializeColumn(e),o.modExists("mutator")&&o.modules.mutator.initializeColumn(e),o.modExists("accessor")&&o.modules.accessor.initializeColumn(e),_typeof(o.options.responsiveLayout)&&o.modExists("responsiveLayout")&&o.modules.responsiveLayout.initializeColumn(e),void 0!==t.visible&&(t.visible?e.show(!0):e.hide(!0)),t.cssClass){t.cssClass.split(" ").forEach(function(t){e.element.classList.add(t)})}t.field&&this.element.setAttribute("tabulator-field",t.field),e.setMinWidth(void 0===t.minWidth?e.table.options.columnMinWidth:parseInt(t.minWidth)),e.reinitializeWidth(),e.tooltip=e.definition.tooltip||!1===e.definition.tooltip?e.definition.tooltip:e.table.options.tooltips,e.hozAlign=void 0===e.definition.hozAlign?e.table.options.cellHozAlign:e.definition.hozAlign,e.vertAlign=void 0===e.definition.vertAlign?e.table.options.cellVertAlign:e.definition.vertAlign},n.prototype._buildColumnHeaderContent=function(){var e=(this.definition,this.table,document.createElement("div"));return e.classList.add("tabulator-col-content"),this.titleElement=this._buildColumnHeaderTitle(),e.appendChild(this.titleElement),e},n.prototype._buildColumnHeaderTitle=function(){var e=this,t=e.definition,o=e.table,i=document.createElement("div");if(i.classList.add("tabulator-col-title"),t.editableTitle){var n=document.createElement("input");n.classList.add("tabulator-title-editor"),n.addEventListener("click",function(e){e.stopPropagation(),n.focus()}),n.addEventListener("change",function(){t.title=n.value,o.options.columnTitleChanged.call(e.table,e.getComponent())}),i.appendChild(n),t.field?o.modules.localize.bind("columns|"+t.field,function(e){n.value=e||t.title||" "}):n.value=t.title||" "}else t.field?o.modules.localize.bind("columns|"+t.field,function(o){e._formatColumnHeaderTitle(i,o||t.title||" ")}):e._formatColumnHeaderTitle(i,t.title||" ");return i},n.prototype._formatColumnHeaderTitle=function(e,t){var o,i,n,s,r,a=this;if(this.definition.titleFormatter&&this.table.modExists("format"))switch(o=this.table.modules.format.getFormatter(this.definition.titleFormatter),r=function(e){a.titleFormatterRendered=e},s={getValue:function(){return t},getElement:function(){return e}},n=this.definition.titleFormatterParams||{},n="function"==typeof n?n():n,i=o.call(this.table.modules.format,s,n,r),void 0===i?"undefined":_typeof(i)){case"object":i instanceof Node?e.appendChild(i):(e.innerHTML="",console.warn("Format Error - Title formatter has returned a type of object, the only valid formatter object return is an instance of Node, the formatter returned:",i));break;case"undefined":case"null":e.innerHTML="";break;default:e.innerHTML=i}else e.innerHTML=t},n.prototype._buildGroupHeader=function(){var e=this;if(this.element.classList.add("tabulator-col-group"),this.element.setAttribute("role","columngroup"),this.element.setAttribute("aria-title",this.definition.title),this.definition.cssClass){this.definition.cssClass.split(" ").forEach(function(t){e.element.classList.add(t)})}(this.definition.headerContextMenu||this.definition.headerMenu)&&this.table.modExists("menu")&&this.table.modules.menu.initializeColumnHeader(this),this.element.appendChild(this.groupElement)},n.prototype._getFlatData=function(e){return e[this.field]},n.prototype._getNestedData=function(e){for(var t,o=e,i=this.fieldStructure,n=i.length,s=0;s-1&&this._nextVisibleColumn(e+1)},n.prototype._nextVisibleColumn=function(e){var t=this.table.columnManager.getColumnByIndex(e);return!t||t.visible?t:this._nextVisibleColumn(e+1)},n.prototype.prevColumn=function(){var e=this.table.columnManager.findColumnIndex(this);return e>-1&&this._prevVisibleColumn(e-1)},n.prototype._prevVisibleColumn=function(e){var t=this.table.columnManager.getColumnByIndex(e);return!t||t.visible?t:this._prevVisibleColumn(e-1)},n.prototype.reinitializeWidth=function(e){this.widthFixed=!1, +void 0===this.definition.width||e||this.setWidth(this.definition.width),this.table.modExists("filter")&&this.table.modules.filter.hideHeaderFilterElements(),this.fitToData(),this.table.modExists("filter")&&this.table.modules.filter.showHeaderFilterElements()},n.prototype.fitToData=function(){var e=this;this.widthFixed||(this.element.style.width="",e.cells.forEach(function(e){e.clearWidth()}));var t=this.element.offsetWidth;e.width&&this.widthFixed||(e.cells.forEach(function(e){var o=e.getWidth();o>t&&(t=o)}),t&&e.setWidthActual(t+1))},n.prototype.updateDefinition=function(e){var t=this;return new Promise(function(o,i){var n;t.isGroup?(console.warn("Column Update Error - The updateDefintion function is only available on columns, not column groups"),i("Column Update Error - The updateDefintion function is only available on columns, not column groups")):(n=Object.assign({},t.getDefinition()),n=Object.assign(n,e),t.table.columnManager.addColumn(n,!1,t).then(function(e){n.field==t.field&&(t.field=!1),t.delete().then(function(){o(e.getComponent())}).catch(function(e){i(e)})}).catch(function(e){i(e)}))})},n.prototype.deleteCell=function(e){var t=this.cells.indexOf(e);t>-1&&this.cells.splice(t,1)},n.prototype.defaultOptionList=["title","field","columns","visible","align","hozAlign","vertAlign","width","minWidth","widthGrow","widthShrink","resizable","frozen","responsive","tooltip","cssClass","rowHandle","hideInHtml","print","htmlOutput","sorter","sorterParams","formatter","formatterParams","variableHeight","editable","editor","editorParams","validator","mutator","mutatorParams","mutatorData","mutatorDataParams","mutatorEdit","mutatorEditParams","mutatorClipboard","mutatorClipboardParams","accessor","accessorParams","accessorData","accessorDataParams","accessorDownload","accessorDownloadParams","accessorClipboard","accessorClipboardParams","accessorPrint","accessorPrintParams","accessorHtmlOutput","accessorHtmlOutputParams","clipboard","download","downloadTitle","topCalc","topCalcParams","topCalcFormatter","topCalcFormatterParams","bottomCalc","bottomCalcParams","bottomCalcFormatter","bottomCalcFormatterParams","cellClick","cellDblClick","cellContext","cellTap","cellDblTap","cellTapHold","cellMouseEnter","cellMouseLeave","cellMouseOver","cellMouseOut","cellMouseMove","cellEditing","cellEdited","cellEditCancelled","headerSort","headerSortStartingDir","headerSortTristate","headerClick","headerDblClick","headerContext","headerTap","headerDblTap","headerTapHold","headerTooltip","headerVertical","editableTitle","titleFormatter","titleFormatterParams","headerFilter","headerFilterPlaceholder","headerFilterParams","headerFilterEmptyCheck","headerFilterFunc","headerFilterFuncParams","headerFilterLiveFilter","print","headerContextMenu","headerMenu","contextMenu","formatterPrint","formatterPrintParams","formatterClipboard","formatterClipboardParams","formatterHtmlOutput","formatterHtmlOutputParams","titlePrint","titleClipboard","titleHtmlOutput","titleDownload"],n.prototype.getComponent=function(){return this.component||(this.component=new o(this)),this.component};var s=function(e){this.table=e,this.element=this.createHolderElement(),this.tableElement=this.createTableElement(),this.heightFixer=this.createTableElement(),this.columnManager=null,this.height=0,this.firstRender=!1,this.renderMode="virtual",this.fixedHeight=!1,this.rows=[],this.activeRows=[],this.activeRowsCount=0,this.displayRows=[],this.displayRowsCount=0,this.scrollTop=0,this.scrollLeft=0,this.vDomRowHeight=20,this.vDomTop=0,this.vDomBottom=0,this.vDomScrollPosTop=0,this.vDomScrollPosBottom=0,this.vDomTopPad=0,this.vDomBottomPad=0,this.vDomMaxRenderChain=90,this.vDomWindowBuffer=0,this.vDomWindowMinTotalRows=20,this.vDomWindowMinMarginRows=5,this.vDomTopNewRows=[],this.vDomBottomNewRows=[],this.rowNumColumn=!1,this.redrawBlock=!1,this.redrawBlockRestoreConfig=!1,this.redrawBlockRederInPosition=!1};s.prototype.createHolderElement=function(){var e=document.createElement("div");return e.classList.add("tabulator-tableHolder"),e.setAttribute("tabindex",0),e},s.prototype.createTableElement=function(){var e=document.createElement("div");return e.classList.add("tabulator-table"),e},s.prototype.getElement=function(){return this.element},s.prototype.getTableElement=function(){return this.tableElement},s.prototype.getRowPosition=function(e,t){return t?this.activeRows.indexOf(e):this.rows.indexOf(e)},s.prototype.setColumnManager=function(e){this.columnManager=e},s.prototype.initialize=function(){var e=this;e.setRenderMode(),e.element.appendChild(e.tableElement),e.firstRender=!0,e.element.addEventListener("scroll",function(){var t=e.element.scrollLeft;e.scrollLeft!=t&&(e.columnManager.scrollHorizontal(t),e.table.options.groupBy&&e.table.modules.groupRows.scrollHeaders(t),e.table.modExists("columnCalcs")&&e.table.modules.columnCalcs.scrollHorizontal(t),e.table.options.scrollHorizontal(t)),e.scrollLeft=t}),"virtual"===this.renderMode&&e.element.addEventListener("scroll",function(){var t=e.element.scrollTop,o=e.scrollTop>t;e.scrollTop!=t?(e.scrollTop=t,e.scrollVertical(o),"scroll"==e.table.options.ajaxProgressiveLoad&&e.table.modules.ajax.nextPage(e.element.scrollHeight-e.element.clientHeight-t),e.table.options.scrollVertical(t)):e.scrollTop=t})},s.prototype.findRow=function(e){var t=this;if("object"!=(void 0===e?"undefined":_typeof(e))){if(void 0===e||null===e)return!1;return t.rows.find(function(o){return o.data[t.table.options.index]==e})||!1}if(e instanceof a)return e;if(e instanceof r)return e._getSelf()||!1;if("undefined"!=typeof HTMLElement&&e instanceof HTMLElement){return t.rows.find(function(t){return t.element===e})||!1}return!1},s.prototype.getRowFromDataObject=function(e){return this.rows.find(function(t){return t.data===e})||!1},s.prototype.getRowFromPosition=function(e,t){return t?this.activeRows[e]:this.rows[e]},s.prototype.scrollToRow=function(e,t,o){var i,n=this,s=this.getDisplayRows().indexOf(e),r=e.getElement(),a=0;return new Promise(function(e,l){if(s>-1){if(void 0===t&&(t=n.table.options.scrollToRowPosition),void 0===o&&(o=n.table.options.scrollToRowIfVisible),"nearest"===t)switch(n.renderMode){case"classic":i=d.prototype.helpers.elOffset(r).top,t=Math.abs(n.element.scrollTop-i)>Math.abs(n.element.scrollTop+n.element.clientHeight-i)?"bottom":"top";break;case"virtual":t=Math.abs(n.vDomTop-s)>Math.abs(n.vDomBottom-s)?"bottom":"top"}if(!o&&d.prototype.helpers.elVisible(r)&&(a=d.prototype.helpers.elOffset(r).top-d.prototype.helpers.elOffset(n.element).top)>0&&a-1&&this.activeRows.splice(i,1),o>-1&&this.rows.splice(o,1),this.setActiveRows(this.activeRows),this.displayRowIterator(function(t){var o=t.indexOf(e);o>-1&&t.splice(o,1)}),t||this.reRenderInPosition(),this.regenerateRowNumbers(),this.table.options.rowDeleted.call(this.table,e.getComponent()),this.table.options.dataEdited.call(this.table,this.getData()),this.table.options.groupBy&&this.table.modExists("groupRows")?this.table.modules.groupRows.updateGroupRows(!0):this.table.options.pagination&&this.table.modExists("page")?this.refreshActiveData(!1,!1,!0):this.table.options.pagination&&this.table.modExists("page")&&this.refreshActiveData("page")},s.prototype.addRow=function(e,t,o,i){var n=this.addRowActual(e,t,o,i);return this.table.options.history&&this.table.modExists("history")&&this.table.modules.history.action("rowAdd",n,{data:e,pos:t,index:o}),n},s.prototype.addRows=function(e,t,o){var i=this,n=this,s=0,r=[];return new Promise(function(a,l){t=i.findAddRowPos(t),Array.isArray(e)||(e=[e]),s=e.length-1,(void 0===o&&t||void 0!==o&&!t)&&e.reverse(),e.forEach(function(e,i){var s=n.addRow(e,t,o,!0);r.push(s)}),i.table.options.groupBy&&i.table.modExists("groupRows")?i.table.modules.groupRows.updateGroupRows(!0):i.table.options.pagination&&i.table.modExists("page")?i.refreshActiveData(!1,!1,!0):i.reRenderInPosition(),i.table.modExists("columnCalcs")&&i.table.modules.columnCalcs.recalc(i.table.rowManager.activeRows),i.regenerateRowNumbers(),a(r)})},s.prototype.findAddRowPos=function(e){return void 0===e&&(e=this.table.options.addRowPos),"pos"===e&&(e=!0),"bottom"===e&&(e=!1),e},s.prototype.addRowActual=function(e,t,o,i){var n,s,r=e instanceof a?e:new a(e||{},this),l=this.findAddRowPos(t),c=-1;if(!o&&this.table.options.pagination&&"page"==this.table.options.paginationAddRow&&(s=this.getDisplayRows(),l?s.length?o=s[0]:this.activeRows.length&&(o=this.activeRows[this.activeRows.length-1],l=!1):s.length&&(o=s[s.length-1],l=!(s.length1&&(!o||o&&-1==u.indexOf(o)?l?u[0]!==r&&(o=u[0],this._moveRowInArray(r.getGroup().rows,r,o,!l)):u[u.length-1]!==r&&(o=u[u.length-1],this._moveRowInArray(r.getGroup().rows,r,o,!l)):this._moveRowInArray(r.getGroup().rows,r,o,!l))}return o&&(c=this.rows.indexOf(o)),o&&c>-1?(n=this.activeRows.indexOf(o),this.displayRowIterator(function(e){var t=e.indexOf(o);t>-1&&e.splice(l?t:t+1,0,r)}),n>-1&&this.activeRows.splice(l?n:n+1,0,r),this.rows.splice(l?c:c+1,0,r)):l?(this.displayRowIterator(function(e){e.unshift(r)}),this.activeRows.unshift(r),this.rows.unshift(r)):(this.displayRowIterator(function(e){e.push(r)}),this.activeRows.push(r),this.rows.push(r)),this.setActiveRows(this.activeRows),this.table.options.rowAdded.call(this.table,r.getComponent()),this.table.options.dataEdited.call(this.table,this.getData()),i||this.reRenderInPosition(),r},s.prototype.moveRow=function(e,t,o){this.table.options.history&&this.table.modExists("history")&&this.table.modules.history.action("rowMove",e,{posFrom:this.getRowPosition(e),posTo:this.getRowPosition(t),to:t,after:o}),this.moveRowActual(e,t,o),this.regenerateRowNumbers(),this.table.options.rowMoved.call(this.table,e.getComponent())},s.prototype.moveRowActual=function(e,t,o){var i=this;if(this._moveRowInArray(this.rows,e,t,o),this._moveRowInArray(this.activeRows,e,t,o),this.displayRowIterator(function(n){i._moveRowInArray(n,e,t,o)}),this.table.options.groupBy&&this.table.modExists("groupRows")){!o&&t instanceof S&&(t=this.table.rowManager.prevDisplayRow(e)||t);var n=t.getGroup(),s=e.getGroup();n===s?this._moveRowInArray(n.rows,e,t,o):(s&&s.removeRow(e),n.insertRow(e,t,o))}},s.prototype._moveRowInArray=function(e,t,o,i){var n,s,r,a;if(t!==o&&(n=e.indexOf(t),n>-1&&(e.splice(n,1),s=e.indexOf(o),s>-1?i?e.splice(s+1,0,t):e.splice(s,0,t):e.splice(n,0,t)),e===this.getDisplayRows())){r=nn?s:n+1;for(var l=r;l<=a;l++)e[l]&&this.styleRow(e[l],l)}},s.prototype.clearData=function(){this.setData([])},s.prototype.getRowIndex=function(e){return this.findRowIndex(e,this.rows)},s.prototype.getDisplayRowIndex=function(e){var t=this.getDisplayRows().indexOf(e);return t>-1&&t},s.prototype.nextDisplayRow=function(e,t){var o=this.getDisplayRowIndex(e),i=!1;return!1!==o&&o-1)&&o},s.prototype.getData=function(e,t){var o=[];return this.getRows(e).forEach(function(e){"row"==e.type&&o.push(e.getData(t||"data"))}),o},s.prototype.getComponents=function(e){var t=[];return this.getRows(e).forEach(function(e){t.push(e.getComponent())}),t},s.prototype.getDataCount=function(e){return this.getRows(e).length},s.prototype._genRemoteRequest=function(){var e=this,t=this.table,o=t.options,i={};if(t.modExists("page")){if(o.ajaxSorting){var n=this.table.modules.sort.getSort();n.forEach(function(e){delete e.column}),i[this.table.modules.page.paginationDataSentNames.sorters]=n}if(o.ajaxFiltering){var s=this.table.modules.filter.getFilters(!0,!0);i[this.table.modules.page.paginationDataSentNames.filters]=s}this.table.modules.ajax.setParams(i,!0)}t.modules.ajax.sendRequest().then(function(t){e._setDataActual(t,!0)}).catch(function(e){})},s.prototype.filterRefresh=function(){var e=this.table,t=e.options,o=this.scrollLeft;t.ajaxFiltering?"remote"==t.pagination&&e.modExists("page")?(e.modules.page.reset(!0),e.modules.page.setPage(1).then(function(){}).catch(function(){})):t.ajaxProgressiveLoad?e.modules.ajax.loadData().then(function(){}).catch(function(){}):this._genRemoteRequest():this.refreshActiveData("filter"),this.scrollHorizontal(o)},s.prototype.sorterRefresh=function(e){var t=this.table,o=this.table.options,i=this.scrollLeft;o.ajaxSorting?("remote"==o.pagination||o.progressiveLoad)&&t.modExists("page")?(t.modules.page.reset(!0),t.modules.page.setPage(1).then(function(){}).catch(function(){})):o.ajaxProgressiveLoad?t.modules.ajax.loadData().then(function(){}).catch(function(){}):this._genRemoteRequest():this.refreshActiveData(e?"filter":"sort"),this.scrollHorizontal(i)},s.prototype.scrollHorizontal=function(e){this.scrollLeft=e,this.element.scrollLeft=e,this.table.options.groupBy&&this.table.modules.groupRows.scrollHeaders(e),this.table.modExists("columnCalcs")&&this.table.modules.columnCalcs.scrollHorizontal(e)},s.prototype.refreshActiveData=function(e,t,o){var i,n=this,s=this.table,r=["all","filter","sort","display","freeze","group","tree","page"];if(this.redrawBlock)return void((!this.redrawBlockRestoreConfig||r.indexOf(e)=0))break;s=a}else if(t-r[a].getElement().offsetTop>=0)n=a;else{if(i=!0,!(o-r[a].getElement().offsetTop>=0))break;s=a}}else n=this.vDomTop,s=this.vDomBottom;return r.slice(n,s+1)},s.prototype.displayRowIterator=function(e){this.displayRows.forEach(e),this.displayRowsCount=this.displayRows[this.displayRows.length-1].length},s.prototype.getRows=function(e){var t;switch(e){case"active":t=this.activeRows;break;case"display":t=this.table.rowManager.getDisplayRows();break;case"visible":t=this.getVisibleRows(!0);break;default:t=this.rows}return t},s.prototype.reRenderInPosition=function(e){if("virtual"==this.getRenderMode())if(this.redrawBlock)e?e():this.redrawBlockRederInPosition=!0;else{for(var t=this.element.scrollTop,o=!1,i=!1,n=this.scrollLeft,s=this.getDisplayRows(),r=this.vDomTop;r<=this.vDomBottom;r++)if(s[r]){var a=t-s[r].getElement().offsetTop;if(!(!1===i||Math.abs(a)this.vDomWindowBuffer&&(this.vDomWindowBuffer=2*g),"group"!==f.type&&(u=!1),i.vDomBottom++,c++}e?(i.vDomTopPad=t?i.vDomRowHeight*this.vDomTop+o:i.scrollTop-l,i.vDomBottomPad=i.vDomBottom==i.displayRowsCount-1?0:Math.max(i.vDomScrollHeight-i.vDomTopPad-a-l,0)):(this.vDomTopPad=0,i.vDomRowHeight=Math.floor((a+l)/c),i.vDomBottomPad=i.vDomRowHeight*(i.displayRowsCount-i.vDomBottom-1),i.vDomScrollHeight=l+a+i.vDomBottomPad-i.height),n.style.paddingTop=i.vDomTopPad+"px",n.style.paddingBottom=i.vDomBottomPad+"px",t&&(this.scrollTop=i.vDomTopPad+l+o-(this.element.scrollWidth>this.element.clientWidth?this.element.offsetHeight-this.element.clientHeight:0)),this.scrollTop=Math.min(this.scrollTop,this.element.scrollHeight-this.height),this.element.scrollWidth>this.element.offsetWidth&&t&&(this.scrollTop+=this.element.offsetHeight-this.element.clientHeight),this.vDomScrollPosTop=this.scrollTop,this.vDomScrollPosBottom=this.scrollTop,s.scrollTop=this.scrollTop,n.style.minWidth=u?i.table.columnManager.getWidth()+"px":"",i.table.options.groupBy&&"fitDataFill"!=i.table.modules.layout.getMode()&&i.displayRowsCount==i.table.modules.groupRows.countGroups()&&(i.tableElement.style.minWidth=i.table.columnManager.getWidth())}else this.renderEmptyScroll();this.fixedHeight||this.adjustTableSize()},s.prototype.scrollVertical=function(e){var t=this.scrollTop-this.vDomScrollPosTop,o=this.scrollTop-this.vDomScrollPosBottom,i=2*this.vDomWindowBuffer;if(-t>i||o>i){var n=this.scrollLeft;this._virtualRenderFill(Math.floor(this.element.scrollTop/this.element.scrollHeight*this.displayRowsCount)),this.scrollHorizontal(n)}else e?(t<0&&this._addTopRow(-t),o<0&&(this.vDomScrollHeight-this.scrollTop>this.vDomWindowBuffer?this._removeBottomRow(-o):this.vDomScrollPosBottom=this.scrollTop)):(t>=0&&(this.scrollTop>this.vDomWindowBuffer?this._removeTopRow(t):this.vDomScrollPosTop=this.scrollTop),o>=0&&this._addBottomRow(o))},s.prototype._addTopRow=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,o=this.tableElement,i=this.getDisplayRows();if(this.vDomTop){var n=this.vDomTop-1,s=i[n],r=s.getHeight()||this.vDomRowHeight;e>=r&&(this.styleRow(s,n),o.insertBefore(s.getElement(),o.firstChild),s.initialized&&s.heightInitialized||(this.vDomTopNewRows.push(s),s.heightInitialized||s.clearCellHeight()),s.initialize(),this.vDomTopPad-=r,this.vDomTopPad<0&&(this.vDomTopPad=n*this.vDomRowHeight),n||(this.vDomTopPad=0),o.style.paddingTop=this.vDomTopPad+"px",this.vDomScrollPosTop-=r,this.vDomTop--),e=-(this.scrollTop-this.vDomScrollPosTop),s.getHeight()>this.vDomWindowBuffer&&(this.vDomWindowBuffer=2*s.getHeight()),t=(i[this.vDomTop-1].getHeight()||this.vDomRowHeight)?this._addTopRow(e,t+1):this._quickNormalizeRowHeight(this.vDomTopNewRows)}},s.prototype._removeTopRow=function(e){var t=this.tableElement,o=this.getDisplayRows()[this.vDomTop],i=o.getHeight()||this.vDomRowHeight;if(e>=i){var n=o.getElement();n.parentNode.removeChild(n),this.vDomTopPad+=i,t.style.paddingTop=this.vDomTopPad+"px",this.vDomScrollPosTop+=this.vDomTop?i:i+this.vDomWindowBuffer,this.vDomTop++,e=this.scrollTop-this.vDomScrollPosTop,this._removeTopRow(e)}},s.prototype._addBottomRow=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,o=this.tableElement,i=this.getDisplayRows();if(this.vDomBottom=r&&(this.styleRow(s,n),o.appendChild(s.getElement()),s.initialized&&s.heightInitialized||(this.vDomBottomNewRows.push(s),s.heightInitialized||s.clearCellHeight()),s.initialize(),this.vDomBottomPad-=r,(this.vDomBottomPad<0||n==this.displayRowsCount-1)&&(this.vDomBottomPad=0),o.style.paddingBottom=this.vDomBottomPad+"px",this.vDomScrollPosBottom+=r,this.vDomBottom++),e=this.scrollTop-this.vDomScrollPosBottom,s.getHeight()>this.vDomWindowBuffer&&(this.vDomWindowBuffer=2*s.getHeight()),t=(i[this.vDomBottom+1].getHeight()||this.vDomRowHeight)?this._addBottomRow(e,t+1):this._quickNormalizeRowHeight(this.vDomBottomNewRows)}},s.prototype._removeBottomRow=function(e){var t=this.tableElement,o=this.getDisplayRows()[this.vDomBottom],i=o.getHeight()||this.vDomRowHeight;if(e>=i){var n=o.getElement();n.parentNode&&n.parentNode.removeChild(n),this.vDomBottomPad+=i,this.vDomBottomPad<0&&(this.vDomBottomPad=0),t.style.paddingBottom=this.vDomBottomPad+"px",this.vDomScrollPosBottom-=i,this.vDomBottom--,e=-(this.scrollTop-this.vDomScrollPosBottom),this._removeBottomRow(e)}},s.prototype._quickNormalizeRowHeight=function(e){e.forEach(function(e){e.calcHeight()}),e.forEach(function(e){e.setCellHeight()}),e.length=0},s.prototype.normalizeHeight=function(){this.activeRows.forEach(function(e){e.normalizeHeight()})},s.prototype.adjustTableSize=function(){var e,t=this.element.clientHeight;if("virtual"===this.renderMode){var o=this.columnManager.getElement().offsetHeight+(this.table.footerManager&&!this.table.footerManager.external?this.table.footerManager.getElement().offsetHeight:0);this.fixedHeight?(this.element.style.minHeight="calc(100% - "+o+"px)",this.element.style.height="calc(100% - "+o+"px)",this.element.style.maxHeight="calc(100% - "+o+"px)"):(this.element.style.height="",this.element.style.height=this.table.element.clientHeight-o+"px",this.element.scrollTop=this.scrollTop),this.height=this.element.clientHeight,this.vDomWindowBuffer=this.table.options.virtualDomBuffer||this.height,this.fixedHeight||t==this.element.clientHeight||((e=this.table.modExists("resizeTable"))&&!this.table.modules.resizeTable.autoResize||!e)&&this.redraw()}},s.prototype.reinitialize=function(){this.rows.forEach(function(e){e.reinitialize()})},s.prototype.blockRedraw=function(){this.redrawBlock=!0,this.redrawBlockRestoreConfig=!1},s.prototype.restoreRedraw=function(){this.redrawBlock=!1,this.redrawBlockRestoreConfig?(this.refreshActiveData(this.redrawBlockRestoreConfig.stage,this.redrawBlockRestoreConfig.skipStage,this.redrawBlockRestoreConfig.renderInPosition),this.redrawBlockRestoreConfig=!1):this.redrawBlockRederInPosition&&this.reRenderInPosition(),this.redrawBlockRederInPosition=!1},s.prototype.redraw=function(e){var t=this.scrollLeft;this.adjustTableSize(),this.table.tableWidth=this.table.element.clientWidth,e?this.renderTable():("classic"==this.renderMode?this.table.options.groupBy?this.refreshActiveData("group",!1,!1):this._simpleRender():(this.reRenderInPosition(),this.scrollHorizontal(t)),this.displayRowsCount||this.table.options.placeholder&&this.getElement().appendChild(this.table.options.placeholder))},s.prototype.resetScroll=function(){if(this.element.scrollLeft=0,this.element.scrollTop=0,"ie"===this.table.browser){var e=document.createEvent("Event");e.initEvent("scroll",!1,!0),this.element.dispatchEvent(e)}else this.element.dispatchEvent(new Event("scroll"))};var r=function(e){this._row=e};r.prototype.getData=function(e){return this._row.getData(e)},r.prototype.getElement=function(){return this._row.getElement()},r.prototype.getCells=function(){var e=[];return this._row.getCells().forEach(function(t){e.push(t.getComponent())}),e},r.prototype.getCell=function(e){var t=this._row.getCell(e);return!!t&&t.getComponent()},r.prototype.getIndex=function(){return this._row.getData("data")[this._row.table.options.index]},r.prototype.getPosition=function(e){return this._row.table.rowManager.getRowPosition(this._row,e)},r.prototype.delete=function(){return this._row.delete()},r.prototype.scrollTo=function(){return this._row.table.rowManager.scrollToRow(this._row)},r.prototype.pageTo=function(){if(this._row.table.modExists("page",!0))return this._row.table.modules.page.setPageToRow(this._row)},r.prototype.move=function(e,t){this._row.moveToRow(e,t)},r.prototype.update=function(e){return this._row.updateData(e)}, +r.prototype.normalizeHeight=function(){this._row.normalizeHeight(!0)},r.prototype.select=function(){this._row.table.modules.selectRow.selectRows(this._row)},r.prototype.deselect=function(){this._row.table.modules.selectRow.deselectRows(this._row)},r.prototype.toggleSelect=function(){this._row.table.modules.selectRow.toggleRow(this._row)},r.prototype.isSelected=function(){return this._row.table.modules.selectRow.isRowSelected(this._row)},r.prototype._getSelf=function(){return this._row},r.prototype.validate=function(){return this._row.validate()},r.prototype.freeze=function(){this._row.table.modExists("frozenRows",!0)&&this._row.table.modules.frozenRows.freezeRow(this._row)},r.prototype.unfreeze=function(){this._row.table.modExists("frozenRows",!0)&&this._row.table.modules.frozenRows.unfreezeRow(this._row)},r.prototype.isFrozen=function(){if(this._row.table.modExists("frozenRows",!0)){return this._row.table.modules.frozenRows.rows.indexOf(this._row)>-1}return!1},r.prototype.treeCollapse=function(){this._row.table.modExists("dataTree",!0)&&this._row.table.modules.dataTree.collapseRow(this._row)},r.prototype.treeExpand=function(){this._row.table.modExists("dataTree",!0)&&this._row.table.modules.dataTree.expandRow(this._row)},r.prototype.treeToggle=function(){this._row.table.modExists("dataTree",!0)&&this._row.table.modules.dataTree.toggleRow(this._row)},r.prototype.getTreeParent=function(){return!!this._row.table.modExists("dataTree",!0)&&this._row.table.modules.dataTree.getTreeParent(this._row)},r.prototype.getTreeChildren=function(){return!!this._row.table.modExists("dataTree",!0)&&this._row.table.modules.dataTree.getTreeChildren(this._row)},r.prototype.addTreeChild=function(e,t,o){return!!this._row.table.modExists("dataTree",!0)&&this._row.table.modules.dataTree.addTreeChildRow(this._row,e,t,o)},r.prototype.reformat=function(){return this._row.reinitialize()},r.prototype.getGroup=function(){return this._row.getGroup().getComponent()},r.prototype.getTable=function(){return this._row.table},r.prototype.getNextRow=function(){var e=this._row.nextRow();return e?e.getComponent():e},r.prototype.getPrevRow=function(){var e=this._row.prevRow();return e?e.getComponent():e};var a=function(e,t){var o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"row";this.table=t.table,this.parent=t,this.data={},this.type=o,this.element=this.createElement(),this.modules={},this.cells=[],this.height=0,this.heightStyled="",this.manualHeight=!1,this.outerHeight=0,this.initialized=!1,this.heightInitialized=!1,this.component=null,this.setData(e),this.generateElement()};a.prototype.createElement=function(){var e=document.createElement("div");return e.classList.add("tabulator-row"),e.setAttribute("role","row"),e},a.prototype.getElement=function(){return this.element},a.prototype.detachElement=function(){this.element&&this.element.parentNode&&this.element.parentNode.removeChild(this.element)},a.prototype.generateElement=function(){var e,t,o,i=this;!1!==i.table.options.selectable&&i.table.modExists("selectRow")&&i.table.modules.selectRow.initializeRow(this),!1!==i.table.options.movableRows&&i.table.modExists("moveRow")&&i.table.modules.moveRow.initializeRow(this),!1!==i.table.options.dataTree&&i.table.modExists("dataTree")&&i.table.modules.dataTree.initializeRow(this),"collapse"===i.table.options.responsiveLayout&&i.table.modExists("responsiveLayout")&&i.table.modules.responsiveLayout.initializeRow(this),i.table.options.rowContextMenu&&this.table.modExists("menu")&&i.table.modules.menu.initializeRow(this),i.table.options.rowClick&&i.element.addEventListener("click",function(e){i.table.options.rowClick(e,i.getComponent())}),i.table.options.rowDblClick&&i.element.addEventListener("dblclick",function(e){i.table.options.rowDblClick(e,i.getComponent())}),i.table.options.rowContext&&i.element.addEventListener("contextmenu",function(e){i.table.options.rowContext(e,i.getComponent())}),i.table.options.rowMouseEnter&&i.element.addEventListener("mouseenter",function(e){i.table.options.rowMouseEnter(e,i.getComponent())}),i.table.options.rowMouseLeave&&i.element.addEventListener("mouseleave",function(e){i.table.options.rowMouseLeave(e,i.getComponent())}),i.table.options.rowMouseOver&&i.element.addEventListener("mouseover",function(e){i.table.options.rowMouseOver(e,i.getComponent())}),i.table.options.rowMouseOut&&i.element.addEventListener("mouseout",function(e){i.table.options.rowMouseOut(e,i.getComponent())}),i.table.options.rowMouseMove&&i.element.addEventListener("mousemove",function(e){i.table.options.rowMouseMove(e,i.getComponent())}),i.table.options.rowTap&&(o=!1,i.element.addEventListener("touchstart",function(e){o=!0},{passive:!0}),i.element.addEventListener("touchend",function(e){o&&i.table.options.rowTap(e,i.getComponent()),o=!1})),i.table.options.rowDblTap&&(e=null,i.element.addEventListener("touchend",function(t){e?(clearTimeout(e),e=null,i.table.options.rowDblTap(t,i.getComponent())):e=setTimeout(function(){clearTimeout(e),e=null},300)})),i.table.options.rowTapHold&&(t=null,i.element.addEventListener("touchstart",function(e){clearTimeout(t),t=setTimeout(function(){clearTimeout(t),t=null,o=!1,i.table.options.rowTapHold(e,i.getComponent())},1e3)},{passive:!0}),i.element.addEventListener("touchend",function(e){clearTimeout(t),t=null}))},a.prototype.generateCells=function(){this.cells=this.table.columnManager.generateCells(this)},a.prototype.initialize=function(e){var t=this;if(!t.initialized||e){for(t.deleteCells();t.element.firstChild;)t.element.removeChild(t.element.firstChild);this.table.modExists("frozenColumns")&&this.table.modules.frozenColumns.layoutRow(this),this.generateCells(),t.cells.forEach(function(e){t.element.appendChild(e.getElement()),e.cellRendered()}),e&&t.normalizeHeight(),t.table.options.dataTree&&t.table.modExists("dataTree")&&t.table.modules.dataTree.layoutRow(this),"collapse"===t.table.options.responsiveLayout&&t.table.modExists("responsiveLayout")&&t.table.modules.responsiveLayout.layoutRow(this),t.table.options.rowFormatter&&t.table.options.rowFormatter(t.getComponent()),t.table.options.resizableRows&&t.table.modExists("resizeRows")&&t.table.modules.resizeRows.initializeRow(t),t.initialized=!0}},a.prototype.reinitializeHeight=function(){this.heightInitialized=!1,null!==this.element.offsetParent&&this.normalizeHeight(!0)},a.prototype.reinitialize=function(){this.initialized=!1,this.heightInitialized=!1,this.manualHeight||(this.height=0,this.heightStyled=""),null!==this.element.offsetParent&&this.initialize(!0)},a.prototype.calcHeight=function(e){var t=0,o=this.table.options.resizableRows?this.element.clientHeight:0;this.cells.forEach(function(e){var o=e.getHeight();o>t&&(t=o)}),this.height=e?Math.max(t,o):this.manualHeight?this.height:Math.max(t,o),this.heightStyled=this.height?this.height+"px":"",this.outerHeight=this.element.offsetHeight},a.prototype.setCellHeight=function(){this.cells.forEach(function(e){e.setHeight()}),this.heightInitialized=!0},a.prototype.clearCellHeight=function(){this.cells.forEach(function(e){e.clearHeight()})},a.prototype.normalizeHeight=function(e){e&&this.clearCellHeight(),this.calcHeight(e),this.setCellHeight()},a.prototype.setHeight=function(e,t){(this.height!=e||t)&&(this.manualHeight=!0,this.height=e,this.heightStyled=e?e+"px":"",this.setCellHeight(),this.outerHeight=this.element.offsetHeight)},a.prototype.getHeight=function(){return this.outerHeight},a.prototype.getWidth=function(){return this.element.offsetWidth},a.prototype.deleteCell=function(e){var t=this.cells.indexOf(e);t>-1&&this.cells.splice(t,1)},a.prototype.setData=function(e){this.table.modExists("mutator")&&(e=this.table.modules.mutator.transformRow(e,"data")),this.data=e,this.table.options.reactiveData&&this.table.modExists("reactiveData",!0)&&this.table.modules.reactiveData.watchRow(this)},a.prototype.updateData=function(e){var t,o=this,i=d.prototype.helpers.elVisible(this.element),n={};return new Promise(function(s,r){"string"==typeof e&&(e=JSON.parse(e)),o.table.options.reactiveData&&o.table.modExists("reactiveData",!0)&&o.table.modules.reactiveData.block(),o.table.modExists("mutator")?(n=Object.assign(n,o.data),n=Object.assign(n,e),t=o.table.modules.mutator.transformRow(n,"data",e)):t=e;for(var a in t)o.data[a]=t[a];o.table.options.reactiveData&&o.table.modExists("reactiveData",!0)&&o.table.modules.reactiveData.unblock();for(var a in e){o.table.columnManager.getColumnsByFieldRoot(a).forEach(function(e){var n=o.getCell(e.getField());if(n){var s=e.getFieldValue(t);n.getValue()!=s&&(n.setValueProcessData(s),i&&n.cellRendered())}})}i?(o.normalizeHeight(!0),o.table.options.rowFormatter&&o.table.options.rowFormatter(o.getComponent())):(o.initialized=!1,o.height=0,o.heightStyled=""),!1!==o.table.options.dataTree&&o.table.modExists("dataTree")&&o.table.modules.dataTree.redrawNeeded(e)&&(o.table.modules.dataTree.initializeRow(o),o.table.modules.dataTree.layoutRow(o),o.table.rowManager.refreshActiveData("tree",!1,!0)),o.table.options.rowUpdated.call(o.table,o.getComponent()),s()})},a.prototype.getData=function(e){var t=this;return e?t.table.modExists("accessor")?t.table.modules.accessor.transformRow(t.data,e):void 0:this.data},a.prototype.getCell=function(e){return e=this.table.columnManager.findColumn(e),this.cells.find(function(t){return t.column===e})},a.prototype.getCellIndex=function(e){return this.cells.findIndex(function(t){return t===e})},a.prototype.findNextEditableCell=function(e){var t=!1;if(e0)for(var o=e-1;o>=0;o--){var i=this.cells[o],n=!0;if(i.column.modules.edit&&d.prototype.helpers.elVisible(i.getElement())&&("function"==typeof i.column.modules.edit.check&&(n=i.column.modules.edit.check(i.getComponent())),n)){t=i;break}}return t},a.prototype.getCells=function(){return this.cells},a.prototype.nextRow=function(){return this.table.rowManager.nextDisplayRow(this,!0)||!1},a.prototype.prevRow=function(){return this.table.rowManager.prevDisplayRow(this,!0)||!1},a.prototype.moveToRow=function(e,t){var o=this.table.rowManager.findRow(e);o?(this.table.rowManager.moveRowActual(this,o,!t),this.table.rowManager.refreshActiveData("display",!1,!0)):console.warn("Move Error - No matching row found:",e)},a.prototype.validate=function(){var e=[];return this.cells.forEach(function(t){t.validate()||e.push(t.getComponent())}),!e.length||e},a.prototype.delete=function(){var e=this;return new Promise(function(t,o){var i,n;e.table.options.history&&e.table.modExists("history")&&(e.table.options.groupBy&&e.table.modExists("groupRows")?(n=e.getGroup().rows,(i=n.indexOf(e))&&(i=n[i-1])):(i=e.table.rowManager.getRowIndex(e))&&(i=e.table.rowManager.rows[i-1]),e.table.modules.history.action("rowDelete",e,{data:e.getData(),pos:!i,index:i})),e.deleteActual(),t()})},a.prototype.deleteActual=function(e){this.table.rowManager.getRowIndex(this);this.table.modExists("selectRow")&&this.table.modules.selectRow._deselectRow(this,!0),this.table.modExists("edit")&&this.table.modules.edit.currentCell.row===this&&this.table.modules.edit.cancelEdit(),this.table.options.reactiveData&&this.table.modExists("reactiveData",!0),this.modules.group&&this.modules.group.removeRow(this),this.table.rowManager.deleteRow(this,e),this.deleteCells(),this.initialized=!1,this.heightInitialized=!1,this.table.options.dataTree&&this.table.modExists("dataTree",!0)&&this.table.modules.dataTree.rowDelete(this),this.table.modExists("columnCalcs")&&(this.table.options.groupBy&&this.table.modExists("groupRows")?this.table.modules.columnCalcs.recalcRowGroup(this):this.table.modules.columnCalcs.recalc(this.table.rowManager.activeRows))},a.prototype.deleteCells=function(){for(var e=this.cells.length,t=0;t-1?(this.browser="ie",this.browserSlow=!0):e.indexOf("Edge")>-1?(this.browser="edge",this.browserSlow=!0):e.indexOf("Firefox")>-1?(this.browser="firefox",this.browserSlow=!1):(this.browser="other",this.browserSlow=!1),this.browserMobile=/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino|android|ipad|playbook|silk/i.test(e)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(e.substr(0,4))},d.prototype.blockRedraw=function(){return this.rowManager.blockRedraw()},d.prototype.restoreRedraw=function(){return this.rowManager.restoreRedraw()},d.prototype.setDataFromLocalFile=function(e){var t=this;return new Promise(function(o,i){var n=document.createElement("input");n.type="file",n.accept=e||".json,application/json",n.addEventListener("change",function(e){var s,r=n.files[0],a=new FileReader;a.readAsText(r),a.onload=function(e){try{s=JSON.parse(a.result)}catch(e){return console.warn("File Load Error - File contents is invalid JSON",e),void i(e)}t._setData(s).then(function(e){o(e)}).catch(function(e){o(e)})},a.onerror=function(e){console.warn("File Load Error - Unable to read file"),i()}}),n.click()})},d.prototype.setData=function(e,t,o){return this.modExists("ajax")&&this.modules.ajax.blockActiveRequest(),this._setData(e,t,o,!1,!0)},d.prototype._setData=function(e,t,o,i,n){var s=this;return"string"!=typeof e?e?s.rowManager.setData(e,i,n):s.modExists("ajax")&&(s.modules.ajax.getUrl||s.options.ajaxURLGenerator)?"remote"==s.options.pagination&&s.modExists("page",!0)?(s.modules.page.reset(!0,!0),s.modules.page.setPage(1)):s.modules.ajax.loadData(i,n):s.rowManager.setData([],i,n):0==e.indexOf("{")||0==e.indexOf("[")?s.rowManager.setData(JSON.parse(e),i,n):s.modExists("ajax",!0)?(t&&s.modules.ajax.setParams(t),o&&s.modules.ajax.setConfig(o),s.modules.ajax.setUrl(e),"remote"==s.options.pagination&&s.modExists("page",!0)?(s.modules.page.reset(!0,!0),s.modules.page.setPage(1)):s.modules.ajax.loadData(i,n)):void 0},d.prototype.clearData=function(){this.modExists("ajax")&&this.modules.ajax.blockActiveRequest(),this.rowManager.clearData()},d.prototype.getData=function(e){return!0===e&&(console.warn("passing a boolean to the getData function is deprecated, you should now pass the string 'active'"),e="active"),this.rowManager.getData(e)},d.prototype.getDataCount=function(e){return!0===e&&(console.warn("passing a boolean to the getDataCount function is deprecated, you should now pass the string 'active'"),e="active"),this.rowManager.getDataCount(e)},d.prototype.searchRows=function(e,t,o){if(this.modExists("filter",!0))return this.modules.filter.search("rows",e,t,o)},d.prototype.searchData=function(e,t,o){if(this.modExists("filter",!0))return this.modules.filter.search("data",e,t,o)},d.prototype.getHtml=function(e,t,o){if(this.modExists("export",!0))return this.modules.export.getHtml(e,t,o)},d.prototype.print=function(e,t,o){if(this.modExists("print",!0))return this.modules.print.printFullscreen(e,t,o)},d.prototype.getAjaxUrl=function(){if(this.modExists("ajax",!0))return this.modules.ajax.getUrl()},d.prototype.replaceData=function(e,t,o){return this.modExists("ajax")&&this.modules.ajax.blockActiveRequest(),this._setData(e,t,o,!0)},d.prototype.updateData=function(e){var t=this,o=this,i=0;return new Promise(function(n,s){t.modExists("ajax")&&t.modules.ajax.blockActiveRequest(),"string"==typeof e&&(e=JSON.parse(e)),e?e.forEach(function(e){var t=o.rowManager.findRow(e[o.options.index]);t&&(i++,t.updateData(e).then(function(){--i||n()}))}):(console.warn("Update Error - No data provided"),s("Update Error - No data provided"))})},d.prototype.addData=function(e,t,o){var i=this;return new Promise(function(n,s){i.modExists("ajax")&&i.modules.ajax.blockActiveRequest(),"string"==typeof e&&(e=JSON.parse(e)),e?i.rowManager.addRows(e,t,o).then(function(e){var t=[];e.forEach(function(e){t.push(e.getComponent())}),n(t)}):(console.warn("Update Error - No data provided"),s("Update Error - No data provided"))})},d.prototype.updateOrAddData=function(e){var t=this,o=this,i=[],n=0;return new Promise(function(s,r){t.modExists("ajax")&&t.modules.ajax.blockActiveRequest(),"string"==typeof e&&(e=JSON.parse(e)),e?e.forEach(function(e){var t=o.rowManager.findRow(e[o.options.index]);n++,t?t.updateData(e).then(function(){n--,i.push(t.getComponent()),n||s(i)}):o.rowManager.addRows(e).then(function(e){n--,i.push(e[0].getComponent()),n||s(i)})}):(console.warn("Update Error - No data provided"),r("Update Error - No data provided"))})},d.prototype.getRow=function(e){var t=this.rowManager.findRow(e);return t?t.getComponent():(console.warn("Find Error - No matching row found:",e),!1)},d.prototype.getRowFromPosition=function(e,t){var o=this.rowManager.getRowFromPosition(e,t);return o?o.getComponent():(console.warn("Find Error - No matching row found:",e),!1)},d.prototype.deleteRow=function(e){var t=this;return new Promise(function(o,i){function n(){++r==e.length&&a&&(s.rowManager.reRenderInPosition(),o())}var s=t,r=0,a=0,l=[];Array.isArray(e)||(e=[e]),e.forEach(function(e){var o=t.rowManager.findRow(e,!0);o?l.push(o):(console.warn("Delete Error - No matching row found:",e),i("Delete Error - No matching row found"),n())}),l.sort(function(e,o){return t.rowManager.rows.indexOf(e)>t.rowManager.rows.indexOf(o)?1:-1}),l.forEach(function(e){e.delete().then(function(){a++,n()}).catch(function(e){n(),i(e)})})})},d.prototype.addRow=function(e,t,o){var i=this;return new Promise(function(n,s){"string"==typeof e&&(e=JSON.parse(e)),i.rowManager.addRows(e,t,o).then(function(e){i.modExists("columnCalcs")&&i.modules.columnCalcs.recalc(i.rowManager.activeRows),n(e[0].getComponent())})})},d.prototype.updateOrAddRow=function(e,t){var o=this;return new Promise(function(i,n){var s=o.rowManager.findRow(e);"string"==typeof t&&(t=JSON.parse(t)),s?s.updateData(t).then(function(){o.modExists("columnCalcs")&&o.modules.columnCalcs.recalc(o.rowManager.activeRows),i(s.getComponent())}).catch(function(e){n(e)}):s=o.rowManager.addRows(t).then(function(e){o.modExists("columnCalcs")&&o.modules.columnCalcs.recalc(o.rowManager.activeRows),i(e[0].getComponent())}).catch(function(e){n(e)})})},d.prototype.updateRow=function(e,t){var o=this;return new Promise(function(i,n){var s=o.rowManager.findRow(e);"string"==typeof t&&(t=JSON.parse(t)),s?s.updateData(t).then(function(){i(s.getComponent())}).catch(function(e){n(e)}):(console.warn("Update Error - No matching row found:",e),n("Update Error - No matching row found"))})},d.prototype.scrollToRow=function(e,t,o){var i=this;return new Promise(function(n,s){var r=i.rowManager.findRow(e);r?i.rowManager.scrollToRow(r,t,o).then(function(){n()}).catch(function(e){s(e)}):(console.warn("Scroll Error - No matching row found:",e),s("Scroll Error - No matching row found"))})},d.prototype.moveRow=function(e,t,o){var i=this.rowManager.findRow(e);i?i.moveToRow(t,o):console.warn("Move Error - No matching row found:",e)},d.prototype.getRows=function(e){return!0===e&&(console.warn("passing a boolean to the getRows function is deprecated, you should now pass the string 'active'"),e="active"),this.rowManager.getComponents(e)},d.prototype.getRowPosition=function(e,t){var o=this.rowManager.findRow(e);return o?this.rowManager.getRowPosition(o,t):(console.warn("Position Error - No matching row found:",e),!1)},d.prototype.copyToClipboard=function(e){this.modExists("clipboard",!0)&&this.modules.clipboard.copy(e)},d.prototype.setColumns=function(e){this.columnManager.setColumns(e)},d.prototype.getColumns=function(e){return this.columnManager.getComponents(e)},d.prototype.getColumn=function(e){var t=this.columnManager.findColumn(e);return t?t.getComponent():(console.warn("Find Error - No matching column found:",e),!1)},d.prototype.getColumnDefinitions=function(){return this.columnManager.getDefinitionTree()},d.prototype.getColumnLayout=function(){if(this.modExists("persistence",!0))return this.modules.persistence.parseColumns(this.columnManager.getColumns())},d.prototype.setColumnLayout=function(e){return!!this.modExists("persistence",!0)&&(this.columnManager.setColumns(this.modules.persistence.mergeDefinition(this.options.columns,e)),!0)},d.prototype.showColumn=function(e){var t=this.columnManager.findColumn(e);if(!t)return console.warn("Column Show Error - No matching column found:",e),!1;t.show(),this.options.responsiveLayout&&this.modExists("responsiveLayout",!0)&&this.modules.responsiveLayout.update()},d.prototype.hideColumn=function(e){var t=this.columnManager.findColumn(e);if(!t)return console.warn("Column Hide Error - No matching column found:",e),!1;t.hide(),this.options.responsiveLayout&&this.modExists("responsiveLayout",!0)&&this.modules.responsiveLayout.update()},d.prototype.toggleColumn=function(e){var t=this.columnManager.findColumn(e);if(!t)return console.warn("Column Visibility Toggle Error - No matching column found:",e),!1;t.visible?t.hide():t.show()},d.prototype.addColumn=function(e,t,o){var i=this;return new Promise(function(n,s){var r=i.columnManager.findColumn(o);i.columnManager.addColumn(e,t,r).then(function(e){n(e.getComponent())}).catch(function(e){s(e)})})},d.prototype.deleteColumn=function(e){var t=this;return new Promise(function(o,i){var n=t.columnManager.findColumn(e);n?n.delete().then(function(){o()}).catch(function(e){i(e)}):(console.warn("Column Delete Error - No matching column found:",e),i())})},d.prototype.updateColumnDefinition=function(e,t){var o=this;return new Promise(function(i,n){var s=o.columnManager.findColumn(e);s?s.updateDefinition(t).then(function(e){i(e)}).catch(function(e){n(e)}):(console.warn("Column Update Error - No matching column found:",e),n())})},d.prototype.moveColumn=function(e,t,o){var i=this.columnManager.findColumn(e),n=this.columnManager.findColumn(t);i?n?this.columnManager.moveColumn(i,n,o):console.warn("Move Error - No matching column found:",n):console.warn("Move Error - No matching column found:",e)},d.prototype.scrollToColumn=function(e,t,o){var i=this;return new Promise(function(n,s){var r=i.columnManager.findColumn(e);r?i.columnManager.scrollToColumn(r,t,o).then(function(){n()}).catch(function(e){s(e)}):(console.warn("Scroll Error - No matching column found:",e),s("Scroll Error - No matching column found"))})},d.prototype.setLocale=function(e){this.modules.localize.setLocale(e)},d.prototype.getLocale=function(){return this.modules.localize.getLocale()},d.prototype.getLang=function(e){return this.modules.localize.getLang(e)},d.prototype.redraw=function(e){this.columnManager.redraw(e),this.rowManager.redraw(e)},d.prototype.setHeight=function(e){"classic"!==this.rowManager.renderMode?(this.options.height=isNaN(e)?e:e+"px",this.element.style.height=this.options.height,this.rowManager.setRenderMode(),this.rowManager.redraw()):console.warn("setHeight function is not available in classic render mode")},d.prototype.setSort=function(e,t){this.modExists("sort",!0)&&(this.modules.sort.setSort(e,t),this.rowManager.sorterRefresh())},d.prototype.getSorters=function(){if(this.modExists("sort",!0))return this.modules.sort.getSort()},d.prototype.clearSort=function(){this.modExists("sort",!0)&&(this.modules.sort.clear(),this.rowManager.sorterRefresh())},d.prototype.setFilter=function(e,t,o,i){this.modExists("filter",!0)&&(this.modules.filter.setFilter(e,t,o,i),this.rowManager.filterRefresh())},d.prototype.addFilter=function(e,t,o,i){this.modExists("filter",!0)&&(this.modules.filter.addFilter(e,t,o,i),this.rowManager.filterRefresh())},d.prototype.getFilters=function(e){if(this.modExists("filter",!0))return this.modules.filter.getFilters(e)},d.prototype.setHeaderFilterFocus=function(e){if(this.modExists("filter",!0)){var t=this.columnManager.findColumn(e);if(!t)return console.warn("Column Filter Focus Error - No matching column found:",e),!1;this.modules.filter.setHeaderFilterFocus(t)}},d.prototype.getHeaderFilterValue=function(e){if(this.modExists("filter",!0)){var t=this.columnManager.findColumn(e);if(t)return this.modules.filter.getHeaderFilterValue(t);console.warn("Column Filter Error - No matching column found:",e)}},d.prototype.setHeaderFilterValue=function(e,t){if(this.modExists("filter",!0)){var o=this.columnManager.findColumn(e);if(!o)return console.warn("Column Filter Error - No matching column found:",e),!1;this.modules.filter.setHeaderFilterValue(o,t)}},d.prototype.getHeaderFilters=function(){if(this.modExists("filter",!0))return this.modules.filter.getHeaderFilters()},d.prototype.removeFilter=function(e,t,o){this.modExists("filter",!0)&&(this.modules.filter.removeFilter(e,t,o),this.rowManager.filterRefresh())},d.prototype.clearFilter=function(e){this.modExists("filter",!0)&&(this.modules.filter.clearFilter(e),this.rowManager.filterRefresh())},d.prototype.clearHeaderFilter=function(){this.modExists("filter",!0)&&(this.modules.filter.clearHeaderFilter(),this.rowManager.filterRefresh())},d.prototype.selectRow=function(e){this.modExists("selectRow",!0)&&(!0===e&&(console.warn("passing a boolean to the selectRowselectRow function is deprecated, you should now pass the string 'active'"),e="active"),this.modules.selectRow.selectRows(e))},d.prototype.deselectRow=function(e){this.modExists("selectRow",!0)&&this.modules.selectRow.deselectRows(e)},d.prototype.toggleSelectRow=function(e){this.modExists("selectRow",!0)&&this.modules.selectRow.toggleRow(e)},d.prototype.getSelectedRows=function(){if(this.modExists("selectRow",!0))return this.modules.selectRow.getSelectedRows()},d.prototype.getSelectedData=function(){if(this.modExists("selectRow",!0))return this.modules.selectRow.getSelectedData()},d.prototype.getInvalidCells=function(){if(this.modExists("validate",!0))return this.modules.validate.getInvalidCells()},d.prototype.clearCellValidation=function(e){var t=this;this.modExists("validate",!0)&&(e||(e=this.modules.validate.getInvalidCells()),Array.isArray(e)||(e=[e]),e.forEach(function(e){t.modules.validate.clearValidation(e._getSelf())}))},d.prototype.validate=function(e){var t=[];return this.rowManager.rows.forEach(function(e){var o=e.validate();!0!==o&&(t=t.concat(o))}),!t.length||t},d.prototype.setMaxPage=function(e){if(!this.options.pagination||!this.modExists("page"))return!1;this.modules.page.setMaxPage(e)},d.prototype.setPage=function(e){return this.options.pagination&&this.modExists("page")?this.modules.page.setPage(e):new Promise(function(e,t){t()})},d.prototype.setPageToRow=function(e){var t=this;return new Promise(function(o,i){t.options.pagination&&t.modExists("page")?(e=t.rowManager.findRow(e),e?t.modules.page.setPageToRow(e).then(function(){o()}).catch(function(){i()}):i()):i()})},d.prototype.setPageSize=function(e){if(!this.options.pagination||!this.modExists("page"))return!1;this.modules.page.setPageSize(e),this.modules.page.setPage(1).then(function(){}).catch(function(){})},d.prototype.getPageSize=function(){if(this.options.pagination&&this.modExists("page",!0))return this.modules.page.getPageSize()},d.prototype.previousPage=function(){if(!this.options.pagination||!this.modExists("page"))return!1;this.modules.page.previousPage()},d.prototype.nextPage=function(){if(!this.options.pagination||!this.modExists("page"))return!1;this.modules.page.nextPage()},d.prototype.getPage=function(){return!(!this.options.pagination||!this.modExists("page"))&&this.modules.page.getPage()},d.prototype.getPageMax=function(){return!(!this.options.pagination||!this.modExists("page"))&&this.modules.page.getPageMax()},d.prototype.setGroupBy=function(e){if(!this.modExists("groupRows",!0))return!1;this.options.groupBy=e,this.modules.groupRows.initialize(),this.rowManager.refreshActiveData("display"),this.options.persistence&&this.modExists("persistence",!0)&&this.modules.persistence.config.group&&this.modules.persistence.save("group")},d.prototype.setGroupStartOpen=function(e){if(!this.modExists("groupRows",!0))return!1;this.options.groupStartOpen=e,this.modules.groupRows.initialize(),this.options.groupBy?(this.rowManager.refreshActiveData("group"),this.options.persistence&&this.modExists("persistence",!0)&&this.modules.persistence.config.group&&this.modules.persistence.save("group")):console.warn("Grouping Update - cant refresh view, no groups have been set")},d.prototype.setGroupHeader=function(e){if(!this.modExists("groupRows",!0))return!1;this.options.groupHeader=e,this.modules.groupRows.initialize(),this.options.groupBy?(this.rowManager.refreshActiveData("group"),this.options.persistence&&this.modExists("persistence",!0)&&this.modules.persistence.config.group&&this.modules.persistence.save("group")):console.warn("Grouping Update - cant refresh view, no groups have been set")},d.prototype.getGroups=function(e){return!!this.modExists("groupRows",!0)&&this.modules.groupRows.getGroups(!0)},d.prototype.getGroupedData=function(){if(this.modExists("groupRows",!0))return this.options.groupBy?this.modules.groupRows.getGroupedData():this.getData()},d.prototype.getEditedCells=function(){if(this.modExists("edit",!0))return this.modules.edit.getEditedCells()},d.prototype.clearCellEdited=function(e){var t=this;this.modExists("edit",!0)&&(e||(e=this.modules.edit.getEditedCells()),Array.isArray(e)||(e=[e]),e.forEach(function(e){t.modules.edit.clearEdited(e._getSelf())}))},d.prototype.getCalcResults=function(){return!!this.modExists("columnCalcs",!0)&&this.modules.columnCalcs.getResults()},d.prototype.recalc=function(){this.modExists("columnCalcs",!0)&&this.modules.columnCalcs.recalcAll(this.rowManager.activeRows)},d.prototype.navigatePrev=function(){var e=!1;return!(!this.modExists("edit",!0)||!(e=this.modules.edit.currentCell))&&e.nav().prev()},d.prototype.navigateNext=function(){var e=!1;return!(!this.modExists("edit",!0)||!(e=this.modules.edit.currentCell))&&e.nav().next()},d.prototype.navigateLeft=function(){var t=!1;return!(!this.modExists("edit",!0)||!(t=this.modules.edit.currentCell))&&(e.preventDefault(),t.nav().left())},d.prototype.navigateRight=function(){var t=!1;return!(!this.modExists("edit",!0)||!(t=this.modules.edit.currentCell))&&(e.preventDefault(),t.nav().right())},d.prototype.navigateUp=function(){var t=!1;return!(!this.modExists("edit",!0)||!(t=this.modules.edit.currentCell))&&(e.preventDefault(),t.nav().up())},d.prototype.navigateDown=function(){var t=!1;return!(!this.modExists("edit",!0)||!(t=this.modules.edit.currentCell))&&(e.preventDefault(),t.nav().down())},d.prototype.undo=function(){return!(!this.options.history||!this.modExists("history",!0))&&this.modules.history.undo()},d.prototype.redo=function(){return!(!this.options.history||!this.modExists("history",!0))&&this.modules.history.redo()},d.prototype.getHistoryUndoSize=function(){return!(!this.options.history||!this.modExists("history",!0))&&this.modules.history.getHistoryUndoSize()},d.prototype.getHistoryRedoSize=function(){return!(!this.options.history||!this.modExists("history",!0))&&this.modules.history.getHistoryRedoSize()},d.prototype.download=function(e,t,o,i){this.modExists("download",!0)&&this.modules.download.download(e,t,o,i)},d.prototype.downloadToTab=function(e,t,o,i){this.modExists("download",!0)&&this.modules.download.download(e,t,o,i,!0)},d.prototype.tableComms=function(e,t,o,i){this.modules.comms.receive(e,t,o,i)},d.prototype.moduleBindings={},d.prototype.extendModule=function(e,t,o){if(d.prototype.moduleBindings[e]){var i=d.prototype.moduleBindings[e].prototype[t];if(i)if("object"==(void 0===o?"undefined":_typeof(o)))for(var n in o)i[n]=o[n];else console.warn("Module Error - Invalid value type, it must be an object");else console.warn("Module Error - property does not exist:",t)}else console.warn("Module Error - module does not exist:",e)},d.prototype.registerModule=function(e,t){d.prototype.moduleBindings[e]=t},d.prototype.bindModules=function(){this.modules={};for(var e in d.prototype.moduleBindings)this.modules[e]=new d.prototype.moduleBindings[e](this)},d.prototype.modExists=function(e,t){return!!this.modules[e]||(t&&console.error("Tabulator Module Not Installed: "+e),!1)},d.prototype.helpers={elVisible:function(e){return!(e.offsetWidth<=0&&e.offsetHeight<=0)},elOffset:function(e){var t=e.getBoundingClientRect();return{top:t.top+window.pageYOffset-document.documentElement.clientTop,left:t.left+window.pageXOffset-document.documentElement.clientLeft}},deepClone:function(e){var t=Array.isArray(e)?[]:{};for(var o in e)null!=e[o]&&"object"===_typeof(e[o])?e[o]instanceof Date?t[o]=new Date(e[o]):t[o]=this.deepClone(e[o]):t[o]=e[o];return t}},d.prototype.comms={tables:[],register:function(e){d.prototype.comms.tables.push(e)},deregister:function(e){var t=d.prototype.comms.tables.indexOf(e);t>-1&&d.prototype.comms.tables.splice(t,1)},lookupTable:function(e,t){var o,i,n=[];if("string"==typeof e){if(o=document.querySelectorAll(e),o.length)for(var s=0;s0?s.setWidth(n):s.reinitializeWidth()):this.table.options.responsiveLayout&&this.table.modExists("responsiveLayout",!0)&&this.table.modules.responsiveLayout.update()},fitColumns:function(e){function t(e){return"string"==typeof e?e.indexOf("%")>-1?n/100*parseInt(e):parseInt(e):e}function o(e,i,n,s){function r(e){return n*(e.column.definition.widthGrow||1)}function a(e){return t(e.width)-n*(e.column.definition.widthShrink||0)}var l=[],c=0,u=0,d=0,h=0,p=0,m=[];return e.forEach(function(e,t){var o=s?a(e):r(e);e.column.minWidth>=o?l.push(e):(m.push(e),p+=s?e.column.definition.widthShrink||1:e.column.definition.widthGrow||1)}),l.length?(l.forEach(function(e){c+=s?e.width-e.column.minWidth:e.column.minWidth,e.width=e.column.minWidth}),u=i-c,d=p?Math.floor(u/p):u,h=u-d*p,h+=o(m,u,d,s)):(h=p?i-Math.floor(i/p)*p:i,m.forEach(function(e){e.width=s?a(e):r(e)})),h}var i=this,n=i.table.element.clientWidth,s=0,r=0,a=0,l=0,c=[],u=[],d=0,h=0,p=0;this.table.options.responsiveLayout&&this.table.modExists("responsiveLayout",!0)&&this.table.modules.responsiveLayout.update(),this.table.rowManager.element.scrollHeight>this.table.rowManager.element.clientHeight&&(n-=this.table.rowManager.element.offsetWidth-this.table.rowManager.element.clientWidth),e.forEach(function(e){var o,i,n;e.visible&&(o=e.definition.width,i=parseInt(e.minWidth),o?(n=t(o),s+=n>i?n:i,e.definition.widthShrink&&(u.push({column:e,width:n>i?n:i}),d+=e.definition.widthShrink)):(c.push({column:e,width:0}),a+=e.definition.widthGrow||1))}),r=n-s,l=Math.floor(r/a);var p=o(c,r,l,!1);c.length&&p>0&&(c[c.length-1].width+=+p),c.forEach(function(e){r-=e.width}),h=Math.abs(p)+r,h>0&&d&&(p=o(u,h,Math.floor(h/d),!0)),u.length&&(u[u.length-1].width-=p),c.forEach(function(e){e.column.setWidth(e.width)}),u.forEach(function(e){e.column.setWidth(e.width)})}},d.prototype.registerModule("layout",h);var p=function(e){this.table=e,this.locale="default",this.lang=!1,this.bindings={}};p.prototype.setHeaderFilterPlaceholder=function(e){this.langs.default.headerFilters.default=e},p.prototype.setHeaderFilterColumnPlaceholder=function(e,t){this.langs.default.headerFilters.columns[e]=t,this.lang&&!this.lang.headerFilters.columns[e]&&(this.lang.headerFilters.columns[e]=t)},p.prototype.installLang=function(e,t){this.langs[e]?this._setLangProp(this.langs[e],t):this.langs[e]=t},p.prototype._setLangProp=function(e,t){for(var o in t)e[o]&&"object"==_typeof(e[o])?this._setLangProp(e[o],t[o]):e[o]=t[o]},p.prototype.setLocale=function(e){function t(e,o){for(var i in e)"object"==_typeof(e[i])?(o[i]||(o[i]={}),t(e[i],o[i])):o[i]=e[i]}var o=this;if(e=e||"default",!0===e&&navigator.language&&(e=navigator.language.toLowerCase()),e&&!o.langs[e]){var i=e.split("-")[0];o.langs[i]?(console.warn("Localization Error - Exact matching locale not found, using closest match: ",e,i),e=i):(console.warn("Localization Error - Matching locale not found, using default: ",e),e="default")}o.locale=e,o.lang=d.prototype.helpers.deepClone(o.langs.default||{}),"default"!=e&&t(o.langs[e],o.lang),o.table.options.localized.call(o.table,o.locale,o.lang),o._executeBindings()},p.prototype.getLocale=function(e){return self.locale},p.prototype.getLang=function(e){return e?this.langs[e]:this.lang},p.prototype.getText=function(e,t){var e=t?e+"|"+t:e,o=e.split("|");return this._getLangElement(o,this.locale)||""},p.prototype._getLangElement=function(e,t){var o=this,i=o.lang;return e.forEach(function(e){var t;i&&(t=i[e],i=void 0!==t&&t)}),i},p.prototype.bind=function(e,t){this.bindings[e]||(this.bindings[e]=[]),this.bindings[e].push(t),t(this.getText(e),this.lang)},p.prototype._executeBindings=function(){var e=this;for(var t in e.bindings)!function(t){e.bindings[t].forEach(function(o){o(e.getText(t),e.lang)})}(t)},p.prototype.langs={default:{groups:{item:"item",items:"items"},columns:{},ajax:{loading:"Loading",error:"Error"},pagination:{page_size:"Page Size",page_title:"Show Page",first:"First",first_title:"First Page",last:"Last",last_title:"Last Page",prev:"Prev",prev_title:"Prev Page",next:"Next",next_title:"Next Page",all:"All"},headerFilters:{default:"filter column...",columns:{}}}},d.prototype.registerModule("localize",p);var m=function(e){this.table=e};m.prototype.getConnections=function(e){var t,o=this,i=[];return t=d.prototype.comms.lookupTable(e),t.forEach(function(e){o.table!==e&&i.push(e)}),i},m.prototype.send=function(e,t,o,i){var n=this,s=this.getConnections(e);s.forEach(function(e){e.tableComms(n.table.element,t,o,i)}),!s.length&&e&&console.warn("Table Connection Error - No tables matching selector found",e)},m.prototype.receive=function(e,t,o,i){if(this.table.modExists(t))return this.table.modules[t].commsReceived(e,o,i);console.warn("Inter-table Comms Error - no such module:",t)},d.prototype.registerModule("comms",m);var f=function(e){this.table=e,this.allowedTypes=["","data","download","clipboard","print","htmlOutput"]};f.prototype.initializeColumn=function(e){var t=this,o=!1,i={};this.allowedTypes.forEach(function(n){var s,r="accessor"+(n.charAt(0).toUpperCase()+n.slice(1));e.definition[r]&&(s=t.lookupAccessor(e.definition[r]))&&(o=!0,i[r]={accessor:s,params:e.definition[r+"Params"]||{}})}),o&&(e.modules.accessor=i)},f.prototype.lookupAccessor=function(e){var t=!1;switch(void 0===e?"undefined":_typeof(e)){case"string":this.accessors[e]?t=this.accessors[e]:console.warn("Accessor Error - No such accessor found, ignoring: ",e);break;case"function":t=e}return t},f.prototype.transformRow=function(e,t){var o=this,i="accessor"+(t.charAt(0).toUpperCase()+t.slice(1)),n=d.prototype.helpers.deepClone(e||{});return o.table.columnManager.traverse(function(e){var o,s,r,a;e.modules.accessor&&(s=e.modules.accessor[i]||e.modules.accessor.accessor||!1)&&"undefined"!=(o=e.getFieldValue(n))&&(a=e.getComponent(),r="function"==typeof s.params?s.params(o,n,t,a):s.params,e.setFieldValue(n,s.accessor(o,n,t,r,a)))}),n},f.prototype.accessors={},d.prototype.registerModule("accessor",f);var g=function(e){this.table=e,this.config=!1,this.url="",this.urlGenerator=!1,this.params=!1,this.loaderElement=this.createLoaderElement(),this.msgElement=this.createMsgElement(),this.loadingElement=!1,this.errorElement=!1,this.loaderPromise=!1,this.progressiveLoad=!1,this.loading=!1,this.requestOrder=0};g.prototype.initialize=function(){var e;this.loaderElement.appendChild(this.msgElement),this.table.options.ajaxLoaderLoading&&("string"==typeof this.table.options.ajaxLoaderLoading?(e=document.createElement("template"),e.innerHTML=this.table.options.ajaxLoaderLoading.trim(),this.loadingElement=e.content.firstChild):this.loadingElement=this.table.options.ajaxLoaderLoading),this.loaderPromise=this.table.options.ajaxRequestFunc||this.defaultLoaderPromise,this.urlGenerator=this.table.options.ajaxURLGenerator||this.defaultURLGenerator,this.table.options.ajaxLoaderError&&("string"==typeof this.table.options.ajaxLoaderError?(e=document.createElement("template"),e.innerHTML=this.table.options.ajaxLoaderError.trim(),this.errorElement=e.content.firstChild):this.errorElement=this.table.options.ajaxLoaderError),this.table.options.ajaxParams&&this.setParams(this.table.options.ajaxParams),this.table.options.ajaxConfig&&this.setConfig(this.table.options.ajaxConfig),this.table.options.ajaxURL&&this.setUrl(this.table.options.ajaxURL),this.table.options.ajaxProgressiveLoad&&(this.table.options.pagination?(this.progressiveLoad=!1,console.error("Progressive Load Error - Pagination and progressive load cannot be used at the same time")):this.table.modExists("page")?(this.progressiveLoad=this.table.options.ajaxProgressiveLoad,this.table.modules.page.initializeProgressive(this.progressiveLoad)):console.error("Pagination plugin is required for progressive ajax loading"))},g.prototype.createLoaderElement=function(){var e=document.createElement("div");return e.classList.add("tabulator-loader"),e},g.prototype.createMsgElement=function(){var e=document.createElement("div");return e.classList.add("tabulator-loader-msg"),e.setAttribute("role","alert"),e},g.prototype.setParams=function(e,t){if(t){this.params=this.params||{};for(var o in e)this.params[o]=e[o]}else this.params=e},g.prototype.getParams=function(){return this.params||{}},g.prototype.setConfig=function(e){if(this._loadDefaultConfig(),"string"==typeof e)this.config.method=e;else for(var t in e)this.config[t]=e[t]},g.prototype._loadDefaultConfig=function(e){var t=this;if(!t.config||e){t.config={};for(var o in t.defaultConfig)t.config[o]=t.defaultConfig[o]}},g.prototype.setUrl=function(e){this.url=e},g.prototype.getUrl=function(){return this.url},g.prototype.loadData=function(e,t){return this.progressiveLoad?this._loadDataProgressive():this._loadDataStandard(e,t)},g.prototype.nextPage=function(e){var t;this.loading||(t=this.table.options.ajaxProgressiveLoadScrollMargin||2*this.table.rowManager.getElement().clientHeight,ei||null===i)&&(i=e)}),null!==i?!1!==n?i.toFixed(n):i:""},min:function(e,t,o){var i=null,n=void 0!==o.precision&&o.precision;return e.forEach(function(e){((e=Number(e))"),o.dataTreeExpandElement?"string"==typeof o.dataTreeExpandElement?(e=document.createElement("div"),e.innerHTML=o.dataTreeExpandElement,this.expandEl=e.firstChild):this.expandEl=o.dataTreeExpandElement:(this.expandEl=document.createElement("div"),this.expandEl.classList.add("tabulator-data-tree-control"),this.expandEl.tabIndex=0,this.expandEl.innerHTML="
"),_typeof(o.dataTreeStartExpanded)){case"boolean":this.startOpen=function(e,t){return o.dataTreeStartExpanded};break;case"function":this.startOpen=o.dataTreeStartExpanded;break;default:this.startOpen=function(e,t){return o.dataTreeStartExpanded[t]}}},y.prototype.initializeRow=function(e){var t=e.getData()[this.field],o=Array.isArray(t),i=o||!o&&"object"===(void 0===t?"undefined":_typeof(t))&&null!==t;!i&&e.modules.dataTree&&e.modules.dataTree.branchEl&&e.modules.dataTree.branchEl.parentNode.removeChild(e.modules.dataTree.branchEl),!i&&e.modules.dataTree&&e.modules.dataTree.controlEl&&e.modules.dataTree.controlEl.parentNode.removeChild(e.modules.dataTree.controlEl),e.modules.dataTree={index:e.modules.dataTree?e.modules.dataTree.index:0,open:!!i&&(e.modules.dataTree?e.modules.dataTree.open:this.startOpen(e.getComponent(),0)),controlEl:!(!e.modules.dataTree||!i)&&e.modules.dataTree.controlEl,branchEl:!(!e.modules.dataTree||!i)&&e.modules.dataTree.branchEl,parent:!!e.modules.dataTree&&e.modules.dataTree.parent,children:i}},y.prototype.layoutRow=function(e){var t=this.elementField?e.getCell(this.elementField):e.getCells()[0],o=t.getElement(),i=e.modules.dataTree;i.branchEl&&(i.branchEl.parentNode&&i.branchEl.parentNode.removeChild(i.branchEl),i.branchEl=!1),i.controlEl&&(i.controlEl.parentNode&&i.controlEl.parentNode.removeChild(i.controlEl),i.controlEl=!1),this.generateControlElement(e,o),e.element.classList.add("tabulator-tree-level-"+i.index),i.index&&(this.branchEl?(i.branchEl=this.branchEl.cloneNode(!0),o.insertBefore(i.branchEl,o.firstChild),i.branchEl.style.marginLeft=(i.branchEl.offsetWidth+i.branchEl.style.marginRight)*(i.index-1)+i.index*this.indent+"px"):o.style.paddingLeft=parseInt(window.getComputedStyle(o,null).getPropertyValue("padding-left"))+i.index*this.indent+"px")},y.prototype.generateControlElement=function(e,t){var o=this,i=e.modules.dataTree,t=t||e.getCells()[0].getElement(),n=i.controlEl;!1!==i.children&&(i.open?(i.controlEl=this.collapseEl.cloneNode(!0),i.controlEl.addEventListener("click",function(t){t.stopPropagation(),o.collapseRow(e)})):(i.controlEl=this.expandEl.cloneNode(!0),i.controlEl.addEventListener("click",function(t){t.stopPropagation(),o.expandRow(e)})),i.controlEl.addEventListener("mousedown",function(e){e.stopPropagation()}),n&&n.parentNode===t?n.parentNode.replaceChild(i.controlEl,n):t.insertBefore(i.controlEl,t.firstChild))},y.prototype.setDisplayIndex=function(e){this.displayIndex=e},y.prototype.getDisplayIndex=function(){return this.displayIndex},y.prototype.getRows=function(e){var t=this,o=[];return e.forEach(function(e,i){var n,s;o.push(e),e instanceof a&&(n=e.modules.dataTree.children,n.index||!1===n.children||(s=t.getChildren(e),s.forEach(function(e){o.push(e)})))}),o},y.prototype.getChildren=function(e){var t=this,o=e.modules.dataTree,i=[],n=[];return!1!==o.children&&o.open&&(Array.isArray(o.children)||(o.children=this.generateChildren(e)),i=this.table.modExists("filter")?this.table.modules.filter.filter(o.children):o.children,this.table.modExists("sort")&&this.table.modules.sort.sort(i),i.forEach(function(e){n.push(e),t.getChildren(e).forEach(function(e){n.push(e)})})),n}, +y.prototype.generateChildren=function(e){var t=this,o=[],i=e.getData()[this.field];return Array.isArray(i)||(i=[i]),i.forEach(function(i){var n=new a(i||{},t.table.rowManager);n.modules.dataTree.index=e.modules.dataTree.index+1,n.modules.dataTree.parent=e,n.modules.dataTree.children&&(n.modules.dataTree.open=t.startOpen(n.getComponent(),n.modules.dataTree.index)),o.push(n)}),o},y.prototype.expandRow=function(e,t){var o=e.modules.dataTree;!1!==o.children&&(o.open=!0,e.reinitialize(),this.table.rowManager.refreshActiveData("tree",!1,!0),this.table.options.dataTreeRowExpanded(e.getComponent(),e.modules.dataTree.index))},y.prototype.collapseRow=function(e){var t=e.modules.dataTree;!1!==t.children&&(t.open=!1,e.reinitialize(),this.table.rowManager.refreshActiveData("tree",!1,!0),this.table.options.dataTreeRowCollapsed(e.getComponent(),e.modules.dataTree.index))},y.prototype.toggleRow=function(e){var t=e.modules.dataTree;!1!==t.children&&(t.open?this.collapseRow(e):this.expandRow(e))},y.prototype.getTreeParent=function(e){return!!e.modules.dataTree.parent&&e.modules.dataTree.parent.getComponent()},y.prototype.getFilteredTreeChildren=function(e){var t,o=e.modules.dataTree,i=[];return o.children&&(Array.isArray(o.children)||(o.children=this.generateChildren(e)),t=this.table.modExists("filter")?this.table.modules.filter.filter(o.children):o.children,t.forEach(function(e){e instanceof a&&i.push(e)})),i},y.prototype.rowDelete=function(e){var t,o=e.modules.dataTree.parent;o&&(t=this.findChildIndex(e,o),!1!==t&&o.data[this.field].splice(t,1),o.data[this.field].length||delete o.data[this.field],this.initializeRow(o),this.layoutRow(o)),this.table.rowManager.refreshActiveData("tree",!1,!0)},y.prototype.addTreeChildRow=function(e,t,o,i){var n=!1;"string"==typeof t&&(t=JSON.parse(t)),Array.isArray(e.data[this.field])||(e.data[this.field]=[],e.modules.dataTree.open=this.startOpen(e.getComponent(),e.modules.dataTree.index)),void 0!==i&&!1!==(n=this.findChildIndex(i,e))&&e.data[this.field].splice(o?n:n+1,0,t),!1===n&&(o?e.data[this.field].unshift(t):e.data[this.field].push(t)),this.initializeRow(e),this.layoutRow(e),this.table.rowManager.refreshActiveData("tree",!1,!0)},y.prototype.findChildIndex=function(e,t){var o=this,i=!1;return"object"==(void 0===e?"undefined":_typeof(e))?e instanceof a?i=e.data:e instanceof r?i=e._getSelf().data:"undefined"!=typeof HTMLElement&&e instanceof HTMLElement&&t.modules.dataTree&&(i=t.modules.dataTree.children.find(function(t){return t instanceof a&&t.element===e}))&&(i=i.data):i=void 0!==e&&null!==e&&t.data[this.field].find(function(t){return t.data[o.table.options.index]==e}),i&&(Array.isArray(t.data[this.field])&&(i=t.data[this.field].indexOf(i)),-1==i&&(i=!1)),i},y.prototype.getTreeChildren=function(e){var t=e.modules.dataTree,o=[];return t.children&&(Array.isArray(t.children)||(t.children=this.generateChildren(e)),t.children.forEach(function(e){e instanceof a&&o.push(e.getComponent())})),o},y.prototype.checkForRestyle=function(e){e.row.cells.indexOf(e)||e.row.reinitialize()},y.prototype.getChildField=function(){return this.field},y.prototype.redrawNeeded=function(e){return!!this.field&&void 0!==e[this.field]||!!this.elementField&&void 0!==e[this.elementField]},d.prototype.registerModule("dataTree",y);var w=function(e){this.table=e};w.prototype.download=function(e,t,o,i,n){function s(o,i){n?!0===n?r.triggerDownload(o,i,e,t,!0):n(o):r.triggerDownload(o,i,e,t)}var r=this,a=!1;if("function"==typeof e?a=e:r.downloaders[e]?a=r.downloaders[e]:console.warn("Download Error - No such download type found: ",e),a){var l=this.generateExportList(i);a.call(this.table,l,o||{},s)}},w.prototype.generateExportList=function(e){var t=this.table.modules.export.generateExportList(this.table.options.downloadConfig,!1,e||this.table.options.downloadRowRange,"download"),o=this.table.options.groupHeaderDownload;return o&&!Array.isArray(o)&&(o=[o]),t.forEach(function(e){var t;"group"===e.type&&(t=e.columns[0],o&&o[e.indent]&&(t.value=o[e.indent](t.value,e.component._group.getRowCount(),e.component._group.getData(),e.component)))}),t},w.prototype.triggerDownload=function(e,t,o,i,n){var s=document.createElement("a"),r=new Blob([e],{type:t}),i=i||"Tabulator."+("function"==typeof o?"txt":o);(r=this.table.options.downloadReady.call(this.table,e,r))&&(n?window.open(window.URL.createObjectURL(r)):navigator.msSaveOrOpenBlob?navigator.msSaveOrOpenBlob(r,i):(s.setAttribute("href",window.URL.createObjectURL(r)),s.setAttribute("download",i),s.style.display="none",document.body.appendChild(s),s.click(),document.body.removeChild(s)),this.table.options.downloadComplete&&this.table.options.downloadComplete())},w.prototype.commsReceived=function(e,t,o){switch(t){case"intercept":this.download(o.type,"",o.options,o.active,o.intercept)}},w.prototype.downloaders={csv:function(e,t,o){var i=t&&t.delimiter?t.delimiter:",",n=[],s=[];e.forEach(function(e){var t=[];switch(e.type){case"group":console.warn("Download Warning - CSV downloader cannot process row groups");break;case"calc":console.warn("Download Warning - CSV downloader cannot process column calculations");break;case"header":e.columns.forEach(function(e,t){e&&1===e.depth&&(s[t]=void 0===e.value||"null"==typeof e.value?"":e.value)});break;case"row":e.columns.forEach(function(e){if(e){switch(_typeof(e.value)){case"object":e.value=JSON.stringify(e.value);break;case"undefined":case"null":e.value=""}t.push('"'+String(e.value).split('"').join('""')+'"')}}),n.push(t.join(i))}}),s.length&&(n=[s].concat(n)),n=n.join("\n"),t.bom&&(n="\ufeff"+n),o(n,"text/csv")},json:function(e,t,o){var i=[];e.forEach(function(e){var t={};switch(e.type){case"header":break;case"group":console.warn("Download Warning - JSON downloader cannot process row groups");break;case"calc":console.warn("Download Warning - JSON downloader cannot process column calculations");break;case"row":e.columns.forEach(function(e){e&&(t[e.component.getField()]=e.value)}),i.push(t)}}),i=JSON.stringify(i,null,"\t"),o(i,"application/json")},pdf:function(e,t,o){function i(e,t){var o=[];return e.columns.forEach(function(e){var i;if(e){switch(_typeof(e.value)){case"object":e.value=JSON.stringify(e.value);break;case"undefined":case"null":e.value=""}i={content:e.value,colSpan:e.width,rowSpan:e.height},t&&(i.styles=t),o.push(i)}else o.push("")}),o}var n=[],s=[],r={},a=t.rowGroupStyles||{fontStyle:"bold",fontSize:12,cellPadding:6,fillColor:220},l=t.rowCalcStyles||{fontStyle:"bold",fontSize:10,cellPadding:4,fillColor:232},c=t.jsPDF||{},u=t&&t.title?t.title:"";c.orientation||(c.orientation=t.orientation||"landscape"),c.unit||(c.unit="pt"),e.forEach(function(e){switch(e.type){case"header":n.push(i(e));break;case"group":s.push(i(e,a));break;case"calc":s.push(i(e,l));break;case"row":s.push(i(e))}});var d=new jsPDF(c);t&&t.autoTable&&(r="function"==typeof t.autoTable?t.autoTable(d)||{}:t.autoTable),u&&(r.addPageContent=function(e){d.text(u,40,30)}),r.head=n,r.body=s,d.autoTable(r),t&&t.documentProcessing&&t.documentProcessing(d),o(d.output("arraybuffer"),"application/pdf")},xlsx:function(e,t,o){function i(){var t=[],o=[],i={},n={s:{c:0,r:0},e:{c:e[0]?e[0].columns.reduce(function(e,t){return e+(t&&t.width?t.width:1)},0):0,r:e.length}};return e.forEach(function(e,i){var n=[];e.columns.forEach(function(e,t){e?(n.push(e.value instanceof Date||"object"!==_typeof(e.value)?e.value:JSON.stringify(e.value)),(e.width>1||e.height>-1)&&o.push({s:{r:i,c:t},e:{r:i+e.height-1,c:t+e.width-1}})):n.push("")}),t.push(n)}),XLSX.utils.sheet_add_aoa(i,t),i["!ref"]=XLSX.utils.encode_range(n),o.length&&(i["!merges"]=o),i}var n,s=this,r=t.sheetName||"Sheet1",a=XLSX.utils.book_new();if(a.SheetNames=[],a.Sheets={},t.sheetOnly)return void o(i());if(t.sheets)for(var l in t.sheets)!0===t.sheets[l]?(a.SheetNames.push(l),a.Sheets[l]=i()):(a.SheetNames.push(l),this.table.modules.comms.send(t.sheets[l],"download","intercept",{type:"xlsx",options:{sheetOnly:!0},active:s.active,intercept:function(e){a.Sheets[l]=e}}));else a.SheetNames.push(r),a.Sheets[r]=i();t.documentProcessing&&(a=t.documentProcessing(a)),n=XLSX.write(a,{bookType:"xlsx",bookSST:!0,type:"binary"}),o(function(e){for(var t=new ArrayBuffer(e.length),o=new Uint8Array(t),i=0;i!=e.length;++i)o[i]=255&e.charCodeAt(i);return t}(n),"application/octet-stream")},html:function(e,t,o){this.modExists("export",!0)&&o(this.modules.export.genereateHTMLTable(e),"text/html")}},d.prototype.registerModule("download",w);var E=function(e){this.table=e,this.currentCell=!1,this.mouseClick=!1,this.recursionBlock=!1,this.invalidEdit=!1,this.editedCells=[]};E.prototype.initializeColumn=function(e){var t=this,o={editor:!1,blocked:!1,check:e.definition.editable,params:e.definition.editorParams||{}};switch(_typeof(e.definition.editor)){case"string":"tick"===e.definition.editor&&(e.definition.editor="tickCross",console.warn("DEPRECATION WARNING - the tick editor has been deprecated, please use the tickCross editor")),t.editors[e.definition.editor]?o.editor=t.editors[e.definition.editor]:console.warn("Editor Error - No such editor found: ",e.definition.editor);break;case"function":o.editor=e.definition.editor;break;case"boolean":!0===e.definition.editor&&("function"!=typeof e.definition.formatter?("tick"===e.definition.formatter&&(e.definition.formatter="tickCross",console.warn("DEPRECATION WARNING - the tick editor has been deprecated, please use the tickCross editor")),t.editors[e.definition.formatter]?o.editor=t.editors[e.definition.formatter]:o.editor=t.editors.input):console.warn("Editor Error - Cannot auto lookup editor for a custom formatter: ",e.definition.formatter))}o.editor&&(e.modules.edit=o)},E.prototype.getCurrentCell=function(){return!!this.currentCell&&this.currentCell.getComponent()},E.prototype.clearEditor=function(e){var t,o=this.currentCell;if(this.invalidEdit=!1,o){for(this.currentCell=!1,t=o.getElement(),e?o.validate():t.classList.remove("tabulator-validation-fail"),t.classList.remove("tabulator-editing");t.firstChild;)t.removeChild(t.firstChild);o.row.getElement().classList.remove("tabulator-row-editing")}},E.prototype.cancelEdit=function(){if(this.currentCell){var e=this.currentCell,t=this.currentCell.getComponent();this.clearEditor(!0),e.setValueActual(e.getValue()),e.cellRendered(),e.column.cellEvents.cellEditCancelled&&e.column.cellEvents.cellEditCancelled.call(this.table,t),this.table.options.cellEditCancelled.call(this.table,t)}},E.prototype.bindEditor=function(e){var t=this,o=e.getElement();o.setAttribute("tabindex",0),o.addEventListener("click",function(e){o.classList.contains("tabulator-editing")||o.focus({preventScroll:!0})}),o.addEventListener("mousedown",function(e){t.mouseClick=!0}),o.addEventListener("focus",function(o){t.recursionBlock||t.edit(e,o,!1)})},E.prototype.focusCellNoEvent=function(e,t){this.recursionBlock=!0,t&&"ie"===this.table.browser||e.getElement().focus({preventScroll:!0}),this.recursionBlock=!1},E.prototype.editCell=function(e,t){this.focusCellNoEvent(e),this.edit(e,!1,t)},E.prototype.focusScrollAdjust=function(e){if("virtual"==this.table.rowManager.getRenderMode()){var t=this.table.rowManager.element.scrollTop,o=this.table.rowManager.element.clientHeight+this.table.rowManager.element.scrollTop,i=e.row.getElement();i.offsetTop;i.offsetTopo&&(this.table.rowManager.element.scrollTop+=i.offsetTop+i.offsetHeight-o)}},E.prototype.edit=function(e,t,o){function i(t){if(c.currentCell===e){var o=!0;return e.column.modules.validate&&c.table.modExists("validate")&&"manual"!=c.table.options.validationMode&&(o=c.table.modules.validate.validate(e.column.modules.validate,e,t)),!0===o||"highlight"===c.table.options.validationMode?(c.clearEditor(),e.setValue(t,!0),e.modules.edit||(e.modules.edit={}),e.modules.edit.edited=!0,-1==c.editedCells.indexOf(e)&&c.editedCells.push(e),c.table.options.dataTree&&c.table.modExists("dataTree")&&c.table.modules.dataTree.checkForRestyle(e),!0===o||(h.classList.add("tabulator-validation-fail"),!1)):(c.invalidEdit=!0,h.classList.add("tabulator-validation-fail"),c.focusCellNoEvent(e,!0),d(),c.table.options.validationFailed.call(c.table,e.getComponent(),t,o),!1)}}function n(){c.currentCell===e&&(c.cancelEdit(),c.table.options.dataTree&&c.table.modExists("dataTree")&&c.table.modules.dataTree.checkForRestyle(e))}function s(e){d=e}var r,a,l,c=this,u=!0,d=function(){},h=e.getElement();if(this.currentCell)return void(this.invalidEdit||this.cancelEdit());if(e.column.modules.edit.blocked)return this.mouseClick=!1,h.blur(),!1;switch(t&&t.stopPropagation(),_typeof(e.column.modules.edit.check)){case"function":u=e.column.modules.edit.check(e.getComponent());break;case"boolean":u=e.column.modules.edit.check}if(u||o){if(c.cancelEdit(),c.currentCell=e,this.focusScrollAdjust(e),a=e.getComponent(),this.mouseClick&&(this.mouseClick=!1,e.column.cellEvents.cellClick&&e.column.cellEvents.cellClick.call(this.table,t,a)),e.column.cellEvents.cellEditing&&e.column.cellEvents.cellEditing.call(this.table,a),c.table.options.cellEditing.call(this.table,a),l="function"==typeof e.column.modules.edit.params?e.column.modules.edit.params(a):e.column.modules.edit.params,!1===(r=e.column.modules.edit.editor.call(c,a,s,i,n,l)))return h.blur(),!1;if(!(r instanceof Node))return console.warn("Edit Error - Editor should return an instance of Node, the editor returned:",r),h.blur(),!1;for(h.classList.add("tabulator-editing"),e.row.getElement().classList.add("tabulator-row-editing");h.firstChild;)h.removeChild(h.firstChild);h.appendChild(r),d();for(var p=h.children,m=0;m46){if(o>=i.length)return t.preventDefault(),t.stopPropagation(),a=!1,!1;switch(i[o]){case n:if(l.toUpperCase()==l.toLowerCase())return t.preventDefault(),t.stopPropagation(),a=!1,!1;break;case s:if(isNaN(l))return t.preventDefault(),t.stopPropagation(),a=!1,!1;break;case r:break;default:if(l!==i[o])return t.preventDefault(),t.stopPropagation(),a=!1,!1}a=!0}}),e.addEventListener("keyup",function(i){i.keyCode>46&&t.maskAutoFill&&o(e.value.length)}),e.placeholder||(e.placeholder=i),t.maskAutoFill&&o(e.value.length)},E.prototype.getEditedCells=function(){var e=[];return this.editedCells.forEach(function(t){e.push(t.getComponent())}),e},E.prototype.clearEdited=function(e){var t;e.modules.edit&&e.modules.edit.edited&&(e.modules.validate.invalid=!1,(t=this.editedCells.indexOf(e))>-1&&this.editedCells.splice(t,1))},E.prototype.editors={input:function(e,t,o,i,n){function s(e){(null===r||void 0===r)&&""!==a.value||a.value!==r?o(a.value)&&(r=a.value):i()}var r=e.getValue(),a=document.createElement("input");if(a.setAttribute("type",n.search?"search":"text"),a.style.padding="4px",a.style.width="100%",a.style.boxSizing="border-box",n.elementAttributes&&"object"==_typeof(n.elementAttributes))for(var l in n.elementAttributes)"+"==l.charAt(0)?(l=l.slice(1),a.setAttribute(l,a.getAttribute(l)+n.elementAttributes["+"+l])):a.setAttribute(l,n.elementAttributes[l]);return a.value=void 0!==r?r:"",t(function(){a.focus({preventScroll:!0}),a.style.height="100%"}),a.addEventListener("change",s),a.addEventListener("blur",s),a.addEventListener("keydown",function(e){switch(e.keyCode){case 13:s(e);break;case 27:i()}}),n.mask&&this.table.modules.edit.maskInput(a,n),a},textarea:function(e,t,o,i,n){function s(t){(null===r||void 0===r)&&""!==c.value||c.value!==r?(o(c.value)&&(r=c.value),setTimeout(function(){e.getRow().normalizeHeight()},300)):i()}var r=e.getValue(),a=n.verticalNavigation||"hybrid",l=String(null!==r&&void 0!==r?r:""),c=(l.match(/(?:\r\n|\r|\n)/g),document.createElement("textarea")),u=0;if(c.style.display="block",c.style.padding="2px",c.style.height="100%",c.style.width="100%",c.style.boxSizing="border-box",c.style.whiteSpace="pre-wrap",c.style.resize="none",n.elementAttributes&&"object"==_typeof(n.elementAttributes))for(var d in n.elementAttributes)"+"==d.charAt(0)?(d=d.slice(1),c.setAttribute(d,c.getAttribute(d)+n.elementAttributes["+"+d])):c.setAttribute(d,n.elementAttributes[d]);return c.value=l,t(function(){c.focus({preventScroll:!0}),c.style.height="100%"}),c.addEventListener("change",s),c.addEventListener("blur",s),c.addEventListener("keyup",function(){c.style.height="";var t=c.scrollHeight;c.style.height=t+"px",t!=u&&(u=t,e.getRow().normalizeHeight())}),c.addEventListener("keydown",function(e){switch(e.keyCode){case 27:i();break;case 38:("editor"==a||"hybrid"==a&&c.selectionStart)&&(e.stopImmediatePropagation(),e.stopPropagation());break;case 40:("editor"==a||"hybrid"==a&&c.selectionStart!==c.value.length)&&(e.stopImmediatePropagation(),e.stopPropagation())}}),n.mask&&this.table.modules.edit.maskInput(c,n),c},number:function(e,t,o,i,n){function s(){var e=l.value;isNaN(e)||""===e||(e=Number(e)),e!==r?o(e)&&(r=e):i()}var r=e.getValue(),a=n.verticalNavigation||"editor",l=document.createElement("input");if(l.setAttribute("type","number"),void 0!==n.max&&l.setAttribute("max",n.max),void 0!==n.min&&l.setAttribute("min",n.min),void 0!==n.step&&l.setAttribute("step",n.step),l.style.padding="4px",l.style.width="100%",l.style.boxSizing="border-box",n.elementAttributes&&"object"==_typeof(n.elementAttributes))for(var c in n.elementAttributes)"+"==c.charAt(0)?(c=c.slice(1),l.setAttribute(c,l.getAttribute(c)+n.elementAttributes["+"+c])):l.setAttribute(c,n.elementAttributes[c]);l.value=r;var u=function(e){s()};return t(function(){l.removeEventListener("blur",u),l.focus({preventScroll:!0}),l.style.height="100%",l.addEventListener("blur",u)}),l.addEventListener("keydown",function(e){switch(e.keyCode){case 13:s();break;case 27:i();break;case 38:case 40:"editor"==a&&(e.stopImmediatePropagation(),e.stopPropagation())}}),n.mask&&this.table.modules.edit.maskInput(l,n),l},range:function(e,t,o,i,n){function s(){var e=a.value;isNaN(e)||""===e||(e=Number(e)),e!=r?o(e)&&(r=e):i()}var r=e.getValue(),a=document.createElement("input");if(a.setAttribute("type","range"),void 0!==n.max&&a.setAttribute("max",n.max),void 0!==n.min&&a.setAttribute("min",n.min),void 0!==n.step&&a.setAttribute("step",n.step),a.style.padding="4px",a.style.width="100%",a.style.boxSizing="border-box",n.elementAttributes&&"object"==_typeof(n.elementAttributes))for(var l in n.elementAttributes)"+"==l.charAt(0)?(l=l.slice(1),a.setAttribute(l,a.getAttribute(l)+n.elementAttributes["+"+l])):a.setAttribute(l,n.elementAttributes[l]);return a.value=r,t(function(){a.focus({preventScroll:!0}),a.style.height="100%"}),a.addEventListener("blur",function(e){s()}),a.addEventListener("keydown",function(e){switch(e.keyCode){case 13:s();break;case 27:i()}}),a},select:function(e,t,o,i,n){function s(t){var o,i={},s=w.table.getData();return o=t?w.table.columnManager.getColumnByField(t):e.getColumn()._getSelf(),o?(s.forEach(function(e){var t=o.getFieldValue(e);null!==t&&void 0!==t&&""!==t&&(i[t]=!0)}),i=n.sortValuesList?"asc"==n.sortValuesList?Object.keys(i).sort():Object.keys(i).sort().reverse():Object.keys(i)):console.warn("unable to find matching column to create select lookup list:",t),i}function r(t,o){function i(e){var e={label:e.label,value:e.value,itemParams:e.itemParams,elementAttributes:e.elementAttributes,element:!1};return o.indexOf(e.value)>-1&&c(e),n.push(e),s.push(e),e}var n=[],s=[];if("function"==typeof t&&(t=t(e)),Array.isArray(t))t.forEach(function(e){var t;"object"===(void 0===e?"undefined":_typeof(e))?e.options?(t={label:e.label,group:!0,itemParams:e.itemParams,elementAttributes:e.elementAttributes,element:!1},s.push(t),e.options.forEach(function(e){i(e)})):i(e):(t={label:e,value:e,element:!1},o.indexOf(t.value)>-1&&c(t),n.push(t),s.push(t))});else for(var r in t){var l={label:t[r],value:r,element:!1};o.indexOf(l.value)>-1&&c(l),n.push(l),s.push(l)}D=n,S=s,a()}function a(){for(;L.firstChild;)L.removeChild(L.firstChild);S.forEach(function(t){var o=t.element;if(!o){if(o=document.createElement("div"),t.label=n.listItemFormatter?n.listItemFormatter(t.value,t.label,e,o,t.itemParams):t.label,t.group?(o.classList.add("tabulator-edit-select-list-group"),o.tabIndex=0,o.innerHTML=""===t.label?" ":t.label):(o.classList.add("tabulator-edit-select-list-item"),o.tabIndex=0,o.innerHTML=""===t.label?" ":t.label,o.addEventListener("click",function(){T?(h(t),M.focus()):p(t)}),H.indexOf(t)>-1&&o.classList.add("active")),t.elementAttributes&&"object"==_typeof(t.elementAttributes))for(var i in t.elementAttributes)"+"==i.charAt(0)?(i=i.slice(1),o.setAttribute(i,M.getAttribute(i)+t.elementAttributes["+"+i])):o.setAttribute(i,t.elementAttributes[i]);o.addEventListener("mousedown",function(){z=!1,setTimeout(function(){z=!0},10)}),t.element=o}L.appendChild(o)})}function l(e,t){!T&&k&&k.element&&k.element.classList.remove("active"),k&&k.element&&k.element.classList.remove("focused"),k=e,e.element&&(e.element.classList.add("focused"),t&&e.element.classList.add("active"))}function c(e){-1==H.indexOf(e)&&(H.push(e),l(e,!0)),f()}function u(e){var t=H[e];e>-1&&(H.splice(e,1),t.element&&t.element.classList.remove("active"))}function h(e){e||(e=k);var t=H.indexOf(e);t>-1?u(t):(!0!==T&&H.length>=T&&u(0),c(e)),f()}function p(e){v(),e||(e=k),e&&o(e.value)}function m(){v();var e=[];H.forEach(function(t){e.push(t.value)}),o(e)}function f(){var e=[];H.forEach(function(t){e.push(t.label)}),M.value=e.join(", ")}function g(){v(),i()}function b(){if(!L.parentNode){!0===n.values?r(s(),R):"string"==typeof n.values?r(s(n.values),R):r(n.values||[],R);var e=d.prototype.helpers.elOffset(E);L.style.minWidth=E.offsetWidth+"px",L.style.top=e.top+E.offsetHeight+"px",L.style.left=e.left+"px",L.addEventListener("mousedown",function(e){z=!1,setTimeout(function(){z=!0},10)}),document.body.appendChild(L)}}function v(){L.parentNode&&L.parentNode.removeChild(L),y()}function y(){w.table.rowManager.element.removeEventListener("scroll",g)}var w=this,E=e.getElement(),C=e.getValue(),x=n.verticalNavigation||"editor",R=void 0!==C||null===C?C:void 0!==n.defaultValue?n.defaultValue:[],M=document.createElement("input"),L=document.createElement("div"),T=n.multiselect,D=[],k={},S=[],H=[],z=!0;if(this.table.rowManager.element.addEventListener("scroll",g),(Array.isArray(n)||!Array.isArray(n)&&"object"===(void 0===n?"undefined":_typeof(n))&&!n.values)&&(console.warn("DEPRECATION WARNING - values for the select editor must now be passed into the values property of the editorParams object, not as the editorParams object"),n={values:n}),M.setAttribute("type","text"),M.style.padding="4px",M.style.width="100%",M.style.boxSizing="border-box",M.style.cursor="default",M.readOnly=0!=this.currentCell,n.elementAttributes&&"object"==_typeof(n.elementAttributes))for(var A in n.elementAttributes)"+"==A.charAt(0)?(A=A.slice(1),M.setAttribute(A,M.getAttribute(A)+n.elementAttributes["+"+A])):M.setAttribute(A,n.elementAttributes[A]);return M.value=void 0!==C||null===C?C:"",M.addEventListener("keydown",function(e){var t;switch(e.keyCode){case 38:t=D.indexOf(k),("editor"==x||"hybrid"==x&&t)&&(e.stopImmediatePropagation(),e.stopPropagation(),e.preventDefault(),t>0&&l(D[t-1],!T));break;case 40:t=D.indexOf(k),("editor"==x||"hybrid"==x&&t-1||String(t.title).toLowerCase().indexOf(String(e).toLowerCase())>-1)&&s.push(t)}),h(s,t))}function l(e){var t=document.createElement("div");u(),!1!==e&&(t.classList.add("tabulator-edit-select-list-notice"),t.tabIndex=0,e instanceof Node?t.appendChild(e):t.innerHTML=e,L.appendChild(t))}function c(e){var t=[];if(Array.isArray(e))e.forEach(function(e){var o={};"object"===(void 0===e?"undefined":_typeof(e))?(o.title=n.listItemFormatter?n.listItemFormatter(e.value,e.label):e.label,o.value=e.value):(o.title=n.listItemFormatter?n.listItemFormatter(e,e):e,o.value=e),t.push(o)});else for(var o in e){var i={title:n.listItemFormatter?n.listItemFormatter(o,e[o]):e[o],value:o};t.push(i)}return t}function u(){for(;L.firstChild;)L.removeChild(L.firstChild)}function h(e,t){e.length?p(e,t):n.emptyPlaceholder&&l(n.emptyPlaceholder)}function p(e,t){var o=!1;u(),T=e,T.forEach(function(e){var i=e.element;i||(i=document.createElement("div"),i.classList.add("tabulator-edit-select-list-item"),i.tabIndex=0,i.innerHTML=e.title,i.addEventListener("click",function(t){g(e),m()}),i.addEventListener("mousedown",function(e){k=!1,setTimeout(function(){k=!0},10)}),e.element=i,t&&e.value==C&&(M.value=e.title,e.element.classList.add("active"),o=!0),e===D&&(e.element.classList.add("active"),o=!0)),L.appendChild(i)}),o||g(!1)}function m(){b(),D?C!==D.value?(C=D.value,M.value=D.title,o(D.value)):i():n.freetext?(C=M.value,o(M.value)):n.allowEmpty&&""===M.value?(C=M.value,o(M.value)):i()}function f(){if(!L.parentNode){for(;L.firstChild;)L.removeChild(L.firstChild);var e=d.prototype.helpers.elOffset(E);L.style.minWidth=E.offsetWidth+"px",L.style.top=e.top+E.offsetHeight+"px",L.style.left=e.left+"px",document.body.appendChild(L)}}function g(e,t){D&&D.element&&D.element.classList.remove("active"),D=e,e&&e.element&&e.element.classList.add("active")}function b(){L.parentNode&&L.parentNode.removeChild(L),y()}function v(){b(),i()}function y(){w.table.rowManager.element.removeEventListener("scroll",v)}var w=this,E=e.getElement(),C=e.getValue(),x=n.verticalNavigation||"editor",R=void 0!==C||null===C?C:void 0!==n.defaultValue?n.defaultValue:"",M=document.createElement("input"),L=document.createElement("div"),T=[],D=!1,k=!0,S=!1;if(this.table.rowManager.element.addEventListener("scroll",v),M.setAttribute("type","search"),M.style.padding="4px",M.style.width="100%",M.style.boxSizing="border-box",n.elementAttributes&&"object"==_typeof(n.elementAttributes))for(var H in n.elementAttributes)"+"==H.charAt(0)?(H=H.slice(1),M.setAttribute(H,M.getAttribute(H)+n.elementAttributes["+"+H])):M.setAttribute(H,n.elementAttributes[H]);return L.classList.add("tabulator-edit-select-list"),L.addEventListener("mousedown",function(e){k=!1,setTimeout(function(){k=!0},10)}),M.addEventListener("keydown",function(e){var t;switch(e.keyCode){case 38:t=T.indexOf(D),("editor"==x||"hybrid"==x&&t)&&(e.stopImmediatePropagation(),e.stopPropagation(),e.preventDefault(),g(t>0?T[t-1]:!1));break;case 40:t=T.indexOf(D),("editor"==x||"hybrid"==x&&t'):("ie"==a.table.browser?t.setAttribute("class","tabulator-star-inactive"):t.classList.replace("tabulator-star-active","tabulator-star-inactive"),t.innerHTML='')})}function r(e){c=e,s(e)}var a=this,l=e.getElement(),c=e.getValue(),u=l.getElementsByTagName("svg").length||5,d=l.getElementsByTagName("svg")[0]?l.getElementsByTagName("svg")[0].getAttribute("width"):14,h=[],p=document.createElement("div"),m=document.createElementNS("http://www.w3.org/2000/svg","svg");if(l.style.whiteSpace="nowrap",l.style.overflow="hidden",l.style.textOverflow="ellipsis",p.style.verticalAlign="middle",p.style.display="inline-block",p.style.padding="4px",m.setAttribute("width",d),m.setAttribute("height",d),m.setAttribute("viewBox","0 0 512 512"),m.setAttribute("xml:space","preserve"),m.style.padding="0 1px",n.elementAttributes&&"object"==_typeof(n.elementAttributes))for(var f in n.elementAttributes)"+"==f.charAt(0)?(f=f.slice(1),p.setAttribute(f,p.getAttribute(f)+n.elementAttributes["+"+f])):p.setAttribute(f,n.elementAttributes[f]);for(var g=1;g<=u;g++)!function(e){var t=document.createElement("span"),i=m.cloneNode(!0);h.push(i),t.addEventListener("mouseenter",function(t){t.stopPropagation(),t.stopImmediatePropagation(),s(e)}),t.addEventListener("mousemove",function(e){e.stopPropagation(),e.stopImmediatePropagation()}),t.addEventListener("click",function(t){t.stopPropagation(),t.stopImmediatePropagation(),o(e),l.blur()}),t.appendChild(i),p.appendChild(t)}(g);return c=Math.min(parseInt(c),u),s(c),p.addEventListener("mousemove",function(e){s(0)}),p.addEventListener("click",function(e){o(0)}),l.addEventListener("blur",function(e){i()}),l.addEventListener("keydown",function(e){switch(e.keyCode){case 39:r(c+1);break;case 37:r(c-1);break;case 13:o(c);break;case 27:i()}}),p},progress:function(e,t,o,i,n){function s(){var e=d*Math.round(m.offsetWidth/(l.clientWidth/100))+u;o(e),l.setAttribute("aria-valuenow",e),l.setAttribute("aria-label",h)}var r,a,l=e.getElement(),c=void 0===n.max?l.getElementsByTagName("div")[0].getAttribute("max")||100:n.max,u=void 0===n.min?l.getElementsByTagName("div")[0].getAttribute("min")||0:n.min,d=(c-u)/100,h=e.getValue()||0,p=document.createElement("div"),m=document.createElement("div");if(p.style.position="absolute",p.style.right="0",p.style.top="0",p.style.bottom="0",p.style.width="5px",p.classList.add("tabulator-progress-handle"),m.style.display="inline-block", +m.style.position="relative",m.style.height="100%",m.style.backgroundColor="#488CE9",m.style.maxWidth="100%",m.style.minWidth="0%",n.elementAttributes&&"object"==_typeof(n.elementAttributes))for(var f in n.elementAttributes)"+"==f.charAt(0)?(f=f.slice(1),m.setAttribute(f,m.getAttribute(f)+n.elementAttributes["+"+f])):m.setAttribute(f,n.elementAttributes[f]);return l.style.padding="4px 4px",h=Math.min(parseFloat(h),c),h=Math.max(parseFloat(h),u),h=Math.round((h-u)/d),m.style.width=h+"%",l.setAttribute("aria-valuemin",u),l.setAttribute("aria-valuemax",c),m.appendChild(p),p.addEventListener("mousedown",function(e){r=e.screenX,a=m.offsetWidth}),p.addEventListener("mouseover",function(){p.style.cursor="ew-resize"}),l.addEventListener("mousemove",function(e){r&&(m.style.width=a+e.screenX-r+"px")}),l.addEventListener("mouseup",function(e){r&&(e.stopPropagation(),e.stopImmediatePropagation(),r=!1,a=!1,s())}),l.addEventListener("keydown",function(e){switch(e.keyCode){case 39:e.preventDefault(),m.style.width=m.clientWidth+l.clientWidth/100+"px";break;case 37:e.preventDefault(),m.style.width=m.clientWidth-l.clientWidth/100+"px";break;case 9:case 13:s();break;case 27:i()}}),l.addEventListener("blur",function(){i()}),m},tickCross:function(e,t,o,i,n){function s(e){return l?e?u?c:a.checked:a.checked&&!u?(a.checked=!1,a.indeterminate=!0,u=!0,c):(u=!1,a.checked):a.checked}var r=e.getValue(),a=document.createElement("input"),l=n.tristate,c=void 0===n.indeterminateValue?null:n.indeterminateValue,u=!1;if(a.setAttribute("type","checkbox"),a.style.marginTop="5px",a.style.boxSizing="border-box",n.elementAttributes&&"object"==_typeof(n.elementAttributes))for(var d in n.elementAttributes)"+"==d.charAt(0)?(d=d.slice(1),a.setAttribute(d,a.getAttribute(d)+n.elementAttributes["+"+d])):a.setAttribute(d,n.elementAttributes[d]);return a.value=r,!l||void 0!==r&&r!==c&&""!==r||(u=!0,a.indeterminate=!0),"firefox"!=this.table.browser&&t(function(){a.focus({preventScroll:!0})}),a.checked=!0===r||"true"===r||"True"===r||1===r,a.addEventListener("change",function(e){o(s())}),a.addEventListener("blur",function(e){o(s(!0))}),a.addEventListener("keydown",function(e){13==e.keyCode&&o(s()),27==e.keyCode&&i()}),a}},d.prototype.registerModule("edit",E);var C=function(e,t,o,i){this.type=e,this.columns=t,this.component=o||!1,this.indent=i||0},x=function(e,t,o,i,n){this.value=e,this.component=t||!1,this.width=o,this.height=i,this.depth=n},R=function(e){this.table=e,this.config={},this.cloneTableStyle=!0,this.colVisProp=""};R.prototype.generateExportList=function(e,t,o,i){this.cloneTableStyle=t,this.config=e||{},this.colVisProp=i;var n=!1!==this.config.columnHeaders?this.headersToExportRows(this.generateColumnGroupHeaders()):[],s=this.bodyToExportRows(this.rowLookup(o));return n.concat(s)},R.prototype.genereateTable=function(e,t,o,i){var n=this.generateExportList(e,t,o,i);return this.genereateTableElement(n)},R.prototype.rowLookup=function(e){var t=this,o=[];if("function"==typeof e)e.call(this.table).forEach(function(e){(e=t.table.rowManager.findRow(e))&&o.push(e)});else switch(e){case!0:case"visible":o=this.table.rowManager.getVisibleRows(!0);break;case"all":o=this.table.rowManager.rows;break;case"selected":o=this.table.modules.selectRow.selectedRows;break;case"active":default:o=this.table.rowManager.getDisplayRows()}return Object.assign([],o)},R.prototype.generateColumnGroupHeaders=function(){var e=this,t=[];return(!1!==this.config.columnGroups?this.table.columnManager.columns:this.table.columnManager.columnsByIndex).forEach(function(o){var i=e.processColumnGroup(o);i&&t.push(i)}),t},R.prototype.processColumnGroup=function(e){var t=this,o=e.columns,i=0,n=e.definition["title"+(this.colVisProp.charAt(0).toUpperCase()+this.colVisProp.slice(1))]||e.definition.title,s={title:n,column:e,depth:1};if(o.length){if(s.subGroups=[],s.width=0,o.forEach(function(e){var o=t.processColumnGroup(e);o&&(s.width+=o.width,s.subGroups.push(o),o.depth>i&&(i=o.depth))}),s.depth+=i,!s.width)return!1}else{if(!this.columnVisCheck(e))return!1;s.width=1}return s},R.prototype.columnVisCheck=function(e){return!1!==e.definition[this.colVisProp]&&(e.visible||!e.visible&&e.definition[this.colVisProp])},R.prototype.headersToExportRows=function(e){function t(e,n){var s=i-n;if(void 0===o[n]&&(o[n]=[]),e.height=e.subGroups?1:s-e.depth+1,o[n].push(e),e.height>1)for(var r=1;r1)for(var a=1;ai&&(i=e.depth)}),e.forEach(function(e){t(e,0)}),o.forEach(function(e){var t=[];e.forEach(function(e){e?t.push(new x(e.title,e.column.getComponent(),e.width,e.height,e.depth)):t.push(null)}),n.push(new C("header",t))}),n},R.prototype.bodyToExportRows=function(e){var t=this,o=[],i=[];return this.table.columnManager.columnsByIndex.forEach(function(e){t.columnVisCheck(e)&&o.push(e.getComponent())}),!1!==this.config.columnCalcs&&this.table.modExists("columnCalcs")&&(this.table.modules.columnCalcs.topInitialized&&e.unshift(this.table.modules.columnCalcs.topRow),this.table.modules.columnCalcs.botInitialized&&e.push(this.table.modules.columnCalcs.botRow)),e=e.filter(function(e){switch(e.type){case"group":return!1!==t.config.rowGroups;case"calc":return!1!==t.config.columnCalcs;case"row":return!(t.table.options.dataTree&&!1===t.config.dataTree&&e.modules.dataTree.parent)}return!0}),e.forEach(function(e,n){var s=e.getData(t.colVisProp),r=[],a=0;switch(e.type){case"group":a=e.level,r.push(new x(e.key,e.getComponent(),o.length,1));break;case"calc":case"row":o.forEach(function(e){r.push(new x(e._column.getFieldValue(s),e,1,1))}),t.table.options.dataTree&&!1!==t.config.dataTree&&(a=e.modules.dataTree.index)}i.push(new C(e.type,r,e.getComponent(),a))}),i},R.prototype.genereateTableElement=function(e){var t=this,o=document.createElement("table"),i=document.createElement("thead"),n=document.createElement("tbody"),s=this.lookupTableStyles(),r=this.table.options["rowFormatter"+(this.colVisProp.charAt(0).toUpperCase()+this.colVisProp.slice(1))],a={};return a.rowFormatter=null!==r?r:this.table.options.rowFormatter,this.table.options.dataTree&&!1!==this.config.dataTree&&this.table.modExists("columnCalcs")&&(a.treeElementField=this.table.modules.dataTree.elementField),a.groupHeader=this.table.options["groupHeader"+(this.colVisProp.charAt(0).toUpperCase()+this.colVisProp.slice(1))],a.groupHeader&&!Array.isArray(a.groupHeader)&&(a.groupHeader=[a.groupHeader]),o.classList.add("tabulator-print-table"),this.mapElementStyles(this.table.columnManager.getHeadersElement(),i,["border-top","border-left","border-right","border-bottom","background-color","color","font-weight","font-family","font-size"]),e.length>1e3&&console.warn("It may take a long time to render an HTML table with more than 1000 rows"),e.forEach(function(e,o){switch(e.type){case"header":i.appendChild(t.genereateHeaderElement(e,a,s));break;case"group":n.appendChild(t.genereateGroupElement(e,a,s));break;case"calc":n.appendChild(t.genereateCalcElement(e,a,s));break;case"row":var r=t.genereateRowElement(e,a,s);t.mapElementStyles(o%2&&s.evenRow?s.evenRow:s.oddRow,r,["border-top","border-left","border-right","border-bottom","color","font-weight","font-family","font-size","background-color"]),n.appendChild(r)}}),i.innerHTML&&o.appendChild(i),o.appendChild(n),this.mapElementStyles(this.table.element,o,["border-top","border-left","border-right","border-bottom"]),o},R.prototype.lookupTableStyles=function(){var e={};return this.cloneTableStyle&&window.getComputedStyle&&(e.oddRow=this.table.element.querySelector(".tabulator-row-odd:not(.tabulator-group):not(.tabulator-calcs)"),e.evenRow=this.table.element.querySelector(".tabulator-row-even:not(.tabulator-group):not(.tabulator-calcs)"),e.calcRow=this.table.element.querySelector(".tabulator-row.tabulator-calcs"),e.firstRow=this.table.element.querySelector(".tabulator-row:not(.tabulator-group):not(.tabulator-calcs)"),e.firstGroup=this.table.element.getElementsByClassName("tabulator-group")[0],e.firstRow&&(e.styleCells=e.firstRow.getElementsByClassName("tabulator-cell"),e.firstCell=e.styleCells[0],e.lastCell=e.styleCells[e.styleCells.length-1])),e},R.prototype.genereateHeaderElement=function(e,t,o){var i=this,n=document.createElement("tr");return e.columns.forEach(function(e){if(e){var t=document.createElement("th"),o=e.component._column.definition.cssClass?e.component._column.definition.cssClass.split(" "):[];t.colSpan=e.width,t.rowSpan=e.height,t.innerHTML=e.value,i.cloneTableStyle&&(t.style.boxSizing="border-box"),o.forEach(function(e){t.classList.add(e)}),i.mapElementStyles(e.component.getElement(),t,["text-align","border-top","border-left","border-right","border-bottom","background-color","color","font-weight","font-family","font-size"]),i.mapElementStyles(e.component._column.contentElement,t,["padding-top","padding-left","padding-right","padding-bottom"]),e.component._column.visible?i.mapElementStyles(e.component.getElement(),t,["width"]):e.component._column.definition.width&&(t.style.width=e.component._column.definition.width+"px"),e.component._column.parent&&i.mapElementStyles(e.component._column.parent.groupElement,t,["border-top"]),n.appendChild(t)}}),n},R.prototype.genereateGroupElement=function(e,t,o){var i=document.createElement("tr"),n=document.createElement("td"),s=e.columns[0];return i.classList.add("tabulator-print-table-row"),t.groupHeader&&t.groupHeader[e.indent]?s.value=t.groupHeader[e.indent](s.value,e.component._group.getRowCount(),e.component._group.getData(),e.component):!1===t.groupHeader?s.value=s.value:s.value=e.component._group.generator(s.value,e.component._group.getRowCount(),e.component._group.getData(),e.component),n.colSpan=s.width,n.innerHTML=s.value,i.classList.add("tabulator-print-table-group"),i.classList.add("tabulator-group-level-"+e.indent),s.component.getVisibility()&&i.classList.add("tabulator-group-visible"),this.mapElementStyles(o.firstGroup,i,["border-top","border-left","border-right","border-bottom","color","font-weight","font-family","font-size","background-color"]),this.mapElementStyles(o.firstGroup,n,["padding-top","padding-left","padding-right","padding-bottom"]),i.appendChild(n),i},R.prototype.genereateCalcElement=function(e,t,o){var i=this.genereateRowElement(e,t,o);return i.classList.add("tabulator-print-table-calcs"),this.mapElementStyles(o.calcRow,i,["border-top","border-left","border-right","border-bottom","color","font-weight","font-family","font-size","background-color"]),i},R.prototype.genereateRowElement=function(e,t,o){var n=this,s=document.createElement("tr");return s.classList.add("tabulator-print-table-row"),e.columns.forEach(function(r){if(r){var a=document.createElement("td"),l=r.component._column,c=r.value,u={modules:{},getValue:function(){return c},getField:function(){return l.definition.field},getElement:function(){return a},getColumn:function(){return l.getComponent()},getData:function(){return rowData},getRow:function(){return e.getComponent()},getComponent:function(){return u},column:l};if((l.definition.cssClass?l.definition.cssClass.split(" "):[]).forEach(function(e){a.classList.add(e)}),n.table.modExists("format")&&!1!==n.config.formatCells)c=n.table.modules.format.formatExportValue(u,n.colVisProp);else switch(void 0===c?"undefined":_typeof(c)){case"object":c=JSON.stringify(c);break;case"undefined":case"null":c="";break;default:c=c}if(c instanceof Node?a.appendChild(c):a.innerHTML=c,o.firstCell&&(n.mapElementStyles(o.firstCell,a,["padding-top","padding-left","padding-right","padding-bottom","border-top","border-left","border-right","border-bottom","color","font-weight","font-family","font-size"]),l.definition.align&&(a.style.textAlign=l.definition.align)),n.table.options.dataTree&&!1!==n.config.dataTree&&(t.treeElementField&&t.treeElementField==l.field||!t.treeElementField&&0==i)&&(e.component._row.modules.dataTree.controlEl&&a.insertBefore(e.component._row.modules.dataTree.controlEl.cloneNode(!0),a.firstChild),e.component._row.modules.dataTree.branchEl&&a.insertBefore(e.component._row.modules.dataTree.branchEl.cloneNode(!0),a.firstChild)),s.appendChild(a),u.modules.format&&u.modules.format.renderedCallback&&u.modules.format.renderedCallback(),t.rowFormatter&&!1!==n.config.formatCells){var d=e.getComponent();d.getElement=function(){return s},t.rowFormatter(d)}}}),s},R.prototype.genereateHTMLTable=function(e){var t=document.createElement("div");return t.appendChild(this.genereateTableElement(e)),t.innerHTML},R.prototype.getHtml=function(e,t,o,i){var n=this.generateExportList(o||this.table.options.htmlOutputConfig,t,e,i||"htmlOutput");return this.genereateHTMLTable(n)},R.prototype.mapElementStyles=function(e,t,o){if(this.cloneTableStyle&&e&&t){var i={"background-color":"backgroundColor",color:"fontColor",width:"width","font-weight":"fontWeight","font-family":"fontFamily","font-size":"fontSize","text-align":"textAlign","border-top":"borderTop","border-left":"borderLeft","border-right":"borderRight","border-bottom":"borderBottom","padding-top":"paddingTop","padding-left":"paddingLeft","padding-right":"paddingRight","padding-bottom":"paddingBottom"};if(window.getComputedStyle){var n=window.getComputedStyle(e);o.forEach(function(e){t.style[i[e]]=n.getPropertyValue(e)})}}},d.prototype.registerModule("export",R);var M=function(e){this.table=e,this.filterList=[],this.headerFilters={},this.headerFilterColumns=[],this.prevHeaderFilterChangeCheck="",this.prevHeaderFilterChangeCheck="{}",this.changed=!1};M.prototype.initializeColumn=function(e,t){function o(t){var o,r="input"==e.modules.filter.tagType&&"text"==e.modules.filter.attrType||"textarea"==e.modules.filter.tagType?"partial":"match",a="",l="";if(void 0===e.modules.filter.prevSuccess||e.modules.filter.prevSuccess!==t){if(e.modules.filter.prevSuccess=t,e.modules.filter.emptyFunc(t))delete n.headerFilters[s];else{switch(e.modules.filter.value=t,_typeof(e.definition.headerFilterFunc)){case"string":n.filters[e.definition.headerFilterFunc]?(a=e.definition.headerFilterFunc,o=function(o){var i=e.definition.headerFilterFuncParams||{},s=e.getFieldValue(o);return i="function"==typeof i?i(t,s,o):i,n.filters[e.definition.headerFilterFunc](t,s,o,i)}):console.warn("Header Filter Error - Matching filter function not found: ",e.definition.headerFilterFunc);break;case"function":o=function(o){var i=e.definition.headerFilterFuncParams||{},n=e.getFieldValue(o);return i="function"==typeof i?i(t,n,o):i,e.definition.headerFilterFunc(t,n,o,i)},a=o}if(!o)switch(r){case"partial":o=function(o){var i=e.getFieldValue(o);return void 0!==i&&null!==i&&String(i).toLowerCase().indexOf(String(t).toLowerCase())>-1},a="like";break;default:o=function(o){return e.getFieldValue(o)==t},a="="}n.headerFilters[s]={value:t,func:o,type:a,params:i||{}}}l=JSON.stringify(n.headerFilters),n.prevHeaderFilterChangeCheck!==l&&(n.prevHeaderFilterChangeCheck=l,n.changed=!0,n.table.rowManager.filterRefresh())}return!0}var i,n=this,s=e.getField();e.modules.filter={success:o,attrType:!1,tagType:!1,emptyFunc:!1},this.generateHeaderFilterElement(e)},M.prototype.generateHeaderFilterElement=function(e,t,o){function i(){}var n,s,r,a,l,c,u,d=this,h=this,p=e.modules.filter.success,m=e.getField();if(e.modules.filter.headerElement&&e.modules.filter.headerElement.parentNode&&e.contentElement.removeChild(e.modules.filter.headerElement.parentNode),m){switch(e.modules.filter.emptyFunc=e.definition.headerFilterEmptyCheck||function(e){return!e&&"0"!==e},n=document.createElement("div"),n.classList.add("tabulator-header-filter"),_typeof(e.definition.headerFilter)){case"string":h.table.modules.edit.editors[e.definition.headerFilter]?(s=h.table.modules.edit.editors[e.definition.headerFilter],"tick"!==e.definition.headerFilter&&"tickCross"!==e.definition.headerFilter||e.definition.headerFilterEmptyCheck||(e.modules.filter.emptyFunc=function(e){return!0!==e&&!1!==e})):console.warn("Filter Error - Cannot build header filter, No such editor found: ",e.definition.editor);break;case"function":s=e.definition.headerFilter;break;case"boolean":e.modules.edit&&e.modules.edit.editor?s=e.modules.edit.editor:e.definition.formatter&&h.table.modules.edit.editors[e.definition.formatter]?(s=h.table.modules.edit.editors[e.definition.formatter],"tick"!==e.definition.formatter&&"tickCross"!==e.definition.formatter||e.definition.headerFilterEmptyCheck||(e.modules.filter.emptyFunc=function(e){return!0!==e&&!1!==e})):s=h.table.modules.edit.editors.input}if(s){if(a={getValue:function(){return void 0!==t?t:""},getField:function(){return e.definition.field},getElement:function(){return n},getColumn:function(){return e.getComponent()},getRow:function(){return{normalizeHeight:function(){}}}},u=e.definition.headerFilterParams||{},u="function"==typeof u?u.call(h.table):u,!(r=s.call(this.table.modules.edit,a,function(){},p,i,u)))return void console.warn("Filter Error - Cannot add filter to "+m+" column, editor returned a value of false");if(!(r instanceof Node))return void console.warn("Filter Error - Cannot add filter to "+m+" column, editor should return an instance of Node, the editor returned:",r);m?h.table.modules.localize.bind("headerFilters|columns|"+e.definition.field,function(e){r.setAttribute("placeholder",void 0!==e&&e?e:h.table.modules.localize.getText("headerFilters|default"))}):h.table.modules.localize.bind("headerFilters|default",function(e){r.setAttribute("placeholder",void 0!==h.column.definition.headerFilterPlaceholder&&h.column.definition.headerFilterPlaceholder?h.column.definition.headerFilterPlaceholder:e)}),r.addEventListener("click",function(e){e.stopPropagation(),r.focus()}),r.addEventListener("focus",function(e){var t=d.table.columnManager.element.scrollLeft;t!==d.table.rowManager.element.scrollLeft&&(d.table.rowManager.scrollHorizontal(t),d.table.columnManager.scrollHorizontal(t))}),l=!1,c=function(e){l&&clearTimeout(l),l=setTimeout(function(){p(r.value)},h.table.options.headerFilterLiveFilterDelay)},e.modules.filter.headerElement=r,e.modules.filter.attrType=r.hasAttribute("type")?r.getAttribute("type").toLowerCase():"",e.modules.filter.tagType=r.tagName.toLowerCase(),!1!==e.definition.headerFilterLiveFilter&&("autocomplete"!==e.definition.headerFilter&&"tickCross"!==e.definition.headerFilter&&("autocomplete"!==e.definition.editor&&"tickCross"!==e.definition.editor||!0!==e.definition.headerFilter)&&(r.addEventListener("keyup",c),r.addEventListener("search",c),"number"==e.modules.filter.attrType&&r.addEventListener("change",function(e){p(r.value)}),"text"==e.modules.filter.attrType&&"ie"!==this.table.browser&&r.setAttribute("type","search")),"input"!=e.modules.filter.tagType&&"select"!=e.modules.filter.tagType&&"textarea"!=e.modules.filter.tagType||r.addEventListener("mousedown",function(e){e.stopPropagation()})),n.appendChild(r),e.contentElement.appendChild(n),o||h.headerFilterColumns.push(e)}}else console.warn("Filter Error - Cannot add header filter, column has no field set:",e.definition.title)},M.prototype.hideHeaderFilterElements=function(){this.headerFilterColumns.forEach(function(e){e.modules.filter&&e.modules.filter.headerElement&&(e.modules.filter.headerElement.style.display="none")})},M.prototype.showHeaderFilterElements=function(){this.headerFilterColumns.forEach(function(e){e.modules.filter&&e.modules.filter.headerElement&&(e.modules.filter.headerElement.style.display="")})},M.prototype.setHeaderFilterFocus=function(e){e.modules.filter&&e.modules.filter.headerElement?e.modules.filter.headerElement.focus():console.warn("Column Filter Focus Error - No header filter set on column:",e.getField())},M.prototype.getHeaderFilterValue=function(e){if(e.modules.filter&&e.modules.filter.headerElement)return e.modules.filter.headerElement.value;console.warn("Column Filter Error - No header filter set on column:",e.getField())},M.prototype.setHeaderFilterValue=function(e,t){e&&(e.modules.filter&&e.modules.filter.headerElement?(this.generateHeaderFilterElement(e,t,!0),e.modules.filter.success(t)):console.warn("Column Filter Error - No header filter set on column:",e.getField()))},M.prototype.reloadHeaderFilter=function(e){e&&(e.modules.filter&&e.modules.filter.headerElement?this.generateHeaderFilterElement(e,e.modules.filter.value,!0):console.warn("Column Filter Error - No header filter set on column:",e.getField()))},M.prototype.hasChanged=function(){var e=this.changed;return this.changed=!1,e},M.prototype.setFilter=function(e,t,o,i){var n=this;n.filterList=[],Array.isArray(e)||(e=[{field:e,type:t,value:o,params:i}]),n.addFilter(e)},M.prototype.addFilter=function(e,t,o,i){var n=this;Array.isArray(e)||(e=[{field:e,type:t,value:o,params:i}]),e.forEach(function(e){(e=n.findFilter(e))&&(n.filterList.push(e),n.changed=!0)}),this.table.options.persistence&&this.table.modExists("persistence",!0)&&this.table.modules.persistence.config.filter&&this.table.modules.persistence.save("filter")},M.prototype.findFilter=function(e){var t,o=this;if(Array.isArray(e))return this.findSubFilters(e);var i=!1;return"function"==typeof e.field?i=function(t){return e.field(t,e.type||{})}:o.filters[e.type]?(t=o.table.columnManager.getColumnByField(e.field),i=t?function(i){return o.filters[e.type](e.value,t.getFieldValue(i),i,e.params||{})}:function(t){return o.filters[e.type](e.value,t[e.field],t,e.params||{})}):console.warn("Filter Error - No such filter type found, ignoring: ",e.type),e.func=i,!!e.func&&e},M.prototype.findSubFilters=function(e){var t=this,o=[];return e.forEach(function(e){(e=t.findFilter(e))&&o.push(e)}),!!o.length&&o},M.prototype.getFilters=function(e,t){var o=[];return e&&(o=this.getHeaderFilters()),t&&o.forEach(function(e){"function"==typeof e.type&&(e.type="function")}),o=o.concat(this.filtersToArray(this.filterList,t))},M.prototype.filtersToArray=function(e,t){var o=this,i=[];return e.forEach(function(e){var n;Array.isArray(e)?i.push(o.filtersToArray(e,t)):(n={field:e.field,type:e.type,value:e.value},t&&"function"==typeof n.type&&(n.type="function"),i.push(n))}),i},M.prototype.getHeaderFilters=function(){var e=[];for(var t in this.headerFilters)e.push({field:t,type:this.headerFilters[t].type,value:this.headerFilters[t].value});return e},M.prototype.removeFilter=function(e,t,o){var i=this;Array.isArray(e)||(e=[{field:e,type:t,value:o}]),e.forEach(function(e){var t=-1;t="object"==_typeof(e.field)?i.filterList.findIndex(function(t){return e===t}):i.filterList.findIndex(function(t){return e.field===t.field&&e.type===t.type&&e.value===t.value}),t>-1?(i.filterList.splice(t,1),i.changed=!0):console.warn("Filter Error - No matching filter type found, ignoring: ",e.type)}),this.table.options.persistence&&this.table.modExists("persistence",!0)&&this.table.modules.persistence.config.filter&&this.table.modules.persistence.save("filter")},M.prototype.clearFilter=function(e){this.filterList=[],e&&this.clearHeaderFilter(),this.changed=!0,this.table.options.persistence&&this.table.modExists("persistence",!0)&&this.table.modules.persistence.config.filter&&this.table.modules.persistence.save("filter")},M.prototype.clearHeaderFilter=function(){var e=this;this.headerFilters={},e.prevHeaderFilterChangeCheck="{}",this.headerFilterColumns.forEach(function(t){t.modules.filter.value=null,t.modules.filter.prevSuccess=void 0,e.reloadHeaderFilter(t)}),this.changed=!0},M.prototype.search=function(e,t,o,i){var n=this,s=[],r=[];return Array.isArray(t)||(t=[{field:t,type:o,value:i}]),t.forEach(function(e){(e=n.findFilter(e))&&r.push(e)}),this.table.rowManager.rows.forEach(function(t){var o=!0;r.forEach(function(e){n.filterRecurse(e,t.getData())||(o=!1)}),o&&s.push("data"===e?t.getData("data"):t.getComponent())}),s},M.prototype.filter=function(e,t){var o=this,i=[],n=[];return o.table.options.dataFiltering&&o.table.options.dataFiltering.call(o.table,o.getFilters()),o.table.options.ajaxFiltering||!o.filterList.length&&!Object.keys(o.headerFilters).length?i=e.slice(0):e.forEach(function(e){o.filterRow(e)&&i.push(e)}),o.table.options.dataFiltered&&(i.forEach(function(e){n.push(e.getComponent())}),o.table.options.dataFiltered.call(o.table,o.getFilters(),n)),i},M.prototype.filterRow=function(e,t){var o=this,i=!0,n=e.getData();o.filterList.forEach(function(e){o.filterRecurse(e,n)||(i=!1)});for(var s in o.headerFilters)o.headerFilters[s].func(n)||(i=!1);return i},M.prototype.filterRecurse=function(e,t){var o=this,i=!1;return Array.isArray(e)?e.forEach(function(e){o.filterRecurse(e,t)&&(i=!0)}):i=e.func(t),i},M.prototype.filters={"=":function(e,t,o,i){return t==e},"<":function(e,t,o,i){return t":function(e,t,o,i){return t>e},">=":function(e,t,o,i){return t>=e},"!=":function(e,t,o,i){return t!=e},regex:function(e,t,o,i){return"string"==typeof e&&(e=new RegExp(e)),e.test(t)},like:function(e,t,o,i){return null===e||void 0===e?t===e:void 0!==t&&null!==t&&String(t).toLowerCase().indexOf(e.toLowerCase())>-1},keywords:function(e,t,o,i){var n=e.toLowerCase().split(void 0===i.separator?" ":i.separator),s=String(null===t||void 0===t?"":t).toLowerCase(),r=[];return n.forEach(function(e){s.includes(e)&&r.push(!0)}),i.matchAll?r.length===n.length:!!r.length},starts:function(e,t,o,i){return null===e||void 0===e?t===e:void 0!==t&&null!==t&&String(t).toLowerCase().startsWith(e.toLowerCase())},ends:function(e,t,o,i){return null===e||void 0===e?t===e:void 0!==t&&null!==t&&String(t).toLowerCase().endsWith(e.toLowerCase())},in:function(e,t,o,i){return Array.isArray(e)?e.indexOf(t)>-1:(console.warn("Filter Error - filter value is not an array:",e),!1)}},d.prototype.registerModule("filter",M);var L=function(e){this.table=e};L.prototype.initializeColumn=function(e){e.modules.format=this.lookupFormatter(e,""),void 0!==e.definition.formatterPrint&&(e.modules.format.print=this.lookupFormatter(e,"Print")),void 0!==e.definition.formatterClipboard&&(e.modules.format.clipboard=this.lookupFormatter(e,"Clipboard")),void 0!==e.definition.formatterHtmlOutput&&(e.modules.format.htmlOutput=this.lookupFormatter(e,"HtmlOutput"))},L.prototype.lookupFormatter=function(e,t){var o={params:e.definition["formatter"+t+"Params"]||{}},i=e.definition["formatter"+t];switch(void 0===i?"undefined":_typeof(i)){case"string":"tick"===i&&(i="tickCross",void 0===o.params.crossElement&&(o.params.crossElement=!1),console.warn("DEPRECATION WARNING - the tick formatter has been deprecated, please use the tickCross formatter with the crossElement param set to false")),this.formatters[i]?o.formatter=this.formatters[i]:(console.warn("Formatter Error - No such formatter found: ",i),o.formatter=this.formatters.plaintext);break;case"function":o.formatter=i;break;default:o.formatter=this.formatters.plaintext}return o},L.prototype.cellRendered=function(e){e.modules.format&&e.modules.format.renderedCallback&&e.modules.format.renderedCallback()},L.prototype.formatValue=function(e){function t(t){e.modules.format||(e.modules.format={}),e.modules.format.renderedCallback=t}var o=e.getComponent(),i="function"==typeof e.column.modules.format.params?e.column.modules.format.params(o):e.column.modules.format.params;return e.column.modules.format.formatter.call(this,o,i,t)},L.prototype.formatExportValue=function(e,t){var o,i=e.column.modules.format[t];if(i){var n=function(t){e.modules.format||(e.modules.format={}),e.modules.format.renderedCallback=t};return o="function"==typeof i.params?i.params(component):i.params,i.formatter.call(this,e.getComponent(),o,n)}return this.formatValue(e)},L.prototype.sanitizeHTML=function(e){if(e){var t={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/","`":"`","=":"="};return String(e).replace(/[&<>"'`=\/]/g,function(e){return t[e]})}return e},L.prototype.emptyToSpace=function(e){return null===e||void 0===e||""===e?" ":e},L.prototype.getFormatter=function(e){var e;switch(void 0===e?"undefined":_typeof(e)){case"string":this.formatters[e]?e=this.formatters[e]:(console.warn("Formatter Error - No such formatter found: ",e),e=this.formatters.plaintext);break;case"function":e=e;break;default:e=this.formatters.plaintext}return e},L.prototype.formatters={plaintext:function(e,t,o){return this.emptyToSpace(this.sanitizeHTML(e.getValue()))},html:function(e,t,o){return e.getValue()},textarea:function(e,t,o){return e.getElement().style.whiteSpace="pre-wrap",this.emptyToSpace(this.sanitizeHTML(e.getValue()))},money:function(e,t,o){var i,n,s,r,a=parseFloat(e.getValue()),l=t.decimal||".",c=t.thousand||",",u=t.symbol||"",d=!!t.symbolAfter,h=void 0!==t.precision?t.precision:2;if(isNaN(a))return this.emptyToSpace(this.sanitizeHTML(e.getValue()));for(i=!1!==h?a.toFixed(h):a,i=String(i).split("."),n=i[0],s=i.length>1?l+i[1]:"",r=/(\d+)(\d{3})/;r.test(n);)n=n.replace(r,"$1"+c+"$2");return d?n+s+u:u+n+s},link:function(e,t,o){var i,n=e.getValue(),s=t.urlPrefix||"",r=t.download,a=n,l=document.createElement("a");if(t.labelField&&(i=e.getData(),a=i[t.labelField]),t.label)switch(_typeof(t.label)){case"string":a=t.label;break;case"function":a=t.label(e)}if(a){if(t.urlField&&(i=e.getData(),n=i[t.urlField]),t.url)switch(_typeof(t.url)){case"string":n=t.url;break;case"function":n=t.url(e)}return l.setAttribute("href",s+n),t.target&&l.setAttribute("target",t.target),t.download&&(r="function"==typeof r?r(e):!0===r?"":r,l.setAttribute("download",r)),l.innerHTML=this.emptyToSpace(this.sanitizeHTML(a)),l}return" "},image:function(e,t,o){var i=document.createElement("img");switch(i.setAttribute("src",e.getValue()),_typeof(t.height)){case"number":i.style.height=t.height+"px";break;case"string":i.style.height=t.height}switch(_typeof(t.width)){case"number":i.style.width=t.width+"px";break;case"string":i.style.width=t.width}return i.addEventListener("load",function(){e.getRow().normalizeHeight()}),i},tickCross:function(e,t,o){var i=e.getValue(),n=e.getElement(),s=t.allowEmpty,r=t.allowTruthy,a=void 0!==t.tickElement?t.tickElement:'',l=void 0!==t.crossElement?t.crossElement:'';return r&&i||!0===i||"true"===i||"True"===i||1===i||"1"===i?(n.setAttribute("aria-checked",!0),a||""):!s||"null"!==i&&""!==i&&null!==i&&void 0!==i?(n.setAttribute("aria-checked",!1),l||""):(n.setAttribute("aria-checked","mixed"),"")},datetime:function(e,t,o){var i=t.inputFormat||"YYYY-MM-DD hh:mm:ss",n=t.outputFormat||"DD/MM/YYYY hh:mm:ss",s=void 0!==t.invalidPlaceholder?t.invalidPlaceholder:"",r=e.getValue(),a=moment(r,i);return a.isValid()?t.timezone?a.tz(t.timezone).format(n):a.format(n):!0===s?r:"function"==typeof s?s(r):s},datetimediff:function(e,t,o){ +var i=t.inputFormat||"YYYY-MM-DD hh:mm:ss",n=void 0!==t.invalidPlaceholder?t.invalidPlaceholder:"",s=void 0!==t.suffix&&t.suffix,r=void 0!==t.unit?t.unit:void 0,a=void 0!==t.humanize&&t.humanize,l=void 0!==t.date?t.date:moment(),c=e.getValue(),u=moment(c,i);return u.isValid()?a?moment.duration(u.diff(l)).humanize(s):u.diff(l,r)+(s?" "+s:""):!0===n?c:"function"==typeof n?n(c):n},lookup:function(e,t,o){var i=e.getValue();return void 0===t[i]?(console.warn("Missing display value for "+i),i):t[i]},star:function(e,t,o){var i=e.getValue(),n=e.getElement(),s=t&&t.stars?t.stars:5,r=document.createElement("span"),a=document.createElementNS("http://www.w3.org/2000/svg","svg");r.style.verticalAlign="middle",a.setAttribute("width","14"),a.setAttribute("height","14"),a.setAttribute("viewBox","0 0 512 512"),a.setAttribute("xml:space","preserve"),a.style.padding="0 1px",i=i&&!isNaN(i)?parseInt(i):0,i=Math.max(0,Math.min(i,s));for(var l=1;l<=s;l++){var c=a.cloneNode(!0);c.innerHTML=l<=i?'':'',r.appendChild(c)}return n.style.whiteSpace="nowrap",n.style.overflow="hidden",n.style.textOverflow="ellipsis",n.setAttribute("aria-label",i),r},traffic:function(e,t,o){var i,n,s=this.sanitizeHTML(e.getValue())||0,r=document.createElement("span"),a=t&&t.max?t.max:100,l=t&&t.min?t.min:0,c=t&&void 0!==t.color?t.color:["red","orange","green"],u="#666666";if(!isNaN(s)&&void 0!==e.getValue()){switch(r.classList.add("tabulator-traffic-light"),n=parseFloat(s)<=a?parseFloat(s):a,n=parseFloat(n)>=l?parseFloat(n):l,i=(a-l)/100,n=Math.round((n-l)/i),void 0===c?"undefined":_typeof(c)){case"string":u=c;break;case"function":u=c(s);break;case"object":if(Array.isArray(c)){var d=100/c.length,h=Math.floor(n/d);h=Math.min(h,c.length-1),h=Math.max(h,0),u=c[h];break}}return r.style.backgroundColor=u,r}},progress:function(e,t,o){var i,n,s,r,a,c=this.sanitizeHTML(e.getValue())||0,u=e.getElement(),d=t&&t.max?t.max:100,h=t&&t.min?t.min:0,p=t&&t.legendAlign?t.legendAlign:"center";switch(n=parseFloat(c)<=d?parseFloat(c):d,n=parseFloat(n)>=h?parseFloat(n):h,i=(d-h)/100,n=Math.round((n-h)/i),_typeof(t.color)){case"string":s=t.color;break;case"function":s=t.color(c);break;case"object":if(Array.isArray(t.color)){var m=100/t.color.length,f=Math.floor(n/m);f=Math.min(f,t.color.length-1),f=Math.max(f,0),s=t.color[f];break}default:s="#2DC214"}switch(_typeof(t.legend)){case"string":r=t.legend;break;case"function":r=t.legend(c);break;case"boolean":r=c;break;default:r=!1}switch(_typeof(t.legendColor)){case"string":a=t.legendColor;break;case"function":a=t.legendColor(c);break;case"object":if(Array.isArray(t.legendColor)){var m=100/t.legendColor.length,f=Math.floor(n/m);f=Math.min(f,t.legendColor.length-1),f=Math.max(f,0),a=t.legendColor[f]}break;default:a="#000"}u.style.minWidth="30px",u.style.position="relative",u.setAttribute("aria-label",n);var g=document.createElement("div");if(g.style.display="inline-block",g.style.position="relative",g.style.width=n+"%",g.style.backgroundColor=s,g.style.height="100%",g.setAttribute("data-max",d),g.setAttribute("data-min",h),r){var b=document.createElement("div");b.style.position="absolute",b.style.top="4px",b.style.left=0,b.style.textAlign=p,b.style.width="100%",b.style.color=a,b.innerHTML=r}return o(function(){if(!(e instanceof l)){var t=document.createElement("div");t.style.position="absolute",t.style.top="4px",t.style.bottom="4px",t.style.left="4px",t.style.right="4px",u.appendChild(t),u=t}u.appendChild(g),r&&u.appendChild(b)}),""},color:function(e,t,o){return e.getElement().style.backgroundColor=this.sanitizeHTML(e.getValue()),""},buttonTick:function(e,t,o){return''},buttonCross:function(e,t,o){return''},rownum:function(e,t,o){return this.table.rowManager.activeRows.indexOf(e.getRow()._getSelf())+1},handle:function(e,t,o){return e.getElement().classList.add("tabulator-row-handle"),"
"},responsiveCollapse:function(e,t,o){function i(e){var t=s.element;s.open=e,t&&(s.open?(n.classList.add("open"),t.style.display=""):(n.classList.remove("open"),t.style.display="none"))}var n=document.createElement("div"),s=e.getRow()._row.modules.responsiveLayout;return n.classList.add("tabulator-responsive-collapse-toggle"),n.innerHTML="+-",e.getElement().classList.add("tabulator-row-handle"),n.addEventListener("click",function(e){e.stopImmediatePropagation(),i(!s.open)}),i(s.open),n},rowSelection:function(e){var t=this,o=document.createElement("input");if(o.type="checkbox",this.table.modExists("selectRow",!0))if(o.addEventListener("click",function(e){e.stopPropagation()}),"function"==typeof e.getRow){var i=e.getRow();o.addEventListener("change",function(e){i.toggleSelect()}),o.checked=i.isSelected(),this.table.modules.selectRow.registerRowSelectCheckbox(i,o)}else o.addEventListener("change",function(e){t.table.modules.selectRow.selectedRows.length?t.table.deselectRow():t.table.selectRow()}),this.table.modules.selectRow.registerHeaderSelectCheckbox(o);return o}},d.prototype.registerModule("format",L);var T=function(e){this.table=e,this.leftColumns=[],this.rightColumns=[],this.leftMargin=0,this.rightMargin=0,this.rightPadding=0,this.initializationMode="left",this.active=!1,this.scrollEndTimer=!1};T.prototype.reset=function(){this.initializationMode="left",this.leftColumns=[],this.rightColumns=[],this.leftMargin=0,this.rightMargin=0,this.rightMargin=0,this.active=!1,this.table.columnManager.headersElement.style.marginLeft=0,this.table.columnManager.element.style.paddingRight=0},T.prototype.initializeColumn=function(e){var t={margin:0,edge:!1};e.isGroup||(this.frozenCheck(e)?(t.position=this.initializationMode,"left"==this.initializationMode?this.leftColumns.push(e):this.rightColumns.unshift(e),this.active=!0,e.modules.frozen=t):this.initializationMode="right")},T.prototype.frozenCheck=function(e){return e.parent.isGroup&&e.definition.frozen&&console.warn("Frozen Column Error - Parent column group must be frozen, not individual columns or sub column groups"),e.parent.isGroup?this.frozenCheck(e.parent):e.definition.frozen},T.prototype.scrollHorizontal=function(){var e,t=this;this.active&&(clearTimeout(this.scrollEndTimer),this.scrollEndTimer=setTimeout(function(){t.layout()},100),e=this.table.rowManager.getVisibleRows(),this.calcMargins(),this.layoutColumnPosition(),this.layoutCalcRows(),e.forEach(function(e){"row"===e.type&&t.layoutRow(e)}),this.table.rowManager.tableElement.style.marginRight=this.rightMargin)},T.prototype.calcMargins=function(){this.leftMargin=this._calcSpace(this.leftColumns,this.leftColumns.length)+"px",this.table.columnManager.headersElement.style.marginLeft=this.leftMargin,this.rightMargin=this._calcSpace(this.rightColumns,this.rightColumns.length)+"px",this.table.columnManager.element.style.paddingRight=this.rightMargin,this.rightPadding=this.table.rowManager.element.clientWidth+this.table.columnManager.scrollLeft},T.prototype.layoutCalcRows=function(){this.table.modExists("columnCalcs")&&(this.table.modules.columnCalcs.topInitialized&&this.table.modules.columnCalcs.topRow&&this.layoutRow(this.table.modules.columnCalcs.topRow),this.table.modules.columnCalcs.botInitialized&&this.table.modules.columnCalcs.botRow&&this.layoutRow(this.table.modules.columnCalcs.botRow))},T.prototype.layoutColumnPosition=function(e){var t=this,o=[];this.leftColumns.forEach(function(i,n){if(i.modules.frozen.margin=t._calcSpace(t.leftColumns,n)+t.table.columnManager.scrollLeft+"px",n==t.leftColumns.length-1?i.modules.frozen.edge=!0:i.modules.frozen.edge=!1,i.parent.isGroup){var s=t.getColGroupParentElement(i);o.includes(s)||(t.layoutElement(s,i),o.push(s)),i.modules.frozen.edge&&s.classList.add("tabulator-frozen-"+i.modules.frozen.position)}else t.layoutElement(i.getElement(),i);e&&i.cells.forEach(function(e){t.layoutElement(e.getElement(),i)})}),this.rightColumns.forEach(function(o,i){o.modules.frozen.margin=t.rightPadding-t._calcSpace(t.rightColumns,i+1)+"px",i==t.rightColumns.length-1?o.modules.frozen.edge=!0:o.modules.frozen.edge=!1,o.parent.isGroup?t.layoutElement(t.getColGroupParentElement(o),o):t.layoutElement(o.getElement(),o),e&&o.cells.forEach(function(e){t.layoutElement(e.getElement(),o)})})},T.prototype.getColGroupParentElement=function(e){return e.parent.isGroup?this.getColGroupParentElement(e.parent):e.getElement()},T.prototype.layout=function(){var e=this;e.active&&(this.calcMargins(),e.table.rowManager.getDisplayRows().forEach(function(t){"row"===t.type&&e.layoutRow(t)}),this.layoutCalcRows(),this.layoutColumnPosition(!0),this.table.rowManager.tableElement.style.marginRight=this.rightMargin)},T.prototype.layoutRow=function(e){var t=this;e.getElement().style.paddingLeft=this.leftMargin,this.leftColumns.forEach(function(o){var i=e.getCell(o);i&&t.layoutElement(i.getElement(),o)}),this.rightColumns.forEach(function(o){var i=e.getCell(o);i&&t.layoutElement(i.getElement(),o)})},T.prototype.layoutElement=function(e,t){t.modules.frozen&&(e.style.position="absolute",e.style.left=t.modules.frozen.margin,e.classList.add("tabulator-frozen"),t.modules.frozen.edge&&e.classList.add("tabulator-frozen-"+t.modules.frozen.position))},T.prototype._calcSpace=function(e,t){for(var o=0,i=0;i-1&&t.splice(o,1)}),t},D.prototype.freezeRow=function(e){e.modules.frozen?console.warn("Freeze Error - Row is already frozen"):(e.modules.frozen=!0,this.topElement.appendChild(e.getElement()),e.initialize(),e.normalizeHeight(),this.table.rowManager.adjustTableSize(),this.rows.push(e),this.table.rowManager.refreshActiveData("display"),this.styleRows())},D.prototype.unfreezeRow=function(e){var t=this.rows.indexOf(e);if(e.modules.frozen){e.modules.frozen=!1;var o=e.getElement();o.parentNode.removeChild(o),this.table.rowManager.adjustTableSize(),this.rows.splice(t,1),this.table.rowManager.refreshActiveData("display"),this.rows.length&&this.styleRows()}else console.warn("Freeze Error - Row is already unfrozen")},D.prototype.styleRows=function(e){var t=this;this.rows.forEach(function(e,o){t.table.rowManager.styleRow(e,o)})},d.prototype.registerModule("frozenRows",D);var k=function(e){this._group=e,this.type="GroupComponent"};k.prototype.getKey=function(){return this._group.key},k.prototype.getField=function(){return this._group.field},k.prototype.getElement=function(){return this._group.element},k.prototype.getRows=function(){return this._group.getRows(!0)},k.prototype.getSubGroups=function(){return this._group.getSubGroups(!0)},k.prototype.getParentGroup=function(){return!!this._group.parent&&this._group.parent.getComponent()},k.prototype.getVisibility=function(){return console.warn("getVisibility function is deprecated, you should now use the isVisible function"),this._group.visible},k.prototype.isVisible=function(){return this._group.visible},k.prototype.show=function(){this._group.show()},k.prototype.hide=function(){this._group.hide()},k.prototype.toggle=function(){this._group.toggleVisibility()},k.prototype._getSelf=function(){return this._group},k.prototype.getTable=function(){return this._group.groupManager.table};var S=function(e,t,o,i,n,s,r){this.groupManager=e,this.parent=t,this.key=i,this.level=o,this.field=n,this.hasSubGroups=o-1?o?this.rows.splice(n+1,0,e):this.rows.splice(n,0,e):o?this.rows.push(e):this.rows.unshift(e),e.modules.group=this,this.generateGroupHeaderContents(),this.groupManager.table.modExists("columnCalcs")&&"table"!=this.groupManager.table.options.columnCalcs&&this.groupManager.table.modules.columnCalcs.recalcGroup(this),this.groupManager.updateGroupRows(!0)},S.prototype.scrollHeader=function(e){this.arrowElement.style.marginLeft=e,this.groupList.forEach(function(t){t.scrollHeader(e)})},S.prototype.getRowIndex=function(e){},S.prototype.conformRowData=function(e){return this.field?e[this.field]=this.key:console.warn("Data Conforming Error - Cannot conform row data to match new group as groupBy is a function"),this.parent&&(e=this.parent.conformRowData(e)),e},S.prototype.removeRow=function(e){var t=this.rows.indexOf(e),o=e.getElement();t>-1&&this.rows.splice(t,1),this.groupManager.table.options.groupValues||this.rows.length?(o.parentNode&&o.parentNode.removeChild(o),this.generateGroupHeaderContents(),this.groupManager.table.modExists("columnCalcs")&&"table"!=this.groupManager.table.options.columnCalcs&&this.groupManager.table.modules.columnCalcs.recalcGroup(this)):(this.parent?this.parent.removeGroup(this):this.groupManager.removeGroup(this),this.groupManager.updateGroupRows(!0))},S.prototype.removeGroup=function(e){var t,o=e.level+"_"+e.key;this.groups[o]&&(delete this.groups[o],t=this.groupList.indexOf(e),t>-1&&this.groupList.splice(t,1),this.groupList.length||(this.parent?this.parent.removeGroup(this):this.groupManager.removeGroup(this)))},S.prototype.getHeadersAndRows=function(e){var t=[];return t.push(this),this._visSet(),this.visible?this.groupList.length?this.groupList.forEach(function(o){t=t.concat(o.getHeadersAndRows(e))}):(!e&&"table"!=this.groupManager.table.options.columnCalcs&&this.groupManager.table.modExists("columnCalcs")&&this.groupManager.table.modules.columnCalcs.hasTopCalcs()&&(this.calcs.top&&(this.calcs.top.detachElement(),this.calcs.top.deleteCells()),this.calcs.top=this.groupManager.table.modules.columnCalcs.generateTopRow(this.rows),t.push(this.calcs.top)),t=t.concat(this.rows),!e&&"table"!=this.groupManager.table.options.columnCalcs&&this.groupManager.table.modExists("columnCalcs")&&this.groupManager.table.modules.columnCalcs.hasBottomCalcs()&&(this.calcs.bottom&&(this.calcs.bottom.detachElement(),this.calcs.bottom.deleteCells()),this.calcs.bottom=this.groupManager.table.modules.columnCalcs.generateBottomRow(this.rows),t.push(this.calcs.bottom))):this.groupList.length||"table"==this.groupManager.table.options.columnCalcs||this.groupManager.table.modExists("columnCalcs")&&(!e&&this.groupManager.table.modules.columnCalcs.hasTopCalcs()&&(this.calcs.top&&(this.calcs.top.detachElement(),this.calcs.top.deleteCells()),this.groupManager.table.options.groupClosedShowCalcs&&(this.calcs.top=this.groupManager.table.modules.columnCalcs.generateTopRow(this.rows),t.push(this.calcs.top))),!e&&this.groupManager.table.modules.columnCalcs.hasBottomCalcs()&&(this.calcs.bottom&&(this.calcs.bottom.detachElement(),this.calcs.bottom.deleteCells()),this.groupManager.table.options.groupClosedShowCalcs&&(this.calcs.bottom=this.groupManager.table.modules.columnCalcs.generateBottomRow(this.rows),t.push(this.calcs.bottom)))),t},S.prototype.getData=function(e,t){var o=[];return this._visSet(),(!e||e&&this.visible)&&this.rows.forEach(function(e){o.push(e.getData(t||"data"))}),o},S.prototype.getRowCount=function(){var e=0;return this.groupList.length?this.groupList.forEach(function(t){e+=t.getRowCount()}):e=this.rows.length,e},S.prototype.toggleVisibility=function(){this.visible?this.hide():this.show()},S.prototype.hide=function(){this.visible=!1,"classic"!=this.groupManager.table.rowManager.getRenderMode()||this.groupManager.table.options.pagination?this.groupManager.updateGroupRows(!0):(this.element.classList.remove("tabulator-group-visible"),this.groupList.length?this.groupList.forEach(function(e){e.getHeadersAndRows().forEach(function(e){e.detachElement()})}):this.rows.forEach(function(e){var t=e.getElement();t.parentNode.removeChild(t)}),this.groupManager.table.rowManager.setDisplayRows(this.groupManager.updateGroupRows(),this.groupManager.getDisplayIndex()),this.groupManager.table.rowManager.checkClassicModeGroupHeaderWidth()),this.groupManager.table.options.groupVisibilityChanged.call(this.table,this.getComponent(),!1)},S.prototype.show=function(){var e=this;if(e.visible=!0,"classic"!=this.groupManager.table.rowManager.getRenderMode()||this.groupManager.table.options.pagination)this.groupManager.updateGroupRows(!0);else{this.element.classList.add("tabulator-group-visible");var t=e.getElement();this.groupList.length?this.groupList.forEach(function(e){e.getHeadersAndRows().forEach(function(e){var o=e.getElement();t.parentNode.insertBefore(o,t.nextSibling),e.initialize(),t=o})}):e.rows.forEach(function(e){var o=e.getElement();t.parentNode.insertBefore(o,t.nextSibling),e.initialize(),t=o}),this.groupManager.table.rowManager.setDisplayRows(this.groupManager.updateGroupRows(),this.groupManager.getDisplayIndex()),this.groupManager.table.rowManager.checkClassicModeGroupHeaderWidth()}this.groupManager.table.options.groupVisibilityChanged.call(this.table,this.getComponent(),!0)},S.prototype._visSet=function(){var e=[];"function"==typeof this.visible&&(this.rows.forEach(function(t){e.push(t.getData())}),this.visible=this.visible(this.key,this.getRowCount(),e,this.getComponent()))},S.prototype.getRowGroup=function(e){var t=!1;return this.groupList.length?this.groupList.forEach(function(o){var i=o.getRowGroup(e);i&&(t=i)}):this.rows.find(function(t){return t===e})&&(t=this),t},S.prototype.getSubGroups=function(e){var t=[];return this.groupList.forEach(function(o){t.push(e?o.getComponent():o)}),t},S.prototype.getRows=function(e){var t=[];return this.rows.forEach(function(o){t.push(e?o.getComponent():o)}),t},S.prototype.generateGroupHeaderContents=function(){var e=[];for(this.rows.forEach(function(t){e.push(t.getData())}),this.elementContents=this.generator(this.key,this.getRowCount(),e,this.getComponent());this.element.firstChild;)this.element.removeChild(this.element.firstChild);"string"==typeof this.elementContents?this.element.innerHTML=this.elementContents:this.element.appendChild(this.elementContents),this.element.insertBefore(this.arrowElement,this.element.firstChild)},S.prototype.getElement=function(){this.addBindingsd=!1,this._visSet(),this.visible?this.element.classList.add("tabulator-group-visible"):this.element.classList.remove("tabulator-group-visible");for(var e=0;ei.length&&console.warn("Error creating group headers, groupHeader array is shorter than groupBy array"),e.headerGenerator=[function(){return""}],this.startOpen=[function(){return!1}],e.table.modules.localize.bind("groups|item",function(t,o){e.headerGenerator[0]=function(e,i,n){return(void 0===e?"":e)+"("+i+" "+(1===i?t:o.groups.items)+")"}}),this.groupIDLookups=[],Array.isArray(t)||t)this.table.modExists("columnCalcs")&&"table"!=this.table.options.columnCalcs&&"both"!=this.table.options.columnCalcs&&this.table.modules.columnCalcs.removeCalcs();else if(this.table.modExists("columnCalcs")&&"group"!=this.table.options.columnCalcs){var n=this.table.columnManager.getRealColumns();n.forEach(function(t){t.definition.topCalc&&e.table.modules.columnCalcs.initializeTopRow(),t.definition.bottomCalc&&e.table.modules.columnCalcs.initializeBottomRow()})}Array.isArray(t)||(t=[t]),t.forEach(function(t,o){var i,n;"function"==typeof t?i=t:(n=e.table.columnManager.getColumnByField(t),i=n?function(e){return n.getFieldValue(e)}:function(e){return e[t]}),e.groupIDLookups.push({field:"function"!=typeof t&&t,func:i,values:!!e.allowedValues&&e.allowedValues[o]})}),o&&(Array.isArray(o)||(o=[o]),o.forEach(function(e){e="function"==typeof e?e:function(){return!0}}),e.startOpen=o),i&&(e.headerGenerator=Array.isArray(i)?i:[i]),this.initialized=!0},H.prototype.setDisplayIndex=function(e){this.displayIndex=e},H.prototype.getDisplayIndex=function(){return this.displayIndex},H.prototype.getRows=function(e){return this.groupIDLookups.length?(this.table.options.dataGrouping.call(this.table),this.generateGroups(e),this.table.options.dataGrouped&&this.table.options.dataGrouped.call(this.table,this.getGroups(!0)),this.updateGroupRows()):e.slice(0)},H.prototype.getGroups=function(e){var t=[];return this.groupList.forEach(function(o){t.push(e?o.getComponent():o)}),t},H.prototype.getChildGroups=function(e){var t=this,o=[];return e||(e=this),e.groupList.forEach(function(e){e.groupList.length?o=o.concat(t.getChildGroups(e)):o.push(e)}),o},H.prototype.wipe=function(){this.groupList.forEach(function(e){e.wipe()})},H.prototype.pullGroupListData=function(e){var t=this,o=[];return e.forEach(function(e){var i={};i.level=0,i.rowCount=0,i.headerContent="";var n=[];e.hasSubGroups?(n=t.pullGroupListData(e.groupList),i.level=e.level,i.rowCount=n.length-e.groupList.length,i.headerContent=e.generator(e.key,i.rowCount,e.rows,e),o.push(i),o=o.concat(n)):(i.level=e.level,i.headerContent=e.generator(e.key,e.rows.length,e.rows,e),i.rowCount=e.getRows().length,o.push(i),e.getRows().forEach(function(e){o.push(e.getData("data"))}))}),o},H.prototype.getGroupedData=function(){return this.pullGroupListData(this.groupList)},H.prototype.getRowGroup=function(e){var t=!1;return this.groupList.forEach(function(o){var i=o.getRowGroup(e);i&&(t=i)}),t},H.prototype.countGroups=function(){return this.groupList.length},H.prototype.generateGroups=function(e){var t=this,o=t.groups;t.groups={},t.groupList=[],this.allowedValues&&this.allowedValues[0]?(this.allowedValues[0].forEach(function(e){t.createGroup(e,0,o)}),e.forEach(function(e){t.assignRowToExistingGroup(e,o)})):e.forEach(function(e){t.assignRowToGroup(e,o)})},H.prototype.createGroup=function(e,t,o){var i,n=t+"_"+e;o=o||[],i=new S(this,!1,t,e,this.groupIDLookups[0].field,this.headerGenerator[0],o[n]),this.groups[n]=i,this.groupList.push(i)},H.prototype.assignRowToExistingGroup=function(e,t){var o=this.groupIDLookups[0].func(e.getData()),i="0_"+o;this.groups[i]&&this.groups[i].addRow(e)},H.prototype.assignRowToGroup=function(e,t){var o=this.groupIDLookups[0].func(e.getData()),i=!this.groups["0_"+o];return i&&this.createGroup(o,0,t),this.groups["0_"+o].addRow(e),!i},H.prototype.updateGroupRows=function(e){var t=this,o=[];if(t.groupList.forEach(function(e){o=o.concat(e.getHeadersAndRows())}),e){var i=t.table.rowManager.setDisplayRows(o,this.getDisplayIndex());!0!==i&&this.setDisplayIndex(i),t.table.rowManager.refreshActiveData("group",!0,!0)}return o},H.prototype.scrollHeaders=function(e){e+="px",this.groupList.forEach(function(t){t.scrollHeader(e)})},H.prototype.removeGroup=function(e){var t,o=e.level+"_"+e.key;this.groups[o]&&(delete this.groups[o],(t=this.groupList.indexOf(e))>-1&&this.groupList.splice(t,1))},d.prototype.registerModule("groupRows",H);var z=function(e){this.table=e,this.history=[],this.index=-1};z.prototype.clear=function(){this.history=[],this.index=-1},z.prototype.action=function(e,t,o){this.history=this.history.slice(0,this.index+1),this.history.push({type:e,component:t,data:o}),this.index++},z.prototype.getHistoryUndoSize=function(){return this.index+1},z.prototype.getHistoryRedoSize=function(){return this.history.length-(this.index+1)},z.prototype.undo=function(){if(this.index>-1){var e=this.history[this.index];return this.undoers[e.type].call(this,e),this.index--,this.table.options.historyUndo.call(this.table,e.type,e.component.getComponent(),e.data),!0}return console.warn("History Undo Error - No more history to undo"),!1},z.prototype.redo=function(){if(this.history.length-1>this.index){this.index++;var e=this.history[this.index];return this.redoers[e.type].call(this,e),this.table.options.historyRedo.call(this.table,e.type,e.component.getComponent(),e.data),!0}return console.warn("History Redo Error - No more history to redo"),!1},z.prototype.undoers={cellEdit:function(e){e.component.setValueProcessData(e.data.oldValue)},rowAdd:function(e){e.component.deleteActual()},rowDelete:function(e){var t=this.table.rowManager.addRowActual(e.data.data,e.data.pos,e.data.index);this.table.options.groupBy&&this.table.modExists("groupRows")&&this.table.modules.groupRows.updateGroupRows(!0),this._rebindRow(e.component,t)},rowMove:function(e){ +this.table.rowManager.moveRowActual(e.component,this.table.rowManager.rows[e.data.posFrom],!e.data.after),this.table.rowManager.redraw()}},z.prototype.redoers={cellEdit:function(e){e.component.setValueProcessData(e.data.newValue)},rowAdd:function(e){var t=this.table.rowManager.addRowActual(e.data.data,e.data.pos,e.data.index);this.table.options.groupBy&&this.table.modExists("groupRows")&&this.table.modules.groupRows.updateGroupRows(!0),this._rebindRow(e.component,t)},rowDelete:function(e){e.component.deleteActual()},rowMove:function(e){this.table.rowManager.moveRowActual(e.component,this.table.rowManager.rows[e.data.posTo],e.data.after),this.table.rowManager.redraw()}},z.prototype._rebindRow=function(e,t){this.history.forEach(function(o){if(o.component instanceof a)o.component===e&&(o.component=t);else if(o.component instanceof c&&o.component.row===e){var i=o.component.column.getField();i&&(o.component=t.getCell(i))}})},d.prototype.registerModule("history",z);var A=function(e){this.table=e,this.fieldIndex=[],this.hasIndex=!1};A.prototype.parseTable=function(){var e=this,t=e.table.element,o=e.table.options,i=(o.columns,t.getElementsByTagName("th")),n=t.getElementsByTagName("tbody")[0],s=[];e.hasIndex=!1,e.table.options.htmlImporting.call(this.table),n=n?n.getElementsByTagName("tr"):[],e._extractOptions(t,o),i.length?e._extractHeaders(i,n):e._generateBlankHeaders(i,n);for(var r=0;r-1&&e.pressedKeys.splice(i,1)}},this.table.element.addEventListener("keydown",this.keyupBinding),this.table.element.addEventListener("keyup",this.keydownBinding)},_.prototype.clearBindings=function(){this.keyupBinding&&this.table.element.removeEventListener("keydown",this.keyupBinding),this.keydownBinding&&this.table.element.removeEventListener("keyup",this.keydownBinding)},_.prototype.checkBinding=function(e,t){var o=this,i=!0;return e.ctrlKey==t.ctrl&&e.shiftKey==t.shift&&e.metaKey==t.meta&&(t.keys.forEach(function(e){-1==o.pressedKeys.indexOf(e)&&(i=!1)}),i&&t.action.call(o,e),!0)},_.prototype.bindings={navPrev:"shift + 9",navNext:9,navUp:38,navDown:40,scrollPageUp:33,scrollPageDown:34,scrollToStart:36,scrollToEnd:35,undo:"ctrl + 90",redo:"ctrl + 89",copyToClipboard:"ctrl + 67"},_.prototype.actions={keyBlock:function(e){e.stopPropagation(),e.preventDefault()},scrollPageUp:function(e){var t=this.table.rowManager,o=t.scrollTop-t.height;t.element.scrollHeight;e.preventDefault(),t.displayRowsCount&&(o>=0?t.element.scrollTop=o:t.scrollToRow(t.getDisplayRows()[0])),this.table.element.focus()},scrollPageDown:function(e){var t=this.table.rowManager,o=t.scrollTop+t.height,i=t.element.scrollHeight;e.preventDefault(),t.displayRowsCount&&(o<=i?t.element.scrollTop=o:t.scrollToRow(t.getDisplayRows()[t.displayRowsCount-1])),this.table.element.focus()},scrollToStart:function(e){var t=this.table.rowManager;e.preventDefault(),t.displayRowsCount&&t.scrollToRow(t.getDisplayRows()[0]),this.table.element.focus()},scrollToEnd:function(e){var t=this.table.rowManager;e.preventDefault(),t.displayRowsCount&&t.scrollToRow(t.getDisplayRows()[t.displayRowsCount-1]),this.table.element.focus()},navPrev:function(e){var t=!1;this.table.modExists("edit")&&(t=this.table.modules.edit.currentCell)&&(e.preventDefault(),t.nav().prev())},navNext:function(e){var t,o=!1,i=this.table.options.tabEndNewRow;this.table.modExists("edit")&&(o=this.table.modules.edit.currentCell)&&(e.preventDefault(),t=o.nav(),t.next()||i&&(o.getElement().firstChild.blur(),i=!0===i?this.table.addRow({}):"function"==typeof i?this.table.addRow(i(o.row.getComponent())):this.table.addRow(Object.assign({},i)),i.then(function(){setTimeout(function(){t.next()})})))},navLeft:function(e){var t=!1;this.table.modExists("edit")&&(t=this.table.modules.edit.currentCell)&&(e.preventDefault(),t.nav().left())},navRight:function(e){var t=!1;this.table.modExists("edit")&&(t=this.table.modules.edit.currentCell)&&(e.preventDefault(),t.nav().right())},navUp:function(e){var t=!1;this.table.modExists("edit")&&(t=this.table.modules.edit.currentCell)&&(e.preventDefault(),t.nav().up())},navDown:function(e){var t=!1;this.table.modExists("edit")&&(t=this.table.modules.edit.currentCell)&&(e.preventDefault(),t.nav().down())},undo:function(e){this.table.options.history&&this.table.modExists("history")&&this.table.modExists("edit")&&(this.table.modules.edit.currentCell||(e.preventDefault(),this.table.modules.history.undo()))},redo:function(e){this.table.options.history&&this.table.modExists("history")&&this.table.modExists("edit")&&(this.table.modules.edit.currentCell||(e.preventDefault(),this.table.modules.history.redo()))},copyToClipboard:function(e){this.table.modules.edit.currentCell||this.table.modExists("clipboard",!0)&&this.table.modules.clipboard.copy(!1,!0)}},d.prototype.registerModule("keybindings",_);var P=function(e){this.table=e,this.menuEl=!1,this.blurEvent=this.hideMenu.bind(this),this.escEvent=this.escMenu.bind(this),this.nestedMenuBlock=!1};P.prototype.initializeColumnHeader=function(e){var t,o=this;e.definition.headerContextMenu&&e.getElement().addEventListener("contextmenu",function(t){var i="function"==typeof e.definition.headerContextMenu?e.definition.headerContextMenu(e.getComponent()):e.definition.headerContextMenu;t.preventDefault(),o.loadMenu(t,e,i)}),e.definition.headerMenu&&(t=document.createElement("span"),t.classList.add("tabulator-header-menu-button"),t.innerHTML="⋮",t.addEventListener("click",function(t){var i="function"==typeof e.definition.headerMenu?e.definition.headerMenu(e.getComponent()):e.definition.headerMenu;t.stopPropagation(),t.preventDefault(),o.loadMenu(t,e,i)}),e.titleElement.insertBefore(t,e.titleElement.firstChild))},P.prototype.initializeCell=function(e){var t=this;e.getElement().addEventListener("contextmenu",function(o){var i="function"==typeof e.column.definition.contextMenu?e.column.definition.contextMenu(e.getComponent()):e.column.definition.contextMenu;o.stopImmediatePropagation(),t.loadMenu(o,e,i)})},P.prototype.initializeRow=function(e){var t=this;e.getElement().addEventListener("contextmenu",function(o){var i="function"==typeof t.table.options.rowContextMenu?t.table.options.rowContextMenu(e.getComponent()):t.table.options.rowContextMenu;t.loadMenu(o,e,i)})},P.prototype.initializeGroup=function(e){var t=this;e.getElement().addEventListener("contextmenu",function(o){var i="function"==typeof t.table.options.groupContextMenu?t.table.options.groupContextMenu(e.getComponent()):t.table.options.groupContextMenu;t.loadMenu(o,e,i)})},P.prototype.loadMenu=function(e,t,o){var i=this,n=Math.max(document.body.offsetHeight,window.innerHeight);if(e.preventDefault(),o&&o.length){if(this.nestedMenuBlock){if(this.isOpen())return}else this.nestedMenuBlock=setTimeout(function(){i.nestedMenuBlock=!1},100);this.hideMenu(),this.menuEl=document.createElement("div"),this.menuEl.classList.add("tabulator-menu"),o.forEach(function(e){var o=document.createElement("div"),n=e.label,s=e.disabled;e.separator?o.classList.add("tabulator-menu-separator"):(o.classList.add("tabulator-menu-item"),"function"==typeof n&&(n=n(t.getComponent())),n instanceof Node?o.appendChild(n):o.innerHTML=n,"function"==typeof s&&(s=s(t.getComponent())),s?(o.classList.add("tabulator-menu-item-disabled"),o.addEventListener("click",function(e){e.stopPropagation()})):o.addEventListener("click",function(o){i.hideMenu(),e.action(o,t.getComponent())})),i.menuEl.appendChild(o)}),this.menuEl.style.top=e.pageY+"px",this.menuEl.style.left=e.pageX+"px",document.body.addEventListener("click",this.blurEvent),this.table.rowManager.element.addEventListener("scroll",this.blurEvent),setTimeout(function(){document.body.addEventListener("contextmenu",i.blurEvent)},100),document.body.addEventListener("keydown",this.escEvent),document.body.appendChild(this.menuEl),e.pageX+this.menuEl.offsetWidth>=document.body.offsetWidth&&(this.menuEl.style.left="",this.menuEl.style.right=document.body.offsetWidth-e.pageX+"px"),e.pageY+this.menuEl.offsetHeight>=n&&(this.menuEl.style.top="",this.menuEl.style.bottom=n-e.pageY+"px")}},P.prototype.isOpen=function(){return!!this.menuEl.parentNode},P.prototype.escMenu=function(e){27==e.keyCode&&this.hideMenu()},P.prototype.hideMenu=function(){this.menuEl.parentNode&&this.menuEl.parentNode.removeChild(this.menuEl),this.escEvent&&document.body.removeEventListener("keydown",this.escEvent),this.blurEvent&&(document.body.removeEventListener("click",this.blurEvent),document.body.removeEventListener("contextmenu",this.blurEvent),this.table.rowManager.element.removeEventListener("scroll",this.blurEvent))},P.prototype.menus={},d.prototype.registerModule("menu",P);var F=function(e){this.table=e,this.placeholderElement=this.createPlaceholderElement(),this.hoverElement=!1,this.checkTimeout=!1,this.checkPeriod=250,this.moving=!1,this.toCol=!1,this.toColAfter=!1,this.startX=0,this.autoScrollMargin=40,this.autoScrollStep=5,this.autoScrollTimeout=!1,this.touchMove=!1,this.moveHover=this.moveHover.bind(this),this.endMove=this.endMove.bind(this)};F.prototype.createPlaceholderElement=function(){var e=document.createElement("div");return e.classList.add("tabulator-col"),e.classList.add("tabulator-col-placeholder"),e},F.prototype.initializeColumn=function(e){var t,o=this,i={};e.modules.frozen||(t=e.getElement(),i.mousemove=function(i){e.parent===o.moving.parent&&((o.touchMove?i.touches[0].pageX:i.pageX)-d.prototype.helpers.elOffset(t).left+o.table.columnManager.element.scrollLeft>e.getWidth()/2?o.toCol===e&&o.toColAfter||(t.parentNode.insertBefore(o.placeholderElement,t.nextSibling),o.moveColumn(e,!0)):(o.toCol!==e||o.toColAfter)&&(t.parentNode.insertBefore(o.placeholderElement,t),o.moveColumn(e,!1)))}.bind(o),t.addEventListener("mousedown",function(t){o.touchMove=!1,1===t.which&&(o.checkTimeout=setTimeout(function(){o.startMove(t,e)},o.checkPeriod))}),t.addEventListener("mouseup",function(e){1===e.which&&o.checkTimeout&&clearTimeout(o.checkTimeout)}),o.bindTouchEvents(e)),e.modules.moveColumn=i},F.prototype.bindTouchEvents=function(e){var t,o,i,n,s,r,a,l=this,c=e.getElement(),u=!1;c.addEventListener("touchstart",function(c){l.checkTimeout=setTimeout(function(){l.touchMove=!0,t=e,o=e.nextColumn(),n=o?o.getWidth()/2:0,i=e.prevColumn(),s=i?i.getWidth()/2:0,r=0,a=0,u=!1,l.startMove(c,e)},l.checkPeriod)},{passive:!0}),c.addEventListener("touchmove",function(c){var d,h;l.moving&&(l.moveHover(c),u||(u=c.touches[0].pageX),d=c.touches[0].pageX-u,d>0?o&&d-r>n&&(h=o)!==e&&(u=c.touches[0].pageX,h.getElement().parentNode.insertBefore(l.placeholderElement,h.getElement().nextSibling),l.moveColumn(h,!0)):i&&-d-a>s&&(h=i)!==e&&(u=c.touches[0].pageX,h.getElement().parentNode.insertBefore(l.placeholderElement,h.getElement()),l.moveColumn(h,!1)),h&&(t=h,o=h.nextColumn(),r=n,n=o?o.getWidth()/2:0,i=h.prevColumn(),a=s,s=i?i.getWidth()/2:0))},{passive:!0}),c.addEventListener("touchend",function(e){l.checkTimeout&&clearTimeout(l.checkTimeout),l.moving&&l.endMove(e)})},F.prototype.startMove=function(e,t){var o=t.getElement();this.moving=t,this.startX=(this.touchMove?e.touches[0].pageX:e.pageX)-d.prototype.helpers.elOffset(o).left,this.table.element.classList.add("tabulator-block-select"),this.placeholderElement.style.width=t.getWidth()+"px",this.placeholderElement.style.height=t.getHeight()+"px",o.parentNode.insertBefore(this.placeholderElement,o),o.parentNode.removeChild(o),this.hoverElement=o.cloneNode(!0),this.hoverElement.classList.add("tabulator-moving"),this.table.columnManager.getElement().appendChild(this.hoverElement),this.hoverElement.style.left="0",this.hoverElement.style.bottom="0",this.touchMove||(this._bindMouseMove(),document.body.addEventListener("mousemove",this.moveHover),document.body.addEventListener("mouseup",this.endMove)),this.moveHover(e)},F.prototype._bindMouseMove=function(){this.table.columnManager.columnsByIndex.forEach(function(e){e.modules.moveColumn.mousemove&&e.getElement().addEventListener("mousemove",e.modules.moveColumn.mousemove)})},F.prototype._unbindMouseMove=function(){this.table.columnManager.columnsByIndex.forEach(function(e){e.modules.moveColumn.mousemove&&e.getElement().removeEventListener("mousemove",e.modules.moveColumn.mousemove)})},F.prototype.moveColumn=function(e,t){var o=this.moving.getCells();this.toCol=e,this.toColAfter=t,t?e.getCells().forEach(function(e,t){var i=e.getElement();i.parentNode.insertBefore(o[t].getElement(),i.nextSibling)}):e.getCells().forEach(function(e,t){var i=e.getElement();i.parentNode.insertBefore(o[t].getElement(),i)})},F.prototype.endMove=function(e){(1===e.which||this.touchMove)&&(this._unbindMouseMove(),this.placeholderElement.parentNode.insertBefore(this.moving.getElement(),this.placeholderElement.nextSibling),this.placeholderElement.parentNode.removeChild(this.placeholderElement),this.hoverElement.parentNode.removeChild(this.hoverElement),this.table.element.classList.remove("tabulator-block-select"),this.toCol&&this.table.columnManager.moveColumnActual(this.moving,this.toCol,this.toColAfter),this.moving=!1,this.toCol=!1,this.toColAfter=!1,this.touchMove||(document.body.removeEventListener("mousemove",this.moveHover),document.body.removeEventListener("mouseup",this.endMove)))},F.prototype.moveHover=function(e){var t,o=this,i=o.table.columnManager.getElement(),n=i.scrollLeft,s=(o.touchMove?e.touches[0].pageX:e.pageX)-d.prototype.helpers.elOffset(i).left+n;o.hoverElement.style.left=s-o.startX+"px",s-ne.getHeight()/2){if(t.toRow!==e||!t.toRowAfter){var i=e.getElement();i.parentNode.insertBefore(t.placeholderElement,i.nextSibling),t.moveRow(e,!0)}}else if(t.toRow!==e||t.toRowAfter){var i=e.getElement();i.previousSibling&&(i.parentNode.insertBefore(t.placeholderElement,i),t.moveRow(e,!1))}}.bind(t),e.modules.moveRow=o},N.prototype.initializeRow=function(e){var t,o=this,i={};i.mouseup=function(t){o.tableRowDrop(t,e)}.bind(o),i.mousemove=function(t){if(t.pageY-d.prototype.helpers.elOffset(e.element).top+o.table.rowManager.element.scrollTop>e.getHeight()/2){if(o.toRow!==e||!o.toRowAfter){var i=e.getElement();i.parentNode.insertBefore(o.placeholderElement,i.nextSibling),o.moveRow(e,!0)}}else if(o.toRow!==e||o.toRowAfter){var i=e.getElement();i.parentNode.insertBefore(o.placeholderElement,i),o.moveRow(e,!1)}}.bind(o),this.hasHandle||(t=e.getElement(),t.addEventListener("mousedown",function(t){1===t.which&&(o.checkTimeout=setTimeout(function(){o.startMove(t,e)},o.checkPeriod))}),t.addEventListener("mouseup",function(e){1===e.which&&o.checkTimeout&&clearTimeout(o.checkTimeout)}),this.bindTouchEvents(e,e.getElement())),e.modules.moveRow=i},N.prototype.initializeCell=function(e){var t=this,o=e.getElement();o.addEventListener("mousedown",function(o){1===o.which&&(t.checkTimeout=setTimeout(function(){t.startMove(o,e.row)},t.checkPeriod))}),o.addEventListener("mouseup",function(e){1===e.which&&t.checkTimeout&&clearTimeout(t.checkTimeout)}),this.bindTouchEvents(e.row,e.getElement())},N.prototype.bindTouchEvents=function(e,t){var o,i,n,s,r,a,l,c=this,u=!1;t.addEventListener("touchstart",function(t){c.checkTimeout=setTimeout(function(){c.touchMove=!0,o=e,i=e.nextRow(),s=i?i.getHeight()/2:0,n=e.prevRow(),r=n?n.getHeight()/2:0,a=0,l=0,u=!1,c.startMove(t,e)},c.checkPeriod)},{passive:!0}),this.moving,this.toRow,this.toRowAfter,t.addEventListener("touchmove",function(t){var d,h;c.moving&&(t.preventDefault(),c.moveHover(t),u||(u=t.touches[0].pageY),d=t.touches[0].pageY-u,d>0?i&&d-a>s&&(h=i)!==e&&(u=t.touches[0].pageY,h.getElement().parentNode.insertBefore(c.placeholderElement,h.getElement().nextSibling),c.moveRow(h,!0)):n&&-d-l>r&&(h=n)!==e&&(u=t.touches[0].pageY,h.getElement().parentNode.insertBefore(c.placeholderElement,h.getElement()),c.moveRow(h,!1)),h&&(o=h,i=h.nextRow(),a=s,s=i?i.getHeight()/2:0,n=h.prevRow(),l=r,r=n?n.getHeight()/2:0))}),t.addEventListener("touchend",function(e){c.checkTimeout&&clearTimeout(c.checkTimeout),c.moving&&(c.endMove(e),c.touchMove=!1)})},N.prototype._bindMouseMove=function(){this.table.rowManager.getDisplayRows().forEach(function(e){"row"!==e.type&&"group"!==e.type||!e.modules.moveRow.mousemove||e.getElement().addEventListener("mousemove",e.modules.moveRow.mousemove)})},N.prototype._unbindMouseMove=function(){this.table.rowManager.getDisplayRows().forEach(function(e){"row"!==e.type&&"group"!==e.type||!e.modules.moveRow.mousemove||e.getElement().removeEventListener("mousemove",e.modules.moveRow.mousemove)})},N.prototype.startMove=function(e,t){var o=t.getElement();this.setStartPosition(e,t),this.moving=t,this.table.element.classList.add("tabulator-block-select"),this.placeholderElement.style.width=t.getWidth()+"px",this.placeholderElement.style.height=t.getHeight()+"px",this.connection?(this.table.element.classList.add("tabulator-movingrow-sending"),this.connectToTables(t)):(o.parentNode.insertBefore(this.placeholderElement,o),o.parentNode.removeChild(o)),this.hoverElement=o.cloneNode(!0),this.hoverElement.classList.add("tabulator-moving"),this.connection?(document.body.appendChild(this.hoverElement),this.hoverElement.style.left="0",this.hoverElement.style.top="0",this.hoverElement.style.width=this.table.element.clientWidth+"px",this.hoverElement.style.whiteSpace="nowrap",this.hoverElement.style.overflow="hidden",this.hoverElement.style.pointerEvents="none"):(this.table.rowManager.getTableElement().appendChild(this.hoverElement),this.hoverElement.style.left="0",this.hoverElement.style.top="0",this._bindMouseMove()),document.body.addEventListener("mousemove",this.moveHover),document.body.addEventListener("mouseup",this.endMove),this.moveHover(e)},N.prototype.setStartPosition=function(e,t){var o,i,n=this.touchMove?e.touches[0].pageX:e.pageX,s=this.touchMove?e.touches[0].pageY:e.pageY;o=t.getElement(),this.connection?(i=o.getBoundingClientRect(),this.startX=i.left-n+window.pageXOffset,this.startY=i.top-s+window.pageYOffset):this.startY=s-o.getBoundingClientRect().top},N.prototype.endMove=function(e){e&&1!==e.which&&!this.touchMove||(this._unbindMouseMove(),this.connection||(this.placeholderElement.parentNode.insertBefore(this.moving.getElement(),this.placeholderElement.nextSibling),this.placeholderElement.parentNode.removeChild(this.placeholderElement)),this.hoverElement.parentNode.removeChild(this.hoverElement),this.table.element.classList.remove("tabulator-block-select"),this.toRow&&this.table.rowManager.moveRow(this.moving,this.toRow,this.toRowAfter),this.moving=!1,this.toRow=!1,this.toRowAfter=!1,document.body.removeEventListener("mousemove",this.moveHover),document.body.removeEventListener("mouseup",this.endMove),this.connection&&(this.table.element.classList.remove("tabulator-movingrow-sending"),this.disconnectFromTables()))},N.prototype.moveRow=function(e,t){this.toRow=e,this.toRowAfter=t},N.prototype.moveHover=function(e){this.connection?this.moveHoverConnections.call(this,e):this.moveHoverTable.call(this,e)},N.prototype.moveHoverTable=function(e){var t=this.table.rowManager.getElement(),o=t.scrollTop,i=(this.touchMove?e.touches[0].pageY:e.pageY)-t.getBoundingClientRect().top+o;this.hoverElement.style.top=i-this.startY+"px"},N.prototype.moveHoverConnections=function(e){this.hoverElement.style.left=this.startX+(this.touchMove?e.touches[0].pageX:e.pageX)+"px",this.hoverElement.style.top=this.startY+(this.touchMove?e.touches[0].pageY:e.pageY)+"px"},N.prototype.elementRowDrop=function(e,t,o){this.table.options.movableRowsElementDrop&&this.table.options.movableRowsElementDrop(e,t,!!o&&o.getComponent())},N.prototype.connectToTables=function(e){var t,o=this;this.connectionSelectorsTables&&(t=this.table.modules.comms.getConnections(this.connectionSelectorsTables),this.table.options.movableRowsSendingStart.call(this.table,t),this.table.modules.comms.send(this.connectionSelectorsTables,"moveRow","connect",{row:e})),this.connectionSelectorsElements&&(this.connectionElements=[],Array.isArray(this.connectionSelectorsElements)||(this.connectionSelectorsElements=[this.connectionSelectorsElements]),this.connectionSelectorsElements.forEach(function(e){"string"==typeof e?o.connectionElements=o.connectionElements.concat(Array.prototype.slice.call(document.querySelectorAll(e))):o.connectionElements.push(e)}),this.connectionElements.forEach(function(e){var t=function(t){o.elementRowDrop(t,e,o.moving)};e.addEventListener("mouseup",t),e.tabulatorElementDropEvent=t,e.classList.add("tabulator-movingrow-receiving")}))},N.prototype.disconnectFromTables=function(){var e;this.connectionSelectorsTables&&(e=this.table.modules.comms.getConnections(this.connectionSelectorsTables),this.table.options.movableRowsSendingStop.call(this.table,e),this.table.modules.comms.send(this.connectionSelectorsTables,"moveRow","disconnect")),this.connectionElements.forEach(function(e){e.classList.remove("tabulator-movingrow-receiving"),e.removeEventListener("mouseup",e.tabulatorElementDropEvent),delete e.tabulatorElementDropEvent})},N.prototype.connect=function(e,t){var o=this;return this.connectedTable?(console.warn("Move Row Error - Table cannot accept connection, already connected to table:",this.connectedTable),!1):(this.connectedTable=e,this.connectedRow=t,this.table.element.classList.add("tabulator-movingrow-receiving"),o.table.rowManager.getDisplayRows().forEach(function(e){"row"===e.type&&e.modules.moveRow&&e.modules.moveRow.mouseup&&e.getElement().addEventListener("mouseup",e.modules.moveRow.mouseup)}),o.tableRowDropEvent=o.tableRowDrop.bind(o),o.table.element.addEventListener("mouseup",o.tableRowDropEvent),this.table.options.movableRowsReceivingStart.call(this.table,t,e),!0)},N.prototype.disconnect=function(e){var t=this;e===this.connectedTable?(this.connectedTable=!1,this.connectedRow=!1,this.table.element.classList.remove("tabulator-movingrow-receiving"),t.table.rowManager.getDisplayRows().forEach(function(e){"row"===e.type&&e.modules.moveRow&&e.modules.moveRow.mouseup&&e.getElement().removeEventListener("mouseup",e.modules.moveRow.mouseup)}),t.table.element.removeEventListener("mouseup",t.tableRowDropEvent),this.table.options.movableRowsReceivingStop.call(this.table,e)):console.warn("Move Row Error - trying to disconnect from non connected table")},N.prototype.dropComplete=function(e,t,o){var i=!1;if(o){switch(_typeof(this.table.options.movableRowsSender)){case"string":i=this.senders[this.table.options.movableRowsSender];break;case"function":i=this.table.options.movableRowsSender}i?i.call(this,this.moving.getComponent(),t?t.getComponent():void 0,e):this.table.options.movableRowsSender&&console.warn("Mover Row Error - no matching sender found:",this.table.options.movableRowsSender),this.table.options.movableRowsSent.call(this.table,this.moving.getComponent(),t?t.getComponent():void 0,e)}else this.table.options.movableRowsSentFailed.call(this.table,this.moving.getComponent(),t?t.getComponent():void 0,e);this.endMove()},N.prototype.tableRowDrop=function(e,t){var o=!1,i=!1;switch(console.trace("drop"),e.stopImmediatePropagation(),_typeof(this.table.options.movableRowsReceiver)){case"string":o=this.receivers[this.table.options.movableRowsReceiver];break;case"function":o=this.table.options.movableRowsReceiver}o?i=o.call(this,this.connectedRow.getComponent(),t?t.getComponent():void 0,this.connectedTable):console.warn("Mover Row Error - no matching receiver found:",this.table.options.movableRowsReceiver),i?this.table.options.movableRowsReceived.call(this.table,this.connectedRow.getComponent(),t?t.getComponent():void 0,this.connectedTable):this.table.options.movableRowsReceivedFailed.call(this.table,this.connectedRow.getComponent(),t?t.getComponent():void 0,this.connectedTable),this.table.modules.comms.send(this.connectedTable,"moveRow","dropcomplete",{row:t,success:i})},N.prototype.receivers={insert:function(e,t,o){return this.table.addRow(e.getData(),void 0,t),!0},add:function(e,t,o){return this.table.addRow(e.getData()),!0},update:function(e,t,o){return!!t&&(t.update(e.getData()),!0)},replace:function(e,t,o){return!!t&&(this.table.addRow(e.getData(),void 0,t),t.delete(),!0)}},N.prototype.senders={delete:function(e,t,o){e.delete()}},N.prototype.commsReceived=function(e,t,o){switch(t){case"connect":return this.connect(e,o.row);case"disconnect":return this.disconnect(e);case"dropcomplete":return this.dropComplete(e,o.row,o.success)}},d.prototype.registerModule("moveRow",N);var B=function(e){this.table=e,this.allowedTypes=["","data","edit","clipboard"],this.enabled=!0};B.prototype.initializeColumn=function(e){var t=this,o=!1,i={};this.allowedTypes.forEach(function(n){var s,r="mutator"+(n.charAt(0).toUpperCase()+n.slice(1));e.definition[r]&&(s=t.lookupMutator(e.definition[r]))&&(o=!0,i[r]={mutator:s,params:e.definition[r+"Params"]||{}})}),o&&(e.modules.mutate=i)},B.prototype.lookupMutator=function(e){var t=!1;switch(void 0===e?"undefined":_typeof(e)){case"string":this.mutators[e]?t=this.mutators[e]:console.warn("Mutator Error - No such mutator found, ignoring: ",e);break;case"function":t=e}return t},B.prototype.transformRow=function(e,t,o){var i,n=this,s="mutator"+(t.charAt(0).toUpperCase()+t.slice(1));return this.enabled&&n.table.columnManager.traverse(function(n){var r,a,l;n.modules.mutate&&(r=n.modules.mutate[s]||n.modules.mutate.mutator||!1)&&(i=n.getFieldValue(void 0!==o?o:e),"data"!=t&&void 0===i||(l=n.getComponent(),a="function"==typeof r.params?r.params(i,e,t,l):r.params,n.setFieldValue(e,r.mutator(i,e,t,a,l))))}),e},B.prototype.transformCell=function(e,t){var o=e.column.modules.mutate.mutatorEdit||e.column.modules.mutate.mutator||!1,i={};return o?(i=Object.assign(i,e.row.getData()),e.column.setFieldValue(i,t),o.mutator(t,i,"edit",o.params,e.getComponent())):t},B.prototype.enable=function(){this.enabled=!0},B.prototype.disable=function(){this.enabled=!1},B.prototype.mutators={},d.prototype.registerModule("mutator",B);var O=function(e){this.table=e,this.mode="local",this.progressiveLoad=!1,this.size=0,this.page=1,this.count=5,this.max=1,this.displayIndex=0,this.initialLoad=!0,this.pageSizes=[],this.dataReceivedNames={},this.dataSentNames={},this.createElements()};O.prototype.createElements=function(){var e;this.element=document.createElement("span"),this.element.classList.add("tabulator-paginator"),this.pagesElement=document.createElement("span"),this.pagesElement.classList.add("tabulator-pages"),e=document.createElement("button"),e.classList.add("tabulator-page"),e.setAttribute("type","button"),e.setAttribute("role","button"),e.setAttribute("aria-label",""),e.setAttribute("title",""),this.firstBut=e.cloneNode(!0),this.firstBut.setAttribute("data-page","first"),this.prevBut=e.cloneNode(!0),this.prevBut.setAttribute("data-page","prev"),this.nextBut=e.cloneNode(!0),this.nextBut.setAttribute("data-page","next"),this.lastBut=e.cloneNode(!0),this.lastBut.setAttribute("data-page","last"),this.table.options.paginationSizeSelector&&(this.pageSizeSelect=document.createElement("select"),this.pageSizeSelect.classList.add("tabulator-page-size"))},O.prototype.generatePageSizeSelectList=function(){var e=this,t=[];if(this.pageSizeSelect){if(Array.isArray(this.table.options.paginationSizeSelector))t=this.table.options.paginationSizeSelector,this.pageSizes=t,-1==this.pageSizes.indexOf(this.size)&&t.unshift(this.size);else if(-1==this.pageSizes.indexOf(this.size)){t=[];for(var o=1;o<5;o++)t.push(this.size*o);this.pageSizes=t}else t=this.pageSizes +;for(;this.pageSizeSelect.firstChild;)this.pageSizeSelect.removeChild(this.pageSizeSelect.firstChild);t.forEach(function(t){var o=document.createElement("option");o.value=t,!0===t?e.table.modules.localize.bind("pagination|all",function(e){o.innerHTML=e}):o.innerHTML=t,e.pageSizeSelect.appendChild(o)}),this.pageSizeSelect.value=this.size}},O.prototype.initialize=function(e){var t,o,i,n=this;this.dataSentNames=Object.assign({},this.paginationDataSentNames),this.dataSentNames=Object.assign(this.dataSentNames,this.table.options.paginationDataSent),this.dataReceivedNames=Object.assign({},this.paginationDataReceivedNames),this.dataReceivedNames=Object.assign(this.dataReceivedNames,this.table.options.paginationDataReceived),n.table.modules.localize.bind("pagination|first",function(e){n.firstBut.innerHTML=e}),n.table.modules.localize.bind("pagination|first_title",function(e){n.firstBut.setAttribute("aria-label",e),n.firstBut.setAttribute("title",e)}),n.table.modules.localize.bind("pagination|prev",function(e){n.prevBut.innerHTML=e}),n.table.modules.localize.bind("pagination|prev_title",function(e){n.prevBut.setAttribute("aria-label",e),n.prevBut.setAttribute("title",e)}),n.table.modules.localize.bind("pagination|next",function(e){n.nextBut.innerHTML=e}),n.table.modules.localize.bind("pagination|next_title",function(e){n.nextBut.setAttribute("aria-label",e),n.nextBut.setAttribute("title",e)}),n.table.modules.localize.bind("pagination|last",function(e){n.lastBut.innerHTML=e}),n.table.modules.localize.bind("pagination|last_title",function(e){n.lastBut.setAttribute("aria-label",e),n.lastBut.setAttribute("title",e)}),n.firstBut.addEventListener("click",function(){n.setPage(1)}),n.prevBut.addEventListener("click",function(){n.previousPage()}),n.nextBut.addEventListener("click",function(){n.nextPage().then(function(){}).catch(function(){})}),n.lastBut.addEventListener("click",function(){n.setPage(n.max)}),n.table.options.paginationElement&&(n.element=n.table.options.paginationElement),this.pageSizeSelect&&(t=document.createElement("label"),n.table.modules.localize.bind("pagination|page_size",function(e){n.pageSizeSelect.setAttribute("aria-label",e),n.pageSizeSelect.setAttribute("title",e),t.innerHTML=e}),n.element.appendChild(t),n.element.appendChild(n.pageSizeSelect),n.pageSizeSelect.addEventListener("change",function(e){n.setPageSize("true"==n.pageSizeSelect.value||n.pageSizeSelect.value),n.setPage(1).then(function(){}).catch(function(){})})),n.element.appendChild(n.firstBut),n.element.appendChild(n.prevBut),n.element.appendChild(n.pagesElement),n.element.appendChild(n.nextBut),n.element.appendChild(n.lastBut),n.table.options.paginationElement||e||n.table.footerManager.append(n.element,n),n.mode=n.table.options.pagination,n.table.options.paginationSize?n.size=n.table.options.paginationSize:(o=document.createElement("div"),o.classList.add("tabulator-row"),o.style.visibility=e,i=document.createElement("div"),i.classList.add("tabulator-cell"),i.innerHTML="Page Row Test",o.appendChild(i),n.table.rowManager.getTableElement().appendChild(o),n.size=Math.floor(n.table.rowManager.getElement().clientHeight/o.offsetHeight),n.table.rowManager.getTableElement().removeChild(o)),n.count=n.table.options.paginationButtonCount,n.generatePageSizeSelectList()},O.prototype.initializeProgressive=function(e){this.initialize(!0),this.mode="progressive_"+e,this.progressiveLoad=!0},O.prototype.setDisplayIndex=function(e){this.displayIndex=e},O.prototype.getDisplayIndex=function(){return this.displayIndex},O.prototype.setMaxRows=function(e){this.max=e?!0===this.size?1:Math.ceil(e/this.size):1,this.page>this.max&&(this.page=this.max)},O.prototype.reset=function(e,t){return("local"==this.mode||e)&&(this.page=1),t&&(this.initialLoad=!0),!0},O.prototype.setMaxPage=function(e){e=parseInt(e),this.max=e||1,this.page>this.max&&(this.page=this.max,this.trigger())},O.prototype.setPage=function(e){var t=this,o=this;switch(e){case"first":return this.setPage(1);case"prev":return this.previousPage();case"next":return this.nextPage();case"last":return this.setPage(this.max)}return new Promise(function(i,n){e=parseInt(e),e>0&&e<=t.max?(t.page=e,t.trigger().then(function(){i()}).catch(function(){n()}),o.table.options.persistence&&o.table.modExists("persistence",!0)&&o.table.modules.persistence.config.page&&o.table.modules.persistence.save("page")):(console.warn("Pagination Error - Requested page is out of range of 1 - "+t.max+":",e),n())})},O.prototype.setPageToRow=function(e){var t=this;return new Promise(function(o,i){var n=t.table.rowManager.getDisplayRows(t.displayIndex-1),s=n.indexOf(e);if(s>-1){var r=!0===t.size?1:Math.ceil((s+1)/t.size);t.setPage(r).then(function(){o()}).catch(function(){i()})}else console.warn("Pagination Error - Requested row is not visible"),i()})},O.prototype.setPageSize=function(e){!0!==e&&(e=parseInt(e)),e>0&&(this.size=e),this.pageSizeSelect&&this.generatePageSizeSelectList(),this.table.options.persistence&&this.table.modExists("persistence",!0)&&this.table.modules.persistence.config.page&&this.table.modules.persistence.save("page")},O.prototype._setPageButtons=function(){for(var e=this,t=Math.floor((this.count-1)/2),o=Math.ceil((this.count-1)/2),i=this.max-this.page+t+10&&s<=e.max&&e.pagesElement.appendChild(e._generatePageButton(s));this.footerRedraw()},O.prototype._generatePageButton=function(e){var t=this,o=document.createElement("button");return o.classList.add("tabulator-page"),e==t.page&&o.classList.add("active"),o.setAttribute("type","button"),o.setAttribute("role","button"),t.table.modules.localize.bind("pagination|page_title",function(t){o.setAttribute("aria-label",t+" "+e),o.setAttribute("title",t+" "+e)}),o.setAttribute("data-page",e),o.textContent=e,o.addEventListener("click",function(o){t.setPage(e)}),o},O.prototype.previousPage=function(){var e=this;return new Promise(function(t,o){e.page>1?(e.page--,e.trigger().then(function(){t()}).catch(function(){o()}),e.table.options.persistence&&e.table.modExists("persistence",!0)&&e.table.modules.persistence.config.page&&e.table.modules.persistence.save("page")):(console.warn("Pagination Error - Previous page would be less than page 1:",0),o())})},O.prototype.nextPage=function(){var e=this;return new Promise(function(t,o){e.pagen?i.splice(n,0,e):i.push(e))}),i},I.prototype._findColumn=function(e,t){var o=t.columns?"group":t.field?"field":"object";return e.find(function(e){switch(o){case"group":return e.title===t.title&&e.columns.length===t.columns.length;case"field":return e.field===t.field;case"object":return e===t}})},I.prototype.save=function(e){var t={};switch(e){case"columns":t=this.parseColumns(this.table.columnManager.getColumns());break;case"filter":t=this.table.modules.filter.getFilters();break;case"sort":t=this.validateSorters(this.table.modules.sort.getSort());break;case"group":t=this.getGroupConfig();break;case"page":t=this.getPageConfig()}this.writeFunc&&this.writeFunc(this.id,e,t)},I.prototype.validateSorters=function(e){return e.forEach(function(e){e.column=e.field,delete e.field}),e},I.prototype.getGroupConfig=function(){return this.config.group&&((!0===this.config.group||this.config.group.groupBy)&&(data.groupBy=this.table.options.groupBy),(!0===this.config.group||this.config.group.groupStartOpen)&&(data.groupStartOpen=this.table.options.groupStartOpen),(!0===this.config.group||this.config.group.groupHeader)&&(data.groupHeader=this.table.options.groupHeader)),data},I.prototype.getPageConfig=function(){var e={};return this.config.page&&((!0===this.config.page||this.config.page.size)&&(e.paginationSize=this.table.modules.page.getPageSize()),(!0===this.config.page||this.config.page.page)&&(e.paginationInitialPage=this.table.modules.page.getPage())),e},I.prototype.parseColumns=function(e){var t=this,o=[];return e.forEach(function(e){var i,n={},s=e.getDefinition();e.isGroup?(n.title=s.title,n.columns=t.parseColumns(e.getColumns())):(n.field=e.getField(),!0===t.config.columns||void 0==t.config.columns?(i=Object.keys(s),i.push("width")):i=t.config.columns,i.forEach(function(t){switch(t){case"width":n.width=e.getWidth();break;case"visible":n.visible=e.visible;break;default:n[t]=s[t]}})),o.push(n)}),o},I.prototype.readers={local:function(e,t){var o=localStorage.getItem(e+"-"+t);return!!o&&JSON.parse(o)},cookie:function(e,t){var o,i,n=document.cookie,s=e+"-"+t,r=n.indexOf(s+"=");return r>-1&&(n=n.substr(r),o=n.indexOf(";"),o>-1&&(n=n.substr(0,o)),i=n.replace(s+"=","")),!!i&&JSON.parse(i)}},I.prototype.writers={local:function(e,t,o){localStorage.setItem(e+"-"+t,JSON.stringify(o))},cookie:function(e,t,o){var i=new Date;i.setDate(i.getDate()+1e4),document.cookie=e+"-"+t+"="+JSON.stringify(o)+"; expires="+i.toUTCString()}},d.prototype.registerModule("persistence",I);var j=function(e){this.table=e,this.element=!1,this.manualBlock=!1};j.prototype.initialize=function(){window.addEventListener("beforeprint",this.replaceTable.bind(this)),window.addEventListener("afterprint",this.cleanup.bind(this))},j.prototype.replaceTable=function(){this.manualBlock||(this.element=document.createElement("div"),this.element.classList.add("tabulator-print-table"),this.element.appendChild(this.table.modules.export.genereateTable(this.table.options.printConfig,this.table.options.printStyled,this.table.options.printRowRange,"print")),this.table.element.style.display="none",this.table.element.parentNode.insertBefore(this.element,this.table.element))},j.prototype.cleanup=function(){document.body.classList.remove("tabulator-print-fullscreen-hide"),this.element&&this.element.parentNode&&(this.element.parentNode.removeChild(this.element),this.table.element.style.display="")},j.prototype.printFullscreen=function(e,t,o){var i,n,s=window.scrollX,r=window.scrollY,a=document.createElement("div"),l=document.createElement("div"),c=this.table.modules.export.genereateTable(void 0!==o?o:this.table.options.printConfig,void 0!==t?t:this.table.options.printStyled,e,"print");this.manualBlock=!0,this.element=document.createElement("div"),this.element.classList.add("tabulator-print-fullscreen"),this.table.options.printHeader&&(a.classList.add("tabulator-print-header"),i="function"==typeof this.table.options.printHeader?this.table.options.printHeader.call(this.table):this.table.options.printHeader,"string"==typeof i?a.innerHTML=i:a.appendChild(i),this.element.appendChild(a)),this.element.appendChild(c),this.table.options.printFooter&&(l.classList.add("tabulator-print-footer"),n="function"==typeof this.table.options.printFooter?this.table.options.printFooter.call(this.table):this.table.options.printFooter,"string"==typeof n?l.innerHTML=n:l.appendChild(n),this.element.appendChild(l)),document.body.classList.add("tabulator-print-fullscreen-hide"),document.body.appendChild(this.element),this.table.options.printFormatter&&this.table.options.printFormatter(this.element,c),window.print(),this.cleanup(),window.scrollTo(s,r),this.manualBlock=!1},d.prototype.registerModule("print",j);var V=function(e){this.table=e,this.data=!1,this.blocked=!1,this.origFuncs={},this.currentVersion=0};V.prototype.watchData=function(e){var t,o=this;this.currentVersion++,t=this.currentVersion,o.unwatchData(),o.data=e,o.origFuncs.push=e.push,Object.defineProperty(o.data,"push",{enumerable:!1,configurable:!0,value:function(){var i=Array.from(arguments);return o.blocked||t!==o.currentVersion||i.forEach(function(e){o.table.rowManager.addRowActual(e,!1)}),o.origFuncs.push.apply(e,arguments)}}),o.origFuncs.unshift=e.unshift,Object.defineProperty(o.data,"unshift",{enumerable:!1,configurable:!0,value:function(){var i=Array.from(arguments);return o.blocked||t!==o.currentVersion||i.forEach(function(e){o.table.rowManager.addRowActual(e,!0)}),o.origFuncs.unshift.apply(e,arguments)}}),o.origFuncs.shift=e.shift,Object.defineProperty(o.data,"shift",{enumerable:!1,configurable:!0,value:function(){var i;return o.blocked||t!==o.currentVersion||o.data.length&&(i=o.table.rowManager.getRowFromDataObject(o.data[0]))&&i.deleteActual(),o.origFuncs.shift.call(e)}}),o.origFuncs.pop=e.pop,Object.defineProperty(o.data,"pop",{enumerable:!1,configurable:!0,value:function(){var i;return o.blocked||t!==o.currentVersion||o.data.length&&(i=o.table.rowManager.getRowFromDataObject(o.data[o.data.length-1]))&&i.deleteActual(),o.origFuncs.pop.call(e)}}),o.origFuncs.splice=e.splice,Object.defineProperty(o.data,"splice",{enumerable:!1,configurable:!0,value:function(){var i,n=Array.from(arguments),s=n[0]<0?e.length+n[0]:n[0],r=n[1],a=!!n[2]&&n.slice(2);if(!o.blocked&&t===o.currentVersion){if(a&&(i=!!e[s]&&o.table.rowManager.getRowFromDataObject(e[s]),i?a.forEach(function(e){o.table.rowManager.addRowActual(e,!0,i,!0)}):(a=a.slice().reverse(),a.forEach(function(e){o.table.rowManager.addRowActual(e,!0,!1,!0)}))),0!==r){var l=e.slice(s,void 0===n[1]?n[1]:s+r);l.forEach(function(e,t){var i=o.table.rowManager.getRowFromDataObject(e);i&&i.deleteActual(t!==l.length-1)})}(a||0!==r)&&o.table.rowManager.reRenderInPosition()}return o.origFuncs.splice.apply(e,arguments)}})},V.prototype.unwatchData=function(){if(!1!==this.data)for(var e in this.origFuncs)Object.defineProperty(this.data,e,{enumerable:!0,configurable:!0,writable:!0,value:this.origFuncs.key})},V.prototype.watchRow=function(e){var t=e.getData();this.blocked=!0;for(var o in t)this.watchKey(e,t,o);this.blocked=!1},V.prototype.watchKey=function(e,t,o){var i=this,n=Object.getOwnPropertyDescriptor(t,o),s=t[o],r=this.currentVersion;Object.defineProperty(t,o,{set:function(t){if(s=t,!i.blocked&&r===i.currentVersion){var a={};a[o]=t,e.updateData(a)}n.set&&n.set(t)},get:function(){return n.get&&n.get(),s}})},V.prototype.unwatchRow=function(e){var t=e.getData();for(var o in t)Object.defineProperty(t,o,{value:t[o]})},V.prototype.block=function(){this.blocked=!0},V.prototype.unblock=function(){this.blocked=!1},d.prototype.registerModule("reactiveData",V);var W=function(e){this.table=e,this.startColumn=!1,this.startX=!1,this.startWidth=!1,this.handle=null,this.prevHandle=null};W.prototype.initializeColumn=function(e,t,o){var i=this,n=!1,s=this.table.options.resizableColumns;if("header"===e&&(n="textarea"==t.definition.formatter||t.definition.variableHeight,t.modules.resize={variableHeight:n}),!0===s||s==e){var r=document.createElement("div");r.className="tabulator-col-resize-handle";var a=document.createElement("div");a.className="tabulator-col-resize-handle prev",r.addEventListener("click",function(e){e.stopPropagation()});var l=function(e){var o=t.getLastColumn();o&&i._checkResizability(o)&&(i.startColumn=t,i._mouseDown(e,o,r))};r.addEventListener("mousedown",l),r.addEventListener("touchstart",l,{passive:!0}),r.addEventListener("dblclick",function(e){var o=t.getLastColumn();o&&i._checkResizability(o)&&(e.stopPropagation(),o.reinitializeWidth(!0))}),a.addEventListener("click",function(e){e.stopPropagation()});var c=function(e){var o,n,s;(o=t.getFirstColumn())&&(n=i.table.columnManager.findColumnIndex(o),(s=n>0&&i.table.columnManager.getColumnByIndex(n-1))&&i._checkResizability(s)&&(i.startColumn=t,i._mouseDown(e,s,a)))};a.addEventListener("mousedown",c),a.addEventListener("touchstart",c,{passive:!0}),a.addEventListener("dblclick",function(e){var o,n,s;(o=t.getFirstColumn())&&(n=i.table.columnManager.findColumnIndex(o),(s=n>0&&i.table.columnManager.getColumnByIndex(n-1))&&i._checkResizability(s)&&(e.stopPropagation(),s.reinitializeWidth(!0)))}),o.appendChild(r),o.appendChild(a)}},W.prototype._checkResizability=function(e){return void 0!==e.definition.resizable?e.definition.resizable:this.table.options.resizableColumns},W.prototype._mouseDown=function(e,t,o){function i(e){t.setWidth(s.startWidth+((void 0===e.screenX?e.touches[0].screenX:e.screenX)-s.startX)),!s.table.browserSlow&&t.modules.resize&&t.modules.resize.variableHeight&&t.checkCellHeights()}function n(e){s.startColumn.modules.edit&&(s.startColumn.modules.edit.blocked=!1),s.table.browserSlow&&t.modules.resize&&t.modules.resize.variableHeight&&t.checkCellHeights(),document.body.removeEventListener("mouseup",n),document.body.removeEventListener("mousemove",i),o.removeEventListener("touchmove",i),o.removeEventListener("touchend",n),s.table.element.classList.remove("tabulator-block-select"),s.table.options.persistence&&s.table.modExists("persistence",!0)&&s.table.modules.persistence.config.columns&&s.table.modules.persistence.save("columns"),s.table.options.columnResized.call(s.table,t.getComponent())}var s=this;s.table.element.classList.add("tabulator-block-select"),e.stopPropagation(),s.startColumn.modules.edit&&(s.startColumn.modules.edit.blocked=!0),s.startX=void 0===e.screenX?e.touches[0].screenX:e.screenX,s.startWidth=t.getWidth(),document.body.addEventListener("mousemove",i),document.body.addEventListener("mouseup",n),o.addEventListener("touchmove",i,{passive:!0}),o.addEventListener("touchend",n)},d.prototype.registerModule("resizeColumns",W);var G=function(e){this.table=e,this.startColumn=!1,this.startY=!1,this.startHeight=!1,this.handle=null,this.prevHandle=null};G.prototype.initializeRow=function(e){var t=this,o=e.getElement(),i=document.createElement("div");i.className="tabulator-row-resize-handle";var n=document.createElement("div");n.className="tabulator-row-resize-handle prev",i.addEventListener("click",function(e){e.stopPropagation()});var s=function(o){t.startRow=e,t._mouseDown(o,e,i)};i.addEventListener("mousedown",s),i.addEventListener("touchstart",s,{passive:!0}),n.addEventListener("click",function(e){e.stopPropagation()});var r=function(o){var i=t.table.rowManager.prevDisplayRow(e);i&&(t.startRow=i,t._mouseDown(o,i,n))};n.addEventListener("mousedown",r),n.addEventListener("touchstart",r,{passive:!0}),o.appendChild(i),o.appendChild(n)},G.prototype._mouseDown=function(e,t,o){function i(e){t.setHeight(s.startHeight+((void 0===e.screenY?e.touches[0].screenY:e.screenY)-s.startY))}function n(e){document.body.removeEventListener("mouseup",i),document.body.removeEventListener("mousemove",i),o.removeEventListener("touchmove",i),o.removeEventListener("touchend",n),s.table.element.classList.remove("tabulator-block-select"),s.table.options.rowResized.call(this.table,t.getComponent())}var s=this;s.table.element.classList.add("tabulator-block-select"),e.stopPropagation(),s.startY=void 0===e.screenY?e.touches[0].screenY:e.screenY,s.startHeight=t.getHeight(),document.body.addEventListener("mousemove",i),document.body.addEventListener("mouseup",n),o.addEventListener("touchmove",i,{passive:!0}),o.addEventListener("touchend",n)},d.prototype.registerModule("resizeRows",G);var U=function(e){this.table=e,this.binding=!1,this.observer=!1,this.containerObserver=!1,this.tableHeight=0,this.tableWidth=0,this.containerHeight=0,this.containerWidth=0,this.autoResize=!1};U.prototype.initialize=function(e){var t,o=this,i=this.table;this.tableHeight=i.element.clientHeight,this.tableWidth=i.element.clientWidth,i.element.parentNode&&(this.containerHeight=i.element.parentNode.clientHeight,this.containerWidth=i.element.parentNode.clientWidth),"undefined"!=typeof ResizeObserver&&"virtual"===i.rowManager.getRenderMode()?(this.autoResize=!0,this.observer=new ResizeObserver(function(e){if(!i.browserMobile||i.browserMobile&&!i.modules.edit.currentCell){var t=Math.floor(e[0].contentRect.height),n=Math.floor(e[0].contentRect.width);o.tableHeight==t&&o.tableWidth==n||(o.tableHeight=t,o.tableWidth=n,i.element.parentNode&&(o.containerHeight=i.element.parentNode.clientHeight,o.containerWidth=i.element.parentNode.clientWidth),i.redraw())}}),this.observer.observe(i.element),t=window.getComputedStyle(i.element),this.table.element.parentNode&&!this.table.rowManager.fixedHeight&&(t.getPropertyValue("max-height")||t.getPropertyValue("min-height"))&&(this.containerObserver=new ResizeObserver(function(e){if(!i.browserMobile||i.browserMobile&&!i.modules.edit.currentCell){var t=Math.floor(e[0].contentRect.height),n=Math.floor(e[0].contentRect.width);o.containerHeight==t&&o.containerWidth==n||(o.containerHeight=t,o.containerWidth=n,o.tableHeight=i.element.clientHeight,o.tableWidth=i.element.clientWidth,i.redraw()),i.redraw()}}),this.containerObserver.observe(this.table.element.parentNode))):(this.binding=function(){(!i.browserMobile||i.browserMobile&&!i.modules.edit.currentCell)&&i.redraw()},window.addEventListener("resize",this.binding))},U.prototype.clearBindings=function(e){this.binding&&window.removeEventListener("resize",this.binding),this.observer&&this.observer.unobserve(this.table.element),this.containerObserver&&this.containerObserver.unobserve(this.table.element.parentNode)},d.prototype.registerModule("resizeTable",U);var Y=function(e){this.table=e,this.columns=[],this.hiddenColumns=[],this.mode="",this.index=0,this.collapseFormatter=[],this.collapseStartOpen=!0,this.collapseHandleColumn=!1};Y.prototype.initialize=function(){var e=this,t=[];this.mode=this.table.options.responsiveLayout,this.collapseFormatter=this.table.options.responsiveLayoutCollapseFormatter||this.formatCollapsedData,this.collapseStartOpen=this.table.options.responsiveLayoutCollapseStartOpen,this.hiddenColumns=[],this.table.columnManager.columnsByIndex.forEach(function(o,i){o.modules.responsive&&o.modules.responsive.order&&o.modules.responsive.visible&&(o.modules.responsive.index=i,t.push(o),o.visible||"collapse"!==e.mode||e.hiddenColumns.push(o))}),t=t.reverse(),t=t.sort(function(e,t){return t.modules.responsive.order-e.modules.responsive.order||t.modules.responsive.index-e.modules.responsive.index}),this.columns=t,"collapse"===this.mode&&this.generateCollapsedContent();for(var o=this.table.columnManager.columnsByIndex,i=Array.isArray(o),n=0,o=i?o:o[Symbol.iterator]();;){var s;if(i){if(n>=o.length)break;s=o[n++]}else{if(n=o.next(),n.done)break;s=n.value}var r=s;if("responsiveCollapse"==r.definition.formatter){this.collapseHandleColumn=r;break}}this.collapseHandleColumn&&(this.hiddenColumns.length?this.collapseHandleColumn.show():this.collapseHandleColumn.hide())},Y.prototype.initializeColumn=function(e){var t=e.getDefinition();e.modules.responsive={order:void 0===t.responsive?1:t.responsive,visible:!1!==t.visible}},Y.prototype.initializeRow=function(e){var t;"calc"!==e.type&&(t=document.createElement("div"),t.classList.add("tabulator-responsive-collapse"),e.modules.responsiveLayout={element:t,open:this.collapseStartOpen},this.collapseStartOpen||(t.style.display="none"))},Y.prototype.layoutRow=function(e){var t=e.getElement();e.modules.responsiveLayout&&(t.appendChild(e.modules.responsiveLayout.element),this.generateCollapsedRowContent(e))},Y.prototype.updateColumnVisibility=function(e,t){e.modules.responsive&&(e.modules.responsive.visible=t,this.initialize())},Y.prototype.hideColumn=function(e){var t=this.hiddenColumns.length;e.hide(!1,!0),"collapse"===this.mode&&(this.hiddenColumns.unshift(e),this.generateCollapsedContent(),this.collapseHandleColumn&&!t&&this.collapseHandleColumn.show())},Y.prototype.showColumn=function(e){var t;e.show(!1,!0),e.setWidth(e.getWidth()),"collapse"===this.mode&&(t=this.hiddenColumns.indexOf(e),t>-1&&this.hiddenColumns.splice(t,1),this.generateCollapsedContent(),this.collapseHandleColumn&&!this.hiddenColumns.length&&this.collapseHandleColumn.hide())},Y.prototype.update=function(){for(var e=this,t=!0;t;){var o="fitColumns"==e.table.modules.layout.getMode()?e.table.columnManager.getFlexBaseWidth():e.table.columnManager.getWidth(),i=(e.table.options.headerVisible?e.table.columnManager.element.clientWidth:e.table.element.clientWidth)-o;if(i<0){var n=e.columns[e.index];n?(e.hideColumn(n),e.index++):t=!1}else{var s=e.columns[e.index-1] +;s&&i>0&&i>=s.getWidth()?(e.showColumn(s),e.index--):t=!1}e.table.rowManager.activeRowsCount||e.table.rowManager.renderEmptyScroll()}},Y.prototype.generateCollapsedContent=function(){var e=this;this.table.rowManager.getDisplayRows().forEach(function(t){e.generateCollapsedRowContent(t)})},Y.prototype.generateCollapsedRowContent=function(e){var t,o;if(e.modules.responsiveLayout){for(t=e.modules.responsiveLayout.element;t.firstChild;)t.removeChild(t.firstChild);o=this.collapseFormatter(this.generateCollapsedRowData(e)),o&&t.appendChild(o)}},Y.prototype.generateCollapsedRowData=function(e){var t,o=this,i=e.getData(),n=[];return this.hiddenColumns.forEach(function(s){var r=s.getFieldValue(i);s.definition.title&&s.field&&(s.modules.format&&o.table.options.responsiveLayoutCollapseUseFormatters?(t={value:!1,data:{},getValue:function(){return r},getData:function(){return i},getElement:function(){return document.createElement("div")},getRow:function(){return e.getComponent()},getColumn:function(){return s.getComponent()}},n.push({title:s.definition.title,value:s.modules.format.formatter.call(o.table.modules.format,t,s.modules.format.params)})):n.push({title:s.definition.title,value:r}))}),n},Y.prototype.formatCollapsedData=function(e){var t=document.createElement("table"),o="";return e.forEach(function(e){var t=document.createElement("div");e.value instanceof Node&&(t.appendChild(e.value),e.value=t.innerHTML),o+=""+e.title+""+e.value+""}),t.innerHTML=o,Object.keys(e).length?t:""},d.prototype.registerModule("responsiveLayout",Y);var q=function(e){this.table=e,this.selecting=!1,this.lastClickedRow=!1,this.selectPrev=[],this.selectedRows=[],this.headerCheckboxElement=null};q.prototype.clearSelectionData=function(e){this.selecting=!1,this.lastClickedRow=!1,this.selectPrev=[],this.selectedRows=[],e||this._rowSelectionChanged()},q.prototype.initializeRow=function(e){var t=this,o=e.getElement(),i=function e(){setTimeout(function(){t.selecting=!1},50),document.body.removeEventListener("mouseup",e)};e.modules.select={selected:!1},t.table.options.selectableCheck.call(this.table,e.getComponent())?(o.classList.add("tabulator-selectable"),o.classList.remove("tabulator-unselectable"),t.table.options.selectable&&"highlight"!=t.table.options.selectable&&("click"===t.table.options.selectableRangeMode?o.addEventListener("click",function(o){if(o.shiftKey){t.table._clearSelection(),t.lastClickedRow=t.lastClickedRow||e;var i=t.table.rowManager.getDisplayRowIndex(t.lastClickedRow),n=t.table.rowManager.getDisplayRowIndex(e),s=i<=n?i:n,r=i>=n?i:n,a=t.table.rowManager.getDisplayRows().slice(0),l=a.splice(s,r-s+1);o.ctrlKey||o.metaKey?(l.forEach(function(o){o!==t.lastClickedRow&&(!0===t.table.options.selectable||t.isRowSelected(e)?t.toggleRow(o):t.selectedRows.lengtht.table.options.selectable&&(l=l.slice(0,t.table.options.selectable)),t.selectRows(l)),t.table._clearSelection()}else o.ctrlKey||o.metaKey?(t.toggleRow(e),t.lastClickedRow=e):(t.deselectRows(void 0,!0),t.selectRows(e),t.lastClickedRow=e)}):(o.addEventListener("click",function(o){t.table.modExists("edit")&&t.table.modules.edit.getCurrentCell()||t.table._clearSelection(),t.selecting||t.toggleRow(e)}),o.addEventListener("mousedown",function(o){if(o.shiftKey)return t.table._clearSelection(),t.selecting=!0,t.selectPrev=[],document.body.addEventListener("mouseup",i),document.body.addEventListener("keyup",i),t.toggleRow(e),!1}),o.addEventListener("mouseenter",function(o){t.selecting&&(t.table._clearSelection(),t.toggleRow(e),t.selectPrev[1]==e&&t.toggleRow(t.selectPrev[0]))}),o.addEventListener("mouseout",function(o){t.selecting&&(t.table._clearSelection(),t.selectPrev.unshift(e))})))):(o.classList.add("tabulator-unselectable"),o.classList.remove("tabulator-selectable"))},q.prototype.toggleRow=function(e){this.table.options.selectableCheck.call(this.table,e.getComponent())&&(e.modules.select&&e.modules.select.selected?this._deselectRow(e):this._selectRow(e))},q.prototype.selectRows=function(e){var t,o=this;switch(void 0===e?"undefined":_typeof(e)){case"undefined":this.table.rowManager.rows.forEach(function(e){o._selectRow(e,!0,!0)}),this._rowSelectionChanged();break;case"string":t=this.table.rowManager.findRow(e),t?this._selectRow(t,!0,!0):this.table.rowManager.getRows(e).forEach(function(e){o._selectRow(e,!0,!0)}),this._rowSelectionChanged();break;default:Array.isArray(e)?(e.forEach(function(e){o._selectRow(e,!0,!0)}),this._rowSelectionChanged()):this._selectRow(e,!1,!0)}},q.prototype._selectRow=function(e,t,o){if(!isNaN(this.table.options.selectable)&&!0!==this.table.options.selectable&&!o&&this.selectedRows.length>=this.table.options.selectable){if(!this.table.options.selectableRollingSelection)return!1;this._deselectRow(this.selectedRows[0])}var i=this.table.rowManager.findRow(e);i?-1==this.selectedRows.indexOf(i)&&(i.modules.select||(i.modules.select={}),i.modules.select.selected=!0,i.modules.select.checkboxEl&&(i.modules.select.checkboxEl.checked=!0),i.getElement().classList.add("tabulator-selected"),this.selectedRows.push(i),this.table.options.dataTreeSelectPropagate&&this.childRowSelection(i,!0),t||this.table.options.rowSelected.call(this.table,i.getComponent()),this._rowSelectionChanged(t)):t||console.warn("Selection Error - No such row found, ignoring selection:"+e)},q.prototype.isRowSelected=function(e){return-1!==this.selectedRows.indexOf(e)},q.prototype.deselectRows=function(e,t){var o,i=this;if(void 0===e){o=i.selectedRows.length;for(var n=0;n-1&&(n.modules.select||(n.modules.select={}),n.modules.select.selected=!1,n.modules.select.checkboxEl&&(n.modules.select.checkboxEl.checked=!1),n.getElement().classList.remove("tabulator-selected"),i.selectedRows.splice(o,1),this.table.options.dataTreeSelectPropagate&&this.childRowSelection(n,!1),t||i.table.options.rowDeselected.call(this.table,n.getComponent()),i._rowSelectionChanged(t)):t||console.warn("Deselection Error - No such row found, ignoring selection:"+e)},q.prototype.getSelectedData=function(){var e=[];return this.selectedRows.forEach(function(t){e.push(t.getData())}),e},q.prototype.getSelectedRows=function(){var e=[];return this.selectedRows.forEach(function(t){e.push(t.getComponent())}),e},q.prototype._rowSelectionChanged=function(e){this.headerCheckboxElement&&(0===this.selectedRows.length?(this.headerCheckboxElement.checked=!1,this.headerCheckboxElement.indeterminate=!1):this.table.rowManager.rows.length===this.selectedRows.length?(this.headerCheckboxElement.checked=!0,this.headerCheckboxElement.indeterminate=!1):(this.headerCheckboxElement.indeterminate=!0,this.headerCheckboxElement.checked=!1)),e||this.table.options.rowSelectionChanged.call(this.table,this.getSelectedData(),this.getSelectedRows())},q.prototype.registerRowSelectCheckbox=function(e,t){e._row.modules.select||(e._row.modules.select={}),e._row.modules.select.checkboxEl=t},q.prototype.registerHeaderSelectCheckbox=function(e){this.headerCheckboxElement=e},q.prototype.childRowSelection=function(e,t){var o=this.table.modules.dataTree.getChildren(e);if(t)for(var i=o,n=Array.isArray(i),s=0,i=n?i:i[Symbol.iterator]();;){var r;if(n){if(s>=i.length)break;r=i[s++]}else{if(s=i.next(),s.done)break;r=s.value}var a=r;this._selectRow(a,!0)}else for(var l=o,c=Array.isArray(l),u=0,l=c?l:l[Symbol.iterator]();;){var d;if(c){if(u>=l.length)break;d=l[u++]}else{if(u=l.next(),u.done)break;d=u.value}var h=d;this._deselectRow(h,!0)}},d.prototype.registerModule("selectRow",q);var X=function(e){this.table=e,this.sortList=[],this.changed=!1};X.prototype.initializeColumn=function(e,t){var o,i,n=this,s=!1;switch(_typeof(e.definition.sorter)){case"string":n.sorters[e.definition.sorter]?s=n.sorters[e.definition.sorter]:console.warn("Sort Error - No such sorter found: ",e.definition.sorter);break;case"function":s=e.definition.sorter}e.modules.sort={sorter:s,dir:"none",params:e.definition.sorterParams||{},startingDir:e.definition.headerSortStartingDir||"asc",tristate:void 0!==e.definition.headerSortTristate?e.definition.headerSortTristate:this.table.options.headerSortTristate},(void 0===e.definition.headerSort?!1!==this.table.options.headerSort:!1!==e.definition.headerSort)&&(o=e.getElement(),o.classList.add("tabulator-sortable"),i=document.createElement("div"),i.classList.add("tabulator-arrow"),t.appendChild(i),o.addEventListener("click",function(t){var o="",i=[],s=!1;if(e.modules.sort){if(e.modules.sort.tristate)o="none"==e.modules.sort.dir?e.modules.sort.startingDir:e.modules.sort.dir==e.modules.sort.startingDir?"asc"==e.modules.sort.dir?"desc":"asc":"none";else switch(e.modules.sort.dir){case"asc":o="desc";break;case"desc":o="asc";break;default:o=e.modules.sort.startingDir}n.table.options.columnHeaderSortMulti&&(t.shiftKey||t.ctrlKey)?(i=n.getSort(),s=i.findIndex(function(t){return t.field===e.getField()}),s>-1?(i[s].dir=o,s!=i.length-1&&(s=i.splice(s,1)[0],"none"!=o&&i.push(s))):"none"!=o&&i.push({column:e,dir:o}),n.setSort(i)):"none"==o?n.clear():n.setSort(e,o),n.table.rowManager.sorterRefresh(!n.sortList.length)}}))},X.prototype.hasChanged=function(){var e=this.changed;return this.changed=!1,e},X.prototype.getSort=function(){var e=this,t=[];return e.sortList.forEach(function(e){e.column&&t.push({column:e.column.getComponent(),field:e.column.getField(),dir:e.dir})}),t},X.prototype.setSort=function(e,t){var o=this,i=[];Array.isArray(e)||(e=[{column:e,dir:t}]),e.forEach(function(e){var t;t=o.table.columnManager.findColumn(e.column),t?(e.column=t,i.push(e),o.changed=!0):console.warn("Sort Warning - Sort field does not exist and is being ignored: ",e.column)}),o.sortList=i,this.table.options.persistence&&this.table.modExists("persistence",!0)&&this.table.modules.persistence.config.sort&&this.table.modules.persistence.save("sort")},X.prototype.clear=function(){this.setSort([])},X.prototype.findSorter=function(e){var t,o=this.table.rowManager.activeRows[0],i="string";if(o&&(o=o.getData(),e.getField()))switch(t=e.getFieldValue(o),void 0===t?"undefined":_typeof(t)){case"undefined":i="string";break;case"boolean":i="boolean";break;default:isNaN(t)||""===t?t.match(/((^[0-9]+[a-z]+)|(^[a-z]+[0-9]+))+$/i)&&(i="alphanum"):i="number"}return this.sorters[i]},X.prototype.sort=function(e){var t=this,o=this.table.options.sortOrderReverse?t.sortList.slice().reverse():t.sortList,i=[],n=[];t.table.options.dataSorting&&t.table.options.dataSorting.call(t.table,t.getSort()),t.clearColumnHeaders(),t.table.options.ajaxSorting?o.forEach(function(e,o){t.setColumnHeader(e.column,e.dir)}):(o.forEach(function(e,o){var n=e.column.modules.sort;e.column&&n&&(n.sorter||(n.sorter=t.findSorter(e.column)),e.params="function"==typeof n.params?n.params(e.column.getComponent(),e.dir):n.params,i.push(e)),t.setColumnHeader(e.column,e.dir)}),i.length&&t._sortItems(e,i)),t.table.options.dataSorted&&(e.forEach(function(e){n.push(e.getComponent())}),t.table.options.dataSorted.call(t.table,t.getSort(),n))},X.prototype.clearColumnHeaders=function(){this.table.columnManager.getRealColumns().forEach(function(e){e.modules.sort&&(e.modules.sort.dir="none",e.getElement().setAttribute("aria-sort","none"))})},X.prototype.setColumnHeader=function(e,t){e.modules.sort.dir=t,e.getElement().setAttribute("aria-sort",t)},X.prototype._sortItems=function(e,t){var o=this,i=t.length-1;e.sort(function(e,n){for(var s,r=i;r>=0;r--){var a=t[r];if(0!==(s=o._sortRow(e,n,a.column,a.dir,a.params)))break}return s})},X.prototype._sortRow=function(e,t,o,i,n){var s,r,a="asc"==i?e:t,l="asc"==i?t:e;return e=o.getFieldValue(a.getData()),t=o.getFieldValue(l.getData()),e=void 0!==e?e:"",t=void 0!==t?t:"",s=a.getComponent(),r=l.getComponent(),o.modules.sort.sorter.call(this,e,t,s,r,o.getComponent(),i,n)},X.prototype.sorters={number:function(e,t,o,i,n,s,r){var a=r.alignEmptyValues,l=r.decimalSeparator||".",c=r.thousandSeparator||",",u=0;if(e=parseFloat(String(e).split(c).join("").split(l).join(".")),t=parseFloat(String(t).split(c).join("").split(l).join(".")),isNaN(e))u=isNaN(t)?0:-1;else{if(!isNaN(t))return e-t;u=1}return("top"===a&&"desc"===s||"bottom"===a&&"asc"===s)&&(u*=-1),u},string:function(e,t,o,i,n,s,r){var a,l=r.alignEmptyValues,c=0;if(e){if(t){switch(_typeof(r.locale)){case"boolean":r.locale&&(a=this.table.modules.localize.getLocale());break;case"string":a=r.locale}return String(e).toLowerCase().localeCompare(String(t).toLowerCase(),a)}c=1}else c=t?-1:0;return("top"===l&&"desc"===s||"bottom"===l&&"asc"===s)&&(c*=-1),c},date:function(e,t,o,i,n,s,r){return r.format||(r.format="DD/MM/YYYY"),this.sorters.datetime.call(this,e,t,o,i,n,s,r)},time:function(e,t,o,i,n,s,r){return r.format||(r.format="HH:mm"),this.sorters.datetime.call(this,e,t,o,i,n,s,r)},datetime:function(e,t,o,i,n,s,r){var a=r.format||"DD/MM/YYYY HH:mm:ss",l=r.alignEmptyValues,c=0;if("undefined"!=typeof moment){if(e=moment(e,a),t=moment(t,a),e.isValid()){if(t.isValid())return e-t;c=1}else c=t.isValid()?-1:0;return("top"===l&&"desc"===s||"bottom"===l&&"asc"===s)&&(c*=-1),c}console.error("Sort Error - 'datetime' sorter is dependant on moment.js")},boolean:function(e,t,o,i,n,s,r){return(!0===e||"true"===e||"True"===e||1===e?1:0)-(!0===t||"true"===t||"True"===t||1===t?1:0)},array:function(e,t,o,i,n,s,r){function a(e){switch(u){case"length":return e.length;case"sum":return e.reduce(function(e,t){return e+t});case"max":return Math.max.apply(null,e);case"min":return Math.min.apply(null,e);case"avg":return e.reduce(function(e,t){return e+t})/e.length}}var l=0,c=0,u=r.type||"length",d=r.alignEmptyValues,h=0;if(Array.isArray(e)){if(Array.isArray(t))return l=e?a(e):0,c=t?a(t):0,l-c;d=1}else d=Array.isArray(t)?-1:0;return("top"===d&&"desc"===s||"bottom"===d&&"asc"===s)&&(h*=-1),h},exists:function(e,t,o,i,n,s,r){return(void 0===e?0:1)-(void 0===t?0:1)},alphanum:function(e,t,o,i,n,s,r){var a,l,c,u,d,h=0,p=/(\d+)|(\D+)/g,m=/\d/,f=r.alignEmptyValues,g=0;if(e||0===e){if(t||0===t){if(isFinite(e)&&isFinite(t))return e-t;if(a=String(e).toLowerCase(),l=String(t).toLowerCase(),a===l)return 0;if(!m.test(a)||!m.test(l))return a>l?1:-1;for(a=a.match(p),l=l.match(p),d=a.length>l.length?l.length:a.length;hu?1:-1;return a.length>l.length}g=1}else g=t||0===t?-1:0;return("top"===f&&"desc"===s||"bottom"===f&&"asc"===s)&&(g*=-1),g}},d.prototype.registerModule("sort",X);var K=function(e){this.table=e,this.invalidCells=[]};return K.prototype.initializeColumn=function(e){var t,o=this,i=[];e.definition.validator&&(Array.isArray(e.definition.validator)?e.definition.validator.forEach(function(e){(t=o._extractValidator(e))&&i.push(t)}):(t=this._extractValidator(e.definition.validator))&&i.push(t),e.modules.validate=!!i.length&&i)},K.prototype._extractValidator=function(e){var t,o,i;switch(void 0===e?"undefined":_typeof(e)){case"string":return i=e.indexOf(":"),i>-1?(t=e.substring(0,i),o=e.substring(i+1)):t=e,this._buildValidator(t,o);case"function":return this._buildValidator(e);case"object":return this._buildValidator(e.type,e.parameters)}},K.prototype._buildValidator=function(e,t){var o="function"==typeof e?e:this.validators[e];return o?{type:"function"==typeof e?"function":e,func:o,params:t}:(console.warn("Validator Setup Error - No matching validator found:",e),!1)},K.prototype.validate=function(e,t,o){var i=this,n=[],s=this.invalidCells.indexOf(t);return e&&e.forEach(function(e){e.func.call(i,t.getComponent(),o,e.params)||n.push({type:e.type,parameters:e.params})}),n=!n.length||n,t.modules.validate||(t.modules.validate={}),!0===n?(t.modules.validate.invalid=!1,t.getElement().classList.remove("tabulator-validation-fail"),s>-1&&this.invalidCells.splice(s,1)):(t.modules.validate.invalid=!0,"manual"!==this.table.options.validationMode&&t.getElement().classList.add("tabulator-validation-fail"),-1==s&&this.invalidCells.push(t)),n},K.prototype.getInvalidCells=function(){var e=[];return this.invalidCells.forEach(function(t){e.push(t.getComponent())}),e},K.prototype.clearValidation=function(e){var t;e.modules.validate&&e.modules.validate.invalid&&(e.element.classList.remove("tabulator-validation-fail"),e.modules.validate.invalid=!1,(t=this.invalidCells.indexOf(e))>-1&&this.invalidCells.splice(t,1))},K.prototype.validators={integer:function(e,t,o){return""===t||null===t||void 0===t||"number"==typeof(t=Number(t))&&isFinite(t)&&Math.floor(t)===t},float:function(e,t,o){return""===t||null===t||void 0===t||"number"==typeof(t=Number(t))&&isFinite(t)&&t%1!=0},numeric:function(e,t,o){return""===t||null===t||void 0===t||!isNaN(t)},string:function(e,t,o){return""===t||null===t||void 0===t||isNaN(t)},max:function(e,t,o){return""===t||null===t||void 0===t||parseFloat(t)<=o},min:function(e,t,o){return""===t||null===t||void 0===t||parseFloat(t)>=o},starts:function(e,t,o){return""===t||null===t||void 0===t||String(t).toLowerCase().startsWith(String(o).toLowerCase())},ends:function(e,t,o){return""===t||null===t||void 0===t||String(t).toLowerCase().endsWith(String(o).toLowerCase())},minLength:function(e,t,o){return""===t||null===t||void 0===t||String(t).length>=o},maxLength:function(e,t,o){return""===t||null===t||void 0===t||String(t).length<=o},in:function(e,t,o){return""===t||null===t||void 0===t||("string"==typeof o&&(o=o.split("|")),""===t||o.indexOf(t)>-1)},regex:function(e,t,o){return""===t||null===t||void 0===t||new RegExp(o).test(t)},unique:function(e,t,o){if(""===t||null===t||void 0===t)return!0;var i=!0,n=e.getData(),s=e.getColumn()._getSelf();return this.table.rowManager.rows.forEach(function(e){var o=e.getData();o!==n&&t==s.getFieldValue(o)&&(i=!1)}),i},required:function(e,t,o){return""!==t&&null!==t&&void 0!==t}},d.prototype.registerModule("validate",K),d}); \ No newline at end of file diff --git a/admin/js/vendors/tabulator/js/tabulator_core.js b/admin/js/vendors/tabulator/js/tabulator_core.js new file mode 100644 index 0000000..1c4797a --- /dev/null +++ b/admin/js/vendors/tabulator/js/tabulator_core.js @@ -0,0 +1,8906 @@ +/* Tabulator v4.7.0 (c) Oliver Folkerd */ + +'use strict'; + +// https://tc39.github.io/ecma262/#sec-array.prototype.findIndex + +var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; + +if (!Array.prototype.findIndex) { + + Object.defineProperty(Array.prototype, 'findIndex', { + + value: function value(predicate) { + + // 1. Let O be ? ToObject(this value). + + if (this == null) { + + throw new TypeError('"this" is null or not defined'); + } + + var o = Object(this); + + // 2. Let len be ? ToLength(? Get(O, "length")). + + var len = o.length >>> 0; + + // 3. If IsCallable(predicate) is false, throw a TypeError exception. + + if (typeof predicate !== 'function') { + + throw new TypeError('predicate must be a function'); + } + + // 4. If thisArg was supplied, let T be thisArg; else let T be undefined. + + var thisArg = arguments[1]; + + // 5. Let k be 0. + + var k = 0; + + // 6. Repeat, while k < len + + while (k < len) { + + // a. Let Pk be ! ToString(k). + + // b. Let kValue be ? Get(O, Pk). + + // c. Let testResult be ToBoolean(? Call(predicate, T, « kValue, k, O »)). + + // d. If testResult is true, return k. + + var kValue = o[k]; + + if (predicate.call(thisArg, kValue, k, o)) { + + return k; + } + + // e. Increase k by 1. + + k++; + } + + // 7. Return -1. + + return -1; + } + + }); +} + +// https://tc39.github.io/ecma262/#sec-array.prototype.find + +if (!Array.prototype.find) { + + Object.defineProperty(Array.prototype, 'find', { + + value: function value(predicate) { + + // 1. Let O be ? ToObject(this value). + + if (this == null) { + + throw new TypeError('"this" is null or not defined'); + } + + var o = Object(this); + + // 2. Let len be ? ToLength(? Get(O, "length")). + + var len = o.length >>> 0; + + // 3. If IsCallable(predicate) is false, throw a TypeError exception. + + if (typeof predicate !== 'function') { + + throw new TypeError('predicate must be a function'); + } + + // 4. If thisArg was supplied, let T be thisArg; else let T be undefined. + + var thisArg = arguments[1]; + + // 5. Let k be 0. + + var k = 0; + + // 6. Repeat, while k < len + + while (k < len) { + + // a. Let Pk be ! ToString(k). + + // b. Let kValue be ? Get(O, Pk). + + // c. Let testResult be ToBoolean(? Call(predicate, T, « kValue, k, O »)). + + // d. If testResult is true, return kValue. + + var kValue = o[k]; + + if (predicate.call(thisArg, kValue, k, o)) { + + return kValue; + } + + // e. Increase k by 1. + + k++; + } + + // 7. Return undefined. + + return undefined; + } + + }); +} + +// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/includes#Polyfill + +if (!String.prototype.includes) { + + String.prototype.includes = function (search, start) { + + 'use strict'; + + if (search instanceof RegExp) { + + throw TypeError('first argument must not be a RegExp'); + } + + if (start === undefined) { + start = 0; + } + + return this.indexOf(search, start) !== -1; + }; +} + +// https://tc39.github.io/ecma262/#sec-array.prototype.includes + +if (!Array.prototype.includes) { + + Object.defineProperty(Array.prototype, 'includes', { + + value: function value(searchElement, fromIndex) { + + if (this == null) { + + throw new TypeError('"this" is null or not defined'); + } + + // 1. Let O be ? ToObject(this value). + + var o = Object(this); + + // 2. Let len be ? ToLength(? Get(O, "length")). + + var len = o.length >>> 0; + + // 3. If len is 0, return false. + + if (len === 0) { + + return false; + } + + // 4. Let n be ? ToInteger(fromIndex). + + // (If fromIndex is undefined, this step produces the value 0.) + + var n = fromIndex | 0; + + // 5. If n ≥ 0, then + + // a. Let k be n. + + // 6. Else n < 0, + + // a. Let k be len + n. + + // b. If k < 0, let k be 0. + + var k = Math.max(n >= 0 ? n : len - Math.abs(n), 0); + + function sameValueZero(x, y) { + + return x === y || typeof x === 'number' && typeof y === 'number' && isNaN(x) && isNaN(y); + } + + // 7. Repeat, while k < len + + while (k < len) { + + // a. Let elementK be the result of ? Get(O, ! ToString(k)). + + // b. If SameValueZero(searchElement, elementK) is true, return true. + + if (sameValueZero(o[k], searchElement)) { + + return true; + } + + // c. Increase k by 1. + + k++; + } + + // 8. Return false + + return false; + } + + }); +} + +// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/assign#Polyfill + +if (typeof Object.assign !== 'function') { + + // Must be writable: true, enumerable: false, configurable: true + + Object.defineProperty(Object, "assign", { + + value: function assign(target, varArgs) { + // .length of function is 2 + + 'use strict'; + + if (target === null || target === undefined) { + + throw new TypeError('Cannot convert undefined or null to object'); + } + + var to = Object(target); + + for (var index = 1; index < arguments.length; index++) { + + var nextSource = arguments[index]; + + if (nextSource !== null && nextSource !== undefined) { + + for (var nextKey in nextSource) { + + // Avoid bugs when hasOwnProperty is shadowed + + if (Object.prototype.hasOwnProperty.call(nextSource, nextKey)) { + + to[nextKey] = nextSource[nextKey]; + } + } + } + } + + return to; + }, + + writable: true, + + configurable: true + + }); +} + +var ColumnManager = function ColumnManager(table) { + + this.table = table; //hold parent table + + this.blockHozScrollEvent = false; + + this.headersElement = this.createHeadersElement(); + + this.element = this.createHeaderElement(); //containing element + + this.rowManager = null; //hold row manager object + + this.columns = []; // column definition object + + this.columnsByIndex = []; //columns by index + + this.columnsByField = {}; //columns by field + + this.scrollLeft = 0; + + this.element.insertBefore(this.headersElement, this.element.firstChild); +}; + +////////////// Setup Functions ///////////////// + + +ColumnManager.prototype.createHeadersElement = function () { + + var el = document.createElement("div"); + + el.classList.add("tabulator-headers"); + + return el; +}; + +ColumnManager.prototype.createHeaderElement = function () { + + var el = document.createElement("div"); + + el.classList.add("tabulator-header"); + + if (!this.table.options.headerVisible) { + + el.classList.add("tabulator-header-hidden"); + } + + return el; +}; + +ColumnManager.prototype.initialize = function () { + + var self = this; + + //scroll body along with header + + // self.element.addEventListener("scroll", function(e){ + + // if(!self.blockHozScrollEvent){ + + // self.table.rowManager.scrollHorizontal(self.element.scrollLeft); + + // } + + // }); +}; + +//link to row manager + +ColumnManager.prototype.setRowManager = function (manager) { + + this.rowManager = manager; +}; + +//return containing element + +ColumnManager.prototype.getElement = function () { + + return this.element; +}; + +//return header containing element + +ColumnManager.prototype.getHeadersElement = function () { + + return this.headersElement; +}; + +// ColumnManager.prototype.tempScrollBlock = function(){ + +// clearTimeout(this.blockHozScrollEvent); + +// this.blockHozScrollEvent = setTimeout(() => {this.blockHozScrollEvent = false;}, 50); + +// } + + +//scroll horizontally to match table body + +ColumnManager.prototype.scrollHorizontal = function (left) { + + var hozAdjust = 0, + scrollWidth = this.element.scrollWidth - this.table.element.clientWidth; + + // this.tempScrollBlock(); + + this.element.scrollLeft = left; + + //adjust for vertical scrollbar moving table when present + + if (left > scrollWidth) { + + hozAdjust = left - scrollWidth; + + this.element.style.marginLeft = -hozAdjust + "px"; + } else { + + this.element.style.marginLeft = 0; + } + + //keep frozen columns fixed in position + + //this._calcFrozenColumnsPos(hozAdjust + 3); + + + this.scrollLeft = left; + + if (this.table.modExists("frozenColumns")) { + + this.table.modules.frozenColumns.scrollHorizontal(); + } +}; + +///////////// Column Setup Functions ///////////// + + +ColumnManager.prototype.generateColumnsFromRowData = function (data) { + + var cols = [], + row, + sorter; + + if (data && data.length) { + + row = data[0]; + + for (var key in row) { + + var col = { + + field: key, + + title: key + + }; + + var value = row[key]; + + switch (typeof value === 'undefined' ? 'undefined' : _typeof(value)) { + + case "undefined": + + sorter = "string"; + + break; + + case "boolean": + + sorter = "boolean"; + + break; + + case "object": + + if (Array.isArray(value)) { + + sorter = "array"; + } else { + + sorter = "string"; + } + + break; + + default: + + if (!isNaN(value) && value !== "") { + + sorter = "number"; + } else { + + if (value.match(/((^[0-9]+[a-z]+)|(^[a-z]+[0-9]+))+$/i)) { + + sorter = "alphanum"; + } else { + + sorter = "string"; + } + } + + break; + + } + + col.sorter = sorter; + + cols.push(col); + } + + this.table.options.columns = cols; + + this.setColumns(this.table.options.columns); + } +}; + +ColumnManager.prototype.setColumns = function (cols, row) { + + var self = this; + + while (self.headersElement.firstChild) { + self.headersElement.removeChild(self.headersElement.firstChild); + }self.columns = []; + + self.columnsByIndex = []; + + self.columnsByField = {}; + + //reset frozen columns + + if (self.table.modExists("frozenColumns")) { + + self.table.modules.frozenColumns.reset(); + } + + cols.forEach(function (def, i) { + + self._addColumn(def); + }); + + self._reIndexColumns(); + + if (self.table.options.responsiveLayout && self.table.modExists("responsiveLayout", true)) { + + self.table.modules.responsiveLayout.initialize(); + } + + self.redraw(true); +}; + +ColumnManager.prototype._addColumn = function (definition, before, nextToColumn) { + + var column = new Column(definition, this), + colEl = column.getElement(), + index = nextToColumn ? this.findColumnIndex(nextToColumn) : nextToColumn; + + if (nextToColumn && index > -1) { + + var parentIndex = this.columns.indexOf(nextToColumn.getTopColumn()); + + var nextEl = nextToColumn.getElement(); + + if (before) { + + this.columns.splice(parentIndex, 0, column); + + nextEl.parentNode.insertBefore(colEl, nextEl); + } else { + + this.columns.splice(parentIndex + 1, 0, column); + + nextEl.parentNode.insertBefore(colEl, nextEl.nextSibling); + } + } else { + + if (before) { + + this.columns.unshift(column); + + this.headersElement.insertBefore(column.getElement(), this.headersElement.firstChild); + } else { + + this.columns.push(column); + + this.headersElement.appendChild(column.getElement()); + } + + column.columnRendered(); + } + + return column; +}; + +ColumnManager.prototype.registerColumnField = function (col) { + + if (col.definition.field) { + + this.columnsByField[col.definition.field] = col; + } +}; + +ColumnManager.prototype.registerColumnPosition = function (col) { + + this.columnsByIndex.push(col); +}; + +ColumnManager.prototype._reIndexColumns = function () { + + this.columnsByIndex = []; + + this.columns.forEach(function (column) { + + column.reRegisterPosition(); + }); +}; + +//ensure column headers take up the correct amount of space in column groups + +ColumnManager.prototype._verticalAlignHeaders = function () { + + var self = this, + minHeight = 0; + + self.columns.forEach(function (column) { + + var height; + + column.clearVerticalAlign(); + + height = column.getHeight(); + + if (height > minHeight) { + + minHeight = height; + } + }); + + self.columns.forEach(function (column) { + + column.verticalAlign(self.table.options.columnHeaderVertAlign, minHeight); + }); + + self.rowManager.adjustTableSize(); +}; + +//////////////// Column Details ///////////////// + + +ColumnManager.prototype.findColumn = function (subject) { + + var self = this; + + if ((typeof subject === 'undefined' ? 'undefined' : _typeof(subject)) == "object") { + + if (subject instanceof Column) { + + //subject is column element + + return subject; + } else if (subject instanceof ColumnComponent) { + + //subject is public column component + + return subject._getSelf() || false; + } else if (typeof HTMLElement !== "undefined" && subject instanceof HTMLElement) { + + //subject is a HTML element of the column header + + var match = self.columns.find(function (column) { + + return column.element === subject; + }); + + return match || false; + } + } else { + + //subject should be treated as the field name of the column + + return this.columnsByField[subject] || false; + } + + //catch all for any other type of input + + + return false; +}; + +ColumnManager.prototype.getColumnByField = function (field) { + + return this.columnsByField[field]; +}; + +ColumnManager.prototype.getColumnsByFieldRoot = function (root) { + var _this = this; + + var matches = []; + + Object.keys(this.columnsByField).forEach(function (field) { + + var fieldRoot = field.split(".")[0]; + + if (fieldRoot === root) { + + matches.push(_this.columnsByField[field]); + } + }); + + return matches; +}; + +ColumnManager.prototype.getColumnByIndex = function (index) { + + return this.columnsByIndex[index]; +}; + +ColumnManager.prototype.getFirstVisibileColumn = function (index) { + + var index = this.columnsByIndex.findIndex(function (col) { + + return col.visible; + }); + + return index > -1 ? this.columnsByIndex[index] : false; +}; + +ColumnManager.prototype.getColumns = function () { + + return this.columns; +}; + +ColumnManager.prototype.findColumnIndex = function (column) { + + return this.columnsByIndex.findIndex(function (col) { + + return column === col; + }); +}; + +//return all columns that are not groups + +ColumnManager.prototype.getRealColumns = function () { + + return this.columnsByIndex; +}; + +//travers across columns and call action + +ColumnManager.prototype.traverse = function (callback) { + + var self = this; + + self.columnsByIndex.forEach(function (column, i) { + + callback(column, i); + }); +}; + +//get defintions of actual columns + +ColumnManager.prototype.getDefinitions = function (active) { + + var self = this, + output = []; + + self.columnsByIndex.forEach(function (column) { + + if (!active || active && column.visible) { + + output.push(column.getDefinition()); + } + }); + + return output; +}; + +//get full nested definition tree + +ColumnManager.prototype.getDefinitionTree = function () { + + var self = this, + output = []; + + self.columns.forEach(function (column) { + + output.push(column.getDefinition(true)); + }); + + return output; +}; + +ColumnManager.prototype.getComponents = function (structured) { + + var self = this, + output = [], + columns = structured ? self.columns : self.columnsByIndex; + + columns.forEach(function (column) { + + output.push(column.getComponent()); + }); + + return output; +}; + +ColumnManager.prototype.getWidth = function () { + + var width = 0; + + this.columnsByIndex.forEach(function (column) { + + if (column.visible) { + + width += column.getWidth(); + } + }); + + return width; +}; + +ColumnManager.prototype.moveColumn = function (from, to, after) { + + this.moveColumnActual(from, to, after); + + if (this.table.options.responsiveLayout && this.table.modExists("responsiveLayout", true)) { + + this.table.modules.responsiveLayout.initialize(); + } + + if (this.table.modExists("columnCalcs")) { + + this.table.modules.columnCalcs.recalc(this.table.rowManager.activeRows); + } + + to.element.parentNode.insertBefore(from.element, to.element); + + if (after) { + + to.element.parentNode.insertBefore(to.element, from.element); + } + + this._verticalAlignHeaders(); + + this.table.rowManager.reinitialize(); +}; + +ColumnManager.prototype.moveColumnActual = function (from, to, after) { + + if (from.parent.isGroup) { + + this._moveColumnInArray(from.parent.columns, from, to, after); + } else { + + this._moveColumnInArray(this.columns, from, to, after); + } + + this._moveColumnInArray(this.columnsByIndex, from, to, after, true); + + if (this.table.options.responsiveLayout && this.table.modExists("responsiveLayout", true)) { + + this.table.modules.responsiveLayout.initialize(); + } + + if (this.table.options.columnMoved) { + + this.table.options.columnMoved.call(this.table, from.getComponent(), this.table.columnManager.getComponents()); + } + + if (this.table.options.persistence && this.table.modExists("persistence", true) && this.table.modules.persistence.config.columns) { + + this.table.modules.persistence.save("columns"); + } +}; + +ColumnManager.prototype._moveColumnInArray = function (columns, from, to, after, updateRows) { + + var fromIndex = columns.indexOf(from), + toIndex; + + if (fromIndex > -1) { + + columns.splice(fromIndex, 1); + + toIndex = columns.indexOf(to); + + if (toIndex > -1) { + + if (after) { + + toIndex = toIndex + 1; + } + } else { + + toIndex = fromIndex; + } + + columns.splice(toIndex, 0, from); + + if (updateRows) { + + this.table.rowManager.rows.forEach(function (row) { + + if (row.cells.length) { + + var cell = row.cells.splice(fromIndex, 1)[0]; + + row.cells.splice(toIndex, 0, cell); + } + }); + } + } +}; + +ColumnManager.prototype.scrollToColumn = function (column, position, ifVisible) { + var _this2 = this; + + var left = 0, + offset = 0, + adjust = 0, + colEl = column.getElement(); + + return new Promise(function (resolve, reject) { + + if (typeof position === "undefined") { + + position = _this2.table.options.scrollToColumnPosition; + } + + if (typeof ifVisible === "undefined") { + + ifVisible = _this2.table.options.scrollToColumnIfVisible; + } + + if (column.visible) { + + //align to correct position + + switch (position) { + + case "middle": + + case "center": + + adjust = -_this2.element.clientWidth / 2; + + break; + + case "right": + + adjust = colEl.clientWidth - _this2.headersElement.clientWidth; + + break; + + } + + //check column visibility + + if (!ifVisible) { + + offset = colEl.offsetLeft; + + if (offset > 0 && offset + colEl.offsetWidth < _this2.element.clientWidth) { + + return false; + } + } + + //calculate scroll position + + left = colEl.offsetLeft + _this2.element.scrollLeft + adjust; + + left = Math.max(Math.min(left, _this2.table.rowManager.element.scrollWidth - _this2.table.rowManager.element.clientWidth), 0); + + _this2.table.rowManager.scrollHorizontal(left); + + _this2.scrollHorizontal(left); + + resolve(); + } else { + + console.warn("Scroll Error - Column not visible"); + + reject("Scroll Error - Column not visible"); + } + }); +}; + +//////////////// Cell Management ///////////////// + + +ColumnManager.prototype.generateCells = function (row) { + + var self = this; + + var cells = []; + + self.columnsByIndex.forEach(function (column) { + + cells.push(column.generateCell(row)); + }); + + return cells; +}; + +//////////////// Column Management ///////////////// + + +ColumnManager.prototype.getFlexBaseWidth = function () { + + var self = this, + totalWidth = self.table.element.clientWidth, + //table element width + + fixedWidth = 0; + + //adjust for vertical scrollbar if present + + if (self.rowManager.element.scrollHeight > self.rowManager.element.clientHeight) { + + totalWidth -= self.rowManager.element.offsetWidth - self.rowManager.element.clientWidth; + } + + this.columnsByIndex.forEach(function (column) { + + var width, minWidth, colWidth; + + if (column.visible) { + + width = column.definition.width || 0; + + minWidth = typeof column.minWidth == "undefined" ? self.table.options.columnMinWidth : parseInt(column.minWidth); + + if (typeof width == "string") { + + if (width.indexOf("%") > -1) { + + colWidth = totalWidth / 100 * parseInt(width); + } else { + + colWidth = parseInt(width); + } + } else { + + colWidth = width; + } + + fixedWidth += colWidth > minWidth ? colWidth : minWidth; + } + }); + + return fixedWidth; +}; + +ColumnManager.prototype.addColumn = function (definition, before, nextToColumn) { + var _this3 = this; + + return new Promise(function (resolve, reject) { + + var column = _this3._addColumn(definition, before, nextToColumn); + + _this3._reIndexColumns(); + + if (_this3.table.options.responsiveLayout && _this3.table.modExists("responsiveLayout", true)) { + + _this3.table.modules.responsiveLayout.initialize(); + } + + if (_this3.table.modExists("columnCalcs")) { + + _this3.table.modules.columnCalcs.recalc(_this3.table.rowManager.activeRows); + } + + _this3.redraw(); + + if (_this3.table.modules.layout.getMode() != "fitColumns") { + + column.reinitializeWidth(); + } + + _this3._verticalAlignHeaders(); + + _this3.table.rowManager.reinitialize(); + + resolve(column); + }); +}; + +//remove column from system + +ColumnManager.prototype.deregisterColumn = function (column) { + + var field = column.getField(), + index; + + //remove from field list + + if (field) { + + delete this.columnsByField[field]; + } + + //remove from index list + + index = this.columnsByIndex.indexOf(column); + + if (index > -1) { + + this.columnsByIndex.splice(index, 1); + } + + //remove from column list + + index = this.columns.indexOf(column); + + if (index > -1) { + + this.columns.splice(index, 1); + } + + if (this.table.options.responsiveLayout && this.table.modExists("responsiveLayout", true)) { + + this.table.modules.responsiveLayout.initialize(); + } + + this.redraw(); +}; + +//redraw columns + +ColumnManager.prototype.redraw = function (force) { + + if (force) { + + if (Tabulator.prototype.helpers.elVisible(this.element)) { + + this._verticalAlignHeaders(); + } + + this.table.rowManager.resetScroll(); + + this.table.rowManager.reinitialize(); + } + + if (["fitColumns", "fitDataStretch"].indexOf(this.table.modules.layout.getMode()) > -1) { + + this.table.modules.layout.layout(); + } else { + + if (force) { + + this.table.modules.layout.layout(); + } else { + + if (this.table.options.responsiveLayout && this.table.modExists("responsiveLayout", true)) { + + this.table.modules.responsiveLayout.update(); + } + } + } + + if (this.table.modExists("frozenColumns")) { + + this.table.modules.frozenColumns.layout(); + } + + if (this.table.modExists("columnCalcs")) { + + this.table.modules.columnCalcs.recalc(this.table.rowManager.activeRows); + } + + if (force) { + + if (this.table.options.persistence && this.table.modExists("persistence", true) && this.table.modules.persistence.config.columns) { + + this.table.modules.persistence.save("columns"); + } + + if (this.table.modExists("columnCalcs")) { + + this.table.modules.columnCalcs.redraw(); + } + } + + this.table.footerManager.redraw(); +}; + +//public column object +var ColumnComponent = function ColumnComponent(column) { + this._column = column; + this.type = "ColumnComponent"; +}; + +ColumnComponent.prototype.getElement = function () { + return this._column.getElement(); +}; + +ColumnComponent.prototype.getDefinition = function () { + return this._column.getDefinition(); +}; + +ColumnComponent.prototype.getField = function () { + return this._column.getField(); +}; + +ColumnComponent.prototype.getCells = function () { + var cells = []; + + this._column.cells.forEach(function (cell) { + cells.push(cell.getComponent()); + }); + + return cells; +}; + +ColumnComponent.prototype.getVisibility = function () { + console.warn("getVisibility function is deprecated, you should now use the isVisible function"); + return this._column.visible; +}; + +ColumnComponent.prototype.isVisible = function () { + return this._column.visible; +}; + +ColumnComponent.prototype.show = function () { + if (this._column.isGroup) { + this._column.columns.forEach(function (column) { + column.show(); + }); + } else { + this._column.show(); + } +}; + +ColumnComponent.prototype.hide = function () { + if (this._column.isGroup) { + this._column.columns.forEach(function (column) { + column.hide(); + }); + } else { + this._column.hide(); + } +}; + +ColumnComponent.prototype.toggle = function () { + if (this._column.visible) { + this.hide(); + } else { + this.show(); + } +}; + +ColumnComponent.prototype.delete = function () { + return this._column.delete(); +}; + +ColumnComponent.prototype.getSubColumns = function () { + var output = []; + + if (this._column.columns.length) { + this._column.columns.forEach(function (column) { + output.push(column.getComponent()); + }); + } + + return output; +}; + +ColumnComponent.prototype.getParentColumn = function () { + return this._column.parent instanceof Column ? this._column.parent.getComponent() : false; +}; + +ColumnComponent.prototype._getSelf = function () { + return this._column; +}; + +ColumnComponent.prototype.scrollTo = function () { + return this._column.table.columnManager.scrollToColumn(this._column); +}; + +ColumnComponent.prototype.getTable = function () { + return this._column.table; +}; + +ColumnComponent.prototype.headerFilterFocus = function () { + if (this._column.table.modExists("filter", true)) { + this._column.table.modules.filter.setHeaderFilterFocus(this._column); + } +}; + +ColumnComponent.prototype.reloadHeaderFilter = function () { + if (this._column.table.modExists("filter", true)) { + this._column.table.modules.filter.reloadHeaderFilter(this._column); + } +}; + +ColumnComponent.prototype.getHeaderFilterValue = function () { + if (this._column.table.modExists("filter", true)) { + return this._column.table.modules.filter.getHeaderFilterValue(this._column); + } +}; + +ColumnComponent.prototype.setHeaderFilterValue = function (value) { + if (this._column.table.modExists("filter", true)) { + this._column.table.modules.filter.setHeaderFilterValue(this._column, value); + } +}; + +ColumnComponent.prototype.move = function (to, after) { + var toColumn = this._column.table.columnManager.findColumn(to); + + if (toColumn) { + this._column.table.columnManager.moveColumn(this._column, toColumn, after); + } else { + console.warn("Move Error - No matching column found:", toColumn); + } +}; + +ColumnComponent.prototype.getNextColumn = function () { + var nextCol = this._column.nextColumn(); + + return nextCol ? nextCol.getComponent() : false; +}; + +ColumnComponent.prototype.getPrevColumn = function () { + var prevCol = this._column.prevColumn(); + + return prevCol ? prevCol.getComponent() : false; +}; + +ColumnComponent.prototype.updateDefinition = function (updates) { + return this._column.updateDefinition(updates); +}; + +ColumnComponent.prototype.getWidth = function () { + return this._column.getWidth(); +}; + +ColumnComponent.prototype.setWidth = function (width) { + if (width === true) { + return this._column.reinitializeWidth(true); + } else { + return this._column.setWidth(width); + } +}; + +ColumnComponent.prototype.validate = function () { + return this._column.validate(); +}; + +var Column = function Column(def, parent) { + var self = this; + + this.table = parent.table; + this.definition = def; //column definition + this.parent = parent; //hold parent object + this.type = "column"; //type of element + this.columns = []; //child columns + this.cells = []; //cells bound to this column + this.element = this.createElement(); //column header element + this.contentElement = false; + this.titleElement = false; + this.groupElement = this.createGroupElement(); //column group holder element + this.isGroup = false; + this.tooltip = false; //hold column tooltip + this.hozAlign = ""; //horizontal text alignment + this.vertAlign = ""; //vert text alignment + + //multi dimensional filed handling + this.field = ""; + this.fieldStructure = ""; + this.getFieldValue = ""; + this.setFieldValue = ""; + + this.titleFormatterRendered = false; + + this.setField(this.definition.field); + + if (this.table.options.invalidOptionWarnings) { + this.checkDefinition(); + } + + this.modules = {}; //hold module variables; + + this.cellEvents = { + cellClick: false, + cellDblClick: false, + cellContext: false, + cellTap: false, + cellDblTap: false, + cellTapHold: false, + cellMouseEnter: false, + cellMouseLeave: false, + cellMouseOver: false, + cellMouseOut: false, + cellMouseMove: false + }; + + this.width = null; //column width + this.widthStyled = ""; //column width prestyled to improve render efficiency + this.minWidth = null; //column minimum width + this.minWidthStyled = ""; //column minimum prestyled to improve render efficiency + this.widthFixed = false; //user has specified a width for this column + + this.visible = true; //default visible state + + this.component = null; + + this._mapDepricatedFunctionality(); + + //initialize column + if (def.columns) { + + this.isGroup = true; + + def.columns.forEach(function (def, i) { + var newCol = new Column(def, self); + self.attachColumn(newCol); + }); + + self.checkColumnVisibility(); + } else { + parent.registerColumnField(this); + } + + if (def.rowHandle && this.table.options.movableRows !== false && this.table.modExists("moveRow")) { + this.table.modules.moveRow.setHandle(true); + } + + this._buildHeader(); + + this.bindModuleColumns(); +}; + +Column.prototype.createElement = function () { + var el = document.createElement("div"); + + el.classList.add("tabulator-col"); + el.setAttribute("role", "columnheader"); + el.setAttribute("aria-sort", "none"); + + return el; +}; + +Column.prototype.createGroupElement = function () { + var el = document.createElement("div"); + + el.classList.add("tabulator-col-group-cols"); + + return el; +}; + +Column.prototype.checkDefinition = function () { + var _this4 = this; + + Object.keys(this.definition).forEach(function (key) { + if (_this4.defaultOptionList.indexOf(key) === -1) { + console.warn("Invalid column definition option in '" + (_this4.field || _this4.definition.title) + "' column:", key); + } + }); +}; + +Column.prototype.setField = function (field) { + this.field = field; + this.fieldStructure = field ? this.table.options.nestedFieldSeparator ? field.split(this.table.options.nestedFieldSeparator) : [field] : []; + this.getFieldValue = this.fieldStructure.length > 1 ? this._getNestedData : this._getFlatData; + this.setFieldValue = this.fieldStructure.length > 1 ? this._setNestedData : this._setFlatData; +}; + +//register column position with column manager +Column.prototype.registerColumnPosition = function (column) { + this.parent.registerColumnPosition(column); +}; + +//register column position with column manager +Column.prototype.registerColumnField = function (column) { + this.parent.registerColumnField(column); +}; + +//trigger position registration +Column.prototype.reRegisterPosition = function () { + if (this.isGroup) { + this.columns.forEach(function (column) { + column.reRegisterPosition(); + }); + } else { + this.registerColumnPosition(this); + } +}; + +Column.prototype._mapDepricatedFunctionality = function () { + if (typeof this.definition.hideInHtml !== "undefined") { + this.definition.htmlOutput = !this.definition.hideInHtml; + console.warn("hideInHtml column definition property is deprecated, you should now use htmlOutput"); + } + + if (typeof this.definition.align !== "undefined") { + this.definition.hozAlign = this.definition.align; + console.warn("align column definition property is deprecated, you should now use hozAlign"); + } + + if (typeof this.definition.downloadTitle !== "undefined") { + this.definition.titleDownload = this.definition.downloadTitle; + console.warn("downloadTitle definition property is deprecated, you should now use titleDownload"); + } +}; + +Column.prototype.setTooltip = function () { + var self = this, + def = self.definition; + + //set header tooltips + var tooltip = def.headerTooltip || def.tooltip === false ? def.headerTooltip : self.table.options.tooltipsHeader; + + if (tooltip) { + if (tooltip === true) { + if (def.field) { + self.table.modules.localize.bind("columns|" + def.field, function (value) { + self.element.setAttribute("title", value || def.title); + }); + } else { + self.element.setAttribute("title", def.title); + } + } else { + if (typeof tooltip == "function") { + tooltip = tooltip(self.getComponent()); + + if (tooltip === false) { + tooltip = ""; + } + } + + self.element.setAttribute("title", tooltip); + } + } else { + self.element.setAttribute("title", ""); + } +}; + +//build header element +Column.prototype._buildHeader = function () { + var self = this, + def = self.definition; + + while (self.element.firstChild) { + self.element.removeChild(self.element.firstChild); + }if (def.headerVertical) { + self.element.classList.add("tabulator-col-vertical"); + + if (def.headerVertical === "flip") { + self.element.classList.add("tabulator-col-vertical-flip"); + } + } + + self.contentElement = self._bindEvents(); + + self.contentElement = self._buildColumnHeaderContent(); + + self.element.appendChild(self.contentElement); + + if (self.isGroup) { + self._buildGroupHeader(); + } else { + self._buildColumnHeader(); + } + + self.setTooltip(); + + //set resizable handles + if (self.table.options.resizableColumns && self.table.modExists("resizeColumns")) { + self.table.modules.resizeColumns.initializeColumn("header", self, self.element); + } + + //set resizable handles + if (def.headerFilter && self.table.modExists("filter") && self.table.modExists("edit")) { + if (typeof def.headerFilterPlaceholder !== "undefined" && def.field) { + self.table.modules.localize.setHeaderFilterColumnPlaceholder(def.field, def.headerFilterPlaceholder); + } + + self.table.modules.filter.initializeColumn(self); + } + + //set resizable handles + if (self.table.modExists("frozenColumns")) { + self.table.modules.frozenColumns.initializeColumn(self); + } + + //set movable column + if (self.table.options.movableColumns && !self.isGroup && self.table.modExists("moveColumn")) { + self.table.modules.moveColumn.initializeColumn(self); + } + + //set calcs column + if ((def.topCalc || def.bottomCalc) && self.table.modExists("columnCalcs")) { + self.table.modules.columnCalcs.initializeColumn(self); + } + + //handle persistence + if (self.table.modExists("persistence") && self.table.modules.persistence.config.columns) { + self.table.modules.persistence.initializeColumn(self); + } + + //update header tooltip on mouse enter + self.element.addEventListener("mouseenter", function (e) { + self.setTooltip(); + }); +}; + +Column.prototype._bindEvents = function () { + + var self = this, + def = self.definition, + dblTap, + tapHold, + tap; + + //setup header click event bindings + if (typeof def.headerClick == "function") { + self.element.addEventListener("click", function (e) { + def.headerClick(e, self.getComponent()); + }); + } + + if (typeof def.headerDblClick == "function") { + self.element.addEventListener("dblclick", function (e) { + def.headerDblClick(e, self.getComponent()); + }); + } + + if (typeof def.headerContext == "function") { + self.element.addEventListener("contextmenu", function (e) { + def.headerContext(e, self.getComponent()); + }); + } + + //setup header tap event bindings + if (typeof def.headerTap == "function") { + tap = false; + + self.element.addEventListener("touchstart", function (e) { + tap = true; + }, { passive: true }); + + self.element.addEventListener("touchend", function (e) { + if (tap) { + def.headerTap(e, self.getComponent()); + } + + tap = false; + }); + } + + if (typeof def.headerDblTap == "function") { + dblTap = null; + + self.element.addEventListener("touchend", function (e) { + + if (dblTap) { + clearTimeout(dblTap); + dblTap = null; + + def.headerDblTap(e, self.getComponent()); + } else { + + dblTap = setTimeout(function () { + clearTimeout(dblTap); + dblTap = null; + }, 300); + } + }); + } + + if (typeof def.headerTapHold == "function") { + tapHold = null; + + self.element.addEventListener("touchstart", function (e) { + clearTimeout(tapHold); + + tapHold = setTimeout(function () { + clearTimeout(tapHold); + tapHold = null; + tap = false; + def.headerTapHold(e, self.getComponent()); + }, 1000); + }, { passive: true }); + + self.element.addEventListener("touchend", function (e) { + clearTimeout(tapHold); + tapHold = null; + }); + } + + //store column cell click event bindings + if (typeof def.cellClick == "function") { + self.cellEvents.cellClick = def.cellClick; + } + + if (typeof def.cellDblClick == "function") { + self.cellEvents.cellDblClick = def.cellDblClick; + } + + if (typeof def.cellContext == "function") { + self.cellEvents.cellContext = def.cellContext; + } + + //store column mouse event bindings + if (typeof def.cellMouseEnter == "function") { + self.cellEvents.cellMouseEnter = def.cellMouseEnter; + } + + if (typeof def.cellMouseLeave == "function") { + self.cellEvents.cellMouseLeave = def.cellMouseLeave; + } + + if (typeof def.cellMouseOver == "function") { + self.cellEvents.cellMouseOver = def.cellMouseOver; + } + + if (typeof def.cellMouseOut == "function") { + self.cellEvents.cellMouseOut = def.cellMouseOut; + } + + if (typeof def.cellMouseMove == "function") { + self.cellEvents.cellMouseMove = def.cellMouseMove; + } + + //setup column cell tap event bindings + if (typeof def.cellTap == "function") { + self.cellEvents.cellTap = def.cellTap; + } + + if (typeof def.cellDblTap == "function") { + self.cellEvents.cellDblTap = def.cellDblTap; + } + + if (typeof def.cellTapHold == "function") { + self.cellEvents.cellTapHold = def.cellTapHold; + } + + //setup column cell edit callbacks + if (typeof def.cellEdited == "function") { + self.cellEvents.cellEdited = def.cellEdited; + } + + if (typeof def.cellEditing == "function") { + self.cellEvents.cellEditing = def.cellEditing; + } + + if (typeof def.cellEditCancelled == "function") { + self.cellEvents.cellEditCancelled = def.cellEditCancelled; + } +}; + +//build header element for header +Column.prototype._buildColumnHeader = function () { + var self = this, + def = self.definition, + table = self.table, + sortable; + + //set column sorter + if (table.modExists("sort")) { + table.modules.sort.initializeColumn(self, self.contentElement); + } + + //set column header context menu + if ((def.headerContextMenu || def.headerMenu) && table.modExists("menu")) { + table.modules.menu.initializeColumnHeader(self); + } + + //set column formatter + if (table.modExists("format")) { + table.modules.format.initializeColumn(self); + } + + //set column editor + if (typeof def.editor != "undefined" && table.modExists("edit")) { + table.modules.edit.initializeColumn(self); + } + + //set colum validator + if (typeof def.validator != "undefined" && table.modExists("validate")) { + table.modules.validate.initializeColumn(self); + } + + //set column mutator + if (table.modExists("mutator")) { + table.modules.mutator.initializeColumn(self); + } + + //set column accessor + if (table.modExists("accessor")) { + table.modules.accessor.initializeColumn(self); + } + + //set respoviveLayout + if (_typeof(table.options.responsiveLayout) && table.modExists("responsiveLayout")) { + table.modules.responsiveLayout.initializeColumn(self); + } + + //set column visibility + if (typeof def.visible != "undefined") { + if (def.visible) { + self.show(true); + } else { + self.hide(true); + } + } + + //asign additional css classes to column header + if (def.cssClass) { + var classeNames = def.cssClass.split(" "); + classeNames.forEach(function (className) { + self.element.classList.add(className); + }); + } + + if (def.field) { + this.element.setAttribute("tabulator-field", def.field); + } + + //set min width if present + self.setMinWidth(typeof def.minWidth == "undefined" ? self.table.options.columnMinWidth : parseInt(def.minWidth)); + + self.reinitializeWidth(); + + //set tooltip if present + self.tooltip = self.definition.tooltip || self.definition.tooltip === false ? self.definition.tooltip : self.table.options.tooltips; + + //set orizontal text alignment + self.hozAlign = typeof self.definition.hozAlign == "undefined" ? self.table.options.cellHozAlign : self.definition.hozAlign; + self.vertAlign = typeof self.definition.vertAlign == "undefined" ? self.table.options.cellVertAlign : self.definition.vertAlign; +}; + +Column.prototype._buildColumnHeaderContent = function () { + var def = this.definition, + table = this.table; + + var contentElement = document.createElement("div"); + contentElement.classList.add("tabulator-col-content"); + + this.titleElement = this._buildColumnHeaderTitle(); + + contentElement.appendChild(this.titleElement); + + return contentElement; +}; + +//build title element of column +Column.prototype._buildColumnHeaderTitle = function () { + var self = this, + def = self.definition, + table = self.table, + title; + + var titleHolderElement = document.createElement("div"); + titleHolderElement.classList.add("tabulator-col-title"); + + if (def.editableTitle) { + var titleElement = document.createElement("input"); + titleElement.classList.add("tabulator-title-editor"); + + titleElement.addEventListener("click", function (e) { + e.stopPropagation(); + titleElement.focus(); + }); + + titleElement.addEventListener("change", function () { + def.title = titleElement.value; + table.options.columnTitleChanged.call(self.table, self.getComponent()); + }); + + titleHolderElement.appendChild(titleElement); + + if (def.field) { + table.modules.localize.bind("columns|" + def.field, function (text) { + titleElement.value = text || def.title || " "; + }); + } else { + titleElement.value = def.title || " "; + } + } else { + if (def.field) { + table.modules.localize.bind("columns|" + def.field, function (text) { + self._formatColumnHeaderTitle(titleHolderElement, text || def.title || " "); + }); + } else { + self._formatColumnHeaderTitle(titleHolderElement, def.title || " "); + } + } + + return titleHolderElement; +}; + +Column.prototype._formatColumnHeaderTitle = function (el, title) { + var _this5 = this; + + var formatter, contents, params, mockCell, onRendered; + + if (this.definition.titleFormatter && this.table.modExists("format")) { + + formatter = this.table.modules.format.getFormatter(this.definition.titleFormatter); + + onRendered = function onRendered(callback) { + _this5.titleFormatterRendered = callback; + }; + + mockCell = { + getValue: function getValue() { + return title; + }, + getElement: function getElement() { + return el; + } + }; + + params = this.definition.titleFormatterParams || {}; + + params = typeof params === "function" ? params() : params; + + contents = formatter.call(this.table.modules.format, mockCell, params, onRendered); + + switch (typeof contents === 'undefined' ? 'undefined' : _typeof(contents)) { + case "object": + if (contents instanceof Node) { + el.appendChild(contents); + } else { + el.innerHTML = ""; + console.warn("Format Error - Title formatter has returned a type of object, the only valid formatter object return is an instance of Node, the formatter returned:", contents); + } + break; + case "undefined": + case "null": + el.innerHTML = ""; + break; + default: + el.innerHTML = contents; + } + } else { + el.innerHTML = title; + } +}; + +//build header element for column group +Column.prototype._buildGroupHeader = function () { + var _this6 = this; + + this.element.classList.add("tabulator-col-group"); + this.element.setAttribute("role", "columngroup"); + this.element.setAttribute("aria-title", this.definition.title); + + //asign additional css classes to column header + if (this.definition.cssClass) { + var classeNames = this.definition.cssClass.split(" "); + classeNames.forEach(function (className) { + _this6.element.classList.add(className); + }); + } + + //set column header context menu + if ((this.definition.headerContextMenu || this.definition.headerMenu) && this.table.modExists("menu")) { + this.table.modules.menu.initializeColumnHeader(this); + } + + this.element.appendChild(this.groupElement); +}; + +//flat field lookup +Column.prototype._getFlatData = function (data) { + return data[this.field]; +}; + +//nested field lookup +Column.prototype._getNestedData = function (data) { + var dataObj = data, + structure = this.fieldStructure, + length = structure.length, + output; + + for (var i = 0; i < length; i++) { + + dataObj = dataObj[structure[i]]; + + output = dataObj; + + if (!dataObj) { + break; + } + } + + return output; +}; + +//flat field set +Column.prototype._setFlatData = function (data, value) { + if (this.field) { + data[this.field] = value; + } +}; + +//nested field set +Column.prototype._setNestedData = function (data, value) { + var dataObj = data, + structure = this.fieldStructure, + length = structure.length; + + for (var i = 0; i < length; i++) { + + if (i == length - 1) { + dataObj[structure[i]] = value; + } else { + if (!dataObj[structure[i]]) { + if (typeof value !== "undefined") { + dataObj[structure[i]] = {}; + } else { + break; + } + } + + dataObj = dataObj[structure[i]]; + } + } +}; + +//attach column to this group +Column.prototype.attachColumn = function (column) { + var self = this; + + if (self.groupElement) { + self.columns.push(column); + self.groupElement.appendChild(column.getElement()); + } else { + console.warn("Column Warning - Column being attached to another column instead of column group"); + } +}; + +//vertically align header in column +Column.prototype.verticalAlign = function (alignment, height) { + + //calculate height of column header and group holder element + var parentHeight = this.parent.isGroup ? this.parent.getGroupElement().clientHeight : height || this.parent.getHeadersElement().clientHeight; + // var parentHeight = this.parent.isGroup ? this.parent.getGroupElement().clientHeight : this.parent.getHeadersElement().clientHeight; + + this.element.style.height = parentHeight + "px"; + + if (this.isGroup) { + this.groupElement.style.minHeight = parentHeight - this.contentElement.offsetHeight + "px"; + } + + //vertically align cell contents + if (!this.isGroup && alignment !== "top") { + if (alignment === "bottom") { + this.element.style.paddingTop = this.element.clientHeight - this.contentElement.offsetHeight + "px"; + } else { + this.element.style.paddingTop = (this.element.clientHeight - this.contentElement.offsetHeight) / 2 + "px"; + } + } + + this.columns.forEach(function (column) { + column.verticalAlign(alignment); + }); +}; + +//clear vertical alignmenet +Column.prototype.clearVerticalAlign = function () { + this.element.style.paddingTop = ""; + this.element.style.height = ""; + this.element.style.minHeight = ""; + this.groupElement.style.minHeight = ""; + + this.columns.forEach(function (column) { + column.clearVerticalAlign(); + }); +}; + +Column.prototype.bindModuleColumns = function () { + //check if rownum formatter is being used on a column + if (this.definition.formatter == "rownum") { + this.table.rowManager.rowNumColumn = this; + } +}; + +//// Retreive Column Information //// + +//return column header element +Column.prototype.getElement = function () { + return this.element; +}; + +//return colunm group element +Column.prototype.getGroupElement = function () { + return this.groupElement; +}; + +//return field name +Column.prototype.getField = function () { + return this.field; +}; + +//return the first column in a group +Column.prototype.getFirstColumn = function () { + if (!this.isGroup) { + return this; + } else { + if (this.columns.length) { + return this.columns[0].getFirstColumn(); + } else { + return false; + } + } +}; + +//return the last column in a group +Column.prototype.getLastColumn = function () { + if (!this.isGroup) { + return this; + } else { + if (this.columns.length) { + return this.columns[this.columns.length - 1].getLastColumn(); + } else { + return false; + } + } +}; + +//return all columns in a group +Column.prototype.getColumns = function () { + return this.columns; +}; + +//return all columns in a group +Column.prototype.getCells = function () { + return this.cells; +}; + +//retreive the top column in a group of columns +Column.prototype.getTopColumn = function () { + if (this.parent.isGroup) { + return this.parent.getTopColumn(); + } else { + return this; + } +}; + +//return column definition object +Column.prototype.getDefinition = function (updateBranches) { + var colDefs = []; + + if (this.isGroup && updateBranches) { + this.columns.forEach(function (column) { + colDefs.push(column.getDefinition(true)); + }); + + this.definition.columns = colDefs; + } + + return this.definition; +}; + +//////////////////// Actions //////////////////// + +Column.prototype.checkColumnVisibility = function () { + var visible = false; + + this.columns.forEach(function (column) { + if (column.visible) { + visible = true; + } + }); + + if (visible) { + this.show(); + this.parent.table.options.columnVisibilityChanged.call(this.table, this.getComponent(), false); + } else { + this.hide(); + } +}; + +//show column +Column.prototype.show = function (silent, responsiveToggle) { + if (!this.visible) { + this.visible = true; + + this.element.style.display = ""; + + if (this.parent.isGroup) { + this.parent.checkColumnVisibility(); + } + + this.cells.forEach(function (cell) { + cell.show(); + }); + + if (!this.isGroup && this.width === null) { + this.reinitializeWidth(); + } + + this.table.columnManager._verticalAlignHeaders(); + + if (this.table.options.persistence && this.table.modExists("persistence", true) && this.table.modules.persistence.config.columns) { + this.table.modules.persistence.save("columns"); + } + + if (!responsiveToggle && this.table.options.responsiveLayout && this.table.modExists("responsiveLayout", true)) { + this.table.modules.responsiveLayout.updateColumnVisibility(this, this.visible); + } + + if (!silent) { + this.table.options.columnVisibilityChanged.call(this.table, this.getComponent(), true); + } + + if (this.parent.isGroup) { + this.parent.matchChildWidths(); + } + } +}; + +//hide column +Column.prototype.hide = function (silent, responsiveToggle) { + if (this.visible) { + this.visible = false; + + this.element.style.display = "none"; + + this.table.columnManager._verticalAlignHeaders(); + + if (this.parent.isGroup) { + this.parent.checkColumnVisibility(); + } + + this.cells.forEach(function (cell) { + cell.hide(); + }); + + if (this.table.options.persistence && this.table.modExists("persistence", true) && this.table.modules.persistence.config.columns) { + this.table.modules.persistence.save("columns"); + } + + if (!responsiveToggle && this.table.options.responsiveLayout && this.table.modExists("responsiveLayout", true)) { + this.table.modules.responsiveLayout.updateColumnVisibility(this, this.visible); + } + + if (!silent) { + this.table.options.columnVisibilityChanged.call(this.table, this.getComponent(), false); + } + + if (this.parent.isGroup) { + this.parent.matchChildWidths(); + } + } +}; + +Column.prototype.matchChildWidths = function () { + var childWidth = 0; + + if (this.contentElement && this.columns.length) { + this.columns.forEach(function (column) { + if (column.visible) { + childWidth += column.getWidth(); + } + }); + + this.contentElement.style.maxWidth = childWidth - 1 + "px"; + + if (this.parent.isGroup) { + this.parent.matchChildWidths(); + } + } +}; + +Column.prototype.setWidth = function (width) { + this.widthFixed = true; + this.setWidthActual(width); +}; + +Column.prototype.setWidthActual = function (width) { + if (isNaN(width)) { + width = Math.floor(this.table.element.clientWidth / 100 * parseInt(width)); + } + + width = Math.max(this.minWidth, width); + + this.width = width; + this.widthStyled = width ? width + "px" : ""; + + this.element.style.width = this.widthStyled; + + if (!this.isGroup) { + this.cells.forEach(function (cell) { + cell.setWidth(); + }); + } + + if (this.parent.isGroup) { + this.parent.matchChildWidths(); + } + + //set resizable handles + if (this.table.modExists("frozenColumns")) { + this.table.modules.frozenColumns.layout(); + } +}; + +Column.prototype.checkCellHeights = function () { + var rows = []; + + this.cells.forEach(function (cell) { + if (cell.row.heightInitialized) { + if (cell.row.getElement().offsetParent !== null) { + rows.push(cell.row); + cell.row.clearCellHeight(); + } else { + cell.row.heightInitialized = false; + } + } + }); + + rows.forEach(function (row) { + row.calcHeight(); + }); + + rows.forEach(function (row) { + row.setCellHeight(); + }); +}; + +Column.prototype.getWidth = function () { + var width = 0; + + if (this.isGroup) { + this.columns.forEach(function (column) { + if (column.visible) { + width += column.getWidth(); + } + }); + } else { + width = this.width; + } + + return width; +}; + +Column.prototype.getHeight = function () { + return this.element.offsetHeight; +}; + +Column.prototype.setMinWidth = function (minWidth) { + this.minWidth = minWidth; + this.minWidthStyled = minWidth ? minWidth + "px" : ""; + + this.element.style.minWidth = this.minWidthStyled; + + this.cells.forEach(function (cell) { + cell.setMinWidth(); + }); +}; + +Column.prototype.delete = function () { + var _this7 = this; + + return new Promise(function (resolve, reject) { + + if (_this7.isGroup) { + _this7.columns.forEach(function (column) { + column.delete(); + }); + } + + //cancel edit if column is currently being edited + if (_this7.table.modExists("edit")) { + if (_this7.table.modules.edit.currentCell.column === _this7) { + _this7.table.modules.edit.cancelEdit(); + } + } + + var cellCount = _this7.cells.length; + + for (var i = 0; i < cellCount; i++) { + _this7.cells[0].delete(); + } + + _this7.element.parentNode.removeChild(_this7.element); + + _this7.table.columnManager.deregisterColumn(_this7); + + resolve(); + }); +}; + +Column.prototype.columnRendered = function () { + if (this.titleFormatterRendered) { + this.titleFormatterRendered(); + } +}; + +Column.prototype.validate = function () { + var invalid = []; + + this.cells.forEach(function (cell) { + if (!cell.validate()) { + invalid.push(cell.getComponent()); + } + }); + + return invalid.length ? invalid : true; +}; + +//////////////// Cell Management ///////////////// + +//generate cell for this column +Column.prototype.generateCell = function (row) { + var self = this; + + var cell = new Cell(self, row); + + this.cells.push(cell); + + return cell; +}; + +Column.prototype.nextColumn = function () { + var index = this.table.columnManager.findColumnIndex(this); + return index > -1 ? this._nextVisibleColumn(index + 1) : false; +}; + +Column.prototype._nextVisibleColumn = function (index) { + var column = this.table.columnManager.getColumnByIndex(index); + return !column || column.visible ? column : this._nextVisibleColumn(index + 1); +}; + +Column.prototype.prevColumn = function () { + var index = this.table.columnManager.findColumnIndex(this); + return index > -1 ? this._prevVisibleColumn(index - 1) : false; +}; + +Column.prototype._prevVisibleColumn = function (index) { + var column = this.table.columnManager.getColumnByIndex(index); + return !column || column.visible ? column : this._prevVisibleColumn(index - 1); +}; + +Column.prototype.reinitializeWidth = function (force) { + this.widthFixed = false; + + //set width if present + if (typeof this.definition.width !== "undefined" && !force) { + this.setWidth(this.definition.width); + } + + //hide header filters to prevent them altering column width + if (this.table.modExists("filter")) { + this.table.modules.filter.hideHeaderFilterElements(); + } + + this.fitToData(); + + //show header filters again after layout is complete + if (this.table.modExists("filter")) { + this.table.modules.filter.showHeaderFilterElements(); + } +}; + +//set column width to maximum cell width +Column.prototype.fitToData = function () { + var self = this; + + if (!this.widthFixed) { + this.element.style.width = ""; + + self.cells.forEach(function (cell) { + cell.clearWidth(); + }); + } + + var maxWidth = this.element.offsetWidth; + + if (!self.width || !this.widthFixed) { + self.cells.forEach(function (cell) { + var width = cell.getWidth(); + + if (width > maxWidth) { + maxWidth = width; + } + }); + + if (maxWidth) { + self.setWidthActual(maxWidth + 1); + } + } +}; + +Column.prototype.updateDefinition = function (updates) { + var _this8 = this; + + return new Promise(function (resolve, reject) { + var definition; + + if (!_this8.isGroup) { + definition = Object.assign({}, _this8.getDefinition()); + definition = Object.assign(definition, updates); + + _this8.table.columnManager.addColumn(definition, false, _this8).then(function (column) { + + if (definition.field == _this8.field) { + _this8.field = false; //cleair field name to prevent deletion of duplicate column from arrays + } + + _this8.delete().then(function () { + resolve(column.getComponent()); + }).catch(function (err) { + reject(err); + }); + }).catch(function (err) { + reject(err); + }); + } else { + console.warn("Column Update Error - The updateDefintion function is only available on columns, not column groups"); + reject("Column Update Error - The updateDefintion function is only available on columns, not column groups"); + } + }); +}; + +Column.prototype.deleteCell = function (cell) { + var index = this.cells.indexOf(cell); + + if (index > -1) { + this.cells.splice(index, 1); + } +}; + +Column.prototype.defaultOptionList = ["title", "field", "columns", "visible", "align", "hozAlign", "vertAlign", "width", "minWidth", "widthGrow", "widthShrink", "resizable", "frozen", "responsive", "tooltip", "cssClass", "rowHandle", "hideInHtml", "print", "htmlOutput", "sorter", "sorterParams", "formatter", "formatterParams", "variableHeight", "editable", "editor", "editorParams", "validator", "mutator", "mutatorParams", "mutatorData", "mutatorDataParams", "mutatorEdit", "mutatorEditParams", "mutatorClipboard", "mutatorClipboardParams", "accessor", "accessorParams", "accessorData", "accessorDataParams", "accessorDownload", "accessorDownloadParams", "accessorClipboard", "accessorClipboardParams", "accessorPrint", "accessorPrintParams", "accessorHtmlOutput", "accessorHtmlOutputParams", "clipboard", "download", "downloadTitle", "topCalc", "topCalcParams", "topCalcFormatter", "topCalcFormatterParams", "bottomCalc", "bottomCalcParams", "bottomCalcFormatter", "bottomCalcFormatterParams", "cellClick", "cellDblClick", "cellContext", "cellTap", "cellDblTap", "cellTapHold", "cellMouseEnter", "cellMouseLeave", "cellMouseOver", "cellMouseOut", "cellMouseMove", "cellEditing", "cellEdited", "cellEditCancelled", "headerSort", "headerSortStartingDir", "headerSortTristate", "headerClick", "headerDblClick", "headerContext", "headerTap", "headerDblTap", "headerTapHold", "headerTooltip", "headerVertical", "editableTitle", "titleFormatter", "titleFormatterParams", "headerFilter", "headerFilterPlaceholder", "headerFilterParams", "headerFilterEmptyCheck", "headerFilterFunc", "headerFilterFuncParams", "headerFilterLiveFilter", "print", "headerContextMenu", "headerMenu", "contextMenu", "formatterPrint", "formatterPrintParams", "formatterClipboard", "formatterClipboardParams", "formatterHtmlOutput", "formatterHtmlOutputParams", "titlePrint", "titleClipboard", "titleHtmlOutput", "titleDownload"]; + +//////////////// Event Bindings ///////////////// + +//////////////// Object Generation ///////////////// +Column.prototype.getComponent = function () { + if (!this.component) { + this.component = new ColumnComponent(this); + } + + return this.component; +}; + +var RowManager = function RowManager(table) { + + this.table = table; + this.element = this.createHolderElement(); //containing element + this.tableElement = this.createTableElement(); //table element + this.heightFixer = this.createTableElement(); //table element + this.columnManager = null; //hold column manager object + this.height = 0; //hold height of table element + + this.firstRender = false; //handle first render + this.renderMode = "virtual"; //current rendering mode + this.fixedHeight = false; //current rendering mode + + this.rows = []; //hold row data objects + this.activeRows = []; //rows currently available to on display in the table + this.activeRowsCount = 0; //count of active rows + + this.displayRows = []; //rows currently on display in the table + this.displayRowsCount = 0; //count of display rows + + this.scrollTop = 0; + this.scrollLeft = 0; + + this.vDomRowHeight = 20; //approximation of row heights for padding + + this.vDomTop = 0; //hold position for first rendered row in the virtual DOM + this.vDomBottom = 0; //hold possition for last rendered row in the virtual DOM + + this.vDomScrollPosTop = 0; //last scroll position of the vDom top; + this.vDomScrollPosBottom = 0; //last scroll position of the vDom bottom; + + this.vDomTopPad = 0; //hold value of padding for top of virtual DOM + this.vDomBottomPad = 0; //hold value of padding for bottom of virtual DOM + + this.vDomMaxRenderChain = 90; //the maximum number of dom elements that can be rendered in 1 go + + this.vDomWindowBuffer = 0; //window row buffer before removing elements, to smooth scrolling + + this.vDomWindowMinTotalRows = 20; //minimum number of rows to be generated in virtual dom (prevent buffering issues on tables with tall rows) + this.vDomWindowMinMarginRows = 5; //minimum number of rows to be generated in virtual dom margin + + this.vDomTopNewRows = []; //rows to normalize after appending to optimize render speed + this.vDomBottomNewRows = []; //rows to normalize after appending to optimize render speed + + this.rowNumColumn = false; //hold column component for row number column + + this.redrawBlock = false; //prevent redraws to allow multiple data manipulations becore continuing + this.redrawBlockRestoreConfig = false; //store latest redraw function calls for when redraw is needed + this.redrawBlockRederInPosition = false; //store latest redraw function calls for when redraw is needed +}; + +//////////////// Setup Functions ///////////////// + +RowManager.prototype.createHolderElement = function () { + var el = document.createElement("div"); + + el.classList.add("tabulator-tableHolder"); + el.setAttribute("tabindex", 0); + + return el; +}; + +RowManager.prototype.createTableElement = function () { + var el = document.createElement("div"); + + el.classList.add("tabulator-table"); + + return el; +}; + +//return containing element +RowManager.prototype.getElement = function () { + return this.element; +}; + +//return table element +RowManager.prototype.getTableElement = function () { + return this.tableElement; +}; + +//return position of row in table +RowManager.prototype.getRowPosition = function (row, active) { + if (active) { + return this.activeRows.indexOf(row); + } else { + return this.rows.indexOf(row); + } +}; + +//link to column manager +RowManager.prototype.setColumnManager = function (manager) { + this.columnManager = manager; +}; + +RowManager.prototype.initialize = function () { + var self = this; + + self.setRenderMode(); + + //initialize manager + self.element.appendChild(self.tableElement); + + self.firstRender = true; + + //scroll header along with table body + self.element.addEventListener("scroll", function () { + var left = self.element.scrollLeft; + + //handle horizontal scrolling + if (self.scrollLeft != left) { + self.columnManager.scrollHorizontal(left); + + if (self.table.options.groupBy) { + self.table.modules.groupRows.scrollHeaders(left); + } + + if (self.table.modExists("columnCalcs")) { + self.table.modules.columnCalcs.scrollHorizontal(left); + } + + self.table.options.scrollHorizontal(left); + } + + self.scrollLeft = left; + }); + + //handle virtual dom scrolling + if (this.renderMode === "virtual") { + + self.element.addEventListener("scroll", function () { + var top = self.element.scrollTop; + var dir = self.scrollTop > top; + + //handle verical scrolling + if (self.scrollTop != top) { + self.scrollTop = top; + self.scrollVertical(dir); + + if (self.table.options.ajaxProgressiveLoad == "scroll") { + self.table.modules.ajax.nextPage(self.element.scrollHeight - self.element.clientHeight - top); + } + + self.table.options.scrollVertical(top); + } else { + self.scrollTop = top; + } + }); + } +}; + +////////////////// Row Manipulation ////////////////// + +RowManager.prototype.findRow = function (subject) { + var self = this; + + if ((typeof subject === 'undefined' ? 'undefined' : _typeof(subject)) == "object") { + + if (subject instanceof Row) { + //subject is row element + return subject; + } else if (subject instanceof RowComponent) { + //subject is public row component + return subject._getSelf() || false; + } else if (typeof HTMLElement !== "undefined" && subject instanceof HTMLElement) { + //subject is a HTML element of the row + var match = self.rows.find(function (row) { + return row.element === subject; + }); + + return match || false; + } + } else if (typeof subject == "undefined" || subject === null) { + return false; + } else { + //subject should be treated as the index of the row + var _match = self.rows.find(function (row) { + return row.data[self.table.options.index] == subject; + }); + + return _match || false; + } + + //catch all for any other type of input + + return false; +}; + +RowManager.prototype.getRowFromDataObject = function (data) { + var match = this.rows.find(function (row) { + return row.data === data; + }); + + return match || false; +}; + +RowManager.prototype.getRowFromPosition = function (position, active) { + if (active) { + return this.activeRows[position]; + } else { + return this.rows[position]; + } +}; + +RowManager.prototype.scrollToRow = function (row, position, ifVisible) { + var _this9 = this; + + var rowIndex = this.getDisplayRows().indexOf(row), + rowEl = row.getElement(), + rowTop, + offset = 0; + + return new Promise(function (resolve, reject) { + if (rowIndex > -1) { + + if (typeof position === "undefined") { + position = _this9.table.options.scrollToRowPosition; + } + + if (typeof ifVisible === "undefined") { + ifVisible = _this9.table.options.scrollToRowIfVisible; + } + + if (position === "nearest") { + switch (_this9.renderMode) { + case "classic": + rowTop = Tabulator.prototype.helpers.elOffset(rowEl).top; + position = Math.abs(_this9.element.scrollTop - rowTop) > Math.abs(_this9.element.scrollTop + _this9.element.clientHeight - rowTop) ? "bottom" : "top"; + break; + case "virtual": + position = Math.abs(_this9.vDomTop - rowIndex) > Math.abs(_this9.vDomBottom - rowIndex) ? "bottom" : "top"; + break; + } + } + + //check row visibility + if (!ifVisible) { + if (Tabulator.prototype.helpers.elVisible(rowEl)) { + offset = Tabulator.prototype.helpers.elOffset(rowEl).top - Tabulator.prototype.helpers.elOffset(_this9.element).top; + + if (offset > 0 && offset < _this9.element.clientHeight - rowEl.offsetHeight) { + return false; + } + } + } + + //scroll to row + switch (_this9.renderMode) { + case "classic": + _this9.element.scrollTop = Tabulator.prototype.helpers.elOffset(rowEl).top - Tabulator.prototype.helpers.elOffset(_this9.element).top + _this9.element.scrollTop; + break; + case "virtual": + _this9._virtualRenderFill(rowIndex, true); + break; + } + + //align to correct position + switch (position) { + case "middle": + case "center": + + if (_this9.element.scrollHeight - _this9.element.scrollTop == _this9.element.clientHeight) { + _this9.element.scrollTop = _this9.element.scrollTop + (rowEl.offsetTop - _this9.element.scrollTop) - (_this9.element.scrollHeight - rowEl.offsetTop) / 2; + } else { + _this9.element.scrollTop = _this9.element.scrollTop - _this9.element.clientHeight / 2; + } + + break; + + case "bottom": + + if (_this9.element.scrollHeight - _this9.element.scrollTop == _this9.element.clientHeight) { + _this9.element.scrollTop = _this9.element.scrollTop - (_this9.element.scrollHeight - rowEl.offsetTop) + rowEl.offsetHeight; + } else { + _this9.element.scrollTop = _this9.element.scrollTop - _this9.element.clientHeight + rowEl.offsetHeight; + } + + break; + } + + resolve(); + } else { + console.warn("Scroll Error - Row not visible"); + reject("Scroll Error - Row not visible"); + } + }); +}; + +////////////////// Data Handling ////////////////// + +RowManager.prototype.setData = function (data, renderInPosition, columnsChanged) { + var _this10 = this; + + var self = this; + + return new Promise(function (resolve, reject) { + if (renderInPosition && _this10.getDisplayRows().length) { + if (self.table.options.pagination) { + self._setDataActual(data, true); + } else { + _this10.reRenderInPosition(function () { + self._setDataActual(data); + }); + } + } else { + if (_this10.table.options.autoColumns && columnsChanged) { + _this10.table.columnManager.generateColumnsFromRowData(data); + } + _this10.resetScroll(); + _this10._setDataActual(data); + } + + resolve(); + }); +}; + +RowManager.prototype._setDataActual = function (data, renderInPosition) { + var self = this; + + self.table.options.dataLoading.call(this.table, data); + + this._wipeElements(); + + if (this.table.options.history && this.table.modExists("history")) { + this.table.modules.history.clear(); + } + + if (Array.isArray(data)) { + + if (this.table.modExists("selectRow")) { + this.table.modules.selectRow.clearSelectionData(); + } + + if (this.table.options.reactiveData && this.table.modExists("reactiveData", true)) { + this.table.modules.reactiveData.watchData(data); + } + + data.forEach(function (def, i) { + if (def && (typeof def === 'undefined' ? 'undefined' : _typeof(def)) === "object") { + var row = new Row(def, self); + self.rows.push(row); + } else { + console.warn("Data Loading Warning - Invalid row data detected and ignored, expecting object but received:", def); + } + }); + + self.table.options.dataLoaded.call(this.table, data); + + self.refreshActiveData(false, false, renderInPosition); + } else { + console.error("Data Loading Error - Unable to process data due to invalid data type \nExpecting: array \nReceived: ", typeof data === 'undefined' ? 'undefined' : _typeof(data), "\nData: ", data); + } +}; + +RowManager.prototype._wipeElements = function () { + this.rows.forEach(function (row) { + row.wipe(); + }); + + if (this.table.options.groupBy && this.table.modExists("groupRows")) { + this.table.modules.groupRows.wipe(); + } + + this.rows = []; +}; + +RowManager.prototype.deleteRow = function (row, blockRedraw) { + var allIndex = this.rows.indexOf(row), + activeIndex = this.activeRows.indexOf(row); + + if (activeIndex > -1) { + this.activeRows.splice(activeIndex, 1); + } + + if (allIndex > -1) { + this.rows.splice(allIndex, 1); + } + + this.setActiveRows(this.activeRows); + + this.displayRowIterator(function (rows) { + var displayIndex = rows.indexOf(row); + + if (displayIndex > -1) { + rows.splice(displayIndex, 1); + } + }); + + if (!blockRedraw) { + this.reRenderInPosition(); + } + + this.regenerateRowNumbers(); + + this.table.options.rowDeleted.call(this.table, row.getComponent()); + + this.table.options.dataEdited.call(this.table, this.getData()); + + if (this.table.options.groupBy && this.table.modExists("groupRows")) { + this.table.modules.groupRows.updateGroupRows(true); + } else if (this.table.options.pagination && this.table.modExists("page")) { + this.refreshActiveData(false, false, true); + } else { + if (this.table.options.pagination && this.table.modExists("page")) { + this.refreshActiveData("page"); + } + } +}; + +RowManager.prototype.addRow = function (data, pos, index, blockRedraw) { + + var row = this.addRowActual(data, pos, index, blockRedraw); + + if (this.table.options.history && this.table.modExists("history")) { + this.table.modules.history.action("rowAdd", row, { data: data, pos: pos, index: index }); + } + + return row; +}; + +//add multiple rows +RowManager.prototype.addRows = function (data, pos, index) { + var _this11 = this; + + var self = this, + length = 0, + rows = []; + + return new Promise(function (resolve, reject) { + pos = _this11.findAddRowPos(pos); + + if (!Array.isArray(data)) { + data = [data]; + } + + length = data.length - 1; + + if (typeof index == "undefined" && pos || typeof index !== "undefined" && !pos) { + data.reverse(); + } + + data.forEach(function (item, i) { + var row = self.addRow(item, pos, index, true); + rows.push(row); + }); + + if (_this11.table.options.groupBy && _this11.table.modExists("groupRows")) { + _this11.table.modules.groupRows.updateGroupRows(true); + } else if (_this11.table.options.pagination && _this11.table.modExists("page")) { + _this11.refreshActiveData(false, false, true); + } else { + _this11.reRenderInPosition(); + } + + //recalc column calculations if present + if (_this11.table.modExists("columnCalcs")) { + _this11.table.modules.columnCalcs.recalc(_this11.table.rowManager.activeRows); + } + + _this11.regenerateRowNumbers(); + resolve(rows); + }); +}; + +RowManager.prototype.findAddRowPos = function (pos) { + if (typeof pos === "undefined") { + pos = this.table.options.addRowPos; + } + + if (pos === "pos") { + pos = true; + } + + if (pos === "bottom") { + pos = false; + } + + return pos; +}; + +RowManager.prototype.addRowActual = function (data, pos, index, blockRedraw) { + var row = data instanceof Row ? data : new Row(data || {}, this), + top = this.findAddRowPos(pos), + allIndex = -1, + activeIndex, + dispRows; + + if (!index && this.table.options.pagination && this.table.options.paginationAddRow == "page") { + dispRows = this.getDisplayRows(); + + if (top) { + if (dispRows.length) { + index = dispRows[0]; + } else { + if (this.activeRows.length) { + index = this.activeRows[this.activeRows.length - 1]; + top = false; + } + } + } else { + if (dispRows.length) { + index = dispRows[dispRows.length - 1]; + top = dispRows.length < this.table.modules.page.getPageSize() ? false : true; + } + } + } + + if (typeof index !== "undefined") { + index = this.findRow(index); + } + + if (this.table.options.groupBy && this.table.modExists("groupRows")) { + this.table.modules.groupRows.assignRowToGroup(row); + + var groupRows = row.getGroup().rows; + + if (groupRows.length > 1) { + + if (!index || index && groupRows.indexOf(index) == -1) { + if (top) { + if (groupRows[0] !== row) { + index = groupRows[0]; + this._moveRowInArray(row.getGroup().rows, row, index, !top); + } + } else { + if (groupRows[groupRows.length - 1] !== row) { + index = groupRows[groupRows.length - 1]; + this._moveRowInArray(row.getGroup().rows, row, index, !top); + } + } + } else { + this._moveRowInArray(row.getGroup().rows, row, index, !top); + } + } + } + + if (index) { + allIndex = this.rows.indexOf(index); + } + + if (index && allIndex > -1) { + activeIndex = this.activeRows.indexOf(index); + + this.displayRowIterator(function (rows) { + var displayIndex = rows.indexOf(index); + + if (displayIndex > -1) { + rows.splice(top ? displayIndex : displayIndex + 1, 0, row); + } + }); + + if (activeIndex > -1) { + this.activeRows.splice(top ? activeIndex : activeIndex + 1, 0, row); + } + + this.rows.splice(top ? allIndex : allIndex + 1, 0, row); + } else { + + if (top) { + + this.displayRowIterator(function (rows) { + rows.unshift(row); + }); + + this.activeRows.unshift(row); + this.rows.unshift(row); + } else { + this.displayRowIterator(function (rows) { + rows.push(row); + }); + + this.activeRows.push(row); + this.rows.push(row); + } + } + + this.setActiveRows(this.activeRows); + + this.table.options.rowAdded.call(this.table, row.getComponent()); + + this.table.options.dataEdited.call(this.table, this.getData()); + + if (!blockRedraw) { + this.reRenderInPosition(); + } + + return row; +}; + +RowManager.prototype.moveRow = function (from, to, after) { + if (this.table.options.history && this.table.modExists("history")) { + this.table.modules.history.action("rowMove", from, { posFrom: this.getRowPosition(from), posTo: this.getRowPosition(to), to: to, after: after }); + } + + this.moveRowActual(from, to, after); + + this.regenerateRowNumbers(); + + this.table.options.rowMoved.call(this.table, from.getComponent()); +}; + +RowManager.prototype.moveRowActual = function (from, to, after) { + var _this12 = this; + + this._moveRowInArray(this.rows, from, to, after); + this._moveRowInArray(this.activeRows, from, to, after); + + this.displayRowIterator(function (rows) { + _this12._moveRowInArray(rows, from, to, after); + }); + + if (this.table.options.groupBy && this.table.modExists("groupRows")) { + + if (!after && to instanceof Group) { + to = this.table.rowManager.prevDisplayRow(from) || to; + } + + var toGroup = to.getGroup(); + var fromGroup = from.getGroup(); + + if (toGroup === fromGroup) { + this._moveRowInArray(toGroup.rows, from, to, after); + } else { + if (fromGroup) { + fromGroup.removeRow(from); + } + + toGroup.insertRow(from, to, after); + } + } +}; + +RowManager.prototype._moveRowInArray = function (rows, from, to, after) { + var fromIndex, toIndex, start, end; + + if (from !== to) { + + fromIndex = rows.indexOf(from); + + if (fromIndex > -1) { + + rows.splice(fromIndex, 1); + + toIndex = rows.indexOf(to); + + if (toIndex > -1) { + + if (after) { + rows.splice(toIndex + 1, 0, from); + } else { + rows.splice(toIndex, 0, from); + } + } else { + rows.splice(fromIndex, 0, from); + } + } + + //restyle rows + if (rows === this.getDisplayRows()) { + + start = fromIndex < toIndex ? fromIndex : toIndex; + end = toIndex > fromIndex ? toIndex : fromIndex + 1; + + for (var i = start; i <= end; i++) { + if (rows[i]) { + this.styleRow(rows[i], i); + } + } + } + } +}; + +RowManager.prototype.clearData = function () { + this.setData([]); +}; + +RowManager.prototype.getRowIndex = function (row) { + return this.findRowIndex(row, this.rows); +}; + +RowManager.prototype.getDisplayRowIndex = function (row) { + var index = this.getDisplayRows().indexOf(row); + return index > -1 ? index : false; +}; + +RowManager.prototype.nextDisplayRow = function (row, rowOnly) { + var index = this.getDisplayRowIndex(row), + nextRow = false; + + if (index !== false && index < this.displayRowsCount - 1) { + nextRow = this.getDisplayRows()[index + 1]; + } + + if (nextRow && (!(nextRow instanceof Row) || nextRow.type != "row")) { + return this.nextDisplayRow(nextRow, rowOnly); + } + + return nextRow; +}; + +RowManager.prototype.prevDisplayRow = function (row, rowOnly) { + var index = this.getDisplayRowIndex(row), + prevRow = false; + + if (index) { + prevRow = this.getDisplayRows()[index - 1]; + } + + if (rowOnly && prevRow && (!(prevRow instanceof Row) || prevRow.type != "row")) { + return this.prevDisplayRow(prevRow, rowOnly); + } + + return prevRow; +}; + +RowManager.prototype.findRowIndex = function (row, list) { + var rowIndex; + + row = this.findRow(row); + + if (row) { + rowIndex = list.indexOf(row); + + if (rowIndex > -1) { + return rowIndex; + } + } + + return false; +}; + +RowManager.prototype.getData = function (active, transform) { + var output = [], + rows = this.getRows(active); + + rows.forEach(function (row) { + if (row.type == "row") { + output.push(row.getData(transform || "data")); + } + }); + + return output; +}; + +RowManager.prototype.getComponents = function (active) { + var output = [], + rows = this.getRows(active); + + rows.forEach(function (row) { + output.push(row.getComponent()); + }); + + return output; +}; + +RowManager.prototype.getDataCount = function (active) { + var rows = this.getRows(active); + + return rows.length; +}; + +RowManager.prototype._genRemoteRequest = function () { + var _this13 = this; + + var table = this.table, + options = table.options, + params = {}; + + if (table.modExists("page")) { + //set sort data if defined + if (options.ajaxSorting) { + var sorters = this.table.modules.sort.getSort(); + + sorters.forEach(function (item) { + delete item.column; + }); + + params[this.table.modules.page.paginationDataSentNames.sorters] = sorters; + } + + //set filter data if defined + if (options.ajaxFiltering) { + var filters = this.table.modules.filter.getFilters(true, true); + + params[this.table.modules.page.paginationDataSentNames.filters] = filters; + } + + this.table.modules.ajax.setParams(params, true); + } + + table.modules.ajax.sendRequest().then(function (data) { + _this13._setDataActual(data, true); + }).catch(function (e) {}); +}; + +//choose the path to refresh data after a filter update +RowManager.prototype.filterRefresh = function () { + var table = this.table, + options = table.options, + left = this.scrollLeft; + + if (options.ajaxFiltering) { + if (options.pagination == "remote" && table.modExists("page")) { + table.modules.page.reset(true); + table.modules.page.setPage(1).then(function () {}).catch(function () {}); + } else if (options.ajaxProgressiveLoad) { + table.modules.ajax.loadData().then(function () {}).catch(function () {}); + } else { + //assume data is url, make ajax call to url to get data + this._genRemoteRequest(); + } + } else { + this.refreshActiveData("filter"); + } + + this.scrollHorizontal(left); +}; + +//choose the path to refresh data after a sorter update +RowManager.prototype.sorterRefresh = function (loadOrignalData) { + var table = this.table, + options = this.table.options, + left = this.scrollLeft; + + if (options.ajaxSorting) { + if ((options.pagination == "remote" || options.progressiveLoad) && table.modExists("page")) { + table.modules.page.reset(true); + table.modules.page.setPage(1).then(function () {}).catch(function () {}); + } else if (options.ajaxProgressiveLoad) { + table.modules.ajax.loadData().then(function () {}).catch(function () {}); + } else { + //assume data is url, make ajax call to url to get data + this._genRemoteRequest(); + } + } else { + this.refreshActiveData(loadOrignalData ? "filter" : "sort"); + } + + this.scrollHorizontal(left); +}; + +RowManager.prototype.scrollHorizontal = function (left) { + this.scrollLeft = left; + this.element.scrollLeft = left; + + if (this.table.options.groupBy) { + this.table.modules.groupRows.scrollHeaders(left); + } + + if (this.table.modExists("columnCalcs")) { + this.table.modules.columnCalcs.scrollHorizontal(left); + } +}; + +//set active data set +RowManager.prototype.refreshActiveData = function (stage, skipStage, renderInPosition) { + var self = this, + table = this.table, + cascadeOrder = ["all", "filter", "sort", "display", "freeze", "group", "tree", "page"], + displayIndex; + + if (this.redrawBlock) { + + if (!this.redrawBlockRestoreConfig || cascadeOrder.indexOf(stage) < cascadeOrder.indexOf(this.redrawBlockRestoreConfig.stage)) { + this.redrawBlockRestoreConfig = { + stage: stage, + skipStage: skipStage, + renderInPosition: renderInPosition + }; + } + + return; + } else { + + if (self.table.modExists("edit")) { + self.table.modules.edit.cancelEdit(); + } + + if (!stage) { + stage = "all"; + } + + if (table.options.selectable && !table.options.selectablePersistence && table.modExists("selectRow")) { + table.modules.selectRow.deselectRows(); + } + + //cascade through data refresh stages + switch (stage) { + case "all": + + case "filter": + if (!skipStage) { + if (table.modExists("filter")) { + self.setActiveRows(table.modules.filter.filter(self.rows)); + } else { + self.setActiveRows(self.rows.slice(0)); + } + } else { + skipStage = false; + } + + case "sort": + if (!skipStage) { + if (table.modExists("sort")) { + table.modules.sort.sort(this.activeRows); + } + } else { + skipStage = false; + } + + //regenerate row numbers for row number formatter if in use + this.regenerateRowNumbers(); + + //generic stage to allow for pipeline trigger after the data manipulation stage + case "display": + this.resetDisplayRows(); + + case "freeze": + if (!skipStage) { + if (this.table.modExists("frozenRows")) { + if (table.modules.frozenRows.isFrozen()) { + if (!table.modules.frozenRows.getDisplayIndex()) { + table.modules.frozenRows.setDisplayIndex(this.getNextDisplayIndex()); + } + + displayIndex = table.modules.frozenRows.getDisplayIndex(); + + displayIndex = self.setDisplayRows(table.modules.frozenRows.getRows(this.getDisplayRows(displayIndex - 1)), displayIndex); + + if (displayIndex !== true) { + table.modules.frozenRows.setDisplayIndex(displayIndex); + } + } + } + } else { + skipStage = false; + } + + case "group": + if (!skipStage) { + if (table.options.groupBy && table.modExists("groupRows")) { + + if (!table.modules.groupRows.getDisplayIndex()) { + table.modules.groupRows.setDisplayIndex(this.getNextDisplayIndex()); + } + + displayIndex = table.modules.groupRows.getDisplayIndex(); + + displayIndex = self.setDisplayRows(table.modules.groupRows.getRows(this.getDisplayRows(displayIndex - 1)), displayIndex); + + if (displayIndex !== true) { + table.modules.groupRows.setDisplayIndex(displayIndex); + } + } + } else { + skipStage = false; + } + + case "tree": + + if (!skipStage) { + if (table.options.dataTree && table.modExists("dataTree")) { + if (!table.modules.dataTree.getDisplayIndex()) { + table.modules.dataTree.setDisplayIndex(this.getNextDisplayIndex()); + } + + displayIndex = table.modules.dataTree.getDisplayIndex(); + + displayIndex = self.setDisplayRows(table.modules.dataTree.getRows(this.getDisplayRows(displayIndex - 1)), displayIndex); + + if (displayIndex !== true) { + table.modules.dataTree.setDisplayIndex(displayIndex); + } + } + } else { + skipStage = false; + } + + if (table.options.pagination && table.modExists("page") && !renderInPosition) { + if (table.modules.page.getMode() == "local") { + table.modules.page.reset(); + } + } + + case "page": + if (!skipStage) { + if (table.options.pagination && table.modExists("page")) { + + if (!table.modules.page.getDisplayIndex()) { + table.modules.page.setDisplayIndex(this.getNextDisplayIndex()); + } + + displayIndex = table.modules.page.getDisplayIndex(); + + if (table.modules.page.getMode() == "local") { + table.modules.page.setMaxRows(this.getDisplayRows(displayIndex - 1).length); + } + + displayIndex = self.setDisplayRows(table.modules.page.getRows(this.getDisplayRows(displayIndex - 1)), displayIndex); + + if (displayIndex !== true) { + table.modules.page.setDisplayIndex(displayIndex); + } + } + } else { + skipStage = false; + } + } + + if (Tabulator.prototype.helpers.elVisible(self.element)) { + if (renderInPosition) { + self.reRenderInPosition(); + } else { + self.renderTable(); + if (table.options.layoutColumnsOnNewData) { + self.table.columnManager.redraw(true); + } + } + } + + if (table.modExists("columnCalcs")) { + table.modules.columnCalcs.recalc(this.activeRows); + } + } +}; + +//regenerate row numbers for row number formatter if in use +RowManager.prototype.regenerateRowNumbers = function () { + var _this14 = this; + + if (this.rowNumColumn) { + this.activeRows.forEach(function (row) { + var cell = row.getCell(_this14.rowNumColumn); + + if (cell) { + cell._generateContents(); + } + }); + } +}; + +RowManager.prototype.setActiveRows = function (activeRows) { + this.activeRows = activeRows; + this.activeRowsCount = this.activeRows.length; +}; + +//reset display rows array +RowManager.prototype.resetDisplayRows = function () { + this.displayRows = []; + + this.displayRows.push(this.activeRows.slice(0)); + + this.displayRowsCount = this.displayRows[0].length; + + if (this.table.modExists("frozenRows")) { + this.table.modules.frozenRows.setDisplayIndex(0); + } + + if (this.table.options.groupBy && this.table.modExists("groupRows")) { + this.table.modules.groupRows.setDisplayIndex(0); + } + + if (this.table.options.pagination && this.table.modExists("page")) { + this.table.modules.page.setDisplayIndex(0); + } +}; + +RowManager.prototype.getNextDisplayIndex = function () { + return this.displayRows.length; +}; + +//set display row pipeline data +RowManager.prototype.setDisplayRows = function (displayRows, index) { + + var output = true; + + if (index && typeof this.displayRows[index] != "undefined") { + this.displayRows[index] = displayRows; + output = true; + } else { + this.displayRows.push(displayRows); + output = index = this.displayRows.length - 1; + } + + if (index == this.displayRows.length - 1) { + this.displayRowsCount = this.displayRows[this.displayRows.length - 1].length; + } + + return output; +}; + +RowManager.prototype.getDisplayRows = function (index) { + if (typeof index == "undefined") { + return this.displayRows.length ? this.displayRows[this.displayRows.length - 1] : []; + } else { + return this.displayRows[index] || []; + } +}; + +RowManager.prototype.getVisibleRows = function (viewable) { + var topEdge = this.element.scrollTop, + bottomEdge = this.element.clientHeight + topEdge, + topFound = false, + topRow = 0, + bottomRow = 0, + rows = this.getDisplayRows(); + + if (viewable) { + + this.getDisplayRows(); + for (var i = this.vDomTop; i <= this.vDomBottom; i++) { + if (rows[i]) { + if (!topFound) { + if (topEdge - rows[i].getElement().offsetTop >= 0) { + topRow = i; + } else { + topFound = true; + + if (bottomEdge - rows[i].getElement().offsetTop >= 0) { + bottomRow = i; + } else { + break; + } + } + } else { + if (bottomEdge - rows[i].getElement().offsetTop >= 0) { + bottomRow = i; + } else { + break; + } + } + } + } + } else { + topRow = this.vDomTop; + bottomRow = this.vDomBottom; + } + + return rows.slice(topRow, bottomRow + 1); +}; + +//repeat action accross display rows +RowManager.prototype.displayRowIterator = function (callback) { + this.displayRows.forEach(callback); + + this.displayRowsCount = this.displayRows[this.displayRows.length - 1].length; +}; + +//return only actual rows (not group headers etc) +RowManager.prototype.getRows = function (active) { + var rows; + + switch (active) { + case "active": + rows = this.activeRows; + break; + + case "display": + rows = this.table.rowManager.getDisplayRows(); + break; + + case "visible": + rows = this.getVisibleRows(true); + break; + + default: + rows = this.rows; + } + + return rows; +}; + +///////////////// Table Rendering ///////////////// + +//trigger rerender of table in current position +RowManager.prototype.reRenderInPosition = function (callback) { + if (this.getRenderMode() == "virtual") { + + if (this.redrawBlock) { + if (callback) { + callback(); + } else { + this.redrawBlockRederInPosition = true; + } + } else { + var scrollTop = this.element.scrollTop; + var topRow = false; + var topOffset = false; + + var left = this.scrollLeft; + + var rows = this.getDisplayRows(); + + for (var i = this.vDomTop; i <= this.vDomBottom; i++) { + + if (rows[i]) { + var diff = scrollTop - rows[i].getElement().offsetTop; + + if (topOffset === false || Math.abs(diff) < topOffset) { + topOffset = diff; + topRow = i; + } else { + break; + } + } + } + + if (callback) { + callback(); + } + + this._virtualRenderFill(topRow === false ? this.displayRowsCount - 1 : topRow, true, topOffset || 0); + + this.scrollHorizontal(left); + } + } else { + this.renderTable(); + + if (callback) { + callback(); + } + } +}; + +RowManager.prototype.setRenderMode = function () { + + if (this.table.options.virtualDom) { + + this.renderMode = "virtual"; + + if (this.table.element.clientHeight || this.table.options.height) { + this.fixedHeight = true; + } else { + this.fixedHeight = false; + } + } else { + this.renderMode = "classic"; + } +}; + +RowManager.prototype.getRenderMode = function () { + return this.renderMode; +}; + +RowManager.prototype.renderTable = function () { + + this.table.options.renderStarted.call(this.table); + + this.element.scrollTop = 0; + + switch (this.renderMode) { + case "classic": + this._simpleRender(); + break; + + case "virtual": + this._virtualRenderFill(); + break; + } + + if (this.firstRender) { + if (this.displayRowsCount) { + this.firstRender = false; + this.table.modules.layout.layout(); + } else { + this.renderEmptyScroll(); + } + } + + if (this.table.modExists("frozenColumns")) { + this.table.modules.frozenColumns.layout(); + } + + if (!this.displayRowsCount) { + if (this.table.options.placeholder) { + + this.table.options.placeholder.setAttribute("tabulator-render-mode", this.renderMode); + + this.getElement().appendChild(this.table.options.placeholder); + this.table.options.placeholder.style.width = this.table.columnManager.getWidth() + "px"; + } + } + + this.table.options.renderComplete.call(this.table); +}; + +//simple render on heightless table +RowManager.prototype._simpleRender = function () { + this._clearVirtualDom(); + + if (this.displayRowsCount) { + this.checkClassicModeGroupHeaderWidth(); + } else { + this.renderEmptyScroll(); + } +}; + +RowManager.prototype.checkClassicModeGroupHeaderWidth = function () { + var self = this, + element = this.tableElement, + onlyGroupHeaders = true; + + self.getDisplayRows().forEach(function (row, index) { + self.styleRow(row, index); + element.appendChild(row.getElement()); + row.initialize(true); + + if (row.type !== "group") { + onlyGroupHeaders = false; + } + }); + + if (onlyGroupHeaders) { + element.style.minWidth = self.table.columnManager.getWidth() + "px"; + } else { + element.style.minWidth = ""; + } +}; + +//show scrollbars on empty table div +RowManager.prototype.renderEmptyScroll = function () { + if (this.table.options.placeholder) { + this.tableElement.style.display = "none"; + } else { + this.tableElement.style.minWidth = this.table.columnManager.getWidth() + "px"; + this.tableElement.style.minHeight = "1px"; + this.tableElement.style.visibility = "hidden"; + } +}; + +RowManager.prototype._clearVirtualDom = function () { + var element = this.tableElement; + + if (this.table.options.placeholder && this.table.options.placeholder.parentNode) { + this.table.options.placeholder.parentNode.removeChild(this.table.options.placeholder); + } + + // element.children.detach(); + while (element.firstChild) { + element.removeChild(element.firstChild); + }element.style.paddingTop = ""; + element.style.paddingBottom = ""; + element.style.minWidth = ""; + element.style.minHeight = ""; + element.style.display = ""; + element.style.visibility = ""; + + this.scrollTop = 0; + this.scrollLeft = 0; + this.vDomTop = 0; + this.vDomBottom = 0; + this.vDomTopPad = 0; + this.vDomBottomPad = 0; +}; + +RowManager.prototype.styleRow = function (row, index) { + var rowEl = row.getElement(); + + if (index % 2) { + rowEl.classList.add("tabulator-row-even"); + rowEl.classList.remove("tabulator-row-odd"); + } else { + rowEl.classList.add("tabulator-row-odd"); + rowEl.classList.remove("tabulator-row-even"); + } +}; + +//full virtual render +RowManager.prototype._virtualRenderFill = function (position, forceMove, offset) { + var self = this, + element = self.tableElement, + holder = self.element, + topPad = 0, + rowsHeight = 0, + topPadHeight = 0, + i = 0, + onlyGroupHeaders = true, + rows = self.getDisplayRows(); + + position = position || 0; + + offset = offset || 0; + + if (!position) { + self._clearVirtualDom(); + } else { + while (element.firstChild) { + element.removeChild(element.firstChild); + } //check if position is too close to bottom of table + var heightOccupied = (self.displayRowsCount - position + 1) * self.vDomRowHeight; + + if (heightOccupied < self.height) { + position -= Math.ceil((self.height - heightOccupied) / self.vDomRowHeight); + + if (position < 0) { + position = 0; + } + } + + //calculate initial pad + topPad = Math.min(Math.max(Math.floor(self.vDomWindowBuffer / self.vDomRowHeight), self.vDomWindowMinMarginRows), position); + position -= topPad; + } + + if (self.displayRowsCount && Tabulator.prototype.helpers.elVisible(self.element)) { + + self.vDomTop = position; + + self.vDomBottom = position - 1; + + while ((rowsHeight <= self.height + self.vDomWindowBuffer || i < self.vDomWindowMinTotalRows) && self.vDomBottom < self.displayRowsCount - 1) { + var index = self.vDomBottom + 1, + row = rows[index], + rowHeight = 0; + + self.styleRow(row, index); + + element.appendChild(row.getElement()); + if (!row.initialized) { + row.initialize(true); + } else { + if (!row.heightInitialized) { + row.normalizeHeight(true); + } + } + + rowHeight = row.getHeight(); + + if (i < topPad) { + topPadHeight += rowHeight; + } else { + rowsHeight += rowHeight; + } + + if (rowHeight > this.vDomWindowBuffer) { + this.vDomWindowBuffer = rowHeight * 2; + } + + if (row.type !== "group") { + onlyGroupHeaders = false; + } + + self.vDomBottom++; + i++; + } + + if (!position) { + this.vDomTopPad = 0; + //adjust rowheight to match average of rendered elements + self.vDomRowHeight = Math.floor((rowsHeight + topPadHeight) / i); + self.vDomBottomPad = self.vDomRowHeight * (self.displayRowsCount - self.vDomBottom - 1); + + self.vDomScrollHeight = topPadHeight + rowsHeight + self.vDomBottomPad - self.height; + } else { + self.vDomTopPad = !forceMove ? self.scrollTop - topPadHeight : self.vDomRowHeight * this.vDomTop + offset; + self.vDomBottomPad = self.vDomBottom == self.displayRowsCount - 1 ? 0 : Math.max(self.vDomScrollHeight - self.vDomTopPad - rowsHeight - topPadHeight, 0); + } + + element.style.paddingTop = self.vDomTopPad + "px"; + element.style.paddingBottom = self.vDomBottomPad + "px"; + + if (forceMove) { + this.scrollTop = self.vDomTopPad + topPadHeight + offset - (this.element.scrollWidth > this.element.clientWidth ? this.element.offsetHeight - this.element.clientHeight : 0); + } + + this.scrollTop = Math.min(this.scrollTop, this.element.scrollHeight - this.height); + + //adjust for horizontal scrollbar if present (and not at top of table) + if (this.element.scrollWidth > this.element.offsetWidth && forceMove) { + this.scrollTop += this.element.offsetHeight - this.element.clientHeight; + } + + this.vDomScrollPosTop = this.scrollTop; + this.vDomScrollPosBottom = this.scrollTop; + + holder.scrollTop = this.scrollTop; + + element.style.minWidth = onlyGroupHeaders ? self.table.columnManager.getWidth() + "px" : ""; + + if (self.table.options.groupBy) { + if (self.table.modules.layout.getMode() != "fitDataFill" && self.displayRowsCount == self.table.modules.groupRows.countGroups()) { + self.tableElement.style.minWidth = self.table.columnManager.getWidth(); + } + } + } else { + this.renderEmptyScroll(); + } + + if (!this.fixedHeight) { + this.adjustTableSize(); + } +}; + +//handle vertical scrolling +RowManager.prototype.scrollVertical = function (dir) { + var topDiff = this.scrollTop - this.vDomScrollPosTop; + var bottomDiff = this.scrollTop - this.vDomScrollPosBottom; + var margin = this.vDomWindowBuffer * 2; + + if (-topDiff > margin || bottomDiff > margin) { + //if big scroll redraw table; + var left = this.scrollLeft; + this._virtualRenderFill(Math.floor(this.element.scrollTop / this.element.scrollHeight * this.displayRowsCount)); + this.scrollHorizontal(left); + } else { + + if (dir) { + //scrolling up + if (topDiff < 0) { + + this._addTopRow(-topDiff); + } + + if (bottomDiff < 0) { + + //hide bottom row if needed + if (this.vDomScrollHeight - this.scrollTop > this.vDomWindowBuffer) { + this._removeBottomRow(-bottomDiff); + } else { + this.vDomScrollPosBottom = this.scrollTop; + } + } + } else { + //scrolling down + if (topDiff >= 0) { + + //hide top row if needed + if (this.scrollTop > this.vDomWindowBuffer) { + + this._removeTopRow(topDiff); + } else { + this.vDomScrollPosTop = this.scrollTop; + } + } + + if (bottomDiff >= 0) { + + this._addBottomRow(bottomDiff); + } + } + } +}; + +RowManager.prototype._addTopRow = function (topDiff) { + var i = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0; + + var table = this.tableElement, + rows = this.getDisplayRows(); + + if (this.vDomTop) { + var index = this.vDomTop - 1, + topRow = rows[index], + topRowHeight = topRow.getHeight() || this.vDomRowHeight; + + //hide top row if needed + if (topDiff >= topRowHeight) { + this.styleRow(topRow, index); + table.insertBefore(topRow.getElement(), table.firstChild); + if (!topRow.initialized || !topRow.heightInitialized) { + this.vDomTopNewRows.push(topRow); + + if (!topRow.heightInitialized) { + topRow.clearCellHeight(); + } + } + topRow.initialize(); + + this.vDomTopPad -= topRowHeight; + + if (this.vDomTopPad < 0) { + this.vDomTopPad = index * this.vDomRowHeight; + } + + if (!index) { + this.vDomTopPad = 0; + } + + table.style.paddingTop = this.vDomTopPad + "px"; + this.vDomScrollPosTop -= topRowHeight; + this.vDomTop--; + } + + topDiff = -(this.scrollTop - this.vDomScrollPosTop); + + if (topRow.getHeight() > this.vDomWindowBuffer) { + this.vDomWindowBuffer = topRow.getHeight() * 2; + } + + if (i < this.vDomMaxRenderChain && this.vDomTop && topDiff >= (rows[this.vDomTop - 1].getHeight() || this.vDomRowHeight)) { + this._addTopRow(topDiff, i + 1); + } else { + this._quickNormalizeRowHeight(this.vDomTopNewRows); + } + } +}; + +RowManager.prototype._removeTopRow = function (topDiff) { + var table = this.tableElement, + topRow = this.getDisplayRows()[this.vDomTop], + topRowHeight = topRow.getHeight() || this.vDomRowHeight; + + if (topDiff >= topRowHeight) { + + var rowEl = topRow.getElement(); + rowEl.parentNode.removeChild(rowEl); + + this.vDomTopPad += topRowHeight; + table.style.paddingTop = this.vDomTopPad + "px"; + this.vDomScrollPosTop += this.vDomTop ? topRowHeight : topRowHeight + this.vDomWindowBuffer; + this.vDomTop++; + + topDiff = this.scrollTop - this.vDomScrollPosTop; + + this._removeTopRow(topDiff); + } +}; + +RowManager.prototype._addBottomRow = function (bottomDiff) { + var i = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0; + + var table = this.tableElement, + rows = this.getDisplayRows(); + + if (this.vDomBottom < this.displayRowsCount - 1) { + var index = this.vDomBottom + 1, + bottomRow = rows[index], + bottomRowHeight = bottomRow.getHeight() || this.vDomRowHeight; + + //hide bottom row if needed + if (bottomDiff >= bottomRowHeight) { + this.styleRow(bottomRow, index); + table.appendChild(bottomRow.getElement()); + + if (!bottomRow.initialized || !bottomRow.heightInitialized) { + this.vDomBottomNewRows.push(bottomRow); + + if (!bottomRow.heightInitialized) { + bottomRow.clearCellHeight(); + } + } + + bottomRow.initialize(); + + this.vDomBottomPad -= bottomRowHeight; + + if (this.vDomBottomPad < 0 || index == this.displayRowsCount - 1) { + this.vDomBottomPad = 0; + } + + table.style.paddingBottom = this.vDomBottomPad + "px"; + this.vDomScrollPosBottom += bottomRowHeight; + this.vDomBottom++; + } + + bottomDiff = this.scrollTop - this.vDomScrollPosBottom; + + if (bottomRow.getHeight() > this.vDomWindowBuffer) { + this.vDomWindowBuffer = bottomRow.getHeight() * 2; + } + + if (i < this.vDomMaxRenderChain && this.vDomBottom < this.displayRowsCount - 1 && bottomDiff >= (rows[this.vDomBottom + 1].getHeight() || this.vDomRowHeight)) { + this._addBottomRow(bottomDiff, i + 1); + } else { + this._quickNormalizeRowHeight(this.vDomBottomNewRows); + } + } +}; + +RowManager.prototype._removeBottomRow = function (bottomDiff) { + var table = this.tableElement, + bottomRow = this.getDisplayRows()[this.vDomBottom], + bottomRowHeight = bottomRow.getHeight() || this.vDomRowHeight; + + if (bottomDiff >= bottomRowHeight) { + + var rowEl = bottomRow.getElement(); + + if (rowEl.parentNode) { + rowEl.parentNode.removeChild(rowEl); + } + + this.vDomBottomPad += bottomRowHeight; + + if (this.vDomBottomPad < 0) { + this.vDomBottomPad = 0; + } + + table.style.paddingBottom = this.vDomBottomPad + "px"; + this.vDomScrollPosBottom -= bottomRowHeight; + this.vDomBottom--; + + bottomDiff = -(this.scrollTop - this.vDomScrollPosBottom); + + this._removeBottomRow(bottomDiff); + } +}; + +RowManager.prototype._quickNormalizeRowHeight = function (rows) { + rows.forEach(function (row) { + row.calcHeight(); + }); + + rows.forEach(function (row) { + row.setCellHeight(); + }); + + rows.length = 0; +}; + +//normalize height of active rows +RowManager.prototype.normalizeHeight = function () { + this.activeRows.forEach(function (row) { + row.normalizeHeight(); + }); +}; + +//adjust the height of the table holder to fit in the Tabulator element +RowManager.prototype.adjustTableSize = function () { + var initialHeight = this.element.clientHeight, + modExists; + + if (this.renderMode === "virtual") { + var otherHeight = this.columnManager.getElement().offsetHeight + (this.table.footerManager && !this.table.footerManager.external ? this.table.footerManager.getElement().offsetHeight : 0); + + if (this.fixedHeight) { + this.element.style.minHeight = "calc(100% - " + otherHeight + "px)"; + this.element.style.height = "calc(100% - " + otherHeight + "px)"; + this.element.style.maxHeight = "calc(100% - " + otherHeight + "px)"; + } else { + this.element.style.height = ""; + this.element.style.height = this.table.element.clientHeight - otherHeight + "px"; + this.element.scrollTop = this.scrollTop; + } + + this.height = this.element.clientHeight; + this.vDomWindowBuffer = this.table.options.virtualDomBuffer || this.height; + + //check if the table has changed size when dealing with variable height tables + if (!this.fixedHeight && initialHeight != this.element.clientHeight) { + modExists = this.table.modExists("resizeTable"); + + if (modExists && !this.table.modules.resizeTable.autoResize || !modExists) { + this.redraw(); + } + } + } +}; + +//renitialize all rows +RowManager.prototype.reinitialize = function () { + this.rows.forEach(function (row) { + row.reinitialize(); + }); +}; + +//prevent table from being redrawn +RowManager.prototype.blockRedraw = function () { + this.redrawBlock = true; + this.redrawBlockRestoreConfig = false; +}; + +//restore table redrawing +RowManager.prototype.restoreRedraw = function () { + this.redrawBlock = false; + + if (this.redrawBlockRestoreConfig) { + this.refreshActiveData(this.redrawBlockRestoreConfig.stage, this.redrawBlockRestoreConfig.skipStage, this.redrawBlockRestoreConfig.renderInPosition); + + this.redrawBlockRestoreConfig = false; + } else { + if (this.redrawBlockRederInPosition) { + this.reRenderInPosition(); + } + } + + this.redrawBlockRederInPosition = false; +}; + +//redraw table +RowManager.prototype.redraw = function (force) { + var pos = 0, + left = this.scrollLeft; + + this.adjustTableSize(); + + this.table.tableWidth = this.table.element.clientWidth; + + if (!force) { + if (this.renderMode == "classic") { + + if (this.table.options.groupBy) { + this.refreshActiveData("group", false, false); + } else { + this._simpleRender(); + } + } else { + this.reRenderInPosition(); + this.scrollHorizontal(left); + } + + if (!this.displayRowsCount) { + if (this.table.options.placeholder) { + this.getElement().appendChild(this.table.options.placeholder); + } + } + } else { + this.renderTable(); + } +}; + +RowManager.prototype.resetScroll = function () { + this.element.scrollLeft = 0; + this.element.scrollTop = 0; + + if (this.table.browser === "ie") { + var event = document.createEvent("Event"); + event.initEvent("scroll", false, true); + this.element.dispatchEvent(event); + } else { + this.element.dispatchEvent(new Event('scroll')); + } +}; + +//public row object +var RowComponent = function RowComponent(row) { + this._row = row; +}; + +RowComponent.prototype.getData = function (transform) { + return this._row.getData(transform); +}; + +RowComponent.prototype.getElement = function () { + return this._row.getElement(); +}; + +RowComponent.prototype.getCells = function () { + var cells = []; + + this._row.getCells().forEach(function (cell) { + cells.push(cell.getComponent()); + }); + + return cells; +}; + +RowComponent.prototype.getCell = function (column) { + var cell = this._row.getCell(column); + return cell ? cell.getComponent() : false; +}; + +RowComponent.prototype.getIndex = function () { + return this._row.getData("data")[this._row.table.options.index]; +}; + +RowComponent.prototype.getPosition = function (active) { + return this._row.table.rowManager.getRowPosition(this._row, active); +}; + +RowComponent.prototype.delete = function () { + return this._row.delete(); +}; + +RowComponent.prototype.scrollTo = function () { + return this._row.table.rowManager.scrollToRow(this._row); +}; + +RowComponent.prototype.pageTo = function () { + if (this._row.table.modExists("page", true)) { + return this._row.table.modules.page.setPageToRow(this._row); + } +}; + +RowComponent.prototype.move = function (to, after) { + this._row.moveToRow(to, after); +}; + +RowComponent.prototype.update = function (data) { + return this._row.updateData(data); +}; + +RowComponent.prototype.normalizeHeight = function () { + this._row.normalizeHeight(true); +}; + +RowComponent.prototype.select = function () { + this._row.table.modules.selectRow.selectRows(this._row); +}; + +RowComponent.prototype.deselect = function () { + this._row.table.modules.selectRow.deselectRows(this._row); +}; + +RowComponent.prototype.toggleSelect = function () { + this._row.table.modules.selectRow.toggleRow(this._row); +}; + +RowComponent.prototype.isSelected = function () { + return this._row.table.modules.selectRow.isRowSelected(this._row); +}; + +RowComponent.prototype._getSelf = function () { + return this._row; +}; + +RowComponent.prototype.validate = function () { + return this._row.validate(); +}; + +RowComponent.prototype.freeze = function () { + if (this._row.table.modExists("frozenRows", true)) { + this._row.table.modules.frozenRows.freezeRow(this._row); + } +}; + +RowComponent.prototype.unfreeze = function () { + if (this._row.table.modExists("frozenRows", true)) { + this._row.table.modules.frozenRows.unfreezeRow(this._row); + } +}; + +RowComponent.prototype.isFrozen = function () { + if (this._row.table.modExists("frozenRows", true)) { + var index = this._row.table.modules.frozenRows.rows.indexOf(this._row); + return index > -1; + } + + return false; +}; + +RowComponent.prototype.treeCollapse = function () { + if (this._row.table.modExists("dataTree", true)) { + this._row.table.modules.dataTree.collapseRow(this._row); + } +}; + +RowComponent.prototype.treeExpand = function () { + if (this._row.table.modExists("dataTree", true)) { + this._row.table.modules.dataTree.expandRow(this._row); + } +}; + +RowComponent.prototype.treeToggle = function () { + if (this._row.table.modExists("dataTree", true)) { + this._row.table.modules.dataTree.toggleRow(this._row); + } +}; + +RowComponent.prototype.getTreeParent = function () { + if (this._row.table.modExists("dataTree", true)) { + return this._row.table.modules.dataTree.getTreeParent(this._row); + } + + return false; +}; + +RowComponent.prototype.getTreeChildren = function () { + if (this._row.table.modExists("dataTree", true)) { + return this._row.table.modules.dataTree.getTreeChildren(this._row); + } + + return false; +}; + +RowComponent.prototype.addTreeChild = function (data, pos, index) { + if (this._row.table.modExists("dataTree", true)) { + return this._row.table.modules.dataTree.addTreeChildRow(this._row, data, pos, index); + } + + return false; +}; + +RowComponent.prototype.reformat = function () { + return this._row.reinitialize(); +}; + +RowComponent.prototype.getGroup = function () { + return this._row.getGroup().getComponent(); +}; + +RowComponent.prototype.getTable = function () { + return this._row.table; +}; + +RowComponent.prototype.getNextRow = function () { + var row = this._row.nextRow(); + return row ? row.getComponent() : row; +}; + +RowComponent.prototype.getPrevRow = function () { + var row = this._row.prevRow(); + return row ? row.getComponent() : row; +}; + +var Row = function Row(data, parent) { + var type = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : "row"; + + this.table = parent.table; + this.parent = parent; + this.data = {}; + this.type = type; //type of element + this.element = this.createElement(); + this.modules = {}; //hold module variables; + this.cells = []; + this.height = 0; //hold element height + this.heightStyled = ""; //hold element height prestyled to improve render efficiency + this.manualHeight = false; //user has manually set row height + this.outerHeight = 0; //holde lements outer height + this.initialized = false; //element has been rendered + this.heightInitialized = false; //element has resized cells to fit + + this.component = null; + + this.setData(data); + this.generateElement(); +}; + +Row.prototype.createElement = function () { + var el = document.createElement("div"); + + el.classList.add("tabulator-row"); + el.setAttribute("role", "row"); + + return el; +}; + +Row.prototype.getElement = function () { + return this.element; +}; + +Row.prototype.detachElement = function () { + if (this.element && this.element.parentNode) { + this.element.parentNode.removeChild(this.element); + } +}; + +Row.prototype.generateElement = function () { + var self = this, + dblTap, + tapHold, + tap; + + //set row selection characteristics + if (self.table.options.selectable !== false && self.table.modExists("selectRow")) { + self.table.modules.selectRow.initializeRow(this); + } + + //setup movable rows + if (self.table.options.movableRows !== false && self.table.modExists("moveRow")) { + self.table.modules.moveRow.initializeRow(this); + } + + //setup data tree + if (self.table.options.dataTree !== false && self.table.modExists("dataTree")) { + self.table.modules.dataTree.initializeRow(this); + } + + //setup column colapse container + if (self.table.options.responsiveLayout === "collapse" && self.table.modExists("responsiveLayout")) { + self.table.modules.responsiveLayout.initializeRow(this); + } + + //set column menu + if (self.table.options.rowContextMenu && this.table.modExists("menu")) { + self.table.modules.menu.initializeRow(this); + } + + //handle row click events + if (self.table.options.rowClick) { + self.element.addEventListener("click", function (e) { + self.table.options.rowClick(e, self.getComponent()); + }); + } + + if (self.table.options.rowDblClick) { + self.element.addEventListener("dblclick", function (e) { + self.table.options.rowDblClick(e, self.getComponent()); + }); + } + + if (self.table.options.rowContext) { + self.element.addEventListener("contextmenu", function (e) { + self.table.options.rowContext(e, self.getComponent()); + }); + } + + //handle mouse events + if (self.table.options.rowMouseEnter) { + self.element.addEventListener("mouseenter", function (e) { + self.table.options.rowMouseEnter(e, self.getComponent()); + }); + } + + if (self.table.options.rowMouseLeave) { + self.element.addEventListener("mouseleave", function (e) { + self.table.options.rowMouseLeave(e, self.getComponent()); + }); + } + + if (self.table.options.rowMouseOver) { + self.element.addEventListener("mouseover", function (e) { + self.table.options.rowMouseOver(e, self.getComponent()); + }); + } + + if (self.table.options.rowMouseOut) { + self.element.addEventListener("mouseout", function (e) { + self.table.options.rowMouseOut(e, self.getComponent()); + }); + } + + if (self.table.options.rowMouseMove) { + self.element.addEventListener("mousemove", function (e) { + self.table.options.rowMouseMove(e, self.getComponent()); + }); + } + + if (self.table.options.rowTap) { + + tap = false; + + self.element.addEventListener("touchstart", function (e) { + tap = true; + }, { passive: true }); + + self.element.addEventListener("touchend", function (e) { + if (tap) { + self.table.options.rowTap(e, self.getComponent()); + } + + tap = false; + }); + } + + if (self.table.options.rowDblTap) { + + dblTap = null; + + self.element.addEventListener("touchend", function (e) { + + if (dblTap) { + clearTimeout(dblTap); + dblTap = null; + + self.table.options.rowDblTap(e, self.getComponent()); + } else { + + dblTap = setTimeout(function () { + clearTimeout(dblTap); + dblTap = null; + }, 300); + } + }); + } + + if (self.table.options.rowTapHold) { + + tapHold = null; + + self.element.addEventListener("touchstart", function (e) { + clearTimeout(tapHold); + + tapHold = setTimeout(function () { + clearTimeout(tapHold); + tapHold = null; + tap = false; + self.table.options.rowTapHold(e, self.getComponent()); + }, 1000); + }, { passive: true }); + + self.element.addEventListener("touchend", function (e) { + clearTimeout(tapHold); + tapHold = null; + }); + } +}; + +Row.prototype.generateCells = function () { + this.cells = this.table.columnManager.generateCells(this); +}; + +//functions to setup on first render +Row.prototype.initialize = function (force) { + var self = this; + + if (!self.initialized || force) { + + self.deleteCells(); + + while (self.element.firstChild) { + self.element.removeChild(self.element.firstChild); + } //handle frozen cells + if (this.table.modExists("frozenColumns")) { + this.table.modules.frozenColumns.layoutRow(this); + } + + this.generateCells(); + + self.cells.forEach(function (cell) { + self.element.appendChild(cell.getElement()); + cell.cellRendered(); + }); + + if (force) { + self.normalizeHeight(); + } + + //setup movable rows + if (self.table.options.dataTree && self.table.modExists("dataTree")) { + self.table.modules.dataTree.layoutRow(this); + } + + //setup column colapse container + if (self.table.options.responsiveLayout === "collapse" && self.table.modExists("responsiveLayout")) { + self.table.modules.responsiveLayout.layoutRow(this); + } + + if (self.table.options.rowFormatter) { + self.table.options.rowFormatter(self.getComponent()); + } + + //set resizable handles + if (self.table.options.resizableRows && self.table.modExists("resizeRows")) { + self.table.modules.resizeRows.initializeRow(self); + } + + self.initialized = true; + } +}; + +Row.prototype.reinitializeHeight = function () { + this.heightInitialized = false; + + if (this.element.offsetParent !== null) { + this.normalizeHeight(true); + } +}; + +Row.prototype.reinitialize = function () { + this.initialized = false; + this.heightInitialized = false; + + if (!this.manualHeight) { + this.height = 0; + this.heightStyled = ""; + } + + if (this.element.offsetParent !== null) { + this.initialize(true); + } +}; + +//get heights when doing bulk row style calcs in virtual DOM +Row.prototype.calcHeight = function (force) { + + var maxHeight = 0, + minHeight = this.table.options.resizableRows ? this.element.clientHeight : 0; + + this.cells.forEach(function (cell) { + var height = cell.getHeight(); + if (height > maxHeight) { + maxHeight = height; + } + }); + + if (force) { + this.height = Math.max(maxHeight, minHeight); + } else { + this.height = this.manualHeight ? this.height : Math.max(maxHeight, minHeight); + } + + this.heightStyled = this.height ? this.height + "px" : ""; + this.outerHeight = this.element.offsetHeight; +}; + +//set of cells +Row.prototype.setCellHeight = function () { + this.cells.forEach(function (cell) { + cell.setHeight(); + }); + + this.heightInitialized = true; +}; + +Row.prototype.clearCellHeight = function () { + this.cells.forEach(function (cell) { + cell.clearHeight(); + }); +}; + +//normalize the height of elements in the row +Row.prototype.normalizeHeight = function (force) { + + if (force) { + this.clearCellHeight(); + } + + this.calcHeight(force); + + this.setCellHeight(); +}; + +// Row.prototype.setHeight = function(height){ +// this.height = height; + +// this.setCellHeight(); +// }; + +//set height of rows +Row.prototype.setHeight = function (height, force) { + if (this.height != height || force) { + + this.manualHeight = true; + + this.height = height; + this.heightStyled = height ? height + "px" : ""; + + this.setCellHeight(); + + // this.outerHeight = this.element.outerHeight(); + this.outerHeight = this.element.offsetHeight; + } +}; + +//return rows outer height +Row.prototype.getHeight = function () { + return this.outerHeight; +}; + +//return rows outer Width +Row.prototype.getWidth = function () { + return this.element.offsetWidth; +}; + +//////////////// Cell Management ///////////////// + +Row.prototype.deleteCell = function (cell) { + var index = this.cells.indexOf(cell); + + if (index > -1) { + this.cells.splice(index, 1); + } +}; + +//////////////// Data Management ///////////////// + +Row.prototype.setData = function (data) { + if (this.table.modExists("mutator")) { + data = this.table.modules.mutator.transformRow(data, "data"); + } + + this.data = data; + + if (this.table.options.reactiveData && this.table.modExists("reactiveData", true)) { + this.table.modules.reactiveData.watchRow(this); + } +}; + +//update the rows data +Row.prototype.updateData = function (updatedData) { + var _this15 = this; + + var visible = Tabulator.prototype.helpers.elVisible(this.element), + tempData = {}, + newRowData; + + return new Promise(function (resolve, reject) { + + if (typeof updatedData === "string") { + updatedData = JSON.parse(updatedData); + } + + if (_this15.table.options.reactiveData && _this15.table.modExists("reactiveData", true)) { + _this15.table.modules.reactiveData.block(); + } + + //mutate incomming data if needed + if (_this15.table.modExists("mutator")) { + + tempData = Object.assign(tempData, _this15.data); + tempData = Object.assign(tempData, updatedData); + + newRowData = _this15.table.modules.mutator.transformRow(tempData, "data", updatedData); + } else { + newRowData = updatedData; + } + + //set data + for (var attrname in newRowData) { + _this15.data[attrname] = newRowData[attrname]; + } + + if (_this15.table.options.reactiveData && _this15.table.modExists("reactiveData", true)) { + _this15.table.modules.reactiveData.unblock(); + } + + //update affected cells only + for (var attrname in updatedData) { + + var columns = _this15.table.columnManager.getColumnsByFieldRoot(attrname); + + columns.forEach(function (column) { + var cell = _this15.getCell(column.getField()); + + if (cell) { + var value = column.getFieldValue(newRowData); + if (cell.getValue() != value) { + cell.setValueProcessData(value); + + if (visible) { + cell.cellRendered(); + } + } + } + }); + } + + //Partial reinitialization if visible + if (visible) { + _this15.normalizeHeight(true); + + if (_this15.table.options.rowFormatter) { + _this15.table.options.rowFormatter(_this15.getComponent()); + } + } else { + _this15.initialized = false; + _this15.height = 0; + _this15.heightStyled = ""; + } + + if (_this15.table.options.dataTree !== false && _this15.table.modExists("dataTree") && _this15.table.modules.dataTree.redrawNeeded(updatedData)) { + _this15.table.modules.dataTree.initializeRow(_this15); + _this15.table.modules.dataTree.layoutRow(_this15); + _this15.table.rowManager.refreshActiveData("tree", false, true); + } + + //this.reinitialize(); + + _this15.table.options.rowUpdated.call(_this15.table, _this15.getComponent()); + + resolve(); + }); +}; + +Row.prototype.getData = function (transform) { + var self = this; + + if (transform) { + if (self.table.modExists("accessor")) { + return self.table.modules.accessor.transformRow(self.data, transform); + } + } else { + return this.data; + } +}; + +Row.prototype.getCell = function (column) { + var match = false; + + column = this.table.columnManager.findColumn(column); + + match = this.cells.find(function (cell) { + return cell.column === column; + }); + + return match; +}; + +Row.prototype.getCellIndex = function (findCell) { + return this.cells.findIndex(function (cell) { + return cell === findCell; + }); +}; + +Row.prototype.findNextEditableCell = function (index) { + var nextCell = false; + + if (index < this.cells.length - 1) { + for (var i = index + 1; i < this.cells.length; i++) { + var cell = this.cells[i]; + + if (cell.column.modules.edit && Tabulator.prototype.helpers.elVisible(cell.getElement())) { + var allowEdit = true; + + if (typeof cell.column.modules.edit.check == "function") { + allowEdit = cell.column.modules.edit.check(cell.getComponent()); + } + + if (allowEdit) { + nextCell = cell; + break; + } + } + } + } + + return nextCell; +}; + +Row.prototype.findPrevEditableCell = function (index) { + var prevCell = false; + + if (index > 0) { + for (var i = index - 1; i >= 0; i--) { + var cell = this.cells[i], + allowEdit = true; + + if (cell.column.modules.edit && Tabulator.prototype.helpers.elVisible(cell.getElement())) { + if (typeof cell.column.modules.edit.check == "function") { + allowEdit = cell.column.modules.edit.check(cell.getComponent()); + } + + if (allowEdit) { + prevCell = cell; + break; + } + } + } + } + + return prevCell; +}; + +Row.prototype.getCells = function () { + return this.cells; +}; + +Row.prototype.nextRow = function () { + var row = this.table.rowManager.nextDisplayRow(this, true); + return row || false; +}; + +Row.prototype.prevRow = function () { + var row = this.table.rowManager.prevDisplayRow(this, true); + return row || false; +}; + +Row.prototype.moveToRow = function (to, before) { + var toRow = this.table.rowManager.findRow(to); + + if (toRow) { + this.table.rowManager.moveRowActual(this, toRow, !before); + this.table.rowManager.refreshActiveData("display", false, true); + } else { + console.warn("Move Error - No matching row found:", to); + } +}; + +Row.prototype.validate = function () { + var invalid = []; + + this.cells.forEach(function (cell) { + if (!cell.validate()) { + invalid.push(cell.getComponent()); + } + }); + + return invalid.length ? invalid : true; +}; + +///////////////////// Actions ///////////////////// + +Row.prototype.delete = function () { + var _this16 = this; + + return new Promise(function (resolve, reject) { + var index, rows; + + if (_this16.table.options.history && _this16.table.modExists("history")) { + + if (_this16.table.options.groupBy && _this16.table.modExists("groupRows")) { + rows = _this16.getGroup().rows; + index = rows.indexOf(_this16); + + if (index) { + index = rows[index - 1]; + } + } else { + index = _this16.table.rowManager.getRowIndex(_this16); + + if (index) { + index = _this16.table.rowManager.rows[index - 1]; + } + } + + _this16.table.modules.history.action("rowDelete", _this16, { data: _this16.getData(), pos: !index, index: index }); + } + + _this16.deleteActual(); + + resolve(); + }); +}; + +Row.prototype.deleteActual = function (blockRedraw) { + var index = this.table.rowManager.getRowIndex(this); + + //deselect row if it is selected + if (this.table.modExists("selectRow")) { + this.table.modules.selectRow._deselectRow(this, true); + } + + //cancel edit if row is currently being edited + if (this.table.modExists("edit")) { + if (this.table.modules.edit.currentCell.row === this) { + this.table.modules.edit.cancelEdit(); + } + } + + // if(this.table.options.dataTree && this.table.modExists("dataTree")){ + // this.table.modules.dataTree.collapseRow(this, true); + // } + + //remove any reactive data watchers from row object + if (this.table.options.reactiveData && this.table.modExists("reactiveData", true)) {} + // this.table.modules.reactiveData.unwatchRow(this); + + + //remove from group + if (this.modules.group) { + this.modules.group.removeRow(this); + } + + this.table.rowManager.deleteRow(this, blockRedraw); + + this.deleteCells(); + + this.initialized = false; + this.heightInitialized = false; + + if (this.table.options.dataTree && this.table.modExists("dataTree", true)) { + this.table.modules.dataTree.rowDelete(this); + } + + //recalc column calculations if present + if (this.table.modExists("columnCalcs")) { + if (this.table.options.groupBy && this.table.modExists("groupRows")) { + this.table.modules.columnCalcs.recalcRowGroup(this); + } else { + this.table.modules.columnCalcs.recalc(this.table.rowManager.activeRows); + } + } +}; + +Row.prototype.deleteCells = function () { + var cellCount = this.cells.length; + + for (var i = 0; i < cellCount; i++) { + this.cells[0].delete(); + } +}; + +Row.prototype.wipe = function () { + this.deleteCells(); + + while (this.element.firstChild) { + this.element.removeChild(this.element.firstChild); + }this.element = false; + this.modules = {}; + + if (this.element.parentNode) { + this.element.parentNode.removeChild(this.element); + } +}; + +Row.prototype.getGroup = function () { + return this.modules.group || false; +}; + +//////////////// Object Generation ///////////////// +Row.prototype.getComponent = function () { + if (!this.component) { + this.component = new RowComponent(this); + } + + return this.component; +}; + +//public row object +var CellComponent = function CellComponent(cell) { + this._cell = cell; +}; + +CellComponent.prototype.getValue = function () { + return this._cell.getValue(); +}; + +CellComponent.prototype.getOldValue = function () { + return this._cell.getOldValue(); +}; + +CellComponent.prototype.getElement = function () { + return this._cell.getElement(); +}; + +CellComponent.prototype.getRow = function () { + return this._cell.row.getComponent(); +}; + +CellComponent.prototype.getData = function () { + return this._cell.row.getData(); +}; + +CellComponent.prototype.getField = function () { + return this._cell.column.getField(); +}; + +CellComponent.prototype.getColumn = function () { + return this._cell.column.getComponent(); +}; + +CellComponent.prototype.setValue = function (value, mutate) { + if (typeof mutate == "undefined") { + mutate = true; + } + + this._cell.setValue(value, mutate); +}; + +CellComponent.prototype.restoreOldValue = function () { + this._cell.setValueActual(this._cell.getOldValue()); +}; + +CellComponent.prototype.edit = function (force) { + return this._cell.edit(force); +}; + +CellComponent.prototype.cancelEdit = function () { + this._cell.cancelEdit(); +}; + +CellComponent.prototype.isEdited = function () { + return !!this._cell.modules.edit && this._cell.modules.edit.edited; +}; + +CellComponent.prototype.clearEdited = function () { + if (self.table.modExists("edit", true)) { + this._cell.table.modules.edit.clearEdited(this._cell); + } +}; + +CellComponent.prototype.isValid = function () { + return this._cell.modules.validate ? !this._cell.modules.validate.invalid : true; +}; + +CellComponent.prototype.validate = function () { + return this._cell.validate(); +}; + +CellComponent.prototype.clearValidation = function () { + if (self.table.modExists("validate", true)) { + this._cell.table.modules.validate.clearValidation(this._cell); + } +}; + +CellComponent.prototype.nav = function () { + return this._cell.nav(); +}; + +CellComponent.prototype.checkHeight = function () { + this._cell.checkHeight(); +}; + +CellComponent.prototype.getTable = function () { + return this._cell.table; +}; + +CellComponent.prototype._getSelf = function () { + return this._cell; +}; + +var Cell = function Cell(column, row) { + + this.table = column.table; + this.column = column; + this.row = row; + this.element = null; + this.value = null; + this.oldValue = null; + this.modules = {}; + + this.height = null; + this.width = null; + this.minWidth = null; + + this.component = null; + + this.build(); +}; + +//////////////// Setup Functions ///////////////// + +//generate element +Cell.prototype.build = function () { + this.generateElement(); + + this.setWidth(); + + this._configureCell(); + + this.setValueActual(this.column.getFieldValue(this.row.data)); +}; + +Cell.prototype.generateElement = function () { + this.element = document.createElement('div'); + this.element.className = "tabulator-cell"; + this.element.setAttribute("role", "gridcell"); + this.element = this.element; +}; + +Cell.prototype._configureCell = function () { + var self = this, + cellEvents = self.column.cellEvents, + element = self.element, + field = this.column.getField(), + vertAligns = { + top: "flex-start", + bottom: "flex-end", + middle: "center" + }, + hozAligns = { + left: "flex-start", + right: "flex-end", + center: "center" + }; + + //set text alignment + element.style.textAlign = self.column.hozAlign; + + if (self.column.vertAlign) { + element.style.display = "inline-flex"; + + element.style.alignItems = vertAligns[self.column.vertAlign] || ""; + + if (self.column.hozAlign) { + element.style.justifyContent = hozAligns[self.column.hozAlign] || ""; + } + } + + if (field) { + element.setAttribute("tabulator-field", field); + } + + //add class to cell if needed + if (self.column.definition.cssClass) { + var classNames = self.column.definition.cssClass.split(" "); + classNames.forEach(function (className) { + element.classList.add(className); + }); + } + + //update tooltip on mouse enter + if (this.table.options.tooltipGenerationMode === "hover") { + element.addEventListener("mouseenter", function (e) { + self._generateTooltip(); + }); + } + + self._bindClickEvents(cellEvents); + + self._bindTouchEvents(cellEvents); + + self._bindMouseEvents(cellEvents); + + if (self.column.modules.edit) { + self.table.modules.edit.bindEditor(self); + } + + if (self.column.definition.rowHandle && self.table.options.movableRows !== false && self.table.modExists("moveRow")) { + self.table.modules.moveRow.initializeCell(self); + } + + //hide cell if not visible + if (!self.column.visible) { + self.hide(); + } +}; + +Cell.prototype._bindClickEvents = function (cellEvents) { + var self = this, + element = self.element; + + //set event bindings + if (cellEvents.cellClick || self.table.options.cellClick) { + element.addEventListener("click", function (e) { + var component = self.getComponent(); + + if (cellEvents.cellClick) { + cellEvents.cellClick.call(self.table, e, component); + } + + if (self.table.options.cellClick) { + self.table.options.cellClick.call(self.table, e, component); + } + }); + } + + if (cellEvents.cellDblClick || this.table.options.cellDblClick) { + element.addEventListener("dblclick", function (e) { + var component = self.getComponent(); + + if (cellEvents.cellDblClick) { + cellEvents.cellDblClick.call(self.table, e, component); + } + + if (self.table.options.cellDblClick) { + self.table.options.cellDblClick.call(self.table, e, component); + } + }); + } else { + element.addEventListener("dblclick", function (e) { + + if (self.table.modExists("edit")) { + if (self.table.modules.edit.currentCell === self) { + return; //prevent instant selection of editor content + } + } + + e.preventDefault(); + + try { + if (document.selection) { + // IE + var range = document.body.createTextRange(); + range.moveToElementText(self.element); + range.select(); + } else if (window.getSelection) { + var range = document.createRange(); + range.selectNode(self.element); + window.getSelection().removeAllRanges(); + window.getSelection().addRange(range); + } + } catch (e) {} + }); + } + + if (cellEvents.cellContext || this.table.options.cellContext) { + element.addEventListener("contextmenu", function (e) { + var component = self.getComponent(); + + if (cellEvents.cellContext) { + cellEvents.cellContext.call(self.table, e, component); + } + + if (self.table.options.cellContext) { + self.table.options.cellContext.call(self.table, e, component); + } + }); + } +}; + +Cell.prototype._bindMouseEvents = function (cellEvents) { + var self = this, + element = self.element; + + if (cellEvents.cellMouseEnter || self.table.options.cellMouseEnter) { + element.addEventListener("mouseenter", function (e) { + var component = self.getComponent(); + + if (cellEvents.cellMouseEnter) { + cellEvents.cellMouseEnter.call(self.table, e, component); + } + + if (self.table.options.cellMouseEnter) { + self.table.options.cellMouseEnter.call(self.table, e, component); + } + }); + } + + if (cellEvents.cellMouseLeave || self.table.options.cellMouseLeave) { + element.addEventListener("mouseleave", function (e) { + var component = self.getComponent(); + + if (cellEvents.cellMouseLeave) { + cellEvents.cellMouseLeave.call(self.table, e, component); + } + + if (self.table.options.cellMouseLeave) { + self.table.options.cellMouseLeave.call(self.table, e, component); + } + }); + } + + if (cellEvents.cellMouseOver || self.table.options.cellMouseOver) { + element.addEventListener("mouseover", function (e) { + var component = self.getComponent(); + + if (cellEvents.cellMouseOver) { + cellEvents.cellMouseOver.call(self.table, e, component); + } + + if (self.table.options.cellMouseOver) { + self.table.options.cellMouseOver.call(self.table, e, component); + } + }); + } + + if (cellEvents.cellMouseOut || self.table.options.cellMouseOut) { + element.addEventListener("mouseout", function (e) { + var component = self.getComponent(); + + if (cellEvents.cellMouseOut) { + cellEvents.cellMouseOut.call(self.table, e, component); + } + + if (self.table.options.cellMouseOut) { + self.table.options.cellMouseOut.call(self.table, e, component); + } + }); + } + + if (cellEvents.cellMouseMove || self.table.options.cellMouseMove) { + element.addEventListener("mousemove", function (e) { + var component = self.getComponent(); + + if (cellEvents.cellMouseMove) { + cellEvents.cellMouseMove.call(self.table, e, component); + } + + if (self.table.options.cellMouseMove) { + self.table.options.cellMouseMove.call(self.table, e, component); + } + }); + } +}; + +Cell.prototype._bindTouchEvents = function (cellEvents) { + var self = this, + element = self.element, + dblTap, + tapHold, + tap; + + if (cellEvents.cellTap || this.table.options.cellTap) { + tap = false; + + element.addEventListener("touchstart", function (e) { + tap = true; + }, { passive: true }); + + element.addEventListener("touchend", function (e) { + if (tap) { + var component = self.getComponent(); + + if (cellEvents.cellTap) { + cellEvents.cellTap.call(self.table, e, component); + } + + if (self.table.options.cellTap) { + self.table.options.cellTap.call(self.table, e, component); + } + } + + tap = false; + }); + } + + if (cellEvents.cellDblTap || this.table.options.cellDblTap) { + dblTap = null; + + element.addEventListener("touchend", function (e) { + + if (dblTap) { + clearTimeout(dblTap); + dblTap = null; + + var component = self.getComponent(); + + if (cellEvents.cellDblTap) { + cellEvents.cellDblTap.call(self.table, e, component); + } + + if (self.table.options.cellDblTap) { + self.table.options.cellDblTap.call(self.table, e, component); + } + } else { + + dblTap = setTimeout(function () { + clearTimeout(dblTap); + dblTap = null; + }, 300); + } + }); + } + + if (cellEvents.cellTapHold || this.table.options.cellTapHold) { + tapHold = null; + + element.addEventListener("touchstart", function (e) { + clearTimeout(tapHold); + + tapHold = setTimeout(function () { + clearTimeout(tapHold); + tapHold = null; + tap = false; + var component = self.getComponent(); + + if (cellEvents.cellTapHold) { + cellEvents.cellTapHold.call(self.table, e, component); + } + + if (self.table.options.cellTapHold) { + self.table.options.cellTapHold.call(self.table, e, component); + } + }, 1000); + }, { passive: true }); + + element.addEventListener("touchend", function (e) { + clearTimeout(tapHold); + tapHold = null; + }); + } +}; + +//generate cell contents +Cell.prototype._generateContents = function () { + var val; + + if (this.table.modExists("format")) { + val = this.table.modules.format.formatValue(this); + } else { + val = this.element.innerHTML = this.value; + } + + switch (typeof val === 'undefined' ? 'undefined' : _typeof(val)) { + case "object": + if (val instanceof Node) { + + //clear previous cell contents + while (this.element.firstChild) { + this.element.removeChild(this.element.firstChild); + }this.element.appendChild(val); + } else { + this.element.innerHTML = ""; + + if (val != null) { + console.warn("Format Error - Formatter has returned a type of object, the only valid formatter object return is an instance of Node, the formatter returned:", val); + } + } + break; + case "undefined": + case "null": + this.element.innerHTML = ""; + break; + default: + this.element.innerHTML = val; + } +}; + +Cell.prototype.cellRendered = function () { + if (this.table.modExists("format") && this.table.modules.format.cellRendered) { + this.table.modules.format.cellRendered(this); + } +}; + +//generate tooltip text +Cell.prototype._generateTooltip = function () { + var tooltip = this.column.tooltip; + + if (tooltip) { + if (tooltip === true) { + tooltip = this.value; + } else if (typeof tooltip == "function") { + tooltip = tooltip(this.getComponent()); + + if (tooltip === false) { + tooltip = ""; + } + } + + if (typeof tooltip === "undefined") { + tooltip = ""; + } + + this.element.setAttribute("title", tooltip); + } else { + this.element.setAttribute("title", ""); + } +}; + +//////////////////// Getters //////////////////// +Cell.prototype.getElement = function () { + return this.element; +}; + +Cell.prototype.getValue = function () { + return this.value; +}; + +Cell.prototype.getOldValue = function () { + return this.oldValue; +}; + +//////////////////// Actions //////////////////// + +Cell.prototype.setValue = function (value, mutate) { + + var changed = this.setValueProcessData(value, mutate), + component; + + if (changed) { + if (this.table.options.history && this.table.modExists("history")) { + this.table.modules.history.action("cellEdit", this, { oldValue: this.oldValue, newValue: this.value }); + } + + component = this.getComponent(); + + if (this.column.cellEvents.cellEdited) { + this.column.cellEvents.cellEdited.call(this.table, component); + } + + this.cellRendered(); + + this.table.options.cellEdited.call(this.table, component); + + this.table.options.dataEdited.call(this.table, this.table.rowManager.getData()); + } +}; + +Cell.prototype.setValueProcessData = function (value, mutate) { + var changed = false; + + if (this.value != value) { + + changed = true; + + if (mutate) { + if (this.column.modules.mutate) { + value = this.table.modules.mutator.transformCell(this, value); + } + } + } + + this.setValueActual(value); + + if (changed && this.table.modExists("columnCalcs")) { + if (this.column.definition.topCalc || this.column.definition.bottomCalc) { + if (this.table.options.groupBy && this.table.modExists("groupRows")) { + + if (this.table.options.columnCalcs == "table" || this.table.options.columnCalcs == "both") { + this.table.modules.columnCalcs.recalc(this.table.rowManager.activeRows); + } + + if (this.table.options.columnCalcs != "table") { + this.table.modules.columnCalcs.recalcRowGroup(this.row); + } + } else { + this.table.modules.columnCalcs.recalc(this.table.rowManager.activeRows); + } + } + } + + return changed; +}; + +Cell.prototype.setValueActual = function (value) { + this.oldValue = this.value; + + this.value = value; + + if (this.table.options.reactiveData && this.table.modExists("reactiveData")) { + this.table.modules.reactiveData.block(); + } + + this.column.setFieldValue(this.row.data, value); + + if (this.table.options.reactiveData && this.table.modExists("reactiveData")) { + this.table.modules.reactiveData.unblock(); + } + + this._generateContents(); + this._generateTooltip(); + + //set resizable handles + if (this.table.options.resizableColumns && this.table.modExists("resizeColumns")) { + this.table.modules.resizeColumns.initializeColumn("cell", this.column, this.element); + } + + //set column menu + if (this.column.definition.contextMenu && this.table.modExists("menu")) { + this.table.modules.menu.initializeCell(this); + } + + //handle frozen cells + if (this.table.modExists("frozenColumns")) { + this.table.modules.frozenColumns.layoutElement(this.element, this.column); + } +}; + +Cell.prototype.setWidth = function () { + this.width = this.column.width; + this.element.style.width = this.column.widthStyled; +}; + +Cell.prototype.clearWidth = function () { + this.width = ""; + this.element.style.width = ""; +}; + +Cell.prototype.getWidth = function () { + return this.width || this.element.offsetWidth; +}; + +Cell.prototype.setMinWidth = function () { + this.minWidth = this.column.minWidth; + this.element.style.minWidth = this.column.minWidthStyled; +}; + +Cell.prototype.checkHeight = function () { + // var height = this.element.css("height"); + this.row.reinitializeHeight(); +}; + +Cell.prototype.clearHeight = function () { + this.element.style.height = ""; + this.height = null; +}; + +Cell.prototype.setHeight = function () { + this.height = this.row.height; + this.element.style.height = this.row.heightStyled; +}; + +Cell.prototype.getHeight = function () { + return this.height || this.element.offsetHeight; +}; + +Cell.prototype.show = function () { + this.element.style.display = ""; +}; + +Cell.prototype.hide = function () { + this.element.style.display = "none"; +}; + +Cell.prototype.edit = function (force) { + if (this.table.modExists("edit", true)) { + return this.table.modules.edit.editCell(this, force); + } +}; + +Cell.prototype.cancelEdit = function () { + if (this.table.modExists("edit", true)) { + var editing = this.table.modules.edit.getCurrentCell(); + + if (editing && editing._getSelf() === this) { + this.table.modules.edit.cancelEdit(); + } else { + console.warn("Cancel Editor Error - This cell is not currently being edited "); + } + } +}; + +Cell.prototype.validate = function () { + if (this.column.modules.validate && this.table.modExists("validate", true)) { + var valid = this.table.modules.validate.validate(this.column.modules.validate, this, this.getValue()); + + return valid === true; + } else { + return true; + } +}; + +Cell.prototype.delete = function () { + if (!this.table.rowManager.redrawBlock) { + this.element.parentNode.removeChild(this.element); + } + + if (this.modules.validate && this.modules.validate.invalid) { + this.table.modules.validate.clearValidation(this); + } + + if (this.modules.edit && this.modules.edit.edited) { + this.table.modules.edit.clearEdited(this); + } + + this.element = false; + this.column.deleteCell(this); + this.row.deleteCell(this); + this.calcs = {}; +}; + +//////////////// Navigation ///////////////// + +Cell.prototype.nav = function () { + + var self = this, + nextCell = false, + index = this.row.getCellIndex(this); + + return { + next: function next() { + var nextCell = this.right(), + nextRow; + + if (!nextCell) { + nextRow = self.table.rowManager.nextDisplayRow(self.row, true); + + if (nextRow) { + nextCell = nextRow.findNextEditableCell(-1); + + if (nextCell) { + nextCell.edit(); + return true; + } + } + } else { + return true; + } + + return false; + }, + prev: function prev() { + var nextCell = this.left(), + prevRow; + + if (!nextCell) { + prevRow = self.table.rowManager.prevDisplayRow(self.row, true); + + if (prevRow) { + nextCell = prevRow.findPrevEditableCell(prevRow.cells.length); + + if (nextCell) { + nextCell.edit(); + return true; + } + } + } else { + return true; + } + + return false; + }, + left: function left() { + + nextCell = self.row.findPrevEditableCell(index); + + if (nextCell) { + nextCell.edit(); + return true; + } else { + return false; + } + }, + right: function right() { + nextCell = self.row.findNextEditableCell(index); + + if (nextCell) { + nextCell.edit(); + return true; + } else { + return false; + } + }, + up: function up() { + var nextRow = self.table.rowManager.prevDisplayRow(self.row, true); + + if (nextRow) { + nextRow.cells[index].edit(); + } + }, + down: function down() { + var nextRow = self.table.rowManager.nextDisplayRow(self.row, true); + + if (nextRow) { + nextRow.cells[index].edit(); + } + } + + }; +}; + +Cell.prototype.getIndex = function () { + this.row.getCellIndex(this); +}; + +//////////////// Object Generation ///////////////// +Cell.prototype.getComponent = function () { + + if (!this.component) { + this.component = new CellComponent(this); + } + + return this.component; +}; +var FooterManager = function FooterManager(table) { + this.table = table; + this.active = false; + this.element = this.createElement(); //containing element + this.external = false; + this.links = []; + + this._initialize(); +}; + +FooterManager.prototype.createElement = function () { + var el = document.createElement("div"); + + el.classList.add("tabulator-footer"); + + return el; +}; + +FooterManager.prototype._initialize = function (element) { + if (this.table.options.footerElement) { + + switch (_typeof(this.table.options.footerElement)) { + case "string": + + if (this.table.options.footerElement[0] === "<") { + this.element.innerHTML = this.table.options.footerElement; + } else { + this.external = true; + this.element = document.querySelector(this.table.options.footerElement); + } + break; + default: + this.element = this.table.options.footerElement; + break; + } + } +}; + +FooterManager.prototype.getElement = function () { + return this.element; +}; + +FooterManager.prototype.append = function (element, parent) { + this.activate(parent); + + this.element.appendChild(element); + this.table.rowManager.adjustTableSize(); +}; + +FooterManager.prototype.prepend = function (element, parent) { + this.activate(parent); + + this.element.insertBefore(element, this.element.firstChild); + this.table.rowManager.adjustTableSize(); +}; + +FooterManager.prototype.remove = function (element) { + element.parentNode.removeChild(element); + this.deactivate(); +}; + +FooterManager.prototype.deactivate = function (force) { + if (!this.element.firstChild || force) { + if (!this.external) { + this.element.parentNode.removeChild(this.element); + } + this.active = false; + } + + // this.table.rowManager.adjustTableSize(); +}; + +FooterManager.prototype.activate = function (parent) { + if (!this.active) { + this.active = true; + if (!this.external) { + this.table.element.appendChild(this.getElement()); + this.table.element.style.display = ''; + } + } + + if (parent) { + this.links.push(parent); + } +}; + +FooterManager.prototype.redraw = function () { + this.links.forEach(function (link) { + link.footerRedraw(); + }); +}; + +var Tabulator = function Tabulator(element, options) { + + this.options = {}; + + this.columnManager = null; // hold Column Manager + this.rowManager = null; //hold Row Manager + this.footerManager = null; //holder Footer Manager + this.browser = ""; //hold current browser type + this.browserSlow = false; //handle reduced functionality for slower browsers + this.browserMobile = false; //check if running on moble, prevent resize cancelling edit on keyboard appearence + + this.modules = {}; //hold all modules bound to this table + + this.initializeElement(element); + this.initializeOptions(options || {}); + this._create(); + + Tabulator.prototype.comms.register(this); //register table for inderdevice communication +}; + +//default setup options +Tabulator.prototype.defaultOptions = { + + height: false, //height of tabulator + minHeight: false, //minimum height of tabulator + maxHeight: false, //maximum height of tabulator + + layout: "fitData", ///layout type "fitColumns" | "fitData" + layoutColumnsOnNewData: false, //update column widths on setData + + columnMinWidth: 40, //minimum global width for a column + columnHeaderVertAlign: "top", //vertical alignment of column headers + columnVertAlign: false, // DEPRECATED - Left to allow warning + + resizableColumns: true, //resizable columns + resizableRows: false, //resizable rows + autoResize: true, //auto resize table + + columns: [], //store for colum header info + + cellHozAlign: "", //horizontal align columns + cellVertAlign: "", //certical align columns + + + data: [], //default starting data + + autoColumns: false, //build columns from data row structure + + reactiveData: false, //enable data reactivity + + nestedFieldSeparator: ".", //seperatpr for nested data + + tooltips: false, //Tool tip value + tooltipsHeader: false, //Tool tip for headers + tooltipGenerationMode: "load", //when to generate tooltips + + initialSort: false, //initial sorting criteria + initialFilter: false, //initial filtering criteria + initialHeaderFilter: false, //initial header filtering criteria + + columnHeaderSortMulti: true, //multiple or single column sorting + + sortOrderReverse: false, //reverse internal sort ordering + + headerSort: true, //set default global header sort + headerSortTristate: false, //set default tristate header sorting + + footerElement: false, //hold footer element + + index: "id", //filed for row index + + keybindings: [], //array for keybindings + + tabEndNewRow: false, //create new row when tab to end of table + + invalidOptionWarnings: true, //allow toggling of invalid option warnings + + clipboard: false, //enable clipboard + clipboardCopyStyled: true, //formatted table data + clipboardCopyConfig: false, //clipboard config + clipboardCopyFormatter: false, //DEPRICATED - REMOVE in 5.0 + clipboardCopyRowRange: "active", //restrict clipboard to visible rows only + clipboardPasteParser: "table", //convert pasted clipboard data to rows + clipboardPasteAction: "insert", //how to insert pasted data into the table + + clipboardCopied: function clipboardCopied() {}, //data has been copied to the clipboard + clipboardPasted: function clipboardPasted() {}, //data has been pasted into the table + clipboardPasteError: function clipboardPasteError() {}, //data has not successfully been pasted into the table + + downloadDataFormatter: false, //function to manipulate table data before it is downloaded + downloadReady: function downloadReady(data, blob) { + return blob; + }, //function to manipulate download data + downloadComplete: false, //function to manipulate download data + downloadConfig: {}, //download config + downloadRowRange: "active", //restrict download to active rows only + + dataTree: false, //enable data tree + dataTreeElementColumn: false, + dataTreeBranchElement: true, //show data tree branch element + dataTreeChildIndent: 9, //data tree child indent in px + dataTreeChildField: "_children", //data tre column field to look for child rows + dataTreeCollapseElement: false, //data tree row collapse element + dataTreeExpandElement: false, //data tree row expand element + dataTreeStartExpanded: false, + dataTreeRowExpanded: function dataTreeRowExpanded() {}, //row has been expanded + dataTreeRowCollapsed: function dataTreeRowCollapsed() {}, //row has been collapsed + dataTreeChildColumnCalcs: false, //include visible data tree rows in column calculations + dataTreeSelectPropagate: false, //seleccting a parent row selects its children + + printAsHtml: false, //enable print as html + printFormatter: false, //printing page formatter + printHeader: false, //page header contents + printFooter: false, //page footer contents + printCopyStyle: true, //DEPRICATED - REMOVE in 5.0 + printStyled: true, //enable print as html styling + printVisibleRows: true, //DEPRICATED - REMOVE in 5.0 + printRowRange: "visible", //restrict print to visible rows only + printConfig: {}, //print config options + + addRowPos: "bottom", //position to insert blank rows, top|bottom + + selectable: "highlight", //highlight rows on hover + selectableRangeMode: "drag", //highlight rows on hover + selectableRollingSelection: true, //roll selection once maximum number of selectable rows is reached + selectablePersistence: true, // maintain selection when table view is updated + selectableCheck: function selectableCheck(data, row) { + return true; + }, //check wheather row is selectable + + headerFilterLiveFilterDelay: 300, //delay before updating column after user types in header filter + headerFilterPlaceholder: false, //placeholder text to display in header filters + + headerVisible: true, //hide header + + history: false, //enable edit history + + locale: false, //current system language + langs: {}, + + virtualDom: true, //enable DOM virtualization + virtualDomBuffer: 0, // set virtual DOM buffer size + + persistentLayout: false, //DEPRICATED - REMOVE in 5.0 + persistentSort: false, //DEPRICATED - REMOVE in 5.0 + persistentFilter: false, //DEPRICATED - REMOVE in 5.0 + persistenceID: "", //key for persistent storage + persistenceMode: true, //mode for storing persistence information + persistenceReaderFunc: false, //function for handling persistence data reading + persistenceWriterFunc: false, //function for handling persistence data writing + + persistence: false, + + responsiveLayout: false, //responsive layout flags + responsiveLayoutCollapseStartOpen: true, //start showing collapsed data + responsiveLayoutCollapseUseFormatters: true, //responsive layout collapse formatter + responsiveLayoutCollapseFormatter: false, //responsive layout collapse formatter + + pagination: false, //set pagination type + paginationSize: false, //set number of rows to a page + paginationInitialPage: 1, //initail page to show on load + paginationButtonCount: 5, // set count of page button + paginationSizeSelector: false, //add pagination size selector element + paginationElement: false, //element to hold pagination numbers + paginationDataSent: {}, //pagination data sent to the server + paginationDataReceived: {}, //pagination data received from the server + paginationAddRow: "page", //add rows on table or page + + ajaxURL: false, //url for ajax loading + ajaxURLGenerator: false, + ajaxParams: {}, //params for ajax loading + ajaxConfig: "get", //ajax request type + ajaxContentType: "form", //ajax request type + ajaxRequestFunc: false, //promise function + ajaxLoader: true, //show loader + ajaxLoaderLoading: false, //loader element + ajaxLoaderError: false, //loader element + ajaxFiltering: false, + ajaxSorting: false, + ajaxProgressiveLoad: false, //progressive loading + ajaxProgressiveLoadDelay: 0, //delay between requests + ajaxProgressiveLoadScrollMargin: 0, //margin before scroll begins + + groupBy: false, //enable table grouping and set field to group by + groupStartOpen: true, //starting state of group + groupValues: false, + + groupHeader: false, //header generation function + groupHeaderPrint: null, + groupHeaderClipboard: null, + groupHeaderHtmlOutput: null, + groupHeaderDownload: null, + + htmlOutputConfig: false, //html outypu config + + movableColumns: false, //enable movable columns + + movableRows: false, //enable movable rows + movableRowsConnectedTables: false, //tables for movable rows to be connected to + movableRowsConnectedElements: false, //other elements for movable rows to be connected to + movableRowsSender: false, + movableRowsReceiver: "insert", + movableRowsSendingStart: function movableRowsSendingStart() {}, + movableRowsSent: function movableRowsSent() {}, + movableRowsSentFailed: function movableRowsSentFailed() {}, + movableRowsSendingStop: function movableRowsSendingStop() {}, + movableRowsReceivingStart: function movableRowsReceivingStart() {}, + movableRowsReceived: function movableRowsReceived() {}, + movableRowsReceivedFailed: function movableRowsReceivedFailed() {}, + movableRowsReceivingStop: function movableRowsReceivingStop() {}, + movableRowsElementDrop: function movableRowsElementDrop() {}, + + scrollToRowPosition: "top", + scrollToRowIfVisible: true, + + scrollToColumnPosition: "left", + scrollToColumnIfVisible: true, + + rowFormatter: false, + rowFormatterPrint: null, + rowFormatterClipboard: null, + rowFormatterHtmlOutput: null, + + placeholder: false, + + //table building callbacks + tableBuilding: function tableBuilding() {}, + tableBuilt: function tableBuilt() {}, + + //render callbacks + renderStarted: function renderStarted() {}, + renderComplete: function renderComplete() {}, + + //row callbacks + rowClick: false, + rowDblClick: false, + rowContext: false, + rowTap: false, + rowDblTap: false, + rowTapHold: false, + rowMouseEnter: false, + rowMouseLeave: false, + rowMouseOver: false, + rowMouseOut: false, + rowMouseMove: false, + rowContextMenu: false, + rowAdded: function rowAdded() {}, + rowDeleted: function rowDeleted() {}, + rowMoved: function rowMoved() {}, + rowUpdated: function rowUpdated() {}, + rowSelectionChanged: function rowSelectionChanged() {}, + rowSelected: function rowSelected() {}, + rowDeselected: function rowDeselected() {}, + rowResized: function rowResized() {}, + + //cell callbacks + //row callbacks + cellClick: false, + cellDblClick: false, + cellContext: false, + cellTap: false, + cellDblTap: false, + cellTapHold: false, + cellMouseEnter: false, + cellMouseLeave: false, + cellMouseOver: false, + cellMouseOut: false, + cellMouseMove: false, + cellEditing: function cellEditing() {}, + cellEdited: function cellEdited() {}, + cellEditCancelled: function cellEditCancelled() {}, + + //column callbacks + columnMoved: false, + columnResized: function columnResized() {}, + columnTitleChanged: function columnTitleChanged() {}, + columnVisibilityChanged: function columnVisibilityChanged() {}, + + //HTML iport callbacks + htmlImporting: function htmlImporting() {}, + htmlImported: function htmlImported() {}, + + //data callbacks + dataLoading: function dataLoading() {}, + dataLoaded: function dataLoaded() {}, + dataEdited: function dataEdited() {}, + + //ajax callbacks + ajaxRequesting: function ajaxRequesting() {}, + ajaxResponse: false, + ajaxError: function ajaxError() {}, + + //filtering callbacks + dataFiltering: false, + dataFiltered: false, + + //sorting callbacks + dataSorting: function dataSorting() {}, + dataSorted: function dataSorted() {}, + + //grouping callbacks + groupToggleElement: "arrow", + groupClosedShowCalcs: false, + dataGrouping: function dataGrouping() {}, + dataGrouped: false, + groupVisibilityChanged: function groupVisibilityChanged() {}, + groupClick: false, + groupDblClick: false, + groupContext: false, + groupContextMenu: false, + groupTap: false, + groupDblTap: false, + groupTapHold: false, + + columnCalcs: true, + + //pagination callbacks + pageLoaded: function pageLoaded() {}, + + //localization callbacks + localized: function localized() {}, + + //validation callbacks + validationMode: "blocking", + validationFailed: function validationFailed() {}, + + //history callbacks + historyUndo: function historyUndo() {}, + historyRedo: function historyRedo() {}, + + //scroll callbacks + scrollHorizontal: function scrollHorizontal() {}, + scrollVertical: function scrollVertical() {} +}; + +Tabulator.prototype.initializeOptions = function (options) { + + //warn user if option is not available + if (options.invalidOptionWarnings !== false) { + for (var key in options) { + if (typeof this.defaultOptions[key] === "undefined") { + console.warn("Invalid table constructor option:", key); + } + } + } + + //assign options to table + for (var key in this.defaultOptions) { + if (key in options) { + this.options[key] = options[key]; + } else { + if (Array.isArray(this.defaultOptions[key])) { + this.options[key] = []; + } else if (_typeof(this.defaultOptions[key]) === "object" && this.defaultOptions[key] !== null) { + this.options[key] = {}; + } else { + this.options[key] = this.defaultOptions[key]; + } + } + } +}; + +Tabulator.prototype.initializeElement = function (element) { + + if (typeof HTMLElement !== "undefined" && element instanceof HTMLElement) { + this.element = element; + return true; + } else if (typeof element === "string") { + this.element = document.querySelector(element); + + if (this.element) { + return true; + } else { + console.error("Tabulator Creation Error - no element found matching selector: ", element); + return false; + } + } else { + console.error("Tabulator Creation Error - Invalid element provided:", element); + return false; + } +}; + +//convert depricated functionality to new functions +Tabulator.prototype._mapDepricatedFunctionality = function () { + + //map depricated persistance setup options + if (this.options.persistentLayout || this.options.persistentSort || this.options.persistentFilter) { + if (!this.options.persistence) { + this.options.persistence = {}; + } + } + + if (this.options.downloadDataFormatter) { + console.warn("DEPRECATION WARNING - downloadDataFormatter option has been deprecated"); + } + + if (typeof this.options.clipboardCopyHeader !== "undefined") { + this.options.columnHeaders = this.options.clipboardCopyHeader; + console.warn("DEPRECATION WARNING - clipboardCopyHeader option has been deprecated, please use the columnHeaders property on the clipboardCopyConfig option"); + } + + if (this.options.printVisibleRows !== true) { + console.warn("printVisibleRows option is deprecated, you should now use the printRowRange option"); + + this.options.persistence.printRowRange = "active"; + } + + if (this.options.printCopyStyle !== true) { + console.warn("printCopyStyle option is deprecated, you should now use the printStyled option"); + + this.options.persistence.printStyled = this.options.printCopyStyle; + } + + if (this.options.persistentLayout) { + console.warn("persistentLayout option is deprecated, you should now use the persistence option"); + + if (this.options.persistence !== true && typeof this.options.persistence.columns === "undefined") { + this.options.persistence.columns = true; + } + } + + if (this.options.persistentSort) { + console.warn("persistentSort option is deprecated, you should now use the persistence option"); + + if (this.options.persistence !== true && typeof this.options.persistence.sort === "undefined") { + this.options.persistence.sort = true; + } + } + + if (this.options.persistentFilter) { + console.warn("persistentFilter option is deprecated, you should now use the persistence option"); + + if (this.options.persistence !== true && typeof this.options.persistence.filter === "undefined") { + this.options.persistence.filter = true; + } + } + + if (this.options.columnVertAlign) { + console.warn("columnVertAlign option is deprecated, you should now use the columnHeaderVertAlign option"); + + this.options.columnHeaderVertAlign = this.options.columnVertAlign; + } +}; + +Tabulator.prototype._clearSelection = function () { + + this.element.classList.add("tabulator-block-select"); + + if (window.getSelection) { + if (window.getSelection().empty) { + // Chrome + window.getSelection().empty(); + } else if (window.getSelection().removeAllRanges) { + // Firefox + window.getSelection().removeAllRanges(); + } + } else if (document.selection) { + // IE? + document.selection.empty(); + } + + this.element.classList.remove("tabulator-block-select"); +}; + +//concreate table +Tabulator.prototype._create = function () { + this._clearObjectPointers(); + + this._mapDepricatedFunctionality(); + + this.bindModules(); + + if (this.element.tagName === "TABLE") { + if (this.modExists("htmlTableImport", true)) { + this.modules.htmlTableImport.parseTable(); + } + } + + this.columnManager = new ColumnManager(this); + this.rowManager = new RowManager(this); + this.footerManager = new FooterManager(this); + + this.columnManager.setRowManager(this.rowManager); + this.rowManager.setColumnManager(this.columnManager); + + this._buildElement(); + + this._loadInitialData(); +}; + +//clear pointers to objects in default config object +Tabulator.prototype._clearObjectPointers = function () { + this.options.columns = this.options.columns.slice(0); + + if (!this.options.reactiveData) { + this.options.data = this.options.data.slice(0); + } +}; + +//build tabulator element +Tabulator.prototype._buildElement = function () { + var _this17 = this; + + var element = this.element, + mod = this.modules, + options = this.options; + + options.tableBuilding.call(this); + + element.classList.add("tabulator"); + element.setAttribute("role", "grid"); + + //empty element + while (element.firstChild) { + element.removeChild(element.firstChild); + } //set table height + if (options.height) { + options.height = isNaN(options.height) ? options.height : options.height + "px"; + element.style.height = options.height; + } + + //set table min height + if (options.minHeight !== false) { + options.minHeight = isNaN(options.minHeight) ? options.minHeight : options.minHeight + "px"; + element.style.minHeight = options.minHeight; + } + + //set table maxHeight + if (options.maxHeight !== false) { + options.maxHeight = isNaN(options.maxHeight) ? options.maxHeight : options.maxHeight + "px"; + element.style.maxHeight = options.maxHeight; + } + + this.columnManager.initialize(); + this.rowManager.initialize(); + + this._detectBrowser(); + + if (this.modExists("layout", true)) { + mod.layout.initialize(options.layout); + } + + //set localization + if (options.headerFilterPlaceholder !== false) { + mod.localize.setHeaderFilterPlaceholder(options.headerFilterPlaceholder); + } + + for (var locale in options.langs) { + mod.localize.installLang(locale, options.langs[locale]); + } + + mod.localize.setLocale(options.locale); + + //configure placeholder element + if (typeof options.placeholder == "string") { + + var el = document.createElement("div"); + el.classList.add("tabulator-placeholder"); + + var span = document.createElement("span"); + span.innerHTML = options.placeholder; + + el.appendChild(span); + + options.placeholder = el; + } + + //build table elements + element.appendChild(this.columnManager.getElement()); + element.appendChild(this.rowManager.getElement()); + + if (options.footerElement) { + this.footerManager.activate(); + } + + if (options.persistence && this.modExists("persistence", true)) { + mod.persistence.initialize(); + } + + if (options.persistence && this.modExists("persistence", true) && mod.persistence.config.columns) { + options.columns = mod.persistence.load("columns", options.columns); + } + + if (options.movableRows && this.modExists("moveRow")) { + mod.moveRow.initialize(); + } + + if (options.autoColumns && this.options.data) { + this.columnManager.generateColumnsFromRowData(this.options.data); + } + + if (this.modExists("columnCalcs")) { + mod.columnCalcs.initialize(); + } + + this.columnManager.setColumns(options.columns); + + if (options.dataTree && this.modExists("dataTree", true)) { + mod.dataTree.initialize(); + } + + if (this.modExists("frozenRows")) { + this.modules.frozenRows.initialize(); + } + + if ((options.persistence && this.modExists("persistence", true) && mod.persistence.config.sort || options.initialSort) && this.modExists("sort", true)) { + var sorters = []; + + if (options.persistence && this.modExists("persistence", true) && mod.persistence.config.sort) { + sorters = mod.persistence.load("sort"); + + if (sorters === false && options.initialSort) { + sorters = options.initialSort; + } + } else if (options.initialSort) { + sorters = options.initialSort; + } + + mod.sort.setSort(sorters); + } + + if ((options.persistence && this.modExists("persistence", true) && mod.persistence.config.filter || options.initialFilter) && this.modExists("filter", true)) { + var filters = []; + + if (options.persistence && this.modExists("persistence", true) && mod.persistence.config.filter) { + filters = mod.persistence.load("filter"); + + if (filters === false && options.initialFilter) { + filters = options.initialFilter; + } + } else if (options.initialFilter) { + filters = options.initialFilter; + } + + mod.filter.setFilter(filters); + } + + if (options.initialHeaderFilter && this.modExists("filter", true)) { + options.initialHeaderFilter.forEach(function (item) { + + var column = _this17.columnManager.findColumn(item.field); + + if (column) { + mod.filter.setHeaderFilterValue(column, item.value); + } else { + console.warn("Column Filter Error - No matching column found:", item.field); + return false; + } + }); + } + + if (this.modExists("ajax")) { + mod.ajax.initialize(); + } + + if (options.pagination && this.modExists("page", true)) { + mod.page.initialize(); + } + + if (options.groupBy && this.modExists("groupRows", true)) { + mod.groupRows.initialize(); + } + + if (this.modExists("keybindings")) { + mod.keybindings.initialize(); + } + + if (this.modExists("selectRow")) { + mod.selectRow.clearSelectionData(true); + } + + if (options.autoResize && this.modExists("resizeTable")) { + mod.resizeTable.initialize(); + } + + if (this.modExists("clipboard")) { + mod.clipboard.initialize(); + } + + if (options.printAsHtml && this.modExists("print")) { + mod.print.initialize(); + } + + options.tableBuilt.call(this); +}; + +Tabulator.prototype._loadInitialData = function () { + var self = this; + + if (self.options.pagination && self.modExists("page")) { + self.modules.page.reset(true, true); + + if (self.options.pagination == "local") { + if (self.options.data.length) { + self.rowManager.setData(self.options.data, false, true); + } else { + if ((self.options.ajaxURL || self.options.ajaxURLGenerator) && self.modExists("ajax")) { + self.modules.ajax.loadData(false, true).then(function () {}).catch(function () { + if (self.options.paginationInitialPage) { + self.modules.page.setPage(self.options.paginationInitialPage); + } + }); + + return; + } else { + self.rowManager.setData(self.options.data, false, true); + } + } + + if (self.options.paginationInitialPage) { + self.modules.page.setPage(self.options.paginationInitialPage); + } + } else { + if (self.options.ajaxURL) { + self.modules.page.setPage(self.options.paginationInitialPage).then(function () {}).catch(function () {}); + } else { + self.rowManager.setData([], false, true); + } + } + } else { + if (self.options.data.length) { + self.rowManager.setData(self.options.data); + } else { + if ((self.options.ajaxURL || self.options.ajaxURLGenerator) && self.modExists("ajax")) { + self.modules.ajax.loadData(false, true).then(function () {}).catch(function () {}); + } else { + self.rowManager.setData(self.options.data, false, true); + } + } + } +}; + +//deconstructor +Tabulator.prototype.destroy = function () { + var element = this.element; + + Tabulator.prototype.comms.deregister(this); //deregister table from inderdevice communication + + if (this.options.reactiveData && this.modExists("reactiveData", true)) { + this.modules.reactiveData.unwatchData(); + } + + //clear row data + this.rowManager.rows.forEach(function (row) { + row.wipe(); + }); + + this.rowManager.rows = []; + this.rowManager.activeRows = []; + this.rowManager.displayRows = []; + + //clear event bindings + if (this.options.autoResize && this.modExists("resizeTable")) { + this.modules.resizeTable.clearBindings(); + } + + if (this.modExists("keybindings")) { + this.modules.keybindings.clearBindings(); + } + + //clear DOM + while (element.firstChild) { + element.removeChild(element.firstChild); + }element.classList.remove("tabulator"); +}; + +Tabulator.prototype._detectBrowser = function () { + var ua = navigator.userAgent || navigator.vendor || window.opera; + + if (ua.indexOf("Trident") > -1) { + this.browser = "ie"; + this.browserSlow = true; + } else if (ua.indexOf("Edge") > -1) { + this.browser = "edge"; + this.browserSlow = true; + } else if (ua.indexOf("Firefox") > -1) { + this.browser = "firefox"; + this.browserSlow = false; + } else { + this.browser = "other"; + this.browserSlow = false; + } + + this.browserMobile = /(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino|android|ipad|playbook|silk/i.test(ua) || /1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(ua.substr(0, 4)); +}; + +////////////////// Data Handling ////////////////// + +//block table redrawing +Tabulator.prototype.blockRedraw = function () { + return this.rowManager.blockRedraw(); +}; + +//restore table redrawing +Tabulator.prototype.restoreRedraw = function () { + return this.rowManager.restoreRedraw(); +}; + +//local data from local file +Tabulator.prototype.setDataFromLocalFile = function (extensions) { + var _this18 = this; + + return new Promise(function (resolve, reject) { + var input = document.createElement("input"); + input.type = "file"; + input.accept = extensions || ".json,application/json"; + + input.addEventListener("change", function (e) { + var file = input.files[0], + reader = new FileReader(), + data; + + reader.readAsText(file); + + reader.onload = function (e) { + + try { + data = JSON.parse(reader.result); + } catch (e) { + console.warn("File Load Error - File contents is invalid JSON", e); + reject(e); + return; + } + + _this18._setData(data).then(function (data) { + resolve(data); + }).catch(function (err) { + resolve(err); + }); + }; + + reader.onerror = function (e) { + console.warn("File Load Error - Unable to read file"); + reject(); + }; + }); + + input.click(); + }); +}; + +//load data +Tabulator.prototype.setData = function (data, params, config) { + if (this.modExists("ajax")) { + this.modules.ajax.blockActiveRequest(); + } + + return this._setData(data, params, config, false, true); +}; + +Tabulator.prototype._setData = function (data, params, config, inPosition, columnsChanged) { + var self = this; + + if (typeof data === "string") { + if (data.indexOf("{") == 0 || data.indexOf("[") == 0) { + //data is a json encoded string + return self.rowManager.setData(JSON.parse(data), inPosition, columnsChanged); + } else { + + if (self.modExists("ajax", true)) { + if (params) { + self.modules.ajax.setParams(params); + } + + if (config) { + self.modules.ajax.setConfig(config); + } + + self.modules.ajax.setUrl(data); + + if (self.options.pagination == "remote" && self.modExists("page", true)) { + self.modules.page.reset(true, true); + return self.modules.page.setPage(1); + } else { + //assume data is url, make ajax call to url to get data + return self.modules.ajax.loadData(inPosition, columnsChanged); + } + } + } + } else { + if (data) { + //asume data is already an object + return self.rowManager.setData(data, inPosition, columnsChanged); + } else { + + //no data provided, check if ajaxURL is present; + if (self.modExists("ajax") && (self.modules.ajax.getUrl || self.options.ajaxURLGenerator)) { + + if (self.options.pagination == "remote" && self.modExists("page", true)) { + self.modules.page.reset(true, true); + return self.modules.page.setPage(1); + } else { + return self.modules.ajax.loadData(inPosition, columnsChanged); + } + } else { + //empty data + return self.rowManager.setData([], inPosition, columnsChanged); + } + } + } +}; + +//clear data +Tabulator.prototype.clearData = function () { + if (this.modExists("ajax")) { + this.modules.ajax.blockActiveRequest(); + } + + this.rowManager.clearData(); +}; + +//get table data array +Tabulator.prototype.getData = function (active) { + + if (active === true) { + console.warn("passing a boolean to the getData function is deprecated, you should now pass the string 'active'"); + active = "active"; + } + + return this.rowManager.getData(active); +}; + +//get table data array count +Tabulator.prototype.getDataCount = function (active) { + + if (active === true) { + console.warn("passing a boolean to the getDataCount function is deprecated, you should now pass the string 'active'"); + active = "active"; + } + + return this.rowManager.getDataCount(active); +}; + +//search for specific row components +Tabulator.prototype.searchRows = function (field, type, value) { + if (this.modExists("filter", true)) { + return this.modules.filter.search("rows", field, type, value); + } +}; + +//search for specific data +Tabulator.prototype.searchData = function (field, type, value) { + if (this.modExists("filter", true)) { + return this.modules.filter.search("data", field, type, value); + } +}; + +//get table html +Tabulator.prototype.getHtml = function (visible, style, config) { + if (this.modExists("export", true)) { + return this.modules.export.getHtml(visible, style, config); + } +}; + +//get print html +Tabulator.prototype.print = function (visible, style, config) { + if (this.modExists("print", true)) { + return this.modules.print.printFullscreen(visible, style, config); + } +}; + +//retrieve Ajax URL +Tabulator.prototype.getAjaxUrl = function () { + if (this.modExists("ajax", true)) { + return this.modules.ajax.getUrl(); + } +}; + +//replace data, keeping table in position with same sort +Tabulator.prototype.replaceData = function (data, params, config) { + if (this.modExists("ajax")) { + this.modules.ajax.blockActiveRequest(); + } + + return this._setData(data, params, config, true); +}; + +//update table data +Tabulator.prototype.updateData = function (data) { + var _this19 = this; + + var self = this; + var responses = 0; + + return new Promise(function (resolve, reject) { + if (_this19.modExists("ajax")) { + _this19.modules.ajax.blockActiveRequest(); + } + + if (typeof data === "string") { + data = JSON.parse(data); + } + + if (data) { + data.forEach(function (item) { + var row = self.rowManager.findRow(item[self.options.index]); + + if (row) { + responses++; + + row.updateData(item).then(function () { + responses--; + + if (!responses) { + resolve(); + } + }); + } + }); + } else { + console.warn("Update Error - No data provided"); + reject("Update Error - No data provided"); + } + }); +}; + +Tabulator.prototype.addData = function (data, pos, index) { + var _this20 = this; + + return new Promise(function (resolve, reject) { + if (_this20.modExists("ajax")) { + _this20.modules.ajax.blockActiveRequest(); + } + + if (typeof data === "string") { + data = JSON.parse(data); + } + + if (data) { + _this20.rowManager.addRows(data, pos, index).then(function (rows) { + var output = []; + + rows.forEach(function (row) { + output.push(row.getComponent()); + }); + + resolve(output); + }); + } else { + console.warn("Update Error - No data provided"); + reject("Update Error - No data provided"); + } + }); +}; + +//update table data +Tabulator.prototype.updateOrAddData = function (data) { + var _this21 = this; + + var self = this, + rows = [], + responses = 0; + + return new Promise(function (resolve, reject) { + if (_this21.modExists("ajax")) { + _this21.modules.ajax.blockActiveRequest(); + } + + if (typeof data === "string") { + data = JSON.parse(data); + } + + if (data) { + data.forEach(function (item) { + var row = self.rowManager.findRow(item[self.options.index]); + + responses++; + + if (row) { + row.updateData(item).then(function () { + responses--; + rows.push(row.getComponent()); + + if (!responses) { + resolve(rows); + } + }); + } else { + self.rowManager.addRows(item).then(function (newRows) { + responses--; + rows.push(newRows[0].getComponent()); + + if (!responses) { + resolve(rows); + } + }); + } + }); + } else { + console.warn("Update Error - No data provided"); + reject("Update Error - No data provided"); + } + }); +}; + +//get row object +Tabulator.prototype.getRow = function (index) { + var row = this.rowManager.findRow(index); + + if (row) { + return row.getComponent(); + } else { + console.warn("Find Error - No matching row found:", index); + return false; + } +}; + +//get row object +Tabulator.prototype.getRowFromPosition = function (position, active) { + var row = this.rowManager.getRowFromPosition(position, active); + + if (row) { + return row.getComponent(); + } else { + console.warn("Find Error - No matching row found:", position); + return false; + } +}; + +//delete row from table +Tabulator.prototype.deleteRow = function (index) { + var _this22 = this; + + return new Promise(function (resolve, reject) { + var self = _this22, + count = 0, + successCount = 0, + foundRows = []; + + function doneCheck() { + count++; + + if (count == index.length) { + if (successCount) { + self.rowManager.reRenderInPosition(); + resolve(); + } + } + } + + if (!Array.isArray(index)) { + index = [index]; + } + + //find matching rows + index.forEach(function (item) { + var row = _this22.rowManager.findRow(item, true); + + if (row) { + foundRows.push(row); + } else { + console.warn("Delete Error - No matching row found:", item); + reject("Delete Error - No matching row found"); + doneCheck(); + } + }); + + //sort rows into correct order to ensure smooth delete from table + foundRows.sort(function (a, b) { + return _this22.rowManager.rows.indexOf(a) > _this22.rowManager.rows.indexOf(b) ? 1 : -1; + }); + + foundRows.forEach(function (row) { + row.delete().then(function () { + successCount++; + doneCheck(); + }).catch(function (err) { + doneCheck(); + reject(err); + }); + }); + }); +}; + +//add row to table +Tabulator.prototype.addRow = function (data, pos, index) { + var _this23 = this; + + return new Promise(function (resolve, reject) { + if (typeof data === "string") { + data = JSON.parse(data); + } + + _this23.rowManager.addRows(data, pos, index).then(function (rows) { + //recalc column calculations if present + if (_this23.modExists("columnCalcs")) { + _this23.modules.columnCalcs.recalc(_this23.rowManager.activeRows); + } + + resolve(rows[0].getComponent()); + }); + }); +}; + +//update a row if it exitsts otherwise create it +Tabulator.prototype.updateOrAddRow = function (index, data) { + var _this24 = this; + + return new Promise(function (resolve, reject) { + var row = _this24.rowManager.findRow(index); + + if (typeof data === "string") { + data = JSON.parse(data); + } + + if (row) { + row.updateData(data).then(function () { + //recalc column calculations if present + if (_this24.modExists("columnCalcs")) { + _this24.modules.columnCalcs.recalc(_this24.rowManager.activeRows); + } + + resolve(row.getComponent()); + }).catch(function (err) { + reject(err); + }); + } else { + row = _this24.rowManager.addRows(data).then(function (rows) { + //recalc column calculations if present + if (_this24.modExists("columnCalcs")) { + _this24.modules.columnCalcs.recalc(_this24.rowManager.activeRows); + } + + resolve(rows[0].getComponent()); + }).catch(function (err) { + reject(err); + }); + } + }); +}; + +//update row data +Tabulator.prototype.updateRow = function (index, data) { + var _this25 = this; + + return new Promise(function (resolve, reject) { + var row = _this25.rowManager.findRow(index); + + if (typeof data === "string") { + data = JSON.parse(data); + } + + if (row) { + row.updateData(data).then(function () { + resolve(row.getComponent()); + }).catch(function (err) { + reject(err); + }); + } else { + console.warn("Update Error - No matching row found:", index); + reject("Update Error - No matching row found"); + } + }); +}; + +//scroll to row in DOM +Tabulator.prototype.scrollToRow = function (index, position, ifVisible) { + var _this26 = this; + + return new Promise(function (resolve, reject) { + var row = _this26.rowManager.findRow(index); + + if (row) { + _this26.rowManager.scrollToRow(row, position, ifVisible).then(function () { + resolve(); + }).catch(function (err) { + reject(err); + }); + } else { + console.warn("Scroll Error - No matching row found:", index); + reject("Scroll Error - No matching row found"); + } + }); +}; + +Tabulator.prototype.moveRow = function (from, to, after) { + var fromRow = this.rowManager.findRow(from); + + if (fromRow) { + fromRow.moveToRow(to, after); + } else { + console.warn("Move Error - No matching row found:", from); + } +}; + +Tabulator.prototype.getRows = function (active) { + + if (active === true) { + console.warn("passing a boolean to the getRows function is deprecated, you should now pass the string 'active'"); + active = "active"; + } + + return this.rowManager.getComponents(active); +}; + +//get position of row in table +Tabulator.prototype.getRowPosition = function (index, active) { + var row = this.rowManager.findRow(index); + + if (row) { + return this.rowManager.getRowPosition(row, active); + } else { + console.warn("Position Error - No matching row found:", index); + return false; + } +}; + +//copy table data to clipboard +Tabulator.prototype.copyToClipboard = function (selector) { + if (this.modExists("clipboard", true)) { + this.modules.clipboard.copy(selector); + } +}; + +/////////////// Column Functions /////////////// + +Tabulator.prototype.setColumns = function (definition) { + this.columnManager.setColumns(definition); +}; + +Tabulator.prototype.getColumns = function (structured) { + return this.columnManager.getComponents(structured); +}; + +Tabulator.prototype.getColumn = function (field) { + var col = this.columnManager.findColumn(field); + + if (col) { + return col.getComponent(); + } else { + console.warn("Find Error - No matching column found:", field); + return false; + } +}; + +Tabulator.prototype.getColumnDefinitions = function () { + return this.columnManager.getDefinitionTree(); +}; + +Tabulator.prototype.getColumnLayout = function () { + if (this.modExists("persistence", true)) { + return this.modules.persistence.parseColumns(this.columnManager.getColumns()); + } +}; + +Tabulator.prototype.setColumnLayout = function (layout) { + if (this.modExists("persistence", true)) { + this.columnManager.setColumns(this.modules.persistence.mergeDefinition(this.options.columns, layout)); + return true; + } + return false; +}; + +Tabulator.prototype.showColumn = function (field) { + var column = this.columnManager.findColumn(field); + + if (column) { + column.show(); + + if (this.options.responsiveLayout && this.modExists("responsiveLayout", true)) { + this.modules.responsiveLayout.update(); + } + } else { + console.warn("Column Show Error - No matching column found:", field); + return false; + } +}; + +Tabulator.prototype.hideColumn = function (field) { + var column = this.columnManager.findColumn(field); + + if (column) { + column.hide(); + + if (this.options.responsiveLayout && this.modExists("responsiveLayout", true)) { + this.modules.responsiveLayout.update(); + } + } else { + console.warn("Column Hide Error - No matching column found:", field); + return false; + } +}; + +Tabulator.prototype.toggleColumn = function (field) { + var column = this.columnManager.findColumn(field); + + if (column) { + if (column.visible) { + column.hide(); + } else { + column.show(); + } + } else { + console.warn("Column Visibility Toggle Error - No matching column found:", field); + return false; + } +}; + +Tabulator.prototype.addColumn = function (definition, before, field) { + var _this27 = this; + + return new Promise(function (resolve, reject) { + var column = _this27.columnManager.findColumn(field); + + _this27.columnManager.addColumn(definition, before, column).then(function (column) { + resolve(column.getComponent()); + }).catch(function (err) { + reject(err); + }); + }); +}; + +Tabulator.prototype.deleteColumn = function (field) { + var _this28 = this; + + return new Promise(function (resolve, reject) { + var column = _this28.columnManager.findColumn(field); + + if (column) { + column.delete().then(function () { + resolve(); + }).catch(function (err) { + reject(err); + }); + } else { + console.warn("Column Delete Error - No matching column found:", field); + reject(); + } + }); +}; + +Tabulator.prototype.updateColumnDefinition = function (field, definition) { + var _this29 = this; + + return new Promise(function (resolve, reject) { + var column = _this29.columnManager.findColumn(field); + + if (column) { + column.updateDefinition(definition).then(function (col) { + resolve(col); + }).catch(function (err) { + reject(err); + }); + } else { + console.warn("Column Update Error - No matching column found:", field); + reject(); + } + }); +}; + +Tabulator.prototype.moveColumn = function (from, to, after) { + var fromColumn = this.columnManager.findColumn(from); + var toColumn = this.columnManager.findColumn(to); + + if (fromColumn) { + if (toColumn) { + this.columnManager.moveColumn(fromColumn, toColumn, after); + } else { + console.warn("Move Error - No matching column found:", toColumn); + } + } else { + console.warn("Move Error - No matching column found:", from); + } +}; + +//scroll to column in DOM +Tabulator.prototype.scrollToColumn = function (field, position, ifVisible) { + var _this30 = this; + + return new Promise(function (resolve, reject) { + var column = _this30.columnManager.findColumn(field); + + if (column) { + _this30.columnManager.scrollToColumn(column, position, ifVisible).then(function () { + resolve(); + }).catch(function (err) { + reject(err); + }); + } else { + console.warn("Scroll Error - No matching column found:", field); + reject("Scroll Error - No matching column found"); + } + }); +}; + +//////////// Localization Functions //////////// +Tabulator.prototype.setLocale = function (locale) { + this.modules.localize.setLocale(locale); +}; + +Tabulator.prototype.getLocale = function () { + return this.modules.localize.getLocale(); +}; + +Tabulator.prototype.getLang = function (locale) { + return this.modules.localize.getLang(locale); +}; + +//////////// General Public Functions //////////// + +//redraw list without updating data +Tabulator.prototype.redraw = function (force) { + this.columnManager.redraw(force); + this.rowManager.redraw(force); +}; + +Tabulator.prototype.setHeight = function (height) { + + if (this.rowManager.renderMode !== "classic") { + this.options.height = isNaN(height) ? height : height + "px"; + this.element.style.height = this.options.height; + this.rowManager.setRenderMode(); + this.rowManager.redraw(); + } else { + console.warn("setHeight function is not available in classic render mode"); + } +}; + +///////////////////// Sorting //////////////////// + +//trigger sort +Tabulator.prototype.setSort = function (sortList, dir) { + if (this.modExists("sort", true)) { + this.modules.sort.setSort(sortList, dir); + this.rowManager.sorterRefresh(); + } +}; + +Tabulator.prototype.getSorters = function () { + if (this.modExists("sort", true)) { + return this.modules.sort.getSort(); + } +}; + +Tabulator.prototype.clearSort = function () { + if (this.modExists("sort", true)) { + this.modules.sort.clear(); + this.rowManager.sorterRefresh(); + } +}; + +///////////////////// Filtering //////////////////// + +//set standard filters +Tabulator.prototype.setFilter = function (field, type, value, params) { + if (this.modExists("filter", true)) { + this.modules.filter.setFilter(field, type, value, params); + this.rowManager.filterRefresh(); + } +}; + +//add filter to array +Tabulator.prototype.addFilter = function (field, type, value, params) { + if (this.modExists("filter", true)) { + this.modules.filter.addFilter(field, type, value, params); + this.rowManager.filterRefresh(); + } +}; + +//get all filters +Tabulator.prototype.getFilters = function (all) { + if (this.modExists("filter", true)) { + return this.modules.filter.getFilters(all); + } +}; + +Tabulator.prototype.setHeaderFilterFocus = function (field) { + if (this.modExists("filter", true)) { + var column = this.columnManager.findColumn(field); + + if (column) { + this.modules.filter.setHeaderFilterFocus(column); + } else { + console.warn("Column Filter Focus Error - No matching column found:", field); + return false; + } + } +}; + +Tabulator.prototype.getHeaderFilterValue = function (field) { + if (this.modExists("filter", true)) { + var column = this.columnManager.findColumn(field); + + if (column) { + return this.modules.filter.getHeaderFilterValue(column); + } else { + console.warn("Column Filter Error - No matching column found:", field); + } + } +}; + +Tabulator.prototype.setHeaderFilterValue = function (field, value) { + if (this.modExists("filter", true)) { + var column = this.columnManager.findColumn(field); + + if (column) { + this.modules.filter.setHeaderFilterValue(column, value); + } else { + console.warn("Column Filter Error - No matching column found:", field); + return false; + } + } +}; + +Tabulator.prototype.getHeaderFilters = function () { + if (this.modExists("filter", true)) { + return this.modules.filter.getHeaderFilters(); + } +}; + +//remove filter from array +Tabulator.prototype.removeFilter = function (field, type, value) { + if (this.modExists("filter", true)) { + this.modules.filter.removeFilter(field, type, value); + this.rowManager.filterRefresh(); + } +}; + +//clear filters +Tabulator.prototype.clearFilter = function (all) { + if (this.modExists("filter", true)) { + this.modules.filter.clearFilter(all); + this.rowManager.filterRefresh(); + } +}; + +//clear header filters +Tabulator.prototype.clearHeaderFilter = function () { + if (this.modExists("filter", true)) { + this.modules.filter.clearHeaderFilter(); + this.rowManager.filterRefresh(); + } +}; + +///////////////////// select //////////////////// +Tabulator.prototype.selectRow = function (rows) { + if (this.modExists("selectRow", true)) { + if (rows === true) { + console.warn("passing a boolean to the selectRowselectRow function is deprecated, you should now pass the string 'active'"); + rows = "active"; + } + this.modules.selectRow.selectRows(rows); + } +}; + +Tabulator.prototype.deselectRow = function (rows) { + if (this.modExists("selectRow", true)) { + this.modules.selectRow.deselectRows(rows); + } +}; + +Tabulator.prototype.toggleSelectRow = function (row) { + if (this.modExists("selectRow", true)) { + this.modules.selectRow.toggleRow(row); + } +}; + +Tabulator.prototype.getSelectedRows = function () { + if (this.modExists("selectRow", true)) { + return this.modules.selectRow.getSelectedRows(); + } +}; + +Tabulator.prototype.getSelectedData = function () { + if (this.modExists("selectRow", true)) { + return this.modules.selectRow.getSelectedData(); + } +}; + +///////////////////// validation //////////////////// +Tabulator.prototype.getInvalidCells = function () { + if (this.modExists("validate", true)) { + return this.modules.validate.getInvalidCells(); + } +}; + +Tabulator.prototype.clearCellValidation = function (cells) { + var _this31 = this; + + if (this.modExists("validate", true)) { + + if (!cells) { + cells = this.modules.validate.getInvalidCells(); + } + + if (!Array.isArray(cells)) { + cells = [cells]; + } + + cells.forEach(function (cell) { + _this31.modules.validate.clearValidation(cell._getSelf()); + }); + } +}; + +Tabulator.prototype.validate = function (cells) { + var output = []; + + //clear row data + this.rowManager.rows.forEach(function (row) { + var valid = row.validate(); + + if (valid !== true) { + output = output.concat(valid); + } + }); + + return output.length ? output : true; +}; + +//////////// Pagination Functions //////////// + +Tabulator.prototype.setMaxPage = function (max) { + if (this.options.pagination && this.modExists("page")) { + this.modules.page.setMaxPage(max); + } else { + return false; + } +}; + +Tabulator.prototype.setPage = function (page) { + if (this.options.pagination && this.modExists("page")) { + return this.modules.page.setPage(page); + } else { + return new Promise(function (resolve, reject) { + reject(); + }); + } +}; + +Tabulator.prototype.setPageToRow = function (row) { + var _this32 = this; + + return new Promise(function (resolve, reject) { + if (_this32.options.pagination && _this32.modExists("page")) { + row = _this32.rowManager.findRow(row); + + if (row) { + _this32.modules.page.setPageToRow(row).then(function () { + resolve(); + }).catch(function () { + reject(); + }); + } else { + reject(); + } + } else { + reject(); + } + }); +}; + +Tabulator.prototype.setPageSize = function (size) { + if (this.options.pagination && this.modExists("page")) { + this.modules.page.setPageSize(size); + this.modules.page.setPage(1).then(function () {}).catch(function () {}); + } else { + return false; + } +}; + +Tabulator.prototype.getPageSize = function () { + if (this.options.pagination && this.modExists("page", true)) { + return this.modules.page.getPageSize(); + } +}; + +Tabulator.prototype.previousPage = function () { + if (this.options.pagination && this.modExists("page")) { + this.modules.page.previousPage(); + } else { + return false; + } +}; + +Tabulator.prototype.nextPage = function () { + if (this.options.pagination && this.modExists("page")) { + this.modules.page.nextPage(); + } else { + return false; + } +}; + +Tabulator.prototype.getPage = function () { + if (this.options.pagination && this.modExists("page")) { + return this.modules.page.getPage(); + } else { + return false; + } +}; + +Tabulator.prototype.getPageMax = function () { + if (this.options.pagination && this.modExists("page")) { + return this.modules.page.getPageMax(); + } else { + return false; + } +}; + +///////////////// Grouping Functions /////////////// + +Tabulator.prototype.setGroupBy = function (groups) { + if (this.modExists("groupRows", true)) { + this.options.groupBy = groups; + this.modules.groupRows.initialize(); + this.rowManager.refreshActiveData("display"); + + if (this.options.persistence && this.modExists("persistence", true) && this.modules.persistence.config.group) { + this.modules.persistence.save("group"); + } + } else { + return false; + } +}; + +Tabulator.prototype.setGroupStartOpen = function (values) { + if (this.modExists("groupRows", true)) { + this.options.groupStartOpen = values; + this.modules.groupRows.initialize(); + if (this.options.groupBy) { + this.rowManager.refreshActiveData("group"); + + if (this.options.persistence && this.modExists("persistence", true) && this.modules.persistence.config.group) { + this.modules.persistence.save("group"); + } + } else { + console.warn("Grouping Update - cant refresh view, no groups have been set"); + } + } else { + return false; + } +}; + +Tabulator.prototype.setGroupHeader = function (values) { + if (this.modExists("groupRows", true)) { + this.options.groupHeader = values; + this.modules.groupRows.initialize(); + if (this.options.groupBy) { + this.rowManager.refreshActiveData("group"); + + if (this.options.persistence && this.modExists("persistence", true) && this.modules.persistence.config.group) { + this.modules.persistence.save("group"); + } + } else { + console.warn("Grouping Update - cant refresh view, no groups have been set"); + } + } else { + return false; + } +}; + +Tabulator.prototype.getGroups = function (values) { + if (this.modExists("groupRows", true)) { + return this.modules.groupRows.getGroups(true); + } else { + return false; + } +}; + +// get grouped table data in the same format as getData() +Tabulator.prototype.getGroupedData = function () { + if (this.modExists("groupRows", true)) { + return this.options.groupBy ? this.modules.groupRows.getGroupedData() : this.getData(); + } +}; + +Tabulator.prototype.getEditedCells = function () { + if (this.modExists("edit", true)) { + return this.modules.edit.getEditedCells(); + } +}; + +Tabulator.prototype.clearCellEdited = function (cells) { + var _this33 = this; + + if (this.modExists("edit", true)) { + + if (!cells) { + cells = this.modules.edit.getEditedCells(); + } + + if (!Array.isArray(cells)) { + cells = [cells]; + } + + cells.forEach(function (cell) { + _this33.modules.edit.clearEdited(cell._getSelf()); + }); + } +}; + +///////////////// Column Calculation Functions /////////////// +Tabulator.prototype.getCalcResults = function () { + if (this.modExists("columnCalcs", true)) { + return this.modules.columnCalcs.getResults(); + } else { + return false; + } +}; + +Tabulator.prototype.recalc = function () { + if (this.modExists("columnCalcs", true)) { + this.modules.columnCalcs.recalcAll(this.rowManager.activeRows); + } +}; + +/////////////// Navigation Management ////////////// + +Tabulator.prototype.navigatePrev = function () { + var cell = false; + + if (this.modExists("edit", true)) { + cell = this.modules.edit.currentCell; + + if (cell) { + return cell.nav().prev(); + } + } + + return false; +}; + +Tabulator.prototype.navigateNext = function () { + var cell = false; + + if (this.modExists("edit", true)) { + cell = this.modules.edit.currentCell; + + if (cell) { + return cell.nav().next(); + } + } + + return false; +}; + +Tabulator.prototype.navigateLeft = function () { + var cell = false; + + if (this.modExists("edit", true)) { + cell = this.modules.edit.currentCell; + + if (cell) { + e.preventDefault(); + return cell.nav().left(); + } + } + + return false; +}; + +Tabulator.prototype.navigateRight = function () { + var cell = false; + + if (this.modExists("edit", true)) { + cell = this.modules.edit.currentCell; + + if (cell) { + e.preventDefault(); + return cell.nav().right(); + } + } + + return false; +}; + +Tabulator.prototype.navigateUp = function () { + var cell = false; + + if (this.modExists("edit", true)) { + cell = this.modules.edit.currentCell; + + if (cell) { + e.preventDefault(); + return cell.nav().up(); + } + } + + return false; +}; + +Tabulator.prototype.navigateDown = function () { + var cell = false; + + if (this.modExists("edit", true)) { + cell = this.modules.edit.currentCell; + + if (cell) { + e.preventDefault(); + return cell.nav().down(); + } + } + + return false; +}; + +/////////////// History Management ////////////// +Tabulator.prototype.undo = function () { + if (this.options.history && this.modExists("history", true)) { + return this.modules.history.undo(); + } else { + return false; + } +}; + +Tabulator.prototype.redo = function () { + if (this.options.history && this.modExists("history", true)) { + return this.modules.history.redo(); + } else { + return false; + } +}; + +Tabulator.prototype.getHistoryUndoSize = function () { + if (this.options.history && this.modExists("history", true)) { + return this.modules.history.getHistoryUndoSize(); + } else { + return false; + } +}; + +Tabulator.prototype.getHistoryRedoSize = function () { + if (this.options.history && this.modExists("history", true)) { + return this.modules.history.getHistoryRedoSize(); + } else { + return false; + } +}; + +/////////////// Download Management ////////////// + +Tabulator.prototype.download = function (type, filename, options, active) { + if (this.modExists("download", true)) { + this.modules.download.download(type, filename, options, active); + } +}; + +Tabulator.prototype.downloadToTab = function (type, filename, options, active) { + if (this.modExists("download", true)) { + this.modules.download.download(type, filename, options, active, true); + } +}; + +/////////// Inter Table Communications /////////// + +Tabulator.prototype.tableComms = function (table, module, action, data) { + this.modules.comms.receive(table, module, action, data); +}; + +////////////// Extension Management ////////////// + +//object to hold module +Tabulator.prototype.moduleBindings = {}; + +//extend module +Tabulator.prototype.extendModule = function (name, property, values) { + + if (Tabulator.prototype.moduleBindings[name]) { + var source = Tabulator.prototype.moduleBindings[name].prototype[property]; + + if (source) { + if ((typeof values === 'undefined' ? 'undefined' : _typeof(values)) == "object") { + for (var key in values) { + source[key] = values[key]; + } + } else { + console.warn("Module Error - Invalid value type, it must be an object"); + } + } else { + console.warn("Module Error - property does not exist:", property); + } + } else { + console.warn("Module Error - module does not exist:", name); + } +}; + +//add module to tabulator +Tabulator.prototype.registerModule = function (name, module) { + var self = this; + Tabulator.prototype.moduleBindings[name] = module; +}; + +//ensure that module are bound to instantiated function +Tabulator.prototype.bindModules = function () { + this.modules = {}; + + for (var name in Tabulator.prototype.moduleBindings) { + this.modules[name] = new Tabulator.prototype.moduleBindings[name](this); + } +}; + +//Check for module +Tabulator.prototype.modExists = function (plugin, required) { + if (this.modules[plugin]) { + return true; + } else { + if (required) { + console.error("Tabulator Module Not Installed: " + plugin); + } + return false; + } +}; + +Tabulator.prototype.helpers = { + + elVisible: function elVisible(el) { + return !(el.offsetWidth <= 0 && el.offsetHeight <= 0); + }, + + elOffset: function elOffset(el) { + var box = el.getBoundingClientRect(); + + return { + top: box.top + window.pageYOffset - document.documentElement.clientTop, + left: box.left + window.pageXOffset - document.documentElement.clientLeft + }; + }, + + deepClone: function deepClone(obj) { + var clone = Array.isArray(obj) ? [] : {}; + + for (var i in obj) { + if (obj[i] != null && _typeof(obj[i]) === "object") { + if (obj[i] instanceof Date) { + clone[i] = new Date(obj[i]); + } else { + clone[i] = this.deepClone(obj[i]); + } + } else { + clone[i] = obj[i]; + } + } + return clone; + } +}; + +Tabulator.prototype.comms = { + tables: [], + register: function register(table) { + Tabulator.prototype.comms.tables.push(table); + }, + deregister: function deregister(table) { + var index = Tabulator.prototype.comms.tables.indexOf(table); + + if (index > -1) { + Tabulator.prototype.comms.tables.splice(index, 1); + } + }, + lookupTable: function lookupTable(query, silent) { + var results = [], + matches, + match; + + if (typeof query === "string") { + matches = document.querySelectorAll(query); + + if (matches.length) { + for (var i = 0; i < matches.length; i++) { + match = Tabulator.prototype.comms.matchElement(matches[i]); + + if (match) { + results.push(match); + } + } + } + } else if (typeof HTMLElement !== "undefined" && query instanceof HTMLElement || query instanceof Tabulator) { + match = Tabulator.prototype.comms.matchElement(query); + + if (match) { + results.push(match); + } + } else if (Array.isArray(query)) { + query.forEach(function (item) { + results = results.concat(Tabulator.prototype.comms.lookupTable(item)); + }); + } else { + if (!silent) { + console.warn("Table Connection Error - Invalid Selector", query); + } + } + + return results; + }, + matchElement: function matchElement(element) { + return Tabulator.prototype.comms.tables.find(function (table) { + return element instanceof Tabulator ? table === element : table.element === element; + }); + } +}; + +Tabulator.prototype.findTable = function (query) { + var results = Tabulator.prototype.comms.lookupTable(query, true); + return Array.isArray(results) && !results.length ? false : results; +}; + +var Layout = function Layout(table) { + + this.table = table; + + this.mode = null; +}; + +//initialize layout system + +Layout.prototype.initialize = function (layout) { + + if (this.modes[layout]) { + + this.mode = layout; + } else { + + console.warn("Layout Error - invalid mode set, defaulting to 'fitData' : " + layout); + + this.mode = 'fitData'; + } + + this.table.element.setAttribute("tabulator-layout", this.mode); +}; + +Layout.prototype.getMode = function () { + + return this.mode; +}; + +//trigger table layout + +Layout.prototype.layout = function () { + + this.modes[this.mode].call(this, this.table.columnManager.columnsByIndex); +}; + +//layout render functions + +Layout.prototype.modes = { + + //resize columns to fit data they contain + + "fitData": function fitData(columns) { + + columns.forEach(function (column) { + + column.reinitializeWidth(); + }); + + if (this.table.options.responsiveLayout && this.table.modExists("responsiveLayout", true)) { + + this.table.modules.responsiveLayout.update(); + } + }, + + //resize columns to fit data they contain and stretch row to fill table + + "fitDataFill": function fitDataFill(columns) { + + columns.forEach(function (column) { + + column.reinitializeWidth(); + }); + + if (this.table.options.responsiveLayout && this.table.modExists("responsiveLayout", true)) { + + this.table.modules.responsiveLayout.update(); + } + }, + + //resize columns to fit data they contain + + "fitDataTable": function fitDataTable(columns) { + + columns.forEach(function (column) { + + column.reinitializeWidth(); + }); + + if (this.table.options.responsiveLayout && this.table.modExists("responsiveLayout", true)) { + + this.table.modules.responsiveLayout.update(); + } + }, + + //resize columns to fit data the contain and stretch last column to fill table + + "fitDataStretch": function fitDataStretch(columns) { + var _this34 = this; + + var colsWidth = 0, + tableWidth = this.table.rowManager.element.clientWidth, + gap = 0, + lastCol = false; + + columns.forEach(function (column, i) { + + if (!column.widthFixed) { + + column.reinitializeWidth(); + } + + if (_this34.table.options.responsiveLayout ? column.modules.responsive.visible : column.visible) { + + lastCol = column; + } + + if (column.visible) { + + colsWidth += column.getWidth(); + } + }); + + if (lastCol) { + + gap = tableWidth - colsWidth + lastCol.getWidth(); + + if (this.table.options.responsiveLayout && this.table.modExists("responsiveLayout", true)) { + + lastCol.setWidth(0); + + this.table.modules.responsiveLayout.update(); + } + + if (gap > 0) { + + lastCol.setWidth(gap); + } else { + + lastCol.reinitializeWidth(); + } + } else { + + if (this.table.options.responsiveLayout && this.table.modExists("responsiveLayout", true)) { + + this.table.modules.responsiveLayout.update(); + } + } + }, + + //resize columns to fit + + "fitColumns": function fitColumns(columns) { + + var self = this; + + var totalWidth = self.table.element.clientWidth; //table element width + + var fixedWidth = 0; //total width of columns with a defined width + + var flexWidth = 0; //total width available to flexible columns + + var flexGrowUnits = 0; //total number of widthGrow blocks accross all columns + + var flexColWidth = 0; //desired width of flexible columns + + var flexColumns = []; //array of flexible width columns + + var fixedShrinkColumns = []; //array of fixed width columns that can shrink + + var flexShrinkUnits = 0; //total number of widthShrink blocks accross all columns + + var overflowWidth = 0; //horizontal overflow width + + var gapFill = 0; //number of pixels to be added to final column to close and half pixel gaps + + + function calcWidth(width) { + + var colWidth; + + if (typeof width == "string") { + + if (width.indexOf("%") > -1) { + + colWidth = totalWidth / 100 * parseInt(width); + } else { + + colWidth = parseInt(width); + } + } else { + + colWidth = width; + } + + return colWidth; + } + + //ensure columns resize to take up the correct amount of space + + function scaleColumns(columns, freeSpace, colWidth, shrinkCols) { + + var oversizeCols = [], + oversizeSpace = 0, + remainingSpace = 0, + nextColWidth = 0, + gap = 0, + changeUnits = 0, + undersizeCols = []; + + function calcGrow(col) { + + return colWidth * (col.column.definition.widthGrow || 1); + } + + function calcShrink(col) { + + return calcWidth(col.width) - colWidth * (col.column.definition.widthShrink || 0); + } + + columns.forEach(function (col, i) { + + var width = shrinkCols ? calcShrink(col) : calcGrow(col); + + if (col.column.minWidth >= width) { + + oversizeCols.push(col); + } else { + + undersizeCols.push(col); + + changeUnits += shrinkCols ? col.column.definition.widthShrink || 1 : col.column.definition.widthGrow || 1; + } + }); + + if (oversizeCols.length) { + + oversizeCols.forEach(function (col) { + + oversizeSpace += shrinkCols ? col.width - col.column.minWidth : col.column.minWidth; + + col.width = col.column.minWidth; + }); + + remainingSpace = freeSpace - oversizeSpace; + + nextColWidth = changeUnits ? Math.floor(remainingSpace / changeUnits) : remainingSpace; + + gap = remainingSpace - nextColWidth * changeUnits; + + gap += scaleColumns(undersizeCols, remainingSpace, nextColWidth, shrinkCols); + } else { + + gap = changeUnits ? freeSpace - Math.floor(freeSpace / changeUnits) * changeUnits : freeSpace; + + undersizeCols.forEach(function (column) { + + column.width = shrinkCols ? calcShrink(column) : calcGrow(column); + }); + } + + return gap; + } + + if (this.table.options.responsiveLayout && this.table.modExists("responsiveLayout", true)) { + + this.table.modules.responsiveLayout.update(); + } + + //adjust for vertical scrollbar if present + + if (this.table.rowManager.element.scrollHeight > this.table.rowManager.element.clientHeight) { + + totalWidth -= this.table.rowManager.element.offsetWidth - this.table.rowManager.element.clientWidth; + } + + columns.forEach(function (column) { + + var width, minWidth, colWidth; + + if (column.visible) { + + width = column.definition.width; + + minWidth = parseInt(column.minWidth); + + if (width) { + + colWidth = calcWidth(width); + + fixedWidth += colWidth > minWidth ? colWidth : minWidth; + + if (column.definition.widthShrink) { + + fixedShrinkColumns.push({ + + column: column, + + width: colWidth > minWidth ? colWidth : minWidth + + }); + + flexShrinkUnits += column.definition.widthShrink; + } + } else { + + flexColumns.push({ + + column: column, + + width: 0 + + }); + + flexGrowUnits += column.definition.widthGrow || 1; + } + } + }); + + //calculate available space + + flexWidth = totalWidth - fixedWidth; + + //calculate correct column size + + flexColWidth = Math.floor(flexWidth / flexGrowUnits); + + //generate column widths + + var gapFill = scaleColumns(flexColumns, flexWidth, flexColWidth, false); + + //increase width of last column to account for rounding errors + + if (flexColumns.length && gapFill > 0) { + + flexColumns[flexColumns.length - 1].width += +gapFill; + } + + //caculate space for columns to be shrunk into + + flexColumns.forEach(function (col) { + + flexWidth -= col.width; + }); + + overflowWidth = Math.abs(gapFill) + flexWidth; + + //shrink oversize columns if there is no available space + + if (overflowWidth > 0 && flexShrinkUnits) { + + gapFill = scaleColumns(fixedShrinkColumns, overflowWidth, Math.floor(overflowWidth / flexShrinkUnits), true); + } + + //decrease width of last column to account for rounding errors + + if (fixedShrinkColumns.length) { + + fixedShrinkColumns[fixedShrinkColumns.length - 1].width -= gapFill; + } + + flexColumns.forEach(function (col) { + + col.column.setWidth(col.width); + }); + + fixedShrinkColumns.forEach(function (col) { + + col.column.setWidth(col.width); + }); + } + +}; + +Tabulator.prototype.registerModule("layout", Layout); +var Localize = function Localize(table) { + this.table = table; //hold Tabulator object + this.locale = "default"; //current locale + this.lang = false; //current language + this.bindings = {}; //update events to call when locale is changed +}; + +//set header placehoder +Localize.prototype.setHeaderFilterPlaceholder = function (placeholder) { + this.langs.default.headerFilters.default = placeholder; +}; + +//set header filter placeholder by column +Localize.prototype.setHeaderFilterColumnPlaceholder = function (column, placeholder) { + this.langs.default.headerFilters.columns[column] = placeholder; + + if (this.lang && !this.lang.headerFilters.columns[column]) { + this.lang.headerFilters.columns[column] = placeholder; + } +}; + +//setup a lang description object +Localize.prototype.installLang = function (locale, lang) { + if (this.langs[locale]) { + this._setLangProp(this.langs[locale], lang); + } else { + this.langs[locale] = lang; + } +}; + +Localize.prototype._setLangProp = function (lang, values) { + for (var key in values) { + if (lang[key] && _typeof(lang[key]) == "object") { + this._setLangProp(lang[key], values[key]); + } else { + lang[key] = values[key]; + } + } +}; + +//set current locale +Localize.prototype.setLocale = function (desiredLocale) { + var self = this; + + desiredLocale = desiredLocale || "default"; + + //fill in any matching languge values + function traverseLang(trans, path) { + for (var prop in trans) { + + if (_typeof(trans[prop]) == "object") { + if (!path[prop]) { + path[prop] = {}; + } + traverseLang(trans[prop], path[prop]); + } else { + path[prop] = trans[prop]; + } + } + } + + //determing correct locale to load + if (desiredLocale === true && navigator.language) { + //get local from system + desiredLocale = navigator.language.toLowerCase(); + } + + if (desiredLocale) { + + //if locale is not set, check for matching top level locale else use default + if (!self.langs[desiredLocale]) { + var prefix = desiredLocale.split("-")[0]; + + if (self.langs[prefix]) { + console.warn("Localization Error - Exact matching locale not found, using closest match: ", desiredLocale, prefix); + desiredLocale = prefix; + } else { + console.warn("Localization Error - Matching locale not found, using default: ", desiredLocale); + desiredLocale = "default"; + } + } + } + + self.locale = desiredLocale; + + //load default lang template + self.lang = Tabulator.prototype.helpers.deepClone(self.langs.default || {}); + + if (desiredLocale != "default") { + traverseLang(self.langs[desiredLocale], self.lang); + } + + self.table.options.localized.call(self.table, self.locale, self.lang); + + self._executeBindings(); +}; + +//get current locale +Localize.prototype.getLocale = function (locale) { + return self.locale; +}; + +//get lang object for given local or current if none provided +Localize.prototype.getLang = function (locale) { + return locale ? this.langs[locale] : this.lang; +}; + +//get text for current locale +Localize.prototype.getText = function (path, value) { + var path = value ? path + "|" + value : path, + pathArray = path.split("|"), + text = this._getLangElement(pathArray, this.locale); + + // if(text === false){ + // console.warn("Localization Error - Matching localized text not found for given path: ", path); + // } + + return text || ""; +}; + +//traverse langs object and find localized copy +Localize.prototype._getLangElement = function (path, locale) { + var self = this; + var root = self.lang; + + path.forEach(function (level) { + var rootPath; + + if (root) { + rootPath = root[level]; + + if (typeof rootPath != "undefined") { + root = rootPath; + } else { + root = false; + } + } + }); + + return root; +}; + +//set update binding +Localize.prototype.bind = function (path, callback) { + if (!this.bindings[path]) { + this.bindings[path] = []; + } + + this.bindings[path].push(callback); + + callback(this.getText(path), this.lang); +}; + +//itterate through bindings and trigger updates +Localize.prototype._executeBindings = function () { + var self = this; + + var _loop = function _loop(path) { + self.bindings[path].forEach(function (binding) { + binding(self.getText(path), self.lang); + }); + }; + + for (var path in self.bindings) { + _loop(path); + } +}; + +//Localized text listings +Localize.prototype.langs = { + "default": { //hold default locale text + "groups": { + "item": "item", + "items": "items" + }, + "columns": {}, + "ajax": { + "loading": "Loading", + "error": "Error" + }, + "pagination": { + "page_size": "Page Size", + "page_title": "Show Page", + "first": "First", + "first_title": "First Page", + "last": "Last", + "last_title": "Last Page", + "prev": "Prev", + "prev_title": "Prev Page", + "next": "Next", + "next_title": "Next Page", + "all": "All" + }, + "headerFilters": { + "default": "filter column...", + "columns": {} + } + } +}; + +Tabulator.prototype.registerModule("localize", Localize); +var Comms = function Comms(table) { + this.table = table; +}; + +Comms.prototype.getConnections = function (selectors) { + var self = this, + connections = [], + connection; + + connection = Tabulator.prototype.comms.lookupTable(selectors); + + connection.forEach(function (con) { + if (self.table !== con) { + connections.push(con); + } + }); + + return connections; +}; + +Comms.prototype.send = function (selectors, module, action, data) { + var self = this, + connections = this.getConnections(selectors); + + connections.forEach(function (connection) { + connection.tableComms(self.table.element, module, action, data); + }); + + if (!connections.length && selectors) { + console.warn("Table Connection Error - No tables matching selector found", selectors); + } +}; + +Comms.prototype.receive = function (table, module, action, data) { + if (this.table.modExists(module)) { + return this.table.modules[module].commsReceived(table, action, data); + } else { + console.warn("Inter-table Comms Error - no such module:", module); + } +}; + +Tabulator.prototype.registerModule("comms", Comms); \ No newline at end of file diff --git a/admin/js/vendors/tabulator/js/tabulator_core.min.js b/admin/js/vendors/tabulator/js/tabulator_core.min.js new file mode 100644 index 0000000..92522ab --- /dev/null +++ b/admin/js/vendors/tabulator/js/tabulator_core.min.js @@ -0,0 +1,6 @@ +/* Tabulator v4.7.0 (c) Oliver Folkerd */ +"use strict";var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t};Array.prototype.findIndex||Object.defineProperty(Array.prototype,"findIndex",{value:function(t){if(null==this)throw new TypeError('"this" is null or not defined');var e=Object(this),o=e.length>>>0;if("function"!=typeof t)throw new TypeError("predicate must be a function");for(var i=arguments[1],n=0;n>>0;if("function"!=typeof t)throw new TypeError("predicate must be a function");for(var i=arguments[1],n=0;n>>0;if(0===i)return!1;for(var n=0|e,l=Math.max(n>=0?n:i-Math.abs(n),0);lo?(e=t-o,this.element.style.marginLeft=-e+"px"):this.element.style.marginLeft=0,this.scrollLeft=t,this.table.modExists("frozenColumns")&&this.table.modules.frozenColumns.scrollHorizontal()},ColumnManager.prototype.generateColumnsFromRowData=function(t){var e,o,i=[];if(t&&t.length){e=t[0];for(var n in e){var l={field:n,title:n},s=e[n];switch(void 0===s?"undefined":_typeof(s)){case"undefined":o="string";break;case"boolean":o="boolean";break;case"object":o=Array.isArray(s)?"array":"string";break;default:o=isNaN(s)||""===s?s.match(/((^[0-9]+[a-z]+)|(^[a-z]+[0-9]+))+$/i)?"alphanum":"string":"number"}l.sorter=o,i.push(l)}this.table.options.columns=i,this.setColumns(this.table.options.columns)}},ColumnManager.prototype.setColumns=function(t,e){for(var o=this;o.headersElement.firstChild;)o.headersElement.removeChild(o.headersElement.firstChild);o.columns=[],o.columnsByIndex=[],o.columnsByField={},o.table.modExists("frozenColumns")&&o.table.modules.frozenColumns.reset(),t.forEach(function(t,e){o._addColumn(t)}),o._reIndexColumns(),o.table.options.responsiveLayout&&o.table.modExists("responsiveLayout",!0)&&o.table.modules.responsiveLayout.initialize(),o.redraw(!0)},ColumnManager.prototype._addColumn=function(t,e,o){var i=new Column(t,this),n=i.getElement(),l=o?this.findColumnIndex(o):o;if(o&&l>-1){var s=this.columns.indexOf(o.getTopColumn()),a=o.getElement();e?(this.columns.splice(s,0,i),a.parentNode.insertBefore(n,a)):(this.columns.splice(s+1,0,i),a.parentNode.insertBefore(n,a.nextSibling))}else e?(this.columns.unshift(i),this.headersElement.insertBefore(i.getElement(),this.headersElement.firstChild)):(this.columns.push(i),this.headersElement.appendChild(i.getElement())),i.columnRendered();return i},ColumnManager.prototype.registerColumnField=function(t){t.definition.field&&(this.columnsByField[t.definition.field]=t)},ColumnManager.prototype.registerColumnPosition=function(t){this.columnsByIndex.push(t)},ColumnManager.prototype._reIndexColumns=function(){this.columnsByIndex=[],this.columns.forEach(function(t){t.reRegisterPosition()})},ColumnManager.prototype._verticalAlignHeaders=function(){var t=this,e=0;t.columns.forEach(function(t){var o;t.clearVerticalAlign(),(o=t.getHeight())>e&&(e=o)}),t.columns.forEach(function(o){o.verticalAlign(t.table.options.columnHeaderVertAlign,e)}),t.rowManager.adjustTableSize()},ColumnManager.prototype.findColumn=function(t){var e=this;if("object"!=(void 0===t?"undefined":_typeof(t)))return this.columnsByField[t]||!1;if(t instanceof Column)return t;if(t instanceof ColumnComponent)return t._getSelf()||!1;if("undefined"!=typeof HTMLElement&&t instanceof HTMLElement){return e.columns.find(function(e){return e.element===t})||!1}return!1},ColumnManager.prototype.getColumnByField=function(t){return this.columnsByField[t]},ColumnManager.prototype.getColumnsByFieldRoot=function(t){var e=this,o=[];return Object.keys(this.columnsByField).forEach(function(i){i.split(".")[0]===t&&o.push(e.columnsByField[i])}),o},ColumnManager.prototype.getColumnByIndex=function(t){return this.columnsByIndex[t]},ColumnManager.prototype.getFirstVisibileColumn=function(t){var t=this.columnsByIndex.findIndex(function(t){return t.visible});return t>-1&&this.columnsByIndex[t]},ColumnManager.prototype.getColumns=function(){return this.columns},ColumnManager.prototype.findColumnIndex=function(t){return this.columnsByIndex.findIndex(function(e){return t===e})},ColumnManager.prototype.getRealColumns=function(){return this.columnsByIndex},ColumnManager.prototype.traverse=function(t){this.columnsByIndex.forEach(function(e,o){t(e,o)})},ColumnManager.prototype.getDefinitions=function(t){var e=this,o=[];return e.columnsByIndex.forEach(function(e){(!t||t&&e.visible)&&o.push(e.getDefinition())}),o},ColumnManager.prototype.getDefinitionTree=function(){var t=this,e=[];return t.columns.forEach(function(t){e.push(t.getDefinition(!0))}),e},ColumnManager.prototype.getComponents=function(t){var e=this,o=[];return(t?e.columns:e.columnsByIndex).forEach(function(t){o.push(t.getComponent())}),o},ColumnManager.prototype.getWidth=function(){var t=0;return this.columnsByIndex.forEach(function(e){e.visible&&(t+=e.getWidth())}),t},ColumnManager.prototype.moveColumn=function(t,e,o){this.moveColumnActual(t,e,o),this.table.options.responsiveLayout&&this.table.modExists("responsiveLayout",!0)&&this.table.modules.responsiveLayout.initialize(),this.table.modExists("columnCalcs")&&this.table.modules.columnCalcs.recalc(this.table.rowManager.activeRows),e.element.parentNode.insertBefore(t.element,e.element),o&&e.element.parentNode.insertBefore(e.element,t.element),this._verticalAlignHeaders(),this.table.rowManager.reinitialize()},ColumnManager.prototype.moveColumnActual=function(t,e,o){t.parent.isGroup?this._moveColumnInArray(t.parent.columns,t,e,o):this._moveColumnInArray(this.columns,t,e,o),this._moveColumnInArray(this.columnsByIndex,t,e,o,!0),this.table.options.responsiveLayout&&this.table.modExists("responsiveLayout",!0)&&this.table.modules.responsiveLayout.initialize(),this.table.options.columnMoved&&this.table.options.columnMoved.call(this.table,t.getComponent(),this.table.columnManager.getComponents()),this.table.options.persistence&&this.table.modExists("persistence",!0)&&this.table.modules.persistence.config.columns&&this.table.modules.persistence.save("columns")},ColumnManager.prototype._moveColumnInArray=function(t,e,o,i,n){var l,s=t.indexOf(e);s>-1&&(t.splice(s,1),l=t.indexOf(o),l>-1?i&&(l+=1):l=s,t.splice(l,0,e),n&&this.table.rowManager.rows.forEach(function(t){if(t.cells.length){var e=t.cells.splice(s,1)[0];t.cells.splice(l,0,e)}}))},ColumnManager.prototype.scrollToColumn=function(t,e,o){var i=this,n=0,l=0,s=0,a=t.getElement();return new Promise(function(r,u){if(void 0===e&&(e=i.table.options.scrollToColumnPosition),void 0===o&&(o=i.table.options.scrollToColumnIfVisible),t.visible){switch(e){case"middle":case"center":s=-i.element.clientWidth/2;break;case"right":s=a.clientWidth-i.headersElement.clientWidth}if(!o&&(l=a.offsetLeft)>0&&l+a.offsetWidtht.rowManager.element.clientHeight&&(e-=t.rowManager.element.offsetWidth-t.rowManager.element.clientWidth),this.columnsByIndex.forEach(function(i){var n,l,s;i.visible&&(n=i.definition.width||0,l=void 0===i.minWidth?t.table.options.columnMinWidth:parseInt(i.minWidth),s="string"==typeof n?n.indexOf("%")>-1?e/100*parseInt(n):parseInt(n):n,o+=s>l?s:l)}),o},ColumnManager.prototype.addColumn=function(t,e,o){var i=this;return new Promise(function(n,l){var s=i._addColumn(t,e,o);i._reIndexColumns(),i.table.options.responsiveLayout&&i.table.modExists("responsiveLayout",!0)&&i.table.modules.responsiveLayout.initialize(),i.table.modExists("columnCalcs")&&i.table.modules.columnCalcs.recalc(i.table.rowManager.activeRows),i.redraw(),"fitColumns"!=i.table.modules.layout.getMode()&&s.reinitializeWidth(),i._verticalAlignHeaders(),i.table.rowManager.reinitialize(),n(s)})},ColumnManager.prototype.deregisterColumn=function(t){var e,o=t.getField();o&&delete this.columnsByField[o],e=this.columnsByIndex.indexOf(t),e>-1&&this.columnsByIndex.splice(e,1),e=this.columns.indexOf(t),e>-1&&this.columns.splice(e,1),this.table.options.responsiveLayout&&this.table.modExists("responsiveLayout",!0)&&this.table.modules.responsiveLayout.initialize(),this.redraw()},ColumnManager.prototype.redraw=function(t){t&&(Tabulator.prototype.helpers.elVisible(this.element)&&this._verticalAlignHeaders(),this.table.rowManager.resetScroll(),this.table.rowManager.reinitialize()),["fitColumns","fitDataStretch"].indexOf(this.table.modules.layout.getMode())>-1?this.table.modules.layout.layout():t?this.table.modules.layout.layout():this.table.options.responsiveLayout&&this.table.modExists("responsiveLayout",!0)&&this.table.modules.responsiveLayout.update(),this.table.modExists("frozenColumns")&&this.table.modules.frozenColumns.layout(),this.table.modExists("columnCalcs")&&this.table.modules.columnCalcs.recalc(this.table.rowManager.activeRows),t&&(this.table.options.persistence&&this.table.modExists("persistence",!0)&&this.table.modules.persistence.config.columns&&this.table.modules.persistence.save("columns"),this.table.modExists("columnCalcs")&&this.table.modules.columnCalcs.redraw()),this.table.footerManager.redraw()};var ColumnComponent=function(t){this._column=t,this.type="ColumnComponent"};ColumnComponent.prototype.getElement=function(){return this._column.getElement()},ColumnComponent.prototype.getDefinition=function(){return this._column.getDefinition()},ColumnComponent.prototype.getField=function(){return this._column.getField()},ColumnComponent.prototype.getCells=function(){var t=[];return this._column.cells.forEach(function(e){t.push(e.getComponent())}),t},ColumnComponent.prototype.getVisibility=function(){return console.warn("getVisibility function is deprecated, you should now use the isVisible function"),this._column.visible},ColumnComponent.prototype.isVisible=function(){return this._column.visible},ColumnComponent.prototype.show=function(){this._column.isGroup?this._column.columns.forEach(function(t){t.show()}):this._column.show()},ColumnComponent.prototype.hide=function(){this._column.isGroup?this._column.columns.forEach(function(t){t.hide()}):this._column.hide()},ColumnComponent.prototype.toggle=function(){this._column.visible?this.hide():this.show()},ColumnComponent.prototype.delete=function(){return this._column.delete()},ColumnComponent.prototype.getSubColumns=function(){var t=[];return this._column.columns.length&&this._column.columns.forEach(function(e){t.push(e.getComponent())}),t},ColumnComponent.prototype.getParentColumn=function(){return this._column.parent instanceof Column&&this._column.parent.getComponent()},ColumnComponent.prototype._getSelf=function(){return this._column},ColumnComponent.prototype.scrollTo=function(){return this._column.table.columnManager.scrollToColumn(this._column)},ColumnComponent.prototype.getTable=function(){return this._column.table},ColumnComponent.prototype.headerFilterFocus=function(){this._column.table.modExists("filter",!0)&&this._column.table.modules.filter.setHeaderFilterFocus(this._column)},ColumnComponent.prototype.reloadHeaderFilter=function(){this._column.table.modExists("filter",!0)&&this._column.table.modules.filter.reloadHeaderFilter(this._column)},ColumnComponent.prototype.getHeaderFilterValue=function(){if(this._column.table.modExists("filter",!0))return this._column.table.modules.filter.getHeaderFilterValue(this._column)},ColumnComponent.prototype.setHeaderFilterValue=function(t){this._column.table.modExists("filter",!0)&&this._column.table.modules.filter.setHeaderFilterValue(this._column,t)},ColumnComponent.prototype.move=function(t,e){var o=this._column.table.columnManager.findColumn(t);o?this._column.table.columnManager.moveColumn(this._column,o,e):console.warn("Move Error - No matching column found:",o)},ColumnComponent.prototype.getNextColumn=function(){var t=this._column.nextColumn();return!!t&&t.getComponent()},ColumnComponent.prototype.getPrevColumn=function(){var t=this._column.prevColumn();return!!t&&t.getComponent()},ColumnComponent.prototype.updateDefinition=function(t){return this._column.updateDefinition(t)},ColumnComponent.prototype.getWidth=function(){return this._column.getWidth()},ColumnComponent.prototype.setWidth=function(t){return!0===t?this._column.reinitializeWidth(!0):this._column.setWidth(t)},ColumnComponent.prototype.validate=function(){return this._column.validate()};var Column=function t(e,o){var i=this;this.table=o.table,this.definition=e,this.parent=o,this.type="column",this.columns=[],this.cells=[],this.element=this.createElement(),this.contentElement=!1,this.titleElement=!1,this.groupElement=this.createGroupElement(),this.isGroup=!1,this.tooltip=!1,this.hozAlign="",this.vertAlign="",this.field="",this.fieldStructure="",this.getFieldValue="",this.setFieldValue="",this.titleFormatterRendered=!1,this.setField(this.definition.field),this.table.options.invalidOptionWarnings&&this.checkDefinition(),this.modules={},this.cellEvents={cellClick:!1,cellDblClick:!1,cellContext:!1,cellTap:!1,cellDblTap:!1,cellTapHold:!1,cellMouseEnter:!1,cellMouseLeave:!1,cellMouseOver:!1,cellMouseOut:!1,cellMouseMove:!1},this.width=null,this.widthStyled="",this.minWidth=null,this.minWidthStyled="",this.widthFixed=!1,this.visible=!0,this.component=null,this._mapDepricatedFunctionality(),e.columns?(this.isGroup=!0,e.columns.forEach(function(e,o){var n=new t(e,i);i.attachColumn(n)}),i.checkColumnVisibility()):o.registerColumnField(this),e.rowHandle&&!1!==this.table.options.movableRows&&this.table.modExists("moveRow")&&this.table.modules.moveRow.setHandle(!0),this._buildHeader(),this.bindModuleColumns()};Column.prototype.createElement=function(){var t=document.createElement("div");return t.classList.add("tabulator-col"),t.setAttribute("role","columnheader"),t.setAttribute("aria-sort","none"),t},Column.prototype.createGroupElement=function(){var t=document.createElement("div");return t.classList.add("tabulator-col-group-cols"),t},Column.prototype.checkDefinition=function(){var t=this;Object.keys(this.definition).forEach(function(e){-1===t.defaultOptionList.indexOf(e)&&console.warn("Invalid column definition option in '"+(t.field||t.definition.title)+"' column:",e)})},Column.prototype.setField=function(t){this.field=t,this.fieldStructure=t?this.table.options.nestedFieldSeparator?t.split(this.table.options.nestedFieldSeparator):[t]:[],this.getFieldValue=this.fieldStructure.length>1?this._getNestedData:this._getFlatData,this.setFieldValue=this.fieldStructure.length>1?this._setNestedData:this._setFlatData},Column.prototype.registerColumnPosition=function(t){this.parent.registerColumnPosition(t)},Column.prototype.registerColumnField=function(t){this.parent.registerColumnField(t)},Column.prototype.reRegisterPosition=function(){this.isGroup?this.columns.forEach(function(t){t.reRegisterPosition()}):this.registerColumnPosition(this)},Column.prototype._mapDepricatedFunctionality=function(){void 0!==this.definition.hideInHtml&&(this.definition.htmlOutput=!this.definition.hideInHtml,console.warn("hideInHtml column definition property is deprecated, you should now use htmlOutput")),void 0!==this.definition.align&&(this.definition.hozAlign=this.definition.align,console.warn("align column definition property is deprecated, you should now use hozAlign")),void 0!==this.definition.downloadTitle&&(this.definition.titleDownload=this.definition.downloadTitle,console.warn("downloadTitle definition property is deprecated, you should now use titleDownload"))},Column.prototype.setTooltip=function(){var t=this,e=t.definition,o=e.headerTooltip||!1===e.tooltip?e.headerTooltip:t.table.options.tooltipsHeader;o?!0===o?e.field?t.table.modules.localize.bind("columns|"+e.field,function(o){t.element.setAttribute("title",o||e.title)}):t.element.setAttribute("title",e.title):("function"==typeof o&&!1===(o=o(t.getComponent()))&&(o=""),t.element.setAttribute("title",o)):t.element.setAttribute("title","")},Column.prototype._buildHeader=function(){for(var t=this,e=t.definition;t.element.firstChild;)t.element.removeChild(t.element.firstChild);e.headerVertical&&(t.element.classList.add("tabulator-col-vertical"),"flip"===e.headerVertical&&t.element.classList.add("tabulator-col-vertical-flip")),t.contentElement=t._bindEvents(),t.contentElement=t._buildColumnHeaderContent(),t.element.appendChild(t.contentElement),t.isGroup?t._buildGroupHeader():t._buildColumnHeader(),t.setTooltip(),t.table.options.resizableColumns&&t.table.modExists("resizeColumns")&&t.table.modules.resizeColumns.initializeColumn("header",t,t.element),e.headerFilter&&t.table.modExists("filter")&&t.table.modExists("edit")&&(void 0!==e.headerFilterPlaceholder&&e.field&&t.table.modules.localize.setHeaderFilterColumnPlaceholder(e.field,e.headerFilterPlaceholder),t.table.modules.filter.initializeColumn(t)),t.table.modExists("frozenColumns")&&t.table.modules.frozenColumns.initializeColumn(t),t.table.options.movableColumns&&!t.isGroup&&t.table.modExists("moveColumn")&&t.table.modules.moveColumn.initializeColumn(t),(e.topCalc||e.bottomCalc)&&t.table.modExists("columnCalcs")&&t.table.modules.columnCalcs.initializeColumn(t),t.table.modExists("persistence")&&t.table.modules.persistence.config.columns&&t.table.modules.persistence.initializeColumn(t),t.element.addEventListener("mouseenter",function(e){t.setTooltip()})},Column.prototype._bindEvents=function(){var t,e,o,i=this,n=i.definition;"function"==typeof n.headerClick&&i.element.addEventListener("click",function(t){n.headerClick(t,i.getComponent())}),"function"==typeof n.headerDblClick&&i.element.addEventListener("dblclick",function(t){n.headerDblClick(t,i.getComponent())}),"function"==typeof n.headerContext&&i.element.addEventListener("contextmenu",function(t){n.headerContext(t,i.getComponent())}),"function"==typeof n.headerTap&&(o=!1,i.element.addEventListener("touchstart",function(t){o=!0},{passive:!0}),i.element.addEventListener("touchend",function(t){o&&n.headerTap(t,i.getComponent()),o=!1})),"function"==typeof n.headerDblTap&&(t=null,i.element.addEventListener("touchend",function(e){t?(clearTimeout(t),t=null,n.headerDblTap(e,i.getComponent())):t=setTimeout(function(){clearTimeout(t),t=null},300)})),"function"==typeof n.headerTapHold&&(e=null,i.element.addEventListener("touchstart",function(t){clearTimeout(e),e=setTimeout(function(){clearTimeout(e),e=null,o=!1,n.headerTapHold(t,i.getComponent())},1e3)},{passive:!0}),i.element.addEventListener("touchend",function(t){clearTimeout(e),e=null})),"function"==typeof n.cellClick&&(i.cellEvents.cellClick=n.cellClick),"function"==typeof n.cellDblClick&&(i.cellEvents.cellDblClick=n.cellDblClick),"function"==typeof n.cellContext&&(i.cellEvents.cellContext=n.cellContext),"function"==typeof n.cellMouseEnter&&(i.cellEvents.cellMouseEnter=n.cellMouseEnter),"function"==typeof n.cellMouseLeave&&(i.cellEvents.cellMouseLeave=n.cellMouseLeave),"function"==typeof n.cellMouseOver&&(i.cellEvents.cellMouseOver=n.cellMouseOver),"function"==typeof n.cellMouseOut&&(i.cellEvents.cellMouseOut=n.cellMouseOut),"function"==typeof n.cellMouseMove&&(i.cellEvents.cellMouseMove=n.cellMouseMove),"function"==typeof n.cellTap&&(i.cellEvents.cellTap=n.cellTap),"function"==typeof n.cellDblTap&&(i.cellEvents.cellDblTap=n.cellDblTap),"function"==typeof n.cellTapHold&&(i.cellEvents.cellTapHold=n.cellTapHold),"function"==typeof n.cellEdited&&(i.cellEvents.cellEdited=n.cellEdited),"function"==typeof n.cellEditing&&(i.cellEvents.cellEditing=n.cellEditing),"function"==typeof n.cellEditCancelled&&(i.cellEvents.cellEditCancelled=n.cellEditCancelled)},Column.prototype._buildColumnHeader=function(){var t=this,e=t.definition,o=t.table;if(o.modExists("sort")&&o.modules.sort.initializeColumn(t,t.contentElement),(e.headerContextMenu||e.headerMenu)&&o.modExists("menu")&&o.modules.menu.initializeColumnHeader(t),o.modExists("format")&&o.modules.format.initializeColumn(t),void 0!==e.editor&&o.modExists("edit")&&o.modules.edit.initializeColumn(t),void 0!==e.validator&&o.modExists("validate")&&o.modules.validate.initializeColumn(t),o.modExists("mutator")&&o.modules.mutator.initializeColumn(t),o.modExists("accessor")&&o.modules.accessor.initializeColumn(t),_typeof(o.options.responsiveLayout)&&o.modExists("responsiveLayout")&&o.modules.responsiveLayout.initializeColumn(t),void 0!==e.visible&&(e.visible?t.show(!0):t.hide(!0)),e.cssClass){e.cssClass.split(" ").forEach(function(e){t.element.classList.add(e)})}e.field&&this.element.setAttribute("tabulator-field",e.field),t.setMinWidth(void 0===e.minWidth?t.table.options.columnMinWidth:parseInt(e.minWidth)),t.reinitializeWidth(),t.tooltip=t.definition.tooltip||!1===t.definition.tooltip?t.definition.tooltip:t.table.options.tooltips,t.hozAlign=void 0===t.definition.hozAlign?t.table.options.cellHozAlign:t.definition.hozAlign,t.vertAlign=void 0===t.definition.vertAlign?t.table.options.cellVertAlign:t.definition.vertAlign},Column.prototype._buildColumnHeaderContent=function(){var t=(this.definition,this.table,document.createElement("div"));return t.classList.add("tabulator-col-content"),this.titleElement=this._buildColumnHeaderTitle(),t.appendChild(this.titleElement),t},Column.prototype._buildColumnHeaderTitle=function(){var t=this,e=t.definition,o=t.table,i=document.createElement("div");if(i.classList.add("tabulator-col-title"),e.editableTitle){var n=document.createElement("input");n.classList.add("tabulator-title-editor"),n.addEventListener("click",function(t){t.stopPropagation(),n.focus()}),n.addEventListener("change",function(){e.title=n.value,o.options.columnTitleChanged.call(t.table,t.getComponent())}),i.appendChild(n),e.field?o.modules.localize.bind("columns|"+e.field,function(t){n.value=t||e.title||" "}):n.value=e.title||" "}else e.field?o.modules.localize.bind("columns|"+e.field,function(o){t._formatColumnHeaderTitle(i,o||e.title||" ")}):t._formatColumnHeaderTitle(i,e.title||" ");return i},Column.prototype._formatColumnHeaderTitle=function(t,e){var o,i,n,l,s,a=this;if(this.definition.titleFormatter&&this.table.modExists("format"))switch(o=this.table.modules.format.getFormatter(this.definition.titleFormatter),s=function(t){a.titleFormatterRendered=t},l={getValue:function(){return e},getElement:function(){return t}},n=this.definition.titleFormatterParams||{},n="function"==typeof n?n():n,i=o.call(this.table.modules.format,l,n,s),void 0===i?"undefined":_typeof(i)){case"object":i instanceof Node?t.appendChild(i):(t.innerHTML="",console.warn("Format Error - Title formatter has returned a type of object, the only valid formatter object return is an instance of Node, the formatter returned:",i));break;case"undefined":case"null":t.innerHTML="";break;default:t.innerHTML=i}else t.innerHTML=e},Column.prototype._buildGroupHeader=function(){var t=this;if(this.element.classList.add("tabulator-col-group"),this.element.setAttribute("role","columngroup"),this.element.setAttribute("aria-title",this.definition.title),this.definition.cssClass){this.definition.cssClass.split(" ").forEach(function(e){t.element.classList.add(e)})}(this.definition.headerContextMenu||this.definition.headerMenu)&&this.table.modExists("menu")&&this.table.modules.menu.initializeColumnHeader(this),this.element.appendChild(this.groupElement)},Column.prototype._getFlatData=function(t){return t[this.field]},Column.prototype._getNestedData=function(t){for(var e,o=t,i=this.fieldStructure,n=i.length,l=0;l-1&&this._nextVisibleColumn(t+1)},Column.prototype._nextVisibleColumn=function(t){var e=this.table.columnManager.getColumnByIndex(t);return!e||e.visible?e:this._nextVisibleColumn(t+1)},Column.prototype.prevColumn=function(){var t=this.table.columnManager.findColumnIndex(this);return t>-1&&this._prevVisibleColumn(t-1)},Column.prototype._prevVisibleColumn=function(t){var e=this.table.columnManager.getColumnByIndex(t);return!e||e.visible?e:this._prevVisibleColumn(t-1)},Column.prototype.reinitializeWidth=function(t){this.widthFixed=!1,void 0===this.definition.width||t||this.setWidth(this.definition.width),this.table.modExists("filter")&&this.table.modules.filter.hideHeaderFilterElements(),this.fitToData(),this.table.modExists("filter")&&this.table.modules.filter.showHeaderFilterElements()},Column.prototype.fitToData=function(){var t=this;this.widthFixed||(this.element.style.width="",t.cells.forEach(function(t){t.clearWidth()}));var e=this.element.offsetWidth;t.width&&this.widthFixed||(t.cells.forEach(function(t){var o=t.getWidth();o>e&&(e=o)}),e&&t.setWidthActual(e+1))},Column.prototype.updateDefinition=function(t){var e=this;return new Promise(function(o,i){var n;e.isGroup?(console.warn("Column Update Error - The updateDefintion function is only available on columns, not column groups"),i("Column Update Error - The updateDefintion function is only available on columns, not column groups")):(n=Object.assign({},e.getDefinition()),n=Object.assign(n,t),e.table.columnManager.addColumn(n,!1,e).then(function(t){n.field==e.field&&(e.field=!1),e.delete().then(function(){o(t.getComponent())}).catch(function(t){i(t)})}).catch(function(t){i(t)}))})},Column.prototype.deleteCell=function(t){var e=this.cells.indexOf(t);e>-1&&this.cells.splice(e,1)},Column.prototype.defaultOptionList=["title","field","columns","visible","align","hozAlign","vertAlign","width","minWidth","widthGrow","widthShrink","resizable","frozen","responsive","tooltip","cssClass","rowHandle","hideInHtml","print","htmlOutput","sorter","sorterParams","formatter","formatterParams","variableHeight","editable","editor","editorParams","validator","mutator","mutatorParams","mutatorData","mutatorDataParams","mutatorEdit","mutatorEditParams","mutatorClipboard","mutatorClipboardParams","accessor","accessorParams","accessorData","accessorDataParams","accessorDownload","accessorDownloadParams","accessorClipboard","accessorClipboardParams","accessorPrint","accessorPrintParams","accessorHtmlOutput","accessorHtmlOutputParams","clipboard","download","downloadTitle","topCalc","topCalcParams","topCalcFormatter","topCalcFormatterParams","bottomCalc","bottomCalcParams","bottomCalcFormatter","bottomCalcFormatterParams","cellClick","cellDblClick","cellContext","cellTap","cellDblTap","cellTapHold","cellMouseEnter","cellMouseLeave","cellMouseOver","cellMouseOut","cellMouseMove","cellEditing","cellEdited","cellEditCancelled","headerSort","headerSortStartingDir","headerSortTristate","headerClick","headerDblClick","headerContext","headerTap","headerDblTap","headerTapHold","headerTooltip","headerVertical","editableTitle","titleFormatter","titleFormatterParams","headerFilter","headerFilterPlaceholder","headerFilterParams","headerFilterEmptyCheck","headerFilterFunc","headerFilterFuncParams","headerFilterLiveFilter","print","headerContextMenu","headerMenu","contextMenu","formatterPrint","formatterPrintParams","formatterClipboard","formatterClipboardParams","formatterHtmlOutput","formatterHtmlOutputParams","titlePrint","titleClipboard","titleHtmlOutput","titleDownload"],Column.prototype.getComponent=function(){return this.component||(this.component=new ColumnComponent(this)),this.component};var RowManager=function(t){this.table=t,this.element=this.createHolderElement(),this.tableElement=this.createTableElement(),this.heightFixer=this.createTableElement(),this.columnManager=null,this.height=0,this.firstRender=!1,this.renderMode="virtual",this.fixedHeight=!1,this.rows=[],this.activeRows=[],this.activeRowsCount=0,this.displayRows=[],this.displayRowsCount=0,this.scrollTop=0,this.scrollLeft=0,this.vDomRowHeight=20,this.vDomTop=0,this.vDomBottom=0,this.vDomScrollPosTop=0,this.vDomScrollPosBottom=0,this.vDomTopPad=0,this.vDomBottomPad=0,this.vDomMaxRenderChain=90,this.vDomWindowBuffer=0,this.vDomWindowMinTotalRows=20,this.vDomWindowMinMarginRows=5,this.vDomTopNewRows=[],this.vDomBottomNewRows=[],this.rowNumColumn=!1,this.redrawBlock=!1,this.redrawBlockRestoreConfig=!1,this.redrawBlockRederInPosition=!1};RowManager.prototype.createHolderElement=function(){var t=document.createElement("div");return t.classList.add("tabulator-tableHolder"),t.setAttribute("tabindex",0),t},RowManager.prototype.createTableElement=function(){var t=document.createElement("div");return t.classList.add("tabulator-table"),t},RowManager.prototype.getElement=function(){return this.element},RowManager.prototype.getTableElement=function(){return this.tableElement},RowManager.prototype.getRowPosition=function(t,e){return e?this.activeRows.indexOf(t):this.rows.indexOf(t)},RowManager.prototype.setColumnManager=function(t){this.columnManager=t},RowManager.prototype.initialize=function(){var t=this;t.setRenderMode(),t.element.appendChild(t.tableElement),t.firstRender=!0,t.element.addEventListener("scroll",function(){var e=t.element.scrollLeft;t.scrollLeft!=e&&(t.columnManager.scrollHorizontal(e),t.table.options.groupBy&&t.table.modules.groupRows.scrollHeaders(e),t.table.modExists("columnCalcs")&&t.table.modules.columnCalcs.scrollHorizontal(e),t.table.options.scrollHorizontal(e)),t.scrollLeft=e}),"virtual"===this.renderMode&&t.element.addEventListener("scroll",function(){var e=t.element.scrollTop,o=t.scrollTop>e;t.scrollTop!=e?(t.scrollTop=e,t.scrollVertical(o),"scroll"==t.table.options.ajaxProgressiveLoad&&t.table.modules.ajax.nextPage(t.element.scrollHeight-t.element.clientHeight-e),t.table.options.scrollVertical(e)):t.scrollTop=e})},RowManager.prototype.findRow=function(t){var e=this;if("object"!=(void 0===t?"undefined":_typeof(t))){if(void 0===t||null===t)return!1;return e.rows.find(function(o){return o.data[e.table.options.index]==t})||!1}if(t instanceof Row)return t;if(t instanceof RowComponent)return t._getSelf()||!1;if("undefined"!=typeof HTMLElement&&t instanceof HTMLElement){return e.rows.find(function(e){return e.element===t})||!1}return!1},RowManager.prototype.getRowFromDataObject=function(t){return this.rows.find(function(e){return e.data===t})||!1},RowManager.prototype.getRowFromPosition=function(t,e){return e?this.activeRows[t]:this.rows[t]},RowManager.prototype.scrollToRow=function(t,e,o){var i,n=this,l=this.getDisplayRows().indexOf(t),s=t.getElement(),a=0;return new Promise(function(t,r){if(l>-1){if(void 0===e&&(e=n.table.options.scrollToRowPosition),void 0===o&&(o=n.table.options.scrollToRowIfVisible),"nearest"===e)switch(n.renderMode){case"classic":i=Tabulator.prototype.helpers.elOffset(s).top,e=Math.abs(n.element.scrollTop-i)>Math.abs(n.element.scrollTop+n.element.clientHeight-i)?"bottom":"top";break;case"virtual":e=Math.abs(n.vDomTop-l)>Math.abs(n.vDomBottom-l)?"bottom":"top"}if(!o&&Tabulator.prototype.helpers.elVisible(s)&&(a=Tabulator.prototype.helpers.elOffset(s).top-Tabulator.prototype.helpers.elOffset(n.element).top)>0&&a-1&&this.activeRows.splice(i,1),o>-1&&this.rows.splice(o,1),this.setActiveRows(this.activeRows),this.displayRowIterator(function(e){var o=e.indexOf(t);o>-1&&e.splice(o,1)}),e||this.reRenderInPosition(),this.regenerateRowNumbers(),this.table.options.rowDeleted.call(this.table,t.getComponent()),this.table.options.dataEdited.call(this.table,this.getData()),this.table.options.groupBy&&this.table.modExists("groupRows")?this.table.modules.groupRows.updateGroupRows(!0):this.table.options.pagination&&this.table.modExists("page")?this.refreshActiveData(!1,!1,!0):this.table.options.pagination&&this.table.modExists("page")&&this.refreshActiveData("page")},RowManager.prototype.addRow=function(t,e,o,i){var n=this.addRowActual(t,e,o,i);return this.table.options.history&&this.table.modExists("history")&&this.table.modules.history.action("rowAdd",n,{data:t,pos:e,index:o}),n},RowManager.prototype.addRows=function(t,e,o){var i=this,n=this,l=0,s=[];return new Promise(function(a,r){e=i.findAddRowPos(e),Array.isArray(t)||(t=[t]),l=t.length-1,(void 0===o&&e||void 0!==o&&!e)&&t.reverse(),t.forEach(function(t,i){var l=n.addRow(t,e,o,!0);s.push(l)}),i.table.options.groupBy&&i.table.modExists("groupRows")?i.table.modules.groupRows.updateGroupRows(!0):i.table.options.pagination&&i.table.modExists("page")?i.refreshActiveData(!1,!1,!0):i.reRenderInPosition(),i.table.modExists("columnCalcs")&&i.table.modules.columnCalcs.recalc(i.table.rowManager.activeRows),i.regenerateRowNumbers(),a(s)})},RowManager.prototype.findAddRowPos=function(t){return void 0===t&&(t=this.table.options.addRowPos),"pos"===t&&(t=!0),"bottom"===t&&(t=!1),t},RowManager.prototype.addRowActual=function(t,e,o,i){var n,l,s=t instanceof Row?t:new Row(t||{},this),a=this.findAddRowPos(e),r=-1;if(!o&&this.table.options.pagination&&"page"==this.table.options.paginationAddRow&&(l=this.getDisplayRows(),a?l.length?o=l[0]:this.activeRows.length&&(o=this.activeRows[this.activeRows.length-1],a=!1):l.length&&(o=l[l.length-1],a=!(l.length1&&(!o||o&&-1==u.indexOf(o)?a?u[0]!==s&&(o=u[0],this._moveRowInArray(s.getGroup().rows,s,o,!a)):u[u.length-1]!==s&&(o=u[u.length-1],this._moveRowInArray(s.getGroup().rows,s,o,!a)):this._moveRowInArray(s.getGroup().rows,s,o,!a))}return o&&(r=this.rows.indexOf(o)),o&&r>-1?(n=this.activeRows.indexOf(o),this.displayRowIterator(function(t){var e=t.indexOf(o);e>-1&&t.splice(a?e:e+1,0,s)}),n>-1&&this.activeRows.splice(a?n:n+1,0,s),this.rows.splice(a?r:r+1,0,s)):a?(this.displayRowIterator(function(t){t.unshift(s)}),this.activeRows.unshift(s),this.rows.unshift(s)):(this.displayRowIterator(function(t){t.push(s)}),this.activeRows.push(s),this.rows.push(s)),this.setActiveRows(this.activeRows),this.table.options.rowAdded.call(this.table,s.getComponent()),this.table.options.dataEdited.call(this.table,this.getData()),i||this.reRenderInPosition(),s},RowManager.prototype.moveRow=function(t,e,o){this.table.options.history&&this.table.modExists("history")&&this.table.modules.history.action("rowMove",t,{posFrom:this.getRowPosition(t),posTo:this.getRowPosition(e),to:e,after:o}),this.moveRowActual(t,e,o),this.regenerateRowNumbers(),this.table.options.rowMoved.call(this.table,t.getComponent())},RowManager.prototype.moveRowActual=function(t,e,o){var i=this;if(this._moveRowInArray(this.rows,t,e,o),this._moveRowInArray(this.activeRows,t,e,o),this.displayRowIterator(function(n){i._moveRowInArray(n,t,e,o)}),this.table.options.groupBy&&this.table.modExists("groupRows")){!o&&e instanceof Group&&(e=this.table.rowManager.prevDisplayRow(t)||e);var n=e.getGroup(),l=t.getGroup();n===l?this._moveRowInArray(n.rows,t,e,o):(l&&l.removeRow(t),n.insertRow(t,e,o))}},RowManager.prototype._moveRowInArray=function(t,e,o,i){var n,l,s,a;if(e!==o&&(n=t.indexOf(e),n>-1&&(t.splice(n,1),l=t.indexOf(o),l>-1?i?t.splice(l+1,0,e):t.splice(l,0,e):t.splice(n,0,e)),t===this.getDisplayRows())){s=nn?l:n+1;for(var r=s;r<=a;r++)t[r]&&this.styleRow(t[r],r)}},RowManager.prototype.clearData=function(){this.setData([])},RowManager.prototype.getRowIndex=function(t){return this.findRowIndex(t,this.rows)},RowManager.prototype.getDisplayRowIndex=function(t){var e=this.getDisplayRows().indexOf(t);return e>-1&&e},RowManager.prototype.nextDisplayRow=function(t,e){var o=this.getDisplayRowIndex(t),i=!1;return!1!==o&&o-1)&&o},RowManager.prototype.getData=function(t,e){var o=[];return this.getRows(t).forEach(function(t){"row"==t.type&&o.push(t.getData(e||"data"))}),o},RowManager.prototype.getComponents=function(t){var e=[];return this.getRows(t).forEach(function(t){e.push(t.getComponent())}),e},RowManager.prototype.getDataCount=function(t){return this.getRows(t).length},RowManager.prototype._genRemoteRequest=function(){var t=this,e=this.table,o=e.options,i={};if(e.modExists("page")){if(o.ajaxSorting){var n=this.table.modules.sort.getSort();n.forEach(function(t){delete t.column}),i[this.table.modules.page.paginationDataSentNames.sorters]=n}if(o.ajaxFiltering){var l=this.table.modules.filter.getFilters(!0,!0);i[this.table.modules.page.paginationDataSentNames.filters]=l}this.table.modules.ajax.setParams(i,!0)}e.modules.ajax.sendRequest().then(function(e){t._setDataActual(e,!0)}).catch(function(t){})},RowManager.prototype.filterRefresh=function(){var t=this.table,e=t.options,o=this.scrollLeft;e.ajaxFiltering?"remote"==e.pagination&&t.modExists("page")?(t.modules.page.reset(!0),t.modules.page.setPage(1).then(function(){}).catch(function(){})):e.ajaxProgressiveLoad?t.modules.ajax.loadData().then(function(){}).catch(function(){}):this._genRemoteRequest():this.refreshActiveData("filter"),this.scrollHorizontal(o)},RowManager.prototype.sorterRefresh=function(t){var e=this.table,o=this.table.options,i=this.scrollLeft;o.ajaxSorting?("remote"==o.pagination||o.progressiveLoad)&&e.modExists("page")?(e.modules.page.reset(!0),e.modules.page.setPage(1).then(function(){}).catch(function(){})):o.ajaxProgressiveLoad?e.modules.ajax.loadData().then(function(){}).catch(function(){}):this._genRemoteRequest():this.refreshActiveData(t?"filter":"sort"),this.scrollHorizontal(i)},RowManager.prototype.scrollHorizontal=function(t){this.scrollLeft=t,this.element.scrollLeft=t,this.table.options.groupBy&&this.table.modules.groupRows.scrollHeaders(t),this.table.modExists("columnCalcs")&&this.table.modules.columnCalcs.scrollHorizontal(t)},RowManager.prototype.refreshActiveData=function(t,e,o){var i,n=this,l=this.table,s=["all","filter","sort","display","freeze","group","tree","page"];if(this.redrawBlock)return void((!this.redrawBlockRestoreConfig||s.indexOf(t)=0))break;l=a}else if(e-s[a].getElement().offsetTop>=0)n=a;else{if(i=!0,!(o-s[a].getElement().offsetTop>=0))break;l=a}}else n=this.vDomTop,l=this.vDomBottom;return s.slice(n,l+1)},RowManager.prototype.displayRowIterator=function(t){this.displayRows.forEach(t),this.displayRowsCount=this.displayRows[this.displayRows.length-1].length},RowManager.prototype.getRows=function(t){var e;switch(t){case"active":e=this.activeRows;break;case"display":e=this.table.rowManager.getDisplayRows();break;case"visible":e=this.getVisibleRows(!0);break;default:e=this.rows}return e},RowManager.prototype.reRenderInPosition=function(t){if("virtual"==this.getRenderMode())if(this.redrawBlock)t?t():this.redrawBlockRederInPosition=!0;else{for(var e=this.element.scrollTop,o=!1,i=!1,n=this.scrollLeft,l=this.getDisplayRows(),s=this.vDomTop;s<=this.vDomBottom;s++)if(l[s]){var a=e-l[s].getElement().offsetTop;if(!(!1===i||Math.abs(a)this.vDomWindowBuffer&&(this.vDomWindowBuffer=2*f),"group"!==m.type&&(c=!1),i.vDomBottom++,u++}t?(i.vDomTopPad=e?i.vDomRowHeight*this.vDomTop+o:i.scrollTop-r,i.vDomBottomPad=i.vDomBottom==i.displayRowsCount-1?0:Math.max(i.vDomScrollHeight-i.vDomTopPad-a-r,0)):(this.vDomTopPad=0,i.vDomRowHeight=Math.floor((a+r)/u),i.vDomBottomPad=i.vDomRowHeight*(i.displayRowsCount-i.vDomBottom-1),i.vDomScrollHeight=r+a+i.vDomBottomPad-i.height),n.style.paddingTop=i.vDomTopPad+"px",n.style.paddingBottom=i.vDomBottomPad+"px",e&&(this.scrollTop=i.vDomTopPad+r+o-(this.element.scrollWidth>this.element.clientWidth?this.element.offsetHeight-this.element.clientHeight:0)),this.scrollTop=Math.min(this.scrollTop,this.element.scrollHeight-this.height),this.element.scrollWidth>this.element.offsetWidth&&e&&(this.scrollTop+=this.element.offsetHeight-this.element.clientHeight),this.vDomScrollPosTop=this.scrollTop,this.vDomScrollPosBottom=this.scrollTop,l.scrollTop=this.scrollTop,n.style.minWidth=c?i.table.columnManager.getWidth()+"px":"",i.table.options.groupBy&&"fitDataFill"!=i.table.modules.layout.getMode()&&i.displayRowsCount==i.table.modules.groupRows.countGroups()&&(i.tableElement.style.minWidth=i.table.columnManager.getWidth())}else this.renderEmptyScroll();this.fixedHeight||this.adjustTableSize()},RowManager.prototype.scrollVertical=function(t){var e=this.scrollTop-this.vDomScrollPosTop,o=this.scrollTop-this.vDomScrollPosBottom,i=2*this.vDomWindowBuffer;if(-e>i||o>i){var n=this.scrollLeft;this._virtualRenderFill(Math.floor(this.element.scrollTop/this.element.scrollHeight*this.displayRowsCount)),this.scrollHorizontal(n)}else t?(e<0&&this._addTopRow(-e),o<0&&(this.vDomScrollHeight-this.scrollTop>this.vDomWindowBuffer?this._removeBottomRow(-o):this.vDomScrollPosBottom=this.scrollTop)):(e>=0&&(this.scrollTop>this.vDomWindowBuffer?this._removeTopRow(e):this.vDomScrollPosTop=this.scrollTop),o>=0&&this._addBottomRow(o))},RowManager.prototype._addTopRow=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,o=this.tableElement,i=this.getDisplayRows();if(this.vDomTop){var n=this.vDomTop-1,l=i[n],s=l.getHeight()||this.vDomRowHeight;t>=s&&(this.styleRow(l,n),o.insertBefore(l.getElement(),o.firstChild),l.initialized&&l.heightInitialized||(this.vDomTopNewRows.push(l),l.heightInitialized||l.clearCellHeight()),l.initialize(),this.vDomTopPad-=s,this.vDomTopPad<0&&(this.vDomTopPad=n*this.vDomRowHeight),n||(this.vDomTopPad=0),o.style.paddingTop=this.vDomTopPad+"px",this.vDomScrollPosTop-=s,this.vDomTop--),t=-(this.scrollTop-this.vDomScrollPosTop),l.getHeight()>this.vDomWindowBuffer&&(this.vDomWindowBuffer=2*l.getHeight()),e=(i[this.vDomTop-1].getHeight()||this.vDomRowHeight)?this._addTopRow(t,e+1):this._quickNormalizeRowHeight(this.vDomTopNewRows)}},RowManager.prototype._removeTopRow=function(t){var e=this.tableElement,o=this.getDisplayRows()[this.vDomTop],i=o.getHeight()||this.vDomRowHeight;if(t>=i){var n=o.getElement();n.parentNode.removeChild(n),this.vDomTopPad+=i,e.style.paddingTop=this.vDomTopPad+"px",this.vDomScrollPosTop+=this.vDomTop?i:i+this.vDomWindowBuffer,this.vDomTop++,t=this.scrollTop-this.vDomScrollPosTop,this._removeTopRow(t)}},RowManager.prototype._addBottomRow=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,o=this.tableElement,i=this.getDisplayRows();if(this.vDomBottom=s&&(this.styleRow(l,n),o.appendChild(l.getElement()),l.initialized&&l.heightInitialized||(this.vDomBottomNewRows.push(l),l.heightInitialized||l.clearCellHeight()),l.initialize(),this.vDomBottomPad-=s,(this.vDomBottomPad<0||n==this.displayRowsCount-1)&&(this.vDomBottomPad=0),o.style.paddingBottom=this.vDomBottomPad+"px",this.vDomScrollPosBottom+=s,this.vDomBottom++),t=this.scrollTop-this.vDomScrollPosBottom,l.getHeight()>this.vDomWindowBuffer&&(this.vDomWindowBuffer=2*l.getHeight()),e=(i[this.vDomBottom+1].getHeight()||this.vDomRowHeight)?this._addBottomRow(t,e+1):this._quickNormalizeRowHeight(this.vDomBottomNewRows)}},RowManager.prototype._removeBottomRow=function(t){var e=this.tableElement,o=this.getDisplayRows()[this.vDomBottom],i=o.getHeight()||this.vDomRowHeight;if(t>=i){var n=o.getElement();n.parentNode&&n.parentNode.removeChild(n),this.vDomBottomPad+=i,this.vDomBottomPad<0&&(this.vDomBottomPad=0),e.style.paddingBottom=this.vDomBottomPad+"px",this.vDomScrollPosBottom-=i,this.vDomBottom--,t=-(this.scrollTop-this.vDomScrollPosBottom),this._removeBottomRow(t)}},RowManager.prototype._quickNormalizeRowHeight=function(t){t.forEach(function(t){t.calcHeight()}),t.forEach(function(t){t.setCellHeight()}),t.length=0},RowManager.prototype.normalizeHeight=function(){this.activeRows.forEach(function(t){t.normalizeHeight()})},RowManager.prototype.adjustTableSize=function(){var t,e=this.element.clientHeight;if("virtual"===this.renderMode){var o=this.columnManager.getElement().offsetHeight+(this.table.footerManager&&!this.table.footerManager.external?this.table.footerManager.getElement().offsetHeight:0);this.fixedHeight?(this.element.style.minHeight="calc(100% - "+o+"px)",this.element.style.height="calc(100% - "+o+"px)",this.element.style.maxHeight="calc(100% - "+o+"px)"):(this.element.style.height="",this.element.style.height=this.table.element.clientHeight-o+"px",this.element.scrollTop=this.scrollTop),this.height=this.element.clientHeight,this.vDomWindowBuffer=this.table.options.virtualDomBuffer||this.height,this.fixedHeight||e==this.element.clientHeight||((t=this.table.modExists("resizeTable"))&&!this.table.modules.resizeTable.autoResize||!t)&&this.redraw()}},RowManager.prototype.reinitialize=function(){this.rows.forEach(function(t){t.reinitialize()})},RowManager.prototype.blockRedraw=function(){this.redrawBlock=!0,this.redrawBlockRestoreConfig=!1},RowManager.prototype.restoreRedraw=function(){this.redrawBlock=!1,this.redrawBlockRestoreConfig?(this.refreshActiveData(this.redrawBlockRestoreConfig.stage,this.redrawBlockRestoreConfig.skipStage,this.redrawBlockRestoreConfig.renderInPosition),this.redrawBlockRestoreConfig=!1):this.redrawBlockRederInPosition&&this.reRenderInPosition(),this.redrawBlockRederInPosition=!1}, +RowManager.prototype.redraw=function(t){var e=this.scrollLeft;this.adjustTableSize(),this.table.tableWidth=this.table.element.clientWidth,t?this.renderTable():("classic"==this.renderMode?this.table.options.groupBy?this.refreshActiveData("group",!1,!1):this._simpleRender():(this.reRenderInPosition(),this.scrollHorizontal(e)),this.displayRowsCount||this.table.options.placeholder&&this.getElement().appendChild(this.table.options.placeholder))},RowManager.prototype.resetScroll=function(){if(this.element.scrollLeft=0,this.element.scrollTop=0,"ie"===this.table.browser){var t=document.createEvent("Event");t.initEvent("scroll",!1,!0),this.element.dispatchEvent(t)}else this.element.dispatchEvent(new Event("scroll"))};var RowComponent=function(t){this._row=t};RowComponent.prototype.getData=function(t){return this._row.getData(t)},RowComponent.prototype.getElement=function(){return this._row.getElement()},RowComponent.prototype.getCells=function(){var t=[];return this._row.getCells().forEach(function(e){t.push(e.getComponent())}),t},RowComponent.prototype.getCell=function(t){var e=this._row.getCell(t);return!!e&&e.getComponent()},RowComponent.prototype.getIndex=function(){return this._row.getData("data")[this._row.table.options.index]},RowComponent.prototype.getPosition=function(t){return this._row.table.rowManager.getRowPosition(this._row,t)},RowComponent.prototype.delete=function(){return this._row.delete()},RowComponent.prototype.scrollTo=function(){return this._row.table.rowManager.scrollToRow(this._row)},RowComponent.prototype.pageTo=function(){if(this._row.table.modExists("page",!0))return this._row.table.modules.page.setPageToRow(this._row)},RowComponent.prototype.move=function(t,e){this._row.moveToRow(t,e)},RowComponent.prototype.update=function(t){return this._row.updateData(t)},RowComponent.prototype.normalizeHeight=function(){this._row.normalizeHeight(!0)},RowComponent.prototype.select=function(){this._row.table.modules.selectRow.selectRows(this._row)},RowComponent.prototype.deselect=function(){this._row.table.modules.selectRow.deselectRows(this._row)},RowComponent.prototype.toggleSelect=function(){this._row.table.modules.selectRow.toggleRow(this._row)},RowComponent.prototype.isSelected=function(){return this._row.table.modules.selectRow.isRowSelected(this._row)},RowComponent.prototype._getSelf=function(){return this._row},RowComponent.prototype.validate=function(){return this._row.validate()},RowComponent.prototype.freeze=function(){this._row.table.modExists("frozenRows",!0)&&this._row.table.modules.frozenRows.freezeRow(this._row)},RowComponent.prototype.unfreeze=function(){this._row.table.modExists("frozenRows",!0)&&this._row.table.modules.frozenRows.unfreezeRow(this._row)},RowComponent.prototype.isFrozen=function(){if(this._row.table.modExists("frozenRows",!0)){return this._row.table.modules.frozenRows.rows.indexOf(this._row)>-1}return!1},RowComponent.prototype.treeCollapse=function(){this._row.table.modExists("dataTree",!0)&&this._row.table.modules.dataTree.collapseRow(this._row)},RowComponent.prototype.treeExpand=function(){this._row.table.modExists("dataTree",!0)&&this._row.table.modules.dataTree.expandRow(this._row)},RowComponent.prototype.treeToggle=function(){this._row.table.modExists("dataTree",!0)&&this._row.table.modules.dataTree.toggleRow(this._row)},RowComponent.prototype.getTreeParent=function(){return!!this._row.table.modExists("dataTree",!0)&&this._row.table.modules.dataTree.getTreeParent(this._row)},RowComponent.prototype.getTreeChildren=function(){return!!this._row.table.modExists("dataTree",!0)&&this._row.table.modules.dataTree.getTreeChildren(this._row)},RowComponent.prototype.addTreeChild=function(t,e,o){return!!this._row.table.modExists("dataTree",!0)&&this._row.table.modules.dataTree.addTreeChildRow(this._row,t,e,o)},RowComponent.prototype.reformat=function(){return this._row.reinitialize()},RowComponent.prototype.getGroup=function(){return this._row.getGroup().getComponent()},RowComponent.prototype.getTable=function(){return this._row.table},RowComponent.prototype.getNextRow=function(){var t=this._row.nextRow();return t?t.getComponent():t},RowComponent.prototype.getPrevRow=function(){var t=this._row.prevRow();return t?t.getComponent():t};var Row=function(t,e){var o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"row";this.table=e.table,this.parent=e,this.data={},this.type=o,this.element=this.createElement(),this.modules={},this.cells=[],this.height=0,this.heightStyled="",this.manualHeight=!1,this.outerHeight=0,this.initialized=!1,this.heightInitialized=!1,this.component=null,this.setData(t),this.generateElement()};Row.prototype.createElement=function(){var t=document.createElement("div");return t.classList.add("tabulator-row"),t.setAttribute("role","row"),t},Row.prototype.getElement=function(){return this.element},Row.prototype.detachElement=function(){this.element&&this.element.parentNode&&this.element.parentNode.removeChild(this.element)},Row.prototype.generateElement=function(){var t,e,o,i=this;!1!==i.table.options.selectable&&i.table.modExists("selectRow")&&i.table.modules.selectRow.initializeRow(this),!1!==i.table.options.movableRows&&i.table.modExists("moveRow")&&i.table.modules.moveRow.initializeRow(this),!1!==i.table.options.dataTree&&i.table.modExists("dataTree")&&i.table.modules.dataTree.initializeRow(this),"collapse"===i.table.options.responsiveLayout&&i.table.modExists("responsiveLayout")&&i.table.modules.responsiveLayout.initializeRow(this),i.table.options.rowContextMenu&&this.table.modExists("menu")&&i.table.modules.menu.initializeRow(this),i.table.options.rowClick&&i.element.addEventListener("click",function(t){i.table.options.rowClick(t,i.getComponent())}),i.table.options.rowDblClick&&i.element.addEventListener("dblclick",function(t){i.table.options.rowDblClick(t,i.getComponent())}),i.table.options.rowContext&&i.element.addEventListener("contextmenu",function(t){i.table.options.rowContext(t,i.getComponent())}),i.table.options.rowMouseEnter&&i.element.addEventListener("mouseenter",function(t){i.table.options.rowMouseEnter(t,i.getComponent())}),i.table.options.rowMouseLeave&&i.element.addEventListener("mouseleave",function(t){i.table.options.rowMouseLeave(t,i.getComponent())}),i.table.options.rowMouseOver&&i.element.addEventListener("mouseover",function(t){i.table.options.rowMouseOver(t,i.getComponent())}),i.table.options.rowMouseOut&&i.element.addEventListener("mouseout",function(t){i.table.options.rowMouseOut(t,i.getComponent())}),i.table.options.rowMouseMove&&i.element.addEventListener("mousemove",function(t){i.table.options.rowMouseMove(t,i.getComponent())}),i.table.options.rowTap&&(o=!1,i.element.addEventListener("touchstart",function(t){o=!0},{passive:!0}),i.element.addEventListener("touchend",function(t){o&&i.table.options.rowTap(t,i.getComponent()),o=!1})),i.table.options.rowDblTap&&(t=null,i.element.addEventListener("touchend",function(e){t?(clearTimeout(t),t=null,i.table.options.rowDblTap(e,i.getComponent())):t=setTimeout(function(){clearTimeout(t),t=null},300)})),i.table.options.rowTapHold&&(e=null,i.element.addEventListener("touchstart",function(t){clearTimeout(e),e=setTimeout(function(){clearTimeout(e),e=null,o=!1,i.table.options.rowTapHold(t,i.getComponent())},1e3)},{passive:!0}),i.element.addEventListener("touchend",function(t){clearTimeout(e),e=null}))},Row.prototype.generateCells=function(){this.cells=this.table.columnManager.generateCells(this)},Row.prototype.initialize=function(t){var e=this;if(!e.initialized||t){for(e.deleteCells();e.element.firstChild;)e.element.removeChild(e.element.firstChild);this.table.modExists("frozenColumns")&&this.table.modules.frozenColumns.layoutRow(this),this.generateCells(),e.cells.forEach(function(t){e.element.appendChild(t.getElement()),t.cellRendered()}),t&&e.normalizeHeight(),e.table.options.dataTree&&e.table.modExists("dataTree")&&e.table.modules.dataTree.layoutRow(this),"collapse"===e.table.options.responsiveLayout&&e.table.modExists("responsiveLayout")&&e.table.modules.responsiveLayout.layoutRow(this),e.table.options.rowFormatter&&e.table.options.rowFormatter(e.getComponent()),e.table.options.resizableRows&&e.table.modExists("resizeRows")&&e.table.modules.resizeRows.initializeRow(e),e.initialized=!0}},Row.prototype.reinitializeHeight=function(){this.heightInitialized=!1,null!==this.element.offsetParent&&this.normalizeHeight(!0)},Row.prototype.reinitialize=function(){this.initialized=!1,this.heightInitialized=!1,this.manualHeight||(this.height=0,this.heightStyled=""),null!==this.element.offsetParent&&this.initialize(!0)},Row.prototype.calcHeight=function(t){var e=0,o=this.table.options.resizableRows?this.element.clientHeight:0;this.cells.forEach(function(t){var o=t.getHeight();o>e&&(e=o)}),this.height=t?Math.max(e,o):this.manualHeight?this.height:Math.max(e,o),this.heightStyled=this.height?this.height+"px":"",this.outerHeight=this.element.offsetHeight},Row.prototype.setCellHeight=function(){this.cells.forEach(function(t){t.setHeight()}),this.heightInitialized=!0},Row.prototype.clearCellHeight=function(){this.cells.forEach(function(t){t.clearHeight()})},Row.prototype.normalizeHeight=function(t){t&&this.clearCellHeight(),this.calcHeight(t),this.setCellHeight()},Row.prototype.setHeight=function(t,e){(this.height!=t||e)&&(this.manualHeight=!0,this.height=t,this.heightStyled=t?t+"px":"",this.setCellHeight(),this.outerHeight=this.element.offsetHeight)},Row.prototype.getHeight=function(){return this.outerHeight},Row.prototype.getWidth=function(){return this.element.offsetWidth},Row.prototype.deleteCell=function(t){var e=this.cells.indexOf(t);e>-1&&this.cells.splice(e,1)},Row.prototype.setData=function(t){this.table.modExists("mutator")&&(t=this.table.modules.mutator.transformRow(t,"data")),this.data=t,this.table.options.reactiveData&&this.table.modExists("reactiveData",!0)&&this.table.modules.reactiveData.watchRow(this)},Row.prototype.updateData=function(t){var e,o=this,i=Tabulator.prototype.helpers.elVisible(this.element),n={};return new Promise(function(l,s){"string"==typeof t&&(t=JSON.parse(t)),o.table.options.reactiveData&&o.table.modExists("reactiveData",!0)&&o.table.modules.reactiveData.block(),o.table.modExists("mutator")?(n=Object.assign(n,o.data),n=Object.assign(n,t),e=o.table.modules.mutator.transformRow(n,"data",t)):e=t;for(var a in e)o.data[a]=e[a];o.table.options.reactiveData&&o.table.modExists("reactiveData",!0)&&o.table.modules.reactiveData.unblock();for(var a in t){o.table.columnManager.getColumnsByFieldRoot(a).forEach(function(t){var n=o.getCell(t.getField());if(n){var l=t.getFieldValue(e);n.getValue()!=l&&(n.setValueProcessData(l),i&&n.cellRendered())}})}i?(o.normalizeHeight(!0),o.table.options.rowFormatter&&o.table.options.rowFormatter(o.getComponent())):(o.initialized=!1,o.height=0,o.heightStyled=""),!1!==o.table.options.dataTree&&o.table.modExists("dataTree")&&o.table.modules.dataTree.redrawNeeded(t)&&(o.table.modules.dataTree.initializeRow(o),o.table.modules.dataTree.layoutRow(o),o.table.rowManager.refreshActiveData("tree",!1,!0)),o.table.options.rowUpdated.call(o.table,o.getComponent()),l()})},Row.prototype.getData=function(t){var e=this;return t?e.table.modExists("accessor")?e.table.modules.accessor.transformRow(e.data,t):void 0:this.data},Row.prototype.getCell=function(t){return t=this.table.columnManager.findColumn(t),this.cells.find(function(e){return e.column===t})},Row.prototype.getCellIndex=function(t){return this.cells.findIndex(function(e){return e===t})},Row.prototype.findNextEditableCell=function(t){var e=!1;if(t0)for(var o=t-1;o>=0;o--){var i=this.cells[o],n=!0;if(i.column.modules.edit&&Tabulator.prototype.helpers.elVisible(i.getElement())&&("function"==typeof i.column.modules.edit.check&&(n=i.column.modules.edit.check(i.getComponent())),n)){e=i;break}}return e},Row.prototype.getCells=function(){return this.cells},Row.prototype.nextRow=function(){return this.table.rowManager.nextDisplayRow(this,!0)||!1},Row.prototype.prevRow=function(){return this.table.rowManager.prevDisplayRow(this,!0)||!1},Row.prototype.moveToRow=function(t,e){var o=this.table.rowManager.findRow(t);o?(this.table.rowManager.moveRowActual(this,o,!e),this.table.rowManager.refreshActiveData("display",!1,!0)):console.warn("Move Error - No matching row found:",t)},Row.prototype.validate=function(){var t=[];return this.cells.forEach(function(e){e.validate()||t.push(e.getComponent())}),!t.length||t},Row.prototype.delete=function(){var t=this;return new Promise(function(e,o){var i,n;t.table.options.history&&t.table.modExists("history")&&(t.table.options.groupBy&&t.table.modExists("groupRows")?(n=t.getGroup().rows,(i=n.indexOf(t))&&(i=n[i-1])):(i=t.table.rowManager.getRowIndex(t))&&(i=t.table.rowManager.rows[i-1]),t.table.modules.history.action("rowDelete",t,{data:t.getData(),pos:!i,index:i})),t.deleteActual(),e()})},Row.prototype.deleteActual=function(t){this.table.rowManager.getRowIndex(this);this.table.modExists("selectRow")&&this.table.modules.selectRow._deselectRow(this,!0),this.table.modExists("edit")&&this.table.modules.edit.currentCell.row===this&&this.table.modules.edit.cancelEdit(),this.table.options.reactiveData&&this.table.modExists("reactiveData",!0),this.modules.group&&this.modules.group.removeRow(this),this.table.rowManager.deleteRow(this,t),this.deleteCells(),this.initialized=!1,this.heightInitialized=!1,this.table.options.dataTree&&this.table.modExists("dataTree",!0)&&this.table.modules.dataTree.rowDelete(this),this.table.modExists("columnCalcs")&&(this.table.options.groupBy&&this.table.modExists("groupRows")?this.table.modules.columnCalcs.recalcRowGroup(this):this.table.modules.columnCalcs.recalc(this.table.rowManager.activeRows))},Row.prototype.deleteCells=function(){for(var t=this.cells.length,e=0;e-1?(this.browser="ie",this.browserSlow=!0):t.indexOf("Edge")>-1?(this.browser="edge",this.browserSlow=!0):t.indexOf("Firefox")>-1?(this.browser="firefox",this.browserSlow=!1):(this.browser="other",this.browserSlow=!1),this.browserMobile=/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino|android|ipad|playbook|silk/i.test(t)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(t.substr(0,4))},Tabulator.prototype.blockRedraw=function(){return this.rowManager.blockRedraw()},Tabulator.prototype.restoreRedraw=function(){return this.rowManager.restoreRedraw()},Tabulator.prototype.setDataFromLocalFile=function(t){var e=this;return new Promise(function(o,i){var n=document.createElement("input");n.type="file",n.accept=t||".json,application/json",n.addEventListener("change",function(t){var l,s=n.files[0],a=new FileReader;a.readAsText(s),a.onload=function(t){try{l=JSON.parse(a.result)}catch(t){return console.warn("File Load Error - File contents is invalid JSON",t),void i(t)}e._setData(l).then(function(t){o(t)}).catch(function(t){o(t)})},a.onerror=function(t){console.warn("File Load Error - Unable to read file"),i()}}),n.click()})},Tabulator.prototype.setData=function(t,e,o){return this.modExists("ajax")&&this.modules.ajax.blockActiveRequest(),this._setData(t,e,o,!1,!0)},Tabulator.prototype._setData=function(t,e,o,i,n){var l=this;return"string"!=typeof t?t?l.rowManager.setData(t,i,n):l.modExists("ajax")&&(l.modules.ajax.getUrl||l.options.ajaxURLGenerator)?"remote"==l.options.pagination&&l.modExists("page",!0)?(l.modules.page.reset(!0,!0),l.modules.page.setPage(1)):l.modules.ajax.loadData(i,n):l.rowManager.setData([],i,n):0==t.indexOf("{")||0==t.indexOf("[")?l.rowManager.setData(JSON.parse(t),i,n):l.modExists("ajax",!0)?(e&&l.modules.ajax.setParams(e),o&&l.modules.ajax.setConfig(o),l.modules.ajax.setUrl(t),"remote"==l.options.pagination&&l.modExists("page",!0)?(l.modules.page.reset(!0,!0),l.modules.page.setPage(1)):l.modules.ajax.loadData(i,n)):void 0},Tabulator.prototype.clearData=function(){this.modExists("ajax")&&this.modules.ajax.blockActiveRequest(),this.rowManager.clearData()},Tabulator.prototype.getData=function(t){return!0===t&&(console.warn("passing a boolean to the getData function is deprecated, you should now pass the string 'active'"),t="active"),this.rowManager.getData(t)},Tabulator.prototype.getDataCount=function(t){return!0===t&&(console.warn("passing a boolean to the getDataCount function is deprecated, you should now pass the string 'active'"),t="active"),this.rowManager.getDataCount(t)},Tabulator.prototype.searchRows=function(t,e,o){if(this.modExists("filter",!0))return this.modules.filter.search("rows",t,e,o)},Tabulator.prototype.searchData=function(t,e,o){if(this.modExists("filter",!0))return this.modules.filter.search("data",t,e,o)},Tabulator.prototype.getHtml=function(t,e,o){if(this.modExists("export",!0))return this.modules.export.getHtml(t,e,o)},Tabulator.prototype.print=function(t,e,o){if(this.modExists("print",!0))return this.modules.print.printFullscreen(t,e,o)},Tabulator.prototype.getAjaxUrl=function(){if(this.modExists("ajax",!0))return this.modules.ajax.getUrl()},Tabulator.prototype.replaceData=function(t,e,o){return this.modExists("ajax")&&this.modules.ajax.blockActiveRequest(),this._setData(t,e,o,!0)},Tabulator.prototype.updateData=function(t){var e=this,o=this,i=0;return new Promise(function(n,l){e.modExists("ajax")&&e.modules.ajax.blockActiveRequest(),"string"==typeof t&&(t=JSON.parse(t)),t?t.forEach(function(t){var e=o.rowManager.findRow(t[o.options.index]);e&&(i++,e.updateData(t).then(function(){--i||n()}))}):(console.warn("Update Error - No data provided"),l("Update Error - No data provided"))})},Tabulator.prototype.addData=function(t,e,o){var i=this;return new Promise(function(n,l){i.modExists("ajax")&&i.modules.ajax.blockActiveRequest(),"string"==typeof t&&(t=JSON.parse(t)),t?i.rowManager.addRows(t,e,o).then(function(t){var e=[];t.forEach(function(t){e.push(t.getComponent())}),n(e)}):(console.warn("Update Error - No data provided"),l("Update Error - No data provided"))})},Tabulator.prototype.updateOrAddData=function(t){var e=this,o=this,i=[],n=0;return new Promise(function(l,s){e.modExists("ajax")&&e.modules.ajax.blockActiveRequest(),"string"==typeof t&&(t=JSON.parse(t)),t?t.forEach(function(t){var e=o.rowManager.findRow(t[o.options.index]);n++,e?e.updateData(t).then(function(){n--,i.push(e.getComponent()),n||l(i)}):o.rowManager.addRows(t).then(function(t){n--,i.push(t[0].getComponent()),n||l(i)})}):(console.warn("Update Error - No data provided"),s("Update Error - No data provided"))})},Tabulator.prototype.getRow=function(t){var e=this.rowManager.findRow(t);return e?e.getComponent():(console.warn("Find Error - No matching row found:",t),!1)},Tabulator.prototype.getRowFromPosition=function(t,e){var o=this.rowManager.getRowFromPosition(t,e);return o?o.getComponent():(console.warn("Find Error - No matching row found:",t),!1)},Tabulator.prototype.deleteRow=function(t){var e=this;return new Promise(function(o,i){function n(){++s==t.length&&a&&(l.rowManager.reRenderInPosition(),o())}var l=e,s=0,a=0,r=[];Array.isArray(t)||(t=[t]),t.forEach(function(t){var o=e.rowManager.findRow(t,!0);o?r.push(o):(console.warn("Delete Error - No matching row found:",t),i("Delete Error - No matching row found"),n())}),r.sort(function(t,o){return e.rowManager.rows.indexOf(t)>e.rowManager.rows.indexOf(o)?1:-1}),r.forEach(function(t){t.delete().then(function(){a++,n()}).catch(function(t){n(),i(t)})})})},Tabulator.prototype.addRow=function(t,e,o){var i=this;return new Promise(function(n,l){"string"==typeof t&&(t=JSON.parse(t)),i.rowManager.addRows(t,e,o).then(function(t){i.modExists("columnCalcs")&&i.modules.columnCalcs.recalc(i.rowManager.activeRows),n(t[0].getComponent())})})},Tabulator.prototype.updateOrAddRow=function(t,e){var o=this;return new Promise(function(i,n){var l=o.rowManager.findRow(t);"string"==typeof e&&(e=JSON.parse(e)),l?l.updateData(e).then(function(){o.modExists("columnCalcs")&&o.modules.columnCalcs.recalc(o.rowManager.activeRows),i(l.getComponent())}).catch(function(t){n(t)}):l=o.rowManager.addRows(e).then(function(t){o.modExists("columnCalcs")&&o.modules.columnCalcs.recalc(o.rowManager.activeRows),i(t[0].getComponent())}).catch(function(t){n(t)})})},Tabulator.prototype.updateRow=function(t,e){var o=this;return new Promise(function(i,n){var l=o.rowManager.findRow(t);"string"==typeof e&&(e=JSON.parse(e)),l?l.updateData(e).then(function(){i(l.getComponent())}).catch(function(t){n(t)}):(console.warn("Update Error - No matching row found:",t),n("Update Error - No matching row found"))})},Tabulator.prototype.scrollToRow=function(t,e,o){var i=this;return new Promise(function(n,l){var s=i.rowManager.findRow(t);s?i.rowManager.scrollToRow(s,e,o).then(function(){n()}).catch(function(t){l(t)}):(console.warn("Scroll Error - No matching row found:",t),l("Scroll Error - No matching row found"))})},Tabulator.prototype.moveRow=function(t,e,o){var i=this.rowManager.findRow(t);i?i.moveToRow(e,o):console.warn("Move Error - No matching row found:",t)},Tabulator.prototype.getRows=function(t){return!0===t&&(console.warn("passing a boolean to the getRows function is deprecated, you should now pass the string 'active'"),t="active"),this.rowManager.getComponents(t)},Tabulator.prototype.getRowPosition=function(t,e){var o=this.rowManager.findRow(t);return o?this.rowManager.getRowPosition(o,e):(console.warn("Position Error - No matching row found:",t),!1)},Tabulator.prototype.copyToClipboard=function(t){this.modExists("clipboard",!0)&&this.modules.clipboard.copy(t)},Tabulator.prototype.setColumns=function(t){this.columnManager.setColumns(t)},Tabulator.prototype.getColumns=function(t){return this.columnManager.getComponents(t)},Tabulator.prototype.getColumn=function(t){var e=this.columnManager.findColumn(t);return e?e.getComponent():(console.warn("Find Error - No matching column found:",t),!1)},Tabulator.prototype.getColumnDefinitions=function(){return this.columnManager.getDefinitionTree()},Tabulator.prototype.getColumnLayout=function(){if(this.modExists("persistence",!0))return this.modules.persistence.parseColumns(this.columnManager.getColumns())},Tabulator.prototype.setColumnLayout=function(t){return!!this.modExists("persistence",!0)&&(this.columnManager.setColumns(this.modules.persistence.mergeDefinition(this.options.columns,t)),!0)},Tabulator.prototype.showColumn=function(t){var e=this.columnManager.findColumn(t);if(!e)return console.warn("Column Show Error - No matching column found:",t),!1;e.show(),this.options.responsiveLayout&&this.modExists("responsiveLayout",!0)&&this.modules.responsiveLayout.update()},Tabulator.prototype.hideColumn=function(t){var e=this.columnManager.findColumn(t);if(!e)return console.warn("Column Hide Error - No matching column found:",t),!1;e.hide(),this.options.responsiveLayout&&this.modExists("responsiveLayout",!0)&&this.modules.responsiveLayout.update()},Tabulator.prototype.toggleColumn=function(t){var e=this.columnManager.findColumn(t);if(!e)return console.warn("Column Visibility Toggle Error - No matching column found:",t),!1;e.visible?e.hide():e.show()},Tabulator.prototype.addColumn=function(t,e,o){var i=this;return new Promise(function(n,l){var s=i.columnManager.findColumn(o);i.columnManager.addColumn(t,e,s).then(function(t){n(t.getComponent())}).catch(function(t){l(t)})})},Tabulator.prototype.deleteColumn=function(t){var e=this;return new Promise(function(o,i){var n=e.columnManager.findColumn(t);n?n.delete().then(function(){o()}).catch(function(t){i(t)}):(console.warn("Column Delete Error - No matching column found:",t),i())})},Tabulator.prototype.updateColumnDefinition=function(t,e){var o=this;return new Promise(function(i,n){var l=o.columnManager.findColumn(t);l?l.updateDefinition(e).then(function(t){i(t)}).catch(function(t){n(t)}):(console.warn("Column Update Error - No matching column found:",t),n())})},Tabulator.prototype.moveColumn=function(t,e,o){var i=this.columnManager.findColumn(t),n=this.columnManager.findColumn(e);i?n?this.columnManager.moveColumn(i,n,o):console.warn("Move Error - No matching column found:",n):console.warn("Move Error - No matching column found:",t)},Tabulator.prototype.scrollToColumn=function(t,e,o){var i=this;return new Promise(function(n,l){var s=i.columnManager.findColumn(t);s?i.columnManager.scrollToColumn(s,e,o).then(function(){n()}).catch(function(t){l(t)}):(console.warn("Scroll Error - No matching column found:",t),l("Scroll Error - No matching column found"))})},Tabulator.prototype.setLocale=function(t){this.modules.localize.setLocale(t)},Tabulator.prototype.getLocale=function(){return this.modules.localize.getLocale()},Tabulator.prototype.getLang=function(t){return this.modules.localize.getLang(t)},Tabulator.prototype.redraw=function(t){this.columnManager.redraw(t),this.rowManager.redraw(t)},Tabulator.prototype.setHeight=function(t){"classic"!==this.rowManager.renderMode?(this.options.height=isNaN(t)?t:t+"px",this.element.style.height=this.options.height,this.rowManager.setRenderMode(),this.rowManager.redraw()):console.warn("setHeight function is not available in classic render mode")},Tabulator.prototype.setSort=function(t,e){this.modExists("sort",!0)&&(this.modules.sort.setSort(t,e),this.rowManager.sorterRefresh())},Tabulator.prototype.getSorters=function(){if(this.modExists("sort",!0))return this.modules.sort.getSort()},Tabulator.prototype.clearSort=function(){this.modExists("sort",!0)&&(this.modules.sort.clear(),this.rowManager.sorterRefresh())},Tabulator.prototype.setFilter=function(t,e,o,i){this.modExists("filter",!0)&&(this.modules.filter.setFilter(t,e,o,i),this.rowManager.filterRefresh())},Tabulator.prototype.addFilter=function(t,e,o,i){this.modExists("filter",!0)&&(this.modules.filter.addFilter(t,e,o,i),this.rowManager.filterRefresh())},Tabulator.prototype.getFilters=function(t){if(this.modExists("filter",!0))return this.modules.filter.getFilters(t)},Tabulator.prototype.setHeaderFilterFocus=function(t){if(this.modExists("filter",!0)){var e=this.columnManager.findColumn(t);if(!e)return console.warn("Column Filter Focus Error - No matching column found:",t),!1;this.modules.filter.setHeaderFilterFocus(e)}},Tabulator.prototype.getHeaderFilterValue=function(t){if(this.modExists("filter",!0)){var e=this.columnManager.findColumn(t);if(e)return this.modules.filter.getHeaderFilterValue(e);console.warn("Column Filter Error - No matching column found:",t)}},Tabulator.prototype.setHeaderFilterValue=function(t,e){if(this.modExists("filter",!0)){var o=this.columnManager.findColumn(t);if(!o)return console.warn("Column Filter Error - No matching column found:",t),!1;this.modules.filter.setHeaderFilterValue(o,e)}},Tabulator.prototype.getHeaderFilters=function(){if(this.modExists("filter",!0))return this.modules.filter.getHeaderFilters()},Tabulator.prototype.removeFilter=function(t,e,o){this.modExists("filter",!0)&&(this.modules.filter.removeFilter(t,e,o),this.rowManager.filterRefresh())},Tabulator.prototype.clearFilter=function(t){this.modExists("filter",!0)&&(this.modules.filter.clearFilter(t),this.rowManager.filterRefresh())},Tabulator.prototype.clearHeaderFilter=function(){this.modExists("filter",!0)&&(this.modules.filter.clearHeaderFilter(),this.rowManager.filterRefresh())},Tabulator.prototype.selectRow=function(t){this.modExists("selectRow",!0)&&(!0===t&&(console.warn("passing a boolean to the selectRowselectRow function is deprecated, you should now pass the string 'active'"),t="active"),this.modules.selectRow.selectRows(t))},Tabulator.prototype.deselectRow=function(t){this.modExists("selectRow",!0)&&this.modules.selectRow.deselectRows(t)},Tabulator.prototype.toggleSelectRow=function(t){this.modExists("selectRow",!0)&&this.modules.selectRow.toggleRow(t)},Tabulator.prototype.getSelectedRows=function(){if(this.modExists("selectRow",!0))return this.modules.selectRow.getSelectedRows()},Tabulator.prototype.getSelectedData=function(){if(this.modExists("selectRow",!0))return this.modules.selectRow.getSelectedData()},Tabulator.prototype.getInvalidCells=function(){if(this.modExists("validate",!0))return this.modules.validate.getInvalidCells()},Tabulator.prototype.clearCellValidation=function(t){var e=this;this.modExists("validate",!0)&&(t||(t=this.modules.validate.getInvalidCells()),Array.isArray(t)||(t=[t]),t.forEach(function(t){e.modules.validate.clearValidation(t._getSelf())}))},Tabulator.prototype.validate=function(t){var e=[];return this.rowManager.rows.forEach(function(t){var o=t.validate();!0!==o&&(e=e.concat(o))}),!e.length||e},Tabulator.prototype.setMaxPage=function(t){if(!this.options.pagination||!this.modExists("page"))return!1;this.modules.page.setMaxPage(t)},Tabulator.prototype.setPage=function(t){return this.options.pagination&&this.modExists("page")?this.modules.page.setPage(t):new Promise(function(t,e){e()})},Tabulator.prototype.setPageToRow=function(t){var e=this;return new Promise(function(o,i){e.options.pagination&&e.modExists("page")?(t=e.rowManager.findRow(t),t?e.modules.page.setPageToRow(t).then(function(){o()}).catch(function(){i()}):i()):i()})},Tabulator.prototype.setPageSize=function(t){if(!this.options.pagination||!this.modExists("page"))return!1;this.modules.page.setPageSize(t),this.modules.page.setPage(1).then(function(){}).catch(function(){})},Tabulator.prototype.getPageSize=function(){if(this.options.pagination&&this.modExists("page",!0))return this.modules.page.getPageSize()},Tabulator.prototype.previousPage=function(){if(!this.options.pagination||!this.modExists("page"))return!1;this.modules.page.previousPage()},Tabulator.prototype.nextPage=function(){if(!this.options.pagination||!this.modExists("page"))return!1;this.modules.page.nextPage()},Tabulator.prototype.getPage=function(){return!(!this.options.pagination||!this.modExists("page"))&&this.modules.page.getPage()},Tabulator.prototype.getPageMax=function(){return!(!this.options.pagination||!this.modExists("page"))&&this.modules.page.getPageMax()},Tabulator.prototype.setGroupBy=function(t){if(!this.modExists("groupRows",!0))return!1;this.options.groupBy=t,this.modules.groupRows.initialize(),this.rowManager.refreshActiveData("display"),this.options.persistence&&this.modExists("persistence",!0)&&this.modules.persistence.config.group&&this.modules.persistence.save("group")},Tabulator.prototype.setGroupStartOpen=function(t){if(!this.modExists("groupRows",!0))return!1;this.options.groupStartOpen=t,this.modules.groupRows.initialize(),this.options.groupBy?(this.rowManager.refreshActiveData("group"),this.options.persistence&&this.modExists("persistence",!0)&&this.modules.persistence.config.group&&this.modules.persistence.save("group")):console.warn("Grouping Update - cant refresh view, no groups have been set")},Tabulator.prototype.setGroupHeader=function(t){if(!this.modExists("groupRows",!0))return!1;this.options.groupHeader=t,this.modules.groupRows.initialize(),this.options.groupBy?(this.rowManager.refreshActiveData("group"),this.options.persistence&&this.modExists("persistence",!0)&&this.modules.persistence.config.group&&this.modules.persistence.save("group")):console.warn("Grouping Update - cant refresh view, no groups have been set")},Tabulator.prototype.getGroups=function(t){return!!this.modExists("groupRows",!0)&&this.modules.groupRows.getGroups(!0)},Tabulator.prototype.getGroupedData=function(){if(this.modExists("groupRows",!0))return this.options.groupBy?this.modules.groupRows.getGroupedData():this.getData()},Tabulator.prototype.getEditedCells=function(){if(this.modExists("edit",!0))return this.modules.edit.getEditedCells()},Tabulator.prototype.clearCellEdited=function(t){var e=this;this.modExists("edit",!0)&&(t||(t=this.modules.edit.getEditedCells()),Array.isArray(t)||(t=[t]),t.forEach(function(t){e.modules.edit.clearEdited(t._getSelf())}))},Tabulator.prototype.getCalcResults=function(){return!!this.modExists("columnCalcs",!0)&&this.modules.columnCalcs.getResults()},Tabulator.prototype.recalc=function(){this.modExists("columnCalcs",!0)&&this.modules.columnCalcs.recalcAll(this.rowManager.activeRows)},Tabulator.prototype.navigatePrev=function(){var t=!1;return!(!this.modExists("edit",!0)||!(t=this.modules.edit.currentCell))&&t.nav().prev()},Tabulator.prototype.navigateNext=function(){var t=!1;return!(!this.modExists("edit",!0)||!(t=this.modules.edit.currentCell))&&t.nav().next()},Tabulator.prototype.navigateLeft=function(){var t=!1;return!(!this.modExists("edit",!0)||!(t=this.modules.edit.currentCell))&&(e.preventDefault(),t.nav().left())},Tabulator.prototype.navigateRight=function(){var t=!1;return!(!this.modExists("edit",!0)||!(t=this.modules.edit.currentCell))&&(e.preventDefault(),t.nav().right())},Tabulator.prototype.navigateUp=function(){var t=!1;return!(!this.modExists("edit",!0)||!(t=this.modules.edit.currentCell))&&(e.preventDefault(),t.nav().up())},Tabulator.prototype.navigateDown=function(){var t=!1;return!(!this.modExists("edit",!0)||!(t=this.modules.edit.currentCell))&&(e.preventDefault(),t.nav().down())},Tabulator.prototype.undo=function(){ +return!(!this.options.history||!this.modExists("history",!0))&&this.modules.history.undo()},Tabulator.prototype.redo=function(){return!(!this.options.history||!this.modExists("history",!0))&&this.modules.history.redo()},Tabulator.prototype.getHistoryUndoSize=function(){return!(!this.options.history||!this.modExists("history",!0))&&this.modules.history.getHistoryUndoSize()},Tabulator.prototype.getHistoryRedoSize=function(){return!(!this.options.history||!this.modExists("history",!0))&&this.modules.history.getHistoryRedoSize()},Tabulator.prototype.download=function(t,e,o,i){this.modExists("download",!0)&&this.modules.download.download(t,e,o,i)},Tabulator.prototype.downloadToTab=function(t,e,o,i){this.modExists("download",!0)&&this.modules.download.download(t,e,o,i,!0)},Tabulator.prototype.tableComms=function(t,e,o,i){this.modules.comms.receive(t,e,o,i)},Tabulator.prototype.moduleBindings={},Tabulator.prototype.extendModule=function(t,e,o){if(Tabulator.prototype.moduleBindings[t]){var i=Tabulator.prototype.moduleBindings[t].prototype[e];if(i)if("object"==(void 0===o?"undefined":_typeof(o)))for(var n in o)i[n]=o[n];else console.warn("Module Error - Invalid value type, it must be an object");else console.warn("Module Error - property does not exist:",e)}else console.warn("Module Error - module does not exist:",t)},Tabulator.prototype.registerModule=function(t,e){Tabulator.prototype.moduleBindings[t]=e},Tabulator.prototype.bindModules=function(){this.modules={};for(var t in Tabulator.prototype.moduleBindings)this.modules[t]=new Tabulator.prototype.moduleBindings[t](this)},Tabulator.prototype.modExists=function(t,e){return!!this.modules[t]||(e&&console.error("Tabulator Module Not Installed: "+t),!1)},Tabulator.prototype.helpers={elVisible:function(t){return!(t.offsetWidth<=0&&t.offsetHeight<=0)},elOffset:function(t){var e=t.getBoundingClientRect();return{top:e.top+window.pageYOffset-document.documentElement.clientTop,left:e.left+window.pageXOffset-document.documentElement.clientLeft}},deepClone:function(t){var e=Array.isArray(t)?[]:{};for(var o in t)null!=t[o]&&"object"===_typeof(t[o])?t[o]instanceof Date?e[o]=new Date(t[o]):e[o]=this.deepClone(t[o]):e[o]=t[o];return e}},Tabulator.prototype.comms={tables:[],register:function(t){Tabulator.prototype.comms.tables.push(t)},deregister:function(t){var e=Tabulator.prototype.comms.tables.indexOf(t);e>-1&&Tabulator.prototype.comms.tables.splice(e,1)},lookupTable:function(t,e){var o,i,n=[];if("string"==typeof t){if(o=document.querySelectorAll(t),o.length)for(var l=0;l0?l.setWidth(n):l.reinitializeWidth()):this.table.options.responsiveLayout&&this.table.modExists("responsiveLayout",!0)&&this.table.modules.responsiveLayout.update()},fitColumns:function(t){function e(t){return"string"==typeof t?t.indexOf("%")>-1?n/100*parseInt(t):parseInt(t):t}function o(t,i,n,l){function s(t){return n*(t.column.definition.widthGrow||1)}function a(t){return e(t.width)-n*(t.column.definition.widthShrink||0)}var r=[],u=0,c=0,h=0,d=0,p=0,m=[];return t.forEach(function(t,e){var o=l?a(t):s(t);t.column.minWidth>=o?r.push(t):(m.push(t),p+=l?t.column.definition.widthShrink||1:t.column.definition.widthGrow||1)}),r.length?(r.forEach(function(t){u+=l?t.width-t.column.minWidth:t.column.minWidth,t.width=t.column.minWidth}),c=i-u,h=p?Math.floor(c/p):c,d=c-h*p,d+=o(m,c,h,l)):(d=p?i-Math.floor(i/p)*p:i,m.forEach(function(t){t.width=l?a(t):s(t)})),d}var i=this,n=i.table.element.clientWidth,l=0,s=0,a=0,r=0,u=[],c=[],h=0,d=0,p=0;this.table.options.responsiveLayout&&this.table.modExists("responsiveLayout",!0)&&this.table.modules.responsiveLayout.update(),this.table.rowManager.element.scrollHeight>this.table.rowManager.element.clientHeight&&(n-=this.table.rowManager.element.offsetWidth-this.table.rowManager.element.clientWidth),t.forEach(function(t){var o,i,n;t.visible&&(o=t.definition.width,i=parseInt(t.minWidth),o?(n=e(o),l+=n>i?n:i,t.definition.widthShrink&&(c.push({column:t,width:n>i?n:i}),h+=t.definition.widthShrink)):(u.push({column:t,width:0}),a+=t.definition.widthGrow||1))}),s=n-l,r=Math.floor(s/a);var p=o(u,s,r,!1);u.length&&p>0&&(u[u.length-1].width+=+p),u.forEach(function(t){s-=t.width}),d=Math.abs(p)+s,d>0&&h&&(p=o(c,d,Math.floor(d/h),!0)),c.length&&(c[c.length-1].width-=p),u.forEach(function(t){t.column.setWidth(t.width)}),c.forEach(function(t){t.column.setWidth(t.width)})}},Tabulator.prototype.registerModule("layout",Layout);var Localize=function(t){this.table=t,this.locale="default",this.lang=!1,this.bindings={}};Localize.prototype.setHeaderFilterPlaceholder=function(t){this.langs.default.headerFilters.default=t},Localize.prototype.setHeaderFilterColumnPlaceholder=function(t,e){this.langs.default.headerFilters.columns[t]=e,this.lang&&!this.lang.headerFilters.columns[t]&&(this.lang.headerFilters.columns[t]=e)},Localize.prototype.installLang=function(t,e){this.langs[t]?this._setLangProp(this.langs[t],e):this.langs[t]=e},Localize.prototype._setLangProp=function(t,e){for(var o in e)t[o]&&"object"==_typeof(t[o])?this._setLangProp(t[o],e[o]):t[o]=e[o]},Localize.prototype.setLocale=function(t){function e(t,o){for(var i in t)"object"==_typeof(t[i])?(o[i]||(o[i]={}),e(t[i],o[i])):o[i]=t[i]}var o=this;if(t=t||"default",!0===t&&navigator.language&&(t=navigator.language.toLowerCase()),t&&!o.langs[t]){var i=t.split("-")[0];o.langs[i]?(console.warn("Localization Error - Exact matching locale not found, using closest match: ",t,i),t=i):(console.warn("Localization Error - Matching locale not found, using default: ",t),t="default")}o.locale=t,o.lang=Tabulator.prototype.helpers.deepClone(o.langs.default||{}),"default"!=t&&e(o.langs[t],o.lang),o.table.options.localized.call(o.table,o.locale,o.lang),o._executeBindings()},Localize.prototype.getLocale=function(t){return self.locale},Localize.prototype.getLang=function(t){return t?this.langs[t]:this.lang},Localize.prototype.getText=function(t,e){var t=e?t+"|"+e:t,o=t.split("|");return this._getLangElement(o,this.locale)||""},Localize.prototype._getLangElement=function(t,e){var o=this,i=o.lang;return t.forEach(function(t){var e;i&&(e=i[t],i=void 0!==e&&e)}),i},Localize.prototype.bind=function(t,e){this.bindings[t]||(this.bindings[t]=[]),this.bindings[t].push(e),e(this.getText(t),this.lang)},Localize.prototype._executeBindings=function(){var t=this;for(var e in t.bindings)!function(e){t.bindings[e].forEach(function(o){o(t.getText(e),t.lang)})}(e)},Localize.prototype.langs={default:{groups:{item:"item",items:"items"},columns:{},ajax:{loading:"Loading",error:"Error"},pagination:{page_size:"Page Size",page_title:"Show Page",first:"First",first_title:"First Page",last:"Last",last_title:"Last Page",prev:"Prev",prev_title:"Prev Page",next:"Next",next_title:"Next Page",all:"All"},headerFilters:{default:"filter column...",columns:{}}}},Tabulator.prototype.registerModule("localize",Localize);var Comms=function(t){this.table=t};Comms.prototype.getConnections=function(t){var e,o=this,i=[];return e=Tabulator.prototype.comms.lookupTable(t),e.forEach(function(t){o.table!==t&&i.push(t)}),i},Comms.prototype.send=function(t,e,o,i){var n=this,l=this.getConnections(t);l.forEach(function(t){t.tableComms(n.table.element,e,o,i)}),!l.length&&t&&console.warn("Table Connection Error - No tables matching selector found",t)},Comms.prototype.receive=function(t,e,o,i){if(this.table.modExists(e))return this.table.modules[e].commsReceived(t,o,i);console.warn("Inter-table Comms Error - no such module:",e)},Tabulator.prototype.registerModule("comms",Comms); \ No newline at end of file diff --git a/admin/lib/composer.json b/admin/lib/composer.json new file mode 100644 index 0000000..d40c2ef --- /dev/null +++ b/admin/lib/composer.json @@ -0,0 +1,5 @@ +{ + "require":{ + "mustache/mustache":"2.13.0" + } +} \ No newline at end of file diff --git a/admin/lib/composer.lock b/admin/lib/composer.lock new file mode 100644 index 0000000..0b1a613 --- /dev/null +++ b/admin/lib/composer.lock @@ -0,0 +1,65 @@ +{ + "_readme": [ + "This file locks the dependencies of your project to a known state", + "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", + "This file is @generated automatically" + ], + "content-hash": "92525a9a1d7680bb4e3111b321d46087", + "packages": [ + { + "name": "mustache/mustache", + "version": "v2.13.0", + "source": { + "type": "git", + "url": "https://github.com/bobthecow/mustache.php.git", + "reference": "e95c5a008c23d3151d59ea72484d4f72049ab7f4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/bobthecow/mustache.php/zipball/e95c5a008c23d3151d59ea72484d4f72049ab7f4", + "reference": "e95c5a008c23d3151d59ea72484d4f72049ab7f4", + "shasum": "" + }, + "require": { + "php": ">=5.2.4" + }, + "require-dev": { + "friendsofphp/php-cs-fixer": "~1.11", + "phpunit/phpunit": "~3.7|~4.0|~5.0" + }, + "type": "library", + "autoload": { + "psr-0": { + "Mustache": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Justin Hileman", + "email": "justin@justinhileman.info", + "homepage": "http://justinhileman.com" + } + ], + "description": "A Mustache implementation in PHP.", + "homepage": "https://github.com/bobthecow/mustache.php", + "keywords": [ + "mustache", + "templating" + ], + "time": "2019-11-23T21:40:31+00:00" + } + ], + "packages-dev": [], + "aliases": [], + "minimum-stability": "stable", + "stability-flags": [], + "prefer-stable": false, + "prefer-lowest": false, + "platform": [], + "platform-dev": [], + "plugin-api-version": "1.1.0" +} diff --git a/admin/lib/config.php b/admin/lib/config.php new file mode 100644 index 0000000..9d3b7d3 --- /dev/null +++ b/admin/lib/config.php @@ -0,0 +1,29 @@ + "/oldbelladmin/", + "cookie" => "oldbell_lu", + "templatepath" => "tmpl/", + "db"=> array( + "type" => "pgsql", + "host" => "dedi1781.your-server.de", + "dbname" => "oldbell_db", + "user" => "oldbell_user", + "password" => "reLH2MgvEsnWNHcy", + ), + "appversion" => "1", + "minify" => "" + ); + + function getparams(){ + $get_arr = array(); + $xar = explode("&", $_SERVER['QUERY_STRING']); + print_r($xar); + if (count($xar) > 0){ + foreach (explode("&", $_SERVER['QUERY_STRING']) as $tmp_arr_param) { + $split_param = explode("=", $tmp_arr_param); + $get_arr[$split_param[0]] = urldecode($split_param[1]); + } + } + return $get_arr; + } +?> \ No newline at end of file diff --git a/admin/lib/database.php b/admin/lib/database.php new file mode 100644 index 0000000..3d5cb18 --- /dev/null +++ b/admin/lib/database.php @@ -0,0 +1,74 @@ +dbconf = $pdbconf; + try { + //'mysql:host=;dbname=', $user, password + //'sqlite:/opt/databases/mydb.sq3 + //pgsql:host=localhost;port=5432;dbname=testdb;user=bruce;password=mypass + $this->conn = new PDO($this->dbconf["type"].':host='.$this->dbconf["host"].';port=5432;dbname='.$this->dbconf["dbname"],$this->dbconf["user"],$this->dbconf["password"]); + } catch(PDOException $e){ + // fwrite(STDERR, "Connectio Error: ".$e->getMessage()."\n"); + } + } + + public function securetext($text){ + return str_replace("'","''",$text); + } + public function value($text){ + if (($text == "") || ($text == null)){ + return 'null'; + } + return "'".$text."'"; + } + + public function query($sql){ + try { + // fwrite(STDERR, "QUERY: ".$sql."\n"); + if ($this->conn){ + return $this->conn->query($sql); + } + } catch(PDOException $e){ + // fwrite(STDERR, "QUERY ERROR: ".$sql."\n"); + } + return null; + } + + public function queryarray($sql){ + $result = null; + try { + if ($this->conn){ + $sth = $this->link->prepare($sql); + $sth->execute(); + $result = $sth->fetchAll(PDO::FETCH_ASSOC); + return $result; + } + } catch (PDOException $e){ + // fwrite(STDERR, "QUERYARRAY ERROR: ".$sql."\n"); + } + return $result; + } + + public function exec($sql){ + try { + if ($this->conn){ + return $this->exec($sql); + } + } catch (PDOException $e){ + // fwrite(STDERR, "EXEC ERROR: ".$sql."\n"); + } + return -1; + } + + public function newuuid(){ + $nid = $this->query("SELECT uuid_in(md5(random()::text || clock_timestamp()::text)::cstring) as id"); + return $nid["id"]; + } + + public function __destruct(){ + $this->conn = null; + } +} +?> \ No newline at end of file diff --git a/admin/lib/session.php b/admin/lib/session.php new file mode 100644 index 0000000..1092b79 --- /dev/null +++ b/admin/lib/session.php @@ -0,0 +1,35 @@ +dbh = $dblink; + } + + public function getSession($sid){ + if (($sid !== null) && ($sid != "")){ + $this->session = $this->dbh->query("select * from public.sessions where id='".$sid."' and remote_addr='".$_SERVER["REMOTE_ADDR"]."';"); + } + return $this->session; + } + + public function checkLogin($username,$password,$cookiename){ + $encpwd = hash('sha256', trim($password)); + //echo "select id,username,usergroup from public.users where username='".$username."' and password='".$encpwd."';\n"; + $auth = $this->dbh->query("select id,username,usergroup from public.users where username='".$username."' and password='".$encpwd."';"); + + if ($auth){ + $nuuid = $this->dbh->newuuid(); + + $this->dbh->exec("INSERT INTO public.sessions (id,id_user,remote_addr,user_agent) VALUES ('".$nuuid."','".$auth['id']."','".$_SERVER["REMOTE_ADDR"]."','".$_SERVER["HTTP_USER_AGENT"]."');"); + setcookie($cookiename,$nuuid,0,"/",null,0,1); + return $this->getSession($nuuid); + } + return null; + } + + public function __destruct(){ + $this->conn = null; + } +} +?> \ No newline at end of file diff --git a/admin/lib/web/galleries.php b/admin/lib/web/galleries.php new file mode 100644 index 0000000..e69de29 diff --git a/admin/lib/web/rendezvous.php b/admin/lib/web/rendezvous.php new file mode 100644 index 0000000..e69de29 diff --git a/admin/lib/web/websites.php b/admin/lib/web/websites.php new file mode 100644 index 0000000..e69de29 diff --git a/admin/tmpl/.htaccess b/admin/tmpl/.htaccess new file mode 100644 index 0000000..908fc52 --- /dev/null +++ b/admin/tmpl/.htaccess @@ -0,0 +1,5 @@ +#RewriteEngine On +#RewriteBase / +#RewriteCond %{HTTP_COOKIE} !potlu= [NC] +#RewriteRule .* "%{REQUEST_SCHEME}://%{HTTP_HOST}/backoffice/login.html" [L] +Require all denied \ No newline at end of file diff --git a/admin/tmpl/index.html.mustache b/admin/tmpl/index.html.mustache new file mode 100644 index 0000000..26a9788 --- /dev/null +++ b/admin/tmpl/index.html.mustache @@ -0,0 +1,55 @@ + + + + + + Website Admin + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ {{ pagedata }} +
+ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/admin/tmpl/login.html.mustache b/admin/tmpl/login.html.mustache new file mode 100644 index 0000000..2c812f2 --- /dev/null +++ b/admin/tmpl/login.html.mustache @@ -0,0 +1,66 @@ + + + + + + + + + POT - Plan d'organisation du travail + + + + + + + + + + + + + + + + + + + + +
+ +
+
  +
+
+
+ logo +
+
+ {{pagedata}} +
+ +
+
  +
+
+ +
+ + + diff --git a/admin/tmpl/pages/error.html.mustache b/admin/tmpl/pages/error.html.mustache new file mode 100644 index 0000000..31ab5ed --- /dev/null +++ b/admin/tmpl/pages/error.html.mustache @@ -0,0 +1,2 @@ +

Cette page n'existe pas!

+
{{config}}
\ No newline at end of file diff --git a/admin/tmpl/pages/galleries.html.mustache b/admin/tmpl/pages/galleries.html.mustache new file mode 100644 index 0000000..e69de29 diff --git a/admin/tmpl/pages/home.html.mustache b/admin/tmpl/pages/home.html.mustache new file mode 100644 index 0000000..e69de29 diff --git a/admin/tmpl/pages/login/forgotpassword.html.mustache b/admin/tmpl/pages/login/forgotpassword.html.mustache new file mode 100644 index 0000000..3205836 --- /dev/null +++ b/admin/tmpl/pages/login/forgotpassword.html.mustache @@ -0,0 +1,20 @@ +
+

Mot de passe oublié?

+
Demander un nouveau mot de passe
+
+
+
+ + + + +
+ +
+ +
+ + +
\ No newline at end of file diff --git a/admin/tmpl/pages/login/login.html.mustache b/admin/tmpl/pages/login/login.html.mustache new file mode 100644 index 0000000..3ab8836 --- /dev/null +++ b/admin/tmpl/pages/login/login.html.mustache @@ -0,0 +1,23 @@ +
+

Accès Client

+
+
+
+ + +
+
+ + +
+
+ +
+ + +
+ +
+
\ No newline at end of file diff --git a/admin/tmpl/pages/login/message.html.mustache b/admin/tmpl/pages/login/message.html.mustache new file mode 100644 index 0000000..e9d05ec --- /dev/null +++ b/admin/tmpl/pages/login/message.html.mustache @@ -0,0 +1,7 @@ +
[% message %]
+ +
+ +
\ No newline at end of file diff --git a/admin/tmpl/pages/orders.html.mustache b/admin/tmpl/pages/orders.html.mustache new file mode 100644 index 0000000..e69de29 diff --git a/admin/tmpl/pages/rdvconfig.html.mustache b/admin/tmpl/pages/rdvconfig.html.mustache new file mode 100644 index 0000000..e69de29 diff --git a/admin/tmpl/pages/rendezvous.html.mustache b/admin/tmpl/pages/rendezvous.html.mustache new file mode 100644 index 0000000..e69de29 diff --git a/admin/tmpl/pages/shop.html.mustache b/admin/tmpl/pages/shop.html.mustache new file mode 100644 index 0000000..e69de29 diff --git a/admin/upload.php b/admin/upload.php new file mode 100644 index 0000000..e69de29 diff --git a/oldwebsite/img/logo1.png b/oldwebsite/img/logo1.png new file mode 100644 index 0000000..a8516a4 Binary files /dev/null and b/oldwebsite/img/logo1.png differ diff --git a/website/css/fonts/ledf.svg b/website/css/fonts/ledf.svg deleted file mode 100644 index 30121bb..0000000 --- a/website/css/fonts/ledf.svg +++ /dev/null @@ -1,15 +0,0 @@ - - - -Generated by IcoMoon - - - - - - - - - - - \ No newline at end of file diff --git a/website/css/fonts/ledf.ttf b/website/css/fonts/ledf.ttf deleted file mode 100644 index ac8e4b1..0000000 Binary files a/website/css/fonts/ledf.ttf and /dev/null differ diff --git a/website/css/fonts/ledf.woff b/website/css/fonts/ledf.woff deleted file mode 100644 index ba03696..0000000 Binary files a/website/css/fonts/ledf.woff and /dev/null differ diff --git a/website/css/fonts/siteicons.svg b/website/css/fonts/siteicons.svg new file mode 100644 index 0000000..5c2d6d6 --- /dev/null +++ b/website/css/fonts/siteicons.svg @@ -0,0 +1,70 @@ + + + + + + +{ + "fontFamily": "siteicons", + "majorVersion": 1, + "minorVersion": 0, + "version": "Version 1.0", + "fontId": "siteicons", + "psName": "siteicons", + "subFamily": "Regular", + "fullName": "siteicons", + "description": "Font generated by IcoMoon." +} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/website/css/fonts/siteicons.ttf b/website/css/fonts/siteicons.ttf new file mode 100644 index 0000000..0b612cc Binary files /dev/null and b/website/css/fonts/siteicons.ttf differ diff --git a/website/css/fonts/siteicons.woff b/website/css/fonts/siteicons.woff new file mode 100644 index 0000000..3089162 Binary files /dev/null and b/website/css/fonts/siteicons.woff differ diff --git a/website/css/icons.css b/website/css/icons.css index 787a144..4a08fb1 100644 --- a/website/css/icons.css +++ b/website/css/icons.css @@ -1,9 +1,9 @@ @font-face { - font-family: 'ledf'; + font-family: 'siteicons'; src: - url('fonts/ledf.ttf?d9kavb') format('truetype'), - url('fonts/ledf.woff?d9kavb') format('woff'), - url('fonts/ledf.svg?d9kavb#ledf') format('svg'); + url('fonts/siteicons.ttf?2p3ux7') format('truetype'), + url('fonts/siteicons.woff?2p3ux7') format('woff'), + url('fonts/siteicons.svg?2p3ux7#siteicons') format('svg'); font-weight: normal; font-style: normal; font-display: block; @@ -11,7 +11,7 @@ [class^="icon-"], [class*=" icon-"] { /* use !important to prevent issues with browser extensions that change fonts */ - font-family: 'ledf' !important; + font-family: 'siteicons' !important; speak: never; font-style: normal; font-weight: normal; @@ -24,18 +24,135 @@ -moz-osx-font-smoothing: grayscale; } +.icon-home:before { + content: "\e900"; +} +.icon-image:before { + content: "\e90d"; +} +.icon-images:before { + content: "\e90e"; +} +.icon-camera:before { + content: "\e90f"; +} +.icon-play:before { + content: "\e912"; +} +.icon-film:before { + content: "\e913"; +} +.icon-profile:before { + content: "\e923"; +} +.icon-file-picture:before { + content: "\e927"; +} +.icon-file-play:before { + content: "\e929"; +} +.icon-copy:before { + content: "\e92c"; +} +.icon-paste:before { + content: "\e92d"; +} +.icon-cart:before { + content: "\e93a"; +} +.icon-coin-euro:before { + content: "\e93c"; +} +.icon-credit-card:before { + content: "\e93f"; +} +.icon-phone:before { + content: "\e942"; +} .icon-envelop:before { content: "\e945"; } +.icon-pushpin:before { + content: "\e946"; +} .icon-location:before { content: "\e947"; } .icon-map2:before { content: "\e94c"; } +.icon-clock:before { + content: "\e94e"; +} .icon-calendar:before { content: "\e953"; } +.icon-box-add:before { + content: "\e95e"; +} +.icon-download:before { + content: "\e960"; +} .icon-menu:before { content: "\e9bd"; } +.icon-cross:before { + content: "\ea0f"; +} +.icon-checkmark:before { + content: "\ea10"; +} +.icon-arrow-right:before { + content: "\ea34"; +} +.icon-arrow-down:before { + content: "\ea36"; +} +.icon-arrow-left:before { + content: "\ea38"; +} +.icon-arrow-right2:before { + content: "\ea3c"; +} +.icon-arrow-left2:before { + content: "\ea40"; +} +.icon-circle-right:before { + content: "\ea42"; +} +.icon-circle-left:before { + content: "\ea44"; +} +.icon-checkbox-checked:before { + content: "\ea52"; +} +.icon-checkbox-unchecked:before { + content: "\ea53"; +} +.icon-section:before { + content: "\ea76"; +} +.icon-share:before { + content: "\ea7d"; +} +.icon-new-tab:before { + content: "\ea7e"; +} +.icon-mail:before { + content: "\ea83"; +} +.icon-facebook2:before { + content: "\ea91"; +} +.icon-instagram:before { + content: "\ea92"; +} +.icon-whatsapp:before { + content: "\ea93"; +} +.icon-twitter:before { + content: "\ea96"; +} +.icon-youtube:before { + content: "\ea9d"; +} diff --git a/website/css/style.css b/website/css/style.css index 959e755..93157a5 100644 --- a/website/css/style.css +++ b/website/css/style.css @@ -1,6 +1,6 @@ -body { +/* body { font-family: sans-serif; -} +} */ /* Make content area fill the entire browser window */ html, @@ -12,7 +12,7 @@ html, width: 100%; } -/* Center the content in the browser window */ +/* Center the content in the browser window .container { margin: auto; text-align: center; @@ -20,4 +20,4 @@ html, .title { font-size: 3rem; -} +} */ diff --git a/website/css/theme.css b/website/css/theme.css index 2b61b8b..e1e6f53 100644 --- a/website/css/theme.css +++ b/website/css/theme.css @@ -25,9 +25,9 @@ legend{color:inherit;display:table;max-width:100%;padding:0;white-space:normal}t [type=search]::-webkit-search-decoration{-webkit-appearance:none} ::-webkit-file-upload-button{-webkit-appearance:button;font:inherit} /* End extract */ -/* html,body { - background-color: #52638e; -} */ +html ,body { + background-color: #faeddd; +} html,body{font-family:Verdana,sans-serif;font-size:9pt;line-height:1.5}html{overflow-x:hidden} h1{font-size:36px}h2{font-size:30px}h3{font-size:24px}h4{font-size:20px}h5{font-size:18px}h6{font-size:16px}.serif{font-family:serif} h1,h2,h3,h4,h5,h6{font-family:"Segoe UI",Arial,sans-serif;font-weight:400;margin: 0}.wide{letter-spacing:4px} @@ -50,16 +50,26 @@ hr{border:0;border-top:1px solid #eee;margin:20px 0} .ripple:active{opacity:0.5}.ripple{transition:opacity 0s} .input{padding:2px;display:block;border: 0;border-bottom: 1px solid #ccc;width:100%;background-color: #fff;}/*#e8f0fe*/ .select{padding:2px 0; display:block;width:100%;border:1px solid #ccc;background-color: #fff;} +.check,.radio{width:24px;height:24px;position:relative;top:6px} +.sidebar{height:100%;width:160px;background-color:#fff;position:fixed!important;z-index:1;overflow:auto} .dropdown-click,.dropdown-hover{position:relative;display:inline-block;cursor:pointer} .dropdown-hover:hover .dropdown-content{display:block; } .dropdown-hover:first-child,.dropdown-click:hover{background-color:#ccc;color:#000} .dropdown-hover:hover > .button:first-child,.dropdown-click:hover > .button:first-child{background-color:#ccc;color:#000} .dropdown-content{cursor:auto;color:#000;background-color:#fff;display:none;position:absolute;min-width:160px;margin:0;padding:0;z-index:1} -.check,.radio{width:24px;height:24px;position:relative;top:6px} -.sidebar{height:100%;width:160px;background-color:#fff;position:fixed!important;z-index:1;overflow:auto} .bar-block .dropdown-hover,.bar-block .dropdown-click{width:100%} .bar-block .dropdown-hover .dropdown-content,.bar-block .dropdown-click .dropdown-content{min-width:100%} .bar-block .dropdown-hover .button,.bar-block .dropdown-click .button{width:100%;text-align:left;padding:8px 16px} + +.dropup-click,.dropup-hover{position:relative;display:inline-block;cursor:pointer} +.dropup-hover:hover .dropup-content{display:block; } +.dropup-hover:first-child,.dropup-click:hover{background-color:#ccc;color:#000} +.dropup-hover:hover > .button:first-child,.dropup-click:hover > .button:first-child{background-color:#ccc;color:#000} +.dropup-content{cursor:auto;color:#000;background-color:#fff;display:none;position:absolute;min-width:160px;bottom:70px;padding:0;z-index:1} +.bar-block .dropup-hover,.bar-block .dropup-click{width:100%} +.bar-block .dropup-hover .dropup-content,.bar-block .dropup-click .dropup-content{min-width:100%} +.bar-block .dropup-hover .button,.bar-block .dropup-click .button{width:100%;text-align:left;padding:8px 16px} + .main,#main{transition:margin-left .4s} .modal{z-index:3;display:none;padding-top:100px;position:fixed;left:0;top:0;width:100%;height:100%;overflow:auto;background-color:rgb(0,0,0);background-color:rgba(0,0,0,0.4)} .modal-content{margin:auto;background-color:#fff;position:relative;padding:0;outline:0;width:600px} @@ -70,6 +80,7 @@ hr{border:0;border-top:1px solid #eee;margin:20px 0} .bar-block .bar-item{width:100%;display:block;padding:8px 16px;text-align:left;border:none;white-space:normal;float:none;outline:0} .bar-block.center .bar-item{text-align:center}.block{display:block;width:100%} .responsive{display:block;overflow-x:auto} +.panel{ width: 100%;} .container:after,.container:before,.datapanel:after,.datapanel:before,.row:after,.row:before,.row-padding:after,.row-padding:before, .cell-row:before,.cell-row:after,.clear:after,.clear:before,.bar:before,.bar:after{content:"";display:table;clear:both} .col,.half,.third,.twothird,.threequarter,.quarter,.fifth,.twofifth,.threefifth,.fourfifth{float:left;width:100%} @@ -146,117 +157,13 @@ hr{border:0;border-top:1px solid #eee;margin:20px 0} .padding-32{padding-top:32px!important;padding-bottom:32px!important}.padding-48{padding-top:48px!important;padding-bottom:48px!important} .padding-64{padding-top:64px!important;padding-bottom:64px!important} .left{float:left!important}.right{float:right!important} -.button:hover{color:#fff!important;background-color:#343434!important} +.button:hover{color:#fff!important;background-color:#ca050f!important} .transparent,.hover-none:hover{background-color:transparent!important} .hover-none:hover{box-shadow:none!important} /* DEFAULT COLORS */ -.amber,.hover-amber:hover{color:#000!important;background-color:#ffc107!important} -.aqua,.hover-aqua:hover{color:#000!important;background-color:#00ffff!important} -.blue,.hover-blue:hover{color:#fff!important;background-color:#2196F3!important} -.light-blue,.hover-light-blue:hover{color:#000!important;background-color:#87CEEB!important} -.brown,.hover-brown:hover{color:#fff!important;background-color:#795548!important} -.cyan,.hover-cyan:hover{color:#000!important;background-color:#00bcd4!important} -.blue-grey,.hover-blue-grey:hover{color:#fff!important;background-color:#607d8b!important} -.green,.hover-green:hover{color:#fff!important;background-color:#4CAF50!important} -.light-green,.hover-light-green:hover{color:#000!important;background-color:#8bc34a!important} -.indigo,.hover-indigo:hover{color:#fff!important;background-color:#3f51b5!important} -.khaki,.hover-khaki:hover{color:#000!important;background-color:#f0e68c!important} -.lime,.hover-lime:hover{color:#000!important;background-color:#cddc39!important} -.orange,.hover-orange:hover{color:#000!important;background-color:#ff9800!important} -.deep-orange,.hover-deep-orange:hover{color:#fff!important;background-color:#ff5722!important} -.pink,.hover-pink:hover{color:#fff!important;background-color:#e91e63!important} -.purple,.hover-purple:hover{color:#fff!important;background-color:#9c27b0!important} -.deep-purple,.hover-deep-purple:hover{color:#fff!important;background-color:#673ab7!important} -.red,.hover-red:hover{color:#fff!important;background-color:#f44336!important} -.sand,.hover-sand:hover{color:#000!important;background-color:#fdf5e6!important} -.teal,.hover-teal:hover{color:#fff!important;background-color:#009688!important} -.yellow,.hover-yellow:hover{color:#000!important;background-color:#ffeb3b!important} -.white,.hover-white:hover{color:#000!important;background-color:#fff!important} -.black,.hover-black:hover{color:#fff!important;background-color:#000!important} -.grey,.hover-grey:hover{color:#000!important;background-color:#c6c6c6!important} -.light-grey,.hover-light-grey:hover{color:#000!important;background-color:#f1f1f1!important} -.dark-grey,.hover-dark-grey:hover{color:#fff!important;background-color:#616161!important} -.pale-red,.hover-pale-red:hover{color:#000!important;background-color:#ffe7e7!important}.pale-green,.hover-pale-green:hover{color:#000!important;background-color:#e7ffe7!important} -.pale-yellow,.hover-pale-yellow:hover{color:#000!important;background-color:#ffffd7!important}.pale-blue,.hover-pale-blue:hover{color:#000!important;background-color:#e7ffff!important} -.text-align-right { text-align: right;} -.text-amber,.hover-text-amber:hover{color:#ffc107!important} -.text-aqua,.hover-text-aqua:hover{color:#00ffff!important} -.text-blue,.hover-text-blue:hover{color:#2196F3!important} -.text-light-blue,.hover-text-light-blue:hover{color:#87CEEB!important} -.text-brown,.hover-text-brown:hover{color:#795548!important} -.text-cyan,.hover-text-cyan:hover{color:#00bcd4!important} -.text-blue-grey,.hover-text-blue-grey:hover{color:#607d8b!important} -.text-green,.hover-text-green:hover{color:#4CAF50!important} -.text-light-green,.hover-text-light-green:hover{color:#8bc34a!important} -.text-indigo,.hover-text-indigo:hover{color:#3f51b5!important} -.text-khaki,.hover-text-khaki:hover{color:#b4aa50!important} -.text-lime,.hover-text-lime:hover{color:#cddc39!important} -.text-orange,.hover-text-orange:hover{color:#ff9800!important} -.text-deep-orange,.hover-text-deep-orange:hover{color:#ff5722!important} -.text-pink,.hover-text-pink:hover{color:#e91e63!important} -.text-purple,.hover-text-purple:hover{color:#9c27b0!important} -.text-deep-purple,.hover-text-deep-purple:hover{color:#673ab7!important} -.text-red,.hover-text-red:hover{color:#f44336!important} -.text-sand,.hover-text-sand:hover{color:#fdf5e6!important} -.text-teal,.hover-text-teal:hover{color:#009688!important} -.text-yellow,.hover-text-yellow:hover{color:#d2be0e!important} -.text-white,.hover-text-white:hover{color:#fff!important} -.text-black,.hover-text-black:hover{color:#000!important} -.text-grey,.hover-text-grey:hover{color:#757575!important} -.text-light-grey,.hover-text-light-grey:hover{color:#f1f1f1!important} -.text-dark-grey,.hover-text-dark-grey:hover{color:#3a3a3a!important} -.border-amber,.hover-border-amber:hover{border-color:#ffc107!important} -.border-aqua,.hover-border-aqua:hover{border-color:#00ffff!important} -.border-blue,.hover-border-blue:hover{border-color:#2196F3!important} -.border-light-blue,.hover-border-light-blue:hover{border-color:#87CEEB!important} -.border-brown,.hover-border-brown:hover{border-color:#795548!important} -.border-cyan,.hover-border-cyan:hover{border-color:#00bcd4!important} -.border-blue-grey,.hover-blue-grey:hover{border-color:#607d8b!important} -.border-green,.hover-border-green:hover{border-color:#4CAF50!important} -.border-light-green,.hover-border-light-green:hover{border-color:#8bc34a!important} -.border-indigo,.hover-border-indigo:hover{border-color:#3f51b5!important} -.border-khaki,.hover-border-khaki:hover{border-color:#f0e68c!important} -.border-lime,.hover-border-lime:hover{border-color:#cddc39!important} -.border-orange,.hover-border-orange:hover{border-color:#ff9800!important} -.border-deep-orange,.hover-border-deep-orange:hover{border-color:#ff5722!important} -.border-pink,.hover-border-pink:hover{border-color:#e91e63!important} -.border-purple,.hover-border-purple:hover{border-color:#9c27b0!important} -.border-deep-purple,.hover-border-deep-purple:hover{border-color:#673ab7!important} -.border-red,.hover-border-red:hover{border-color:#f44336!important} -.border-sand,.hover-border-sand:hover{border-color:#fdf5e6!important} -.border-teal,.hover-border-teal:hover{border-color:#009688!important} -.border-yellow,.hover-border-yellow:hover{border-color:#ffeb3b!important} -.border-white,.hover-border-white:hover{border-color:#fff!important} -.border-black,.hover-border-black:hover{border-color:#000!important} -.border-grey,.hover-border-grey:hover{border-color:#9e9e9e!important} -.border-light-grey,.hover-border-light-grey:hover{border-color:#f1f1f1!important} -.border-dark-grey,.hover-border-dark-grey:hover{border-color:#616161!important} -.border-pale-red,.hover-border-pale-red:hover{border-color:#ffe7e7!important}.border-pale-green,.hover-border-pale-green:hover{border-color:#e7ffe7!important} -.border-pale-yellow,.hover-border-pale-yellow:hover{border-color:#ffffd7!important}.border-pale-blue,.hover-border-pale-blue:hover{border-color:#e7ffff!important} -/* DEFAULT THEME */ -.theme-l5 {color:#000 !important; background-color:#f6f8fc !important} -.theme-l4 {color:#000 !important; background-color:#e1e9f6 !important} -.theme-l3 {color:#000 !important; background-color:#c3d3ed !important} -.theme-l2 {color:#000 !important; background-color:#a5bee4 !important} -.theme-l1 {color:#fff !important; background-color:#88a8db !important} -.theme-d1 {color:#fff !important; background-color:#5180cb !important} -.theme-d2 {color:#fff !important; background-color:#3a6fc3 !important} -.theme-d3 {color:#fff !important; background-color:#3361aa !important} -.theme-d4 {color:#fff !important; background-color:#2c5392 !important} -.theme-d5 {color:#fff !important; background-color:#24457a !important} - -.theme-light {color:#000 !important; background-color:#f6f8fc !important} -.theme-dark {color:#fff !important; background-color:#24457a !important} -.theme-action {color:#fff !important; background-color:#24457a !important} - -.theme {color:#fff !important; background-color:#6a92d3 !important} -.text-theme {color:#6a92d3 !important} -.border-theme {border-color:#6a92d3 !important} - -.hover-theme:hover {color:#fff !important; background-color:#6a92d3 !important} -.hover-text-theme:hover {color:#6a92d3 !important} -.hover-border-theme:hover {border-color:#6a92d3 !important} - +.red-gold,.hover-red-gold{color: #b0834c;background-color: #c42027;} +.gold-white,.hover-gold-white{background-color: #b0834c;color: #fff;} +.text-white { color: #fff;} /* .label { color: #000; font-size: 8pt;} */ /* #main {margin-left: 210px;} */ /* @media (max-width:768px){ @@ -561,7 +468,7 @@ button.Button_ImgPlacer .inner_border div.PageHeadTitle { font-size: 18pt; - color: #fff; + color: #b0834c; } div.ListView_SectionHeader @@ -987,4 +894,13 @@ input[type="time"]::-webkit-calendar-picker-indicator { .border-bottom { border-bottom: 2px solid #00bcd4; +} + +html, +.fullscreen { + display: flex; + height: 100%; + margin: 0; + padding: 0; + width: 100%; } \ No newline at end of file diff --git a/website/img/IMG_20201029_105226.jpg b/website/img/IMG_20201029_105226.jpg new file mode 100644 index 0000000..cefd546 Binary files /dev/null and b/website/img/IMG_20201029_105226.jpg differ diff --git a/website/img/dose.jpg b/website/img/dose.jpg new file mode 100644 index 0000000..d858075 Binary files /dev/null and b/website/img/dose.jpg differ diff --git a/website/img/favicon/manifest.json b/website/img/favicon/manifest.json index 013d4a6..dd3947d 100644 --- a/website/img/favicon/manifest.json +++ b/website/img/favicon/manifest.json @@ -1,41 +1,40 @@ { - "name": "App", + "name": "OldBell", "icons": [ { - "src": "\/android-icon-36x36.png", + "src": "android-icon-36x36.png", "sizes": "36x36", - "type": "image\/png", - "density": "0.75" + "type": "image/png" }, { - "src": "\/android-icon-48x48.png", + "src": "android-icon-48x48.png", "sizes": "48x48", - "type": "image\/png", - "density": "1.0" + "type": "image/png" }, { - "src": "\/android-icon-72x72.png", + "src": "android-icon-72x72.png", "sizes": "72x72", - "type": "image\/png", - "density": "1.5" + "type": "image/png" }, { - "src": "\/android-icon-96x96.png", + "src": "android-icon-96x96.png", "sizes": "96x96", - "type": "image\/png", - "density": "2.0" + "type": "image/png" }, { - "src": "\/android-icon-144x144.png", + "src": "android-icon-144x144.png", "sizes": "144x144", - "type": "image\/png", - "density": "3.0" + "type": "image/png" }, { - "src": "\/android-icon-192x192.png", + "src": "android-icon-192x192.png", "sizes": "192x192", - "type": "image\/png", - "density": "4.0" + "type": "image/png" } - ] + ], + "lang": "fr-FR", + "start_url": "http://dks-laptop/oldbell_lu/index.html", + "display": "standalone", + "background_color": "white", + "theme_color": "white" } \ No newline at end of file diff --git a/website/img/logo.png b/website/img/logo.png new file mode 100644 index 0000000..a0061fd Binary files /dev/null and b/website/img/logo.png differ diff --git a/website/img/logo1.png b/website/img/logo1.png new file mode 100644 index 0000000..5570514 Binary files /dev/null and b/website/img/logo1.png differ diff --git a/website/img/thumb.jpg b/website/img/thumb.jpg new file mode 100644 index 0000000..0813018 Binary files /dev/null and b/website/img/thumb.jpg differ diff --git a/website/img/wood-pattern.jpg b/website/img/wood-pattern.jpg new file mode 100644 index 0000000..9be9efe Binary files /dev/null and b/website/img/wood-pattern.jpg differ diff --git a/website/index.php b/website/index.php index 0feadc8..8255193 100644 --- a/website/index.php +++ b/website/index.php @@ -8,7 +8,13 @@ $vars = array(); $vars["page"] = 'home.html'; if ($_SERVER["REQUEST_URI"] != $cfg["basepath"]){ - $vars["filepath"] = $_SERVER["REQUEST_URI"]; + if (strpos($_SERVER["REQUEST_URI"], ".html?") === false){ + $vars["filepath"] = $_SERVER["REQUEST_URI"]; + }else { + $vars["filepath"] = substr($_SERVER["REQUEST_URI"],0,strpos($_SERVER["REQUEST_URI"],".html?")).".html"; + } + + $vars["params"] = getparams(); $vars["page"] = substr($vars["filepath"],strlen($cfg["basepath"])); } $vars["contenttype"] = "text/html"; @@ -23,9 +29,9 @@ { $vars["page"] = 'error.html'; } - if (file_exists($cfg["templatepath"].'/pages/'.$vars["page"].'json')){ + if (file_exists($cfg["templatepath"].'/pages/'.$vars["page"].'.json')){ $db = new database($cfg["db"]); - $tmpdata = file_get_contents($cfg["templatepath"].'/pages/'.$vars["page"].'json'); + $tmpdata = file_get_contents($cfg["templatepath"].'/pages/'.$vars["page"].'.json'); try { $vars["data"] = json_decode($tmpdata,true); foreach ($vars["data"] as $key => $value) { @@ -57,5 +63,5 @@ $mainsite = $m->render('index.html',$vars); echo $mainsite; - // echo "
".print_r($vars).print_r($_SERVER["REQUEST_URI"])."
"; + //echo "
".print_r($vars).print_r($_SERVER["REQUEST_URI"]).print_r($vars)."
"; ?> \ No newline at end of file diff --git a/website/info.php b/website/info.php new file mode 100644 index 0000000..3c256a4 --- /dev/null +++ b/website/info.php @@ -0,0 +1,4 @@ +".print_r($vars).print_r($_SERVER["REQUEST_URI"]).""; +?> \ No newline at end of file diff --git a/website/js/gallery.js b/website/js/gallery.js new file mode 100644 index 0000000..e69de29 diff --git a/website/js/rendezvous.js b/website/js/rendezvous.js new file mode 100644 index 0000000..ec2700f --- /dev/null +++ b/website/js/rendezvous.js @@ -0,0 +1,11 @@ +let rendezvous = { + tblproducts: null, + tbldates: null, + tblhours:null, + viewpanel: function(id){ + + }, + init: function(){ + + } +} \ No newline at end of file diff --git a/website/js/shop.js b/website/js/shop.js new file mode 100644 index 0000000..e69de29 diff --git a/website/js/site.js b/website/js/site.js index 952426e..d3b454a 100644 --- a/website/js/site.js +++ b/website/js/site.js @@ -1,8 +1,43 @@ -function togglemenu(){ - var mnu = document.getElementById("mobilemenu"); - if (mnu.style.display == 'none'){ - mnu.style.display = 'block'; - } else { - mnu.style.display = 'none'; +// function togglemenu(){ +// var mnu = document.getElementById("mobilemenu"); +// if (mnu.style.display == 'none'){ +// mnu.style.display = 'block'; +// } else { +// mnu.style.display = 'none'; +// } +// } + +function hideAddressBar(){ + if(document.documentElement.scrollHeight { + 'use strict'; + + if ('serviceWorker' in navigator) { + navigator.serviceWorker + .register('./js/sw.js'); + } +} + +function dropdown(drdid){ + var x = document.getElementById(drdid); + if (x.className.indexOf("show") == -1) { + x.className += " show"; + } else { + x.className = x.className.replace(" show", ""); + } +} + +function dropup(drdid){ + var x = document.getElementById(drdid); + if (x.className.indexOf("show") == -1) { + x.className += " show"; + } else { + x.className = x.className.replace(" show", ""); } } \ No newline at end of file diff --git a/website/js/sw.js b/website/js/sw.js index 6730c5d..872158d 100644 --- a/website/js/sw.js +++ b/website/js/sw.js @@ -1,9 +1,14 @@ -var cacheName = 'hello-pwa'; +var cacheName = 'oldbell-pwa'; var filesToCache = [ - '/', - '/index.html', - '/css/style.css', - '/js/main.js' + '/oldbell_lu/', + '/oldbell_lu/index.html', + '/oldbell_lu/css/theme.css', + '/oldbell_lu/css/icons.css', + '/oldbell_lu/css/fonts/siteicons.svg', + '/oldbell_lu/css/fonts/siteicons.ttf', + '/oldbell_lu/css/fonts/siteicons.woff', + '/oldbell_lu/css/theme.css', + '/oldbell_lu/js/site.js' ]; /* Start the service worker and cache all of the app's content */ diff --git a/website/js/vendor/flatpickr/flatpickr.css b/website/js/vendor/flatpickr/flatpickr.css new file mode 100644 index 0000000..4c58f46 --- /dev/null +++ b/website/js/vendor/flatpickr/flatpickr.css @@ -0,0 +1,791 @@ +.flatpickr-calendar { + background: transparent; + opacity: 0; + display: none; + text-align: center; + visibility: hidden; + padding: 0; + -webkit-animation: none; + animation: none; + direction: ltr; + border: 0; + font-size: 14px; + line-height: 24px; + border-radius: 5px; + position: absolute; + width: 307.875px; + -webkit-box-sizing: border-box; + box-sizing: border-box; + -ms-touch-action: manipulation; + touch-action: manipulation; + background: #fff; + -webkit-box-shadow: 1px 0 0 #e6e6e6, -1px 0 0 #e6e6e6, 0 1px 0 #e6e6e6, 0 -1px 0 #e6e6e6, 0 3px 13px rgba(0,0,0,0.08); + box-shadow: 1px 0 0 #e6e6e6, -1px 0 0 #e6e6e6, 0 1px 0 #e6e6e6, 0 -1px 0 #e6e6e6, 0 3px 13px rgba(0,0,0,0.08); +} +.flatpickr-calendar.open, +.flatpickr-calendar.inline { + opacity: 1; + max-height: 640px; + visibility: visible; +} +.flatpickr-calendar.open { + display: inline-block; + z-index: 99999; +} +.flatpickr-calendar.animate.open { + -webkit-animation: fpFadeInDown 300ms cubic-bezier(0.23, 1, 0.32, 1); + animation: fpFadeInDown 300ms cubic-bezier(0.23, 1, 0.32, 1); +} +.flatpickr-calendar.inline { + display: block; + position: relative; + top: 2px; +} +.flatpickr-calendar.static { + position: absolute; + top: calc(100% + 2px); +} +.flatpickr-calendar.static.open { + z-index: 999; + display: block; +} +.flatpickr-calendar.multiMonth .flatpickr-days .dayContainer:nth-child(n+1) .flatpickr-day.inRange:nth-child(7n+7) { + -webkit-box-shadow: none !important; + box-shadow: none !important; +} +.flatpickr-calendar.multiMonth .flatpickr-days .dayContainer:nth-child(n+2) .flatpickr-day.inRange:nth-child(7n+1) { + -webkit-box-shadow: -2px 0 0 #e6e6e6, 5px 0 0 #e6e6e6; + box-shadow: -2px 0 0 #e6e6e6, 5px 0 0 #e6e6e6; +} +.flatpickr-calendar .hasWeeks .dayContainer, +.flatpickr-calendar .hasTime .dayContainer { + border-bottom: 0; + border-bottom-right-radius: 0; + border-bottom-left-radius: 0; +} +.flatpickr-calendar .hasWeeks .dayContainer { + border-left: 0; +} +.flatpickr-calendar.hasTime .flatpickr-time { + height: 40px; + border-top: 1px solid #e6e6e6; +} +.flatpickr-calendar.noCalendar.hasTime .flatpickr-time { + height: auto; +} +.flatpickr-calendar:before, +.flatpickr-calendar:after { + position: absolute; + display: block; + pointer-events: none; + border: solid transparent; + content: ''; + height: 0; + width: 0; + left: 22px; +} +.flatpickr-calendar.rightMost:before, +.flatpickr-calendar.arrowRight:before, +.flatpickr-calendar.rightMost:after, +.flatpickr-calendar.arrowRight:after { + left: auto; + right: 22px; +} +.flatpickr-calendar.arrowCenter:before, +.flatpickr-calendar.arrowCenter:after { + left: 50%; + right: 50%; +} +.flatpickr-calendar:before { + border-width: 5px; + margin: 0 -5px; +} +.flatpickr-calendar:after { + border-width: 4px; + margin: 0 -4px; +} +.flatpickr-calendar.arrowTop:before, +.flatpickr-calendar.arrowTop:after { + bottom: 100%; +} +.flatpickr-calendar.arrowTop:before { + border-bottom-color: #e6e6e6; +} +.flatpickr-calendar.arrowTop:after { + border-bottom-color: #fff; +} +.flatpickr-calendar.arrowBottom:before, +.flatpickr-calendar.arrowBottom:after { + top: 100%; +} +.flatpickr-calendar.arrowBottom:before { + border-top-color: #e6e6e6; +} +.flatpickr-calendar.arrowBottom:after { + border-top-color: #fff; +} +.flatpickr-calendar:focus { + outline: 0; +} +.flatpickr-wrapper { + position: relative; + display: inline-block; +} +.flatpickr-months { + display: -webkit-box; + display: -webkit-flex; + display: -ms-flexbox; + display: flex; +} +.flatpickr-months .flatpickr-month { + background: transparent; + color: rgba(0,0,0,0.9); + fill: rgba(0,0,0,0.9); + height: 34px; + line-height: 1; + text-align: center; + position: relative; + -webkit-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; + overflow: hidden; + -webkit-box-flex: 1; + -webkit-flex: 1; + -ms-flex: 1; + flex: 1; +} +.flatpickr-months .flatpickr-prev-month, +.flatpickr-months .flatpickr-next-month { + text-decoration: none; + cursor: pointer; + position: absolute; + top: 0; + height: 34px; + padding: 10px; + z-index: 3; + color: rgba(0,0,0,0.9); + fill: rgba(0,0,0,0.9); +} +.flatpickr-months .flatpickr-prev-month.flatpickr-disabled, +.flatpickr-months .flatpickr-next-month.flatpickr-disabled { + display: none; +} +.flatpickr-months .flatpickr-prev-month i, +.flatpickr-months .flatpickr-next-month i { + position: relative; +} +.flatpickr-months .flatpickr-prev-month.flatpickr-prev-month, +.flatpickr-months .flatpickr-next-month.flatpickr-prev-month { +/* + /*rtl:begin:ignore*/ +/* + */ + left: 0; +/* + /*rtl:end:ignore*/ +/* + */ +} +/* + /*rtl:begin:ignore*/ +/* + /*rtl:end:ignore*/ +.flatpickr-months .flatpickr-prev-month.flatpickr-next-month, +.flatpickr-months .flatpickr-next-month.flatpickr-next-month { +/* + /*rtl:begin:ignore*/ +/* + */ + right: 0; +/* + /*rtl:end:ignore*/ +/* + */ +} +/* + /*rtl:begin:ignore*/ +/* + /*rtl:end:ignore*/ +.flatpickr-months .flatpickr-prev-month:hover, +.flatpickr-months .flatpickr-next-month:hover { + color: #959ea9; +} +.flatpickr-months .flatpickr-prev-month:hover svg, +.flatpickr-months .flatpickr-next-month:hover svg { + fill: #f64747; +} +.flatpickr-months .flatpickr-prev-month svg, +.flatpickr-months .flatpickr-next-month svg { + width: 14px; + height: 14px; +} +.flatpickr-months .flatpickr-prev-month svg path, +.flatpickr-months .flatpickr-next-month svg path { + -webkit-transition: fill 0.1s; + transition: fill 0.1s; + fill: inherit; +} +.numInputWrapper { + position: relative; + height: auto; +} +.numInputWrapper input, +.numInputWrapper span { + display: inline-block; +} +.numInputWrapper input { + width: 100%; +} +.numInputWrapper input::-ms-clear { + display: none; +} +.numInputWrapper input::-webkit-outer-spin-button, +.numInputWrapper input::-webkit-inner-spin-button { + margin: 0; + -webkit-appearance: none; +} +.numInputWrapper span { + position: absolute; + right: 0; + width: 14px; + padding: 0 4px 0 2px; + height: 50%; + line-height: 50%; + opacity: 0; + cursor: pointer; + border: 1px solid rgba(57,57,57,0.15); + -webkit-box-sizing: border-box; + box-sizing: border-box; +} +.numInputWrapper span:hover { + background: rgba(0,0,0,0.1); +} +.numInputWrapper span:active { + background: rgba(0,0,0,0.2); +} +.numInputWrapper span:after { + display: block; + content: ""; + position: absolute; +} +.numInputWrapper span.arrowUp { + top: 0; + border-bottom: 0; +} +.numInputWrapper span.arrowUp:after { + border-left: 4px solid transparent; + border-right: 4px solid transparent; + border-bottom: 4px solid rgba(57,57,57,0.6); + top: 26%; +} +.numInputWrapper span.arrowDown { + top: 50%; +} +.numInputWrapper span.arrowDown:after { + border-left: 4px solid transparent; + border-right: 4px solid transparent; + border-top: 4px solid rgba(57,57,57,0.6); + top: 40%; +} +.numInputWrapper span svg { + width: inherit; + height: auto; +} +.numInputWrapper span svg path { + fill: rgba(0,0,0,0.5); +} +.numInputWrapper:hover { + background: rgba(0,0,0,0.05); +} +.numInputWrapper:hover span { + opacity: 1; +} +.flatpickr-current-month { + font-size: 135%; + line-height: inherit; + font-weight: 300; + color: inherit; + position: absolute; + width: 75%; + left: 12.5%; + padding: 7.48px 0 0 0; + line-height: 1; + height: 34px; + display: inline-block; + text-align: center; + -webkit-transform: translate3d(0px, 0px, 0px); + transform: translate3d(0px, 0px, 0px); +} +.flatpickr-current-month span.cur-month { + font-family: inherit; + font-weight: 700; + color: inherit; + display: inline-block; + margin-left: 0.5ch; + padding: 0; +} +.flatpickr-current-month span.cur-month:hover { + background: rgba(0,0,0,0.05); +} +.flatpickr-current-month .numInputWrapper { + width: 6ch; + width: 7ch\0; + display: inline-block; +} +.flatpickr-current-month .numInputWrapper span.arrowUp:after { + border-bottom-color: rgba(0,0,0,0.9); +} +.flatpickr-current-month .numInputWrapper span.arrowDown:after { + border-top-color: rgba(0,0,0,0.9); +} +.flatpickr-current-month input.cur-year { + background: transparent; + -webkit-box-sizing: border-box; + box-sizing: border-box; + color: inherit; + cursor: text; + padding: 0 0 0 0.5ch; + margin: 0; + display: inline-block; + font-size: inherit; + font-family: inherit; + font-weight: 300; + line-height: inherit; + height: auto; + border: 0; + border-radius: 0; + vertical-align: initial; + -webkit-appearance: textfield; + -moz-appearance: textfield; + appearance: textfield; +} +.flatpickr-current-month input.cur-year:focus { + outline: 0; +} +.flatpickr-current-month input.cur-year[disabled], +.flatpickr-current-month input.cur-year[disabled]:hover { + font-size: 100%; + color: rgba(0,0,0,0.5); + background: transparent; + pointer-events: none; +} +.flatpickr-current-month .flatpickr-monthDropdown-months { + appearance: menulist; + background: transparent; + border: none; + border-radius: 0; + box-sizing: border-box; + color: inherit; + cursor: pointer; + font-size: inherit; + font-family: inherit; + font-weight: 300; + height: auto; + line-height: inherit; + margin: -1px 0 0 0; + outline: none; + padding: 0 0 0 0.5ch; + position: relative; + vertical-align: initial; + -webkit-box-sizing: border-box; + -webkit-appearance: menulist; + -moz-appearance: menulist; + width: auto; +} +.flatpickr-current-month .flatpickr-monthDropdown-months:focus, +.flatpickr-current-month .flatpickr-monthDropdown-months:active { + outline: none; +} +.flatpickr-current-month .flatpickr-monthDropdown-months:hover { + background: rgba(0,0,0,0.05); +} +.flatpickr-current-month .flatpickr-monthDropdown-months .flatpickr-monthDropdown-month { + background-color: transparent; + outline: none; + padding: 0; +} +.flatpickr-weekdays { + background: transparent; + text-align: center; + overflow: hidden; + width: 100%; + display: -webkit-box; + display: -webkit-flex; + display: -ms-flexbox; + display: flex; + -webkit-box-align: center; + -webkit-align-items: center; + -ms-flex-align: center; + align-items: center; + height: 28px; +} +.flatpickr-weekdays .flatpickr-weekdaycontainer { + display: -webkit-box; + display: -webkit-flex; + display: -ms-flexbox; + display: flex; + -webkit-box-flex: 1; + -webkit-flex: 1; + -ms-flex: 1; + flex: 1; +} +span.flatpickr-weekday { + cursor: default; + font-size: 90%; + background: transparent; + color: rgba(0,0,0,0.54); + line-height: 1; + margin: 0; + text-align: center; + display: block; + -webkit-box-flex: 1; + -webkit-flex: 1; + -ms-flex: 1; + flex: 1; + font-weight: bolder; +} +.dayContainer, +.flatpickr-weeks { + padding: 1px 0 0 0; +} +.flatpickr-days { + position: relative; + overflow: hidden; + display: -webkit-box; + display: -webkit-flex; + display: -ms-flexbox; + display: flex; + -webkit-box-align: start; + -webkit-align-items: flex-start; + -ms-flex-align: start; + align-items: flex-start; + width: 307.875px; +} +.flatpickr-days:focus { + outline: 0; +} +.dayContainer { + padding: 0; + outline: 0; + text-align: left; + width: 307.875px; + min-width: 307.875px; + max-width: 307.875px; + -webkit-box-sizing: border-box; + box-sizing: border-box; + display: inline-block; + display: -ms-flexbox; + display: -webkit-box; + display: -webkit-flex; + display: flex; + -webkit-flex-wrap: wrap; + flex-wrap: wrap; + -ms-flex-wrap: wrap; + -ms-flex-pack: justify; + -webkit-justify-content: space-around; + justify-content: space-around; + -webkit-transform: translate3d(0px, 0px, 0px); + transform: translate3d(0px, 0px, 0px); + opacity: 1; +} +.dayContainer + .dayContainer { + -webkit-box-shadow: -1px 0 0 #e6e6e6; + box-shadow: -1px 0 0 #e6e6e6; +} +.flatpickr-day { + background: none; + border: 1px solid transparent; + border-radius: 150px; + -webkit-box-sizing: border-box; + box-sizing: border-box; + color: #393939; + cursor: pointer; + font-weight: 400; + width: 14.2857143%; + -webkit-flex-basis: 14.2857143%; + -ms-flex-preferred-size: 14.2857143%; + flex-basis: 14.2857143%; + max-width: 39px; + height: 39px; + line-height: 39px; + margin: 0; + display: inline-block; + position: relative; + -webkit-box-pack: center; + -webkit-justify-content: center; + -ms-flex-pack: center; + justify-content: center; + text-align: center; +} +.flatpickr-day.inRange, +.flatpickr-day.prevMonthDay.inRange, +.flatpickr-day.nextMonthDay.inRange, +.flatpickr-day.today.inRange, +.flatpickr-day.prevMonthDay.today.inRange, +.flatpickr-day.nextMonthDay.today.inRange, +.flatpickr-day:hover, +.flatpickr-day.prevMonthDay:hover, +.flatpickr-day.nextMonthDay:hover, +.flatpickr-day:focus, +.flatpickr-day.prevMonthDay:focus, +.flatpickr-day.nextMonthDay:focus { + cursor: pointer; + outline: 0; + background: #e6e6e6; + border-color: #e6e6e6; +} +.flatpickr-day.today { + border-color: #959ea9; +} +.flatpickr-day.today:hover, +.flatpickr-day.today:focus { + border-color: #959ea9; + background: #959ea9; + color: #fff; +} +.flatpickr-day.selected, +.flatpickr-day.startRange, +.flatpickr-day.endRange, +.flatpickr-day.selected.inRange, +.flatpickr-day.startRange.inRange, +.flatpickr-day.endRange.inRange, +.flatpickr-day.selected:focus, +.flatpickr-day.startRange:focus, +.flatpickr-day.endRange:focus, +.flatpickr-day.selected:hover, +.flatpickr-day.startRange:hover, +.flatpickr-day.endRange:hover, +.flatpickr-day.selected.prevMonthDay, +.flatpickr-day.startRange.prevMonthDay, +.flatpickr-day.endRange.prevMonthDay, +.flatpickr-day.selected.nextMonthDay, +.flatpickr-day.startRange.nextMonthDay, +.flatpickr-day.endRange.nextMonthDay { + background: #569ff7; + -webkit-box-shadow: none; + box-shadow: none; + color: #fff; + border-color: #569ff7; +} +.flatpickr-day.selected.startRange, +.flatpickr-day.startRange.startRange, +.flatpickr-day.endRange.startRange { + border-radius: 50px 0 0 50px; +} +.flatpickr-day.selected.endRange, +.flatpickr-day.startRange.endRange, +.flatpickr-day.endRange.endRange { + border-radius: 0 50px 50px 0; +} +.flatpickr-day.selected.startRange + .endRange:not(:nth-child(7n+1)), +.flatpickr-day.startRange.startRange + .endRange:not(:nth-child(7n+1)), +.flatpickr-day.endRange.startRange + .endRange:not(:nth-child(7n+1)) { + -webkit-box-shadow: -10px 0 0 #569ff7; + box-shadow: -10px 0 0 #569ff7; +} +.flatpickr-day.selected.startRange.endRange, +.flatpickr-day.startRange.startRange.endRange, +.flatpickr-day.endRange.startRange.endRange { + border-radius: 50px; +} +.flatpickr-day.inRange { + border-radius: 0; + -webkit-box-shadow: -5px 0 0 #e6e6e6, 5px 0 0 #e6e6e6; + box-shadow: -5px 0 0 #e6e6e6, 5px 0 0 #e6e6e6; +} +.flatpickr-day.flatpickr-disabled, +.flatpickr-day.flatpickr-disabled:hover, +.flatpickr-day.prevMonthDay, +.flatpickr-day.nextMonthDay, +.flatpickr-day.notAllowed, +.flatpickr-day.notAllowed.prevMonthDay, +.flatpickr-day.notAllowed.nextMonthDay { + color: rgba(57,57,57,0.3); + background: transparent; + border-color: transparent; + cursor: default; +} +.flatpickr-day.flatpickr-disabled, +.flatpickr-day.flatpickr-disabled:hover { + cursor: not-allowed; + color: rgba(57,57,57,0.1); +} +.flatpickr-day.week.selected { + border-radius: 0; + -webkit-box-shadow: -5px 0 0 #569ff7, 5px 0 0 #569ff7; + box-shadow: -5px 0 0 #569ff7, 5px 0 0 #569ff7; +} +.flatpickr-day.hidden { + visibility: hidden; +} +.rangeMode .flatpickr-day { + margin-top: 1px; +} +.flatpickr-weekwrapper { + float: left; +} +.flatpickr-weekwrapper .flatpickr-weeks { + padding: 0 12px; + -webkit-box-shadow: 1px 0 0 #e6e6e6; + box-shadow: 1px 0 0 #e6e6e6; +} +.flatpickr-weekwrapper .flatpickr-weekday { + float: none; + width: 100%; + line-height: 28px; +} +.flatpickr-weekwrapper span.flatpickr-day, +.flatpickr-weekwrapper span.flatpickr-day:hover { + display: block; + width: 100%; + max-width: none; + color: rgba(57,57,57,0.3); + background: transparent; + cursor: default; + border: none; +} +.flatpickr-innerContainer { + display: block; + display: -webkit-box; + display: -webkit-flex; + display: -ms-flexbox; + display: flex; + -webkit-box-sizing: border-box; + box-sizing: border-box; + overflow: hidden; +} +.flatpickr-rContainer { + display: inline-block; + padding: 0; + -webkit-box-sizing: border-box; + box-sizing: border-box; +} +.flatpickr-time { + text-align: center; + outline: 0; + display: block; + height: 0; + line-height: 40px; + max-height: 40px; + -webkit-box-sizing: border-box; + box-sizing: border-box; + overflow: hidden; + display: -webkit-box; + display: -webkit-flex; + display: -ms-flexbox; + display: flex; +} +.flatpickr-time:after { + content: ""; + display: table; + clear: both; +} +.flatpickr-time .numInputWrapper { + -webkit-box-flex: 1; + -webkit-flex: 1; + -ms-flex: 1; + flex: 1; + width: 40%; + height: 40px; + float: left; +} +.flatpickr-time .numInputWrapper span.arrowUp:after { + border-bottom-color: #393939; +} +.flatpickr-time .numInputWrapper span.arrowDown:after { + border-top-color: #393939; +} +.flatpickr-time.hasSeconds .numInputWrapper { + width: 26%; +} +.flatpickr-time.time24hr .numInputWrapper { + width: 49%; +} +.flatpickr-time input { + background: transparent; + -webkit-box-shadow: none; + box-shadow: none; + border: 0; + border-radius: 0; + text-align: center; + margin: 0; + padding: 0; + height: inherit; + line-height: inherit; + color: #393939; + font-size: 14px; + position: relative; + -webkit-box-sizing: border-box; + box-sizing: border-box; + -webkit-appearance: textfield; + -moz-appearance: textfield; + appearance: textfield; +} +.flatpickr-time input.flatpickr-hour { + font-weight: bold; +} +.flatpickr-time input.flatpickr-minute, +.flatpickr-time input.flatpickr-second { + font-weight: 400; +} +.flatpickr-time input:focus { + outline: 0; + border: 0; +} +.flatpickr-time .flatpickr-time-separator, +.flatpickr-time .flatpickr-am-pm { + height: inherit; + float: left; + line-height: inherit; + color: #393939; + font-weight: bold; + width: 2%; + -webkit-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; + -webkit-align-self: center; + -ms-flex-item-align: center; + align-self: center; +} +.flatpickr-time .flatpickr-am-pm { + outline: 0; + width: 18%; + cursor: pointer; + text-align: center; + font-weight: 400; +} +.flatpickr-time input:hover, +.flatpickr-time .flatpickr-am-pm:hover, +.flatpickr-time input:focus, +.flatpickr-time .flatpickr-am-pm:focus { + background: #eee; +} +.flatpickr-input[readonly] { + cursor: pointer; +} +@-webkit-keyframes fpFadeInDown { + from { + opacity: 0; + -webkit-transform: translate3d(0, -20px, 0); + transform: translate3d(0, -20px, 0); + } + to { + opacity: 1; + -webkit-transform: translate3d(0, 0, 0); + transform: translate3d(0, 0, 0); + } +} +@keyframes fpFadeInDown { + from { + opacity: 0; + -webkit-transform: translate3d(0, -20px, 0); + transform: translate3d(0, -20px, 0); + } + to { + opacity: 1; + -webkit-transform: translate3d(0, 0, 0); + transform: translate3d(0, 0, 0); + } +} diff --git a/website/js/vendor/flatpickr/flatpickr.js b/website/js/vendor/flatpickr/flatpickr.js new file mode 100644 index 0000000..a94e6ac --- /dev/null +++ b/website/js/vendor/flatpickr/flatpickr.js @@ -0,0 +1,2658 @@ +/* flatpickr v4.6.6, @license MIT */ +(function (global, factory) { + typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : + typeof define === 'function' && define.amd ? define(factory) : + (global = global || self, global.flatpickr = factory()); +}(this, (function () { 'use strict'; + + /*! ***************************************************************************** + Copyright (c) Microsoft Corporation. + + Permission to use, copy, modify, and/or distribute this software for any + purpose with or without fee is hereby granted. + + THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH + REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY + AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, + INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM + LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR + OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + PERFORMANCE OF THIS SOFTWARE. + ***************************************************************************** */ + + var __assign = function() { + __assign = Object.assign || function __assign(t) { + for (var s, i = 1, n = arguments.length; i < n; i++) { + s = arguments[i]; + for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; + } + return t; + }; + return __assign.apply(this, arguments); + }; + + function __spreadArrays() { + for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length; + for (var r = Array(s), k = 0, i = 0; i < il; i++) + for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) + r[k] = a[j]; + return r; + } + + var HOOKS = [ + "onChange", + "onClose", + "onDayCreate", + "onDestroy", + "onKeyDown", + "onMonthChange", + "onOpen", + "onParseConfig", + "onReady", + "onValueUpdate", + "onYearChange", + "onPreCalendarPosition", + ]; + var defaults = { + _disable: [], + _enable: [], + allowInput: false, + allowInvalidPreload: false, + altFormat: "F j, Y", + altInput: false, + altInputClass: "form-control input", + animate: typeof window === "object" && + window.navigator.userAgent.indexOf("MSIE") === -1, + ariaDateFormat: "F j, Y", + autoFillDefaultTime: true, + clickOpens: true, + closeOnSelect: true, + conjunction: ", ", + dateFormat: "Y-m-d", + defaultHour: 12, + defaultMinute: 0, + defaultSeconds: 0, + disable: [], + disableMobile: false, + enable: [], + enableSeconds: false, + enableTime: false, + errorHandler: function (err) { + return typeof console !== "undefined" && console.warn(err); + }, + getWeek: function (givenDate) { + var date = new Date(givenDate.getTime()); + date.setHours(0, 0, 0, 0); + // Thursday in current week decides the year. + date.setDate(date.getDate() + 3 - ((date.getDay() + 6) % 7)); + // January 4 is always in week 1. + var week1 = new Date(date.getFullYear(), 0, 4); + // Adjust to Thursday in week 1 and count number of weeks from date to week1. + return (1 + + Math.round(((date.getTime() - week1.getTime()) / 86400000 - + 3 + + ((week1.getDay() + 6) % 7)) / + 7)); + }, + hourIncrement: 1, + ignoredFocusElements: [], + inline: false, + locale: "default", + minuteIncrement: 5, + mode: "single", + monthSelectorType: "dropdown", + nextArrow: "", + noCalendar: false, + now: new Date(), + onChange: [], + onClose: [], + onDayCreate: [], + onDestroy: [], + onKeyDown: [], + onMonthChange: [], + onOpen: [], + onParseConfig: [], + onReady: [], + onValueUpdate: [], + onYearChange: [], + onPreCalendarPosition: [], + plugins: [], + position: "auto", + positionElement: undefined, + prevArrow: "", + shorthandCurrentMonth: false, + showMonths: 1, + static: false, + time_24hr: false, + weekNumbers: false, + wrap: false, + }; + + var english = { + weekdays: { + shorthand: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"], + longhand: [ + "Sunday", + "Monday", + "Tuesday", + "Wednesday", + "Thursday", + "Friday", + "Saturday", + ], + }, + months: { + shorthand: [ + "Jan", + "Feb", + "Mar", + "Apr", + "May", + "Jun", + "Jul", + "Aug", + "Sep", + "Oct", + "Nov", + "Dec", + ], + longhand: [ + "January", + "February", + "March", + "April", + "May", + "June", + "July", + "August", + "September", + "October", + "November", + "December", + ], + }, + daysInMonth: [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31], + firstDayOfWeek: 0, + ordinal: function (nth) { + var s = nth % 100; + if (s > 3 && s < 21) + return "th"; + switch (s % 10) { + case 1: + return "st"; + case 2: + return "nd"; + case 3: + return "rd"; + default: + return "th"; + } + }, + rangeSeparator: " to ", + weekAbbreviation: "Wk", + scrollTitle: "Scroll to increment", + toggleTitle: "Click to toggle", + amPM: ["AM", "PM"], + yearAriaLabel: "Year", + monthAriaLabel: "Month", + hourAriaLabel: "Hour", + minuteAriaLabel: "Minute", + time_24hr: false, + }; + + var pad = function (number, length) { + if (length === void 0) { length = 2; } + return ("000" + number).slice(length * -1); + }; + var int = function (bool) { return (bool === true ? 1 : 0); }; + /* istanbul ignore next */ + function debounce(func, wait, immediate) { + if (immediate === void 0) { immediate = false; } + var timeout; + return function () { + var context = this, args = arguments; + timeout !== null && clearTimeout(timeout); + timeout = window.setTimeout(function () { + timeout = null; + if (!immediate) + func.apply(context, args); + }, wait); + if (immediate && !timeout) + func.apply(context, args); + }; + } + var arrayify = function (obj) { + return obj instanceof Array ? obj : [obj]; + }; + + function toggleClass(elem, className, bool) { + if (bool === true) + return elem.classList.add(className); + elem.classList.remove(className); + } + function createElement(tag, className, content) { + var e = window.document.createElement(tag); + className = className || ""; + content = content || ""; + e.className = className; + if (content !== undefined) + e.textContent = content; + return e; + } + function clearNode(node) { + while (node.firstChild) + node.removeChild(node.firstChild); + } + function findParent(node, condition) { + if (condition(node)) + return node; + else if (node.parentNode) + return findParent(node.parentNode, condition); + return undefined; // nothing found + } + function createNumberInput(inputClassName, opts) { + var wrapper = createElement("div", "numInputWrapper"), numInput = createElement("input", "numInput " + inputClassName), arrowUp = createElement("span", "arrowUp"), arrowDown = createElement("span", "arrowDown"); + if (navigator.userAgent.indexOf("MSIE 9.0") === -1) { + numInput.type = "number"; + } + else { + numInput.type = "text"; + numInput.pattern = "\\d*"; + } + if (opts !== undefined) + for (var key in opts) + numInput.setAttribute(key, opts[key]); + wrapper.appendChild(numInput); + wrapper.appendChild(arrowUp); + wrapper.appendChild(arrowDown); + return wrapper; + } + function getEventTarget(event) { + try { + if (typeof event.composedPath === "function") { + var path = event.composedPath(); + return path[0]; + } + return event.target; + } + catch (error) { + return event.target; + } + } + + var doNothing = function () { return undefined; }; + var monthToStr = function (monthNumber, shorthand, locale) { return locale.months[shorthand ? "shorthand" : "longhand"][monthNumber]; }; + var revFormat = { + D: doNothing, + F: function (dateObj, monthName, locale) { + dateObj.setMonth(locale.months.longhand.indexOf(monthName)); + }, + G: function (dateObj, hour) { + dateObj.setHours(parseFloat(hour)); + }, + H: function (dateObj, hour) { + dateObj.setHours(parseFloat(hour)); + }, + J: function (dateObj, day) { + dateObj.setDate(parseFloat(day)); + }, + K: function (dateObj, amPM, locale) { + dateObj.setHours((dateObj.getHours() % 12) + + 12 * int(new RegExp(locale.amPM[1], "i").test(amPM))); + }, + M: function (dateObj, shortMonth, locale) { + dateObj.setMonth(locale.months.shorthand.indexOf(shortMonth)); + }, + S: function (dateObj, seconds) { + dateObj.setSeconds(parseFloat(seconds)); + }, + U: function (_, unixSeconds) { return new Date(parseFloat(unixSeconds) * 1000); }, + W: function (dateObj, weekNum, locale) { + var weekNumber = parseInt(weekNum); + var date = new Date(dateObj.getFullYear(), 0, 2 + (weekNumber - 1) * 7, 0, 0, 0, 0); + date.setDate(date.getDate() - date.getDay() + locale.firstDayOfWeek); + return date; + }, + Y: function (dateObj, year) { + dateObj.setFullYear(parseFloat(year)); + }, + Z: function (_, ISODate) { return new Date(ISODate); }, + d: function (dateObj, day) { + dateObj.setDate(parseFloat(day)); + }, + h: function (dateObj, hour) { + dateObj.setHours(parseFloat(hour)); + }, + i: function (dateObj, minutes) { + dateObj.setMinutes(parseFloat(minutes)); + }, + j: function (dateObj, day) { + dateObj.setDate(parseFloat(day)); + }, + l: doNothing, + m: function (dateObj, month) { + dateObj.setMonth(parseFloat(month) - 1); + }, + n: function (dateObj, month) { + dateObj.setMonth(parseFloat(month) - 1); + }, + s: function (dateObj, seconds) { + dateObj.setSeconds(parseFloat(seconds)); + }, + u: function (_, unixMillSeconds) { + return new Date(parseFloat(unixMillSeconds)); + }, + w: doNothing, + y: function (dateObj, year) { + dateObj.setFullYear(2000 + parseFloat(year)); + }, + }; + var tokenRegex = { + D: "(\\w+)", + F: "(\\w+)", + G: "(\\d\\d|\\d)", + H: "(\\d\\d|\\d)", + J: "(\\d\\d|\\d)\\w+", + K: "", + M: "(\\w+)", + S: "(\\d\\d|\\d)", + U: "(.+)", + W: "(\\d\\d|\\d)", + Y: "(\\d{4})", + Z: "(.+)", + d: "(\\d\\d|\\d)", + h: "(\\d\\d|\\d)", + i: "(\\d\\d|\\d)", + j: "(\\d\\d|\\d)", + l: "(\\w+)", + m: "(\\d\\d|\\d)", + n: "(\\d\\d|\\d)", + s: "(\\d\\d|\\d)", + u: "(.+)", + w: "(\\d\\d|\\d)", + y: "(\\d{2})", + }; + var formats = { + // get the date in UTC + Z: function (date) { return date.toISOString(); }, + // weekday name, short, e.g. Thu + D: function (date, locale, options) { + return locale.weekdays.shorthand[formats.w(date, locale, options)]; + }, + // full month name e.g. January + F: function (date, locale, options) { + return monthToStr(formats.n(date, locale, options) - 1, false, locale); + }, + // padded hour 1-12 + G: function (date, locale, options) { + return pad(formats.h(date, locale, options)); + }, + // hours with leading zero e.g. 03 + H: function (date) { return pad(date.getHours()); }, + // day (1-30) with ordinal suffix e.g. 1st, 2nd + J: function (date, locale) { + return locale.ordinal !== undefined + ? date.getDate() + locale.ordinal(date.getDate()) + : date.getDate(); + }, + // AM/PM + K: function (date, locale) { return locale.amPM[int(date.getHours() > 11)]; }, + // shorthand month e.g. Jan, Sep, Oct, etc + M: function (date, locale) { + return monthToStr(date.getMonth(), true, locale); + }, + // seconds 00-59 + S: function (date) { return pad(date.getSeconds()); }, + // unix timestamp + U: function (date) { return date.getTime() / 1000; }, + W: function (date, _, options) { + return options.getWeek(date); + }, + // full year e.g. 2016, padded (0001-9999) + Y: function (date) { return pad(date.getFullYear(), 4); }, + // day in month, padded (01-30) + d: function (date) { return pad(date.getDate()); }, + // hour from 1-12 (am/pm) + h: function (date) { return (date.getHours() % 12 ? date.getHours() % 12 : 12); }, + // minutes, padded with leading zero e.g. 09 + i: function (date) { return pad(date.getMinutes()); }, + // day in month (1-30) + j: function (date) { return date.getDate(); }, + // weekday name, full, e.g. Thursday + l: function (date, locale) { + return locale.weekdays.longhand[date.getDay()]; + }, + // padded month number (01-12) + m: function (date) { return pad(date.getMonth() + 1); }, + // the month number (1-12) + n: function (date) { return date.getMonth() + 1; }, + // seconds 0-59 + s: function (date) { return date.getSeconds(); }, + // Unix Milliseconds + u: function (date) { return date.getTime(); }, + // number of the day of the week + w: function (date) { return date.getDay(); }, + // last two digits of year e.g. 16 for 2016 + y: function (date) { return String(date.getFullYear()).substring(2); }, + }; + + var createDateFormatter = function (_a) { + var _b = _a.config, config = _b === void 0 ? defaults : _b, _c = _a.l10n, l10n = _c === void 0 ? english : _c, _d = _a.isMobile, isMobile = _d === void 0 ? false : _d; + return function (dateObj, frmt, overrideLocale) { + var locale = overrideLocale || l10n; + if (config.formatDate !== undefined && !isMobile) { + return config.formatDate(dateObj, frmt, locale); + } + return frmt + .split("") + .map(function (c, i, arr) { + return formats[c] && arr[i - 1] !== "\\" + ? formats[c](dateObj, locale, config) + : c !== "\\" + ? c + : ""; + }) + .join(""); + }; + }; + var createDateParser = function (_a) { + var _b = _a.config, config = _b === void 0 ? defaults : _b, _c = _a.l10n, l10n = _c === void 0 ? english : _c; + return function (date, givenFormat, timeless, customLocale) { + if (date !== 0 && !date) + return undefined; + var locale = customLocale || l10n; + var parsedDate; + var dateOrig = date; + if (date instanceof Date) + parsedDate = new Date(date.getTime()); + else if (typeof date !== "string" && + date.toFixed !== undefined // timestamp + ) + // create a copy + parsedDate = new Date(date); + else if (typeof date === "string") { + // date string + var format = givenFormat || (config || defaults).dateFormat; + var datestr = String(date).trim(); + if (datestr === "today") { + parsedDate = new Date(); + timeless = true; + } + else if (/Z$/.test(datestr) || + /GMT$/.test(datestr) // datestrings w/ timezone + ) + parsedDate = new Date(date); + else if (config && config.parseDate) + parsedDate = config.parseDate(date, format); + else { + parsedDate = + !config || !config.noCalendar + ? new Date(new Date().getFullYear(), 0, 1, 0, 0, 0, 0) + : new Date(new Date().setHours(0, 0, 0, 0)); + var matched = void 0, ops = []; + for (var i = 0, matchIndex = 0, regexStr = ""; i < format.length; i++) { + var token_1 = format[i]; + var isBackSlash = token_1 === "\\"; + var escaped = format[i - 1] === "\\" || isBackSlash; + if (tokenRegex[token_1] && !escaped) { + regexStr += tokenRegex[token_1]; + var match = new RegExp(regexStr).exec(date); + if (match && (matched = true)) { + ops[token_1 !== "Y" ? "push" : "unshift"]({ + fn: revFormat[token_1], + val: match[++matchIndex], + }); + } + } + else if (!isBackSlash) + regexStr += "."; // don't really care + ops.forEach(function (_a) { + var fn = _a.fn, val = _a.val; + return (parsedDate = fn(parsedDate, val, locale) || parsedDate); + }); + } + parsedDate = matched ? parsedDate : undefined; + } + } + /* istanbul ignore next */ + if (!(parsedDate instanceof Date && !isNaN(parsedDate.getTime()))) { + config.errorHandler(new Error("Invalid date provided: " + dateOrig)); + return undefined; + } + if (timeless === true) + parsedDate.setHours(0, 0, 0, 0); + return parsedDate; + }; + }; + /** + * Compute the difference in dates, measured in ms + */ + function compareDates(date1, date2, timeless) { + if (timeless === void 0) { timeless = true; } + if (timeless !== false) { + return (new Date(date1.getTime()).setHours(0, 0, 0, 0) - + new Date(date2.getTime()).setHours(0, 0, 0, 0)); + } + return date1.getTime() - date2.getTime(); + } + var isBetween = function (ts, ts1, ts2) { + return ts > Math.min(ts1, ts2) && ts < Math.max(ts1, ts2); + }; + var duration = { + DAY: 86400000, + }; + + if (typeof Object.assign !== "function") { + Object.assign = function (target) { + var args = []; + for (var _i = 1; _i < arguments.length; _i++) { + args[_i - 1] = arguments[_i]; + } + if (!target) { + throw TypeError("Cannot convert undefined or null to object"); + } + var _loop_1 = function (source) { + if (source) { + Object.keys(source).forEach(function (key) { return (target[key] = source[key]); }); + } + }; + for (var _a = 0, args_1 = args; _a < args_1.length; _a++) { + var source = args_1[_a]; + _loop_1(source); + } + return target; + }; + } + + var DEBOUNCED_CHANGE_MS = 300; + function FlatpickrInstance(element, instanceConfig) { + var self = { + config: __assign(__assign({}, defaults), flatpickr.defaultConfig), + l10n: english, + }; + self.parseDate = createDateParser({ config: self.config, l10n: self.l10n }); + self._handlers = []; + self.pluginElements = []; + self.loadedPlugins = []; + self._bind = bind; + self._setHoursFromDate = setHoursFromDate; + self._positionCalendar = positionCalendar; + self.changeMonth = changeMonth; + self.changeYear = changeYear; + self.clear = clear; + self.close = close; + self._createElement = createElement; + self.destroy = destroy; + self.isEnabled = isEnabled; + self.jumpToDate = jumpToDate; + self.open = open; + self.redraw = redraw; + self.set = set; + self.setDate = setDate; + self.toggle = toggle; + function setupHelperFunctions() { + self.utils = { + getDaysInMonth: function (month, yr) { + if (month === void 0) { month = self.currentMonth; } + if (yr === void 0) { yr = self.currentYear; } + if (month === 1 && ((yr % 4 === 0 && yr % 100 !== 0) || yr % 400 === 0)) + return 29; + return self.l10n.daysInMonth[month]; + }, + }; + } + function init() { + self.element = self.input = element; + self.isOpen = false; + parseConfig(); + setupLocale(); + setupInputs(); + setupDates(); + setupHelperFunctions(); + if (!self.isMobile) + build(); + bindEvents(); + if (self.selectedDates.length || self.config.noCalendar) { + if (self.config.enableTime) { + setHoursFromDate(self.config.noCalendar + ? self.latestSelectedDateObj || self.config.minDate + : undefined); + } + updateValue(false); + } + setCalendarWidth(); + var isSafari = /^((?!chrome|android).)*safari/i.test(navigator.userAgent); + /* TODO: investigate this further + + Currently, there is weird positioning behavior in safari causing pages + to scroll up. https://github.com/chmln/flatpickr/issues/563 + + However, most browsers are not Safari and positioning is expensive when used + in scale. https://github.com/chmln/flatpickr/issues/1096 + */ + if (!self.isMobile && isSafari) { + positionCalendar(); + } + triggerEvent("onReady"); + } + function bindToInstance(fn) { + return fn.bind(self); + } + function setCalendarWidth() { + var config = self.config; + if (config.weekNumbers === false && config.showMonths === 1) { + return; + } + else if (config.noCalendar !== true) { + window.requestAnimationFrame(function () { + if (self.calendarContainer !== undefined) { + self.calendarContainer.style.visibility = "hidden"; + self.calendarContainer.style.display = "block"; + } + if (self.daysContainer !== undefined) { + var daysWidth = (self.days.offsetWidth + 1) * config.showMonths; + self.daysContainer.style.width = daysWidth + "px"; + self.calendarContainer.style.width = + daysWidth + + (self.weekWrapper !== undefined + ? self.weekWrapper.offsetWidth + : 0) + + "px"; + self.calendarContainer.style.removeProperty("visibility"); + self.calendarContainer.style.removeProperty("display"); + } + }); + } + } + /** + * The handler for all events targeting the time inputs + */ + function updateTime(e) { + if (self.selectedDates.length === 0) { + var defaultDate = self.config.minDate !== undefined + ? new Date(self.config.minDate.getTime()) + : new Date(); + var _a = getDefaultHours(), hours = _a.hours, minutes = _a.minutes, seconds = _a.seconds; + defaultDate.setHours(hours, minutes, seconds, 0); + self.setDate(defaultDate, false); + } + if (e !== undefined && e.type !== "blur") { + timeWrapper(e); + } + var prevValue = self._input.value; + setHoursFromInputs(); + updateValue(); + if (self._input.value !== prevValue) { + self._debouncedChange(); + } + } + function ampm2military(hour, amPM) { + return (hour % 12) + 12 * int(amPM === self.l10n.amPM[1]); + } + function military2ampm(hour) { + switch (hour % 24) { + case 0: + case 12: + return 12; + default: + return hour % 12; + } + } + /** + * Syncs the selected date object time with user's time input + */ + function setHoursFromInputs() { + if (self.hourElement === undefined || self.minuteElement === undefined) + return; + var hours = (parseInt(self.hourElement.value.slice(-2), 10) || 0) % 24, minutes = (parseInt(self.minuteElement.value, 10) || 0) % 60, seconds = self.secondElement !== undefined + ? (parseInt(self.secondElement.value, 10) || 0) % 60 + : 0; + if (self.amPM !== undefined) { + hours = ampm2military(hours, self.amPM.textContent); + } + var limitMinHours = self.config.minTime !== undefined || + (self.config.minDate && + self.minDateHasTime && + self.latestSelectedDateObj && + compareDates(self.latestSelectedDateObj, self.config.minDate, true) === + 0); + var limitMaxHours = self.config.maxTime !== undefined || + (self.config.maxDate && + self.maxDateHasTime && + self.latestSelectedDateObj && + compareDates(self.latestSelectedDateObj, self.config.maxDate, true) === + 0); + if (limitMaxHours) { + var maxTime = self.config.maxTime !== undefined + ? self.config.maxTime + : self.config.maxDate; + hours = Math.min(hours, maxTime.getHours()); + if (hours === maxTime.getHours()) + minutes = Math.min(minutes, maxTime.getMinutes()); + if (minutes === maxTime.getMinutes()) + seconds = Math.min(seconds, maxTime.getSeconds()); + } + if (limitMinHours) { + var minTime = self.config.minTime !== undefined + ? self.config.minTime + : self.config.minDate; + hours = Math.max(hours, minTime.getHours()); + if (hours === minTime.getHours()) + minutes = Math.max(minutes, minTime.getMinutes()); + if (minutes === minTime.getMinutes()) + seconds = Math.max(seconds, minTime.getSeconds()); + } + setHours(hours, minutes, seconds); + } + /** + * Syncs time input values with a date + */ + function setHoursFromDate(dateObj) { + var date = dateObj || self.latestSelectedDateObj; + if (date) { + setHours(date.getHours(), date.getMinutes(), date.getSeconds()); + } + } + function getDefaultHours() { + var hours = self.config.defaultHour; + var minutes = self.config.defaultMinute; + var seconds = self.config.defaultSeconds; + if (self.config.minDate !== undefined) { + var minHr = self.config.minDate.getHours(); + var minMinutes = self.config.minDate.getMinutes(); + hours = Math.max(hours, minHr); + if (hours === minHr) + minutes = Math.max(minMinutes, minutes); + if (hours === minHr && minutes === minMinutes) + seconds = self.config.minDate.getSeconds(); + } + if (self.config.maxDate !== undefined) { + var maxHr = self.config.maxDate.getHours(); + var maxMinutes = self.config.maxDate.getMinutes(); + hours = Math.min(hours, maxHr); + if (hours === maxHr) + minutes = Math.min(maxMinutes, minutes); + if (hours === maxHr && minutes === maxMinutes) + seconds = self.config.maxDate.getSeconds(); + } + return { hours: hours, minutes: minutes, seconds: seconds }; + } + /** + * Sets the hours, minutes, and optionally seconds + * of the latest selected date object and the + * corresponding time inputs + * @param {Number} hours the hour. whether its military + * or am-pm gets inferred from config + * @param {Number} minutes the minutes + * @param {Number} seconds the seconds (optional) + */ + function setHours(hours, minutes, seconds) { + if (self.latestSelectedDateObj !== undefined) { + self.latestSelectedDateObj.setHours(hours % 24, minutes, seconds || 0, 0); + } + if (!self.hourElement || !self.minuteElement || self.isMobile) + return; + self.hourElement.value = pad(!self.config.time_24hr + ? ((12 + hours) % 12) + 12 * int(hours % 12 === 0) + : hours); + self.minuteElement.value = pad(minutes); + if (self.amPM !== undefined) + self.amPM.textContent = self.l10n.amPM[int(hours >= 12)]; + if (self.secondElement !== undefined) + self.secondElement.value = pad(seconds); + } + /** + * Handles the year input and incrementing events + * @param {Event} event the keyup or increment event + */ + function onYearInput(event) { + var eventTarget = getEventTarget(event); + var year = parseInt(eventTarget.value) + (event.delta || 0); + if (year / 1000 > 1 || + (event.key === "Enter" && !/[^\d]/.test(year.toString()))) { + changeYear(year); + } + } + /** + * Essentially addEventListener + tracking + * @param {Element} element the element to addEventListener to + * @param {String} event the event name + * @param {Function} handler the event handler + */ + function bind(element, event, handler, options) { + if (event instanceof Array) + return event.forEach(function (ev) { return bind(element, ev, handler, options); }); + if (element instanceof Array) + return element.forEach(function (el) { return bind(el, event, handler, options); }); + element.addEventListener(event, handler, options); + self._handlers.push({ + element: element, + event: event, + handler: handler, + options: options, + }); + } + function triggerChange() { + triggerEvent("onChange"); + } + /** + * Adds all the necessary event listeners + */ + function bindEvents() { + if (self.config.wrap) { + ["open", "close", "toggle", "clear"].forEach(function (evt) { + Array.prototype.forEach.call(self.element.querySelectorAll("[data-" + evt + "]"), function (el) { + return bind(el, "click", self[evt]); + }); + }); + } + if (self.isMobile) { + setupMobile(); + return; + } + var debouncedResize = debounce(onResize, 50); + self._debouncedChange = debounce(triggerChange, DEBOUNCED_CHANGE_MS); + if (self.daysContainer && !/iPhone|iPad|iPod/i.test(navigator.userAgent)) + bind(self.daysContainer, "mouseover", function (e) { + if (self.config.mode === "range") + onMouseOver(getEventTarget(e)); + }); + bind(window.document.body, "keydown", onKeyDown); + if (!self.config.inline && !self.config.static) + bind(window, "resize", debouncedResize); + if (window.ontouchstart !== undefined) + bind(window.document, "touchstart", documentClick); + else + bind(window.document, "click", documentClick); + bind(window.document, "focus", documentClick, { capture: true }); + if (self.config.clickOpens === true) { + bind(self._input, "focus", self.open); + bind(self._input, "click", self.open); + } + if (self.daysContainer !== undefined) { + bind(self.monthNav, "click", onMonthNavClick); + bind(self.monthNav, ["keyup", "increment"], onYearInput); + bind(self.daysContainer, "click", selectDate); + } + if (self.timeContainer !== undefined && + self.minuteElement !== undefined && + self.hourElement !== undefined) { + var selText = function (e) { + return getEventTarget(e).select(); + }; + bind(self.timeContainer, ["increment"], updateTime); + bind(self.timeContainer, "blur", updateTime, { capture: true }); + bind(self.timeContainer, "click", timeIncrement); + bind([self.hourElement, self.minuteElement], ["focus", "click"], selText); + if (self.secondElement !== undefined) + bind(self.secondElement, "focus", function () { return self.secondElement && self.secondElement.select(); }); + if (self.amPM !== undefined) { + bind(self.amPM, "click", function (e) { + updateTime(e); + triggerChange(); + }); + } + } + if (self.config.allowInput) + bind(self._input, "blur", onBlur); + } + /** + * Set the calendar view to a particular date. + * @param {Date} jumpDate the date to set the view to + * @param {boolean} triggerChange if change events should be triggered + */ + function jumpToDate(jumpDate, triggerChange) { + var jumpTo = jumpDate !== undefined + ? self.parseDate(jumpDate) + : self.latestSelectedDateObj || + (self.config.minDate && self.config.minDate > self.now + ? self.config.minDate + : self.config.maxDate && self.config.maxDate < self.now + ? self.config.maxDate + : self.now); + var oldYear = self.currentYear; + var oldMonth = self.currentMonth; + try { + if (jumpTo !== undefined) { + self.currentYear = jumpTo.getFullYear(); + self.currentMonth = jumpTo.getMonth(); + } + } + catch (e) { + /* istanbul ignore next */ + e.message = "Invalid date supplied: " + jumpTo; + self.config.errorHandler(e); + } + if (triggerChange && self.currentYear !== oldYear) { + triggerEvent("onYearChange"); + buildMonthSwitch(); + } + if (triggerChange && + (self.currentYear !== oldYear || self.currentMonth !== oldMonth)) { + triggerEvent("onMonthChange"); + } + self.redraw(); + } + /** + * The up/down arrow handler for time inputs + * @param {Event} e the click event + */ + function timeIncrement(e) { + var eventTarget = getEventTarget(e); + if (~eventTarget.className.indexOf("arrow")) + incrementNumInput(e, eventTarget.classList.contains("arrowUp") ? 1 : -1); + } + /** + * Increments/decrements the value of input associ- + * ated with the up/down arrow by dispatching an + * "increment" event on the input. + * + * @param {Event} e the click event + * @param {Number} delta the diff (usually 1 or -1) + * @param {Element} inputElem the input element + */ + function incrementNumInput(e, delta, inputElem) { + var target = e && getEventTarget(e); + var input = inputElem || + (target && target.parentNode && target.parentNode.firstChild); + var event = createEvent("increment"); + event.delta = delta; + input && input.dispatchEvent(event); + } + function build() { + var fragment = window.document.createDocumentFragment(); + self.calendarContainer = createElement("div", "flatpickr-calendar"); + self.calendarContainer.tabIndex = -1; + if (!self.config.noCalendar) { + fragment.appendChild(buildMonthNav()); + self.innerContainer = createElement("div", "flatpickr-innerContainer"); + if (self.config.weekNumbers) { + var _a = buildWeeks(), weekWrapper = _a.weekWrapper, weekNumbers = _a.weekNumbers; + self.innerContainer.appendChild(weekWrapper); + self.weekNumbers = weekNumbers; + self.weekWrapper = weekWrapper; + } + self.rContainer = createElement("div", "flatpickr-rContainer"); + self.rContainer.appendChild(buildWeekdays()); + if (!self.daysContainer) { + self.daysContainer = createElement("div", "flatpickr-days"); + self.daysContainer.tabIndex = -1; + } + buildDays(); + self.rContainer.appendChild(self.daysContainer); + self.innerContainer.appendChild(self.rContainer); + fragment.appendChild(self.innerContainer); + } + if (self.config.enableTime) { + fragment.appendChild(buildTime()); + } + toggleClass(self.calendarContainer, "rangeMode", self.config.mode === "range"); + toggleClass(self.calendarContainer, "animate", self.config.animate === true); + toggleClass(self.calendarContainer, "multiMonth", self.config.showMonths > 1); + self.calendarContainer.appendChild(fragment); + var customAppend = self.config.appendTo !== undefined && + self.config.appendTo.nodeType !== undefined; + if (self.config.inline || self.config.static) { + self.calendarContainer.classList.add(self.config.inline ? "inline" : "static"); + if (self.config.inline) { + if (!customAppend && self.element.parentNode) + self.element.parentNode.insertBefore(self.calendarContainer, self._input.nextSibling); + else if (self.config.appendTo !== undefined) + self.config.appendTo.appendChild(self.calendarContainer); + } + if (self.config.static) { + var wrapper = createElement("div", "flatpickr-wrapper"); + if (self.element.parentNode) + self.element.parentNode.insertBefore(wrapper, self.element); + wrapper.appendChild(self.element); + if (self.altInput) + wrapper.appendChild(self.altInput); + wrapper.appendChild(self.calendarContainer); + } + } + if (!self.config.static && !self.config.inline) + (self.config.appendTo !== undefined + ? self.config.appendTo + : window.document.body).appendChild(self.calendarContainer); + } + function createDay(className, date, dayNumber, i) { + var dateIsEnabled = isEnabled(date, true), dayElement = createElement("span", "flatpickr-day " + className, date.getDate().toString()); + dayElement.dateObj = date; + dayElement.$i = i; + dayElement.setAttribute("aria-label", self.formatDate(date, self.config.ariaDateFormat)); + if (className.indexOf("hidden") === -1 && + compareDates(date, self.now) === 0) { + self.todayDateElem = dayElement; + dayElement.classList.add("today"); + dayElement.setAttribute("aria-current", "date"); + } + if (dateIsEnabled) { + dayElement.tabIndex = -1; + if (isDateSelected(date)) { + dayElement.classList.add("selected"); + self.selectedDateElem = dayElement; + if (self.config.mode === "range") { + toggleClass(dayElement, "startRange", self.selectedDates[0] && + compareDates(date, self.selectedDates[0], true) === 0); + toggleClass(dayElement, "endRange", self.selectedDates[1] && + compareDates(date, self.selectedDates[1], true) === 0); + if (className === "nextMonthDay") + dayElement.classList.add("inRange"); + } + } + } + else { + dayElement.classList.add("flatpickr-disabled"); + } + if (self.config.mode === "range") { + if (isDateInRange(date) && !isDateSelected(date)) + dayElement.classList.add("inRange"); + } + if (self.weekNumbers && + self.config.showMonths === 1 && + className !== "prevMonthDay" && + dayNumber % 7 === 1) { + self.weekNumbers.insertAdjacentHTML("beforeend", "" + self.config.getWeek(date) + ""); + } + triggerEvent("onDayCreate", dayElement); + return dayElement; + } + function focusOnDayElem(targetNode) { + targetNode.focus(); + if (self.config.mode === "range") + onMouseOver(targetNode); + } + function getFirstAvailableDay(delta) { + var startMonth = delta > 0 ? 0 : self.config.showMonths - 1; + var endMonth = delta > 0 ? self.config.showMonths : -1; + for (var m = startMonth; m != endMonth; m += delta) { + var month = self.daysContainer.children[m]; + var startIndex = delta > 0 ? 0 : month.children.length - 1; + var endIndex = delta > 0 ? month.children.length : -1; + for (var i = startIndex; i != endIndex; i += delta) { + var c = month.children[i]; + if (c.className.indexOf("hidden") === -1 && isEnabled(c.dateObj)) + return c; + } + } + return undefined; + } + function getNextAvailableDay(current, delta) { + var givenMonth = current.className.indexOf("Month") === -1 + ? current.dateObj.getMonth() + : self.currentMonth; + var endMonth = delta > 0 ? self.config.showMonths : -1; + var loopDelta = delta > 0 ? 1 : -1; + for (var m = givenMonth - self.currentMonth; m != endMonth; m += loopDelta) { + var month = self.daysContainer.children[m]; + var startIndex = givenMonth - self.currentMonth === m + ? current.$i + delta + : delta < 0 + ? month.children.length - 1 + : 0; + var numMonthDays = month.children.length; + for (var i = startIndex; i >= 0 && i < numMonthDays && i != (delta > 0 ? numMonthDays : -1); i += loopDelta) { + var c = month.children[i]; + if (c.className.indexOf("hidden") === -1 && + isEnabled(c.dateObj) && + Math.abs(current.$i - i) >= Math.abs(delta)) + return focusOnDayElem(c); + } + } + self.changeMonth(loopDelta); + focusOnDay(getFirstAvailableDay(loopDelta), 0); + return undefined; + } + function focusOnDay(current, offset) { + var dayFocused = isInView(document.activeElement || document.body); + var startElem = current !== undefined + ? current + : dayFocused + ? document.activeElement + : self.selectedDateElem !== undefined && isInView(self.selectedDateElem) + ? self.selectedDateElem + : self.todayDateElem !== undefined && isInView(self.todayDateElem) + ? self.todayDateElem + : getFirstAvailableDay(offset > 0 ? 1 : -1); + if (startElem === undefined) { + self._input.focus(); + } + else if (!dayFocused) { + focusOnDayElem(startElem); + } + else { + getNextAvailableDay(startElem, offset); + } + } + function buildMonthDays(year, month) { + var firstOfMonth = (new Date(year, month, 1).getDay() - self.l10n.firstDayOfWeek + 7) % 7; + var prevMonthDays = self.utils.getDaysInMonth((month - 1 + 12) % 12, year); + var daysInMonth = self.utils.getDaysInMonth(month, year), days = window.document.createDocumentFragment(), isMultiMonth = self.config.showMonths > 1, prevMonthDayClass = isMultiMonth ? "prevMonthDay hidden" : "prevMonthDay", nextMonthDayClass = isMultiMonth ? "nextMonthDay hidden" : "nextMonthDay"; + var dayNumber = prevMonthDays + 1 - firstOfMonth, dayIndex = 0; + // prepend days from the ending of previous month + for (; dayNumber <= prevMonthDays; dayNumber++, dayIndex++) { + days.appendChild(createDay(prevMonthDayClass, new Date(year, month - 1, dayNumber), dayNumber, dayIndex)); + } + // Start at 1 since there is no 0th day + for (dayNumber = 1; dayNumber <= daysInMonth; dayNumber++, dayIndex++) { + days.appendChild(createDay("", new Date(year, month, dayNumber), dayNumber, dayIndex)); + } + // append days from the next month + for (var dayNum = daysInMonth + 1; dayNum <= 42 - firstOfMonth && + (self.config.showMonths === 1 || dayIndex % 7 !== 0); dayNum++, dayIndex++) { + days.appendChild(createDay(nextMonthDayClass, new Date(year, month + 1, dayNum % daysInMonth), dayNum, dayIndex)); + } + //updateNavigationCurrentMonth(); + var dayContainer = createElement("div", "dayContainer"); + dayContainer.appendChild(days); + return dayContainer; + } + function buildDays() { + if (self.daysContainer === undefined) { + return; + } + clearNode(self.daysContainer); + // TODO: week numbers for each month + if (self.weekNumbers) + clearNode(self.weekNumbers); + var frag = document.createDocumentFragment(); + for (var i = 0; i < self.config.showMonths; i++) { + var d = new Date(self.currentYear, self.currentMonth, 1); + d.setMonth(self.currentMonth + i); + frag.appendChild(buildMonthDays(d.getFullYear(), d.getMonth())); + } + self.daysContainer.appendChild(frag); + self.days = self.daysContainer.firstChild; + if (self.config.mode === "range" && self.selectedDates.length === 1) { + onMouseOver(); + } + } + function buildMonthSwitch() { + if (self.config.showMonths > 1 || + self.config.monthSelectorType !== "dropdown") + return; + var shouldBuildMonth = function (month) { + if (self.config.minDate !== undefined && + self.currentYear === self.config.minDate.getFullYear() && + month < self.config.minDate.getMonth()) { + return false; + } + return !(self.config.maxDate !== undefined && + self.currentYear === self.config.maxDate.getFullYear() && + month > self.config.maxDate.getMonth()); + }; + self.monthsDropdownContainer.tabIndex = -1; + self.monthsDropdownContainer.innerHTML = ""; + for (var i = 0; i < 12; i++) { + if (!shouldBuildMonth(i)) + continue; + var month = createElement("option", "flatpickr-monthDropdown-month"); + month.value = new Date(self.currentYear, i).getMonth().toString(); + month.textContent = monthToStr(i, self.config.shorthandCurrentMonth, self.l10n); + month.tabIndex = -1; + if (self.currentMonth === i) { + month.selected = true; + } + self.monthsDropdownContainer.appendChild(month); + } + } + function buildMonth() { + var container = createElement("div", "flatpickr-month"); + var monthNavFragment = window.document.createDocumentFragment(); + var monthElement; + if (self.config.showMonths > 1 || + self.config.monthSelectorType === "static") { + monthElement = createElement("span", "cur-month"); + } + else { + self.monthsDropdownContainer = createElement("select", "flatpickr-monthDropdown-months"); + self.monthsDropdownContainer.setAttribute("aria-label", self.l10n.monthAriaLabel); + bind(self.monthsDropdownContainer, "change", function (e) { + var target = getEventTarget(e); + var selectedMonth = parseInt(target.value, 10); + self.changeMonth(selectedMonth - self.currentMonth); + triggerEvent("onMonthChange"); + }); + buildMonthSwitch(); + monthElement = self.monthsDropdownContainer; + } + var yearInput = createNumberInput("cur-year", { tabindex: "-1" }); + var yearElement = yearInput.getElementsByTagName("input")[0]; + yearElement.setAttribute("aria-label", self.l10n.yearAriaLabel); + if (self.config.minDate) { + yearElement.setAttribute("min", self.config.minDate.getFullYear().toString()); + } + if (self.config.maxDate) { + yearElement.setAttribute("max", self.config.maxDate.getFullYear().toString()); + yearElement.disabled = + !!self.config.minDate && + self.config.minDate.getFullYear() === self.config.maxDate.getFullYear(); + } + var currentMonth = createElement("div", "flatpickr-current-month"); + currentMonth.appendChild(monthElement); + currentMonth.appendChild(yearInput); + monthNavFragment.appendChild(currentMonth); + container.appendChild(monthNavFragment); + return { + container: container, + yearElement: yearElement, + monthElement: monthElement, + }; + } + function buildMonths() { + clearNode(self.monthNav); + self.monthNav.appendChild(self.prevMonthNav); + if (self.config.showMonths) { + self.yearElements = []; + self.monthElements = []; + } + for (var m = self.config.showMonths; m--;) { + var month = buildMonth(); + self.yearElements.push(month.yearElement); + self.monthElements.push(month.monthElement); + self.monthNav.appendChild(month.container); + } + self.monthNav.appendChild(self.nextMonthNav); + } + function buildMonthNav() { + self.monthNav = createElement("div", "flatpickr-months"); + self.yearElements = []; + self.monthElements = []; + self.prevMonthNav = createElement("span", "flatpickr-prev-month"); + self.prevMonthNav.innerHTML = self.config.prevArrow; + self.nextMonthNav = createElement("span", "flatpickr-next-month"); + self.nextMonthNav.innerHTML = self.config.nextArrow; + buildMonths(); + Object.defineProperty(self, "_hidePrevMonthArrow", { + get: function () { return self.__hidePrevMonthArrow; }, + set: function (bool) { + if (self.__hidePrevMonthArrow !== bool) { + toggleClass(self.prevMonthNav, "flatpickr-disabled", bool); + self.__hidePrevMonthArrow = bool; + } + }, + }); + Object.defineProperty(self, "_hideNextMonthArrow", { + get: function () { return self.__hideNextMonthArrow; }, + set: function (bool) { + if (self.__hideNextMonthArrow !== bool) { + toggleClass(self.nextMonthNav, "flatpickr-disabled", bool); + self.__hideNextMonthArrow = bool; + } + }, + }); + self.currentYearElement = self.yearElements[0]; + updateNavigationCurrentMonth(); + return self.monthNav; + } + function buildTime() { + self.calendarContainer.classList.add("hasTime"); + if (self.config.noCalendar) + self.calendarContainer.classList.add("noCalendar"); + self.timeContainer = createElement("div", "flatpickr-time"); + self.timeContainer.tabIndex = -1; + var separator = createElement("span", "flatpickr-time-separator", ":"); + var hourInput = createNumberInput("flatpickr-hour", { + "aria-label": self.l10n.hourAriaLabel, + }); + self.hourElement = hourInput.getElementsByTagName("input")[0]; + var minuteInput = createNumberInput("flatpickr-minute", { + "aria-label": self.l10n.minuteAriaLabel, + }); + self.minuteElement = minuteInput.getElementsByTagName("input")[0]; + self.hourElement.tabIndex = self.minuteElement.tabIndex = -1; + self.hourElement.value = pad(self.latestSelectedDateObj + ? self.latestSelectedDateObj.getHours() + : self.config.time_24hr + ? self.config.defaultHour + : military2ampm(self.config.defaultHour)); + self.minuteElement.value = pad(self.latestSelectedDateObj + ? self.latestSelectedDateObj.getMinutes() + : self.config.defaultMinute); + self.hourElement.setAttribute("step", self.config.hourIncrement.toString()); + self.minuteElement.setAttribute("step", self.config.minuteIncrement.toString()); + self.hourElement.setAttribute("min", self.config.time_24hr ? "0" : "1"); + self.hourElement.setAttribute("max", self.config.time_24hr ? "23" : "12"); + self.minuteElement.setAttribute("min", "0"); + self.minuteElement.setAttribute("max", "59"); + self.timeContainer.appendChild(hourInput); + self.timeContainer.appendChild(separator); + self.timeContainer.appendChild(minuteInput); + if (self.config.time_24hr) + self.timeContainer.classList.add("time24hr"); + if (self.config.enableSeconds) { + self.timeContainer.classList.add("hasSeconds"); + var secondInput = createNumberInput("flatpickr-second"); + self.secondElement = secondInput.getElementsByTagName("input")[0]; + self.secondElement.value = pad(self.latestSelectedDateObj + ? self.latestSelectedDateObj.getSeconds() + : self.config.defaultSeconds); + self.secondElement.setAttribute("step", self.minuteElement.getAttribute("step")); + self.secondElement.setAttribute("min", "0"); + self.secondElement.setAttribute("max", "59"); + self.timeContainer.appendChild(createElement("span", "flatpickr-time-separator", ":")); + self.timeContainer.appendChild(secondInput); + } + if (!self.config.time_24hr) { + // add self.amPM if appropriate + self.amPM = createElement("span", "flatpickr-am-pm", self.l10n.amPM[int((self.latestSelectedDateObj + ? self.hourElement.value + : self.config.defaultHour) > 11)]); + self.amPM.title = self.l10n.toggleTitle; + self.amPM.tabIndex = -1; + self.timeContainer.appendChild(self.amPM); + } + return self.timeContainer; + } + function buildWeekdays() { + if (!self.weekdayContainer) + self.weekdayContainer = createElement("div", "flatpickr-weekdays"); + else + clearNode(self.weekdayContainer); + for (var i = self.config.showMonths; i--;) { + var container = createElement("div", "flatpickr-weekdaycontainer"); + self.weekdayContainer.appendChild(container); + } + updateWeekdays(); + return self.weekdayContainer; + } + function updateWeekdays() { + if (!self.weekdayContainer) { + return; + } + var firstDayOfWeek = self.l10n.firstDayOfWeek; + var weekdays = __spreadArrays(self.l10n.weekdays.shorthand); + if (firstDayOfWeek > 0 && firstDayOfWeek < weekdays.length) { + weekdays = __spreadArrays(weekdays.splice(firstDayOfWeek, weekdays.length), weekdays.splice(0, firstDayOfWeek)); + } + for (var i = self.config.showMonths; i--;) { + self.weekdayContainer.children[i].innerHTML = "\n \n " + weekdays.join("") + "\n \n "; + } + } + /* istanbul ignore next */ + function buildWeeks() { + self.calendarContainer.classList.add("hasWeeks"); + var weekWrapper = createElement("div", "flatpickr-weekwrapper"); + weekWrapper.appendChild(createElement("span", "flatpickr-weekday", self.l10n.weekAbbreviation)); + var weekNumbers = createElement("div", "flatpickr-weeks"); + weekWrapper.appendChild(weekNumbers); + return { + weekWrapper: weekWrapper, + weekNumbers: weekNumbers, + }; + } + function changeMonth(value, isOffset) { + if (isOffset === void 0) { isOffset = true; } + var delta = isOffset ? value : value - self.currentMonth; + if ((delta < 0 && self._hidePrevMonthArrow === true) || + (delta > 0 && self._hideNextMonthArrow === true)) + return; + self.currentMonth += delta; + if (self.currentMonth < 0 || self.currentMonth > 11) { + self.currentYear += self.currentMonth > 11 ? 1 : -1; + self.currentMonth = (self.currentMonth + 12) % 12; + triggerEvent("onYearChange"); + buildMonthSwitch(); + } + buildDays(); + triggerEvent("onMonthChange"); + updateNavigationCurrentMonth(); + } + function clear(triggerChangeEvent, toInitial) { + if (triggerChangeEvent === void 0) { triggerChangeEvent = true; } + if (toInitial === void 0) { toInitial = true; } + self.input.value = ""; + if (self.altInput !== undefined) + self.altInput.value = ""; + if (self.mobileInput !== undefined) + self.mobileInput.value = ""; + self.selectedDates = []; + self.latestSelectedDateObj = undefined; + if (toInitial === true) { + self.currentYear = self._initialDate.getFullYear(); + self.currentMonth = self._initialDate.getMonth(); + } + if (self.config.enableTime === true) { + var _a = getDefaultHours(), hours = _a.hours, minutes = _a.minutes, seconds = _a.seconds; + setHours(hours, minutes, seconds); + } + self.redraw(); + if (triggerChangeEvent) + // triggerChangeEvent is true (default) or an Event + triggerEvent("onChange"); + } + function close() { + self.isOpen = false; + if (!self.isMobile) { + if (self.calendarContainer !== undefined) { + self.calendarContainer.classList.remove("open"); + } + if (self._input !== undefined) { + self._input.classList.remove("active"); + } + } + triggerEvent("onClose"); + } + function destroy() { + if (self.config !== undefined) + triggerEvent("onDestroy"); + for (var i = self._handlers.length; i--;) { + var h = self._handlers[i]; + h.element.removeEventListener(h.event, h.handler, h.options); + } + self._handlers = []; + if (self.mobileInput) { + if (self.mobileInput.parentNode) + self.mobileInput.parentNode.removeChild(self.mobileInput); + self.mobileInput = undefined; + } + else if (self.calendarContainer && self.calendarContainer.parentNode) { + if (self.config.static && self.calendarContainer.parentNode) { + var wrapper = self.calendarContainer.parentNode; + wrapper.lastChild && wrapper.removeChild(wrapper.lastChild); + if (wrapper.parentNode) { + while (wrapper.firstChild) + wrapper.parentNode.insertBefore(wrapper.firstChild, wrapper); + wrapper.parentNode.removeChild(wrapper); + } + } + else + self.calendarContainer.parentNode.removeChild(self.calendarContainer); + } + if (self.altInput) { + self.input.type = "text"; + if (self.altInput.parentNode) + self.altInput.parentNode.removeChild(self.altInput); + delete self.altInput; + } + if (self.input) { + self.input.type = self.input._type; + self.input.classList.remove("flatpickr-input"); + self.input.removeAttribute("readonly"); + } + [ + "_showTimeInput", + "latestSelectedDateObj", + "_hideNextMonthArrow", + "_hidePrevMonthArrow", + "__hideNextMonthArrow", + "__hidePrevMonthArrow", + "isMobile", + "isOpen", + "selectedDateElem", + "minDateHasTime", + "maxDateHasTime", + "days", + "daysContainer", + "_input", + "_positionElement", + "innerContainer", + "rContainer", + "monthNav", + "todayDateElem", + "calendarContainer", + "weekdayContainer", + "prevMonthNav", + "nextMonthNav", + "monthsDropdownContainer", + "currentMonthElement", + "currentYearElement", + "navigationCurrentMonth", + "selectedDateElem", + "config", + ].forEach(function (k) { + try { + delete self[k]; + } + catch (_) { } + }); + } + function isCalendarElem(elem) { + if (self.config.appendTo && self.config.appendTo.contains(elem)) + return true; + return self.calendarContainer.contains(elem); + } + function documentClick(e) { + if (self.isOpen && !self.config.inline) { + var eventTarget_1 = getEventTarget(e); + var isCalendarElement = isCalendarElem(eventTarget_1); + var isInput = eventTarget_1 === self.input || + eventTarget_1 === self.altInput || + self.element.contains(eventTarget_1) || + // web components + // e.path is not present in all browsers. circumventing typechecks + (e.path && + e.path.indexOf && + (~e.path.indexOf(self.input) || + ~e.path.indexOf(self.altInput))); + var lostFocus = e.type === "blur" + ? isInput && + e.relatedTarget && + !isCalendarElem(e.relatedTarget) + : !isInput && + !isCalendarElement && + !isCalendarElem(e.relatedTarget); + var isIgnored = !self.config.ignoredFocusElements.some(function (elem) { + return elem.contains(eventTarget_1); + }); + if (lostFocus && isIgnored) { + if (self.timeContainer !== undefined && + self.minuteElement !== undefined && + self.hourElement !== undefined && + self.input.value !== "" && + self.input.value !== undefined) { + updateTime(); + } + self.close(); + if (self.config && + self.config.mode === "range" && + self.selectedDates.length === 1) { + self.clear(false); + self.redraw(); + } + } + } + } + function changeYear(newYear) { + if (!newYear || + (self.config.minDate && newYear < self.config.minDate.getFullYear()) || + (self.config.maxDate && newYear > self.config.maxDate.getFullYear())) + return; + var newYearNum = newYear, isNewYear = self.currentYear !== newYearNum; + self.currentYear = newYearNum || self.currentYear; + if (self.config.maxDate && + self.currentYear === self.config.maxDate.getFullYear()) { + self.currentMonth = Math.min(self.config.maxDate.getMonth(), self.currentMonth); + } + else if (self.config.minDate && + self.currentYear === self.config.minDate.getFullYear()) { + self.currentMonth = Math.max(self.config.minDate.getMonth(), self.currentMonth); + } + if (isNewYear) { + self.redraw(); + triggerEvent("onYearChange"); + buildMonthSwitch(); + } + } + function isEnabled(date, timeless) { + if (timeless === void 0) { timeless = true; } + var dateToCheck = self.parseDate(date, undefined, timeless); // timeless + if ((self.config.minDate && + dateToCheck && + compareDates(dateToCheck, self.config.minDate, timeless !== undefined ? timeless : !self.minDateHasTime) < 0) || + (self.config.maxDate && + dateToCheck && + compareDates(dateToCheck, self.config.maxDate, timeless !== undefined ? timeless : !self.maxDateHasTime) > 0)) + return false; + if (self.config.enable.length === 0 && self.config.disable.length === 0) + return true; + if (dateToCheck === undefined) + return false; + var bool = self.config.enable.length > 0, array = bool ? self.config.enable : self.config.disable; + for (var i = 0, d = void 0; i < array.length; i++) { + d = array[i]; + if (typeof d === "function" && + d(dateToCheck) // disabled by function + ) + return bool; + else if (d instanceof Date && + dateToCheck !== undefined && + d.getTime() === dateToCheck.getTime()) + // disabled by date + return bool; + else if (typeof d === "string" && dateToCheck !== undefined) { + // disabled by date string + var parsed = self.parseDate(d, undefined, true); + return parsed && parsed.getTime() === dateToCheck.getTime() + ? bool + : !bool; + } + else if ( + // disabled by range + typeof d === "object" && + dateToCheck !== undefined && + d.from && + d.to && + dateToCheck.getTime() >= d.from.getTime() && + dateToCheck.getTime() <= d.to.getTime()) + return bool; + } + return !bool; + } + function isInView(elem) { + if (self.daysContainer !== undefined) + return (elem.className.indexOf("hidden") === -1 && + elem.className.indexOf("flatpickr-disabled") === -1 && + self.daysContainer.contains(elem)); + return false; + } + function onBlur(e) { + var isInput = e.target === self._input; + if (isInput && + !(e.relatedTarget && isCalendarElem(e.relatedTarget))) { + self.setDate(self._input.value, true, e.target === self.altInput + ? self.config.altFormat + : self.config.dateFormat); + } + } + function onKeyDown(e) { + // e.key e.keyCode + // "Backspace" 8 + // "Tab" 9 + // "Enter" 13 + // "Escape" (IE "Esc") 27 + // "ArrowLeft" (IE "Left") 37 + // "ArrowUp" (IE "Up") 38 + // "ArrowRight" (IE "Right") 39 + // "ArrowDown" (IE "Down") 40 + // "Delete" (IE "Del") 46 + var eventTarget = getEventTarget(e); + var isInput = self.config.wrap + ? element.contains(eventTarget) + : eventTarget === self._input; + var allowInput = self.config.allowInput; + var allowKeydown = self.isOpen && (!allowInput || !isInput); + var allowInlineKeydown = self.config.inline && isInput && !allowInput; + if (e.keyCode === 13 && isInput) { + if (allowInput) { + self.setDate(self._input.value, true, eventTarget === self.altInput + ? self.config.altFormat + : self.config.dateFormat); + return eventTarget.blur(); + } + else { + self.open(); + } + } + else if (isCalendarElem(eventTarget) || + allowKeydown || + allowInlineKeydown) { + var isTimeObj = !!self.timeContainer && + self.timeContainer.contains(eventTarget); + switch (e.keyCode) { + case 13: + if (isTimeObj) { + e.preventDefault(); + updateTime(); + focusAndClose(); + } + else + selectDate(e); + break; + case 27: // escape + e.preventDefault(); + focusAndClose(); + break; + case 8: + case 46: + if (isInput && !self.config.allowInput) { + e.preventDefault(); + self.clear(); + } + break; + case 37: + case 39: + if (!isTimeObj && !isInput) { + e.preventDefault(); + if (self.daysContainer !== undefined && + (allowInput === false || + (document.activeElement && isInView(document.activeElement)))) { + var delta_1 = e.keyCode === 39 ? 1 : -1; + if (!e.ctrlKey) + focusOnDay(undefined, delta_1); + else { + e.stopPropagation(); + changeMonth(delta_1); + focusOnDay(getFirstAvailableDay(1), 0); + } + } + } + else if (self.hourElement) + self.hourElement.focus(); + break; + case 38: + case 40: + e.preventDefault(); + var delta = e.keyCode === 40 ? 1 : -1; + if ((self.daysContainer && + eventTarget.$i !== undefined) || + eventTarget === self.input || + eventTarget === self.altInput) { + if (e.ctrlKey) { + e.stopPropagation(); + changeYear(self.currentYear - delta); + focusOnDay(getFirstAvailableDay(1), 0); + } + else if (!isTimeObj) + focusOnDay(undefined, delta * 7); + } + else if (eventTarget === self.currentYearElement) { + changeYear(self.currentYear - delta); + } + else if (self.config.enableTime) { + if (!isTimeObj && self.hourElement) + self.hourElement.focus(); + updateTime(e); + self._debouncedChange(); + } + break; + case 9: + if (isTimeObj) { + var elems = [ + self.hourElement, + self.minuteElement, + self.secondElement, + self.amPM, + ] + .concat(self.pluginElements) + .filter(function (x) { return x; }); + var i = elems.indexOf(eventTarget); + if (i !== -1) { + var target = elems[i + (e.shiftKey ? -1 : 1)]; + e.preventDefault(); + (target || self._input).focus(); + } + } + else if (!self.config.noCalendar && + self.daysContainer && + self.daysContainer.contains(eventTarget) && + e.shiftKey) { + e.preventDefault(); + self._input.focus(); + } + break; + } + } + if (self.amPM !== undefined && eventTarget === self.amPM) { + switch (e.key) { + case self.l10n.amPM[0].charAt(0): + case self.l10n.amPM[0].charAt(0).toLowerCase(): + self.amPM.textContent = self.l10n.amPM[0]; + setHoursFromInputs(); + updateValue(); + break; + case self.l10n.amPM[1].charAt(0): + case self.l10n.amPM[1].charAt(0).toLowerCase(): + self.amPM.textContent = self.l10n.amPM[1]; + setHoursFromInputs(); + updateValue(); + break; + } + } + if (isInput || isCalendarElem(eventTarget)) { + triggerEvent("onKeyDown", e); + } + } + function onMouseOver(elem) { + if (self.selectedDates.length !== 1 || + (elem && + (!elem.classList.contains("flatpickr-day") || + elem.classList.contains("flatpickr-disabled")))) + return; + var hoverDate = elem + ? elem.dateObj.getTime() + : self.days.firstElementChild.dateObj.getTime(), initialDate = self.parseDate(self.selectedDates[0], undefined, true).getTime(), rangeStartDate = Math.min(hoverDate, self.selectedDates[0].getTime()), rangeEndDate = Math.max(hoverDate, self.selectedDates[0].getTime()); + var containsDisabled = false; + var minRange = 0, maxRange = 0; + for (var t = rangeStartDate; t < rangeEndDate; t += duration.DAY) { + if (!isEnabled(new Date(t), true)) { + containsDisabled = + containsDisabled || (t > rangeStartDate && t < rangeEndDate); + if (t < initialDate && (!minRange || t > minRange)) + minRange = t; + else if (t > initialDate && (!maxRange || t < maxRange)) + maxRange = t; + } + } + for (var m = 0; m < self.config.showMonths; m++) { + var month = self.daysContainer.children[m]; + var _loop_1 = function (i, l) { + var dayElem = month.children[i], date = dayElem.dateObj; + var timestamp = date.getTime(); + var outOfRange = (minRange > 0 && timestamp < minRange) || + (maxRange > 0 && timestamp > maxRange); + if (outOfRange) { + dayElem.classList.add("notAllowed"); + ["inRange", "startRange", "endRange"].forEach(function (c) { + dayElem.classList.remove(c); + }); + return "continue"; + } + else if (containsDisabled && !outOfRange) + return "continue"; + ["startRange", "inRange", "endRange", "notAllowed"].forEach(function (c) { + dayElem.classList.remove(c); + }); + if (elem !== undefined) { + elem.classList.add(hoverDate <= self.selectedDates[0].getTime() + ? "startRange" + : "endRange"); + if (initialDate < hoverDate && timestamp === initialDate) + dayElem.classList.add("startRange"); + else if (initialDate > hoverDate && timestamp === initialDate) + dayElem.classList.add("endRange"); + if (timestamp >= minRange && + (maxRange === 0 || timestamp <= maxRange) && + isBetween(timestamp, initialDate, hoverDate)) + dayElem.classList.add("inRange"); + } + }; + for (var i = 0, l = month.children.length; i < l; i++) { + _loop_1(i, l); + } + } + } + function onResize() { + if (self.isOpen && !self.config.static && !self.config.inline) + positionCalendar(); + } + function open(e, positionElement) { + if (positionElement === void 0) { positionElement = self._positionElement; } + if (self.isMobile === true) { + if (e) { + e.preventDefault(); + var eventTarget = getEventTarget(e); + eventTarget && eventTarget.blur(); + } + if (self.mobileInput !== undefined) { + self.mobileInput.focus(); + self.mobileInput.click(); + } + triggerEvent("onOpen"); + return; + } + if (self._input.disabled || self.config.inline) + return; + var wasOpen = self.isOpen; + self.isOpen = true; + if (!wasOpen) { + self.calendarContainer.classList.add("open"); + self._input.classList.add("active"); + triggerEvent("onOpen"); + positionCalendar(positionElement); + } + if (self.config.enableTime === true && self.config.noCalendar === true) { + if (self.config.allowInput === false && + (e === undefined || + !self.timeContainer.contains(e.relatedTarget))) { + setTimeout(function () { return self.hourElement.select(); }, 50); + } + } + } + function minMaxDateSetter(type) { + return function (date) { + var dateObj = (self.config["_" + type + "Date"] = self.parseDate(date, self.config.dateFormat)); + var inverseDateObj = self.config["_" + (type === "min" ? "max" : "min") + "Date"]; + if (dateObj !== undefined) { + self[type === "min" ? "minDateHasTime" : "maxDateHasTime"] = + dateObj.getHours() > 0 || + dateObj.getMinutes() > 0 || + dateObj.getSeconds() > 0; + } + if (self.selectedDates) { + self.selectedDates = self.selectedDates.filter(function (d) { return isEnabled(d); }); + if (!self.selectedDates.length && type === "min") + setHoursFromDate(dateObj); + updateValue(); + } + if (self.daysContainer) { + redraw(); + if (dateObj !== undefined) + self.currentYearElement[type] = dateObj.getFullYear().toString(); + else + self.currentYearElement.removeAttribute(type); + self.currentYearElement.disabled = + !!inverseDateObj && + dateObj !== undefined && + inverseDateObj.getFullYear() === dateObj.getFullYear(); + } + }; + } + function parseConfig() { + var boolOpts = [ + "wrap", + "weekNumbers", + "allowInput", + "allowInvalidPreload", + "clickOpens", + "time_24hr", + "enableTime", + "noCalendar", + "altInput", + "shorthandCurrentMonth", + "inline", + "static", + "enableSeconds", + "disableMobile", + ]; + var userConfig = __assign(__assign({}, JSON.parse(JSON.stringify(element.dataset || {}))), instanceConfig); + var formats = {}; + self.config.parseDate = userConfig.parseDate; + self.config.formatDate = userConfig.formatDate; + Object.defineProperty(self.config, "enable", { + get: function () { return self.config._enable; }, + set: function (dates) { + self.config._enable = parseDateRules(dates); + }, + }); + Object.defineProperty(self.config, "disable", { + get: function () { return self.config._disable; }, + set: function (dates) { + self.config._disable = parseDateRules(dates); + }, + }); + var timeMode = userConfig.mode === "time"; + if (!userConfig.dateFormat && (userConfig.enableTime || timeMode)) { + var defaultDateFormat = flatpickr.defaultConfig.dateFormat || defaults.dateFormat; + formats.dateFormat = + userConfig.noCalendar || timeMode + ? "H:i" + (userConfig.enableSeconds ? ":S" : "") + : defaultDateFormat + " H:i" + (userConfig.enableSeconds ? ":S" : ""); + } + if (userConfig.altInput && + (userConfig.enableTime || timeMode) && + !userConfig.altFormat) { + var defaultAltFormat = flatpickr.defaultConfig.altFormat || defaults.altFormat; + formats.altFormat = + userConfig.noCalendar || timeMode + ? "h:i" + (userConfig.enableSeconds ? ":S K" : " K") + : defaultAltFormat + (" h:i" + (userConfig.enableSeconds ? ":S" : "") + " K"); + } + Object.defineProperty(self.config, "minDate", { + get: function () { return self.config._minDate; }, + set: minMaxDateSetter("min"), + }); + Object.defineProperty(self.config, "maxDate", { + get: function () { return self.config._maxDate; }, + set: minMaxDateSetter("max"), + }); + var minMaxTimeSetter = function (type) { return function (val) { + self.config[type === "min" ? "_minTime" : "_maxTime"] = self.parseDate(val, "H:i:S"); + }; }; + Object.defineProperty(self.config, "minTime", { + get: function () { return self.config._minTime; }, + set: minMaxTimeSetter("min"), + }); + Object.defineProperty(self.config, "maxTime", { + get: function () { return self.config._maxTime; }, + set: minMaxTimeSetter("max"), + }); + if (userConfig.mode === "time") { + self.config.noCalendar = true; + self.config.enableTime = true; + } + Object.assign(self.config, formats, userConfig); + for (var i = 0; i < boolOpts.length; i++) + // https://github.com/microsoft/TypeScript/issues/31663 + self.config[boolOpts[i]] = + self.config[boolOpts[i]] === true || + self.config[boolOpts[i]] === "true"; + HOOKS.filter(function (hook) { return self.config[hook] !== undefined; }).forEach(function (hook) { + self.config[hook] = arrayify(self.config[hook] || []).map(bindToInstance); + }); + self.isMobile = + !self.config.disableMobile && + !self.config.inline && + self.config.mode === "single" && + !self.config.disable.length && + !self.config.enable.length && + !self.config.weekNumbers && + /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent); + for (var i = 0; i < self.config.plugins.length; i++) { + var pluginConf = self.config.plugins[i](self) || {}; + for (var key in pluginConf) { + if (HOOKS.indexOf(key) > -1) { + self.config[key] = arrayify(pluginConf[key]) + .map(bindToInstance) + .concat(self.config[key]); + } + else if (typeof userConfig[key] === "undefined") + self.config[key] = pluginConf[key]; + } + } + if (!userConfig.altInputClass) { + self.config.altInputClass = + getInputElem().className + " " + self.config.altInputClass; + } + triggerEvent("onParseConfig"); + } + function getInputElem() { + return self.config.wrap + ? element.querySelector("[data-input]") + : element; + } + function setupLocale() { + if (typeof self.config.locale !== "object" && + typeof flatpickr.l10ns[self.config.locale] === "undefined") + self.config.errorHandler(new Error("flatpickr: invalid locale " + self.config.locale)); + self.l10n = __assign(__assign({}, flatpickr.l10ns.default), (typeof self.config.locale === "object" + ? self.config.locale + : self.config.locale !== "default" + ? flatpickr.l10ns[self.config.locale] + : undefined)); + tokenRegex.K = "(" + self.l10n.amPM[0] + "|" + self.l10n.amPM[1] + "|" + self.l10n.amPM[0].toLowerCase() + "|" + self.l10n.amPM[1].toLowerCase() + ")"; + var userConfig = __assign(__assign({}, instanceConfig), JSON.parse(JSON.stringify(element.dataset || {}))); + if (userConfig.time_24hr === undefined && + flatpickr.defaultConfig.time_24hr === undefined) { + self.config.time_24hr = self.l10n.time_24hr; + } + self.formatDate = createDateFormatter(self); + self.parseDate = createDateParser({ config: self.config, l10n: self.l10n }); + } + function positionCalendar(customPositionElement) { + if (self.calendarContainer === undefined) + return; + triggerEvent("onPreCalendarPosition"); + var positionElement = customPositionElement || self._positionElement; + var calendarHeight = Array.prototype.reduce.call(self.calendarContainer.children, (function (acc, child) { return acc + child.offsetHeight; }), 0), calendarWidth = self.calendarContainer.offsetWidth, configPos = self.config.position.split(" "), configPosVertical = configPos[0], configPosHorizontal = configPos.length > 1 ? configPos[1] : null, inputBounds = positionElement.getBoundingClientRect(), distanceFromBottom = window.innerHeight - inputBounds.bottom, showOnTop = configPosVertical === "above" || + (configPosVertical !== "below" && + distanceFromBottom < calendarHeight && + inputBounds.top > calendarHeight); + var top = window.pageYOffset + + inputBounds.top + + (!showOnTop ? positionElement.offsetHeight + 2 : -calendarHeight - 2); + toggleClass(self.calendarContainer, "arrowTop", !showOnTop); + toggleClass(self.calendarContainer, "arrowBottom", showOnTop); + if (self.config.inline) + return; + var left = window.pageXOffset + inputBounds.left; + var isCenter = false; + var isRight = false; + if (configPosHorizontal === "center") { + left -= (calendarWidth - inputBounds.width) / 2; + isCenter = true; + } + else if (configPosHorizontal === "right") { + left -= calendarWidth - inputBounds.width; + isRight = true; + } + toggleClass(self.calendarContainer, "arrowLeft", !isCenter && !isRight); + toggleClass(self.calendarContainer, "arrowCenter", isCenter); + toggleClass(self.calendarContainer, "arrowRight", isRight); + var right = window.document.body.offsetWidth - + (window.pageXOffset + inputBounds.right); + var rightMost = left + calendarWidth > window.document.body.offsetWidth; + var centerMost = right + calendarWidth > window.document.body.offsetWidth; + toggleClass(self.calendarContainer, "rightMost", rightMost); + if (self.config.static) + return; + self.calendarContainer.style.top = top + "px"; + if (!rightMost) { + self.calendarContainer.style.left = left + "px"; + self.calendarContainer.style.right = "auto"; + } + else if (!centerMost) { + self.calendarContainer.style.left = "auto"; + self.calendarContainer.style.right = right + "px"; + } + else { + var doc = getDocumentStyleSheet(); + // some testing environments don't have css support + if (doc === undefined) + return; + var bodyWidth = window.document.body.offsetWidth; + var centerLeft = Math.max(0, bodyWidth / 2 - calendarWidth / 2); + var centerBefore = ".flatpickr-calendar.centerMost:before"; + var centerAfter = ".flatpickr-calendar.centerMost:after"; + var centerIndex = doc.cssRules.length; + var centerStyle = "{left:" + inputBounds.left + "px;right:auto;}"; + toggleClass(self.calendarContainer, "rightMost", false); + toggleClass(self.calendarContainer, "centerMost", true); + doc.insertRule(centerBefore + "," + centerAfter + centerStyle, centerIndex); + self.calendarContainer.style.left = centerLeft + "px"; + self.calendarContainer.style.right = "auto"; + } + } + function getDocumentStyleSheet() { + var editableSheet = null; + for (var i = 0; i < document.styleSheets.length; i++) { + var sheet = document.styleSheets[i]; + try { + sheet.cssRules; + } + catch (err) { + continue; + } + editableSheet = sheet; + break; + } + return editableSheet != null ? editableSheet : createStyleSheet(); + } + function createStyleSheet() { + var style = document.createElement("style"); + document.head.appendChild(style); + return style.sheet; + } + function redraw() { + if (self.config.noCalendar || self.isMobile) + return; + buildMonthSwitch(); + updateNavigationCurrentMonth(); + buildDays(); + } + function focusAndClose() { + self._input.focus(); + if (window.navigator.userAgent.indexOf("MSIE") !== -1 || + navigator.msMaxTouchPoints !== undefined) { + // hack - bugs in the way IE handles focus keeps the calendar open + setTimeout(self.close, 0); + } + else { + self.close(); + } + } + function selectDate(e) { + e.preventDefault(); + e.stopPropagation(); + var isSelectable = function (day) { + return day.classList && + day.classList.contains("flatpickr-day") && + !day.classList.contains("flatpickr-disabled") && + !day.classList.contains("notAllowed"); + }; + var t = findParent(getEventTarget(e), isSelectable); + if (t === undefined) + return; + var target = t; + var selectedDate = (self.latestSelectedDateObj = new Date(target.dateObj.getTime())); + var shouldChangeMonth = (selectedDate.getMonth() < self.currentMonth || + selectedDate.getMonth() > + self.currentMonth + self.config.showMonths - 1) && + self.config.mode !== "range"; + self.selectedDateElem = target; + if (self.config.mode === "single") + self.selectedDates = [selectedDate]; + else if (self.config.mode === "multiple") { + var selectedIndex = isDateSelected(selectedDate); + if (selectedIndex) + self.selectedDates.splice(parseInt(selectedIndex), 1); + else + self.selectedDates.push(selectedDate); + } + else if (self.config.mode === "range") { + if (self.selectedDates.length === 2) { + self.clear(false, false); + } + self.latestSelectedDateObj = selectedDate; + self.selectedDates.push(selectedDate); + // unless selecting same date twice, sort ascendingly + if (compareDates(selectedDate, self.selectedDates[0], true) !== 0) + self.selectedDates.sort(function (a, b) { return a.getTime() - b.getTime(); }); + } + setHoursFromInputs(); + if (shouldChangeMonth) { + var isNewYear = self.currentYear !== selectedDate.getFullYear(); + self.currentYear = selectedDate.getFullYear(); + self.currentMonth = selectedDate.getMonth(); + if (isNewYear) { + triggerEvent("onYearChange"); + buildMonthSwitch(); + } + triggerEvent("onMonthChange"); + } + updateNavigationCurrentMonth(); + buildDays(); + updateValue(); + // maintain focus + if (!shouldChangeMonth && + self.config.mode !== "range" && + self.config.showMonths === 1) + focusOnDayElem(target); + else if (self.selectedDateElem !== undefined && + self.hourElement === undefined) { + self.selectedDateElem && self.selectedDateElem.focus(); + } + if (self.hourElement !== undefined) + self.hourElement !== undefined && self.hourElement.focus(); + if (self.config.closeOnSelect) { + var single = self.config.mode === "single" && !self.config.enableTime; + var range = self.config.mode === "range" && + self.selectedDates.length === 2 && + !self.config.enableTime; + if (single || range) { + focusAndClose(); + } + } + triggerChange(); + } + var CALLBACKS = { + locale: [setupLocale, updateWeekdays], + showMonths: [buildMonths, setCalendarWidth, buildWeekdays], + minDate: [jumpToDate], + maxDate: [jumpToDate], + }; + function set(option, value) { + if (option !== null && typeof option === "object") { + Object.assign(self.config, option); + for (var key in option) { + if (CALLBACKS[key] !== undefined) + CALLBACKS[key].forEach(function (x) { return x(); }); + } + } + else { + self.config[option] = value; + if (CALLBACKS[option] !== undefined) + CALLBACKS[option].forEach(function (x) { return x(); }); + else if (HOOKS.indexOf(option) > -1) + self.config[option] = arrayify(value); + } + self.redraw(); + updateValue(true); + } + function setSelectedDate(inputDate, format) { + var dates = []; + if (inputDate instanceof Array) + dates = inputDate.map(function (d) { return self.parseDate(d, format); }); + else if (inputDate instanceof Date || typeof inputDate === "number") + dates = [self.parseDate(inputDate, format)]; + else if (typeof inputDate === "string") { + switch (self.config.mode) { + case "single": + case "time": + dates = [self.parseDate(inputDate, format)]; + break; + case "multiple": + dates = inputDate + .split(self.config.conjunction) + .map(function (date) { return self.parseDate(date, format); }); + break; + case "range": + dates = inputDate + .split(self.l10n.rangeSeparator) + .map(function (date) { return self.parseDate(date, format); }); + break; + } + } + else + self.config.errorHandler(new Error("Invalid date supplied: " + JSON.stringify(inputDate))); + self.selectedDates = (self.config.allowInvalidPreload + ? dates + : dates.filter(function (d) { return d instanceof Date && isEnabled(d, false); })); + if (self.config.mode === "range") + self.selectedDates.sort(function (a, b) { return a.getTime() - b.getTime(); }); + } + function setDate(date, triggerChange, format) { + if (triggerChange === void 0) { triggerChange = false; } + if (format === void 0) { format = self.config.dateFormat; } + if ((date !== 0 && !date) || (date instanceof Array && date.length === 0)) + return self.clear(triggerChange); + setSelectedDate(date, format); + self.latestSelectedDateObj = + self.selectedDates[self.selectedDates.length - 1]; + self.redraw(); + jumpToDate(undefined, triggerChange); + setHoursFromDate(); + if (self.selectedDates.length === 0) { + self.clear(false); + } + updateValue(triggerChange); + if (triggerChange) + triggerEvent("onChange"); + } + function parseDateRules(arr) { + return arr + .slice() + .map(function (rule) { + if (typeof rule === "string" || + typeof rule === "number" || + rule instanceof Date) { + return self.parseDate(rule, undefined, true); + } + else if (rule && + typeof rule === "object" && + rule.from && + rule.to) + return { + from: self.parseDate(rule.from, undefined), + to: self.parseDate(rule.to, undefined), + }; + return rule; + }) + .filter(function (x) { return x; }); // remove falsy values + } + function setupDates() { + self.selectedDates = []; + self.now = self.parseDate(self.config.now) || new Date(); + // Workaround IE11 setting placeholder as the input's value + var preloadedDate = self.config.defaultDate || + ((self.input.nodeName === "INPUT" || + self.input.nodeName === "TEXTAREA") && + self.input.placeholder && + self.input.value === self.input.placeholder + ? null + : self.input.value); + if (preloadedDate) + setSelectedDate(preloadedDate, self.config.dateFormat); + self._initialDate = + self.selectedDates.length > 0 + ? self.selectedDates[0] + : self.config.minDate && + self.config.minDate.getTime() > self.now.getTime() + ? self.config.minDate + : self.config.maxDate && + self.config.maxDate.getTime() < self.now.getTime() + ? self.config.maxDate + : self.now; + self.currentYear = self._initialDate.getFullYear(); + self.currentMonth = self._initialDate.getMonth(); + if (self.selectedDates.length > 0) + self.latestSelectedDateObj = self.selectedDates[0]; + if (self.config.minTime !== undefined) + self.config.minTime = self.parseDate(self.config.minTime, "H:i"); + if (self.config.maxTime !== undefined) + self.config.maxTime = self.parseDate(self.config.maxTime, "H:i"); + self.minDateHasTime = + !!self.config.minDate && + (self.config.minDate.getHours() > 0 || + self.config.minDate.getMinutes() > 0 || + self.config.minDate.getSeconds() > 0); + self.maxDateHasTime = + !!self.config.maxDate && + (self.config.maxDate.getHours() > 0 || + self.config.maxDate.getMinutes() > 0 || + self.config.maxDate.getSeconds() > 0); + } + function setupInputs() { + self.input = getInputElem(); + /* istanbul ignore next */ + if (!self.input) { + self.config.errorHandler(new Error("Invalid input element specified")); + return; + } + // hack: store previous type to restore it after destroy() + self.input._type = self.input.type; + self.input.type = "text"; + self.input.classList.add("flatpickr-input"); + self._input = self.input; + if (self.config.altInput) { + // replicate self.element + self.altInput = createElement(self.input.nodeName, self.config.altInputClass); + self._input = self.altInput; + self.altInput.placeholder = self.input.placeholder; + self.altInput.disabled = self.input.disabled; + self.altInput.required = self.input.required; + self.altInput.tabIndex = self.input.tabIndex; + self.altInput.type = "text"; + self.input.setAttribute("type", "hidden"); + if (!self.config.static && self.input.parentNode) + self.input.parentNode.insertBefore(self.altInput, self.input.nextSibling); + } + if (!self.config.allowInput) + self._input.setAttribute("readonly", "readonly"); + self._positionElement = self.config.positionElement || self._input; + } + function setupMobile() { + var inputType = self.config.enableTime + ? self.config.noCalendar + ? "time" + : "datetime-local" + : "date"; + self.mobileInput = createElement("input", self.input.className + " flatpickr-mobile"); + self.mobileInput.tabIndex = 1; + self.mobileInput.type = inputType; + self.mobileInput.disabled = self.input.disabled; + self.mobileInput.required = self.input.required; + self.mobileInput.placeholder = self.input.placeholder; + self.mobileFormatStr = + inputType === "datetime-local" + ? "Y-m-d\\TH:i:S" + : inputType === "date" + ? "Y-m-d" + : "H:i:S"; + if (self.selectedDates.length > 0) { + self.mobileInput.defaultValue = self.mobileInput.value = self.formatDate(self.selectedDates[0], self.mobileFormatStr); + } + if (self.config.minDate) + self.mobileInput.min = self.formatDate(self.config.minDate, "Y-m-d"); + if (self.config.maxDate) + self.mobileInput.max = self.formatDate(self.config.maxDate, "Y-m-d"); + if (self.input.getAttribute("step")) + self.mobileInput.step = String(self.input.getAttribute("step")); + self.input.type = "hidden"; + if (self.altInput !== undefined) + self.altInput.type = "hidden"; + try { + if (self.input.parentNode) + self.input.parentNode.insertBefore(self.mobileInput, self.input.nextSibling); + } + catch (_a) { } + bind(self.mobileInput, "change", function (e) { + self.setDate(getEventTarget(e).value, false, self.mobileFormatStr); + triggerEvent("onChange"); + triggerEvent("onClose"); + }); + } + function toggle(e) { + if (self.isOpen === true) + return self.close(); + self.open(e); + } + function triggerEvent(event, data) { + // If the instance has been destroyed already, all hooks have been removed + if (self.config === undefined) + return; + var hooks = self.config[event]; + if (hooks !== undefined && hooks.length > 0) { + for (var i = 0; hooks[i] && i < hooks.length; i++) + hooks[i](self.selectedDates, self.input.value, self, data); + } + if (event === "onChange") { + self.input.dispatchEvent(createEvent("change")); + // many front-end frameworks bind to the input event + self.input.dispatchEvent(createEvent("input")); + } + } + function createEvent(name) { + var e = document.createEvent("Event"); + e.initEvent(name, true, true); + return e; + } + function isDateSelected(date) { + for (var i = 0; i < self.selectedDates.length; i++) { + if (compareDates(self.selectedDates[i], date) === 0) + return "" + i; + } + return false; + } + function isDateInRange(date) { + if (self.config.mode !== "range" || self.selectedDates.length < 2) + return false; + return (compareDates(date, self.selectedDates[0]) >= 0 && + compareDates(date, self.selectedDates[1]) <= 0); + } + function updateNavigationCurrentMonth() { + if (self.config.noCalendar || self.isMobile || !self.monthNav) + return; + self.yearElements.forEach(function (yearElement, i) { + var d = new Date(self.currentYear, self.currentMonth, 1); + d.setMonth(self.currentMonth + i); + if (self.config.showMonths > 1 || + self.config.monthSelectorType === "static") { + self.monthElements[i].textContent = + monthToStr(d.getMonth(), self.config.shorthandCurrentMonth, self.l10n) + " "; + } + else { + self.monthsDropdownContainer.value = d.getMonth().toString(); + } + yearElement.value = d.getFullYear().toString(); + }); + self._hidePrevMonthArrow = + self.config.minDate !== undefined && + (self.currentYear === self.config.minDate.getFullYear() + ? self.currentMonth <= self.config.minDate.getMonth() + : self.currentYear < self.config.minDate.getFullYear()); + self._hideNextMonthArrow = + self.config.maxDate !== undefined && + (self.currentYear === self.config.maxDate.getFullYear() + ? self.currentMonth + 1 > self.config.maxDate.getMonth() + : self.currentYear > self.config.maxDate.getFullYear()); + } + function getDateStr(format) { + return self.selectedDates + .map(function (dObj) { return self.formatDate(dObj, format); }) + .filter(function (d, i, arr) { + return self.config.mode !== "range" || + self.config.enableTime || + arr.indexOf(d) === i; + }) + .join(self.config.mode !== "range" + ? self.config.conjunction + : self.l10n.rangeSeparator); + } + /** + * Updates the values of inputs associated with the calendar + */ + function updateValue(triggerChange) { + if (triggerChange === void 0) { triggerChange = true; } + if (self.mobileInput !== undefined && self.mobileFormatStr) { + self.mobileInput.value = + self.latestSelectedDateObj !== undefined + ? self.formatDate(self.latestSelectedDateObj, self.mobileFormatStr) + : ""; + } + self.input.value = getDateStr(self.config.dateFormat); + if (self.altInput !== undefined) { + self.altInput.value = getDateStr(self.config.altFormat); + } + if (triggerChange !== false) + triggerEvent("onValueUpdate"); + } + function onMonthNavClick(e) { + var eventTarget = getEventTarget(e); + var isPrevMonth = self.prevMonthNav.contains(eventTarget); + var isNextMonth = self.nextMonthNav.contains(eventTarget); + if (isPrevMonth || isNextMonth) { + changeMonth(isPrevMonth ? -1 : 1); + } + else if (self.yearElements.indexOf(eventTarget) >= 0) { + eventTarget.select(); + } + else if (eventTarget.classList.contains("arrowUp")) { + self.changeYear(self.currentYear + 1); + } + else if (eventTarget.classList.contains("arrowDown")) { + self.changeYear(self.currentYear - 1); + } + } + function timeWrapper(e) { + e.preventDefault(); + var isKeyDown = e.type === "keydown", eventTarget = getEventTarget(e), input = eventTarget; + if (self.amPM !== undefined && eventTarget === self.amPM) { + self.amPM.textContent = + self.l10n.amPM[int(self.amPM.textContent === self.l10n.amPM[0])]; + } + var min = parseFloat(input.getAttribute("min")), max = parseFloat(input.getAttribute("max")), step = parseFloat(input.getAttribute("step")), curValue = parseInt(input.value, 10), delta = e.delta || + (isKeyDown ? (e.which === 38 ? 1 : -1) : 0); + var newValue = curValue + step * delta; + if (typeof input.value !== "undefined" && input.value.length === 2) { + var isHourElem = input === self.hourElement, isMinuteElem = input === self.minuteElement; + if (newValue < min) { + newValue = + max + + newValue + + int(!isHourElem) + + (int(isHourElem) && int(!self.amPM)); + if (isMinuteElem) + incrementNumInput(undefined, -1, self.hourElement); + } + else if (newValue > max) { + newValue = + input === self.hourElement ? newValue - max - int(!self.amPM) : min; + if (isMinuteElem) + incrementNumInput(undefined, 1, self.hourElement); + } + if (self.amPM && + isHourElem && + (step === 1 + ? newValue + curValue === 23 + : Math.abs(newValue - curValue) > step)) { + self.amPM.textContent = + self.l10n.amPM[int(self.amPM.textContent === self.l10n.amPM[0])]; + } + input.value = pad(newValue); + } + } + init(); + return self; + } + /* istanbul ignore next */ + function _flatpickr(nodeList, config) { + // static list + var nodes = Array.prototype.slice + .call(nodeList) + .filter(function (x) { return x instanceof HTMLElement; }); + var instances = []; + for (var i = 0; i < nodes.length; i++) { + var node = nodes[i]; + try { + if (node.getAttribute("data-fp-omit") !== null) + continue; + if (node._flatpickr !== undefined) { + node._flatpickr.destroy(); + node._flatpickr = undefined; + } + node._flatpickr = FlatpickrInstance(node, config || {}); + instances.push(node._flatpickr); + } + catch (e) { + console.error(e); + } + } + return instances.length === 1 ? instances[0] : instances; + } + /* istanbul ignore next */ + if (typeof HTMLElement !== "undefined" && + typeof HTMLCollection !== "undefined" && + typeof NodeList !== "undefined") { + // browser env + HTMLCollection.prototype.flatpickr = NodeList.prototype.flatpickr = function (config) { + return _flatpickr(this, config); + }; + HTMLElement.prototype.flatpickr = function (config) { + return _flatpickr([this], config); + }; + } + /* istanbul ignore next */ + var flatpickr = function (selector, config) { + if (typeof selector === "string") { + return _flatpickr(window.document.querySelectorAll(selector), config); + } + else if (selector instanceof Node) { + return _flatpickr([selector], config); + } + else { + return _flatpickr(selector, config); + } + }; + /* istanbul ignore next */ + flatpickr.defaultConfig = {}; + flatpickr.l10ns = { + en: __assign({}, english), + default: __assign({}, english), + }; + flatpickr.localize = function (l10n) { + flatpickr.l10ns.default = __assign(__assign({}, flatpickr.l10ns.default), l10n); + }; + flatpickr.setDefaults = function (config) { + flatpickr.defaultConfig = __assign(__assign({}, flatpickr.defaultConfig), config); + }; + flatpickr.parseDate = createDateParser({}); + flatpickr.formatDate = createDateFormatter({}); + flatpickr.compareDates = compareDates; + /* istanbul ignore next */ + if (typeof jQuery !== "undefined" && typeof jQuery.fn !== "undefined") { + jQuery.fn.flatpickr = function (config) { + return _flatpickr(this, config); + }; + } + // eslint-disable-next-line @typescript-eslint/camelcase + Date.prototype.fp_incr = function (days) { + return new Date(this.getFullYear(), this.getMonth(), this.getDate() + (typeof days === "string" ? parseInt(days, 10) : days)); + }; + if (typeof window !== "undefined") { + window.flatpickr = flatpickr; + } + + return flatpickr; + +}))); diff --git a/website/js/vendor/flatpickr/flatpickr.min.css b/website/js/vendor/flatpickr/flatpickr.min.css new file mode 100644 index 0000000..2b5da59 --- /dev/null +++ b/website/js/vendor/flatpickr/flatpickr.min.css @@ -0,0 +1,13 @@ +.flatpickr-calendar{background:transparent;opacity:0;display:none;text-align:center;visibility:hidden;padding:0;-webkit-animation:none;animation:none;direction:ltr;border:0;font-size:14px;line-height:24px;border-radius:5px;position:absolute;width:307.875px;-webkit-box-sizing:border-box;box-sizing:border-box;-ms-touch-action:manipulation;touch-action:manipulation;background:#fff;-webkit-box-shadow:1px 0 0 #e6e6e6,-1px 0 0 #e6e6e6,0 1px 0 #e6e6e6,0 -1px 0 #e6e6e6,0 3px 13px rgba(0,0,0,0.08);box-shadow:1px 0 0 #e6e6e6,-1px 0 0 #e6e6e6,0 1px 0 #e6e6e6,0 -1px 0 #e6e6e6,0 3px 13px rgba(0,0,0,0.08)}.flatpickr-calendar.open,.flatpickr-calendar.inline{opacity:1;max-height:640px;visibility:visible}.flatpickr-calendar.open{display:inline-block;z-index:99999}.flatpickr-calendar.animate.open{-webkit-animation:fpFadeInDown 300ms cubic-bezier(.23,1,.32,1);animation:fpFadeInDown 300ms cubic-bezier(.23,1,.32,1)}.flatpickr-calendar.inline{display:block;position:relative;top:2px}.flatpickr-calendar.static{position:absolute;top:calc(100% + 2px)}.flatpickr-calendar.static.open{z-index:999;display:block}.flatpickr-calendar.multiMonth .flatpickr-days .dayContainer:nth-child(n+1) .flatpickr-day.inRange:nth-child(7n+7){-webkit-box-shadow:none !important;box-shadow:none !important}.flatpickr-calendar.multiMonth .flatpickr-days .dayContainer:nth-child(n+2) .flatpickr-day.inRange:nth-child(7n+1){-webkit-box-shadow:-2px 0 0 #e6e6e6,5px 0 0 #e6e6e6;box-shadow:-2px 0 0 #e6e6e6,5px 0 0 #e6e6e6}.flatpickr-calendar .hasWeeks .dayContainer,.flatpickr-calendar .hasTime .dayContainer{border-bottom:0;border-bottom-right-radius:0;border-bottom-left-radius:0}.flatpickr-calendar .hasWeeks .dayContainer{border-left:0}.flatpickr-calendar.hasTime .flatpickr-time{height:40px;border-top:1px solid #e6e6e6}.flatpickr-calendar.noCalendar.hasTime .flatpickr-time{height:auto}.flatpickr-calendar:before,.flatpickr-calendar:after{position:absolute;display:block;pointer-events:none;border:solid transparent;content:'';height:0;width:0;left:22px}.flatpickr-calendar.rightMost:before,.flatpickr-calendar.arrowRight:before,.flatpickr-calendar.rightMost:after,.flatpickr-calendar.arrowRight:after{left:auto;right:22px}.flatpickr-calendar.arrowCenter:before,.flatpickr-calendar.arrowCenter:after{left:50%;right:50%}.flatpickr-calendar:before{border-width:5px;margin:0 -5px}.flatpickr-calendar:after{border-width:4px;margin:0 -4px}.flatpickr-calendar.arrowTop:before,.flatpickr-calendar.arrowTop:after{bottom:100%}.flatpickr-calendar.arrowTop:before{border-bottom-color:#e6e6e6}.flatpickr-calendar.arrowTop:after{border-bottom-color:#fff}.flatpickr-calendar.arrowBottom:before,.flatpickr-calendar.arrowBottom:after{top:100%}.flatpickr-calendar.arrowBottom:before{border-top-color:#e6e6e6}.flatpickr-calendar.arrowBottom:after{border-top-color:#fff}.flatpickr-calendar:focus{outline:0}.flatpickr-wrapper{position:relative;display:inline-block}.flatpickr-months{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex}.flatpickr-months .flatpickr-month{background:transparent;color:rgba(0,0,0,0.9);fill:rgba(0,0,0,0.9);height:34px;line-height:1;text-align:center;position:relative;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;overflow:hidden;-webkit-box-flex:1;-webkit-flex:1;-ms-flex:1;flex:1}.flatpickr-months .flatpickr-prev-month,.flatpickr-months .flatpickr-next-month{text-decoration:none;cursor:pointer;position:absolute;top:0;height:34px;padding:10px;z-index:3;color:rgba(0,0,0,0.9);fill:rgba(0,0,0,0.9)}.flatpickr-months .flatpickr-prev-month.flatpickr-disabled,.flatpickr-months .flatpickr-next-month.flatpickr-disabled{display:none}.flatpickr-months .flatpickr-prev-month i,.flatpickr-months .flatpickr-next-month i{position:relative}.flatpickr-months .flatpickr-prev-month.flatpickr-prev-month,.flatpickr-months .flatpickr-next-month.flatpickr-prev-month{/* + /*rtl:begin:ignore*/left:0/* + /*rtl:end:ignore*/}/* + /*rtl:begin:ignore*/ +/* + /*rtl:end:ignore*/ +.flatpickr-months .flatpickr-prev-month.flatpickr-next-month,.flatpickr-months .flatpickr-next-month.flatpickr-next-month{/* + /*rtl:begin:ignore*/right:0/* + /*rtl:end:ignore*/}/* + /*rtl:begin:ignore*/ +/* + /*rtl:end:ignore*/ +.flatpickr-months .flatpickr-prev-month:hover,.flatpickr-months .flatpickr-next-month:hover{color:#959ea9}.flatpickr-months .flatpickr-prev-month:hover svg,.flatpickr-months .flatpickr-next-month:hover svg{fill:#f64747}.flatpickr-months .flatpickr-prev-month svg,.flatpickr-months .flatpickr-next-month svg{width:14px;height:14px}.flatpickr-months .flatpickr-prev-month svg path,.flatpickr-months .flatpickr-next-month svg path{-webkit-transition:fill .1s;transition:fill .1s;fill:inherit}.numInputWrapper{position:relative;height:auto}.numInputWrapper input,.numInputWrapper span{display:inline-block}.numInputWrapper input{width:100%}.numInputWrapper input::-ms-clear{display:none}.numInputWrapper input::-webkit-outer-spin-button,.numInputWrapper input::-webkit-inner-spin-button{margin:0;-webkit-appearance:none}.numInputWrapper span{position:absolute;right:0;width:14px;padding:0 4px 0 2px;height:50%;line-height:50%;opacity:0;cursor:pointer;border:1px solid rgba(57,57,57,0.15);-webkit-box-sizing:border-box;box-sizing:border-box}.numInputWrapper span:hover{background:rgba(0,0,0,0.1)}.numInputWrapper span:active{background:rgba(0,0,0,0.2)}.numInputWrapper span:after{display:block;content:"";position:absolute}.numInputWrapper span.arrowUp{top:0;border-bottom:0}.numInputWrapper span.arrowUp:after{border-left:4px solid transparent;border-right:4px solid transparent;border-bottom:4px solid rgba(57,57,57,0.6);top:26%}.numInputWrapper span.arrowDown{top:50%}.numInputWrapper span.arrowDown:after{border-left:4px solid transparent;border-right:4px solid transparent;border-top:4px solid rgba(57,57,57,0.6);top:40%}.numInputWrapper span svg{width:inherit;height:auto}.numInputWrapper span svg path{fill:rgba(0,0,0,0.5)}.numInputWrapper:hover{background:rgba(0,0,0,0.05)}.numInputWrapper:hover span{opacity:1}.flatpickr-current-month{font-size:135%;line-height:inherit;font-weight:300;color:inherit;position:absolute;width:75%;left:12.5%;padding:7.48px 0 0 0;line-height:1;height:34px;display:inline-block;text-align:center;-webkit-transform:translate3d(0,0,0);transform:translate3d(0,0,0)}.flatpickr-current-month span.cur-month{font-family:inherit;font-weight:700;color:inherit;display:inline-block;margin-left:.5ch;padding:0}.flatpickr-current-month span.cur-month:hover{background:rgba(0,0,0,0.05)}.flatpickr-current-month .numInputWrapper{width:6ch;width:7ch\0;display:inline-block}.flatpickr-current-month .numInputWrapper span.arrowUp:after{border-bottom-color:rgba(0,0,0,0.9)}.flatpickr-current-month .numInputWrapper span.arrowDown:after{border-top-color:rgba(0,0,0,0.9)}.flatpickr-current-month input.cur-year{background:transparent;-webkit-box-sizing:border-box;box-sizing:border-box;color:inherit;cursor:text;padding:0 0 0 .5ch;margin:0;display:inline-block;font-size:inherit;font-family:inherit;font-weight:300;line-height:inherit;height:auto;border:0;border-radius:0;vertical-align:initial;-webkit-appearance:textfield;-moz-appearance:textfield;appearance:textfield}.flatpickr-current-month input.cur-year:focus{outline:0}.flatpickr-current-month input.cur-year[disabled],.flatpickr-current-month input.cur-year[disabled]:hover{font-size:100%;color:rgba(0,0,0,0.5);background:transparent;pointer-events:none}.flatpickr-current-month .flatpickr-monthDropdown-months{appearance:menulist;background:transparent;border:none;border-radius:0;box-sizing:border-box;color:inherit;cursor:pointer;font-size:inherit;font-family:inherit;font-weight:300;height:auto;line-height:inherit;margin:-1px 0 0 0;outline:none;padding:0 0 0 .5ch;position:relative;vertical-align:initial;-webkit-box-sizing:border-box;-webkit-appearance:menulist;-moz-appearance:menulist;width:auto}.flatpickr-current-month .flatpickr-monthDropdown-months:focus,.flatpickr-current-month .flatpickr-monthDropdown-months:active{outline:none}.flatpickr-current-month .flatpickr-monthDropdown-months:hover{background:rgba(0,0,0,0.05)}.flatpickr-current-month .flatpickr-monthDropdown-months .flatpickr-monthDropdown-month{background-color:transparent;outline:none;padding:0}.flatpickr-weekdays{background:transparent;text-align:center;overflow:hidden;width:100%;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-box-align:center;-webkit-align-items:center;-ms-flex-align:center;align-items:center;height:28px}.flatpickr-weekdays .flatpickr-weekdaycontainer{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-box-flex:1;-webkit-flex:1;-ms-flex:1;flex:1}span.flatpickr-weekday{cursor:default;font-size:90%;background:transparent;color:rgba(0,0,0,0.54);line-height:1;margin:0;text-align:center;display:block;-webkit-box-flex:1;-webkit-flex:1;-ms-flex:1;flex:1;font-weight:bolder}.dayContainer,.flatpickr-weeks{padding:1px 0 0 0}.flatpickr-days{position:relative;overflow:hidden;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-box-align:start;-webkit-align-items:flex-start;-ms-flex-align:start;align-items:flex-start;width:307.875px}.flatpickr-days:focus{outline:0}.dayContainer{padding:0;outline:0;text-align:left;width:307.875px;min-width:307.875px;max-width:307.875px;-webkit-box-sizing:border-box;box-sizing:border-box;display:inline-block;display:-ms-flexbox;display:-webkit-box;display:-webkit-flex;display:flex;-webkit-flex-wrap:wrap;flex-wrap:wrap;-ms-flex-wrap:wrap;-ms-flex-pack:justify;-webkit-justify-content:space-around;justify-content:space-around;-webkit-transform:translate3d(0,0,0);transform:translate3d(0,0,0);opacity:1}.dayContainer + .dayContainer{-webkit-box-shadow:-1px 0 0 #e6e6e6;box-shadow:-1px 0 0 #e6e6e6}.flatpickr-day{background:none;border:1px solid transparent;border-radius:150px;-webkit-box-sizing:border-box;box-sizing:border-box;color:#393939;cursor:pointer;font-weight:400;width:14.2857143%;-webkit-flex-basis:14.2857143%;-ms-flex-preferred-size:14.2857143%;flex-basis:14.2857143%;max-width:39px;height:39px;line-height:39px;margin:0;display:inline-block;position:relative;-webkit-box-pack:center;-webkit-justify-content:center;-ms-flex-pack:center;justify-content:center;text-align:center}.flatpickr-day.inRange,.flatpickr-day.prevMonthDay.inRange,.flatpickr-day.nextMonthDay.inRange,.flatpickr-day.today.inRange,.flatpickr-day.prevMonthDay.today.inRange,.flatpickr-day.nextMonthDay.today.inRange,.flatpickr-day:hover,.flatpickr-day.prevMonthDay:hover,.flatpickr-day.nextMonthDay:hover,.flatpickr-day:focus,.flatpickr-day.prevMonthDay:focus,.flatpickr-day.nextMonthDay:focus{cursor:pointer;outline:0;background:#e6e6e6;border-color:#e6e6e6}.flatpickr-day.today{border-color:#959ea9}.flatpickr-day.today:hover,.flatpickr-day.today:focus{border-color:#959ea9;background:#959ea9;color:#fff}.flatpickr-day.selected,.flatpickr-day.startRange,.flatpickr-day.endRange,.flatpickr-day.selected.inRange,.flatpickr-day.startRange.inRange,.flatpickr-day.endRange.inRange,.flatpickr-day.selected:focus,.flatpickr-day.startRange:focus,.flatpickr-day.endRange:focus,.flatpickr-day.selected:hover,.flatpickr-day.startRange:hover,.flatpickr-day.endRange:hover,.flatpickr-day.selected.prevMonthDay,.flatpickr-day.startRange.prevMonthDay,.flatpickr-day.endRange.prevMonthDay,.flatpickr-day.selected.nextMonthDay,.flatpickr-day.startRange.nextMonthDay,.flatpickr-day.endRange.nextMonthDay{background:#569ff7;-webkit-box-shadow:none;box-shadow:none;color:#fff;border-color:#569ff7}.flatpickr-day.selected.startRange,.flatpickr-day.startRange.startRange,.flatpickr-day.endRange.startRange{border-radius:50px 0 0 50px}.flatpickr-day.selected.endRange,.flatpickr-day.startRange.endRange,.flatpickr-day.endRange.endRange{border-radius:0 50px 50px 0}.flatpickr-day.selected.startRange + .endRange:not(:nth-child(7n+1)),.flatpickr-day.startRange.startRange + .endRange:not(:nth-child(7n+1)),.flatpickr-day.endRange.startRange + .endRange:not(:nth-child(7n+1)){-webkit-box-shadow:-10px 0 0 #569ff7;box-shadow:-10px 0 0 #569ff7}.flatpickr-day.selected.startRange.endRange,.flatpickr-day.startRange.startRange.endRange,.flatpickr-day.endRange.startRange.endRange{border-radius:50px}.flatpickr-day.inRange{border-radius:0;-webkit-box-shadow:-5px 0 0 #e6e6e6,5px 0 0 #e6e6e6;box-shadow:-5px 0 0 #e6e6e6,5px 0 0 #e6e6e6}.flatpickr-day.flatpickr-disabled,.flatpickr-day.flatpickr-disabled:hover,.flatpickr-day.prevMonthDay,.flatpickr-day.nextMonthDay,.flatpickr-day.notAllowed,.flatpickr-day.notAllowed.prevMonthDay,.flatpickr-day.notAllowed.nextMonthDay{color:rgba(57,57,57,0.3);background:transparent;border-color:transparent;cursor:default}.flatpickr-day.flatpickr-disabled,.flatpickr-day.flatpickr-disabled:hover{cursor:not-allowed;color:rgba(57,57,57,0.1)}.flatpickr-day.week.selected{border-radius:0;-webkit-box-shadow:-5px 0 0 #569ff7,5px 0 0 #569ff7;box-shadow:-5px 0 0 #569ff7,5px 0 0 #569ff7}.flatpickr-day.hidden{visibility:hidden}.rangeMode .flatpickr-day{margin-top:1px}.flatpickr-weekwrapper{float:left}.flatpickr-weekwrapper .flatpickr-weeks{padding:0 12px;-webkit-box-shadow:1px 0 0 #e6e6e6;box-shadow:1px 0 0 #e6e6e6}.flatpickr-weekwrapper .flatpickr-weekday{float:none;width:100%;line-height:28px}.flatpickr-weekwrapper span.flatpickr-day,.flatpickr-weekwrapper span.flatpickr-day:hover{display:block;width:100%;max-width:none;color:rgba(57,57,57,0.3);background:transparent;cursor:default;border:none}.flatpickr-innerContainer{display:block;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-box-sizing:border-box;box-sizing:border-box;overflow:hidden}.flatpickr-rContainer{display:inline-block;padding:0;-webkit-box-sizing:border-box;box-sizing:border-box}.flatpickr-time{text-align:center;outline:0;display:block;height:0;line-height:40px;max-height:40px;-webkit-box-sizing:border-box;box-sizing:border-box;overflow:hidden;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex}.flatpickr-time:after{content:"";display:table;clear:both}.flatpickr-time .numInputWrapper{-webkit-box-flex:1;-webkit-flex:1;-ms-flex:1;flex:1;width:40%;height:40px;float:left}.flatpickr-time .numInputWrapper span.arrowUp:after{border-bottom-color:#393939}.flatpickr-time .numInputWrapper span.arrowDown:after{border-top-color:#393939}.flatpickr-time.hasSeconds .numInputWrapper{width:26%}.flatpickr-time.time24hr .numInputWrapper{width:49%}.flatpickr-time input{background:transparent;-webkit-box-shadow:none;box-shadow:none;border:0;border-radius:0;text-align:center;margin:0;padding:0;height:inherit;line-height:inherit;color:#393939;font-size:14px;position:relative;-webkit-box-sizing:border-box;box-sizing:border-box;-webkit-appearance:textfield;-moz-appearance:textfield;appearance:textfield}.flatpickr-time input.flatpickr-hour{font-weight:bold}.flatpickr-time input.flatpickr-minute,.flatpickr-time input.flatpickr-second{font-weight:400}.flatpickr-time input:focus{outline:0;border:0}.flatpickr-time .flatpickr-time-separator,.flatpickr-time .flatpickr-am-pm{height:inherit;float:left;line-height:inherit;color:#393939;font-weight:bold;width:2%;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;-webkit-align-self:center;-ms-flex-item-align:center;align-self:center}.flatpickr-time .flatpickr-am-pm{outline:0;width:18%;cursor:pointer;text-align:center;font-weight:400}.flatpickr-time input:hover,.flatpickr-time .flatpickr-am-pm:hover,.flatpickr-time input:focus,.flatpickr-time .flatpickr-am-pm:focus{background:#eee}.flatpickr-input[readonly]{cursor:pointer}@-webkit-keyframes fpFadeInDown{from{opacity:0;-webkit-transform:translate3d(0,-20px,0);transform:translate3d(0,-20px,0)}to{opacity:1;-webkit-transform:translate3d(0,0,0);transform:translate3d(0,0,0)}}@keyframes fpFadeInDown{from{opacity:0;-webkit-transform:translate3d(0,-20px,0);transform:translate3d(0,-20px,0)}to{opacity:1;-webkit-transform:translate3d(0,0,0);transform:translate3d(0,0,0)}} \ No newline at end of file diff --git a/website/js/vendor/flatpickr/flatpickr.min.js b/website/js/vendor/flatpickr/flatpickr.min.js new file mode 100644 index 0000000..bded21e --- /dev/null +++ b/website/js/vendor/flatpickr/flatpickr.min.js @@ -0,0 +1,2 @@ +/* flatpickr v4.6.6,, @license MIT */ +!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):(e=e||self).flatpickr=n()}(this,(function(){"use strict";var e=function(){return(e=Object.assign||function(e){for(var n,t=1,a=arguments.length;t",noCalendar:!1,now:new Date,onChange:[],onClose:[],onDayCreate:[],onDestroy:[],onKeyDown:[],onMonthChange:[],onOpen:[],onParseConfig:[],onReady:[],onValueUpdate:[],onYearChange:[],onPreCalendarPosition:[],plugins:[],position:"auto",positionElement:void 0,prevArrow:"",shorthandCurrentMonth:!1,showMonths:1,static:!1,time_24hr:!1,weekNumbers:!1,wrap:!1},i={weekdays:{shorthand:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],longhand:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},months:{shorthand:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],longhand:["January","February","March","April","May","June","July","August","September","October","November","December"]},daysInMonth:[31,28,31,30,31,30,31,31,30,31,30,31],firstDayOfWeek:0,ordinal:function(e){var n=e%100;if(n>3&&n<21)return"th";switch(n%10){case 1:return"st";case 2:return"nd";case 3:return"rd";default:return"th"}},rangeSeparator:" to ",weekAbbreviation:"Wk",scrollTitle:"Scroll to increment",toggleTitle:"Click to toggle",amPM:["AM","PM"],yearAriaLabel:"Year",monthAriaLabel:"Month",hourAriaLabel:"Hour",minuteAriaLabel:"Minute",time_24hr:!1},o=function(e,n){return void 0===n&&(n=2),("000"+e).slice(-1*n)},r=function(e){return!0===e?1:0};function l(e,n,t){var a;return void 0===t&&(t=!1),function(){var i=this,o=arguments;null!==a&&clearTimeout(a),a=window.setTimeout((function(){a=null,t||e.apply(i,o)}),n),t&&!a&&e.apply(i,o)}}var c=function(e){return e instanceof Array?e:[e]};function d(e,n,t){if(!0===t)return e.classList.add(n);e.classList.remove(n)}function s(e,n,t){var a=window.document.createElement(e);return n=n||"",t=t||"",a.className=n,void 0!==t&&(a.textContent=t),a}function u(e){for(;e.firstChild;)e.removeChild(e.firstChild)}function f(e,n){var t=s("div","numInputWrapper"),a=s("input","numInput "+e),i=s("span","arrowUp"),o=s("span","arrowDown");if(-1===navigator.userAgent.indexOf("MSIE 9.0")?a.type="number":(a.type="text",a.pattern="\\d*"),void 0!==n)for(var r in n)a.setAttribute(r,n[r]);return t.appendChild(a),t.appendChild(i),t.appendChild(o),t}function m(e){try{return"function"==typeof e.composedPath?e.composedPath()[0]:e.target}catch(n){return e.target}}var g=function(){},p=function(e,n,t){return t.months[n?"shorthand":"longhand"][e]},h={D:g,F:function(e,n,t){e.setMonth(t.months.longhand.indexOf(n))},G:function(e,n){e.setHours(parseFloat(n))},H:function(e,n){e.setHours(parseFloat(n))},J:function(e,n){e.setDate(parseFloat(n))},K:function(e,n,t){e.setHours(e.getHours()%12+12*r(new RegExp(t.amPM[1],"i").test(n)))},M:function(e,n,t){e.setMonth(t.months.shorthand.indexOf(n))},S:function(e,n){e.setSeconds(parseFloat(n))},U:function(e,n){return new Date(1e3*parseFloat(n))},W:function(e,n,t){var a=parseInt(n),i=new Date(e.getFullYear(),0,2+7*(a-1),0,0,0,0);return i.setDate(i.getDate()-i.getDay()+t.firstDayOfWeek),i},Y:function(e,n){e.setFullYear(parseFloat(n))},Z:function(e,n){return new Date(n)},d:function(e,n){e.setDate(parseFloat(n))},h:function(e,n){e.setHours(parseFloat(n))},i:function(e,n){e.setMinutes(parseFloat(n))},j:function(e,n){e.setDate(parseFloat(n))},l:g,m:function(e,n){e.setMonth(parseFloat(n)-1)},n:function(e,n){e.setMonth(parseFloat(n)-1)},s:function(e,n){e.setSeconds(parseFloat(n))},u:function(e,n){return new Date(parseFloat(n))},w:g,y:function(e,n){e.setFullYear(2e3+parseFloat(n))}},v={D:"(\\w+)",F:"(\\w+)",G:"(\\d\\d|\\d)",H:"(\\d\\d|\\d)",J:"(\\d\\d|\\d)\\w+",K:"",M:"(\\w+)",S:"(\\d\\d|\\d)",U:"(.+)",W:"(\\d\\d|\\d)",Y:"(\\d{4})",Z:"(.+)",d:"(\\d\\d|\\d)",h:"(\\d\\d|\\d)",i:"(\\d\\d|\\d)",j:"(\\d\\d|\\d)",l:"(\\w+)",m:"(\\d\\d|\\d)",n:"(\\d\\d|\\d)",s:"(\\d\\d|\\d)",u:"(.+)",w:"(\\d\\d|\\d)",y:"(\\d{2})"},D={Z:function(e){return e.toISOString()},D:function(e,n,t){return n.weekdays.shorthand[D.w(e,n,t)]},F:function(e,n,t){return p(D.n(e,n,t)-1,!1,n)},G:function(e,n,t){return o(D.h(e,n,t))},H:function(e){return o(e.getHours())},J:function(e,n){return void 0!==n.ordinal?e.getDate()+n.ordinal(e.getDate()):e.getDate()},K:function(e,n){return n.amPM[r(e.getHours()>11)]},M:function(e,n){return p(e.getMonth(),!0,n)},S:function(e){return o(e.getSeconds())},U:function(e){return e.getTime()/1e3},W:function(e,n,t){return t.getWeek(e)},Y:function(e){return o(e.getFullYear(),4)},d:function(e){return o(e.getDate())},h:function(e){return e.getHours()%12?e.getHours()%12:12},i:function(e){return o(e.getMinutes())},j:function(e){return e.getDate()},l:function(e,n){return n.weekdays.longhand[e.getDay()]},m:function(e){return o(e.getMonth()+1)},n:function(e){return e.getMonth()+1},s:function(e){return e.getSeconds()},u:function(e){return e.getTime()},w:function(e){return e.getDay()},y:function(e){return String(e.getFullYear()).substring(2)}},w=function(e){var n=e.config,t=void 0===n?a:n,o=e.l10n,r=void 0===o?i:o,l=e.isMobile,c=void 0!==l&&l;return function(e,n,a){var i=a||r;return void 0===t.formatDate||c?n.split("").map((function(n,a,o){return D[n]&&"\\"!==o[a-1]?D[n](e,i,t):"\\"!==n?n:""})).join(""):t.formatDate(e,n,i)}},b=function(e){var n=e.config,t=void 0===n?a:n,o=e.l10n,r=void 0===o?i:o;return function(e,n,i,o){if(0===e||e){var l,c=o||r,d=e;if(e instanceof Date)l=new Date(e.getTime());else if("string"!=typeof e&&void 0!==e.toFixed)l=new Date(e);else if("string"==typeof e){var s=n||(t||a).dateFormat,u=String(e).trim();if("today"===u)l=new Date,i=!0;else if(/Z$/.test(u)||/GMT$/.test(u))l=new Date(e);else if(t&&t.parseDate)l=t.parseDate(e,s);else{l=t&&t.noCalendar?new Date((new Date).setHours(0,0,0,0)):new Date((new Date).getFullYear(),0,1,0,0,0,0);for(var f=void 0,m=[],g=0,p=0,D="";gl&&(u=a===D.hourElement?u-l-r(!D.amPM):i,g&&Y(void 0,1,D.hourElement)),D.amPM&&f&&(1===c?u+d===23:Math.abs(u-d)>c)&&(D.amPM.textContent=D.l10n.amPM[r(D.amPM.textContent===D.l10n.amPM[0])]),a.value=o(u)}}(e);var c=D._input.value;T(),we(),D._input.value!==c&&D._debouncedChange()}function T(){if(void 0!==D.hourElement&&void 0!==D.minuteElement){var e,n,t=(parseInt(D.hourElement.value.slice(-2),10)||0)%24,a=(parseInt(D.minuteElement.value,10)||0)%60,i=void 0!==D.secondElement?(parseInt(D.secondElement.value,10)||0)%60:0;void 0!==D.amPM&&(e=t,n=D.amPM.textContent,t=e%12+12*r(n===D.l10n.amPM[1]));var o=void 0!==D.config.minTime||D.config.minDate&&D.minDateHasTime&&D.latestSelectedDateObj&&0===C(D.latestSelectedDateObj,D.config.minDate,!0);if(void 0!==D.config.maxTime||D.config.maxDate&&D.maxDateHasTime&&D.latestSelectedDateObj&&0===C(D.latestSelectedDateObj,D.config.maxDate,!0)){var l=void 0!==D.config.maxTime?D.config.maxTime:D.config.maxDate;(t=Math.min(t,l.getHours()))===l.getHours()&&(a=Math.min(a,l.getMinutes())),a===l.getMinutes()&&(i=Math.min(i,l.getSeconds()))}if(o){var c=void 0!==D.config.minTime?D.config.minTime:D.config.minDate;(t=Math.max(t,c.getHours()))===c.getHours()&&(a=Math.max(a,c.getMinutes())),a===c.getMinutes()&&(i=Math.max(i,c.getSeconds()))}_(t,a,i)}}function I(e){var n=e||D.latestSelectedDateObj;n&&_(n.getHours(),n.getMinutes(),n.getSeconds())}function S(){var e=D.config.defaultHour,n=D.config.defaultMinute,t=D.config.defaultSeconds;if(void 0!==D.config.minDate){var a=D.config.minDate.getHours(),i=D.config.minDate.getMinutes();(e=Math.max(e,a))===a&&(n=Math.max(i,n)),e===a&&n===i&&(t=D.config.minDate.getSeconds())}if(void 0!==D.config.maxDate){var o=D.config.maxDate.getHours(),r=D.config.maxDate.getMinutes();(e=Math.min(e,o))===o&&(n=Math.min(r,n)),e===o&&n===r&&(t=D.config.maxDate.getSeconds())}return{hours:e,minutes:n,seconds:t}}function _(e,n,t){void 0!==D.latestSelectedDateObj&&D.latestSelectedDateObj.setHours(e%24,n,t||0,0),D.hourElement&&D.minuteElement&&!D.isMobile&&(D.hourElement.value=o(D.config.time_24hr?e:(12+e)%12+12*r(e%12==0)),D.minuteElement.value=o(n),void 0!==D.amPM&&(D.amPM.textContent=D.l10n.amPM[r(e>=12)]),void 0!==D.secondElement&&(D.secondElement.value=o(t)))}function O(e){var n=m(e),t=parseInt(n.value)+(e.delta||0);(t/1e3>1||"Enter"===e.key&&!/[^\d]/.test(t.toString()))&&Z(t)}function F(e,n,t,a){return n instanceof Array?n.forEach((function(n){return F(e,n,t,a)})):e instanceof Array?e.forEach((function(e){return F(e,n,t,a)})):(e.addEventListener(n,t,a),void D._handlers.push({element:e,event:n,handler:t,options:a}))}function N(){ge("onChange")}function A(e,n){var t=void 0!==e?D.parseDate(e):D.latestSelectedDateObj||(D.config.minDate&&D.config.minDate>D.now?D.config.minDate:D.config.maxDate&&D.config.maxDate=0&&C(e,D.selectedDates[1])<=0)}(n)&&!he(n)&&o.classList.add("inRange"),D.weekNumbers&&1===D.config.showMonths&&"prevMonthDay"!==e&&t%7==1&&D.weekNumbers.insertAdjacentHTML("beforeend",""+D.config.getWeek(n)+""),ge("onDayCreate",o),o}function j(e){e.focus(),"range"===D.config.mode&&te(e)}function L(e){for(var n=e>0?0:D.config.showMonths-1,t=e>0?D.config.showMonths:-1,a=n;a!=t;a+=e)for(var i=D.daysContainer.children[a],o=e>0?0:i.children.length-1,r=e>0?i.children.length:-1,l=o;l!=r;l+=e){var c=i.children[l];if(-1===c.className.indexOf("hidden")&&Q(c.dateObj))return c}}function W(e,n){var t=X(document.activeElement||document.body),a=void 0!==e?e:t?document.activeElement:void 0!==D.selectedDateElem&&X(D.selectedDateElem)?D.selectedDateElem:void 0!==D.todayDateElem&&X(D.todayDateElem)?D.todayDateElem:L(n>0?1:-1);void 0===a?D._input.focus():t?function(e,n){for(var t=-1===e.className.indexOf("Month")?e.dateObj.getMonth():D.currentMonth,a=n>0?D.config.showMonths:-1,i=n>0?1:-1,o=t-D.currentMonth;o!=a;o+=i)for(var r=D.daysContainer.children[o],l=t-D.currentMonth===o?e.$i+n:n<0?r.children.length-1:0,c=r.children.length,d=l;d>=0&&d0?c:-1);d+=i){var s=r.children[d];if(-1===s.className.indexOf("hidden")&&Q(s.dateObj)&&Math.abs(e.$i-d)>=Math.abs(n))return j(s)}D.changeMonth(i),W(L(i),0)}(a,n):j(a)}function R(e,n){for(var t=(new Date(e,n,1).getDay()-D.l10n.firstDayOfWeek+7)%7,a=D.utils.getDaysInMonth((n-1+12)%12,e),i=D.utils.getDaysInMonth(n,e),o=window.document.createDocumentFragment(),r=D.config.showMonths>1,l=r?"prevMonthDay hidden":"prevMonthDay",c=r?"nextMonthDay hidden":"nextMonthDay",d=a+1-t,u=0;d<=a;d++,u++)o.appendChild(H(l,new Date(e,n-1,d),d,u));for(d=1;d<=i;d++,u++)o.appendChild(H("",new Date(e,n,d),d,u));for(var f=i+1;f<=42-t&&(1===D.config.showMonths||u%7!=0);f++,u++)o.appendChild(H(c,new Date(e,n+1,f%i),f,u));var m=s("div","dayContainer");return m.appendChild(o),m}function B(){if(void 0!==D.daysContainer){u(D.daysContainer),D.weekNumbers&&u(D.weekNumbers);for(var e=document.createDocumentFragment(),n=0;n1||"dropdown"!==D.config.monthSelectorType)){var e=function(e){return!(void 0!==D.config.minDate&&D.currentYear===D.config.minDate.getFullYear()&&eD.config.maxDate.getMonth())};D.monthsDropdownContainer.tabIndex=-1,D.monthsDropdownContainer.innerHTML="";for(var n=0;n<12;n++)if(e(n)){var t=s("option","flatpickr-monthDropdown-month");t.value=new Date(D.currentYear,n).getMonth().toString(),t.textContent=p(n,D.config.shorthandCurrentMonth,D.l10n),t.tabIndex=-1,D.currentMonth===n&&(t.selected=!0),D.monthsDropdownContainer.appendChild(t)}}}function K(){var e,n=s("div","flatpickr-month"),t=window.document.createDocumentFragment();D.config.showMonths>1||"static"===D.config.monthSelectorType?e=s("span","cur-month"):(D.monthsDropdownContainer=s("select","flatpickr-monthDropdown-months"),D.monthsDropdownContainer.setAttribute("aria-label",D.l10n.monthAriaLabel),F(D.monthsDropdownContainer,"change",(function(e){var n=m(e),t=parseInt(n.value,10);D.changeMonth(t-D.currentMonth),ge("onMonthChange")})),J(),e=D.monthsDropdownContainer);var a=f("cur-year",{tabindex:"-1"}),i=a.getElementsByTagName("input")[0];i.setAttribute("aria-label",D.l10n.yearAriaLabel),D.config.minDate&&i.setAttribute("min",D.config.minDate.getFullYear().toString()),D.config.maxDate&&(i.setAttribute("max",D.config.maxDate.getFullYear().toString()),i.disabled=!!D.config.minDate&&D.config.minDate.getFullYear()===D.config.maxDate.getFullYear());var o=s("div","flatpickr-current-month");return o.appendChild(e),o.appendChild(a),t.appendChild(o),n.appendChild(t),{container:n,yearElement:i,monthElement:e}}function U(){u(D.monthNav),D.monthNav.appendChild(D.prevMonthNav),D.config.showMonths&&(D.yearElements=[],D.monthElements=[]);for(var e=D.config.showMonths;e--;){var n=K();D.yearElements.push(n.yearElement),D.monthElements.push(n.monthElement),D.monthNav.appendChild(n.container)}D.monthNav.appendChild(D.nextMonthNav)}function q(){D.weekdayContainer?u(D.weekdayContainer):D.weekdayContainer=s("div","flatpickr-weekdays");for(var e=D.config.showMonths;e--;){var n=s("div","flatpickr-weekdaycontainer");D.weekdayContainer.appendChild(n)}return $(),D.weekdayContainer}function $(){if(D.weekdayContainer){var e=D.l10n.firstDayOfWeek,t=n(D.l10n.weekdays.shorthand);e>0&&e\n "+t.join("")+"\n \n "}}function z(e,n){void 0===n&&(n=!0);var t=n?e:e-D.currentMonth;t<0&&!0===D._hidePrevMonthArrow||t>0&&!0===D._hideNextMonthArrow||(D.currentMonth+=t,(D.currentMonth<0||D.currentMonth>11)&&(D.currentYear+=D.currentMonth>11?1:-1,D.currentMonth=(D.currentMonth+12)%12,ge("onYearChange"),J()),B(),ge("onMonthChange"),ve())}function G(e){return!(!D.config.appendTo||!D.config.appendTo.contains(e))||D.calendarContainer.contains(e)}function V(e){if(D.isOpen&&!D.config.inline){var n=m(e),t=G(n),a=n===D.input||n===D.altInput||D.element.contains(n)||e.path&&e.path.indexOf&&(~e.path.indexOf(D.input)||~e.path.indexOf(D.altInput)),i="blur"===e.type?a&&e.relatedTarget&&!G(e.relatedTarget):!a&&!t&&!G(e.relatedTarget),o=!D.config.ignoredFocusElements.some((function(e){return e.contains(n)}));i&&o&&(void 0!==D.timeContainer&&void 0!==D.minuteElement&&void 0!==D.hourElement&&""!==D.input.value&&void 0!==D.input.value&&k(),D.close(),D.config&&"range"===D.config.mode&&1===D.selectedDates.length&&(D.clear(!1),D.redraw()))}}function Z(e){if(!(!e||D.config.minDate&&eD.config.maxDate.getFullYear())){var n=e,t=D.currentYear!==n;D.currentYear=n||D.currentYear,D.config.maxDate&&D.currentYear===D.config.maxDate.getFullYear()?D.currentMonth=Math.min(D.config.maxDate.getMonth(),D.currentMonth):D.config.minDate&&D.currentYear===D.config.minDate.getFullYear()&&(D.currentMonth=Math.max(D.config.minDate.getMonth(),D.currentMonth)),t&&(D.redraw(),ge("onYearChange"),J())}}function Q(e,n){void 0===n&&(n=!0);var t=D.parseDate(e,void 0,n);if(D.config.minDate&&t&&C(t,D.config.minDate,void 0!==n?n:!D.minDateHasTime)<0||D.config.maxDate&&t&&C(t,D.config.maxDate,void 0!==n?n:!D.maxDateHasTime)>0)return!1;if(0===D.config.enable.length&&0===D.config.disable.length)return!0;if(void 0===t)return!1;for(var a=D.config.enable.length>0,i=a?D.config.enable:D.config.disable,o=0,r=void 0;o=r.from.getTime()&&t.getTime()<=r.to.getTime())return a}return!a}function X(e){return void 0!==D.daysContainer&&(-1===e.className.indexOf("hidden")&&-1===e.className.indexOf("flatpickr-disabled")&&D.daysContainer.contains(e))}function ee(e){!(e.target===D._input)||e.relatedTarget&&G(e.relatedTarget)||D.setDate(D._input.value,!0,e.target===D.altInput?D.config.altFormat:D.config.dateFormat)}function ne(e){var n=m(e),t=D.config.wrap?g.contains(n):n===D._input,a=D.config.allowInput,i=D.isOpen&&(!a||!t),o=D.config.inline&&t&&!a;if(13===e.keyCode&&t){if(a)return D.setDate(D._input.value,!0,n===D.altInput?D.config.altFormat:D.config.dateFormat),n.blur();D.open()}else if(G(n)||i||o){var r=!!D.timeContainer&&D.timeContainer.contains(n);switch(e.keyCode){case 13:r?(e.preventDefault(),k(),de()):se(e);break;case 27:e.preventDefault(),de();break;case 8:case 46:t&&!D.config.allowInput&&(e.preventDefault(),D.clear());break;case 37:case 39:if(r||t)D.hourElement&&D.hourElement.focus();else if(e.preventDefault(),void 0!==D.daysContainer&&(!1===a||document.activeElement&&X(document.activeElement))){var l=39===e.keyCode?1:-1;e.ctrlKey?(e.stopPropagation(),z(l),W(L(1),0)):W(void 0,l)}break;case 38:case 40:e.preventDefault();var c=40===e.keyCode?1:-1;D.daysContainer&&void 0!==n.$i||n===D.input||n===D.altInput?e.ctrlKey?(e.stopPropagation(),Z(D.currentYear-c),W(L(1),0)):r||W(void 0,7*c):n===D.currentYearElement?Z(D.currentYear-c):D.config.enableTime&&(!r&&D.hourElement&&D.hourElement.focus(),k(e),D._debouncedChange());break;case 9:if(r){var d=[D.hourElement,D.minuteElement,D.secondElement,D.amPM].concat(D.pluginElements).filter((function(e){return e})),s=d.indexOf(n);if(-1!==s){var u=d[s+(e.shiftKey?-1:1)];e.preventDefault(),(u||D._input).focus()}}else!D.config.noCalendar&&D.daysContainer&&D.daysContainer.contains(n)&&e.shiftKey&&(e.preventDefault(),D._input.focus())}}if(void 0!==D.amPM&&n===D.amPM)switch(e.key){case D.l10n.amPM[0].charAt(0):case D.l10n.amPM[0].charAt(0).toLowerCase():D.amPM.textContent=D.l10n.amPM[0],T(),we();break;case D.l10n.amPM[1].charAt(0):case D.l10n.amPM[1].charAt(0).toLowerCase():D.amPM.textContent=D.l10n.amPM[1],T(),we()}(t||G(n))&&ge("onKeyDown",e)}function te(e){if(1===D.selectedDates.length&&(!e||e.classList.contains("flatpickr-day")&&!e.classList.contains("flatpickr-disabled"))){for(var n=e?e.dateObj.getTime():D.days.firstElementChild.dateObj.getTime(),t=D.parseDate(D.selectedDates[0],void 0,!0).getTime(),a=Math.min(n,D.selectedDates[0].getTime()),i=Math.max(n,D.selectedDates[0].getTime()),o=!1,r=0,l=0,c=a;ca&&cr)?r=c:c>t&&(!l||c0&&m0&&m>l;return g?(f.classList.add("notAllowed"),["inRange","startRange","endRange"].forEach((function(e){f.classList.remove(e)})),"continue"):o&&!g?"continue":(["startRange","inRange","endRange","notAllowed"].forEach((function(e){f.classList.remove(e)})),void(void 0!==e&&(e.classList.add(n<=D.selectedDates[0].getTime()?"startRange":"endRange"),tn&&m===t&&f.classList.add("endRange"),m>=r&&(0===l||m<=l)&&(d=t,u=n,(c=m)>Math.min(d,u)&&c0||t.getMinutes()>0||t.getSeconds()>0),D.selectedDates&&(D.selectedDates=D.selectedDates.filter((function(e){return Q(e)})),D.selectedDates.length||"min"!==e||I(t),we()),D.daysContainer&&(ce(),void 0!==t?D.currentYearElement[e]=t.getFullYear().toString():D.currentYearElement.removeAttribute(e),D.currentYearElement.disabled=!!a&&void 0!==t&&a.getFullYear()===t.getFullYear())}}function oe(){return D.config.wrap?g.querySelector("[data-input]"):g}function re(){"object"!=typeof D.config.locale&&void 0===E.l10ns[D.config.locale]&&D.config.errorHandler(new Error("flatpickr: invalid locale "+D.config.locale)),D.l10n=e(e({},E.l10ns.default),"object"==typeof D.config.locale?D.config.locale:"default"!==D.config.locale?E.l10ns[D.config.locale]:void 0),v.K="("+D.l10n.amPM[0]+"|"+D.l10n.amPM[1]+"|"+D.l10n.amPM[0].toLowerCase()+"|"+D.l10n.amPM[1].toLowerCase()+")",void 0===e(e({},h),JSON.parse(JSON.stringify(g.dataset||{}))).time_24hr&&void 0===E.defaultConfig.time_24hr&&(D.config.time_24hr=D.l10n.time_24hr),D.formatDate=w(D),D.parseDate=b({config:D.config,l10n:D.l10n})}function le(e){if(void 0!==D.calendarContainer){ge("onPreCalendarPosition");var n=e||D._positionElement,t=Array.prototype.reduce.call(D.calendarContainer.children,(function(e,n){return e+n.offsetHeight}),0),a=D.calendarContainer.offsetWidth,i=D.config.position.split(" "),o=i[0],r=i.length>1?i[1]:null,l=n.getBoundingClientRect(),c=window.innerHeight-l.bottom,s="above"===o||"below"!==o&&ct,u=window.pageYOffset+l.top+(s?-t-2:n.offsetHeight+2);if(d(D.calendarContainer,"arrowTop",!s),d(D.calendarContainer,"arrowBottom",s),!D.config.inline){var f=window.pageXOffset+l.left,m=!1,g=!1;"center"===r?(f-=(a-l.width)/2,m=!0):"right"===r&&(f-=a-l.width,g=!0),d(D.calendarContainer,"arrowLeft",!m&&!g),d(D.calendarContainer,"arrowCenter",m),d(D.calendarContainer,"arrowRight",g);var p=window.document.body.offsetWidth-(window.pageXOffset+l.right),h=f+a>window.document.body.offsetWidth,v=p+a>window.document.body.offsetWidth;if(d(D.calendarContainer,"rightMost",h),!D.config.static)if(D.calendarContainer.style.top=u+"px",h)if(v){var w=function(){for(var e=null,n=0;nD.currentMonth+D.config.showMonths-1)&&"range"!==D.config.mode;if(D.selectedDateElem=t,"single"===D.config.mode)D.selectedDates=[a];else if("multiple"===D.config.mode){var o=he(a);o?D.selectedDates.splice(parseInt(o),1):D.selectedDates.push(a)}else"range"===D.config.mode&&(2===D.selectedDates.length&&D.clear(!1,!1),D.latestSelectedDateObj=a,D.selectedDates.push(a),0!==C(a,D.selectedDates[0],!0)&&D.selectedDates.sort((function(e,n){return e.getTime()-n.getTime()})));if(T(),i){var r=D.currentYear!==a.getFullYear();D.currentYear=a.getFullYear(),D.currentMonth=a.getMonth(),r&&(ge("onYearChange"),J()),ge("onMonthChange")}if(ve(),B(),we(),i||"range"===D.config.mode||1!==D.config.showMonths?void 0!==D.selectedDateElem&&void 0===D.hourElement&&D.selectedDateElem&&D.selectedDateElem.focus():j(t),void 0!==D.hourElement&&void 0!==D.hourElement&&D.hourElement.focus(),D.config.closeOnSelect){var l="single"===D.config.mode&&!D.config.enableTime,c="range"===D.config.mode&&2===D.selectedDates.length&&!D.config.enableTime;(l||c)&&de()}N()}}D.parseDate=b({config:D.config,l10n:D.l10n}),D._handlers=[],D.pluginElements=[],D.loadedPlugins=[],D._bind=F,D._setHoursFromDate=I,D._positionCalendar=le,D.changeMonth=z,D.changeYear=Z,D.clear=function(e,n){void 0===e&&(e=!0);void 0===n&&(n=!0);D.input.value="",void 0!==D.altInput&&(D.altInput.value="");void 0!==D.mobileInput&&(D.mobileInput.value="");D.selectedDates=[],D.latestSelectedDateObj=void 0,!0===n&&(D.currentYear=D._initialDate.getFullYear(),D.currentMonth=D._initialDate.getMonth());if(!0===D.config.enableTime){var t=S(),a=t.hours,i=t.minutes,o=t.seconds;_(a,i,o)}D.redraw(),e&&ge("onChange")},D.close=function(){D.isOpen=!1,D.isMobile||(void 0!==D.calendarContainer&&D.calendarContainer.classList.remove("open"),void 0!==D._input&&D._input.classList.remove("active"));ge("onClose")},D._createElement=s,D.destroy=function(){void 0!==D.config&&ge("onDestroy");for(var e=D._handlers.length;e--;){var n=D._handlers[e];n.element.removeEventListener(n.event,n.handler,n.options)}if(D._handlers=[],D.mobileInput)D.mobileInput.parentNode&&D.mobileInput.parentNode.removeChild(D.mobileInput),D.mobileInput=void 0;else if(D.calendarContainer&&D.calendarContainer.parentNode)if(D.config.static&&D.calendarContainer.parentNode){var t=D.calendarContainer.parentNode;if(t.lastChild&&t.removeChild(t.lastChild),t.parentNode){for(;t.firstChild;)t.parentNode.insertBefore(t.firstChild,t);t.parentNode.removeChild(t)}}else D.calendarContainer.parentNode.removeChild(D.calendarContainer);D.altInput&&(D.input.type="text",D.altInput.parentNode&&D.altInput.parentNode.removeChild(D.altInput),delete D.altInput);D.input&&(D.input.type=D.input._type,D.input.classList.remove("flatpickr-input"),D.input.removeAttribute("readonly"));["_showTimeInput","latestSelectedDateObj","_hideNextMonthArrow","_hidePrevMonthArrow","__hideNextMonthArrow","__hidePrevMonthArrow","isMobile","isOpen","selectedDateElem","minDateHasTime","maxDateHasTime","days","daysContainer","_input","_positionElement","innerContainer","rContainer","monthNav","todayDateElem","calendarContainer","weekdayContainer","prevMonthNav","nextMonthNav","monthsDropdownContainer","currentMonthElement","currentYearElement","navigationCurrentMonth","selectedDateElem","config"].forEach((function(e){try{delete D[e]}catch(e){}}))},D.isEnabled=Q,D.jumpToDate=A,D.open=function(e,n){void 0===n&&(n=D._positionElement);if(!0===D.isMobile){if(e){e.preventDefault();var t=m(e);t&&t.blur()}return void 0!==D.mobileInput&&(D.mobileInput.focus(),D.mobileInput.click()),void ge("onOpen")}if(D._input.disabled||D.config.inline)return;var a=D.isOpen;D.isOpen=!0,a||(D.calendarContainer.classList.add("open"),D._input.classList.add("active"),ge("onOpen"),le(n));!0===D.config.enableTime&&!0===D.config.noCalendar&&(!1!==D.config.allowInput||void 0!==e&&D.timeContainer.contains(e.relatedTarget)||setTimeout((function(){return D.hourElement.select()}),50))},D.redraw=ce,D.set=function(e,n){if(null!==e&&"object"==typeof e)for(var a in Object.assign(D.config,e),e)void 0!==ue[a]&&ue[a].forEach((function(e){return e()}));else D.config[e]=n,void 0!==ue[e]?ue[e].forEach((function(e){return e()})):t.indexOf(e)>-1&&(D.config[e]=c(n));D.redraw(),we(!0)},D.setDate=function(e,n,t){void 0===n&&(n=!1);void 0===t&&(t=D.config.dateFormat);if(0!==e&&!e||e instanceof Array&&0===e.length)return D.clear(n);fe(e,t),D.latestSelectedDateObj=D.selectedDates[D.selectedDates.length-1],D.redraw(),A(void 0,n),I(),0===D.selectedDates.length&&D.clear(!1);we(n),n&&ge("onChange")},D.toggle=function(e){if(!0===D.isOpen)return D.close();D.open(e)};var ue={locale:[re,$],showMonths:[U,x,q],minDate:[A],maxDate:[A]};function fe(e,n){var t=[];if(e instanceof Array)t=e.map((function(e){return D.parseDate(e,n)}));else if(e instanceof Date||"number"==typeof e)t=[D.parseDate(e,n)];else if("string"==typeof e)switch(D.config.mode){case"single":case"time":t=[D.parseDate(e,n)];break;case"multiple":t=e.split(D.config.conjunction).map((function(e){return D.parseDate(e,n)}));break;case"range":t=e.split(D.l10n.rangeSeparator).map((function(e){return D.parseDate(e,n)}))}else D.config.errorHandler(new Error("Invalid date supplied: "+JSON.stringify(e)));D.selectedDates=D.config.allowInvalidPreload?t:t.filter((function(e){return e instanceof Date&&Q(e,!1)})),"range"===D.config.mode&&D.selectedDates.sort((function(e,n){return e.getTime()-n.getTime()}))}function me(e){return e.slice().map((function(e){return"string"==typeof e||"number"==typeof e||e instanceof Date?D.parseDate(e,void 0,!0):e&&"object"==typeof e&&e.from&&e.to?{from:D.parseDate(e.from,void 0),to:D.parseDate(e.to,void 0)}:e})).filter((function(e){return e}))}function ge(e,n){if(void 0!==D.config){var t=D.config[e];if(void 0!==t&&t.length>0)for(var a=0;t[a]&&a1||"static"===D.config.monthSelectorType?D.monthElements[n].textContent=p(t.getMonth(),D.config.shorthandCurrentMonth,D.l10n)+" ":D.monthsDropdownContainer.value=t.getMonth().toString(),e.value=t.getFullYear().toString()})),D._hidePrevMonthArrow=void 0!==D.config.minDate&&(D.currentYear===D.config.minDate.getFullYear()?D.currentMonth<=D.config.minDate.getMonth():D.currentYearD.config.maxDate.getMonth():D.currentYear>D.config.maxDate.getFullYear()))}function De(e){return D.selectedDates.map((function(n){return D.formatDate(n,e)})).filter((function(e,n,t){return"range"!==D.config.mode||D.config.enableTime||t.indexOf(e)===n})).join("range"!==D.config.mode?D.config.conjunction:D.l10n.rangeSeparator)}function we(e){void 0===e&&(e=!0),void 0!==D.mobileInput&&D.mobileFormatStr&&(D.mobileInput.value=void 0!==D.latestSelectedDateObj?D.formatDate(D.latestSelectedDateObj,D.mobileFormatStr):""),D.input.value=De(D.config.dateFormat),void 0!==D.altInput&&(D.altInput.value=De(D.config.altFormat)),!1!==e&&ge("onValueUpdate")}function be(e){var n=m(e),t=D.prevMonthNav.contains(n),a=D.nextMonthNav.contains(n);t||a?z(t?-1:1):D.yearElements.indexOf(n)>=0?n.select():n.classList.contains("arrowUp")?D.changeYear(D.currentYear+1):n.classList.contains("arrowDown")&&D.changeYear(D.currentYear-1)}return function(){D.element=D.input=g,D.isOpen=!1,function(){var n=["wrap","weekNumbers","allowInput","allowInvalidPreload","clickOpens","time_24hr","enableTime","noCalendar","altInput","shorthandCurrentMonth","inline","static","enableSeconds","disableMobile"],i=e(e({},JSON.parse(JSON.stringify(g.dataset||{}))),h),o={};D.config.parseDate=i.parseDate,D.config.formatDate=i.formatDate,Object.defineProperty(D.config,"enable",{get:function(){return D.config._enable},set:function(e){D.config._enable=me(e)}}),Object.defineProperty(D.config,"disable",{get:function(){return D.config._disable},set:function(e){D.config._disable=me(e)}});var r="time"===i.mode;if(!i.dateFormat&&(i.enableTime||r)){var l=E.defaultConfig.dateFormat||a.dateFormat;o.dateFormat=i.noCalendar||r?"H:i"+(i.enableSeconds?":S":""):l+" H:i"+(i.enableSeconds?":S":"")}if(i.altInput&&(i.enableTime||r)&&!i.altFormat){var d=E.defaultConfig.altFormat||a.altFormat;o.altFormat=i.noCalendar||r?"h:i"+(i.enableSeconds?":S K":" K"):d+" h:i"+(i.enableSeconds?":S":"")+" K"}Object.defineProperty(D.config,"minDate",{get:function(){return D.config._minDate},set:ie("min")}),Object.defineProperty(D.config,"maxDate",{get:function(){return D.config._maxDate},set:ie("max")});var s=function(e){return function(n){D.config["min"===e?"_minTime":"_maxTime"]=D.parseDate(n,"H:i:S")}};Object.defineProperty(D.config,"minTime",{get:function(){return D.config._minTime},set:s("min")}),Object.defineProperty(D.config,"maxTime",{get:function(){return D.config._maxTime},set:s("max")}),"time"===i.mode&&(D.config.noCalendar=!0,D.config.enableTime=!0);Object.assign(D.config,o,i);for(var u=0;u-1?D.config[m]=c(f[m]).map(y).concat(D.config[m]):void 0===i[m]&&(D.config[m]=f[m])}i.altInputClass||(D.config.altInputClass=oe().className+" "+D.config.altInputClass);ge("onParseConfig")}(),re(),function(){if(D.input=oe(),!D.input)return void D.config.errorHandler(new Error("Invalid input element specified"));D.input._type=D.input.type,D.input.type="text",D.input.classList.add("flatpickr-input"),D._input=D.input,D.config.altInput&&(D.altInput=s(D.input.nodeName,D.config.altInputClass),D._input=D.altInput,D.altInput.placeholder=D.input.placeholder,D.altInput.disabled=D.input.disabled,D.altInput.required=D.input.required,D.altInput.tabIndex=D.input.tabIndex,D.altInput.type="text",D.input.setAttribute("type","hidden"),!D.config.static&&D.input.parentNode&&D.input.parentNode.insertBefore(D.altInput,D.input.nextSibling));D.config.allowInput||D._input.setAttribute("readonly","readonly");D._positionElement=D.config.positionElement||D._input}(),function(){D.selectedDates=[],D.now=D.parseDate(D.config.now)||new Date;var e=D.config.defaultDate||("INPUT"!==D.input.nodeName&&"TEXTAREA"!==D.input.nodeName||!D.input.placeholder||D.input.value!==D.input.placeholder?D.input.value:null);e&&fe(e,D.config.dateFormat);D._initialDate=D.selectedDates.length>0?D.selectedDates[0]:D.config.minDate&&D.config.minDate.getTime()>D.now.getTime()?D.config.minDate:D.config.maxDate&&D.config.maxDate.getTime()0&&(D.latestSelectedDateObj=D.selectedDates[0]);void 0!==D.config.minTime&&(D.config.minTime=D.parseDate(D.config.minTime,"H:i"));void 0!==D.config.maxTime&&(D.config.maxTime=D.parseDate(D.config.maxTime,"H:i"));D.minDateHasTime=!!D.config.minDate&&(D.config.minDate.getHours()>0||D.config.minDate.getMinutes()>0||D.config.minDate.getSeconds()>0),D.maxDateHasTime=!!D.config.maxDate&&(D.config.maxDate.getHours()>0||D.config.maxDate.getMinutes()>0||D.config.maxDate.getSeconds()>0)}(),D.utils={getDaysInMonth:function(e,n){return void 0===e&&(e=D.currentMonth),void 0===n&&(n=D.currentYear),1===e&&(n%4==0&&n%100!=0||n%400==0)?29:D.l10n.daysInMonth[e]}},D.isMobile||function(){var e=window.document.createDocumentFragment();if(D.calendarContainer=s("div","flatpickr-calendar"),D.calendarContainer.tabIndex=-1,!D.config.noCalendar){if(e.appendChild((D.monthNav=s("div","flatpickr-months"),D.yearElements=[],D.monthElements=[],D.prevMonthNav=s("span","flatpickr-prev-month"),D.prevMonthNav.innerHTML=D.config.prevArrow,D.nextMonthNav=s("span","flatpickr-next-month"),D.nextMonthNav.innerHTML=D.config.nextArrow,U(),Object.defineProperty(D,"_hidePrevMonthArrow",{get:function(){return D.__hidePrevMonthArrow},set:function(e){D.__hidePrevMonthArrow!==e&&(d(D.prevMonthNav,"flatpickr-disabled",e),D.__hidePrevMonthArrow=e)}}),Object.defineProperty(D,"_hideNextMonthArrow",{get:function(){return D.__hideNextMonthArrow},set:function(e){D.__hideNextMonthArrow!==e&&(d(D.nextMonthNav,"flatpickr-disabled",e),D.__hideNextMonthArrow=e)}}),D.currentYearElement=D.yearElements[0],ve(),D.monthNav)),D.innerContainer=s("div","flatpickr-innerContainer"),D.config.weekNumbers){var n=function(){D.calendarContainer.classList.add("hasWeeks");var e=s("div","flatpickr-weekwrapper");e.appendChild(s("span","flatpickr-weekday",D.l10n.weekAbbreviation));var n=s("div","flatpickr-weeks");return e.appendChild(n),{weekWrapper:e,weekNumbers:n}}(),t=n.weekWrapper,a=n.weekNumbers;D.innerContainer.appendChild(t),D.weekNumbers=a,D.weekWrapper=t}D.rContainer=s("div","flatpickr-rContainer"),D.rContainer.appendChild(q()),D.daysContainer||(D.daysContainer=s("div","flatpickr-days"),D.daysContainer.tabIndex=-1),B(),D.rContainer.appendChild(D.daysContainer),D.innerContainer.appendChild(D.rContainer),e.appendChild(D.innerContainer)}D.config.enableTime&&e.appendChild(function(){D.calendarContainer.classList.add("hasTime"),D.config.noCalendar&&D.calendarContainer.classList.add("noCalendar");D.timeContainer=s("div","flatpickr-time"),D.timeContainer.tabIndex=-1;var e=s("span","flatpickr-time-separator",":"),n=f("flatpickr-hour",{"aria-label":D.l10n.hourAriaLabel});D.hourElement=n.getElementsByTagName("input")[0];var t=f("flatpickr-minute",{"aria-label":D.l10n.minuteAriaLabel});D.minuteElement=t.getElementsByTagName("input")[0],D.hourElement.tabIndex=D.minuteElement.tabIndex=-1,D.hourElement.value=o(D.latestSelectedDateObj?D.latestSelectedDateObj.getHours():D.config.time_24hr?D.config.defaultHour:function(e){switch(e%24){case 0:case 12:return 12;default:return e%12}}(D.config.defaultHour)),D.minuteElement.value=o(D.latestSelectedDateObj?D.latestSelectedDateObj.getMinutes():D.config.defaultMinute),D.hourElement.setAttribute("step",D.config.hourIncrement.toString()),D.minuteElement.setAttribute("step",D.config.minuteIncrement.toString()),D.hourElement.setAttribute("min",D.config.time_24hr?"0":"1"),D.hourElement.setAttribute("max",D.config.time_24hr?"23":"12"),D.minuteElement.setAttribute("min","0"),D.minuteElement.setAttribute("max","59"),D.timeContainer.appendChild(n),D.timeContainer.appendChild(e),D.timeContainer.appendChild(t),D.config.time_24hr&&D.timeContainer.classList.add("time24hr");if(D.config.enableSeconds){D.timeContainer.classList.add("hasSeconds");var a=f("flatpickr-second");D.secondElement=a.getElementsByTagName("input")[0],D.secondElement.value=o(D.latestSelectedDateObj?D.latestSelectedDateObj.getSeconds():D.config.defaultSeconds),D.secondElement.setAttribute("step",D.minuteElement.getAttribute("step")),D.secondElement.setAttribute("min","0"),D.secondElement.setAttribute("max","59"),D.timeContainer.appendChild(s("span","flatpickr-time-separator",":")),D.timeContainer.appendChild(a)}D.config.time_24hr||(D.amPM=s("span","flatpickr-am-pm",D.l10n.amPM[r((D.latestSelectedDateObj?D.hourElement.value:D.config.defaultHour)>11)]),D.amPM.title=D.l10n.toggleTitle,D.amPM.tabIndex=-1,D.timeContainer.appendChild(D.amPM));return D.timeContainer}());d(D.calendarContainer,"rangeMode","range"===D.config.mode),d(D.calendarContainer,"animate",!0===D.config.animate),d(D.calendarContainer,"multiMonth",D.config.showMonths>1),D.calendarContainer.appendChild(e);var i=void 0!==D.config.appendTo&&void 0!==D.config.appendTo.nodeType;if((D.config.inline||D.config.static)&&(D.calendarContainer.classList.add(D.config.inline?"inline":"static"),D.config.inline&&(!i&&D.element.parentNode?D.element.parentNode.insertBefore(D.calendarContainer,D._input.nextSibling):void 0!==D.config.appendTo&&D.config.appendTo.appendChild(D.calendarContainer)),D.config.static)){var l=s("div","flatpickr-wrapper");D.element.parentNode&&D.element.parentNode.insertBefore(l,D.element),l.appendChild(D.element),D.altInput&&l.appendChild(D.altInput),l.appendChild(D.calendarContainer)}D.config.static||D.config.inline||(void 0!==D.config.appendTo?D.config.appendTo:window.document.body).appendChild(D.calendarContainer)}(),function(){D.config.wrap&&["open","close","toggle","clear"].forEach((function(e){Array.prototype.forEach.call(D.element.querySelectorAll("[data-"+e+"]"),(function(n){return F(n,"click",D[e])}))}));if(D.isMobile)return void function(){var e=D.config.enableTime?D.config.noCalendar?"time":"datetime-local":"date";D.mobileInput=s("input",D.input.className+" flatpickr-mobile"),D.mobileInput.tabIndex=1,D.mobileInput.type=e,D.mobileInput.disabled=D.input.disabled,D.mobileInput.required=D.input.required,D.mobileInput.placeholder=D.input.placeholder,D.mobileFormatStr="datetime-local"===e?"Y-m-d\\TH:i:S":"date"===e?"Y-m-d":"H:i:S",D.selectedDates.length>0&&(D.mobileInput.defaultValue=D.mobileInput.value=D.formatDate(D.selectedDates[0],D.mobileFormatStr));D.config.minDate&&(D.mobileInput.min=D.formatDate(D.config.minDate,"Y-m-d"));D.config.maxDate&&(D.mobileInput.max=D.formatDate(D.config.maxDate,"Y-m-d"));D.input.getAttribute("step")&&(D.mobileInput.step=String(D.input.getAttribute("step")));D.input.type="hidden",void 0!==D.altInput&&(D.altInput.type="hidden");try{D.input.parentNode&&D.input.parentNode.insertBefore(D.mobileInput,D.input.nextSibling)}catch(e){}F(D.mobileInput,"change",(function(e){D.setDate(m(e).value,!1,D.mobileFormatStr),ge("onChange"),ge("onClose")}))}();var e=l(ae,50);D._debouncedChange=l(N,300),D.daysContainer&&!/iPhone|iPad|iPod/i.test(navigator.userAgent)&&F(D.daysContainer,"mouseover",(function(e){"range"===D.config.mode&&te(m(e))}));F(window.document.body,"keydown",ne),D.config.inline||D.config.static||F(window,"resize",e);void 0!==window.ontouchstart?F(window.document,"touchstart",V):F(window.document,"click",V);F(window.document,"focus",V,{capture:!0}),!0===D.config.clickOpens&&(F(D._input,"focus",D.open),F(D._input,"click",D.open));void 0!==D.daysContainer&&(F(D.monthNav,"click",be),F(D.monthNav,["keyup","increment"],O),F(D.daysContainer,"click",se));if(void 0!==D.timeContainer&&void 0!==D.minuteElement&&void 0!==D.hourElement){F(D.timeContainer,["increment"],k),F(D.timeContainer,"blur",k,{capture:!0}),F(D.timeContainer,"click",P),F([D.hourElement,D.minuteElement],["focus","click"],(function(e){return m(e).select()})),void 0!==D.secondElement&&F(D.secondElement,"focus",(function(){return D.secondElement&&D.secondElement.select()})),void 0!==D.amPM&&F(D.amPM,"click",(function(e){k(e),N()}))}D.config.allowInput&&F(D._input,"blur",ee)}(),(D.selectedDates.length||D.config.noCalendar)&&(D.config.enableTime&&I(D.config.noCalendar?D.latestSelectedDateObj||D.config.minDate:void 0),we(!1)),x();var n=/^((?!chrome|android).)*safari/i.test(navigator.userAgent);!D.isMobile&&n&&le(),ge("onReady")}(),D}function x(e,n){for(var t=Array.prototype.slice.call(e).filter((function(e){return e instanceof HTMLElement})),a=[],i=0;i 3 && s < 21) + return "th"; + switch (s % 10) { + case 1: + return "st"; + case 2: + return "nd"; + case 3: + return "rd"; + default: + return "th"; + } + }, + rangeSeparator: " to ", + weekAbbreviation: "Wk", + scrollTitle: "Scroll to increment", + toggleTitle: "Click to toggle", + amPM: ["AM", "PM"], + yearAriaLabel: "Year", + monthAriaLabel: "Month", + hourAriaLabel: "Hour", + minuteAriaLabel: "Minute", + time_24hr: false, + }; + + exports.default = english; + exports.english = english; + + Object.defineProperty(exports, '__esModule', { value: true }); + +}))); diff --git a/website/js/vendor/flatpickr/l10n/fr.d.ts b/website/js/vendor/flatpickr/l10n/fr.d.ts new file mode 100644 index 0000000..6fcd191 --- /dev/null +++ b/website/js/vendor/flatpickr/l10n/fr.d.ts @@ -0,0 +1,69 @@ +import { CustomLocale } from "../types/locale"; +export declare const French: CustomLocale; +declare const _default: { + default?: CustomLocale | undefined; + hr?: CustomLocale | undefined; + th?: CustomLocale | undefined; + tr?: CustomLocale | undefined; + ar?: CustomLocale | undefined; + at?: CustomLocale | undefined; + az?: CustomLocale | undefined; + be?: CustomLocale | undefined; + bg?: CustomLocale | undefined; + bn?: CustomLocale | undefined; + bs?: CustomLocale | undefined; + ca?: CustomLocale | undefined; + cat?: CustomLocale | undefined; + cs?: CustomLocale | undefined; + cy?: CustomLocale | undefined; + da?: CustomLocale | undefined; + de?: CustomLocale | undefined; + en?: CustomLocale | undefined; + eo?: CustomLocale | undefined; + es?: CustomLocale | undefined; + et?: CustomLocale | undefined; + fa?: CustomLocale | undefined; + fi?: CustomLocale | undefined; + fo?: CustomLocale | undefined; + fr?: CustomLocale | undefined; + gr?: CustomLocale | undefined; + he?: CustomLocale | undefined; + hi?: CustomLocale | undefined; + hu?: CustomLocale | undefined; + id?: CustomLocale | undefined; + is?: CustomLocale | undefined; + it?: CustomLocale | undefined; + ja?: CustomLocale | undefined; + ka?: CustomLocale | undefined; + ko?: CustomLocale | undefined; + km?: CustomLocale | undefined; + kz?: CustomLocale | undefined; + lt?: CustomLocale | undefined; + lv?: CustomLocale | undefined; + mk?: CustomLocale | undefined; + mn?: CustomLocale | undefined; + ms?: CustomLocale | undefined; + my?: CustomLocale | undefined; + nl?: CustomLocale | undefined; + no?: CustomLocale | undefined; + pa?: CustomLocale | undefined; + pl?: CustomLocale | undefined; + pt?: CustomLocale | undefined; + ro?: CustomLocale | undefined; + ru?: CustomLocale | undefined; + si?: CustomLocale | undefined; + sk?: CustomLocale | undefined; + sl?: CustomLocale | undefined; + sq?: CustomLocale | undefined; + sr?: CustomLocale | undefined; + sv?: CustomLocale | undefined; + uk?: CustomLocale | undefined; + vn?: CustomLocale | undefined; + zh?: CustomLocale | undefined; + uz?: CustomLocale | undefined; + uz_latn?: CustomLocale | undefined; + zh_tw?: CustomLocale | undefined; +} & { + default: import("../types/locale").Locale; +}; +export default _default; diff --git a/website/js/vendor/flatpickr/l10n/fr.js b/website/js/vendor/flatpickr/l10n/fr.js new file mode 100644 index 0000000..4a63cfe --- /dev/null +++ b/website/js/vendor/flatpickr/l10n/fr.js @@ -0,0 +1,75 @@ +(function (global, factory) { + typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : + typeof define === 'function' && define.amd ? define(['exports'], factory) : + (global = global || self, factory(global.fr = {})); +}(this, (function (exports) { 'use strict'; + + var fp = typeof window !== "undefined" && window.flatpickr !== undefined + ? window.flatpickr + : { + l10ns: {}, + }; + var French = { + firstDayOfWeek: 1, + weekdays: { + shorthand: ["dim", "lun", "mar", "mer", "jeu", "ven", "sam"], + longhand: [ + "dimanche", + "lundi", + "mardi", + "mercredi", + "jeudi", + "vendredi", + "samedi", + ], + }, + months: { + shorthand: [ + "janv", + "févr", + "mars", + "avr", + "mai", + "juin", + "juil", + "août", + "sept", + "oct", + "nov", + "déc", + ], + longhand: [ + "janvier", + "février", + "mars", + "avril", + "mai", + "juin", + "juillet", + "août", + "septembre", + "octobre", + "novembre", + "décembre", + ], + }, + ordinal: function (nth) { + if (nth > 1) + return ""; + return "er"; + }, + rangeSeparator: " au ", + weekAbbreviation: "Sem", + scrollTitle: "Défiler pour augmenter la valeur", + toggleTitle: "Cliquer pour basculer", + time_24hr: true, + }; + fp.l10ns.fr = French; + var fr = fp.l10ns; + + exports.French = French; + exports.default = fr; + + Object.defineProperty(exports, '__esModule', { value: true }); + +}))); diff --git a/website/js/vendor/flatpickr/l10n/index.d.ts b/website/js/vendor/flatpickr/l10n/index.d.ts new file mode 100644 index 0000000..8b2ef7d --- /dev/null +++ b/website/js/vendor/flatpickr/l10n/index.d.ts @@ -0,0 +1,3 @@ +import { key, CustomLocale } from "../types/locale"; +declare const l10n: Record; +export default l10n; diff --git a/website/js/vendor/flatpickr/l10n/index.js b/website/js/vendor/flatpickr/l10n/index.js new file mode 100644 index 0000000..c197ead --- /dev/null +++ b/website/js/vendor/flatpickr/l10n/index.js @@ -0,0 +1,3594 @@ +(function (global, factory) { + typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : + typeof define === 'function' && define.amd ? define(['exports'], factory) : + (global = global || self, factory(global.index = {})); +}(this, (function (exports) { 'use strict'; + + /*! ***************************************************************************** + Copyright (c) Microsoft Corporation. + + Permission to use, copy, modify, and/or distribute this software for any + purpose with or without fee is hereby granted. + + THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH + REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY + AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, + INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM + LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR + OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + PERFORMANCE OF THIS SOFTWARE. + ***************************************************************************** */ + + var __assign = function() { + __assign = Object.assign || function __assign(t) { + for (var s, i = 1, n = arguments.length; i < n; i++) { + s = arguments[i]; + for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; + } + return t; + }; + return __assign.apply(this, arguments); + }; + + var fp = typeof window !== "undefined" && window.flatpickr !== undefined + ? window.flatpickr + : { + l10ns: {}, + }; + var Arabic = { + weekdays: { + shorthand: ["أحد", "اثنين", "ثلاثاء", "أربعاء", "خميس", "جمعة", "سبت"], + longhand: [ + "الأحد", + "الاثنين", + "الثلاثاء", + "الأربعاء", + "الخميس", + "الجمعة", + "السبت", + ], + }, + months: { + shorthand: ["1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12"], + longhand: [ + "يناير", + "فبراير", + "مارس", + "أبريل", + "مايو", + "يونيو", + "يوليو", + "أغسطس", + "سبتمبر", + "أكتوبر", + "نوفمبر", + "ديسمبر", + ], + }, + rangeSeparator: " - ", + }; + fp.l10ns.ar = Arabic; + fp.l10ns; + + var fp$1 = typeof window !== "undefined" && window.flatpickr !== undefined + ? window.flatpickr + : { + l10ns: {}, + }; + var Austria = { + weekdays: { + shorthand: ["So", "Mo", "Di", "Mi", "Do", "Fr", "Sa"], + longhand: [ + "Sonntag", + "Montag", + "Dienstag", + "Mittwoch", + "Donnerstag", + "Freitag", + "Samstag", + ], + }, + months: { + shorthand: [ + "Jän", + "Feb", + "Mär", + "Apr", + "Mai", + "Jun", + "Jul", + "Aug", + "Sep", + "Okt", + "Nov", + "Dez", + ], + longhand: [ + "Jänner", + "Februar", + "März", + "April", + "Mai", + "Juni", + "Juli", + "August", + "September", + "Oktober", + "November", + "Dezember", + ], + }, + firstDayOfWeek: 1, + weekAbbreviation: "KW", + rangeSeparator: " bis ", + scrollTitle: "Zum Ändern scrollen", + toggleTitle: "Zum Umschalten klicken", + }; + fp$1.l10ns.at = Austria; + fp$1.l10ns; + + var fp$2 = typeof window !== "undefined" && window.flatpickr !== undefined + ? window.flatpickr + : { + l10ns: {}, + }; + var Azerbaijan = { + weekdays: { + shorthand: ["B.", "B.e.", "Ç.a.", "Ç.", "C.a.", "C.", "Ş."], + longhand: [ + "Bazar", + "Bazar ertəsi", + "Çərşənbə axşamı", + "Çərşənbə", + "Cümə axşamı", + "Cümə", + "Şənbə", + ], + }, + months: { + shorthand: [ + "Yan", + "Fev", + "Mar", + "Apr", + "May", + "İyn", + "İyl", + "Avq", + "Sen", + "Okt", + "Noy", + "Dek", + ], + longhand: [ + "Yanvar", + "Fevral", + "Mart", + "Aprel", + "May", + "İyun", + "İyul", + "Avqust", + "Sentyabr", + "Oktyabr", + "Noyabr", + "Dekabr", + ], + }, + firstDayOfWeek: 1, + ordinal: function () { + return "."; + }, + rangeSeparator: " - ", + weekAbbreviation: "Hf", + scrollTitle: "Artırmaq üçün sürüşdürün", + toggleTitle: "Aç / Bağla", + amPM: ["GƏ", "GS"], + time_24hr: true, + }; + fp$2.l10ns.az = Azerbaijan; + fp$2.l10ns; + + var fp$3 = typeof window !== "undefined" && window.flatpickr !== undefined + ? window.flatpickr + : { + l10ns: {}, + }; + var Belarusian = { + weekdays: { + shorthand: ["Нд", "Пн", "Аў", "Ср", "Чц", "Пт", "Сб"], + longhand: [ + "Нядзеля", + "Панядзелак", + "Аўторак", + "Серада", + "Чацвер", + "Пятніца", + "Субота", + ], + }, + months: { + shorthand: [ + "Сту", + "Лют", + "Сак", + "Кра", + "Тра", + "Чэр", + "Ліп", + "Жні", + "Вер", + "Кас", + "Ліс", + "Сне", + ], + longhand: [ + "Студзень", + "Люты", + "Сакавік", + "Красавік", + "Травень", + "Чэрвень", + "Ліпень", + "Жнівень", + "Верасень", + "Кастрычнік", + "Лістапад", + "Снежань", + ], + }, + firstDayOfWeek: 1, + ordinal: function () { + return ""; + }, + rangeSeparator: " — ", + weekAbbreviation: "Тыд.", + scrollTitle: "Пракруціце для павелічэння", + toggleTitle: "Націсніце для пераключэння", + amPM: ["ДП", "ПП"], + yearAriaLabel: "Год", + time_24hr: true, + }; + fp$3.l10ns.be = Belarusian; + fp$3.l10ns; + + var fp$4 = typeof window !== "undefined" && window.flatpickr !== undefined + ? window.flatpickr + : { + l10ns: {}, + }; + var Bosnian = { + firstDayOfWeek: 1, + weekdays: { + shorthand: ["Ned", "Pon", "Uto", "Sri", "Čet", "Pet", "Sub"], + longhand: [ + "Nedjelja", + "Ponedjeljak", + "Utorak", + "Srijeda", + "Četvrtak", + "Petak", + "Subota", + ], + }, + months: { + shorthand: [ + "Jan", + "Feb", + "Mar", + "Apr", + "Maj", + "Jun", + "Jul", + "Avg", + "Sep", + "Okt", + "Nov", + "Dec", + ], + longhand: [ + "Januar", + "Februar", + "Mart", + "April", + "Maj", + "Juni", + "Juli", + "Avgust", + "Septembar", + "Oktobar", + "Novembar", + "Decembar", + ], + }, + time_24hr: true, + }; + fp$4.l10ns.bs = Bosnian; + fp$4.l10ns; + + var fp$5 = typeof window !== "undefined" && window.flatpickr !== undefined + ? window.flatpickr + : { + l10ns: {}, + }; + var Bulgarian = { + weekdays: { + shorthand: ["Нд", "Пн", "Вт", "Ср", "Чт", "Пт", "Сб"], + longhand: [ + "Неделя", + "Понеделник", + "Вторник", + "Сряда", + "Четвъртък", + "Петък", + "Събота", + ], + }, + months: { + shorthand: [ + "Яну", + "Фев", + "Март", + "Апр", + "Май", + "Юни", + "Юли", + "Авг", + "Сеп", + "Окт", + "Ное", + "Дек", + ], + longhand: [ + "Януари", + "Февруари", + "Март", + "Април", + "Май", + "Юни", + "Юли", + "Август", + "Септември", + "Октомври", + "Ноември", + "Декември", + ], + }, + time_24hr: true, + firstDayOfWeek: 1, + }; + fp$5.l10ns.bg = Bulgarian; + fp$5.l10ns; + + var fp$6 = typeof window !== "undefined" && window.flatpickr !== undefined + ? window.flatpickr + : { + l10ns: {}, + }; + var Bangla = { + weekdays: { + shorthand: ["রবি", "সোম", "মঙ্গল", "বুধ", "বৃহস্পতি", "শুক্র", "শনি"], + longhand: [ + "রবিবার", + "সোমবার", + "মঙ্গলবার", + "বুধবার", + "বৃহস্পতিবার", + "শুক্রবার", + "শনিবার", + ], + }, + months: { + shorthand: [ + "জানু", + "ফেব্রু", + "মার্চ", + "এপ্রিল", + "মে", + "জুন", + "জুলাই", + "আগ", + "সেপ্টে", + "অক্টো", + "নভে", + "ডিসে", + ], + longhand: [ + "জানুয়ারী", + "ফেব্রুয়ারী", + "মার্চ", + "এপ্রিল", + "মে", + "জুন", + "জুলাই", + "আগস্ট", + "সেপ্টেম্বর", + "অক্টোবর", + "নভেম্বর", + "ডিসেম্বর", + ], + }, + }; + fp$6.l10ns.bn = Bangla; + fp$6.l10ns; + + var fp$7 = typeof window !== "undefined" && window.flatpickr !== undefined + ? window.flatpickr + : { + l10ns: {}, + }; + var Catalan = { + weekdays: { + shorthand: ["Dg", "Dl", "Dt", "Dc", "Dj", "Dv", "Ds"], + longhand: [ + "Diumenge", + "Dilluns", + "Dimarts", + "Dimecres", + "Dijous", + "Divendres", + "Dissabte", + ], + }, + months: { + shorthand: [ + "Gen", + "Febr", + "Març", + "Abr", + "Maig", + "Juny", + "Jul", + "Ag", + "Set", + "Oct", + "Nov", + "Des", + ], + longhand: [ + "Gener", + "Febrer", + "Març", + "Abril", + "Maig", + "Juny", + "Juliol", + "Agost", + "Setembre", + "Octubre", + "Novembre", + "Desembre", + ], + }, + ordinal: function (nth) { + var s = nth % 100; + if (s > 3 && s < 21) + return "è"; + switch (s % 10) { + case 1: + return "r"; + case 2: + return "n"; + case 3: + return "r"; + case 4: + return "t"; + default: + return "è"; + } + }, + firstDayOfWeek: 1, + time_24hr: true, + }; + fp$7.l10ns.cat = fp$7.l10ns.ca = Catalan; + fp$7.l10ns; + + var fp$8 = typeof window !== "undefined" && window.flatpickr !== undefined + ? window.flatpickr + : { + l10ns: {}, + }; + var Czech = { + weekdays: { + shorthand: ["Ne", "Po", "Út", "St", "Čt", "Pá", "So"], + longhand: [ + "Neděle", + "Pondělí", + "Úterý", + "Středa", + "Čtvrtek", + "Pátek", + "Sobota", + ], + }, + months: { + shorthand: [ + "Led", + "Ún", + "Bře", + "Dub", + "Kvě", + "Čer", + "Čvc", + "Srp", + "Zář", + "Říj", + "Lis", + "Pro", + ], + longhand: [ + "Leden", + "Únor", + "Březen", + "Duben", + "Květen", + "Červen", + "Červenec", + "Srpen", + "Září", + "Říjen", + "Listopad", + "Prosinec", + ], + }, + firstDayOfWeek: 1, + ordinal: function () { + return "."; + }, + rangeSeparator: " do ", + weekAbbreviation: "Týd.", + scrollTitle: "Rolujte pro změnu", + toggleTitle: "Přepnout dopoledne/odpoledne", + amPM: ["dop.", "odp."], + yearAriaLabel: "Rok", + time_24hr: true, + }; + fp$8.l10ns.cs = Czech; + fp$8.l10ns; + + var fp$9 = typeof window !== "undefined" && window.flatpickr !== undefined + ? window.flatpickr + : { + l10ns: {}, + }; + var Welsh = { + weekdays: { + shorthand: ["Sul", "Llun", "Maw", "Mer", "Iau", "Gwe", "Sad"], + longhand: [ + "Dydd Sul", + "Dydd Llun", + "Dydd Mawrth", + "Dydd Mercher", + "Dydd Iau", + "Dydd Gwener", + "Dydd Sadwrn", + ], + }, + months: { + shorthand: [ + "Ion", + "Chwef", + "Maw", + "Ebr", + "Mai", + "Meh", + "Gorff", + "Awst", + "Medi", + "Hyd", + "Tach", + "Rhag", + ], + longhand: [ + "Ionawr", + "Chwefror", + "Mawrth", + "Ebrill", + "Mai", + "Mehefin", + "Gorffennaf", + "Awst", + "Medi", + "Hydref", + "Tachwedd", + "Rhagfyr", + ], + }, + firstDayOfWeek: 1, + ordinal: function (nth) { + if (nth === 1) + return "af"; + if (nth === 2) + return "ail"; + if (nth === 3 || nth === 4) + return "ydd"; + if (nth === 5 || nth === 6) + return "ed"; + if ((nth >= 7 && nth <= 10) || + nth == 12 || + nth == 15 || + nth == 18 || + nth == 20) + return "fed"; + if (nth == 11 || + nth == 13 || + nth == 14 || + nth == 16 || + nth == 17 || + nth == 19) + return "eg"; + if (nth >= 21 && nth <= 39) + return "ain"; + // Inconclusive. + return ""; + }, + time_24hr: true, + }; + fp$9.l10ns.cy = Welsh; + fp$9.l10ns; + + var fp$a = typeof window !== "undefined" && window.flatpickr !== undefined + ? window.flatpickr + : { + l10ns: {}, + }; + var Danish = { + weekdays: { + shorthand: ["søn", "man", "tir", "ons", "tors", "fre", "lør"], + longhand: [ + "søndag", + "mandag", + "tirsdag", + "onsdag", + "torsdag", + "fredag", + "lørdag", + ], + }, + months: { + shorthand: [ + "jan", + "feb", + "mar", + "apr", + "maj", + "jun", + "jul", + "aug", + "sep", + "okt", + "nov", + "dec", + ], + longhand: [ + "januar", + "februar", + "marts", + "april", + "maj", + "juni", + "juli", + "august", + "september", + "oktober", + "november", + "december", + ], + }, + ordinal: function () { + return "."; + }, + firstDayOfWeek: 1, + rangeSeparator: " til ", + weekAbbreviation: "uge", + time_24hr: true, + }; + fp$a.l10ns.da = Danish; + fp$a.l10ns; + + var fp$b = typeof window !== "undefined" && window.flatpickr !== undefined + ? window.flatpickr + : { + l10ns: {}, + }; + var German = { + weekdays: { + shorthand: ["So", "Mo", "Di", "Mi", "Do", "Fr", "Sa"], + longhand: [ + "Sonntag", + "Montag", + "Dienstag", + "Mittwoch", + "Donnerstag", + "Freitag", + "Samstag", + ], + }, + months: { + shorthand: [ + "Jan", + "Feb", + "Mär", + "Apr", + "Mai", + "Jun", + "Jul", + "Aug", + "Sep", + "Okt", + "Nov", + "Dez", + ], + longhand: [ + "Januar", + "Februar", + "März", + "April", + "Mai", + "Juni", + "Juli", + "August", + "September", + "Oktober", + "November", + "Dezember", + ], + }, + firstDayOfWeek: 1, + weekAbbreviation: "KW", + rangeSeparator: " bis ", + scrollTitle: "Zum Ändern scrollen", + toggleTitle: "Zum Umschalten klicken", + time_24hr: true, + }; + fp$b.l10ns.de = German; + fp$b.l10ns; + + var english = { + weekdays: { + shorthand: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"], + longhand: [ + "Sunday", + "Monday", + "Tuesday", + "Wednesday", + "Thursday", + "Friday", + "Saturday", + ], + }, + months: { + shorthand: [ + "Jan", + "Feb", + "Mar", + "Apr", + "May", + "Jun", + "Jul", + "Aug", + "Sep", + "Oct", + "Nov", + "Dec", + ], + longhand: [ + "January", + "February", + "March", + "April", + "May", + "June", + "July", + "August", + "September", + "October", + "November", + "December", + ], + }, + daysInMonth: [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31], + firstDayOfWeek: 0, + ordinal: function (nth) { + var s = nth % 100; + if (s > 3 && s < 21) + return "th"; + switch (s % 10) { + case 1: + return "st"; + case 2: + return "nd"; + case 3: + return "rd"; + default: + return "th"; + } + }, + rangeSeparator: " to ", + weekAbbreviation: "Wk", + scrollTitle: "Scroll to increment", + toggleTitle: "Click to toggle", + amPM: ["AM", "PM"], + yearAriaLabel: "Year", + monthAriaLabel: "Month", + hourAriaLabel: "Hour", + minuteAriaLabel: "Minute", + time_24hr: false, + }; + + var fp$c = typeof window !== "undefined" && window.flatpickr !== undefined + ? window.flatpickr + : { + l10ns: {}, + }; + var Esperanto = { + firstDayOfWeek: 1, + rangeSeparator: " ĝis ", + weekAbbreviation: "Sem", + scrollTitle: "Rulumu por pligrandigi la valoron", + toggleTitle: "Klaku por ŝalti", + weekdays: { + shorthand: ["Dim", "Lun", "Mar", "Mer", "Ĵaŭ", "Ven", "Sab"], + longhand: [ + "dimanĉo", + "lundo", + "mardo", + "merkredo", + "ĵaŭdo", + "vendredo", + "sabato", + ], + }, + months: { + shorthand: [ + "Jan", + "Feb", + "Mar", + "Apr", + "Maj", + "Jun", + "Jul", + "Aŭg", + "Sep", + "Okt", + "Nov", + "Dec", + ], + longhand: [ + "januaro", + "februaro", + "marto", + "aprilo", + "majo", + "junio", + "julio", + "aŭgusto", + "septembro", + "oktobro", + "novembro", + "decembro", + ], + }, + ordinal: function () { + return "-a"; + }, + time_24hr: true, + }; + fp$c.l10ns.eo = Esperanto; + fp$c.l10ns; + + var fp$d = typeof window !== "undefined" && window.flatpickr !== undefined + ? window.flatpickr + : { + l10ns: {}, + }; + var Spanish = { + weekdays: { + shorthand: ["Dom", "Lun", "Mar", "Mié", "Jue", "Vie", "Sáb"], + longhand: [ + "Domingo", + "Lunes", + "Martes", + "Miércoles", + "Jueves", + "Viernes", + "Sábado", + ], + }, + months: { + shorthand: [ + "Ene", + "Feb", + "Mar", + "Abr", + "May", + "Jun", + "Jul", + "Ago", + "Sep", + "Oct", + "Nov", + "Dic", + ], + longhand: [ + "Enero", + "Febrero", + "Marzo", + "Abril", + "Mayo", + "Junio", + "Julio", + "Agosto", + "Septiembre", + "Octubre", + "Noviembre", + "Diciembre", + ], + }, + ordinal: function () { + return "º"; + }, + firstDayOfWeek: 1, + rangeSeparator: " a ", + time_24hr: true, + }; + fp$d.l10ns.es = Spanish; + fp$d.l10ns; + + var fp$e = typeof window !== "undefined" && window.flatpickr !== undefined + ? window.flatpickr + : { + l10ns: {}, + }; + var Estonian = { + weekdays: { + shorthand: ["P", "E", "T", "K", "N", "R", "L"], + longhand: [ + "Pühapäev", + "Esmaspäev", + "Teisipäev", + "Kolmapäev", + "Neljapäev", + "Reede", + "Laupäev", + ], + }, + months: { + shorthand: [ + "Jaan", + "Veebr", + "Märts", + "Apr", + "Mai", + "Juuni", + "Juuli", + "Aug", + "Sept", + "Okt", + "Nov", + "Dets", + ], + longhand: [ + "Jaanuar", + "Veebruar", + "Märts", + "Aprill", + "Mai", + "Juuni", + "Juuli", + "August", + "September", + "Oktoober", + "November", + "Detsember", + ], + }, + firstDayOfWeek: 1, + ordinal: function () { + return "."; + }, + weekAbbreviation: "Näd", + rangeSeparator: " kuni ", + scrollTitle: "Keri, et suurendada", + toggleTitle: "Klõpsa, et vahetada", + time_24hr: true, + }; + fp$e.l10ns.et = Estonian; + fp$e.l10ns; + + var fp$f = typeof window !== "undefined" && window.flatpickr !== undefined + ? window.flatpickr + : { + l10ns: {}, + }; + var Persian = { + weekdays: { + shorthand: ["یک", "دو", "سه", "چهار", "پنج", "جمعه", "شنبه"], + longhand: [ + "یک‌شنبه", + "دوشنبه", + "سه‌شنبه", + "چهارشنبه", + "پنچ‌شنبه", + "جمعه", + "شنبه", + ], + }, + months: { + shorthand: [ + "ژانویه", + "فوریه", + "مارس", + "آوریل", + "مه", + "ژوئن", + "ژوئیه", + "اوت", + "سپتامبر", + "اکتبر", + "نوامبر", + "دسامبر", + ], + longhand: [ + "ژانویه", + "فوریه", + "مارس", + "آوریل", + "مه", + "ژوئن", + "ژوئیه", + "اوت", + "سپتامبر", + "اکتبر", + "نوامبر", + "دسامبر", + ], + }, + firstDayOfWeek: 6, + ordinal: function () { + return ""; + }, + }; + fp$f.l10ns.fa = Persian; + fp$f.l10ns; + + var fp$g = typeof window !== "undefined" && window.flatpickr !== undefined + ? window.flatpickr + : { + l10ns: {}, + }; + var Finnish = { + firstDayOfWeek: 1, + weekdays: { + shorthand: ["Su", "Ma", "Ti", "Ke", "To", "Pe", "La"], + longhand: [ + "Sunnuntai", + "Maanantai", + "Tiistai", + "Keskiviikko", + "Torstai", + "Perjantai", + "Lauantai", + ], + }, + months: { + shorthand: [ + "Tammi", + "Helmi", + "Maalis", + "Huhti", + "Touko", + "Kesä", + "Heinä", + "Elo", + "Syys", + "Loka", + "Marras", + "Joulu", + ], + longhand: [ + "Tammikuu", + "Helmikuu", + "Maaliskuu", + "Huhtikuu", + "Toukokuu", + "Kesäkuu", + "Heinäkuu", + "Elokuu", + "Syyskuu", + "Lokakuu", + "Marraskuu", + "Joulukuu", + ], + }, + ordinal: function () { + return "."; + }, + time_24hr: true, + }; + fp$g.l10ns.fi = Finnish; + fp$g.l10ns; + + var fp$h = typeof window !== "undefined" && window.flatpickr !== undefined + ? window.flatpickr + : { + l10ns: {}, + }; + var Faroese = { + weekdays: { + shorthand: ["Sun", "Mán", "Týs", "Mik", "Hós", "Frí", "Ley"], + longhand: [ + "Sunnudagur", + "Mánadagur", + "Týsdagur", + "Mikudagur", + "Hósdagur", + "Fríggjadagur", + "Leygardagur", + ], + }, + months: { + shorthand: [ + "Jan", + "Feb", + "Mar", + "Apr", + "Mai", + "Jun", + "Jul", + "Aug", + "Sep", + "Okt", + "Nov", + "Des", + ], + longhand: [ + "Januar", + "Februar", + "Mars", + "Apríl", + "Mai", + "Juni", + "Juli", + "August", + "Septembur", + "Oktobur", + "Novembur", + "Desembur", + ], + }, + ordinal: function () { + return "."; + }, + firstDayOfWeek: 1, + rangeSeparator: " til ", + weekAbbreviation: "vika", + scrollTitle: "Rulla fyri at broyta", + toggleTitle: "Trýst fyri at skifta", + yearAriaLabel: "Ár", + time_24hr: true, + }; + fp$h.l10ns.fo = Faroese; + fp$h.l10ns; + + var fp$i = typeof window !== "undefined" && window.flatpickr !== undefined + ? window.flatpickr + : { + l10ns: {}, + }; + var French = { + firstDayOfWeek: 1, + weekdays: { + shorthand: ["dim", "lun", "mar", "mer", "jeu", "ven", "sam"], + longhand: [ + "dimanche", + "lundi", + "mardi", + "mercredi", + "jeudi", + "vendredi", + "samedi", + ], + }, + months: { + shorthand: [ + "janv", + "févr", + "mars", + "avr", + "mai", + "juin", + "juil", + "août", + "sept", + "oct", + "nov", + "déc", + ], + longhand: [ + "janvier", + "février", + "mars", + "avril", + "mai", + "juin", + "juillet", + "août", + "septembre", + "octobre", + "novembre", + "décembre", + ], + }, + ordinal: function (nth) { + if (nth > 1) + return ""; + return "er"; + }, + rangeSeparator: " au ", + weekAbbreviation: "Sem", + scrollTitle: "Défiler pour augmenter la valeur", + toggleTitle: "Cliquer pour basculer", + time_24hr: true, + }; + fp$i.l10ns.fr = French; + fp$i.l10ns; + + var fp$j = typeof window !== "undefined" && window.flatpickr !== undefined + ? window.flatpickr + : { + l10ns: {}, + }; + var Greek = { + weekdays: { + shorthand: ["Κυ", "Δε", "Τρ", "Τε", "Πέ", "Πα", "Σά"], + longhand: [ + "Κυριακή", + "Δευτέρα", + "Τρίτη", + "Τετάρτη", + "Πέμπτη", + "Παρασκευή", + "Σάββατο", + ], + }, + months: { + shorthand: [ + "Ιαν", + "Φεβ", + "Μάρ", + "Απρ", + "Μάι", + "Ιού", + "Ιού", + "Αύγ", + "Σεπ", + "Οκτ", + "Νοέ", + "Δεκ", + ], + longhand: [ + "Ιανουάριος", + "Φεβρουάριος", + "Μάρτιος", + "Απρίλιος", + "Μάιος", + "Ιούνιος", + "Ιούλιος", + "Αύγουστος", + "Σεπτέμβριος", + "Οκτώβριος", + "Νοέμβριος", + "Δεκέμβριος", + ], + }, + firstDayOfWeek: 1, + ordinal: function () { + return ""; + }, + weekAbbreviation: "Εβδ", + rangeSeparator: " έως ", + scrollTitle: "Μετακυλήστε για προσαύξηση", + toggleTitle: "Κάντε κλικ για αλλαγή", + amPM: ["ΠΜ", "ΜΜ"], + }; + fp$j.l10ns.gr = Greek; + fp$j.l10ns; + + var fp$k = typeof window !== "undefined" && window.flatpickr !== undefined + ? window.flatpickr + : { + l10ns: {}, + }; + var Hebrew = { + weekdays: { + shorthand: ["א", "ב", "ג", "ד", "ה", "ו", "ש"], + longhand: ["ראשון", "שני", "שלישי", "רביעי", "חמישי", "שישי", "שבת"], + }, + months: { + shorthand: [ + "ינו׳", + "פבר׳", + "מרץ", + "אפר׳", + "מאי", + "יוני", + "יולי", + "אוג׳", + "ספט׳", + "אוק׳", + "נוב׳", + "דצמ׳", + ], + longhand: [ + "ינואר", + "פברואר", + "מרץ", + "אפריל", + "מאי", + "יוני", + "יולי", + "אוגוסט", + "ספטמבר", + "אוקטובר", + "נובמבר", + "דצמבר", + ], + }, + rangeSeparator: " אל ", + time_24hr: true, + }; + fp$k.l10ns.he = Hebrew; + fp$k.l10ns; + + var fp$l = typeof window !== "undefined" && window.flatpickr !== undefined + ? window.flatpickr + : { + l10ns: {}, + }; + var Hindi = { + weekdays: { + shorthand: ["रवि", "सोम", "मंगल", "बुध", "गुरु", "शुक्र", "शनि"], + longhand: [ + "रविवार", + "सोमवार", + "मंगलवार", + "बुधवार", + "गुरुवार", + "शुक्रवार", + "शनिवार", + ], + }, + months: { + shorthand: [ + "जन", + "फर", + "मार्च", + "अप्रेल", + "मई", + "जून", + "जूलाई", + "अग", + "सित", + "अक्ट", + "नव", + "दि", + ], + longhand: [ + "जनवरी ", + "फरवरी", + "मार्च", + "अप्रेल", + "मई", + "जून", + "जूलाई", + "अगस्त ", + "सितम्बर", + "अक्टूबर", + "नवम्बर", + "दिसम्बर", + ], + }, + }; + fp$l.l10ns.hi = Hindi; + fp$l.l10ns; + + var fp$m = typeof window !== "undefined" && window.flatpickr !== undefined + ? window.flatpickr + : { + l10ns: {}, + }; + var Croatian = { + firstDayOfWeek: 1, + weekdays: { + shorthand: ["Ned", "Pon", "Uto", "Sri", "Čet", "Pet", "Sub"], + longhand: [ + "Nedjelja", + "Ponedjeljak", + "Utorak", + "Srijeda", + "Četvrtak", + "Petak", + "Subota", + ], + }, + months: { + shorthand: [ + "Sij", + "Velj", + "Ožu", + "Tra", + "Svi", + "Lip", + "Srp", + "Kol", + "Ruj", + "Lis", + "Stu", + "Pro", + ], + longhand: [ + "Siječanj", + "Veljača", + "Ožujak", + "Travanj", + "Svibanj", + "Lipanj", + "Srpanj", + "Kolovoz", + "Rujan", + "Listopad", + "Studeni", + "Prosinac", + ], + }, + time_24hr: true, + }; + fp$m.l10ns.hr = Croatian; + fp$m.l10ns; + + var fp$n = typeof window !== "undefined" && window.flatpickr !== undefined + ? window.flatpickr + : { + l10ns: {}, + }; + var Hungarian = { + firstDayOfWeek: 1, + weekdays: { + shorthand: ["V", "H", "K", "Sz", "Cs", "P", "Szo"], + longhand: [ + "Vasárnap", + "Hétfő", + "Kedd", + "Szerda", + "Csütörtök", + "Péntek", + "Szombat", + ], + }, + months: { + shorthand: [ + "Jan", + "Feb", + "Már", + "Ápr", + "Máj", + "Jún", + "Júl", + "Aug", + "Szep", + "Okt", + "Nov", + "Dec", + ], + longhand: [ + "Január", + "Február", + "Március", + "Április", + "Május", + "Június", + "Július", + "Augusztus", + "Szeptember", + "Október", + "November", + "December", + ], + }, + ordinal: function () { + return "."; + }, + weekAbbreviation: "Hét", + scrollTitle: "Görgessen", + toggleTitle: "Kattintson a váltáshoz", + rangeSeparator: " - ", + time_24hr: true, + }; + fp$n.l10ns.hu = Hungarian; + fp$n.l10ns; + + var fp$o = typeof window !== "undefined" && window.flatpickr !== undefined + ? window.flatpickr + : { + l10ns: {}, + }; + var Indonesian = { + weekdays: { + shorthand: ["Min", "Sen", "Sel", "Rab", "Kam", "Jum", "Sab"], + longhand: ["Minggu", "Senin", "Selasa", "Rabu", "Kamis", "Jumat", "Sabtu"], + }, + months: { + shorthand: [ + "Jan", + "Feb", + "Mar", + "Apr", + "Mei", + "Jun", + "Jul", + "Agu", + "Sep", + "Okt", + "Nov", + "Des", + ], + longhand: [ + "Januari", + "Februari", + "Maret", + "April", + "Mei", + "Juni", + "Juli", + "Agustus", + "September", + "Oktober", + "November", + "Desember", + ], + }, + firstDayOfWeek: 1, + ordinal: function () { + return ""; + }, + time_24hr: true, + rangeSeparator: " - ", + }; + fp$o.l10ns.id = Indonesian; + fp$o.l10ns; + + var fp$p = typeof window !== "undefined" && window.flatpickr !== undefined + ? window.flatpickr + : { + l10ns: {}, + }; + var Icelandic = { + weekdays: { + shorthand: ["Sun", "Mán", "Þri", "Mið", "Fim", "Fös", "Lau"], + longhand: [ + "Sunnudagur", + "Mánudagur", + "Þriðjudagur", + "Miðvikudagur", + "Fimmtudagur", + "Föstudagur", + "Laugardagur", + ], + }, + months: { + shorthand: [ + "Jan", + "Feb", + "Mar", + "Apr", + "Maí", + "Jún", + "Júl", + "Ágú", + "Sep", + "Okt", + "Nóv", + "Des", + ], + longhand: [ + "Janúar", + "Febrúar", + "Mars", + "Apríl", + "Maí", + "Júní", + "Júlí", + "Ágúst", + "September", + "Október", + "Nóvember", + "Desember", + ], + }, + ordinal: function () { + return "."; + }, + firstDayOfWeek: 1, + rangeSeparator: " til ", + weekAbbreviation: "vika", + yearAriaLabel: "Ár", + time_24hr: true, + }; + fp$p.l10ns.is = Icelandic; + fp$p.l10ns; + + var fp$q = typeof window !== "undefined" && window.flatpickr !== undefined + ? window.flatpickr + : { + l10ns: {}, + }; + var Italian = { + weekdays: { + shorthand: ["Dom", "Lun", "Mar", "Mer", "Gio", "Ven", "Sab"], + longhand: [ + "Domenica", + "Lunedì", + "Martedì", + "Mercoledì", + "Giovedì", + "Venerdì", + "Sabato", + ], + }, + months: { + shorthand: [ + "Gen", + "Feb", + "Mar", + "Apr", + "Mag", + "Giu", + "Lug", + "Ago", + "Set", + "Ott", + "Nov", + "Dic", + ], + longhand: [ + "Gennaio", + "Febbraio", + "Marzo", + "Aprile", + "Maggio", + "Giugno", + "Luglio", + "Agosto", + "Settembre", + "Ottobre", + "Novembre", + "Dicembre", + ], + }, + firstDayOfWeek: 1, + ordinal: function () { return "°"; }, + rangeSeparator: " al ", + weekAbbreviation: "Se", + scrollTitle: "Scrolla per aumentare", + toggleTitle: "Clicca per cambiare", + time_24hr: true, + }; + fp$q.l10ns.it = Italian; + fp$q.l10ns; + + var fp$r = typeof window !== "undefined" && window.flatpickr !== undefined + ? window.flatpickr + : { + l10ns: {}, + }; + var Japanese = { + weekdays: { + shorthand: ["日", "月", "火", "水", "木", "金", "土"], + longhand: [ + "日曜日", + "月曜日", + "火曜日", + "水曜日", + "木曜日", + "金曜日", + "土曜日", + ], + }, + months: { + shorthand: [ + "1月", + "2月", + "3月", + "4月", + "5月", + "6月", + "7月", + "8月", + "9月", + "10月", + "11月", + "12月", + ], + longhand: [ + "1月", + "2月", + "3月", + "4月", + "5月", + "6月", + "7月", + "8月", + "9月", + "10月", + "11月", + "12月", + ], + }, + time_24hr: true, + rangeSeparator: " から ", + firstDayOfWeek: 1, + }; + fp$r.l10ns.ja = Japanese; + fp$r.l10ns; + + var fp$s = typeof window !== "undefined" && window.flatpickr !== undefined + ? window.flatpickr + : { + l10ns: {}, + }; + var Georgian = { + weekdays: { + shorthand: ["კვ", "ორ", "სა", "ოთ", "ხუ", "პა", "შა"], + longhand: [ + "კვირა", + "ორშაბათი", + "სამშაბათი", + "ოთხშაბათი", + "ხუთშაბათი", + "პარასკევი", + "შაბათი", + ], + }, + months: { + shorthand: [ + "იან", + "თებ", + "მარ", + "აპრ", + "მაი", + "ივნ", + "ივლ", + "აგვ", + "სექ", + "ოქტ", + "ნოე", + "დეკ", + ], + longhand: [ + "იანვარი", + "თებერვალი", + "მარტი", + "აპრილი", + "მაისი", + "ივნისი", + "ივლისი", + "აგვისტო", + "სექტემბერი", + "ოქტომბერი", + "ნოემბერი", + "დეკემბერი", + ], + }, + firstDayOfWeek: 1, + ordinal: function () { + return ""; + }, + rangeSeparator: " — ", + weekAbbreviation: "კვ.", + scrollTitle: "დასქროლეთ გასადიდებლად", + toggleTitle: "დააკლიკეთ გადართვისთვის", + amPM: ["AM", "PM"], + yearAriaLabel: "წელი", + time_24hr: true, + }; + fp$s.l10ns.ka = Georgian; + fp$s.l10ns; + + var fp$t = typeof window !== "undefined" && window.flatpickr !== undefined + ? window.flatpickr + : { + l10ns: {}, + }; + var Korean = { + weekdays: { + shorthand: ["일", "월", "화", "수", "목", "금", "토"], + longhand: [ + "일요일", + "월요일", + "화요일", + "수요일", + "목요일", + "금요일", + "토요일", + ], + }, + months: { + shorthand: [ + "1월", + "2월", + "3월", + "4월", + "5월", + "6월", + "7월", + "8월", + "9월", + "10월", + "11월", + "12월", + ], + longhand: [ + "1월", + "2월", + "3월", + "4월", + "5월", + "6월", + "7월", + "8월", + "9월", + "10월", + "11월", + "12월", + ], + }, + ordinal: function () { + return "일"; + }, + rangeSeparator: " ~ ", + }; + fp$t.l10ns.ko = Korean; + fp$t.l10ns; + + var fp$u = typeof window !== "undefined" && window.flatpickr !== undefined + ? window.flatpickr + : { + l10ns: {}, + }; + var Khmer = { + weekdays: { + shorthand: ["អាទិត្យ", "ចន្ទ", "អង្គារ", "ពុធ", "ព្រហស.", "សុក្រ", "សៅរ៍"], + longhand: [ + "អាទិត្យ", + "ចន្ទ", + "អង្គារ", + "ពុធ", + "ព្រហស្បតិ៍", + "សុក្រ", + "សៅរ៍", + ], + }, + months: { + shorthand: [ + "មករា", + "កុម្ភះ", + "មីនា", + "មេសា", + "ឧសភា", + "មិថុនា", + "កក្កដា", + "សីហា", + "កញ្ញា", + "តុលា", + "វិច្ឆិកា", + "ធ្នូ", + ], + longhand: [ + "មករា", + "កុម្ភះ", + "មីនា", + "មេសា", + "ឧសភា", + "មិថុនា", + "កក្កដា", + "សីហា", + "កញ្ញា", + "តុលា", + "វិច្ឆិកា", + "ធ្នូ", + ], + }, + ordinal: function () { + return ""; + }, + firstDayOfWeek: 1, + rangeSeparator: " ដល់ ", + weekAbbreviation: "សប្តាហ៍", + scrollTitle: "រំកិលដើម្បីបង្កើន", + toggleTitle: "ចុចដើម្បីផ្លាស់ប្ដូរ", + yearAriaLabel: "ឆ្នាំ", + time_24hr: true, + }; + fp$u.l10ns.km = Khmer; + fp$u.l10ns; + + var fp$v = typeof window !== "undefined" && window.flatpickr !== undefined + ? window.flatpickr + : { + l10ns: {}, + }; + var Kazakh = { + weekdays: { + shorthand: ["Жс", "Дс", "Сc", "Ср", "Бс", "Жм", "Сб"], + longhand: [ + "Жексенбi", + "Дүйсенбi", + "Сейсенбi", + "Сәрсенбi", + "Бейсенбi", + "Жұма", + "Сенбi", + ], + }, + months: { + shorthand: [ + "Қаң", + "Ақп", + "Нау", + "Сәу", + "Мам", + "Мау", + "Шiл", + "Там", + "Қыр", + "Қаз", + "Қар", + "Жел", + ], + longhand: [ + "Қаңтар", + "Ақпан", + "Наурыз", + "Сәуiр", + "Мамыр", + "Маусым", + "Шiлде", + "Тамыз", + "Қыркүйек", + "Қазан", + "Қараша", + "Желтоқсан", + ], + }, + firstDayOfWeek: 1, + ordinal: function () { + return ""; + }, + rangeSeparator: " — ", + weekAbbreviation: "Апта", + scrollTitle: "Үлкейту үшін айналдырыңыз", + toggleTitle: "Ауыстыру үшін басыңыз", + amPM: ["ТД", "ТК"], + yearAriaLabel: "Жыл", + }; + fp$v.l10ns.kz = Kazakh; + fp$v.l10ns; + + var fp$w = typeof window !== "undefined" && window.flatpickr !== undefined + ? window.flatpickr + : { + l10ns: {}, + }; + var Lithuanian = { + weekdays: { + shorthand: ["S", "Pr", "A", "T", "K", "Pn", "Š"], + longhand: [ + "Sekmadienis", + "Pirmadienis", + "Antradienis", + "Trečiadienis", + "Ketvirtadienis", + "Penktadienis", + "Šeštadienis", + ], + }, + months: { + shorthand: [ + "Sau", + "Vas", + "Kov", + "Bal", + "Geg", + "Bir", + "Lie", + "Rgp", + "Rgs", + "Spl", + "Lap", + "Grd", + ], + longhand: [ + "Sausis", + "Vasaris", + "Kovas", + "Balandis", + "Gegužė", + "Birželis", + "Liepa", + "Rugpjūtis", + "Rugsėjis", + "Spalis", + "Lapkritis", + "Gruodis", + ], + }, + firstDayOfWeek: 1, + ordinal: function () { + return "-a"; + }, + rangeSeparator: " iki ", + weekAbbreviation: "Sav", + scrollTitle: "Keisti laiką pelės rateliu", + toggleTitle: "Perjungti laiko formatą", + time_24hr: true, + }; + fp$w.l10ns.lt = Lithuanian; + fp$w.l10ns; + + var fp$x = typeof window !== "undefined" && window.flatpickr !== undefined + ? window.flatpickr + : { + l10ns: {}, + }; + var Latvian = { + firstDayOfWeek: 1, + weekdays: { + shorthand: ["Sv", "Pr", "Ot", "Tr", "Ce", "Pk", "Se"], + longhand: [ + "Svētdiena", + "Pirmdiena", + "Otrdiena", + "Trešdiena", + "Ceturtdiena", + "Piektdiena", + "Sestdiena", + ], + }, + months: { + shorthand: [ + "Jan", + "Feb", + "Mar", + "Apr", + "Mai", + "Jūn", + "Jūl", + "Aug", + "Sep", + "Okt", + "Nov", + "Dec", + ], + longhand: [ + "Janvāris", + "Februāris", + "Marts", + "Aprīlis", + "Maijs", + "Jūnijs", + "Jūlijs", + "Augusts", + "Septembris", + "Oktobris", + "Novembris", + "Decembris", + ], + }, + rangeSeparator: " līdz ", + time_24hr: true, + }; + fp$x.l10ns.lv = Latvian; + fp$x.l10ns; + + var fp$y = typeof window !== "undefined" && window.flatpickr !== undefined + ? window.flatpickr + : { + l10ns: {}, + }; + var Macedonian = { + weekdays: { + shorthand: ["Не", "По", "Вт", "Ср", "Че", "Пе", "Са"], + longhand: [ + "Недела", + "Понеделник", + "Вторник", + "Среда", + "Четврток", + "Петок", + "Сабота", + ], + }, + months: { + shorthand: [ + "Јан", + "Фев", + "Мар", + "Апр", + "Мај", + "Јун", + "Јул", + "Авг", + "Сеп", + "Окт", + "Ное", + "Дек", + ], + longhand: [ + "Јануари", + "Февруари", + "Март", + "Април", + "Мај", + "Јуни", + "Јули", + "Август", + "Септември", + "Октомври", + "Ноември", + "Декември", + ], + }, + firstDayOfWeek: 1, + weekAbbreviation: "Нед.", + rangeSeparator: " до ", + time_24hr: true, + }; + fp$y.l10ns.mk = Macedonian; + fp$y.l10ns; + + var fp$z = typeof window !== "undefined" && window.flatpickr !== undefined + ? window.flatpickr + : { + l10ns: {}, + }; + var Mongolian = { + firstDayOfWeek: 1, + weekdays: { + shorthand: ["Да", "Мя", "Лх", "Пү", "Ба", "Бя", "Ня"], + longhand: ["Даваа", "Мягмар", "Лхагва", "Пүрэв", "Баасан", "Бямба", "Ням"], + }, + months: { + shorthand: [ + "1-р сар", + "2-р сар", + "3-р сар", + "4-р сар", + "5-р сар", + "6-р сар", + "7-р сар", + "8-р сар", + "9-р сар", + "10-р сар", + "11-р сар", + "12-р сар", + ], + longhand: [ + "Нэгдүгээр сар", + "Хоёрдугаар сар", + "Гуравдугаар сар", + "Дөрөвдүгээр сар", + "Тавдугаар сар", + "Зургаадугаар сар", + "Долдугаар сар", + "Наймдугаар сар", + "Есдүгээр сар", + "Аравдугаар сар", + "Арваннэгдүгээр сар", + "Арванхоёрдугаар сар", + ], + }, + rangeSeparator: "-с ", + time_24hr: true, + }; + fp$z.l10ns.mn = Mongolian; + fp$z.l10ns; + + var fp$A = typeof window !== "undefined" && window.flatpickr !== undefined + ? window.flatpickr + : { + l10ns: {}, + }; + var Malaysian = { + weekdays: { + shorthand: ["Min", "Isn", "Sel", "Rab", "Kha", "Jum", "Sab"], + longhand: [ + "Minggu", + "Isnin", + "Selasa", + "Rabu", + "Khamis", + "Jumaat", + "Sabtu", + ], + }, + months: { + shorthand: [ + "Jan", + "Feb", + "Mac", + "Apr", + "Mei", + "Jun", + "Jul", + "Ogo", + "Sep", + "Okt", + "Nov", + "Dis", + ], + longhand: [ + "Januari", + "Februari", + "Mac", + "April", + "Mei", + "Jun", + "Julai", + "Ogos", + "September", + "Oktober", + "November", + "Disember", + ], + }, + firstDayOfWeek: 1, + ordinal: function () { + return ""; + }, + }; + fp$A.l10ns; + + var fp$B = typeof window !== "undefined" && window.flatpickr !== undefined + ? window.flatpickr + : { + l10ns: {}, + }; + var Burmese = { + weekdays: { + shorthand: ["နွေ", "လာ", "ဂါ", "ဟူး", "ကြာ", "သော", "နေ"], + longhand: [ + "တနင်္ဂနွေ", + "တနင်္လာ", + "အင်္ဂါ", + "ဗုဒ္ဓဟူး", + "ကြာသပတေး", + "သောကြာ", + "စနေ", + ], + }, + months: { + shorthand: [ + "ဇန်", + "ဖေ", + "မတ်", + "ပြီ", + "မေ", + "ဇွန်", + "လိုင်", + "သြ", + "စက်", + "အောက်", + "နို", + "ဒီ", + ], + longhand: [ + "ဇန်နဝါရီ", + "ဖေဖော်ဝါရီ", + "မတ်", + "ဧပြီ", + "မေ", + "ဇွန်", + "ဇူလိုင်", + "သြဂုတ်", + "စက်တင်ဘာ", + "အောက်တိုဘာ", + "နိုဝင်ဘာ", + "ဒီဇင်ဘာ", + ], + }, + firstDayOfWeek: 1, + ordinal: function () { + return ""; + }, + time_24hr: true, + }; + fp$B.l10ns.my = Burmese; + fp$B.l10ns; + + var fp$C = typeof window !== "undefined" && window.flatpickr !== undefined + ? window.flatpickr + : { + l10ns: {}, + }; + var Dutch = { + weekdays: { + shorthand: ["zo", "ma", "di", "wo", "do", "vr", "za"], + longhand: [ + "zondag", + "maandag", + "dinsdag", + "woensdag", + "donderdag", + "vrijdag", + "zaterdag", + ], + }, + months: { + shorthand: [ + "jan", + "feb", + "mrt", + "apr", + "mei", + "jun", + "jul", + "aug", + "sept", + "okt", + "nov", + "dec", + ], + longhand: [ + "januari", + "februari", + "maart", + "april", + "mei", + "juni", + "juli", + "augustus", + "september", + "oktober", + "november", + "december", + ], + }, + firstDayOfWeek: 1, + weekAbbreviation: "wk", + rangeSeparator: " t/m ", + scrollTitle: "Scroll voor volgende / vorige", + toggleTitle: "Klik om te wisselen", + time_24hr: true, + ordinal: function (nth) { + if (nth === 1 || nth === 8 || nth >= 20) + return "ste"; + return "de"; + }, + }; + fp$C.l10ns.nl = Dutch; + fp$C.l10ns; + + var fp$D = typeof window !== "undefined" && window.flatpickr !== undefined + ? window.flatpickr + : { + l10ns: {}, + }; + var Norwegian = { + weekdays: { + shorthand: ["Søn", "Man", "Tir", "Ons", "Tor", "Fre", "Lør"], + longhand: [ + "Søndag", + "Mandag", + "Tirsdag", + "Onsdag", + "Torsdag", + "Fredag", + "Lørdag", + ], + }, + months: { + shorthand: [ + "Jan", + "Feb", + "Mar", + "Apr", + "Mai", + "Jun", + "Jul", + "Aug", + "Sep", + "Okt", + "Nov", + "Des", + ], + longhand: [ + "Januar", + "Februar", + "Mars", + "April", + "Mai", + "Juni", + "Juli", + "August", + "September", + "Oktober", + "November", + "Desember", + ], + }, + firstDayOfWeek: 1, + rangeSeparator: " til ", + weekAbbreviation: "Uke", + scrollTitle: "Scroll for å endre", + toggleTitle: "Klikk for å veksle", + time_24hr: true, + ordinal: function () { + return "."; + }, + }; + fp$D.l10ns.no = Norwegian; + fp$D.l10ns; + + var fp$E = typeof window !== "undefined" && window.flatpickr !== undefined + ? window.flatpickr + : { + l10ns: {}, + }; + var Punjabi = { + weekdays: { + shorthand: ["ਐਤ", "ਸੋਮ", "ਮੰਗਲ", "ਬੁੱਧ", "ਵੀਰ", "ਸ਼ੁੱਕਰ", "ਸ਼ਨਿੱਚਰ"], + longhand: [ + "ਐਤਵਾਰ", + "ਸੋਮਵਾਰ", + "ਮੰਗਲਵਾਰ", + "ਬੁੱਧਵਾਰ", + "ਵੀਰਵਾਰ", + "ਸ਼ੁੱਕਰਵਾਰ", + "ਸ਼ਨਿੱਚਰਵਾਰ", + ], + }, + months: { + shorthand: [ + "ਜਨ", + "ਫ਼ਰ", + "ਮਾਰ", + "ਅਪ੍ਰੈ", + "ਮਈ", + "ਜੂਨ", + "ਜੁਲਾ", + "ਅਗ", + "ਸਤੰ", + "ਅਕ", + "ਨਵੰ", + "ਦਸੰ", + ], + longhand: [ + "ਜਨਵਰੀ", + "ਫ਼ਰਵਰੀ", + "ਮਾਰਚ", + "ਅਪ੍ਰੈਲ", + "ਮਈ", + "ਜੂਨ", + "ਜੁਲਾਈ", + "ਅਗਸਤ", + "ਸਤੰਬਰ", + "ਅਕਤੂਬਰ", + "ਨਵੰਬਰ", + "ਦਸੰਬਰ", + ], + }, + time_24hr: true, + }; + fp$E.l10ns.pa = Punjabi; + fp$E.l10ns; + + var fp$F = typeof window !== "undefined" && window.flatpickr !== undefined + ? window.flatpickr + : { + l10ns: {}, + }; + var Polish = { + weekdays: { + shorthand: ["Nd", "Pn", "Wt", "Śr", "Cz", "Pt", "So"], + longhand: [ + "Niedziela", + "Poniedziałek", + "Wtorek", + "Środa", + "Czwartek", + "Piątek", + "Sobota", + ], + }, + months: { + shorthand: [ + "Sty", + "Lut", + "Mar", + "Kwi", + "Maj", + "Cze", + "Lip", + "Sie", + "Wrz", + "Paź", + "Lis", + "Gru", + ], + longhand: [ + "Styczeń", + "Luty", + "Marzec", + "Kwiecień", + "Maj", + "Czerwiec", + "Lipiec", + "Sierpień", + "Wrzesień", + "Październik", + "Listopad", + "Grudzień", + ], + }, + rangeSeparator: " do ", + weekAbbreviation: "tydz.", + scrollTitle: "Przewiń, aby zwiększyć", + toggleTitle: "Kliknij, aby przełączyć", + firstDayOfWeek: 1, + time_24hr: true, + ordinal: function () { + return "."; + }, + }; + fp$F.l10ns.pl = Polish; + fp$F.l10ns; + + var fp$G = typeof window !== "undefined" && window.flatpickr !== undefined + ? window.flatpickr + : { + l10ns: {}, + }; + var Portuguese = { + weekdays: { + shorthand: ["Dom", "Seg", "Ter", "Qua", "Qui", "Sex", "Sáb"], + longhand: [ + "Domingo", + "Segunda-feira", + "Terça-feira", + "Quarta-feira", + "Quinta-feira", + "Sexta-feira", + "Sábado", + ], + }, + months: { + shorthand: [ + "Jan", + "Fev", + "Mar", + "Abr", + "Mai", + "Jun", + "Jul", + "Ago", + "Set", + "Out", + "Nov", + "Dez", + ], + longhand: [ + "Janeiro", + "Fevereiro", + "Março", + "Abril", + "Maio", + "Junho", + "Julho", + "Agosto", + "Setembro", + "Outubro", + "Novembro", + "Dezembro", + ], + }, + rangeSeparator: " até ", + time_24hr: true, + }; + fp$G.l10ns.pt = Portuguese; + fp$G.l10ns; + + var fp$H = typeof window !== "undefined" && window.flatpickr !== undefined + ? window.flatpickr + : { + l10ns: {}, + }; + var Romanian = { + weekdays: { + shorthand: ["Dum", "Lun", "Mar", "Mie", "Joi", "Vin", "Sâm"], + longhand: [ + "Duminică", + "Luni", + "Marți", + "Miercuri", + "Joi", + "Vineri", + "Sâmbătă", + ], + }, + months: { + shorthand: [ + "Ian", + "Feb", + "Mar", + "Apr", + "Mai", + "Iun", + "Iul", + "Aug", + "Sep", + "Oct", + "Noi", + "Dec", + ], + longhand: [ + "Ianuarie", + "Februarie", + "Martie", + "Aprilie", + "Mai", + "Iunie", + "Iulie", + "August", + "Septembrie", + "Octombrie", + "Noiembrie", + "Decembrie", + ], + }, + firstDayOfWeek: 1, + time_24hr: true, + ordinal: function () { + return ""; + }, + }; + fp$H.l10ns.ro = Romanian; + fp$H.l10ns; + + var fp$I = typeof window !== "undefined" && window.flatpickr !== undefined + ? window.flatpickr + : { + l10ns: {}, + }; + var Russian = { + weekdays: { + shorthand: ["Вс", "Пн", "Вт", "Ср", "Чт", "Пт", "Сб"], + longhand: [ + "Воскресенье", + "Понедельник", + "Вторник", + "Среда", + "Четверг", + "Пятница", + "Суббота", + ], + }, + months: { + shorthand: [ + "Янв", + "Фев", + "Март", + "Апр", + "Май", + "Июнь", + "Июль", + "Авг", + "Сен", + "Окт", + "Ноя", + "Дек", + ], + longhand: [ + "Январь", + "Февраль", + "Март", + "Апрель", + "Май", + "Июнь", + "Июль", + "Август", + "Сентябрь", + "Октябрь", + "Ноябрь", + "Декабрь", + ], + }, + firstDayOfWeek: 1, + ordinal: function () { + return ""; + }, + rangeSeparator: " — ", + weekAbbreviation: "Нед.", + scrollTitle: "Прокрутите для увеличения", + toggleTitle: "Нажмите для переключения", + amPM: ["ДП", "ПП"], + yearAriaLabel: "Год", + time_24hr: true, + }; + fp$I.l10ns.ru = Russian; + fp$I.l10ns; + + var fp$J = typeof window !== "undefined" && window.flatpickr !== undefined + ? window.flatpickr + : { + l10ns: {}, + }; + var Sinhala = { + weekdays: { + shorthand: ["ඉ", "ස", "අ", "බ", "බ්‍ර", "සි", "සෙ"], + longhand: [ + "ඉරිදා", + "සඳුදා", + "අඟහරුවාදා", + "බදාදා", + "බ්‍රහස්පතින්දා", + "සිකුරාදා", + "සෙනසුරාදා", + ], + }, + months: { + shorthand: [ + "ජන", + "පෙබ", + "මාර්", + "අප්‍රේ", + "මැයි", + "ජුනි", + "ජූලි", + "අගෝ", + "සැප්", + "ඔක්", + "නොවැ", + "දෙසැ", + ], + longhand: [ + "ජනවාරි", + "පෙබරවාරි", + "මාර්තු", + "අප්‍රේල්", + "මැයි", + "ජුනි", + "ජූලි", + "අගෝස්තු", + "සැප්තැම්බර්", + "ඔක්තෝබර්", + "නොවැම්බර්", + "දෙසැම්බර්", + ], + }, + time_24hr: true, + }; + fp$J.l10ns.si = Sinhala; + fp$J.l10ns; + + var fp$K = typeof window !== "undefined" && window.flatpickr !== undefined + ? window.flatpickr + : { + l10ns: {}, + }; + var Slovak = { + weekdays: { + shorthand: ["Ned", "Pon", "Ut", "Str", "Štv", "Pia", "Sob"], + longhand: [ + "Nedeľa", + "Pondelok", + "Utorok", + "Streda", + "Štvrtok", + "Piatok", + "Sobota", + ], + }, + months: { + shorthand: [ + "Jan", + "Feb", + "Mar", + "Apr", + "Máj", + "Jún", + "Júl", + "Aug", + "Sep", + "Okt", + "Nov", + "Dec", + ], + longhand: [ + "Január", + "Február", + "Marec", + "Apríl", + "Máj", + "Jún", + "Júl", + "August", + "September", + "Október", + "November", + "December", + ], + }, + firstDayOfWeek: 1, + rangeSeparator: " do ", + time_24hr: true, + ordinal: function () { + return "."; + }, + }; + fp$K.l10ns.sk = Slovak; + fp$K.l10ns; + + var fp$L = typeof window !== "undefined" && window.flatpickr !== undefined + ? window.flatpickr + : { + l10ns: {}, + }; + var Slovenian = { + weekdays: { + shorthand: ["Ned", "Pon", "Tor", "Sre", "Čet", "Pet", "Sob"], + longhand: [ + "Nedelja", + "Ponedeljek", + "Torek", + "Sreda", + "Četrtek", + "Petek", + "Sobota", + ], + }, + months: { + shorthand: [ + "Jan", + "Feb", + "Mar", + "Apr", + "Maj", + "Jun", + "Jul", + "Avg", + "Sep", + "Okt", + "Nov", + "Dec", + ], + longhand: [ + "Januar", + "Februar", + "Marec", + "April", + "Maj", + "Junij", + "Julij", + "Avgust", + "September", + "Oktober", + "November", + "December", + ], + }, + firstDayOfWeek: 1, + rangeSeparator: " do ", + time_24hr: true, + ordinal: function () { + return "."; + }, + }; + fp$L.l10ns.sl = Slovenian; + fp$L.l10ns; + + var fp$M = typeof window !== "undefined" && window.flatpickr !== undefined + ? window.flatpickr + : { + l10ns: {}, + }; + var Albanian = { + weekdays: { + shorthand: ["Di", "Hë", "Ma", "Më", "En", "Pr", "Sh"], + longhand: [ + "E Diel", + "E Hënë", + "E Martë", + "E Mërkurë", + "E Enjte", + "E Premte", + "E Shtunë", + ], + }, + months: { + shorthand: [ + "Jan", + "Shk", + "Mar", + "Pri", + "Maj", + "Qer", + "Kor", + "Gus", + "Sht", + "Tet", + "Nën", + "Dhj", + ], + longhand: [ + "Janar", + "Shkurt", + "Mars", + "Prill", + "Maj", + "Qershor", + "Korrik", + "Gusht", + "Shtator", + "Tetor", + "Nëntor", + "Dhjetor", + ], + }, + time_24hr: true, + }; + fp$M.l10ns.sq = Albanian; + fp$M.l10ns; + + var fp$N = typeof window !== "undefined" && window.flatpickr !== undefined + ? window.flatpickr + : { + l10ns: {}, + }; + var Serbian = { + weekdays: { + shorthand: ["Ned", "Pon", "Uto", "Sre", "Čet", "Pet", "Sub"], + longhand: [ + "Nedelja", + "Ponedeljak", + "Utorak", + "Sreda", + "Četvrtak", + "Petak", + "Subota", + ], + }, + months: { + shorthand: [ + "Jan", + "Feb", + "Mar", + "Apr", + "Maj", + "Jun", + "Jul", + "Avg", + "Sep", + "Okt", + "Nov", + "Dec", + ], + longhand: [ + "Januar", + "Februar", + "Mart", + "April", + "Maj", + "Jun", + "Jul", + "Avgust", + "Septembar", + "Oktobar", + "Novembar", + "Decembar", + ], + }, + firstDayOfWeek: 1, + weekAbbreviation: "Ned.", + rangeSeparator: " do ", + time_24hr: true, + }; + fp$N.l10ns.sr = Serbian; + fp$N.l10ns; + + var fp$O = typeof window !== "undefined" && window.flatpickr !== undefined + ? window.flatpickr + : { + l10ns: {}, + }; + var Swedish = { + firstDayOfWeek: 1, + weekAbbreviation: "v", + weekdays: { + shorthand: ["Sön", "Mån", "Tis", "Ons", "Tor", "Fre", "Lör"], + longhand: [ + "Söndag", + "Måndag", + "Tisdag", + "Onsdag", + "Torsdag", + "Fredag", + "Lördag", + ], + }, + months: { + shorthand: [ + "Jan", + "Feb", + "Mar", + "Apr", + "Maj", + "Jun", + "Jul", + "Aug", + "Sep", + "Okt", + "Nov", + "Dec", + ], + longhand: [ + "Januari", + "Februari", + "Mars", + "April", + "Maj", + "Juni", + "Juli", + "Augusti", + "September", + "Oktober", + "November", + "December", + ], + }, + time_24hr: true, + ordinal: function () { + return "."; + }, + }; + fp$O.l10ns.sv = Swedish; + fp$O.l10ns; + + var fp$P = typeof window !== "undefined" && window.flatpickr !== undefined + ? window.flatpickr + : { + l10ns: {}, + }; + var Thai = { + weekdays: { + shorthand: ["อา", "จ", "อ", "พ", "พฤ", "ศ", "ส"], + longhand: [ + "อาทิตย์", + "จันทร์", + "อังคาร", + "พุธ", + "พฤหัสบดี", + "ศุกร์", + "เสาร์", + ], + }, + months: { + shorthand: [ + "ม.ค.", + "ก.พ.", + "มี.ค.", + "เม.ย.", + "พ.ค.", + "มิ.ย.", + "ก.ค.", + "ส.ค.", + "ก.ย.", + "ต.ค.", + "พ.ย.", + "ธ.ค.", + ], + longhand: [ + "มกราคม", + "กุมภาพันธ์", + "มีนาคม", + "เมษายน", + "พฤษภาคม", + "มิถุนายน", + "กรกฎาคม", + "สิงหาคม", + "กันยายน", + "ตุลาคม", + "พฤศจิกายน", + "ธันวาคม", + ], + }, + firstDayOfWeek: 1, + rangeSeparator: " ถึง ", + scrollTitle: "เลื่อนเพื่อเพิ่มหรือลด", + toggleTitle: "คลิกเพื่อเปลี่ยน", + time_24hr: true, + ordinal: function () { + return ""; + }, + }; + fp$P.l10ns.th = Thai; + fp$P.l10ns; + + var fp$Q = typeof window !== "undefined" && window.flatpickr !== undefined + ? window.flatpickr + : { + l10ns: {}, + }; + var Turkish = { + weekdays: { + shorthand: ["Paz", "Pzt", "Sal", "Çar", "Per", "Cum", "Cmt"], + longhand: [ + "Pazar", + "Pazartesi", + "Salı", + "Çarşamba", + "Perşembe", + "Cuma", + "Cumartesi", + ], + }, + months: { + shorthand: [ + "Oca", + "Şub", + "Mar", + "Nis", + "May", + "Haz", + "Tem", + "Ağu", + "Eyl", + "Eki", + "Kas", + "Ara", + ], + longhand: [ + "Ocak", + "Şubat", + "Mart", + "Nisan", + "Mayıs", + "Haziran", + "Temmuz", + "Ağustos", + "Eylül", + "Ekim", + "Kasım", + "Aralık", + ], + }, + firstDayOfWeek: 1, + ordinal: function () { + return "."; + }, + rangeSeparator: " - ", + weekAbbreviation: "Hf", + scrollTitle: "Artırmak için kaydırın", + toggleTitle: "Aç/Kapa", + amPM: ["ÖÖ", "ÖS"], + time_24hr: true, + }; + fp$Q.l10ns.tr = Turkish; + fp$Q.l10ns; + + var fp$R = typeof window !== "undefined" && window.flatpickr !== undefined + ? window.flatpickr + : { + l10ns: {}, + }; + var Ukrainian = { + firstDayOfWeek: 1, + weekdays: { + shorthand: ["Нд", "Пн", "Вт", "Ср", "Чт", "Пт", "Сб"], + longhand: [ + "Неділя", + "Понеділок", + "Вівторок", + "Середа", + "Четвер", + "П'ятниця", + "Субота", + ], + }, + months: { + shorthand: [ + "Січ", + "Лют", + "Бер", + "Кві", + "Тра", + "Чер", + "Лип", + "Сер", + "Вер", + "Жов", + "Лис", + "Гру", + ], + longhand: [ + "Січень", + "Лютий", + "Березень", + "Квітень", + "Травень", + "Червень", + "Липень", + "Серпень", + "Вересень", + "Жовтень", + "Листопад", + "Грудень", + ], + }, + time_24hr: true, + }; + fp$R.l10ns.uk = Ukrainian; + fp$R.l10ns; + + var fp$S = typeof window !== "undefined" && window.flatpickr !== undefined + ? window.flatpickr + : { + l10ns: {}, + }; + var Uzbek = { + weekdays: { + shorthand: ["Якш", "Душ", "Сеш", "Чор", "Пай", "Жум", "Шан"], + longhand: [ + "Якшанба", + "Душанба", + "Сешанба", + "Чоршанба", + "Пайшанба", + "Жума", + "Шанба", + ], + }, + months: { + shorthand: [ + "Янв", + "Фев", + "Мар", + "Апр", + "Май", + "Июн", + "Июл", + "Авг", + "Сен", + "Окт", + "Ноя", + "Дек", + ], + longhand: [ + "Январ", + "Феврал", + "Март", + "Апрел", + "Май", + "Июн", + "Июл", + "Август", + "Сентябр", + "Октябр", + "Ноябр", + "Декабр", + ], + }, + firstDayOfWeek: 1, + ordinal: function () { + return ""; + }, + rangeSeparator: " — ", + weekAbbreviation: "Ҳафта", + scrollTitle: "Катталаштириш учун айлантиринг", + toggleTitle: "Ўтиш учун босинг", + amPM: ["AM", "PM"], + yearAriaLabel: "Йил", + time_24hr: true, + }; + fp$S.l10ns.uz = Uzbek; + fp$S.l10ns; + + var fp$T = typeof window !== "undefined" && window.flatpickr !== undefined + ? window.flatpickr + : { + l10ns: {}, + }; + var UzbekLatin = { + weekdays: { + shorthand: ["Ya", "Du", "Se", "Cho", "Pa", "Ju", "Sha"], + longhand: [ + "Yakshanba", + "Dushanba", + "Seshanba", + "Chorshanba", + "Payshanba", + "Juma", + "Shanba", + ], + }, + months: { + shorthand: [ + "Yan", + "Fev", + "Mar", + "Apr", + "May", + "Iyun", + "Iyul", + "Avg", + "Sen", + "Okt", + "Noy", + "Dek", + ], + longhand: [ + "Yanvar", + "Fevral", + "Mart", + "Aprel", + "May", + "Iyun", + "Iyul", + "Avgust", + "Sentabr", + "Oktabr", + "Noyabr", + "Dekabr", + ], + }, + firstDayOfWeek: 1, + ordinal: function () { + return ""; + }, + rangeSeparator: " — ", + weekAbbreviation: "Hafta", + scrollTitle: "Kattalashtirish uchun aylantiring", + toggleTitle: "O‘tish uchun bosing", + amPM: ["AM", "PM"], + yearAriaLabel: "Yil", + time_24hr: true, + }; + fp$T.l10ns["uz_latn"] = UzbekLatin; + fp$T.l10ns; + + var fp$U = typeof window !== "undefined" && window.flatpickr !== undefined + ? window.flatpickr + : { + l10ns: {}, + }; + var Vietnamese = { + weekdays: { + shorthand: ["CN", "T2", "T3", "T4", "T5", "T6", "T7"], + longhand: [ + "Chủ nhật", + "Thứ hai", + "Thứ ba", + "Thứ tư", + "Thứ năm", + "Thứ sáu", + "Thứ bảy", + ], + }, + months: { + shorthand: [ + "Th1", + "Th2", + "Th3", + "Th4", + "Th5", + "Th6", + "Th7", + "Th8", + "Th9", + "Th10", + "Th11", + "Th12", + ], + longhand: [ + "Tháng một", + "Tháng hai", + "Tháng ba", + "Tháng tư", + "Tháng năm", + "Tháng sáu", + "Tháng bảy", + "Tháng tám", + "Tháng chín", + "Tháng mười", + "Tháng 11", + "Tháng 12", + ], + }, + firstDayOfWeek: 1, + rangeSeparator: " đến ", + }; + fp$U.l10ns.vn = Vietnamese; + fp$U.l10ns; + + var fp$V = typeof window !== "undefined" && window.flatpickr !== undefined + ? window.flatpickr + : { + l10ns: {}, + }; + var Mandarin = { + weekdays: { + shorthand: ["周日", "周一", "周二", "周三", "周四", "周五", "周六"], + longhand: [ + "星期日", + "星期一", + "星期二", + "星期三", + "星期四", + "星期五", + "星期六", + ], + }, + months: { + shorthand: [ + "一月", + "二月", + "三月", + "四月", + "五月", + "六月", + "七月", + "八月", + "九月", + "十月", + "十一月", + "十二月", + ], + longhand: [ + "一月", + "二月", + "三月", + "四月", + "五月", + "六月", + "七月", + "八月", + "九月", + "十月", + "十一月", + "十二月", + ], + }, + rangeSeparator: " 至 ", + weekAbbreviation: "周", + scrollTitle: "滚动切换", + toggleTitle: "点击切换 12/24 小时时制", + }; + fp$V.l10ns.zh = Mandarin; + fp$V.l10ns; + + var fp$W = typeof window !== "undefined" && window.flatpickr !== undefined + ? window.flatpickr + : { + l10ns: {}, + }; + var MandarinTraditional = { + weekdays: { + shorthand: ["週日", "週一", "週二", "週三", "週四", "週五", "週六"], + longhand: [ + "星期日", + "星期一", + "星期二", + "星期三", + "星期四", + "星期五", + "星期六", + ], + }, + months: { + shorthand: [ + "一月", + "二月", + "三月", + "四月", + "五月", + "六月", + "七月", + "八月", + "九月", + "十月", + "十一月", + "十二月", + ], + longhand: [ + "一月", + "二月", + "三月", + "四月", + "五月", + "六月", + "七月", + "八月", + "九月", + "十月", + "十一月", + "十二月", + ], + }, + rangeSeparator: " 至 ", + weekAbbreviation: "週", + scrollTitle: "滾動切換", + toggleTitle: "點擊切換 12/24 小時時制", + }; + fp$W.l10ns.zh_tw = MandarinTraditional; + fp$W.l10ns; + + var l10n = { + ar: Arabic, + at: Austria, + az: Azerbaijan, + be: Belarusian, + bg: Bulgarian, + bn: Bangla, + bs: Bosnian, + ca: Catalan, + cat: Catalan, + cs: Czech, + cy: Welsh, + da: Danish, + de: German, + default: __assign({}, english), + en: english, + eo: Esperanto, + es: Spanish, + et: Estonian, + fa: Persian, + fi: Finnish, + fo: Faroese, + fr: French, + gr: Greek, + he: Hebrew, + hi: Hindi, + hr: Croatian, + hu: Hungarian, + id: Indonesian, + is: Icelandic, + it: Italian, + ja: Japanese, + ka: Georgian, + ko: Korean, + km: Khmer, + kz: Kazakh, + lt: Lithuanian, + lv: Latvian, + mk: Macedonian, + mn: Mongolian, + ms: Malaysian, + my: Burmese, + nl: Dutch, + no: Norwegian, + pa: Punjabi, + pl: Polish, + pt: Portuguese, + ro: Romanian, + ru: Russian, + si: Sinhala, + sk: Slovak, + sl: Slovenian, + sq: Albanian, + sr: Serbian, + sv: Swedish, + th: Thai, + tr: Turkish, + uk: Ukrainian, + vn: Vietnamese, + zh: Mandarin, + zh_tw: MandarinTraditional, + uz: Uzbek, + uz_latn: UzbekLatin, + }; + + exports.default = l10n; + + Object.defineProperty(exports, '__esModule', { value: true }); + +}))); diff --git a/website/js/vendor/flatpickr/plugins/confirmDate/confirmDate.css b/website/js/vendor/flatpickr/plugins/confirmDate/confirmDate.css new file mode 100644 index 0000000..9508ea9 --- /dev/null +++ b/website/js/vendor/flatpickr/plugins/confirmDate/confirmDate.css @@ -0,0 +1,24 @@ +.flatpickr-confirm { + height: 40px; + max-height: 0px; + visibility: hidden; + display: flex; + justify-content: center; + align-items: center; + cursor: pointer; + background: rgba(0,0,0,0.06) +} + +.flatpickr-confirm svg path { + fill: inherit; +} + +.flatpickr-confirm.darkTheme { + color: white; + fill: white; +} + +.flatpickr-confirm.visible { + max-height: 40px; + visibility: visible +} diff --git a/website/js/vendor/flatpickr/plugins/confirmDate/confirmDate.d.ts b/website/js/vendor/flatpickr/plugins/confirmDate/confirmDate.d.ts new file mode 100644 index 0000000..a4ddf39 --- /dev/null +++ b/website/js/vendor/flatpickr/plugins/confirmDate/confirmDate.d.ts @@ -0,0 +1,9 @@ +import { Plugin } from "../../types/options"; +export interface Config { + confirmIcon?: string; + confirmText?: string; + showAlways?: boolean; + theme?: string; +} +declare function confirmDatePlugin(pluginConfig: Config): Plugin; +export default confirmDatePlugin; diff --git a/website/js/vendor/flatpickr/plugins/confirmDate/confirmDate.js b/website/js/vendor/flatpickr/plugins/confirmDate/confirmDate.js new file mode 100644 index 0000000..8c55a4e --- /dev/null +++ b/website/js/vendor/flatpickr/plugins/confirmDate/confirmDate.js @@ -0,0 +1,100 @@ +(function (global, factory) { + typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : + typeof define === 'function' && define.amd ? define(factory) : + (global = global || self, global.confirmDatePlugin = factory()); +}(this, (function () { 'use strict'; + + /*! ***************************************************************************** + Copyright (c) Microsoft Corporation. + + Permission to use, copy, modify, and/or distribute this software for any + purpose with or without fee is hereby granted. + + THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH + REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY + AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, + INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM + LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR + OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + PERFORMANCE OF THIS SOFTWARE. + ***************************************************************************** */ + + var __assign = function() { + __assign = Object.assign || function __assign(t) { + for (var s, i = 1, n = arguments.length; i < n; i++) { + s = arguments[i]; + for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; + } + return t; + }; + return __assign.apply(this, arguments); + }; + + function getEventTarget(event) { + try { + if (typeof event.composedPath === "function") { + var path = event.composedPath(); + return path[0]; + } + return event.target; + } + catch (error) { + return event.target; + } + } + + var defaultConfig = { + confirmIcon: " ", + confirmText: "OK ", + showAlways: false, + theme: "light", + }; + function confirmDatePlugin(pluginConfig) { + var config = __assign(__assign({}, defaultConfig), pluginConfig); + var confirmContainer; + var confirmButtonCSSClass = "flatpickr-confirm"; + return function (fp) { + if (fp.config.noCalendar || fp.isMobile) + return {}; + return __assign({ onKeyDown: function (_, __, ___, e) { + var eventTarget = getEventTarget(e); + if (fp.config.enableTime && + e.key === "Tab" && + eventTarget === fp.amPM) { + e.preventDefault(); + confirmContainer.focus(); + } + else if (e.key === "Enter" && eventTarget === confirmContainer) + fp.close(); + }, + onReady: function () { + confirmContainer = fp._createElement("div", confirmButtonCSSClass + " " + (config.showAlways ? "visible" : "") + " " + config.theme + "Theme", config.confirmText); + confirmContainer.tabIndex = -1; + confirmContainer.innerHTML += config.confirmIcon; + confirmContainer.addEventListener("click", fp.close); + fp.calendarContainer.appendChild(confirmContainer); + fp.loadedPlugins.push("confirmDate"); + } }, (!config.showAlways + ? { + onChange: function (_, dateStr) { + var showCondition = fp.config.enableTime || + fp.config.mode === "multiple" || + fp.loadedPlugins.indexOf("monthSelect") !== -1; + var localConfirmContainer = fp.calendarContainer.querySelector("." + confirmButtonCSSClass); + if (!localConfirmContainer) + return; + if (dateStr && + !fp.config.inline && + showCondition && + localConfirmContainer) + return localConfirmContainer.classList.add("visible"); + localConfirmContainer.classList.remove("visible"); + }, + } + : {})); + }; + } + + return confirmDatePlugin; + +}))); diff --git a/website/js/vendor/flatpickr/plugins/labelPlugin/labelPlugin.d.ts b/website/js/vendor/flatpickr/plugins/labelPlugin/labelPlugin.d.ts new file mode 100644 index 0000000..1a9cbce --- /dev/null +++ b/website/js/vendor/flatpickr/plugins/labelPlugin/labelPlugin.d.ts @@ -0,0 +1,3 @@ +import { Plugin } from "../../types/options"; +declare function labelPlugin(): Plugin; +export default labelPlugin; diff --git a/website/js/vendor/flatpickr/plugins/labelPlugin/labelPlugin.js b/website/js/vendor/flatpickr/plugins/labelPlugin/labelPlugin.js new file mode 100644 index 0000000..1d8f0b0 --- /dev/null +++ b/website/js/vendor/flatpickr/plugins/labelPlugin/labelPlugin.js @@ -0,0 +1,31 @@ +(function (global, factory) { + typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : + typeof define === 'function' && define.amd ? define(factory) : + (global = global || self, global.labelPlugin = factory()); +}(this, (function () { 'use strict'; + + function labelPlugin() { + return function (fp) { + return { + onReady: function () { + var id = fp.input.id; + if (!id) { + return; + } + if (fp.mobileInput) { + fp.input.removeAttribute("id"); + fp.mobileInput.id = id; + } + else if (fp.altInput) { + fp.input.removeAttribute("id"); + fp.altInput.id = id; + } + fp.loadedPlugins.push("labelPlugin"); + }, + }; + }; + } + + return labelPlugin; + +}))); diff --git a/website/js/vendor/flatpickr/plugins/minMaxTimePlugin.d.ts b/website/js/vendor/flatpickr/plugins/minMaxTimePlugin.d.ts new file mode 100644 index 0000000..4fe2e5c --- /dev/null +++ b/website/js/vendor/flatpickr/plugins/minMaxTimePlugin.d.ts @@ -0,0 +1,17 @@ +import { Plugin } from "../types/options"; +export interface MinMaxTime { + minTime?: string; + maxTime?: string; +} +export interface Config { + table?: Record; + getTimeLimits?: (date: Date) => MinMaxTime; + tableDateFormat?: string; +} +export interface State { + formatDate: (date: Date, f: string) => string; + tableDateFormat: string; + defaults: MinMaxTime; +} +declare function minMaxTimePlugin(config?: Config): Plugin; +export default minMaxTimePlugin; diff --git a/website/js/vendor/flatpickr/plugins/minMaxTimePlugin.js b/website/js/vendor/flatpickr/plugins/minMaxTimePlugin.js new file mode 100644 index 0000000..cfc485f --- /dev/null +++ b/website/js/vendor/flatpickr/plugins/minMaxTimePlugin.js @@ -0,0 +1,332 @@ +(function (global, factory) { + typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : + typeof define === 'function' && define.amd ? define(factory) : + (global = global || self, global.minMaxTimePlugin = factory()); +}(this, (function () { 'use strict'; + + var pad = function (number, length) { + if (length === void 0) { length = 2; } + return ("000" + number).slice(length * -1); + }; + var int = function (bool) { return (bool === true ? 1 : 0); }; + + var monthToStr = function (monthNumber, shorthand, locale) { return locale.months[shorthand ? "shorthand" : "longhand"][monthNumber]; }; + var formats = { + // get the date in UTC + Z: function (date) { return date.toISOString(); }, + // weekday name, short, e.g. Thu + D: function (date, locale, options) { + return locale.weekdays.shorthand[formats.w(date, locale, options)]; + }, + // full month name e.g. January + F: function (date, locale, options) { + return monthToStr(formats.n(date, locale, options) - 1, false, locale); + }, + // padded hour 1-12 + G: function (date, locale, options) { + return pad(formats.h(date, locale, options)); + }, + // hours with leading zero e.g. 03 + H: function (date) { return pad(date.getHours()); }, + // day (1-30) with ordinal suffix e.g. 1st, 2nd + J: function (date, locale) { + return locale.ordinal !== undefined + ? date.getDate() + locale.ordinal(date.getDate()) + : date.getDate(); + }, + // AM/PM + K: function (date, locale) { return locale.amPM[int(date.getHours() > 11)]; }, + // shorthand month e.g. Jan, Sep, Oct, etc + M: function (date, locale) { + return monthToStr(date.getMonth(), true, locale); + }, + // seconds 00-59 + S: function (date) { return pad(date.getSeconds()); }, + // unix timestamp + U: function (date) { return date.getTime() / 1000; }, + W: function (date, _, options) { + return options.getWeek(date); + }, + // full year e.g. 2016, padded (0001-9999) + Y: function (date) { return pad(date.getFullYear(), 4); }, + // day in month, padded (01-30) + d: function (date) { return pad(date.getDate()); }, + // hour from 1-12 (am/pm) + h: function (date) { return (date.getHours() % 12 ? date.getHours() % 12 : 12); }, + // minutes, padded with leading zero e.g. 09 + i: function (date) { return pad(date.getMinutes()); }, + // day in month (1-30) + j: function (date) { return date.getDate(); }, + // weekday name, full, e.g. Thursday + l: function (date, locale) { + return locale.weekdays.longhand[date.getDay()]; + }, + // padded month number (01-12) + m: function (date) { return pad(date.getMonth() + 1); }, + // the month number (1-12) + n: function (date) { return date.getMonth() + 1; }, + // seconds 0-59 + s: function (date) { return date.getSeconds(); }, + // Unix Milliseconds + u: function (date) { return date.getTime(); }, + // number of the day of the week + w: function (date) { return date.getDay(); }, + // last two digits of year e.g. 16 for 2016 + y: function (date) { return String(date.getFullYear()).substring(2); }, + }; + + var defaults = { + _disable: [], + _enable: [], + allowInput: false, + allowInvalidPreload: false, + altFormat: "F j, Y", + altInput: false, + altInputClass: "form-control input", + animate: typeof window === "object" && + window.navigator.userAgent.indexOf("MSIE") === -1, + ariaDateFormat: "F j, Y", + autoFillDefaultTime: true, + clickOpens: true, + closeOnSelect: true, + conjunction: ", ", + dateFormat: "Y-m-d", + defaultHour: 12, + defaultMinute: 0, + defaultSeconds: 0, + disable: [], + disableMobile: false, + enable: [], + enableSeconds: false, + enableTime: false, + errorHandler: function (err) { + return typeof console !== "undefined" && console.warn(err); + }, + getWeek: function (givenDate) { + var date = new Date(givenDate.getTime()); + date.setHours(0, 0, 0, 0); + // Thursday in current week decides the year. + date.setDate(date.getDate() + 3 - ((date.getDay() + 6) % 7)); + // January 4 is always in week 1. + var week1 = new Date(date.getFullYear(), 0, 4); + // Adjust to Thursday in week 1 and count number of weeks from date to week1. + return (1 + + Math.round(((date.getTime() - week1.getTime()) / 86400000 - + 3 + + ((week1.getDay() + 6) % 7)) / + 7)); + }, + hourIncrement: 1, + ignoredFocusElements: [], + inline: false, + locale: "default", + minuteIncrement: 5, + mode: "single", + monthSelectorType: "dropdown", + nextArrow: "", + noCalendar: false, + now: new Date(), + onChange: [], + onClose: [], + onDayCreate: [], + onDestroy: [], + onKeyDown: [], + onMonthChange: [], + onOpen: [], + onParseConfig: [], + onReady: [], + onValueUpdate: [], + onYearChange: [], + onPreCalendarPosition: [], + plugins: [], + position: "auto", + positionElement: undefined, + prevArrow: "", + shorthandCurrentMonth: false, + showMonths: 1, + static: false, + time_24hr: false, + weekNumbers: false, + wrap: false, + }; + + var english = { + weekdays: { + shorthand: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"], + longhand: [ + "Sunday", + "Monday", + "Tuesday", + "Wednesday", + "Thursday", + "Friday", + "Saturday", + ], + }, + months: { + shorthand: [ + "Jan", + "Feb", + "Mar", + "Apr", + "May", + "Jun", + "Jul", + "Aug", + "Sep", + "Oct", + "Nov", + "Dec", + ], + longhand: [ + "January", + "February", + "March", + "April", + "May", + "June", + "July", + "August", + "September", + "October", + "November", + "December", + ], + }, + daysInMonth: [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31], + firstDayOfWeek: 0, + ordinal: function (nth) { + var s = nth % 100; + if (s > 3 && s < 21) + return "th"; + switch (s % 10) { + case 1: + return "st"; + case 2: + return "nd"; + case 3: + return "rd"; + default: + return "th"; + } + }, + rangeSeparator: " to ", + weekAbbreviation: "Wk", + scrollTitle: "Scroll to increment", + toggleTitle: "Click to toggle", + amPM: ["AM", "PM"], + yearAriaLabel: "Year", + monthAriaLabel: "Month", + hourAriaLabel: "Hour", + minuteAriaLabel: "Minute", + time_24hr: false, + }; + + var createDateFormatter = function (_a) { + var _b = _a.config, config = _b === void 0 ? defaults : _b, _c = _a.l10n, l10n = _c === void 0 ? english : _c, _d = _a.isMobile, isMobile = _d === void 0 ? false : _d; + return function (dateObj, frmt, overrideLocale) { + var locale = overrideLocale || l10n; + if (config.formatDate !== undefined && !isMobile) { + return config.formatDate(dateObj, frmt, locale); + } + return frmt + .split("") + .map(function (c, i, arr) { + return formats[c] && arr[i - 1] !== "\\" + ? formats[c](dateObj, locale, config) + : c !== "\\" + ? c + : ""; + }) + .join(""); + }; + }; + /** + * Compute the difference in dates, measured in ms + */ + function compareDates(date1, date2, timeless) { + if (timeless === void 0) { timeless = true; } + if (timeless !== false) { + return (new Date(date1.getTime()).setHours(0, 0, 0, 0) - + new Date(date2.getTime()).setHours(0, 0, 0, 0)); + } + return date1.getTime() - date2.getTime(); + } + /** + * Compute the difference in times, measured in ms + */ + function compareTimes(date1, date2) { + return (3600 * (date1.getHours() - date2.getHours()) + + 60 * (date1.getMinutes() - date2.getMinutes()) + + date1.getSeconds() - + date2.getSeconds()); + } + + function minMaxTimePlugin(config) { + if (config === void 0) { config = {}; } + var state = { + formatDate: createDateFormatter({}), + tableDateFormat: config.tableDateFormat || "Y-m-d", + defaults: { + minTime: undefined, + maxTime: undefined, + }, + }; + function findDateTimeLimit(date) { + if (config.table !== undefined) { + return config.table[state.formatDate(date, state.tableDateFormat)]; + } + return config.getTimeLimits && config.getTimeLimits(date); + } + return function (fp) { + return { + onReady: function () { + state.formatDate = this.formatDate; + state.defaults = { + minTime: this.config.minTime && state.formatDate(this.config.minTime, "H:i"), + maxTime: this.config.maxTime && state.formatDate(this.config.maxTime, "H:i"), + }; + fp.loadedPlugins.push("minMaxTime"); + }, + onChange: function () { + var latest = this.latestSelectedDateObj; + var matchingTimeLimit = latest && findDateTimeLimit(latest); + if (latest && matchingTimeLimit !== undefined) { + this.set(matchingTimeLimit); + fp.config.minTime.setFullYear(latest.getFullYear()); + fp.config.maxTime.setFullYear(latest.getFullYear()); + fp.config.minTime.setMonth(latest.getMonth()); + fp.config.maxTime.setMonth(latest.getMonth()); + fp.config.minTime.setDate(latest.getDate()); + fp.config.maxTime.setDate(latest.getDate()); + if (compareDates(latest, fp.config.maxTime, false) > 0) { + fp.setDate(new Date(latest.getTime()).setHours(fp.config.maxTime.getHours(), fp.config.maxTime.getMinutes(), fp.config.maxTime.getSeconds(), fp.config.maxTime.getMilliseconds()), false); + } + else if (compareDates(latest, fp.config.minTime, false) < 0) + fp.setDate(new Date(latest.getTime()).setHours(fp.config.minTime.getHours(), fp.config.minTime.getMinutes(), fp.config.minTime.getSeconds(), fp.config.minTime.getMilliseconds()), false); + } + else { + var newMinMax = state.defaults || { + minTime: undefined, + maxTime: undefined, + }; + this.set(newMinMax); + if (!latest) + return; + var _a = fp.config, minTime = _a.minTime, maxTime = _a.maxTime; + if (minTime && compareTimes(latest, minTime) < 0) { + fp.setDate(new Date(latest.getTime()).setHours(minTime.getHours(), minTime.getMinutes(), minTime.getSeconds(), minTime.getMilliseconds()), false); + } + else if (maxTime && compareTimes(latest, maxTime) > 0) { + fp.setDate(new Date(latest.getTime()).setHours(maxTime.getHours(), maxTime.getMinutes(), maxTime.getSeconds(), maxTime.getMilliseconds())); + } + // + } + }, + }; + }; + } + + return minMaxTimePlugin; + +}))); diff --git a/website/js/vendor/flatpickr/plugins/momentPlugin.d.ts b/website/js/vendor/flatpickr/plugins/momentPlugin.d.ts new file mode 100644 index 0000000..c0ed5aa --- /dev/null +++ b/website/js/vendor/flatpickr/plugins/momentPlugin.d.ts @@ -0,0 +1,6 @@ +import { Plugin } from "../types/options"; +export interface Config { + moment: Function; +} +declare function momentPlugin(config: Config): Plugin; +export default momentPlugin; diff --git a/website/js/vendor/flatpickr/plugins/momentPlugin.js b/website/js/vendor/flatpickr/plugins/momentPlugin.js new file mode 100644 index 0000000..777ef3a --- /dev/null +++ b/website/js/vendor/flatpickr/plugins/momentPlugin.js @@ -0,0 +1,69 @@ +(function (global, factory) { + typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : + typeof define === 'function' && define.amd ? define(factory) : + (global = global || self, global.momentPlugin = factory()); +}(this, (function () { 'use strict'; + + function getEventTarget(event) { + try { + if (typeof event.composedPath === "function") { + var path = event.composedPath(); + return path[0]; + } + return event.target; + } + catch (error) { + return event.target; + } + } + + function momentPlugin(config) { + var moment = config.moment; + return function (fp) { + function captureIncrement(e) { + var event = e; + event.stopPropagation(); + var date = moment(fp.selectedDates[0]); + var input = getEventTarget(event); + var unit = Array.from(input.classList) + .filter(function (name) { return name.startsWith("flatpickr-"); }) + .map(function (name) { return name.substring(10); })[0]; + var step = parseFloat(input.getAttribute("step")); + date.add(step * event.delta, unit); + fp.setDate(date.toDate()); + } + return { + parseDate: function (datestr, format) { + return moment(datestr, format, true).toDate(); + }, + formatDate: function (date, format) { + // locale can also be used + var momentDate = moment(date); + if (typeof fp.config.locale === "string") { + momentDate.locale(fp.config.locale); + } + return momentDate.format(format); + }, + onReady: function () { + [fp.hourElement, fp.minuteElement, fp.secondElement].forEach(function (element) { + return element && + element.addEventListener("increment", captureIncrement, { + capture: true, + }); + }); + }, + onDestroy: function () { + [fp.hourElement, fp.minuteElement, fp.secondElement].forEach(function (element) { + return element && + element.removeEventListener("increment", captureIncrement, { + capture: true, + }); + }); + }, + }; + }; + } + + return momentPlugin; + +}))); diff --git a/website/js/vendor/flatpickr/plugins/monthSelect/index.d.ts b/website/js/vendor/flatpickr/plugins/monthSelect/index.d.ts new file mode 100644 index 0000000..78d5c52 --- /dev/null +++ b/website/js/vendor/flatpickr/plugins/monthSelect/index.d.ts @@ -0,0 +1,16 @@ +import { Plugin } from "../../types/options"; +export interface Config { + shorthand: boolean; + dateFormat: string; + altFormat: string; + theme: string; +} +export interface ElementDate extends Element { + dateObj: Date; +} +export declare type MonthElement = HTMLSpanElement & { + dateObj: Date; + $i: number; +}; +declare function monthSelectPlugin(pluginConfig?: Partial): Plugin; +export default monthSelectPlugin; diff --git a/website/js/vendor/flatpickr/plugins/monthSelect/index.js b/website/js/vendor/flatpickr/plugins/monthSelect/index.js new file mode 100644 index 0000000..87f7629 --- /dev/null +++ b/website/js/vendor/flatpickr/plugins/monthSelect/index.js @@ -0,0 +1,233 @@ +(function (global, factory) { + typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : + typeof define === 'function' && define.amd ? define(factory) : + (global = global || self, global.monthSelectPlugin = factory()); +}(this, (function () { 'use strict'; + + /*! ***************************************************************************** + Copyright (c) Microsoft Corporation. + + Permission to use, copy, modify, and/or distribute this software for any + purpose with or without fee is hereby granted. + + THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH + REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY + AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, + INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM + LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR + OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + PERFORMANCE OF THIS SOFTWARE. + ***************************************************************************** */ + + var __assign = function() { + __assign = Object.assign || function __assign(t) { + for (var s, i = 1, n = arguments.length; i < n; i++) { + s = arguments[i]; + for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; + } + return t; + }; + return __assign.apply(this, arguments); + }; + + var monthToStr = function (monthNumber, shorthand, locale) { return locale.months[shorthand ? "shorthand" : "longhand"][monthNumber]; }; + + function getEventTarget(event) { + try { + if (typeof event.composedPath === "function") { + var path = event.composedPath(); + return path[0]; + } + return event.target; + } + catch (error) { + return event.target; + } + } + + var defaultConfig = { + shorthand: false, + dateFormat: "F Y", + altFormat: "F Y", + theme: "light", + }; + function monthSelectPlugin(pluginConfig) { + var config = __assign(__assign({}, defaultConfig), pluginConfig); + return function (fp) { + fp.config.dateFormat = config.dateFormat; + fp.config.altFormat = config.altFormat; + var self = { monthsContainer: null }; + function clearUnnecessaryDOMElements() { + if (!fp.rContainer || !fp.daysContainer || !fp.weekdayContainer) + return; + fp.rContainer.removeChild(fp.daysContainer); + fp.rContainer.removeChild(fp.weekdayContainer); + for (var index = 0; index < fp.monthElements.length; index++) { + var element = fp.monthElements[index]; + if (!element.parentNode) + continue; + element.parentNode.removeChild(element); + } + } + function addListeners() { + fp._bind(fp.prevMonthNav, "click", function (e) { + var _a; + e.preventDefault(); + e.stopPropagation(); + var selectedMonth = (_a = fp.rContainer) === null || _a === void 0 ? void 0 : _a.querySelector(".flatpickr-monthSelect-month.selected").dateObj.getMonth(); + if (selectedMonth === 0) { + fp.currentYear--; + } + selectYear(); + }); + fp._bind(fp.nextMonthNav, "click", function (e) { + var _a; + e.preventDefault(); + e.stopPropagation(); + var selectedMonth = (_a = fp.rContainer) === null || _a === void 0 ? void 0 : _a.querySelector(".flatpickr-monthSelect-month.selected").dateObj.getMonth(); + if (selectedMonth === 11) { + fp.currentYear++; + } + selectYear(); + }); + } + function addMonths() { + if (!fp.rContainer) + return; + self.monthsContainer = fp._createElement("div", "flatpickr-monthSelect-months"); + self.monthsContainer.tabIndex = -1; + fp.calendarContainer.classList.add("flatpickr-monthSelect-theme-" + config.theme); + for (var i = 0; i < 12; i++) { + var month = fp._createElement("span", "flatpickr-monthSelect-month"); + month.dateObj = new Date(fp.currentYear, i); + month.$i = i; + month.textContent = monthToStr(i, config.shorthand, fp.l10n); + month.tabIndex = -1; + month.addEventListener("click", selectMonth); + self.monthsContainer.appendChild(month); + if ((fp.config.minDate && month.dateObj < fp.config.minDate) || + (fp.config.maxDate && month.dateObj > fp.config.maxDate)) { + month.classList.add("disabled"); + } + } + fp.rContainer.appendChild(self.monthsContainer); + } + function setCurrentlySelected() { + if (!fp.rContainer) + return; + var currentlySelected = fp.rContainer.querySelectorAll(".flatpickr-monthSelect-month.selected"); + for (var index = 0; index < currentlySelected.length; index++) { + currentlySelected[index].classList.remove("selected"); + } + var month = fp.rContainer.querySelector(".flatpickr-monthSelect-month:nth-child(" + (fp.currentMonth + 1) + ")"); + if (month) { + month.classList.add("selected"); + } + } + function selectYear() { + var selectedDate = fp.selectedDates[0]; + if (selectedDate) { + selectedDate = new Date(selectedDate); + selectedDate.setFullYear(fp.currentYear); + if (fp.config.minDate && selectedDate < fp.config.minDate) { + selectedDate = fp.config.minDate; + } + if (fp.config.maxDate && selectedDate > fp.config.maxDate) { + selectedDate = fp.config.maxDate; + } + fp.currentYear = selectedDate.getFullYear(); + fp.currentYearElement.value = String(fp.currentYear); + fp.currentMonth = selectedDate.getMonth(); + } + if (fp.rContainer) { + var months = fp.rContainer.querySelectorAll(".flatpickr-monthSelect-month"); + months.forEach(function (month) { + month.dateObj.setFullYear(fp.currentYear); + if ((fp.config.minDate && month.dateObj < fp.config.minDate) || + (fp.config.maxDate && month.dateObj > fp.config.maxDate)) { + month.classList.add("disabled"); + } + else { + month.classList.remove("disabled"); + } + }); + } + setCurrentlySelected(); + } + function selectMonth(e) { + e.preventDefault(); + e.stopPropagation(); + var eventTarget = getEventTarget(e); + if (eventTarget instanceof Element && + !eventTarget.classList.contains("disabled")) { + setMonth(eventTarget.dateObj); + fp.close(); + } + } + function setMonth(date) { + var selectedDate = new Date(date); + selectedDate.setFullYear(fp.currentYear); + fp.currentMonth = selectedDate.getMonth(); + fp.setDate(selectedDate, true); + setCurrentlySelected(); + } + var shifts = { + 37: -1, + 39: 1, + 40: 3, + 38: -3, + }; + function onKeyDown(_, __, ___, e) { + var shouldMove = shifts[e.keyCode] !== undefined; + if (!shouldMove && e.keyCode !== 13) { + return; + } + if (!fp.rContainer || !self.monthsContainer) + return; + var currentlySelected = fp.rContainer.querySelector(".flatpickr-monthSelect-month.selected"); + var index = Array.prototype.indexOf.call(self.monthsContainer.children, document.activeElement); + if (index === -1) { + var target = currentlySelected || self.monthsContainer.firstElementChild; + target.focus(); + index = target.$i; + } + if (shouldMove) { + self.monthsContainer.children[(12 + index + shifts[e.keyCode]) % 12].focus(); + } + else if (e.keyCode === 13 && + self.monthsContainer.contains(document.activeElement)) { + setMonth(document.activeElement.dateObj); + } + } + function destroyPluginInstance() { + if (self.monthsContainer !== null) { + var months = self.monthsContainer.querySelectorAll(".flatpickr-monthSelect-month"); + for (var index = 0; index < months.length; index++) { + months[index].removeEventListener("click", selectMonth); + } + } + } + return { + onParseConfig: function () { + fp.config.mode = "single"; + fp.config.enableTime = false; + }, + onValueUpdate: setCurrentlySelected, + onKeyDown: onKeyDown, + onReady: [ + clearUnnecessaryDOMElements, + addListeners, + addMonths, + setCurrentlySelected, + function () { + fp.loadedPlugins.push("monthSelect"); + }, + ], + onDestroy: destroyPluginInstance, + }; + }; + } + + return monthSelectPlugin; + +}))); diff --git a/website/js/vendor/flatpickr/plugins/monthSelect/style.css b/website/js/vendor/flatpickr/plugins/monthSelect/style.css new file mode 100644 index 0000000..f49a9ec --- /dev/null +++ b/website/js/vendor/flatpickr/plugins/monthSelect/style.css @@ -0,0 +1,79 @@ +.flatpickr-monthSelect-months { + margin: 10px 1px 3px 1px; + flex-wrap: wrap; +} + +.flatpickr-monthSelect-month { + background: none; + border: 0; + border-radius: 2px; + -webkit-box-sizing: border-box; + box-sizing: border-box; + color: #393939; + cursor: pointer; + display: inline-block; + font-weight: 400; + margin: 0.5px; + justify-content: center; + padding: 10px; + position: relative; + -webkit-box-pack: center; + -webkit-justify-content: center; + -ms-flex-pack: center; + text-align: center; + width: 33%; +} + +.flatpickr-monthSelect-month.disabled { + color: #eee; +} + +.flatpickr-monthSelect-month.disabled:hover, +.flatpickr-monthSelect-month.disabled:focus { + cursor: not-allowed; + background: none !important; +} + +.flatpickr-monthSelect-theme-dark { + background: #3f4458; +} + +.flatpickr-monthSelect-theme-dark .flatpickr-current-month input.cur-year { + color: #fff; +} + +.flatpickr-monthSelect-theme-dark .flatpickr-months .flatpickr-prev-month, +.flatpickr-monthSelect-theme-dark .flatpickr-months .flatpickr-next-month { + color: #fff; + fill: #fff; +} + +.flatpickr-monthSelect-theme-dark .flatpickr-monthSelect-month { + color: rgba(255, 255, 255, 0.95); +} + +.flatpickr-monthSelect-month:hover, +.flatpickr-monthSelect-month:focus { + background: #e6e6e6; + cursor: pointer; + outline: 0; +} + +.flatpickr-monthSelect-theme-dark .flatpickr-monthSelect-month:hover, +.flatpickr-monthSelect-theme-dark .flatpickr-monthSelect-month:focus { + background: #646c8c; + border-color: #646c8c; +} + +.flatpickr-monthSelect-month.selected { + background-color: #569ff7; + color: #fff; +} + +.flatpickr-monthSelect-theme-dark .flatpickr-monthSelect-month.selected { + background: #80cbc4; + -webkit-box-shadow: none; + box-shadow: none; + color: #fff; + border-color: #80cbc4; +} diff --git a/website/js/vendor/flatpickr/plugins/monthSelect/tests.spec.d.ts b/website/js/vendor/flatpickr/plugins/monthSelect/tests.spec.d.ts new file mode 100644 index 0000000..cb0ff5c --- /dev/null +++ b/website/js/vendor/flatpickr/plugins/monthSelect/tests.spec.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/website/js/vendor/flatpickr/plugins/rangePlugin.d.ts b/website/js/vendor/flatpickr/plugins/rangePlugin.d.ts new file mode 100644 index 0000000..960a834 --- /dev/null +++ b/website/js/vendor/flatpickr/plugins/rangePlugin.d.ts @@ -0,0 +1,12 @@ +import { Plugin } from "../types/options"; +export interface Config { + input?: string | HTMLInputElement; + position?: "left"; +} +declare global { + interface Window { + rangePlugin: (config?: Config) => void; + } +} +declare function rangePlugin(config?: Config): Plugin; +export default rangePlugin; diff --git a/website/js/vendor/flatpickr/plugins/rangePlugin.js b/website/js/vendor/flatpickr/plugins/rangePlugin.js new file mode 100644 index 0000000..8413ca8 --- /dev/null +++ b/website/js/vendor/flatpickr/plugins/rangePlugin.js @@ -0,0 +1,169 @@ +(function (global, factory) { + typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : + typeof define === 'function' && define.amd ? define(factory) : + (global = global || self, global.rangePlugin = factory()); +}(this, (function () { 'use strict'; + + /*! ***************************************************************************** + Copyright (c) Microsoft Corporation. + + Permission to use, copy, modify, and/or distribute this software for any + purpose with or without fee is hereby granted. + + THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH + REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY + AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, + INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM + LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR + OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + PERFORMANCE OF THIS SOFTWARE. + ***************************************************************************** */ + + function __spreadArrays() { + for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length; + for (var r = Array(s), k = 0, i = 0; i < il; i++) + for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) + r[k] = a[j]; + return r; + } + + function rangePlugin(config) { + if (config === void 0) { config = {}; } + return function (fp) { + var dateFormat = "", secondInput, _secondInputFocused, _prevDates; + var createSecondInput = function () { + if (config.input) { + secondInput = + config.input instanceof Element + ? config.input + : window.document.querySelector(config.input); + if (!secondInput) { + fp.config.errorHandler(new Error("Invalid input element specified")); + return; + } + if (fp.config.wrap) { + secondInput = secondInput.querySelector("[data-input]"); + } + } + else { + secondInput = fp._input.cloneNode(); + secondInput.removeAttribute("id"); + secondInput._flatpickr = undefined; + } + if (secondInput.value) { + var parsedDate = fp.parseDate(secondInput.value); + if (parsedDate) + fp.selectedDates.push(parsedDate); + } + secondInput.setAttribute("data-fp-omit", ""); + fp._bind(secondInput, ["focus", "click"], function () { + if (fp.selectedDates[1]) { + fp.latestSelectedDateObj = fp.selectedDates[1]; + fp._setHoursFromDate(fp.selectedDates[1]); + fp.jumpToDate(fp.selectedDates[1]); + } + _secondInputFocused = true; + fp.isOpen = false; + fp.open(undefined, config.position === "left" ? fp._input : secondInput); + }); + fp._bind(fp._input, ["focus", "click"], function (e) { + e.preventDefault(); + fp.isOpen = false; + fp.open(); + }); + if (fp.config.allowInput) + fp._bind(secondInput, "keydown", function (e) { + if (e.key === "Enter") { + fp.setDate([fp.selectedDates[0], secondInput.value], true, dateFormat); + secondInput.click(); + } + }); + if (!config.input) + fp._input.parentNode && + fp._input.parentNode.insertBefore(secondInput, fp._input.nextSibling); + }; + var plugin = { + onParseConfig: function () { + fp.config.mode = "range"; + dateFormat = fp.config.altInput + ? fp.config.altFormat + : fp.config.dateFormat; + }, + onReady: function () { + createSecondInput(); + fp.config.ignoredFocusElements.push(secondInput); + if (fp.config.allowInput) { + fp._input.removeAttribute("readonly"); + secondInput.removeAttribute("readonly"); + } + else { + secondInput.setAttribute("readonly", "readonly"); + } + fp._bind(fp._input, "focus", function () { + fp.latestSelectedDateObj = fp.selectedDates[0]; + fp._setHoursFromDate(fp.selectedDates[0]); + _secondInputFocused = false; + fp.jumpToDate(fp.selectedDates[0]); + }); + if (fp.config.allowInput) + fp._bind(fp._input, "keydown", function (e) { + if (e.key === "Enter") + fp.setDate([fp._input.value, fp.selectedDates[1]], true, dateFormat); + }); + fp.setDate(fp.selectedDates, false); + plugin.onValueUpdate(fp.selectedDates); + fp.loadedPlugins.push("range"); + }, + onPreCalendarPosition: function () { + if (_secondInputFocused) { + fp._positionElement = secondInput; + setTimeout(function () { + fp._positionElement = fp._input; + }, 0); + } + }, + onChange: function () { + if (!fp.selectedDates.length) { + setTimeout(function () { + if (fp.selectedDates.length) + return; + secondInput.value = ""; + _prevDates = []; + }, 10); + } + if (_secondInputFocused) { + setTimeout(function () { + secondInput.focus(); + }, 0); + } + }, + onDestroy: function () { + if (!config.input) + secondInput.parentNode && + secondInput.parentNode.removeChild(secondInput); + }, + onValueUpdate: function (selDates) { + var _a, _b, _c; + if (!secondInput) + return; + _prevDates = + !_prevDates || selDates.length >= _prevDates.length + ? __spreadArrays(selDates) : _prevDates; + if (_prevDates.length > selDates.length) { + var newSelectedDate = selDates[0]; + var newDates = _secondInputFocused + ? [_prevDates[0], newSelectedDate] + : [newSelectedDate, _prevDates[1]]; + fp.setDate(newDates, false); + _prevDates = __spreadArrays(newDates); + } + _a = fp.selectedDates.map(function (d) { return fp.formatDate(d, dateFormat); }), _b = _a[0], fp._input.value = _b === void 0 ? "" : _b, _c = _a[1], secondInput.value = _c === void 0 ? "" : _c; + }, + }; + return plugin; + }; + } + + return rangePlugin; + +}))); diff --git a/website/js/vendor/flatpickr/plugins/scrollPlugin.d.ts b/website/js/vendor/flatpickr/plugins/scrollPlugin.d.ts new file mode 100644 index 0000000..a367428 --- /dev/null +++ b/website/js/vendor/flatpickr/plugins/scrollPlugin.d.ts @@ -0,0 +1,3 @@ +import { Plugin } from "../types/options"; +declare function scrollPlugin(): Plugin; +export default scrollPlugin; diff --git a/website/js/vendor/flatpickr/plugins/scrollPlugin.js b/website/js/vendor/flatpickr/plugins/scrollPlugin.js new file mode 100644 index 0000000..0e50f95 --- /dev/null +++ b/website/js/vendor/flatpickr/plugins/scrollPlugin.js @@ -0,0 +1,85 @@ +(function (global, factory) { + typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : + typeof define === 'function' && define.amd ? define(factory) : + (global = global || self, global.scrollPlugin = factory()); +}(this, (function () { 'use strict'; + + function getEventTarget(event) { + try { + if (typeof event.composedPath === "function") { + var path = event.composedPath(); + return path[0]; + } + return event.target; + } + catch (error) { + return event.target; + } + } + + if (typeof window.CustomEvent !== "function") { + function CustomEvent(typeArg, eventInitDict) { + eventInitDict = eventInitDict || { + bubbles: false, + cancelable: false, + detail: undefined, + }; + var evt = document.createEvent("CustomEvent"); + evt.initCustomEvent(typeArg, eventInitDict.bubbles, eventInitDict.cancelable, eventInitDict.detail); + return evt; + } + CustomEvent.prototype = window.Event.prototype; + window.CustomEvent = CustomEvent; + } + function delta(e) { + return Math.max(-1, Math.min(1, e.wheelDelta || -e.deltaY)); + } + var scroll = function (e) { + e.preventDefault(); + var ev = new CustomEvent("increment", { + bubbles: true, + }); + ev.delta = delta(e); + getEventTarget(e).dispatchEvent(ev); + }; + function scrollMonth(fp) { + return function (e) { + e.preventDefault(); + var mDelta = delta(e); + fp.changeMonth(mDelta); + }; + } + function scrollPlugin() { + return function (fp) { + var monthScroller = scrollMonth(fp); + return { + onReady: function () { + if (fp.timeContainer) { + fp.timeContainer.addEventListener("wheel", scroll); + } + fp.yearElements.forEach(function (yearElem) { + return yearElem.addEventListener("wheel", scroll); + }); + fp.monthElements.forEach(function (monthElem) { + return monthElem.addEventListener("wheel", monthScroller); + }); + fp.loadedPlugins.push("scroll"); + }, + onDestroy: function () { + if (fp.timeContainer) { + fp.timeContainer.removeEventListener("wheel", scroll); + } + fp.yearElements.forEach(function (yearElem) { + return yearElem.removeEventListener("wheel", scroll); + }); + fp.monthElements.forEach(function (monthElem) { + return monthElem.removeEventListener("wheel", monthScroller); + }); + }, + }; + }; + } + + return scrollPlugin; + +}))); diff --git a/website/js/vendor/flatpickr/plugins/weekSelect/weekSelect.d.ts b/website/js/vendor/flatpickr/plugins/weekSelect/weekSelect.d.ts new file mode 100644 index 0000000..88cc964 --- /dev/null +++ b/website/js/vendor/flatpickr/plugins/weekSelect/weekSelect.d.ts @@ -0,0 +1,7 @@ +import { Plugin } from "../../types/options"; +export declare type PlusWeeks = { + weekStartDay: Date; + weekEndDay: Date; +}; +declare function weekSelectPlugin(): Plugin; +export default weekSelectPlugin; diff --git a/website/js/vendor/flatpickr/plugins/weekSelect/weekSelect.js b/website/js/vendor/flatpickr/plugins/weekSelect/weekSelect.js new file mode 100644 index 0000000..d72fd8a --- /dev/null +++ b/website/js/vendor/flatpickr/plugins/weekSelect/weekSelect.js @@ -0,0 +1,99 @@ +(function (global, factory) { + typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : + typeof define === 'function' && define.amd ? define(factory) : + (global = global || self, global.weekSelect = factory()); +}(this, (function () { 'use strict'; + + function getEventTarget(event) { + try { + if (typeof event.composedPath === "function") { + var path = event.composedPath(); + return path[0]; + } + return event.target; + } + catch (error) { + return event.target; + } + } + + function weekSelectPlugin() { + return function (fp) { + function onDayHover(event) { + var day = getEventTarget(event); + if (!day.classList.contains("flatpickr-day")) + return; + var days = fp.days.childNodes; + var dayIndex = day.$i; + var dayIndSeven = dayIndex / 7; + var weekStartDay = days[7 * Math.floor(dayIndSeven)] + .dateObj; + var weekEndDay = days[7 * Math.ceil(dayIndSeven + 0.01) - 1].dateObj; + for (var i = days.length; i--;) { + var day_1 = days[i]; + var date = day_1.dateObj; + if (date > weekEndDay || date < weekStartDay) + day_1.classList.remove("inRange"); + else + day_1.classList.add("inRange"); + } + } + function highlightWeek() { + var selDate = fp.latestSelectedDateObj; + if (selDate !== undefined && + selDate.getMonth() === fp.currentMonth && + selDate.getFullYear() === fp.currentYear) { + fp.weekStartDay = fp.days.childNodes[7 * Math.floor(fp.selectedDateElem.$i / 7)].dateObj; + fp.weekEndDay = fp.days.childNodes[7 * Math.ceil(fp.selectedDateElem.$i / 7 + 0.01) - 1].dateObj; + } + var days = fp.days.childNodes; + for (var i = days.length; i--;) { + var date = days[i].dateObj; + if (date >= fp.weekStartDay && date <= fp.weekEndDay) + days[i].classList.add("week", "selected"); + } + } + function clearHover() { + var days = fp.days.childNodes; + for (var i = days.length; i--;) + days[i].classList.remove("inRange"); + } + function onReady() { + if (fp.daysContainer !== undefined) + fp.daysContainer.addEventListener("mouseover", onDayHover); + } + function onDestroy() { + if (fp.daysContainer !== undefined) + fp.daysContainer.removeEventListener("mouseover", onDayHover); + } + return { + onValueUpdate: highlightWeek, + onMonthChange: highlightWeek, + onYearChange: highlightWeek, + onOpen: highlightWeek, + onClose: clearHover, + onParseConfig: function () { + fp.config.mode = "single"; + fp.config.enableTime = false; + fp.config.dateFormat = fp.config.dateFormat + ? fp.config.dateFormat + : "\\W\\e\\e\\k #W, Y"; + fp.config.altFormat = fp.config.altFormat + ? fp.config.altFormat + : "\\W\\e\\e\\k #W, Y"; + }, + onReady: [ + onReady, + highlightWeek, + function () { + fp.loadedPlugins.push("weekSelect"); + }, + ], + onDestroy: onDestroy, + }; + }; + } + + return weekSelectPlugin; + +}))); diff --git a/website/js/vendor/flatpickr/themes/airbnb.css b/website/js/vendor/flatpickr/themes/airbnb.css new file mode 100644 index 0000000..ad55e5a --- /dev/null +++ b/website/js/vendor/flatpickr/themes/airbnb.css @@ -0,0 +1,880 @@ +.flatpickr-calendar { + background: transparent; + opacity: 0; + display: none; + text-align: center; + visibility: hidden; + padding: 0; + -webkit-animation: none; + animation: none; + direction: ltr; + border: 0; + font-size: 14px; + line-height: 24px; + border-radius: 5px; + position: absolute; + width: 307.875px; + -webkit-box-sizing: border-box; + box-sizing: border-box; + -ms-touch-action: manipulation; + touch-action: manipulation; + background: #fff; + -webkit-box-shadow: 1px 0 0 #eee, -1px 0 0 #eee, 0 1px 0 #eee, 0 -1px 0 #eee, 0 3px 13px rgba(0,0,0,0.08); + box-shadow: 1px 0 0 #eee, -1px 0 0 #eee, 0 1px 0 #eee, 0 -1px 0 #eee, 0 3px 13px rgba(0,0,0,0.08); +} +.flatpickr-calendar.open, +.flatpickr-calendar.inline { + opacity: 1; + max-height: 640px; + visibility: visible; +} +.flatpickr-calendar.open { + display: inline-block; + z-index: 99999; +} +.flatpickr-calendar.animate.open { + -webkit-animation: fpFadeInDown 300ms cubic-bezier(0.23, 1, 0.32, 1); + animation: fpFadeInDown 300ms cubic-bezier(0.23, 1, 0.32, 1); +} +.flatpickr-calendar.inline { + display: block; + position: relative; + top: 2px; +} +.flatpickr-calendar.static { + position: absolute; + top: calc(100% + 2px); +} +.flatpickr-calendar.static.open { + z-index: 999; + display: block; +} +.flatpickr-calendar.multiMonth .flatpickr-days .dayContainer:nth-child(n+1) .flatpickr-day.inRange:nth-child(7n+7) { + -webkit-box-shadow: none !important; + box-shadow: none !important; +} +.flatpickr-calendar.multiMonth .flatpickr-days .dayContainer:nth-child(n+2) .flatpickr-day.inRange:nth-child(7n+1) { + -webkit-box-shadow: -2px 0 0 #e6e6e6, 5px 0 0 #e6e6e6; + box-shadow: -2px 0 0 #e6e6e6, 5px 0 0 #e6e6e6; +} +.flatpickr-calendar .hasWeeks .dayContainer, +.flatpickr-calendar .hasTime .dayContainer { + border-bottom: 0; + border-bottom-right-radius: 0; + border-bottom-left-radius: 0; +} +.flatpickr-calendar .hasWeeks .dayContainer { + border-left: 0; +} +.flatpickr-calendar.hasTime .flatpickr-time { + height: 40px; + border-top: 1px solid #eee; +} +.flatpickr-calendar.noCalendar.hasTime .flatpickr-time { + height: auto; +} +.flatpickr-calendar:before, +.flatpickr-calendar:after { + position: absolute; + display: block; + pointer-events: none; + border: solid transparent; + content: ''; + height: 0; + width: 0; + left: 22px; +} +.flatpickr-calendar.rightMost:before, +.flatpickr-calendar.arrowRight:before, +.flatpickr-calendar.rightMost:after, +.flatpickr-calendar.arrowRight:after { + left: auto; + right: 22px; +} +.flatpickr-calendar.arrowCenter:before, +.flatpickr-calendar.arrowCenter:after { + left: 50%; + right: 50%; +} +.flatpickr-calendar:before { + border-width: 5px; + margin: 0 -5px; +} +.flatpickr-calendar:after { + border-width: 4px; + margin: 0 -4px; +} +.flatpickr-calendar.arrowTop:before, +.flatpickr-calendar.arrowTop:after { + bottom: 100%; +} +.flatpickr-calendar.arrowTop:before { + border-bottom-color: #eee; +} +.flatpickr-calendar.arrowTop:after { + border-bottom-color: #fff; +} +.flatpickr-calendar.arrowBottom:before, +.flatpickr-calendar.arrowBottom:after { + top: 100%; +} +.flatpickr-calendar.arrowBottom:before { + border-top-color: #eee; +} +.flatpickr-calendar.arrowBottom:after { + border-top-color: #fff; +} +.flatpickr-calendar:focus { + outline: 0; +} +.flatpickr-wrapper { + position: relative; + display: inline-block; +} +.flatpickr-months { + display: -webkit-box; + display: -webkit-flex; + display: -ms-flexbox; + display: flex; +} +.flatpickr-months .flatpickr-month { + background: transparent; + color: #3c3f40; + fill: #3c3f40; + height: 34px; + line-height: 1; + text-align: center; + position: relative; + -webkit-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; + overflow: hidden; + -webkit-box-flex: 1; + -webkit-flex: 1; + -ms-flex: 1; + flex: 1; +} +.flatpickr-months .flatpickr-prev-month, +.flatpickr-months .flatpickr-next-month { + text-decoration: none; + cursor: pointer; + position: absolute; + top: 0; + height: 34px; + padding: 10px; + z-index: 3; + color: #3c3f40; + fill: #3c3f40; +} +.flatpickr-months .flatpickr-prev-month.flatpickr-disabled, +.flatpickr-months .flatpickr-next-month.flatpickr-disabled { + display: none; +} +.flatpickr-months .flatpickr-prev-month i, +.flatpickr-months .flatpickr-next-month i { + position: relative; +} +.flatpickr-months .flatpickr-prev-month.flatpickr-prev-month, +.flatpickr-months .flatpickr-next-month.flatpickr-prev-month { +/* + /*rtl:begin:ignore*/ +/* + */ + left: 0; +/* + /*rtl:end:ignore*/ +/* + */ +} +/* + /*rtl:begin:ignore*/ +/* + /*rtl:end:ignore*/ +.flatpickr-months .flatpickr-prev-month.flatpickr-next-month, +.flatpickr-months .flatpickr-next-month.flatpickr-next-month { +/* + /*rtl:begin:ignore*/ +/* + */ + right: 0; +/* + /*rtl:end:ignore*/ +/* + */ +} +/* + /*rtl:begin:ignore*/ +/* + /*rtl:end:ignore*/ +.flatpickr-months .flatpickr-prev-month:hover, +.flatpickr-months .flatpickr-next-month:hover { + color: #3a6fc3; +} +.flatpickr-months .flatpickr-prev-month:hover svg, +.flatpickr-months .flatpickr-next-month:hover svg { + fill: #3a6fc3;; +} +.flatpickr-months .flatpickr-prev-month svg, +.flatpickr-months .flatpickr-next-month svg { + width: 14px; + height: 14px; +} +.flatpickr-months .flatpickr-prev-month svg path, +.flatpickr-months .flatpickr-next-month svg path { + -webkit-transition: fill 0.1s; + transition: fill 0.1s; + fill: inherit; +} +.numInputWrapper { + position: relative; + height: auto; +} +.numInputWrapper input, +.numInputWrapper span { + display: inline-block; +} +.numInputWrapper input { + width: 100%; +} +.numInputWrapper input::-ms-clear { + display: none; +} +.numInputWrapper input::-webkit-outer-spin-button, +.numInputWrapper input::-webkit-inner-spin-button { + margin: 0; + -webkit-appearance: none; +} +.numInputWrapper span { + position: absolute; + right: 0; + width: 14px; + padding: 0 4px 0 2px; + height: 50%; + line-height: 50%; + opacity: 0; + cursor: pointer; + border: 1px solid rgba(64,72,72,0.15); + -webkit-box-sizing: border-box; + box-sizing: border-box; +} +.numInputWrapper span:hover { + background: rgba(0,0,0,0.1); +} +.numInputWrapper span:active { + background: rgba(0,0,0,0.2); +} +.numInputWrapper span:after { + display: block; + content: ""; + position: absolute; +} +.numInputWrapper span.arrowUp { + top: 0; + border-bottom: 0; +} +.numInputWrapper span.arrowUp:after { + border-left: 4px solid transparent; + border-right: 4px solid transparent; + border-bottom: 4px solid rgba(64,72,72,0.6); + top: 26%; +} +.numInputWrapper span.arrowDown { + top: 50%; +} +.numInputWrapper span.arrowDown:after { + border-left: 4px solid transparent; + border-right: 4px solid transparent; + border-top: 4px solid rgba(64,72,72,0.6); + top: 40%; +} +.numInputWrapper span svg { + width: inherit; + height: auto; +} +.numInputWrapper span svg path { + fill: rgba(60,63,64,0.5); +} +.numInputWrapper:hover { + background: rgba(0,0,0,0.05); +} +.numInputWrapper:hover span { + opacity: 1; +} +.flatpickr-current-month { + font-size: 135%; + line-height: inherit; + font-weight: 300; + color: inherit; + position: absolute; + width: 75%; + left: 12.5%; + padding: 7.48px 0 0 0; + line-height: 1; + height: 34px; + display: inline-block; + text-align: center; + -webkit-transform: translate3d(0px, 0px, 0px); + transform: translate3d(0px, 0px, 0px); +} +.flatpickr-current-month span.cur-month { + font-family: inherit; + font-weight: 700; + color: inherit; + display: inline-block; + margin-left: 0.5ch; + padding: 0; +} +.flatpickr-current-month span.cur-month:hover { + background: rgba(0,0,0,0.05); +} +.flatpickr-current-month .numInputWrapper { + top: -27px; + width: 6ch; + left: 53px; + display: inline-block; +} +.flatpickr-current-month .numInputWrapper span.arrowUp:after { + border-bottom-color: #3c3f40; +} +.flatpickr-current-month .numInputWrapper span.arrowDown:after { + border-top-color: #3c3f40; +} +.flatpickr-current-month input.cur-year { + background: transparent; + -webkit-box-sizing: border-box; + box-sizing: border-box; + color: inherit; + cursor: text; + padding: 0 0 0 0.5ch; + margin: 0; + display: inline-block; + font-size: inherit; + font-family: inherit; + font-weight: 300; + line-height: inherit; + height: 27px; + border: 1px solid #ccc; + border-radius: 0; + vertical-align: initial; + -webkit-appearance: textfield; + -moz-appearance: textfield; + appearance: textfield; +} +.flatpickr-current-month input.cur-year:focus { + outline: 0; +} +.flatpickr-current-month input.cur-year[disabled], +.flatpickr-current-month input.cur-year[disabled]:hover { + font-size: 100%; + color: rgba(60,63,64,0.5); + background: transparent; + pointer-events: none; +} +.flatpickr-current-month .flatpickr-monthDropdown-months { + appearance: menulist; + background: transparent; + border: 1px solid #ccc; + border-radius: 0; + box-sizing: border-box; + color: inherit; + cursor: pointer; + font-size: inherit; + font-family: inherit; + font-weight: 300; + height: auto; + line-height: inherit; + margin: -1px 0 0 0; + outline: none; + padding: 0 0 0 0.5ch; + position: relative; + vertical-align: initial; + -webkit-box-sizing: border-box; + -webkit-appearance: menulist; + -moz-appearance: menulist; + width: auto; +} +.flatpickr-current-month .flatpickr-monthDropdown-months:focus, +.flatpickr-current-month .flatpickr-monthDropdown-months:active { + outline: none; +} +.flatpickr-current-month .flatpickr-monthDropdown-months:hover { + background: rgba(0,0,0,0.05); +} +.flatpickr-current-month .flatpickr-monthDropdown-months .flatpickr-monthDropdown-month { + background-color: transparent; + outline: none; + padding: 0; +} +.flatpickr-weekdays { + background: transparent; + text-align: center; + overflow: hidden; + width: 100%; + display: -webkit-box; + display: -webkit-flex; + display: -ms-flexbox; + display: flex; + -webkit-box-align: center; + -webkit-align-items: center; + -ms-flex-align: center; + align-items: center; + height: 28px; +} +.flatpickr-weekdays .flatpickr-weekdaycontainer { + display: -webkit-box; + display: -webkit-flex; + display: -ms-flexbox; + display: flex; + -webkit-box-flex: 1; + -webkit-flex: 1; + -ms-flex: 1; + flex: 1; +} +span.flatpickr-weekday { + cursor: default; + font-size: 90%; + background: transparent; + color: rgba(0,0,0,0.54); + line-height: 1; + margin: 0; + text-align: center; + display: block; + -webkit-box-flex: 1; + -webkit-flex: 1; + -ms-flex: 1; + flex: 1; + font-weight: bolder; +} +.dayContainer, +.flatpickr-weeks { + padding: 1px 0 0 0; +} +.flatpickr-days { + position: relative; + overflow: hidden; + display: -webkit-box; + display: -webkit-flex; + display: -ms-flexbox; + display: flex; + -webkit-box-align: start; + -webkit-align-items: flex-start; + -ms-flex-align: start; + align-items: flex-start; + width: 307.875px; +} +.flatpickr-days:focus { + outline: 0; +} +.dayContainer { + padding: 0; + outline: 0; + text-align: left; + width: 307.875px; + min-width: 307.875px; + max-width: 307.875px; + -webkit-box-sizing: border-box; + box-sizing: border-box; + display: inline-block; + display: -ms-flexbox; + display: -webkit-box; + display: -webkit-flex; + display: flex; + -webkit-flex-wrap: wrap; + flex-wrap: wrap; + -ms-flex-wrap: wrap; + -ms-flex-pack: justify; + -webkit-justify-content: space-around; + justify-content: space-around; + -webkit-transform: translate3d(0px, 0px, 0px); + transform: translate3d(0px, 0px, 0px); + opacity: 1; +} +.dayContainer + .dayContainer { + -webkit-box-shadow: -1px 0 0 #eee; + box-shadow: -1px 0 0 #eee; +} +.flatpickr-day { + background: none; + border: 1px solid transparent; + border-radius: 150px; + -webkit-box-sizing: border-box; + box-sizing: border-box; + color: #404848; + cursor: pointer; + font-weight: 400; + width: 14.2857143%; + -webkit-flex-basis: 14.2857143%; + -ms-flex-preferred-size: 14.2857143%; + flex-basis: 14.2857143%; + max-width: 39px; + height: 39px; + line-height: 39px; + margin: 0; + display: inline-block; + position: relative; + -webkit-box-pack: center; + -webkit-justify-content: center; + -ms-flex-pack: center; + justify-content: center; + text-align: center; +} +.flatpickr-day.inRange, +.flatpickr-day.prevMonthDay.inRange, +.flatpickr-day.nextMonthDay.inRange, +.flatpickr-day.today.inRange, +.flatpickr-day.prevMonthDay.today.inRange, +.flatpickr-day.nextMonthDay.today.inRange, +.flatpickr-day:hover, +.flatpickr-day.prevMonthDay:hover, +.flatpickr-day.nextMonthDay:hover, +.flatpickr-day:focus, +.flatpickr-day.prevMonthDay:focus, +.flatpickr-day.nextMonthDay:focus { + cursor: pointer; + outline: 0; + background: #e9e9e9; + border-color: #e9e9e9; +} +.flatpickr-day.today { + border-color: #f64747; +} +.flatpickr-day.today:hover, +.flatpickr-day.today:focus { + border-color: #f64747; + background: #f64747; + color: #fff; +} +.flatpickr-day.selected, +.flatpickr-day.startRange, +.flatpickr-day.endRange, +.flatpickr-day.selected.inRange, +.flatpickr-day.startRange.inRange, +.flatpickr-day.endRange.inRange, +.flatpickr-day.selected:focus, +.flatpickr-day.startRange:focus, +.flatpickr-day.endRange:focus, +.flatpickr-day.selected:hover, +.flatpickr-day.startRange:hover, +.flatpickr-day.endRange:hover, +.flatpickr-day.selected.prevMonthDay, +.flatpickr-day.startRange.prevMonthDay, +.flatpickr-day.endRange.prevMonthDay, +.flatpickr-day.selected.nextMonthDay, +.flatpickr-day.startRange.nextMonthDay, +.flatpickr-day.endRange.nextMonthDay { + background: #4f99ff; + -webkit-box-shadow: none; + box-shadow: none; + color: #fff; + border-color: #4f99ff; +} +.flatpickr-day.selected.startRange, +.flatpickr-day.startRange.startRange, +.flatpickr-day.endRange.startRange { + border-radius: 50px 0 0 50px; +} +.flatpickr-day.selected.endRange, +.flatpickr-day.startRange.endRange, +.flatpickr-day.endRange.endRange { + border-radius: 0 50px 50px 0; +} +.flatpickr-day.selected.startRange + .endRange:not(:nth-child(7n+1)), +.flatpickr-day.startRange.startRange + .endRange:not(:nth-child(7n+1)), +.flatpickr-day.endRange.startRange + .endRange:not(:nth-child(7n+1)) { + -webkit-box-shadow: -10px 0 0 #4f99ff; + box-shadow: -10px 0 0 #4f99ff; +} +.flatpickr-day.selected.startRange.endRange, +.flatpickr-day.startRange.startRange.endRange, +.flatpickr-day.endRange.startRange.endRange { + border-radius: 50px; +} +.flatpickr-day.inRange { + border-radius: 0; + -webkit-box-shadow: -5px 0 0 #e9e9e9, 5px 0 0 #e9e9e9; + box-shadow: -5px 0 0 #e9e9e9, 5px 0 0 #e9e9e9; +} +.flatpickr-day.flatpickr-disabled, +.flatpickr-day.flatpickr-disabled:hover, +.flatpickr-day.prevMonthDay, +.flatpickr-day.nextMonthDay, +.flatpickr-day.notAllowed, +.flatpickr-day.notAllowed.prevMonthDay, +.flatpickr-day.notAllowed.nextMonthDay { + color: rgba(64,72,72,0.3); + background: transparent; + border-color: #e9e9e9; + cursor: default; +} +.flatpickr-day.flatpickr-disabled, +.flatpickr-day.flatpickr-disabled:hover { + cursor: not-allowed; + color: rgba(64,72,72,0.1); +} +.flatpickr-day.week.selected { + border-radius: 0; + -webkit-box-shadow: -5px 0 0 #4f99ff, 5px 0 0 #4f99ff; + box-shadow: -5px 0 0 #4f99ff, 5px 0 0 #4f99ff; +} +.flatpickr-day.hidden { + visibility: hidden; +} +.rangeMode .flatpickr-day { + margin-top: 1px; +} +.flatpickr-weekwrapper { + float: left; +} +.flatpickr-weekwrapper .flatpickr-weeks { + padding: 0 12px; + -webkit-box-shadow: 1px 0 0 #eee; + box-shadow: 1px 0 0 #eee; +} +.flatpickr-weekwrapper .flatpickr-weekday { + float: none; + width: 100%; + line-height: 28px; +} +.flatpickr-weekwrapper span.flatpickr-day, +.flatpickr-weekwrapper span.flatpickr-day:hover { + display: block; + width: 100%; + max-width: none; + color: rgba(64,72,72,0.3); + background: transparent; + cursor: default; + border: none; +} +.flatpickr-innerContainer { + display: block; + display: -webkit-box; + display: -webkit-flex; + display: -ms-flexbox; + display: flex; + -webkit-box-sizing: border-box; + box-sizing: border-box; + overflow: hidden; +} +.flatpickr-rContainer { + display: inline-block; + padding: 0; + -webkit-box-sizing: border-box; + box-sizing: border-box; +} +.flatpickr-time { + text-align: center; + outline: 0; + display: block; + height: 0; + line-height: 40px; + max-height: 40px; + -webkit-box-sizing: border-box; + box-sizing: border-box; + overflow: hidden; + display: -webkit-box; + display: -webkit-flex; + display: -ms-flexbox; + display: flex; +} +.flatpickr-time:after { + content: ""; + display: table; + clear: both; +} +.flatpickr-time .numInputWrapper { + -webkit-box-flex: 1; + -webkit-flex: 1; + -ms-flex: 1; + flex: 1; + width: 40%; + height: 40px; + float: left; +} +.flatpickr-time .numInputWrapper span.arrowUp:after { + border-bottom-color: #404848; +} +.flatpickr-time .numInputWrapper span.arrowDown:after { + border-top-color: #404848; +} +.flatpickr-time.hasSeconds .numInputWrapper { + width: 26%; +} +.flatpickr-time.time24hr .numInputWrapper { + width: 49%; +} +.flatpickr-time input { + background: transparent; + -webkit-box-shadow: none; + box-shadow: none; + border: 0; + border-radius: 0; + text-align: center; + margin: 0; + padding: 0; + height: inherit; + line-height: inherit; + color: #404848; + font-size: 14px; + position: relative; + -webkit-box-sizing: border-box; + box-sizing: border-box; + -webkit-appearance: textfield; + -moz-appearance: textfield; + appearance: textfield; +} +.flatpickr-time input.flatpickr-hour { + font-weight: bold; +} +.flatpickr-time input.flatpickr-minute, +.flatpickr-time input.flatpickr-second { + font-weight: 400; +} +.flatpickr-time input:focus { + outline: 0; + border: 0; +} +.flatpickr-time .flatpickr-time-separator, +.flatpickr-time .flatpickr-am-pm { + height: inherit; + float: left; + line-height: inherit; + color: #404848; + font-weight: bold; + width: 2%; + -webkit-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; + -webkit-align-self: center; + -ms-flex-item-align: center; + align-self: center; +} +.flatpickr-time .flatpickr-am-pm { + outline: 0; + width: 18%; + cursor: pointer; + text-align: center; + font-weight: 400; +} +.flatpickr-time input:hover, +.flatpickr-time .flatpickr-am-pm:hover, +.flatpickr-time input:focus, +.flatpickr-time .flatpickr-am-pm:focus { + background: #f1f1f1; +} +.flatpickr-input[readonly] { + cursor: pointer; +} +@-webkit-keyframes fpFadeInDown { + from { + opacity: 0; + -webkit-transform: translate3d(0, -20px, 0); + transform: translate3d(0, -20px, 0); + } + to { + opacity: 1; + -webkit-transform: translate3d(0, 0, 0); + transform: translate3d(0, 0, 0); + } +} +@keyframes fpFadeInDown { + from { + opacity: 0; + -webkit-transform: translate3d(0, -20px, 0); + transform: translate3d(0, -20px, 0); + } + to { + opacity: 1; + -webkit-transform: translate3d(0, 0, 0); + transform: translate3d(0, 0, 0); + } +} +.flatpickr-calendar { + width: 310px; +} +.dayContainer { + padding: 0; + border-right: 0; +} +span.flatpickr-day, +span.flatpickr-day.prevMonthDay, +span.flatpickr-day.nextMonthDay { + border-radius: 0 !important; + border: 1px solid #e9e9e9; + max-width: none; + border-right-color: transparent; +} +span.flatpickr-day:nth-child(n+8), +span.flatpickr-day.prevMonthDay:nth-child(n+8), +span.flatpickr-day.nextMonthDay:nth-child(n+8) { + border-top-color: transparent; +} +span.flatpickr-day:nth-child(7n-6), +span.flatpickr-day.prevMonthDay:nth-child(7n-6), +span.flatpickr-day.nextMonthDay:nth-child(7n-6) { + border-left: 0; +} +span.flatpickr-day:nth-child(n+36), +span.flatpickr-day.prevMonthDay:nth-child(n+36), +span.flatpickr-day.nextMonthDay:nth-child(n+36) { + border-bottom: 0; +} +span.flatpickr-day:nth-child(-n+7), +span.flatpickr-day.prevMonthDay:nth-child(-n+7), +span.flatpickr-day.nextMonthDay:nth-child(-n+7) { + margin-top: 0; +} +span.flatpickr-day.today:not(.selected), +span.flatpickr-day.prevMonthDay.today:not(.selected), +span.flatpickr-day.nextMonthDay.today:not(.selected) { + border-color: #e9e9e9; + border-right-color: transparent; + border-top-color: transparent; + border-bottom-color: #f64747; +} +span.flatpickr-day.today:not(.selected):hover, +span.flatpickr-day.prevMonthDay.today:not(.selected):hover, +span.flatpickr-day.nextMonthDay.today:not(.selected):hover { + border: 1px solid #f64747; +} +span.flatpickr-day.startRange, +span.flatpickr-day.prevMonthDay.startRange, +span.flatpickr-day.nextMonthDay.startRange, +span.flatpickr-day.endRange, +span.flatpickr-day.prevMonthDay.endRange, +span.flatpickr-day.nextMonthDay.endRange { + border-color: #4f99ff; +} +span.flatpickr-day.today, +span.flatpickr-day.prevMonthDay.today, +span.flatpickr-day.nextMonthDay.today, +span.flatpickr-day.selected, +span.flatpickr-day.prevMonthDay.selected, +span.flatpickr-day.nextMonthDay.selected { + z-index: 2; +} +.rangeMode .flatpickr-day { + margin-top: -1px; +} +.flatpickr-weekwrapper .flatpickr-weeks { + -webkit-box-shadow: none; + box-shadow: none; +} +.flatpickr-weekwrapper span.flatpickr-day { + border: 0; + margin: -1px 0 0 -1px; +} +.hasWeeks .flatpickr-days { + border-right: 0; +} + + @media screen and (min-width:0\0) and (min-resolution: +72dpi) { + span.flatpickr-day { + display: block; + -webkit-box-flex: 1; + -webkit-flex: 1 0 auto; + -ms-flex: 1 0 auto; + flex: 1 0 auto; + } + } diff --git a/website/js/vendor/flatpickr/types/globals.d.ts b/website/js/vendor/flatpickr/types/globals.d.ts new file mode 100644 index 0000000..a36e45b --- /dev/null +++ b/website/js/vendor/flatpickr/types/globals.d.ts @@ -0,0 +1,20 @@ +import { Options } from "./options"; +import { Instance, FlatpickrFn } from "./instance"; +declare global { + interface HTMLElement { + flatpickr: (config?: Options) => Instance; + _flatpickr?: Instance; + } + interface NodeList { + flatpickr: (config?: Options) => Instance | Instance[]; + } + interface HTMLCollection { + flatpickr: (config?: Options) => Instance | Instance[]; + } + interface Window { + flatpickr: FlatpickrFn; + } + interface Date { + fp_incr: (n: number) => Date; + } +} diff --git a/website/js/vendor/flatpickr/types/instance.d.ts b/website/js/vendor/flatpickr/types/instance.d.ts new file mode 100644 index 0000000..e274274 --- /dev/null +++ b/website/js/vendor/flatpickr/types/instance.d.ts @@ -0,0 +1,116 @@ +import { DateOption, Options, ParsedOptions } from "./options"; +import { Locale, CustomLocale, key as LocaleKey } from "./locale"; +import { RevFormat, Formats, TokenRegex } from "../utils/formatting"; +export interface Elements { + element: HTMLElement; + input: HTMLInputElement; + altInput?: HTMLInputElement; + _input: HTMLInputElement; + mobileInput?: HTMLInputElement; + mobileFormatStr?: string; + selectedDateElem?: DayElement; + todayDateElem?: DayElement; + _positionElement: HTMLElement; + weekdayContainer: HTMLDivElement; + calendarContainer: HTMLDivElement; + innerContainer?: HTMLDivElement; + rContainer?: HTMLDivElement; + daysContainer?: HTMLDivElement; + days: HTMLDivElement; + weekWrapper?: HTMLDivElement; + weekNumbers?: HTMLDivElement; + monthNav: HTMLDivElement; + monthsDropdownContainer: HTMLSelectElement; + yearElements: HTMLInputElement[]; + monthElements: HTMLSpanElement[]; + currentYearElement: HTMLInputElement; + currentMonthElement: HTMLSpanElement; + _hidePrevMonthArrow: boolean; + _hideNextMonthArrow: boolean; + prevMonthNav: HTMLElement; + nextMonthNav: HTMLElement; + timeContainer?: HTMLDivElement; + hourElement?: HTMLInputElement; + minuteElement?: HTMLInputElement; + secondElement?: HTMLInputElement; + amPM?: HTMLSpanElement; + pluginElements: Node[]; +} +export interface Formatting { + revFormat: RevFormat; + formats: Formats; + tokenRegex: TokenRegex; +} +export declare type Instance = Elements & Formatting & { + minRangeDate?: Date; + maxRangeDate?: Date; + now: Date; + latestSelectedDateObj?: Date; + _selectedDateObj?: Date; + selectedDates: Date[]; + _initialDate: Date; + config: ParsedOptions; + loadedPlugins: string[]; + l10n: Locale; + currentYear: number; + currentMonth: number; + isOpen: boolean; + isMobile: boolean; + minDateHasTime: boolean; + maxDateHasTime: boolean; + changeMonth: (value: number, isOffset?: boolean, fromKeyboard?: boolean) => void; + changeYear: (year: number) => void; + clear: (emitChangeEvent?: boolean, toInitial?: boolean) => void; + close: () => void; + destroy: () => void; + isEnabled: (date: DateOption, timeless?: boolean) => boolean; + jumpToDate: (date?: DateOption, triggerChange?: boolean) => void; + open: (e?: FocusEvent | MouseEvent, positionElement?: HTMLElement) => void; + redraw: () => void; + set: (option: keyof Options | { + [k in keyof Options]?: Options[k]; + }, value?: any) => void; + setDate: (date: DateOption | DateOption[], triggerChange?: boolean, format?: string) => void; + toggle: () => void; + pad: (num: string | number) => string; + parseDate: (date: Date | string | number, givenFormat?: string, timeless?: boolean) => Date | undefined; + formatDate: (dateObj: Date, frmt: string) => string; + _handlers: { + event: string; + element: Element; + handler: (e?: Event) => void; + options?: { + capture?: boolean; + }; + }[]; + _bind: (element: E | E[], event: string | string[], handler: (e?: any) => void) => void; + _createElement: (tag: keyof HTMLElementTagNameMap, className: string, content?: string) => E; + _setHoursFromDate: (date: Date) => void; + _debouncedChange: () => void; + __hideNextMonthArrow: boolean; + __hidePrevMonthArrow: boolean; + _positionCalendar: (customPositionElement?: HTMLElement) => void; + utils: { + getDaysInMonth: (month?: number, year?: number) => number; + }; +}; +export interface FlatpickrFn { + (selector: Node, config?: Options): Instance; + (selector: ArrayLike, config?: Options): Instance[]; + (selector: string, config?: Options): Instance | Instance[]; + defaultConfig: Partial; + l10ns: { + [k in LocaleKey]?: CustomLocale; + } & { + default: Locale; + }; + localize: (l10n: CustomLocale) => void; + setDefaults: (config: Options) => void; + parseDate: (date: DateOption, format?: string, timeless?: boolean) => Date | undefined; + formatDate: (date: Date, format: string) => string; + compareDates: (date1: Date, date2: Date, timeless?: boolean) => number; +} +export declare type DayElement = HTMLSpanElement & { + dateObj: Date; + $i: number; +}; diff --git a/website/js/vendor/flatpickr/types/locale.d.ts b/website/js/vendor/flatpickr/types/locale.d.ts new file mode 100644 index 0000000..86ad582 --- /dev/null +++ b/website/js/vendor/flatpickr/types/locale.d.ts @@ -0,0 +1,46 @@ +export declare type Locale = { + weekdays: { + shorthand: [string, string, string, string, string, string, string]; + longhand: [string, string, string, string, string, string, string]; + }; + months: { + shorthand: [string, string, string, string, string, string, string, string, string, string, string, string]; + longhand: [string, string, string, string, string, string, string, string, string, string, string, string]; + }; + daysInMonth: [number, number, number, number, number, number, number, number, number, number, number, number]; + firstDayOfWeek: number; + ordinal: (nth: number) => string; + rangeSeparator: string; + weekAbbreviation: string; + scrollTitle: string; + toggleTitle: string; + amPM: [string, string]; + yearAriaLabel: string; + monthAriaLabel: string; + hourAriaLabel: string; + minuteAriaLabel: string; + time_24hr: boolean; +}; +export declare type CustomLocale = { + ordinal?: Locale["ordinal"]; + daysInMonth?: Locale["daysInMonth"]; + firstDayOfWeek?: Locale["firstDayOfWeek"]; + rangeSeparator?: Locale["rangeSeparator"]; + weekAbbreviation?: Locale["weekAbbreviation"]; + toggleTitle?: Locale["toggleTitle"]; + scrollTitle?: Locale["scrollTitle"]; + yearAriaLabel?: string; + hourAriaLabel?: string; + minuteAriaLabel?: string; + amPM?: Locale["amPM"]; + time_24hr?: Locale["time_24hr"]; + weekdays: { + shorthand: [string, string, string, string, string, string, string]; + longhand: [string, string, string, string, string, string, string]; + }; + months: { + shorthand: [string, string, string, string, string, string, string, string, string, string, string, string]; + longhand: [string, string, string, string, string, string, string, string, string, string, string, string]; + }; +}; +export declare type key = "ar" | "at" | "az" | "be" | "bg" | "bn" | "bs" | "ca" | "cat" | "cs" | "cy" | "da" | "de" | "default" | "en" | "eo" | "es" | "et" | "fa" | "fi" | "fo" | "fr" | "gr" | "he" | "hi" | "hr" | "hu" | "id" | "is" | "it" | "ja" | "ka" | "ko" | "km" | "kz" | "lt" | "lv" | "mk" | "mn" | "ms" | "my" | "nl" | "no" | "pa" | "pl" | "pt" | "ro" | "ru" | "si" | "sk" | "sl" | "sq" | "sr" | "sv" | "th" | "tr" | "uk" | "vn" | "zh" | "uz" | "uz_latn" | "zh_tw"; diff --git a/website/js/vendor/flatpickr/types/options.d.ts b/website/js/vendor/flatpickr/types/options.d.ts new file mode 100644 index 0000000..f62d10e --- /dev/null +++ b/website/js/vendor/flatpickr/types/options.d.ts @@ -0,0 +1,148 @@ +import { Instance } from "./instance"; +import { CustomLocale, key as LocaleKey, Locale } from "./locale"; +export declare type DateOption = Date | string | number; +export declare type DateRangeLimit = { + from: D; + to: D; +}; +export declare type DateLimit = D | DateRangeLimit | ((date: Date) => boolean); +export declare type Hook = (dates: Date[], currentDateString: string, self: Instance, data?: any) => void; +export declare type HookKey = "onChange" | "onClose" | "onDayCreate" | "onDestroy" | "onKeyDown" | "onMonthChange" | "onOpen" | "onParseConfig" | "onReady" | "onValueUpdate" | "onYearChange" | "onPreCalendarPosition"; +export declare const HOOKS: HookKey[]; +export declare type Plugin = (fp: Instance & E) => Options; +export interface BaseOptions { + allowInput: boolean; + allowInvalidPreload: boolean; + altFormat: string; + altInput: boolean; + altInputClass: string; + animate: boolean; + appendTo: HTMLElement; + ariaDateFormat: string; + autoFillDefaultTime: boolean; + clickOpens: boolean; + closeOnSelect: boolean; + conjunction: string; + dateFormat: string; + defaultDate: DateOption | DateOption[]; + defaultHour: number; + defaultMinute: number; + defaultSeconds: number; + disable: DateLimit[]; + disableMobile: boolean; + enable: DateLimit[]; + enableSeconds: boolean; + enableTime: boolean; + errorHandler: (e: Error) => void; + formatDate: (date: Date, format: string, locale: Locale) => string; + getWeek: (date: Date) => string | number; + hourIncrement: number; + ignoredFocusElements: HTMLElement[]; + inline: boolean; + locale: LocaleKey | CustomLocale; + maxDate: DateOption; + maxTime: DateOption; + minDate: DateOption; + minTime: DateOption; + minuteIncrement: number; + mode: "single" | "multiple" | "range" | "time"; + monthSelectorType: "dropdown" | "static"; + nextArrow: string; + noCalendar: boolean; + now?: DateOption; + onChange: Hook | Hook[]; + onClose: Hook | Hook[]; + onDayCreate: Hook | Hook[]; + onDestroy: Hook | Hook[]; + onKeyDown: Hook | Hook[]; + onMonthChange: Hook | Hook[]; + onOpen: Hook | Hook[]; + onParseConfig: Hook | Hook[]; + onReady: Hook | Hook[]; + onValueUpdate: Hook | Hook[]; + onYearChange: Hook | Hook[]; + onPreCalendarPosition: Hook | Hook[]; + parseDate: (date: string, format: string) => Date; + plugins: Plugin[]; + position: "auto" | "above" | "below"; + positionElement: Element; + prevArrow: string; + shorthandCurrentMonth: boolean; + static: boolean; + showMonths?: number; + time_24hr: boolean; + weekNumbers: boolean; + wrap: boolean; +} +export declare type Options = Partial; +export interface ParsedOptions { + _disable: DateLimit[]; + _enable: DateLimit[]; + _maxDate?: Date; + _maxTime?: Date; + _minDate?: Date; + _minTime?: Date; + allowInput: boolean; + allowInvalidPreload: boolean; + altFormat: string; + altInput: boolean; + altInputClass: string; + animate: boolean; + appendTo?: HTMLElement; + ariaDateFormat: string; + autoFillDefaultTime: boolean; + clickOpens: boolean; + closeOnSelect: boolean; + conjunction: string; + dateFormat: string; + defaultDate?: Date | Date[]; + defaultHour: number; + defaultMinute: number; + defaultSeconds: number; + disable: DateLimit[]; + disableMobile: boolean; + enable: DateLimit[]; + enableSeconds: boolean; + enableTime: boolean; + errorHandler: (err: Error) => void; + formatDate?: Options["formatDate"]; + getWeek: (date: Date) => string | number; + hourIncrement: number; + ignoredFocusElements: HTMLElement[]; + inline: boolean; + locale: LocaleKey | CustomLocale; + maxDate?: Date; + maxTime?: Date; + minDate?: Date; + minTime?: Date; + minuteIncrement: number; + mode: BaseOptions["mode"]; + monthSelectorType: string; + nextArrow: string; + noCalendar: boolean; + now: Date; + onChange: Hook[]; + onClose: Hook[]; + onDayCreate: Hook[]; + onDestroy: Hook[]; + onKeyDown: Hook[]; + onMonthChange: Hook[]; + onOpen: Hook[]; + onParseConfig: Hook[]; + onReady: Hook[]; + onValueUpdate: Hook[]; + onYearChange: Hook[]; + onPreCalendarPosition: Hook[]; + parseDate?: BaseOptions["parseDate"]; + plugins: Plugin[]; + position: BaseOptions["position"]; + positionElement?: HTMLElement; + prevArrow: string; + shorthandCurrentMonth: boolean; + showMonths: number; + static: boolean; + time_24hr: boolean; + weekNumbers: boolean; + wrap: boolean; +} +export declare const defaults: ParsedOptions; diff --git a/website/js/vendor/flatpickr/typings.d.ts b/website/js/vendor/flatpickr/typings.d.ts new file mode 100644 index 0000000..2c9c27d --- /dev/null +++ b/website/js/vendor/flatpickr/typings.d.ts @@ -0,0 +1,40 @@ +import { FlatpickrFn } from "./types/instance"; +import { Instance as _Instance } from "./types/instance"; +import { + Options as _Options, + Hook as _Hook, + HookKey as _HookKey, + ParsedOptions as _ParsedOptions, + DateLimit as _DateLimit, + DateOption as _DateOption, + DateRangeLimit as _DateRangeLimit, + Plugin as _Plugin, +} from "./types/options"; + +import { + Locale as _Locale, + CustomLocale as _CustomLocale, + key as _LocaleKey, +} from "./types/locale"; + +declare var flatpickr: FlatpickrFn; + +declare namespace flatpickr { + export type Instance = _Instance; + export type CustomLocale = _CustomLocale; + export type Locale = _Locale; + + export namespace Options { + export type Options = _Options; + export type Hook = _Hook; + export type HookKey = _HookKey; + export type ParsedOptions = _ParsedOptions; + export type DateLimit = _DateLimit; + export type DateOption = _DateOption; + export type DateRangeLimit = _DateRangeLimit; + export type Plugin = _Plugin; + export type LocaleKey = _LocaleKey; + } +} + +export default flatpickr; diff --git a/website/js/vendor/flatpickr/utils/dates.d.ts b/website/js/vendor/flatpickr/utils/dates.d.ts new file mode 100644 index 0000000..fc30798 --- /dev/null +++ b/website/js/vendor/flatpickr/utils/dates.d.ts @@ -0,0 +1,18 @@ +import { Locale } from "../types/locale"; +import { ParsedOptions } from "../types/options"; +export interface FormatterArgs { + config?: ParsedOptions; + l10n?: Locale; + isMobile?: boolean; +} +export declare const createDateFormatter: ({ config, l10n, isMobile, }: FormatterArgs) => (dateObj: Date, frmt: string, overrideLocale?: Locale | undefined) => string; +export declare const createDateParser: ({ config, l10n }: { + config?: ParsedOptions | undefined; + l10n?: Locale | undefined; +}) => (date: Date | string | number, givenFormat?: string | undefined, timeless?: boolean | undefined, customLocale?: Locale | undefined) => Date | undefined; +export declare function compareDates(date1: Date, date2: Date, timeless?: boolean): number; +export declare function compareTimes(date1: Date, date2: Date): number; +export declare const isBetween: (ts: number, ts1: number, ts2: number) => boolean; +export declare const duration: { + DAY: number; +}; diff --git a/website/js/vendor/flatpickr/utils/dom.d.ts b/website/js/vendor/flatpickr/utils/dom.d.ts new file mode 100644 index 0000000..b15f309 --- /dev/null +++ b/website/js/vendor/flatpickr/utils/dom.d.ts @@ -0,0 +1,6 @@ +export declare function toggleClass(elem: HTMLElement, className: string, bool: boolean): void; +export declare function createElement(tag: keyof HTMLElementTagNameMap, className: string, content?: string): T; +export declare function clearNode(node: HTMLElement): void; +export declare function findParent(node: Element, condition: (n: Element) => boolean): Element | undefined; +export declare function createNumberInput(inputClassName: string, opts?: Record): HTMLDivElement; +export declare function getEventTarget(event: Event): EventTarget | null; diff --git a/website/js/vendor/flatpickr/utils/formatting.d.ts b/website/js/vendor/flatpickr/utils/formatting.d.ts new file mode 100644 index 0000000..b430324 --- /dev/null +++ b/website/js/vendor/flatpickr/utils/formatting.d.ts @@ -0,0 +1,13 @@ +import { Locale } from "../types/locale"; +import { ParsedOptions } from "../types/options"; +export declare type token = "D" | "F" | "G" | "H" | "J" | "K" | "M" | "S" | "U" | "W" | "Y" | "Z" | "d" | "h" | "i" | "j" | "l" | "m" | "n" | "s" | "u" | "w" | "y"; +export declare const monthToStr: (monthNumber: number, shorthand: boolean, locale: Locale) => string; +export declare type RevFormatFn = (date: Date, data: string, locale: Locale) => Date | void | undefined; +export declare type RevFormat = Record; +export declare const revFormat: RevFormat; +export declare type TokenRegex = { + [k in token]: string; +}; +export declare const tokenRegex: TokenRegex; +export declare type Formats = Record string | number>; +export declare const formats: Formats; diff --git a/website/js/vendor/flatpickr/utils/index.d.ts b/website/js/vendor/flatpickr/utils/index.d.ts new file mode 100644 index 0000000..113069e --- /dev/null +++ b/website/js/vendor/flatpickr/utils/index.d.ts @@ -0,0 +1,8 @@ +export declare const pad: (number: string | number, length?: number) => string; +export declare const int: (bool: boolean) => 1 | 0; +export declare function debounce(func: F, wait: number, immediate?: boolean): (this: Function) => void; +export declare const arrayify: (obj: T | T[]) => T[]; +export declare type IncrementEvent = MouseEvent & { + delta: number; + type: "increment"; +}; diff --git a/website/js/vendor/flatpickr/utils/polyfills.d.ts b/website/js/vendor/flatpickr/utils/polyfills.d.ts new file mode 100644 index 0000000..e69de29 diff --git a/website/js/vendor/moment/moment-with-locales.min.js b/website/js/vendor/moment/moment-with-locales.min.js new file mode 100644 index 0000000..02cd72b --- /dev/null +++ b/website/js/vendor/moment/moment-with-locales.min.js @@ -0,0 +1 @@ +!function(e,a){"object"==typeof exports&&"undefined"!=typeof module?module.exports=a():"function"==typeof define&&define.amd?define(a):e.moment=a()}(this,function(){"use strict";var e,n;function l(){return e.apply(null,arguments)}function _(e){return e instanceof Array||"[object Array]"===Object.prototype.toString.call(e)}function i(e){return null!=e&&"[object Object]"===Object.prototype.toString.call(e)}function o(e){return void 0===e}function m(e){return"number"==typeof e||"[object Number]"===Object.prototype.toString.call(e)}function u(e){return e instanceof Date||"[object Date]"===Object.prototype.toString.call(e)}function M(e,a){var t,s=[];for(t=0;t>>0,s=0;sTe(e)?(d=e+1,_-Te(e)):(d=e,_),{year:d,dayOfYear:r}}function Ie(e,a,t){var s,n,d=Ne(e.year(),a,t),r=Math.floor((e.dayOfYear()-d-1)/7)+1;return r<1?s=r+Ce(n=e.year()-1,a,t):r>Ce(e.year(),a,t)?(s=r-Ce(e.year(),a,t),n=e.year()+1):(n=e.year(),s=r),{week:s,year:n}}function Ce(e,a,t){var s=Ne(e,a,t),n=Ne(e+1,a,t);return(Te(e)-s+n)/7}I("w",["ww",2],"wo","week"),I("W",["WW",2],"Wo","isoWeek"),P("week","w"),P("isoWeek","W"),A("week",5),A("isoWeek",5),ie("w",B),ie("ww",B,V),ie("W",B),ie("WW",B,V),Me(["w","ww","W","WW"],function(e,a,t,s){a[s.substr(0,1)]=g(e)});I("d",0,"do","day"),I("dd",0,0,function(e){return this.localeData().weekdaysMin(this,e)}),I("ddd",0,0,function(e){return this.localeData().weekdaysShort(this,e)}),I("dddd",0,0,function(e){return this.localeData().weekdays(this,e)}),I("e",0,0,"weekday"),I("E",0,0,"isoWeekday"),P("day","d"),P("weekday","e"),P("isoWeekday","E"),A("day",11),A("weekday",11),A("isoWeekday",11),ie("d",B),ie("e",B),ie("E",B),ie("dd",function(e,a){return a.weekdaysMinRegex(e)}),ie("ddd",function(e,a){return a.weekdaysShortRegex(e)}),ie("dddd",function(e,a){return a.weekdaysRegex(e)}),Me(["dd","ddd","dddd"],function(e,a,t,s){var n=t._locale.weekdaysParse(e,s,t._strict);null!=n?a.d=n:Y(t).invalidWeekday=e}),Me(["d","e","E"],function(e,a,t,s){a[s]=g(e)});var Ge="Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_");var Ue="Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_");var Ve="Su_Mo_Tu_We_Th_Fr_Sa".split("_");var Ke=re;var $e=re;var Ze=re;function Be(){function e(e,a){return a.length-e.length}var a,t,s,n,d,r=[],_=[],i=[],o=[];for(a=0;a<7;a++)t=c([2e3,1]).day(a),s=this.weekdaysMin(t,""),n=this.weekdaysShort(t,""),d=this.weekdays(t,""),r.push(s),_.push(n),i.push(d),o.push(s),o.push(n),o.push(d);for(r.sort(e),_.sort(e),i.sort(e),o.sort(e),a=0;a<7;a++)_[a]=me(_[a]),i[a]=me(i[a]),o[a]=me(o[a]);this._weekdaysRegex=new RegExp("^("+o.join("|")+")","i"),this._weekdaysShortRegex=this._weekdaysRegex,this._weekdaysMinRegex=this._weekdaysRegex,this._weekdaysStrictRegex=new RegExp("^("+i.join("|")+")","i"),this._weekdaysShortStrictRegex=new RegExp("^("+_.join("|")+")","i"),this._weekdaysMinStrictRegex=new RegExp("^("+r.join("|")+")","i")}function qe(){return this.hours()%12||12}function Qe(e,a){I(e,0,0,function(){return this.localeData().meridiem(this.hours(),this.minutes(),a)})}function Xe(e,a){return a._meridiemParse}I("H",["HH",2],0,"hour"),I("h",["hh",2],0,qe),I("k",["kk",2],0,function(){return this.hours()||24}),I("hmm",0,0,function(){return""+qe.apply(this)+F(this.minutes(),2)}),I("hmmss",0,0,function(){return""+qe.apply(this)+F(this.minutes(),2)+F(this.seconds(),2)}),I("Hmm",0,0,function(){return""+this.hours()+F(this.minutes(),2)}),I("Hmmss",0,0,function(){return""+this.hours()+F(this.minutes(),2)+F(this.seconds(),2)}),Qe("a",!0),Qe("A",!1),P("hour","h"),A("hour",13),ie("a",Xe),ie("A",Xe),ie("H",B),ie("h",B),ie("k",B),ie("HH",B,V),ie("hh",B,V),ie("kk",B,V),ie("hmm",q),ie("hmmss",Q),ie("Hmm",q),ie("Hmmss",Q),le(["H","HH"],Ye),le(["k","kk"],function(e,a,t){var s=g(e);a[Ye]=24===s?0:s}),le(["a","A"],function(e,a,t){t._isPm=t._locale.isPM(e),t._meridiem=e}),le(["h","hh"],function(e,a,t){a[Ye]=g(e),Y(t).bigHour=!0}),le("hmm",function(e,a,t){var s=e.length-2;a[Ye]=g(e.substr(0,s)),a[ye]=g(e.substr(s)),Y(t).bigHour=!0}),le("hmmss",function(e,a,t){var s=e.length-4,n=e.length-2;a[Ye]=g(e.substr(0,s)),a[ye]=g(e.substr(s,2)),a[fe]=g(e.substr(n)),Y(t).bigHour=!0}),le("Hmm",function(e,a,t){var s=e.length-2;a[Ye]=g(e.substr(0,s)),a[ye]=g(e.substr(s))}),le("Hmmss",function(e,a,t){var s=e.length-4,n=e.length-2;a[Ye]=g(e.substr(0,s)),a[ye]=g(e.substr(s,2)),a[fe]=g(e.substr(n))});var ea,aa=He("Hours",!0),ta={calendar:{sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"},longDateFormat:{LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"},invalidDate:"Invalid date",ordinal:"%d",dayOfMonthOrdinalParse:/\d{1,2}/,relativeTime:{future:"in %s",past:"%s ago",s:"a few seconds",ss:"%d seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"},months:Pe,monthsShort:Oe,week:{dow:0,doy:6},weekdays:Ge,weekdaysMin:Ve,weekdaysShort:Ue,meridiemParse:/[ap]\.?m?\.?/i},sa={},na={};function da(e){return e?e.toLowerCase().replace("_","-"):e}function ra(e){var a=null;if(!sa[e]&&"undefined"!=typeof module&&module&&module.exports)try{a=ea._abbr,require("./locale/"+e),_a(a)}catch(e){}return sa[e]}function _a(e,a){var t;return e&&((t=o(a)?oa(e):ia(e,a))?ea=t:"undefined"!=typeof console&&console.warn&&console.warn("Locale "+e+" not found. Did you forget to load it?")),ea._abbr}function ia(e,a){if(null===a)return delete sa[e],null;var t,s=ta;if(a.abbr=e,null!=sa[e])H("defineLocaleOverride","use moment.updateLocale(localeName, config) to change an existing locale. moment.defineLocale(localeName, config) should only be used for creating a new locale See http://momentjs.com/guides/#/warnings/define-locale/ for more info."),s=sa[e]._config;else if(null!=a.parentLocale)if(null!=sa[a.parentLocale])s=sa[a.parentLocale]._config;else{if(null==(t=ra(a.parentLocale)))return na[a.parentLocale]||(na[a.parentLocale]=[]),na[a.parentLocale].push({name:e,config:a}),null;s=t._config}return sa[e]=new j(b(s,a)),na[e]&&na[e].forEach(function(e){ia(e.name,e.config)}),_a(e),sa[e]}function oa(e){var a;if(e&&e._locale&&e._locale._abbr&&(e=e._locale._abbr),!e)return ea;if(!_(e)){if(a=ra(e))return a;e=[e]}return function(e){for(var a,t,s,n,d=0;d=a&&r(n,t,!0)>=a-1)break;a--}d++}return ea}(e)}function ma(e){var a,t=e._a;return t&&-2===Y(e).overflow&&(a=t[Le]<0||11je(t[he],t[Le])?ce:t[Ye]<0||24Ce(t,d,r)?Y(e)._overflowWeeks=!0:null!=i?Y(e)._overflowWeekday=!0:(_=Re(t,s,n,d,r),e._a[he]=_.year,e._dayOfYear=_.dayOfYear)}(e),null!=e._dayOfYear&&(d=ua(e._a[he],s[he]),(e._dayOfYear>Te(d)||0===e._dayOfYear)&&(Y(e)._overflowDayOfYear=!0),t=Je(d,0,e._dayOfYear),e._a[Le]=t.getUTCMonth(),e._a[ce]=t.getUTCDate()),a=0;a<3&&null==e._a[a];++a)e._a[a]=r[a]=s[a];for(;a<7;a++)e._a[a]=r[a]=null==e._a[a]?2===a?1:0:e._a[a];24===e._a[Ye]&&0===e._a[ye]&&0===e._a[fe]&&0===e._a[ke]&&(e._nextDay=!0,e._a[Ye]=0),e._d=(e._useUTC?Je:function(e,a,t,s,n,d,r){var _=new Date(e,a,t,s,n,d,r);return e<100&&0<=e&&isFinite(_.getFullYear())&&_.setFullYear(e),_}).apply(null,r),n=e._useUTC?e._d.getUTCDay():e._d.getDay(),null!=e._tzm&&e._d.setUTCMinutes(e._d.getUTCMinutes()-e._tzm),e._nextDay&&(e._a[Ye]=24),e._w&&void 0!==e._w.d&&e._w.d!==n&&(Y(e).weekdayMismatch=!0)}}var Ma=/^\s*((?:[+-]\d{6}|\d{4})-(?:\d\d-\d\d|W\d\d-\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?::\d\d(?::\d\d(?:[.,]\d+)?)?)?)([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?$/,ha=/^\s*((?:[+-]\d{6}|\d{4})(?:\d\d\d\d|W\d\d\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?:\d\d(?:\d\d(?:[.,]\d+)?)?)?)([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?$/,La=/Z|[+-]\d\d(?::?\d\d)?/,ca=[["YYYYYY-MM-DD",/[+-]\d{6}-\d\d-\d\d/],["YYYY-MM-DD",/\d{4}-\d\d-\d\d/],["GGGG-[W]WW-E",/\d{4}-W\d\d-\d/],["GGGG-[W]WW",/\d{4}-W\d\d/,!1],["YYYY-DDD",/\d{4}-\d{3}/],["YYYY-MM",/\d{4}-\d\d/,!1],["YYYYYYMMDD",/[+-]\d{10}/],["YYYYMMDD",/\d{8}/],["GGGG[W]WWE",/\d{4}W\d{3}/],["GGGG[W]WW",/\d{4}W\d{2}/,!1],["YYYYDDD",/\d{7}/]],Ya=[["HH:mm:ss.SSSS",/\d\d:\d\d:\d\d\.\d+/],["HH:mm:ss,SSSS",/\d\d:\d\d:\d\d,\d+/],["HH:mm:ss",/\d\d:\d\d:\d\d/],["HH:mm",/\d\d:\d\d/],["HHmmss.SSSS",/\d\d\d\d\d\d\.\d+/],["HHmmss,SSSS",/\d\d\d\d\d\d,\d+/],["HHmmss",/\d\d\d\d\d\d/],["HHmm",/\d\d\d\d/],["HH",/\d\d/]],ya=/^\/?Date\((\-?\d+)/i;function fa(e){var a,t,s,n,d,r,_=e._i,i=Ma.exec(_)||ha.exec(_);if(i){for(Y(e).iso=!0,a=0,t=ca.length;at.valueOf():t.valueOf()this.clone().month(0).utcOffset()||this.utcOffset()>this.clone().month(5).utcOffset()},it.isLocal=function(){return!!this.isValid()&&!this._isUTC},it.isUtcOffset=function(){return!!this.isValid()&&this._isUTC},it.isUtc=Na,it.isUTC=Na,it.zoneAbbr=function(){return this._isUTC?"UTC":""},it.zoneName=function(){return this._isUTC?"Coordinated Universal Time":""},it.dates=t("dates accessor is deprecated. Use date instead.",tt),it.months=t("months accessor is deprecated. Use month instead",Ee),it.years=t("years accessor is deprecated. Use year instead",ve),it.zone=t("moment().zone is deprecated, use moment().utcOffset instead. http://momentjs.com/guides/#/warnings/zone/",function(e,a){return null!=e?("string"!=typeof e&&(e=-e),this.utcOffset(e,a),this):-this.utcOffset()}),it.isDSTShifted=t("isDSTShifted is deprecated. See http://momentjs.com/guides/#/warnings/dst-shifted/ for more information",function(){if(!o(this._isDSTShifted))return this._isDSTShifted;var e={};if(k(e,this),(e=wa(e))._a){var a=e._isUTC?c(e._a):Ha(e._a);this._isDSTShifted=this.isValid()&&0>>0,s=0;sDe(e)?(r=e+1,o-De(e)):(r=e,o),{year:r,dayOfYear:a}}function Ie(e,t,n){var s,i,r=Ve(e.year(),t,n),a=Math.floor((e.dayOfYear()-r-1)/7)+1;return a<1?s=a+Ae(i=e.year()-1,t,n):a>Ae(e.year(),t,n)?(s=a-Ae(e.year(),t,n),i=e.year()+1):(i=e.year(),s=a),{week:s,year:i}}function Ae(e,t,n){var s=Ve(e,t,n),i=Ve(e+1,t,n);return(De(e)-s+i)/7}I("w",["ww",2],"wo","week"),I("W",["WW",2],"Wo","isoWeek"),H("week","w"),H("isoWeek","W"),L("week",5),L("isoWeek",5),ue("w",B),ue("ww",B,z),ue("W",B),ue("WW",B,z),fe(["w","ww","W","WW"],function(e,t,n,s){t[s.substr(0,1)]=k(e)});I("d",0,"do","day"),I("dd",0,0,function(e){return this.localeData().weekdaysMin(this,e)}),I("ddd",0,0,function(e){return this.localeData().weekdaysShort(this,e)}),I("dddd",0,0,function(e){return this.localeData().weekdays(this,e)}),I("e",0,0,"weekday"),I("E",0,0,"isoWeekday"),H("day","d"),H("weekday","e"),H("isoWeekday","E"),L("day",11),L("weekday",11),L("isoWeekday",11),ue("d",B),ue("e",B),ue("E",B),ue("dd",function(e,t){return t.weekdaysMinRegex(e)}),ue("ddd",function(e,t){return t.weekdaysShortRegex(e)}),ue("dddd",function(e,t){return t.weekdaysRegex(e)}),fe(["dd","ddd","dddd"],function(e,t,n,s){var i=n._locale.weekdaysParse(e,s,n._strict);null!=i?t.d=i:g(n).invalidWeekday=e}),fe(["d","e","E"],function(e,t,n,s){t[s]=k(e)});var je="Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_");var Ze="Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_");var ze="Su_Mo_Tu_We_Th_Fr_Sa".split("_");var $e=ae;var qe=ae;var Je=ae;function Be(){function e(e,t){return t.length-e.length}var t,n,s,i,r,a=[],o=[],u=[],l=[];for(t=0;t<7;t++)n=y([2e3,1]).day(t),s=this.weekdaysMin(n,""),i=this.weekdaysShort(n,""),r=this.weekdays(n,""),a.push(s),o.push(i),u.push(r),l.push(s),l.push(i),l.push(r);for(a.sort(e),o.sort(e),u.sort(e),l.sort(e),t=0;t<7;t++)o[t]=de(o[t]),u[t]=de(u[t]),l[t]=de(l[t]);this._weekdaysRegex=new RegExp("^("+l.join("|")+")","i"),this._weekdaysShortRegex=this._weekdaysRegex,this._weekdaysMinRegex=this._weekdaysRegex,this._weekdaysStrictRegex=new RegExp("^("+u.join("|")+")","i"),this._weekdaysShortStrictRegex=new RegExp("^("+o.join("|")+")","i"),this._weekdaysMinStrictRegex=new RegExp("^("+a.join("|")+")","i")}function Qe(){return this.hours()%12||12}function Xe(e,t){I(e,0,0,function(){return this.localeData().meridiem(this.hours(),this.minutes(),t)})}function Ke(e,t){return t._meridiemParse}I("H",["HH",2],0,"hour"),I("h",["hh",2],0,Qe),I("k",["kk",2],0,function(){return this.hours()||24}),I("hmm",0,0,function(){return""+Qe.apply(this)+U(this.minutes(),2)}),I("hmmss",0,0,function(){return""+Qe.apply(this)+U(this.minutes(),2)+U(this.seconds(),2)}),I("Hmm",0,0,function(){return""+this.hours()+U(this.minutes(),2)}),I("Hmmss",0,0,function(){return""+this.hours()+U(this.minutes(),2)+U(this.seconds(),2)}),Xe("a",!0),Xe("A",!1),H("hour","h"),L("hour",13),ue("a",Ke),ue("A",Ke),ue("H",B),ue("h",B),ue("k",B),ue("HH",B,z),ue("hh",B,z),ue("kk",B,z),ue("hmm",Q),ue("hmmss",X),ue("Hmm",Q),ue("Hmmss",X),ce(["H","HH"],ge),ce(["k","kk"],function(e,t,n){var s=k(e);t[ge]=24===s?0:s}),ce(["a","A"],function(e,t,n){n._isPm=n._locale.isPM(e),n._meridiem=e}),ce(["h","hh"],function(e,t,n){t[ge]=k(e),g(n).bigHour=!0}),ce("hmm",function(e,t,n){var s=e.length-2;t[ge]=k(e.substr(0,s)),t[pe]=k(e.substr(s)),g(n).bigHour=!0}),ce("hmmss",function(e,t,n){var s=e.length-4,i=e.length-2;t[ge]=k(e.substr(0,s)),t[pe]=k(e.substr(s,2)),t[ve]=k(e.substr(i)),g(n).bigHour=!0}),ce("Hmm",function(e,t,n){var s=e.length-2;t[ge]=k(e.substr(0,s)),t[pe]=k(e.substr(s))}),ce("Hmmss",function(e,t,n){var s=e.length-4,i=e.length-2;t[ge]=k(e.substr(0,s)),t[pe]=k(e.substr(s,2)),t[ve]=k(e.substr(i))});var et,tt=Te("Hours",!0),nt={calendar:{sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"},longDateFormat:{LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"},invalidDate:"Invalid date",ordinal:"%d",dayOfMonthOrdinalParse:/\d{1,2}/,relativeTime:{future:"in %s",past:"%s ago",s:"a few seconds",ss:"%d seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"},months:He,monthsShort:Re,week:{dow:0,doy:6},weekdays:je,weekdaysMin:ze,weekdaysShort:Ze,meridiemParse:/[ap]\.?m?\.?/i},st={},it={};function rt(e){return e?e.toLowerCase().replace("_","-"):e}function at(e){var t=null;if(!st[e]&&"undefined"!=typeof module&&module&&module.exports)try{t=et._abbr,require("./locale/"+e),ot(t)}catch(e){}return st[e]}function ot(e,t){var n;return e&&((n=l(t)?lt(e):ut(e,t))?et=n:"undefined"!=typeof console&&console.warn&&console.warn("Locale "+e+" not found. Did you forget to load it?")),et._abbr}function ut(e,t){if(null===t)return delete st[e],null;var n,s=nt;if(t.abbr=e,null!=st[e])T("defineLocaleOverride","use moment.updateLocale(localeName, config) to change an existing locale. moment.defineLocale(localeName, config) should only be used for creating a new locale See http://momentjs.com/guides/#/warnings/define-locale/ for more info."),s=st[e]._config;else if(null!=t.parentLocale)if(null!=st[t.parentLocale])s=st[t.parentLocale]._config;else{if(null==(n=at(t.parentLocale)))return it[t.parentLocale]||(it[t.parentLocale]=[]),it[t.parentLocale].push({name:e,config:t}),null;s=n._config}return st[e]=new P(b(s,t)),it[e]&&it[e].forEach(function(e){ut(e.name,e.config)}),ot(e),st[e]}function lt(e){var t;if(e&&e._locale&&e._locale._abbr&&(e=e._locale._abbr),!e)return et;if(!o(e)){if(t=at(e))return t;e=[e]}return function(e){for(var t,n,s,i,r=0;r=t&&a(i,n,!0)>=t-1)break;t--}r++}return et}(e)}function dt(e){var t,n=e._a;return n&&-2===g(e).overflow&&(t=n[_e]<0||11Pe(n[me],n[_e])?ye:n[ge]<0||24Ae(n,r,a)?g(e)._overflowWeeks=!0:null!=u?g(e)._overflowWeekday=!0:(o=Ee(n,s,i,r,a),e._a[me]=o.year,e._dayOfYear=o.dayOfYear)}(e),null!=e._dayOfYear&&(r=ht(e._a[me],s[me]),(e._dayOfYear>De(r)||0===e._dayOfYear)&&(g(e)._overflowDayOfYear=!0),n=Ge(r,0,e._dayOfYear),e._a[_e]=n.getUTCMonth(),e._a[ye]=n.getUTCDate()),t=0;t<3&&null==e._a[t];++t)e._a[t]=a[t]=s[t];for(;t<7;t++)e._a[t]=a[t]=null==e._a[t]?2===t?1:0:e._a[t];24===e._a[ge]&&0===e._a[pe]&&0===e._a[ve]&&0===e._a[we]&&(e._nextDay=!0,e._a[ge]=0),e._d=(e._useUTC?Ge:function(e,t,n,s,i,r,a){var o=new Date(e,t,n,s,i,r,a);return e<100&&0<=e&&isFinite(o.getFullYear())&&o.setFullYear(e),o}).apply(null,a),i=e._useUTC?e._d.getUTCDay():e._d.getDay(),null!=e._tzm&&e._d.setUTCMinutes(e._d.getUTCMinutes()-e._tzm),e._nextDay&&(e._a[ge]=24),e._w&&void 0!==e._w.d&&e._w.d!==i&&(g(e).weekdayMismatch=!0)}}var ft=/^\s*((?:[+-]\d{6}|\d{4})-(?:\d\d-\d\d|W\d\d-\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?::\d\d(?::\d\d(?:[.,]\d+)?)?)?)([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?$/,mt=/^\s*((?:[+-]\d{6}|\d{4})(?:\d\d\d\d|W\d\d\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?:\d\d(?:\d\d(?:[.,]\d+)?)?)?)([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?$/,_t=/Z|[+-]\d\d(?::?\d\d)?/,yt=[["YYYYYY-MM-DD",/[+-]\d{6}-\d\d-\d\d/],["YYYY-MM-DD",/\d{4}-\d\d-\d\d/],["GGGG-[W]WW-E",/\d{4}-W\d\d-\d/],["GGGG-[W]WW",/\d{4}-W\d\d/,!1],["YYYY-DDD",/\d{4}-\d{3}/],["YYYY-MM",/\d{4}-\d\d/,!1],["YYYYYYMMDD",/[+-]\d{10}/],["YYYYMMDD",/\d{8}/],["GGGG[W]WWE",/\d{4}W\d{3}/],["GGGG[W]WW",/\d{4}W\d{2}/,!1],["YYYYDDD",/\d{7}/]],gt=[["HH:mm:ss.SSSS",/\d\d:\d\d:\d\d\.\d+/],["HH:mm:ss,SSSS",/\d\d:\d\d:\d\d,\d+/],["HH:mm:ss",/\d\d:\d\d:\d\d/],["HH:mm",/\d\d:\d\d/],["HHmmss.SSSS",/\d\d\d\d\d\d\.\d+/],["HHmmss,SSSS",/\d\d\d\d\d\d,\d+/],["HHmmss",/\d\d\d\d\d\d/],["HHmm",/\d\d\d\d/],["HH",/\d\d/]],pt=/^\/?Date\((\-?\d+)/i;function vt(e){var t,n,s,i,r,a,o=e._i,u=ft.exec(o)||mt.exec(o);if(u){for(g(e).iso=!0,t=0,n=yt.length;tn.valueOf():n.valueOf()this.clone().month(0).utcOffset()||this.utcOffset()>this.clone().month(5).utcOffset()},ln.isLocal=function(){return!!this.isValid()&&!this._isUTC},ln.isUtcOffset=function(){return!!this.isValid()&&this._isUTC},ln.isUtc=Vt,ln.isUTC=Vt,ln.zoneAbbr=function(){return this._isUTC?"UTC":""},ln.zoneName=function(){return this._isUTC?"Coordinated Universal Time":""},ln.dates=n("dates accessor is deprecated. Use date instead.",nn),ln.months=n("months accessor is deprecated. Use month instead",Fe),ln.years=n("years accessor is deprecated. Use year instead",Oe),ln.zone=n("moment().zone is deprecated, use moment().utcOffset instead. http://momentjs.com/guides/#/warnings/zone/",function(e,t){return null!=e?("string"!=typeof e&&(e=-e),this.utcOffset(e,t),this):-this.utcOffset()}),ln.isDSTShifted=n("isDSTShifted is deprecated. See http://momentjs.com/guides/#/warnings/dst-shifted/ for more information",function(){if(!l(this._isDSTShifted))return this._isDSTShifted;var e={};if(w(e,this),(e=Yt(e))._a){var t=e._isUTC?y(e._a):Tt(e._a);this._isDSTShifted=this.isValid()&&0': '>', + '"': '"', + "'": ''', + '/': '/', + '`': '`', + '=': '=' + }; + + function escapeHtml (string) { + return String(string).replace(/[&<>"'`=\/]/g, function fromEntityMap (s) { + return entityMap[s]; + }); + } + + var whiteRe = /\s*/; + var spaceRe = /\s+/; + var equalsRe = /\s*=/; + var curlyRe = /\s*\}/; + var tagRe = /#|\^|\/|>|\{|&|=|!/; + + /** + * Breaks up the given `template` string into a tree of tokens. If the `tags` + * argument is given here it must be an array with two string values: the + * opening and closing tags used in the template (e.g. [ "<%", "%>" ]). Of + * course, the default is to use mustaches (i.e. mustache.tags). + * + * A token is an array with at least 4 elements. The first element is the + * mustache symbol that was used inside the tag, e.g. "#" or "&". If the tag + * did not contain a symbol (i.e. {{myValue}}) this element is "name". For + * all text that appears outside a symbol this element is "text". + * + * The second element of a token is its "value". For mustache tags this is + * whatever else was inside the tag besides the opening symbol. For text tokens + * this is the text itself. + * + * The third and fourth elements of the token are the start and end indices, + * respectively, of the token in the original template. + * + * Tokens that are the root node of a subtree contain two more elements: 1) an + * array of tokens in the subtree and 2) the index in the original template at + * which the closing tag for that section begins. + * + * Tokens for partials also contain two more elements: 1) a string value of + * indendation prior to that tag and 2) the index of that tag on that line - + * eg a value of 2 indicates the partial is the third tag on this line. + */ + function parseTemplate (template, tags) { + if (!template) + return []; + var lineHasNonSpace = false; + var sections = []; // Stack to hold section tokens + var tokens = []; // Buffer to hold the tokens + var spaces = []; // Indices of whitespace tokens on the current line + var hasTag = false; // Is there a {{tag}} on the current line? + var nonSpace = false; // Is there a non-space char on the current line? + var indentation = ''; // Tracks indentation for tags that use it + var tagIndex = 0; // Stores a count of number of tags encountered on a line + + // Strips all whitespace tokens array for the current line + // if there was a {{#tag}} on it and otherwise only space. + function stripSpace () { + if (hasTag && !nonSpace) { + while (spaces.length) + delete tokens[spaces.pop()]; + } else { + spaces = []; + } + + hasTag = false; + nonSpace = false; + } + + var openingTagRe, closingTagRe, closingCurlyRe; + function compileTags (tagsToCompile) { + if (typeof tagsToCompile === 'string') + tagsToCompile = tagsToCompile.split(spaceRe, 2); + + if (!isArray(tagsToCompile) || tagsToCompile.length !== 2) + throw new Error('Invalid tags: ' + tagsToCompile); + + openingTagRe = new RegExp(escapeRegExp(tagsToCompile[0]) + '\\s*'); + closingTagRe = new RegExp('\\s*' + escapeRegExp(tagsToCompile[1])); + closingCurlyRe = new RegExp('\\s*' + escapeRegExp('}' + tagsToCompile[1])); + } + + compileTags(tags || mustache.tags); + + var scanner = new Scanner(template); + + var start, type, value, chr, token, openSection; + while (!scanner.eos()) { + start = scanner.pos; + + // Match any text between tags. + value = scanner.scanUntil(openingTagRe); + + if (value) { + for (var i = 0, valueLength = value.length; i < valueLength; ++i) { + chr = value.charAt(i); + + if (isWhitespace(chr)) { + spaces.push(tokens.length); + indentation += chr; + } else { + nonSpace = true; + lineHasNonSpace = true; + indentation += ' '; + } + + tokens.push([ 'text', chr, start, start + 1 ]); + start += 1; + + // Check for whitespace on the current line. + if (chr === '\n') { + stripSpace(); + indentation = ''; + tagIndex = 0; + lineHasNonSpace = false; + } + } + } + + // Match the opening tag. + if (!scanner.scan(openingTagRe)) + break; + + hasTag = true; + + // Get the tag type. + type = scanner.scan(tagRe) || 'name'; + scanner.scan(whiteRe); + + // Get the tag value. + if (type === '=') { + value = scanner.scanUntil(equalsRe); + scanner.scan(equalsRe); + scanner.scanUntil(closingTagRe); + } else if (type === '{') { + value = scanner.scanUntil(closingCurlyRe); + scanner.scan(curlyRe); + scanner.scanUntil(closingTagRe); + type = '&'; + } else { + value = scanner.scanUntil(closingTagRe); + } + + // Match the closing tag. + if (!scanner.scan(closingTagRe)) + throw new Error('Unclosed tag at ' + scanner.pos); + + if (type == '>') { + token = [ type, value, start, scanner.pos, indentation, tagIndex, lineHasNonSpace ]; + } else { + token = [ type, value, start, scanner.pos ]; + } + tagIndex++; + tokens.push(token); + + if (type === '#' || type === '^') { + sections.push(token); + } else if (type === '/') { + // Check section nesting. + openSection = sections.pop(); + + if (!openSection) + throw new Error('Unopened section "' + value + '" at ' + start); + + if (openSection[1] !== value) + throw new Error('Unclosed section "' + openSection[1] + '" at ' + start); + } else if (type === 'name' || type === '{' || type === '&') { + nonSpace = true; + } else if (type === '=') { + // Set the tags for the next time around. + compileTags(value); + } + } + + stripSpace(); + + // Make sure there are no open sections when we're done. + openSection = sections.pop(); + + if (openSection) + throw new Error('Unclosed section "' + openSection[1] + '" at ' + scanner.pos); + + return nestTokens(squashTokens(tokens)); + } + + /** + * Combines the values of consecutive text tokens in the given `tokens` array + * to a single token. + */ + function squashTokens (tokens) { + var squashedTokens = []; + + var token, lastToken; + for (var i = 0, numTokens = tokens.length; i < numTokens; ++i) { + token = tokens[i]; + + if (token) { + if (token[0] === 'text' && lastToken && lastToken[0] === 'text') { + lastToken[1] += token[1]; + lastToken[3] = token[3]; + } else { + squashedTokens.push(token); + lastToken = token; + } + } + } + + return squashedTokens; + } + + /** + * Forms the given array of `tokens` into a nested tree structure where + * tokens that represent a section have two additional items: 1) an array of + * all tokens that appear in that section and 2) the index in the original + * template that represents the end of that section. + */ + function nestTokens (tokens) { + var nestedTokens = []; + var collector = nestedTokens; + var sections = []; + + var token, section; + for (var i = 0, numTokens = tokens.length; i < numTokens; ++i) { + token = tokens[i]; + + switch (token[0]) { + case '#': + case '^': + collector.push(token); + sections.push(token); + collector = token[4] = []; + break; + case '/': + section = sections.pop(); + section[5] = token[2]; + collector = sections.length > 0 ? sections[sections.length - 1][4] : nestedTokens; + break; + default: + collector.push(token); + } + } + + return nestedTokens; + } + + /** + * A simple string scanner that is used by the template parser to find + * tokens in template strings. + */ + function Scanner (string) { + this.string = string; + this.tail = string; + this.pos = 0; + } + + /** + * Returns `true` if the tail is empty (end of string). + */ + Scanner.prototype.eos = function eos () { + return this.tail === ''; + }; + + /** + * Tries to match the given regular expression at the current position. + * Returns the matched text if it can match, the empty string otherwise. + */ + Scanner.prototype.scan = function scan (re) { + var match = this.tail.match(re); + + if (!match || match.index !== 0) + return ''; + + var string = match[0]; + + this.tail = this.tail.substring(string.length); + this.pos += string.length; + + return string; + }; + + /** + * Skips all text until the given regular expression can be matched. Returns + * the skipped string, which is the entire tail if no match can be made. + */ + Scanner.prototype.scanUntil = function scanUntil (re) { + var index = this.tail.search(re), match; + + switch (index) { + case -1: + match = this.tail; + this.tail = ''; + break; + case 0: + match = ''; + break; + default: + match = this.tail.substring(0, index); + this.tail = this.tail.substring(index); + } + + this.pos += match.length; + + return match; + }; + + /** + * Represents a rendering context by wrapping a view object and + * maintaining a reference to the parent context. + */ + function Context (view, parentContext) { + this.view = view; + this.cache = { '.': this.view }; + this.parent = parentContext; + } + + /** + * Creates a new context using the given view with this context + * as the parent. + */ + Context.prototype.push = function push (view) { + return new Context(view, this); + }; + + /** + * Returns the value of the given name in this context, traversing + * up the context hierarchy if the value is absent in this context's view. + */ + Context.prototype.lookup = function lookup (name) { + var cache = this.cache; + + var value; + if (cache.hasOwnProperty(name)) { + value = cache[name]; + } else { + var context = this, intermediateValue, names, index, lookupHit = false; + + while (context) { + if (name.indexOf('.') > 0) { + intermediateValue = context.view; + names = name.split('.'); + index = 0; + + /** + * Using the dot notion path in `name`, we descend through the + * nested objects. + * + * To be certain that the lookup has been successful, we have to + * check if the last object in the path actually has the property + * we are looking for. We store the result in `lookupHit`. + * + * This is specially necessary for when the value has been set to + * `undefined` and we want to avoid looking up parent contexts. + * + * In the case where dot notation is used, we consider the lookup + * to be successful even if the last "object" in the path is + * not actually an object but a primitive (e.g., a string, or an + * integer), because it is sometimes useful to access a property + * of an autoboxed primitive, such as the length of a string. + **/ + while (intermediateValue != null && index < names.length) { + if (index === names.length - 1) + lookupHit = ( + hasProperty(intermediateValue, names[index]) + || primitiveHasOwnProperty(intermediateValue, names[index]) + ); + + intermediateValue = intermediateValue[names[index++]]; + } + } else { + intermediateValue = context.view[name]; + + /** + * Only checking against `hasProperty`, which always returns `false` if + * `context.view` is not an object. Deliberately omitting the check + * against `primitiveHasOwnProperty` if dot notation is not used. + * + * Consider this example: + * ``` + * Mustache.render("The length of a football field is {{#length}}{{length}}{{/length}}.", {length: "100 yards"}) + * ``` + * + * If we were to check also against `primitiveHasOwnProperty`, as we do + * in the dot notation case, then render call would return: + * + * "The length of a football field is 9." + * + * rather than the expected: + * + * "The length of a football field is 100 yards." + **/ + lookupHit = hasProperty(context.view, name); + } + + if (lookupHit) { + value = intermediateValue; + break; + } + + context = context.parent; + } + + cache[name] = value; + } + + if (isFunction(value)) + value = value.call(this.view); + + return value; + }; + + /** + * A Writer knows how to take a stream of tokens and render them to a + * string, given a context. It also maintains a cache of templates to + * avoid the need to parse the same template twice. + */ + function Writer () { + this.templateCache = { + _cache: {}, + set: function set (key, value) { + this._cache[key] = value; + }, + get: function get (key) { + return this._cache[key]; + }, + clear: function clear () { + this._cache = {}; + } + }; + } + + /** + * Clears all cached templates in this writer. + */ + Writer.prototype.clearCache = function clearCache () { + if (typeof this.templateCache !== 'undefined') { + this.templateCache.clear(); + } + }; + + /** + * Parses and caches the given `template` according to the given `tags` or + * `mustache.tags` if `tags` is omitted, and returns the array of tokens + * that is generated from the parse. + */ + Writer.prototype.parse = function parse (template, tags) { + var cache = this.templateCache; + var cacheKey = template + ':' + (tags || mustache.tags).join(':'); + var isCacheEnabled = typeof cache !== 'undefined'; + var tokens = isCacheEnabled ? cache.get(cacheKey) : undefined; + + if (tokens == undefined) { + tokens = parseTemplate(template, tags); + isCacheEnabled && cache.set(cacheKey, tokens); + } + return tokens; + }; + + /** + * High-level method that is used to render the given `template` with + * the given `view`. + * + * The optional `partials` argument may be an object that contains the + * names and templates of partials that are used in the template. It may + * also be a function that is used to load partial templates on the fly + * that takes a single argument: the name of the partial. + * + * If the optional `tags` argument is given here it must be an array with two + * string values: the opening and closing tags used in the template (e.g. + * [ "<%", "%>" ]). The default is to mustache.tags. + */ + Writer.prototype.render = function render (template, view, partials, tags) { + var tokens = this.parse(template, tags); + var context = (view instanceof Context) ? view : new Context(view, undefined); + return this.renderTokens(tokens, context, partials, template, tags); + }; + + /** + * Low-level method that renders the given array of `tokens` using + * the given `context` and `partials`. + * + * Note: The `originalTemplate` is only ever used to extract the portion + * of the original template that was contained in a higher-order section. + * If the template doesn't use higher-order sections, this argument may + * be omitted. + */ + Writer.prototype.renderTokens = function renderTokens (tokens, context, partials, originalTemplate, tags) { + var buffer = ''; + + var token, symbol, value; + for (var i = 0, numTokens = tokens.length; i < numTokens; ++i) { + value = undefined; + token = tokens[i]; + symbol = token[0]; + + if (symbol === '#') value = this.renderSection(token, context, partials, originalTemplate); + else if (symbol === '^') value = this.renderInverted(token, context, partials, originalTemplate); + else if (symbol === '>') value = this.renderPartial(token, context, partials, tags); + else if (symbol === '&') value = this.unescapedValue(token, context); + else if (symbol === 'name') value = this.escapedValue(token, context); + else if (symbol === 'text') value = this.rawValue(token); + + if (value !== undefined) + buffer += value; + } + + return buffer; + }; + + Writer.prototype.renderSection = function renderSection (token, context, partials, originalTemplate) { + var self = this; + var buffer = ''; + var value = context.lookup(token[1]); + + // This function is used to render an arbitrary template + // in the current context by higher-order sections. + function subRender (template) { + return self.render(template, context, partials); + } + + if (!value) return; + + if (isArray(value)) { + for (var j = 0, valueLength = value.length; j < valueLength; ++j) { + buffer += this.renderTokens(token[4], context.push(value[j]), partials, originalTemplate); + } + } else if (typeof value === 'object' || typeof value === 'string' || typeof value === 'number') { + buffer += this.renderTokens(token[4], context.push(value), partials, originalTemplate); + } else if (isFunction(value)) { + if (typeof originalTemplate !== 'string') + throw new Error('Cannot use higher-order sections without the original template'); + + // Extract the portion of the original template that the section contains. + value = value.call(context.view, originalTemplate.slice(token[3], token[5]), subRender); + + if (value != null) + buffer += value; + } else { + buffer += this.renderTokens(token[4], context, partials, originalTemplate); + } + return buffer; + }; + + Writer.prototype.renderInverted = function renderInverted (token, context, partials, originalTemplate) { + var value = context.lookup(token[1]); + + // Use JavaScript's definition of falsy. Include empty arrays. + // See https://github.com/janl/mustache.js/issues/186 + if (!value || (isArray(value) && value.length === 0)) + return this.renderTokens(token[4], context, partials, originalTemplate); + }; + + Writer.prototype.indentPartial = function indentPartial (partial, indentation, lineHasNonSpace) { + var filteredIndentation = indentation.replace(/[^ \t]/g, ''); + var partialByNl = partial.split('\n'); + for (var i = 0; i < partialByNl.length; i++) { + if (partialByNl[i].length && (i > 0 || !lineHasNonSpace)) { + partialByNl[i] = filteredIndentation + partialByNl[i]; + } + } + return partialByNl.join('\n'); + }; + + Writer.prototype.renderPartial = function renderPartial (token, context, partials, tags) { + if (!partials) return; + + var value = isFunction(partials) ? partials(token[1]) : partials[token[1]]; + if (value != null) { + var lineHasNonSpace = token[6]; + var tagIndex = token[5]; + var indentation = token[4]; + var indentedValue = value; + if (tagIndex == 0 && indentation) { + indentedValue = this.indentPartial(value, indentation, lineHasNonSpace); + } + return this.renderTokens(this.parse(indentedValue, tags), context, partials, indentedValue, tags); + } + }; + + Writer.prototype.unescapedValue = function unescapedValue (token, context) { + var value = context.lookup(token[1]); + if (value != null) + return value; + }; + + Writer.prototype.escapedValue = function escapedValue (token, context) { + var value = context.lookup(token[1]); + if (value != null) + return mustache.escape(value); + }; + + Writer.prototype.rawValue = function rawValue (token) { + return token[1]; + }; + + var mustache = { + name: 'mustache.js', + version: '4.0.1', + tags: [ '{{', '}}' ], + clearCache: undefined, + escape: undefined, + parse: undefined, + render: undefined, + Scanner: undefined, + Context: undefined, + Writer: undefined, + /** + * Allows a user to override the default caching strategy, by providing an + * object with set, get and clear methods. This can also be used to disable + * the cache by setting it to the literal `undefined`. + */ + set templateCache (cache) { + defaultWriter.templateCache = cache; + }, + /** + * Gets the default or overridden caching object from the default writer. + */ + get templateCache () { + return defaultWriter.templateCache; + } + }; + + // All high-level mustache.* functions use this writer. + var defaultWriter = new Writer(); + + /** + * Clears all cached templates in the default writer. + */ + mustache.clearCache = function clearCache () { + return defaultWriter.clearCache(); + }; + + /** + * Parses and caches the given template in the default writer and returns the + * array of tokens it contains. Doing this ahead of time avoids the need to + * parse templates on the fly as they are rendered. + */ + mustache.parse = function parse (template, tags) { + return defaultWriter.parse(template, tags); + }; + + /** + * Renders the `template` with the given `view` and `partials` using the + * default writer. If the optional `tags` argument is given here it must be an + * array with two string values: the opening and closing tags used in the + * template (e.g. [ "<%", "%>" ]). The default is to mustache.tags. + */ + mustache.render = function render (template, view, partials, tags) { + if (typeof template !== 'string') { + throw new TypeError('Invalid template! Template should be a "string" ' + + 'but "' + typeStr(template) + '" was given as the first ' + + 'argument for mustache#render(template, view, partials)'); + } + + return defaultWriter.render(template, view, partials, tags); + }; + + // Export the escaping function so that the user may override it. + // See https://github.com/janl/mustache.js/issues/244 + mustache.escape = escapeHtml; + + // Export these mainly for testing, but also for advanced usage. + mustache.Scanner = Scanner; + mustache.Context = Context; + mustache.Writer = Writer; + + return mustache; + +}))); diff --git a/website/js/vendor/mustache/mustache.min.js b/website/js/vendor/mustache/mustache.min.js new file mode 100644 index 0000000..173c85a --- /dev/null +++ b/website/js/vendor/mustache/mustache.min.js @@ -0,0 +1 @@ +(function(global,factory){typeof exports==="object"&&typeof module!=="undefined"?module.exports=factory():typeof define==="function"&&define.amd?define(factory):(global=global||self,global.Mustache=factory())})(this,function(){"use strict";var objectToString=Object.prototype.toString;var isArray=Array.isArray||function isArrayPolyfill(object){return objectToString.call(object)==="[object Array]"};function isFunction(object){return typeof object==="function"}function typeStr(obj){return isArray(obj)?"array":typeof obj}function escapeRegExp(string){return string.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function hasProperty(obj,propName){return obj!=null&&typeof obj==="object"&&propName in obj}function primitiveHasOwnProperty(primitive,propName){return primitive!=null&&typeof primitive!=="object"&&primitive.hasOwnProperty&&primitive.hasOwnProperty(propName)}var regExpTest=RegExp.prototype.test;function testRegExp(re,string){return regExpTest.call(re,string)}var nonSpaceRe=/\S/;function isWhitespace(string){return!testRegExp(nonSpaceRe,string)}var entityMap={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/","`":"`","=":"="};function escapeHtml(string){return String(string).replace(/[&<>"'`=\/]/g,function fromEntityMap(s){return entityMap[s]})}var whiteRe=/\s*/;var spaceRe=/\s+/;var equalsRe=/\s*=/;var curlyRe=/\s*\}/;var tagRe=/#|\^|\/|>|\{|&|=|!/;function parseTemplate(template,tags){if(!template)return[];var lineHasNonSpace=false;var sections=[];var tokens=[];var spaces=[];var hasTag=false;var nonSpace=false;var indentation="";var tagIndex=0;function stripSpace(){if(hasTag&&!nonSpace){while(spaces.length)delete tokens[spaces.pop()]}else{spaces=[]}hasTag=false;nonSpace=false}var openingTagRe,closingTagRe,closingCurlyRe;function compileTags(tagsToCompile){if(typeof tagsToCompile==="string")tagsToCompile=tagsToCompile.split(spaceRe,2);if(!isArray(tagsToCompile)||tagsToCompile.length!==2)throw new Error("Invalid tags: "+tagsToCompile);openingTagRe=new RegExp(escapeRegExp(tagsToCompile[0])+"\\s*");closingTagRe=new RegExp("\\s*"+escapeRegExp(tagsToCompile[1]));closingCurlyRe=new RegExp("\\s*"+escapeRegExp("}"+tagsToCompile[1]))}compileTags(tags||mustache.tags);var scanner=new Scanner(template);var start,type,value,chr,token,openSection;while(!scanner.eos()){start=scanner.pos;value=scanner.scanUntil(openingTagRe);if(value){for(var i=0,valueLength=value.length;i"){token=[type,value,start,scanner.pos,indentation,tagIndex,lineHasNonSpace]}else{token=[type,value,start,scanner.pos]}tagIndex++;tokens.push(token);if(type==="#"||type==="^"){sections.push(token)}else if(type==="/"){openSection=sections.pop();if(!openSection)throw new Error('Unopened section "'+value+'" at '+start);if(openSection[1]!==value)throw new Error('Unclosed section "'+openSection[1]+'" at '+start)}else if(type==="name"||type==="{"||type==="&"){nonSpace=true}else if(type==="="){compileTags(value)}}stripSpace();openSection=sections.pop();if(openSection)throw new Error('Unclosed section "'+openSection[1]+'" at '+scanner.pos);return nestTokens(squashTokens(tokens))}function squashTokens(tokens){var squashedTokens=[];var token,lastToken;for(var i=0,numTokens=tokens.length;i0?sections[sections.length-1][4]:nestedTokens;break;default:collector.push(token)}}return nestedTokens}function Scanner(string){this.string=string;this.tail=string;this.pos=0}Scanner.prototype.eos=function eos(){return this.tail===""};Scanner.prototype.scan=function scan(re){var match=this.tail.match(re);if(!match||match.index!==0)return"";var string=match[0];this.tail=this.tail.substring(string.length);this.pos+=string.length;return string};Scanner.prototype.scanUntil=function scanUntil(re){var index=this.tail.search(re),match;switch(index){case-1:match=this.tail;this.tail="";break;case 0:match="";break;default:match=this.tail.substring(0,index);this.tail=this.tail.substring(index)}this.pos+=match.length;return match};function Context(view,parentContext){this.view=view;this.cache={".":this.view};this.parent=parentContext}Context.prototype.push=function push(view){return new Context(view,this)};Context.prototype.lookup=function lookup(name){var cache=this.cache;var value;if(cache.hasOwnProperty(name)){value=cache[name]}else{var context=this,intermediateValue,names,index,lookupHit=false;while(context){if(name.indexOf(".")>0){intermediateValue=context.view;names=name.split(".");index=0;while(intermediateValue!=null&&index")value=this.renderPartial(token,context,partials,tags);else if(symbol==="&")value=this.unescapedValue(token,context);else if(symbol==="name")value=this.escapedValue(token,context);else if(symbol==="text")value=this.rawValue(token);if(value!==undefined)buffer+=value}return buffer};Writer.prototype.renderSection=function renderSection(token,context,partials,originalTemplate){var self=this;var buffer="";var value=context.lookup(token[1]);function subRender(template){return self.render(template,context,partials)}if(!value)return;if(isArray(value)){for(var j=0,valueLength=value.length;j0||!lineHasNonSpace)){partialByNl[i]=filteredIndentation+partialByNl[i]}}return partialByNl.join("\n")};Writer.prototype.renderPartial=function renderPartial(token,context,partials,tags){if(!partials)return;var value=isFunction(partials)?partials(token[1]):partials[token[1]];if(value!=null){var lineHasNonSpace=token[6];var tagIndex=token[5];var indentation=token[4];var indentedValue=value;if(tagIndex==0&&indentation){indentedValue=this.indentPartial(value,indentation,lineHasNonSpace)}return this.renderTokens(this.parse(indentedValue,tags),context,partials,indentedValue,tags)}};Writer.prototype.unescapedValue=function unescapedValue(token,context){var value=context.lookup(token[1]);if(value!=null)return value};Writer.prototype.escapedValue=function escapedValue(token,context){var value=context.lookup(token[1]);if(value!=null)return mustache.escape(value)};Writer.prototype.rawValue=function rawValue(token){return token[1]};var mustache={name:"mustache.js",version:"4.0.1",tags:["{{","}}"],clearCache:undefined,escape:undefined,parse:undefined,render:undefined,Scanner:undefined,Context:undefined,Writer:undefined,set templateCache(cache){defaultWriter.templateCache=cache},get templateCache(){return defaultWriter.templateCache}};var defaultWriter=new Writer;mustache.clearCache=function clearCache(){return defaultWriter.clearCache()};mustache.parse=function parse(template,tags){return defaultWriter.parse(template,tags)};mustache.render=function render(template,view,partials,tags){if(typeof template!=="string"){throw new TypeError('Invalid template! Template should be a "string" '+'but "'+typeStr(template)+'" was given as the first '+"argument for mustache#render(template, view, partials)")}return defaultWriter.render(template,view,partials,tags)};mustache.escape=escapeHtml;mustache.Scanner=Scanner;mustache.Context=Context;mustache.Writer=Writer;return mustache}); diff --git a/website/js/vendor/slimselect/slimselect.css b/website/js/vendor/slimselect/slimselect.css new file mode 100644 index 0000000..f7ca569 --- /dev/null +++ b/website/js/vendor/slimselect/slimselect.css @@ -0,0 +1,394 @@ +.ss-main { + position : relative; + display : inline-block; + user-select: none; + color : #000; + width : 100% +} + +.ss-main .ss-single-selected { + display : flex; + cursor : pointer; + width : 100%; + /* height : 30px; */ + padding : 6px; + /* border : 1px solid #dcdee2; */ + /* border-radius : 4px; */ + background-color: #fff; + font-size: 11pt; + outline : 0; + box-sizing : border-box; + /* transition : background-color .2s */ +} + +.ss-main .ss-single-selected.ss-disabled { + background-color: #dcdee2; + cursor : not-allowed +} + +.ss-main .ss-single-selected.ss-open-above { + border-top-left-radius : 0px; + border-top-right-radius: 0px +} + +.ss-main .ss-single-selected.ss-open-below { + border-bottom-left-radius : 0px; + border-bottom-right-radius: 0px +} + +.ss-main .ss-single-selected .placeholder { + display : flex; + flex : 1 1 100%; + align-items : center; + overflow : hidden; + text-overflow : ellipsis; + white-space : nowrap; + text-align : left; + width : calc(100% - 30px); + line-height : 1em; + -webkit-user-select: none; + -moz-user-select : none; + -ms-user-select : none; + user-select : none +} + +.ss-main .ss-single-selected .placeholder * { + display : flex; + align-items : center; + overflow : hidden; + text-overflow: ellipsis; + white-space : nowrap; + width : auto +} + +.ss-main .ss-single-selected .placeholder .ss-disabled { + color: #dedede +} + +.ss-main .ss-single-selected .ss-deselect { + display : flex; + align-items : center; + justify-content: flex-end; + flex : 0 1 auto; + margin : 0 6px 0 6px; + font-weight : bold +} + +.ss-main .ss-single-selected .ss-deselect.ss-hide { + display: none +} + +.ss-main .ss-single-selected .ss-arrow { + display : flex; + align-items : center; + justify-content: flex-end; + flex : 0 1 auto; + margin : 0 6px 0 6px +} + +.ss-main .ss-single-selected .ss-arrow span { + border : solid #666; + border-width: 0 2px 2px 0; + display : inline-block; + padding : 3px; + transition : transform .2s, margin .2s +} + +.ss-main .ss-single-selected .ss-arrow span.arrow-up { + transform: rotate(-135deg); + margin : 3px 0 0 0 +} + +.ss-main .ss-single-selected .ss-arrow span.arrow-down { + transform: rotate(45deg); + margin : -3px 0 0 0 +} + +.ss-main .ss-multi-selected { + display : flex; + flex-direction : row; + cursor : pointer; + min-height : 30px; + width : 100%; + padding : 0 0 0 3px; + border : 1px solid #dcdee2; + border-radius : 2px; + background-color: #fff; + outline : 0; + box-sizing : border-box; + transition : background-color .2s +} + +.ss-main .ss-multi-selected.ss-disabled { + background-color: #dcdee2; + cursor : not-allowed +} + +.ss-main .ss-multi-selected.ss-disabled .ss-values .ss-disabled { + color: #666 +} + +.ss-main .ss-multi-selected.ss-disabled .ss-values .ss-value .ss-value-delete { + cursor: not-allowed +} + +.ss-main .ss-multi-selected.ss-open-above { + border-top-left-radius : 0px; + border-top-right-radius: 0px +} + +.ss-main .ss-multi-selected.ss-open-below { + border-bottom-left-radius : 0px; + border-bottom-right-radius: 0px +} + +.ss-main .ss-multi-selected .ss-values { + display : flex; + flex-wrap : wrap; + justify-content: flex-start; + flex : 1 1 100%; + width : calc(100% - 30px) +} + +.ss-main .ss-multi-selected .ss-values .ss-disabled { + display : flex; + padding : 4px 5px; + margin : 2px 0px; + line-height : 1em; + align-items : center; + width : 100%; + color : #dedede; + overflow : hidden; + text-overflow: ellipsis; + white-space : nowrap +} + +@keyframes scaleIn { + 0% { + transform: scale(0); + opacity : 0 + } + + 100% { + transform: scale(1); + opacity : 1 + } +} + +@keyframes scaleOut { + 0% { + transform: scale(1); + opacity : 1 + } + + 100% { + transform: scale(0); + opacity : 0 + } +} + +.ss-main .ss-multi-selected .ss-values .ss-value { + display : flex; + user-select : none; + align-items : center; + font-size : 12px; + padding : 3px 5px; + margin : 3px 5px 3px 0px; + color : #fff; + background-color : #bbb; + /* border-radius : 4px; */ + animation-name : scaleIn; + animation-duration : .2s; + animation-timing-function: ease-out; + animation-fill-mode : both +} + +.ss-main .ss-multi-selected .ss-values .ss-value.ss-out { + animation-name : scaleOut; + animation-duration : .2s; + animation-timing-function: ease-out +} + +.ss-main .ss-multi-selected .ss-values .ss-value .ss-value-delete { + margin: 0 0 0 5px; + cursor: pointer +} + +.ss-main .ss-multi-selected .ss-add { + display: flex; + flex : 0 1 3px; + margin : 9px 12px 0 5px +} + +.ss-main .ss-multi-selected .ss-add .ss-plus { + display : flex; + justify-content: center; + align-items : center; + background : #666; + position : relative; + height : 10px; + width : 2px; + transition : transform .2s +} + +.ss-main .ss-multi-selected .ss-add .ss-plus:after { + background: #666; + content : ""; + position : absolute; + height : 2px; + width : 10px; + left : -4px; + top : 4px +} + +.ss-main .ss-multi-selected .ss-add .ss-plus.ss-cross { + transform: rotate(45deg) +} + +.ss-content { + position : absolute; + width : 100%; + margin : -1px 0 0 0; + box-sizing : border-box; + border : solid 1px #dcdee2; + z-index : 1010; + background-color: #fff; + transform-origin: center top; + transition : transform .2s, opacity .2s; + opacity : 0; + transform : scaleY(0) +} + +.ss-content.ss-open { + display : block; + opacity : 1; + transform: scaleY(1) +} + +.ss-content .ss-search { + display : flex; + flex-direction: row; + padding : 8px 8px 6px 8px +} + +.ss-content .ss-search.ss-hide { + height : 0px; + opacity: 0; + padding: 0px 0px 0px 0px; + margin : 0px 0px 0px 0px +} + +.ss-content .ss-search.ss-hide input { + height : 0px; + opacity: 0; + padding: 0px 0px 0px 0px; + margin : 0px 0px 0px 0px +} + +.ss-content .ss-search input { + display : inline-flex; + font-size : inherit; + line-height : inherit; + flex : 1 1 auto; + width : 100%; + min-width : 0px; + height : 30px; + padding : 6px 8px; + margin : 0; + border : 1px solid #dcdee2; + border-radius : 4px; + background-color : #fff; + outline : 0; + text-align : left; + box-sizing : border-box; + -webkit-box-sizing: border-box; + -webkit-appearance: textfield +} + +.ss-content .ss-search input::placeholder { + color : #8a8a8a; + vertical-align: middle +} + +.ss-content .ss-search input:focus { + box-shadow: 0 0 5px #bbb; +} + +.ss-content .ss-search .ss-addable { + display : inline-flex; + justify-content: center; + align-items : center; + cursor : pointer; + font-size : 22px; + font-weight : bold; + flex : 0 0 30px; + height : 30px; + margin : 0 0 0 8px; + border : 1px solid #dcdee2; + border-radius : 4px; + box-sizing : border-box +} + +.ss-content .ss-addable { + padding-top: 0px +} + +.ss-content .ss-list { + max-height: 200px; + overflow-x: hidden; + overflow-y: auto; + text-align: left +} + +.ss-content .ss-list .ss-optgroup .ss-optgroup-label { + padding : 6px 10px 6px 10px; + font-weight: bold +} + +.ss-content .ss-list .ss-optgroup .ss-option { + padding: 6px 6px 6px 25px +} + +.ss-content .ss-list .ss-optgroup-label-selectable { + cursor: pointer +} + +.ss-content .ss-list .ss-optgroup-label-selectable:hover { + color : #fff; + background-color: #bbb; +} + +.ss-content .ss-list .ss-option { + padding : 6px 10px 6px 10px; + cursor : pointer; + user-select: none +} + +.ss-content .ss-list .ss-option * { + display: inline-block +} + +.ss-content .ss-list .ss-option:hover, +.ss-content .ss-list .ss-option.ss-highlighted { + color : #fff; + background-color: #bbb; +} + +.ss-content .ss-list .ss-option.ss-disabled { + cursor : not-allowed; + color : #dedede; + background-color: #fff +} + +.ss-content .ss-list .ss-option:not(.ss-disabled).ss-option-selected { + color : #666; + background-color: rgba(88, 151, 251, 0.1) +} + +.ss-content .ss-list .ss-option.ss-hide { + display: none +} + +.ss-content .ss-list .ss-option .ss-search-highlight { + background-color: #fffb8c +} diff --git a/website/js/vendor/slimselect/slimselect.js b/website/js/vendor/slimselect/slimselect.js new file mode 100644 index 0000000..2b0ce4b --- /dev/null +++ b/website/js/vendor/slimselect/slimselect.js @@ -0,0 +1,1931 @@ +(function webpackUniversalModuleDefinition(root, factory) { + if(typeof exports === 'object' && typeof module === 'object') + module.exports = factory(); + else if(typeof define === 'function' && define.amd) + define([], factory); + else if(typeof exports === 'object') + exports["SlimSelect"] = factory(); + else + root["SlimSelect"] = factory(); +})(window, function() { +return /******/ (function(modules) { // webpackBootstrap +/******/ // The module cache +/******/ var installedModules = {}; +/******/ +/******/ // The require function +/******/ function __webpack_require__(moduleId) { +/******/ +/******/ // Check if module is in cache +/******/ if(installedModules[moduleId]) { +/******/ return installedModules[moduleId].exports; +/******/ } +/******/ // Create a new module (and put it into the cache) +/******/ var module = installedModules[moduleId] = { +/******/ i: moduleId, +/******/ l: false, +/******/ exports: {} +/******/ }; +/******/ +/******/ // Execute the module function +/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); +/******/ +/******/ // Flag the module as loaded +/******/ module.l = true; +/******/ +/******/ // Return the exports of the module +/******/ return module.exports; +/******/ } +/******/ +/******/ +/******/ // expose the modules object (__webpack_modules__) +/******/ __webpack_require__.m = modules; +/******/ +/******/ // expose the module cache +/******/ __webpack_require__.c = installedModules; +/******/ +/******/ // define getter function for harmony exports +/******/ __webpack_require__.d = function(exports, name, getter) { +/******/ if(!__webpack_require__.o(exports, name)) { +/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter }); +/******/ } +/******/ }; +/******/ +/******/ // define __esModule on exports +/******/ __webpack_require__.r = function(exports) { +/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { +/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); +/******/ } +/******/ Object.defineProperty(exports, '__esModule', { value: true }); +/******/ }; +/******/ +/******/ // create a fake namespace object +/******/ // mode & 1: value is a module id, require it +/******/ // mode & 2: merge all properties of value into the ns +/******/ // mode & 4: return value when already ns object +/******/ // mode & 8|1: behave like require +/******/ __webpack_require__.t = function(value, mode) { +/******/ if(mode & 1) value = __webpack_require__(value); +/******/ if(mode & 8) return value; +/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value; +/******/ var ns = Object.create(null); +/******/ __webpack_require__.r(ns); +/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value }); +/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key)); +/******/ return ns; +/******/ }; +/******/ +/******/ // getDefaultExport function for compatibility with non-harmony modules +/******/ __webpack_require__.n = function(module) { +/******/ var getter = module && module.__esModule ? +/******/ function getDefault() { return module['default']; } : +/******/ function getModuleExports() { return module; }; +/******/ __webpack_require__.d(getter, 'a', getter); +/******/ return getter; +/******/ }; +/******/ +/******/ // Object.prototype.hasOwnProperty.call +/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; +/******/ +/******/ // __webpack_public_path__ +/******/ __webpack_require__.p = ""; +/******/ +/******/ +/******/ // Load entry module and return exports +/******/ return __webpack_require__(__webpack_require__.s = 2); +/******/ }) +/************************************************************************/ +/******/ ([ +/* 0 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + +exports.__esModule = true; +function hasClassInTree(element, className) { + function hasClass(e, c) { + if (!(!c || !e || !e.classList || !e.classList.contains(c))) { + return e; + } + return null; + } + function parentByClass(e, c) { + if (!e || e === document) { + return null; + } + else if (hasClass(e, c)) { + return e; + } + else { + return parentByClass(e.parentNode, c); + } + } + return hasClass(element, className) || parentByClass(element, className); +} +exports.hasClassInTree = hasClassInTree; +function ensureElementInView(container, element) { + var cTop = container.scrollTop + container.offsetTop; + var cBottom = cTop + container.clientHeight; + var eTop = element.offsetTop; + var eBottom = eTop + element.clientHeight; + if (eTop < cTop) { + container.scrollTop -= (cTop - eTop); + } + else if (eBottom > cBottom) { + container.scrollTop += (eBottom - cBottom); + } +} +exports.ensureElementInView = ensureElementInView; +function putContent(el, currentPosition, isOpen) { + var height = el.offsetHeight; + var rect = el.getBoundingClientRect(); + var elemTop = (isOpen ? rect.top : rect.top - height); + var elemBottom = (isOpen ? rect.bottom : rect.bottom + height); + if (elemTop <= 0) { + return 'below'; + } + if (elemBottom >= window.innerHeight) { + return 'above'; + } + return (isOpen ? currentPosition : 'below'); +} +exports.putContent = putContent; +function debounce(func, wait, immediate) { + if (wait === void 0) { wait = 100; } + if (immediate === void 0) { immediate = false; } + var timeout; + return function () { + var args = []; + for (var _i = 0; _i < arguments.length; _i++) { + args[_i] = arguments[_i]; + } + var context = self; + var later = function () { + timeout = null; + if (!immediate) { + func.apply(context, args); + } + }; + var callNow = immediate && !timeout; + clearTimeout(timeout); + timeout = setTimeout(later, wait); + if (callNow) { + func.apply(context, args); + } + }; +} +exports.debounce = debounce; +function isValueInArrayOfObjects(selected, key, value) { + if (!Array.isArray(selected)) { + return selected[key] === value; + } + for (var _i = 0, selected_1 = selected; _i < selected_1.length; _i++) { + var s = selected_1[_i]; + if (s && s[key] && s[key] === value) { + return true; + } + } + return false; +} +exports.isValueInArrayOfObjects = isValueInArrayOfObjects; +function highlight(str, search, className) { + var completedString = str; + var regex = new RegExp('(' + search.trim() + ')(?![^<]*>[^<>]*" + originalTextFoundByRegex + ""); + return completedString; +} +exports.highlight = highlight; +function kebabCase(str) { + var result = str.replace(/[A-Z\u00C0-\u00D6\u00D8-\u00DE]/g, function (match) { return '-' + match.toLowerCase(); }); + return (str[0] === str[0].toUpperCase()) + ? result.substring(1) + : result; +} +exports.kebabCase = kebabCase; +(function () { + var w = window; + if (typeof w.CustomEvent === 'function') { + return; + } + function CustomEvent(event, params) { + params = params || { bubbles: false, cancelable: false, detail: undefined }; + var evt = document.createEvent('CustomEvent'); + evt.initCustomEvent(event, params.bubbles, params.cancelable, params.detail); + return evt; + } + CustomEvent.prototype = w.Event.prototype; + w.CustomEvent = CustomEvent; +})(); + + +/***/ }), +/* 1 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + +exports.__esModule = true; +var Data = (function () { + function Data(info) { + this.contentOpen = false; + this.contentPosition = 'below'; + this.isOnChangeEnabled = true; + this.main = info.main; + this.searchValue = ''; + this.data = []; + this.filtered = null; + this.parseSelectData(); + this.setSelectedFromSelect(); + } + Data.prototype.newOption = function (info) { + return { + id: (info.id ? info.id : String(Math.floor(Math.random() * 100000000))), + value: (info.value ? info.value : ''), + text: (info.text ? info.text : ''), + innerHTML: (info.innerHTML ? info.innerHTML : ''), + selected: (info.selected ? info.selected : false), + display: (info.display !== undefined ? info.display : true), + disabled: (info.disabled ? info.disabled : false), + placeholder: (info.placeholder ? info.placeholder : false), + "class": (info["class"] ? info["class"] : undefined), + data: (info.data ? info.data : {}), + mandatory: (info.mandatory ? info.mandatory : false) + }; + }; + Data.prototype.add = function (data) { + this.data.push({ + id: String(Math.floor(Math.random() * 100000000)), + value: data.value, + text: data.text, + innerHTML: '', + selected: false, + display: true, + disabled: false, + placeholder: false, + "class": undefined, + mandatory: data.mandatory, + data: {} + }); + }; + Data.prototype.parseSelectData = function () { + this.data = []; + var nodes = this.main.select.element.childNodes; + for (var _i = 0, nodes_1 = nodes; _i < nodes_1.length; _i++) { + var n = nodes_1[_i]; + if (n.nodeName === 'OPTGROUP') { + var node = n; + var optgroup = { + label: node.label, + options: [] + }; + var options = n.childNodes; + for (var _a = 0, options_1 = options; _a < options_1.length; _a++) { + var o = options_1[_a]; + if (o.nodeName === 'OPTION') { + var option = this.pullOptionData(o); + optgroup.options.push(option); + if (option.placeholder && option.text.trim() !== '') { + this.main.config.placeholderText = option.text; + } + } + } + this.data.push(optgroup); + } + else if (n.nodeName === 'OPTION') { + var option = this.pullOptionData(n); + this.data.push(option); + if (option.placeholder && option.text.trim() !== '') { + this.main.config.placeholderText = option.text; + } + } + } + }; + Data.prototype.pullOptionData = function (option) { + return { + id: (option.dataset ? option.dataset.id : false) || String(Math.floor(Math.random() * 100000000)), + value: option.value, + text: option.text, + innerHTML: option.innerHTML, + selected: option.selected, + disabled: option.disabled, + placeholder: option.dataset.placeholder === 'true', + "class": option.className, + style: option.style.cssText, + data: option.dataset, + mandatory: (option.dataset ? option.dataset.mandatory === 'true' : false) + }; + }; + Data.prototype.setSelectedFromSelect = function () { + if (this.main.config.isMultiple) { + var options = this.main.select.element.options; + var newSelected = []; + for (var _i = 0, options_2 = options; _i < options_2.length; _i++) { + var o = options_2[_i]; + if (o.selected) { + var newOption = this.getObjectFromData(o.value, 'value'); + if (newOption && newOption.id) { + newSelected.push(newOption.id); + } + } + } + this.setSelected(newSelected, 'id'); + } + else { + var element = this.main.select.element; + if (element.selectedIndex !== -1) { + var option = element.options[element.selectedIndex]; + var value = option.value; + this.setSelected(value, 'value'); + } + } + }; + Data.prototype.setSelected = function (value, type) { + if (type === void 0) { type = 'id'; } + for (var _i = 0, _a = this.data; _i < _a.length; _i++) { + var d = _a[_i]; + if (d.hasOwnProperty('label')) { + if (d.hasOwnProperty('options')) { + var options = d.options; + if (options) { + for (var _b = 0, options_3 = options; _b < options_3.length; _b++) { + var o = options_3[_b]; + if (o.placeholder) { + continue; + } + o.selected = this.shouldBeSelected(o, value, type); + } + } + } + } + else { + d.selected = this.shouldBeSelected(d, value, type); + } + } + }; + Data.prototype.shouldBeSelected = function (option, value, type) { + if (type === void 0) { type = 'id'; } + if (Array.isArray(value)) { + for (var _i = 0, value_1 = value; _i < value_1.length; _i++) { + var v = value_1[_i]; + if (type in option && String(option[type]) === String(v)) { + return true; + } + } + } + else { + if (type in option && String(option[type]) === String(value)) { + return true; + } + } + return false; + }; + Data.prototype.getSelected = function () { + var value = { text: '', placeholder: this.main.config.placeholderText }; + var values = []; + for (var _i = 0, _a = this.data; _i < _a.length; _i++) { + var d = _a[_i]; + if (d.hasOwnProperty('label')) { + if (d.hasOwnProperty('options')) { + var options = d.options; + if (options) { + for (var _b = 0, options_4 = options; _b < options_4.length; _b++) { + var o = options_4[_b]; + if (o.selected) { + if (!this.main.config.isMultiple) { + value = o; + } + else { + values.push(o); + } + } + } + } + } + } + else { + if (d.selected) { + if (!this.main.config.isMultiple) { + value = d; + } + else { + values.push(d); + } + } + } + } + if (this.main.config.isMultiple) { + return values; + } + return value; + }; + Data.prototype.addToSelected = function (value, type) { + if (type === void 0) { type = 'id'; } + if (this.main.config.isMultiple) { + var values = []; + var selected = this.getSelected(); + if (Array.isArray(selected)) { + for (var _i = 0, selected_1 = selected; _i < selected_1.length; _i++) { + var s = selected_1[_i]; + values.push(s[type]); + } + } + values.push(value); + this.setSelected(values, type); + } + }; + Data.prototype.removeFromSelected = function (value, type) { + if (type === void 0) { type = 'id'; } + if (this.main.config.isMultiple) { + var values = []; + var selected = this.getSelected(); + for (var _i = 0, selected_2 = selected; _i < selected_2.length; _i++) { + var s = selected_2[_i]; + if (String(s[type]) !== String(value)) { + values.push(s[type]); + } + } + this.setSelected(values, type); + } + }; + Data.prototype.onDataChange = function () { + if (this.main.onChange && this.isOnChangeEnabled) { + this.main.onChange(JSON.parse(JSON.stringify(this.getSelected()))); + } + }; + Data.prototype.getObjectFromData = function (value, type) { + if (type === void 0) { type = 'id'; } + for (var _i = 0, _a = this.data; _i < _a.length; _i++) { + var d = _a[_i]; + if (type in d && String(d[type]) === String(value)) { + return d; + } + if (d.hasOwnProperty('options')) { + var optgroupObject = d; + if (optgroupObject.options) { + for (var _b = 0, _c = optgroupObject.options; _b < _c.length; _b++) { + var oo = _c[_b]; + if (String(oo[type]) === String(value)) { + return oo; + } + } + } + } + } + return null; + }; + Data.prototype.search = function (search) { + this.searchValue = search; + if (search.trim() === '') { + this.filtered = null; + return; + } + var searchFilter = this.main.config.searchFilter; + var valuesArray = this.data.slice(0); + search = search.trim(); + var filtered = valuesArray.map(function (obj) { + if (obj.hasOwnProperty('options')) { + var optgroupObj = obj; + var options = []; + if (optgroupObj.options) { + options = optgroupObj.options.filter(function (opt) { + return searchFilter(opt, search); + }); + } + if (options.length !== 0) { + var optgroup = Object.assign({}, optgroupObj); + optgroup.options = options; + return optgroup; + } + } + if (obj.hasOwnProperty('text')) { + var optionObj = obj; + if (searchFilter(optionObj, search)) { + return obj; + } + } + return null; + }); + this.filtered = filtered.filter(function (info) { return info; }); + }; + return Data; +}()); +exports.Data = Data; +function validateData(data) { + if (!data) { + console.error('Data must be an array of objects'); + return false; + } + var isValid = false; + var errorCount = 0; + for (var _i = 0, data_1 = data; _i < data_1.length; _i++) { + var d = data_1[_i]; + if (d.hasOwnProperty('label')) { + if (d.hasOwnProperty('options')) { + var optgroup = d; + var options = optgroup.options; + if (options) { + for (var _a = 0, options_5 = options; _a < options_5.length; _a++) { + var o = options_5[_a]; + isValid = validateOption(o); + if (!isValid) { + errorCount++; + } + } + } + } + } + else { + var option = d; + isValid = validateOption(option); + if (!isValid) { + errorCount++; + } + } + } + return errorCount === 0; +} +exports.validateData = validateData; +function validateOption(option) { + if (option.text === undefined) { + console.error('Data object option must have at least have a text value. Check object: ' + JSON.stringify(option)); + return false; + } + return true; +} +exports.validateOption = validateOption; + + +/***/ }), +/* 2 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + +exports.__esModule = true; +var config_1 = __webpack_require__(3); +var select_1 = __webpack_require__(4); +var slim_1 = __webpack_require__(5); +var data_1 = __webpack_require__(1); +var helper_1 = __webpack_require__(0); +var SlimSelect = (function () { + function SlimSelect(info) { + var _this = this; + this.ajax = null; + this.addable = null; + this.beforeOnChange = null; + this.onChange = null; + this.beforeOpen = null; + this.afterOpen = null; + this.beforeClose = null; + this.afterClose = null; + var selectElement = this.validate(info); + if (selectElement.dataset.ssid) { + this.destroy(selectElement.dataset.ssid); + } + if (info.ajax) { + this.ajax = info.ajax; + } + if (info.addable) { + this.addable = info.addable; + } + this.config = new config_1.Config({ + select: selectElement, + isAjax: (info.ajax ? true : false), + showSearch: info.showSearch, + searchPlaceholder: info.searchPlaceholder, + searchText: info.searchText, + searchingText: info.searchingText, + searchFocus: info.searchFocus, + searchHighlight: info.searchHighlight, + searchFilter: info.searchFilter, + closeOnSelect: info.closeOnSelect, + showContent: info.showContent, + placeholderText: info.placeholder, + allowDeselect: info.allowDeselect, + allowDeselectOption: info.allowDeselectOption, + hideSelectedOption: info.hideSelectedOption, + deselectLabel: info.deselectLabel, + isEnabled: info.isEnabled, + valuesUseText: info.valuesUseText, + showOptionTooltips: info.showOptionTooltips, + selectByGroup: info.selectByGroup, + limit: info.limit, + timeoutDelay: info.timeoutDelay, + addToBody: info.addToBody + }); + this.select = new select_1.Select({ + select: selectElement, + main: this + }); + this.data = new data_1.Data({ main: this }); + this.slim = new slim_1.Slim({ main: this }); + if (this.select.element.parentNode) { + this.select.element.parentNode.insertBefore(this.slim.container, this.select.element.nextSibling); + } + if (info.data) { + this.setData(info.data); + } + else { + this.render(); + } + document.addEventListener('click', function (e) { + if (e.target && !helper_1.hasClassInTree(e.target, _this.config.id)) { + _this.close(); + } + }); + if (this.config.showContent === 'auto') { + window.addEventListener('scroll', helper_1.debounce(function (e) { + if (_this.data.contentOpen) { + if (helper_1.putContent(_this.slim.content, _this.data.contentPosition, _this.data.contentOpen) === 'above') { + _this.moveContentAbove(); + } + else { + _this.moveContentBelow(); + } + } + }), false); + } + if (info.beforeOnChange) { + this.beforeOnChange = info.beforeOnChange; + } + if (info.onChange) { + this.onChange = info.onChange; + } + if (info.beforeOpen) { + this.beforeOpen = info.beforeOpen; + } + if (info.afterOpen) { + this.afterOpen = info.afterOpen; + } + if (info.beforeClose) { + this.beforeClose = info.beforeClose; + } + if (info.afterClose) { + this.afterClose = info.afterClose; + } + if (!this.config.isEnabled) { + this.disable(); + } + } + SlimSelect.prototype.validate = function (info) { + var select = (typeof info.select === 'string' ? document.querySelector(info.select) : info.select); + if (!select) { + throw new Error('Could not find select element'); + } + if (select.tagName !== 'SELECT') { + throw new Error('Element isnt of type select'); + } + return select; + }; + SlimSelect.prototype.selected = function () { + if (this.config.isMultiple) { + var selected = this.data.getSelected(); + var outputSelected = []; + for (var _i = 0, selected_1 = selected; _i < selected_1.length; _i++) { + var s = selected_1[_i]; + outputSelected.push(s.value); + } + return outputSelected; + } + else { + var selected = this.data.getSelected(); + return (selected ? selected.value : ''); + } + }; + SlimSelect.prototype.set = function (value, type, close, render) { + if (type === void 0) { type = 'value'; } + if (close === void 0) { close = true; } + if (render === void 0) { render = true; } + if (this.config.isMultiple && !Array.isArray(value)) { + this.data.addToSelected(value, type); + } + else { + this.data.setSelected(value, type); + } + this.select.setValue(); + this.data.onDataChange(); + this.render(); + if (close) { + this.close(); + } + }; + SlimSelect.prototype.setSelected = function (value, type, close, render) { + if (type === void 0) { type = 'value'; } + if (close === void 0) { close = true; } + if (render === void 0) { render = true; } + this.set(value, type, close, render); + }; + SlimSelect.prototype.setData = function (data) { + var isValid = data_1.validateData(data); + if (!isValid) { + console.error('Validation problem on: #' + this.select.element.id); + return; + } + var newData = JSON.parse(JSON.stringify(data)); + var selected = this.data.getSelected(); + if (this.config.isAjax && selected) { + if (this.config.isMultiple) { + var reverseSelected = selected.reverse(); + for (var _i = 0, reverseSelected_1 = reverseSelected; _i < reverseSelected_1.length; _i++) { + var r = reverseSelected_1[_i]; + newData.unshift(r); + } + } + else { + newData.unshift(this.data.getSelected()); + newData.unshift({ text: '', placeholder: true }); + } + } + this.select.create(newData); + this.data.parseSelectData(); + this.data.setSelectedFromSelect(); + }; + SlimSelect.prototype.addData = function (data) { + var isValid = data_1.validateData([data]); + if (!isValid) { + console.error('Validation problem on: #' + this.select.element.id); + return; + } + this.data.add(this.data.newOption(data)); + this.select.create(this.data.data); + this.data.parseSelectData(); + this.data.setSelectedFromSelect(); + this.render(); + }; + SlimSelect.prototype.open = function () { + var _this = this; + if (!this.config.isEnabled) { + return; + } + if (this.data.contentOpen) { + return; + } + if (this.beforeOpen) { + this.beforeOpen(); + } + if (this.config.isMultiple && this.slim.multiSelected) { + this.slim.multiSelected.plus.classList.add('ss-cross'); + } + else if (this.slim.singleSelected) { + this.slim.singleSelected.arrowIcon.arrow.classList.remove('arrow-down'); + this.slim.singleSelected.arrowIcon.arrow.classList.add('arrow-up'); + } + this.slim[(this.config.isMultiple ? 'multiSelected' : 'singleSelected')].container.classList.add((this.data.contentPosition === 'above' ? this.config.openAbove : this.config.openBelow)); + if (this.config.addToBody) { + var containerRect = this.slim.container.getBoundingClientRect(); + this.slim.content.style.top = (containerRect.top + containerRect.height + window.scrollY) + 'px'; + this.slim.content.style.left = (containerRect.left + window.scrollX) + 'px'; + this.slim.content.style.width = containerRect.width + 'px'; + } + this.slim.content.classList.add(this.config.open); + if (this.config.showContent.toLowerCase() === 'up') { + this.moveContentAbove(); + } + else if (this.config.showContent.toLowerCase() === 'down') { + this.moveContentBelow(); + } + else { + if (helper_1.putContent(this.slim.content, this.data.contentPosition, this.data.contentOpen) === 'above') { + this.moveContentAbove(); + } + else { + this.moveContentBelow(); + } + } + if (!this.config.isMultiple) { + var selected = this.data.getSelected(); + if (selected) { + var selectedId = selected.id; + var selectedOption = this.slim.list.querySelector('[data-id="' + selectedId + '"]'); + if (selectedOption) { + helper_1.ensureElementInView(this.slim.list, selectedOption); + } + } + } + setTimeout(function () { + _this.data.contentOpen = true; + if (_this.config.searchFocus) { + _this.slim.search.input.focus(); + } + if (_this.afterOpen) { + _this.afterOpen(); + } + }, this.config.timeoutDelay); + }; + SlimSelect.prototype.close = function () { + var _this = this; + if (!this.data.contentOpen) { + return; + } + if (this.beforeClose) { + this.beforeClose(); + } + if (this.config.isMultiple && this.slim.multiSelected) { + this.slim.multiSelected.container.classList.remove(this.config.openAbove); + this.slim.multiSelected.container.classList.remove(this.config.openBelow); + this.slim.multiSelected.plus.classList.remove('ss-cross'); + } + else if (this.slim.singleSelected) { + this.slim.singleSelected.container.classList.remove(this.config.openAbove); + this.slim.singleSelected.container.classList.remove(this.config.openBelow); + this.slim.singleSelected.arrowIcon.arrow.classList.add('arrow-down'); + this.slim.singleSelected.arrowIcon.arrow.classList.remove('arrow-up'); + } + this.slim.content.classList.remove(this.config.open); + this.data.contentOpen = false; + this.search(''); + setTimeout(function () { + _this.slim.content.removeAttribute('style'); + _this.data.contentPosition = 'below'; + if (_this.config.isMultiple && _this.slim.multiSelected) { + _this.slim.multiSelected.container.classList.remove(_this.config.openAbove); + _this.slim.multiSelected.container.classList.remove(_this.config.openBelow); + } + else if (_this.slim.singleSelected) { + _this.slim.singleSelected.container.classList.remove(_this.config.openAbove); + _this.slim.singleSelected.container.classList.remove(_this.config.openBelow); + } + _this.slim.search.input.blur(); + if (_this.afterClose) { + _this.afterClose(); + } + }, this.config.timeoutDelay); + }; + SlimSelect.prototype.moveContentAbove = function () { + var selectHeight = 0; + if (this.config.isMultiple && this.slim.multiSelected) { + selectHeight = this.slim.multiSelected.container.offsetHeight; + } + else if (this.slim.singleSelected) { + selectHeight = this.slim.singleSelected.container.offsetHeight; + } + var contentHeight = this.slim.content.offsetHeight; + var height = selectHeight + contentHeight - 1; + this.slim.content.style.margin = '-' + height + 'px 0 0 0'; + this.slim.content.style.height = (height - selectHeight + 1) + 'px'; + this.slim.content.style.transformOrigin = 'center bottom'; + this.data.contentPosition = 'above'; + if (this.config.isMultiple && this.slim.multiSelected) { + this.slim.multiSelected.container.classList.remove(this.config.openBelow); + this.slim.multiSelected.container.classList.add(this.config.openAbove); + } + else if (this.slim.singleSelected) { + this.slim.singleSelected.container.classList.remove(this.config.openBelow); + this.slim.singleSelected.container.classList.add(this.config.openAbove); + } + }; + SlimSelect.prototype.moveContentBelow = function () { + this.data.contentPosition = 'below'; + if (this.config.isMultiple && this.slim.multiSelected) { + this.slim.multiSelected.container.classList.remove(this.config.openAbove); + this.slim.multiSelected.container.classList.add(this.config.openBelow); + } + else if (this.slim.singleSelected) { + this.slim.singleSelected.container.classList.remove(this.config.openAbove); + this.slim.singleSelected.container.classList.add(this.config.openBelow); + } + }; + SlimSelect.prototype.enable = function () { + this.config.isEnabled = true; + if (this.config.isMultiple && this.slim.multiSelected) { + this.slim.multiSelected.container.classList.remove(this.config.disabled); + } + else if (this.slim.singleSelected) { + this.slim.singleSelected.container.classList.remove(this.config.disabled); + } + this.select.triggerMutationObserver = false; + this.select.element.disabled = false; + this.slim.search.input.disabled = false; + this.select.triggerMutationObserver = true; + }; + SlimSelect.prototype.disable = function () { + this.config.isEnabled = false; + if (this.config.isMultiple && this.slim.multiSelected) { + this.slim.multiSelected.container.classList.add(this.config.disabled); + } + else if (this.slim.singleSelected) { + this.slim.singleSelected.container.classList.add(this.config.disabled); + } + this.select.triggerMutationObserver = false; + this.select.element.disabled = true; + this.slim.search.input.disabled = true; + this.select.triggerMutationObserver = true; + }; + SlimSelect.prototype.search = function (value) { + if (this.data.searchValue !== value) { + this.slim.search.input.value = value; + if (this.config.isAjax) { + var master_1 = this; + this.config.isSearching = true; + this.render(); + if (this.ajax) { + this.ajax(value, function (info) { + master_1.config.isSearching = false; + if (Array.isArray(info)) { + info.unshift({ text: '', placeholder: true }); + master_1.setData(info); + master_1.data.search(value); + master_1.render(); + } + else if (typeof info === 'string') { + master_1.slim.options(info); + } + else { + master_1.render(); + } + }); + } + } + else { + this.data.search(value); + this.render(); + } + } + }; + SlimSelect.prototype.setSearchText = function (text) { + this.config.searchText = text; + }; + SlimSelect.prototype.render = function () { + if (this.config.isMultiple) { + this.slim.values(); + } + else { + this.slim.placeholder(); + this.slim.deselect(); + } + this.slim.options(); + }; + SlimSelect.prototype.destroy = function (id) { + if (id === void 0) { id = null; } + var slim = (id ? document.querySelector('.' + id + '.ss-main') : this.slim.container); + var select = (id ? document.querySelector("[data-ssid=" + id + "]") : this.select.element); + if (!slim || !select) { + return; + } + select.style.display = ''; + delete select.dataset.ssid; + var el = select; + el.slim = null; + if (slim.parentElement) { + slim.parentElement.removeChild(slim); + } + if (this.config.addToBody) { + var slimContent = (id ? document.querySelector('.' + id + '.ss-content') : this.slim.content); + if (!slimContent) { + return; + } + document.body.removeChild(slimContent); + } + }; + return SlimSelect; +}()); +exports["default"] = SlimSelect; + + +/***/ }), +/* 3 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + +exports.__esModule = true; +var Config = (function () { + function Config(info) { + this.id = ''; + this.isMultiple = false; + this.isAjax = false; + this.isSearching = false; + this.showSearch = true; + this.searchFocus = true; + this.searchHighlight = false; + this.closeOnSelect = true; + this.showContent = 'auto'; + this.searchPlaceholder = 'Search'; + this.searchText = 'No Results'; + this.searchingText = 'Searching...'; + this.placeholderText = 'Select Value'; + this.allowDeselect = false; + this.allowDeselectOption = false; + this.hideSelectedOption = false; + this.deselectLabel = 'x'; + this.isEnabled = true; + this.valuesUseText = false; + this.showOptionTooltips = false; + this.selectByGroup = false; + this.limit = 0; + this.timeoutDelay = 200; + this.addToBody = false; + this.main = 'ss-main'; + this.singleSelected = 'ss-single-selected'; + this.arrow = 'ss-arrow'; + this.multiSelected = 'ss-multi-selected'; + this.add = 'ss-add'; + this.plus = 'ss-plus'; + this.values = 'ss-values'; + this.value = 'ss-value'; + this.valueText = 'ss-value-text'; + this.valueDelete = 'ss-value-delete'; + this.content = 'ss-content'; + this.open = 'ss-open'; + this.openAbove = 'ss-open-above'; + this.openBelow = 'ss-open-below'; + this.search = 'ss-search'; + this.searchHighlighter = 'ss-search-highlight'; + this.addable = 'ss-addable'; + this.list = 'ss-list'; + this.optgroup = 'ss-optgroup'; + this.optgroupLabel = 'ss-optgroup-label'; + this.optgroupLabelSelectable = 'ss-optgroup-label-selectable'; + this.option = 'ss-option'; + this.optionSelected = 'ss-option-selected'; + this.highlighted = 'ss-highlighted'; + this.disabled = 'ss-disabled'; + this.hide = 'ss-hide'; + this.id = 'ss-' + Math.floor(Math.random() * 100000); + this.style = info.select.style.cssText; + this["class"] = info.select.className.split(' '); + this.isMultiple = info.select.multiple; + this.isAjax = info.isAjax; + this.showSearch = (info.showSearch === false ? false : true); + this.searchFocus = (info.searchFocus === false ? false : true); + this.searchHighlight = (info.searchHighlight === true ? true : false); + this.closeOnSelect = (info.closeOnSelect === false ? false : true); + if (info.showContent) { + this.showContent = info.showContent; + } + this.isEnabled = (info.isEnabled === false ? false : true); + if (info.searchPlaceholder) { + this.searchPlaceholder = info.searchPlaceholder; + } + if (info.searchText) { + this.searchText = info.searchText; + } + if (info.searchingText) { + this.searchingText = info.searchingText; + } + if (info.placeholderText) { + this.placeholderText = info.placeholderText; + } + this.allowDeselect = (info.allowDeselect === true ? true : false); + this.allowDeselectOption = (info.allowDeselectOption === true ? true : false); + this.hideSelectedOption = (info.hideSelectedOption === true ? true : false); + if (info.deselectLabel) { + this.deselectLabel = info.deselectLabel; + } + if (info.valuesUseText) { + this.valuesUseText = info.valuesUseText; + } + if (info.showOptionTooltips) { + this.showOptionTooltips = info.showOptionTooltips; + } + if (info.selectByGroup) { + this.selectByGroup = info.selectByGroup; + } + if (info.limit) { + this.limit = info.limit; + } + if (info.searchFilter) { + this.searchFilter = info.searchFilter; + } + if (info.timeoutDelay != null) { + this.timeoutDelay = info.timeoutDelay; + } + this.addToBody = (info.addToBody === true ? true : false); + } + Config.prototype.searchFilter = function (opt, search) { + return opt.text.toLowerCase().indexOf(search.toLowerCase()) !== -1; + }; + return Config; +}()); +exports.Config = Config; + + +/***/ }), +/* 4 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + +exports.__esModule = true; +var helper_1 = __webpack_require__(0); +var Select = (function () { + function Select(info) { + this.triggerMutationObserver = true; + this.element = info.select; + this.main = info.main; + if (this.element.disabled) { + this.main.config.isEnabled = false; + } + this.addAttributes(); + this.addEventListeners(); + this.mutationObserver = null; + this.addMutationObserver(); + var el = this.element; + el.slim = info.main; + } + Select.prototype.setValue = function () { + if (!this.main.data.getSelected()) { + return; + } + if (this.main.config.isMultiple) { + var selected = this.main.data.getSelected(); + var options = this.element.options; + for (var _i = 0, options_1 = options; _i < options_1.length; _i++) { + var o = options_1[_i]; + o.selected = false; + for (var _a = 0, selected_1 = selected; _a < selected_1.length; _a++) { + var s = selected_1[_a]; + if (s.value === o.value) { + o.selected = true; + } + } + } + } + else { + var selected = this.main.data.getSelected(); + this.element.value = (selected ? selected.value : ''); + } + this.main.data.isOnChangeEnabled = false; + this.element.dispatchEvent(new CustomEvent('change', { bubbles: true })); + this.main.data.isOnChangeEnabled = true; + }; + Select.prototype.addAttributes = function () { + this.element.tabIndex = -1; + this.element.style.display = 'none'; + this.element.dataset.ssid = this.main.config.id; + }; + Select.prototype.addEventListeners = function () { + var _this = this; + this.element.addEventListener('change', function (e) { + _this.main.data.setSelectedFromSelect(); + _this.main.render(); + }); + }; + Select.prototype.addMutationObserver = function () { + var _this = this; + if (this.main.config.isAjax) { + return; + } + this.mutationObserver = new MutationObserver(function (mutations) { + if (!_this.triggerMutationObserver) { + return; + } + _this.main.data.parseSelectData(); + _this.main.data.setSelectedFromSelect(); + _this.main.render(); + mutations.forEach(function (mutation) { + if (mutation.attributeName === 'class') { + _this.main.slim.updateContainerDivClass(_this.main.slim.container); + } + }); + }); + this.observeMutationObserver(); + }; + Select.prototype.observeMutationObserver = function () { + if (!this.mutationObserver) { + return; + } + this.mutationObserver.observe(this.element, { + attributes: true, + childList: true, + characterData: true + }); + }; + Select.prototype.disconnectMutationObserver = function () { + if (this.mutationObserver) { + this.mutationObserver.disconnect(); + } + }; + Select.prototype.create = function (data) { + this.element.innerHTML = ''; + for (var _i = 0, data_1 = data; _i < data_1.length; _i++) { + var d = data_1[_i]; + if (d.hasOwnProperty('options')) { + var optgroupObject = d; + var optgroupEl = document.createElement('optgroup'); + optgroupEl.label = optgroupObject.label; + if (optgroupObject.options) { + for (var _a = 0, _b = optgroupObject.options; _a < _b.length; _a++) { + var oo = _b[_a]; + optgroupEl.appendChild(this.createOption(oo)); + } + } + this.element.appendChild(optgroupEl); + } + else { + this.element.appendChild(this.createOption(d)); + } + } + }; + Select.prototype.createOption = function (info) { + var optionEl = document.createElement('option'); + optionEl.value = info.value !== '' ? info.value : info.text; + optionEl.innerHTML = info.innerHTML || info.text; + if (info.selected) { + optionEl.selected = info.selected; + } + if (info.display === false) { + optionEl.style.display = 'none'; + } + if (info.disabled) { + optionEl.disabled = true; + } + if (info.placeholder) { + optionEl.setAttribute('data-placeholder', 'true'); + } + if (info.mandatory) { + optionEl.setAttribute('data-mandatory', 'true'); + } + if (info["class"]) { + info["class"].split(' ').forEach(function (optionClass) { + optionEl.classList.add(optionClass); + }); + } + if (info.data && typeof info.data === 'object') { + Object.keys(info.data).forEach(function (key) { + optionEl.setAttribute('data-' + helper_1.kebabCase(key), info.data[key]); + }); + } + return optionEl; + }; + return Select; +}()); +exports.Select = Select; + + +/***/ }), +/* 5 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + +exports.__esModule = true; +var helper_1 = __webpack_require__(0); +var data_1 = __webpack_require__(1); +var Slim = (function () { + function Slim(info) { + this.main = info.main; + this.container = this.containerDiv(); + this.content = this.contentDiv(); + this.search = this.searchDiv(); + this.list = this.listDiv(); + this.options(); + this.singleSelected = null; + this.multiSelected = null; + if (this.main.config.isMultiple) { + this.multiSelected = this.multiSelectedDiv(); + if (this.multiSelected) { + this.container.appendChild(this.multiSelected.container); + } + } + else { + this.singleSelected = this.singleSelectedDiv(); + this.container.appendChild(this.singleSelected.container); + } + if (this.main.config.addToBody) { + this.content.classList.add(this.main.config.id); + document.body.appendChild(this.content); + } + else { + this.container.appendChild(this.content); + } + this.content.appendChild(this.search.container); + this.content.appendChild(this.list); + } + Slim.prototype.containerDiv = function () { + var container = document.createElement('div'); + container.style.cssText = this.main.config.style; + this.updateContainerDivClass(container); + return container; + }; + Slim.prototype.updateContainerDivClass = function (container) { + this.main.config["class"] = this.main.select.element.className.split(' '); + container.className = ''; + container.classList.add(this.main.config.id); + container.classList.add(this.main.config.main); + for (var _i = 0, _a = this.main.config["class"]; _i < _a.length; _i++) { + var c = _a[_i]; + if (c.trim() !== '') { + container.classList.add(c); + } + } + }; + Slim.prototype.singleSelectedDiv = function () { + var _this = this; + var container = document.createElement('div'); + container.classList.add(this.main.config.singleSelected); + var placeholder = document.createElement('span'); + placeholder.classList.add('placeholder'); + container.appendChild(placeholder); + var deselect = document.createElement('span'); + deselect.innerHTML = this.main.config.deselectLabel; + deselect.classList.add('ss-deselect'); + deselect.onclick = function (e) { + e.stopPropagation(); + if (!_this.main.config.isEnabled) { + return; + } + _this.main.set(''); + }; + container.appendChild(deselect); + var arrowContainer = document.createElement('span'); + arrowContainer.classList.add(this.main.config.arrow); + var arrowIcon = document.createElement('span'); + arrowIcon.classList.add('arrow-down'); + arrowContainer.appendChild(arrowIcon); + container.appendChild(arrowContainer); + container.onclick = function () { + if (!_this.main.config.isEnabled) { + return; + } + _this.main.data.contentOpen ? _this.main.close() : _this.main.open(); + }; + return { + container: container, + placeholder: placeholder, + deselect: deselect, + arrowIcon: { + container: arrowContainer, + arrow: arrowIcon + } + }; + }; + Slim.prototype.placeholder = function () { + var selected = this.main.data.getSelected(); + if (selected === null || (selected && selected.placeholder)) { + var placeholder = document.createElement('span'); + placeholder.classList.add(this.main.config.disabled); + placeholder.innerHTML = this.main.config.placeholderText; + if (this.singleSelected) { + this.singleSelected.placeholder.innerHTML = placeholder.outerHTML; + } + } + else { + var selectedValue = ''; + if (selected) { + selectedValue = selected.innerHTML && this.main.config.valuesUseText !== true ? selected.innerHTML : selected.text; + } + if (this.singleSelected) { + this.singleSelected.placeholder.innerHTML = (selected ? selectedValue : ''); + } + } + }; + Slim.prototype.deselect = function () { + if (this.singleSelected) { + if (!this.main.config.allowDeselect) { + this.singleSelected.deselect.classList.add('ss-hide'); + return; + } + if (this.main.selected() === '') { + this.singleSelected.deselect.classList.add('ss-hide'); + } + else { + this.singleSelected.deselect.classList.remove('ss-hide'); + } + } + }; + Slim.prototype.multiSelectedDiv = function () { + var _this = this; + var container = document.createElement('div'); + container.classList.add(this.main.config.multiSelected); + var values = document.createElement('div'); + values.classList.add(this.main.config.values); + container.appendChild(values); + var add = document.createElement('div'); + add.classList.add(this.main.config.add); + var plus = document.createElement('span'); + plus.classList.add(this.main.config.plus); + plus.onclick = function (e) { + if (_this.main.data.contentOpen) { + _this.main.close(); + e.stopPropagation(); + } + }; + add.appendChild(plus); + container.appendChild(add); + container.onclick = function (e) { + if (!_this.main.config.isEnabled) { + return; + } + var target = e.target; + if (!target.classList.contains(_this.main.config.valueDelete)) { + _this.main.data.contentOpen ? _this.main.close() : _this.main.open(); + } + }; + return { + container: container, + values: values, + add: add, + plus: plus + }; + }; + Slim.prototype.values = function () { + if (!this.multiSelected) { + return; + } + var currentNodes = this.multiSelected.values.childNodes; + var selected = this.main.data.getSelected(); + var exists; + var nodesToRemove = []; + for (var _i = 0, currentNodes_1 = currentNodes; _i < currentNodes_1.length; _i++) { + var c = currentNodes_1[_i]; + exists = true; + for (var _a = 0, selected_1 = selected; _a < selected_1.length; _a++) { + var s = selected_1[_a]; + if (String(s.id) === String(c.dataset.id)) { + exists = false; + } + } + if (exists) { + nodesToRemove.push(c); + } + } + for (var _b = 0, nodesToRemove_1 = nodesToRemove; _b < nodesToRemove_1.length; _b++) { + var n = nodesToRemove_1[_b]; + n.classList.add('ss-out'); + this.multiSelected.values.removeChild(n); + } + currentNodes = this.multiSelected.values.childNodes; + for (var s = 0; s < selected.length; s++) { + exists = false; + for (var _c = 0, currentNodes_2 = currentNodes; _c < currentNodes_2.length; _c++) { + var c = currentNodes_2[_c]; + if (String(selected[s].id) === String(c.dataset.id)) { + exists = true; + } + } + if (!exists) { + if (currentNodes.length === 0 || !HTMLElement.prototype.insertAdjacentElement) { + this.multiSelected.values.appendChild(this.valueDiv(selected[s])); + } + else if (s === 0) { + this.multiSelected.values.insertBefore(this.valueDiv(selected[s]), currentNodes[s]); + } + else { + currentNodes[s - 1].insertAdjacentElement('afterend', this.valueDiv(selected[s])); + } + } + } + if (selected.length === 0) { + var placeholder = document.createElement('span'); + placeholder.classList.add(this.main.config.disabled); + placeholder.innerHTML = this.main.config.placeholderText; + this.multiSelected.values.innerHTML = placeholder.outerHTML; + } + }; + Slim.prototype.valueDiv = function (optionObj) { + var _this = this; + var value = document.createElement('div'); + value.classList.add(this.main.config.value); + value.dataset.id = optionObj.id; + var text = document.createElement('span'); + text.classList.add(this.main.config.valueText); + text.innerHTML = (optionObj.innerHTML && this.main.config.valuesUseText !== true ? optionObj.innerHTML : optionObj.text); + value.appendChild(text); + if (!optionObj.mandatory) { + var deleteSpan = document.createElement('span'); + deleteSpan.classList.add(this.main.config.valueDelete); + deleteSpan.innerHTML = this.main.config.deselectLabel; + deleteSpan.onclick = function (e) { + e.preventDefault(); + e.stopPropagation(); + var shouldUpdate = false; + if (!_this.main.beforeOnChange) { + shouldUpdate = true; + } + if (_this.main.beforeOnChange) { + var selected = _this.main.data.getSelected(); + var currentValues = JSON.parse(JSON.stringify(selected)); + for (var i = 0; i < currentValues.length; i++) { + if (currentValues[i].id === optionObj.id) { + currentValues.splice(i, 1); + } + } + var beforeOnchange = _this.main.beforeOnChange(currentValues); + if (beforeOnchange !== false) { + shouldUpdate = true; + } + } + if (shouldUpdate) { + _this.main.data.removeFromSelected(optionObj.id, 'id'); + _this.main.render(); + _this.main.select.setValue(); + _this.main.data.onDataChange(); + } + }; + value.appendChild(deleteSpan); + } + return value; + }; + Slim.prototype.contentDiv = function () { + var container = document.createElement('div'); + container.classList.add(this.main.config.content); + return container; + }; + Slim.prototype.searchDiv = function () { + var _this = this; + var container = document.createElement('div'); + var input = document.createElement('input'); + var addable = document.createElement('div'); + container.classList.add(this.main.config.search); + var searchReturn = { + container: container, + input: input + }; + if (!this.main.config.showSearch) { + container.classList.add(this.main.config.hide); + input.readOnly = true; + } + input.type = 'search'; + input.placeholder = this.main.config.searchPlaceholder; + input.tabIndex = 0; + input.setAttribute('aria-label', this.main.config.searchPlaceholder); + input.setAttribute('autocapitalize', 'off'); + input.setAttribute('autocomplete', 'off'); + input.setAttribute('autocorrect', 'off'); + input.onclick = function (e) { + setTimeout(function () { + var target = e.target; + if (target.value === '') { + _this.main.search(''); + } + }, 10); + }; + input.onkeydown = function (e) { + if (e.key === 'ArrowUp') { + _this.main.open(); + _this.highlightUp(); + e.preventDefault(); + } + else if (e.key === 'ArrowDown') { + _this.main.open(); + _this.highlightDown(); + e.preventDefault(); + } + else if (e.key === 'Tab') { + if (!_this.main.data.contentOpen) { + setTimeout(function () { _this.main.close(); }, _this.main.config.timeoutDelay); + } + else { + _this.main.close(); + } + } + else if (e.key === 'Enter') { + e.preventDefault(); + } + }; + input.onkeyup = function (e) { + var target = e.target; + if (e.key === 'Enter') { + if (_this.main.addable && e.ctrlKey) { + addable.click(); + e.preventDefault(); + e.stopPropagation(); + return; + } + var highlighted = _this.list.querySelector('.' + _this.main.config.highlighted); + if (highlighted) { + highlighted.click(); + } + } + else if (e.key === 'ArrowUp' || e.key === 'ArrowDown') { + } + else if (e.key === 'Escape') { + _this.main.close(); + } + else { + if (_this.main.config.showSearch && _this.main.data.contentOpen) { + _this.main.search(target.value); + } + else { + input.value = ''; + } + } + e.preventDefault(); + e.stopPropagation(); + }; + input.onfocus = function () { _this.main.open(); }; + container.appendChild(input); + if (this.main.addable) { + addable.classList.add(this.main.config.addable); + addable.innerHTML = '+'; + addable.onclick = function (e) { + if (_this.main.addable) { + e.preventDefault(); + e.stopPropagation(); + var inputValue = _this.search.input.value; + if (inputValue.trim() === '') { + _this.search.input.focus(); + return; + } + var addableValue = _this.main.addable(inputValue); + var addableValueStr_1 = ''; + if (!addableValue) { + return; + } + if (typeof addableValue === 'object') { + var validValue = data_1.validateOption(addableValue); + if (validValue) { + _this.main.addData(addableValue); + addableValueStr_1 = (addableValue.value ? addableValue.value : addableValue.text); + } + } + else { + _this.main.addData(_this.main.data.newOption({ + text: addableValue, + value: addableValue + })); + addableValueStr_1 = addableValue; + } + _this.main.search(''); + setTimeout(function () { + _this.main.set(addableValueStr_1, 'value', false, false); + }, 100); + if (_this.main.config.closeOnSelect) { + setTimeout(function () { + _this.main.close(); + }, 100); + } + } + }; + container.appendChild(addable); + searchReturn.addable = addable; + } + return searchReturn; + }; + Slim.prototype.highlightUp = function () { + var highlighted = this.list.querySelector('.' + this.main.config.highlighted); + var prev = null; + if (highlighted) { + prev = highlighted.previousSibling; + while (prev !== null) { + if (prev.classList.contains(this.main.config.disabled)) { + prev = prev.previousSibling; + continue; + } + else { + break; + } + } + } + else { + var allOptions = this.list.querySelectorAll('.' + this.main.config.option + ':not(.' + this.main.config.disabled + ')'); + prev = allOptions[allOptions.length - 1]; + } + if (prev && prev.classList.contains(this.main.config.optgroupLabel)) { + prev = null; + } + if (prev === null) { + var parent_1 = highlighted.parentNode; + if (parent_1.classList.contains(this.main.config.optgroup)) { + if (parent_1.previousSibling) { + var prevNodes = parent_1.previousSibling.querySelectorAll('.' + this.main.config.option + ':not(.' + this.main.config.disabled + ')'); + if (prevNodes.length) { + prev = prevNodes[prevNodes.length - 1]; + } + } + } + } + if (prev) { + if (highlighted) { + highlighted.classList.remove(this.main.config.highlighted); + } + prev.classList.add(this.main.config.highlighted); + helper_1.ensureElementInView(this.list, prev); + } + }; + Slim.prototype.highlightDown = function () { + var highlighted = this.list.querySelector('.' + this.main.config.highlighted); + var next = null; + if (highlighted) { + next = highlighted.nextSibling; + while (next !== null) { + if (next.classList.contains(this.main.config.disabled)) { + next = next.nextSibling; + continue; + } + else { + break; + } + } + } + else { + next = this.list.querySelector('.' + this.main.config.option + ':not(.' + this.main.config.disabled + ')'); + } + if (next === null && highlighted !== null) { + var parent_2 = highlighted.parentNode; + if (parent_2.classList.contains(this.main.config.optgroup)) { + if (parent_2.nextSibling) { + var sibling = parent_2.nextSibling; + next = sibling.querySelector('.' + this.main.config.option + ':not(.' + this.main.config.disabled + ')'); + } + } + } + if (next) { + if (highlighted) { + highlighted.classList.remove(this.main.config.highlighted); + } + next.classList.add(this.main.config.highlighted); + helper_1.ensureElementInView(this.list, next); + } + }; + Slim.prototype.listDiv = function () { + var list = document.createElement('div'); + list.classList.add(this.main.config.list); + return list; + }; + Slim.prototype.options = function (content) { + if (content === void 0) { content = ''; } + var data = this.main.data.filtered || this.main.data.data; + this.list.innerHTML = ''; + if (content !== '') { + var searching = document.createElement('div'); + searching.classList.add(this.main.config.option); + searching.classList.add(this.main.config.disabled); + searching.innerHTML = content; + this.list.appendChild(searching); + return; + } + if (this.main.config.isAjax && this.main.config.isSearching) { + var searching = document.createElement('div'); + searching.classList.add(this.main.config.option); + searching.classList.add(this.main.config.disabled); + searching.innerHTML = this.main.config.searchingText; + this.list.appendChild(searching); + return; + } + if (data.length === 0) { + var noResults = document.createElement('div'); + noResults.classList.add(this.main.config.option); + noResults.classList.add(this.main.config.disabled); + noResults.innerHTML = this.main.config.searchText; + this.list.appendChild(noResults); + return; + } + var _loop_1 = function (d) { + if (d.hasOwnProperty('label')) { + var item = d; + var optgroupEl_1 = document.createElement('div'); + optgroupEl_1.classList.add(this_1.main.config.optgroup); + var optgroupLabel = document.createElement('div'); + optgroupLabel.classList.add(this_1.main.config.optgroupLabel); + if (this_1.main.config.selectByGroup && this_1.main.config.isMultiple) { + optgroupLabel.classList.add(this_1.main.config.optgroupLabelSelectable); + } + optgroupLabel.innerHTML = item.label; + optgroupEl_1.appendChild(optgroupLabel); + var options = item.options; + if (options) { + for (var _i = 0, options_1 = options; _i < options_1.length; _i++) { + var o = options_1[_i]; + optgroupEl_1.appendChild(this_1.option(o)); + } + if (this_1.main.config.selectByGroup && this_1.main.config.isMultiple) { + var master_1 = this_1; + optgroupLabel.addEventListener('click', function (e) { + e.preventDefault(); + e.stopPropagation(); + for (var _i = 0, _a = optgroupEl_1.children; _i < _a.length; _i++) { + var childEl = _a[_i]; + if (childEl.className.indexOf(master_1.main.config.option) !== -1) { + childEl.click(); + } + } + }); + } + } + this_1.list.appendChild(optgroupEl_1); + } + else { + this_1.list.appendChild(this_1.option(d)); + } + }; + var this_1 = this; + for (var _i = 0, data_2 = data; _i < data_2.length; _i++) { + var d = data_2[_i]; + _loop_1(d); + } + }; + Slim.prototype.option = function (data) { + if (data.placeholder) { + var placeholder = document.createElement('div'); + placeholder.classList.add(this.main.config.option); + placeholder.classList.add(this.main.config.hide); + return placeholder; + } + var optionEl = document.createElement('div'); + optionEl.classList.add(this.main.config.option); + if (data["class"]) { + data["class"].split(' ').forEach(function (dataClass) { + optionEl.classList.add(dataClass); + }); + } + if (data.style) { + optionEl.style.cssText = data.style; + } + var selected = this.main.data.getSelected(); + optionEl.dataset.id = data.id; + if (this.main.config.searchHighlight && this.main.slim && data.innerHTML && this.main.slim.search.input.value.trim() !== '') { + optionEl.innerHTML = helper_1.highlight(data.innerHTML, this.main.slim.search.input.value, this.main.config.searchHighlighter); + } + else if (data.innerHTML) { + optionEl.innerHTML = data.innerHTML; + } + if (this.main.config.showOptionTooltips && optionEl.textContent) { + optionEl.setAttribute('title', optionEl.textContent); + } + var master = this; + optionEl.addEventListener('click', function (e) { + e.preventDefault(); + e.stopPropagation(); + var element = this; + var elementID = element.dataset.id; + if (data.selected === true && master.main.config.allowDeselectOption) { + var shouldUpdate = false; + if (!master.main.beforeOnChange || !master.main.config.isMultiple) { + shouldUpdate = true; + } + if (master.main.beforeOnChange && master.main.config.isMultiple) { + var selectedValues = master.main.data.getSelected(); + var currentValues = JSON.parse(JSON.stringify(selectedValues)); + for (var i = 0; i < currentValues.length; i++) { + if (currentValues[i].id === elementID) { + currentValues.splice(i, 1); + } + } + var beforeOnchange = master.main.beforeOnChange(currentValues); + if (beforeOnchange !== false) { + shouldUpdate = true; + } + } + if (shouldUpdate) { + if (master.main.config.isMultiple) { + master.main.data.removeFromSelected(elementID, 'id'); + master.main.render(); + master.main.select.setValue(); + master.main.data.onDataChange(); + } + else { + master.main.set(''); + } + } + } + else { + if (data.disabled || data.selected) { + return; + } + if (master.main.config.limit && Array.isArray(selected) && master.main.config.limit <= selected.length) { + return; + } + if (master.main.beforeOnChange) { + var value = void 0; + var objectInfo = JSON.parse(JSON.stringify(master.main.data.getObjectFromData(elementID))); + objectInfo.selected = true; + if (master.main.config.isMultiple) { + value = JSON.parse(JSON.stringify(selected)); + value.push(objectInfo); + } + else { + value = JSON.parse(JSON.stringify(objectInfo)); + } + var beforeOnchange = master.main.beforeOnChange(value); + if (beforeOnchange !== false) { + master.main.set(elementID, 'id', master.main.config.closeOnSelect); + } + } + else { + master.main.set(elementID, 'id', master.main.config.closeOnSelect); + } + } + }); + var isSelected = selected && helper_1.isValueInArrayOfObjects(selected, 'id', data.id); + if (data.disabled || isSelected) { + optionEl.onclick = null; + if (!master.main.config.allowDeselectOption) { + optionEl.classList.add(this.main.config.disabled); + } + if (master.main.config.hideSelectedOption) { + optionEl.classList.add(this.main.config.hide); + } + } + if (isSelected) { + optionEl.classList.add(this.main.config.optionSelected); + } + else { + optionEl.classList.remove(this.main.config.optionSelected); + } + return optionEl; + }; + return Slim; +}()); +exports.Slim = Slim; + + +/***/ }) +/******/ ])["default"]; +}); \ No newline at end of file diff --git a/website/js/vendor/slimselect/slimselect.min.css b/website/js/vendor/slimselect/slimselect.min.css new file mode 100644 index 0000000..753635a --- /dev/null +++ b/website/js/vendor/slimselect/slimselect.min.css @@ -0,0 +1 @@ +.ss-main{position:relative;display:inline-block;user-select:none;color:#666;width:100%}.ss-main .ss-single-selected{display:flex;cursor:pointer;width:100%;height:30px;padding:6px;border:1px solid #dcdee2;border-radius:4px;background-color:#fff;outline:0;box-sizing:border-box;transition:background-color .2s}.ss-main .ss-single-selected.ss-disabled{background-color:#dcdee2;cursor:not-allowed}.ss-main .ss-single-selected.ss-open-above{border-top-left-radius:0;border-top-right-radius:0}.ss-main .ss-single-selected.ss-open-below{border-bottom-left-radius:0;border-bottom-right-radius:0}.ss-main .ss-single-selected .placeholder{display:flex;flex:1 1 100%;align-items:center;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;text-align:left;width:calc(100% - 30px);line-height:1em;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.ss-main .ss-single-selected .placeholder *{display:flex;align-items:center;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;width:auto}.ss-main .ss-single-selected .placeholder .ss-disabled{color:#dedede}.ss-main .ss-single-selected .ss-deselect{display:flex;align-items:center;justify-content:flex-end;flex:0 1 auto;margin:0 6px 0 6px;font-weight:700}.ss-main .ss-single-selected .ss-deselect.ss-hide{display:none}.ss-main .ss-single-selected .ss-arrow{display:flex;align-items:center;justify-content:flex-end;flex:0 1 auto;margin:0 6px 0 6px}.ss-main .ss-single-selected .ss-arrow span{border:solid #666;border-width:0 2px 2px 0;display:inline-block;padding:3px;transition:transform .2s,margin .2s}.ss-main .ss-single-selected .ss-arrow span.arrow-up{transform:rotate(-135deg);margin:3px 0 0 0}.ss-main .ss-single-selected .ss-arrow span.arrow-down{transform:rotate(45deg);margin:-3px 0 0 0}.ss-main .ss-multi-selected{display:flex;flex-direction:row;cursor:pointer;min-height:30px;width:100%;padding:0 0 0 3px;border:1px solid #dcdee2;border-radius:4px;background-color:#fff;outline:0;box-sizing:border-box;transition:background-color .2s}.ss-main .ss-multi-selected.ss-disabled{background-color:#dcdee2;cursor:not-allowed}.ss-main .ss-multi-selected.ss-disabled .ss-values .ss-disabled{color:#666}.ss-main .ss-multi-selected.ss-disabled .ss-values .ss-value .ss-value-delete{cursor:not-allowed}.ss-main .ss-multi-selected.ss-open-above{border-top-left-radius:0;border-top-right-radius:0}.ss-main .ss-multi-selected.ss-open-below{border-bottom-left-radius:0;border-bottom-right-radius:0}.ss-main .ss-multi-selected .ss-values{display:flex;flex-wrap:wrap;justify-content:flex-start;flex:1 1 100%;width:calc(100% - 30px)}.ss-main .ss-multi-selected .ss-values .ss-disabled{display:flex;padding:4px 5px;margin:2px 0;line-height:1em;align-items:center;width:100%;color:#dedede;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}@keyframes scaleIn{0%{transform:scale(0);opacity:0}100%{transform:scale(1);opacity:1}}@keyframes scaleOut{0%{transform:scale(1);opacity:1}100%{transform:scale(0);opacity:0}}.ss-main .ss-multi-selected .ss-values .ss-value{display:flex;user-select:none;align-items:center;font-size:12px;padding:3px 5px;margin:3px 5px 3px 0;color:#fff;background-color:#5897fb;border-radius:4px;animation-name:scaleIn;animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:both}.ss-main .ss-multi-selected .ss-values .ss-value.ss-out{animation-name:scaleOut;animation-duration:.2s;animation-timing-function:ease-out}.ss-main .ss-multi-selected .ss-values .ss-value .ss-value-delete{margin:0 0 0 5px;cursor:pointer}.ss-main .ss-multi-selected .ss-add{display:flex;flex:0 1 3px;margin:9px 12px 0 5px}.ss-main .ss-multi-selected .ss-add .ss-plus{display:flex;justify-content:center;align-items:center;background:#666;position:relative;height:10px;width:2px;transition:transform .2s}.ss-main .ss-multi-selected .ss-add .ss-plus:after{background:#666;content:"";position:absolute;height:2px;width:10px;left:-4px;top:4px}.ss-main .ss-multi-selected .ss-add .ss-plus.ss-cross{transform:rotate(45deg)}.ss-content{position:absolute;width:100%;margin:-1px 0 0 0;box-sizing:border-box;border:solid 1px #dcdee2;z-index:1010;background-color:#fff;transform-origin:center top;transition:transform .2s,opacity .2s;opacity:0;transform:scaleY(0)}.ss-content.ss-open{display:block;opacity:1;transform:scaleY(1)}.ss-content .ss-search{display:flex;flex-direction:row;padding:8px 8px 6px 8px}.ss-content .ss-search.ss-hide{height:0;opacity:0;padding:0;margin:0}.ss-content .ss-search.ss-hide input{height:0;opacity:0;padding:0;margin:0}.ss-content .ss-search input{display:inline-flex;font-size:inherit;line-height:inherit;flex:1 1 auto;width:100%;min-width:0;height:30px;padding:6px 8px;margin:0;border:1px solid #dcdee2;border-radius:4px;background-color:#fff;outline:0;text-align:left;box-sizing:border-box;-webkit-box-sizing:border-box;-webkit-appearance:textfield}.ss-content .ss-search input::placeholder{color:#8a8a8a;vertical-align:middle}.ss-content .ss-search input:focus{box-shadow:0 0 5px #5897fb}.ss-content .ss-search .ss-addable{display:inline-flex;justify-content:center;align-items:center;cursor:pointer;font-size:22px;font-weight:700;flex:0 0 30px;height:30px;margin:0 0 0 8px;border:1px solid #dcdee2;border-radius:4px;box-sizing:border-box}.ss-content .ss-addable{padding-top:0}.ss-content .ss-list{max-height:200px;overflow-x:hidden;overflow-y:auto;text-align:left}.ss-content .ss-list .ss-optgroup .ss-optgroup-label{padding:6px 10px 6px 10px;font-weight:700}.ss-content .ss-list .ss-optgroup .ss-option{padding:6px 6px 6px 25px}.ss-content .ss-list .ss-optgroup-label-selectable{cursor:pointer}.ss-content .ss-list .ss-optgroup-label-selectable:hover{color:#fff;background-color:#5897fb}.ss-content .ss-list .ss-option{padding:6px 10px 6px 10px;cursor:pointer;user-select:none}.ss-content .ss-list .ss-option *{display:inline-block}.ss-content .ss-list .ss-option.ss-highlighted,.ss-content .ss-list .ss-option:hover{color:#fff;background-color:#5897fb}.ss-content .ss-list .ss-option.ss-disabled{cursor:not-allowed;color:#dedede;background-color:#fff}.ss-content .ss-list .ss-option:not(.ss-disabled).ss-option-selected{color:#666;background-color:rgba(88,151,251,.1)}.ss-content .ss-list .ss-option.ss-hide{display:none}.ss-content .ss-list .ss-option .ss-search-highlight{background-color:#fffb8c} \ No newline at end of file diff --git a/website/js/vendor/slimselect/slimselect.min.js b/website/js/vendor/slimselect/slimselect.min.js new file mode 100644 index 0000000..8638634 --- /dev/null +++ b/website/js/vendor/slimselect/slimselect.min.js @@ -0,0 +1 @@ +!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.SlimSelect=t():e.SlimSelect=t()}(window,function(){return s={},n.m=i=[function(e,t,i){"use strict";function s(e,t){t=t||{bubbles:!1,cancelable:!1,detail:void 0};var i=document.createEvent("CustomEvent");return i.initCustomEvent(e,t.bubbles,t.cancelable,t.detail),i}var n;t.__esModule=!0,t.hasClassInTree=function(e,t){function s(e,t){return t&&e&&e.classList&&e.classList.contains(t)?e:null}return s(e,t)||function e(t,i){return t&&t!==document?s(t,i)?t:e(t.parentNode,i):null}(e,t)},t.ensureElementInView=function(e,t){var i=e.scrollTop+e.offsetTop,s=i+e.clientHeight,n=t.offsetTop,a=n+t.clientHeight;n=window.innerHeight?"above":i?t:"below"},t.debounce=function(n,a,o){var l;return void 0===a&&(a=100),void 0===o&&(o=!1),function(){for(var e=[],t=0;t[^<>]*'+l+"")},t.kebabCase=function(e){var t=e.replace(/[A-Z\u00C0-\u00D6\u00D8-\u00DE]/g,function(e){return"-"+e.toLowerCase()});return e[0]===e[0].toUpperCase()?t.substring(1):t},"function"!=typeof(n=window).CustomEvent&&(s.prototype=n.Event.prototype,n.CustomEvent=s)},function(e,t,i){"use strict";t.__esModule=!0;var s=(n.prototype.newOption=function(e){return{id:e.id?e.id:String(Math.floor(1e8*Math.random())),value:e.value?e.value:"",text:e.text?e.text:"",innerHTML:e.innerHTML?e.innerHTML:"",selected:!!e.selected&&e.selected,display:void 0===e.display||e.display,disabled:!!e.disabled&&e.disabled,placeholder:!!e.placeholder&&e.placeholder,class:e.class?e.class:void 0,data:e.data?e.data:{},mandatory:!!e.mandatory&&e.mandatory}},n.prototype.add=function(e){this.data.push({id:String(Math.floor(1e8*Math.random())),value:e.value,text:e.text,innerHTML:"",selected:!1,display:!0,disabled:!1,placeholder:!1,class:void 0,mandatory:e.mandatory,data:{}})},n.prototype.parseSelectData=function(){this.data=[];for(var e=0,t=this.main.select.element.childNodes;e *:not(.tabulator-print-fullscreen) { + display: none !important; +} + +.tabulator-print-table { + border-collapse: collapse; +} + +.tabulator-print-table .tabulator-data-tree-branch { + display: inline-block; + vertical-align: middle; + height: 9px; + width: 7px; + margin-top: -9px; + margin-right: 5px; + border-bottom-left-radius: 1px; + border-left: 2px solid #aaa; + border-bottom: 2px solid #aaa; +} + +.tabulator-print-table .tabulator-print-table-group { + box-sizing: border-box; + border-bottom: 1px solid #999; + border-right: 1px solid #aaa; + border-top: 1px solid #999; + padding: 5px; + padding-left: 10px; + background: #ccc; + font-weight: bold; + min-width: 100%; +} + +.tabulator-print-table .tabulator-print-table-group:hover { + cursor: pointer; + background-color: rgba(0, 0, 0, 0.1); +} + +.tabulator-print-table .tabulator-print-table-group.tabulator-group-visible .tabulator-arrow { + margin-right: 10px; + border-left: 6px solid transparent; + border-right: 6px solid transparent; + border-top: 6px solid #666; + border-bottom: 0; +} + +.tabulator-print-table .tabulator-print-table-group.tabulator-group-level-1 td { + padding-left: 30px !important; +} + +.tabulator-print-table .tabulator-print-table-group.tabulator-group-level-2 td { + padding-left: 50px !important; +} + +.tabulator-print-table .tabulator-print-table-group.tabulator-group-level-3 td { + padding-left: 70px !important; +} + +.tabulator-print-table .tabulator-print-table-group.tabulator-group-level-4 td { + padding-left: 90px !important; +} + +.tabulator-print-table .tabulator-print-table-group.tabulator-group-level-5 td { + padding-left: 110px !important; +} + +.tabulator-print-table .tabulator-print-table-group .tabulator-group-toggle { + display: inline-block; +} + +.tabulator-print-table .tabulator-print-table-group .tabulator-arrow { + display: inline-block; + width: 0; + height: 0; + margin-right: 16px; + border-top: 6px solid transparent; + border-bottom: 6px solid transparent; + border-right: 0; + border-left: 6px solid #666; + vertical-align: middle; +} + +.tabulator-print-table .tabulator-print-table-group span { + margin-left: 10px; + color: #d00; +} + +.tabulator-print-table .tabulator-data-tree-control { + display: -ms-inline-flexbox; + display: inline-flex; + -ms-flex-pack: center; + justify-content: center; + -ms-flex-align: center; + align-items: center; + vertical-align: middle; + height: 11px; + width: 11px; + margin-right: 5px; + border: 1px solid #333; + border-radius: 2px; + background: rgba(0, 0, 0, 0.1); + overflow: hidden; +} + +.tabulator-print-table .tabulator-data-tree-control:hover { + cursor: pointer; + background: rgba(0, 0, 0, 0.2); +} + +.tabulator-print-table .tabulator-data-tree-control .tabulator-data-tree-control-collapse { + display: inline-block; + position: relative; + height: 7px; + width: 1px; + background: transparent; +} + +.tabulator-print-table .tabulator-data-tree-control .tabulator-data-tree-control-collapse:after { + position: absolute; + content: ""; + left: -3px; + top: 3px; + height: 1px; + width: 7px; + background: #333; +} + +.tabulator-print-table .tabulator-data-tree-control .tabulator-data-tree-control-expand { + display: inline-block; + position: relative; + height: 7px; + width: 1px; + background: #333; +} + +.tabulator-print-table .tabulator-data-tree-control .tabulator-data-tree-control-expand:after { + position: absolute; + content: ""; + left: -3px; + top: 3px; + height: 1px; + width: 7px; + background: #333; +} diff --git a/website/js/vendor/tabulator/css/tabulator.min.css b/website/js/vendor/tabulator/css/tabulator.min.css new file mode 100644 index 0000000..92a0dd0 --- /dev/null +++ b/website/js/vendor/tabulator/css/tabulator.min.css @@ -0,0 +1,3 @@ +/* Tabulator v4.8.3 (c) Oliver Folkerd */ +.tabulator{position:relative;border:1px solid #999;background-color:#888;font-size:14px;text-align:left;overflow:hidden;transform:translatez(0)}.tabulator[tabulator-layout=fitDataFill] .tabulator-tableHolder .tabulator-table{min-width:100%}.tabulator[tabulator-layout=fitDataTable]{display:inline-block}.tabulator.tabulator-block-select{-webkit-user-select:none;-ms-user-select:none;user-select:none}.tabulator .tabulator-header{position:relative;box-sizing:border-box;width:100%;border-bottom:1px solid #999;background-color:#e6e6e6;color:#555;font-weight:700;white-space:nowrap;overflow:hidden;-moz-user-select:none;-khtml-user-select:none;-webkit-user-select:none;-o-user-select:none}.tabulator .tabulator-header.tabulator-header-hidden{display:none}.tabulator .tabulator-header .tabulator-col{display:inline-block;position:relative;box-sizing:border-box;border-right:1px solid #aaa;background:#e6e6e6;text-align:left;vertical-align:bottom;overflow:hidden}.tabulator .tabulator-header .tabulator-col.tabulator-moving{position:absolute;border:1px solid #999;background:#cdcdcd;pointer-events:none}.tabulator .tabulator-header .tabulator-col .tabulator-col-content{box-sizing:border-box;position:relative;padding:4px}.tabulator .tabulator-header .tabulator-col .tabulator-col-content .tabulator-header-menu-button{padding:0 8px}.tabulator .tabulator-header .tabulator-col .tabulator-col-content .tabulator-header-menu-button:hover{cursor:pointer;opacity:.6}.tabulator .tabulator-header .tabulator-col .tabulator-col-content .tabulator-col-title-holder{position:relative}.tabulator .tabulator-header .tabulator-col .tabulator-col-content .tabulator-col-title{box-sizing:border-box;width:100%;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;vertical-align:bottom}.tabulator .tabulator-header .tabulator-col .tabulator-col-content .tabulator-col-title .tabulator-title-editor{box-sizing:border-box;width:100%;border:1px solid #999;padding:1px;background:#fff}.tabulator .tabulator-header .tabulator-col .tabulator-col-content .tabulator-col-title .tabulator-header-menu-button+.tabulator-title-editor{width:calc(100% - 22px)}.tabulator .tabulator-header .tabulator-col .tabulator-col-content .tabulator-col-sorter{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;position:absolute;top:0;bottom:0;right:4px}.tabulator .tabulator-header .tabulator-col .tabulator-col-content .tabulator-col-sorter .tabulator-arrow{width:0;height:0;border-left:6px solid transparent;border-right:6px solid transparent;border-bottom:6px solid #bbb}.tabulator .tabulator-header .tabulator-col.tabulator-col-group .tabulator-col-group-cols{position:relative;display:-ms-flexbox;display:flex;border-top:1px solid #aaa;overflow:hidden;margin-right:-1px}.tabulator .tabulator-header .tabulator-col:first-child .tabulator-col-resize-handle.prev{display:none}.tabulator .tabulator-header .tabulator-col .tabulator-header-filter{position:relative;box-sizing:border-box;margin-top:2px;width:100%;text-align:center}.tabulator .tabulator-header .tabulator-col .tabulator-header-filter textarea{height:auto!important}.tabulator .tabulator-header .tabulator-col .tabulator-header-filter svg{margin-top:3px}.tabulator .tabulator-header .tabulator-col .tabulator-header-filter input::-ms-clear{width:0;height:0}.tabulator .tabulator-header .tabulator-col.tabulator-sortable .tabulator-col-title{padding-right:25px}.tabulator .tabulator-header .tabulator-col.tabulator-sortable:hover{cursor:pointer;background-color:#cdcdcd}.tabulator .tabulator-header .tabulator-col.tabulator-sortable[aria-sort=none] .tabulator-col-content .tabulator-col-sorter{color:#bbb}.tabulator .tabulator-header .tabulator-col.tabulator-sortable[aria-sort=none] .tabulator-col-content .tabulator-col-sorter .tabulator-arrow{border-top:none;border-bottom:6px solid #bbb}.tabulator .tabulator-header .tabulator-col.tabulator-sortable[aria-sort=asc] .tabulator-col-content .tabulator-col-sorter{color:#666}.tabulator .tabulator-header .tabulator-col.tabulator-sortable[aria-sort=asc] .tabulator-col-content .tabulator-col-sorter .tabulator-arrow{border-top:none;border-bottom:6px solid #666}.tabulator .tabulator-header .tabulator-col.tabulator-sortable[aria-sort=desc] .tabulator-col-content .tabulator-col-sorter{color:#666}.tabulator .tabulator-header .tabulator-col.tabulator-sortable[aria-sort=desc] .tabulator-col-content .tabulator-col-sorter .tabulator-arrow{border-bottom:none;border-top:6px solid #666;color:#666}.tabulator .tabulator-header .tabulator-col.tabulator-col-vertical .tabulator-col-content .tabulator-col-title{-ms-writing-mode:tb-rl;writing-mode:vertical-rl;text-orientation:mixed;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center}.tabulator .tabulator-header .tabulator-col.tabulator-col-vertical.tabulator-col-vertical-flip .tabulator-col-title{transform:rotate(180deg)}.tabulator .tabulator-header .tabulator-col.tabulator-col-vertical.tabulator-sortable .tabulator-col-title{padding-right:0;padding-top:20px}.tabulator .tabulator-header .tabulator-col.tabulator-col-vertical.tabulator-sortable.tabulator-col-vertical-flip .tabulator-col-title{padding-right:0;padding-bottom:20px}.tabulator .tabulator-header .tabulator-col.tabulator-col-vertical.tabulator-sortable .tabulator-col-sorter{-ms-flex-pack:center;justify-content:center;left:0;right:0;top:4px;bottom:auto}.tabulator .tabulator-header .tabulator-frozen{display:inline-block;position:absolute;z-index:10}.tabulator .tabulator-header .tabulator-frozen.tabulator-frozen-left{border-right:2px solid #aaa}.tabulator .tabulator-header .tabulator-frozen.tabulator-frozen-right{border-left:2px solid #aaa}.tabulator .tabulator-header .tabulator-calcs-holder{box-sizing:border-box;min-width:600%;background:#f3f3f3!important;border-top:1px solid #aaa;border-bottom:1px solid #aaa;overflow:hidden}.tabulator .tabulator-header .tabulator-calcs-holder .tabulator-row{background:#f3f3f3!important}.tabulator .tabulator-header .tabulator-calcs-holder .tabulator-row .tabulator-col-resize-handle{display:none}.tabulator .tabulator-header .tabulator-frozen-rows-holder{min-width:600%}.tabulator .tabulator-header .tabulator-frozen-rows-holder:empty{display:none}.tabulator .tabulator-tableHolder{position:relative;width:100%;white-space:nowrap;overflow:auto;-webkit-overflow-scrolling:touch}.tabulator .tabulator-tableHolder:focus{outline:none}.tabulator .tabulator-tableHolder .tabulator-placeholder{box-sizing:border-box;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;width:100%}.tabulator .tabulator-tableHolder .tabulator-placeholder[tabulator-render-mode=virtual]{min-height:100%;min-width:100%}.tabulator .tabulator-tableHolder .tabulator-placeholder span{display:inline-block;margin:0 auto;padding:10px;color:#ccc;font-weight:700;font-size:20px}.tabulator .tabulator-tableHolder .tabulator-table{position:relative;display:inline-block;background-color:#fff;white-space:nowrap;overflow:visible;color:#333}.tabulator .tabulator-tableHolder .tabulator-table .tabulator-row.tabulator-calcs{font-weight:700;background:#e2e2e2!important}.tabulator .tabulator-tableHolder .tabulator-table .tabulator-row.tabulator-calcs.tabulator-calcs-top{border-bottom:2px solid #aaa}.tabulator .tabulator-tableHolder .tabulator-table .tabulator-row.tabulator-calcs.tabulator-calcs-bottom{border-top:2px solid #aaa}.tabulator .tabulator-footer{padding:5px 10px;border-top:1px solid #999;background-color:#e6e6e6;text-align:right;color:#555;font-weight:700;white-space:nowrap;-ms-user-select:none;user-select:none;-moz-user-select:none;-khtml-user-select:none;-webkit-user-select:none;-o-user-select:none}.tabulator .tabulator-footer .tabulator-calcs-holder{box-sizing:border-box;width:calc(100% + 20px);margin:-5px -10px 5px;text-align:left;background:#f3f3f3!important;border-bottom:1px solid #aaa;border-top:1px solid #aaa;overflow:hidden}.tabulator .tabulator-footer .tabulator-calcs-holder .tabulator-row{background:#f3f3f3!important}.tabulator .tabulator-footer .tabulator-calcs-holder .tabulator-row .tabulator-col-resize-handle{display:none}.tabulator .tabulator-footer .tabulator-calcs-holder:only-child{margin-bottom:-5px;border-bottom:none}.tabulator .tabulator-footer .tabulator-paginator{color:#555;font-family:inherit;font-weight:inherit;font-size:inherit}.tabulator .tabulator-footer .tabulator-page-size{display:inline-block;margin:0 5px;padding:2px 5px;border:1px solid #aaa;border-radius:3px}.tabulator .tabulator-footer .tabulator-pages{margin:0 7px}.tabulator .tabulator-footer .tabulator-page{display:inline-block;margin:0 2px;padding:2px 5px;border:1px solid #aaa;border-radius:3px;background:hsla(0,0%,100%,.2)}.tabulator .tabulator-footer .tabulator-page.active{color:#d00}.tabulator .tabulator-footer .tabulator-page:disabled{opacity:.5}.tabulator .tabulator-footer .tabulator-page:not(.disabled):hover{cursor:pointer;background:rgba(0,0,0,.2);color:#fff}.tabulator .tabulator-col-resize-handle{position:absolute;right:0;top:0;bottom:0;width:5px}.tabulator .tabulator-col-resize-handle.prev{left:0;right:auto}.tabulator .tabulator-col-resize-handle:hover{cursor:ew-resize}.tabulator .tabulator-loader{position:absolute;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;top:0;left:0;z-index:100;height:100%;width:100%;background:rgba(0,0,0,.4);text-align:center}.tabulator .tabulator-loader .tabulator-loader-msg{display:inline-block;margin:0 auto;padding:10px 20px;border-radius:10px;background:#fff;font-weight:700;font-size:16px}.tabulator .tabulator-loader .tabulator-loader-msg.tabulator-loading{border:4px solid #333;color:#000}.tabulator .tabulator-loader .tabulator-loader-msg.tabulator-error{border:4px solid #d00;color:#590000}.tabulator-row{position:relative;box-sizing:border-box;min-height:22px;background-color:#fff}.tabulator-row.tabulator-row-even{background-color:#efefef}.tabulator-row.tabulator-selectable:hover{background-color:#bbb;cursor:pointer}.tabulator-row.tabulator-selected{background-color:#9abcea}.tabulator-row.tabulator-selected:hover{background-color:#769bcc;cursor:pointer}.tabulator-row.tabulator-row-moving{border:1px solid #000;background:#fff}.tabulator-row.tabulator-moving{position:absolute;border-top:1px solid #aaa;border-bottom:1px solid #aaa;pointer-events:none;z-index:15}.tabulator-row .tabulator-row-resize-handle{position:absolute;right:0;bottom:0;left:0;height:5px}.tabulator-row .tabulator-row-resize-handle.prev{top:0;bottom:auto}.tabulator-row .tabulator-row-resize-handle:hover{cursor:ns-resize}.tabulator-row .tabulator-frozen{display:inline-block;position:absolute;background-color:inherit;z-index:10}.tabulator-row .tabulator-frozen.tabulator-frozen-left{border-right:2px solid #aaa}.tabulator-row .tabulator-frozen.tabulator-frozen-right{border-left:2px solid #aaa}.tabulator-row .tabulator-responsive-collapse{box-sizing:border-box;padding:5px;border-top:1px solid #aaa;border-bottom:1px solid #aaa}.tabulator-row .tabulator-responsive-collapse:empty{display:none}.tabulator-row .tabulator-responsive-collapse table{font-size:14px}.tabulator-row .tabulator-responsive-collapse table tr td{position:relative}.tabulator-row .tabulator-responsive-collapse table tr td:first-of-type{padding-right:10px}.tabulator-row .tabulator-cell{display:inline-block;position:relative;box-sizing:border-box;padding:4px;border-right:1px solid #aaa;vertical-align:middle;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.tabulator-row .tabulator-cell.tabulator-editing{border:1px solid #1d68cd;padding:0}.tabulator-row .tabulator-cell.tabulator-editing input,.tabulator-row .tabulator-cell.tabulator-editing select{border:1px;background:transparent}.tabulator-row .tabulator-cell.tabulator-validation-fail{border:1px solid #d00}.tabulator-row .tabulator-cell.tabulator-validation-fail input,.tabulator-row .tabulator-cell.tabulator-validation-fail select{border:1px;background:transparent;color:#d00}.tabulator-row .tabulator-cell:first-child .tabulator-col-resize-handle.prev{display:none}.tabulator-row .tabulator-cell.tabulator-row-handle{display:-ms-inline-flexbox;display:inline-flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;-moz-user-select:none;-khtml-user-select:none;-webkit-user-select:none;-o-user-select:none}.tabulator-row .tabulator-cell.tabulator-row-handle .tabulator-row-handle-box{width:80%}.tabulator-row .tabulator-cell.tabulator-row-handle .tabulator-row-handle-box .tabulator-row-handle-bar{width:100%;height:3px;margin-top:2px;background:#666}.tabulator-row .tabulator-cell .tabulator-data-tree-branch{display:inline-block;vertical-align:middle;height:9px;width:7px;margin-top:-9px;margin-right:5px;border-bottom-left-radius:1px;border-left:2px solid #aaa;border-bottom:2px solid #aaa}.tabulator-row .tabulator-cell .tabulator-data-tree-control{display:-ms-inline-flexbox;display:inline-flex;-ms-flex-pack:center;justify-content:center;-ms-flex-align:center;align-items:center;vertical-align:middle;height:11px;width:11px;margin-right:5px;border:1px solid #333;border-radius:2px;background:rgba(0,0,0,.1);overflow:hidden}.tabulator-row .tabulator-cell .tabulator-data-tree-control:hover{cursor:pointer;background:rgba(0,0,0,.2)}.tabulator-row .tabulator-cell .tabulator-data-tree-control .tabulator-data-tree-control-collapse{display:inline-block;position:relative;height:7px;width:1px;background:transparent}.tabulator-row .tabulator-cell .tabulator-data-tree-control .tabulator-data-tree-control-collapse:after{position:absolute;content:"";left:-3px;top:3px;height:1px;width:7px;background:#333}.tabulator-row .tabulator-cell .tabulator-data-tree-control .tabulator-data-tree-control-expand{display:inline-block;position:relative;height:7px;width:1px;background:#333}.tabulator-row .tabulator-cell .tabulator-data-tree-control .tabulator-data-tree-control-expand:after{position:absolute;content:"";left:-3px;top:3px;height:1px;width:7px;background:#333}.tabulator-row .tabulator-cell .tabulator-responsive-collapse-toggle{display:-ms-inline-flexbox;display:inline-flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;-moz-user-select:none;-khtml-user-select:none;-webkit-user-select:none;-o-user-select:none;height:15px;width:15px;border-radius:20px;background:#666;color:#fff;font-weight:700;font-size:1.1em}.tabulator-row .tabulator-cell .tabulator-responsive-collapse-toggle:hover{opacity:.7}.tabulator-row .tabulator-cell .tabulator-responsive-collapse-toggle.open .tabulator-responsive-collapse-toggle-close{display:initial}.tabulator-row .tabulator-cell .tabulator-responsive-collapse-toggle.open .tabulator-responsive-collapse-toggle-open,.tabulator-row .tabulator-cell .tabulator-responsive-collapse-toggle .tabulator-responsive-collapse-toggle-close{display:none}.tabulator-row .tabulator-cell .tabulator-traffic-light{display:inline-block;height:14px;width:14px;border-radius:14px}.tabulator-row.tabulator-group{box-sizing:border-box;border-bottom:1px solid #999;border-right:1px solid #aaa;border-top:1px solid #999;padding:5px;padding-left:10px;background:#ccc;font-weight:700;min-width:100%}.tabulator-row.tabulator-group:hover{cursor:pointer;background-color:rgba(0,0,0,.1)}.tabulator-row.tabulator-group.tabulator-group-visible .tabulator-arrow{margin-right:10px;border-left:6px solid transparent;border-right:6px solid transparent;border-top:6px solid #666;border-bottom:0}.tabulator-row.tabulator-group.tabulator-group-level-1{padding-left:30px}.tabulator-row.tabulator-group.tabulator-group-level-2{padding-left:50px}.tabulator-row.tabulator-group.tabulator-group-level-3{padding-left:70px}.tabulator-row.tabulator-group.tabulator-group-level-4{padding-left:90px}.tabulator-row.tabulator-group.tabulator-group-level-5{padding-left:110px}.tabulator-row.tabulator-group .tabulator-group-toggle{display:inline-block}.tabulator-row.tabulator-group .tabulator-arrow{display:inline-block;width:0;height:0;margin-right:16px;border-top:6px solid transparent;border-bottom:6px solid transparent;border-right:0;border-left:6px solid #666;vertical-align:middle}.tabulator-row.tabulator-group span{margin-left:10px;color:#d00}.tabulator-menu{position:absolute;display:inline-block;box-sizing:border-box;background:#fff;border:1px solid #aaa;box-shadow:0 0 5px 0 rgba(0,0,0,.2);font-size:14px;overflow-y:auto;-webkit-overflow-scrolling:touch;z-index:10000}.tabulator-menu .tabulator-menu-item{padding:5px 10px;-webkit-user-select:none;-ms-user-select:none;user-select:none}.tabulator-menu .tabulator-menu-item.tabulator-menu-item-disabled{opacity:.5}.tabulator-menu .tabulator-menu-item:not(.tabulator-menu-item-disabled):hover{cursor:pointer;background:#efefef}.tabulator-menu .tabulator-menu-separator{border-top:1px solid #aaa}.tabulator-edit-select-list{position:absolute;display:inline-block;box-sizing:border-box;max-height:200px;background:#fff;border:1px solid #aaa;font-size:14px;overflow-y:auto;-webkit-overflow-scrolling:touch;z-index:10000}.tabulator-edit-select-list .tabulator-edit-select-list-item{padding:4px;color:#333}.tabulator-edit-select-list .tabulator-edit-select-list-item.active{color:#fff;background:#1d68cd}.tabulator-edit-select-list .tabulator-edit-select-list-item.active.focused{outline:1px solid hsla(0,0%,100%,.5)}.tabulator-edit-select-list .tabulator-edit-select-list-item.focused{outline:1px solid #1d68cd}.tabulator-edit-select-list .tabulator-edit-select-list-item:hover{cursor:pointer;color:#fff;background:#1d68cd}.tabulator-edit-select-list .tabulator-edit-select-list-notice{padding:4px;color:#333;text-align:center}.tabulator-edit-select-list .tabulator-edit-select-list-group{border-bottom:1px solid #aaa;padding:4px;padding-top:6px;color:#333;font-weight:700}.tabulator.tabulator-ltr{direction:ltr}.tabulator.tabulator-rtl{text-align:initial;direction:rtl}.tabulator.tabulator-rtl .tabulator-header .tabulator-col{text-align:initial;border-left:1px solid #aaa;border-right:initial}.tabulator.tabulator-rtl .tabulator-header .tabulator-col.tabulator-col-group .tabulator-col-group-cols{margin-right:0;margin-left:-1px}.tabulator.tabulator-rtl .tabulator-header .tabulator-col.tabulator-sortable .tabulator-col-title{padding-right:0;padding-left:25px}.tabulator.tabulator-rtl .tabulator-header .tabulator-col .tabulator-col-content .tabulator-arrow{left:8px;right:auto}.tabulator.tabulator-rtl .tabulator-row .tabulator-cell{border-right:initial;border-left:1px solid #aaa}.tabulator.tabulator-rtl .tabulator-row .tabulator-cell .tabulator-data-tree-branch{margin-right:0;margin-left:5px;border-bottom-left-radius:0;border-bottom-right-radius:1px;border-left:initial;border-right:2px solid #aaa}.tabulator.tabulator-rtl .tabulator-row .tabulator-cell .tabulator-data-tree-control{margin-right:0;margin-left:5px}.tabulator.tabulator-rtl .tabulator-col-resize-handle{position:absolute;left:0;right:auto}.tabulator.tabulator-rtl .tabulator-col-resize-handle.prev{right:0;left:auto}.tabulator-print-fullscreen{position:absolute;top:0;bottom:0;left:0;right:0;z-index:10000}body.tabulator-print-fullscreen-hide>:not(.tabulator-print-fullscreen){display:none!important}.tabulator-print-table{border-collapse:collapse}.tabulator-print-table .tabulator-data-tree-branch{display:inline-block;vertical-align:middle;height:9px;width:7px;margin-top:-9px;margin-right:5px;border-bottom-left-radius:1px;border-left:2px solid #aaa;border-bottom:2px solid #aaa}.tabulator-print-table .tabulator-print-table-group{box-sizing:border-box;border-bottom:1px solid #999;border-right:1px solid #aaa;border-top:1px solid #999;padding:5px;padding-left:10px;background:#ccc;font-weight:700;min-width:100%}.tabulator-print-table .tabulator-print-table-group:hover{cursor:pointer;background-color:rgba(0,0,0,.1)}.tabulator-print-table .tabulator-print-table-group.tabulator-group-visible .tabulator-arrow{margin-right:10px;border-left:6px solid transparent;border-right:6px solid transparent;border-top:6px solid #666;border-bottom:0}.tabulator-print-table .tabulator-print-table-group.tabulator-group-level-1 td{padding-left:30px!important}.tabulator-print-table .tabulator-print-table-group.tabulator-group-level-2 td{padding-left:50px!important}.tabulator-print-table .tabulator-print-table-group.tabulator-group-level-3 td{padding-left:70px!important}.tabulator-print-table .tabulator-print-table-group.tabulator-group-level-4 td{padding-left:90px!important}.tabulator-print-table .tabulator-print-table-group.tabulator-group-level-5 td{padding-left:110px!important}.tabulator-print-table .tabulator-print-table-group .tabulator-group-toggle{display:inline-block}.tabulator-print-table .tabulator-print-table-group .tabulator-arrow{display:inline-block;width:0;height:0;margin-right:16px;border-top:6px solid transparent;border-bottom:6px solid transparent;border-right:0;border-left:6px solid #666;vertical-align:middle}.tabulator-print-table .tabulator-print-table-group span{margin-left:10px;color:#d00}.tabulator-print-table .tabulator-data-tree-control{display:-ms-inline-flexbox;display:inline-flex;-ms-flex-pack:center;justify-content:center;-ms-flex-align:center;align-items:center;vertical-align:middle;height:11px;width:11px;margin-right:5px;border:1px solid #333;border-radius:2px;background:rgba(0,0,0,.1);overflow:hidden}.tabulator-print-table .tabulator-data-tree-control:hover{cursor:pointer;background:rgba(0,0,0,.2)}.tabulator-print-table .tabulator-data-tree-control .tabulator-data-tree-control-collapse{display:inline-block;position:relative;height:7px;width:1px;background:transparent}.tabulator-print-table .tabulator-data-tree-control .tabulator-data-tree-control-collapse:after{position:absolute;content:"";left:-3px;top:3px;height:1px;width:7px;background:#333}.tabulator-print-table .tabulator-data-tree-control .tabulator-data-tree-control-expand{display:inline-block;position:relative;height:7px;width:1px;background:#333}.tabulator-print-table .tabulator-data-tree-control .tabulator-data-tree-control-expand:after{position:absolute;content:"";left:-3px;top:3px;height:1px;width:7px;background:#333} +/*# sourceMappingURL=tabulator.min.css.map */ diff --git a/website/js/vendor/tabulator/css/tabulator.min.css.map b/website/js/vendor/tabulator/css/tabulator.min.css.map new file mode 100644 index 0000000..8924b90 --- /dev/null +++ b/website/js/vendor/tabulator/css/tabulator.min.css.map @@ -0,0 +1 @@ +{"version":3,"sources":["tabulator.scss"],"names":[],"mappings":"AA0CA,WACC,kBAAkB,AAElB,sBAxCgB,AA0ChB,sBA3CqB,AA6CrB,eA3Ca,AA4Cb,gBAAgB,AAChB,gBAAe,AAMf,uBAAwB,CAyhBxB,AAxiBD,iFAoBI,cAAc,CACd,AArBJ,0CA0BE,oBAAqB,CACrB,AA3BF,kCA8BE,yBAAiB,AAAjB,qBAAiB,AAAjB,gBAAiB,CACjB,AA/BF,6BAmCE,kBAAiB,AACjB,sBAAsB,AAEtB,WAAU,AAEV,6BAtEwB,AAuExB,yBA1E4B,AA2E5B,WA1EmB,AA2EnB,gBAAgB,AAEhB,mBAAmB,AACnB,gBAAe,AAEf,sBAAsB,AACtB,wBAAwB,AACxB,yBAAyB,AACzB,mBAAoB,CAoRpB,AAvUF,qDAsDG,YAAY,CACZ,AAvDH,4CA2DG,qBAAoB,AACpB,kBAAiB,AACjB,sBAAqB,AACrB,4BA7FoB,AA8FpB,mBAhG2B,AAiG3B,gBAAe,AACf,sBAAsB,AACtB,eAAgB,CAsNhB,AAxRH,6DAqEI,kBAAkB,AAClB,sBApGsB,AAqGtB,mBAA8C,AAC9C,mBAAoB,CACpB,AAzEJ,mEA6EI,sBAAqB,AACrB,kBAAkB,AAClB,WAAW,CA+DX,AA9IJ,iGAmFK,aAAc,CAMd,AAzFL,uGAsFM,eAAe,AACf,UAAW,CACX,AAxFN,+FA6FK,iBAAkB,CAClB,AA9FL,wFAkGK,sBAAqB,AACrB,WAAW,AAEX,mBAAmB,AACnB,gBAAgB,AAChB,uBAAuB,AACvB,qBAAqB,CAiBrB,AAzHL,gHA4GM,sBAAsB,AACtB,WAAW,AAEX,sBAAqB,AAErB,YAAW,AAEX,eAAgB,CAChB,AApHN,8IAuHM,uBAAuB,CACvB,AAxHN,yFA6HK,oBAAa,AAAb,aAAa,AACb,sBAAmB,AAAnB,mBAAmB,AAEnB,kBAAkB,AAClB,MAAK,AACL,SAAQ,AACR,SAAS,CAST,AA5IL,0GAsIM,QAAQ,AACR,SAAS,AACT,kCAAkC,AAClC,mCAAmC,AACnC,4BAnKkB,CAoKlB,AA3IN,0FAqJK,kBAAiB,AACjB,oBAAa,AAAb,aAAa,AAEb,0BAvLkB,AAwLlB,gBAAgB,AAEhB,iBAAiB,CACjB,AA5JL,0FAkKK,YAAa,CACb,AAnKL,qEAwKI,kBAAkB,AAClB,sBAAsB,AACtB,eAAc,AACd,WAAU,AACV,iBAAkB,CAiBlB,AA7LJ,8EAgLK,qBAAsB,CACtB,AAjLL,yEAoLK,cAAe,CACf,AArLL,sFAyLM,QAAS,AACT,QAAS,CACT,AA3LN,oFAkMK,kBAAkB,CAClB,AAnML,qEAsMK,eAAc,AACd,wBAAoD,CACpD,AAxML,4HA4MM,UArOkB,CA2OlB,AAlNN,6IA+MO,gBAAgB,AAChB,4BAzOiB,CA0OjB,AAjNP,2HAuNM,UAjPgB,CAwPhB,AA9NN,4IA0NO,gBAAgB,AAChB,4BArPe,CAuPf,AA7NP,4HAmOM,UA7PgB,CAoQhB,AA1ON,6IAsOO,mBAAmB,AACnB,0BAjQe,AAkQf,UAlQe,CAmQf,AAzOP,+GAkPM,uBAAyB,AAAzB,yBAAyB,AACzB,uBAAuB,AAEvB,oBAAY,AAAZ,aAAY,AACZ,sBAAkB,AAAlB,mBAAkB,AAClB,qBAAsB,AAAtB,sBAAsB,CACtB,AAxPN,oHA6PM,wBAAyB,CACzB,AA9PN,2GAmQM,gBAAe,AACf,gBAAgB,CAChB,AArQN,uIAyQO,gBAAe,AACf,mBAAmB,CACnB,AA3QP,4GAgRM,qBAAuB,AAAvB,uBAAuB,AACvB,OAAM,AACN,QAAO,AACP,QAAO,AACP,WAAW,CACX,AArRN,+CA2RG,qBAAqB,AACrB,kBAAkB,AAIlB,UAAW,CASX,AAzSH,qEAmSI,2BAvTgB,CAwThB,AApSJ,sEAuSI,0BA3TgB,CA4ThB,AAxSJ,qDA6SG,sBAAqB,AACrB,eAAc,AAEd,6BAAyD,AAUzD,0BA9UiB,AA+UjB,6BA1VoB,AA4VpB,eAAgB,CAChB,AA9TH,oEAmTI,4BAAyD,CAKzD,AAxTJ,iGAsTK,YAAa,CACb,AAvTL,2DAiUG,cAAc,CAKd,AAtUH,iEAoUI,YAAa,CACb,AArUJ,kCA2UE,kBAAiB,AACjB,WAAU,AACV,mBAAmB,AACnB,cAAa,AACb,gCAAiC,CAyDjC,AAxYF,wCAkVG,YAAa,CACb,AAnVH,yDAuVG,sBAAqB,AACrB,oBAAa,AAAb,aAAa,AACb,sBAAkB,AAAlB,mBAAkB,AAOlB,UAAU,CAYV,AA5WH,wFA4VI,gBAAe,AACf,cAAc,CACd,AA9VJ,8DAmWI,qBAAqB,AAErB,cAAa,AACb,aAAY,AAEZ,WAAU,AACV,gBAAiB,AACjB,cAAe,CACf,AA3WJ,mDAgXG,kBAAiB,AACjB,qBAAoB,AACpB,sBAxYqB,AAyYrB,mBAAmB,AACnB,iBAAgB,AAChB,UAxYe,CA0Zf,AAvYH,kFA0XK,gBAAiB,AACjB,4BAAwD,CASxD,AApYL,sGA8XM,4BAlZc,CAmZd,AA/XN,yGAkYM,yBAtZc,CAuZd,AAnYN,6BA8YE,iBAAgB,AAChB,0BArZwB,AAsZxB,yBAzZ4B,AA0Z5B,iBAAiB,AACjB,WA1ZmB,AA2ZnB,gBAAgB,AAChB,mBAAkB,AAClB,qBAAgB,AAAhB,iBAAgB,AAEhB,sBAAsB,AACtB,wBAAwB,AACxB,yBAAyB,AACzB,mBAAoB,CAgFpB,AA1eF,qDA6ZG,sBAAqB,AACrB,wBAAuB,AACvB,sBAA2B,AAE3B,gBAAgB,AAEhB,6BAAyD,AAUzD,6BAjciB,AAkcjB,0BAlciB,AAocjB,eAAgB,CAMhB,AAtbH,oEAsaI,4BAAyD,CAKzD,AA3aJ,iGAyaK,YAAa,CACb,AA1aL,gEAmbI,mBAAkB,AAClB,kBAAkB,CAClB,AArbJ,kDAybG,WAjckB,AAkclB,oBAAmB,AACnB,oBAAmB,AACnB,iBAAiB,CACjB,AA7bH,kDAicG,qBAAoB,AAEpB,aAAY,AACZ,gBAAe,AAEf,sBA7coB,AA8cpB,iBAAiB,CACjB,AAxcH,8CA2cG,YAAY,CACZ,AA5cH,6CAgdG,qBAAoB,AAEpB,aAAY,AACZ,gBAAe,AAEf,sBA5doB,AA6dpB,kBAAiB,AAEjB,6BAA+B,CAiB/B,AAzeH,oDA2dI,UAhemB,CAienB,AA5dJ,sDA+dI,UAAU,CACV,AAheJ,kEAoeK,eAAc,AACd,0BAAyB,AACzB,UAAU,CACV,AAveL,wCA8eE,kBAAiB,AACjB,QAAO,AACP,MAAK,AACL,SAAQ,AACR,SAAS,CAUT,AA5fF,6CAqfG,OAAM,AACN,UAAU,CACV,AAvfH,8CA0fG,gBAAgB,CAChB,AA3fH,6BAigBE,kBAAiB,AACjB,oBAAa,AAAb,aAAa,AACb,sBAAkB,AAAlB,mBAAkB,AAElB,MAAK,AACL,OAAM,AACN,YAAW,AAEX,YAAW,AACX,WAAU,AACV,0BAAyB,AACzB,iBAAiB,CA2BjB,AAviBF,mDAghBG,qBAAoB,AAEpB,cAAa,AACb,kBAAiB,AAEjB,mBAAkB,AAElB,gBAAe,AACf,gBAAgB,AAChB,cAAc,CAad,AAtiBH,qEA6hBI,sBAAqB,AACrB,UAAU,CACV,AA/hBJ,mEAmiBI,sBAAqB,AACrB,aAAa,CACb,AAMJ,eACC,kBAAkB,AAClB,sBAAsB,AACtB,gBAA0C,AAC1C,qBArkBuB,CAq7BvB,AApXD,kCAQE,wBAxkB4B,CAykB5B,AATF,0CAYE,sBAzkBsB,AA0kBtB,cAAe,CACf,AAdF,kCAiBE,wBA5kB6B,CA6kB7B,AAlBF,wCAqBE,yBA/kBkC,AAglBlC,cAAe,CACf,AAvBF,oCA0BE,sBAAqB,AACrB,eAAe,CACf,AA5BF,gCA+BE,kBAAkB,AAElB,0BAhmBkB,AAimBlB,6BAjmBkB,AAmmBlB,oBAAoB,AACpB,UAAU,CACV,AAtCF,4CA0CE,kBAAiB,AACjB,QAAO,AACP,SAAQ,AACR,OAAM,AACN,UAAU,CAUV,AAxDF,iDAiDG,MAAK,AACL,WAAW,CACX,AAnDH,kDAsDG,gBAAgB,CAChB,AAvDH,iCA2DE,qBAAqB,AACrB,kBAAkB,AAElB,yBAAyB,AAEzB,UAAW,CASX,AAzEF,uDAmEG,2BAloBiB,CAmoBjB,AApEH,wDAuEG,0BAtoBiB,CAuoBjB,AAxEH,8CA4EE,sBAAqB,AAErB,YAAW,AAEX,0BA/oBkB,AAgpBlB,4BAhpBkB,CAmqBlB,AApGF,oDAoFG,YAAY,CACZ,AArFH,oDAwFG,cAvqBW,CAkrBX,AAnGH,0DA4FK,iBAAkB,CAKlB,AAjGL,wEA+FM,kBAAkB,CAClB,AAhGN,+BAwGE,qBAAoB,AACpB,kBAAkB,AAClB,sBAAqB,AACrB,YAAW,AACX,4BA3qBkB,AA4qBlB,sBAAqB,AACrB,mBAAkB,AAClB,gBAAe,AACf,sBAAsB,CAyLtB,AAzSF,iDAmHG,yBA3qBkB,AA4qBlB,SAAU,CAMV,AA1HH,+GAuHI,WAAU,AACV,sBAAsB,CACtB,AAzHJ,yDA6HG,qBAprBgB,CA2rBhB,AApIH,+HA+HI,WAAU,AACV,uBAAsB,AAEtB,UAzrBe,CA0rBf,AAnIJ,6EAyII,YAAa,CACb,AA1IJ,oDA+IG,2BAAoB,AAApB,oBAAoB,AACpB,sBAAkB,AAAlB,mBAAkB,AAClB,qBAAsB,AAAtB,uBAAsB,AAEtB,sBAAsB,AACtB,wBAAwB,AACxB,yBAAyB,AACzB,mBAAoB,CAcpB,AApKH,8EA0JI,SAAS,CAST,AAnKJ,wGA8JK,WAAU,AACV,WAAU,AACV,eAAc,AACd,eAAe,CACf,AAlKL,2DAuKG,qBAAoB,AACpB,sBAAqB,AAErB,WAAU,AACV,UAAS,AAET,gBAAe,AACf,iBAAgB,AAEhB,8BAA6B,AAE7B,2BAjvBiB,AAkvBjB,4BAlvBiB,CAmvBjB,AApLH,4DAwLG,2BAAmB,AAAnB,oBAAmB,AACnB,qBAAsB,AAAtB,uBAAsB,AACtB,sBAAkB,AAAlB,mBAAkB,AAClB,sBAAqB,AAErB,YAAW,AACX,WAAU,AAEV,iBAAgB,AAEhB,sBAhwBe,AAiwBf,kBAAiB,AACjB,0BAA4B,AAE5B,eAAe,CAmDf,AAzPH,kEAyMI,eAAc,AACd,yBAA4B,CAC5B,AA3MJ,kGA8MI,qBAAoB,AACpB,kBAAkB,AAElB,WAAW,AACX,UAAU,AAEV,sBAAuB,CAavB,AAjOJ,wGAuNK,kBAAkB,AAClB,WAAW,AACX,UAAU,AACV,QAAQ,AAER,WAAW,AACX,UAAU,AAEV,eA7xBa,CA8xBb,AAhOL,gGAoOI,qBAAoB,AACpB,kBAAkB,AAElB,WAAW,AACX,UAAU,AAEV,eAxyBc,CAqzBd,AAvPJ,sGA6OK,kBAAkB,AAClB,WAAW,AACX,UAAU,AACV,QAAQ,AAER,WAAW,AACX,UAAU,AAEV,eAnzBa,CAozBb,AAtPL,qEA4PG,2BAAoB,AAApB,oBAAoB,AACpB,sBAAkB,AAAlB,mBAAkB,AAClB,qBAAsB,AAAtB,uBAAsB,AAEtB,sBAAsB,AACtB,wBAAwB,AACxB,yBAAyB,AACzB,oBAAoB,AAEpB,YAAW,AACX,WAAU,AAEV,mBAAkB,AAClB,gBAAe,AAEf,WA50BqB,AA60BrB,gBAAgB,AAChB,eAAe,CAmBf,AAhSH,2EAgRI,UAAU,CACV,AAjRJ,sHAqRK,eAAe,CACf,AAtRL,sOA8RI,YAAY,CACZ,AA/RJ,wDAmSG,qBAAqB,AACrB,YAAW,AACX,WAAU,AAEV,kBAAkB,CAClB,AAxSH,+BA6SE,sBAAqB,AACrB,6BAA4B,AAC5B,4BA92BkB,AA+2BlB,0BAAyB,AACzB,YAAW,AACX,kBAAiB,AACjB,gBAAe,AACf,gBAAgB,AAEhB,cAAe,CA4Df,AAlXF,qCAyTG,eAAc,AACd,+BAA+B,CAC/B,AA3TH,wEAgUI,kBAAiB,AACjB,kCAAkC,AAClC,mCAAmC,AACnC,0BAx4BkB,AAy4BlB,eAAgB,CAChB,AArUJ,uDA0UG,iBAAiB,CACjB,AA3UH,uDA8UG,iBAAiB,CACjB,AA/UH,uDAkVG,iBAAiB,CACjB,AAnVH,uDAsVG,iBAAiB,CACjB,AAvVH,uDA0VG,kBAAkB,CAClB,AA3VH,uDA8VG,oBAAqB,CACrB,AA/VH,gDAmWG,qBAAqB,AACrB,QAAQ,AACR,SAAS,AACT,kBAAiB,AACjB,iCAAiC,AACjC,oCAAoC,AACpC,eAAe,AACf,2BA/6BmB,AAg7BnB,qBAAqB,CACrB,AA5WH,oCA+WG,iBAAgB,AAChB,UAAU,CACV,AAKH,gBACC,kBAAkB,AAClB,qBAAoB,AACpB,sBAAqB,AAErB,gBA57BuB,AA67BvB,sBA37BmB,AA47BnB,oCAAuC,AAEvC,eA98Ba,AAg9Bb,gBAAe,AACf,iCAAiC,AAEjC,aAAc,CAqBd,AAnCD,qCAkBE,iBAAgB,AAEhB,yBAAiB,AAAjB,qBAAiB,AAAjB,gBAAiB,CAUjB,AA9BF,kEAuBG,UAAW,CACX,AAxBH,8EA2BG,eAAe,AACf,kBAl9B2B,CAm9B3B,AA7BH,0CAiCE,yBAt9BkB,CAu9BlB,AAGF,4BACC,kBAAkB,AAClB,qBAAoB,AACpB,sBAAqB,AAErB,iBAAgB,AAEhB,gBAn+BuB,AAo+BvB,sBAl+BmB,AAo+BnB,eAp/Ba,AAs/Bb,gBAAe,AACf,iCAAiC,AAEjC,aAAc,CA4Cd,AA3DD,6DAkBE,YAAW,AAEX,UA7+BgB,CAkgChB,AAzCF,oEAuBG,WAn/BqB,AAo/BrB,kBA3+BkB,CAg/BlB,AA7BH,4EA2BI,oCAv/BoB,CAw/BpB,AA5BJ,qEAgCG,yBAn/BkB,CAo/BlB,AAjCH,mEAoCG,eAAc,AAEd,WAlgCqB,AAmgCrB,kBA1/BkB,CA2/BlB,AAxCH,+DA4CE,YAAW,AAEX,WAvgCgB,AAwgChB,iBAAkB,CAClB,AAhDF,8DAmDE,6BA7gCkB,AA+gClB,YAAW,AACX,gBAAe,AAEf,WAjhCgB,AAkhChB,eAAgB,CAChB,AAMF,yBACC,aAAc,CACd,AAED,yBACC,mBAAmB,AACnB,aAAc,CAwEd,AA1ED,0DAMG,mBAAmB,AACnB,2BAhjCoB,AAijCpB,oBAAoB,CAsBpB,AA9BH,wGAYK,eAAoB,AACpB,gBAAgB,CAChB,AAdL,kGAmBK,gBAAe,AACf,iBAAiB,CACjB,AArBL,kGA0BK,SAAQ,AACR,UAAa,CACb,AA5BL,wDAmCG,qBAAoB,AACpB,0BAlkCiB,CA0lCjB,AA5DH,oFA8CI,eAAoB,AACpB,gBAAe,AAEf,4BAAiC,AACjC,+BAA8B,AAE9B,oBAAmB,AACnB,2BAnlCgB,CAolChB,AAtDJ,qFAyDI,eAAoB,AACpB,eAAe,CACf,AA3DJ,sDAiEE,kBAAiB,AACjB,OAAM,AACN,UAAU,CAMV,AAzEF,2DAsEG,QAAO,AACP,SAAS,CACT,AAOH,4BACC,kBAAkB,AAClB,MAAK,AACL,SAAQ,AACR,OAAM,AACN,QAAO,AAEP,aAAc,CACd,AAED,uEACC,sBAAuB,CACvB,AAED,uBACC,wBAAyB,CAwKzB,AAzKD,mDAIE,qBAAoB,AACpB,sBAAqB,AAErB,WAAU,AACV,UAAS,AAET,gBAAe,AACf,iBAAgB,AAEhB,8BAA6B,AAE7B,2BA1oCkB,AA2oClB,4BA3oCkB,CA4oClB,AAjBF,oDAqBE,sBAAqB,AACrB,6BAA4B,AAC5B,4BAlpCkB,AAmpClB,0BAAyB,AACzB,YAAW,AACX,kBAAiB,AACjB,gBAAe,AACf,gBAAgB,AAEhB,cAAe,CAsEf,AApGF,0DAiCG,eAAc,AACd,+BAA+B,CAC/B,AAnCH,6FAwCI,kBAAiB,AACjB,kCAAkC,AAClC,mCAAmC,AACnC,0BA5qCkB,AA6qClB,eAAgB,CAChB,AA7CJ,+EAmDI,2BAA4B,CAC5B,AApDJ,+EAyDI,2BAA4B,CAC5B,AA1DJ,+EA+DI,2BAA4B,CAC5B,AAhEJ,+EAqEI,2BAA4B,CAC5B,AAtEJ,+EA2EI,4BAA6B,CAC7B,AA5EJ,4EAgFG,oBAAqB,CACrB,AAjFH,qEAqFG,qBAAqB,AACrB,QAAQ,AACR,SAAS,AACT,kBAAiB,AACjB,iCAAiC,AACjC,oCAAoC,AACpC,eAAe,AACf,2BA7tCmB,AA8tCnB,qBAAqB,CACrB,AA9FH,yDAiGG,iBAAgB,AAChB,UAAU,CACV,AAnGH,oDAwGE,2BAAmB,AAAnB,oBAAmB,AACnB,qBAAsB,AAAtB,uBAAsB,AACtB,sBAAkB,AAAlB,mBAAkB,AAClB,sBAAqB,AAErB,YAAW,AACX,WAAU,AAEV,iBAAgB,AAEhB,sBA5uCgB,AA6uChB,kBAAiB,AACjB,0BAA4B,AAE5B,eAAe,CAkDf,AAxKF,0DAyHG,eAAc,AACd,yBAA4B,CAC5B,AA3HH,0FA8HG,qBAAoB,AACpB,kBAAkB,AAElB,WAAW,AACX,UAAU,AAEV,sBAAuB,CAavB,AAjJH,gGAuII,kBAAkB,AAClB,WAAW,AACX,UAAU,AACV,QAAQ,AAER,WAAW,AACX,UAAU,AAEV,eAzwCc,CA0wCd,AAhJJ,wFAoJG,qBAAoB,AACpB,kBAAkB,AAElB,WAAW,AACX,UAAU,AAEV,eApxCe,CAiyCf,AAvKH,8FA6JI,kBAAkB,AAClB,WAAW,AACX,UAAU,AACV,QAAQ,AAER,WAAW,AACX,UAAU,AAEV,eA/xCc,CAgyCd","file":"tabulator.min.css","sourcesContent":["/* Tabulator v4.8.3 (c) Oliver Folkerd */\n\n\r\n//Main Theme Variables\r\n$backgroundColor: #888 !default; //background color of tabulator\r\n$borderColor:#999 !default; //border to tabulator\r\n$textSize:14px !default; //table text size\r\n\r\n//header themeing\r\n$headerBackgroundColor:#e6e6e6 !default; //border to tabulator\r\n$headerTextColor:#555 !default; //header text colour\r\n$headerBorderColor:#aaa !default; //header border color\r\n$headerSeperatorColor:#999 !default; //header bottom seperator color\r\n$headerMargin:4px !default; //padding round header\r\n\r\n//column header arrows\r\n$sortArrowActive: #666 !default;\r\n$sortArrowInactive: #bbb !default;\r\n\r\n//row themeing\r\n$rowBackgroundColor:#fff !default; //table row background color\r\n$rowAltBackgroundColor:#EFEFEF !default; //table row background color\r\n$rowBorderColor:#aaa !default; //table border color\r\n$rowTextColor:#333 !default; //table text color\r\n$rowHoverBackground:#bbb !default; //row background color on hover\r\n\r\n$rowSelectedBackground: #9ABCEA !default; //row background color when selected\r\n$rowSelectedBackgroundHover: #769BCC !default;//row background color when selected and hovered\r\n\r\n$editBoxColor:#1D68CD !default; //border color for edit boxes\r\n$errorColor:#dd0000 !default; //error indication\r\n\r\n//footer themeing\r\n$footerBackgroundColor:#e6e6e6 !default; //border to tabulator\r\n$footerTextColor:#555 !default; //footer text colour\r\n$footerBorderColor:#aaa !default; //footer border color\r\n$footerSeperatorColor:#999 !default; //footer bottom seperator color\r\n$footerActiveColor:#d00 !default; //footer bottom active text color\r\n\r\n\r\n\r\n//Tabulator Containing Element\r\n.tabulator{\r\n\tposition: relative;\r\n\r\n\tborder: 1px solid $borderColor;\r\n\r\n\tbackground-color: $backgroundColor;\r\n\r\n\tfont-size:$textSize;\r\n\ttext-align: left;\r\n\toverflow:hidden;\r\n\r\n\t-webkit-transform: translatez(0);\r\n\t-moz-transform: translatez(0);\r\n\t-ms-transform: translatez(0);\r\n\t-o-transform: translatez(0);\r\n\ttransform: translatez(0);\r\n\r\n\t&[tabulator-layout=\"fitDataFill\"]{\r\n\t\t.tabulator-tableHolder{\r\n\t\t\t.tabulator-table{\r\n\t\t\t\tmin-width:100%;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\t&[tabulator-layout=\"fitDataTable\"]{\r\n\t\tdisplay: inline-block;\r\n\t}\r\n\r\n\t&.tabulator-block-select{\r\n\t\tuser-select: none;\r\n\t}\r\n\r\n\t//column header containing element\r\n\t.tabulator-header{\r\n\t\tposition:relative;\r\n\t\tbox-sizing: border-box;\r\n\r\n\t\twidth:100%;\r\n\r\n\t\tborder-bottom:1px solid $headerSeperatorColor;\r\n\t\tbackground-color: $headerBackgroundColor;\r\n\t\tcolor: $headerTextColor;\r\n\t\tfont-weight:bold;\r\n\r\n\t\twhite-space: nowrap;\r\n\t\toverflow:hidden;\r\n\r\n\t\t-moz-user-select: none;\r\n\t\t-khtml-user-select: none;\r\n\t\t-webkit-user-select: none;\r\n\t\t-o-user-select: none;\r\n\r\n\t\t&.tabulator-header-hidden{\r\n\t\t\tdisplay:none;\r\n\t\t}\r\n\r\n\t\t//individual column header element\r\n\t\t.tabulator-col{\r\n\t\t\tdisplay:inline-block;\r\n\t\t\tposition:relative;\r\n\t\t\tbox-sizing:border-box;\r\n\t\t\tborder-right:1px solid $headerBorderColor;\r\n\t\t\tbackground:$headerBackgroundColor;\r\n\t\t\ttext-align:left;\r\n\t\t\tvertical-align: bottom;\r\n\t\t\toverflow: hidden;\r\n\r\n\t\t\t&.tabulator-moving{\r\n\t\t\t\tposition: absolute;\r\n\t\t\t\tborder:1px solid $headerSeperatorColor;\r\n\t\t\t\tbackground:darken($headerBackgroundColor, 10%);\r\n\t\t\t\tpointer-events: none;\r\n\t\t\t}\r\n\r\n\t\t\t//hold content of column header\r\n\t\t\t.tabulator-col-content{\r\n\t\t\t\tbox-sizing:border-box;\r\n\t\t\t\tposition: relative;\r\n\t\t\t\tpadding:4px;\r\n\r\n\t\t\t\t//header menu button\r\n\t\t\t\t.tabulator-header-menu-button{\r\n\t\t\t\t\tpadding: 0 8px;\r\n\r\n\t\t\t\t\t&:hover{\r\n\t\t\t\t\t\tcursor: pointer;\r\n\t\t\t\t\t\topacity: .6;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\r\n\t\t\t\t//hold title and sort arrow\r\n\t\t\t\t.tabulator-col-title-holder{\r\n\t\t\t\t\tposition: relative;\r\n\t\t\t\t}\r\n\r\n\t\t\t\t//hold title of column header\r\n\t\t\t\t.tabulator-col-title{\r\n\t\t\t\t\tbox-sizing:border-box;\r\n\t\t\t\t\twidth: 100%;\r\n\r\n\t\t\t\t\twhite-space: nowrap;\r\n\t\t\t\t\toverflow: hidden;\r\n\t\t\t\t\ttext-overflow: ellipsis;\r\n\t\t\t\t\tvertical-align:bottom;\r\n\r\n\t\t\t\t\t//element to hold title editor\r\n\t\t\t\t\t.tabulator-title-editor{\r\n\t\t\t\t\t\tbox-sizing: border-box;\r\n\t\t\t\t\t\twidth: 100%;\r\n\r\n\t\t\t\t\t\tborder:1px solid #999;\r\n\r\n\t\t\t\t\t\tpadding:1px;\r\n\r\n\t\t\t\t\t\tbackground: #fff;\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\t.tabulator-header-menu-button + .tabulator-title-editor{\r\n\t\t\t\t\t\twidth:calc(100% - 22px);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\r\n\t\t\t\t//column sorter arrow\r\n\t\t\t\t.tabulator-col-sorter{\r\n\t\t\t\t\tdisplay: flex;\r\n\t\t\t\t\talign-items: center;\r\n\r\n\t\t\t\t\tposition: absolute;\r\n\t\t\t\t\ttop:0;\r\n\t\t\t\t\tbottom:0;\r\n\t\t\t\t\tright:4px;\r\n\r\n\t\t\t\t\t.tabulator-arrow{\r\n\t\t\t\t\t\twidth: 0;\r\n\t\t\t\t\t\theight: 0;\r\n\t\t\t\t\t\tborder-left: 6px solid transparent;\r\n\t\t\t\t\t\tborder-right: 6px solid transparent;\r\n\t\t\t\t\t\tborder-bottom: 6px solid $sortArrowInactive;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t\t//complex header column group\r\n\t\t\t&.tabulator-col-group{\r\n\r\n\t\t\t\t//gelement to hold sub columns in column group\r\n\t\t\t\t.tabulator-col-group-cols{\r\n\t\t\t\t\tposition:relative;\r\n\t\t\t\t\tdisplay: flex;\r\n\r\n\t\t\t\t\tborder-top:1px solid $headerBorderColor;\r\n\t\t\t\t\toverflow: hidden;\r\n\r\n\t\t\t\t\tmargin-right:-1px;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\t//hide left resize handle on first column\r\n\t\t\t&:first-child{\r\n\t\t\t\t.tabulator-col-resize-handle.prev{\r\n\t\t\t\t\tdisplay: none;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\t//header filter containing element\r\n\t\t\t.tabulator-header-filter{\r\n\t\t\t\tposition: relative;\r\n\t\t\t\tbox-sizing: border-box;\r\n\t\t\t\tmargin-top:2px;\r\n\t\t\t\twidth:100%;\r\n\t\t\t\ttext-align: center;\r\n\r\n\t\t\t\t//styling adjustment for inbuilt editors\r\n\t\t\t\ttextarea{\r\n\t\t\t\t\theight:auto !important;\r\n\t\t\t\t}\r\n\r\n\t\t\t\tsvg{\r\n\t\t\t\t\tmargin-top: 3px;\r\n\t\t\t\t}\r\n\r\n\t\t\t\tinput{\r\n\t\t\t\t\t&::-ms-clear {\r\n\t\t\t\t\t\twidth : 0;\r\n\t\t\t\t\t\theight: 0;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\t//styling child elements for sortable columns\r\n\t\t\t&.tabulator-sortable{\r\n\t\t\t\t.tabulator-col-title{\r\n\t\t\t\t\tpadding-right:25px;\r\n\t\t\t\t}\r\n\r\n\t\t\t\t&:hover{\r\n\t\t\t\t\tcursor:pointer;\r\n\t\t\t\t\tbackground-color:darken($headerBackgroundColor, 10%);\r\n\t\t\t\t}\r\n\r\n\t\t\t\t&[aria-sort=\"none\"]{\r\n\t\t\t\t\t.tabulator-col-content .tabulator-col-sorter{\r\n\t\t\t\t\t\tcolor: $sortArrowInactive;\r\n\r\n\t\t\t\t\t\t.tabulator-arrow{\r\n\t\t\t\t\t\t\tborder-top: none;\r\n\t\t\t\t\t\t\tborder-bottom: 6px solid $sortArrowInactive;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\r\n\t\t\t\t&[aria-sort=\"asc\"]{\r\n\t\t\t\t\t.tabulator-col-content .tabulator-col-sorter{\r\n\t\t\t\t\t\tcolor: $sortArrowActive;\r\n\r\n\t\t\t\t\t\t.tabulator-arrow{\r\n\t\t\t\t\t\t\tborder-top: none;\r\n\t\t\t\t\t\t\tborder-bottom: 6px solid $sortArrowActive;\r\n\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\r\n\t\t\t\t&[aria-sort=\"desc\"]{\r\n\t\t\t\t\t.tabulator-col-content .tabulator-col-sorter{\r\n\t\t\t\t\t\tcolor: $sortArrowActive;\r\n\r\n\t\t\t\t\t\t.tabulator-arrow{\r\n\t\t\t\t\t\t\tborder-bottom: none;\r\n\t\t\t\t\t\t\tborder-top: 6px solid $sortArrowActive;\r\n\t\t\t\t\t\t\tcolor: $sortArrowActive;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\r\n\t\t\t&.tabulator-col-vertical{\r\n\t\t\t\t.tabulator-col-content{\r\n\t\t\t\t\t.tabulator-col-title{\r\n\t\t\t\t\t\twriting-mode: vertical-rl;\r\n\t\t\t\t\t\ttext-orientation: mixed;\r\n\r\n\t\t\t\t\t\tdisplay:flex;\r\n\t\t\t\t\t\talign-items:center;\r\n\t\t\t\t\t\tjustify-content:center;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\r\n\t\t\t\t&.tabulator-col-vertical-flip{\r\n\t\t\t\t\t.tabulator-col-title{\r\n\t\t\t\t\t\ttransform: rotate(180deg);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\r\n\t\t\t\t&.tabulator-sortable{\r\n\t\t\t\t\t.tabulator-col-title{\r\n\t\t\t\t\t\tpadding-right:0;\r\n\t\t\t\t\t\tpadding-top:20px;\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\t&.tabulator-col-vertical-flip{\r\n\t\t\t\t\t\t.tabulator-col-title{\r\n\t\t\t\t\t\t\tpadding-right:0;\r\n\t\t\t\t\t\t\tpadding-bottom:20px;\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\t.tabulator-col-sorter{\r\n\t\t\t\t\t\tjustify-content: center;\r\n\t\t\t\t\t\tleft:0;\r\n\t\t\t\t\t\tright:0;\r\n\t\t\t\t\t\ttop:4px;\r\n\t\t\t\t\t\tbottom:auto;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t.tabulator-frozen{\r\n\t\t\tdisplay: inline-block;\r\n\t\t\tposition: absolute;\r\n\r\n\t\t\t// background-color: inherit;\r\n\r\n\t\t\tz-index: 10;\r\n\r\n\t\t\t&.tabulator-frozen-left{\r\n\t\t\t\tborder-right:2px solid $rowBorderColor;\r\n\t\t\t}\r\n\r\n\t\t\t&.tabulator-frozen-right{\r\n\t\t\t\tborder-left:2px solid $rowBorderColor;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\r\n\t\t.tabulator-calcs-holder{\r\n\t\t\tbox-sizing:border-box;\r\n\t\t\tmin-width:600%;\r\n\r\n\t\t\tbackground:lighten($headerBackgroundColor, 5%) !important;\r\n\r\n\t\t\t.tabulator-row{\r\n\t\t\t\tbackground:lighten($headerBackgroundColor, 5%) !important;\r\n\r\n\t\t\t\t.tabulator-col-resize-handle{\r\n\t\t\t\t\tdisplay: none;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\tborder-top:1px solid $rowBorderColor;\r\n\t\t\tborder-bottom:1px solid $headerBorderColor;\r\n\r\n\t\t\toverflow: hidden;\r\n\t\t}\r\n\r\n\t\t.tabulator-frozen-rows-holder{\r\n\t\t\tmin-width:600%;\r\n\r\n\t\t\t&:empty{\r\n\t\t\t\tdisplay: none;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\t//scrolling element to hold table\r\n\t.tabulator-tableHolder{\r\n\t\tposition:relative;\r\n\t\twidth:100%;\r\n\t\twhite-space: nowrap;\r\n\t\toverflow:auto;\r\n\t\t-webkit-overflow-scrolling: touch;\r\n\r\n\t\t&:focus{\r\n\t\t\toutline: none;\r\n\t\t}\r\n\r\n\t\t//default placeholder element\r\n\t\t.tabulator-placeholder{\r\n\t\t\tbox-sizing:border-box;\r\n\t\t\tdisplay: flex;\r\n\t\t\talign-items:center;\r\n\r\n\t\t\t&[tabulator-render-mode=\"virtual\"]{\r\n\t\t\t\tmin-height:100%;\r\n\t\t\t\tmin-width:100%;\r\n\t\t\t}\r\n\r\n\t\t\twidth:100%;\r\n\r\n\t\t\tspan{\r\n\t\t\t\tdisplay: inline-block;\r\n\r\n\t\t\t\tmargin:0 auto;\r\n\t\t\t\tpadding:10px;\r\n\r\n\t\t\t\tcolor:#ccc;\r\n\t\t\t\tfont-weight: bold;\r\n\t\t\t\tfont-size: 20px;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t//element to hold table rows\r\n\t\t.tabulator-table{\r\n\t\t\tposition:relative;\r\n\t\t\tdisplay:inline-block;\r\n\t\t\tbackground-color:$rowBackgroundColor;\r\n\t\t\twhite-space: nowrap;\r\n\t\t\toverflow:visible;\r\n\t\t\tcolor:$rowTextColor;\r\n\r\n\t\t\t//row element\r\n\t\t\t.tabulator-row{\r\n\t\t\t\t&.tabulator-calcs{\r\n\t\t\t\t\tfont-weight: bold;\r\n\t\t\t\t\tbackground:darken($rowAltBackgroundColor, 5%) !important;\r\n\r\n\t\t\t\t\t&.tabulator-calcs-top{\r\n\t\t\t\t\t\tborder-bottom:2px solid $rowBorderColor;\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\t&.tabulator-calcs-bottom{\r\n\t\t\t\t\t\tborder-top:2px solid $rowBorderColor;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t}\r\n\t}\r\n\r\n\r\n\r\n\t//footer element\r\n\t.tabulator-footer{\r\n\t\tpadding:5px 10px;\r\n\t\tborder-top:1px solid $footerSeperatorColor;\r\n\t\tbackground-color: $footerBackgroundColor;\r\n\t\ttext-align: right;\r\n\t\tcolor: $footerTextColor;\r\n\t\tfont-weight:bold;\r\n\t\twhite-space:nowrap;\r\n\t\tuser-select:none;\r\n\r\n\t\t-moz-user-select: none;\r\n\t\t-khtml-user-select: none;\r\n\t\t-webkit-user-select: none;\r\n\t\t-o-user-select: none;\r\n\r\n\t\t.tabulator-calcs-holder{\r\n\t\t\tbox-sizing:border-box;\r\n\t\t\twidth:calc(100% + 20px);\r\n\t\t\tmargin:-5px -10px 5px -10px;\r\n\r\n\t\t\ttext-align: left;\r\n\r\n\t\t\tbackground:lighten($footerBackgroundColor, 5%) !important;\r\n\r\n\t\t\t.tabulator-row{\r\n\t\t\t\tbackground:lighten($footerBackgroundColor, 5%) !important;\r\n\r\n\t\t\t\t.tabulator-col-resize-handle{\r\n\t\t\t\t\tdisplay: none;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\tborder-bottom:1px solid $rowBorderColor;\r\n\t\t\tborder-top:1px solid $rowBorderColor;\r\n\r\n\t\t\toverflow: hidden;\r\n\r\n\t\t\t&:only-child{\r\n\t\t\t\tmargin-bottom:-5px;\r\n\t\t\t\tborder-bottom:none;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t.tabulator-paginator{\r\n\t\t\tcolor: $footerTextColor;\r\n\t\t\tfont-family:inherit;\r\n\t\t\tfont-weight:inherit;\r\n\t\t\tfont-size:inherit;\r\n\t\t}\r\n\r\n\t\t//pagination container element\r\n\t\t.tabulator-page-size{\r\n\t\t\tdisplay:inline-block;\r\n\r\n\t\t\tmargin:0 5px;\r\n\t\t\tpadding:2px 5px;\r\n\r\n\t\t\tborder:1px solid $footerBorderColor;\r\n\t\t\tborder-radius:3px;\r\n\t\t}\r\n\r\n\t\t.tabulator-pages{\r\n\t\t\tmargin:0 7px;\r\n\t\t}\r\n\r\n\t\t//pagination button\r\n\t\t.tabulator-page{\r\n\t\t\tdisplay:inline-block;\r\n\r\n\t\t\tmargin:0 2px;\r\n\t\t\tpadding:2px 5px;\r\n\r\n\t\t\tborder:1px solid $footerBorderColor;\r\n\t\t\tborder-radius:3px;\r\n\r\n\t\t\tbackground:rgba(255,255,255,.2);\r\n\r\n\t\t\t&.active{\r\n\t\t\t\tcolor:$footerActiveColor;\r\n\t\t\t}\r\n\r\n\t\t\t&:disabled{\r\n\t\t\t\topacity:.5;\r\n\t\t\t}\r\n\r\n\t\t\t&:not(.disabled){\r\n\t\t\t\t&:hover{\r\n\t\t\t\t\tcursor:pointer;\r\n\t\t\t\t\tbackground:rgba(0,0,0,.2);\r\n\t\t\t\t\tcolor:#fff;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\t//column resize handles\r\n\t.tabulator-col-resize-handle{\r\n\t\tposition:absolute;\r\n\t\tright:0;\r\n\t\ttop:0;\r\n\t\tbottom:0;\r\n\t\twidth:5px;\r\n\r\n\t\t&.prev{\r\n\t\t\tleft:0;\r\n\t\t\tright:auto;\r\n\t\t}\r\n\r\n\t\t&:hover{\r\n\t\t\tcursor:ew-resize;\r\n\t\t}\r\n\t}\r\n\r\n\r\n\t//holding div that contains loader and covers tabulator element to prevent interaction\r\n\t.tabulator-loader{\r\n\t\tposition:absolute;\r\n\t\tdisplay: flex;\r\n\t\talign-items:center;\r\n\r\n\t\ttop:0;\r\n\t\tleft:0;\r\n\t\tz-index:100;\r\n\r\n\t\theight:100%;\r\n\t\twidth:100%;\r\n\t\tbackground:rgba(0,0,0,.4);\r\n\t\ttext-align:center;\r\n\r\n\t\t//loading message element\r\n\t\t.tabulator-loader-msg{\r\n\t\t\tdisplay:inline-block;\r\n\r\n\t\t\tmargin:0 auto;\r\n\t\t\tpadding:10px 20px;\r\n\r\n\t\t\tborder-radius:10px;\r\n\r\n\t\t\tbackground:#fff;\r\n\t\t\tfont-weight:bold;\r\n\t\t\tfont-size:16px;\r\n\r\n\t\t\t//loading message\r\n\t\t\t&.tabulator-loading{\r\n\t\t\t\tborder:4px solid #333;\r\n\t\t\t\tcolor:#000;\r\n\t\t\t}\r\n\r\n\t\t\t//error message\r\n\t\t\t&.tabulator-error{\r\n\t\t\t\tborder:4px solid #D00;\r\n\t\t\t\tcolor:#590000;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n}\r\n\r\n//row element\r\n.tabulator-row{\r\n\tposition: relative;\r\n\tbox-sizing: border-box;\r\n\tmin-height:$textSize + ($headerMargin * 2);\r\n\tbackground-color: $rowBackgroundColor;\r\n\r\n\r\n\t&.tabulator-row-even{\r\n\t\tbackground-color: $rowAltBackgroundColor;\r\n\t}\r\n\r\n\t&.tabulator-selectable:hover{\r\n\t\tbackground-color:$rowHoverBackground;\r\n\t\tcursor: pointer;\r\n\t}\r\n\r\n\t&.tabulator-selected{\r\n\t\tbackground-color:$rowSelectedBackground;\r\n\t}\r\n\r\n\t&.tabulator-selected:hover{\r\n\t\tbackground-color:$rowSelectedBackgroundHover;\r\n\t\tcursor: pointer;\r\n\t}\r\n\r\n\t&.tabulator-row-moving{\r\n\t\tborder:1px solid #000;\r\n\t\tbackground:#fff;\r\n\t}\r\n\r\n\t&.tabulator-moving{\r\n\t\tposition: absolute;\r\n\r\n\t\tborder-top:1px solid $rowBorderColor;\r\n\t\tborder-bottom:1px solid $rowBorderColor;\r\n\r\n\t\tpointer-events: none;\r\n\t\tz-index:15;\r\n\t}\r\n\r\n\t//row resize handles\r\n\t.tabulator-row-resize-handle{\r\n\t\tposition:absolute;\r\n\t\tright:0;\r\n\t\tbottom:0;\r\n\t\tleft:0;\r\n\t\theight:5px;\r\n\r\n\t\t&.prev{\r\n\t\t\ttop:0;\r\n\t\t\tbottom:auto;\r\n\t\t}\r\n\r\n\t\t&:hover{\r\n\t\t\tcursor:ns-resize;\r\n\t\t}\r\n\t}\r\n\r\n\t.tabulator-frozen{\r\n\t\tdisplay: inline-block;\r\n\t\tposition: absolute;\r\n\r\n\t\tbackground-color: inherit;\r\n\r\n\t\tz-index: 10;\r\n\r\n\t\t&.tabulator-frozen-left{\r\n\t\t\tborder-right:2px solid $rowBorderColor;\r\n\t\t}\r\n\r\n\t\t&.tabulator-frozen-right{\r\n\t\t\tborder-left:2px solid $rowBorderColor;\r\n\t\t}\r\n\t}\r\n\r\n\t.tabulator-responsive-collapse{\r\n\t\tbox-sizing:border-box;\r\n\r\n\t\tpadding:5px;\r\n\r\n\t\tborder-top:1px solid $rowBorderColor;\r\n\t\tborder-bottom:1px solid $rowBorderColor;\r\n\r\n\t\t&:empty{\r\n\t\t\tdisplay:none;\r\n\t\t}\r\n\r\n\t\ttable{\r\n\t\t\tfont-size:$textSize;\r\n\r\n\t\t\ttr{\r\n\t\t\t\ttd{\r\n\t\t\t\t\tposition: relative;\r\n\r\n\t\t\t\t\t&:first-of-type{\r\n\t\t\t\t\t\tpadding-right:10px;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\t//cell element\r\n\t.tabulator-cell{\r\n\t\tdisplay:inline-block;\r\n\t\tposition: relative;\r\n\t\tbox-sizing:border-box;\r\n\t\tpadding:4px;\r\n\t\tborder-right:1px solid $rowBorderColor;\r\n\t\tvertical-align:middle;\r\n\t\twhite-space:nowrap;\r\n\t\toverflow:hidden;\r\n\t\ttext-overflow:ellipsis;\r\n\r\n\t\t&.tabulator-editing{\r\n\t\t\tborder:1px solid $editBoxColor;\r\n\t\t\tpadding: 0;\r\n\r\n\t\t\tinput, select{\r\n\t\t\t\tborder:1px;\r\n\t\t\t\tbackground:transparent;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t&.tabulator-validation-fail{\r\n\t\t\tborder:1px solid $errorColor;\r\n\t\t\tinput, select{\r\n\t\t\t\tborder:1px;\r\n\t\t\t\tbackground:transparent;\r\n\r\n\t\t\t\tcolor: $errorColor;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t//hide left resize handle on first column\r\n\t\t&:first-child{\r\n\t\t\t.tabulator-col-resize-handle.prev{\r\n\t\t\t\tdisplay: none;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t//movable row handle\r\n\t\t&.tabulator-row-handle{\r\n\t\t\tdisplay: inline-flex;\r\n\t\t\talign-items:center;\r\n\t\t\tjustify-content:center;\r\n\r\n\t\t\t-moz-user-select: none;\r\n\t\t\t-khtml-user-select: none;\r\n\t\t\t-webkit-user-select: none;\r\n\t\t\t-o-user-select: none;\r\n\r\n\t\t\t//handle holder\r\n\t\t\t.tabulator-row-handle-box{\r\n\t\t\t\twidth:80%;\r\n\r\n\t\t\t\t//Hamburger element\r\n\t\t\t\t.tabulator-row-handle-bar{\r\n\t\t\t\t\twidth:100%;\r\n\t\t\t\t\theight:3px;\r\n\t\t\t\t\tmargin-top:2px;\r\n\t\t\t\t\tbackground:#666;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t.tabulator-data-tree-branch{\r\n\t\t\tdisplay:inline-block;\r\n\t\t\tvertical-align:middle;\r\n\r\n\t\t\theight:9px;\r\n\t\t\twidth:7px;\r\n\r\n\t\t\tmargin-top:-9px;\r\n\t\t\tmargin-right:5px;\r\n\r\n\t\t\tborder-bottom-left-radius:1px;\r\n\r\n\t\t\tborder-left:2px solid $rowBorderColor;\r\n\t\t\tborder-bottom:2px solid $rowBorderColor;\r\n\t\t}\r\n\r\n\t\t.tabulator-data-tree-control{\r\n\r\n\t\t\tdisplay:inline-flex;\r\n\t\t\tjustify-content:center;\r\n\t\t\talign-items:center;\r\n\t\t\tvertical-align:middle;\r\n\r\n\t\t\theight:11px;\r\n\t\t\twidth:11px;\r\n\r\n\t\t\tmargin-right:5px;\r\n\r\n\t\t\tborder:1px solid $rowTextColor;\r\n\t\t\tborder-radius:2px;\r\n\t\t\tbackground:rgba(0, 0, 0, .1);\r\n\r\n\t\t\toverflow:hidden;\r\n\r\n\t\t\t&:hover{\r\n\t\t\t\tcursor:pointer;\r\n\t\t\t\tbackground:rgba(0, 0, 0, .2);\r\n\t\t\t}\r\n\r\n\t\t\t.tabulator-data-tree-control-collapse{\r\n\t\t\t\tdisplay:inline-block;\r\n\t\t\t\tposition: relative;\r\n\r\n\t\t\t\theight: 7px;\r\n\t\t\t\twidth: 1px;\r\n\r\n\t\t\t\tbackground: transparent;\r\n\r\n\t\t\t\t&:after {\r\n\t\t\t\t\tposition: absolute;\r\n\t\t\t\t\tcontent: \"\";\r\n\t\t\t\t\tleft: -3px;\r\n\t\t\t\t\ttop: 3px;\r\n\r\n\t\t\t\t\theight: 1px;\r\n\t\t\t\t\twidth: 7px;\r\n\r\n\t\t\t\t\tbackground: $rowTextColor;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\t.tabulator-data-tree-control-expand{\r\n\t\t\t\tdisplay:inline-block;\r\n\t\t\t\tposition: relative;\r\n\r\n\t\t\t\theight: 7px;\r\n\t\t\t\twidth: 1px;\r\n\r\n\t\t\t\tbackground: $rowTextColor;\r\n\r\n\t\t\t\t&:after {\r\n\t\t\t\t\tposition: absolute;\r\n\t\t\t\t\tcontent: \"\";\r\n\t\t\t\t\tleft: -3px;\r\n\t\t\t\t\ttop: 3px;\r\n\r\n\t\t\t\t\theight: 1px;\r\n\t\t\t\t\twidth: 7px;\r\n\r\n\t\t\t\t\tbackground: $rowTextColor;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\t.tabulator-responsive-collapse-toggle{\r\n\t\t\tdisplay: inline-flex;\r\n\t\t\talign-items:center;\r\n\t\t\tjustify-content:center;\r\n\r\n\t\t\t-moz-user-select: none;\r\n\t\t\t-khtml-user-select: none;\r\n\t\t\t-webkit-user-select: none;\r\n\t\t\t-o-user-select: none;\r\n\r\n\t\t\theight:15px;\r\n\t\t\twidth:15px;\r\n\r\n\t\t\tborder-radius:20px;\r\n\t\t\tbackground:#666;\r\n\r\n\t\t\tcolor:$rowBackgroundColor;\r\n\t\t\tfont-weight:bold;\r\n\t\t\tfont-size:1.1em;\r\n\r\n\t\t\t&:hover{\r\n\t\t\t\topacity:.7;\r\n\t\t\t}\r\n\r\n\t\t\t&.open{\r\n\t\t\t\t.tabulator-responsive-collapse-toggle-close{\r\n\t\t\t\t\tdisplay:initial;\r\n\t\t\t\t}\r\n\r\n\t\t\t\t.tabulator-responsive-collapse-toggle-open{\r\n\t\t\t\t\tdisplay:none;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\t.tabulator-responsive-collapse-toggle-close{\r\n\t\t\t\tdisplay:none;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t.tabulator-traffic-light{\r\n\t\t\tdisplay: inline-block;\r\n\t\t\theight:14px;\r\n\t\t\twidth:14px;\r\n\r\n\t\t\tborder-radius:14px;\r\n\t\t}\r\n\t}\r\n\r\n\t//row grouping element\r\n\t&.tabulator-group{\r\n\t\tbox-sizing:border-box;\r\n\t\tborder-bottom:1px solid #999;\r\n\t\tborder-right:1px solid $rowBorderColor;\r\n\t\tborder-top:1px solid #999;\r\n\t\tpadding:5px;\r\n\t\tpadding-left:10px;\r\n\t\tbackground:#ccc;\r\n\t\tfont-weight:bold;\r\n\r\n\t\tmin-width: 100%;\r\n\r\n\t\t&:hover{\r\n\t\t\tcursor:pointer;\r\n\t\t\tbackground-color:rgba(0,0,0,.1);\r\n\t\t}\r\n\r\n\t\t&.tabulator-group-visible{\r\n\r\n\t\t\t.tabulator-arrow{\r\n\t\t\t\tmargin-right:10px;\r\n\t\t\t\tborder-left: 6px solid transparent;\r\n\t\t\t\tborder-right: 6px solid transparent;\r\n\t\t\t\tborder-top: 6px solid $sortArrowActive;\r\n\t\t\t\tborder-bottom: 0;\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\t&.tabulator-group-level-1{\r\n\t\t\tpadding-left:30px;\r\n\t\t}\r\n\r\n\t\t&.tabulator-group-level-2{\r\n\t\t\tpadding-left:50px;\r\n\t\t}\r\n\r\n\t\t&.tabulator-group-level-3{\r\n\t\t\tpadding-left:70px;\r\n\t\t}\r\n\r\n\t\t&.tabulator-group-level-4{\r\n\t\t\tpadding-left:90px;\r\n\t\t}\r\n\r\n\t\t&.tabulator-group-level-5{\r\n\t\t\tpadding-left:110px;\r\n\t\t}\r\n\r\n\t\t.tabulator-group-toggle{\r\n\t\t\tdisplay: inline-block;\r\n\t\t}\r\n\r\n\t\t//sorting arrow\r\n\t\t.tabulator-arrow{\r\n\t\t\tdisplay: inline-block;\r\n\t\t\twidth: 0;\r\n\t\t\theight: 0;\r\n\t\t\tmargin-right:16px;\r\n\t\t\tborder-top: 6px solid transparent;\r\n\t\t\tborder-bottom: 6px solid transparent;\r\n\t\t\tborder-right: 0;\r\n\t\t\tborder-left: 6px solid $sortArrowActive;\r\n\t\t\tvertical-align:middle;\r\n\t\t}\r\n\r\n\t\tspan{\r\n\t\t\tmargin-left:10px;\r\n\t\t\tcolor:#d00;\r\n\t\t}\r\n\t}\r\n\r\n}\r\n\r\n.tabulator-menu{\r\n\tposition: absolute;\r\n\tdisplay:inline-block;\r\n\tbox-sizing:border-box;\r\n\r\n\tbackground:$rowBackgroundColor;\r\n\tborder:1px solid $rowBorderColor;\r\n\tbox-shadow: 0 0 5px 0 rgba(0, 0, 0, .2);\r\n\r\n\tfont-size:$textSize;\r\n\r\n\toverflow-y:auto;\r\n\t-webkit-overflow-scrolling: touch;\r\n\r\n\tz-index: 10000;\r\n\r\n\t.tabulator-menu-item{\r\n\r\n\t\tpadding:5px 10px;\r\n\r\n\t\tuser-select: none;\r\n\r\n\t\t&.tabulator-menu-item-disabled{\r\n\t\t\topacity: .5;\r\n\t\t}\r\n\r\n\t\t&:not(.tabulator-menu-item-disabled):hover{\r\n\t\t\tcursor: pointer;\r\n\t\t\tbackground: $rowAltBackgroundColor;\r\n\t\t}\r\n\t}\r\n\r\n\t.tabulator-menu-separator{\r\n\t\tborder-top:1px solid $rowBorderColor;\r\n\t}\r\n}\r\n\r\n.tabulator-edit-select-list{\r\n\tposition: absolute;\r\n\tdisplay:inline-block;\r\n\tbox-sizing:border-box;\r\n\r\n\tmax-height:200px;\r\n\r\n\tbackground:$rowBackgroundColor;\r\n\tborder:1px solid $rowBorderColor;\r\n\r\n\tfont-size:$textSize;\r\n\r\n\toverflow-y:auto;\r\n\t-webkit-overflow-scrolling: touch;\r\n\r\n\tz-index: 10000;\r\n\r\n\t.tabulator-edit-select-list-item{\r\n\t\tpadding:4px;\r\n\r\n\t\tcolor:$rowTextColor;\r\n\r\n\t\t&.active{\r\n\t\t\tcolor:$rowBackgroundColor;\r\n\t\t\tbackground:$editBoxColor;\r\n\r\n\t\t\t&.focused{\r\n\t\t\t\toutline:1px solid rgba($rowBackgroundColor, .5);\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t&.focused{\r\n\t\t\toutline:1px solid $editBoxColor;\r\n\t\t}\r\n\r\n\t\t&:hover{\r\n\t\t\tcursor:pointer;\r\n\r\n\t\t\tcolor:$rowBackgroundColor;\r\n\t\t\tbackground:$editBoxColor;\r\n\t\t}\r\n\t}\r\n\r\n\t.tabulator-edit-select-list-notice{\r\n\t\tpadding:4px;\r\n\r\n\t\tcolor:$rowTextColor;\r\n\t\ttext-align: center;\r\n\t}\r\n\r\n\t.tabulator-edit-select-list-group{\r\n\t\tborder-bottom:1px solid $rowBorderColor;\r\n\r\n\t\tpadding:4px;\r\n\t\tpadding-top:6px;\r\n\r\n\t\tcolor:$rowTextColor;\r\n\t\tfont-weight:bold;\r\n\t}\r\n}\r\n\r\n\r\n//RTL Styling\r\n\r\n.tabulator.tabulator-ltr{\r\n\tdirection: ltr;\r\n}\r\n\r\n.tabulator.tabulator-rtl{\r\n\ttext-align: initial;\r\n\tdirection: rtl;\r\n\r\n\t.tabulator-header {\r\n\t\t.tabulator-col{\r\n\t\t\ttext-align: initial;\r\n\t\t\tborder-left:1px solid $headerBorderColor;\r\n\t\t\tborder-right:initial;\r\n\r\n\t\t\t&.tabulator-col-group{\r\n\t\t\t\t.tabulator-col-group-cols{\r\n\t\t\t\t\tmargin-right:initial;\r\n\t\t\t\t\tmargin-left:-1px;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\t&.tabulator-sortable{\r\n\t\t\t\t.tabulator-col-title{\r\n\t\t\t\t\tpadding-right:0;\r\n\t\t\t\t\tpadding-left:25px;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\t.tabulator-col-content{\r\n\t\t\t\t.tabulator-arrow{\r\n\t\t\t\t\tleft:8px;\r\n\t\t\t\t\tright:initial;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\t.tabulator-row{\r\n\t\t.tabulator-cell{\r\n\t\t\tborder-right:initial;\r\n\t\t\tborder-left:1px solid $rowBorderColor;\r\n\r\n\t\t\t//hide left resize handle on first column\r\n\t\t\t// &:first-child{\r\n\t\t\t// \t.tabulator-col-resize-handle.prev{\r\n\t\t\t// \t\tdisplay: none;\r\n\t\t\t// \t}\r\n\t\t\t// }\r\n\r\n\t\t\t.tabulator-data-tree-branch{\r\n\t\t\t\tmargin-right:initial;\r\n\t\t\t\tmargin-left:5px;\r\n\r\n\t\t\t\tborder-bottom-left-radius:initial;\r\n\t\t\t\tborder-bottom-right-radius:1px;\r\n\r\n\t\t\t\tborder-left:initial;\r\n\t\t\t\tborder-right:2px solid $rowBorderColor;\r\n\t\t\t}\r\n\r\n\t\t\t.tabulator-data-tree-control{\r\n\t\t\t\tmargin-right:initial;\r\n\t\t\t\tmargin-left:5px;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\t//column resize handles\r\n\t.tabulator-col-resize-handle{\r\n\t\tposition:absolute;\r\n\t\tleft:0;\r\n\t\tright:auto;\r\n\r\n\t\t&.prev{\r\n\t\t\tright:0;\r\n\t\t\tleft:auto;\r\n\t\t}\r\n\t}\r\n}\r\n\r\n\r\n// Table print styling\r\n\r\n.tabulator-print-fullscreen{\r\n\tposition: absolute;\r\n\ttop:0;\r\n\tbottom:0;\r\n\tleft:0;\r\n\tright:0;\r\n\r\n\tz-index: 10000;\r\n}\r\n\r\nbody.tabulator-print-fullscreen-hide>*:not(.tabulator-print-fullscreen){\r\n\tdisplay:none !important;\r\n}\r\n\r\n.tabulator-print-table{\r\n\tborder-collapse: collapse;\r\n\r\n\t.tabulator-data-tree-branch{\r\n\t\tdisplay:inline-block;\r\n\t\tvertical-align:middle;\r\n\r\n\t\theight:9px;\r\n\t\twidth:7px;\r\n\r\n\t\tmargin-top:-9px;\r\n\t\tmargin-right:5px;\r\n\r\n\t\tborder-bottom-left-radius:1px;\r\n\r\n\t\tborder-left:2px solid $rowBorderColor;\r\n\t\tborder-bottom:2px solid $rowBorderColor;\r\n\t}\r\n\r\n\t//row grouping element\r\n\t.tabulator-print-table-group{\r\n\t\tbox-sizing:border-box;\r\n\t\tborder-bottom:1px solid #999;\r\n\t\tborder-right:1px solid $rowBorderColor;\r\n\t\tborder-top:1px solid #999;\r\n\t\tpadding:5px;\r\n\t\tpadding-left:10px;\r\n\t\tbackground:#ccc;\r\n\t\tfont-weight:bold;\r\n\r\n\t\tmin-width: 100%;\r\n\r\n\t\t&:hover{\r\n\t\t\tcursor:pointer;\r\n\t\t\tbackground-color:rgba(0,0,0,.1);\r\n\t\t}\r\n\r\n\t\t&.tabulator-group-visible{\r\n\r\n\t\t\t.tabulator-arrow{\r\n\t\t\t\tmargin-right:10px;\r\n\t\t\t\tborder-left: 6px solid transparent;\r\n\t\t\t\tborder-right: 6px solid transparent;\r\n\t\t\t\tborder-top: 6px solid $sortArrowActive;\r\n\t\t\t\tborder-bottom: 0;\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\t&.tabulator-group-level-1{\r\n\t\t\ttd{\r\n\t\t\t\tpadding-left:30px !important;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t&.tabulator-group-level-2{\r\n\t\t\ttd{\r\n\t\t\t\tpadding-left:50px !important;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t&.tabulator-group-level-3{\r\n\t\t\ttd{\r\n\t\t\t\tpadding-left:70px !important;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t&.tabulator-group-level-4{\r\n\t\t\ttd{\r\n\t\t\t\tpadding-left:90px !important;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t&.tabulator-group-level-5{\r\n\t\t\ttd{\r\n\t\t\t\tpadding-left:110px !important;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t.tabulator-group-toggle{\r\n\t\t\tdisplay: inline-block;\r\n\t\t}\r\n\r\n\t\t//sorting arrow\r\n\t\t.tabulator-arrow{\r\n\t\t\tdisplay: inline-block;\r\n\t\t\twidth: 0;\r\n\t\t\theight: 0;\r\n\t\t\tmargin-right:16px;\r\n\t\t\tborder-top: 6px solid transparent;\r\n\t\t\tborder-bottom: 6px solid transparent;\r\n\t\t\tborder-right: 0;\r\n\t\t\tborder-left: 6px solid $sortArrowActive;\r\n\t\t\tvertical-align:middle;\r\n\t\t}\r\n\r\n\t\tspan{\r\n\t\t\tmargin-left:10px;\r\n\t\t\tcolor:#d00;\r\n\t\t}\r\n\t}\r\n\r\n\t.tabulator-data-tree-control{\r\n\r\n\t\tdisplay:inline-flex;\r\n\t\tjustify-content:center;\r\n\t\talign-items:center;\r\n\t\tvertical-align:middle;\r\n\r\n\t\theight:11px;\r\n\t\twidth:11px;\r\n\r\n\t\tmargin-right:5px;\r\n\r\n\t\tborder:1px solid $rowTextColor;\r\n\t\tborder-radius:2px;\r\n\t\tbackground:rgba(0, 0, 0, .1);\r\n\r\n\t\toverflow:hidden;\r\n\r\n\t\t&:hover{\r\n\t\t\tcursor:pointer;\r\n\t\t\tbackground:rgba(0, 0, 0, .2);\r\n\t\t}\r\n\r\n\t\t.tabulator-data-tree-control-collapse{\r\n\t\t\tdisplay:inline-block;\r\n\t\t\tposition: relative;\r\n\r\n\t\t\theight: 7px;\r\n\t\t\twidth: 1px;\r\n\r\n\t\t\tbackground: transparent;\r\n\r\n\t\t\t&:after {\r\n\t\t\t\tposition: absolute;\r\n\t\t\t\tcontent: \"\";\r\n\t\t\t\tleft: -3px;\r\n\t\t\t\ttop: 3px;\r\n\r\n\t\t\t\theight: 1px;\r\n\t\t\t\twidth: 7px;\r\n\r\n\t\t\t\tbackground: $rowTextColor;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t.tabulator-data-tree-control-expand{\r\n\t\t\tdisplay:inline-block;\r\n\t\t\tposition: relative;\r\n\r\n\t\t\theight: 7px;\r\n\t\t\twidth: 1px;\r\n\r\n\t\t\tbackground: $rowTextColor;\r\n\r\n\t\t\t&:after {\r\n\t\t\t\tposition: absolute;\r\n\t\t\t\tcontent: \"\";\r\n\t\t\t\tleft: -3px;\r\n\t\t\t\ttop: 3px;\r\n\r\n\t\t\t\theight: 1px;\r\n\t\t\t\twidth: 7px;\r\n\r\n\t\t\t\tbackground: $rowTextColor;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n}\r\n\r\n"]} \ No newline at end of file diff --git a/website/js/vendor/tabulator/css/tabulator_site.css b/website/js/vendor/tabulator/css/tabulator_site.css new file mode 100644 index 0000000..fc14e20 --- /dev/null +++ b/website/js/vendor/tabulator/css/tabulator_site.css @@ -0,0 +1,1086 @@ +/* Tabulator v4.8.3 (c) Oliver Folkerd */ +.tabulator { + position: relative; + border-bottom: 5px solid #222; + background-color: #fff; + font-size: 14px; + text-align: left; + overflow: hidden; + -ms-transform: translatez(0); + transform: translatez(0); +} + +.tabulator[tabulator-layout="fitDataFill"] .tabulator-tableHolder .tabulator-table { + min-width: 100%; +} + +.tabulator[tabulator-layout="fitDataTable"] { + display: inline-block; +} + +.tabulator[tabulator-layout="fitColumns"] .tabulator-row .tabulator-cell:last-of-type { + border-right: none; +} + +.tabulator.tabulator-block-select { + -webkit-user-select: none; + -ms-user-select: none; + user-select: none; +} + +.tabulator .tabulator-header { + position: relative; + box-sizing: border-box; + width: 100%; + border-bottom: 3px solid rgba(32.1569%,38.8235%,55.6863%,1); + background-color: #222; + color: #fff; + font-weight: bold; + white-space: nowrap; + overflow: hidden; + -moz-user-select: none; + -khtml-user-select: none; + -webkit-user-select: none; + -o-user-select: none; +} + +.tabulator .tabulator-header.tabulator-header-hidden { + display: none; +} + +.tabulator .tabulator-header .tabulator-col { + display: inline-block; + position: relative; + box-sizing: border-box; + border-right: 1px solid #aaa; + background-color: #222; + text-align: left; + vertical-align: bottom; + overflow: hidden; +} + +.tabulator .tabulator-header .tabulator-col.tabulator-moving { + position: absolute; + border: 1px solid rgba(32.1569%,38.8235%,55.6863%,1); + background: #090909; + pointer-events: none; +} + +.tabulator .tabulator-header .tabulator-col .tabulator-col-content { + box-sizing: border-box; + position: relative; + padding: 8px; +} + +.tabulator .tabulator-header .tabulator-col .tabulator-col-content .tabulator-header-menu-button { + padding: 0 8px; +} + +.tabulator .tabulator-header .tabulator-col .tabulator-col-content .tabulator-header-menu-button:hover { + cursor: pointer; + opacity: .6; +} + +.tabulator .tabulator-header .tabulator-col .tabulator-col-content .tabulator-col-title-holder { + position: relative; +} + +.tabulator .tabulator-header .tabulator-col .tabulator-col-content .tabulator-col-title { + box-sizing: border-box; + width: 100%; + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; + vertical-align: bottom; +} + +.tabulator .tabulator-header .tabulator-col .tabulator-col-content .tabulator-col-title .tabulator-title-editor { + box-sizing: border-box; + width: 100%; + border: 1px solid #999; + padding: 1px; + background: #fff; +} + +.tabulator .tabulator-header .tabulator-col .tabulator-col-content .tabulator-col-title .tabulator-header-menu-button + .tabulator-title-editor { + width: calc(100% - 22px); +} + +.tabulator .tabulator-header .tabulator-col .tabulator-col-content .tabulator-col-sorter { + display: -ms-flexbox; + display: flex; + -ms-flex-align: center; + align-items: center; + position: absolute; + top: 0; + bottom: 0; + right: 4px; +} + +.tabulator .tabulator-header .tabulator-col .tabulator-col-content .tabulator-col-sorter .tabulator-arrow { + width: 0; + height: 0; + border-left: 6px solid transparent; + border-right: 6px solid transparent; + border-bottom: 6px solid #bbb; +} + +.tabulator .tabulator-header .tabulator-col.tabulator-col-group .tabulator-col-group-cols { + position: relative; + display: -ms-flexbox; + display: flex; + border-top: 1px solid #aaa; + overflow: hidden; + margin-right: -1px; +} + +.tabulator .tabulator-header .tabulator-col:first-child .tabulator-col-resize-handle.prev { + display: none; +} + +.tabulator .tabulator-header .tabulator-col .tabulator-header-filter { + position: relative; + box-sizing: border-box; + margin-top: 2px; + width: 100%; + text-align: center; +} + +.tabulator .tabulator-header .tabulator-col .tabulator-header-filter textarea { + height: auto !important; +} + +.tabulator .tabulator-header .tabulator-col .tabulator-header-filter svg { + margin-top: 3px; +} + +.tabulator .tabulator-header .tabulator-col .tabulator-header-filter input::-ms-clear { + width: 0; + height: 0; +} + +.tabulator .tabulator-header .tabulator-col.tabulator-sortable .tabulator-col-title { + padding-right: 25px; +} + +.tabulator .tabulator-header .tabulator-col.tabulator-sortable:hover { + cursor: pointer; + background-color: #090909; +} + +.tabulator .tabulator-header .tabulator-col.tabulator-sortable[aria-sort="none"] .tabulator-col-content .tabulator-col-sorter { + color: #bbb; +} + +.tabulator .tabulator-header .tabulator-col.tabulator-sortable[aria-sort="none"] .tabulator-col-content .tabulator-col-sorter .tabulator-arrow { + border-top: none; + border-bottom: 6px solid #bbb; +} + +.tabulator .tabulator-header .tabulator-col.tabulator-sortable[aria-sort="asc"] .tabulator-col-content .tabulator-col-sorter { + color: rgba(32.1569%,38.8235%,55.6863%,1); +} + +.tabulator .tabulator-header .tabulator-col.tabulator-sortable[aria-sort="asc"] .tabulator-col-content .tabulator-col-sorter .tabulator-arrow { + border-top: none; + border-bottom: 6px solid rgba(32.1569%,38.8235%,55.6863%,1); +} + +.tabulator .tabulator-header .tabulator-col.tabulator-sortable[aria-sort="desc"] .tabulator-col-content .tabulator-col-sorter { + color: rgba(32.1569%,38.8235%,55.6863%,1); +} + +.tabulator .tabulator-header .tabulator-col.tabulator-sortable[aria-sort="desc"] .tabulator-col-content .tabulator-col-sorter .tabulator-arrow { + border-bottom: none; + border-top: 6px solid rgba(32.1569%,38.8235%,55.6863%,1); + color: rgba(32.1569%,38.8235%,55.6863%,1); +} + +.tabulator .tabulator-header .tabulator-col.tabulator-col-vertical .tabulator-col-content .tabulator-col-title { + -ms-writing-mode: tb-rl; + writing-mode: vertical-rl; + text-orientation: mixed; + display: -ms-flexbox; + display: flex; + -ms-flex-align: center; + align-items: center; + -ms-flex-pack: center; + justify-content: center; +} + +.tabulator .tabulator-header .tabulator-col.tabulator-col-vertical.tabulator-col-vertical-flip .tabulator-col-title { + -ms-transform: rotate(180deg); + transform: rotate(180deg); +} + +.tabulator .tabulator-header .tabulator-col.tabulator-col-vertical.tabulator-sortable .tabulator-col-title { + padding-right: 0; + padding-top: 20px; +} + +.tabulator .tabulator-header .tabulator-col.tabulator-col-vertical.tabulator-sortable.tabulator-col-vertical-flip .tabulator-col-title { + padding-right: 0; + padding-bottom: 20px; +} + +.tabulator .tabulator-header .tabulator-col.tabulator-col-vertical.tabulator-sortable .tabulator-col-sorter { + -ms-flex-pack: center; + justify-content: center; + left: 0; + right: 0; + top: 4px; + bottom: auto; +} + +.tabulator .tabulator-header .tabulator-frozen { + display: inline-block; + position: absolute; + z-index: 10; +} + +.tabulator .tabulator-header .tabulator-frozen.tabulator-frozen-left { + border-right: 2px solid #aaa; +} + +.tabulator .tabulator-header .tabulator-frozen.tabulator-frozen-right { + border-left: 2px solid #aaa; +} + +.tabulator .tabulator-header .tabulator-calcs-holder { + box-sizing: border-box; + min-width: 600%; + background: #3c3c3c !important; + border-top: 1px solid #aaa; + overflow: hidden; +} + +.tabulator .tabulator-header .tabulator-calcs-holder .tabulator-row { + background: #3c3c3c !important; +} + +.tabulator .tabulator-header .tabulator-calcs-holder .tabulator-row .tabulator-col-resize-handle { + display: none; +} + +.tabulator .tabulator-header .tabulator-frozen-rows-holder { + min-width: 600%; +} + +.tabulator .tabulator-header .tabulator-frozen-rows-holder:empty { + display: none; +} + +.tabulator .tabulator-tableHolder { + position: relative; + width: 100%; + white-space: nowrap; + overflow: auto; + -webkit-overflow-scrolling: touch; +} + +.tabulator .tabulator-tableHolder:focus { + outline: none; +} + +.tabulator .tabulator-tableHolder .tabulator-placeholder { + box-sizing: border-box; + display: -ms-flexbox; + display: flex; + -ms-flex-align: center; + align-items: center; + width: 100%; +} + +.tabulator .tabulator-tableHolder .tabulator-placeholder[tabulator-render-mode="virtual"] { + min-height: 100%; + min-width: 100%; +} + +.tabulator .tabulator-tableHolder .tabulator-placeholder span { + display: inline-block; + margin: 0 auto; + padding: 10px; + color: rgba(32.1569%,38.8235%,55.6863%,1); + font-weight: bold; + font-size: 20px; +} + +.tabulator .tabulator-tableHolder .tabulator-table { + position: relative; + display: inline-block; + background-color: #fff; + white-space: nowrap; + overflow: visible; + color: #333; +} + +.tabulator .tabulator-tableHolder .tabulator-table .tabulator-row.tabulator-calcs { + font-weight: bold; + background: #484848 !important; + color: #fff; +} + +.tabulator .tabulator-footer { + padding: 5px 10px; + padding-top: 8px; + border-top: 3px solid rgba(32.1569%,38.8235%,55.6863%,1); + background-color: #222; + text-align: right; + color: #222; + font-weight: bold; + white-space: nowrap; + -ms-user-select: none; + user-select: none; + -moz-user-select: none; + -khtml-user-select: none; + -webkit-user-select: none; + -o-user-select: none; +} + +.tabulator .tabulator-footer .tabulator-calcs-holder { + box-sizing: border-box; + width: calc(100% + 20px); + margin: -8px -10px 8px -10px; + text-align: left; + background: #3c3c3c !important; + border-bottom: 1px solid #aaa; + overflow: hidden; +} + +.tabulator .tabulator-footer .tabulator-calcs-holder .tabulator-row { + background: #3c3c3c !important; + color: #fff !important; +} + +.tabulator .tabulator-footer .tabulator-calcs-holder .tabulator-row .tabulator-col-resize-handle { + display: none; +} + +.tabulator .tabulator-footer .tabulator-calcs-holder:only-child { + margin-bottom: -5px; + border-bottom: none; +} + +.tabulator .tabulator-footer .tabulator-paginator label { + color: #fff; +} + +.tabulator .tabulator-footer .tabulator-page-size { + display: inline-block; + margin: 0 5px; + padding: 2px 5px; + border: 1px solid #aaa; + border-radius: 3px; +} + +.tabulator .tabulator-footer .tabulator-pages { + margin: 0 7px; +} + +.tabulator .tabulator-footer .tabulator-page { + display: inline-block; + margin: 0 2px; + padding: 2px 5px; + border: 1px solid #aaa; + border-radius: 3px; + background: #fff; + color: #222; + font-family: inherit; + font-weight: inherit; + font-size: inherit; +} + +.tabulator .tabulator-footer .tabulator-page.active { + color: rgba(32.1569%,38.8235%,55.6863%,1); +} + +.tabulator .tabulator-footer .tabulator-page:disabled { + opacity: .5; +} + +.tabulator .tabulator-footer .tabulator-page:not(.disabled):hover { + cursor: pointer; + background: rgba(0, 0, 0, 0.2); + color: #fff; +} + +.tabulator .tabulator-col-resize-handle { + position: absolute; + right: 0; + top: 0; + bottom: 0; + width: 5px; +} + +.tabulator .tabulator-col-resize-handle.prev { + left: 0; + right: auto; +} + +.tabulator .tabulator-col-resize-handle:hover { + cursor: ew-resize; +} + +.tabulator .tabulator-loader { + position: absolute; + display: -ms-flexbox; + display: flex; + -ms-flex-align: center; + align-items: center; + top: 0; + left: 0; + z-index: 100; + height: 100%; + width: 100%; + background: rgba(0, 0, 0, 0.4); + text-align: center; +} + +.tabulator .tabulator-loader .tabulator-loader-msg { + display: inline-block; + margin: 0 auto; + padding: 10px 20px; + border-radius: 10px; + background: #fff; + font-weight: bold; + font-size: 16px; +} + +.tabulator .tabulator-loader .tabulator-loader-msg.tabulator-loading { + border: 4px solid #333; + color: #000; +} + +.tabulator .tabulator-loader .tabulator-loader-msg.tabulator-error { + border: 4px solid #D00; + color: #590000; +} + +.tabulator-row { + position: relative; + box-sizing: border-box; + min-height: 22px; + background-color: #fff; +} + +.tabulator-row.tabulator-row-even { + background-color: #EFEFEF; +} + +.tabulator-row.tabulator-selectable:hover { + background-color: #bbb; + cursor: pointer; +} + +.tabulator-row.tabulator-selected { + background-color: #9ABCEA; +} + +.tabulator-row.tabulator-selected:hover { + background-color: #769BCC; + cursor: pointer; +} + +.tabulator-row.tabulator-row-moving { + border: 1px solid #000; + background: #fff; +} + +.tabulator-row.tabulator-moving { + position: absolute; + border-top: 1px solid #aaa; + border-bottom: 1px solid #aaa; + pointer-events: none !important; + z-index: 15; +} + +.tabulator-row .tabulator-row-resize-handle { + position: absolute; + right: 0; + bottom: 0; + left: 0; + height: 5px; +} + +.tabulator-row .tabulator-row-resize-handle.prev { + top: 0; + bottom: auto; +} + +.tabulator-row .tabulator-row-resize-handle:hover { + cursor: ns-resize; +} + +.tabulator-row .tabulator-frozen { + display: inline-block; + position: absolute; + background-color: inherit; + z-index: 10; +} + +.tabulator-row .tabulator-frozen.tabulator-frozen-left { + border-right: 2px solid #aaa; +} + +.tabulator-row .tabulator-frozen.tabulator-frozen-right { + border-left: 2px solid #aaa; +} + +.tabulator-row .tabulator-responsive-collapse { + box-sizing: border-box; + padding: 5px; + border-top: 1px solid #aaa; + border-bottom: 1px solid #aaa; +} + +.tabulator-row .tabulator-responsive-collapse:empty { + display: none; +} + +.tabulator-row .tabulator-responsive-collapse table { + font-size: 14px; +} + +.tabulator-row .tabulator-responsive-collapse table tr td { + position: relative; +} + +.tabulator-row .tabulator-responsive-collapse table tr td:first-of-type { + padding-right: 10px; +} + +.tabulator-row .tabulator-cell { + display: inline-block; + position: relative; + box-sizing: border-box; + padding: 6px; + border-right: 1px solid #aaa; + vertical-align: middle; + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; +} + +.tabulator-row .tabulator-cell.tabulator-editing { + border: 1px solid #1D68CD; + padding: 0; +} + +.tabulator-row .tabulator-cell.tabulator-editing input, .tabulator-row .tabulator-cell.tabulator-editing select { + border: 1px; + background: transparent; +} + +.tabulator-row .tabulator-cell.tabulator-validation-fail { + border: 1px solid #dd0000; +} + +.tabulator-row .tabulator-cell.tabulator-validation-fail input, .tabulator-row .tabulator-cell.tabulator-validation-fail select { + border: 1px; + background: transparent; + color: #dd0000; +} + +.tabulator-row .tabulator-cell:first-child .tabulator-col-resize-handle.prev { + display: none; +} + +.tabulator-row .tabulator-cell.tabulator-row-handle { + display: -ms-inline-flexbox; + display: inline-flex; + -ms-flex-align: center; + align-items: center; + -moz-user-select: none; + -khtml-user-select: none; + -webkit-user-select: none; + -o-user-select: none; +} + +.tabulator-row .tabulator-cell.tabulator-row-handle .tabulator-row-handle-box { + width: 80%; +} + +.tabulator-row .tabulator-cell.tabulator-row-handle .tabulator-row-handle-box .tabulator-row-handle-bar { + width: 100%; + height: 3px; + margin-top: 2px; + background: rgba(32.1569%,38.8235%,55.6863%,1); +} + +.tabulator-row .tabulator-cell .tabulator-data-tree-branch { + display: inline-block; + vertical-align: middle; + height: 9px; + width: 7px; + margin-top: -9px; + margin-right: 5px; + border-bottom-left-radius: 1px; + border-left: 2px solid #aaa; + border-bottom: 2px solid #aaa; +} + +.tabulator-row .tabulator-cell .tabulator-data-tree-control { + display: -ms-inline-flexbox; + display: inline-flex; + -ms-flex-pack: center; + justify-content: center; + -ms-flex-align: center; + align-items: center; + vertical-align: middle; + height: 11px; + width: 11px; + margin-right: 5px; + border: 1px solid #333; + border-radius: 2px; + background: rgba(0, 0, 0, 0.1); + overflow: hidden; +} + +.tabulator-row .tabulator-cell .tabulator-data-tree-control:hover { + cursor: pointer; + background: rgba(0, 0, 0, 0.2); +} + +.tabulator-row .tabulator-cell .tabulator-data-tree-control .tabulator-data-tree-control-collapse { + display: inline-block; + position: relative; + height: 7px; + width: 1px; + background: transparent; +} + +.tabulator-row .tabulator-cell .tabulator-data-tree-control .tabulator-data-tree-control-collapse:after { + position: absolute; + content: ""; + left: -3px; + top: 3px; + height: 1px; + width: 7px; + background: #333; +} + +.tabulator-row .tabulator-cell .tabulator-data-tree-control .tabulator-data-tree-control-expand { + display: inline-block; + position: relative; + height: 7px; + width: 1px; + background: #333; +} + +.tabulator-row .tabulator-cell .tabulator-data-tree-control .tabulator-data-tree-control-expand:after { + position: absolute; + content: ""; + left: -3px; + top: 3px; + height: 1px; + width: 7px; + background: #333; +} + +.tabulator-row .tabulator-cell .tabulator-responsive-collapse-toggle { + display: -ms-inline-flexbox; + display: inline-flex; + -ms-flex-align: center; + align-items: center; + -ms-flex-pack: center; + justify-content: center; + -moz-user-select: none; + -khtml-user-select: none; + -webkit-user-select: none; + -o-user-select: none; + height: 15px; + width: 15px; + border-radius: 20px; + background: #666; + color: #fff; + font-weight: bold; + font-size: 1.1em; +} + +.tabulator-row .tabulator-cell .tabulator-responsive-collapse-toggle:hover { + opacity: .7; +} + +.tabulator-row .tabulator-cell .tabulator-responsive-collapse-toggle.open .tabulator-responsive-collapse-toggle-close { + display: initial; +} + +.tabulator-row .tabulator-cell .tabulator-responsive-collapse-toggle.open .tabulator-responsive-collapse-toggle-open { + display: none; +} + +.tabulator-row .tabulator-cell .tabulator-responsive-collapse-toggle .tabulator-responsive-collapse-toggle-close { + display: none; +} + +.tabulator-row .tabulator-cell .tabulator-traffic-light { + display: inline-block; + height: 14px; + width: 14px; + border-radius: 14px; +} + +.tabulator-row.tabulator-group { + box-sizing: border-box; + border-right: 1px solid #aaa; + border-top: 1px solid #000; + border-bottom: 2px solid rgba(32.1569%,38.8235%,55.6863%,1); + padding: 5px; + padding-left: 10px; + background: #222; + color: #fff; + font-weight: bold; + min-width: 100%; +} + +.tabulator-row.tabulator-group:hover { + cursor: pointer; + background-color: #090909; +} + +.tabulator-row.tabulator-group.tabulator-group-visible .tabulator-arrow { + margin-right: 10px; + border-left: 6px solid transparent; + border-right: 6px solid transparent; + border-top: 6px solid rgba(32.1569%,38.8235%,55.6863%,1); + border-bottom: 0; +} + +.tabulator-row.tabulator-group.tabulator-group-level-1 { + padding-left: 30px; +} + +.tabulator-row.tabulator-group.tabulator-group-level-2 { + padding-left: 50px; +} + +.tabulator-row.tabulator-group.tabulator-group-level-3 { + padding-left: 70px; +} + +.tabulator-row.tabulator-group.tabulator-group-level-4 { + padding-left: 90px; +} + +.tabulator-row.tabulator-group.tabulator-group-level-5 { + padding-left: 110px; +} + +.tabulator-row.tabulator-group .tabulator-group-toggle { + display: inline-block; +} + +.tabulator-row.tabulator-group .tabulator-arrow { + display: inline-block; + width: 0; + height: 0; + margin-right: 16px; + border-top: 6px solid transparent; + border-bottom: 6px solid transparent; + border-right: 0; + border-left: 6px solid rgba(32.1569%,38.8235%,55.6863%,1); + vertical-align: middle; +} + +.tabulator-row.tabulator-group span { + margin-left: 10px; + color: rgba(32.1569%,38.8235%,55.6863%,1); +} + +.tabulator-menu { + position: absolute; + display: inline-block; + box-sizing: border-box; + background: #fff; + border: 1px solid #aaa; + box-shadow: 0 0 5px 0 rgba(0, 0, 0, 0.2); + font-size: 14px; + overflow-y: auto; + -webkit-overflow-scrolling: touch; + z-index: 10000; +} + +.tabulator-menu .tabulator-menu-item { + padding: 5px 10px; + -webkit-user-select: none; + -ms-user-select: none; + user-select: none; +} + +.tabulator-menu .tabulator-menu-item.tabulator-menu-item-disabled { + opacity: .5; +} + +.tabulator-menu .tabulator-menu-item:not(.tabulator-menu-item-disabled):hover { + cursor: pointer; + background: #EFEFEF; +} + +.tabulator-menu .tabulator-menu-separator { + border-top: 1px solid #aaa; +} + +.tabulator-edit-select-list { + position: absolute; + display: inline-block; + box-sizing: border-box; + max-height: 200px; + background: #fff; + border: 1px solid #aaa; + font-size: 14px; + overflow-y: auto; + -webkit-overflow-scrolling: touch; + z-index: 10000; +} + +.tabulator-edit-select-list .tabulator-edit-select-list-item { + padding: 4px; + color: #333; +} + +.tabulator-edit-select-list .tabulator-edit-select-list-item.active { + color: #fff; + background: #1D68CD; +} + +.tabulator-edit-select-list .tabulator-edit-select-list-item.active.focused { + outline: 1px solid rgba(255, 255, 255, 0.5); +} + +.tabulator-edit-select-list .tabulator-edit-select-list-item.focused { + outline: 1px solid #1D68CD; +} + +.tabulator-edit-select-list .tabulator-edit-select-list-item:hover { + cursor: pointer; + color: #fff; + background: #1D68CD; +} + +.tabulator-edit-select-list .tabulator-edit-select-list-notice { + padding: 4px; + color: #333; + text-align: center; +} + +.tabulator-edit-select-list .tabulator-edit-select-list-group { + border-bottom: 1px solid #aaa; + padding: 4px; + padding-top: 6px; + color: #333; + font-weight: bold; +} + +.tabulator.tabulator-ltr { + direction: ltr; +} + +.tabulator.tabulator-rtl { + text-align: initial; + direction: rtl; +} + +.tabulator.tabulator-rtl .tabulator-header .tabulator-col { + text-align: initial; + border-left: 1px solid #aaa; + border-right: initial; +} + +.tabulator.tabulator-rtl .tabulator-header .tabulator-col.tabulator-col-group .tabulator-col-group-cols { + margin-right: initial; + margin-left: -1px; +} + +.tabulator.tabulator-rtl .tabulator-header .tabulator-col.tabulator-sortable .tabulator-col-title { + padding-right: 0; + padding-left: 25px; +} + +.tabulator.tabulator-rtl .tabulator-header .tabulator-col .tabulator-col-content .tabulator-arrow { + left: 8px; + right: initial; +} + +.tabulator.tabulator-rtl .tabulator-row .tabulator-cell { + border-right: initial; + border-left: 1px solid #aaa; +} + +.tabulator.tabulator-rtl .tabulator-row .tabulator-cell .tabulator-data-tree-branch { + margin-right: initial; + margin-left: 5px; + border-bottom-left-radius: initial; + border-bottom-right-radius: 1px; + border-left: initial; + border-right: 2px solid #aaa; +} + +.tabulator.tabulator-rtl .tabulator-row .tabulator-cell .tabulator-data-tree-control { + margin-right: initial; + margin-left: 5px; +} + +.tabulator.tabulator-rtl .tabulator-col-resize-handle { + position: absolute; + left: 0; + right: auto; +} + +.tabulator.tabulator-rtl .tabulator-col-resize-handle.prev { + right: 0; + left: auto; +} + +.tabulator-print-fullscreen { + position: absolute; + top: 0; + bottom: 0; + left: 0; + right: 0; + z-index: 10000; +} + +body.tabulator-print-fullscreen-hide > *:not(.tabulator-print-fullscreen) { + display: none !important; +} + +.tabulator-print-table { + border-collapse: collapse; +} + +.tabulator-print-table .tabulator-print-table-group { + box-sizing: border-box; + border-right: 1px solid #aaa; + border-top: 1px solid #000; + border-bottom: 2px solid rgba(32.1569%,38.8235%,55.6863%,1); + padding: 5px; + padding-left: 10px; + background: #222; + color: #fff; + font-weight: bold; + min-width: 100%; +} + +.tabulator-print-table .tabulator-print-table-group:hover { + cursor: pointer; + background-color: #090909; +} + +.tabulator-print-table .tabulator-print-table-group.tabulator-group-visible .tabulator-arrow { + margin-right: 10px; + border-left: 6px solid transparent; + border-right: 6px solid transparent; + border-top: 6px solid rgba(32.1569%,38.8235%,55.6863%,1); + border-bottom: 0; +} + +.tabulator-print-table .tabulator-print-table-group.tabulator-group-level-1 td { + padding-left: 30px !important; +} + +.tabulator-print-table .tabulator-print-table-group.tabulator-group-level-2 td { + padding-left: 50px !important; +} + +.tabulator-print-table .tabulator-print-table-group.tabulator-group-level-3 td { + padding-left: 70px !important; +} + +.tabulator-print-table .tabulator-print-table-group.tabulator-group-level-4 td { + padding-left: 90px !important; +} + +.tabulator-print-table .tabulator-print-table-group.tabulator-group-level-5 td { + padding-left: 110px !important; +} + +.tabulator-print-table .tabulator-print-table-group .tabulator-group-toggle { + display: inline-block; +} + +.tabulator-print-table .tabulator-print-table-group .tabulator-arrow { + display: inline-block; + width: 0; + height: 0; + margin-right: 16px; + border-top: 6px solid transparent; + border-bottom: 6px solid transparent; + border-right: 0; + border-left: 6px solid rgba(32.1569%,38.8235%,55.6863%,1); + vertical-align: middle; +} + +.tabulator-print-table .tabulator-print-table-group span { + margin-left: 10px; + color: rgba(32.1569%,38.8235%,55.6863%,1); +} + +.tabulator-print-table .tabulator-data-tree-branch { + display: inline-block; + vertical-align: middle; + height: 9px; + width: 7px; + margin-top: -9px; + margin-right: 5px; + border-bottom-left-radius: 1px; + border-left: 2px solid #aaa; + border-bottom: 2px solid #aaa; +} + +.tabulator-print-table .tabulator-data-tree-control { + display: -ms-inline-flexbox; + display: inline-flex; + -ms-flex-pack: center; + justify-content: center; + -ms-flex-align: center; + align-items: center; + vertical-align: middle; + height: 11px; + width: 11px; + margin-right: 5px; + border: 1px solid #333; + border-radius: 2px; + background: rgba(0, 0, 0, 0.1); + overflow: hidden; +} + +.tabulator-print-table .tabulator-data-tree-control:hover { + cursor: pointer; + background: rgba(0, 0, 0, 0.2); +} + +.tabulator-print-table .tabulator-data-tree-control .tabulator-data-tree-control-collapse { + display: inline-block; + position: relative; + height: 7px; + width: 1px; + background: transparent; +} + +.tabulator-print-table .tabulator-data-tree-control .tabulator-data-tree-control-collapse:after { + position: absolute; + content: ""; + left: -3px; + top: 3px; + height: 1px; + width: 7px; + background: #333; +} + +.tabulator-print-table .tabulator-data-tree-control .tabulator-data-tree-control-expand { + display: inline-block; + position: relative; + height: 7px; + width: 1px; + background: #333; +} + +.tabulator-print-table .tabulator-data-tree-control .tabulator-data-tree-control-expand:after { + position: absolute; + content: ""; + left: -3px; + top: 3px; + height: 1px; + width: 7px; + background: #333; +} diff --git a/website/js/vendor/tabulator/css/tabulator_site.min.css b/website/js/vendor/tabulator/css/tabulator_site.min.css new file mode 100644 index 0000000..3b32a79 --- /dev/null +++ b/website/js/vendor/tabulator/css/tabulator_site.min.css @@ -0,0 +1 @@ +.tabulator{position:relative;border-bottom:5px solid #222;background-color:#fff;font-size:14px;text-align:left;overflow:hidden;-ms-transform:translatez(0);transform:translatez(0)}.tabulator[tabulator-layout=fitDataFill] .tabulator-tableHolder .tabulator-table{min-width:100%}.tabulator[tabulator-layout=fitDataTable]{display:inline-block}.tabulator[tabulator-layout=fitColumns] .tabulator-row .tabulator-cell:last-of-type{border-right:none}.tabulator.tabulator-block-select{-webkit-user-select:none;-ms-user-select:none;user-select:none}.tabulator .tabulator-header{position:relative;box-sizing:border-box;width:100%;border-bottom:3px solid rgba(32.1569%,38.8235%,55.6863%,1);background-color:#222;color:#fff;font-weight:700;white-space:nowrap;overflow:hidden;-moz-user-select:none;-khtml-user-select:none;-webkit-user-select:none;-o-user-select:none}.tabulator .tabulator-header.tabulator-header-hidden{display:none}.tabulator .tabulator-header .tabulator-col{display:inline-block;position:relative;box-sizing:border-box;border-right:1px solid #aaa;background-color:#222;text-align:left;vertical-align:bottom;overflow:hidden}.tabulator .tabulator-header .tabulator-col.tabulator-moving{position:absolute;border:1px solid rgba(32.1569%,38.8235%,55.6863%,1);background:#090909;pointer-events:none}.tabulator .tabulator-header .tabulator-col .tabulator-col-content{box-sizing:border-box;position:relative;padding:8px}.tabulator .tabulator-header .tabulator-col .tabulator-col-content .tabulator-header-menu-button{padding:0 8px}.tabulator .tabulator-header .tabulator-col .tabulator-col-content .tabulator-header-menu-button:hover{cursor:pointer;opacity:.6}.tabulator .tabulator-header .tabulator-col .tabulator-col-content .tabulator-col-title-holder{position:relative}.tabulator .tabulator-header .tabulator-col .tabulator-col-content .tabulator-col-title{box-sizing:border-box;width:100%;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;vertical-align:bottom}.tabulator .tabulator-header .tabulator-col .tabulator-col-content .tabulator-col-title .tabulator-title-editor{box-sizing:border-box;width:100%;border:1px solid #999;padding:1px;background:#fff}.tabulator .tabulator-header .tabulator-col .tabulator-col-content .tabulator-col-title .tabulator-header-menu-button+.tabulator-title-editor{width:calc(100% - 22px)}.tabulator .tabulator-header .tabulator-col .tabulator-col-content .tabulator-col-sorter{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;position:absolute;top:0;bottom:0;right:4px}.tabulator .tabulator-header .tabulator-col .tabulator-col-content .tabulator-col-sorter .tabulator-arrow{width:0;height:0;border-left:6px solid transparent;border-right:6px solid transparent;border-bottom:6px solid #bbb}.tabulator .tabulator-header .tabulator-col.tabulator-col-group .tabulator-col-group-cols{position:relative;display:-ms-flexbox;display:flex;border-top:1px solid #aaa;overflow:hidden;margin-right:-1px}.tabulator .tabulator-header .tabulator-col:first-child .tabulator-col-resize-handle.prev{display:none}.tabulator .tabulator-header .tabulator-col .tabulator-header-filter{position:relative;box-sizing:border-box;margin-top:2px;width:100%;text-align:center}.tabulator .tabulator-header .tabulator-col .tabulator-header-filter textarea{height:auto!important}.tabulator .tabulator-header .tabulator-col .tabulator-header-filter svg{margin-top:3px}.tabulator .tabulator-header .tabulator-col .tabulator-header-filter input::-ms-clear{width:0;height:0}.tabulator .tabulator-header .tabulator-col.tabulator-sortable .tabulator-col-title{padding-right:25px}.tabulator .tabulator-header .tabulator-col.tabulator-sortable:hover{cursor:pointer;background-color:#090909}.tabulator .tabulator-header .tabulator-col.tabulator-sortable[aria-sort=none] .tabulator-col-content .tabulator-col-sorter{color:#bbb}.tabulator .tabulator-header .tabulator-col.tabulator-sortable[aria-sort=none] .tabulator-col-content .tabulator-col-sorter .tabulator-arrow{border-top:none;border-bottom:6px solid #bbb}.tabulator .tabulator-header .tabulator-col.tabulator-sortable[aria-sort=asc] .tabulator-col-content .tabulator-col-sorter{color:rgba(32.1569%,38.8235%,55.6863%,1)}.tabulator .tabulator-header .tabulator-col.tabulator-sortable[aria-sort=asc] .tabulator-col-content .tabulator-col-sorter .tabulator-arrow{border-top:none;border-bottom:6px solid rgba(32.1569%,38.8235%,55.6863%,1)}.tabulator .tabulator-header .tabulator-col.tabulator-sortable[aria-sort=desc] .tabulator-col-content .tabulator-col-sorter{color:rgba(32.1569%,38.8235%,55.6863%,1)}.tabulator .tabulator-header .tabulator-col.tabulator-sortable[aria-sort=desc] .tabulator-col-content .tabulator-col-sorter .tabulator-arrow{border-bottom:none;border-top:6px solid rgba(32.1569%,38.8235%,55.6863%,1);color:rgba(32.1569%,38.8235%,55.6863%,1)}.tabulator .tabulator-header .tabulator-col.tabulator-col-vertical .tabulator-col-content .tabulator-col-title{-ms-writing-mode:tb-rl;writing-mode:vertical-rl;text-orientation:mixed;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center}.tabulator .tabulator-header .tabulator-col.tabulator-col-vertical.tabulator-col-vertical-flip .tabulator-col-title{-ms-transform:rotate(180deg);transform:rotate(180deg)}.tabulator .tabulator-header .tabulator-col.tabulator-col-vertical.tabulator-sortable .tabulator-col-title{padding-right:0;padding-top:20px}.tabulator .tabulator-header .tabulator-col.tabulator-col-vertical.tabulator-sortable.tabulator-col-vertical-flip .tabulator-col-title{padding-right:0;padding-bottom:20px}.tabulator .tabulator-header .tabulator-col.tabulator-col-vertical.tabulator-sortable .tabulator-col-sorter{-ms-flex-pack:center;justify-content:center;left:0;right:0;top:4px;bottom:auto}.tabulator .tabulator-header .tabulator-frozen{display:inline-block;position:absolute;z-index:10}.tabulator .tabulator-header .tabulator-frozen.tabulator-frozen-left{border-right:2px solid #aaa}.tabulator .tabulator-header .tabulator-frozen.tabulator-frozen-right{border-left:2px solid #aaa}.tabulator .tabulator-header .tabulator-calcs-holder{box-sizing:border-box;min-width:600%;background:#3c3c3c!important;border-top:1px solid #aaa;overflow:hidden}.tabulator .tabulator-header .tabulator-calcs-holder .tabulator-row{background:#3c3c3c!important}.tabulator .tabulator-header .tabulator-calcs-holder .tabulator-row .tabulator-col-resize-handle{display:none}.tabulator .tabulator-header .tabulator-frozen-rows-holder{min-width:600%}.tabulator .tabulator-header .tabulator-frozen-rows-holder:empty{display:none}.tabulator .tabulator-tableHolder{position:relative;width:100%;white-space:nowrap;overflow:auto;-webkit-overflow-scrolling:touch}.tabulator .tabulator-tableHolder:focus{outline:0}.tabulator .tabulator-tableHolder .tabulator-placeholder{box-sizing:border-box;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;width:100%}.tabulator .tabulator-tableHolder .tabulator-placeholder[tabulator-render-mode=virtual]{min-height:100%;min-width:100%}.tabulator .tabulator-tableHolder .tabulator-placeholder span{display:inline-block;margin:0 auto;padding:10px;color:rgba(32.1569%,38.8235%,55.6863%,1);font-weight:700;font-size:20px}.tabulator .tabulator-tableHolder .tabulator-table{position:relative;display:inline-block;background-color:#fff;white-space:nowrap;overflow:visible;color:#333}.tabulator .tabulator-tableHolder .tabulator-table .tabulator-row.tabulator-calcs{font-weight:700;background:#484848!important;color:#fff}.tabulator .tabulator-footer{padding:5px 10px;padding-top:8px;border-top:3px solid rgba(32.1569%,38.8235%,55.6863%,1);background-color:#222;text-align:right;color:#222;font-weight:700;white-space:nowrap;-ms-user-select:none;user-select:none;-moz-user-select:none;-khtml-user-select:none;-webkit-user-select:none;-o-user-select:none}.tabulator .tabulator-footer .tabulator-calcs-holder{box-sizing:border-box;width:calc(100% + 20px);margin:-8px -10px 8px -10px;text-align:left;background:#3c3c3c!important;border-bottom:1px solid #aaa;overflow:hidden}.tabulator .tabulator-footer .tabulator-calcs-holder .tabulator-row{background:#3c3c3c!important;color:#fff!important}.tabulator .tabulator-footer .tabulator-calcs-holder .tabulator-row .tabulator-col-resize-handle{display:none}.tabulator .tabulator-footer .tabulator-calcs-holder:only-child{margin-bottom:-5px;border-bottom:none}.tabulator .tabulator-footer .tabulator-paginator label{color:#fff}.tabulator .tabulator-footer .tabulator-page-size{display:inline-block;margin:0 5px;padding:2px 5px;border:1px solid #aaa;border-radius:3px}.tabulator .tabulator-footer .tabulator-pages{margin:0 7px}.tabulator .tabulator-footer .tabulator-page{display:inline-block;margin:0 2px;padding:2px 5px;border:1px solid #aaa;border-radius:3px;background:#fff;color:#222;font-family:inherit;font-weight:inherit;font-size:inherit}.tabulator .tabulator-footer .tabulator-page.active{color:rgba(32.1569%,38.8235%,55.6863%,1)}.tabulator .tabulator-footer .tabulator-page:disabled{opacity:.5}.tabulator .tabulator-footer .tabulator-page:not(.disabled):hover{cursor:pointer;background:rgba(0,0,0,.2);color:#fff}.tabulator .tabulator-col-resize-handle{position:absolute;right:0;top:0;bottom:0;width:5px}.tabulator .tabulator-col-resize-handle.prev{left:0;right:auto}.tabulator .tabulator-col-resize-handle:hover{cursor:ew-resize}.tabulator .tabulator-loader{position:absolute;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;top:0;left:0;z-index:100;height:100%;width:100%;background:rgba(0,0,0,.4);text-align:center}.tabulator .tabulator-loader .tabulator-loader-msg{display:inline-block;margin:0 auto;padding:10px 20px;border-radius:10px;background:#fff;font-weight:700;font-size:16px}.tabulator .tabulator-loader .tabulator-loader-msg.tabulator-loading{border:4px solid #333;color:#000}.tabulator .tabulator-loader .tabulator-loader-msg.tabulator-error{border:4px solid #d00;color:#590000}.tabulator-row{position:relative;box-sizing:border-box;min-height:22px;background-color:#fff}.tabulator-row.tabulator-row-even{background-color:#efefef}.tabulator-row.tabulator-selectable:hover{background-color:#bbb;cursor:pointer}.tabulator-row.tabulator-selected{background-color:#9abcea}.tabulator-row.tabulator-selected:hover{background-color:#769bcc;cursor:pointer}.tabulator-row.tabulator-row-moving{border:1px solid #000;background:#fff}.tabulator-row.tabulator-moving{position:absolute;border-top:1px solid #aaa;border-bottom:1px solid #aaa;pointer-events:none!important;z-index:15}.tabulator-row .tabulator-row-resize-handle{position:absolute;right:0;bottom:0;left:0;height:5px}.tabulator-row .tabulator-row-resize-handle.prev{top:0;bottom:auto}.tabulator-row .tabulator-row-resize-handle:hover{cursor:ns-resize}.tabulator-row .tabulator-frozen{display:inline-block;position:absolute;background-color:inherit;z-index:10}.tabulator-row .tabulator-frozen.tabulator-frozen-left{border-right:2px solid #aaa}.tabulator-row .tabulator-frozen.tabulator-frozen-right{border-left:2px solid #aaa}.tabulator-row .tabulator-responsive-collapse{box-sizing:border-box;padding:5px;border-top:1px solid #aaa;border-bottom:1px solid #aaa}.tabulator-row .tabulator-responsive-collapse:empty{display:none}.tabulator-row .tabulator-responsive-collapse table{font-size:14px}.tabulator-row .tabulator-responsive-collapse table tr td{position:relative}.tabulator-row .tabulator-responsive-collapse table tr td:first-of-type{padding-right:10px}.tabulator-row .tabulator-cell{display:inline-block;position:relative;box-sizing:border-box;padding:6px;border-right:1px solid #aaa;vertical-align:middle;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.tabulator-row .tabulator-cell.tabulator-editing{border:1px solid #1d68cd;padding:0}.tabulator-row .tabulator-cell.tabulator-editing input,.tabulator-row .tabulator-cell.tabulator-editing select{border:1px;background:0 0}.tabulator-row .tabulator-cell.tabulator-validation-fail{border:1px solid #d00}.tabulator-row .tabulator-cell.tabulator-validation-fail input,.tabulator-row .tabulator-cell.tabulator-validation-fail select{border:1px;background:0 0;color:#d00}.tabulator-row .tabulator-cell:first-child .tabulator-col-resize-handle.prev{display:none}.tabulator-row .tabulator-cell.tabulator-row-handle{display:-ms-inline-flexbox;display:inline-flex;-ms-flex-align:center;align-items:center;-moz-user-select:none;-khtml-user-select:none;-webkit-user-select:none;-o-user-select:none}.tabulator-row .tabulator-cell.tabulator-row-handle .tabulator-row-handle-box{width:80%}.tabulator-row .tabulator-cell.tabulator-row-handle .tabulator-row-handle-box .tabulator-row-handle-bar{width:100%;height:3px;margin-top:2px;background:rgba(32.1569%,38.8235%,55.6863%,1)}.tabulator-row .tabulator-cell .tabulator-data-tree-branch{display:inline-block;vertical-align:middle;height:9px;width:7px;margin-top:-9px;margin-right:5px;border-bottom-left-radius:1px;border-left:2px solid #aaa;border-bottom:2px solid #aaa}.tabulator-row .tabulator-cell .tabulator-data-tree-control{display:-ms-inline-flexbox;display:inline-flex;-ms-flex-pack:center;justify-content:center;-ms-flex-align:center;align-items:center;vertical-align:middle;height:11px;width:11px;margin-right:5px;border:1px solid #333;border-radius:2px;background:rgba(0,0,0,.1);overflow:hidden}.tabulator-row .tabulator-cell .tabulator-data-tree-control:hover{cursor:pointer;background:rgba(0,0,0,.2)}.tabulator-row .tabulator-cell .tabulator-data-tree-control .tabulator-data-tree-control-collapse{display:inline-block;position:relative;height:7px;width:1px;background:0 0}.tabulator-row .tabulator-cell .tabulator-data-tree-control .tabulator-data-tree-control-collapse:after{position:absolute;content:"";left:-3px;top:3px;height:1px;width:7px;background:#333}.tabulator-row .tabulator-cell .tabulator-data-tree-control .tabulator-data-tree-control-expand{display:inline-block;position:relative;height:7px;width:1px;background:#333}.tabulator-row .tabulator-cell .tabulator-data-tree-control .tabulator-data-tree-control-expand:after{position:absolute;content:"";left:-3px;top:3px;height:1px;width:7px;background:#333}.tabulator-row .tabulator-cell .tabulator-responsive-collapse-toggle{display:-ms-inline-flexbox;display:inline-flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;-moz-user-select:none;-khtml-user-select:none;-webkit-user-select:none;-o-user-select:none;height:15px;width:15px;border-radius:20px;background:#666;color:#fff;font-weight:700;font-size:1.1em}.tabulator-row .tabulator-cell .tabulator-responsive-collapse-toggle:hover{opacity:.7}.tabulator-row .tabulator-cell .tabulator-responsive-collapse-toggle.open .tabulator-responsive-collapse-toggle-close{display:initial}.tabulator-row .tabulator-cell .tabulator-responsive-collapse-toggle.open .tabulator-responsive-collapse-toggle-open{display:none}.tabulator-row .tabulator-cell .tabulator-responsive-collapse-toggle .tabulator-responsive-collapse-toggle-close{display:none}.tabulator-row .tabulator-cell .tabulator-traffic-light{display:inline-block;height:14px;width:14px;border-radius:14px}.tabulator-row.tabulator-group{box-sizing:border-box;border-right:1px solid #aaa;border-top:1px solid #000;border-bottom:2px solid rgba(32.1569%,38.8235%,55.6863%,1);padding:5px;padding-left:10px;background:#222;color:#fff;font-weight:700;min-width:100%}.tabulator-row.tabulator-group:hover{cursor:pointer;background-color:#090909}.tabulator-row.tabulator-group.tabulator-group-visible .tabulator-arrow{margin-right:10px;border-left:6px solid transparent;border-right:6px solid transparent;border-top:6px solid rgba(32.1569%,38.8235%,55.6863%,1);border-bottom:0}.tabulator-row.tabulator-group.tabulator-group-level-1{padding-left:30px}.tabulator-row.tabulator-group.tabulator-group-level-2{padding-left:50px}.tabulator-row.tabulator-group.tabulator-group-level-3{padding-left:70px}.tabulator-row.tabulator-group.tabulator-group-level-4{padding-left:90px}.tabulator-row.tabulator-group.tabulator-group-level-5{padding-left:110px}.tabulator-row.tabulator-group .tabulator-group-toggle{display:inline-block}.tabulator-row.tabulator-group .tabulator-arrow{display:inline-block;width:0;height:0;margin-right:16px;border-top:6px solid transparent;border-bottom:6px solid transparent;border-right:0;border-left:6px solid rgba(32.1569%,38.8235%,55.6863%,1);vertical-align:middle}.tabulator-row.tabulator-group span{margin-left:10px;color:rgba(32.1569%,38.8235%,55.6863%,1)}.tabulator-menu{position:absolute;display:inline-block;box-sizing:border-box;background:#fff;border:1px solid #aaa;box-shadow:0 0 5px 0 rgba(0,0,0,.2);font-size:14px;overflow-y:auto;-webkit-overflow-scrolling:touch;z-index:10000}.tabulator-menu .tabulator-menu-item{padding:5px 10px;-webkit-user-select:none;-ms-user-select:none;user-select:none}.tabulator-menu .tabulator-menu-item.tabulator-menu-item-disabled{opacity:.5}.tabulator-menu .tabulator-menu-item:not(.tabulator-menu-item-disabled):hover{cursor:pointer;background:#efefef}.tabulator-menu .tabulator-menu-separator{border-top:1px solid #aaa}.tabulator-edit-select-list{position:absolute;display:inline-block;box-sizing:border-box;max-height:200px;background:#fff;border:1px solid #aaa;font-size:14px;overflow-y:auto;-webkit-overflow-scrolling:touch;z-index:10000}.tabulator-edit-select-list .tabulator-edit-select-list-item{padding:4px;color:#333}.tabulator-edit-select-list .tabulator-edit-select-list-item.active{color:#fff;background:#1d68cd}.tabulator-edit-select-list .tabulator-edit-select-list-item.active.focused{outline:1px solid rgba(255,255,255,.5)}.tabulator-edit-select-list .tabulator-edit-select-list-item.focused{outline:1px solid #1d68cd}.tabulator-edit-select-list .tabulator-edit-select-list-item:hover{cursor:pointer;color:#fff;background:#1d68cd}.tabulator-edit-select-list .tabulator-edit-select-list-notice{padding:4px;color:#333;text-align:center}.tabulator-edit-select-list .tabulator-edit-select-list-group{border-bottom:1px solid #aaa;padding:4px;padding-top:6px;color:#333;font-weight:700}.tabulator.tabulator-ltr{direction:ltr}.tabulator.tabulator-rtl{text-align:initial;direction:rtl}.tabulator.tabulator-rtl .tabulator-header .tabulator-col{text-align:initial;border-left:1px solid #aaa;border-right:initial}.tabulator.tabulator-rtl .tabulator-header .tabulator-col.tabulator-col-group .tabulator-col-group-cols{margin-right:initial;margin-left:-1px}.tabulator.tabulator-rtl .tabulator-header .tabulator-col.tabulator-sortable .tabulator-col-title{padding-right:0;padding-left:25px}.tabulator.tabulator-rtl .tabulator-header .tabulator-col .tabulator-col-content .tabulator-arrow{left:8px;right:initial}.tabulator.tabulator-rtl .tabulator-row .tabulator-cell{border-right:initial;border-left:1px solid #aaa}.tabulator.tabulator-rtl .tabulator-row .tabulator-cell .tabulator-data-tree-branch{margin-right:initial;margin-left:5px;border-bottom-left-radius:initial;border-bottom-right-radius:1px;border-left:initial;border-right:2px solid #aaa}.tabulator.tabulator-rtl .tabulator-row .tabulator-cell .tabulator-data-tree-control{margin-right:initial;margin-left:5px}.tabulator.tabulator-rtl .tabulator-col-resize-handle{position:absolute;left:0;right:auto}.tabulator.tabulator-rtl .tabulator-col-resize-handle.prev{right:0;left:auto}.tabulator-print-fullscreen{position:absolute;top:0;bottom:0;left:0;right:0;z-index:10000}body.tabulator-print-fullscreen-hide>:not(.tabulator-print-fullscreen){display:none!important}.tabulator-print-table{border-collapse:collapse}.tabulator-print-table .tabulator-print-table-group{box-sizing:border-box;border-right:1px solid #aaa;border-top:1px solid #000;border-bottom:2px solid rgba(32.1569%,38.8235%,55.6863%,1);padding:5px;padding-left:10px;background:#222;color:#fff;font-weight:700;min-width:100%}.tabulator-print-table .tabulator-print-table-group:hover{cursor:pointer;background-color:#090909}.tabulator-print-table .tabulator-print-table-group.tabulator-group-visible .tabulator-arrow{margin-right:10px;border-left:6px solid transparent;border-right:6px solid transparent;border-top:6px solid rgba(32.1569%,38.8235%,55.6863%,1);border-bottom:0}.tabulator-print-table .tabulator-print-table-group.tabulator-group-level-1 td{padding-left:30px!important}.tabulator-print-table .tabulator-print-table-group.tabulator-group-level-2 td{padding-left:50px!important}.tabulator-print-table .tabulator-print-table-group.tabulator-group-level-3 td{padding-left:70px!important}.tabulator-print-table .tabulator-print-table-group.tabulator-group-level-4 td{padding-left:90px!important}.tabulator-print-table .tabulator-print-table-group.tabulator-group-level-5 td{padding-left:110px!important}.tabulator-print-table .tabulator-print-table-group .tabulator-group-toggle{display:inline-block}.tabulator-print-table .tabulator-print-table-group .tabulator-arrow{display:inline-block;width:0;height:0;margin-right:16px;border-top:6px solid transparent;border-bottom:6px solid transparent;border-right:0;border-left:6px solid rgba(32.1569%,38.8235%,55.6863%,1);vertical-align:middle}.tabulator-print-table .tabulator-print-table-group span{margin-left:10px;color:rgba(32.1569%,38.8235%,55.6863%,1)}.tabulator-print-table .tabulator-data-tree-branch{display:inline-block;vertical-align:middle;height:9px;width:7px;margin-top:-9px;margin-right:5px;border-bottom-left-radius:1px;border-left:2px solid #aaa;border-bottom:2px solid #aaa}.tabulator-print-table .tabulator-data-tree-control{display:-ms-inline-flexbox;display:inline-flex;-ms-flex-pack:center;justify-content:center;-ms-flex-align:center;align-items:center;vertical-align:middle;height:11px;width:11px;margin-right:5px;border:1px solid #333;border-radius:2px;background:rgba(0,0,0,.1);overflow:hidden}.tabulator-print-table .tabulator-data-tree-control:hover{cursor:pointer;background:rgba(0,0,0,.2)}.tabulator-print-table .tabulator-data-tree-control .tabulator-data-tree-control-collapse{display:inline-block;position:relative;height:7px;width:1px;background:0 0}.tabulator-print-table .tabulator-data-tree-control .tabulator-data-tree-control-collapse:after{position:absolute;content:"";left:-3px;top:3px;height:1px;width:7px;background:#333}.tabulator-print-table .tabulator-data-tree-control .tabulator-data-tree-control-expand{display:inline-block;position:relative;height:7px;width:1px;background:#333}.tabulator-print-table .tabulator-data-tree-control .tabulator-data-tree-control-expand:after{position:absolute;content:"";left:-3px;top:3px;height:1px;width:7px;background:#333} \ No newline at end of file diff --git a/website/js/vendor/tabulator/css/tabulator_site.min.css.map b/website/js/vendor/tabulator/css/tabulator_site.min.css.map new file mode 100644 index 0000000..5ca4e22 --- /dev/null +++ b/website/js/vendor/tabulator/css/tabulator_site.min.css.map @@ -0,0 +1 @@ +{"version":3,"sources":["tabulator_site.scss"],"names":[],"mappings":"AAyCA,WACC,kBAAkB,AAElB,6BAvCgB,AAyChB,sBA1CqB,AA4CrB,eA1Ca,AA2Cb,gBAAgB,AAChB,gBAAe,AAMf,uBAAwB,CAiiBxB,AAhjBD,iFAoBI,cAAc,CACd,AArBJ,0CA0BE,oBAAqB,CACrB,AA3BF,oFAiCK,iBAAkB,CAClB,AAlCL,kCAyCE,yBAAiB,AAAjB,qBAAiB,AAAjB,gBAAiB,CACjB,AA1CF,6BA8CE,kBAAiB,AACjB,sBAAsB,AAEtB,WAAU,AAEV,gCAhF2B,AAiF3B,sBApFyB,AAqFzB,WApFmB,AAqFnB,gBAAgB,AAEhB,mBAAmB,AACnB,gBAAe,AAEf,sBAAsB,AACtB,wBAAwB,AACxB,yBAAyB,AACzB,mBAAoB,CAmRpB,AAjVF,qDAiEG,YAAY,CACZ,AAlEH,4CAsEG,qBAAoB,AAEpB,kBAAiB,AACjB,sBAAqB,AACrB,4BAxGoB,AAyGpB,sBA3GwB,AA4GxB,gBAAe,AACf,sBAAsB,AACtB,eAAgB,CAqNhB,AAnSH,6DAiFI,kBAAkB,AAClB,yBA/GyB,AAgHzB,mBAA8C,AAC9C,mBAAoB,CACpB,AArFJ,mEAyFI,sBAAqB,AACrB,kBAAkB,AAClB,WAAW,CA8DX,AAzJJ,iGA+FK,aAAc,CAMd,AArGL,uGAkGM,eAAe,AACf,UAAW,CACX,AApGN,+FAyGK,iBAAkB,CAClB,AA1GL,wFA8GK,sBAAqB,AACrB,WAAW,AAEX,mBAAmB,AACnB,gBAAgB,AAChB,uBAAuB,AACvB,qBAAqB,CAiBrB,AArIL,gHAwHM,sBAAsB,AACtB,WAAW,AAEX,sBAAqB,AAErB,YAAW,AAEX,eAAgB,CAChB,AAhIN,8IAmIM,uBAAuB,CACvB,AApIN,yFAyIK,oBAAa,AAAb,aAAa,AACb,sBAAmB,AAAnB,mBAAmB,AAEnB,kBAAkB,AAClB,MAAK,AACL,SAAQ,AACR,SAAS,CAST,AAxJL,0GAkJM,QAAQ,AACR,SAAS,AACT,kCAAkC,AAClC,mCAAmC,AACnC,4BA9KkB,CA+KlB,AAvJN,0FAgKK,kBAAiB,AACjB,oBAAa,AAAb,aAAa,AAEb,0BAjMkB,AAkMlB,gBAAgB,AAEhB,iBAAiB,CACjB,AAvKL,0FA6KK,YAAa,CACb,AA9KL,qEAmLI,kBAAkB,AAClB,sBAAsB,AACtB,eAAc,AACd,WAAU,AACV,iBAAkB,CAiBlB,AAxMJ,8EA2LK,qBAAsB,CACtB,AA5LL,yEA+LK,cAAe,CACf,AAhML,sFAoMM,QAAS,AACT,QAAS,CACT,AAtMN,oFA6MK,kBAAkB,CAClB,AA9ML,qEAiNK,eAAc,AACd,wBAAoD,CACpD,AAnNL,4HAuNM,UA/OkB,CAqPlB,AA7NN,6IA0NO,gBAAgB,AAChB,4BAnPiB,CAoPjB,AA5NP,2HAkOM,aA3PmB,CAkQnB,AAzON,4IAqOO,gBAAgB,AAChB,+BA/PkB,CAiQlB,AAxOP,4HA8OM,aAvQmB,CA8QnB,AArPN,6IAiPO,mBAAmB,AACnB,6BA3QkB,AA4QlB,aA5QkB,CA6QlB,AApPP,+GA4PM,uBAAyB,AAAzB,yBAAyB,AACzB,uBAAuB,AAEvB,oBAAY,AAAZ,aAAY,AACZ,sBAAkB,AAAlB,mBAAkB,AAClB,qBAAsB,AAAtB,sBAAsB,CACtB,AAlQN,oHAuQM,wBAAyB,CACzB,AAxQN,2GA6QM,gBAAe,AACf,gBAAgB,CAChB,AA/QN,uIAmRO,gBAAe,AACf,mBAAmB,CACnB,AArRP,4GA0RM,qBAAuB,AAAvB,uBAAuB,AACvB,OAAM,AACN,QAAO,AACP,QAAO,AACP,WAAW,CACX,AA/RN,+CAsSG,qBAAqB,AACrB,kBAAkB,AAIlB,UAAW,CASX,AApTH,qEA8SI,2BAjUgB,CAkUhB,AA/SJ,sEAkTI,0BArUgB,CAsUhB,AAnTJ,qDAuTG,sBAAqB,AACrB,eAAc,AAEd,6BAA0D,AAU1D,0BAvViB,AA0VjB,eAAgB,CAChB,AAxUH,oEA6TI,4BAA0D,CAK1D,AAlUJ,iGAgUK,YAAa,CACb,AAjUL,2DA2UG,cAAc,CAKd,AAhVH,iEA8UI,YAAa,CACb,AA/UJ,kCAqVE,kBAAiB,AACjB,WAAU,AACV,mBAAmB,AACnB,cAAa,AACb,gCAAiC,CAgDjC,AAzYF,wCA4VG,YAAa,CACb,AA7VH,yDAiWG,sBAAqB,AACrB,oBAAa,AAAb,aAAa,AACb,sBAAkB,AAAlB,mBAAkB,AAOlB,UAAU,CAYV,AAtXH,wFAsWI,gBAAe,AACf,cAAc,CACd,AAxWJ,8DA6WI,qBAAqB,AAErB,cAAa,AACb,aAAY,AAEZ,cA/YyB,AAgZzB,gBAAiB,AACjB,cAAe,CACf,AArXJ,mDA0XG,kBAAiB,AACjB,qBAAoB,AACpB,sBAjZqB,AAkZrB,mBAAmB,AACnB,iBAAgB,AAChB,UAjZe,CA0Zf,AAxYH,kFAmYK,gBAAiB,AACjB,6BAA0D,AAC1D,UApagB,CAqahB,AAtYL,6BA8YE,iBAAgB,AAChB,gBAAe,AACf,6BArZ2B,AAsZ3B,sBAzZyB,AA0ZzB,iBAAgB,AAChB,WA1ZmB,AA2ZnB,gBAAgB,AAChB,mBAAkB,AAClB,qBAAgB,AAAhB,iBAAgB,AAEhB,sBAAsB,AACtB,wBAAwB,AACxB,yBAAyB,AACzB,mBAAoB,CAuFpB,AAlfF,qDA8ZG,sBAAqB,AACrB,wBAAuB,AACvB,sBAA2B,AAE3B,gBAAgB,AAEhB,6BAA0D,AAY1D,6BAnciB,AAqcjB,eAAgB,CAMhB,AAxbH,oEAuaI,6BAA0D,AAC1D,oBAAiC,CAKjC,AA7aJ,iGA2aK,YAAa,CACb,AA5aL,gEAqbI,mBAAkB,AAClB,kBAAkB,CAClB,AAvbJ,wDA6bI,UAAU,CACV,AA9bJ,kDAmcG,qBAAoB,AAEpB,aAAY,AACZ,gBAAe,AAEf,sBA9coB,AA+cpB,iBAAiB,CACjB,AA1cH,8CA8cG,YAAY,CACZ,AA/cH,6CAmdG,qBAAoB,AAEpB,aAAY,AACZ,gBAAe,AAEf,sBA9doB,AA+dpB,kBAAiB,AAEjB,gBAAe,AAEf,WApekB,AAqelB,oBAAmB,AACnB,oBAAmB,AACnB,iBAAiB,CAiBjB,AAjfH,oDAmeI,aAxeyB,CAyezB,AApeJ,sDAueI,UAAU,CACV,AAxeJ,kEA4eK,eAAc,AACd,0BAAyB,AACzB,UAAU,CACV,AA/eL,wCAsfE,kBAAiB,AACjB,QAAO,AACP,MAAK,AACL,SAAQ,AACR,SAAS,CAUT,AApgBF,6CA6fG,OAAM,AACN,UAAU,CACV,AA/fH,8CAkgBG,gBAAgB,CAChB,AAngBH,6BAygBE,kBAAiB,AACjB,oBAAa,AAAb,aAAa,AACb,sBAAkB,AAAlB,mBAAkB,AAElB,MAAK,AACL,OAAM,AACN,YAAW,AAEX,YAAW,AACX,WAAU,AACV,0BAAyB,AACzB,iBAAiB,CA2BjB,AA/iBF,mDAwhBG,qBAAoB,AAEpB,cAAa,AACb,kBAAiB,AAEjB,mBAAkB,AAElB,gBAAe,AACf,gBAAgB,AAChB,cAAc,CAad,AA9iBH,qEAqiBI,sBAAqB,AACrB,UAAU,CACV,AAviBJ,mEA2iBI,sBAAqB,AACrB,aAAa,CACb,AAMJ,eACC,kBAAkB,AAClB,sBAAsB,AACtB,gBAA0C,AAC1C,qBA5kBuB,CA47BvB,AApXD,kCAQE,wBA/kB4B,CAglB5B,AATF,0CAYE,sBAhlBsB,AAilBtB,cAAe,CACf,AAdF,kCAiBE,wBAnlB6B,CAolB7B,AAlBF,wCAqBE,yBAtlBkC,AAulBlC,cAAe,CACf,AAvBF,oCA0BE,sBAAqB,AACrB,eAAe,CACf,AA5BF,gCA+BE,kBAAkB,AAElB,0BAvmBkB,AAwmBlB,6BAxmBkB,AA0mBlB,8BAA+B,AAC/B,UAAU,CACV,AAtCF,4CA0CE,kBAAiB,AACjB,QAAO,AACP,SAAQ,AACR,OAAM,AACN,UAAU,CAUV,AAxDF,iDAiDG,MAAK,AACL,WAAW,CACX,AAnDH,kDAsDG,gBAAgB,CAChB,AAvDH,iCA2DE,qBAAqB,AACrB,kBAAkB,AAElB,yBAAyB,AAEzB,UAAW,CASX,AAzEF,uDAmEG,2BAzoBiB,CA0oBjB,AApEH,wDAuEG,0BA7oBiB,CA8oBjB,AAxEH,8CA4EE,sBAAqB,AAErB,YAAW,AAEX,0BAtpBkB,AAupBlB,4BAvpBkB,CA0qBlB,AApGF,oDAoFG,YAAY,CACZ,AArFH,oDAwFG,cA9qBW,CAyrBX,AAnGH,0DA4FK,iBAAkB,CAKlB,AAjGL,wEA+FM,kBAAkB,CAClB,AAhGN,+BAwGE,qBAAoB,AACpB,kBAAkB,AAClB,sBAAqB,AACrB,YAAW,AACX,4BAlrBkB,AAmrBlB,sBAAqB,AACrB,mBAAkB,AAClB,gBAAe,AACf,sBAAsB,CA0LtB,AA1SF,iDAoHG,yBAnrBkB,AAorBlB,SAAU,CAMV,AA3HH,+GAwHI,WAAU,AACV,sBAAsB,CACtB,AA1HJ,yDA8HG,qBA5rBgB,CAmsBhB,AArIH,+HAgII,WAAU,AACV,uBAAsB,AAEtB,UAjsBe,CAksBf,AApIJ,6EA0II,YAAa,CACb,AA3IJ,oDAiJG,2BAAoB,AAApB,oBAAoB,AACpB,sBAAkB,AAAlB,mBAAkB,AAElB,sBAAsB,AACtB,wBAAwB,AACxB,yBAAyB,AACzB,mBAAoB,CAcpB,AArKH,8EA2JI,SAAS,CAST,AApKJ,wGA+JK,WAAU,AACV,WAAU,AACV,eAAc,AACd,kBA9uBoB,CA+uBpB,AAnKL,2DAwKG,qBAAoB,AACpB,sBAAqB,AAErB,WAAU,AACV,UAAS,AAET,gBAAe,AACf,iBAAgB,AAEhB,8BAA6B,AAE7B,2BAzvBiB,AA0vBjB,4BA1vBiB,CA2vBjB,AArLH,4DAyLG,2BAAmB,AAAnB,oBAAmB,AACnB,qBAAsB,AAAtB,uBAAsB,AACtB,sBAAkB,AAAlB,mBAAkB,AAClB,sBAAqB,AAErB,YAAW,AACX,WAAU,AAEV,iBAAgB,AAEhB,sBAxwBe,AAywBf,kBAAiB,AACjB,0BAA4B,AAE5B,eAAe,CAmDf,AA1PH,kEA0MI,eAAc,AACd,yBAA4B,CAC5B,AA5MJ,kGA+MI,qBAAoB,AACpB,kBAAkB,AAElB,WAAW,AACX,UAAU,AAEV,sBAAuB,CAavB,AAlOJ,wGAwNK,kBAAkB,AAClB,WAAW,AACX,UAAU,AACV,QAAQ,AAER,WAAW,AACX,UAAU,AAEV,eAryBa,CAsyBb,AAjOL,gGAqOI,qBAAoB,AACpB,kBAAkB,AAElB,WAAW,AACX,UAAU,AAEV,eAhzBc,CA6zBd,AAxPJ,sGA8OK,kBAAkB,AAClB,WAAW,AACX,UAAU,AACV,QAAQ,AAER,WAAW,AACX,UAAU,AAEV,eA3zBa,CA4zBb,AAvPL,qEA6PG,2BAAoB,AAApB,oBAAoB,AACpB,sBAAkB,AAAlB,mBAAkB,AAClB,qBAAsB,AAAtB,uBAAsB,AAEtB,sBAAsB,AACtB,wBAAwB,AACxB,yBAAyB,AACzB,oBAAoB,AAEpB,YAAW,AACX,WAAU,AAEV,mBAAkB,AAClB,gBAAe,AAEf,WAp1BqB,AAq1BrB,gBAAgB,AAChB,eAAe,CAmBf,AAjSH,2EAiRI,UAAU,CACV,AAlRJ,sHAsRK,eAAe,CACf,AAvRL,sOA+RI,YAAY,CACZ,AAhSJ,wDAoSG,qBAAqB,AACrB,YAAW,AACX,WAAU,AAEV,kBAAkB,CAClB,AAzSH,+BA8SE,sBAAqB,AACrB,4BAr3BkB,AAs3BlB,0BAAyB,AACzB,gCAj4B2B,AAk4B3B,YAAW,AACX,kBAAiB,AACjB,gBAv4ByB,AAw4BzB,WAv4BmB,AAw4BnB,gBAAgB,AAEhB,cAAe,CA0Df,AAlXF,qCA2TG,eAAc,AACd,wBAAoD,CACpD,AA7TH,wEAiUI,kBAAiB,AACjB,kCAAkC,AAClC,mCAAmC,AACnC,6BAh5BqB,AAi5BrB,eAAgB,CAChB,AAtUJ,uDA0UG,iBAAiB,CACjB,AA3UH,uDA8UG,iBAAiB,CACjB,AA/UH,uDAkVG,iBAAiB,CACjB,AAnVH,uDAsVG,iBAAiB,CACjB,AAvVH,uDA0VG,kBAAkB,CAClB,AA3VH,uDA8VG,oBAAqB,CACrB,AA/VH,gDAmWG,qBAAqB,AACrB,QAAQ,AACR,SAAS,AACT,kBAAiB,AACjB,iCAAiC,AACjC,oCAAoC,AACpC,eAAe,AACf,8BAt7BsB,AAu7BtB,qBAAqB,CACrB,AA5WH,oCA+WG,iBAAgB,AAChB,aAh8B0B,CAi8B1B,AAKH,gBACC,kBAAkB,AAClB,qBAAoB,AACpB,sBAAqB,AAErB,gBAn8BuB,AAo8BvB,sBAl8BmB,AAm8BnB,oCAAuC,AAEvC,eAr9Ba,AAu9Bb,gBAAe,AACf,iCAAiC,AAEjC,aAAc,CAqBd,AAnCD,qCAkBE,iBAAgB,AAEhB,yBAAiB,AAAjB,qBAAiB,AAAjB,gBAAiB,CAUjB,AA9BF,kEAuBG,UAAW,CACX,AAxBH,8EA2BG,eAAe,AACf,kBAz9B2B,CA09B3B,AA7BH,0CAiCE,yBA79BkB,CA89BlB,AAGF,4BACC,kBAAkB,AAClB,qBAAoB,AACpB,sBAAqB,AAErB,iBAAgB,AAEhB,gBA1+BuB,AA2+BvB,sBAz+BmB,AA2+BnB,eA3/Ba,AA6/Bb,gBAAe,AACf,iCAAiC,AAEjC,aAAc,CA6Cd,AA5DD,6DAkBE,YAAW,AAEX,UAp/BgB,CA0gChB,AA1CF,oEAuBG,WA1/BqB,AA2/BrB,kBAl/BkB,CAu/BlB,AA7BH,4EA2BI,oCA9/BoB,CA+/BpB,AA5BJ,qEAgCG,yBA1/BkB,CA2/BlB,AAjCH,mEAqCG,eAAc,AAEd,WA1gCqB,AA2gCrB,kBAlgCkB,CAmgClB,AAzCH,+DA6CE,YAAW,AAEX,WA/gCgB,AAghChB,iBAAkB,CAClB,AAjDF,8DAoDE,6BArhCkB,AAuhClB,YAAW,AACX,gBAAe,AAEf,WAzhCgB,AA0hChB,eAAgB,CAChB,AAMF,yBACC,aAAc,CACd,AAGD,yBACC,mBAAmB,AACnB,aAAc,CAwEd,AA1ED,0DAMG,mBAAmB,AACnB,2BAzjCoB,AA0jCpB,oBAAoB,CAsBpB,AA9BH,wGAYK,eAAoB,AACpB,gBAAgB,CAChB,AAdL,kGAmBK,gBAAe,AACf,iBAAiB,CACjB,AArBL,kGA0BK,SAAQ,AACR,UAAa,CACb,AA5BL,wDAmCG,qBAAoB,AACpB,0BA3kCiB,CAmmCjB,AA5DH,oFA8CI,eAAoB,AACpB,gBAAe,AAEf,4BAAiC,AACjC,+BAA8B,AAE9B,oBAAmB,AACnB,2BA5lCgB,CA6lChB,AAtDJ,qFAyDI,eAAoB,AACpB,eAAe,CACf,AA3DJ,sDAiEE,kBAAiB,AACjB,OAAM,AACN,UAAU,CAMV,AAzEF,2DAsEG,QAAO,AACP,SAAS,CACT,AAOH,4BACC,kBAAkB,AAClB,MAAK,AACL,SAAQ,AACR,OAAM,AACN,QAAO,AAEP,aAAc,CACd,AAED,uEACC,sBAAuB,CACvB,AAED,uBACC,wBAAyB,CAsKzB,AAvKD,oDAKE,sBAAqB,AACrB,4BA1oCkB,AA2oClB,0BAAyB,AACzB,gCAtpC2B,AAupC3B,YAAW,AACX,kBAAiB,AACjB,gBA5pCyB,AA6pCzB,WA5pCmB,AA6pCnB,gBAAgB,AAEhB,cAAe,CAmEf,AAlFF,0DAkBG,eAAc,AACd,wBAAoD,CACpD,AApBH,6FAwBI,kBAAiB,AACjB,kCAAkC,AAClC,mCAAmC,AACnC,6BArqCqB,AAsqCrB,eAAgB,CAChB,AA7BJ,+EAkCI,2BAA4B,CAC5B,AAnCJ,+EAwCI,2BAA4B,CAC5B,AAzCJ,+EA8CI,2BAA4B,CAC5B,AA/CJ,+EAoDI,2BAA4B,CAC5B,AArDJ,+EA0DI,4BAA6B,CAC7B,AA3DJ,4EA8DG,oBAAqB,CACrB,AA/DH,qEAmEG,qBAAqB,AACrB,QAAQ,AACR,SAAS,AACT,kBAAiB,AACjB,iCAAiC,AACjC,oCAAoC,AACpC,eAAe,AACf,8BAptCsB,AAqtCtB,qBAAqB,CACrB,AA5EH,yDA+EG,iBAAgB,AAChB,aA9tC0B,CA+tC1B,AAjFH,mDAqFE,qBAAoB,AACpB,sBAAqB,AAErB,WAAU,AACV,UAAS,AAET,gBAAe,AACf,iBAAgB,AAEhB,8BAA6B,AAE7B,2BApuCkB,AAquClB,4BAruCkB,CAsuClB,AAlGF,oDAsGE,2BAAmB,AAAnB,oBAAmB,AACnB,qBAAsB,AAAtB,uBAAsB,AACtB,sBAAkB,AAAlB,mBAAkB,AAClB,sBAAqB,AAErB,YAAW,AACX,WAAU,AAEV,iBAAgB,AAEhB,sBAnvCgB,AAovChB,kBAAiB,AACjB,0BAA4B,AAE5B,eAAe,CAkDf,AAtKF,0DAuHG,eAAc,AACd,yBAA4B,CAC5B,AAzHH,0FA4HG,qBAAoB,AACpB,kBAAkB,AAElB,WAAW,AACX,UAAU,AAEV,sBAAuB,CAavB,AA/IH,gGAqII,kBAAkB,AAClB,WAAW,AACX,UAAU,AACV,QAAQ,AAER,WAAW,AACX,UAAU,AAEV,eAhxCc,CAixCd,AA9IJ,wFAkJG,qBAAoB,AACpB,kBAAkB,AAElB,WAAW,AACX,UAAU,AAEV,eA3xCe,CAwyCf,AArKH,8FA2JI,kBAAkB,AAClB,WAAW,AACX,UAAU,AACV,QAAQ,AAER,WAAW,AACX,UAAU,AAEV,eAtyCc,CAuyCd","file":"tabulator_site.min.css","sourcesContent":["/* Tabulator v4.8.3 (c) Oliver Folkerd */\n\n\r\n//Main Theme Variables\r\n$backgroundColor: #fff !default; //background color of tabulator\r\n$borderColor:#222 !default; //border to tabulator\r\n$textSize:14px !default; //table text size\r\n\r\n//header themeing\r\n$headerBackgroundColor:#222 !default; //border to tabulator\r\n$headerTextColor:#fff !default; //header text colour\r\n$headerBorderColor:#aaa !default; //header border color\r\n$headerSeperatorColor:#3FB449 !default; //header bottom seperator color\r\n$headerMargin:4px !default; //padding round header\r\n\r\n//column header arrows\r\n$sortArrowActive: #3FB449 !default;\r\n$sortArrowInactive: #bbb !default;\r\n\r\n//row themeing\r\n$rowBackgroundColor:#fff !default; //table row background color\r\n$rowAltBackgroundColor:#EFEFEF !default; //table row background color\r\n$rowBorderColor:#aaa !default; //table border color\r\n$rowTextColor:#333 !default; //table text color\r\n$rowHoverBackground:#bbb !default; //row background color on hover\r\n\r\n$rowSelectedBackground: #9ABCEA !default; //row background color when selected\r\n$rowSelectedBackgroundHover: #769BCC !default;//row background color when selected and hovered\r\n\r\n$editBoxColor:#1D68CD !default; //border color for edit boxes\r\n$errorColor:#dd0000 !default; //error indication\r\n\r\n//footer themeing\r\n$footerBackgroundColor:#222 !default; //border to tabulator\r\n$footerTextColor:#222 !default; //footer text colour\r\n$footerBorderColor:#aaa !default; //footer border color\r\n$footerSeperatorColor:#3FB449 !default; //footer bottom seperator color\r\n$footerActiveColor:$footerSeperatorColor !default; //footer bottom active text color\r\n\r\n\r\n//Tabulator Containing Element\r\n.tabulator{\r\n\tposition: relative;\r\n\r\n\tborder-bottom: 5px solid $borderColor;\r\n\r\n\tbackground-color: $backgroundColor;\r\n\r\n\tfont-size:$textSize;\r\n\ttext-align: left;\r\n\toverflow:hidden;\r\n\r\n\t-webkit-transform: translatez(0);\r\n\t-moz-transform: translatez(0);\r\n\t-ms-transform: translatez(0);\r\n\t-o-transform: translatez(0);\r\n\ttransform: translatez(0);\r\n\r\n\t&[tabulator-layout=\"fitDataFill\"]{\r\n\t\t.tabulator-tableHolder{\r\n\t\t\t.tabulator-table{\r\n\t\t\t\tmin-width:100%;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\t&[tabulator-layout=\"fitDataTable\"]{\r\n\t\tdisplay: inline-block;\r\n\t}\r\n\r\n\t&[tabulator-layout=\"fitColumns\"]{\r\n\t\t.tabulator-row{\r\n\t\t\t.tabulator-cell{\r\n\t\t\t\t&:last-of-type{\r\n\t\t\t\t\tborder-right: none;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\r\n\t&.tabulator-block-select{\r\n\t\tuser-select: none;\r\n\t}\r\n\r\n\t//column header containing element\r\n\t.tabulator-header{\r\n\t\tposition:relative;\r\n\t\tbox-sizing: border-box;\r\n\r\n\t\twidth:100%;\r\n\r\n\t\tborder-bottom:3px solid $headerSeperatorColor;\r\n\t\tbackground-color: $headerBackgroundColor;\r\n\t\tcolor: $headerTextColor;\r\n\t\tfont-weight:bold;\r\n\r\n\t\twhite-space: nowrap;\r\n\t\toverflow:hidden;\r\n\r\n\t\t-moz-user-select: none;\r\n\t\t-khtml-user-select: none;\r\n\t\t-webkit-user-select: none;\r\n\t\t-o-user-select: none;\r\n\r\n\t\t&.tabulator-header-hidden{\r\n\t\t\tdisplay:none;\r\n\t\t}\r\n\r\n\t\t//individual column header element\r\n\t\t.tabulator-col{\r\n\t\t\tdisplay:inline-block;\r\n\r\n\t\t\tposition:relative;\r\n\t\t\tbox-sizing:border-box;\r\n\t\t\tborder-right:1px solid $headerBorderColor;\r\n\t\t\tbackground-color: $headerBackgroundColor;\r\n\t\t\ttext-align:left;\r\n\t\t\tvertical-align: bottom;\r\n\t\t\toverflow: hidden;\r\n\r\n\t\t\t&.tabulator-moving{\r\n\t\t\t\tposition: absolute;\r\n\t\t\t\tborder:1px solid $headerSeperatorColor;\r\n\t\t\t\tbackground:darken($headerBackgroundColor, 10%);\r\n\t\t\t\tpointer-events: none;\r\n\t\t\t}\r\n\r\n\t\t\t//hold content of column header\r\n\t\t\t.tabulator-col-content{\r\n\t\t\t\tbox-sizing:border-box;\r\n\t\t\t\tposition: relative;\r\n\t\t\t\tpadding:8px;\r\n\r\n\t\t\t\t//header menu button\r\n\t\t\t\t.tabulator-header-menu-button{\r\n\t\t\t\t\tpadding: 0 8px;\r\n\r\n\t\t\t\t\t&:hover{\r\n\t\t\t\t\t\tcursor: pointer;\r\n\t\t\t\t\t\topacity: .6;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\r\n\t\t\t\t//hold title and sort arrow\r\n\t\t\t\t.tabulator-col-title-holder{\r\n\t\t\t\t\tposition: relative;\r\n\t\t\t\t}\r\n\r\n\t\t\t\t//hold title of column header\r\n\t\t\t\t.tabulator-col-title{\r\n\t\t\t\t\tbox-sizing:border-box;\r\n\t\t\t\t\twidth: 100%;\r\n\r\n\t\t\t\t\twhite-space: nowrap;\r\n\t\t\t\t\toverflow: hidden;\r\n\t\t\t\t\ttext-overflow: ellipsis;\r\n\t\t\t\t\tvertical-align:bottom;\r\n\r\n\t\t\t\t\t//element to hold title editor\r\n\t\t\t\t\t.tabulator-title-editor{\r\n\t\t\t\t\t\tbox-sizing: border-box;\r\n\t\t\t\t\t\twidth: 100%;\r\n\r\n\t\t\t\t\t\tborder:1px solid #999;\r\n\r\n\t\t\t\t\t\tpadding:1px;\r\n\r\n\t\t\t\t\t\tbackground: #fff;\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\t.tabulator-header-menu-button + .tabulator-title-editor{\r\n\t\t\t\t\t\twidth:calc(100% - 22px);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\r\n\t\t\t\t//column sorter arrow\r\n\t\t\t\t.tabulator-col-sorter{\r\n\t\t\t\t\tdisplay: flex;\r\n\t\t\t\t\talign-items: center;\r\n\r\n\t\t\t\t\tposition: absolute;\r\n\t\t\t\t\ttop:0;\r\n\t\t\t\t\tbottom:0;\r\n\t\t\t\t\tright:4px;\r\n\r\n\t\t\t\t\t.tabulator-arrow{\r\n\t\t\t\t\t\twidth: 0;\r\n\t\t\t\t\t\theight: 0;\r\n\t\t\t\t\t\tborder-left: 6px solid transparent;\r\n\t\t\t\t\t\tborder-right: 6px solid transparent;\r\n\t\t\t\t\t\tborder-bottom: 6px solid $sortArrowInactive;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\t//complex header column group\r\n\t\t\t&.tabulator-col-group{\r\n\r\n\t\t\t\t//gelement to hold sub columns in column group\r\n\t\t\t\t.tabulator-col-group-cols{\r\n\t\t\t\t\tposition:relative;\r\n\t\t\t\t\tdisplay: flex;\r\n\r\n\t\t\t\t\tborder-top:1px solid $headerBorderColor;\r\n\t\t\t\t\toverflow: hidden;\r\n\r\n\t\t\t\t\tmargin-right:-1px;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\t//hide left resize handle on first column\r\n\t\t\t&:first-child{\r\n\t\t\t\t.tabulator-col-resize-handle.prev{\r\n\t\t\t\t\tdisplay: none;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\t//header filter containing element\r\n\t\t\t.tabulator-header-filter{\r\n\t\t\t\tposition: relative;\r\n\t\t\t\tbox-sizing: border-box;\r\n\t\t\t\tmargin-top:2px;\r\n\t\t\t\twidth:100%;\r\n\t\t\t\ttext-align: center;\r\n\r\n\t\t\t\t//styling adjustment for inbuilt editors\r\n\t\t\t\ttextarea{\r\n\t\t\t\t\theight:auto !important;\r\n\t\t\t\t}\r\n\r\n\t\t\t\tsvg{\r\n\t\t\t\t\tmargin-top: 3px;\r\n\t\t\t\t}\r\n\r\n\t\t\t\tinput{\r\n\t\t\t\t\t&::-ms-clear {\r\n\t\t\t\t\t\twidth : 0;\r\n\t\t\t\t\t\theight: 0;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\t//styling child elements for sortable columns\r\n\t\t\t&.tabulator-sortable{\r\n\t\t\t\t.tabulator-col-title{\r\n\t\t\t\t\tpadding-right:25px;\r\n\t\t\t\t}\r\n\r\n\t\t\t\t&:hover{\r\n\t\t\t\t\tcursor:pointer;\r\n\t\t\t\t\tbackground-color:darken($headerBackgroundColor, 10%);\r\n\t\t\t\t}\r\n\r\n\t\t\t\t&[aria-sort=\"none\"]{\r\n\t\t\t\t\t.tabulator-col-content .tabulator-col-sorter{\r\n\t\t\t\t\t\tcolor: $sortArrowInactive;\r\n\r\n\t\t\t\t\t\t.tabulator-arrow{\r\n\t\t\t\t\t\t\tborder-top: none;\r\n\t\t\t\t\t\t\tborder-bottom: 6px solid $sortArrowInactive;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\r\n\t\t\t\t&[aria-sort=\"asc\"]{\r\n\t\t\t\t\t.tabulator-col-content .tabulator-col-sorter{\r\n\t\t\t\t\t\tcolor: $sortArrowActive;\r\n\r\n\t\t\t\t\t\t.tabulator-arrow{\r\n\t\t\t\t\t\t\tborder-top: none;\r\n\t\t\t\t\t\t\tborder-bottom: 6px solid $sortArrowActive;\r\n\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\r\n\t\t\t\t&[aria-sort=\"desc\"]{\r\n\t\t\t\t\t.tabulator-col-content .tabulator-col-sorter{\r\n\t\t\t\t\t\tcolor: $sortArrowActive;\r\n\r\n\t\t\t\t\t\t.tabulator-arrow{\r\n\t\t\t\t\t\t\tborder-bottom: none;\r\n\t\t\t\t\t\t\tborder-top: 6px solid $sortArrowActive;\r\n\t\t\t\t\t\t\tcolor: $sortArrowActive;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\t&.tabulator-col-vertical{\r\n\t\t\t\t.tabulator-col-content{\r\n\t\t\t\t\t.tabulator-col-title{\r\n\t\t\t\t\t\twriting-mode: vertical-rl;\r\n\t\t\t\t\t\ttext-orientation: mixed;\r\n\r\n\t\t\t\t\t\tdisplay:flex;\r\n\t\t\t\t\t\talign-items:center;\r\n\t\t\t\t\t\tjustify-content:center;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\r\n\t\t\t\t&.tabulator-col-vertical-flip{\r\n\t\t\t\t\t.tabulator-col-title{\r\n\t\t\t\t\t\ttransform: rotate(180deg);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\r\n\t\t\t\t&.tabulator-sortable{\r\n\t\t\t\t\t.tabulator-col-title{\r\n\t\t\t\t\t\tpadding-right:0;\r\n\t\t\t\t\t\tpadding-top:20px;\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\t&.tabulator-col-vertical-flip{\r\n\t\t\t\t\t\t.tabulator-col-title{\r\n\t\t\t\t\t\t\tpadding-right:0;\r\n\t\t\t\t\t\t\tpadding-bottom:20px;\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\t.tabulator-col-sorter{\r\n\t\t\t\t\t\tjustify-content: center;\r\n\t\t\t\t\t\tleft:0;\r\n\t\t\t\t\t\tright:0;\r\n\t\t\t\t\t\ttop:4px;\r\n\t\t\t\t\t\tbottom:auto;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\t.tabulator-frozen{\r\n\t\t\tdisplay: inline-block;\r\n\t\t\tposition: absolute;\r\n\r\n\t\t\t// background-color: inherit;\r\n\r\n\t\t\tz-index: 10;\r\n\r\n\t\t\t&.tabulator-frozen-left{\r\n\t\t\t\tborder-right:2px solid $rowBorderColor;\r\n\t\t\t}\r\n\r\n\t\t\t&.tabulator-frozen-right{\r\n\t\t\t\tborder-left:2px solid $rowBorderColor;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t.tabulator-calcs-holder{\r\n\t\t\tbox-sizing:border-box;\r\n\t\t\tmin-width:600%;\r\n\r\n\t\t\tbackground:lighten($headerBackgroundColor, 10%) !important;\r\n\r\n\t\t\t.tabulator-row{\r\n\t\t\t\tbackground:lighten($headerBackgroundColor, 10%) !important;\r\n\r\n\t\t\t\t.tabulator-col-resize-handle{\r\n\t\t\t\t\tdisplay: none;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\tborder-top:1px solid $rowBorderColor;\r\n\t\t\t// border-bottom:1px solid $headerBorderColor;\r\n\r\n\t\t\toverflow: hidden;\r\n\t\t}\r\n\r\n\t\t.tabulator-frozen-rows-holder{\r\n\t\t\tmin-width:600%;\r\n\r\n\t\t\t&:empty{\r\n\t\t\t\tdisplay: none;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\t//scrolling element to hold table\r\n\t.tabulator-tableHolder{\r\n\t\tposition:relative;\r\n\t\twidth:100%;\r\n\t\twhite-space: nowrap;\r\n\t\toverflow:auto;\r\n\t\t-webkit-overflow-scrolling: touch;\r\n\r\n\t\t&:focus{\r\n\t\t\toutline: none;\r\n\t\t}\r\n\r\n\t\t//default placeholder element\r\n\t\t.tabulator-placeholder{\r\n\t\t\tbox-sizing:border-box;\r\n\t\t\tdisplay: flex;\r\n\t\t\talign-items:center;\r\n\r\n\t\t\t&[tabulator-render-mode=\"virtual\"]{\r\n\t\t\t\tmin-height:100%;\r\n\t\t\t\tmin-width:100%;\r\n\t\t\t}\r\n\r\n\t\t\twidth:100%;\r\n\r\n\t\t\tspan{\r\n\t\t\t\tdisplay: inline-block;\r\n\r\n\t\t\t\tmargin:0 auto;\r\n\t\t\t\tpadding:10px;\r\n\r\n\t\t\t\tcolor:$headerSeperatorColor;\r\n\t\t\t\tfont-weight: bold;\r\n\t\t\t\tfont-size: 20px;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t//element to hold table rows\r\n\t\t.tabulator-table{\r\n\t\t\tposition:relative;\r\n\t\t\tdisplay:inline-block;\r\n\t\t\tbackground-color:$rowBackgroundColor;\r\n\t\t\twhite-space: nowrap;\r\n\t\t\toverflow:visible;\r\n\t\t\tcolor:$rowTextColor;\r\n\r\n\t\t\t.tabulator-row{\r\n\t\t\t\t&.tabulator-calcs{\r\n\t\t\t\t\tfont-weight: bold;\r\n\t\t\t\t\tbackground:lighten($headerBackgroundColor, 15%) !important;\r\n\t\t\t\t\tcolor:$headerTextColor;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\r\n\t//footer element\r\n\t.tabulator-footer{\r\n\t\tpadding:5px 10px;\r\n\t\tpadding-top:8px;\r\n\t\tborder-top:3px solid $footerSeperatorColor;\r\n\t\tbackground-color: $footerBackgroundColor;\r\n\t\ttext-align:right;\r\n\t\tcolor: $footerTextColor;\r\n\t\tfont-weight:bold;\r\n\t\twhite-space:nowrap;\r\n\t\tuser-select:none;\r\n\r\n\t\t-moz-user-select: none;\r\n\t\t-khtml-user-select: none;\r\n\t\t-webkit-user-select: none;\r\n\t\t-o-user-select: none;\r\n\r\n\t\t.tabulator-calcs-holder{\r\n\t\t\tbox-sizing:border-box;\r\n\t\t\twidth:calc(100% + 20px);\r\n\t\t\tmargin:-8px -10px 8px -10px;\r\n\r\n\t\t\ttext-align: left;\r\n\r\n\t\t\tbackground:lighten($footerBackgroundColor, 10%) !important;\r\n\r\n\t\t\t.tabulator-row{\r\n\t\t\t\tbackground:lighten($footerBackgroundColor, 10%) !important;\r\n\t\t\t\tcolor:$headerTextColor !important;\r\n\r\n\t\t\t\t.tabulator-col-resize-handle{\r\n\t\t\t\t\tdisplay: none;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\t// border-top:1px solid $rowBorderColor;\r\n\t\t\tborder-bottom:1px solid $rowBorderColor;\r\n\r\n\t\t\toverflow: hidden;\r\n\r\n\t\t\t&:only-child{\r\n\t\t\t\tmargin-bottom:-5px;\r\n\t\t\t\tborder-bottom:none;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t//pagination container element\r\n\t\t.tabulator-paginator{\r\n\t\t\tlabel{\r\n\t\t\t\tcolor:#fff;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t//page size select element\r\n\t\t.tabulator-page-size{\r\n\t\t\tdisplay:inline-block;\r\n\r\n\t\t\tmargin:0 5px;\r\n\t\t\tpadding:2px 5px;\r\n\r\n\t\t\tborder:1px solid $footerBorderColor;\r\n\t\t\tborder-radius:3px;\r\n\t\t}\r\n\r\n\t\t//pagination container element\r\n\t\t.tabulator-pages{\r\n\t\t\tmargin:0 7px;\r\n\t\t}\r\n\r\n\t\t//pagination button\r\n\t\t.tabulator-page{\r\n\t\t\tdisplay:inline-block;\r\n\r\n\t\t\tmargin:0 2px;\r\n\t\t\tpadding:2px 5px;\r\n\r\n\t\t\tborder:1px solid $footerBorderColor;\r\n\t\t\tborder-radius:3px;\r\n\r\n\t\t\tbackground:#fff;\r\n\r\n\t\t\tcolor: $footerTextColor;\r\n\t\t\tfont-family:inherit;\r\n\t\t\tfont-weight:inherit;\r\n\t\t\tfont-size:inherit;\r\n\r\n\t\t\t&.active{\r\n\t\t\t\tcolor:$footerActiveColor;\r\n\t\t\t}\r\n\r\n\t\t\t&:disabled{\r\n\t\t\t\topacity:.5;\r\n\t\t\t}\r\n\r\n\t\t\t&:not(.disabled){\r\n\t\t\t\t&:hover{\r\n\t\t\t\t\tcursor:pointer;\r\n\t\t\t\t\tbackground:rgba(0,0,0,.2);\r\n\t\t\t\t\tcolor:#fff;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\t//column resize handles\r\n\t.tabulator-col-resize-handle{\r\n\t\tposition:absolute;\r\n\t\tright:0;\r\n\t\ttop:0;\r\n\t\tbottom:0;\r\n\t\twidth:5px;\r\n\r\n\t\t&.prev{\r\n\t\t\tleft:0;\r\n\t\t\tright:auto;\r\n\t\t}\r\n\r\n\t\t&:hover{\r\n\t\t\tcursor:ew-resize;\r\n\t\t}\r\n\t}\r\n\r\n\r\n\t//holding div that contains loader and covers tabulator element to prevent interaction\r\n\t.tabulator-loader{\r\n\t\tposition:absolute;\r\n\t\tdisplay: flex;\r\n\t\talign-items:center;\r\n\r\n\t\ttop:0;\r\n\t\tleft:0;\r\n\t\tz-index:100;\r\n\r\n\t\theight:100%;\r\n\t\twidth:100%;\r\n\t\tbackground:rgba(0,0,0,.4);\r\n\t\ttext-align:center;\r\n\r\n\t\t//loading message element\r\n\t\t.tabulator-loader-msg{\r\n\t\t\tdisplay:inline-block;\r\n\r\n\t\t\tmargin:0 auto;\r\n\t\t\tpadding:10px 20px;\r\n\r\n\t\t\tborder-radius:10px;\r\n\r\n\t\t\tbackground:#fff;\r\n\t\t\tfont-weight:bold;\r\n\t\t\tfont-size:16px;\r\n\r\n\t\t\t//loading message\r\n\t\t\t&.tabulator-loading{\r\n\t\t\t\tborder:4px solid #333;\r\n\t\t\t\tcolor:#000;\r\n\t\t\t}\r\n\r\n\t\t\t//error message\r\n\t\t\t&.tabulator-error{\r\n\t\t\t\tborder:4px solid #D00;\r\n\t\t\t\tcolor:#590000;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n}\r\n\r\n//row element\r\n.tabulator-row{\r\n\tposition: relative;\r\n\tbox-sizing: border-box;\r\n\tmin-height:$textSize + ($headerMargin * 2);\r\n\tbackground-color: $rowBackgroundColor;\r\n\r\n\r\n\t&.tabulator-row-even{\r\n\t\tbackground-color: $rowAltBackgroundColor;\r\n\t}\r\n\r\n\t&.tabulator-selectable:hover{\r\n\t\tbackground-color:$rowHoverBackground;\r\n\t\tcursor: pointer;\r\n\t}\r\n\r\n\t&.tabulator-selected{\r\n\t\tbackground-color:$rowSelectedBackground;\r\n\t}\r\n\r\n\t&.tabulator-selected:hover{\r\n\t\tbackground-color:$rowSelectedBackgroundHover;\r\n\t\tcursor: pointer;\r\n\t}\r\n\r\n\t&.tabulator-row-moving{\r\n\t\tborder:1px solid #000;\r\n\t\tbackground:#fff;\r\n\t}\r\n\r\n\t&.tabulator-moving{\r\n\t\tposition: absolute;\r\n\r\n\t\tborder-top:1px solid $rowBorderColor;\r\n\t\tborder-bottom:1px solid $rowBorderColor;\r\n\r\n\t\tpointer-events: none !important;\r\n\t\tz-index:15;\r\n\t}\r\n\r\n\t//row resize handles\r\n\t.tabulator-row-resize-handle{\r\n\t\tposition:absolute;\r\n\t\tright:0;\r\n\t\tbottom:0;\r\n\t\tleft:0;\r\n\t\theight:5px;\r\n\r\n\t\t&.prev{\r\n\t\t\ttop:0;\r\n\t\t\tbottom:auto;\r\n\t\t}\r\n\r\n\t\t&:hover{\r\n\t\t\tcursor:ns-resize;\r\n\t\t}\r\n\t}\r\n\r\n\t.tabulator-frozen{\r\n\t\tdisplay: inline-block;\r\n\t\tposition: absolute;\r\n\r\n\t\tbackground-color: inherit;\r\n\r\n\t\tz-index: 10;\r\n\r\n\t\t&.tabulator-frozen-left{\r\n\t\t\tborder-right:2px solid $rowBorderColor;\r\n\t\t}\r\n\r\n\t\t&.tabulator-frozen-right{\r\n\t\t\tborder-left:2px solid $rowBorderColor;\r\n\t\t}\r\n\t}\r\n\r\n\t.tabulator-responsive-collapse{\r\n\t\tbox-sizing:border-box;\r\n\r\n\t\tpadding:5px;\r\n\r\n\t\tborder-top:1px solid $rowBorderColor;\r\n\t\tborder-bottom:1px solid $rowBorderColor;\r\n\r\n\t\t&:empty{\r\n\t\t\tdisplay:none;\r\n\t\t}\r\n\r\n\t\ttable{\r\n\t\t\tfont-size:$textSize;\r\n\r\n\t\t\ttr{\r\n\t\t\t\ttd{\r\n\t\t\t\t\tposition: relative;\r\n\r\n\t\t\t\t\t&:first-of-type{\r\n\t\t\t\t\t\tpadding-right:10px;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\t//cell element\r\n\t.tabulator-cell{\r\n\t\tdisplay:inline-block;\r\n\t\tposition: relative;\r\n\t\tbox-sizing:border-box;\r\n\t\tpadding:6px;\r\n\t\tborder-right:1px solid $rowBorderColor;\r\n\t\tvertical-align:middle;\r\n\t\twhite-space:nowrap;\r\n\t\toverflow:hidden;\r\n\t\ttext-overflow:ellipsis;\r\n\r\n\r\n\t\t&.tabulator-editing{\r\n\t\t\tborder:1px solid $editBoxColor;\r\n\t\t\tpadding: 0;\r\n\r\n\t\t\tinput, select{\r\n\t\t\t\tborder:1px;\r\n\t\t\t\tbackground:transparent;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t&.tabulator-validation-fail{\r\n\t\t\tborder:1px solid $errorColor;\r\n\t\t\tinput, select{\r\n\t\t\t\tborder:1px;\r\n\t\t\t\tbackground:transparent;\r\n\r\n\t\t\t\tcolor: $errorColor;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t//hide left resize handle on first column\r\n\t\t&:first-child{\r\n\t\t\t.tabulator-col-resize-handle.prev{\r\n\t\t\t\tdisplay: none;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t//movable row handle\r\n\t\t&.tabulator-row-handle{\r\n\r\n\t\t\tdisplay: inline-flex;\r\n\t\t\talign-items:center;\r\n\r\n\t\t\t-moz-user-select: none;\r\n\t\t\t-khtml-user-select: none;\r\n\t\t\t-webkit-user-select: none;\r\n\t\t\t-o-user-select: none;\r\n\r\n\t\t\t//handle holder\r\n\t\t\t.tabulator-row-handle-box{\r\n\t\t\t\twidth:80%;\r\n\r\n\t\t\t\t//Hamburger element\r\n\t\t\t\t.tabulator-row-handle-bar{\r\n\t\t\t\t\twidth:100%;\r\n\t\t\t\t\theight:3px;\r\n\t\t\t\t\tmargin-top:2px;\r\n\t\t\t\t\tbackground:$sortArrowActive;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t.tabulator-data-tree-branch{\r\n\t\t\tdisplay:inline-block;\r\n\t\t\tvertical-align:middle;\r\n\r\n\t\t\theight:9px;\r\n\t\t\twidth:7px;\r\n\r\n\t\t\tmargin-top:-9px;\r\n\t\t\tmargin-right:5px;\r\n\r\n\t\t\tborder-bottom-left-radius:1px;\r\n\r\n\t\t\tborder-left:2px solid $rowBorderColor;\r\n\t\t\tborder-bottom:2px solid $rowBorderColor;\r\n\t\t}\r\n\r\n\t\t.tabulator-data-tree-control{\r\n\r\n\t\t\tdisplay:inline-flex;\r\n\t\t\tjustify-content:center;\r\n\t\t\talign-items:center;\r\n\t\t\tvertical-align:middle;\r\n\r\n\t\t\theight:11px;\r\n\t\t\twidth:11px;\r\n\r\n\t\t\tmargin-right:5px;\r\n\r\n\t\t\tborder:1px solid $rowTextColor;\r\n\t\t\tborder-radius:2px;\r\n\t\t\tbackground:rgba(0, 0, 0, .1);\r\n\r\n\t\t\toverflow:hidden;\r\n\r\n\t\t\t&:hover{\r\n\t\t\t\tcursor:pointer;\r\n\t\t\t\tbackground:rgba(0, 0, 0, .2);\r\n\t\t\t}\r\n\r\n\t\t\t.tabulator-data-tree-control-collapse{\r\n\t\t\t\tdisplay:inline-block;\r\n\t\t\t\tposition: relative;\r\n\r\n\t\t\t\theight: 7px;\r\n\t\t\t\twidth: 1px;\r\n\r\n\t\t\t\tbackground: transparent;\r\n\r\n\t\t\t\t&:after {\r\n\t\t\t\t\tposition: absolute;\r\n\t\t\t\t\tcontent: \"\";\r\n\t\t\t\t\tleft: -3px;\r\n\t\t\t\t\ttop: 3px;\r\n\r\n\t\t\t\t\theight: 1px;\r\n\t\t\t\t\twidth: 7px;\r\n\r\n\t\t\t\t\tbackground: $rowTextColor;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\t.tabulator-data-tree-control-expand{\r\n\t\t\t\tdisplay:inline-block;\r\n\t\t\t\tposition: relative;\r\n\r\n\t\t\t\theight: 7px;\r\n\t\t\t\twidth: 1px;\r\n\r\n\t\t\t\tbackground: $rowTextColor;\r\n\r\n\t\t\t\t&:after {\r\n\t\t\t\t\tposition: absolute;\r\n\t\t\t\t\tcontent: \"\";\r\n\t\t\t\t\tleft: -3px;\r\n\t\t\t\t\ttop: 3px;\r\n\r\n\t\t\t\t\theight: 1px;\r\n\t\t\t\t\twidth: 7px;\r\n\r\n\t\t\t\t\tbackground: $rowTextColor;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\t.tabulator-responsive-collapse-toggle{\r\n\t\t\tdisplay: inline-flex;\r\n\t\t\talign-items:center;\r\n\t\t\tjustify-content:center;\r\n\r\n\t\t\t-moz-user-select: none;\r\n\t\t\t-khtml-user-select: none;\r\n\t\t\t-webkit-user-select: none;\r\n\t\t\t-o-user-select: none;\r\n\r\n\t\t\theight:15px;\r\n\t\t\twidth:15px;\r\n\r\n\t\t\tborder-radius:20px;\r\n\t\t\tbackground:#666;\r\n\r\n\t\t\tcolor:$rowBackgroundColor;\r\n\t\t\tfont-weight:bold;\r\n\t\t\tfont-size:1.1em;\r\n\r\n\t\t\t&:hover{\r\n\t\t\t\topacity:.7;\r\n\t\t\t}\r\n\r\n\t\t\t&.open{\r\n\t\t\t\t.tabulator-responsive-collapse-toggle-close{\r\n\t\t\t\t\tdisplay:initial;\r\n\t\t\t\t}\r\n\r\n\t\t\t\t.tabulator-responsive-collapse-toggle-open{\r\n\t\t\t\t\tdisplay:none;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\t.tabulator-responsive-collapse-toggle-close{\r\n\t\t\t\tdisplay:none;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t.tabulator-traffic-light{\r\n\t\t\tdisplay: inline-block;\r\n\t\t\theight:14px;\r\n\t\t\twidth:14px;\r\n\r\n\t\t\tborder-radius:14px;\r\n\t\t}\r\n\t}\r\n\r\n\t//row grouping element\r\n\t&.tabulator-group{\r\n\t\tbox-sizing:border-box;\r\n\t\tborder-right:1px solid $rowBorderColor;\r\n\t\tborder-top:1px solid #000;\r\n\t\tborder-bottom:2px solid $headerSeperatorColor;\r\n\t\tpadding:5px;\r\n\t\tpadding-left:10px;\r\n\t\tbackground:$headerBackgroundColor;\r\n\t\tcolor:$headerTextColor;\r\n\t\tfont-weight:bold;\r\n\r\n\t\tmin-width: 100%;\r\n\r\n\t\t&:hover{\r\n\t\t\tcursor:pointer;\r\n\t\t\tbackground-color:darken($headerBackgroundColor, 10%);\r\n\t\t}\r\n\r\n\t\t&.tabulator-group-visible{\r\n\t\t\t.tabulator-arrow{\r\n\t\t\t\tmargin-right:10px;\r\n\t\t\t\tborder-left: 6px solid transparent;\r\n\t\t\t\tborder-right: 6px solid transparent;\r\n\t\t\t\tborder-top: 6px solid $sortArrowActive;\r\n\t\t\t\tborder-bottom: 0;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t&.tabulator-group-level-1{\r\n\t\t\tpadding-left:30px;\r\n\t\t}\r\n\r\n\t\t&.tabulator-group-level-2{\r\n\t\t\tpadding-left:50px;\r\n\t\t}\r\n\r\n\t\t&.tabulator-group-level-3{\r\n\t\t\tpadding-left:70px;\r\n\t\t}\r\n\r\n\t\t&.tabulator-group-level-4{\r\n\t\t\tpadding-left:90px;\r\n\t\t}\r\n\r\n\t\t&.tabulator-group-level-5{\r\n\t\t\tpadding-left:110px;\r\n\t\t}\r\n\r\n\t\t.tabulator-group-toggle{\r\n\t\t\tdisplay: inline-block;\r\n\t\t}\r\n\r\n\t\t//sorting arrow\r\n\t\t.tabulator-arrow{\r\n\t\t\tdisplay: inline-block;\r\n\t\t\twidth: 0;\r\n\t\t\theight: 0;\r\n\t\t\tmargin-right:16px;\r\n\t\t\tborder-top: 6px solid transparent;\r\n\t\t\tborder-bottom: 6px solid transparent;\r\n\t\t\tborder-right: 0;\r\n\t\t\tborder-left: 6px solid $sortArrowActive;\r\n\t\t\tvertical-align:middle;\r\n\t\t}\r\n\r\n\t\tspan{\r\n\t\t\tmargin-left:10px;\r\n\t\t\tcolor:$headerSeperatorColor;\r\n\t\t}\r\n\t}\r\n\r\n}\r\n\r\n.tabulator-menu{\r\n\tposition: absolute;\r\n\tdisplay:inline-block;\r\n\tbox-sizing:border-box;\r\n\r\n\tbackground:$rowBackgroundColor;\r\n\tborder:1px solid $rowBorderColor;\r\n\tbox-shadow: 0 0 5px 0 rgba(0, 0, 0, .2);\r\n\r\n\tfont-size:$textSize;\r\n\r\n\toverflow-y:auto;\r\n\t-webkit-overflow-scrolling: touch;\r\n\r\n\tz-index: 10000;\r\n\r\n\t.tabulator-menu-item{\r\n\r\n\t\tpadding:5px 10px;\r\n\r\n\t\tuser-select: none;\r\n\r\n\t\t&.tabulator-menu-item-disabled{\r\n\t\t\topacity: .5;\r\n\t\t}\r\n\r\n\t\t&:not(.tabulator-menu-item-disabled):hover{\r\n\t\t\tcursor: pointer;\r\n\t\t\tbackground: $rowAltBackgroundColor;\r\n\t\t}\r\n\t}\r\n\r\n\t.tabulator-menu-separator{\r\n\t\tborder-top:1px solid $rowBorderColor;\r\n\t}\r\n}\r\n\r\n.tabulator-edit-select-list{\r\n\tposition: absolute;\r\n\tdisplay:inline-block;\r\n\tbox-sizing:border-box;\r\n\r\n\tmax-height:200px;\r\n\r\n\tbackground:$rowBackgroundColor;\r\n\tborder:1px solid $rowBorderColor;\r\n\r\n\tfont-size:$textSize;\r\n\r\n\toverflow-y:auto;\r\n\t-webkit-overflow-scrolling: touch;\r\n\r\n\tz-index: 10000;\r\n\r\n\t.tabulator-edit-select-list-item{\r\n\t\tpadding:4px;\r\n\r\n\t\tcolor:$rowTextColor;\r\n\r\n\t\t&.active{\r\n\t\t\tcolor:$rowBackgroundColor;\r\n\t\t\tbackground:$editBoxColor;\r\n\r\n\t\t\t&.focused{\r\n\t\t\t\toutline:1px solid rgba($rowBackgroundColor, .5);\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t&.focused{\r\n\t\t\toutline:1px solid $editBoxColor;\r\n\t\t}\r\n\r\n\r\n\t\t&:hover{\r\n\t\t\tcursor:pointer;\r\n\r\n\t\t\tcolor:$rowBackgroundColor;\r\n\t\t\tbackground:$editBoxColor;\r\n\t\t}\r\n\t}\r\n\r\n\t.tabulator-edit-select-list-notice{\r\n\t\tpadding:4px;\r\n\r\n\t\tcolor:$rowTextColor;\r\n\t\ttext-align: center;\r\n\t}\r\n\r\n\t.tabulator-edit-select-list-group{\r\n\t\tborder-bottom:1px solid $rowBorderColor;\r\n\r\n\t\tpadding:4px;\r\n\t\tpadding-top:6px;\r\n\r\n\t\tcolor:$rowTextColor;\r\n\t\tfont-weight:bold;\r\n\t}\r\n}\r\n\r\n\r\n//RTL Styling\r\n\r\n.tabulator.tabulator-ltr{\r\n\tdirection: ltr;\r\n}\r\n\r\n\r\n.tabulator.tabulator-rtl{\r\n\ttext-align: initial;\r\n\tdirection: rtl;\r\n\r\n\t.tabulator-header {\r\n\t\t.tabulator-col{\r\n\t\t\ttext-align: initial;\r\n\t\t\tborder-left:1px solid $headerBorderColor;\r\n\t\t\tborder-right:initial;\r\n\r\n\t\t\t&.tabulator-col-group{\r\n\t\t\t\t.tabulator-col-group-cols{\r\n\t\t\t\t\tmargin-right:initial;\r\n\t\t\t\t\tmargin-left:-1px;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\t&.tabulator-sortable{\r\n\t\t\t\t.tabulator-col-title{\r\n\t\t\t\t\tpadding-right:0;\r\n\t\t\t\t\tpadding-left:25px;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\t.tabulator-col-content{\r\n\t\t\t\t.tabulator-arrow{\r\n\t\t\t\t\tleft:8px;\r\n\t\t\t\t\tright:initial;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\t.tabulator-row{\r\n\t\t.tabulator-cell{\r\n\t\t\tborder-right:initial;\r\n\t\t\tborder-left:1px solid $rowBorderColor;\r\n\r\n\t\t\t//hide left resize handle on first column\r\n\t\t\t// &:first-child{\r\n\t\t\t// \t.tabulator-col-resize-handle.prev{\r\n\t\t\t// \t\tdisplay: none;\r\n\t\t\t// \t}\r\n\t\t\t// }\r\n\r\n\t\t\t.tabulator-data-tree-branch{\r\n\t\t\t\tmargin-right:initial;\r\n\t\t\t\tmargin-left:5px;\r\n\r\n\t\t\t\tborder-bottom-left-radius:initial;\r\n\t\t\t\tborder-bottom-right-radius:1px;\r\n\r\n\t\t\t\tborder-left:initial;\r\n\t\t\t\tborder-right:2px solid $rowBorderColor;\r\n\t\t\t}\r\n\r\n\t\t\t.tabulator-data-tree-control{\r\n\t\t\t\tmargin-right:initial;\r\n\t\t\t\tmargin-left:5px;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\t//column resize handles\r\n\t.tabulator-col-resize-handle{\r\n\t\tposition:absolute;\r\n\t\tleft:0;\r\n\t\tright:auto;\r\n\r\n\t\t&.prev{\r\n\t\t\tright:0;\r\n\t\t\tleft:auto;\r\n\t\t}\r\n\t}\r\n}\r\n\r\n\r\n// Table print styling\r\n\r\n.tabulator-print-fullscreen{\r\n\tposition: absolute;\r\n\ttop:0;\r\n\tbottom:0;\r\n\tleft:0;\r\n\tright:0;\r\n\r\n\tz-index: 10000;\r\n}\r\n\r\nbody.tabulator-print-fullscreen-hide>*:not(.tabulator-print-fullscreen){\r\n\tdisplay:none !important;\r\n}\r\n\r\n.tabulator-print-table{\r\n\tborder-collapse: collapse;\r\n\r\n\t//row grouping element\r\n\t.tabulator-print-table-group{\r\n\t\tbox-sizing:border-box;\r\n\t\tborder-right:1px solid $rowBorderColor;\r\n\t\tborder-top:1px solid #000;\r\n\t\tborder-bottom:2px solid $headerSeperatorColor;\r\n\t\tpadding:5px;\r\n\t\tpadding-left:10px;\r\n\t\tbackground:$headerBackgroundColor;\r\n\t\tcolor:$headerTextColor;\r\n\t\tfont-weight:bold;\r\n\r\n\t\tmin-width: 100%;\r\n\r\n\t\t&:hover{\r\n\t\t\tcursor:pointer;\r\n\t\t\tbackground-color:darken($headerBackgroundColor, 10%);\r\n\t\t}\r\n\r\n\t\t&.tabulator-group-visible{\r\n\t\t\t.tabulator-arrow{\r\n\t\t\t\tmargin-right:10px;\r\n\t\t\t\tborder-left: 6px solid transparent;\r\n\t\t\t\tborder-right: 6px solid transparent;\r\n\t\t\t\tborder-top: 6px solid $sortArrowActive;\r\n\t\t\t\tborder-bottom: 0;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t&.tabulator-group-level-1{\r\n\t\t\ttd{\r\n\t\t\t\tpadding-left:30px !important;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t&.tabulator-group-level-2{\r\n\t\t\ttd{\r\n\t\t\t\tpadding-left:50px !important;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t&.tabulator-group-level-3{\r\n\t\t\ttd{\r\n\t\t\t\tpadding-left:70px !important;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t&.tabulator-group-level-4{\r\n\t\t\ttd{\r\n\t\t\t\tpadding-left:90px !important;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t&.tabulator-group-level-5{\r\n\t\t\ttd{\r\n\t\t\t\tpadding-left:110px !important;\r\n\t\t\t}\r\n\t\t}\r\n\t\t.tabulator-group-toggle{\r\n\t\t\tdisplay: inline-block;\r\n\t\t}\r\n\r\n\t\t//sorting arrow\r\n\t\t.tabulator-arrow{\r\n\t\t\tdisplay: inline-block;\r\n\t\t\twidth: 0;\r\n\t\t\theight: 0;\r\n\t\t\tmargin-right:16px;\r\n\t\t\tborder-top: 6px solid transparent;\r\n\t\t\tborder-bottom: 6px solid transparent;\r\n\t\t\tborder-right: 0;\r\n\t\t\tborder-left: 6px solid $sortArrowActive;\r\n\t\t\tvertical-align:middle;\r\n\t\t}\r\n\r\n\t\tspan{\r\n\t\t\tmargin-left:10px;\r\n\t\t\tcolor:$headerSeperatorColor;\r\n\t\t}\r\n\t}\r\n\r\n\t.tabulator-data-tree-branch{\r\n\t\tdisplay:inline-block;\r\n\t\tvertical-align:middle;\r\n\r\n\t\theight:9px;\r\n\t\twidth:7px;\r\n\r\n\t\tmargin-top:-9px;\r\n\t\tmargin-right:5px;\r\n\r\n\t\tborder-bottom-left-radius:1px;\r\n\r\n\t\tborder-left:2px solid $rowBorderColor;\r\n\t\tborder-bottom:2px solid $rowBorderColor;\r\n\t}\r\n\r\n\t.tabulator-data-tree-control{\r\n\r\n\t\tdisplay:inline-flex;\r\n\t\tjustify-content:center;\r\n\t\talign-items:center;\r\n\t\tvertical-align:middle;\r\n\r\n\t\theight:11px;\r\n\t\twidth:11px;\r\n\r\n\t\tmargin-right:5px;\r\n\r\n\t\tborder:1px solid $rowTextColor;\r\n\t\tborder-radius:2px;\r\n\t\tbackground:rgba(0, 0, 0, .1);\r\n\r\n\t\toverflow:hidden;\r\n\r\n\t\t&:hover{\r\n\t\t\tcursor:pointer;\r\n\t\t\tbackground:rgba(0, 0, 0, .2);\r\n\t\t}\r\n\r\n\t\t.tabulator-data-tree-control-collapse{\r\n\t\t\tdisplay:inline-block;\r\n\t\t\tposition: relative;\r\n\r\n\t\t\theight: 7px;\r\n\t\t\twidth: 1px;\r\n\r\n\t\t\tbackground: transparent;\r\n\r\n\t\t\t&:after {\r\n\t\t\t\tposition: absolute;\r\n\t\t\t\tcontent: \"\";\r\n\t\t\t\tleft: -3px;\r\n\t\t\t\ttop: 3px;\r\n\r\n\t\t\t\theight: 1px;\r\n\t\t\t\twidth: 7px;\r\n\r\n\t\t\t\tbackground: $rowTextColor;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t.tabulator-data-tree-control-expand{\r\n\t\t\tdisplay:inline-block;\r\n\t\t\tposition: relative;\r\n\r\n\t\t\theight: 7px;\r\n\t\t\twidth: 1px;\r\n\r\n\t\t\tbackground: $rowTextColor;\r\n\r\n\t\t\t&:after {\r\n\t\t\t\tposition: absolute;\r\n\t\t\t\tcontent: \"\";\r\n\t\t\t\tleft: -3px;\r\n\t\t\t\ttop: 3px;\r\n\r\n\t\t\t\theight: 1px;\r\n\t\t\t\twidth: 7px;\r\n\r\n\t\t\t\tbackground: $rowTextColor;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n}\r\n\r\n"]} \ No newline at end of file diff --git a/website/js/vendor/tabulator/js/modules/accessor.js b/website/js/vendor/tabulator/js/modules/accessor.js new file mode 100644 index 0000000..192c6de --- /dev/null +++ b/website/js/vendor/tabulator/js/modules/accessor.js @@ -0,0 +1,93 @@ +var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; + +/* Tabulator v4.8.3 (c) Oliver Folkerd */ + +var Accessor = function Accessor(table) { + this.table = table; //hold Tabulator object + this.allowedTypes = ["", "data", "download", "clipboard", "print", "htmlOutput"]; //list of accessor types +}; + +//initialize column accessor +Accessor.prototype.initializeColumn = function (column) { + var self = this, + match = false, + config = {}; + + this.allowedTypes.forEach(function (type) { + var key = "accessor" + (type.charAt(0).toUpperCase() + type.slice(1)), + accessor; + + if (column.definition[key]) { + accessor = self.lookupAccessor(column.definition[key]); + + if (accessor) { + match = true; + + config[key] = { + accessor: accessor, + params: column.definition[key + "Params"] || {} + }; + } + } + }); + + if (match) { + column.modules.accessor = config; + } +}; + +Accessor.prototype.lookupAccessor = function (value) { + var accessor = false; + + //set column accessor + switch (typeof value === "undefined" ? "undefined" : _typeof(value)) { + case "string": + if (this.accessors[value]) { + accessor = this.accessors[value]; + } else { + console.warn("Accessor Error - No such accessor found, ignoring: ", value); + } + break; + + case "function": + accessor = value; + break; + } + + return accessor; +}; + +//apply accessor to row +Accessor.prototype.transformRow = function (row, type) { + var key = "accessor" + (type.charAt(0).toUpperCase() + type.slice(1)), + rowComponent = row.getComponent(); + + //clone data object with deep copy to isolate internal data from returned result + var data = Tabulator.prototype.helpers.deepClone(row.data || {}); + + this.table.columnManager.traverse(function (column) { + var value, accessor, params, colCompnent; + + if (column.modules.accessor) { + + accessor = column.modules.accessor[key] || column.modules.accessor.accessor || false; + + if (accessor) { + value = column.getFieldValue(data); + + if (value != "undefined") { + colCompnent = column.getComponent(); + params = typeof accessor.params === "function" ? accessor.params(value, data, type, colCompnent, rowComponent) : accessor.params; + column.setFieldValue(data, accessor.accessor(value, data, type, params, colCompnent, rowComponent)); + } + } + } + }); + + return data; +}, + +//default accessors +Accessor.prototype.accessors = {}; + +Tabulator.prototype.registerModule("accessor", Accessor); \ No newline at end of file diff --git a/website/js/vendor/tabulator/js/modules/accessor.min.js b/website/js/vendor/tabulator/js/modules/accessor.min.js new file mode 100644 index 0000000..901db09 --- /dev/null +++ b/website/js/vendor/tabulator/js/modules/accessor.min.js @@ -0,0 +1,2 @@ +/* Tabulator v4.8.3 (c) Oliver Folkerd */ +var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(o){return typeof o}:function(o){return o&&"function"==typeof Symbol&&o.constructor===Symbol&&o!==Symbol.prototype?"symbol":typeof o},Accessor=function(o){this.table=o,this.allowedTypes=["","data","download","clipboard","print","htmlOutput"]};Accessor.prototype.initializeColumn=function(o){var e=this,s=!1,t={};this.allowedTypes.forEach(function(r){var c,a="accessor"+(r.charAt(0).toUpperCase()+r.slice(1));o.definition[a]&&(c=e.lookupAccessor(o.definition[a]))&&(s=!0,t[a]={accessor:c,params:o.definition[a+"Params"]||{}})}),s&&(o.modules.accessor=t)},Accessor.prototype.lookupAccessor=function(o){var e=!1;switch(void 0===o?"undefined":_typeof(o)){case"string":this.accessors[o]?e=this.accessors[o]:console.warn("Accessor Error - No such accessor found, ignoring: ",o);break;case"function":e=o}return e},Accessor.prototype.transformRow=function(o,e){var s="accessor"+(e.charAt(0).toUpperCase()+e.slice(1)),t=o.getComponent(),r=Tabulator.prototype.helpers.deepClone(o.data||{});return this.table.columnManager.traverse(function(o){var c,a,n,i;o.modules.accessor&&(a=o.modules.accessor[s]||o.modules.accessor.accessor||!1)&&"undefined"!=(c=o.getFieldValue(r))&&(i=o.getComponent(),n="function"==typeof a.params?a.params(c,r,e,i,t):a.params,o.setFieldValue(r,a.accessor(c,r,e,n,i,t)))}),r},Accessor.prototype.accessors={},Tabulator.prototype.registerModule("accessor",Accessor); \ No newline at end of file diff --git a/website/js/vendor/tabulator/js/modules/ajax.js b/website/js/vendor/tabulator/js/modules/ajax.js new file mode 100644 index 0000000..d81cbb6 --- /dev/null +++ b/website/js/vendor/tabulator/js/modules/ajax.js @@ -0,0 +1,465 @@ +var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; + +/* Tabulator v4.8.3 (c) Oliver Folkerd */ + +var Ajax = function Ajax(table) { + + this.table = table; //hold Tabulator object + this.config = false; //hold config object for ajax request + this.url = ""; //request URL + this.urlGenerator = false; + this.params = false; //request parameters + + this.loaderElement = this.createLoaderElement(); //loader message div + this.msgElement = this.createMsgElement(); //message element + this.loadingElement = false; + this.errorElement = false; + this.loaderPromise = false; + + this.progressiveLoad = false; + this.loading = false; + + this.requestOrder = 0; //prevent requests comming out of sequence if overridden by another load request +}; + +//initialize setup options +Ajax.prototype.initialize = function () { + var template; + + this.loaderElement.appendChild(this.msgElement); + + if (this.table.options.ajaxLoaderLoading) { + if (typeof this.table.options.ajaxLoaderLoading == "string") { + template = document.createElement('template'); + template.innerHTML = this.table.options.ajaxLoaderLoading.trim(); + this.loadingElement = template.content.firstChild; + } else { + this.loadingElement = this.table.options.ajaxLoaderLoading; + } + } + + this.loaderPromise = this.table.options.ajaxRequestFunc || this.defaultLoaderPromise; + + this.urlGenerator = this.table.options.ajaxURLGenerator || this.defaultURLGenerator; + + if (this.table.options.ajaxLoaderError) { + if (typeof this.table.options.ajaxLoaderError == "string") { + template = document.createElement('template'); + template.innerHTML = this.table.options.ajaxLoaderError.trim(); + this.errorElement = template.content.firstChild; + } else { + this.errorElement = this.table.options.ajaxLoaderError; + } + } + + if (this.table.options.ajaxParams) { + this.setParams(this.table.options.ajaxParams); + } + + if (this.table.options.ajaxConfig) { + this.setConfig(this.table.options.ajaxConfig); + } + + if (this.table.options.ajaxURL) { + this.setUrl(this.table.options.ajaxURL); + } + + if (this.table.options.ajaxProgressiveLoad) { + if (this.table.options.pagination) { + this.progressiveLoad = false; + console.error("Progressive Load Error - Pagination and progressive load cannot be used at the same time"); + } else { + if (this.table.modExists("page")) { + this.progressiveLoad = this.table.options.ajaxProgressiveLoad; + this.table.modules.page.initializeProgressive(this.progressiveLoad); + } else { + console.error("Pagination plugin is required for progressive ajax loading"); + } + } + } +}; + +Ajax.prototype.createLoaderElement = function () { + var el = document.createElement("div"); + el.classList.add("tabulator-loader"); + return el; +}; + +Ajax.prototype.createMsgElement = function () { + var el = document.createElement("div"); + + el.classList.add("tabulator-loader-msg"); + el.setAttribute("role", "alert"); + + return el; +}; + +//set ajax params +Ajax.prototype.setParams = function (params, update) { + if (update) { + this.params = this.params || {}; + + for (var key in params) { + this.params[key] = params[key]; + } + } else { + this.params = params; + } +}; + +Ajax.prototype.getParams = function () { + return this.params || {}; +}; + +//load config object +Ajax.prototype.setConfig = function (config) { + this._loadDefaultConfig(); + + if (typeof config == "string") { + this.config.method = config; + } else { + for (var key in config) { + this.config[key] = config[key]; + } + } +}; + +//create config object from default +Ajax.prototype._loadDefaultConfig = function (force) { + var self = this; + if (!self.config || force) { + + self.config = {}; + + //load base config from defaults + for (var key in self.defaultConfig) { + self.config[key] = self.defaultConfig[key]; + } + } +}; + +//set request url +Ajax.prototype.setUrl = function (url) { + this.url = url; +}; + +//get request url +Ajax.prototype.getUrl = function () { + return this.url; +}; + +//lstandard loading function +Ajax.prototype.loadData = function (inPosition, columnsChanged) { + var self = this; + + if (this.progressiveLoad) { + return this._loadDataProgressive(); + } else { + return this._loadDataStandard(inPosition, columnsChanged); + } +}; + +Ajax.prototype.nextPage = function (diff) { + var margin; + + if (!this.loading) { + + margin = this.table.options.ajaxProgressiveLoadScrollMargin || this.table.rowManager.getElement().clientHeight * 2; + + if (diff < margin) { + this.table.modules.page.nextPage().then(function () {}).catch(function () {}); + } + } +}; + +Ajax.prototype.blockActiveRequest = function () { + this.requestOrder++; +}; + +Ajax.prototype._loadDataProgressive = function () { + this.table.rowManager.setData([]); + return this.table.modules.page.setPage(1); +}; + +Ajax.prototype._loadDataStandard = function (inPosition, columnsChanged) { + var _this = this; + + return new Promise(function (resolve, reject) { + _this.sendRequest(inPosition).then(function (data) { + _this.table.rowManager.setData(data, inPosition, columnsChanged).then(function () { + resolve(); + }).catch(function (e) { + reject(e); + }); + }).catch(function (e) { + reject(e); + }); + }); +}; + +Ajax.prototype.generateParamsList = function (data, prefix) { + var self = this, + output = []; + + prefix = prefix || ""; + + if (Array.isArray(data)) { + data.forEach(function (item, i) { + output = output.concat(self.generateParamsList(item, prefix ? prefix + "[" + i + "]" : i)); + }); + } else if ((typeof data === "undefined" ? "undefined" : _typeof(data)) === "object") { + for (var key in data) { + output = output.concat(self.generateParamsList(data[key], prefix ? prefix + "[" + key + "]" : key)); + } + } else { + output.push({ key: prefix, value: data }); + } + + return output; +}; + +Ajax.prototype.serializeParams = function (params) { + var output = this.generateParamsList(params), + encoded = []; + + output.forEach(function (item) { + encoded.push(encodeURIComponent(item.key) + "=" + encodeURIComponent(item.value)); + }); + + return encoded.join("&"); +}; + +//send ajax request +Ajax.prototype.sendRequest = function (silent) { + var _this2 = this; + + var self = this, + url = self.url, + requestNo, + esc, + query; + + self.requestOrder++; + requestNo = self.requestOrder; + + self._loadDefaultConfig(); + + return new Promise(function (resolve, reject) { + if (self.table.options.ajaxRequesting.call(_this2.table, self.url, self.params) !== false) { + + self.loading = true; + + if (!silent) { + self.showLoader(); + } + + _this2.loaderPromise(url, self.config, self.params).then(function (data) { + if (requestNo === self.requestOrder) { + if (self.table.options.ajaxResponse) { + data = self.table.options.ajaxResponse.call(self.table, self.url, self.params, data); + } + resolve(data); + + self.hideLoader(); + self.loading = false; + } else { + console.warn("Ajax Response Blocked - An active ajax request was blocked by an attempt to change table data while the request was being made"); + } + }).catch(function (error) { + console.error("Ajax Load Error: ", error); + self.table.options.ajaxError.call(self.table, error); + + self.showError(); + + setTimeout(function () { + self.hideLoader(); + }, 3000); + + self.loading = false; + + reject(); + }); + } else { + reject(); + } + }); +}; + +Ajax.prototype.showLoader = function () { + var shouldLoad = typeof this.table.options.ajaxLoader === "function" ? this.table.options.ajaxLoader() : this.table.options.ajaxLoader; + + if (shouldLoad) { + + this.hideLoader(); + + while (this.msgElement.firstChild) { + this.msgElement.removeChild(this.msgElement.firstChild); + }this.msgElement.classList.remove("tabulator-error"); + this.msgElement.classList.add("tabulator-loading"); + + if (this.loadingElement) { + this.msgElement.appendChild(this.loadingElement); + } else { + this.msgElement.innerHTML = this.table.modules.localize.getText("ajax|loading"); + } + + this.table.element.appendChild(this.loaderElement); + } +}; + +Ajax.prototype.showError = function () { + this.hideLoader(); + + while (this.msgElement.firstChild) { + this.msgElement.removeChild(this.msgElement.firstChild); + }this.msgElement.classList.remove("tabulator-loading"); + this.msgElement.classList.add("tabulator-error"); + + if (this.errorElement) { + this.msgElement.appendChild(this.errorElement); + } else { + this.msgElement.innerHTML = this.table.modules.localize.getText("ajax|error"); + } + + this.table.element.appendChild(this.loaderElement); +}; + +Ajax.prototype.hideLoader = function () { + if (this.loaderElement.parentNode) { + this.loaderElement.parentNode.removeChild(this.loaderElement); + } +}; + +//default ajax config object +Ajax.prototype.defaultConfig = { + method: "GET" +}; + +Ajax.prototype.defaultURLGenerator = function (url, config, params) { + + if (url) { + if (params && Object.keys(params).length) { + if (!config.method || config.method.toLowerCase() == "get") { + config.method = "get"; + + url += (url.includes("?") ? "&" : "?") + this.serializeParams(params); + } + } + } + + return url; +}; + +Ajax.prototype.defaultLoaderPromise = function (url, config, params) { + var self = this, + contentType; + + return new Promise(function (resolve, reject) { + + //set url + url = self.urlGenerator(url, config, params); + + //set body content if not GET request + if (config.method.toUpperCase() != "GET") { + contentType = _typeof(self.table.options.ajaxContentType) === "object" ? self.table.options.ajaxContentType : self.contentTypeFormatters[self.table.options.ajaxContentType]; + if (contentType) { + + for (var key in contentType.headers) { + if (!config.headers) { + config.headers = {}; + } + + if (typeof config.headers[key] === "undefined") { + config.headers[key] = contentType.headers[key]; + } + } + + config.body = contentType.body.call(self, url, config, params); + } else { + console.warn("Ajax Error - Invalid ajaxContentType value:", self.table.options.ajaxContentType); + } + } + + if (url) { + + //configure headers + if (typeof config.headers === "undefined") { + config.headers = {}; + } + + if (typeof config.headers.Accept === "undefined") { + config.headers.Accept = "application/json"; + } + + if (typeof config.headers["X-Requested-With"] === "undefined") { + config.headers["X-Requested-With"] = "XMLHttpRequest"; + } + + if (typeof config.mode === "undefined") { + config.mode = "cors"; + } + + if (config.mode == "cors") { + + if (typeof config.headers["Access-Control-Allow-Origin"] === "undefined") { + config.headers["Access-Control-Allow-Origin"] = window.location.origin; + } + + if (typeof config.credentials === "undefined") { + config.credentials = 'same-origin'; + } + } else { + if (typeof config.credentials === "undefined") { + config.credentials = 'include'; + } + } + + //send request + fetch(url, config).then(function (response) { + if (response.ok) { + response.json().then(function (data) { + resolve(data); + }).catch(function (error) { + reject(error); + console.warn("Ajax Load Error - Invalid JSON returned", error); + }); + } else { + console.error("Ajax Load Error - Connection Error: " + response.status, response.statusText); + reject(response); + } + }).catch(function (error) { + console.error("Ajax Load Error - Connection Error: ", error); + reject(error); + }); + } else { + console.warn("Ajax Load Error - No URL Set"); + resolve([]); + } + }); +}; + +Ajax.prototype.contentTypeFormatters = { + "json": { + headers: { + 'Content-Type': 'application/json' + }, + body: function body(url, config, params) { + return JSON.stringify(params); + } + }, + "form": { + headers: {}, + body: function body(url, config, params) { + var output = this.generateParamsList(params), + form = new FormData(); + + output.forEach(function (item) { + form.append(item.key, item.value); + }); + + return form; + } + } +}; + +Tabulator.prototype.registerModule("ajax", Ajax); \ No newline at end of file diff --git a/website/js/vendor/tabulator/js/modules/ajax.min.js b/website/js/vendor/tabulator/js/modules/ajax.min.js new file mode 100644 index 0000000..8a3f0c7 --- /dev/null +++ b/website/js/vendor/tabulator/js/modules/ajax.min.js @@ -0,0 +1,2 @@ +/* Tabulator v4.8.3 (c) Oliver Folkerd */ +var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Ajax=function(e){this.table=e,this.config=!1,this.url="",this.urlGenerator=!1,this.params=!1,this.loaderElement=this.createLoaderElement(),this.msgElement=this.createMsgElement(),this.loadingElement=!1,this.errorElement=!1,this.loaderPromise=!1,this.progressiveLoad=!1,this.loading=!1,this.requestOrder=0};Ajax.prototype.initialize=function(){var e;this.loaderElement.appendChild(this.msgElement),this.table.options.ajaxLoaderLoading&&("string"==typeof this.table.options.ajaxLoaderLoading?(e=document.createElement("template"),e.innerHTML=this.table.options.ajaxLoaderLoading.trim(),this.loadingElement=e.content.firstChild):this.loadingElement=this.table.options.ajaxLoaderLoading),this.loaderPromise=this.table.options.ajaxRequestFunc||this.defaultLoaderPromise,this.urlGenerator=this.table.options.ajaxURLGenerator||this.defaultURLGenerator,this.table.options.ajaxLoaderError&&("string"==typeof this.table.options.ajaxLoaderError?(e=document.createElement("template"),e.innerHTML=this.table.options.ajaxLoaderError.trim(),this.errorElement=e.content.firstChild):this.errorElement=this.table.options.ajaxLoaderError),this.table.options.ajaxParams&&this.setParams(this.table.options.ajaxParams),this.table.options.ajaxConfig&&this.setConfig(this.table.options.ajaxConfig),this.table.options.ajaxURL&&this.setUrl(this.table.options.ajaxURL),this.table.options.ajaxProgressiveLoad&&(this.table.options.pagination?(this.progressiveLoad=!1,console.error("Progressive Load Error - Pagination and progressive load cannot be used at the same time")):this.table.modExists("page")?(this.progressiveLoad=this.table.options.ajaxProgressiveLoad,this.table.modules.page.initializeProgressive(this.progressiveLoad)):console.error("Pagination plugin is required for progressive ajax loading"))},Ajax.prototype.createLoaderElement=function(){var e=document.createElement("div");return e.classList.add("tabulator-loader"),e},Ajax.prototype.createMsgElement=function(){var e=document.createElement("div");return e.classList.add("tabulator-loader-msg"),e.setAttribute("role","alert"),e},Ajax.prototype.setParams=function(e,t){if(t){this.params=this.params||{};for(var o in e)this.params[o]=e[o]}else this.params=e},Ajax.prototype.getParams=function(){return this.params||{}},Ajax.prototype.setConfig=function(e){if(this._loadDefaultConfig(),"string"==typeof e)this.config.method=e;else for(var t in e)this.config[t]=e[t]},Ajax.prototype._loadDefaultConfig=function(e){var t=this;if(!t.config||e){t.config={};for(var o in t.defaultConfig)t.config[o]=t.defaultConfig[o]}},Ajax.prototype.setUrl=function(e){this.url=e},Ajax.prototype.getUrl=function(){return this.url},Ajax.prototype.loadData=function(e,t){return this.progressiveLoad?this._loadDataProgressive():this._loadDataStandard(e,t)},Ajax.prototype.nextPage=function(e){var t;this.loading||(t=this.table.options.ajaxProgressiveLoadScrollMargin||2*this.table.rowManager.getElement().clientHeight,e output || output === null) { + output = value; + } + }); + + return output !== null ? precision !== false ? output.toFixed(precision) : output : ""; + }, + "min": function min(values, data, calcParams) { + var output = null, + precision = typeof calcParams.precision !== "undefined" ? calcParams.precision : false; + + values.forEach(function (value) { + + value = Number(value); + + if (value < output || output === null) { + output = value; + } + }); + + return output !== null ? precision !== false ? output.toFixed(precision) : output : ""; + }, + "sum": function sum(values, data, calcParams) { + var output = 0, + precision = typeof calcParams.precision !== "undefined" ? calcParams.precision : false; + + if (values.length) { + values.forEach(function (value) { + value = Number(value); + + output += !isNaN(value) ? Number(value) : 0; + }); + } + + return precision !== false ? output.toFixed(precision) : output; + }, + "concat": function concat(values, data, calcParams) { + var output = 0; + + if (values.length) { + output = values.reduce(function (sum, value) { + return String(sum) + String(value); + }); + } + + return output; + }, + "count": function count(values, data, calcParams) { + var output = 0; + + if (values.length) { + values.forEach(function (value) { + if (value) { + output++; + } + }); + } + + return output; + } +}; + +Tabulator.prototype.registerModule("columnCalcs", ColumnCalcs); \ No newline at end of file diff --git a/website/js/vendor/tabulator/js/modules/calculation_colums.min.js b/website/js/vendor/tabulator/js/modules/calculation_colums.min.js new file mode 100644 index 0000000..9b6f56b --- /dev/null +++ b/website/js/vendor/tabulator/js/modules/calculation_colums.min.js @@ -0,0 +1,2 @@ +/* Tabulator v4.8.3 (c) Oliver Folkerd */ +var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},CalcComponent=function(t){this._row=t};CalcComponent.prototype.getData=function(t){return this._row.getData(t)},CalcComponent.prototype.getElement=function(){return this._row.getElement()},CalcComponent.prototype.getTable=function(){return this._row.table},CalcComponent.prototype.getCells=function(){var t=[];return this._row.getCells().forEach(function(o){t.push(o.getComponent())}),t},CalcComponent.prototype.getCell=function(t){var o=this._row.getCell(t);return!!o&&o.getComponent()},CalcComponent.prototype._getSelf=function(){return this._row};var ColumnCalcs=function(t){this.table=t,this.topCalcs=[],this.botCalcs=[],this.genColumn=!1,this.topElement=this.createElement(),this.botElement=this.createElement(),this.topRow=!1,this.botRow=!1,this.topInitialized=!1,this.botInitialized=!1,this.initialize()};ColumnCalcs.prototype.createElement=function(){var t=document.createElement("div");return t.classList.add("tabulator-calcs-holder"),t},ColumnCalcs.prototype.initialize=function(){this.genColumn=new Column({field:"value"},this)},ColumnCalcs.prototype.registerColumnField=function(){},ColumnCalcs.prototype.initializeColumn=function(t){var o=t.definition,e={topCalcParams:o.topCalcParams||{},botCalcParams:o.bottomCalcParams||{}};if(o.topCalc){switch(_typeof(o.topCalc)){case"string":this.calculations[o.topCalc]?e.topCalc=this.calculations[o.topCalc]:console.warn("Column Calc Error - No such calculation found, ignoring: ",o.topCalc);break;case"function":e.topCalc=o.topCalc}e.topCalc&&(t.modules.columnCalcs=e,this.topCalcs.push(t),"group"!=this.table.options.columnCalcs&&this.initializeTopRow())}if(o.bottomCalc){switch(_typeof(o.bottomCalc)){case"string":this.calculations[o.bottomCalc]?e.botCalc=this.calculations[o.bottomCalc]:console.warn("Column Calc Error - No such calculation found, ignoring: ",o.bottomCalc);break;case"function":e.botCalc=o.bottomCalc}e.botCalc&&(t.modules.columnCalcs=e,this.botCalcs.push(t),"group"!=this.table.options.columnCalcs&&this.initializeBottomRow())}},ColumnCalcs.prototype.removeCalcs=function(){var t=!1;this.topInitialized&&(this.topInitialized=!1,this.topElement.parentNode.removeChild(this.topElement),t=!0),this.botInitialized&&(this.botInitialized=!1,this.table.footerManager.remove(this.botElement),t=!0),t&&this.table.rowManager.adjustTableSize()},ColumnCalcs.prototype.initializeTopRow=function(){this.topInitialized||(this.table.columnManager.getElement().insertBefore(this.topElement,this.table.columnManager.headersElement.nextSibling),this.topInitialized=!0)},ColumnCalcs.prototype.initializeBottomRow=function(){this.botInitialized||(this.table.footerManager.prepend(this.botElement),this.botInitialized=!0)},ColumnCalcs.prototype.scrollHorizontal=function(t){this.table.columnManager.getElement().scrollWidth,this.table.element.clientWidth;this.botInitialized&&this.botRow&&(this.botRow.getElement().style.marginLeft=-t+"px")},ColumnCalcs.prototype.recalc=function(t){var o;if(this.topInitialized||this.botInitialized){if(this.rowsToData(t),this.topInitialized){for(this.topRow&&this.topRow.deleteCells(),o=this.generateRow("top",this.rowsToData(t)),this.topRow=o;this.topElement.firstChild;)this.topElement.removeChild(this.topElement.firstChild);this.topElement.appendChild(o.getElement()),o.initialize(!0)}if(this.botInitialized){for(this.botRow&&this.botRow.deleteCells(),o=this.generateRow("bottom",this.rowsToData(t)),this.botRow=o;this.botElement.firstChild;)this.botElement.removeChild(this.botElement.firstChild);this.botElement.appendChild(o.getElement()),o.initialize(!0)}this.table.rowManager.adjustTableSize(),this.table.modExists("frozenColumns")&&this.table.modules.frozenColumns.layout()}},ColumnCalcs.prototype.recalcRowGroup=function(t){this.recalcGroup(this.table.modules.groupRows.getRowGroup(t))},ColumnCalcs.prototype.recalcAll=function(){var t=this;if((this.topCalcs.length||this.botCalcs.length)&&("group"!==this.table.options.columnCalcs&&this.recalc(this.table.rowManager.activeRows),this.table.options.groupBy&&"table"!==this.table.options.columnCalcs)){table.modules.groupRows.getChildGroups().forEach(function(o){t.recalcGroup(o)})}},ColumnCalcs.prototype.recalcGroup=function(t){var o,e;t&&t.calcs&&(t.calcs.bottom&&(o=this.rowsToData(t.rows),e=this.generateRowData("bottom",o),t.calcs.bottom.updateData(e),t.calcs.bottom.reinitialize()),t.calcs.top&&(o=this.rowsToData(t.rows),e=this.generateRowData("top",o),t.calcs.top.updateData(e),t.calcs.top.reinitialize()))},ColumnCalcs.prototype.generateTopRow=function(t){return this.generateRow("top",this.rowsToData(t))},ColumnCalcs.prototype.generateBottomRow=function(t){return this.generateRow("bottom",this.rowsToData(t))},ColumnCalcs.prototype.rowsToData=function(t){var o=this,e=[];return t.forEach(function(t){if(e.push(t.getData()),o.table.options.dataTree&&o.table.options.dataTreeChildColumnCalcs&&t.modules.dataTree.open){var n=o.rowsToData(o.table.modules.dataTree.getFilteredTreeChildren(t));e=e.concat(n)}}),e},ColumnCalcs.prototype.generateRow=function(t,o){var e,n=this,l=this.generateRowData(t,o);return n.table.modExists("mutator")&&n.table.modules.mutator.disable(),e=new Row(l,this,"calc"),n.table.modExists("mutator")&&n.table.modules.mutator.enable(),e.getElement().classList.add("tabulator-calcs","tabulator-calcs-"+t),e.component=!1,e.getComponent=function(){return this.component||(this.component=new CalcComponent(this)),this.component},e.generateCells=function(){var o=[];n.table.columnManager.columnsByIndex.forEach(function(l){n.genColumn.setField(l.getField()),n.genColumn.hozAlign=l.hozAlign,l.definition[t+"CalcFormatter"]&&n.table.modExists("format")?n.genColumn.modules.format={formatter:n.table.modules.format.getFormatter(l.definition[t+"CalcFormatter"]),params:l.definition[t+"CalcFormatterParams"]||{}}:n.genColumn.modules.format={formatter:n.table.modules.format.getFormatter("plaintext"),params:{}},n.genColumn.definition.cssClass=l.definition.cssClass;var i=new Cell(n.genColumn,e);i.getElement(),i.column=l,i.setWidth(),l.cells.push(i),o.push(i),l.visible||i.hide()}),this.cells=o},e},ColumnCalcs.prototype.generateRowData=function(t,o){var e,n,l={},i="top"==t?this.topCalcs:this.botCalcs,a="top"==t?"topCalc":"botCalc";return i.forEach(function(t){var i=[];t.modules.columnCalcs&&t.modules.columnCalcs[a]&&(o.forEach(function(o){i.push(t.getFieldValue(o))}),n=a+"Params",e="function"==typeof t.modules.columnCalcs[n]?t.modules.columnCalcs[n](i,o):t.modules.columnCalcs[n],t.setFieldValue(l,t.modules.columnCalcs[a](i,o,e)))}),l},ColumnCalcs.prototype.hasTopCalcs=function(){return!!this.topCalcs.length},ColumnCalcs.prototype.hasBottomCalcs=function(){return!!this.botCalcs.length},ColumnCalcs.prototype.redraw=function(){this.topRow&&this.topRow.normalizeHeight(!0),this.botRow&&this.botRow.normalizeHeight(!0)},ColumnCalcs.prototype.getResults=function(){var t,o=this,e={};return this.table.options.groupBy&&this.table.modExists("groupRows")?(t=this.table.modules.groupRows.getGroups(!0),t.forEach(function(t){e[t.getKey()]=o.getGroupResults(t)})):e={top:this.topRow?this.topRow.getData():{},bottom:this.botRow?this.botRow.getData():{}},e},ColumnCalcs.prototype.getGroupResults=function(t){var o=this,e=t._getSelf(),n=t.getSubGroups(),l={};return n.forEach(function(t){l[t.getKey()]=o.getGroupResults(t)}),{top:e.calcs.top?e.calcs.top.getData():{},bottom:e.calcs.bottom?e.calcs.bottom.getData():{},groups:l}},ColumnCalcs.prototype.calculations={avg:function(t,o,e){var n=0,l=void 0!==e.precision?e.precision:2;return t.length&&(n=t.reduce(function(t,o){return Number(t)+Number(o)}),n/=t.length,n=!1!==l?n.toFixed(l):n),parseFloat(n).toString()},max:function(t,o,e){var n=null,l=void 0!==e.precision&&e.precision;return t.forEach(function(t){((t=Number(t))>n||null===n)&&(n=t)}),null!==n?!1!==l?n.toFixed(l):n:""},min:function(t,o,e){var n=null,l=void 0!==e.precision&&e.precision;return t.forEach(function(t){((t=Number(t))"),a.dataTreeExpandElement?"string"==typeof a.dataTreeExpandElement?(e=document.createElement("div"),e.innerHTML=a.dataTreeExpandElement,this.expandEl=e.firstChild):this.expandEl=a.dataTreeExpandElement:(this.expandEl=document.createElement("div"),this.expandEl.classList.add("tabulator-data-tree-control"),this.expandEl.tabIndex=0,this.expandEl.innerHTML="
"),_typeof(a.dataTreeStartExpanded)){case"boolean":this.startOpen=function(e,t){return a.dataTreeStartExpanded};break;case"function":this.startOpen=a.dataTreeStartExpanded;break;default:this.startOpen=function(e,t){return a.dataTreeStartExpanded[t]}}},DataTree.prototype.initializeRow=function(e){var t=e.getData()[this.field],a=Array.isArray(t),n=a||!a&&"object"===(void 0===t?"undefined":_typeof(t))&&null!==t;!n&&e.modules.dataTree&&e.modules.dataTree.branchEl&&e.modules.dataTree.branchEl.parentNode.removeChild(e.modules.dataTree.branchEl),!n&&e.modules.dataTree&&e.modules.dataTree.controlEl&&e.modules.dataTree.controlEl.parentNode.removeChild(e.modules.dataTree.controlEl),e.modules.dataTree={index:e.modules.dataTree?e.modules.dataTree.index:0,open:!!n&&(e.modules.dataTree?e.modules.dataTree.open:this.startOpen(e.getComponent(),0)),controlEl:!(!e.modules.dataTree||!n)&&e.modules.dataTree.controlEl,branchEl:!(!e.modules.dataTree||!n)&&e.modules.dataTree.branchEl,parent:!!e.modules.dataTree&&e.modules.dataTree.parent,children:n}},DataTree.prototype.layoutRow=function(e){var t=this.elementField?e.getCell(this.elementField):e.getCells()[0],a=t.getElement(),n=e.modules.dataTree;n.branchEl&&(n.branchEl.parentNode&&n.branchEl.parentNode.removeChild(n.branchEl),n.branchEl=!1),n.controlEl&&(n.controlEl.parentNode&&n.controlEl.parentNode.removeChild(n.controlEl),n.controlEl=!1),this.generateControlElement(e,a),e.element.classList.add("tabulator-tree-level-"+n.index),n.index&&(this.branchEl?(n.branchEl=this.branchEl.cloneNode(!0),a.insertBefore(n.branchEl,a.firstChild),this.table.rtl?n.branchEl.style.marginRight=(n.branchEl.offsetWidth+n.branchEl.style.marginLeft)*(n.index-1)+n.index*this.indent+"px":n.branchEl.style.marginLeft=(n.branchEl.offsetWidth+n.branchEl.style.marginRight)*(n.index-1)+n.index*this.indent+"px"):this.table.rtl?a.style.paddingRight=parseInt(window.getComputedStyle(a,null).getPropertyValue("padding-right"))+n.index*this.indent+"px":a.style.paddingLeft=parseInt(window.getComputedStyle(a,null).getPropertyValue("padding-left"))+n.index*this.indent+"px")},DataTree.prototype.generateControlElement=function(e,t){var a=this,n=e.modules.dataTree,t=t||e.getCells()[0].getElement(),r=n.controlEl;!1!==n.children&&(n.open?(n.controlEl=this.collapseEl.cloneNode(!0),n.controlEl.addEventListener("click",function(t){t.stopPropagation(),a.collapseRow(e)})):(n.controlEl=this.expandEl.cloneNode(!0),n.controlEl.addEventListener("click",function(t){t.stopPropagation(),a.expandRow(e)})),n.controlEl.addEventListener("mousedown",function(e){e.stopPropagation()}),r&&r.parentNode===t?r.parentNode.replaceChild(n.controlEl,r):t.insertBefore(n.controlEl,t.firstChild))},DataTree.prototype.setDisplayIndex=function(e){this.displayIndex=e},DataTree.prototype.getDisplayIndex=function(){return this.displayIndex},DataTree.prototype.getRows=function(e){var t=this,a=[];return e.forEach(function(e,n){var r,l;a.push(e),e instanceof Row&&(r=e.modules.dataTree.children,r.index||!1===r.children||(l=t.getChildren(e),l.forEach(function(e){a.push(e)})))}),a},DataTree.prototype.getChildren=function(e){var t=this,a=e.modules.dataTree,n=[],r=[];return!1!==a.children&&a.open&&(Array.isArray(a.children)||(a.children=this.generateChildren(e)),n=this.table.modExists("filter")&&this.table.options.dataTreeFilter?this.table.modules.filter.filter(a.children):a.children,this.table.modExists("sort")&&this.table.options.dataTreeSort&&this.table.modules.sort.sort(n),n.forEach(function(e){r.push(e),t.getChildren(e).forEach(function(e){r.push(e)})})),r},DataTree.prototype.generateChildren=function(e){var t=this,a=[],n=e.getData()[this.field];return Array.isArray(n)||(n=[n]),n.forEach(function(n){var r=new Row(n||{},t.table.rowManager);r.modules.dataTree.index=e.modules.dataTree.index+1,r.modules.dataTree.parent=e,r.modules.dataTree.children&&(r.modules.dataTree.open=t.startOpen(r.getComponent(),r.modules.dataTree.index)),a.push(r)}),a},DataTree.prototype.expandRow=function(e,t){var a=e.modules.dataTree;!1!==a.children&&(a.open=!0,e.reinitialize(),this.table.rowManager.refreshActiveData("tree",!1,!0),this.table.options.dataTreeRowExpanded(e.getComponent(),e.modules.dataTree.index))},DataTree.prototype.collapseRow=function(e){var t=e.modules.dataTree;!1!==t.children&&(t.open=!1,e.reinitialize(),this.table.rowManager.refreshActiveData("tree",!1,!0),this.table.options.dataTreeRowCollapsed(e.getComponent(),e.modules.dataTree.index))},DataTree.prototype.toggleRow=function(e){var t=e.modules.dataTree;!1!==t.children&&(t.open?this.collapseRow(e):this.expandRow(e))},DataTree.prototype.getTreeParent=function(e){return!!e.modules.dataTree.parent&&e.modules.dataTree.parent.getComponent()},DataTree.prototype.getFilteredTreeChildren=function(e){var t,a=e.modules.dataTree,n=[];return a.children&&(Array.isArray(a.children)||(a.children=this.generateChildren(e)),t=this.table.modExists("filter")&&this.table.options.dataTreeFilter?this.table.modules.filter.filter(a.children):a.children,t.forEach(function(e){e instanceof Row&&n.push(e)})),n},DataTree.prototype.rowDelete=function(e){var t,a=e.modules.dataTree.parent;a&&(t=this.findChildIndex(e,a),!1!==t&&a.data[this.field].splice(t,1),a.data[this.field].length||delete a.data[this.field],this.initializeRow(a),this.layoutRow(a)),this.table.rowManager.refreshActiveData("tree",!1,!0)},DataTree.prototype.addTreeChildRow=function(e,t,a,n){var r=!1;"string"==typeof t&&(t=JSON.parse(t)),Array.isArray(e.data[this.field])||(e.data[this.field]=[],e.modules.dataTree.open=this.startOpen(e.getComponent(),e.modules.dataTree.index)),void 0!==n&&!1!==(r=this.findChildIndex(n,e))&&e.data[this.field].splice(a?r:r+1,0,t),!1===r&&(a?e.data[this.field].unshift(t):e.data[this.field].push(t)),this.initializeRow(e),this.layoutRow(e),this.table.rowManager.refreshActiveData("tree",!1,!0)},DataTree.prototype.findChildIndex=function(e,t){var a=this,n=!1;return"object"==(void 0===e?"undefined":_typeof(e))?e instanceof Row?n=e.data:e instanceof RowComponent?n=e._getSelf().data:"undefined"!=typeof HTMLElement&&e instanceof HTMLElement&&t.modules.dataTree&&(n=t.modules.dataTree.children.find(function(t){return t instanceof Row&&t.element===e}))&&(n=n.data):n=void 0!==e&&null!==e&&t.data[this.field].find(function(t){return t.data[a.table.options.index]==e}),n&&(Array.isArray(t.data[this.field])&&(n=t.data[this.field].indexOf(n)),-1==n&&(n=!1)),n},DataTree.prototype.getTreeChildren=function(e,t,a){var n=this,r=e.modules.dataTree,l=[];return r.children&&(Array.isArray(r.children)||(r.children=this.generateChildren(e)),r.children.forEach(function(e){e instanceof Row&&(l.push(t?e.getComponent():e),a&&(l=l.concat(n.getTreeChildren(e,t,a))))})),l},DataTree.prototype.checkForRestyle=function(e){e.row.cells.indexOf(e)||e.row.reinitialize()},DataTree.prototype.getChildField=function(){return this.field},DataTree.prototype.redrawNeeded=function(e){return!!this.field&&void 0!==e[this.field]||!!this.elementField&&void 0!==e[this.elementField]},Tabulator.prototype.registerModule("dataTree",DataTree); \ No newline at end of file diff --git a/website/js/vendor/tabulator/js/modules/download.js b/website/js/vendor/tabulator/js/modules/download.js new file mode 100644 index 0000000..ddaec41 --- /dev/null +++ b/website/js/vendor/tabulator/js/modules/download.js @@ -0,0 +1,433 @@ +var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; + +/* Tabulator v4.8.3 (c) Oliver Folkerd */ + +var Download = function Download(table) { + this.table = table; //hold Tabulator object +}; + +//trigger file download +Download.prototype.download = function (type, filename, options, range, interceptCallback) { + var self = this, + downloadFunc = false; + + function buildLink(data, mime) { + if (interceptCallback) { + if (interceptCallback === true) { + self.triggerDownload(data, mime, type, filename, true); + } else { + interceptCallback(data); + } + } else { + self.triggerDownload(data, mime, type, filename); + } + } + + if (typeof type == "function") { + downloadFunc = type; + } else { + if (self.downloaders[type]) { + downloadFunc = self.downloaders[type]; + } else { + console.warn("Download Error - No such download type found: ", type); + } + } + + if (downloadFunc) { + var list = this.generateExportList(range); + + downloadFunc.call(this.table, list, options || {}, buildLink); + } +}; + +Download.prototype.generateExportList = function (range) { + var list = this.table.modules.export.generateExportList(this.table.options.downloadConfig, false, range || this.table.options.downloadRowRange, "download"); + + //assign group header formatter + var groupHeader = this.table.options.groupHeaderDownload; + + if (groupHeader && !Array.isArray(groupHeader)) { + groupHeader = [groupHeader]; + } + + list.forEach(function (row) { + var group; + + if (row.type === "group") { + group = row.columns[0]; + + if (groupHeader && groupHeader[row.indent]) { + group.value = groupHeader[row.indent](group.value, row.component._group.getRowCount(), row.component._group.getData(), row.component); + } + } + }); + + return list; +}; + +Download.prototype.triggerDownload = function (data, mime, type, filename, newTab) { + var element = document.createElement('a'), + blob = new Blob([data], { type: mime }), + filename = filename || "Tabulator." + (typeof type === "function" ? "txt" : type); + + blob = this.table.options.downloadReady.call(this.table, data, blob); + + if (blob) { + + if (newTab) { + window.open(window.URL.createObjectURL(blob)); + } else { + if (navigator.msSaveOrOpenBlob) { + navigator.msSaveOrOpenBlob(blob, filename); + } else { + element.setAttribute('href', window.URL.createObjectURL(blob)); + + //set file title + element.setAttribute('download', filename); + + //trigger download + element.style.display = 'none'; + document.body.appendChild(element); + element.click(); + + //remove temporary link element + document.body.removeChild(element); + } + } + + if (this.table.options.downloadComplete) { + this.table.options.downloadComplete(); + } + } +}; + +Download.prototype.commsReceived = function (table, action, data) { + switch (action) { + case "intercept": + this.download(data.type, "", data.options, data.active, data.intercept); + break; + } +}; + +//downloaders +Download.prototype.downloaders = { + csv: function csv(list, options, setFileContents) { + var delimiter = options && options.delimiter ? options.delimiter : ",", + fileContents = [], + headers = []; + + list.forEach(function (row) { + var item = []; + + switch (row.type) { + case "group": + console.warn("Download Warning - CSV downloader cannot process row groups"); + break; + + case "calc": + console.warn("Download Warning - CSV downloader cannot process column calculations"); + break; + + case "header": + row.columns.forEach(function (col, i) { + if (col && col.depth === 1) { + headers[i] = typeof col.value == "undefined" || col.value === null ? "" : '"' + String(col.value).split('"').join('""') + '"'; + } + }); + break; + + case "row": + row.columns.forEach(function (col) { + + if (col) { + + switch (_typeof(col.value)) { + case "object": + col.value = JSON.stringify(col.value); + break; + + case "undefined": + case "null": + col.value = ""; + break; + } + + item.push('"' + String(col.value).split('"').join('""') + '"'); + } + }); + + fileContents.push(item.join(delimiter)); + break; + } + }); + + if (headers.length) { + fileContents.unshift(headers.join(delimiter)); + } + + fileContents = fileContents.join("\n"); + + if (options.bom) { + fileContents = "\uFEFF" + fileContents; + } + + setFileContents(fileContents, "text/csv"); + }, + + json: function json(list, options, setFileContents) { + var fileContents = []; + + list.forEach(function (row) { + var item = {}; + + switch (row.type) { + case "header": + break; + + case "group": + console.warn("Download Warning - JSON downloader cannot process row groups"); + break; + + case "calc": + console.warn("Download Warning - JSON downloader cannot process column calculations"); + break; + + case "row": + row.columns.forEach(function (col) { + if (col) { + item[col.component.getField()] = col.value; + } + }); + + fileContents.push(item); + break; + } + }); + + fileContents = JSON.stringify(fileContents, null, '\t'); + + setFileContents(fileContents, "application/json"); + }, + + pdf: function pdf(list, options, setFileContents) { + var header = [], + body = [], + autoTableParams = {}, + rowGroupStyles = options.rowGroupStyles || { + fontStyle: "bold", + fontSize: 12, + cellPadding: 6, + fillColor: 220 + }, + rowCalcStyles = options.rowCalcStyles || { + fontStyle: "bold", + fontSize: 10, + cellPadding: 4, + fillColor: 232 + }, + jsPDFParams = options.jsPDF || {}, + title = options && options.title ? options.title : ""; + + if (!jsPDFParams.orientation) { + jsPDFParams.orientation = options.orientation || "landscape"; + } + + if (!jsPDFParams.unit) { + jsPDFParams.unit = "pt"; + } + + //parse row list + list.forEach(function (row) { + var item = {}; + + switch (row.type) { + case "header": + header.push(parseRow(row)); + break; + + case "group": + body.push(parseRow(row, rowGroupStyles)); + break; + + case "calc": + body.push(parseRow(row, rowCalcStyles)); + break; + + case "row": + body.push(parseRow(row)); + break; + } + }); + + function parseRow(row, styles) { + var rowData = []; + + row.columns.forEach(function (col) { + var cell; + + if (col) { + switch (_typeof(col.value)) { + case "object": + col.value = JSON.stringify(col.value); + break; + + case "undefined": + case "null": + col.value = ""; + break; + } + + cell = { + content: col.value, + colSpan: col.width, + rowSpan: col.height + }; + + if (styles) { + cell.styles = styles; + } + + rowData.push(cell); + } else { + rowData.push(""); + } + }); + + return rowData; + } + + //configure PDF + var doc = new jsPDF(jsPDFParams); //set document to landscape, better for most tables + + if (options && options.autoTable) { + if (typeof options.autoTable === "function") { + autoTableParams = options.autoTable(doc) || {}; + } else { + autoTableParams = options.autoTable; + } + } + + if (title) { + autoTableParams.addPageContent = function (data) { + doc.text(title, 40, 30); + }; + } + + autoTableParams.head = header; + autoTableParams.body = body; + + doc.autoTable(autoTableParams); + + if (options && options.documentProcessing) { + options.documentProcessing(doc); + } + + setFileContents(doc.output("arraybuffer"), "application/pdf"); + }, + + xlsx: function xlsx(list, options, setFileContents) { + var self = this, + sheetName = options.sheetName || "Sheet1", + workbook = XLSX.utils.book_new(), + output; + + workbook.SheetNames = []; + workbook.Sheets = {}; + + function generateSheet() { + var rows = [], + merges = [], + worksheet = {}, + range = { s: { c: 0, r: 0 }, e: { c: list[0] ? list[0].columns.reduce(function (a, b) { + return a + (b && b.width ? b.width : 1); + }, 0) : 0, r: list.length } }; + + //parse row list + list.forEach(function (row, i) { + var rowData = []; + + row.columns.forEach(function (col, j) { + + if (col) { + rowData.push(!(col.value instanceof Date) && _typeof(col.value) === "object" ? JSON.stringify(col.value) : col.value); + + if (col.width > 1 || col.height > -1) { + merges.push({ s: { r: i, c: j }, e: { r: i + col.height - 1, c: j + col.width - 1 } }); + } + } else { + rowData.push(""); + } + }); + + rows.push(rowData); + }); + + //convert rows to worksheet + XLSX.utils.sheet_add_aoa(worksheet, rows); + + worksheet['!ref'] = XLSX.utils.encode_range(range); + + if (merges.length) { + worksheet["!merges"] = merges; + } + + return worksheet; + } + + if (options.sheetOnly) { + setFileContents(generateSheet()); + return; + } + + if (options.sheets) { + for (var sheet in options.sheets) { + + if (options.sheets[sheet] === true) { + workbook.SheetNames.push(sheet); + workbook.Sheets[sheet] = generateSheet(); + } else { + + workbook.SheetNames.push(sheet); + + this.modules.comms.send(options.sheets[sheet], "download", "intercept", { + type: "xlsx", + options: { sheetOnly: true }, + active: self.active, + intercept: function intercept(data) { + workbook.Sheets[sheet] = data; + } + }); + } + } + } else { + workbook.SheetNames.push(sheetName); + workbook.Sheets[sheetName] = generateSheet(); + } + + if (options.documentProcessing) { + workbook = options.documentProcessing(workbook); + } + + //convert workbook to binary array + function s2ab(s) { + var buf = new ArrayBuffer(s.length); + var view = new Uint8Array(buf); + for (var i = 0; i != s.length; ++i) { + view[i] = s.charCodeAt(i) & 0xFF; + }return buf; + } + + output = XLSX.write(workbook, { bookType: 'xlsx', bookSST: true, type: 'binary' }); + + setFileContents(s2ab(output), "application/octet-stream"); + }, + + html: function html(list, options, setFileContents) { + if (this.modExists("export", true)) { + setFileContents(this.modules.export.genereateHTMLTable(list), "text/html"); + } + } + +}; + +Tabulator.prototype.registerModule("download", Download); \ No newline at end of file diff --git a/website/js/vendor/tabulator/js/modules/download.min.js b/website/js/vendor/tabulator/js/modules/download.min.js new file mode 100644 index 0000000..45bceb3 --- /dev/null +++ b/website/js/vendor/tabulator/js/modules/download.min.js @@ -0,0 +1,2 @@ +/* Tabulator v4.8.3 (c) Oliver Folkerd */ +var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Download=function(e){this.table=e};Download.prototype.download=function(e,o,t,n,a){function r(t,n){a?!0===a?i.triggerDownload(t,n,e,o,!0):a(t):i.triggerDownload(t,n,e,o)}var i=this,l=!1;if("function"==typeof e?l=e:i.downloaders[e]?l=i.downloaders[e]:console.warn("Download Error - No such download type found: ",e),l){var s=this.generateExportList(n);l.call(this.table,s,t||{},r)}},Download.prototype.generateExportList=function(e){var o=this.table.modules.export.generateExportList(this.table.options.downloadConfig,!1,e||this.table.options.downloadRowRange,"download"),t=this.table.options.groupHeaderDownload;return t&&!Array.isArray(t)&&(t=[t]),o.forEach(function(e){var o;"group"===e.type&&(o=e.columns[0],t&&t[e.indent]&&(o.value=t[e.indent](o.value,e.component._group.getRowCount(),e.component._group.getData(),e.component)))}),o},Download.prototype.triggerDownload=function(e,o,t,n,a){var r=document.createElement("a"),i=new Blob([e],{type:o}),n=n||"Tabulator."+("function"==typeof t?"txt":t);(i=this.table.options.downloadReady.call(this.table,e,i))&&(a?window.open(window.URL.createObjectURL(i)):navigator.msSaveOrOpenBlob?navigator.msSaveOrOpenBlob(i,n):(r.setAttribute("href",window.URL.createObjectURL(i)),r.setAttribute("download",n),r.style.display="none",document.body.appendChild(r),r.click(),document.body.removeChild(r)),this.table.options.downloadComplete&&this.table.options.downloadComplete())},Download.prototype.commsReceived=function(e,o,t){switch(o){case"intercept":this.download(t.type,"",t.options,t.active,t.intercept)}},Download.prototype.downloaders={csv:function(e,o,t){var n=o&&o.delimiter?o.delimiter:",",a=[],r=[];e.forEach(function(e){var o=[];switch(e.type){case"group":console.warn("Download Warning - CSV downloader cannot process row groups");break;case"calc":console.warn("Download Warning - CSV downloader cannot process column calculations");break;case"header":e.columns.forEach(function(e,o){e&&1===e.depth&&(r[o]=void 0===e.value||null===e.value?"":'"'+String(e.value).split('"').join('""')+'"')});break;case"row":e.columns.forEach(function(e){if(e){switch(_typeof(e.value)){case"object":e.value=JSON.stringify(e.value);break;case"undefined":case"null":e.value=""}o.push('"'+String(e.value).split('"').join('""')+'"')}}),a.push(o.join(n))}}),r.length&&a.unshift(r.join(n)),a=a.join("\n"),o.bom&&(a="\ufeff"+a),t(a,"text/csv")},json:function(e,o,t){var n=[];e.forEach(function(e){var o={};switch(e.type){case"header":break;case"group":console.warn("Download Warning - JSON downloader cannot process row groups");break;case"calc":console.warn("Download Warning - JSON downloader cannot process column calculations");break;case"row":e.columns.forEach(function(e){e&&(o[e.component.getField()]=e.value)}),n.push(o)}}),n=JSON.stringify(n,null,"\t"),t(n,"application/json")},pdf:function(e,o,t){function n(e,o){var t=[];return e.columns.forEach(function(e){var n;if(e){switch(_typeof(e.value)){case"object":e.value=JSON.stringify(e.value);break;case"undefined":case"null":e.value=""}n={content:e.value,colSpan:e.width,rowSpan:e.height},o&&(n.styles=o),t.push(n)}else t.push("")}),t}var a=[],r=[],i={},l=o.rowGroupStyles||{fontStyle:"bold",fontSize:12,cellPadding:6,fillColor:220},s=o.rowCalcStyles||{fontStyle:"bold",fontSize:10,cellPadding:4,fillColor:232},c=o.jsPDF||{},u=o&&o.title?o.title:"";c.orientation||(c.orientation=o.orientation||"landscape"),c.unit||(c.unit="pt"),e.forEach(function(e){switch(e.type){case"header":a.push(n(e));break;case"group":r.push(n(e,l));break;case"calc":r.push(n(e,s));break;case"row":r.push(n(e))}});var d=new jsPDF(c);o&&o.autoTable&&(i="function"==typeof o.autoTable?o.autoTable(d)||{}:o.autoTable),u&&(i.addPageContent=function(e){d.text(u,40,30)}),i.head=a,i.body=r,d.autoTable(i),o&&o.documentProcessing&&o.documentProcessing(d),t(d.output("arraybuffer"),"application/pdf")},xlsx:function(e,o,t){function n(){var o=[],t=[],n={},a={s:{c:0,r:0},e:{c:e[0]?e[0].columns.reduce(function(e,o){return e+(o&&o.width?o.width:1)},0):0,r:e.length}};return e.forEach(function(e,n){var a=[];e.columns.forEach(function(e,o){e?(a.push(e.value instanceof Date||"object"!==_typeof(e.value)?e.value:JSON.stringify(e.value)),(e.width>1||e.height>-1)&&t.push({s:{r:n,c:o},e:{r:n+e.height-1,c:o+e.width-1}})):a.push("")}),o.push(a)}),XLSX.utils.sheet_add_aoa(n,o),n["!ref"]=XLSX.utils.encode_range(a),t.length&&(n["!merges"]=t),n}var a,r=this,i=o.sheetName||"Sheet1",l=XLSX.utils.book_new();if(l.SheetNames=[],l.Sheets={},o.sheetOnly)return void t(n());if(o.sheets)for(var s in o.sheets)!0===o.sheets[s]?(l.SheetNames.push(s),l.Sheets[s]=n()):(l.SheetNames.push(s),this.modules.comms.send(o.sheets[s],"download","intercept",{type:"xlsx",options:{sheetOnly:!0},active:r.active,intercept:function(e){l.Sheets[s]=e}}));else l.SheetNames.push(i),l.Sheets[i]=n();o.documentProcessing&&(l=o.documentProcessing(l)),a=XLSX.write(l,{bookType:"xlsx",bookSST:!0,type:"binary"}),t(function(e){for(var o=new ArrayBuffer(e.length),t=new Uint8Array(o),n=0;n!=e.length;++n)t[n]=255&e.charCodeAt(n);return o}(a),"application/octet-stream")},html:function(e,o,t){this.modExists("export",!0)&&t(this.modules.export.genereateHTMLTable(e),"text/html")}},Tabulator.prototype.registerModule("download",Download); \ No newline at end of file diff --git a/website/js/vendor/tabulator/js/modules/edit.js b/website/js/vendor/tabulator/js/modules/edit.js new file mode 100644 index 0000000..16240be --- /dev/null +++ b/website/js/vendor/tabulator/js/modules/edit.js @@ -0,0 +1,2230 @@ +var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; + +/* Tabulator v4.8.3 (c) Oliver Folkerd */ + +var Edit = function Edit(table) { + this.table = table; //hold Tabulator object + this.currentCell = false; //hold currently editing cell + this.mouseClick = false; //hold mousedown state to prevent click binding being overriden by editor opening + this.recursionBlock = false; //prevent focus recursion + this.invalidEdit = false; + this.editedCells = []; +}; + +//initialize column editor +Edit.prototype.initializeColumn = function (column) { + var self = this, + config = { + editor: false, + blocked: false, + check: column.definition.editable, + params: column.definition.editorParams || {} + }; + + //set column editor + switch (_typeof(column.definition.editor)) { + case "string": + + if (column.definition.editor === "tick") { + column.definition.editor = "tickCross"; + console.warn("DEPRECATION WARNING - the tick editor has been deprecated, please use the tickCross editor"); + } + + if (self.editors[column.definition.editor]) { + config.editor = self.editors[column.definition.editor]; + } else { + console.warn("Editor Error - No such editor found: ", column.definition.editor); + } + break; + + case "function": + config.editor = column.definition.editor; + break; + + case "boolean": + + if (column.definition.editor === true) { + + if (typeof column.definition.formatter !== "function") { + + if (column.definition.formatter === "tick") { + column.definition.formatter = "tickCross"; + console.warn("DEPRECATION WARNING - the tick editor has been deprecated, please use the tickCross editor"); + } + + if (self.editors[column.definition.formatter]) { + config.editor = self.editors[column.definition.formatter]; + } else { + config.editor = self.editors["input"]; + } + } else { + console.warn("Editor Error - Cannot auto lookup editor for a custom formatter: ", column.definition.formatter); + } + } + break; + } + + if (config.editor) { + column.modules.edit = config; + } +}; + +Edit.prototype.getCurrentCell = function () { + return this.currentCell ? this.currentCell.getComponent() : false; +}; + +Edit.prototype.clearEditor = function (cancel) { + var cell = this.currentCell, + cellEl; + + this.invalidEdit = false; + + if (cell) { + this.currentCell = false; + + cellEl = cell.getElement(); + + if (cancel) { + cell.validate(); + } else { + cellEl.classList.remove("tabulator-validation-fail"); + } + + cellEl.classList.remove("tabulator-editing"); + while (cellEl.firstChild) { + cellEl.removeChild(cellEl.firstChild); + }cell.row.getElement().classList.remove("tabulator-row-editing"); + } +}; + +Edit.prototype.cancelEdit = function () { + + if (this.currentCell) { + var cell = this.currentCell; + var component = this.currentCell.getComponent(); + + this.clearEditor(true); + cell.setValueActual(cell.getValue()); + cell.cellRendered(); + + if (cell.column.definition.editor == "textarea" || cell.column.definition.variableHeight) { + cell.row.normalizeHeight(true); + } + + if (cell.column.cellEvents.cellEditCancelled) { + cell.column.cellEvents.cellEditCancelled.call(this.table, component); + } + + this.table.options.cellEditCancelled.call(this.table, component); + } +}; + +//return a formatted value for a cell +Edit.prototype.bindEditor = function (cell) { + var self = this, + element = cell.getElement(); + + element.setAttribute("tabindex", 0); + + element.addEventListener("click", function (e) { + if (!element.classList.contains("tabulator-editing")) { + element.focus({ preventScroll: true }); + } + }); + + element.addEventListener("mousedown", function (e) { + if (e.button === 2) { + e.preventDefault(); + } else { + self.mouseClick = true; + } + }); + + element.addEventListener("focus", function (e) { + if (!self.recursionBlock) { + self.edit(cell, e, false); + } + }); +}; + +Edit.prototype.focusCellNoEvent = function (cell, block) { + this.recursionBlock = true; + if (!(block && this.table.browser === "ie")) { + cell.getElement().focus({ preventScroll: true }); + } + this.recursionBlock = false; +}; + +Edit.prototype.editCell = function (cell, forceEdit) { + this.focusCellNoEvent(cell); + this.edit(cell, false, forceEdit); +}; + +Edit.prototype.focusScrollAdjust = function (cell) { + if (this.table.rowManager.getRenderMode() == "virtual") { + var topEdge = this.table.rowManager.element.scrollTop, + bottomEdge = this.table.rowManager.element.clientHeight + this.table.rowManager.element.scrollTop, + rowEl = cell.row.getElement(), + offset = rowEl.offsetTop; + + if (rowEl.offsetTop < topEdge) { + this.table.rowManager.element.scrollTop -= topEdge - rowEl.offsetTop; + } else { + if (rowEl.offsetTop + rowEl.offsetHeight > bottomEdge) { + this.table.rowManager.element.scrollTop += rowEl.offsetTop + rowEl.offsetHeight - bottomEdge; + } + } + + var leftEdge = this.table.rowManager.element.scrollLeft, + rightEdge = this.table.rowManager.element.clientWidth + this.table.rowManager.element.scrollLeft, + cellEl = cell.getElement(), + offset = cellEl.offsetLeft; + + if (this.table.modExists("frozenColumns")) { + leftEdge += parseInt(this.table.modules.frozenColumns.leftMargin); + rightEdge -= parseInt(this.table.modules.frozenColumns.rightMargin); + } + + if (cellEl.offsetLeft < leftEdge) { + this.table.rowManager.element.scrollLeft -= leftEdge - cellEl.offsetLeft; + } else { + if (cellEl.offsetLeft + cellEl.offsetWidth > rightEdge) { + this.table.rowManager.element.scrollLeft += cellEl.offsetLeft + cellEl.offsetWidth - rightEdge; + } + } + } +}; + +Edit.prototype.edit = function (cell, e, forceEdit) { + var self = this, + allowEdit = true, + rendered = function rendered() {}, + element = cell.getElement(), + cellEditor, + component, + params; + + //prevent editing if another cell is refusing to leave focus (eg. validation fail) + if (this.currentCell) { + if (!this.invalidEdit) { + this.cancelEdit(); + } + return; + } + + //handle successfull value change + function success(value) { + if (self.currentCell === cell) { + var valid = true; + + if (cell.column.modules.validate && self.table.modExists("validate") && self.table.options.validationMode != "manual") { + valid = self.table.modules.validate.validate(cell.column.modules.validate, cell, value); + } + + if (valid === true || self.table.options.validationMode === "highlight") { + self.clearEditor(); + + if (!cell.modules.edit) { + cell.modules.edit = {}; + } + + cell.modules.edit.edited = true; + + if (self.editedCells.indexOf(cell) == -1) { + self.editedCells.push(cell); + } + + cell.setValue(value, true); + + if (self.table.options.dataTree && self.table.modExists("dataTree")) { + self.table.modules.dataTree.checkForRestyle(cell); + } + + if (valid !== true) { + element.classList.add("tabulator-validation-fail"); + self.table.options.validationFailed.call(self.table, cell.getComponent(), value, valid); + return false; + } + + return true; + } else { + self.invalidEdit = true; + element.classList.add("tabulator-validation-fail"); + self.focusCellNoEvent(cell, true); + rendered(); + self.table.options.validationFailed.call(self.table, cell.getComponent(), value, valid); + + return false; + } + } else { + // console.warn("Edit Success Error - cannot call success on a cell that is no longer being edited"); + } + } + + //handle aborted edit + function cancel() { + if (self.currentCell === cell) { + self.cancelEdit(); + + if (self.table.options.dataTree && self.table.modExists("dataTree")) { + self.table.modules.dataTree.checkForRestyle(cell); + } + } else { + // console.warn("Edit Success Error - cannot call cancel on a cell that is no longer being edited"); + } + } + + function onRendered(callback) { + rendered = callback; + } + + if (!cell.column.modules.edit.blocked) { + if (e) { + e.stopPropagation(); + } + + switch (_typeof(cell.column.modules.edit.check)) { + case "function": + allowEdit = cell.column.modules.edit.check(cell.getComponent()); + break; + + case "boolean": + allowEdit = cell.column.modules.edit.check; + break; + } + + if (allowEdit || forceEdit) { + + self.cancelEdit(); + + self.currentCell = cell; + + this.focusScrollAdjust(cell); + + component = cell.getComponent(); + + if (this.mouseClick) { + this.mouseClick = false; + + if (cell.column.cellEvents.cellClick) { + cell.column.cellEvents.cellClick.call(this.table, e, component); + } + } + + if (cell.column.cellEvents.cellEditing) { + cell.column.cellEvents.cellEditing.call(this.table, component); + } + + self.table.options.cellEditing.call(this.table, component); + + params = typeof cell.column.modules.edit.params === "function" ? cell.column.modules.edit.params(component) : cell.column.modules.edit.params; + + cellEditor = cell.column.modules.edit.editor.call(self, component, onRendered, success, cancel, params); + + //if editor returned, add to DOM, if false, abort edit + if (cellEditor !== false) { + + if (cellEditor instanceof Node) { + element.classList.add("tabulator-editing"); + cell.row.getElement().classList.add("tabulator-row-editing"); + while (element.firstChild) { + element.removeChild(element.firstChild); + }element.appendChild(cellEditor); + + //trigger onRendered Callback + rendered(); + + //prevent editing from triggering rowClick event + var children = element.children; + + for (var i = 0; i < children.length; i++) { + children[i].addEventListener("click", function (e) { + e.stopPropagation(); + }); + } + } else { + console.warn("Edit Error - Editor should return an instance of Node, the editor returned:", cellEditor); + element.blur(); + return false; + } + } else { + element.blur(); + return false; + } + + return true; + } else { + this.mouseClick = false; + element.blur(); + return false; + } + } else { + this.mouseClick = false; + element.blur(); + return false; + } +}; + +Edit.prototype.maskInput = function (el, options) { + var mask = options.mask, + maskLetter = typeof options.maskLetterChar !== "undefined" ? options.maskLetterChar : "A", + maskNumber = typeof options.maskNumberChar !== "undefined" ? options.maskNumberChar : "9", + maskWildcard = typeof options.maskWildcardChar !== "undefined" ? options.maskWildcardChar : "*", + success = false; + + function fillSymbols(index) { + var symbol = mask[index]; + if (typeof symbol !== "undefined" && symbol !== maskWildcard && symbol !== maskLetter && symbol !== maskNumber) { + el.value = el.value + "" + symbol; + fillSymbols(index + 1); + } + } + + el.addEventListener("keydown", function (e) { + var index = el.value.length, + char = e.key; + + if (e.keyCode > 46) { + if (index >= mask.length) { + e.preventDefault(); + e.stopPropagation(); + success = false; + return false; + } else { + switch (mask[index]) { + case maskLetter: + if (char.toUpperCase() == char.toLowerCase()) { + e.preventDefault(); + e.stopPropagation(); + success = false; + return false; + } + break; + + case maskNumber: + if (isNaN(char)) { + e.preventDefault(); + e.stopPropagation(); + success = false; + return false; + } + break; + + case maskWildcard: + break; + + default: + if (char !== mask[index]) { + e.preventDefault(); + e.stopPropagation(); + success = false; + return false; + } + } + } + + success = true; + } + + return; + }); + + el.addEventListener("keyup", function (e) { + if (e.keyCode > 46) { + if (options.maskAutoFill) { + fillSymbols(el.value.length); + } + } + }); + + if (!el.placeholder) { + el.placeholder = mask; + } + + if (options.maskAutoFill) { + fillSymbols(el.value.length); + } +}; + +Edit.prototype.getEditedCells = function () { + var output = []; + + this.editedCells.forEach(function (cell) { + output.push(cell.getComponent()); + }); + + return output; +}; + +Edit.prototype.clearEdited = function (cell) { + var editIndex; + + if (cell.modules.edit && cell.modules.edit.edited) { + cell.modules.edit.edited = false; + + if (cell.modules.validate) { + cell.modules.validate.invalid = false; + } + } + + editIndex = this.editedCells.indexOf(cell); + + if (editIndex > -1) { + this.editedCells.splice(editIndex, 1); + } +}; + +//default data editors +Edit.prototype.editors = { + + //input element + input: function input(cell, onRendered, success, cancel, editorParams) { + + //create and style input + var cellValue = cell.getValue(), + input = document.createElement("input"); + + input.setAttribute("type", editorParams.search ? "search" : "text"); + + input.style.padding = "4px"; + input.style.width = "100%"; + input.style.boxSizing = "border-box"; + + if (editorParams.elementAttributes && _typeof(editorParams.elementAttributes) == "object") { + for (var key in editorParams.elementAttributes) { + if (key.charAt(0) == "+") { + key = key.slice(1); + input.setAttribute(key, input.getAttribute(key) + editorParams.elementAttributes["+" + key]); + } else { + input.setAttribute(key, editorParams.elementAttributes[key]); + } + } + } + + input.value = typeof cellValue !== "undefined" ? cellValue : ""; + + onRendered(function () { + input.focus({ preventScroll: true }); + input.style.height = "100%"; + }); + + function onChange(e) { + if ((cellValue === null || typeof cellValue === "undefined") && input.value !== "" || input.value !== cellValue) { + if (success(input.value)) { + cellValue = input.value; //persist value if successfully validated incase editor is used as header filter + } + } else { + cancel(); + } + } + + //submit new value on blur or change + input.addEventListener("change", onChange); + input.addEventListener("blur", onChange); + + //submit new value on enter + input.addEventListener("keydown", function (e) { + switch (e.keyCode) { + // case 9: + case 13: + onChange(e); + break; + + case 27: + cancel(); + break; + + case 35: + case 36: + e.stopPropagation(); + break; + } + }); + + if (editorParams.mask) { + this.table.modules.edit.maskInput(input, editorParams); + } + + return input; + }, + + //resizable text area element + textarea: function textarea(cell, onRendered, success, cancel, editorParams) { + var self = this, + cellValue = cell.getValue(), + vertNav = editorParams.verticalNavigation || "hybrid", + value = String(cellValue !== null && typeof cellValue !== "undefined" ? cellValue : ""), + count = (value.match(/(?:\r\n|\r|\n)/g) || []).length + 1, + input = document.createElement("textarea"), + scrollHeight = 0; + + //create and style input + input.style.display = "block"; + input.style.padding = "2px"; + input.style.height = "100%"; + input.style.width = "100%"; + input.style.boxSizing = "border-box"; + input.style.whiteSpace = "pre-wrap"; + input.style.resize = "none"; + + if (editorParams.elementAttributes && _typeof(editorParams.elementAttributes) == "object") { + for (var key in editorParams.elementAttributes) { + if (key.charAt(0) == "+") { + key = key.slice(1); + input.setAttribute(key, input.getAttribute(key) + editorParams.elementAttributes["+" + key]); + } else { + input.setAttribute(key, editorParams.elementAttributes[key]); + } + } + } + + input.value = value; + + onRendered(function () { + input.focus({ preventScroll: true }); + input.style.height = "100%"; + + input.scrollHeight; + input.style.height = input.scrollHeight + "px"; + cell.getRow().normalizeHeight(); + }); + + function onChange(e) { + + if ((cellValue === null || typeof cellValue === "undefined") && input.value !== "" || input.value !== cellValue) { + + if (success(input.value)) { + cellValue = input.value; //persist value if successfully validated incase editor is used as header filter + } + + setTimeout(function () { + cell.getRow().normalizeHeight(); + }, 300); + } else { + cancel(); + } + } + + //submit new value on blur or change + input.addEventListener("change", onChange); + input.addEventListener("blur", onChange); + + input.addEventListener("keyup", function () { + + input.style.height = ""; + + var heightNow = input.scrollHeight; + + input.style.height = heightNow + "px"; + + if (heightNow != scrollHeight) { + scrollHeight = heightNow; + cell.getRow().normalizeHeight(); + } + }); + + input.addEventListener("keydown", function (e) { + + switch (e.keyCode) { + case 27: + cancel(); + break; + + case 38: + //up arrow + if (vertNav == "editor" || vertNav == "hybrid" && input.selectionStart) { + e.stopImmediatePropagation(); + e.stopPropagation(); + } + + break; + + case 40: + //down arrow + if (vertNav == "editor" || vertNav == "hybrid" && input.selectionStart !== input.value.length) { + e.stopImmediatePropagation(); + e.stopPropagation(); + } + break; + + case 35: + case 36: + e.stopPropagation(); + break; + } + }); + + if (editorParams.mask) { + this.table.modules.edit.maskInput(input, editorParams); + } + + return input; + }, + + //input element with type of number + number: function number(cell, onRendered, success, cancel, editorParams) { + + var cellValue = cell.getValue(), + vertNav = editorParams.verticalNavigation || "editor", + input = document.createElement("input"); + + input.setAttribute("type", "number"); + + if (typeof editorParams.max != "undefined") { + input.setAttribute("max", editorParams.max); + } + + if (typeof editorParams.min != "undefined") { + input.setAttribute("min", editorParams.min); + } + + if (typeof editorParams.step != "undefined") { + input.setAttribute("step", editorParams.step); + } + + //create and style input + input.style.padding = "4px"; + input.style.width = "100%"; + input.style.boxSizing = "border-box"; + + if (editorParams.elementAttributes && _typeof(editorParams.elementAttributes) == "object") { + for (var key in editorParams.elementAttributes) { + if (key.charAt(0) == "+") { + key = key.slice(1); + input.setAttribute(key, input.getAttribute(key) + editorParams.elementAttributes["+" + key]); + } else { + input.setAttribute(key, editorParams.elementAttributes[key]); + } + } + } + + input.value = cellValue; + + var blurFunc = function blurFunc(e) { + onChange(); + }; + + onRendered(function () { + //submit new value on blur + input.removeEventListener("blur", blurFunc); + + input.focus({ preventScroll: true }); + input.style.height = "100%"; + + //submit new value on blur + input.addEventListener("blur", blurFunc); + }); + + function onChange() { + var value = input.value; + + if (!isNaN(value) && value !== "") { + value = Number(value); + } + + if (value !== cellValue) { + if (success(value)) { + cellValue = value; //persist value if successfully validated incase editor is used as header filter + } + } else { + cancel(); + } + } + + //submit new value on enter + input.addEventListener("keydown", function (e) { + switch (e.keyCode) { + case 13: + // case 9: + onChange(); + break; + + case 27: + cancel(); + break; + + case 38: //up arrow + case 40: + //down arrow + if (vertNav == "editor") { + e.stopImmediatePropagation(); + e.stopPropagation(); + } + break; + + case 35: + case 36: + e.stopPropagation(); + break; + } + }); + + if (editorParams.mask) { + this.table.modules.edit.maskInput(input, editorParams); + } + + return input; + }, + + //input element with type of number + range: function range(cell, onRendered, success, cancel, editorParams) { + + var cellValue = cell.getValue(), + input = document.createElement("input"); + + input.setAttribute("type", "range"); + + if (typeof editorParams.max != "undefined") { + input.setAttribute("max", editorParams.max); + } + + if (typeof editorParams.min != "undefined") { + input.setAttribute("min", editorParams.min); + } + + if (typeof editorParams.step != "undefined") { + input.setAttribute("step", editorParams.step); + } + + //create and style input + input.style.padding = "4px"; + input.style.width = "100%"; + input.style.boxSizing = "border-box"; + + if (editorParams.elementAttributes && _typeof(editorParams.elementAttributes) == "object") { + for (var key in editorParams.elementAttributes) { + if (key.charAt(0) == "+") { + key = key.slice(1); + input.setAttribute(key, input.getAttribute(key) + editorParams.elementAttributes["+" + key]); + } else { + input.setAttribute(key, editorParams.elementAttributes[key]); + } + } + } + + input.value = cellValue; + + onRendered(function () { + input.focus({ preventScroll: true }); + input.style.height = "100%"; + }); + + function onChange() { + var value = input.value; + + if (!isNaN(value) && value !== "") { + value = Number(value); + } + + if (value != cellValue) { + if (success(value)) { + cellValue = value; //persist value if successfully validated incase editor is used as header filter + } + } else { + cancel(); + } + } + + //submit new value on blur + input.addEventListener("blur", function (e) { + onChange(); + }); + + //submit new value on enter + input.addEventListener("keydown", function (e) { + switch (e.keyCode) { + case 13: + // case 9: + onChange(); + break; + + case 27: + cancel(); + break; + } + }); + + return input; + }, + + //select + select: function select(cell, onRendered, success, cancel, editorParams) { + var _this = this; + + var self = this, + cellEl = cell.getElement(), + initialValue = cell.getValue(), + vertNav = editorParams.verticalNavigation || "editor", + initialDisplayValue = typeof initialValue !== "undefined" || initialValue === null ? Array.isArray(initialValue) ? initialValue : [initialValue] : typeof editorParams.defaultValue !== "undefined" ? editorParams.defaultValue : [], + input = document.createElement("input"), + listEl = document.createElement("div"), + multiselect = editorParams.multiselect, + dataItems = [], + currentItem = {}, + displayItems = [], + currentItems = [], + blurable = true, + blockListShow = false; + + if (Array.isArray(editorParams) || !Array.isArray(editorParams) && (typeof editorParams === "undefined" ? "undefined" : _typeof(editorParams)) === "object" && !editorParams.values) { + console.warn("DEPRECATION WARNING - values for the select editor must now be passed into the values property of the editorParams object, not as the editorParams object"); + editorParams = { values: editorParams }; + } + + function getUniqueColumnValues(field) { + var output = {}, + data = self.table.getData(), + column; + + if (field) { + column = self.table.columnManager.getColumnByField(field); + } else { + column = cell.getColumn()._getSelf(); + } + + if (column) { + data.forEach(function (row) { + var val = column.getFieldValue(row); + + if (val !== null && typeof val !== "undefined" && val !== "") { + output[val] = true; + } + }); + + if (editorParams.sortValuesList) { + if (editorParams.sortValuesList == "asc") { + output = Object.keys(output).sort(); + } else { + output = Object.keys(output).sort().reverse(); + } + } else { + output = Object.keys(output); + } + } else { + console.warn("unable to find matching column to create select lookup list:", field); + } + + return output; + } + + function parseItems(inputValues, curentValues) { + var dataList = []; + var displayList = []; + + function processComplexListItem(item) { + var item = { + label: item.label, + value: item.value, + itemParams: item.itemParams, + elementAttributes: item.elementAttributes, + element: false + }; + + // if(item.value === curentValue || (!isNaN(parseFloat(item.value)) && !isNaN(parseFloat(item.value)) && parseFloat(item.value) === parseFloat(curentValue))){ + // setCurrentItem(item); + // } + + if (curentValues.indexOf(item.value) > -1) { + setItem(item); + } + + dataList.push(item); + displayList.push(item); + + return item; + } + + if (typeof inputValues == "function") { + inputValues = inputValues(cell); + } + + if (Array.isArray(inputValues)) { + inputValues.forEach(function (value) { + var item; + + if ((typeof value === "undefined" ? "undefined" : _typeof(value)) === "object") { + + if (value.options) { + item = { + label: value.label, + group: true, + itemParams: value.itemParams, + elementAttributes: value.elementAttributes, + element: false + }; + + displayList.push(item); + + value.options.forEach(function (item) { + processComplexListItem(item); + }); + } else { + processComplexListItem(value); + } + } else { + + item = { + label: value, + value: value, + element: false + }; + + // if(item.value === curentValue || (!isNaN(parseFloat(item.value)) && !isNaN(parseFloat(item.value)) && parseFloat(item.value) === parseFloat(curentValue))){ + // setCurrentItem(item); + // } + + if (curentValues.indexOf(item.value) > -1) { + setItem(item); + } + + dataList.push(item); + displayList.push(item); + } + }); + } else { + for (var key in inputValues) { + var item = { + label: inputValues[key], + value: key, + element: false + }; + + // if(item.value === curentValue || (!isNaN(parseFloat(item.value)) && !isNaN(parseFloat(item.value)) && parseFloat(item.value) === parseFloat(curentValue))){ + // setCurrentItem(item); + // } + + if (curentValues.indexOf(item.value) > -1) { + setItem(item); + } + + dataList.push(item); + displayList.push(item); + } + } + + dataItems = dataList; + displayItems = displayList; + + fillList(); + } + + function fillList() { + while (listEl.firstChild) { + listEl.removeChild(listEl.firstChild); + }displayItems.forEach(function (item) { + + var el = item.element; + + if (!el) { + el = document.createElement("div"); + item.label = editorParams.listItemFormatter ? editorParams.listItemFormatter(item.value, item.label, cell, el, item.itemParams) : item.label; + if (item.group) { + el.classList.add("tabulator-edit-select-list-group"); + el.tabIndex = 0; + el.innerHTML = item.label === "" ? " " : item.label; + } else { + el.classList.add("tabulator-edit-select-list-item"); + el.tabIndex = 0; + el.innerHTML = item.label === "" ? " " : item.label; + + el.addEventListener("click", function () { + blockListShow = true; + + setTimeout(function () { + blockListShow = false; + }, 10); + + // setCurrentItem(item); + // chooseItem(); + if (multiselect) { + toggleItem(item); + input.focus(); + } else { + chooseItem(item); + } + }); + + // if(item === currentItem){ + // el.classList.add("active"); + // } + + if (currentItems.indexOf(item) > -1) { + el.classList.add("active"); + } + } + + if (item.elementAttributes && _typeof(item.elementAttributes) == "object") { + for (var key in item.elementAttributes) { + if (key.charAt(0) == "+") { + key = key.slice(1); + el.setAttribute(key, input.getAttribute(key) + item.elementAttributes["+" + key]); + } else { + el.setAttribute(key, item.elementAttributes[key]); + } + } + } + el.addEventListener("mousedown", function () { + blurable = false; + + setTimeout(function () { + blurable = true; + }, 10); + }); + + item.element = el; + } + + listEl.appendChild(el); + }); + } + + function setCurrentItem(item, active) { + + if (!multiselect && currentItem && currentItem.element) { + currentItem.element.classList.remove("active"); + } + + if (currentItem && currentItem.element) { + currentItem.element.classList.remove("focused"); + } + + currentItem = item; + + if (item.element) { + item.element.classList.add("focused"); + if (active) { + item.element.classList.add("active"); + } + } + + if (item && item.element && item.element.scrollIntoView) { + item.element.scrollIntoView({ behavior: 'smooth', block: 'nearest', inline: 'start' }); + } + } + + // function chooseItem(){ + // hideList(); + + // if(initialValue !== currentItem.value){ + // initialValue = currentItem.value; + // success(currentItem.value); + // }else{ + // cancel(); + // } + // } + + function setItem(item) { + var index = currentItems.indexOf(item); + + if (index == -1) { + currentItems.push(item); + setCurrentItem(item, true); + } + + fillInput(); + } + + function unsetItem(index) { + var item = currentItems[index]; + + if (index > -1) { + currentItems.splice(index, 1); + if (item.element) { + item.element.classList.remove("active"); + } + } + } + + function toggleItem(item) { + if (!item) { + item = currentItem; + } + + var index = currentItems.indexOf(item); + + if (index > -1) { + unsetItem(index); + } else { + if (multiselect !== true && currentItems.length >= multiselect) { + unsetItem(0); + } + + setItem(item); + } + + fillInput(); + } + + function chooseItem(item) { + hideList(); + + if (!item) { + item = currentItem; + } + + if (item) { + input.value = item.label; + success(item.value); + } + + initialDisplayValue = input.value; + } + + function chooseItems(silent) { + if (!silent) { + hideList(); + } + + var output = []; + + currentItems.forEach(function (item) { + output.push(item.value); + }); + + initialDisplayValue = input.value; + + success(output); + } + + function fillInput() { + var output = []; + + currentItems.forEach(function (item) { + output.push(item.label); + }); + + input.value = output.join(", "); + + if (self.currentCell === false) { + chooseItems(true); + } + } + + function unsetItems() { + + var len = currentItems.length; + + for (var i = 0; i < len; i++) { + unsetItem(0); + } + } + + function cancelItem() { + hideList(); + cancel(); + } + + function showList() { + currentItems = []; + + if (!listEl.parentNode) { + if (editorParams.values === true) { + parseItems(getUniqueColumnValues(), initialDisplayValue); + } else if (typeof editorParams.values === "string") { + parseItems(getUniqueColumnValues(editorParams.values), initialDisplayValue); + } else { + parseItems(editorParams.values || [], initialDisplayValue); + } + + var offset = Tabulator.prototype.helpers.elOffset(cellEl); + + listEl.style.minWidth = cellEl.offsetWidth + "px"; + + listEl.style.top = offset.top + cellEl.offsetHeight + "px"; + listEl.style.left = offset.left + "px"; + + listEl.addEventListener("mousedown", function (e) { + blurable = false; + + setTimeout(function () { + blurable = true; + }, 10); + }); + + document.body.appendChild(listEl); + } + } + + function hideList() { + if (listEl.parentNode) { + listEl.parentNode.removeChild(listEl); + } + + removeScrollListener(); + } + + function removeScrollListener() { + self.table.rowManager.element.removeEventListener("scroll", cancelItem); + } + + //style input + input.setAttribute("type", "text"); + + input.style.padding = "4px"; + input.style.width = "100%"; + input.style.boxSizing = "border-box"; + input.style.cursor = "default"; + input.readOnly = this.currentCell != false; + + if (editorParams.elementAttributes && _typeof(editorParams.elementAttributes) == "object") { + for (var key in editorParams.elementAttributes) { + if (key.charAt(0) == "+") { + key = key.slice(1); + input.setAttribute(key, input.getAttribute(key) + editorParams.elementAttributes["+" + key]); + } else { + input.setAttribute(key, editorParams.elementAttributes[key]); + } + } + } + + input.value = typeof initialValue !== "undefined" || initialValue === null ? initialValue : ""; + + // if(editorParams.values === true){ + // parseItems(getUniqueColumnValues(), initialValue); + // }else if(typeof editorParams.values === "string"){ + // parseItems(getUniqueColumnValues(editorParams.values), initialValue); + // }else{ + // parseItems(editorParams.values || [], initialValue); + // } + + input.addEventListener("search", function (e) { + if (!input.value) { + unsetItems(); + chooseItems(); + } + }); + + //allow key based navigation + input.addEventListener("keydown", function (e) { + var index; + + switch (e.keyCode) { + case 38: + //up arrow + index = dataItems.indexOf(currentItem); + + if (vertNav == "editor" || vertNav == "hybrid" && index) { + e.stopImmediatePropagation(); + e.stopPropagation(); + e.preventDefault(); + + if (index > 0) { + setCurrentItem(dataItems[index - 1], !multiselect); + } + } + break; + + case 40: + //down arrow + index = dataItems.indexOf(currentItem); + + if (vertNav == "editor" || vertNav == "hybrid" && index < dataItems.length - 1) { + e.stopImmediatePropagation(); + e.stopPropagation(); + e.preventDefault(); + + if (index < dataItems.length - 1) { + if (index == -1) { + setCurrentItem(dataItems[0], !multiselect); + } else { + setCurrentItem(dataItems[index + 1], !multiselect); + } + } + } + break; + + case 37: //left arrow + case 39: + //right arrow + e.stopImmediatePropagation(); + e.stopPropagation(); + e.preventDefault(); + break; + + case 13: + //enter + // chooseItem(); + + if (multiselect) { + toggleItem(); + } else { + chooseItem(); + } + + break; + + case 27: + //escape + cancelItem(); + break; + + case 9: + //tab + break; + + default: + if (self.currentCell === false) { + e.preventDefault(); + } + } + }); + + input.addEventListener("blur", function (e) { + if (blurable) { + if (multiselect) { + chooseItems(); + } else { + cancelItem(); + } + } + }); + + input.addEventListener("focus", function (e) { + if (!blockListShow) { + showList(); + } + }); + + //style list element + listEl = document.createElement("div"); + listEl.classList.add("tabulator-edit-select-list"); + + onRendered(function () { + input.style.height = "100%"; + input.focus({ preventScroll: true }); + }); + + setTimeout(function () { + _this.table.rowManager.element.addEventListener("scroll", cancelItem); + }, 10); + + return input; + }, + + //autocomplete + autocomplete: function autocomplete(cell, onRendered, success, cancel, editorParams) { + var _this2 = this; + + var self = this, + cellEl = cell.getElement(), + initialValue = cell.getValue(), + vertNav = editorParams.verticalNavigation || "editor", + initialDisplayValue = typeof initialValue !== "undefined" || initialValue === null ? initialValue : typeof editorParams.defaultValue !== "undefined" ? editorParams.defaultValue : "", + input = document.createElement("input"), + listEl = document.createElement("div"), + allItems = [], + displayItems = [], + values = [], + currentItem = false, + blurable = true, + uniqueColumnValues = false; + + //style input + input.setAttribute("type", "search"); + + input.style.padding = "4px"; + input.style.width = "100%"; + input.style.boxSizing = "border-box"; + + if (editorParams.elementAttributes && _typeof(editorParams.elementAttributes) == "object") { + for (var key in editorParams.elementAttributes) { + if (key.charAt(0) == "+") { + key = key.slice(1); + input.setAttribute(key, input.getAttribute(key) + editorParams.elementAttributes["+" + key]); + } else { + input.setAttribute(key, editorParams.elementAttributes[key]); + } + } + } + + //style list element + listEl.classList.add("tabulator-edit-select-list"); + + listEl.addEventListener("mousedown", function (e) { + blurable = false; + + setTimeout(function () { + blurable = true; + }, 10); + }); + + function genUniqueColumnValues() { + if (editorParams.values === true) { + uniqueColumnValues = getUniqueColumnValues(); + } else if (typeof editorParams.values === "string") { + uniqueColumnValues = getUniqueColumnValues(editorParams.values); + } + } + + function getUniqueColumnValues(field) { + var output = {}, + data = self.table.getData(), + column; + + if (field) { + column = self.table.columnManager.getColumnByField(field); + } else { + column = cell.getColumn()._getSelf(); + } + + if (column) { + data.forEach(function (row) { + var val = column.getFieldValue(row); + + if (val !== null && typeof val !== "undefined" && val !== "") { + output[val] = true; + } + }); + + if (editorParams.sortValuesList) { + if (editorParams.sortValuesList == "asc") { + output = Object.keys(output).sort(); + } else { + output = Object.keys(output).sort().reverse(); + } + } else { + output = Object.keys(output); + } + } else { + console.warn("unable to find matching column to create autocomplete lookup list:", field); + } + + return output; + } + + function filterList(term, intialLoad) { + var matches = [], + values, + items, + searchEl; + + //lookup base values list + if (uniqueColumnValues) { + values = uniqueColumnValues; + } else { + values = editorParams.values || []; + } + + if (editorParams.searchFunc) { + matches = editorParams.searchFunc(term, values); + + if (matches instanceof Promise) { + + addNotice(typeof editorParams.searchingPlaceholder !== "undefined" ? editorParams.searchingPlaceholder : "Searching..."); + + matches.then(function (result) { + fillListIfNotEmpty(parseItems(result), intialLoad); + }).catch(function (err) { + console.err("error in autocomplete search promise:", err); + }); + } else { + fillListIfNotEmpty(parseItems(matches), intialLoad); + } + } else { + items = parseItems(values); + + if (term === "") { + if (editorParams.showListOnEmpty) { + matches = items; + } + } else { + items.forEach(function (item) { + if (item.value !== null || typeof item.value !== "undefined") { + if (String(item.value).toLowerCase().indexOf(String(term).toLowerCase()) > -1 || String(item.title).toLowerCase().indexOf(String(term).toLowerCase()) > -1) { + matches.push(item); + } + } + }); + } + + fillListIfNotEmpty(matches, intialLoad); + } + } + + function addNotice(notice) { + var searchEl = document.createElement("div"); + + clearList(); + + if (notice !== false) { + searchEl.classList.add("tabulator-edit-select-list-notice"); + searchEl.tabIndex = 0; + + if (notice instanceof Node) { + searchEl.appendChild(notice); + } else { + searchEl.innerHTML = notice; + } + + listEl.appendChild(searchEl); + } + } + + function parseItems(inputValues) { + var itemList = []; + + if (Array.isArray(inputValues)) { + inputValues.forEach(function (value) { + + var item = {}; + + if ((typeof value === "undefined" ? "undefined" : _typeof(value)) === "object") { + item.title = editorParams.listItemFormatter ? editorParams.listItemFormatter(value.value, value.label) : value.label; + item.value = value.value; + } else { + item.title = editorParams.listItemFormatter ? editorParams.listItemFormatter(value, value) : value; + item.value = value; + } + + itemList.push(item); + }); + } else { + for (var key in inputValues) { + var item = { + title: editorParams.listItemFormatter ? editorParams.listItemFormatter(key, inputValues[key]) : inputValues[key], + value: key + }; + + itemList.push(item); + } + } + + return itemList; + } + + function clearList() { + while (listEl.firstChild) { + listEl.removeChild(listEl.firstChild); + } + } + + function fillListIfNotEmpty(items, intialLoad) { + if (items.length) { + fillList(items, intialLoad); + } else { + if (editorParams.emptyPlaceholder) { + addNotice(editorParams.emptyPlaceholder); + } + } + } + + function fillList(items, intialLoad) { + var current = false; + + clearList(); + + displayItems = items; + + displayItems.forEach(function (item) { + var el = item.element; + + if (!el) { + el = document.createElement("div"); + el.classList.add("tabulator-edit-select-list-item"); + el.tabIndex = 0; + el.innerHTML = item.title; + + el.addEventListener("click", function (e) { + setCurrentItem(item); + chooseItem(); + }); + + el.addEventListener("mousedown", function (e) { + blurable = false; + + setTimeout(function () { + blurable = true; + }, 10); + }); + + item.element = el; + + if (intialLoad && item.value == initialValue) { + input.value = item.title; + item.element.classList.add("active"); + current = true; + } + + if (item === currentItem) { + item.element.classList.add("active"); + current = true; + } + } + + listEl.appendChild(el); + }); + + if (!current) { + setCurrentItem(false); + } + } + + function chooseItem() { + hideList(); + + if (currentItem) { + if (initialValue !== currentItem.value) { + initialValue = currentItem.value; + input.value = currentItem.title; + success(currentItem.value); + } else { + cancel(); + } + } else { + if (editorParams.freetext) { + initialValue = input.value; + success(input.value); + } else { + if (editorParams.allowEmpty && input.value === "") { + initialValue = input.value; + success(input.value); + } else { + cancel(); + } + } + } + } + + function showList() { + if (!listEl.parentNode) { + while (listEl.firstChild) { + listEl.removeChild(listEl.firstChild); + }var offset = Tabulator.prototype.helpers.elOffset(cellEl); + + listEl.style.minWidth = cellEl.offsetWidth + "px"; + + listEl.style.top = offset.top + cellEl.offsetHeight + "px"; + listEl.style.left = offset.left + "px"; + document.body.appendChild(listEl); + } + } + + function setCurrentItem(item, showInputValue) { + if (currentItem && currentItem.element) { + currentItem.element.classList.remove("active"); + } + + currentItem = item; + + if (item && item.element) { + item.element.classList.add("active"); + } + + if (item && item.element && item.element.scrollIntoView) { + item.element.scrollIntoView({ behavior: 'smooth', block: 'nearest', inline: 'start' }); + } + } + + function hideList() { + if (listEl.parentNode) { + listEl.parentNode.removeChild(listEl); + } + + removeScrollListener(); + } + + function cancelItem() { + hideList(); + cancel(); + } + + function removeScrollListener() { + self.table.rowManager.element.removeEventListener("scroll", cancelItem); + } + + //allow key based navigation + input.addEventListener("keydown", function (e) { + var index; + + switch (e.keyCode) { + case 38: + //up arrow + index = displayItems.indexOf(currentItem); + + if (vertNav == "editor" || vertNav == "hybrid" && index) { + e.stopImmediatePropagation(); + e.stopPropagation(); + e.preventDefault(); + + if (index > 0) { + setCurrentItem(displayItems[index - 1]); + } else { + setCurrentItem(false); + } + } + break; + + case 40: + //down arrow + + index = displayItems.indexOf(currentItem); + + if (vertNav == "editor" || vertNav == "hybrid" && index < displayItems.length - 1) { + + e.stopImmediatePropagation(); + e.stopPropagation(); + e.preventDefault(); + + if (index < displayItems.length - 1) { + if (index == -1) { + setCurrentItem(displayItems[0]); + } else { + setCurrentItem(displayItems[index + 1]); + } + } + } + break; + + case 37: //left arrow + case 39: + //right arrow + e.stopImmediatePropagation(); + e.stopPropagation(); + // e.preventDefault(); + break; + + case 13: + //enter + chooseItem(); + break; + + case 27: + //escape + cancelItem(); + break; + + case 36: //home + case 35: + //end + //prevent table navigation while using input element + e.stopImmediatePropagation(); + break; + } + }); + + input.addEventListener("keyup", function (e) { + + switch (e.keyCode) { + case 38: //up arrow + case 37: //left arrow + case 39: //up arrow + case 40: //right arrow + case 13: //enter + case 27: + //escape + break; + + default: + filterList(input.value); + } + }); + + input.addEventListener("search", function (e) { + filterList(input.value); + }); + + input.addEventListener("blur", function (e) { + if (blurable) { + chooseItem(); + } + }); + + input.addEventListener("focus", function (e) { + var value = initialDisplayValue; + genUniqueColumnValues(); + showList(); + input.value = value; + filterList(value, true); + }); + + onRendered(function () { + input.style.height = "100%"; + input.focus({ preventScroll: true }); + }); + + if (editorParams.mask) { + this.table.modules.edit.maskInput(input, editorParams); + } + + setTimeout(function () { + _this2.table.rowManager.element.addEventListener("scroll", cancelItem); + }, 10); + + genUniqueColumnValues(); + input.value = initialDisplayValue; + filterList(initialDisplayValue, true); + + return input; + }, + + //star rating + star: function star(cell, onRendered, success, cancel, editorParams) { + var self = this, + element = cell.getElement(), + value = cell.getValue(), + maxStars = element.getElementsByTagName("svg").length || 5, + size = element.getElementsByTagName("svg")[0] ? element.getElementsByTagName("svg")[0].getAttribute("width") : 14, + stars = [], + starsHolder = document.createElement("div"), + star = document.createElementNS('http://www.w3.org/2000/svg', "svg"); + + //change star type + function starChange(val) { + stars.forEach(function (star, i) { + if (i < val) { + if (self.table.browser == "ie") { + star.setAttribute("class", "tabulator-star-active"); + } else { + star.classList.replace("tabulator-star-inactive", "tabulator-star-active"); + } + + star.innerHTML = ''; + } else { + if (self.table.browser == "ie") { + star.setAttribute("class", "tabulator-star-inactive"); + } else { + star.classList.replace("tabulator-star-active", "tabulator-star-inactive"); + } + + star.innerHTML = ''; + } + }); + } + + //build stars + function buildStar(i) { + + var starHolder = document.createElement("span"); + var nextStar = star.cloneNode(true); + + stars.push(nextStar); + + starHolder.addEventListener("mouseenter", function (e) { + e.stopPropagation(); + e.stopImmediatePropagation(); + starChange(i); + }); + + starHolder.addEventListener("mousemove", function (e) { + e.stopPropagation(); + e.stopImmediatePropagation(); + }); + + starHolder.addEventListener("click", function (e) { + e.stopPropagation(); + e.stopImmediatePropagation(); + success(i); + element.blur(); + }); + + starHolder.appendChild(nextStar); + starsHolder.appendChild(starHolder); + } + + //handle keyboard navigation value change + function changeValue(val) { + value = val; + starChange(val); + } + + //style cell + element.style.whiteSpace = "nowrap"; + element.style.overflow = "hidden"; + element.style.textOverflow = "ellipsis"; + + //style holding element + starsHolder.style.verticalAlign = "middle"; + starsHolder.style.display = "inline-block"; + starsHolder.style.padding = "4px"; + + //style star + star.setAttribute("width", size); + star.setAttribute("height", size); + star.setAttribute("viewBox", "0 0 512 512"); + star.setAttribute("xml:space", "preserve"); + star.style.padding = "0 1px"; + + if (editorParams.elementAttributes && _typeof(editorParams.elementAttributes) == "object") { + for (var key in editorParams.elementAttributes) { + if (key.charAt(0) == "+") { + key = key.slice(1); + starsHolder.setAttribute(key, starsHolder.getAttribute(key) + editorParams.elementAttributes["+" + key]); + } else { + starsHolder.setAttribute(key, editorParams.elementAttributes[key]); + } + } + } + + //create correct number of stars + for (var i = 1; i <= maxStars; i++) { + buildStar(i); + } + + //ensure value does not exceed number of stars + value = Math.min(parseInt(value), maxStars); + + // set initial styling of stars + starChange(value); + + starsHolder.addEventListener("mousemove", function (e) { + starChange(0); + }); + + starsHolder.addEventListener("click", function (e) { + success(0); + }); + + element.addEventListener("blur", function (e) { + cancel(); + }); + + //allow key based navigation + element.addEventListener("keydown", function (e) { + switch (e.keyCode) { + case 39: + //right arrow + changeValue(value + 1); + break; + + case 37: + //left arrow + changeValue(value - 1); + break; + + case 13: + //enter + success(value); + break; + + case 27: + //escape + cancel(); + break; + } + }); + + return starsHolder; + }, + + //draggable progress bar + progress: function progress(cell, onRendered, success, cancel, editorParams) { + var element = cell.getElement(), + max = typeof editorParams.max === "undefined" ? element.getElementsByTagName("div")[0].getAttribute("max") || 100 : editorParams.max, + min = typeof editorParams.min === "undefined" ? element.getElementsByTagName("div")[0].getAttribute("min") || 0 : editorParams.min, + percent = (max - min) / 100, + value = cell.getValue() || 0, + handle = document.createElement("div"), + bar = document.createElement("div"), + mouseDrag, + mouseDragWidth; + + //set new value + function updateValue() { + var calcVal = percent * Math.round(bar.offsetWidth / (element.clientWidth / 100)) + min; + success(calcVal); + element.setAttribute("aria-valuenow", calcVal); + element.setAttribute("aria-label", value); + } + + //style handle + handle.style.position = "absolute"; + handle.style.right = "0"; + handle.style.top = "0"; + handle.style.bottom = "0"; + handle.style.width = "5px"; + handle.classList.add("tabulator-progress-handle"); + + //style bar + bar.style.display = "inline-block"; + bar.style.position = "relative"; + // bar.style.top = "8px"; + // bar.style.bottom = "8px"; + // bar.style.left = "4px"; + // bar.style.marginRight = "4px"; + bar.style.height = "100%"; + bar.style.backgroundColor = "#488CE9"; + bar.style.maxWidth = "100%"; + bar.style.minWidth = "0%"; + + if (editorParams.elementAttributes && _typeof(editorParams.elementAttributes) == "object") { + for (var key in editorParams.elementAttributes) { + if (key.charAt(0) == "+") { + key = key.slice(1); + bar.setAttribute(key, bar.getAttribute(key) + editorParams.elementAttributes["+" + key]); + } else { + bar.setAttribute(key, editorParams.elementAttributes[key]); + } + } + } + + //style cell + element.style.padding = "4px 4px"; + + //make sure value is in range + value = Math.min(parseFloat(value), max); + value = Math.max(parseFloat(value), min); + + //workout percentage + value = Math.round((value - min) / percent); + // bar.style.right = value + "%"; + bar.style.width = value + "%"; + + element.setAttribute("aria-valuemin", min); + element.setAttribute("aria-valuemax", max); + + bar.appendChild(handle); + + handle.addEventListener("mousedown", function (e) { + mouseDrag = e.screenX; + mouseDragWidth = bar.offsetWidth; + }); + + handle.addEventListener("mouseover", function () { + handle.style.cursor = "ew-resize"; + }); + + element.addEventListener("mousemove", function (e) { + if (mouseDrag) { + bar.style.width = mouseDragWidth + e.screenX - mouseDrag + "px"; + } + }); + + element.addEventListener("mouseup", function (e) { + if (mouseDrag) { + e.stopPropagation(); + e.stopImmediatePropagation(); + + mouseDrag = false; + mouseDragWidth = false; + + updateValue(); + } + }); + + //allow key based navigation + element.addEventListener("keydown", function (e) { + switch (e.keyCode) { + case 39: + //right arrow + e.preventDefault(); + bar.style.width = bar.clientWidth + element.clientWidth / 100 + "px"; + break; + + case 37: + //left arrow + e.preventDefault(); + bar.style.width = bar.clientWidth - element.clientWidth / 100 + "px"; + break; + + case 9: //tab + case 13: + //enter + updateValue(); + break; + + case 27: + //escape + cancel(); + break; + + } + }); + + element.addEventListener("blur", function () { + cancel(); + }); + + return bar; + }, + + //checkbox + tickCross: function tickCross(cell, onRendered, success, cancel, editorParams) { + var value = cell.getValue(), + input = document.createElement("input"), + tristate = editorParams.tristate, + indetermValue = typeof editorParams.indeterminateValue === "undefined" ? null : editorParams.indeterminateValue, + indetermState = false; + + input.setAttribute("type", "checkbox"); + input.style.marginTop = "5px"; + input.style.boxSizing = "border-box"; + + if (editorParams.elementAttributes && _typeof(editorParams.elementAttributes) == "object") { + for (var key in editorParams.elementAttributes) { + if (key.charAt(0) == "+") { + key = key.slice(1); + input.setAttribute(key, input.getAttribute(key) + editorParams.elementAttributes["+" + key]); + } else { + input.setAttribute(key, editorParams.elementAttributes[key]); + } + } + } + + input.value = value; + + if (tristate && (typeof value === "undefined" || value === indetermValue || value === "")) { + indetermState = true; + input.indeterminate = true; + } + + if (this.table.browser != "firefox") { + //prevent blur issue on mac firefox + onRendered(function () { + input.focus({ preventScroll: true }); + }); + } + + input.checked = value === true || value === "true" || value === "True" || value === 1; + + onRendered(function () { + input.focus(); + }); + + function setValue(blur) { + if (tristate) { + if (!blur) { + if (input.checked && !indetermState) { + input.checked = false; + input.indeterminate = true; + indetermState = true; + return indetermValue; + } else { + indetermState = false; + return input.checked; + } + } else { + if (indetermState) { + return indetermValue; + } else { + return input.checked; + } + } + } else { + return input.checked; + } + } + + //submit new value on blur + input.addEventListener("change", function (e) { + success(setValue()); + }); + + input.addEventListener("blur", function (e) { + success(setValue(true)); + }); + + //submit new value on enter + input.addEventListener("keydown", function (e) { + if (e.keyCode == 13) { + success(setValue()); + } + if (e.keyCode == 27) { + cancel(); + } + }); + + return input; + } +}; + +Tabulator.prototype.registerModule("edit", Edit); \ No newline at end of file diff --git a/website/js/vendor/tabulator/js/modules/edit.min.js b/website/js/vendor/tabulator/js/modules/edit.min.js new file mode 100644 index 0000000..9d9073b --- /dev/null +++ b/website/js/vendor/tabulator/js/modules/edit.min.js @@ -0,0 +1,2 @@ +/* Tabulator v4.8.3 (c) Oliver Folkerd */ +var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Edit=function(e){this.table=e,this.currentCell=!1,this.mouseClick=!1,this.recursionBlock=!1,this.invalidEdit=!1,this.editedCells=[]};Edit.prototype.initializeColumn=function(e){var t=this,i={editor:!1,blocked:!1,check:e.definition.editable,params:e.definition.editorParams||{}};switch(_typeof(e.definition.editor)){case"string":"tick"===e.definition.editor&&(e.definition.editor="tickCross",console.warn("DEPRECATION WARNING - the tick editor has been deprecated, please use the tickCross editor")),t.editors[e.definition.editor]?i.editor=t.editors[e.definition.editor]:console.warn("Editor Error - No such editor found: ",e.definition.editor);break;case"function":i.editor=e.definition.editor;break;case"boolean":!0===e.definition.editor&&("function"!=typeof e.definition.formatter?("tick"===e.definition.formatter&&(e.definition.formatter="tickCross",console.warn("DEPRECATION WARNING - the tick editor has been deprecated, please use the tickCross editor")),t.editors[e.definition.formatter]?i.editor=t.editors[e.definition.formatter]:i.editor=t.editors.input):console.warn("Editor Error - Cannot auto lookup editor for a custom formatter: ",e.definition.formatter))}i.editor&&(e.modules.edit=i)},Edit.prototype.getCurrentCell=function(){return!!this.currentCell&&this.currentCell.getComponent()},Edit.prototype.clearEditor=function(e){var t,i=this.currentCell;if(this.invalidEdit=!1,i){for(this.currentCell=!1,t=i.getElement(),e?i.validate():t.classList.remove("tabulator-validation-fail"),t.classList.remove("tabulator-editing");t.firstChild;)t.removeChild(t.firstChild);i.row.getElement().classList.remove("tabulator-row-editing")}},Edit.prototype.cancelEdit=function(){if(this.currentCell){var e=this.currentCell,t=this.currentCell.getComponent();this.clearEditor(!0),e.setValueActual(e.getValue()),e.cellRendered(),("textarea"==e.column.definition.editor||e.column.definition.variableHeight)&&e.row.normalizeHeight(!0),e.column.cellEvents.cellEditCancelled&&e.column.cellEvents.cellEditCancelled.call(this.table,t),this.table.options.cellEditCancelled.call(this.table,t)}},Edit.prototype.bindEditor=function(e){var t=this,i=e.getElement();i.setAttribute("tabindex",0),i.addEventListener("click",function(e){i.classList.contains("tabulator-editing")||i.focus({preventScroll:!0})}),i.addEventListener("mousedown",function(e){2===e.button?e.preventDefault():t.mouseClick=!0}),i.addEventListener("focus",function(i){t.recursionBlock||t.edit(e,i,!1)})},Edit.prototype.focusCellNoEvent=function(e,t){this.recursionBlock=!0,t&&"ie"===this.table.browser||e.getElement().focus({preventScroll:!0}),this.recursionBlock=!1},Edit.prototype.editCell=function(e,t){this.focusCellNoEvent(e),this.edit(e,!1,t)},Edit.prototype.focusScrollAdjust=function(e){if("virtual"==this.table.rowManager.getRenderMode()){var t=this.table.rowManager.element.scrollTop,i=this.table.rowManager.element.clientHeight+this.table.rowManager.element.scrollTop,n=e.row.getElement();n.offsetTop;n.offsetTopi&&(this.table.rowManager.element.scrollTop+=n.offsetTop+n.offsetHeight-i);var o=this.table.rowManager.element.scrollLeft,a=this.table.rowManager.element.clientWidth+this.table.rowManager.element.scrollLeft,r=e.getElement();r.offsetLeft;this.table.modExists("frozenColumns")&&(o+=parseInt(this.table.modules.frozenColumns.leftMargin),a-=parseInt(this.table.modules.frozenColumns.rightMargin)),r.offsetLefta&&(this.table.rowManager.element.scrollLeft+=r.offsetLeft+r.offsetWidth-a)}},Edit.prototype.edit=function(e,t,i){function n(t){if(u.currentCell===e){var i=!0;return e.column.modules.validate&&u.table.modExists("validate")&&"manual"!=u.table.options.validationMode&&(i=u.table.modules.validate.validate(e.column.modules.validate,e,t)),!0===i||"highlight"===u.table.options.validationMode?(u.clearEditor(),e.modules.edit||(e.modules.edit={}),e.modules.edit.edited=!0,-1==u.editedCells.indexOf(e)&&u.editedCells.push(e),e.setValue(t,!0),u.table.options.dataTree&&u.table.modExists("dataTree")&&u.table.modules.dataTree.checkForRestyle(e),!0===i||(m.classList.add("tabulator-validation-fail"),u.table.options.validationFailed.call(u.table,e.getComponent(),t,i),!1)):(u.invalidEdit=!0,m.classList.add("tabulator-validation-fail"),u.focusCellNoEvent(e,!0),c(),u.table.options.validationFailed.call(u.table,e.getComponent(),t,i),!1)}}function o(){u.currentCell===e&&(u.cancelEdit(),u.table.options.dataTree&&u.table.modExists("dataTree")&&u.table.modules.dataTree.checkForRestyle(e))}function a(e){c=e}var r,l,s,u=this,d=!0,c=function(){},m=e.getElement();if(this.currentCell)return void(this.invalidEdit||this.cancelEdit());if(e.column.modules.edit.blocked)return this.mouseClick=!1,m.blur(),!1;switch(t&&t.stopPropagation(),_typeof(e.column.modules.edit.check)){case"function":d=e.column.modules.edit.check(e.getComponent());break;case"boolean":d=e.column.modules.edit.check}if(d||i){if(u.cancelEdit(),u.currentCell=e,this.focusScrollAdjust(e),l=e.getComponent(),this.mouseClick&&(this.mouseClick=!1,e.column.cellEvents.cellClick&&e.column.cellEvents.cellClick.call(this.table,t,l)),e.column.cellEvents.cellEditing&&e.column.cellEvents.cellEditing.call(this.table,l),u.table.options.cellEditing.call(this.table,l),s="function"==typeof e.column.modules.edit.params?e.column.modules.edit.params(l):e.column.modules.edit.params,!1===(r=e.column.modules.edit.editor.call(u,l,a,n,o,s)))return m.blur(),!1;if(!(r instanceof Node))return console.warn("Edit Error - Editor should return an instance of Node, the editor returned:",r),m.blur(),!1;for(m.classList.add("tabulator-editing"),e.row.getElement().classList.add("tabulator-row-editing");m.firstChild;)m.removeChild(m.firstChild);m.appendChild(r),c();for(var f=m.children,p=0;p46){if(i>=n.length)return t.preventDefault(),t.stopPropagation(),l=!1,!1;switch(n[i]){case o:if(s.toUpperCase()==s.toLowerCase())return t.preventDefault(),t.stopPropagation(),l=!1,!1;break;case a:if(isNaN(s))return t.preventDefault(),t.stopPropagation(),l=!1,!1;break;case r:break;default:if(s!==n[i])return t.preventDefault(),t.stopPropagation(),l=!1,!1}l=!0}}),e.addEventListener("keyup",function(n){n.keyCode>46&&t.maskAutoFill&&i(e.value.length)}),e.placeholder||(e.placeholder=n),t.maskAutoFill&&i(e.value.length)},Edit.prototype.getEditedCells=function(){var e=[];return this.editedCells.forEach(function(t){e.push(t.getComponent())}),e},Edit.prototype.clearEdited=function(e){var t;e.modules.edit&&e.modules.edit.edited&&(e.modules.edit.edited=!1,e.modules.validate&&(e.modules.validate.invalid=!1)),(t=this.editedCells.indexOf(e))>-1&&this.editedCells.splice(t,1)},Edit.prototype.editors={input:function(e,t,i,n,o){function a(e){(null===r||void 0===r)&&""!==l.value||l.value!==r?i(l.value)&&(r=l.value):n()}var r=e.getValue(),l=document.createElement("input");if(l.setAttribute("type",o.search?"search":"text"),l.style.padding="4px",l.style.width="100%",l.style.boxSizing="border-box",o.elementAttributes&&"object"==_typeof(o.elementAttributes))for(var s in o.elementAttributes)"+"==s.charAt(0)?(s=s.slice(1),l.setAttribute(s,l.getAttribute(s)+o.elementAttributes["+"+s])):l.setAttribute(s,o.elementAttributes[s]);return l.value=void 0!==r?r:"",t(function(){l.focus({preventScroll:!0}),l.style.height="100%"}),l.addEventListener("change",a),l.addEventListener("blur",a),l.addEventListener("keydown",function(e){switch(e.keyCode){case 13:a(e);break;case 27:n();break;case 35:case 36:e.stopPropagation()}}),o.mask&&this.table.modules.edit.maskInput(l,o),l},textarea:function(e,t,i,n,o){function a(t){(null===r||void 0===r)&&""!==u.value||u.value!==r?(i(u.value)&&(r=u.value),setTimeout(function(){e.getRow().normalizeHeight()},300)):n()}var r=e.getValue(),l=o.verticalNavigation||"hybrid",s=String(null!==r&&void 0!==r?r:""),u=(s.match(/(?:\r\n|\r|\n)/g),document.createElement("textarea")),d=0;if(u.style.display="block",u.style.padding="2px",u.style.height="100%",u.style.width="100%",u.style.boxSizing="border-box",u.style.whiteSpace="pre-wrap",u.style.resize="none",o.elementAttributes&&"object"==_typeof(o.elementAttributes))for(var c in o.elementAttributes)"+"==c.charAt(0)?(c=c.slice(1),u.setAttribute(c,u.getAttribute(c)+o.elementAttributes["+"+c])):u.setAttribute(c,o.elementAttributes[c]);return u.value=s,t(function(){u.focus({preventScroll:!0}),u.style.height="100%",u.scrollHeight,u.style.height=u.scrollHeight+"px",e.getRow().normalizeHeight()}),u.addEventListener("change",a),u.addEventListener("blur",a),u.addEventListener("keyup",function(){u.style.height="";var t=u.scrollHeight;u.style.height=t+"px",t!=d&&(d=t,e.getRow().normalizeHeight())}),u.addEventListener("keydown",function(e){switch(e.keyCode){case 27:n();break;case 38:("editor"==l||"hybrid"==l&&u.selectionStart)&&(e.stopImmediatePropagation(),e.stopPropagation());break;case 40:("editor"==l||"hybrid"==l&&u.selectionStart!==u.value.length)&&(e.stopImmediatePropagation(),e.stopPropagation());break;case 35:case 36:e.stopPropagation()}}),o.mask&&this.table.modules.edit.maskInput(u,o),u},number:function(e,t,i,n,o){function a(){var e=s.value;isNaN(e)||""===e||(e=Number(e)),e!==r?i(e)&&(r=e):n()}var r=e.getValue(),l=o.verticalNavigation||"editor",s=document.createElement("input");if(s.setAttribute("type","number"),void 0!==o.max&&s.setAttribute("max",o.max),void 0!==o.min&&s.setAttribute("min",o.min),void 0!==o.step&&s.setAttribute("step",o.step),s.style.padding="4px",s.style.width="100%",s.style.boxSizing="border-box",o.elementAttributes&&"object"==_typeof(o.elementAttributes))for(var u in o.elementAttributes)"+"==u.charAt(0)?(u=u.slice(1),s.setAttribute(u,s.getAttribute(u)+o.elementAttributes["+"+u])):s.setAttribute(u,o.elementAttributes[u]);s.value=r;var d=function(e){a()};return t(function(){s.removeEventListener("blur",d),s.focus({preventScroll:!0}),s.style.height="100%",s.addEventListener("blur",d)}),s.addEventListener("keydown",function(e){switch(e.keyCode){case 13:a();break;case 27:n();break;case 38:case 40:"editor"==l&&(e.stopImmediatePropagation(),e.stopPropagation());break;case 35:case 36:e.stopPropagation()}}),o.mask&&this.table.modules.edit.maskInput(s,o),s},range:function(e,t,i,n,o){function a(){var e=l.value;isNaN(e)||""===e||(e=Number(e)),e!=r?i(e)&&(r=e):n()}var r=e.getValue(),l=document.createElement("input");if(l.setAttribute("type","range"),void 0!==o.max&&l.setAttribute("max",o.max),void 0!==o.min&&l.setAttribute("min",o.min),void 0!==o.step&&l.setAttribute("step",o.step),l.style.padding="4px",l.style.width="100%",l.style.boxSizing="border-box",o.elementAttributes&&"object"==_typeof(o.elementAttributes))for(var s in o.elementAttributes)"+"==s.charAt(0)?(s=s.slice(1),l.setAttribute(s,l.getAttribute(s)+o.elementAttributes["+"+s])):l.setAttribute(s,o.elementAttributes[s]);return l.value=r,t(function(){l.focus({preventScroll:!0}),l.style.height="100%"}),l.addEventListener("blur",function(e){a()}),l.addEventListener("keydown",function(e){switch(e.keyCode){case 13:a();break;case 27:n()}}),l},select:function(e,t,i,n,o){function a(t){var i,n={},a=k.table.getData();return i=t?k.table.columnManager.getColumnByField(t):e.getColumn()._getSelf(),i?(a.forEach(function(e){var t=i.getFieldValue(e);null!==t&&void 0!==t&&""!==t&&(n[t]=!0)}),n=o.sortValuesList?"asc"==o.sortValuesList?Object.keys(n).sort():Object.keys(n).sort().reverse():Object.keys(n)):console.warn("unable to find matching column to create select lookup list:",t),n}function r(t,i){function n(e){var e={label:e.label,value:e.value,itemParams:e.itemParams,elementAttributes:e.elementAttributes,element:!1};return i.indexOf(e.value)>-1&&u(e),o.push(e),a.push(e),e}var o=[],a=[];if("function"==typeof t&&(t=t(e)),Array.isArray(t))t.forEach(function(e){var t;"object"===(void 0===e?"undefined":_typeof(e))?e.options?(t={label:e.label,group:!0,itemParams:e.itemParams,elementAttributes:e.elementAttributes,element:!1},a.push(t),e.options.forEach(function(e){n(e)})):n(e):(t={label:e,value:e,element:!1},i.indexOf(t.value)>-1&&u(t),o.push(t),a.push(t))});else for(var r in t){var s={label:t[r],value:r,element:!1};i.indexOf(s.value)>-1&&u(s),o.push(s),a.push(s)}N=o,S=a,l()}function l(){for(;P.firstChild;)P.removeChild(P.firstChild);S.forEach(function(t){var i=t.element;if(!i){if(i=document.createElement("div"),t.label=o.listItemFormatter?o.listItemFormatter(t.value,t.label,e,i,t.itemParams):t.label,t.group?(i.classList.add("tabulator-edit-select-list-group"),i.tabIndex=0,i.innerHTML=""===t.label?" ":t.label):(i.classList.add("tabulator-edit-select-list-item"),i.tabIndex=0,i.innerHTML=""===t.label?" ":t.label,i.addEventListener("click",function(){V=!0,setTimeout(function(){V=!1},10),I?(c(t),x.focus()):m(t)}),M.indexOf(t)>-1&&i.classList.add("active")),t.elementAttributes&&"object"==_typeof(t.elementAttributes))for(var n in t.elementAttributes)"+"==n.charAt(0)?(n=n.slice(1),i.setAttribute(n,x.getAttribute(n)+t.elementAttributes["+"+n])):i.setAttribute(n,t.elementAttributes[n]);i.addEventListener("mousedown",function(){O=!1,setTimeout(function(){O=!0},10)}),t.element=i}P.appendChild(i)})}function s(e,t){!I&&T&&T.element&&T.element.classList.remove("active"),T&&T.element&&T.element.classList.remove("focused"),T=e,e.element&&(e.element.classList.add("focused"),t&&e.element.classList.add("active")),e&&e.element&&e.element.scrollIntoView&&e.element.scrollIntoView({behavior:"smooth",block:"nearest",inline:"start"})}function u(e){-1==M.indexOf(e)&&(M.push(e),s(e,!0)),p()}function d(e){var t=M[e];e>-1&&(M.splice(e,1),t.element&&t.element.classList.remove("active"))}function c(e){e||(e=T);var t=M.indexOf(e);t>-1?d(t):(!0!==I&&M.length>=I&&d(0),u(e)),p()}function m(e){g(),e||(e=T),e&&(x.value=e.label,i(e.value)),w=x.value}function f(e){e||g();var t=[];M.forEach(function(e){t.push(e.value)}),w=x.value,i(t)}function p(){var e=[];M.forEach(function(t){e.push(t.label)}),x.value=e.join(", "),!1===k.currentCell&&f(!0)}function b(){for(var e=M.length,t=0;t0&&s(N[t-1],!I));break;case 40:t=N.indexOf(T),("editor"==L||"hybrid"==L&&t-1||String(t.title).toLowerCase().indexOf(String(e).toLowerCase())>-1)&&a.push(t)}),c(a,t))}function s(e){var t=document.createElement("div");d(),!1!==e&&(t.classList.add("tabulator-edit-select-list-notice"),t.tabIndex=0,e instanceof Node?t.appendChild(e):t.innerHTML=e,x.appendChild(t))}function u(e){var t=[];if(Array.isArray(e))e.forEach(function(e){var i={};"object"===(void 0===e?"undefined":_typeof(e))?(i.title=o.listItemFormatter?o.listItemFormatter(e.value,e.label):e.label,i.value=e.value):(i.title=o.listItemFormatter?o.listItemFormatter(e,e):e,i.value=e),t.push(i)});else for(var i in e){var n={title:o.listItemFormatter?o.listItemFormatter(i,e[i]):e[i],value:i};t.push(n)}return t}function d(){for(;x.firstChild;)x.removeChild(x.firstChild)}function c(e,t){e.length?m(e,t):o.emptyPlaceholder&&s(o.emptyPlaceholder)}function m(e,t){var i=!1;d(),P=e,P.forEach(function(e){var n=e.element;n||(n=document.createElement("div"),n.classList.add("tabulator-edit-select-list-item"),n.tabIndex=0,n.innerHTML=e.title,n.addEventListener("click",function(t){b(e),f()}),n.addEventListener("mousedown",function(e){N=!1,setTimeout(function(){N=!0},10)}),e.element=n,t&&e.value==A&&(w.value=e.title,e.element.classList.add("active"),i=!0),e===I&&(e.element.classList.add("active"),i=!0)),x.appendChild(n)}),i||b(!1)}function f(){v(),I?A!==I.value?(A=I.value,w.value=I.title,i(I.value)):n():o.freetext?(A=w.value,i(w.value)):o.allowEmpty&&""===w.value?(A=w.value,i(w.value)):n()}function p(){if(!x.parentNode){for(;x.firstChild;)x.removeChild(x.firstChild);var e=Tabulator.prototype.helpers.elOffset(k);x.style.minWidth=k.offsetWidth+"px",x.style.top=e.top+k.offsetHeight+"px",x.style.left=e.left+"px",document.body.appendChild(x)}}function b(e,t){I&&I.element&&I.element.classList.remove("active"),I=e,e&&e.element&&e.element.classList.add("active"),e&&e.element&&e.element.scrollIntoView&&e.element.scrollIntoView({behavior:"smooth",block:"nearest",inline:"start"})}function v(){x.parentNode&&x.parentNode.removeChild(x),g()}function h(){v(),n()}function g(){E.table.rowManager.element.removeEventListener("scroll",h)}var y=this,E=this,k=e.getElement(),A=e.getValue(),C=o.verticalNavigation||"editor",L=void 0!==A||null===A?A:void 0!==o.defaultValue?o.defaultValue:"",w=document.createElement("input"),x=document.createElement("div"),P=[],I=!1,N=!0,T=!1;if(w.setAttribute("type","search"),w.style.padding="4px",w.style.width="100%",w.style.boxSizing="border-box",o.elementAttributes&&"object"==_typeof(o.elementAttributes))for(var S in o.elementAttributes)"+"==S.charAt(0)?(S=S.slice(1),w.setAttribute(S,w.getAttribute(S)+o.elementAttributes["+"+S])):w.setAttribute(S,o.elementAttributes[S]);return x.classList.add("tabulator-edit-select-list"),x.addEventListener("mousedown",function(e){N=!1,setTimeout(function(){N=!0},10)}),w.addEventListener("keydown",function(e){var t;switch(e.keyCode){case 38:t=P.indexOf(I),("editor"==C||"hybrid"==C&&t)&&(e.stopImmediatePropagation(),e.stopPropagation(),e.preventDefault(),b(t>0?P[t-1]:!1));break;case 40:t=P.indexOf(I),("editor"==C||"hybrid"==C&&t'):("ie"==l.table.browser?t.setAttribute("class","tabulator-star-inactive"):t.classList.replace("tabulator-star-active","tabulator-star-inactive"),t.innerHTML='')})}function r(e){u=e,a(e)}var l=this,s=e.getElement(),u=e.getValue(),d=s.getElementsByTagName("svg").length||5,c=s.getElementsByTagName("svg")[0]?s.getElementsByTagName("svg")[0].getAttribute("width"):14,m=[],f=document.createElement("div"),p=document.createElementNS("http://www.w3.org/2000/svg","svg");if(s.style.whiteSpace="nowrap",s.style.overflow="hidden",s.style.textOverflow="ellipsis",f.style.verticalAlign="middle",f.style.display="inline-block",f.style.padding="4px",p.setAttribute("width",c),p.setAttribute("height",c),p.setAttribute("viewBox","0 0 512 512"),p.setAttribute("xml:space","preserve"),p.style.padding="0 1px",o.elementAttributes&&"object"==_typeof(o.elementAttributes))for(var b in o.elementAttributes)"+"==b.charAt(0)?(b=b.slice(1),f.setAttribute(b,f.getAttribute(b)+o.elementAttributes["+"+b])):f.setAttribute(b,o.elementAttributes[b]);for(var v=1;v<=d;v++)!function(e){var t=document.createElement("span"),n=p.cloneNode(!0);m.push(n),t.addEventListener("mouseenter",function(t){t.stopPropagation(),t.stopImmediatePropagation(),a(e)}),t.addEventListener("mousemove",function(e){e.stopPropagation(),e.stopImmediatePropagation()}),t.addEventListener("click",function(t){t.stopPropagation(),t.stopImmediatePropagation(),i(e),s.blur()}),t.appendChild(n),f.appendChild(t)}(v);return u=Math.min(parseInt(u),d),a(u),f.addEventListener("mousemove",function(e){a(0)}),f.addEventListener("click",function(e){i(0)}),s.addEventListener("blur",function(e){n()}),s.addEventListener("keydown",function(e){switch(e.keyCode){case 39:r(u+1);break;case 37:r(u-1);break;case 13:i(u);break;case 27:n()}}),f},progress:function(e,t,i,n,o){function a(){var e=c*Math.round(p.offsetWidth/(s.clientWidth/100))+d;i(e),s.setAttribute("aria-valuenow",e),s.setAttribute("aria-label",m)}var r,l,s=e.getElement(),u=void 0===o.max?s.getElementsByTagName("div")[0].getAttribute("max")||100:o.max,d=void 0===o.min?s.getElementsByTagName("div")[0].getAttribute("min")||0:o.min,c=(u-d)/100,m=e.getValue()||0,f=document.createElement("div"),p=document.createElement("div");if(f.style.position="absolute",f.style.right="0",f.style.top="0",f.style.bottom="0",f.style.width="5px",f.classList.add("tabulator-progress-handle"),p.style.display="inline-block",p.style.position="relative",p.style.height="100%",p.style.backgroundColor="#488CE9",p.style.maxWidth="100%",p.style.minWidth="0%",o.elementAttributes&&"object"==_typeof(o.elementAttributes))for(var b in o.elementAttributes)"+"==b.charAt(0)?(b=b.slice(1),p.setAttribute(b,p.getAttribute(b)+o.elementAttributes["+"+b])):p.setAttribute(b,o.elementAttributes[b]);return s.style.padding="4px 4px",m=Math.min(parseFloat(m),u),m=Math.max(parseFloat(m),d),m=Math.round((m-d)/c),p.style.width=m+"%",s.setAttribute("aria-valuemin",d),s.setAttribute("aria-valuemax",u),p.appendChild(f),f.addEventListener("mousedown",function(e){r=e.screenX,l=p.offsetWidth}),f.addEventListener("mouseover",function(){f.style.cursor="ew-resize"}),s.addEventListener("mousemove",function(e){r&&(p.style.width=l+e.screenX-r+"px")}),s.addEventListener("mouseup",function(e){r&&(e.stopPropagation(),e.stopImmediatePropagation(),r=!1,l=!1,a())}),s.addEventListener("keydown",function(e){switch(e.keyCode){case 39:e.preventDefault(),p.style.width=p.clientWidth+s.clientWidth/100+"px";break;case 37:e.preventDefault(),p.style.width=p.clientWidth-s.clientWidth/100+"px";break;case 9:case 13:a();break;case 27:n()}}),s.addEventListener("blur",function(){n()}),p},tickCross:function(e,t,i,n,o){function a(e){return s?e?d?u:l.checked:l.checked&&!d?(l.checked=!1,l.indeterminate=!0,d=!0,u):(d=!1,l.checked):l.checked}var r=e.getValue(),l=document.createElement("input"),s=o.tristate,u=void 0===o.indeterminateValue?null:o.indeterminateValue,d=!1;if(l.setAttribute("type","checkbox"),l.style.marginTop="5px",l.style.boxSizing="border-box",o.elementAttributes&&"object"==_typeof(o.elementAttributes))for(var c in o.elementAttributes)"+"==c.charAt(0)?(c=c.slice(1),l.setAttribute(c,l.getAttribute(c)+o.elementAttributes["+"+c])):l.setAttribute(c,o.elementAttributes[c]);return l.value=r,!s||void 0!==r&&r!==u&&""!==r||(d=!0,l.indeterminate=!0),"firefox"!=this.table.browser&&t(function(){l.focus({preventScroll:!0})}),l.checked=!0===r||"true"===r||"True"===r||1===r,t(function(){l.focus()}),l.addEventListener("change",function(e){i(a())}),l.addEventListener("blur",function(e){i(a(!0))}),l.addEventListener("keydown",function(e){13==e.keyCode&&i(a()),27==e.keyCode&&n()}),l}},Tabulator.prototype.registerModule("edit",Edit); \ No newline at end of file diff --git a/website/js/vendor/tabulator/js/modules/export.js b/website/js/vendor/tabulator/js/modules/export.js new file mode 100644 index 0000000..9f9806d --- /dev/null +++ b/website/js/vendor/tabulator/js/modules/export.js @@ -0,0 +1,614 @@ +var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; + +/* Tabulator v4.8.3 (c) Oliver Folkerd */ + +var ExportRow = function ExportRow(type, columns, component, indent) { + this.type = type; + this.columns = columns; + this.component = component || false; + this.indent = indent || 0; +}; + +var ExportColumn = function ExportColumn(value, component, width, height, depth) { + this.value = value; + this.component = component || false; + this.width = width; + this.height = height; + this.depth = depth; +}; + +var Export = function Export(table) { + this.table = table; //hold Tabulator object + this.config = {}; + this.cloneTableStyle = true; + this.colVisProp = ""; +}; + +Export.prototype.generateExportList = function (config, style, range, colVisProp) { + this.cloneTableStyle = style; + this.config = config || {}; + this.colVisProp = colVisProp; + + var headers = this.config.columnHeaders !== false ? this.headersToExportRows(this.generateColumnGroupHeaders()) : []; + var body = this.bodyToExportRows(this.rowLookup(range)); + + return headers.concat(body); +}; + +Export.prototype.genereateTable = function (config, style, range, colVisProp) { + var list = this.generateExportList(config, style, range, colVisProp); + + return this.genereateTableElement(list); +}; + +Export.prototype.rowLookup = function (range) { + var _this = this; + + var rows = []; + + if (typeof range == "function") { + range.call(this.table).forEach(function (row) { + row = _this.table.rowManager.findRow(row); + + if (row) { + rows.push(row); + } + }); + } else { + switch (range) { + case true: + case "visible": + rows = this.table.rowManager.getVisibleRows(true); + break; + + case "all": + rows = this.table.rowManager.rows; + break; + + case "selected": + rows = this.table.modules.selectRow.selectedRows; + break; + + case "active": + default: + if (this.table.options.pagination) { + rows = this.table.rowManager.getDisplayRows(this.table.rowManager.displayRows.length - 2); + } else { + rows = this.table.rowManager.getDisplayRows(); + } + } + } + + return Object.assign([], rows); +}; + +Export.prototype.generateColumnGroupHeaders = function () { + var _this2 = this; + + var output = []; + + var columns = this.config.columnGroups !== false ? this.table.columnManager.columns : this.table.columnManager.columnsByIndex; + + columns.forEach(function (column) { + var colData = _this2.processColumnGroup(column); + + if (colData) { + output.push(colData); + } + }); + + return output; +}; + +Export.prototype.processColumnGroup = function (column) { + var _this3 = this; + + var subGroups = column.columns, + maxDepth = 0, + title = column.definition["title" + (this.colVisProp.charAt(0).toUpperCase() + this.colVisProp.slice(1))] || column.definition.title; + + var groupData = { + title: title, + column: column, + depth: 1 + }; + + if (subGroups.length) { + groupData.subGroups = []; + groupData.width = 0; + + subGroups.forEach(function (subGroup) { + var subGroupData = _this3.processColumnGroup(subGroup); + + if (subGroupData) { + groupData.width += subGroupData.width; + groupData.subGroups.push(subGroupData); + + if (subGroupData.depth > maxDepth) { + maxDepth = subGroupData.depth; + } + } + }); + + groupData.depth += maxDepth; + + if (!groupData.width) { + return false; + } + } else { + if (this.columnVisCheck(column)) { + groupData.width = 1; + } else { + return false; + } + } + + return groupData; +}; + +Export.prototype.columnVisCheck = function (column) { + return column.definition[this.colVisProp] !== false && (column.visible || !column.visible && column.definition[this.colVisProp]); +}; + +Export.prototype.headersToExportRows = function (columns) { + var headers = [], + headerDepth = 0, + exportRows = []; + + function parseColumnGroup(column, level) { + + var depth = headerDepth - level; + + if (typeof headers[level] === "undefined") { + headers[level] = []; + } + + column.height = column.subGroups ? 1 : depth - column.depth + 1; + + headers[level].push(column); + + if (column.height > 1) { + for (var _i = 1; _i < column.height; _i++) { + + if (typeof headers[level + _i] === "undefined") { + headers[level + _i] = []; + } + + headers[level + _i].push(false); + } + } + + if (column.width > 1) { + for (var _i2 = 1; _i2 < column.width; _i2++) { + headers[level].push(false); + } + } + + if (column.subGroups) { + column.subGroups.forEach(function (subGroup) { + parseColumnGroup(subGroup, level + 1); + }); + } + } + + //calculate maximum header debth + columns.forEach(function (column) { + if (column.depth > headerDepth) { + headerDepth = column.depth; + } + }); + + columns.forEach(function (column) { + parseColumnGroup(column, 0); + }); + + headers.forEach(function (header) { + var columns = []; + + header.forEach(function (col) { + if (col) { + columns.push(new ExportColumn(col.title, col.column.getComponent(), col.width, col.height, col.depth)); + } else { + columns.push(null); + } + }); + + exportRows.push(new ExportRow("header", columns)); + }); + + return exportRows; +}; + +Export.prototype.bodyToExportRows = function (rows) { + var _this4 = this; + + var columns = []; + var exportRows = []; + + this.table.columnManager.columnsByIndex.forEach(function (column) { + if (_this4.columnVisCheck(column)) { + columns.push(column.getComponent()); + } + }); + + if (this.config.columnCalcs !== false && this.table.modExists("columnCalcs")) { + if (this.table.modules.columnCalcs.topInitialized) { + rows.unshift(this.table.modules.columnCalcs.topRow); + } + + if (this.table.modules.columnCalcs.botInitialized) { + rows.push(this.table.modules.columnCalcs.botRow); + } + } + + rows = rows.filter(function (row) { + switch (row.type) { + case "group": + return _this4.config.rowGroups !== false; + break; + + case "calc": + return _this4.config.columnCalcs !== false; + break; + + case "row": + return !(_this4.table.options.dataTree && _this4.config.dataTree === false && row.modules.dataTree.parent); + break; + } + + return true; + }); + + rows.forEach(function (row, i) { + var rowData = row.getData(_this4.colVisProp); + var exportCols = []; + var indent = 0; + + switch (row.type) { + case "group": + indent = row.level; + exportCols.push(new ExportColumn(row.key, row.getComponent(), columns.length, 1)); + break; + + case "calc": + case "row": + columns.forEach(function (col) { + exportCols.push(new ExportColumn(col._column.getFieldValue(rowData), col, 1, 1)); + }); + + if (_this4.table.options.dataTree && _this4.config.dataTree !== false) { + indent = row.modules.dataTree.index; + } + break; + } + + exportRows.push(new ExportRow(row.type, exportCols, row.getComponent(), indent)); + }); + + return exportRows; +}; + +Export.prototype.genereateTableElement = function (list) { + var _this5 = this; + + var table = document.createElement("table"), + headerEl = document.createElement("thead"), + bodyEl = document.createElement("tbody"), + styles = this.lookupTableStyles(), + rowFormatter = this.table.options["rowFormatter" + (this.colVisProp.charAt(0).toUpperCase() + this.colVisProp.slice(1))], + setup = {}; + + setup.rowFormatter = rowFormatter !== null ? rowFormatter : this.table.options.rowFormatter; + + if (this.table.options.dataTree && this.config.dataTree !== false && this.table.modExists("columnCalcs")) { + setup.treeElementField = this.table.modules.dataTree.elementField; + } + + //assign group header formatter + setup.groupHeader = this.table.options["groupHeader" + (this.colVisProp.charAt(0).toUpperCase() + this.colVisProp.slice(1))]; + + if (setup.groupHeader && !Array.isArray(setup.groupHeader)) { + setup.groupHeader = [setup.groupHeader]; + } + + table.classList.add("tabulator-print-table"); + + this.mapElementStyles(this.table.columnManager.getHeadersElement(), headerEl, ["border-top", "border-left", "border-right", "border-bottom", "background-color", "color", "font-weight", "font-family", "font-size"]); + + if (list.length > 1000) { + console.warn("It may take a long time to render an HTML table with more than 1000 rows"); + } + + list.forEach(function (row, i) { + switch (row.type) { + case "header": + headerEl.appendChild(_this5.genereateHeaderElement(row, setup, styles)); + break; + + case "group": + bodyEl.appendChild(_this5.genereateGroupElement(row, setup, styles)); + break; + + case "calc": + bodyEl.appendChild(_this5.genereateCalcElement(row, setup, styles)); + break; + + case "row": + var rowEl = _this5.genereateRowElement(row, setup, styles); + _this5.mapElementStyles(i % 2 && styles.evenRow ? styles.evenRow : styles.oddRow, rowEl, ["border-top", "border-left", "border-right", "border-bottom", "color", "font-weight", "font-family", "font-size", "background-color"]); + bodyEl.appendChild(rowEl); + break; + } + }); + + if (headerEl.innerHTML) { + table.appendChild(headerEl); + } + + table.appendChild(bodyEl); + + this.mapElementStyles(this.table.element, table, ["border-top", "border-left", "border-right", "border-bottom"]); + return table; +}; + +Export.prototype.lookupTableStyles = function () { + var styles = {}; + + //lookup row styles + if (this.cloneTableStyle && window.getComputedStyle) { + styles.oddRow = this.table.element.querySelector(".tabulator-row-odd:not(.tabulator-group):not(.tabulator-calcs)"); + styles.evenRow = this.table.element.querySelector(".tabulator-row-even:not(.tabulator-group):not(.tabulator-calcs)"); + styles.calcRow = this.table.element.querySelector(".tabulator-row.tabulator-calcs"); + styles.firstRow = this.table.element.querySelector(".tabulator-row:not(.tabulator-group):not(.tabulator-calcs)"); + styles.firstGroup = this.table.element.getElementsByClassName("tabulator-group")[0]; + + if (styles.firstRow) { + styles.styleCells = styles.firstRow.getElementsByClassName("tabulator-cell"); + styles.firstCell = styles.styleCells[0]; + styles.lastCell = styles.styleCells[styles.styleCells.length - 1]; + } + } + + return styles; +}; + +Export.prototype.genereateHeaderElement = function (row, setup, styles) { + var _this6 = this; + + var rowEl = document.createElement("tr"); + + row.columns.forEach(function (column) { + if (column) { + var cellEl = document.createElement("th"); + var classNames = column.component._column.definition.cssClass ? column.component._column.definition.cssClass.split(" ") : []; + + cellEl.colSpan = column.width; + cellEl.rowSpan = column.height; + + cellEl.innerHTML = column.value; + + if (_this6.cloneTableStyle) { + cellEl.style.boxSizing = "border-box"; + } + + classNames.forEach(function (className) { + cellEl.classList.add(className); + }); + + _this6.mapElementStyles(column.component.getElement(), cellEl, ["text-align", "border-top", "border-left", "border-right", "border-bottom", "background-color", "color", "font-weight", "font-family", "font-size"]); + _this6.mapElementStyles(column.component._column.contentElement, cellEl, ["padding-top", "padding-left", "padding-right", "padding-bottom"]); + + if (column.component._column.visible) { + _this6.mapElementStyles(column.component.getElement(), cellEl, ["width"]); + } else { + if (column.component._column.definition.width) { + cellEl.style.width = column.component._column.definition.width + "px"; + } + } + + if (column.component._column.parent) { + _this6.mapElementStyles(column.component._column.parent.groupElement, cellEl, ["border-top"]); + } + + rowEl.appendChild(cellEl); + } + }); + + return rowEl; +}; + +Export.prototype.genereateGroupElement = function (row, setup, styles) { + + var rowEl = document.createElement("tr"), + cellEl = document.createElement("td"), + group = row.columns[0]; + + rowEl.classList.add("tabulator-print-table-row"); + + if (setup.groupHeader && setup.groupHeader[row.indent]) { + group.value = setup.groupHeader[row.indent](group.value, row.component._group.getRowCount(), row.component._group.getData(), row.component); + } else { + if (setup.groupHeader === false) { + group.value = group.value; + } else { + group.value = row.component._group.generator(group.value, row.component._group.getRowCount(), row.component._group.getData(), row.component); + } + } + + cellEl.colSpan = group.width; + cellEl.innerHTML = group.value; + + rowEl.classList.add("tabulator-print-table-group"); + rowEl.classList.add("tabulator-group-level-" + row.indent); + + if (group.component.isVisible()) { + rowEl.classList.add("tabulator-group-visible"); + } + + this.mapElementStyles(styles.firstGroup, rowEl, ["border-top", "border-left", "border-right", "border-bottom", "color", "font-weight", "font-family", "font-size", "background-color"]); + this.mapElementStyles(styles.firstGroup, cellEl, ["padding-top", "padding-left", "padding-right", "padding-bottom"]); + + rowEl.appendChild(cellEl); + + return rowEl; +}; + +Export.prototype.genereateCalcElement = function (row, setup, styles) { + var rowEl = this.genereateRowElement(row, setup, styles); + + rowEl.classList.add("tabulator-print-table-calcs"); + this.mapElementStyles(styles.calcRow, rowEl, ["border-top", "border-left", "border-right", "border-bottom", "color", "font-weight", "font-family", "font-size", "background-color"]); + + return rowEl; +}; + +Export.prototype.genereateRowElement = function (row, setup, styles) { + var _this7 = this; + + var rowEl = document.createElement("tr"); + + rowEl.classList.add("tabulator-print-table-row"); + + row.columns.forEach(function (col) { + + if (col) { + var cellEl = document.createElement("td"), + column = col.component._column, + value = col.value; + + var cellWrapper = { + modules: {}, + getValue: function getValue() { + return value; + }, + getField: function getField() { + return column.definition.field; + }, + getElement: function getElement() { + return cellEl; + }, + getColumn: function getColumn() { + return column.getComponent(); + }, + getData: function getData() { + return row.component.getData(); + }, + getRow: function getRow() { + return row.component; + }, + getComponent: function getComponent() { + return cellWrapper; + }, + column: column + }; + + var classNames = column.definition.cssClass ? column.definition.cssClass.split(" ") : []; + + classNames.forEach(function (className) { + cellEl.classList.add(className); + }); + + if (_this7.table.modExists("format") && _this7.config.formatCells !== false) { + value = _this7.table.modules.format.formatExportValue(cellWrapper, _this7.colVisProp); + } else { + switch (typeof value === "undefined" ? "undefined" : _typeof(value)) { + case "object": + value = JSON.stringify(value); + break; + + case "undefined": + case "null": + value = ""; + break; + + default: + value = value; + } + } + + if (value instanceof Node) { + cellEl.appendChild(value); + } else { + cellEl.innerHTML = value; + } + + if (styles.firstCell) { + _this7.mapElementStyles(styles.firstCell, cellEl, ["padding-top", "padding-left", "padding-right", "padding-bottom", "border-top", "border-left", "border-right", "border-bottom", "color", "font-weight", "font-family", "font-size"]); + + if (column.definition.align) { + cellEl.style.textAlign = column.definition.align; + } + } + + if (_this7.table.options.dataTree && _this7.config.dataTree !== false) { + if (setup.treeElementField && setup.treeElementField == column.field || !setup.treeElementField && i == 0) { + if (row.component._row.modules.dataTree.controlEl) { + cellEl.insertBefore(row.component._row.modules.dataTree.controlEl.cloneNode(true), cellEl.firstChild); + } + if (row.component._row.modules.dataTree.branchEl) { + cellEl.insertBefore(row.component._row.modules.dataTree.branchEl.cloneNode(true), cellEl.firstChild); + } + } + } + + rowEl.appendChild(cellEl); + + if (cellWrapper.modules.format && cellWrapper.modules.format.renderedCallback) { + cellWrapper.modules.format.renderedCallback(); + } + + if (setup.rowFormatter && _this7.config.formatCells !== false) { + setup.rowFormatter(row.component); + } + } + }); + + return rowEl; +}; + +Export.prototype.genereateHTMLTable = function (list) { + var holder = document.createElement("div"); + + holder.appendChild(this.genereateTableElement(list)); + + return holder.innerHTML; +}; + +Export.prototype.getHtml = function (visible, style, config, colVisProp) { + var list = this.generateExportList(config || this.table.options.htmlOutputConfig, style, visible, colVisProp || "htmlOutput"); + + return this.genereateHTMLTable(list); +}; + +Export.prototype.mapElementStyles = function (from, to, props) { + if (this.cloneTableStyle && from && to) { + + var lookup = { + "background-color": "backgroundColor", + "color": "fontColor", + "width": "width", + "font-weight": "fontWeight", + "font-family": "fontFamily", + "font-size": "fontSize", + "text-align": "textAlign", + "border-top": "borderTop", + "border-left": "borderLeft", + "border-right": "borderRight", + "border-bottom": "borderBottom", + "padding-top": "paddingTop", + "padding-left": "paddingLeft", + "padding-right": "paddingRight", + "padding-bottom": "paddingBottom" + }; + + if (window.getComputedStyle) { + var fromStyle = window.getComputedStyle(from); + + props.forEach(function (prop) { + to.style[lookup[prop]] = fromStyle.getPropertyValue(prop); + }); + } + } +}; + +Tabulator.prototype.registerModule("export", Export); \ No newline at end of file diff --git a/website/js/vendor/tabulator/js/modules/export.min.js b/website/js/vendor/tabulator/js/modules/export.min.js new file mode 100644 index 0000000..785982a --- /dev/null +++ b/website/js/vendor/tabulator/js/modules/export.min.js @@ -0,0 +1,2 @@ +/* Tabulator v4.8.3 (c) Oliver Folkerd */ +var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ExportRow=function(t,e,o,n){this.type=t,this.columns=e,this.component=o||!1,this.indent=n||0},ExportColumn=function(t,e,o,n,r){this.value=t,this.component=e||!1,this.width=o,this.height=n,this.depth=r},Export=function(t){this.table=t,this.config={},this.cloneTableStyle=!0,this.colVisProp=""};Export.prototype.generateExportList=function(t,e,o,n){this.cloneTableStyle=e,this.config=t||{},this.colVisProp=n;var r=!1!==this.config.columnHeaders?this.headersToExportRows(this.generateColumnGroupHeaders()):[],a=this.bodyToExportRows(this.rowLookup(o));return r.concat(a)},Export.prototype.genereateTable=function(t,e,o,n){var r=this.generateExportList(t,e,o,n);return this.genereateTableElement(r)},Export.prototype.rowLookup=function(t){var e=this,o=[];if("function"==typeof t)t.call(this.table).forEach(function(t){(t=e.table.rowManager.findRow(t))&&o.push(t)});else switch(t){case!0:case"visible":o=this.table.rowManager.getVisibleRows(!0);break;case"all":o=this.table.rowManager.rows;break;case"selected":o=this.table.modules.selectRow.selectedRows;break;case"active":default:o=this.table.options.pagination?this.table.rowManager.getDisplayRows(this.table.rowManager.displayRows.length-2):this.table.rowManager.getDisplayRows()}return Object.assign([],o)},Export.prototype.generateColumnGroupHeaders=function(){var t=this,e=[];return(!1!==this.config.columnGroups?this.table.columnManager.columns:this.table.columnManager.columnsByIndex).forEach(function(o){var n=t.processColumnGroup(o);n&&e.push(n)}),e},Export.prototype.processColumnGroup=function(t){var e=this,o=t.columns,n=0,r=t.definition["title"+(this.colVisProp.charAt(0).toUpperCase()+this.colVisProp.slice(1))]||t.definition.title,a={title:r,column:t,depth:1};if(o.length){if(a.subGroups=[],a.width=0,o.forEach(function(t){var o=e.processColumnGroup(t);o&&(a.width+=o.width,a.subGroups.push(o),o.depth>n&&(n=o.depth))}),a.depth+=n,!a.width)return!1}else{if(!this.columnVisCheck(t))return!1;a.width=1}return a},Export.prototype.columnVisCheck=function(t){return!1!==t.definition[this.colVisProp]&&(t.visible||!t.visible&&t.definition[this.colVisProp])},Export.prototype.headersToExportRows=function(t){function e(t,r){var a=n-r;if(void 0===o[r]&&(o[r]=[]),t.height=t.subGroups?1:a-t.depth+1,o[r].push(t),t.height>1)for(var l=1;l1)for(var i=1;in&&(n=t.depth)}),t.forEach(function(t){e(t,0)}),o.forEach(function(t){var e=[];t.forEach(function(t){t?e.push(new ExportColumn(t.title,t.column.getComponent(),t.width,t.height,t.depth)):e.push(null)}),r.push(new ExportRow("header",e))}),r},Export.prototype.bodyToExportRows=function(t){var e=this,o=[],n=[];return this.table.columnManager.columnsByIndex.forEach(function(t){e.columnVisCheck(t)&&o.push(t.getComponent())}),!1!==this.config.columnCalcs&&this.table.modExists("columnCalcs")&&(this.table.modules.columnCalcs.topInitialized&&t.unshift(this.table.modules.columnCalcs.topRow),this.table.modules.columnCalcs.botInitialized&&t.push(this.table.modules.columnCalcs.botRow)),t=t.filter(function(t){switch(t.type){case"group":return!1!==e.config.rowGroups;case"calc":return!1!==e.config.columnCalcs;case"row":return!(e.table.options.dataTree&&!1===e.config.dataTree&&t.modules.dataTree.parent)}return!0}),t.forEach(function(t,r){var a=t.getData(e.colVisProp),l=[],i=0;switch(t.type){case"group":i=t.level,l.push(new ExportColumn(t.key,t.getComponent(),o.length,1));break;case"calc":case"row":o.forEach(function(t){l.push(new ExportColumn(t._column.getFieldValue(a),t,1,1))}),e.table.options.dataTree&&!1!==e.config.dataTree&&(i=t.modules.dataTree.index)}n.push(new ExportRow(t.type,l,t.getComponent(),i))}),n},Export.prototype.genereateTableElement=function(t){var e=this,o=document.createElement("table"),n=document.createElement("thead"),r=document.createElement("tbody"),a=this.lookupTableStyles(),l=this.table.options["rowFormatter"+(this.colVisProp.charAt(0).toUpperCase()+this.colVisProp.slice(1))],i={};return i.rowFormatter=null!==l?l:this.table.options.rowFormatter,this.table.options.dataTree&&!1!==this.config.dataTree&&this.table.modExists("columnCalcs")&&(i.treeElementField=this.table.modules.dataTree.elementField),i.groupHeader=this.table.options["groupHeader"+(this.colVisProp.charAt(0).toUpperCase()+this.colVisProp.slice(1))],i.groupHeader&&!Array.isArray(i.groupHeader)&&(i.groupHeader=[i.groupHeader]),o.classList.add("tabulator-print-table"),this.mapElementStyles(this.table.columnManager.getHeadersElement(),n,["border-top","border-left","border-right","border-bottom","background-color","color","font-weight","font-family","font-size"]),t.length>1e3&&console.warn("It may take a long time to render an HTML table with more than 1000 rows"),t.forEach(function(t,o){switch(t.type){case"header":n.appendChild(e.genereateHeaderElement(t,i,a));break;case"group":r.appendChild(e.genereateGroupElement(t,i,a));break;case"calc":r.appendChild(e.genereateCalcElement(t,i,a));break;case"row":var l=e.genereateRowElement(t,i,a);e.mapElementStyles(o%2&&a.evenRow?a.evenRow:a.oddRow,l,["border-top","border-left","border-right","border-bottom","color","font-weight","font-family","font-size","background-color"]),r.appendChild(l)}}),n.innerHTML&&o.appendChild(n),o.appendChild(r),this.mapElementStyles(this.table.element,o,["border-top","border-left","border-right","border-bottom"]),o},Export.prototype.lookupTableStyles=function(){var t={};return this.cloneTableStyle&&window.getComputedStyle&&(t.oddRow=this.table.element.querySelector(".tabulator-row-odd:not(.tabulator-group):not(.tabulator-calcs)"),t.evenRow=this.table.element.querySelector(".tabulator-row-even:not(.tabulator-group):not(.tabulator-calcs)"),t.calcRow=this.table.element.querySelector(".tabulator-row.tabulator-calcs"),t.firstRow=this.table.element.querySelector(".tabulator-row:not(.tabulator-group):not(.tabulator-calcs)"),t.firstGroup=this.table.element.getElementsByClassName("tabulator-group")[0],t.firstRow&&(t.styleCells=t.firstRow.getElementsByClassName("tabulator-cell"),t.firstCell=t.styleCells[0],t.lastCell=t.styleCells[t.styleCells.length-1])),t},Export.prototype.genereateHeaderElement=function(t,e,o){var n=this,r=document.createElement("tr");return t.columns.forEach(function(t){if(t){var e=document.createElement("th"),o=t.component._column.definition.cssClass?t.component._column.definition.cssClass.split(" "):[];e.colSpan=t.width,e.rowSpan=t.height,e.innerHTML=t.value,n.cloneTableStyle&&(e.style.boxSizing="border-box"),o.forEach(function(t){e.classList.add(t)}),n.mapElementStyles(t.component.getElement(),e,["text-align","border-top","border-left","border-right","border-bottom","background-color","color","font-weight","font-family","font-size"]),n.mapElementStyles(t.component._column.contentElement,e,["padding-top","padding-left","padding-right","padding-bottom"]),t.component._column.visible?n.mapElementStyles(t.component.getElement(),e,["width"]):t.component._column.definition.width&&(e.style.width=t.component._column.definition.width+"px"),t.component._column.parent&&n.mapElementStyles(t.component._column.parent.groupElement,e,["border-top"]),r.appendChild(e)}}),r},Export.prototype.genereateGroupElement=function(t,e,o){var n=document.createElement("tr"),r=document.createElement("td"),a=t.columns[0];return n.classList.add("tabulator-print-table-row"),e.groupHeader&&e.groupHeader[t.indent]?a.value=e.groupHeader[t.indent](a.value,t.component._group.getRowCount(),t.component._group.getData(),t.component):!1===e.groupHeader?a.value=a.value:a.value=t.component._group.generator(a.value,t.component._group.getRowCount(),t.component._group.getData(),t.component),r.colSpan=a.width,r.innerHTML=a.value,n.classList.add("tabulator-print-table-group"),n.classList.add("tabulator-group-level-"+t.indent),a.component.isVisible()&&n.classList.add("tabulator-group-visible"),this.mapElementStyles(o.firstGroup,n,["border-top","border-left","border-right","border-bottom","color","font-weight","font-family","font-size","background-color"]),this.mapElementStyles(o.firstGroup,r,["padding-top","padding-left","padding-right","padding-bottom"]),n.appendChild(r),n},Export.prototype.genereateCalcElement=function(t,e,o){var n=this.genereateRowElement(t,e,o);return n.classList.add("tabulator-print-table-calcs"),this.mapElementStyles(o.calcRow,n,["border-top","border-left","border-right","border-bottom","color","font-weight","font-family","font-size","background-color"]),n},Export.prototype.genereateRowElement=function(t,e,o){var n=this,r=document.createElement("tr");return r.classList.add("tabulator-print-table-row"),t.columns.forEach(function(a){if(a){var l=document.createElement("td"),s=a.component._column,p=a.value,c={modules:{},getValue:function(){return p},getField:function(){return s.definition.field},getElement:function(){return l},getColumn:function(){return s.getComponent()},getData:function(){return t.component.getData()},getRow:function(){return t.component},getComponent:function(){return c},column:s};if((s.definition.cssClass?s.definition.cssClass.split(" "):[]).forEach(function(t){l.classList.add(t)}),n.table.modExists("format")&&!1!==n.config.formatCells)p=n.table.modules.format.formatExportValue(c,n.colVisProp);else switch(void 0===p?"undefined":_typeof(p)){case"object":p=JSON.stringify(p);break;case"undefined":case"null":p="";break;default:p=p}p instanceof Node?l.appendChild(p):l.innerHTML=p,o.firstCell&&(n.mapElementStyles(o.firstCell,l,["padding-top","padding-left","padding-right","padding-bottom","border-top","border-left","border-right","border-bottom","color","font-weight","font-family","font-size"]),s.definition.align&&(l.style.textAlign=s.definition.align)),n.table.options.dataTree&&!1!==n.config.dataTree&&(e.treeElementField&&e.treeElementField==s.field||!e.treeElementField&&0==i)&&(t.component._row.modules.dataTree.controlEl&&l.insertBefore(t.component._row.modules.dataTree.controlEl.cloneNode(!0),l.firstChild),t.component._row.modules.dataTree.branchEl&&l.insertBefore(t.component._row.modules.dataTree.branchEl.cloneNode(!0),l.firstChild)),r.appendChild(l),c.modules.format&&c.modules.format.renderedCallback&&c.modules.format.renderedCallback(),e.rowFormatter&&!1!==n.config.formatCells&&e.rowFormatter(t.component)}}),r},Export.prototype.genereateHTMLTable=function(t){var e=document.createElement("div");return e.appendChild(this.genereateTableElement(t)),e.innerHTML},Export.prototype.getHtml=function(t,e,o,n){var r=this.generateExportList(o||this.table.options.htmlOutputConfig,e,t,n||"htmlOutput");return this.genereateHTMLTable(r)},Export.prototype.mapElementStyles=function(t,e,o){if(this.cloneTableStyle&&t&&e){var n={"background-color":"backgroundColor",color:"fontColor",width:"width","font-weight":"fontWeight","font-family":"fontFamily","font-size":"fontSize","text-align":"textAlign","border-top":"borderTop","border-left":"borderLeft","border-right":"borderRight","border-bottom":"borderBottom","padding-top":"paddingTop","padding-left":"paddingLeft","padding-right":"paddingRight","padding-bottom":"paddingBottom"};if(window.getComputedStyle){var r=window.getComputedStyle(t);o.forEach(function(t){e.style[n[t]]=r.getPropertyValue(t)})}}},Tabulator.prototype.registerModule("export",Export); \ No newline at end of file diff --git a/website/js/vendor/tabulator/js/modules/filter.js b/website/js/vendor/tabulator/js/modules/filter.js new file mode 100644 index 0000000..7173cd1 --- /dev/null +++ b/website/js/vendor/tabulator/js/modules/filter.js @@ -0,0 +1,807 @@ +var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; + +/* Tabulator v4.8.3 (c) Oliver Folkerd */ + +var Filter = function Filter(table) { + + this.table = table; //hold Tabulator object + + this.filterList = []; //hold filter list + this.headerFilters = {}; //hold column filters + this.headerFilterColumns = []; //hold columns that use header filters + + this.prevHeaderFilterChangeCheck = ""; + this.prevHeaderFilterChangeCheck = "{}"; + + this.changed = false; //has filtering changed since last render +}; + +//initialize column header filter +Filter.prototype.initializeColumn = function (column, value) { + var self = this, + field = column.getField(), + params; + + //handle successfull value change + function success(value) { + var filterType = column.modules.filter.tagType == "input" && column.modules.filter.attrType == "text" || column.modules.filter.tagType == "textarea" ? "partial" : "match", + type = "", + filterChangeCheck = "", + filterFunc; + + if (typeof column.modules.filter.prevSuccess === "undefined" || column.modules.filter.prevSuccess !== value) { + + column.modules.filter.prevSuccess = value; + + if (!column.modules.filter.emptyFunc(value)) { + column.modules.filter.value = value; + + switch (_typeof(column.definition.headerFilterFunc)) { + case "string": + if (self.filters[column.definition.headerFilterFunc]) { + type = column.definition.headerFilterFunc; + filterFunc = function filterFunc(data) { + var params = column.definition.headerFilterFuncParams || {}; + var fieldVal = column.getFieldValue(data); + + params = typeof params === "function" ? params(value, fieldVal, data) : params; + + return self.filters[column.definition.headerFilterFunc](value, fieldVal, data, params); + }; + } else { + console.warn("Header Filter Error - Matching filter function not found: ", column.definition.headerFilterFunc); + } + break; + + case "function": + filterFunc = function filterFunc(data) { + var params = column.definition.headerFilterFuncParams || {}; + var fieldVal = column.getFieldValue(data); + + params = typeof params === "function" ? params(value, fieldVal, data) : params; + + return column.definition.headerFilterFunc(value, fieldVal, data, params); + }; + + type = filterFunc; + break; + } + + if (!filterFunc) { + switch (filterType) { + case "partial": + filterFunc = function filterFunc(data) { + var colVal = column.getFieldValue(data); + + if (typeof colVal !== 'undefined' && colVal !== null) { + return String(colVal).toLowerCase().indexOf(String(value).toLowerCase()) > -1; + } else { + return false; + } + }; + type = "like"; + break; + + default: + filterFunc = function filterFunc(data) { + return column.getFieldValue(data) == value; + }; + type = "="; + } + } + + self.headerFilters[field] = { value: value, func: filterFunc, type: type, params: params || {} }; + } else { + delete self.headerFilters[field]; + } + + filterChangeCheck = JSON.stringify(self.headerFilters); + + if (self.prevHeaderFilterChangeCheck !== filterChangeCheck) { + self.prevHeaderFilterChangeCheck = filterChangeCheck; + + self.changed = true; + self.table.rowManager.filterRefresh(); + } + } + + return true; + } + + column.modules.filter = { + success: success, + attrType: false, + tagType: false, + emptyFunc: false + }; + + this.generateHeaderFilterElement(column); +}; + +Filter.prototype.generateHeaderFilterElement = function (column, initialValue, reinitialize) { + var _this = this; + + var self = this, + success = column.modules.filter.success, + field = column.getField(), + filterElement, + editor, + editorElement, + cellWrapper, + typingTimer, + searchTrigger, + params; + + //handle aborted edit + function cancel() {} + + if (column.modules.filter.headerElement && column.modules.filter.headerElement.parentNode) { + column.contentElement.removeChild(column.modules.filter.headerElement.parentNode); + } + + if (field) { + + //set empty value function + column.modules.filter.emptyFunc = column.definition.headerFilterEmptyCheck || function (value) { + return !value && value !== "0"; + }; + + filterElement = document.createElement("div"); + filterElement.classList.add("tabulator-header-filter"); + + //set column editor + switch (_typeof(column.definition.headerFilter)) { + case "string": + if (self.table.modules.edit.editors[column.definition.headerFilter]) { + editor = self.table.modules.edit.editors[column.definition.headerFilter]; + + if ((column.definition.headerFilter === "tick" || column.definition.headerFilter === "tickCross") && !column.definition.headerFilterEmptyCheck) { + column.modules.filter.emptyFunc = function (value) { + return value !== true && value !== false; + }; + } + } else { + console.warn("Filter Error - Cannot build header filter, No such editor found: ", column.definition.editor); + } + break; + + case "function": + editor = column.definition.headerFilter; + break; + + case "boolean": + if (column.modules.edit && column.modules.edit.editor) { + editor = column.modules.edit.editor; + } else { + if (column.definition.formatter && self.table.modules.edit.editors[column.definition.formatter]) { + editor = self.table.modules.edit.editors[column.definition.formatter]; + + if ((column.definition.formatter === "tick" || column.definition.formatter === "tickCross") && !column.definition.headerFilterEmptyCheck) { + column.modules.filter.emptyFunc = function (value) { + return value !== true && value !== false; + }; + } + } else { + editor = self.table.modules.edit.editors["input"]; + } + } + break; + } + + if (editor) { + + cellWrapper = { + getValue: function getValue() { + return typeof initialValue !== "undefined" ? initialValue : ""; + }, + getField: function getField() { + return column.definition.field; + }, + getElement: function getElement() { + return filterElement; + }, + getColumn: function getColumn() { + return column.getComponent(); + }, + getRow: function getRow() { + return { + normalizeHeight: function normalizeHeight() {} + }; + } + }; + + params = column.definition.headerFilterParams || {}; + + params = typeof params === "function" ? params.call(self.table) : params; + + editorElement = editor.call(this.table.modules.edit, cellWrapper, function () {}, success, cancel, params); + + if (!editorElement) { + console.warn("Filter Error - Cannot add filter to " + field + " column, editor returned a value of false"); + return; + } + + if (!(editorElement instanceof Node)) { + console.warn("Filter Error - Cannot add filter to " + field + " column, editor should return an instance of Node, the editor returned:", editorElement); + return; + } + + //set Placeholder Text + if (field) { + self.table.modules.localize.bind("headerFilters|columns|" + column.definition.field, function (value) { + editorElement.setAttribute("placeholder", typeof value !== "undefined" && value ? value : self.table.modules.localize.getText("headerFilters|default")); + }); + } else { + self.table.modules.localize.bind("headerFilters|default", function (value) { + editorElement.setAttribute("placeholder", typeof self.column.definition.headerFilterPlaceholder !== "undefined" && self.column.definition.headerFilterPlaceholder ? self.column.definition.headerFilterPlaceholder : value); + }); + } + + //focus on element on click + editorElement.addEventListener("click", function (e) { + e.stopPropagation(); + editorElement.focus(); + }); + + editorElement.addEventListener("focus", function (e) { + var left = _this.table.columnManager.element.scrollLeft; + + if (left !== _this.table.rowManager.element.scrollLeft) { + _this.table.rowManager.scrollHorizontal(left); + _this.table.columnManager.scrollHorizontal(left); + } + }); + + //live update filters as user types + typingTimer = false; + + searchTrigger = function searchTrigger(e) { + if (typingTimer) { + clearTimeout(typingTimer); + } + + typingTimer = setTimeout(function () { + success(editorElement.value); + }, self.table.options.headerFilterLiveFilterDelay); + }; + + column.modules.filter.headerElement = editorElement; + column.modules.filter.attrType = editorElement.hasAttribute("type") ? editorElement.getAttribute("type").toLowerCase() : ""; + column.modules.filter.tagType = editorElement.tagName.toLowerCase(); + + if (column.definition.headerFilterLiveFilter !== false) { + + if (!(column.definition.headerFilter === 'autocomplete' || column.definition.headerFilter === 'tickCross' || (column.definition.editor === 'autocomplete' || column.definition.editor === 'tickCross') && column.definition.headerFilter === true)) { + editorElement.addEventListener("keyup", searchTrigger); + editorElement.addEventListener("search", searchTrigger); + + //update number filtered columns on change + if (column.modules.filter.attrType == "number") { + editorElement.addEventListener("change", function (e) { + success(editorElement.value); + }); + } + + //change text inputs to search inputs to allow for clearing of field + if (column.modules.filter.attrType == "text" && this.table.browser !== "ie") { + editorElement.setAttribute("type", "search"); + // editorElement.off("change blur"); //prevent blur from triggering filter and preventing selection click + } + } + + //prevent input and select elements from propegating click to column sorters etc + if (column.modules.filter.tagType == "input" || column.modules.filter.tagType == "select" || column.modules.filter.tagType == "textarea") { + editorElement.addEventListener("mousedown", function (e) { + e.stopPropagation(); + }); + } + } + + filterElement.appendChild(editorElement); + + column.contentElement.appendChild(filterElement); + + if (!reinitialize) { + self.headerFilterColumns.push(column); + } + } + } else { + console.warn("Filter Error - Cannot add header filter, column has no field set:", column.definition.title); + } +}; + +//hide all header filter elements (used to ensure correct column widths in "fitData" layout mode) +Filter.prototype.hideHeaderFilterElements = function () { + this.headerFilterColumns.forEach(function (column) { + if (column.modules.filter && column.modules.filter.headerElement) { + column.modules.filter.headerElement.style.display = 'none'; + } + }); +}; + +//show all header filter elements (used to ensure correct column widths in "fitData" layout mode) +Filter.prototype.showHeaderFilterElements = function () { + this.headerFilterColumns.forEach(function (column) { + if (column.modules.filter && column.modules.filter.headerElement) { + column.modules.filter.headerElement.style.display = ''; + } + }); +}; + +//programatically set focus of header filter +Filter.prototype.setHeaderFilterFocus = function (column) { + if (column.modules.filter && column.modules.filter.headerElement) { + column.modules.filter.headerElement.focus(); + } else { + console.warn("Column Filter Focus Error - No header filter set on column:", column.getField()); + } +}; + +//programmatically get value of header filter +Filter.prototype.getHeaderFilterValue = function (column) { + if (column.modules.filter && column.modules.filter.headerElement) { + return column.modules.filter.headerElement.value; + } else { + console.warn("Column Filter Error - No header filter set on column:", column.getField()); + } +}; + +//programatically set value of header filter +Filter.prototype.setHeaderFilterValue = function (column, value) { + if (column) { + if (column.modules.filter && column.modules.filter.headerElement) { + this.generateHeaderFilterElement(column, value, true); + column.modules.filter.success(value); + } else { + console.warn("Column Filter Error - No header filter set on column:", column.getField()); + } + } +}; + +Filter.prototype.reloadHeaderFilter = function (column) { + if (column) { + if (column.modules.filter && column.modules.filter.headerElement) { + this.generateHeaderFilterElement(column, column.modules.filter.value, true); + } else { + console.warn("Column Filter Error - No header filter set on column:", column.getField()); + } + } +}; + +//check if the filters has changed since last use +Filter.prototype.hasChanged = function () { + var changed = this.changed; + this.changed = false; + return changed; +}; + +//set standard filters +Filter.prototype.setFilter = function (field, type, value, params) { + var self = this; + + self.filterList = []; + + if (!Array.isArray(field)) { + field = [{ field: field, type: type, value: value, params: params }]; + } + + self.addFilter(field); +}; + +//add filter to array +Filter.prototype.addFilter = function (field, type, value, params) { + var self = this; + + if (!Array.isArray(field)) { + field = [{ field: field, type: type, value: value, params: params }]; + } + + field.forEach(function (filter) { + + filter = self.findFilter(filter); + + if (filter) { + self.filterList.push(filter); + + self.changed = true; + } + }); + + if (this.table.options.persistence && this.table.modExists("persistence", true) && this.table.modules.persistence.config.filter) { + this.table.modules.persistence.save("filter"); + } +}; + +Filter.prototype.findFilter = function (filter) { + var self = this, + column; + + if (Array.isArray(filter)) { + return this.findSubFilters(filter); + } + + var filterFunc = false; + + if (typeof filter.field == "function") { + filterFunc = function filterFunc(data) { + return filter.field(data, filter.type || {}); // pass params to custom filter function + }; + } else { + + if (self.filters[filter.type]) { + + column = self.table.columnManager.getColumnByField(filter.field); + + if (column) { + filterFunc = function filterFunc(data) { + return self.filters[filter.type](filter.value, column.getFieldValue(data), data, filter.params || {}); + }; + } else { + filterFunc = function filterFunc(data) { + return self.filters[filter.type](filter.value, data[filter.field], data, filter.params || {}); + }; + } + } else { + console.warn("Filter Error - No such filter type found, ignoring: ", filter.type); + } + } + + filter.func = filterFunc; + + return filter.func ? filter : false; +}; + +Filter.prototype.findSubFilters = function (filters) { + var self = this, + output = []; + + filters.forEach(function (filter) { + filter = self.findFilter(filter); + + if (filter) { + output.push(filter); + } + }); + + return output.length ? output : false; +}; + +//get all filters +Filter.prototype.getFilters = function (all, ajax) { + var output = []; + + if (all) { + output = this.getHeaderFilters(); + } + + if (ajax) { + output.forEach(function (item) { + if (typeof item.type == "function") { + item.type = "function"; + } + }); + } + + output = output.concat(this.filtersToArray(this.filterList, ajax)); + + return output; +}; + +//filter to Object +Filter.prototype.filtersToArray = function (filterList, ajax) { + var _this2 = this; + + var output = []; + + filterList.forEach(function (filter) { + var item; + + if (Array.isArray(filter)) { + output.push(_this2.filtersToArray(filter, ajax)); + } else { + item = { field: filter.field, type: filter.type, value: filter.value }; + + if (ajax) { + if (typeof item.type == "function") { + item.type = "function"; + } + } + + output.push(item); + } + }); + + return output; +}; + +//get all filters +Filter.prototype.getHeaderFilters = function () { + var self = this, + output = []; + + for (var key in this.headerFilters) { + output.push({ field: key, type: this.headerFilters[key].type, value: this.headerFilters[key].value }); + } + + return output; +}; + +//remove filter from array +Filter.prototype.removeFilter = function (field, type, value) { + var self = this; + + if (!Array.isArray(field)) { + field = [{ field: field, type: type, value: value }]; + } + + field.forEach(function (filter) { + var index = -1; + + if (_typeof(filter.field) == "object") { + index = self.filterList.findIndex(function (element) { + return filter === element; + }); + } else { + index = self.filterList.findIndex(function (element) { + return filter.field === element.field && filter.type === element.type && filter.value === element.value; + }); + } + + if (index > -1) { + self.filterList.splice(index, 1); + self.changed = true; + } else { + console.warn("Filter Error - No matching filter type found, ignoring: ", filter.type); + } + }); + + if (this.table.options.persistence && this.table.modExists("persistence", true) && this.table.modules.persistence.config.filter) { + this.table.modules.persistence.save("filter"); + } +}; + +//clear filters +Filter.prototype.clearFilter = function (all) { + this.filterList = []; + + if (all) { + this.clearHeaderFilter(); + } + + this.changed = true; + + if (this.table.options.persistence && this.table.modExists("persistence", true) && this.table.modules.persistence.config.filter) { + this.table.modules.persistence.save("filter"); + } +}; + +//clear header filters +Filter.prototype.clearHeaderFilter = function () { + var self = this; + + this.headerFilters = {}; + self.prevHeaderFilterChangeCheck = "{}"; + + this.headerFilterColumns.forEach(function (column) { + column.modules.filter.value = null; + column.modules.filter.prevSuccess = undefined; + self.reloadHeaderFilter(column); + }); + + this.changed = true; +}; + +//search data and return matching rows +Filter.prototype.search = function (searchType, field, type, value) { + var self = this, + activeRows = [], + filterList = []; + + if (!Array.isArray(field)) { + field = [{ field: field, type: type, value: value }]; + } + + field.forEach(function (filter) { + filter = self.findFilter(filter); + + if (filter) { + filterList.push(filter); + } + }); + + this.table.rowManager.rows.forEach(function (row) { + var match = true; + + filterList.forEach(function (filter) { + if (!self.filterRecurse(filter, row.getData())) { + match = false; + } + }); + + if (match) { + activeRows.push(searchType === "data" ? row.getData("data") : row.getComponent()); + } + }); + + return activeRows; +}; + +//filter row array +Filter.prototype.filter = function (rowList, filters) { + var self = this, + activeRows = [], + activeRowComponents = []; + + if (self.table.options.dataFiltering) { + self.table.options.dataFiltering.call(self.table, self.getFilters()); + } + + if (!self.table.options.ajaxFiltering && (self.filterList.length || Object.keys(self.headerFilters).length)) { + + rowList.forEach(function (row) { + if (self.filterRow(row)) { + activeRows.push(row); + } + }); + } else { + activeRows = rowList.slice(0); + } + + if (self.table.options.dataFiltered) { + + activeRows.forEach(function (row) { + activeRowComponents.push(row.getComponent()); + }); + + self.table.options.dataFiltered.call(self.table, self.getFilters(), activeRowComponents); + } + + return activeRows; +}; + +//filter individual row +Filter.prototype.filterRow = function (row, filters) { + var self = this, + match = true, + data = row.getData(); + + self.filterList.forEach(function (filter) { + if (!self.filterRecurse(filter, data)) { + match = false; + } + }); + + for (var field in self.headerFilters) { + if (!self.headerFilters[field].func(data)) { + match = false; + } + } + + return match; +}; + +Filter.prototype.filterRecurse = function (filter, data) { + var self = this, + match = false; + + if (Array.isArray(filter)) { + filter.forEach(function (subFilter) { + if (self.filterRecurse(subFilter, data)) { + match = true; + } + }); + } else { + match = filter.func(data); + } + + return match; +}; + +//list of available filters +Filter.prototype.filters = { + + //equal to + "=": function _(filterVal, rowVal, rowData, filterParams) { + return rowVal == filterVal ? true : false; + }, + + //less than + "<": function _(filterVal, rowVal, rowData, filterParams) { + return rowVal < filterVal ? true : false; + }, + + //less than or equal to + "<=": function _(filterVal, rowVal, rowData, filterParams) { + return rowVal <= filterVal ? true : false; + }, + + //greater than + ">": function _(filterVal, rowVal, rowData, filterParams) { + return rowVal > filterVal ? true : false; + }, + + //greater than or equal to + ">=": function _(filterVal, rowVal, rowData, filterParams) { + return rowVal >= filterVal ? true : false; + }, + + //not equal to + "!=": function _(filterVal, rowVal, rowData, filterParams) { + return rowVal != filterVal ? true : false; + }, + + "regex": function regex(filterVal, rowVal, rowData, filterParams) { + + if (typeof filterVal == "string") { + filterVal = new RegExp(filterVal); + } + + return filterVal.test(rowVal); + }, + + //contains the string + "like": function like(filterVal, rowVal, rowData, filterParams) { + if (filterVal === null || typeof filterVal === "undefined") { + return rowVal === filterVal ? true : false; + } else { + if (typeof rowVal !== 'undefined' && rowVal !== null) { + return String(rowVal).toLowerCase().indexOf(filterVal.toLowerCase()) > -1; + } else { + return false; + } + } + }, + + //contains the keywords + "keywords": function keywords(filterVal, rowVal, rowData, filterParams) { + var keywords = filterVal.toLowerCase().split(typeof filterParams.separator === "undefined" ? " " : filterParams.separator), + value = String(rowVal === null || typeof rowVal === "undefined" ? "" : rowVal).toLowerCase(), + matches = []; + + keywords.forEach(function (keyword) { + if (value.includes(keyword)) { + matches.push(true); + } + }); + + return filterParams.matchAll ? matches.length === keywords.length : !!matches.length; + }, + + //starts with the string + "starts": function starts(filterVal, rowVal, rowData, filterParams) { + if (filterVal === null || typeof filterVal === "undefined") { + return rowVal === filterVal ? true : false; + } else { + if (typeof rowVal !== 'undefined' && rowVal !== null) { + return String(rowVal).toLowerCase().startsWith(filterVal.toLowerCase()); + } else { + return false; + } + } + }, + + //ends with the string + "ends": function ends(filterVal, rowVal, rowData, filterParams) { + if (filterVal === null || typeof filterVal === "undefined") { + return rowVal === filterVal ? true : false; + } else { + if (typeof rowVal !== 'undefined' && rowVal !== null) { + return String(rowVal).toLowerCase().endsWith(filterVal.toLowerCase()); + } else { + return false; + } + } + }, + + //in array + "in": function _in(filterVal, rowVal, rowData, filterParams) { + if (Array.isArray(filterVal)) { + return filterVal.length ? filterVal.indexOf(rowVal) > -1 : true; + } else { + console.warn("Filter Error - filter value is not an array:", filterVal); + return false; + } + } +}; + +Tabulator.prototype.registerModule("filter", Filter); \ No newline at end of file diff --git a/website/js/vendor/tabulator/js/modules/filter.min.js b/website/js/vendor/tabulator/js/modules/filter.min.js new file mode 100644 index 0000000..eace11d --- /dev/null +++ b/website/js/vendor/tabulator/js/modules/filter.min.js @@ -0,0 +1,2 @@ +/* Tabulator v4.8.3 (c) Oliver Folkerd */ +var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Filter=function(e){this.table=e,this.filterList=[],this.headerFilters={},this.headerFilterColumns=[],this.prevHeaderFilterChangeCheck="",this.prevHeaderFilterChangeCheck="{}",this.changed=!1};Filter.prototype.initializeColumn=function(e,t){function r(t){var r,o="input"==e.modules.filter.tagType&&"text"==e.modules.filter.attrType||"textarea"==e.modules.filter.tagType?"partial":"match",a="",s="";if(void 0===e.modules.filter.prevSuccess||e.modules.filter.prevSuccess!==t){if(e.modules.filter.prevSuccess=t,e.modules.filter.emptyFunc(t))delete n.headerFilters[l];else{switch(e.modules.filter.value=t,_typeof(e.definition.headerFilterFunc)){case"string":n.filters[e.definition.headerFilterFunc]?(a=e.definition.headerFilterFunc,r=function(r){var i=e.definition.headerFilterFuncParams||{},l=e.getFieldValue(r);return i="function"==typeof i?i(t,l,r):i,n.filters[e.definition.headerFilterFunc](t,l,r,i)}):console.warn("Header Filter Error - Matching filter function not found: ",e.definition.headerFilterFunc);break;case"function":r=function(r){var i=e.definition.headerFilterFuncParams||{},n=e.getFieldValue(r);return i="function"==typeof i?i(t,n,r):i,e.definition.headerFilterFunc(t,n,r,i)},a=r}if(!r)switch(o){case"partial":r=function(r){var i=e.getFieldValue(r);return void 0!==i&&null!==i&&String(i).toLowerCase().indexOf(String(t).toLowerCase())>-1},a="like";break;default:r=function(r){return e.getFieldValue(r)==t},a="="}n.headerFilters[l]={value:t,func:r,type:a,params:i||{}}}s=JSON.stringify(n.headerFilters),n.prevHeaderFilterChangeCheck!==s&&(n.prevHeaderFilterChangeCheck=s,n.changed=!0,n.table.rowManager.filterRefresh())}return!0}var i,n=this,l=e.getField();e.modules.filter={success:r,attrType:!1,tagType:!1,emptyFunc:!1},this.generateHeaderFilterElement(e)},Filter.prototype.generateHeaderFilterElement=function(e,t,r){function i(){}var n,l,o,a,s,d,u,f=this,c=this,h=e.modules.filter.success,p=e.getField();if(e.modules.filter.headerElement&&e.modules.filter.headerElement.parentNode&&e.contentElement.removeChild(e.modules.filter.headerElement.parentNode),p){switch(e.modules.filter.emptyFunc=e.definition.headerFilterEmptyCheck||function(e){return!e&&"0"!==e},n=document.createElement("div"),n.classList.add("tabulator-header-filter"),_typeof(e.definition.headerFilter)){case"string":c.table.modules.edit.editors[e.definition.headerFilter]?(l=c.table.modules.edit.editors[e.definition.headerFilter],"tick"!==e.definition.headerFilter&&"tickCross"!==e.definition.headerFilter||e.definition.headerFilterEmptyCheck||(e.modules.filter.emptyFunc=function(e){return!0!==e&&!1!==e})):console.warn("Filter Error - Cannot build header filter, No such editor found: ",e.definition.editor);break;case"function":l=e.definition.headerFilter;break;case"boolean":e.modules.edit&&e.modules.edit.editor?l=e.modules.edit.editor:e.definition.formatter&&c.table.modules.edit.editors[e.definition.formatter]?(l=c.table.modules.edit.editors[e.definition.formatter],"tick"!==e.definition.formatter&&"tickCross"!==e.definition.formatter||e.definition.headerFilterEmptyCheck||(e.modules.filter.emptyFunc=function(e){return!0!==e&&!1!==e})):l=c.table.modules.edit.editors.input}if(l){if(a={getValue:function(){return void 0!==t?t:""},getField:function(){return e.definition.field},getElement:function(){return n},getColumn:function(){return e.getComponent()},getRow:function(){return{normalizeHeight:function(){}}}},u=e.definition.headerFilterParams||{},u="function"==typeof u?u.call(c.table):u,!(o=l.call(this.table.modules.edit,a,function(){},h,i,u)))return void console.warn("Filter Error - Cannot add filter to "+p+" column, editor returned a value of false");if(!(o instanceof Node))return void console.warn("Filter Error - Cannot add filter to "+p+" column, editor should return an instance of Node, the editor returned:",o);p?c.table.modules.localize.bind("headerFilters|columns|"+e.definition.field,function(e){o.setAttribute("placeholder",void 0!==e&&e?e:c.table.modules.localize.getText("headerFilters|default"))}):c.table.modules.localize.bind("headerFilters|default",function(e){o.setAttribute("placeholder",void 0!==c.column.definition.headerFilterPlaceholder&&c.column.definition.headerFilterPlaceholder?c.column.definition.headerFilterPlaceholder:e)}),o.addEventListener("click",function(e){e.stopPropagation(),o.focus()}),o.addEventListener("focus",function(e){var t=f.table.columnManager.element.scrollLeft;t!==f.table.rowManager.element.scrollLeft&&(f.table.rowManager.scrollHorizontal(t),f.table.columnManager.scrollHorizontal(t))}),s=!1,d=function(e){s&&clearTimeout(s),s=setTimeout(function(){h(o.value)},c.table.options.headerFilterLiveFilterDelay)},e.modules.filter.headerElement=o,e.modules.filter.attrType=o.hasAttribute("type")?o.getAttribute("type").toLowerCase():"",e.modules.filter.tagType=o.tagName.toLowerCase(),!1!==e.definition.headerFilterLiveFilter&&("autocomplete"!==e.definition.headerFilter&&"tickCross"!==e.definition.headerFilter&&("autocomplete"!==e.definition.editor&&"tickCross"!==e.definition.editor||!0!==e.definition.headerFilter)&&(o.addEventListener("keyup",d),o.addEventListener("search",d),"number"==e.modules.filter.attrType&&o.addEventListener("change",function(e){h(o.value)}),"text"==e.modules.filter.attrType&&"ie"!==this.table.browser&&o.setAttribute("type","search")),"input"!=e.modules.filter.tagType&&"select"!=e.modules.filter.tagType&&"textarea"!=e.modules.filter.tagType||o.addEventListener("mousedown",function(e){e.stopPropagation()})),n.appendChild(o),e.contentElement.appendChild(n),r||c.headerFilterColumns.push(e)}}else console.warn("Filter Error - Cannot add header filter, column has no field set:",e.definition.title)},Filter.prototype.hideHeaderFilterElements=function(){this.headerFilterColumns.forEach(function(e){e.modules.filter&&e.modules.filter.headerElement&&(e.modules.filter.headerElement.style.display="none")})},Filter.prototype.showHeaderFilterElements=function(){this.headerFilterColumns.forEach(function(e){e.modules.filter&&e.modules.filter.headerElement&&(e.modules.filter.headerElement.style.display="")})},Filter.prototype.setHeaderFilterFocus=function(e){e.modules.filter&&e.modules.filter.headerElement?e.modules.filter.headerElement.focus():console.warn("Column Filter Focus Error - No header filter set on column:",e.getField())},Filter.prototype.getHeaderFilterValue=function(e){if(e.modules.filter&&e.modules.filter.headerElement)return e.modules.filter.headerElement.value;console.warn("Column Filter Error - No header filter set on column:",e.getField())},Filter.prototype.setHeaderFilterValue=function(e,t){e&&(e.modules.filter&&e.modules.filter.headerElement?(this.generateHeaderFilterElement(e,t,!0),e.modules.filter.success(t)):console.warn("Column Filter Error - No header filter set on column:",e.getField()))},Filter.prototype.reloadHeaderFilter=function(e){e&&(e.modules.filter&&e.modules.filter.headerElement?this.generateHeaderFilterElement(e,e.modules.filter.value,!0):console.warn("Column Filter Error - No header filter set on column:",e.getField()))},Filter.prototype.hasChanged=function(){var e=this.changed;return this.changed=!1,e},Filter.prototype.setFilter=function(e,t,r,i){var n=this;n.filterList=[],Array.isArray(e)||(e=[{field:e,type:t,value:r,params:i}]),n.addFilter(e)},Filter.prototype.addFilter=function(e,t,r,i){var n=this;Array.isArray(e)||(e=[{field:e,type:t,value:r,params:i}]),e.forEach(function(e){(e=n.findFilter(e))&&(n.filterList.push(e),n.changed=!0)}),this.table.options.persistence&&this.table.modExists("persistence",!0)&&this.table.modules.persistence.config.filter&&this.table.modules.persistence.save("filter")},Filter.prototype.findFilter=function(e){var t,r=this;if(Array.isArray(e))return this.findSubFilters(e);var i=!1;return"function"==typeof e.field?i=function(t){return e.field(t,e.type||{})}:r.filters[e.type]?(t=r.table.columnManager.getColumnByField(e.field),i=t?function(i){return r.filters[e.type](e.value,t.getFieldValue(i),i,e.params||{})}:function(t){return r.filters[e.type](e.value,t[e.field],t,e.params||{})}):console.warn("Filter Error - No such filter type found, ignoring: ",e.type),e.func=i,!!e.func&&e},Filter.prototype.findSubFilters=function(e){var t=this,r=[];return e.forEach(function(e){(e=t.findFilter(e))&&r.push(e)}),!!r.length&&r},Filter.prototype.getFilters=function(e,t){var r=[];return e&&(r=this.getHeaderFilters()),t&&r.forEach(function(e){"function"==typeof e.type&&(e.type="function")}),r=r.concat(this.filtersToArray(this.filterList,t))},Filter.prototype.filtersToArray=function(e,t){var r=this,i=[];return e.forEach(function(e){var n;Array.isArray(e)?i.push(r.filtersToArray(e,t)):(n={field:e.field,type:e.type,value:e.value},t&&"function"==typeof n.type&&(n.type="function"),i.push(n))}),i},Filter.prototype.getHeaderFilters=function(){var e=[];for(var t in this.headerFilters)e.push({field:t,type:this.headerFilters[t].type,value:this.headerFilters[t].value});return e},Filter.prototype.removeFilter=function(e,t,r){var i=this;Array.isArray(e)||(e=[{field:e,type:t,value:r}]),e.forEach(function(e){var t=-1;t="object"==_typeof(e.field)?i.filterList.findIndex(function(t){return e===t}):i.filterList.findIndex(function(t){return e.field===t.field&&e.type===t.type&&e.value===t.value}),t>-1?(i.filterList.splice(t,1),i.changed=!0):console.warn("Filter Error - No matching filter type found, ignoring: ",e.type)}),this.table.options.persistence&&this.table.modExists("persistence",!0)&&this.table.modules.persistence.config.filter&&this.table.modules.persistence.save("filter")},Filter.prototype.clearFilter=function(e){this.filterList=[],e&&this.clearHeaderFilter(),this.changed=!0,this.table.options.persistence&&this.table.modExists("persistence",!0)&&this.table.modules.persistence.config.filter&&this.table.modules.persistence.save("filter")},Filter.prototype.clearHeaderFilter=function(){var e=this;this.headerFilters={},e.prevHeaderFilterChangeCheck="{}",this.headerFilterColumns.forEach(function(t){t.modules.filter.value=null,t.modules.filter.prevSuccess=void 0,e.reloadHeaderFilter(t)}),this.changed=!0},Filter.prototype.search=function(e,t,r,i){var n=this,l=[],o=[];return Array.isArray(t)||(t=[{field:t,type:r,value:i}]),t.forEach(function(e){(e=n.findFilter(e))&&o.push(e)}),this.table.rowManager.rows.forEach(function(t){var r=!0;o.forEach(function(e){n.filterRecurse(e,t.getData())||(r=!1)}),r&&l.push("data"===e?t.getData("data"):t.getComponent())}),l},Filter.prototype.filter=function(e,t){var r=this,i=[],n=[];return r.table.options.dataFiltering&&r.table.options.dataFiltering.call(r.table,r.getFilters()),r.table.options.ajaxFiltering||!r.filterList.length&&!Object.keys(r.headerFilters).length?i=e.slice(0):e.forEach(function(e){r.filterRow(e)&&i.push(e)}),r.table.options.dataFiltered&&(i.forEach(function(e){n.push(e.getComponent())}),r.table.options.dataFiltered.call(r.table,r.getFilters(),n)),i},Filter.prototype.filterRow=function(e,t){var r=this,i=!0,n=e.getData();r.filterList.forEach(function(e){r.filterRecurse(e,n)||(i=!1)});for(var l in r.headerFilters)r.headerFilters[l].func(n)||(i=!1);return i},Filter.prototype.filterRecurse=function(e,t){var r=this,i=!1;return Array.isArray(e)?e.forEach(function(e){r.filterRecurse(e,t)&&(i=!0)}):i=e.func(t),i},Filter.prototype.filters={"=":function(e,t,r,i){return t==e},"<":function(e,t,r,i){return t":function(e,t,r,i){return t>e},">=":function(e,t,r,i){return t>=e},"!=":function(e,t,r,i){return t!=e},regex:function(e,t,r,i){return"string"==typeof e&&(e=new RegExp(e)),e.test(t)},like:function(e,t,r,i){return null===e||void 0===e?t===e:void 0!==t&&null!==t&&String(t).toLowerCase().indexOf(e.toLowerCase())>-1},keywords:function(e,t,r,i){var n=e.toLowerCase().split(void 0===i.separator?" ":i.separator),l=String(null===t||void 0===t?"":t).toLowerCase(),o=[];return n.forEach(function(e){l.includes(e)&&o.push(!0)}),i.matchAll?o.length===n.length:!!o.length},starts:function(e,t,r,i){return null===e||void 0===e?t===e:void 0!==t&&null!==t&&String(t).toLowerCase().startsWith(e.toLowerCase())},ends:function(e,t,r,i){return null===e||void 0===e?t===e:void 0!==t&&null!==t&&String(t).toLowerCase().endsWith(e.toLowerCase())},in:function(e,t,r,i){return Array.isArray(e)?!e.length||e.indexOf(t)>-1:(console.warn("Filter Error - filter value is not an array:",e),!1)}},Tabulator.prototype.registerModule("filter",Filter); \ No newline at end of file diff --git a/website/js/vendor/tabulator/js/modules/format.js b/website/js/vendor/tabulator/js/modules/format.js new file mode 100644 index 0000000..8c77ec2 --- /dev/null +++ b/website/js/vendor/tabulator/js/modules/format.js @@ -0,0 +1,733 @@ +var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; + +/* Tabulator v4.8.3 (c) Oliver Folkerd */ + +var Format = function Format(table) { + this.table = table; //hold Tabulator object +}; + +//initialize column formatter +Format.prototype.initializeColumn = function (column) { + column.modules.format = this.lookupFormatter(column, ""); + + if (typeof column.definition.formatterPrint !== "undefined") { + column.modules.format.print = this.lookupFormatter(column, "Print"); + } + + if (typeof column.definition.formatterClipboard !== "undefined") { + column.modules.format.clipboard = this.lookupFormatter(column, "Clipboard"); + } + + if (typeof column.definition.formatterHtmlOutput !== "undefined") { + column.modules.format.htmlOutput = this.lookupFormatter(column, "HtmlOutput"); + } +}; + +Format.prototype.lookupFormatter = function (column, type) { + var config = { params: column.definition["formatter" + type + "Params"] || {} }, + formatter = column.definition["formatter" + type]; + + //set column formatter + switch (typeof formatter === "undefined" ? "undefined" : _typeof(formatter)) { + case "string": + + if (formatter === "tick") { + formatter = "tickCross"; + + if (typeof config.params.crossElement == "undefined") { + config.params.crossElement = false; + } + + console.warn("DEPRECATION WARNING - the tick formatter has been deprecated, please use the tickCross formatter with the crossElement param set to false"); + } + + if (this.formatters[formatter]) { + config.formatter = this.formatters[formatter]; + } else { + console.warn("Formatter Error - No such formatter found: ", formatter); + config.formatter = this.formatters.plaintext; + } + break; + + case "function": + config.formatter = formatter; + break; + + default: + config.formatter = this.formatters.plaintext; + break; + } + + return config; +}; + +Format.prototype.cellRendered = function (cell) { + if (cell.modules.format && cell.modules.format.renderedCallback && !cell.modules.format.rendered) { + cell.modules.format.renderedCallback(); + cell.modules.format.rendered = true; + } +}; + +//return a formatted value for a cell +Format.prototype.formatValue = function (cell) { + var component = cell.getComponent(), + params = typeof cell.column.modules.format.params === "function" ? cell.column.modules.format.params(component) : cell.column.modules.format.params; + + function onRendered(callback) { + if (!cell.modules.format) { + cell.modules.format = {}; + } + + cell.modules.format.renderedCallback = callback; + cell.modules.format.rendered = false; + } + + return cell.column.modules.format.formatter.call(this, component, params, onRendered); +}; + +Format.prototype.formatExportValue = function (cell, type) { + var formatter = cell.column.modules.format[type], + params; + + if (formatter) { + var onRendered = function onRendered(callback) { + if (!cell.modules.format) { + cell.modules.format = {}; + } + + cell.modules.format.renderedCallback = callback; + cell.modules.format.rendered = false; + }; + + params = typeof formatter.params === "function" ? formatter.params(component) : formatter.params; + + return formatter.formatter.call(this, cell.getComponent(), params, onRendered); + } else { + return this.formatValue(cell); + } +}; + +Format.prototype.sanitizeHTML = function (value) { + if (value) { + var entityMap = { + '&': '&', + '<': '<', + '>': '>', + '"': '"', + "'": ''', + '/': '/', + '`': '`', + '=': '=' + }; + + return String(value).replace(/[&<>"'`=\/]/g, function (s) { + return entityMap[s]; + }); + } else { + return value; + } +}; + +Format.prototype.emptyToSpace = function (value) { + return value === null || typeof value === "undefined" || value === "" ? " " : value; +}; + +//get formatter for cell +Format.prototype.getFormatter = function (formatter) { + var formatter; + + switch (typeof formatter === "undefined" ? "undefined" : _typeof(formatter)) { + case "string": + if (this.formatters[formatter]) { + formatter = this.formatters[formatter]; + } else { + console.warn("Formatter Error - No such formatter found: ", formatter); + formatter = this.formatters.plaintext; + } + break; + + case "function": + formatter = formatter; + break; + + default: + formatter = this.formatters.plaintext; + break; + } + + return formatter; +}; + +//default data formatters +Format.prototype.formatters = { + //plain text value + plaintext: function plaintext(cell, formatterParams, onRendered) { + return this.emptyToSpace(this.sanitizeHTML(cell.getValue())); + }, + + //html text value + html: function html(cell, formatterParams, onRendered) { + return cell.getValue(); + }, + + //multiline text area + textarea: function textarea(cell, formatterParams, onRendered) { + cell.getElement().style.whiteSpace = "pre-wrap"; + return this.emptyToSpace(this.sanitizeHTML(cell.getValue())); + }, + + //currency formatting + money: function money(cell, formatterParams, onRendered) { + var floatVal = parseFloat(cell.getValue()), + number, + integer, + decimal, + rgx; + + var decimalSym = formatterParams.decimal || "."; + var thousandSym = formatterParams.thousand || ","; + var symbol = formatterParams.symbol || ""; + var after = !!formatterParams.symbolAfter; + var precision = typeof formatterParams.precision !== "undefined" ? formatterParams.precision : 2; + + if (isNaN(floatVal)) { + return this.emptyToSpace(this.sanitizeHTML(cell.getValue())); + } + + number = precision !== false ? floatVal.toFixed(precision) : floatVal; + number = String(number).split("."); + + integer = number[0]; + decimal = number.length > 1 ? decimalSym + number[1] : ""; + + rgx = /(\d+)(\d{3})/; + + while (rgx.test(integer)) { + integer = integer.replace(rgx, "$1" + thousandSym + "$2"); + } + + return after ? integer + decimal + symbol : symbol + integer + decimal; + }, + + //clickable anchor tag + link: function link(cell, formatterParams, onRendered) { + var value = cell.getValue(), + urlPrefix = formatterParams.urlPrefix || "", + download = formatterParams.download, + label = value, + el = document.createElement("a"), + data; + + if (formatterParams.labelField) { + data = cell.getData(); + label = data[formatterParams.labelField]; + } + + if (formatterParams.label) { + switch (_typeof(formatterParams.label)) { + case "string": + label = formatterParams.label; + break; + + case "function": + label = formatterParams.label(cell); + break; + } + } + + if (label) { + if (formatterParams.urlField) { + data = cell.getData(); + value = data[formatterParams.urlField]; + } + + if (formatterParams.url) { + switch (_typeof(formatterParams.url)) { + case "string": + value = formatterParams.url; + break; + + case "function": + value = formatterParams.url(cell); + break; + } + } + + el.setAttribute("href", urlPrefix + value); + + if (formatterParams.target) { + el.setAttribute("target", formatterParams.target); + } + + if (formatterParams.download) { + + if (typeof download == "function") { + download = download(cell); + } else { + download = download === true ? "" : download; + } + + el.setAttribute("download", download); + } + + el.innerHTML = this.emptyToSpace(this.sanitizeHTML(label)); + + return el; + } else { + return " "; + } + }, + + //image element + image: function image(cell, formatterParams, onRendered) { + var el = document.createElement("img"); + el.setAttribute("src", cell.getValue()); + + switch (_typeof(formatterParams.height)) { + case "number": + el.style.height = formatterParams.height + "px"; + break; + + case "string": + el.style.height = formatterParams.height; + break; + } + + switch (_typeof(formatterParams.width)) { + case "number": + el.style.width = formatterParams.width + "px"; + break; + + case "string": + el.style.width = formatterParams.width; + break; + } + + el.addEventListener("load", function () { + cell.getRow().normalizeHeight(); + }); + + return el; + }, + + //tick or cross + tickCross: function tickCross(cell, formatterParams, onRendered) { + var value = cell.getValue(), + element = cell.getElement(), + empty = formatterParams.allowEmpty, + truthy = formatterParams.allowTruthy, + tick = typeof formatterParams.tickElement !== "undefined" ? formatterParams.tickElement : '', + cross = typeof formatterParams.crossElement !== "undefined" ? formatterParams.crossElement : ''; + + if (truthy && value || value === true || value === "true" || value === "True" || value === 1 || value === "1") { + element.setAttribute("aria-checked", true); + return tick || ""; + } else { + if (empty && (value === "null" || value === "" || value === null || typeof value === "undefined")) { + element.setAttribute("aria-checked", "mixed"); + return ""; + } else { + element.setAttribute("aria-checked", false); + return cross || ""; + } + } + }, + + datetime: function datetime(cell, formatterParams, onRendered) { + var inputFormat = formatterParams.inputFormat || "YYYY-MM-DD hh:mm:ss"; + var outputFormat = formatterParams.outputFormat || "DD/MM/YYYY hh:mm:ss"; + var invalid = typeof formatterParams.invalidPlaceholder !== "undefined" ? formatterParams.invalidPlaceholder : ""; + var value = cell.getValue(); + + var newDatetime = moment(value, inputFormat); + + if (newDatetime.isValid()) { + return formatterParams.timezone ? newDatetime.tz(formatterParams.timezone).format(outputFormat) : newDatetime.format(outputFormat); + } else { + + if (invalid === true) { + return value; + } else if (typeof invalid === "function") { + return invalid(value); + } else { + return invalid; + } + } + }, + + datetimediff: function datetime(cell, formatterParams, onRendered) { + var inputFormat = formatterParams.inputFormat || "YYYY-MM-DD hh:mm:ss"; + var invalid = typeof formatterParams.invalidPlaceholder !== "undefined" ? formatterParams.invalidPlaceholder : ""; + var suffix = typeof formatterParams.suffix !== "undefined" ? formatterParams.suffix : false; + var unit = typeof formatterParams.unit !== "undefined" ? formatterParams.unit : undefined; + var humanize = typeof formatterParams.humanize !== "undefined" ? formatterParams.humanize : false; + var date = typeof formatterParams.date !== "undefined" ? formatterParams.date : moment(); + var value = cell.getValue(); + + var newDatetime = moment(value, inputFormat); + + if (newDatetime.isValid()) { + if (humanize) { + return moment.duration(newDatetime.diff(date)).humanize(suffix); + } else { + return newDatetime.diff(date, unit) + (suffix ? " " + suffix : ""); + } + } else { + + if (invalid === true) { + return value; + } else if (typeof invalid === "function") { + return invalid(value); + } else { + return invalid; + } + } + }, + + //select + lookup: function lookup(cell, formatterParams, onRendered) { + var value = cell.getValue(); + + if (typeof formatterParams[value] === "undefined") { + console.warn('Missing display value for ' + value); + return value; + } + + return formatterParams[value]; + }, + + //star rating + star: function star(cell, formatterParams, onRendered) { + var value = cell.getValue(), + element = cell.getElement(), + maxStars = formatterParams && formatterParams.stars ? formatterParams.stars : 5, + stars = document.createElement("span"), + star = document.createElementNS('http://www.w3.org/2000/svg', "svg"), + starActive = '', + starInactive = ''; + + //style stars holder + stars.style.verticalAlign = "middle"; + + //style star + star.setAttribute("width", "14"); + star.setAttribute("height", "14"); + star.setAttribute("viewBox", "0 0 512 512"); + star.setAttribute("xml:space", "preserve"); + star.style.padding = "0 1px"; + + value = value && !isNaN(value) ? parseInt(value) : 0; + + value = Math.max(0, Math.min(value, maxStars)); + + for (var i = 1; i <= maxStars; i++) { + var nextStar = star.cloneNode(true); + nextStar.innerHTML = i <= value ? starActive : starInactive; + + stars.appendChild(nextStar); + } + + element.style.whiteSpace = "nowrap"; + element.style.overflow = "hidden"; + element.style.textOverflow = "ellipsis"; + + element.setAttribute("aria-label", value); + + return stars; + }, + + traffic: function traffic(cell, formatterParams, onRendered) { + var value = this.sanitizeHTML(cell.getValue()) || 0, + el = document.createElement("span"), + max = formatterParams && formatterParams.max ? formatterParams.max : 100, + min = formatterParams && formatterParams.min ? formatterParams.min : 0, + colors = formatterParams && typeof formatterParams.color !== "undefined" ? formatterParams.color : ["red", "orange", "green"], + color = "#666666", + percent, + percentValue; + + if (isNaN(value) || typeof cell.getValue() === "undefined") { + return; + } + + el.classList.add("tabulator-traffic-light"); + + //make sure value is in range + percentValue = parseFloat(value) <= max ? parseFloat(value) : max; + percentValue = parseFloat(percentValue) >= min ? parseFloat(percentValue) : min; + + //workout percentage + percent = (max - min) / 100; + percentValue = Math.round((percentValue - min) / percent); + + //set color + switch (typeof colors === "undefined" ? "undefined" : _typeof(colors)) { + case "string": + color = colors; + break; + case "function": + color = colors(value); + break; + case "object": + if (Array.isArray(colors)) { + var unit = 100 / colors.length; + var index = Math.floor(percentValue / unit); + + index = Math.min(index, colors.length - 1); + index = Math.max(index, 0); + color = colors[index]; + break; + } + } + + el.style.backgroundColor = color; + + return el; + }, + + //progress bar + progress: function progress(cell, formatterParams, onRendered) { + //progress bar + var value = this.sanitizeHTML(cell.getValue()) || 0, + element = cell.getElement(), + max = formatterParams && formatterParams.max ? formatterParams.max : 100, + min = formatterParams && formatterParams.min ? formatterParams.min : 0, + legendAlign = formatterParams && formatterParams.legendAlign ? formatterParams.legendAlign : "center", + percent, + percentValue, + color, + legend, + legendColor, + top, + left, + right, + bottom; + + //make sure value is in range + percentValue = parseFloat(value) <= max ? parseFloat(value) : max; + percentValue = parseFloat(percentValue) >= min ? parseFloat(percentValue) : min; + + //workout percentage + percent = (max - min) / 100; + percentValue = Math.round((percentValue - min) / percent); + + //set bar color + switch (_typeof(formatterParams.color)) { + case "string": + color = formatterParams.color; + break; + case "function": + color = formatterParams.color(value); + break; + case "object": + if (Array.isArray(formatterParams.color)) { + var unit = 100 / formatterParams.color.length; + var index = Math.floor(percentValue / unit); + + index = Math.min(index, formatterParams.color.length - 1); + index = Math.max(index, 0); + color = formatterParams.color[index]; + break; + } + default: + color = "#2DC214"; + } + + //generate legend + switch (_typeof(formatterParams.legend)) { + case "string": + legend = formatterParams.legend; + break; + case "function": + legend = formatterParams.legend(value); + break; + case "boolean": + legend = value; + break; + default: + legend = false; + } + + //set legend color + switch (_typeof(formatterParams.legendColor)) { + case "string": + legendColor = formatterParams.legendColor; + break; + case "function": + legendColor = formatterParams.legendColor(value); + break; + case "object": + if (Array.isArray(formatterParams.legendColor)) { + var unit = 100 / formatterParams.legendColor.length; + var index = Math.floor(percentValue / unit); + + index = Math.min(index, formatterParams.legendColor.length - 1); + index = Math.max(index, 0); + legendColor = formatterParams.legendColor[index]; + } + break; + default: + legendColor = "#000"; + } + + element.style.minWidth = "30px"; + element.style.position = "relative"; + + element.setAttribute("aria-label", percentValue); + + var barEl = document.createElement("div"); + barEl.style.display = "inline-block"; + barEl.style.position = "relative"; + barEl.style.width = percentValue + "%"; + barEl.style.backgroundColor = color; + barEl.style.height = "100%"; + + barEl.setAttribute('data-max', max); + barEl.setAttribute('data-min', min); + + if (legend) { + var legendEl = document.createElement("div"); + legendEl.style.position = "absolute"; + legendEl.style.top = "4px"; + legendEl.style.left = 0; + legendEl.style.textAlign = legendAlign; + legendEl.style.width = "100%"; + legendEl.style.color = legendColor; + legendEl.innerHTML = legend; + } + + onRendered(function () { + + //handle custom element needed if formatter is to be included in printed/downloaded output + if (!(cell instanceof CellComponent)) { + var holderEl = document.createElement("div"); + holderEl.style.position = "absolute"; + holderEl.style.top = "4px"; + holderEl.style.bottom = "4px"; + holderEl.style.left = "4px"; + holderEl.style.right = "4px"; + + element.appendChild(holderEl); + + element = holderEl; + } + + element.appendChild(barEl); + + if (legend) { + element.appendChild(legendEl); + } + }); + + return ""; + }, + + //background color + color: function color(cell, formatterParams, onRendered) { + cell.getElement().style.backgroundColor = this.sanitizeHTML(cell.getValue()); + return ""; + }, + + //tick icon + buttonTick: function buttonTick(cell, formatterParams, onRendered) { + return ''; + }, + + //cross icon + buttonCross: function buttonCross(cell, formatterParams, onRendered) { + return ''; + }, + + //current row number + rownum: function rownum(cell, formatterParams, onRendered) { + return this.table.rowManager.activeRows.indexOf(cell.getRow()._getSelf()) + 1; + }, + + //row handle + handle: function handle(cell, formatterParams, onRendered) { + cell.getElement().classList.add("tabulator-row-handle"); + return "
"; + }, + + responsiveCollapse: function responsiveCollapse(cell, formatterParams, onRendered) { + var self = this, + open = false, + el = document.createElement("div"), + config = cell.getRow()._row.modules.responsiveLayout; + + el.classList.add("tabulator-responsive-collapse-toggle"); + el.innerHTML = "+-"; + + cell.getElement().classList.add("tabulator-row-handle"); + + function toggleList(isOpen) { + var collapseEl = config.element; + + config.open = isOpen; + + if (collapseEl) { + + if (config.open) { + el.classList.add("open"); + collapseEl.style.display = ''; + } else { + el.classList.remove("open"); + collapseEl.style.display = 'none'; + } + } + } + + el.addEventListener("click", function (e) { + e.stopImmediatePropagation(); + toggleList(!config.open); + }); + + toggleList(config.open); + + return el; + }, + + rowSelection: function rowSelection(cell, formatterParams, onRendered) { + var _this = this; + + var checkbox = document.createElement("input"); + + checkbox.type = 'checkbox'; + + if (this.table.modExists("selectRow", true)) { + + checkbox.addEventListener("click", function (e) { + e.stopPropagation(); + }); + + if (typeof cell.getRow == 'function') { + var row = cell.getRow(); + + if (row instanceof RowComponent) { + + checkbox.addEventListener("change", function (e) { + row.toggleSelect(); + }); + + checkbox.checked = row.isSelected && row.isSelected(); + this.table.modules.selectRow.registerRowSelectCheckbox(row, checkbox); + } else { + checkbox = ""; + } + } else { + checkbox.addEventListener("change", function (e) { + if (_this.table.modules.selectRow.selectedRows.length) { + _this.table.deselectRow(); + } else { + _this.table.selectRow(formatterParams.rowRange); + } + }); + + this.table.modules.selectRow.registerHeaderSelectCheckbox(checkbox); + } + } + return checkbox; + } +}; + +Tabulator.prototype.registerModule("format", Format); \ No newline at end of file diff --git a/website/js/vendor/tabulator/js/modules/format.min.js b/website/js/vendor/tabulator/js/modules/format.min.js new file mode 100644 index 0000000..9616969 --- /dev/null +++ b/website/js/vendor/tabulator/js/modules/format.min.js @@ -0,0 +1,2 @@ +/* Tabulator v4.8.3 (c) Oliver Folkerd */ +var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Format=function(e){this.table=e};Format.prototype.initializeColumn=function(e){e.modules.format=this.lookupFormatter(e,""),void 0!==e.definition.formatterPrint&&(e.modules.format.print=this.lookupFormatter(e,"Print")),void 0!==e.definition.formatterClipboard&&(e.modules.format.clipboard=this.lookupFormatter(e,"Clipboard")),void 0!==e.definition.formatterHtmlOutput&&(e.modules.format.htmlOutput=this.lookupFormatter(e,"HtmlOutput"))},Format.prototype.lookupFormatter=function(e,t){var o={params:e.definition["formatter"+t+"Params"]||{}},r=e.definition["formatter"+t];switch(void 0===r?"undefined":_typeof(r)){case"string":"tick"===r&&(r="tickCross",void 0===o.params.crossElement&&(o.params.crossElement=!1),console.warn("DEPRECATION WARNING - the tick formatter has been deprecated, please use the tickCross formatter with the crossElement param set to false")),this.formatters[r]?o.formatter=this.formatters[r]:(console.warn("Formatter Error - No such formatter found: ",r),o.formatter=this.formatters.plaintext);break;case"function":o.formatter=r;break;default:o.formatter=this.formatters.plaintext}return o},Format.prototype.cellRendered=function(e){e.modules.format&&e.modules.format.renderedCallback&&!e.modules.format.rendered&&(e.modules.format.renderedCallback(),e.modules.format.rendered=!0)},Format.prototype.formatValue=function(e){function t(t){e.modules.format||(e.modules.format={}),e.modules.format.renderedCallback=t,e.modules.format.rendered=!1}var o=e.getComponent(),r="function"==typeof e.column.modules.format.params?e.column.modules.format.params(o):e.column.modules.format.params;return e.column.modules.format.formatter.call(this,o,r,t)},Format.prototype.formatExportValue=function(e,t){var o,r=e.column.modules.format[t];if(r){var a=function(t){e.modules.format||(e.modules.format={}),e.modules.format.renderedCallback=t,e.modules.format.rendered=!1};return o="function"==typeof r.params?r.params(component):r.params,r.formatter.call(this,e.getComponent(),o,a)}return this.formatValue(e)},Format.prototype.sanitizeHTML=function(e){if(e){var t={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/","`":"`","=":"="};return String(e).replace(/[&<>"'`=\/]/g,function(e){return t[e]})}return e},Format.prototype.emptyToSpace=function(e){return null===e||void 0===e||""===e?" ":e},Format.prototype.getFormatter=function(e){var e;switch(void 0===e?"undefined":_typeof(e)){case"string":this.formatters[e]?e=this.formatters[e]:(console.warn("Formatter Error - No such formatter found: ",e),e=this.formatters.plaintext);break;case"function":e=e;break;default:e=this.formatters.plaintext}return e},Format.prototype.formatters={plaintext:function(e,t,o){return this.emptyToSpace(this.sanitizeHTML(e.getValue()))},html:function(e,t,o){return e.getValue()},textarea:function(e,t,o){return e.getElement().style.whiteSpace="pre-wrap",this.emptyToSpace(this.sanitizeHTML(e.getValue()))},money:function(e,t,o){var r,a,n,l,i=parseFloat(e.getValue()),s=t.decimal||".",c=t.thousand||",",d=t.symbol||"",u=!!t.symbolAfter,m=void 0!==t.precision?t.precision:2;if(isNaN(i))return this.emptyToSpace(this.sanitizeHTML(e.getValue()));for(r=!1!==m?i.toFixed(m):i,r=String(r).split("."),a=r[0],n=r.length>1?s+r[1]:"",l=/(\d+)(\d{3})/;l.test(a);)a=a.replace(l,"$1"+c+"$2");return u?a+n+d:d+a+n},link:function(e,t,o){var r,a=e.getValue(),n=t.urlPrefix||"",l=t.download,i=a,s=document.createElement("a");if(t.labelField&&(r=e.getData(),i=r[t.labelField]),t.label)switch(_typeof(t.label)){case"string":i=t.label;break;case"function":i=t.label(e)}if(i){if(t.urlField&&(r=e.getData(),a=r[t.urlField]),t.url)switch(_typeof(t.url)){case"string":a=t.url;break;case"function":a=t.url(e)}return s.setAttribute("href",n+a),t.target&&s.setAttribute("target",t.target),t.download&&(l="function"==typeof l?l(e):!0===l?"":l,s.setAttribute("download",l)),s.innerHTML=this.emptyToSpace(this.sanitizeHTML(i)),s}return" "},image:function(e,t,o){var r=document.createElement("img");switch(r.setAttribute("src",e.getValue()),_typeof(t.height)){case"number":r.style.height=t.height+"px";break;case"string":r.style.height=t.height}switch(_typeof(t.width)){case"number":r.style.width=t.width+"px";break;case"string":r.style.width=t.width}return r.addEventListener("load",function(){e.getRow().normalizeHeight()}),r},tickCross:function(e,t,o){var r=e.getValue(),a=e.getElement(),n=t.allowEmpty,l=t.allowTruthy,i=void 0!==t.tickElement?t.tickElement:'',s=void 0!==t.crossElement?t.crossElement:'';return l&&r||!0===r||"true"===r||"True"===r||1===r||"1"===r?(a.setAttribute("aria-checked",!0),i||""):!n||"null"!==r&&""!==r&&null!==r&&void 0!==r?(a.setAttribute("aria-checked",!1),s||""):(a.setAttribute("aria-checked","mixed"),"")},datetime:function(e,t,o){var r=t.inputFormat||"YYYY-MM-DD hh:mm:ss",a=t.outputFormat||"DD/MM/YYYY hh:mm:ss",n=void 0!==t.invalidPlaceholder?t.invalidPlaceholder:"",l=e.getValue(),i=moment(l,r);return i.isValid()?t.timezone?i.tz(t.timezone).format(a):i.format(a):!0===n?l:"function"==typeof n?n(l):n},datetimediff:function(e,t,o){var r=t.inputFormat||"YYYY-MM-DD hh:mm:ss",a=void 0!==t.invalidPlaceholder?t.invalidPlaceholder:"",n=void 0!==t.suffix&&t.suffix,l=void 0!==t.unit?t.unit:void 0,i=void 0!==t.humanize&&t.humanize,s=void 0!==t.date?t.date:moment(),c=e.getValue(),d=moment(c,r);return d.isValid()?i?moment.duration(d.diff(s)).humanize(n):d.diff(s,l)+(n?" "+n:""):!0===a?c:"function"==typeof a?a(c):a},lookup:function(e,t,o){var r=e.getValue();return void 0===t[r]?(console.warn("Missing display value for "+r),r):t[r]},star:function(e,t,o){var r=e.getValue(),a=e.getElement(),n=t&&t.stars?t.stars:5,l=document.createElement("span"),i=document.createElementNS("http://www.w3.org/2000/svg","svg");l.style.verticalAlign="middle",i.setAttribute("width","14"),i.setAttribute("height","14"),i.setAttribute("viewBox","0 0 512 512"),i.setAttribute("xml:space","preserve"),i.style.padding="0 1px",r=r&&!isNaN(r)?parseInt(r):0,r=Math.max(0,Math.min(r,n));for(var s=1;s<=n;s++){var c=i.cloneNode(!0);c.innerHTML=s<=r?'':'',l.appendChild(c)}return a.style.whiteSpace="nowrap",a.style.overflow="hidden",a.style.textOverflow="ellipsis",a.setAttribute("aria-label",r),l},traffic:function(e,t,o){var r,a,n=this.sanitizeHTML(e.getValue())||0,l=document.createElement("span"),i=t&&t.max?t.max:100,s=t&&t.min?t.min:0,c=t&&void 0!==t.color?t.color:["red","orange","green"],d="#666666";if(!isNaN(n)&&void 0!==e.getValue()){switch(l.classList.add("tabulator-traffic-light"),a=parseFloat(n)<=i?parseFloat(n):i,a=parseFloat(a)>=s?parseFloat(a):s,r=(i-s)/100,a=Math.round((a-s)/r),void 0===c?"undefined":_typeof(c)){case"string":d=c;break;case"function":d=c(n);break;case"object":if(Array.isArray(c)){var u=100/c.length,m=Math.floor(a/u);m=Math.min(m,c.length-1),m=Math.max(m,0),d=c[m];break}}return l.style.backgroundColor=d,l}},progress:function(e,t,o){var r,a,n,l,i,s=this.sanitizeHTML(e.getValue())||0,c=e.getElement(),d=t&&t.max?t.max:100,u=t&&t.min?t.min:0,m=t&&t.legendAlign?t.legendAlign:"center";switch(a=parseFloat(s)<=d?parseFloat(s):d,a=parseFloat(a)>=u?parseFloat(a):u,r=(d-u)/100,a=Math.round((a-u)/r),_typeof(t.color)){case"string":n=t.color;break;case"function":n=t.color(s);break;case"object":if(Array.isArray(t.color)){var f=100/t.color.length,p=Math.floor(a/f);p=Math.min(p,t.color.length-1),p=Math.max(p,0),n=t.color[p];break}default:n="#2DC214"}switch(_typeof(t.legend)){case"string":l=t.legend;break;case"function":l=t.legend(s);break;case"boolean":l=s;break;default:l=!1}switch(_typeof(t.legendColor)){case"string":i=t.legendColor;break;case"function":i=t.legendColor(s);break;case"object":if(Array.isArray(t.legendColor)){var f=100/t.legendColor.length,p=Math.floor(a/f);p=Math.min(p,t.legendColor.length-1),p=Math.max(p,0),i=t.legendColor[p]}break;default:i="#000"}c.style.minWidth="30px",c.style.position="relative",c.setAttribute("aria-label",a);var h=document.createElement("div");if(h.style.display="inline-block",h.style.position="relative",h.style.width=a+"%",h.style.backgroundColor=n,h.style.height="100%",h.setAttribute("data-max",d),h.setAttribute("data-min",u),l){var g=document.createElement("div");g.style.position="absolute",g.style.top="4px",g.style.left=0,g.style.textAlign=m,g.style.width="100%",g.style.color=i,g.innerHTML=l}return o(function(){if(!(e instanceof CellComponent)){var t=document.createElement("div");t.style.position="absolute",t.style.top="4px",t.style.bottom="4px",t.style.left="4px",t.style.right="4px",c.appendChild(t),c=t}c.appendChild(h),l&&c.appendChild(g)}),""},color:function(e,t,o){return e.getElement().style.backgroundColor=this.sanitizeHTML(e.getValue()),""},buttonTick:function(e,t,o){return''},buttonCross:function(e,t,o){return''},rownum:function(e,t,o){return this.table.rowManager.activeRows.indexOf(e.getRow()._getSelf())+1},handle:function(e,t,o){return e.getElement().classList.add("tabulator-row-handle"),"
"},responsiveCollapse:function(e,t,o){function r(e){var t=n.element;n.open=e,t&&(n.open?(a.classList.add("open"),t.style.display=""):(a.classList.remove("open"),t.style.display="none"))}var a=document.createElement("div"),n=e.getRow()._row.modules.responsiveLayout;return a.classList.add("tabulator-responsive-collapse-toggle"),a.innerHTML="+-",e.getElement().classList.add("tabulator-row-handle"),a.addEventListener("click",function(e){e.stopImmediatePropagation(),r(!n.open)}),r(n.open),a},rowSelection:function(e,t,o){var r=this,a=document.createElement("input");if(a.type="checkbox",this.table.modExists("selectRow",!0))if(a.addEventListener("click",function(e){e.stopPropagation()}),"function"==typeof e.getRow){var n=e.getRow();n instanceof RowComponent?(a.addEventListener("change",function(e){n.toggleSelect()}),a.checked=n.isSelected&&n.isSelected(),this.table.modules.selectRow.registerRowSelectCheckbox(n,a)):a=""}else a.addEventListener("change",function(e){r.table.modules.selectRow.selectedRows.length?r.table.deselectRow():r.table.selectRow(t.rowRange)}),this.table.modules.selectRow.registerHeaderSelectCheckbox(a);return a}},Tabulator.prototype.registerModule("format",Format); \ No newline at end of file diff --git a/website/js/vendor/tabulator/js/modules/frozen_columns.js b/website/js/vendor/tabulator/js/modules/frozen_columns.js new file mode 100644 index 0000000..1edd4f7 --- /dev/null +++ b/website/js/vendor/tabulator/js/modules/frozen_columns.js @@ -0,0 +1,275 @@ +/* Tabulator v4.8.3 (c) Oliver Folkerd */ + +var FrozenColumns = function FrozenColumns(table) { + this.table = table; //hold Tabulator object + this.leftColumns = []; + this.rightColumns = []; + this.leftMargin = 0; + this.rightMargin = 0; + this.rightPadding = 0; + this.initializationMode = "left"; + this.active = false; + this.scrollEndTimer = false; +}; + +//reset initial state +FrozenColumns.prototype.reset = function () { + this.initializationMode = "left"; + this.leftColumns = []; + this.rightColumns = []; + this.leftMargin = 0; + this.rightMargin = 0; + this.rightMargin = 0; + this.active = false; + + this.table.columnManager.headersElement.style.marginLeft = 0; + this.table.columnManager.element.style.paddingRight = 0; +}; + +//initialize specific column +FrozenColumns.prototype.initializeColumn = function (column) { + var config = { margin: 0, edge: false }; + + if (!column.isGroup) { + + if (this.frozenCheck(column)) { + + config.position = this.initializationMode; + + if (this.initializationMode == "left") { + this.leftColumns.push(column); + } else { + this.rightColumns.unshift(column); + } + + this.active = true; + + column.modules.frozen = config; + } else { + this.initializationMode = "right"; + } + } +}; + +FrozenColumns.prototype.frozenCheck = function (column) { + var frozen = false; + + if (column.parent.isGroup && column.definition.frozen) { + console.warn("Frozen Column Error - Parent column group must be frozen, not individual columns or sub column groups"); + } + + if (column.parent.isGroup) { + return this.frozenCheck(column.parent); + } else { + return column.definition.frozen; + } + + return frozen; +}; + +//quick layout to smooth horizontal scrolling +FrozenColumns.prototype.scrollHorizontal = function () { + var _this = this; + + var rows; + + if (this.active) { + clearTimeout(this.scrollEndTimer); + + //layout all rows after scroll is complete + this.scrollEndTimer = setTimeout(function () { + _this.layout(); + }, 100); + + rows = this.table.rowManager.getVisibleRows(); + + this.calcMargins(); + + this.layoutColumnPosition(); + + this.layoutCalcRows(); + + rows.forEach(function (row) { + if (row.type === "row") { + _this.layoutRow(row); + } + }); + + this.table.rowManager.tableElement.style.marginRight = this.rightMargin; + } +}; + +//calculate margins for rows +FrozenColumns.prototype.calcMargins = function () { + this.leftMargin = this._calcSpace(this.leftColumns, this.leftColumns.length) + "px"; + this.table.columnManager.headersElement.style.marginLeft = this.leftMargin; + + this.rightMargin = this._calcSpace(this.rightColumns, this.rightColumns.length) + "px"; + this.table.columnManager.element.style.paddingRight = this.rightMargin; + + //calculate right frozen columns + this.rightPadding = this.table.rowManager.element.clientWidth + this.table.columnManager.scrollLeft; +}; + +//layout calculation rows +FrozenColumns.prototype.layoutCalcRows = function () { + if (this.table.modExists("columnCalcs")) { + if (this.table.modules.columnCalcs.topInitialized && this.table.modules.columnCalcs.topRow) { + this.layoutRow(this.table.modules.columnCalcs.topRow); + } + if (this.table.modules.columnCalcs.botInitialized && this.table.modules.columnCalcs.botRow) { + this.layoutRow(this.table.modules.columnCalcs.botRow); + } + } +}; + +//calculate column positions and layout headers +FrozenColumns.prototype.layoutColumnPosition = function (allCells) { + var _this2 = this; + + var leftParents = []; + + this.leftColumns.forEach(function (column, i) { + column.modules.frozen.margin = _this2._calcSpace(_this2.leftColumns, i) + _this2.table.columnManager.scrollLeft + "px"; + + if (i == _this2.leftColumns.length - 1) { + column.modules.frozen.edge = true; + } else { + column.modules.frozen.edge = false; + } + + if (column.parent.isGroup) { + var parentEl = _this2.getColGroupParentElement(column); + if (!leftParents.includes(parentEl)) { + _this2.layoutElement(parentEl, column); + leftParents.push(parentEl); + } + + if (column.modules.frozen.edge) { + parentEl.classList.add("tabulator-frozen-" + column.modules.frozen.position); + } + } else { + _this2.layoutElement(column.getElement(), column); + } + + if (allCells) { + column.cells.forEach(function (cell) { + _this2.layoutElement(cell.getElement(), column); + }); + } + }); + + this.rightColumns.forEach(function (column, i) { + column.modules.frozen.margin = _this2.rightPadding - _this2._calcSpace(_this2.rightColumns, i + 1) + "px"; + + if (i == _this2.rightColumns.length - 1) { + column.modules.frozen.edge = true; + } else { + column.modules.frozen.edge = false; + } + + if (column.parent.isGroup) { + _this2.layoutElement(_this2.getColGroupParentElement(column), column); + } else { + _this2.layoutElement(column.getElement(), column); + } + + if (allCells) { + column.cells.forEach(function (cell) { + _this2.layoutElement(cell.getElement(), column); + }); + } + }); +}; + +FrozenColumns.prototype.getColGroupParentElement = function (column) { + return column.parent.isGroup ? this.getColGroupParentElement(column.parent) : column.getElement(); +}; + +//layout columns appropropriatly +FrozenColumns.prototype.layout = function () { + var self = this, + rightMargin = 0; + + if (self.active) { + + //calculate row padding + this.calcMargins(); + + // self.table.rowManager.activeRows.forEach(function(row){ + // self.layoutRow(row); + // }); + + // if(self.table.options.dataTree){ + self.table.rowManager.getDisplayRows().forEach(function (row) { + if (row.type === "row") { + self.layoutRow(row); + } + }); + // } + + this.layoutCalcRows(); + + //calculate left columns + this.layoutColumnPosition(true); + + // if(tableHolder.scrollHeight > tableHolder.clientHeight){ + // rightMargin -= tableHolder.offsetWidth - tableHolder.clientWidth; + // } + + this.table.rowManager.tableElement.style.marginRight = this.rightMargin; + } +}; + +FrozenColumns.prototype.layoutRow = function (row) { + var _this3 = this; + + var rowEl = row.getElement(); + + rowEl.style.paddingLeft = this.leftMargin; + // rowEl.style.paddingRight = this.rightMargin + "px"; + + this.leftColumns.forEach(function (column) { + var cell = row.getCell(column); + + if (cell) { + _this3.layoutElement(cell.getElement(), column); + } + }); + + this.rightColumns.forEach(function (column) { + var cell = row.getCell(column); + + if (cell) { + _this3.layoutElement(cell.getElement(), column); + } + }); +}; + +FrozenColumns.prototype.layoutElement = function (element, column) { + + if (column.modules.frozen) { + element.style.position = "absolute"; + element.style.left = column.modules.frozen.margin; + + element.classList.add("tabulator-frozen"); + + if (column.modules.frozen.edge) { + element.classList.add("tabulator-frozen-" + column.modules.frozen.position); + } + } +}; + +FrozenColumns.prototype._calcSpace = function (columns, index) { + var width = 0; + + for (var i = 0; i < index; i++) { + if (columns[i].visible) { + width += columns[i].getWidth(); + } + } + + return width; +}; + +Tabulator.prototype.registerModule("frozenColumns", FrozenColumns); \ No newline at end of file diff --git a/website/js/vendor/tabulator/js/modules/frozen_columns.min.js b/website/js/vendor/tabulator/js/modules/frozen_columns.min.js new file mode 100644 index 0000000..7813e4e --- /dev/null +++ b/website/js/vendor/tabulator/js/modules/frozen_columns.min.js @@ -0,0 +1,2 @@ +/* Tabulator v4.8.3 (c) Oliver Folkerd */ +var FrozenColumns=function(t){this.table=t,this.leftColumns=[],this.rightColumns=[],this.leftMargin=0,this.rightMargin=0,this.rightPadding=0,this.initializationMode="left",this.active=!1,this.scrollEndTimer=!1};FrozenColumns.prototype.reset=function(){this.initializationMode="left",this.leftColumns=[],this.rightColumns=[],this.leftMargin=0,this.rightMargin=0,this.rightMargin=0,this.active=!1,this.table.columnManager.headersElement.style.marginLeft=0,this.table.columnManager.element.style.paddingRight=0},FrozenColumns.prototype.initializeColumn=function(t){var e={margin:0,edge:!1};t.isGroup||(this.frozenCheck(t)?(e.position=this.initializationMode,"left"==this.initializationMode?this.leftColumns.push(t):this.rightColumns.unshift(t),this.active=!0,t.modules.frozen=e):this.initializationMode="right")},FrozenColumns.prototype.frozenCheck=function(t){return t.parent.isGroup&&t.definition.frozen&&console.warn("Frozen Column Error - Parent column group must be frozen, not individual columns or sub column groups"),t.parent.isGroup?this.frozenCheck(t.parent):t.definition.frozen},FrozenColumns.prototype.scrollHorizontal=function(){var t,e=this;this.active&&(clearTimeout(this.scrollEndTimer),this.scrollEndTimer=setTimeout(function(){e.layout()},100),t=this.table.rowManager.getVisibleRows(),this.calcMargins(),this.layoutColumnPosition(),this.layoutCalcRows(),t.forEach(function(t){"row"===t.type&&e.layoutRow(t)}),this.table.rowManager.tableElement.style.marginRight=this.rightMargin)},FrozenColumns.prototype.calcMargins=function(){this.leftMargin=this._calcSpace(this.leftColumns,this.leftColumns.length)+"px",this.table.columnManager.headersElement.style.marginLeft=this.leftMargin,this.rightMargin=this._calcSpace(this.rightColumns,this.rightColumns.length)+"px",this.table.columnManager.element.style.paddingRight=this.rightMargin,this.rightPadding=this.table.rowManager.element.clientWidth+this.table.columnManager.scrollLeft},FrozenColumns.prototype.layoutCalcRows=function(){this.table.modExists("columnCalcs")&&(this.table.modules.columnCalcs.topInitialized&&this.table.modules.columnCalcs.topRow&&this.layoutRow(this.table.modules.columnCalcs.topRow),this.table.modules.columnCalcs.botInitialized&&this.table.modules.columnCalcs.botRow&&this.layoutRow(this.table.modules.columnCalcs.botRow))},FrozenColumns.prototype.layoutColumnPosition=function(t){var e=this,o=[];this.leftColumns.forEach(function(n,l){if(n.modules.frozen.margin=e._calcSpace(e.leftColumns,l)+e.table.columnManager.scrollLeft+"px",l==e.leftColumns.length-1?n.modules.frozen.edge=!0:n.modules.frozen.edge=!1,n.parent.isGroup){var i=e.getColGroupParentElement(n);o.includes(i)||(e.layoutElement(i,n),o.push(i)),n.modules.frozen.edge&&i.classList.add("tabulator-frozen-"+n.modules.frozen.position)}else e.layoutElement(n.getElement(),n);t&&n.cells.forEach(function(t){e.layoutElement(t.getElement(),n)})}),this.rightColumns.forEach(function(o,n){o.modules.frozen.margin=e.rightPadding-e._calcSpace(e.rightColumns,n+1)+"px",n==e.rightColumns.length-1?o.modules.frozen.edge=!0:o.modules.frozen.edge=!1,o.parent.isGroup?e.layoutElement(e.getColGroupParentElement(o),o):e.layoutElement(o.getElement(),o),t&&o.cells.forEach(function(t){e.layoutElement(t.getElement(),o)})})},FrozenColumns.prototype.getColGroupParentElement=function(t){return t.parent.isGroup?this.getColGroupParentElement(t.parent):t.getElement()},FrozenColumns.prototype.layout=function(){var t=this;t.active&&(this.calcMargins(),t.table.rowManager.getDisplayRows().forEach(function(e){"row"===e.type&&t.layoutRow(e)}),this.layoutCalcRows(),this.layoutColumnPosition(!0),this.table.rowManager.tableElement.style.marginRight=this.rightMargin)},FrozenColumns.prototype.layoutRow=function(t){var e=this;t.getElement().style.paddingLeft=this.leftMargin,this.leftColumns.forEach(function(o){var n=t.getCell(o);n&&e.layoutElement(n.getElement(),o)}),this.rightColumns.forEach(function(o){var n=t.getCell(o);n&&e.layoutElement(n.getElement(),o)})},FrozenColumns.prototype.layoutElement=function(t,e){e.modules.frozen&&(t.style.position="absolute",t.style.left=e.modules.frozen.margin,t.classList.add("tabulator-frozen"),e.modules.frozen.edge&&t.classList.add("tabulator-frozen-"+e.modules.frozen.position))},FrozenColumns.prototype._calcSpace=function(t,e){for(var o=0,n=0;n -1) { + output.splice(index, 1); + } + }); + + return output; +}; + +FrozenRows.prototype.freezeRow = function (row) { + if (!row.modules.frozen) { + row.modules.frozen = true; + this.topElement.appendChild(row.getElement()); + row.initialize(); + row.normalizeHeight(); + this.table.rowManager.adjustTableSize(); + + this.rows.push(row); + + this.table.rowManager.refreshActiveData("display"); + + this.styleRows(); + } else { + console.warn("Freeze Error - Row is already frozen"); + } +}; + +FrozenRows.prototype.unfreezeRow = function (row) { + var index = this.rows.indexOf(row); + + if (row.modules.frozen) { + + row.modules.frozen = false; + + this.detachRow(row); + + this.table.rowManager.adjustTableSize(); + + this.table.rowManager.refreshActiveData("display"); + + if (this.rows.length) { + this.styleRows(); + } + } else { + console.warn("Freeze Error - Row is already unfrozen"); + } +}; + +FrozenRows.prototype.detachRow = function (row) { + var index = this.rows.indexOf(row); + + if (index > -1) { + var rowEl = row.getElement(); + rowEl.parentNode.removeChild(rowEl); + + this.rows.splice(index, 1); + } +}; + +FrozenRows.prototype.styleRows = function (row) { + var self = this; + + this.rows.forEach(function (row, i) { + self.table.rowManager.styleRow(row, i); + }); +}; + +Tabulator.prototype.registerModule("frozenRows", FrozenRows); \ No newline at end of file diff --git a/website/js/vendor/tabulator/js/modules/frozen_rows.min.js b/website/js/vendor/tabulator/js/modules/frozen_rows.min.js new file mode 100644 index 0000000..13ee75d --- /dev/null +++ b/website/js/vendor/tabulator/js/modules/frozen_rows.min.js @@ -0,0 +1,2 @@ +/* Tabulator v4.8.3 (c) Oliver Folkerd */ +var FrozenRows=function(e){this.table=e,this.topElement=document.createElement("div"),this.rows=[],this.displayIndex=0};FrozenRows.prototype.initialize=function(){this.rows=[],this.topElement.classList.add("tabulator-frozen-rows-holder"),this.table.columnManager.getElement().insertBefore(this.topElement,this.table.columnManager.headersElement.nextSibling)},FrozenRows.prototype.setDisplayIndex=function(e){this.displayIndex=e},FrozenRows.prototype.getDisplayIndex=function(){return this.displayIndex},FrozenRows.prototype.isFrozen=function(){return!!this.rows.length},FrozenRows.prototype.getRows=function(e){var o=e.slice(0);return this.rows.forEach(function(e){var t=o.indexOf(e);t>-1&&o.splice(t,1)}),o},FrozenRows.prototype.freezeRow=function(e){e.modules.frozen?console.warn("Freeze Error - Row is already frozen"):(e.modules.frozen=!0,this.topElement.appendChild(e.getElement()),e.initialize(),e.normalizeHeight(),this.table.rowManager.adjustTableSize(),this.rows.push(e),this.table.rowManager.refreshActiveData("display"),this.styleRows())},FrozenRows.prototype.unfreezeRow=function(e){this.rows.indexOf(e);e.modules.frozen?(e.modules.frozen=!1,this.detachRow(e),this.table.rowManager.adjustTableSize(),this.table.rowManager.refreshActiveData("display"),this.rows.length&&this.styleRows()):console.warn("Freeze Error - Row is already unfrozen")},FrozenRows.prototype.detachRow=function(e){var o=this.rows.indexOf(e);if(o>-1){var t=e.getElement();t.parentNode.removeChild(t),this.rows.splice(o,1)}},FrozenRows.prototype.styleRows=function(e){var o=this;this.rows.forEach(function(e,t){o.table.rowManager.styleRow(e,t)})},Tabulator.prototype.registerModule("frozenRows",FrozenRows); \ No newline at end of file diff --git a/website/js/vendor/tabulator/js/modules/group_rows.js b/website/js/vendor/tabulator/js/modules/group_rows.js new file mode 100644 index 0000000..2e28c2d --- /dev/null +++ b/website/js/vendor/tabulator/js/modules/group_rows.js @@ -0,0 +1,1126 @@ +/* Tabulator v4.8.3 (c) Oliver Folkerd */ + +//public group object +var GroupComponent = function GroupComponent(group) { + this._group = group; + this.type = "GroupComponent"; +}; + +GroupComponent.prototype.getKey = function () { + return this._group.key; +}; + +GroupComponent.prototype.getField = function () { + return this._group.field; +}; + +GroupComponent.prototype.getElement = function () { + return this._group.element; +}; + +GroupComponent.prototype.getRows = function () { + return this._group.getRows(true); +}; + +GroupComponent.prototype.getSubGroups = function () { + return this._group.getSubGroups(true); +}; + +GroupComponent.prototype.getParentGroup = function () { + return this._group.parent ? this._group.parent.getComponent() : false; +}; + +GroupComponent.prototype.getVisibility = function () { + console.warn("getVisibility function is deprecated, you should now use the isVisible function"); + return this._group.visible; +}; + +GroupComponent.prototype.isVisible = function () { + return this._group.visible; +}; + +GroupComponent.prototype.show = function () { + this._group.show(); +}; + +GroupComponent.prototype.hide = function () { + this._group.hide(); +}; + +GroupComponent.prototype.toggle = function () { + this._group.toggleVisibility(); +}; + +GroupComponent.prototype._getSelf = function () { + return this._group; +}; + +GroupComponent.prototype.getTable = function () { + return this._group.groupManager.table; +}; + +////////////////////////////////////////////////// +//////////////// Group Functions ///////////////// +////////////////////////////////////////////////// + +var Group = function Group(groupManager, parent, level, key, field, generator, oldGroup) { + + this.groupManager = groupManager; + this.parent = parent; + this.key = key; + this.level = level; + this.field = field; + this.hasSubGroups = level < groupManager.groupIDLookups.length - 1; + this.addRow = this.hasSubGroups ? this._addRowToGroup : this._addRow; + this.type = "group"; //type of element + this.old = oldGroup; + this.rows = []; + this.groups = []; + this.groupList = []; + this.generator = generator; + this.elementContents = false; + this.height = 0; + this.outerHeight = 0; + this.initialized = false; + this.calcs = {}; + this.initialized = false; + this.modules = {}; + this.arrowElement = false; + + this.visible = oldGroup ? oldGroup.visible : typeof groupManager.startOpen[level] !== "undefined" ? groupManager.startOpen[level] : groupManager.startOpen[0]; + + this.component = null; + + this.createElements(); + this.addBindings(); + + this.createValueGroups(); +}; + +Group.prototype.wipe = function () { + if (this.groupList.length) { + this.groupList.forEach(function (group) { + group.wipe(); + }); + } else { + this.element = false; + this.arrowElement = false; + this.elementContents = false; + } +}; + +Group.prototype.createElements = function () { + var arrow = document.createElement("div"); + arrow.classList.add("tabulator-arrow"); + + this.element = document.createElement("div"); + this.element.classList.add("tabulator-row"); + this.element.classList.add("tabulator-group"); + this.element.classList.add("tabulator-group-level-" + this.level); + this.element.setAttribute("role", "rowgroup"); + + this.arrowElement = document.createElement("div"); + this.arrowElement.classList.add("tabulator-group-toggle"); + this.arrowElement.appendChild(arrow); + + //setup movable rows + if (this.groupManager.table.options.movableRows !== false && this.groupManager.table.modExists("moveRow")) { + this.groupManager.table.modules.moveRow.initializeGroupHeader(this); + } +}; + +Group.prototype.createValueGroups = function () { + var _this = this; + + var level = this.level + 1; + if (this.groupManager.allowedValues && this.groupManager.allowedValues[level]) { + this.groupManager.allowedValues[level].forEach(function (value) { + _this._createGroup(value, level); + }); + } +}; + +Group.prototype.addBindings = function () { + var self = this, + dblTap, + tapHold, + tap, + toggleElement; + + //handle group click events + if (self.groupManager.table.options.groupClick) { + self.element.addEventListener("click", function (e) { + self.groupManager.table.options.groupClick.call(self.groupManager.table, e, self.getComponent()); + }); + } + + if (self.groupManager.table.options.groupDblClick) { + self.element.addEventListener("dblclick", function (e) { + self.groupManager.table.options.groupDblClick.call(self.groupManager.table, e, self.getComponent()); + }); + } + + if (self.groupManager.table.options.groupContext) { + self.element.addEventListener("contextmenu", function (e) { + self.groupManager.table.options.groupContext.call(self.groupManager.table, e, self.getComponent()); + }); + } + + if ((self.groupManager.table.options.groupContextMenu || self.groupManager.table.options.groupClickMenu) && self.groupManager.table.modExists("menu")) { + self.groupManager.table.modules.menu.initializeGroup.call(self.groupManager.table.modules.menu, self); + } + + if (self.groupManager.table.options.groupTap) { + + tap = false; + + self.element.addEventListener("touchstart", function (e) { + tap = true; + }, { passive: true }); + + self.element.addEventListener("touchend", function (e) { + if (tap) { + self.groupManager.table.options.groupTap(e, self.getComponent()); + } + + tap = false; + }); + } + + if (self.groupManager.table.options.groupDblTap) { + + dblTap = null; + + self.element.addEventListener("touchend", function (e) { + + if (dblTap) { + clearTimeout(dblTap); + dblTap = null; + + self.groupManager.table.options.groupDblTap(e, self.getComponent()); + } else { + + dblTap = setTimeout(function () { + clearTimeout(dblTap); + dblTap = null; + }, 300); + } + }); + } + + if (self.groupManager.table.options.groupTapHold) { + + tapHold = null; + + self.element.addEventListener("touchstart", function (e) { + clearTimeout(tapHold); + + tapHold = setTimeout(function () { + clearTimeout(tapHold); + tapHold = null; + tap = false; + self.groupManager.table.options.groupTapHold(e, self.getComponent()); + }, 1000); + }, { passive: true }); + + self.element.addEventListener("touchend", function (e) { + clearTimeout(tapHold); + tapHold = null; + }); + } + + if (self.groupManager.table.options.groupToggleElement) { + toggleElement = self.groupManager.table.options.groupToggleElement == "arrow" ? self.arrowElement : self.element; + + toggleElement.addEventListener("click", function (e) { + e.stopPropagation(); + e.stopImmediatePropagation(); + self.toggleVisibility(); + }); + } +}; + +Group.prototype._createGroup = function (groupID, level) { + var groupKey = level + "_" + groupID; + var group = new Group(this.groupManager, this, level, groupID, this.groupManager.groupIDLookups[level].field, this.groupManager.headerGenerator[level] || this.groupManager.headerGenerator[0], this.old ? this.old.groups[groupKey] : false); + + this.groups[groupKey] = group; + this.groupList.push(group); +}; + +Group.prototype._addRowToGroup = function (row) { + + var level = this.level + 1; + + if (this.hasSubGroups) { + var groupID = this.groupManager.groupIDLookups[level].func(row.getData()), + groupKey = level + "_" + groupID; + + if (this.groupManager.allowedValues && this.groupManager.allowedValues[level]) { + if (this.groups[groupKey]) { + this.groups[groupKey].addRow(row); + } + } else { + if (!this.groups[groupKey]) { + this._createGroup(groupID, level); + } + + this.groups[groupKey].addRow(row); + } + } +}; + +Group.prototype._addRow = function (row) { + this.rows.push(row); + row.modules.group = this; +}; + +Group.prototype.insertRow = function (row, to, after) { + var data = this.conformRowData({}); + + row.updateData(data); + + var toIndex = this.rows.indexOf(to); + + if (toIndex > -1) { + if (after) { + this.rows.splice(toIndex + 1, 0, row); + } else { + this.rows.splice(toIndex, 0, row); + } + } else { + if (after) { + this.rows.push(row); + } else { + this.rows.unshift(row); + } + } + + row.modules.group = this; + + this.generateGroupHeaderContents(); + + if (this.groupManager.table.modExists("columnCalcs") && this.groupManager.table.options.columnCalcs != "table") { + this.groupManager.table.modules.columnCalcs.recalcGroup(this); + } + + this.groupManager.updateGroupRows(true); +}; + +Group.prototype.scrollHeader = function (left) { + this.arrowElement.style.marginLeft = left; + + this.groupList.forEach(function (child) { + child.scrollHeader(left); + }); +}; + +Group.prototype.getRowIndex = function (row) {}; + +//update row data to match grouping contraints +Group.prototype.conformRowData = function (data) { + if (this.field) { + data[this.field] = this.key; + } else { + console.warn("Data Conforming Error - Cannot conform row data to match new group as groupBy is a function"); + } + + if (this.parent) { + data = this.parent.conformRowData(data); + } + + return data; +}; + +Group.prototype.removeRow = function (row) { + var index = this.rows.indexOf(row); + var el = row.getElement(); + + if (index > -1) { + this.rows.splice(index, 1); + } + + if (!this.groupManager.table.options.groupValues && !this.rows.length) { + if (this.parent) { + this.parent.removeGroup(this); + } else { + this.groupManager.removeGroup(this); + } + + this.groupManager.updateGroupRows(true); + } else { + + if (el.parentNode) { + el.parentNode.removeChild(el); + } + + this.generateGroupHeaderContents(); + + if (this.groupManager.table.modExists("columnCalcs") && this.groupManager.table.options.columnCalcs != "table") { + this.groupManager.table.modules.columnCalcs.recalcGroup(this); + } + } +}; + +Group.prototype.removeGroup = function (group) { + var groupKey = group.level + "_" + group.key, + index; + + if (this.groups[groupKey]) { + delete this.groups[groupKey]; + + index = this.groupList.indexOf(group); + + if (index > -1) { + this.groupList.splice(index, 1); + } + + if (!this.groupList.length) { + if (this.parent) { + this.parent.removeGroup(this); + } else { + this.groupManager.removeGroup(this); + } + } + } +}; + +Group.prototype.getHeadersAndRows = function (noCalc) { + var output = []; + + output.push(this); + + this._visSet(); + + if (this.visible) { + if (this.groupList.length) { + this.groupList.forEach(function (group) { + output = output.concat(group.getHeadersAndRows(noCalc)); + }); + } else { + if (!noCalc && this.groupManager.table.options.columnCalcs != "table" && this.groupManager.table.modExists("columnCalcs") && this.groupManager.table.modules.columnCalcs.hasTopCalcs()) { + if (this.calcs.top) { + this.calcs.top.detachElement(); + this.calcs.top.deleteCells(); + } + + this.calcs.top = this.groupManager.table.modules.columnCalcs.generateTopRow(this.rows); + output.push(this.calcs.top); + } + + output = output.concat(this.rows); + + if (!noCalc && this.groupManager.table.options.columnCalcs != "table" && this.groupManager.table.modExists("columnCalcs") && this.groupManager.table.modules.columnCalcs.hasBottomCalcs()) { + if (this.calcs.bottom) { + this.calcs.bottom.detachElement(); + this.calcs.bottom.deleteCells(); + } + + this.calcs.bottom = this.groupManager.table.modules.columnCalcs.generateBottomRow(this.rows); + output.push(this.calcs.bottom); + } + } + } else { + if (!this.groupList.length && this.groupManager.table.options.columnCalcs != "table") { + + if (this.groupManager.table.modExists("columnCalcs")) { + + if (!noCalc && this.groupManager.table.modules.columnCalcs.hasTopCalcs()) { + if (this.calcs.top) { + this.calcs.top.detachElement(); + this.calcs.top.deleteCells(); + } + + if (this.groupManager.table.options.groupClosedShowCalcs) { + this.calcs.top = this.groupManager.table.modules.columnCalcs.generateTopRow(this.rows); + output.push(this.calcs.top); + } + } + + if (!noCalc && this.groupManager.table.modules.columnCalcs.hasBottomCalcs()) { + if (this.calcs.bottom) { + this.calcs.bottom.detachElement(); + this.calcs.bottom.deleteCells(); + } + + if (this.groupManager.table.options.groupClosedShowCalcs) { + this.calcs.bottom = this.groupManager.table.modules.columnCalcs.generateBottomRow(this.rows); + output.push(this.calcs.bottom); + } + } + } + } + } + + return output; +}; + +Group.prototype.getData = function (visible, transform) { + var self = this, + output = []; + + this._visSet(); + + if (!visible || visible && this.visible) { + this.rows.forEach(function (row) { + output.push(row.getData(transform || "data")); + }); + } + + return output; +}; + +// Group.prototype.getRows = function(){ +// this._visSet(); + +// return this.visible ? this.rows : []; +// }; + +Group.prototype.getRowCount = function () { + var count = 0; + + if (this.groupList.length) { + this.groupList.forEach(function (group) { + count += group.getRowCount(); + }); + } else { + count = this.rows.length; + } + return count; +}; + +Group.prototype.toggleVisibility = function () { + if (this.visible) { + this.hide(); + } else { + this.show(); + } +}; + +Group.prototype.hide = function () { + this.visible = false; + + if (this.groupManager.table.rowManager.getRenderMode() == "classic" && !this.groupManager.table.options.pagination) { + + this.element.classList.remove("tabulator-group-visible"); + + if (this.groupList.length) { + this.groupList.forEach(function (group) { + + var rows = group.getHeadersAndRows(); + + rows.forEach(function (row) { + row.detachElement(); + }); + }); + } else { + this.rows.forEach(function (row) { + var rowEl = row.getElement(); + rowEl.parentNode.removeChild(rowEl); + }); + } + + this.groupManager.table.rowManager.setDisplayRows(this.groupManager.updateGroupRows(), this.groupManager.getDisplayIndex()); + + this.groupManager.table.rowManager.checkClassicModeGroupHeaderWidth(); + } else { + this.groupManager.updateGroupRows(true); + } + + this.groupManager.table.options.groupVisibilityChanged.call(this.table, this.getComponent(), false); +}; + +Group.prototype.show = function () { + var self = this; + + self.visible = true; + + if (this.groupManager.table.rowManager.getRenderMode() == "classic" && !this.groupManager.table.options.pagination) { + + this.element.classList.add("tabulator-group-visible"); + + var prev = self.getElement(); + + if (this.groupList.length) { + this.groupList.forEach(function (group) { + var rows = group.getHeadersAndRows(); + + rows.forEach(function (row) { + var rowEl = row.getElement(); + prev.parentNode.insertBefore(rowEl, prev.nextSibling); + row.initialize(); + prev = rowEl; + }); + }); + } else { + self.rows.forEach(function (row) { + var rowEl = row.getElement(); + prev.parentNode.insertBefore(rowEl, prev.nextSibling); + row.initialize(); + prev = rowEl; + }); + } + + this.groupManager.table.rowManager.setDisplayRows(this.groupManager.updateGroupRows(), this.groupManager.getDisplayIndex()); + + this.groupManager.table.rowManager.checkClassicModeGroupHeaderWidth(); + } else { + this.groupManager.updateGroupRows(true); + } + + this.groupManager.table.options.groupVisibilityChanged.call(this.table, this.getComponent(), true); +}; + +Group.prototype._visSet = function () { + var data = []; + + if (typeof this.visible == "function") { + + this.rows.forEach(function (row) { + data.push(row.getData()); + }); + + this.visible = this.visible(this.key, this.getRowCount(), data, this.getComponent()); + } +}; + +Group.prototype.getRowGroup = function (row) { + var match = false; + if (this.groupList.length) { + this.groupList.forEach(function (group) { + var result = group.getRowGroup(row); + + if (result) { + match = result; + } + }); + } else { + if (this.rows.find(function (item) { + return item === row; + })) { + match = this; + } + } + + return match; +}; + +Group.prototype.getSubGroups = function (component) { + var output = []; + + this.groupList.forEach(function (child) { + output.push(component ? child.getComponent() : child); + }); + + return output; +}; + +Group.prototype.getRows = function (compoment) { + var output = []; + + this.rows.forEach(function (row) { + output.push(compoment ? row.getComponent() : row); + }); + + return output; +}; + +Group.prototype.generateGroupHeaderContents = function () { + var data = []; + + this.rows.forEach(function (row) { + data.push(row.getData()); + }); + + this.elementContents = this.generator(this.key, this.getRowCount(), data, this.getComponent()); + + while (this.element.firstChild) { + this.element.removeChild(this.element.firstChild); + }if (typeof this.elementContents === "string") { + this.element.innerHTML = this.elementContents; + } else { + this.element.appendChild(this.elementContents); + } + + this.element.insertBefore(this.arrowElement, this.element.firstChild); +}; + +Group.prototype.getPath = function () { + var path = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : []; + + path.unshift(this.key); + if (this.parent) { + this.parent.getPath(path); + } + return path; +}; +////////////// Standard Row Functions ////////////// + +Group.prototype.getElement = function () { + this.addBindingsd = false; + + this._visSet(); + + if (this.visible) { + this.element.classList.add("tabulator-group-visible"); + } else { + this.element.classList.remove("tabulator-group-visible"); + } + + for (var i = 0; i < this.element.childNodes.length; ++i) { + this.element.childNodes[i].parentNode.removeChild(this.element.childNodes[i]); + } + + this.generateGroupHeaderContents(); + + // this.addBindings(); + + return this.element; +}; + +Group.prototype.detachElement = function () { + if (this.element && this.element.parentNode) { + this.element.parentNode.removeChild(this.element); + } +}; + +//normalize the height of elements in the row +Group.prototype.normalizeHeight = function () { + this.setHeight(this.element.clientHeight); +}; + +Group.prototype.initialize = function (force) { + if (!this.initialized || force) { + this.normalizeHeight(); + this.initialized = true; + } +}; + +Group.prototype.reinitialize = function () { + this.initialized = false; + this.height = 0; + + if (Tabulator.prototype.helpers.elVisible(this.element)) { + this.initialize(true); + } +}; + +Group.prototype.setHeight = function (height) { + if (this.height != height) { + this.height = height; + this.outerHeight = this.element.offsetHeight; + } +}; + +//return rows outer height +Group.prototype.getHeight = function () { + return this.outerHeight; +}; + +Group.prototype.getGroup = function () { + return this; +}; + +Group.prototype.reinitializeHeight = function () {}; +Group.prototype.calcHeight = function () {}; +Group.prototype.setCellHeight = function () {}; +Group.prototype.clearCellHeight = function () {}; + +//////////////// Object Generation ///////////////// +Group.prototype.getComponent = function () { + if (!this.component) { + this.component = new GroupComponent(this); + } + + return this.component; +}; + +////////////////////////////////////////////////// +////////////// Group Row Extension /////////////// +////////////////////////////////////////////////// + +var GroupRows = function GroupRows(table) { + + this.table = table; //hold Tabulator object + + this.groupIDLookups = false; //enable table grouping and set field to group by + this.startOpen = [function () { + return false; + }]; //starting state of group + this.headerGenerator = [function () { + return ""; + }]; + this.groupList = []; //ordered list of groups + this.allowedValues = false; + this.groups = {}; //hold row groups + this.displayIndex = 0; //index in display pipeline +}; + +//initialize group configuration +GroupRows.prototype.initialize = function () { + var self = this, + groupBy = self.table.options.groupBy, + startOpen = self.table.options.groupStartOpen, + groupHeader = self.table.options.groupHeader; + + this.allowedValues = self.table.options.groupValues; + + if (Array.isArray(groupBy) && Array.isArray(groupHeader) && groupBy.length > groupHeader.length) { + console.warn("Error creating group headers, groupHeader array is shorter than groupBy array"); + } + + self.headerGenerator = [function () { + return ""; + }]; + this.startOpen = [function () { + return false; + }]; //starting state of group + + self.table.modules.localize.bind("groups|item", function (langValue, lang) { + self.headerGenerator[0] = function (value, count, data) { + //header layout function + return (typeof value === "undefined" ? "" : value) + "(" + count + " " + (count === 1 ? langValue : lang.groups.items) + ")"; + }; + }); + + this.groupIDLookups = []; + + if (Array.isArray(groupBy) || groupBy) { + if (this.table.modExists("columnCalcs") && this.table.options.columnCalcs != "table" && this.table.options.columnCalcs != "both") { + this.table.modules.columnCalcs.removeCalcs(); + } + } else { + if (this.table.modExists("columnCalcs") && this.table.options.columnCalcs != "group") { + + var cols = this.table.columnManager.getRealColumns(); + + cols.forEach(function (col) { + if (col.definition.topCalc) { + self.table.modules.columnCalcs.initializeTopRow(); + } + + if (col.definition.bottomCalc) { + self.table.modules.columnCalcs.initializeBottomRow(); + } + }); + } + } + + if (!Array.isArray(groupBy)) { + groupBy = [groupBy]; + } + + groupBy.forEach(function (group, i) { + var lookupFunc, column; + + if (typeof group == "function") { + lookupFunc = group; + } else { + column = self.table.columnManager.getColumnByField(group); + + if (column) { + lookupFunc = function lookupFunc(data) { + return column.getFieldValue(data); + }; + } else { + lookupFunc = function lookupFunc(data) { + return data[group]; + }; + } + } + + self.groupIDLookups.push({ + field: typeof group === "function" ? false : group, + func: lookupFunc, + values: self.allowedValues ? self.allowedValues[i] : false + }); + }); + + if (startOpen) { + + if (!Array.isArray(startOpen)) { + startOpen = [startOpen]; + } + + startOpen.forEach(function (level) { + level = typeof level == "function" ? level : function () { + return true; + }; + }); + + self.startOpen = startOpen; + } + + if (groupHeader) { + self.headerGenerator = Array.isArray(groupHeader) ? groupHeader : [groupHeader]; + } + + this.initialized = true; +}; + +GroupRows.prototype.setDisplayIndex = function (index) { + this.displayIndex = index; +}; + +GroupRows.prototype.getDisplayIndex = function () { + return this.displayIndex; +}; + +//return appropriate rows with group headers +GroupRows.prototype.getRows = function (rows) { + if (this.groupIDLookups.length) { + + this.table.options.dataGrouping.call(this.table); + + this.generateGroups(rows); + + if (this.table.options.dataGrouped) { + this.table.options.dataGrouped.call(this.table, this.getGroups(true)); + } + + return this.updateGroupRows(); + } else { + return rows.slice(0); + } +}; + +GroupRows.prototype.getGroups = function (compoment) { + var groupComponents = []; + + this.groupList.forEach(function (group) { + groupComponents.push(compoment ? group.getComponent() : group); + }); + + return groupComponents; +}; + +GroupRows.prototype.getChildGroups = function (group) { + var _this2 = this; + + var groupComponents = []; + + if (!group) { + group = this; + } + + group.groupList.forEach(function (child) { + if (child.groupList.length) { + groupComponents = groupComponents.concat(_this2.getChildGroups(child)); + } else { + groupComponents.push(child); + } + }); + + return groupComponents; +}; + +GroupRows.prototype.wipe = function () { + this.groupList.forEach(function (group) { + group.wipe(); + }); +}; + +GroupRows.prototype.pullGroupListData = function (groupList) { + var self = this; + var groupListData = []; + + groupList.forEach(function (group) { + var groupHeader = {}; + groupHeader.level = 0; + groupHeader.rowCount = 0; + groupHeader.headerContent = ""; + var childData = []; + + if (group.hasSubGroups) { + childData = self.pullGroupListData(group.groupList); + + groupHeader.level = group.level; + groupHeader.rowCount = childData.length - group.groupList.length; // data length minus number of sub-headers + groupHeader.headerContent = group.generator(group.key, groupHeader.rowCount, group.rows, group); + + groupListData.push(groupHeader); + groupListData = groupListData.concat(childData); + } else { + groupHeader.level = group.level; + groupHeader.headerContent = group.generator(group.key, group.rows.length, group.rows, group); + groupHeader.rowCount = group.getRows().length; + + groupListData.push(groupHeader); + + group.getRows().forEach(function (row) { + groupListData.push(row.getData("data")); + }); + } + }); + + return groupListData; +}; + +GroupRows.prototype.getGroupedData = function () { + + return this.pullGroupListData(this.groupList); +}; + +GroupRows.prototype.getRowGroup = function (row) { + var match = false; + + this.groupList.forEach(function (group) { + var result = group.getRowGroup(row); + + if (result) { + match = result; + } + }); + + return match; +}; + +GroupRows.prototype.countGroups = function () { + return this.groupList.length; +}; + +GroupRows.prototype.generateGroups = function (rows) { + var self = this, + oldGroups = self.groups; + + self.groups = {}; + self.groupList = []; + + if (this.allowedValues && this.allowedValues[0]) { + this.allowedValues[0].forEach(function (value) { + self.createGroup(value, 0, oldGroups); + }); + + rows.forEach(function (row) { + self.assignRowToExistingGroup(row, oldGroups); + }); + } else { + rows.forEach(function (row) { + self.assignRowToGroup(row, oldGroups); + }); + } +}; + +GroupRows.prototype.createGroup = function (groupID, level, oldGroups) { + var groupKey = level + "_" + groupID, + group; + + oldGroups = oldGroups || []; + + group = new Group(this, false, level, groupID, this.groupIDLookups[0].field, this.headerGenerator[0], oldGroups[groupKey]); + + this.groups[groupKey] = group; + this.groupList.push(group); +}; + +// GroupRows.prototype.assignRowToGroup = function(row, oldGroups){ +// var groupID = this.groupIDLookups[0].func(row.getData()), +// groupKey = "0_" + groupID; + +// if(!this.groups[groupKey]){ +// this.createGroup(groupID, 0, oldGroups); +// } + +// this.groups[groupKey].addRow(row); +// }; + +GroupRows.prototype.assignRowToExistingGroup = function (row, oldGroups) { + var groupID = this.groupIDLookups[0].func(row.getData()), + groupKey = "0_" + groupID; + + if (this.groups[groupKey]) { + this.groups[groupKey].addRow(row); + } +}; + +GroupRows.prototype.assignRowToGroup = function (row, oldGroups) { + var groupID = this.groupIDLookups[0].func(row.getData()), + newGroupNeeded = !this.groups["0_" + groupID]; + + if (newGroupNeeded) { + this.createGroup(groupID, 0, oldGroups); + } + + this.groups["0_" + groupID].addRow(row); + + return !newGroupNeeded; +}; + +GroupRows.prototype.reassignRowToGroup = function (row) { + var oldRowGroup = row.getGroup(), + oldGroupPath = oldRowGroup.getPath(), + newGroupPath = this.getExpectedPath(row), + samePath = true; + // figure out if new group path is the same as old group path + var samePath = oldGroupPath.length == newGroupPath.length && oldGroupPath.every(function (element, index) { + return element === newGroupPath[index]; + }); + // refresh if they new path and old path aren't the same (aka the row's groupings have changed) + if (!samePath) { + oldRowGroup.removeRow(row); + this.assignRowToGroup(row, self.groups); + this.table.rowManager.refreshActiveData("group", false, true); + } +}; + +GroupRows.prototype.getExpectedPath = function (row) { + var groupPath = [], + rowData = row.getData(); + this.groupIDLookups.forEach(function (groupId) { + groupPath.push(groupId.func(rowData)); + }); + return groupPath; +}; + +GroupRows.prototype.updateGroupRows = function (force) { + var self = this, + output = [], + oldRowCount; + + self.groupList.forEach(function (group) { + output = output.concat(group.getHeadersAndRows()); + }); + + //force update of table display + if (force) { + + var displayIndex = self.table.rowManager.setDisplayRows(output, this.getDisplayIndex()); + + if (displayIndex !== true) { + this.setDisplayIndex(displayIndex); + } + + self.table.rowManager.refreshActiveData("group", true, true); + } + + return output; +}; + +GroupRows.prototype.scrollHeaders = function (left) { + if (this.table.options.virtualDomHoz) { + left -= this.table.vdomHoz.vDomPadLeft; + } + + left = left + "px"; + + this.groupList.forEach(function (group) { + group.scrollHeader(left); + }); +}; + +GroupRows.prototype.removeGroup = function (group) { + var groupKey = group.level + "_" + group.key, + index; + + if (this.groups[groupKey]) { + delete this.groups[groupKey]; + + index = this.groupList.indexOf(group); + + if (index > -1) { + this.groupList.splice(index, 1); + } + } +}; + +Tabulator.prototype.registerModule("groupRows", GroupRows); \ No newline at end of file diff --git a/website/js/vendor/tabulator/js/modules/group_rows.min.js b/website/js/vendor/tabulator/js/modules/group_rows.min.js new file mode 100644 index 0000000..f1b6996 --- /dev/null +++ b/website/js/vendor/tabulator/js/modules/group_rows.min.js @@ -0,0 +1,2 @@ +/* Tabulator v4.8.3 (c) Oliver Folkerd */ +var GroupComponent=function(t){this._group=t,this.type="GroupComponent"};GroupComponent.prototype.getKey=function(){return this._group.key},GroupComponent.prototype.getField=function(){return this._group.field},GroupComponent.prototype.getElement=function(){return this._group.element},GroupComponent.prototype.getRows=function(){return this._group.getRows(!0)},GroupComponent.prototype.getSubGroups=function(){return this._group.getSubGroups(!0)},GroupComponent.prototype.getParentGroup=function(){return!!this._group.parent&&this._group.parent.getComponent()},GroupComponent.prototype.getVisibility=function(){return console.warn("getVisibility function is deprecated, you should now use the isVisible function"),this._group.visible},GroupComponent.prototype.isVisible=function(){return this._group.visible},GroupComponent.prototype.show=function(){this._group.show()},GroupComponent.prototype.hide=function(){this._group.hide()},GroupComponent.prototype.toggle=function(){this._group.toggleVisibility()},GroupComponent.prototype._getSelf=function(){return this._group},GroupComponent.prototype.getTable=function(){return this._group.groupManager.table};var Group=function(t,o,e,r,i,s,n){this.groupManager=t,this.parent=o,this.key=r,this.level=e,this.field=i,this.hasSubGroups=e-1?e?this.rows.splice(i+1,0,t):this.rows.splice(i,0,t):e?this.rows.push(t):this.rows.unshift(t),t.modules.group=this,this.generateGroupHeaderContents(),this.groupManager.table.modExists("columnCalcs")&&"table"!=this.groupManager.table.options.columnCalcs&&this.groupManager.table.modules.columnCalcs.recalcGroup(this),this.groupManager.updateGroupRows(!0)},Group.prototype.scrollHeader=function(t){this.arrowElement.style.marginLeft=t,this.groupList.forEach(function(o){o.scrollHeader(t)})},Group.prototype.getRowIndex=function(t){},Group.prototype.conformRowData=function(t){return this.field?t[this.field]=this.key:console.warn("Data Conforming Error - Cannot conform row data to match new group as groupBy is a function"),this.parent&&(t=this.parent.conformRowData(t)),t},Group.prototype.removeRow=function(t){var o=this.rows.indexOf(t),e=t.getElement();o>-1&&this.rows.splice(o,1),this.groupManager.table.options.groupValues||this.rows.length?(e.parentNode&&e.parentNode.removeChild(e),this.generateGroupHeaderContents(),this.groupManager.table.modExists("columnCalcs")&&"table"!=this.groupManager.table.options.columnCalcs&&this.groupManager.table.modules.columnCalcs.recalcGroup(this)):(this.parent?this.parent.removeGroup(this):this.groupManager.removeGroup(this),this.groupManager.updateGroupRows(!0))},Group.prototype.removeGroup=function(t){var o,e=t.level+"_"+t.key;this.groups[e]&&(delete this.groups[e],o=this.groupList.indexOf(t),o>-1&&this.groupList.splice(o,1),this.groupList.length||(this.parent?this.parent.removeGroup(this):this.groupManager.removeGroup(this)))},Group.prototype.getHeadersAndRows=function(t){var o=[];return o.push(this),this._visSet(),this.visible?this.groupList.length?this.groupList.forEach(function(e){o=o.concat(e.getHeadersAndRows(t))}):(!t&&"table"!=this.groupManager.table.options.columnCalcs&&this.groupManager.table.modExists("columnCalcs")&&this.groupManager.table.modules.columnCalcs.hasTopCalcs()&&(this.calcs.top&&(this.calcs.top.detachElement(),this.calcs.top.deleteCells()),this.calcs.top=this.groupManager.table.modules.columnCalcs.generateTopRow(this.rows),o.push(this.calcs.top)),o=o.concat(this.rows),!t&&"table"!=this.groupManager.table.options.columnCalcs&&this.groupManager.table.modExists("columnCalcs")&&this.groupManager.table.modules.columnCalcs.hasBottomCalcs()&&(this.calcs.bottom&&(this.calcs.bottom.detachElement(),this.calcs.bottom.deleteCells()),this.calcs.bottom=this.groupManager.table.modules.columnCalcs.generateBottomRow(this.rows),o.push(this.calcs.bottom))):this.groupList.length||"table"==this.groupManager.table.options.columnCalcs||this.groupManager.table.modExists("columnCalcs")&&(!t&&this.groupManager.table.modules.columnCalcs.hasTopCalcs()&&(this.calcs.top&&(this.calcs.top.detachElement(),this.calcs.top.deleteCells()),this.groupManager.table.options.groupClosedShowCalcs&&(this.calcs.top=this.groupManager.table.modules.columnCalcs.generateTopRow(this.rows),o.push(this.calcs.top))),!t&&this.groupManager.table.modules.columnCalcs.hasBottomCalcs()&&(this.calcs.bottom&&(this.calcs.bottom.detachElement(),this.calcs.bottom.deleteCells()),this.groupManager.table.options.groupClosedShowCalcs&&(this.calcs.bottom=this.groupManager.table.modules.columnCalcs.generateBottomRow(this.rows),o.push(this.calcs.bottom)))),o},Group.prototype.getData=function(t,o){var e=[];return this._visSet(),(!t||t&&this.visible)&&this.rows.forEach(function(t){e.push(t.getData(o||"data"))}),e},Group.prototype.getRowCount=function(){var t=0;return this.groupList.length?this.groupList.forEach(function(o){t+=o.getRowCount()}):t=this.rows.length,t},Group.prototype.toggleVisibility=function(){this.visible?this.hide():this.show()},Group.prototype.hide=function(){this.visible=!1,"classic"!=this.groupManager.table.rowManager.getRenderMode()||this.groupManager.table.options.pagination?this.groupManager.updateGroupRows(!0):(this.element.classList.remove("tabulator-group-visible"),this.groupList.length?this.groupList.forEach(function(t){t.getHeadersAndRows().forEach(function(t){t.detachElement()})}):this.rows.forEach(function(t){var o=t.getElement();o.parentNode.removeChild(o)}),this.groupManager.table.rowManager.setDisplayRows(this.groupManager.updateGroupRows(),this.groupManager.getDisplayIndex()),this.groupManager.table.rowManager.checkClassicModeGroupHeaderWidth()),this.groupManager.table.options.groupVisibilityChanged.call(this.table,this.getComponent(),!1)},Group.prototype.show=function(){var t=this;if(t.visible=!0,"classic"!=this.groupManager.table.rowManager.getRenderMode()||this.groupManager.table.options.pagination)this.groupManager.updateGroupRows(!0);else{this.element.classList.add("tabulator-group-visible");var o=t.getElement();this.groupList.length?this.groupList.forEach(function(t){t.getHeadersAndRows().forEach(function(t){var e=t.getElement();o.parentNode.insertBefore(e,o.nextSibling),t.initialize(),o=e})}):t.rows.forEach(function(t){var e=t.getElement();o.parentNode.insertBefore(e,o.nextSibling),t.initialize(),o=e}),this.groupManager.table.rowManager.setDisplayRows(this.groupManager.updateGroupRows(),this.groupManager.getDisplayIndex()),this.groupManager.table.rowManager.checkClassicModeGroupHeaderWidth()}this.groupManager.table.options.groupVisibilityChanged.call(this.table,this.getComponent(),!0)},Group.prototype._visSet=function(){var t=[];"function"==typeof this.visible&&(this.rows.forEach(function(o){t.push(o.getData())}),this.visible=this.visible(this.key,this.getRowCount(),t,this.getComponent()))},Group.prototype.getRowGroup=function(t){var o=!1;return this.groupList.length?this.groupList.forEach(function(e){var r=e.getRowGroup(t);r&&(o=r)}):this.rows.find(function(o){return o===t})&&(o=this),o},Group.prototype.getSubGroups=function(t){var o=[];return this.groupList.forEach(function(e){o.push(t?e.getComponent():e)}),o},Group.prototype.getRows=function(t){var o=[];return this.rows.forEach(function(e){o.push(t?e.getComponent():e)}),o},Group.prototype.generateGroupHeaderContents=function(){var t=[];for(this.rows.forEach(function(o){t.push(o.getData())}),this.elementContents=this.generator(this.key,this.getRowCount(),t,this.getComponent());this.element.firstChild;)this.element.removeChild(this.element.firstChild);"string"==typeof this.elementContents?this.element.innerHTML=this.elementContents:this.element.appendChild(this.elementContents),this.element.insertBefore(this.arrowElement,this.element.firstChild)},Group.prototype.getPath=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return t.unshift(this.key),this.parent&&this.parent.getPath(t),t},Group.prototype.getElement=function(){this.addBindingsd=!1,this._visSet(),this.visible?this.element.classList.add("tabulator-group-visible"):this.element.classList.remove("tabulator-group-visible");for(var t=0;tr.length&&console.warn("Error creating group headers, groupHeader array is shorter than groupBy array"),t.headerGenerator=[function(){return""}],this.startOpen=[function(){return!1}],t.table.modules.localize.bind("groups|item",function(o,e){t.headerGenerator[0]=function(t,r,i){return(void 0===t?"":t)+"("+r+" "+(1===r?o:e.groups.items)+")"}}),this.groupIDLookups=[],Array.isArray(o)||o)this.table.modExists("columnCalcs")&&"table"!=this.table.options.columnCalcs&&"both"!=this.table.options.columnCalcs&&this.table.modules.columnCalcs.removeCalcs();else if(this.table.modExists("columnCalcs")&&"group"!=this.table.options.columnCalcs){var i=this.table.columnManager.getRealColumns();i.forEach(function(o){o.definition.topCalc&&t.table.modules.columnCalcs.initializeTopRow(),o.definition.bottomCalc&&t.table.modules.columnCalcs.initializeBottomRow()})}Array.isArray(o)||(o=[o]),o.forEach(function(o,e){var r,i;"function"==typeof o?r=o:(i=t.table.columnManager.getColumnByField(o),r=i?function(t){return i.getFieldValue(t)}:function(t){return t[o]}),t.groupIDLookups.push({field:"function"!=typeof o&&o,func:r,values:!!t.allowedValues&&t.allowedValues[e]})}),e&&(Array.isArray(e)||(e=[e]),e.forEach(function(t){t="function"==typeof t?t:function(){return!0}}),t.startOpen=e),r&&(t.headerGenerator=Array.isArray(r)?r:[r]),this.initialized=!0},GroupRows.prototype.setDisplayIndex=function(t){this.displayIndex=t},GroupRows.prototype.getDisplayIndex=function(){return this.displayIndex},GroupRows.prototype.getRows=function(t){return this.groupIDLookups.length?(this.table.options.dataGrouping.call(this.table),this.generateGroups(t),this.table.options.dataGrouped&&this.table.options.dataGrouped.call(this.table,this.getGroups(!0)),this.updateGroupRows()):t.slice(0)},GroupRows.prototype.getGroups=function(t){var o=[];return this.groupList.forEach(function(e){o.push(t?e.getComponent():e)}),o},GroupRows.prototype.getChildGroups=function(t){var o=this,e=[];return t||(t=this),t.groupList.forEach(function(t){t.groupList.length?e=e.concat(o.getChildGroups(t)):e.push(t)}),e},GroupRows.prototype.wipe=function(){this.groupList.forEach(function(t){t.wipe()})},GroupRows.prototype.pullGroupListData=function(t){var o=this,e=[];return t.forEach(function(t){var r={};r.level=0,r.rowCount=0,r.headerContent="";var i=[];t.hasSubGroups?(i=o.pullGroupListData(t.groupList),r.level=t.level,r.rowCount=i.length-t.groupList.length,r.headerContent=t.generator(t.key,r.rowCount,t.rows,t),e.push(r),e=e.concat(i)):(r.level=t.level,r.headerContent=t.generator(t.key,t.rows.length,t.rows,t),r.rowCount=t.getRows().length,e.push(r),t.getRows().forEach(function(t){e.push(t.getData("data"))}))}),e},GroupRows.prototype.getGroupedData=function(){return this.pullGroupListData(this.groupList)},GroupRows.prototype.getRowGroup=function(t){var o=!1;return this.groupList.forEach(function(e){var r=e.getRowGroup(t);r&&(o=r)}),o},GroupRows.prototype.countGroups=function(){return this.groupList.length},GroupRows.prototype.generateGroups=function(t){var o=this,e=o.groups;o.groups={},o.groupList=[],this.allowedValues&&this.allowedValues[0]?(this.allowedValues[0].forEach(function(t){o.createGroup(t,0,e)}),t.forEach(function(t){o.assignRowToExistingGroup(t,e)})):t.forEach(function(t){o.assignRowToGroup(t,e)})},GroupRows.prototype.createGroup=function(t,o,e){var r,i=o+"_"+t;e=e||[],r=new Group(this,!1,o,t,this.groupIDLookups[0].field,this.headerGenerator[0],e[i]),this.groups[i]=r,this.groupList.push(r)},GroupRows.prototype.assignRowToExistingGroup=function(t,o){var e=this.groupIDLookups[0].func(t.getData()),r="0_"+e;this.groups[r]&&this.groups[r].addRow(t)},GroupRows.prototype.assignRowToGroup=function(t,o){var e=this.groupIDLookups[0].func(t.getData()),r=!this.groups["0_"+e];return r&&this.createGroup(e,0,o),this.groups["0_"+e].addRow(t),!r},GroupRows.prototype.reassignRowToGroup=function(t){var o=t.getGroup(),e=o.getPath(),r=this.getExpectedPath(t);e.length==r.length&&e.every(function(t,o){return t===r[o]})||(o.removeRow(t),this.assignRowToGroup(t,self.groups),this.table.rowManager.refreshActiveData("group",!1,!0))},GroupRows.prototype.getExpectedPath=function(t){var o=[],e=t.getData();return this.groupIDLookups.forEach(function(t){o.push(t.func(e))}),o},GroupRows.prototype.updateGroupRows=function(t){var o=this,e=[];if(o.groupList.forEach(function(t){e=e.concat(t.getHeadersAndRows())}),t){var r=o.table.rowManager.setDisplayRows(e,this.getDisplayIndex());!0!==r&&this.setDisplayIndex(r),o.table.rowManager.refreshActiveData("group",!0,!0)}return e},GroupRows.prototype.scrollHeaders=function(t){this.table.options.virtualDomHoz&&(t-=this.table.vdomHoz.vDomPadLeft),t+="px",this.groupList.forEach(function(o){o.scrollHeader(t)})},GroupRows.prototype.removeGroup=function(t){var o,e=t.level+"_"+t.key;this.groups[e]&&(delete this.groups[e],(o=this.groupList.indexOf(t))>-1&&this.groupList.splice(o,1))},Tabulator.prototype.registerModule("groupRows",GroupRows); \ No newline at end of file diff --git a/website/js/vendor/tabulator/js/modules/history.js b/website/js/vendor/tabulator/js/modules/history.js new file mode 100644 index 0000000..87a053d --- /dev/null +++ b/website/js/vendor/tabulator/js/modules/history.js @@ -0,0 +1,156 @@ +/* Tabulator v4.8.3 (c) Oliver Folkerd */ + +var History = function History(table) { + this.table = table; //hold Tabulator object + + this.history = []; + this.index = -1; +}; + +History.prototype.clear = function () { + this.history = []; + this.index = -1; +}; + +History.prototype.action = function (type, component, data) { + + this.history = this.history.slice(0, this.index + 1); + + this.history.push({ + type: type, + component: component, + data: data + }); + + this.index++; +}; + +History.prototype.getHistoryUndoSize = function () { + return this.index + 1; +}; + +History.prototype.getHistoryRedoSize = function () { + return this.history.length - (this.index + 1); +}; + +History.prototype.clearComponentHistory = function (component) { + var index = this.history.findIndex(function (item) { + return item.component === component; + }); + + if (index > -1) { + this.history.splice(index, 1); + if (index <= this.index) { + this.index--; + } + + this.clearComponentHistory(component); + } +}; + +History.prototype.undo = function () { + + if (this.index > -1) { + var action = this.history[this.index]; + + this.undoers[action.type].call(this, action); + + this.index--; + + this.table.options.historyUndo.call(this.table, action.type, action.component.getComponent(), action.data); + + return true; + } else { + console.warn("History Undo Error - No more history to undo"); + return false; + } +}; + +History.prototype.redo = function () { + if (this.history.length - 1 > this.index) { + + this.index++; + + var action = this.history[this.index]; + + this.redoers[action.type].call(this, action); + + this.table.options.historyRedo.call(this.table, action.type, action.component.getComponent(), action.data); + + return true; + } else { + console.warn("History Redo Error - No more history to redo"); + return false; + } +}; + +History.prototype.undoers = { + cellEdit: function cellEdit(action) { + action.component.setValueProcessData(action.data.oldValue); + }, + + rowAdd: function rowAdd(action) { + action.component.deleteActual(); + }, + + rowDelete: function rowDelete(action) { + var newRow = this.table.rowManager.addRowActual(action.data.data, action.data.pos, action.data.index); + + if (this.table.options.groupBy && this.table.modExists("groupRows")) { + this.table.modules.groupRows.updateGroupRows(true); + } + + this._rebindRow(action.component, newRow); + }, + + rowMove: function rowMove(action) { + this.table.rowManager.moveRowActual(action.component, this.table.rowManager.rows[action.data.posFrom], !action.data.after); + this.table.rowManager.redraw(); + } +}; + +History.prototype.redoers = { + cellEdit: function cellEdit(action) { + action.component.setValueProcessData(action.data.newValue); + }, + + rowAdd: function rowAdd(action) { + var newRow = this.table.rowManager.addRowActual(action.data.data, action.data.pos, action.data.index); + + if (this.table.options.groupBy && this.table.modExists("groupRows")) { + this.table.modules.groupRows.updateGroupRows(true); + } + + this._rebindRow(action.component, newRow); + }, + + rowDelete: function rowDelete(action) { + action.component.deleteActual(); + }, + + rowMove: function rowMove(action) { + this.table.rowManager.moveRowActual(action.component, this.table.rowManager.rows[action.data.posTo], action.data.after); + this.table.rowManager.redraw(); + } +}; + +//rebind rows to new element after deletion +History.prototype._rebindRow = function (oldRow, newRow) { + this.history.forEach(function (action) { + if (action.component instanceof Row) { + if (action.component === oldRow) { + action.component = newRow; + } + } else if (action.component instanceof Cell) { + if (action.component.row === oldRow) { + var field = action.component.column.getField(); + + if (field) { + action.component = newRow.getCell(field); + } + } + } + }); +}; + +Tabulator.prototype.registerModule("history", History); \ No newline at end of file diff --git a/website/js/vendor/tabulator/js/modules/history.min.js b/website/js/vendor/tabulator/js/modules/history.min.js new file mode 100644 index 0000000..ed4acef --- /dev/null +++ b/website/js/vendor/tabulator/js/modules/history.min.js @@ -0,0 +1,2 @@ +/* Tabulator v4.8.3 (c) Oliver Folkerd */ +var History=function(t){this.table=t,this.history=[],this.index=-1};History.prototype.clear=function(){this.history=[],this.index=-1},History.prototype.action=function(t,o,e){this.history=this.history.slice(0,this.index+1),this.history.push({type:t,component:o,data:e}),this.index++},History.prototype.getHistoryUndoSize=function(){return this.index+1},History.prototype.getHistoryRedoSize=function(){return this.history.length-(this.index+1)},History.prototype.clearComponentHistory=function(t){var o=this.history.findIndex(function(o){return o.component===t});o>-1&&(this.history.splice(o,1),o<=this.index&&this.index--,this.clearComponentHistory(t))},History.prototype.undo=function(){if(this.index>-1){var t=this.history[this.index];return this.undoers[t.type].call(this,t),this.index--,this.table.options.historyUndo.call(this.table,t.type,t.component.getComponent(),t.data),!0}return console.warn("History Undo Error - No more history to undo"),!1},History.prototype.redo=function(){if(this.history.length-1>this.index){this.index++;var t=this.history[this.index];return this.redoers[t.type].call(this,t),this.table.options.historyRedo.call(this.table,t.type,t.component.getComponent(),t.data),!0}return console.warn("History Redo Error - No more history to redo"),!1},History.prototype.undoers={cellEdit:function(t){t.component.setValueProcessData(t.data.oldValue)},rowAdd:function(t){t.component.deleteActual()},rowDelete:function(t){var o=this.table.rowManager.addRowActual(t.data.data,t.data.pos,t.data.index);this.table.options.groupBy&&this.table.modExists("groupRows")&&this.table.modules.groupRows.updateGroupRows(!0),this._rebindRow(t.component,o)},rowMove:function(t){this.table.rowManager.moveRowActual(t.component,this.table.rowManager.rows[t.data.posFrom],!t.data.after),this.table.rowManager.redraw()}},History.prototype.redoers={cellEdit:function(t){t.component.setValueProcessData(t.data.newValue)},rowAdd:function(t){var o=this.table.rowManager.addRowActual(t.data.data,t.data.pos,t.data.index);this.table.options.groupBy&&this.table.modExists("groupRows")&&this.table.modules.groupRows.updateGroupRows(!0),this._rebindRow(t.component,o)},rowDelete:function(t){t.component.deleteActual()},rowMove:function(t){this.table.rowManager.moveRowActual(t.component,this.table.rowManager.rows[t.data.posTo],t.data.after),this.table.rowManager.redraw()}},History.prototype._rebindRow=function(t,o){this.history.forEach(function(e){if(e.component instanceof Row)e.component===t&&(e.component=o);else if(e.component instanceof Cell&&e.component.row===t){var i=e.component.column.getField();i&&(e.component=o.getCell(i))}})},Tabulator.prototype.registerModule("history",History); \ No newline at end of file diff --git a/website/js/vendor/tabulator/js/modules/html_table_import.js b/website/js/vendor/tabulator/js/modules/html_table_import.js new file mode 100644 index 0000000..2f5f0fb --- /dev/null +++ b/website/js/vendor/tabulator/js/modules/html_table_import.js @@ -0,0 +1,191 @@ +var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; + +/* Tabulator v4.8.3 (c) Oliver Folkerd */ + +var HtmlTableImport = function HtmlTableImport(table) { + this.table = table; //hold Tabulator object + this.fieldIndex = []; + this.hasIndex = false; +}; + +HtmlTableImport.prototype.parseTable = function () { + var self = this, + element = self.table.element, + options = self.table.options, + columns = options.columns, + headers = element.getElementsByTagName("th"), + rows = element.getElementsByTagName("tbody")[0], + data = [], + newTable; + + self.hasIndex = false; + + self.table.options.htmlImporting.call(this.table); + + rows = rows ? rows.getElementsByTagName("tr") : []; + + //check for tablator inline options + self._extractOptions(element, options); + + if (headers.length) { + self._extractHeaders(headers, rows); + } else { + self._generateBlankHeaders(headers, rows); + } + + //iterate through table rows and build data set + for (var index = 0; index < rows.length; index++) { + var row = rows[index], + cells = row.getElementsByTagName("td"), + item = {}; + + //create index if the dont exist in table + if (!self.hasIndex) { + item[options.index] = index; + } + + for (var i = 0; i < cells.length; i++) { + var cell = cells[i]; + if (typeof this.fieldIndex[i] !== "undefined") { + item[this.fieldIndex[i]] = cell.innerHTML; + } + } + + //add row data to item + data.push(item); + } + + //create new element + var newElement = document.createElement("div"); + + //transfer attributes to new element + var attributes = element.attributes; + + // loop through attributes and apply them on div + + for (var i in attributes) { + if (_typeof(attributes[i]) == "object") { + newElement.setAttribute(attributes[i].name, attributes[i].value); + } + } + + // replace table with div element + element.parentNode.replaceChild(newElement, element); + + options.data = data; + + self.table.options.htmlImported.call(this.table); + + // // newElement.tabulator(options); + + this.table.element = newElement; +}; + +//extract tabulator attribute options +HtmlTableImport.prototype._extractOptions = function (element, options, defaultOptions) { + var attributes = element.attributes; + var optionsArr = defaultOptions ? Object.assign([], defaultOptions) : Object.keys(options); + var optionsList = {}; + + optionsArr.forEach(function (item) { + optionsList[item.toLowerCase()] = item; + }); + + for (var index in attributes) { + var attrib = attributes[index]; + var name; + + if (attrib && (typeof attrib === "undefined" ? "undefined" : _typeof(attrib)) == "object" && attrib.name && attrib.name.indexOf("tabulator-") === 0) { + name = attrib.name.replace("tabulator-", ""); + + if (typeof optionsList[name] !== "undefined") { + options[optionsList[name]] = this._attribValue(attrib.value); + } + } + } +}; + +//get value of attribute +HtmlTableImport.prototype._attribValue = function (value) { + if (value === "true") { + return true; + } + + if (value === "false") { + return false; + } + + return value; +}; + +//find column if it has already been defined +HtmlTableImport.prototype._findCol = function (title) { + var match = this.table.options.columns.find(function (column) { + return column.title === title; + }); + + return match || false; +}; + +//extract column from headers +HtmlTableImport.prototype._extractHeaders = function (headers, rows) { + for (var index = 0; index < headers.length; index++) { + var header = headers[index], + exists = false, + col = this._findCol(header.textContent), + width, + attributes; + + if (col) { + exists = true; + } else { + col = { title: header.textContent.trim() }; + } + + if (!col.field) { + col.field = header.textContent.trim().toLowerCase().replace(" ", "_"); + } + + width = header.getAttribute("width"); + + if (width && !col.width) { + col.width = width; + } + + //check for tablator inline options + attributes = header.attributes; + + // //check for tablator inline options + this._extractOptions(header, col, Column.prototype.defaultOptionList); + + this.fieldIndex[index] = col.field; + + if (col.field == this.table.options.index) { + this.hasIndex = true; + } + + if (!exists) { + this.table.options.columns.push(col); + } + } +}; + +//generate blank headers +HtmlTableImport.prototype._generateBlankHeaders = function (headers, rows) { + for (var index = 0; index < headers.length; index++) { + var header = headers[index], + col = { title: "", field: "col" + index }; + + this.fieldIndex[index] = col.field; + + var width = header.getAttribute("width"); + + if (width) { + col.width = width; + } + + this.table.options.columns.push(col); + } +}; + +Tabulator.prototype.registerModule("htmlTableImport", HtmlTableImport); \ No newline at end of file diff --git a/website/js/vendor/tabulator/js/modules/html_table_import.min.js b/website/js/vendor/tabulator/js/modules/html_table_import.min.js new file mode 100644 index 0000000..0076035 --- /dev/null +++ b/website/js/vendor/tabulator/js/modules/html_table_import.min.js @@ -0,0 +1,2 @@ +/* Tabulator v4.8.3 (c) Oliver Folkerd */ +var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},HtmlTableImport=function(t){this.table=t,this.fieldIndex=[],this.hasIndex=!1};HtmlTableImport.prototype.parseTable=function(){var t=this,e=t.table.element,o=t.table.options,a=(o.columns,e.getElementsByTagName("th")),n=e.getElementsByTagName("tbody")[0],l=[];t.hasIndex=!1,t.table.options.htmlImporting.call(this.table),n=n?n.getElementsByTagName("tr"):[],t._extractOptions(e,o),a.length?t._extractHeaders(a,n):t._generateBlankHeaders(a,n);for(var r=0;r -1) { + self.pressedKeys.splice(index, 1); + } + } + }; + + this.table.element.addEventListener("keydown", this.keyupBinding); + + this.table.element.addEventListener("keyup", this.keydownBinding); +}; + +Keybindings.prototype.clearBindings = function () { + if (this.keyupBinding) { + this.table.element.removeEventListener("keydown", this.keyupBinding); + } + + if (this.keydownBinding) { + this.table.element.removeEventListener("keyup", this.keydownBinding); + } +}; + +Keybindings.prototype.checkBinding = function (e, binding) { + var self = this, + match = true; + + if (e.ctrlKey == binding.ctrl && e.shiftKey == binding.shift && e.metaKey == binding.meta) { + binding.keys.forEach(function (key) { + var index = self.pressedKeys.indexOf(key); + + if (index == -1) { + match = false; + } + }); + + if (match) { + binding.action.call(self, e); + } + + return true; + } + + return false; +}; + +//default bindings +Keybindings.prototype.bindings = { + navPrev: "shift + 9", + navNext: 9, + navUp: 38, + navDown: 40, + scrollPageUp: 33, + scrollPageDown: 34, + scrollToStart: 36, + scrollToEnd: 35, + undo: "ctrl + 90", + redo: "ctrl + 89", + copyToClipboard: "ctrl + 67" +}; + +//default actions +Keybindings.prototype.actions = { + keyBlock: function keyBlock(e) { + e.stopPropagation(); + e.preventDefault(); + }, + scrollPageUp: function scrollPageUp(e) { + var rowManager = this.table.rowManager, + newPos = rowManager.scrollTop - rowManager.height, + scrollMax = rowManager.element.scrollHeight; + + e.preventDefault(); + + if (rowManager.displayRowsCount) { + if (newPos >= 0) { + rowManager.element.scrollTop = newPos; + } else { + rowManager.scrollToRow(rowManager.getDisplayRows()[0]); + } + } + + this.table.element.focus(); + }, + scrollPageDown: function scrollPageDown(e) { + var rowManager = this.table.rowManager, + newPos = rowManager.scrollTop + rowManager.height, + scrollMax = rowManager.element.scrollHeight; + + e.preventDefault(); + + if (rowManager.displayRowsCount) { + if (newPos <= scrollMax) { + rowManager.element.scrollTop = newPos; + } else { + rowManager.scrollToRow(rowManager.getDisplayRows()[rowManager.displayRowsCount - 1]); + } + } + + this.table.element.focus(); + }, + scrollToStart: function scrollToStart(e) { + var rowManager = this.table.rowManager; + + e.preventDefault(); + + if (rowManager.displayRowsCount) { + rowManager.scrollToRow(rowManager.getDisplayRows()[0]); + } + + this.table.element.focus(); + }, + scrollToEnd: function scrollToEnd(e) { + var rowManager = this.table.rowManager; + + e.preventDefault(); + + if (rowManager.displayRowsCount) { + rowManager.scrollToRow(rowManager.getDisplayRows()[rowManager.displayRowsCount - 1]); + } + + this.table.element.focus(); + }, + navPrev: function navPrev(e) { + var cell = false; + + if (this.table.modExists("edit")) { + cell = this.table.modules.edit.currentCell; + + if (cell) { + e.preventDefault(); + cell.nav().prev(); + } + } + }, + + navNext: function navNext(e) { + var cell = false; + var newRow = this.table.options.tabEndNewRow; + var nav; + + if (this.table.modExists("edit")) { + cell = this.table.modules.edit.currentCell; + + if (cell) { + e.preventDefault(); + + nav = cell.nav(); + + if (!nav.next()) { + if (newRow) { + + cell.getElement().firstChild.blur(); + + if (newRow === true) { + newRow = this.table.addRow({}); + } else { + if (typeof newRow == "function") { + newRow = this.table.addRow(newRow(cell.row.getComponent())); + } else { + newRow = this.table.addRow(Object.assign({}, newRow)); + } + } + + newRow.then(function () { + setTimeout(function () { + nav.next(); + }); + }); + } + } + } + } + }, + + navLeft: function navLeft(e) { + var cell = false; + + if (this.table.modExists("edit")) { + cell = this.table.modules.edit.currentCell; + + if (cell) { + e.preventDefault(); + cell.nav().left(); + } + } + }, + + navRight: function navRight(e) { + var cell = false; + + if (this.table.modExists("edit")) { + cell = this.table.modules.edit.currentCell; + + if (cell) { + e.preventDefault(); + cell.nav().right(); + } + } + }, + + navUp: function navUp(e) { + var cell = false; + + if (this.table.modExists("edit")) { + cell = this.table.modules.edit.currentCell; + + if (cell) { + e.preventDefault(); + cell.nav().up(); + } + } + }, + + navDown: function navDown(e) { + var cell = false; + + if (this.table.modExists("edit")) { + cell = this.table.modules.edit.currentCell; + + if (cell) { + e.preventDefault(); + cell.nav().down(); + } + } + }, + + undo: function undo(e) { + var cell = false; + if (this.table.options.history && this.table.modExists("history") && this.table.modExists("edit")) { + + cell = this.table.modules.edit.currentCell; + + if (!cell) { + e.preventDefault(); + this.table.modules.history.undo(); + } + } + }, + + redo: function redo(e) { + var cell = false; + if (this.table.options.history && this.table.modExists("history") && this.table.modExists("edit")) { + + cell = this.table.modules.edit.currentCell; + + if (!cell) { + e.preventDefault(); + this.table.modules.history.redo(); + } + } + }, + + copyToClipboard: function copyToClipboard(e) { + if (!this.table.modules.edit.currentCell) { + if (this.table.modExists("clipboard", true)) { + this.table.modules.clipboard.copy(false, true); + } + } + } +}; + +Tabulator.prototype.registerModule("keybindings", Keybindings); \ No newline at end of file diff --git a/website/js/vendor/tabulator/js/modules/keybindings.min.js b/website/js/vendor/tabulator/js/modules/keybindings.min.js new file mode 100644 index 0000000..96f0fcf --- /dev/null +++ b/website/js/vendor/tabulator/js/modules/keybindings.min.js @@ -0,0 +1,2 @@ +/* Tabulator v4.8.3 (c) Oliver Folkerd */ +var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Keybindings=function(t){this.table=t,this.watchKeys=null,this.pressedKeys=null,this.keyupBinding=!1,this.keydownBinding=!1};Keybindings.prototype.initialize=function(){var t=this.table.options.keybindings,e={};if(this.watchKeys={},this.pressedKeys=[],!1!==t){for(var i in this.bindings)e[i]=this.bindings[i];if(Object.keys(t).length)for(var n in t)e[n]=t[n];this.mapBindings(e),this.bindEvents()}},Keybindings.prototype.mapBindings=function(t){var e=this,i=this;for(var n in t)!function(n){e.actions[n]?t[n]&&("object"!==_typeof(t[n])&&(t[n]=[t[n]]),t[n].forEach(function(t){i.mapBinding(n,t)})):console.warn("Key Binding Error - no such action:",n)}(n)},Keybindings.prototype.mapBinding=function(t,e){var i=this,n={action:this.actions[t],keys:[],ctrl:!1,shift:!1,meta:!1};e.toString().toLowerCase().split(" ").join("").split("+").forEach(function(t){switch(t){case"ctrl":n.ctrl=!0;break;case"shift":n.shift=!0;break;case"meta":n.meta=!0;break;default:t=parseInt(t),n.keys.push(t),i.watchKeys[t]||(i.watchKeys[t]=[]),i.watchKeys[t].push(n)}})},Keybindings.prototype.bindEvents=function(){var t=this;this.keyupBinding=function(e){var i=e.keyCode,n=t.watchKeys[i];n&&(t.pressedKeys.push(i),n.forEach(function(i){t.checkBinding(e,i)}))},this.keydownBinding=function(e){var i=e.keyCode;if(t.watchKeys[i]){var n=t.pressedKeys.indexOf(i);n>-1&&t.pressedKeys.splice(n,1)}},this.table.element.addEventListener("keydown",this.keyupBinding),this.table.element.addEventListener("keyup",this.keydownBinding)},Keybindings.prototype.clearBindings=function(){this.keyupBinding&&this.table.element.removeEventListener("keydown",this.keyupBinding),this.keydownBinding&&this.table.element.removeEventListener("keyup",this.keydownBinding)},Keybindings.prototype.checkBinding=function(t,e){var i=this,n=!0;return t.ctrlKey==e.ctrl&&t.shiftKey==e.shift&&t.metaKey==e.meta&&(e.keys.forEach(function(t){-1==i.pressedKeys.indexOf(t)&&(n=!1)}),n&&e.action.call(i,t),!0)},Keybindings.prototype.bindings={navPrev:"shift + 9",navNext:9,navUp:38,navDown:40,scrollPageUp:33,scrollPageDown:34,scrollToStart:36,scrollToEnd:35,undo:"ctrl + 90",redo:"ctrl + 89",copyToClipboard:"ctrl + 67"},Keybindings.prototype.actions={keyBlock:function(t){t.stopPropagation(),t.preventDefault()},scrollPageUp:function(t){var e=this.table.rowManager,i=e.scrollTop-e.height;e.element.scrollHeight;t.preventDefault(),e.displayRowsCount&&(i>=0?e.element.scrollTop=i:e.scrollToRow(e.getDisplayRows()[0])),this.table.element.focus()},scrollPageDown:function(t){var e=this.table.rowManager,i=e.scrollTop+e.height,n=e.element.scrollHeight;t.preventDefault(),e.displayRowsCount&&(i<=n?e.element.scrollTop=i:e.scrollToRow(e.getDisplayRows()[e.displayRowsCount-1])),this.table.element.focus()},scrollToStart:function(t){var e=this.table.rowManager;t.preventDefault(),e.displayRowsCount&&e.scrollToRow(e.getDisplayRows()[0]),this.table.element.focus()},scrollToEnd:function(t){var e=this.table.rowManager;t.preventDefault(),e.displayRowsCount&&e.scrollToRow(e.getDisplayRows()[e.displayRowsCount-1]),this.table.element.focus()},navPrev:function(t){var e=!1;this.table.modExists("edit")&&(e=this.table.modules.edit.currentCell)&&(t.preventDefault(),e.nav().prev())},navNext:function(t){var e,i=!1,n=this.table.options.tabEndNewRow;this.table.modExists("edit")&&(i=this.table.modules.edit.currentCell)&&(t.preventDefault(),e=i.nav(),e.next()||n&&(i.getElement().firstChild.blur(),n=!0===n?this.table.addRow({}):"function"==typeof n?this.table.addRow(n(i.row.getComponent())):this.table.addRow(Object.assign({},n)),n.then(function(){setTimeout(function(){e.next()})})))},navLeft:function(t){var e=!1;this.table.modExists("edit")&&(e=this.table.modules.edit.currentCell)&&(t.preventDefault(),e.nav().left())},navRight:function(t){var e=!1;this.table.modExists("edit")&&(e=this.table.modules.edit.currentCell)&&(t.preventDefault(),e.nav().right())},navUp:function(t){var e=!1;this.table.modExists("edit")&&(e=this.table.modules.edit.currentCell)&&(t.preventDefault(),e.nav().up())},navDown:function(t){var e=!1;this.table.modExists("edit")&&(e=this.table.modules.edit.currentCell)&&(t.preventDefault(),e.nav().down())},undo:function(t){this.table.options.history&&this.table.modExists("history")&&this.table.modExists("edit")&&(this.table.modules.edit.currentCell||(t.preventDefault(),this.table.modules.history.undo()))},redo:function(t){this.table.options.history&&this.table.modExists("history")&&this.table.modExists("edit")&&(this.table.modules.edit.currentCell||(t.preventDefault(),this.table.modules.history.redo()))},copyToClipboard:function(t){this.table.modules.edit.currentCell||this.table.modExists("clipboard",!0)&&this.table.modules.clipboard.copy(!1,!0)}},Tabulator.prototype.registerModule("keybindings",Keybindings); \ No newline at end of file diff --git a/website/js/vendor/tabulator/js/modules/menu.js b/website/js/vendor/tabulator/js/modules/menu.js new file mode 100644 index 0000000..bbcf83d --- /dev/null +++ b/website/js/vendor/tabulator/js/modules/menu.js @@ -0,0 +1,241 @@ +/* Tabulator v4.8.3 (c) Oliver Folkerd */ + +var Menu = function Menu(table) { + this.table = table; //hold Tabulator object + this.menuEl = false; + this.blurEvent = this.hideMenu.bind(this); + this.escEvent = this.escMenu.bind(this); + this.nestedMenuBlock = false; +}; + +Menu.prototype.initializeColumnHeader = function (column) { + var _this = this; + + var headerMenuEl; + + if (column.definition.headerContextMenu) { + column.getElement().addEventListener("contextmenu", this.LoadMenuEvent.bind(this, column, column.definition.headerContextMenu)); + this.tapHold(column, column.definition.headerContextMenu); + } + + // if(column.definition.headerClickMenu){ + // column.getElement().addEventListener("click", this.LoadMenuEvent.bind(this, column, column.definition.headerClickMenu)); + // } + + if (column.definition.headerMenu) { + + headerMenuEl = document.createElement("span"); + headerMenuEl.classList.add("tabulator-header-menu-button"); + headerMenuEl.innerHTML = "⋮"; + + headerMenuEl.addEventListener("click", function (e) { + var menu = typeof column.definition.headerMenu == "function" ? column.definition.headerMenu(column.getComponent(), e) : column.definition.headerMenu; + e.stopPropagation(); + e.preventDefault(); + + _this.loadMenu(e, column, menu); + }); + + column.titleElement.insertBefore(headerMenuEl, column.titleElement.firstChild); + } +}; + +Menu.prototype.LoadMenuEvent = function (component, menu, e) { + menu = typeof menu == "function" ? menu(component.getComponent(), e) : menu; + + // if(component instanceof Cell){ + // e.stopImmediatePropagation(); + // } + + this.loadMenu(e, component, menu); +}; + +Menu.prototype.tapHold = function (component, menu) { + var _this2 = this; + + var element = component.getElement(), + tapHold = null, + loaded = false; + + element.addEventListener("touchstart", function (e) { + clearTimeout(tapHold); + loaded = false; + + tapHold = setTimeout(function () { + clearTimeout(tapHold); + tapHold = null; + loaded = true; + + _this2.LoadMenuEvent(component, menu, e); + }, 1000); + }, { passive: true }); + + element.addEventListener("touchend", function (e) { + clearTimeout(tapHold); + tapHold = null; + + if (loaded) { + e.preventDefault(); + } + }); +}; + +Menu.prototype.initializeCell = function (cell) { + if (cell.column.definition.contextMenu) { + cell.getElement().addEventListener("contextmenu", this.LoadMenuEvent.bind(this, cell, cell.column.definition.contextMenu)); + this.tapHold(cell, cell.column.definition.contextMenu); + } + + if (cell.column.definition.clickMenu) { + cell.getElement().addEventListener("click", this.LoadMenuEvent.bind(this, cell, cell.column.definition.clickMenu)); + } +}; + +Menu.prototype.initializeRow = function (row) { + if (this.table.options.rowContextMenu) { + row.getElement().addEventListener("contextmenu", this.LoadMenuEvent.bind(this, row, this.table.options.rowContextMenu)); + this.tapHold(row, this.table.options.rowContextMenu); + } + + if (this.table.options.rowClickMenu) { + row.getElement().addEventListener("click", this.LoadMenuEvent.bind(this, row, this.table.options.rowClickMenu)); + } +}; + +Menu.prototype.initializeGroup = function (group) { + if (this.table.options.groupContextMenu) { + group.getElement().addEventListener("contextmenu", this.LoadMenuEvent.bind(this, group, this.table.options.groupContextMenu)); + this.tapHold(group, this.table.options.groupContextMenu); + } + + if (this.table.options.groupClickMenu) { + group.getElement().addEventListener("click", this.LoadMenuEvent.bind(this, group, this.table.options.groupClickMenu)); + } +}; + +Menu.prototype.loadMenu = function (e, component, menu) { + var _this3 = this; + + var docHeight = Math.max(document.body.offsetHeight, window.innerHeight), + touch = !(e instanceof MouseEvent); + + if (!touch) { + e.preventDefault(); + } + + //abort if no menu set + if (!menu || !menu.length) { + return; + } + + if (this.nestedMenuBlock) { + //abort if child menu already open + if (this.isOpen()) { + return; + } + } else { + this.nestedMenuBlock = setTimeout(function () { + _this3.nestedMenuBlock = false; + }, 100); + } + + this.hideMenu(); + + this.menuEl = document.createElement("div"); + this.menuEl.classList.add("tabulator-menu"); + + menu.forEach(function (item) { + var itemEl = document.createElement("div"); + var label = item.label; + var disabled = item.disabled; + + if (item.separator) { + itemEl.classList.add("tabulator-menu-separator"); + } else { + itemEl.classList.add("tabulator-menu-item"); + + if (typeof label == "function") { + label = label(component.getComponent()); + } + + if (label instanceof Node) { + itemEl.appendChild(label); + } else { + itemEl.innerHTML = label; + } + + if (typeof disabled == "function") { + disabled = disabled(component.getComponent()); + } + + if (disabled) { + itemEl.classList.add("tabulator-menu-item-disabled"); + itemEl.addEventListener("click", function (e) { + e.stopPropagation(); + }); + } else { + itemEl.addEventListener("click", function (e) { + _this3.hideMenu(); + item.action(e, component.getComponent()); + }); + } + } + + _this3.menuEl.appendChild(itemEl); + }); + + this.menuEl.style.top = (touch ? e.touches[0].pageY : e.pageY) + "px"; + this.menuEl.style.left = (touch ? e.touches[0].pageX : e.pageX) + "px"; + + setTimeout(function () { + _this3.table.rowManager.element.addEventListener("scroll", _this3.blurEvent); + document.body.addEventListener("click", _this3.blurEvent); + document.body.addEventListener("contextmenu", _this3.blurEvent); + document.body.addEventListener("keydown", _this3.escEvent); + }, 100); + + document.body.appendChild(this.menuEl); + + //move menu to start on right edge if it is too close to the edge of the screen + if (e.pageX + this.menuEl.offsetWidth >= document.body.offsetWidth) { + this.menuEl.style.left = ""; + this.menuEl.style.right = document.body.offsetWidth - e.pageX + "px"; + } + + //move menu to start on bottom edge if it is too close to the edge of the screen + if (e.pageY + this.menuEl.offsetHeight >= docHeight) { + this.menuEl.style.top = ""; + this.menuEl.style.bottom = docHeight - e.pageY + "px"; + } +}; + +Menu.prototype.isOpen = function () { + return !!this.menuEl.parentNode; +}; + +Menu.prototype.escMenu = function (e) { + if (e.keyCode == 27) { + this.hideMenu(); + } +}; + +Menu.prototype.hideMenu = function () { + if (this.menuEl.parentNode) { + this.menuEl.parentNode.removeChild(this.menuEl); + } + + if (this.escEvent) { + document.body.removeEventListener("keydown", this.escEvent); + } + + if (this.blurEvent) { + document.body.removeEventListener("click", this.blurEvent); + document.body.removeEventListener("contextmenu", this.blurEvent); + this.table.rowManager.element.removeEventListener("scroll", this.blurEvent); + } +}; + +//default accessors +Menu.prototype.menus = {}; + +Tabulator.prototype.registerModule("menu", Menu); \ No newline at end of file diff --git a/website/js/vendor/tabulator/js/modules/menu.min.js b/website/js/vendor/tabulator/js/modules/menu.min.js new file mode 100644 index 0000000..172576e --- /dev/null +++ b/website/js/vendor/tabulator/js/modules/menu.min.js @@ -0,0 +1,2 @@ +/* Tabulator v4.8.3 (c) Oliver Folkerd */ +var Menu=function(e){this.table=e,this.menuEl=!1,this.blurEvent=this.hideMenu.bind(this),this.escEvent=this.escMenu.bind(this),this.nestedMenuBlock=!1};Menu.prototype.initializeColumnHeader=function(e){var t,n=this;e.definition.headerContextMenu&&(e.getElement().addEventListener("contextmenu",this.LoadMenuEvent.bind(this,e,e.definition.headerContextMenu)),this.tapHold(e,e.definition.headerContextMenu)),e.definition.headerMenu&&(t=document.createElement("span"),t.classList.add("tabulator-header-menu-button"),t.innerHTML="⋮",t.addEventListener("click",function(t){var i="function"==typeof e.definition.headerMenu?e.definition.headerMenu(e.getComponent(),t):e.definition.headerMenu;t.stopPropagation(),t.preventDefault(),n.loadMenu(t,e,i)}),e.titleElement.insertBefore(t,e.titleElement.firstChild))},Menu.prototype.LoadMenuEvent=function(e,t,n){t="function"==typeof t?t(e.getComponent(),n):t,this.loadMenu(n,e,t)},Menu.prototype.tapHold=function(e,t){var n=this,i=e.getElement(),o=null,u=!1;i.addEventListener("touchstart",function(i){clearTimeout(o),u=!1,o=setTimeout(function(){clearTimeout(o),o=null,u=!0,n.LoadMenuEvent(e,t,i)},1e3)},{passive:!0}),i.addEventListener("touchend",function(e){clearTimeout(o),o=null,u&&e.preventDefault()})},Menu.prototype.initializeCell=function(e){e.column.definition.contextMenu&&(e.getElement().addEventListener("contextmenu",this.LoadMenuEvent.bind(this,e,e.column.definition.contextMenu)),this.tapHold(e,e.column.definition.contextMenu)),e.column.definition.clickMenu&&e.getElement().addEventListener("click",this.LoadMenuEvent.bind(this,e,e.column.definition.clickMenu))},Menu.prototype.initializeRow=function(e){this.table.options.rowContextMenu&&(e.getElement().addEventListener("contextmenu",this.LoadMenuEvent.bind(this,e,this.table.options.rowContextMenu)),this.tapHold(e,this.table.options.rowContextMenu)),this.table.options.rowClickMenu&&e.getElement().addEventListener("click",this.LoadMenuEvent.bind(this,e,this.table.options.rowClickMenu))},Menu.prototype.initializeGroup=function(e){this.table.options.groupContextMenu&&(e.getElement().addEventListener("contextmenu",this.LoadMenuEvent.bind(this,e,this.table.options.groupContextMenu)),this.tapHold(e,this.table.options.groupContextMenu)),this.table.options.groupClickMenu&&e.getElement().addEventListener("click",this.LoadMenuEvent.bind(this,e,this.table.options.groupClickMenu))},Menu.prototype.loadMenu=function(e,t,n){var i=this,o=Math.max(document.body.offsetHeight,window.innerHeight),u=!(e instanceof MouseEvent);if(u||e.preventDefault(),n&&n.length){if(this.nestedMenuBlock){if(this.isOpen())return}else this.nestedMenuBlock=setTimeout(function(){i.nestedMenuBlock=!1},100);this.hideMenu(),this.menuEl=document.createElement("div"),this.menuEl.classList.add("tabulator-menu"),n.forEach(function(e){var n=document.createElement("div"),o=e.label,u=e.disabled;e.separator?n.classList.add("tabulator-menu-separator"):(n.classList.add("tabulator-menu-item"),"function"==typeof o&&(o=o(t.getComponent())),o instanceof Node?n.appendChild(o):n.innerHTML=o,"function"==typeof u&&(u=u(t.getComponent())),u?(n.classList.add("tabulator-menu-item-disabled"),n.addEventListener("click",function(e){e.stopPropagation()})):n.addEventListener("click",function(n){i.hideMenu(),e.action(n,t.getComponent())})),i.menuEl.appendChild(n)}),this.menuEl.style.top=(u?e.touches[0].pageY:e.pageY)+"px",this.menuEl.style.left=(u?e.touches[0].pageX:e.pageX)+"px",setTimeout(function(){i.table.rowManager.element.addEventListener("scroll",i.blurEvent),document.body.addEventListener("click",i.blurEvent),document.body.addEventListener("contextmenu",i.blurEvent),document.body.addEventListener("keydown",i.escEvent)},100),document.body.appendChild(this.menuEl),e.pageX+this.menuEl.offsetWidth>=document.body.offsetWidth&&(this.menuEl.style.left="",this.menuEl.style.right=document.body.offsetWidth-e.pageX+"px"),e.pageY+this.menuEl.offsetHeight>=o&&(this.menuEl.style.top="",this.menuEl.style.bottom=o-e.pageY+"px")}},Menu.prototype.isOpen=function(){return!!this.menuEl.parentNode},Menu.prototype.escMenu=function(e){27==e.keyCode&&this.hideMenu()},Menu.prototype.hideMenu=function(){this.menuEl.parentNode&&this.menuEl.parentNode.removeChild(this.menuEl),this.escEvent&&document.body.removeEventListener("keydown",this.escEvent),this.blurEvent&&(document.body.removeEventListener("click",this.blurEvent),document.body.removeEventListener("contextmenu",this.blurEvent),this.table.rowManager.element.removeEventListener("scroll",this.blurEvent))},Menu.prototype.menus={},Tabulator.prototype.registerModule("menu",Menu); \ No newline at end of file diff --git a/website/js/vendor/tabulator/js/modules/moveable_columns.js b/website/js/vendor/tabulator/js/modules/moveable_columns.js new file mode 100644 index 0000000..b22faea --- /dev/null +++ b/website/js/vendor/tabulator/js/modules/moveable_columns.js @@ -0,0 +1,289 @@ +/* Tabulator v4.8.3 (c) Oliver Folkerd */ + +var MoveColumns = function MoveColumns(table) { + this.table = table; //hold Tabulator object + this.placeholderElement = this.createPlaceholderElement(); + this.hoverElement = false; //floating column header element + this.checkTimeout = false; //click check timeout holder + this.checkPeriod = 250; //period to wait on mousedown to consider this a move and not a click + this.moving = false; //currently moving column + this.toCol = false; //destination column + this.toColAfter = false; //position of moving column relative to the desitnation column + this.startX = 0; //starting position within header element + this.autoScrollMargin = 40; //auto scroll on edge when within margin + this.autoScrollStep = 5; //auto scroll distance in pixels + this.autoScrollTimeout = false; //auto scroll timeout + this.touchMove = false; + + this.moveHover = this.moveHover.bind(this); + this.endMove = this.endMove.bind(this); +}; + +MoveColumns.prototype.createPlaceholderElement = function () { + var el = document.createElement("div"); + + el.classList.add("tabulator-col"); + el.classList.add("tabulator-col-placeholder"); + + return el; +}; + +MoveColumns.prototype.initializeColumn = function (column) { + var self = this, + config = {}, + colEl; + + if (!column.modules.frozen) { + + colEl = column.getElement(); + + config.mousemove = function (e) { + if (column.parent === self.moving.parent) { + if ((self.touchMove ? e.touches[0].pageX : e.pageX) - Tabulator.prototype.helpers.elOffset(colEl).left + self.table.columnManager.element.scrollLeft > column.getWidth() / 2) { + if (self.toCol !== column || !self.toColAfter) { + colEl.parentNode.insertBefore(self.placeholderElement, colEl.nextSibling); + self.moveColumn(column, true); + } + } else { + if (self.toCol !== column || self.toColAfter) { + colEl.parentNode.insertBefore(self.placeholderElement, colEl); + self.moveColumn(column, false); + } + } + } + }.bind(self); + + colEl.addEventListener("mousedown", function (e) { + self.touchMove = false; + if (e.which === 1) { + self.checkTimeout = setTimeout(function () { + self.startMove(e, column); + }, self.checkPeriod); + } + }); + + colEl.addEventListener("mouseup", function (e) { + if (e.which === 1) { + if (self.checkTimeout) { + clearTimeout(self.checkTimeout); + } + } + }); + + self.bindTouchEvents(column); + } + + column.modules.moveColumn = config; +}; + +MoveColumns.prototype.bindTouchEvents = function (column) { + var self = this, + colEl = column.getElement(), + startXMove = false, + //shifting center position of the cell + dir = false, + currentCol, + nextCol, + prevCol, + nextColWidth, + prevColWidth, + nextColWidthLast, + prevColWidthLast; + + colEl.addEventListener("touchstart", function (e) { + self.checkTimeout = setTimeout(function () { + self.touchMove = true; + currentCol = column; + nextCol = column.nextColumn(); + nextColWidth = nextCol ? nextCol.getWidth() / 2 : 0; + prevCol = column.prevColumn(); + prevColWidth = prevCol ? prevCol.getWidth() / 2 : 0; + nextColWidthLast = 0; + prevColWidthLast = 0; + startXMove = false; + + self.startMove(e, column); + }, self.checkPeriod); + }, { passive: true }); + + colEl.addEventListener("touchmove", function (e) { + var halfCol, diff, moveToCol; + + if (self.moving) { + self.moveHover(e); + + if (!startXMove) { + startXMove = e.touches[0].pageX; + } + + diff = e.touches[0].pageX - startXMove; + + if (diff > 0) { + if (nextCol && diff - nextColWidthLast > nextColWidth) { + moveToCol = nextCol; + + if (moveToCol !== column) { + startXMove = e.touches[0].pageX; + moveToCol.getElement().parentNode.insertBefore(self.placeholderElement, moveToCol.getElement().nextSibling); + self.moveColumn(moveToCol, true); + } + } + } else { + if (prevCol && -diff - prevColWidthLast > prevColWidth) { + moveToCol = prevCol; + + if (moveToCol !== column) { + startXMove = e.touches[0].pageX; + moveToCol.getElement().parentNode.insertBefore(self.placeholderElement, moveToCol.getElement()); + self.moveColumn(moveToCol, false); + } + } + } + + if (moveToCol) { + currentCol = moveToCol; + nextCol = moveToCol.nextColumn(); + nextColWidthLast = nextColWidth; + nextColWidth = nextCol ? nextCol.getWidth() / 2 : 0; + prevCol = moveToCol.prevColumn(); + prevColWidthLast = prevColWidth; + prevColWidth = prevCol ? prevCol.getWidth() / 2 : 0; + } + } + }, { passive: true }); + + colEl.addEventListener("touchend", function (e) { + if (self.checkTimeout) { + clearTimeout(self.checkTimeout); + } + if (self.moving) { + self.endMove(e); + } + }); +}; + +MoveColumns.prototype.startMove = function (e, column) { + var element = column.getElement(); + + this.moving = column; + this.startX = (this.touchMove ? e.touches[0].pageX : e.pageX) - Tabulator.prototype.helpers.elOffset(element).left; + + this.table.element.classList.add("tabulator-block-select"); + + //create placeholder + this.placeholderElement.style.width = column.getWidth() + "px"; + this.placeholderElement.style.height = column.getHeight() + "px"; + + element.parentNode.insertBefore(this.placeholderElement, element); + element.parentNode.removeChild(element); + + //create hover element + this.hoverElement = element.cloneNode(true); + this.hoverElement.classList.add("tabulator-moving"); + + this.table.columnManager.getElement().appendChild(this.hoverElement); + + this.hoverElement.style.left = "0"; + this.hoverElement.style.bottom = "0"; + + if (!this.touchMove) { + this._bindMouseMove(); + + document.body.addEventListener("mousemove", this.moveHover); + document.body.addEventListener("mouseup", this.endMove); + } + + this.moveHover(e); +}; + +MoveColumns.prototype._bindMouseMove = function () { + this.table.columnManager.columnsByIndex.forEach(function (column) { + if (column.modules.moveColumn.mousemove) { + column.getElement().addEventListener("mousemove", column.modules.moveColumn.mousemove); + } + }); +}; + +MoveColumns.prototype._unbindMouseMove = function () { + this.table.columnManager.columnsByIndex.forEach(function (column) { + if (column.modules.moveColumn.mousemove) { + column.getElement().removeEventListener("mousemove", column.modules.moveColumn.mousemove); + } + }); +}; + +MoveColumns.prototype.moveColumn = function (column, after) { + var movingCells = this.moving.getCells(); + + this.toCol = column; + this.toColAfter = after; + + if (after) { + column.getCells().forEach(function (cell, i) { + var cellEl = cell.getElement(); + cellEl.parentNode.insertBefore(movingCells[i].getElement(), cellEl.nextSibling); + }); + } else { + column.getCells().forEach(function (cell, i) { + var cellEl = cell.getElement(); + cellEl.parentNode.insertBefore(movingCells[i].getElement(), cellEl); + }); + } +}; + +MoveColumns.prototype.endMove = function (e) { + if (e.which === 1 || this.touchMove) { + this._unbindMouseMove(); + + this.placeholderElement.parentNode.insertBefore(this.moving.getElement(), this.placeholderElement.nextSibling); + this.placeholderElement.parentNode.removeChild(this.placeholderElement); + this.hoverElement.parentNode.removeChild(this.hoverElement); + + this.table.element.classList.remove("tabulator-block-select"); + + if (this.toCol) { + this.table.columnManager.moveColumnActual(this.moving, this.toCol, this.toColAfter); + } + + this.moving = false; + this.toCol = false; + this.toColAfter = false; + + if (!this.touchMove) { + document.body.removeEventListener("mousemove", this.moveHover); + document.body.removeEventListener("mouseup", this.endMove); + } + } +}; + +MoveColumns.prototype.moveHover = function (e) { + var self = this, + columnHolder = self.table.columnManager.getElement(), + scrollLeft = columnHolder.scrollLeft, + xPos = (self.touchMove ? e.touches[0].pageX : e.pageX) - Tabulator.prototype.helpers.elOffset(columnHolder).left + scrollLeft, + scrollPos; + + self.hoverElement.style.left = xPos - self.startX + "px"; + + if (xPos - scrollLeft < self.autoScrollMargin) { + if (!self.autoScrollTimeout) { + self.autoScrollTimeout = setTimeout(function () { + scrollPos = Math.max(0, scrollLeft - 5); + self.table.rowManager.getElement().scrollLeft = scrollPos; + self.autoScrollTimeout = false; + }, 1); + } + } + + if (scrollLeft + columnHolder.clientWidth - xPos < self.autoScrollMargin) { + if (!self.autoScrollTimeout) { + self.autoScrollTimeout = setTimeout(function () { + scrollPos = Math.min(columnHolder.clientWidth, scrollLeft + 5); + self.table.rowManager.getElement().scrollLeft = scrollPos; + self.autoScrollTimeout = false; + }, 1); + } + } +}; + +Tabulator.prototype.registerModule("moveColumn", MoveColumns); \ No newline at end of file diff --git a/website/js/vendor/tabulator/js/modules/moveable_columns.min.js b/website/js/vendor/tabulator/js/modules/moveable_columns.min.js new file mode 100644 index 0000000..4319932 --- /dev/null +++ b/website/js/vendor/tabulator/js/modules/moveable_columns.min.js @@ -0,0 +1,2 @@ +/* Tabulator v4.8.3 (c) Oliver Folkerd */ +var MoveColumns=function(e){this.table=e,this.placeholderElement=this.createPlaceholderElement(),this.hoverElement=!1,this.checkTimeout=!1,this.checkPeriod=250,this.moving=!1,this.toCol=!1,this.toColAfter=!1,this.startX=0,this.autoScrollMargin=40,this.autoScrollStep=5,this.autoScrollTimeout=!1,this.touchMove=!1,this.moveHover=this.moveHover.bind(this),this.endMove=this.endMove.bind(this)};MoveColumns.prototype.createPlaceholderElement=function(){var e=document.createElement("div");return e.classList.add("tabulator-col"),e.classList.add("tabulator-col-placeholder"),e},MoveColumns.prototype.initializeColumn=function(e){var t,o=this,n={};e.modules.frozen||(t=e.getElement(),n.mousemove=function(n){e.parent===o.moving.parent&&((o.touchMove?n.touches[0].pageX:n.pageX)-Tabulator.prototype.helpers.elOffset(t).left+o.table.columnManager.element.scrollLeft>e.getWidth()/2?o.toCol===e&&o.toColAfter||(t.parentNode.insertBefore(o.placeholderElement,t.nextSibling),o.moveColumn(e,!0)):(o.toCol!==e||o.toColAfter)&&(t.parentNode.insertBefore(o.placeholderElement,t),o.moveColumn(e,!1)))}.bind(o),t.addEventListener("mousedown",function(t){o.touchMove=!1,1===t.which&&(o.checkTimeout=setTimeout(function(){o.startMove(t,e)},o.checkPeriod))}),t.addEventListener("mouseup",function(e){1===e.which&&o.checkTimeout&&clearTimeout(o.checkTimeout)}),o.bindTouchEvents(e)),e.modules.moveColumn=n},MoveColumns.prototype.bindTouchEvents=function(e){var t,o,n,l,i,s,m,r=this,u=e.getElement(),h=!1;u.addEventListener("touchstart",function(u){r.checkTimeout=setTimeout(function(){r.touchMove=!0,t=e,o=e.nextColumn(),l=o?o.getWidth()/2:0,n=e.prevColumn(),i=n?n.getWidth()/2:0,s=0,m=0,h=!1,r.startMove(u,e)},r.checkPeriod)},{passive:!0}),u.addEventListener("touchmove",function(u){var a,c;r.moving&&(r.moveHover(u),h||(h=u.touches[0].pageX),a=u.touches[0].pageX-h,a>0?o&&a-s>l&&(c=o)!==e&&(h=u.touches[0].pageX,c.getElement().parentNode.insertBefore(r.placeholderElement,c.getElement().nextSibling),r.moveColumn(c,!0)):n&&-a-m>i&&(c=n)!==e&&(h=u.touches[0].pageX,c.getElement().parentNode.insertBefore(r.placeholderElement,c.getElement()),r.moveColumn(c,!1)),c&&(t=c,o=c.nextColumn(),s=l,l=o?o.getWidth()/2:0,n=c.prevColumn(),m=i,i=n?n.getWidth()/2:0))},{passive:!0}),u.addEventListener("touchend",function(e){r.checkTimeout&&clearTimeout(r.checkTimeout),r.moving&&r.endMove(e)})},MoveColumns.prototype.startMove=function(e,t){var o=t.getElement();this.moving=t,this.startX=(this.touchMove?e.touches[0].pageX:e.pageX)-Tabulator.prototype.helpers.elOffset(o).left,this.table.element.classList.add("tabulator-block-select"),this.placeholderElement.style.width=t.getWidth()+"px",this.placeholderElement.style.height=t.getHeight()+"px",o.parentNode.insertBefore(this.placeholderElement,o),o.parentNode.removeChild(o),this.hoverElement=o.cloneNode(!0),this.hoverElement.classList.add("tabulator-moving"),this.table.columnManager.getElement().appendChild(this.hoverElement),this.hoverElement.style.left="0",this.hoverElement.style.bottom="0",this.touchMove||(this._bindMouseMove(),document.body.addEventListener("mousemove",this.moveHover),document.body.addEventListener("mouseup",this.endMove)),this.moveHover(e)},MoveColumns.prototype._bindMouseMove=function(){this.table.columnManager.columnsByIndex.forEach(function(e){e.modules.moveColumn.mousemove&&e.getElement().addEventListener("mousemove",e.modules.moveColumn.mousemove)})},MoveColumns.prototype._unbindMouseMove=function(){this.table.columnManager.columnsByIndex.forEach(function(e){e.modules.moveColumn.mousemove&&e.getElement().removeEventListener("mousemove",e.modules.moveColumn.mousemove)})},MoveColumns.prototype.moveColumn=function(e,t){var o=this.moving.getCells();this.toCol=e,this.toColAfter=t,t?e.getCells().forEach(function(e,t){var n=e.getElement();n.parentNode.insertBefore(o[t].getElement(),n.nextSibling)}):e.getCells().forEach(function(e,t){var n=e.getElement();n.parentNode.insertBefore(o[t].getElement(),n)})},MoveColumns.prototype.endMove=function(e){(1===e.which||this.touchMove)&&(this._unbindMouseMove(),this.placeholderElement.parentNode.insertBefore(this.moving.getElement(),this.placeholderElement.nextSibling),this.placeholderElement.parentNode.removeChild(this.placeholderElement),this.hoverElement.parentNode.removeChild(this.hoverElement),this.table.element.classList.remove("tabulator-block-select"),this.toCol&&this.table.columnManager.moveColumnActual(this.moving,this.toCol,this.toColAfter),this.moving=!1,this.toCol=!1,this.toColAfter=!1,this.touchMove||(document.body.removeEventListener("mousemove",this.moveHover),document.body.removeEventListener("mouseup",this.endMove)))},MoveColumns.prototype.moveHover=function(e){var t,o=this,n=o.table.columnManager.getElement(),l=n.scrollLeft,i=(o.touchMove?e.touches[0].pageX:e.pageX)-Tabulator.prototype.helpers.elOffset(n).left+l;o.hoverElement.style.left=i-o.startX+"px",i-l group.getHeight() / 2) { + if (self.toRow !== group || !self.toRowAfter) { + var rowEl = group.getElement(); + rowEl.parentNode.insertBefore(self.placeholderElement, rowEl.nextSibling); + self.moveRow(group, true); + } + } else { + if (self.toRow !== group || self.toRowAfter) { + var rowEl = group.getElement(); + if (rowEl.previousSibling) { + rowEl.parentNode.insertBefore(self.placeholderElement, rowEl); + self.moveRow(group, false); + } + } + } + }.bind(self); + + group.modules.moveRow = config; +}; + +MoveRows.prototype.initializeRow = function (row) { + var self = this, + config = {}, + rowEl; + + //inter table drag drop + config.mouseup = function (e) { + self.tableRowDrop(e, row); + }.bind(self); + + //same table drag drop + config.mousemove = function (e) { + if (e.pageY - Tabulator.prototype.helpers.elOffset(row.element).top + self.table.rowManager.element.scrollTop > row.getHeight() / 2) { + if (self.toRow !== row || !self.toRowAfter) { + var rowEl = row.getElement(); + rowEl.parentNode.insertBefore(self.placeholderElement, rowEl.nextSibling); + self.moveRow(row, true); + } + } else { + if (self.toRow !== row || self.toRowAfter) { + var rowEl = row.getElement(); + rowEl.parentNode.insertBefore(self.placeholderElement, rowEl); + self.moveRow(row, false); + } + } + }.bind(self); + + if (!this.hasHandle) { + + rowEl = row.getElement(); + + rowEl.addEventListener("mousedown", function (e) { + if (e.which === 1) { + self.checkTimeout = setTimeout(function () { + self.startMove(e, row); + }, self.checkPeriod); + } + }); + + rowEl.addEventListener("mouseup", function (e) { + if (e.which === 1) { + if (self.checkTimeout) { + clearTimeout(self.checkTimeout); + } + } + }); + + this.bindTouchEvents(row, row.getElement()); + } + + row.modules.moveRow = config; +}; + +MoveRows.prototype.initializeCell = function (cell) { + var self = this, + cellEl = cell.getElement(); + + cellEl.addEventListener("mousedown", function (e) { + if (e.which === 1) { + self.checkTimeout = setTimeout(function () { + self.startMove(e, cell.row); + }, self.checkPeriod); + } + }); + + cellEl.addEventListener("mouseup", function (e) { + if (e.which === 1) { + if (self.checkTimeout) { + clearTimeout(self.checkTimeout); + } + } + }); + + this.bindTouchEvents(cell.row, cell.getElement()); +}; + +MoveRows.prototype.bindTouchEvents = function (row, element) { + var self = this, + startYMove = false, + //shifting center position of the cell + dir = false, + currentRow, + nextRow, + prevRow, + nextRowHeight, + prevRowHeight, + nextRowHeightLast, + prevRowHeightLast; + + element.addEventListener("touchstart", function (e) { + self.checkTimeout = setTimeout(function () { + self.touchMove = true; + currentRow = row; + nextRow = row.nextRow(); + nextRowHeight = nextRow ? nextRow.getHeight() / 2 : 0; + prevRow = row.prevRow(); + prevRowHeight = prevRow ? prevRow.getHeight() / 2 : 0; + nextRowHeightLast = 0; + prevRowHeightLast = 0; + startYMove = false; + + self.startMove(e, row); + }, self.checkPeriod); + }, { passive: true }); + this.moving, this.toRow, this.toRowAfter; + element.addEventListener("touchmove", function (e) { + + var halfCol, diff, moveToRow; + + if (self.moving) { + e.preventDefault(); + + self.moveHover(e); + + if (!startYMove) { + startYMove = e.touches[0].pageY; + } + + diff = e.touches[0].pageY - startYMove; + + if (diff > 0) { + if (nextRow && diff - nextRowHeightLast > nextRowHeight) { + moveToRow = nextRow; + + if (moveToRow !== row) { + startYMove = e.touches[0].pageY; + moveToRow.getElement().parentNode.insertBefore(self.placeholderElement, moveToRow.getElement().nextSibling); + self.moveRow(moveToRow, true); + } + } + } else { + if (prevRow && -diff - prevRowHeightLast > prevRowHeight) { + moveToRow = prevRow; + + if (moveToRow !== row) { + startYMove = e.touches[0].pageY; + moveToRow.getElement().parentNode.insertBefore(self.placeholderElement, moveToRow.getElement()); + self.moveRow(moveToRow, false); + } + } + } + + if (moveToRow) { + currentRow = moveToRow; + nextRow = moveToRow.nextRow(); + nextRowHeightLast = nextRowHeight; + nextRowHeight = nextRow ? nextRow.getHeight() / 2 : 0; + prevRow = moveToRow.prevRow(); + prevRowHeightLast = prevRowHeight; + prevRowHeight = prevRow ? prevRow.getHeight() / 2 : 0; + } + } + }); + + element.addEventListener("touchend", function (e) { + if (self.checkTimeout) { + clearTimeout(self.checkTimeout); + } + if (self.moving) { + self.endMove(e); + self.touchMove = false; + } + }); +}; + +MoveRows.prototype._bindMouseMove = function () { + var self = this; + + self.table.rowManager.getDisplayRows().forEach(function (row) { + if ((row.type === "row" || row.type === "group") && row.modules.moveRow.mousemove) { + row.getElement().addEventListener("mousemove", row.modules.moveRow.mousemove); + } + }); +}; + +MoveRows.prototype._unbindMouseMove = function () { + var self = this; + + self.table.rowManager.getDisplayRows().forEach(function (row) { + if ((row.type === "row" || row.type === "group") && row.modules.moveRow.mousemove) { + row.getElement().removeEventListener("mousemove", row.modules.moveRow.mousemove); + } + }); +}; + +MoveRows.prototype.startMove = function (e, row) { + var element = row.getElement(); + + this.setStartPosition(e, row); + + this.moving = row; + + this.table.element.classList.add("tabulator-block-select"); + + //create placeholder + this.placeholderElement.style.width = row.getWidth() + "px"; + this.placeholderElement.style.height = row.getHeight() + "px"; + + if (!this.connection) { + element.parentNode.insertBefore(this.placeholderElement, element); + element.parentNode.removeChild(element); + } else { + this.table.element.classList.add("tabulator-movingrow-sending"); + this.connectToTables(row); + } + + //create hover element + this.hoverElement = element.cloneNode(true); + this.hoverElement.classList.add("tabulator-moving"); + + if (this.connection) { + document.body.appendChild(this.hoverElement); + this.hoverElement.style.left = "0"; + this.hoverElement.style.top = "0"; + this.hoverElement.style.width = this.table.element.clientWidth + "px"; + this.hoverElement.style.whiteSpace = "nowrap"; + this.hoverElement.style.overflow = "hidden"; + this.hoverElement.style.pointerEvents = "none"; + } else { + this.table.rowManager.getTableElement().appendChild(this.hoverElement); + + this.hoverElement.style.left = "0"; + this.hoverElement.style.top = "0"; + + this._bindMouseMove(); + } + + document.body.addEventListener("mousemove", this.moveHover); + document.body.addEventListener("mouseup", this.endMove); + + this.moveHover(e); +}; + +MoveRows.prototype.setStartPosition = function (e, row) { + var pageX = this.touchMove ? e.touches[0].pageX : e.pageX, + pageY = this.touchMove ? e.touches[0].pageY : e.pageY, + element, + position; + + element = row.getElement(); + if (this.connection) { + position = element.getBoundingClientRect(); + + this.startX = position.left - pageX + window.pageXOffset; + this.startY = position.top - pageY + window.pageYOffset; + } else { + this.startY = pageY - element.getBoundingClientRect().top; + } +}; + +MoveRows.prototype.endMove = function (e) { + if (!e || e.which === 1 || this.touchMove) { + this._unbindMouseMove(); + + if (!this.connection) { + this.placeholderElement.parentNode.insertBefore(this.moving.getElement(), this.placeholderElement.nextSibling); + this.placeholderElement.parentNode.removeChild(this.placeholderElement); + } + + this.hoverElement.parentNode.removeChild(this.hoverElement); + + this.table.element.classList.remove("tabulator-block-select"); + + if (this.toRow) { + this.table.rowManager.moveRow(this.moving, this.toRow, this.toRowAfter); + } + + this.moving = false; + this.toRow = false; + this.toRowAfter = false; + + document.body.removeEventListener("mousemove", this.moveHover); + document.body.removeEventListener("mouseup", this.endMove); + + if (this.connection) { + this.table.element.classList.remove("tabulator-movingrow-sending"); + this.disconnectFromTables(); + } + } +}; + +MoveRows.prototype.moveRow = function (row, after) { + this.toRow = row; + this.toRowAfter = after; +}; + +MoveRows.prototype.moveHover = function (e) { + if (this.connection) { + this.moveHoverConnections.call(this, e); + } else { + this.moveHoverTable.call(this, e); + } +}; + +MoveRows.prototype.moveHoverTable = function (e) { + var rowHolder = this.table.rowManager.getElement(), + scrollTop = rowHolder.scrollTop, + yPos = (this.touchMove ? e.touches[0].pageY : e.pageY) - rowHolder.getBoundingClientRect().top + scrollTop, + scrollPos; + + this.hoverElement.style.top = yPos - this.startY + "px"; +}; + +MoveRows.prototype.moveHoverConnections = function (e) { + this.hoverElement.style.left = this.startX + (this.touchMove ? e.touches[0].pageX : e.pageX) + "px"; + this.hoverElement.style.top = this.startY + (this.touchMove ? e.touches[0].pageY : e.pageY) + "px"; +}; + +MoveRows.prototype.elementRowDrop = function (e, element, row) { + if (this.table.options.movableRowsElementDrop) { + this.table.options.movableRowsElementDrop(e, element, row ? row.getComponent() : false); + } +}; + +//establish connection with other tables +MoveRows.prototype.connectToTables = function (row) { + var _this = this; + + var connectionTables; + + if (this.connectionSelectorsTables) { + connectionTables = this.table.modules.comms.getConnections(this.connectionSelectorsTables); + + this.table.options.movableRowsSendingStart.call(this.table, connectionTables); + + this.table.modules.comms.send(this.connectionSelectorsTables, "moveRow", "connect", { + row: row + }); + } + + if (this.connectionSelectorsElements) { + + this.connectionElements = []; + + if (!Array.isArray(this.connectionSelectorsElements)) { + this.connectionSelectorsElements = [this.connectionSelectorsElements]; + } + + this.connectionSelectorsElements.forEach(function (query) { + if (typeof query === "string") { + _this.connectionElements = _this.connectionElements.concat(Array.prototype.slice.call(document.querySelectorAll(query))); + } else { + _this.connectionElements.push(query); + } + }); + + this.connectionElements.forEach(function (element) { + var dropEvent = function dropEvent(e) { + _this.elementRowDrop(e, element, _this.moving); + }; + + element.addEventListener("mouseup", dropEvent); + element.tabulatorElementDropEvent = dropEvent; + + element.classList.add("tabulator-movingrow-receiving"); + }); + } +}; + +//disconnect from other tables +MoveRows.prototype.disconnectFromTables = function () { + var connectionTables; + + if (this.connectionSelectorsTables) { + connectionTables = this.table.modules.comms.getConnections(this.connectionSelectorsTables); + + this.table.options.movableRowsSendingStop.call(this.table, connectionTables); + + this.table.modules.comms.send(this.connectionSelectorsTables, "moveRow", "disconnect"); + } + + this.connectionElements.forEach(function (element) { + element.classList.remove("tabulator-movingrow-receiving"); + element.removeEventListener("mouseup", element.tabulatorElementDropEvent); + delete element.tabulatorElementDropEvent; + }); +}; + +//accept incomming connection +MoveRows.prototype.connect = function (table, row) { + var self = this; + if (!this.connectedTable) { + this.connectedTable = table; + this.connectedRow = row; + + this.table.element.classList.add("tabulator-movingrow-receiving"); + + self.table.rowManager.getDisplayRows().forEach(function (row) { + if (row.type === "row" && row.modules.moveRow && row.modules.moveRow.mouseup) { + row.getElement().addEventListener("mouseup", row.modules.moveRow.mouseup); + } + }); + + self.tableRowDropEvent = self.tableRowDrop.bind(self); + + self.table.element.addEventListener("mouseup", self.tableRowDropEvent); + + this.table.options.movableRowsReceivingStart.call(this.table, row, table); + + return true; + } else { + console.warn("Move Row Error - Table cannot accept connection, already connected to table:", this.connectedTable); + return false; + } +}; + +//close incomming connection +MoveRows.prototype.disconnect = function (table) { + var self = this; + if (table === this.connectedTable) { + this.connectedTable = false; + this.connectedRow = false; + + this.table.element.classList.remove("tabulator-movingrow-receiving"); + + self.table.rowManager.getDisplayRows().forEach(function (row) { + if (row.type === "row" && row.modules.moveRow && row.modules.moveRow.mouseup) { + row.getElement().removeEventListener("mouseup", row.modules.moveRow.mouseup); + } + }); + + self.table.element.removeEventListener("mouseup", self.tableRowDropEvent); + + this.table.options.movableRowsReceivingStop.call(this.table, table); + } else { + console.warn("Move Row Error - trying to disconnect from non connected table"); + } +}; + +MoveRows.prototype.dropComplete = function (table, row, success) { + var sender = false; + + if (success) { + + switch (_typeof(this.table.options.movableRowsSender)) { + case "string": + sender = this.senders[this.table.options.movableRowsSender]; + break; + + case "function": + sender = this.table.options.movableRowsSender; + break; + } + + if (sender) { + sender.call(this, this.moving.getComponent(), row ? row.getComponent() : undefined, table); + } else { + if (this.table.options.movableRowsSender) { + console.warn("Mover Row Error - no matching sender found:", this.table.options.movableRowsSender); + } + } + + this.table.options.movableRowsSent.call(this.table, this.moving.getComponent(), row ? row.getComponent() : undefined, table); + } else { + this.table.options.movableRowsSentFailed.call(this.table, this.moving.getComponent(), row ? row.getComponent() : undefined, table); + } + + this.endMove(); +}; + +MoveRows.prototype.tableRowDrop = function (e, row) { + var receiver = false, + success = false; + + console.trace("drop"); + + e.stopImmediatePropagation(); + + switch (_typeof(this.table.options.movableRowsReceiver)) { + case "string": + receiver = this.receivers[this.table.options.movableRowsReceiver]; + break; + + case "function": + receiver = this.table.options.movableRowsReceiver; + break; + } + + if (receiver) { + success = receiver.call(this, this.connectedRow.getComponent(), row ? row.getComponent() : undefined, this.connectedTable); + } else { + console.warn("Mover Row Error - no matching receiver found:", this.table.options.movableRowsReceiver); + } + + if (success) { + this.table.options.movableRowsReceived.call(this.table, this.connectedRow.getComponent(), row ? row.getComponent() : undefined, this.connectedTable); + } else { + this.table.options.movableRowsReceivedFailed.call(this.table, this.connectedRow.getComponent(), row ? row.getComponent() : undefined, this.connectedTable); + } + + this.table.modules.comms.send(this.connectedTable, "moveRow", "dropcomplete", { + row: row, + success: success + }); +}; + +MoveRows.prototype.receivers = { + insert: function insert(fromRow, toRow, fromTable) { + this.table.addRow(fromRow.getData(), undefined, toRow); + return true; + }, + + add: function add(fromRow, toRow, fromTable) { + this.table.addRow(fromRow.getData()); + return true; + }, + + update: function update(fromRow, toRow, fromTable) { + if (toRow) { + toRow.update(fromRow.getData()); + return true; + } + + return false; + }, + + replace: function replace(fromRow, toRow, fromTable) { + if (toRow) { + this.table.addRow(fromRow.getData(), undefined, toRow); + toRow.delete(); + return true; + } + + return false; + } +}; + +MoveRows.prototype.senders = { + delete: function _delete(fromRow, toRow, toTable) { + fromRow.delete(); + } +}; + +MoveRows.prototype.commsReceived = function (table, action, data) { + switch (action) { + case "connect": + return this.connect(table, data.row); + break; + + case "disconnect": + return this.disconnect(table); + break; + + case "dropcomplete": + return this.dropComplete(table, data.row, data.success); + break; + } +}; + +Tabulator.prototype.registerModule("moveRow", MoveRows); \ No newline at end of file diff --git a/website/js/vendor/tabulator/js/modules/moveable_rows.min.js b/website/js/vendor/tabulator/js/modules/moveable_rows.min.js new file mode 100644 index 0000000..7d88d12 --- /dev/null +++ b/website/js/vendor/tabulator/js/modules/moveable_rows.min.js @@ -0,0 +1,2 @@ +/* Tabulator v4.8.3 (c) Oliver Folkerd */ +var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},MoveRows=function(e){this.table=e,this.placeholderElement=this.createPlaceholderElement(),this.hoverElement=!1,this.checkTimeout=!1,this.checkPeriod=150,this.moving=!1,this.toRow=!1,this.toRowAfter=!1,this.hasHandle=!1,this.startY=0,this.startX=0,this.moveHover=this.moveHover.bind(this),this.endMove=this.endMove.bind(this),this.tableRowDropEvent=!1,this.touchMove=!1,this.connection=!1,this.connectionSelectorsTables=!1,this.connectionSelectorsElements=!1,this.connectionElements=[],this.connections=[],this.connectedTable=!1,this.connectedRow=!1};MoveRows.prototype.createPlaceholderElement=function(){var e=document.createElement("div");return e.classList.add("tabulator-row"),e.classList.add("tabulator-row-placeholder"),e},MoveRows.prototype.initialize=function(e){this.connectionSelectorsTables=this.table.options.movableRowsConnectedTables,this.connectionSelectorsElements=this.table.options.movableRowsConnectedElements,this.connection=this.connectionSelectorsTables||this.connectionSelectorsElements},MoveRows.prototype.setHandle=function(e){this.hasHandle=e},MoveRows.prototype.initializeGroupHeader=function(e){var t=this,o={};o.mouseup=function(e){t.tableRowDrop(e,row)}.bind(t),o.mousemove=function(o){if(o.pageY-Tabulator.prototype.helpers.elOffset(e.element).top+t.table.rowManager.element.scrollTop>e.getHeight()/2){if(t.toRow!==e||!t.toRowAfter){var n=e.getElement();n.parentNode.insertBefore(t.placeholderElement,n.nextSibling),t.moveRow(e,!0)}}else if(t.toRow!==e||t.toRowAfter){var n=e.getElement();n.previousSibling&&(n.parentNode.insertBefore(t.placeholderElement,n),t.moveRow(e,!1))}}.bind(t),e.modules.moveRow=o},MoveRows.prototype.initializeRow=function(e){var t,o=this,n={};n.mouseup=function(t){o.tableRowDrop(t,e)}.bind(o),n.mousemove=function(t){if(t.pageY-Tabulator.prototype.helpers.elOffset(e.element).top+o.table.rowManager.element.scrollTop>e.getHeight()/2){if(o.toRow!==e||!o.toRowAfter){var n=e.getElement();n.parentNode.insertBefore(o.placeholderElement,n.nextSibling),o.moveRow(e,!0)}}else if(o.toRow!==e||o.toRowAfter){var n=e.getElement();n.parentNode.insertBefore(o.placeholderElement,n),o.moveRow(e,!1)}}.bind(o),this.hasHandle||(t=e.getElement(),t.addEventListener("mousedown",function(t){1===t.which&&(o.checkTimeout=setTimeout(function(){o.startMove(t,e)},o.checkPeriod))}),t.addEventListener("mouseup",function(e){1===e.which&&o.checkTimeout&&clearTimeout(o.checkTimeout)}),this.bindTouchEvents(e,e.getElement())),e.modules.moveRow=n},MoveRows.prototype.initializeCell=function(e){var t=this,o=e.getElement();o.addEventListener("mousedown",function(o){1===o.which&&(t.checkTimeout=setTimeout(function(){t.startMove(o,e.row)},t.checkPeriod))}),o.addEventListener("mouseup",function(e){1===e.which&&t.checkTimeout&&clearTimeout(t.checkTimeout)}),this.bindTouchEvents(e.row,e.getElement())},MoveRows.prototype.bindTouchEvents=function(e,t){var o,n,s,i,l,c,r,a=this,h=!1;t.addEventListener("touchstart",function(t){a.checkTimeout=setTimeout(function(){a.touchMove=!0,o=e,n=e.nextRow(),i=n?n.getHeight()/2:0,s=e.prevRow(),l=s?s.getHeight()/2:0,c=0,r=0,h=!1,a.startMove(t,e)},a.checkPeriod)},{passive:!0}),this.moving,this.toRow,this.toRowAfter,t.addEventListener("touchmove",function(t){var m,v;a.moving&&(t.preventDefault(),a.moveHover(t),h||(h=t.touches[0].pageY),m=t.touches[0].pageY-h,m>0?n&&m-c>i&&(v=n)!==e&&(h=t.touches[0].pageY,v.getElement().parentNode.insertBefore(a.placeholderElement,v.getElement().nextSibling),a.moveRow(v,!0)):s&&-m-r>l&&(v=s)!==e&&(h=t.touches[0].pageY,v.getElement().parentNode.insertBefore(a.placeholderElement,v.getElement()),a.moveRow(v,!1)),v&&(o=v,n=v.nextRow(),c=i,i=n?n.getHeight()/2:0,s=v.prevRow(),r=l,l=s?s.getHeight()/2:0))}),t.addEventListener("touchend",function(e){a.checkTimeout&&clearTimeout(a.checkTimeout),a.moving&&(a.endMove(e),a.touchMove=!1)})},MoveRows.prototype._bindMouseMove=function(){this.table.rowManager.getDisplayRows().forEach(function(e){"row"!==e.type&&"group"!==e.type||!e.modules.moveRow.mousemove||e.getElement().addEventListener("mousemove",e.modules.moveRow.mousemove)})},MoveRows.prototype._unbindMouseMove=function(){this.table.rowManager.getDisplayRows().forEach(function(e){"row"!==e.type&&"group"!==e.type||!e.modules.moveRow.mousemove||e.getElement().removeEventListener("mousemove",e.modules.moveRow.mousemove)})},MoveRows.prototype.startMove=function(e,t){var o=t.getElement();this.setStartPosition(e,t),this.moving=t,this.table.element.classList.add("tabulator-block-select"),this.placeholderElement.style.width=t.getWidth()+"px",this.placeholderElement.style.height=t.getHeight()+"px",this.connection?(this.table.element.classList.add("tabulator-movingrow-sending"),this.connectToTables(t)):(o.parentNode.insertBefore(this.placeholderElement,o),o.parentNode.removeChild(o)),this.hoverElement=o.cloneNode(!0),this.hoverElement.classList.add("tabulator-moving"),this.connection?(document.body.appendChild(this.hoverElement),this.hoverElement.style.left="0",this.hoverElement.style.top="0",this.hoverElement.style.width=this.table.element.clientWidth+"px",this.hoverElement.style.whiteSpace="nowrap",this.hoverElement.style.overflow="hidden",this.hoverElement.style.pointerEvents="none"):(this.table.rowManager.getTableElement().appendChild(this.hoverElement),this.hoverElement.style.left="0",this.hoverElement.style.top="0",this._bindMouseMove()),document.body.addEventListener("mousemove",this.moveHover),document.body.addEventListener("mouseup",this.endMove),this.moveHover(e)},MoveRows.prototype.setStartPosition=function(e,t){var o,n,s=this.touchMove?e.touches[0].pageX:e.pageX,i=this.touchMove?e.touches[0].pageY:e.pageY;o=t.getElement(),this.connection?(n=o.getBoundingClientRect(),this.startX=n.left-s+window.pageXOffset,this.startY=n.top-i+window.pageYOffset):this.startY=i-o.getBoundingClientRect().top},MoveRows.prototype.endMove=function(e){e&&1!==e.which&&!this.touchMove||(this._unbindMouseMove(),this.connection||(this.placeholderElement.parentNode.insertBefore(this.moving.getElement(),this.placeholderElement.nextSibling),this.placeholderElement.parentNode.removeChild(this.placeholderElement)),this.hoverElement.parentNode.removeChild(this.hoverElement),this.table.element.classList.remove("tabulator-block-select"),this.toRow&&this.table.rowManager.moveRow(this.moving,this.toRow,this.toRowAfter),this.moving=!1,this.toRow=!1,this.toRowAfter=!1,document.body.removeEventListener("mousemove",this.moveHover),document.body.removeEventListener("mouseup",this.endMove),this.connection&&(this.table.element.classList.remove("tabulator-movingrow-sending"),this.disconnectFromTables()))},MoveRows.prototype.moveRow=function(e,t){this.toRow=e,this.toRowAfter=t},MoveRows.prototype.moveHover=function(e){this.connection?this.moveHoverConnections.call(this,e):this.moveHoverTable.call(this,e)},MoveRows.prototype.moveHoverTable=function(e){var t=this.table.rowManager.getElement(),o=t.scrollTop,n=(this.touchMove?e.touches[0].pageY:e.pageY)-t.getBoundingClientRect().top+o;this.hoverElement.style.top=n-this.startY+"px"},MoveRows.prototype.moveHoverConnections=function(e){this.hoverElement.style.left=this.startX+(this.touchMove?e.touches[0].pageX:e.pageX)+"px",this.hoverElement.style.top=this.startY+(this.touchMove?e.touches[0].pageY:e.pageY)+"px"},MoveRows.prototype.elementRowDrop=function(e,t,o){this.table.options.movableRowsElementDrop&&this.table.options.movableRowsElementDrop(e,t,!!o&&o.getComponent())},MoveRows.prototype.connectToTables=function(e){var t,o=this;this.connectionSelectorsTables&&(t=this.table.modules.comms.getConnections(this.connectionSelectorsTables),this.table.options.movableRowsSendingStart.call(this.table,t),this.table.modules.comms.send(this.connectionSelectorsTables,"moveRow","connect",{row:e})),this.connectionSelectorsElements&&(this.connectionElements=[],Array.isArray(this.connectionSelectorsElements)||(this.connectionSelectorsElements=[this.connectionSelectorsElements]),this.connectionSelectorsElements.forEach(function(e){"string"==typeof e?o.connectionElements=o.connectionElements.concat(Array.prototype.slice.call(document.querySelectorAll(e))):o.connectionElements.push(e)}),this.connectionElements.forEach(function(e){var t=function(t){o.elementRowDrop(t,e,o.moving)};e.addEventListener("mouseup",t),e.tabulatorElementDropEvent=t,e.classList.add("tabulator-movingrow-receiving")}))},MoveRows.prototype.disconnectFromTables=function(){var e;this.connectionSelectorsTables&&(e=this.table.modules.comms.getConnections(this.connectionSelectorsTables),this.table.options.movableRowsSendingStop.call(this.table,e),this.table.modules.comms.send(this.connectionSelectorsTables,"moveRow","disconnect")),this.connectionElements.forEach(function(e){e.classList.remove("tabulator-movingrow-receiving"),e.removeEventListener("mouseup",e.tabulatorElementDropEvent),delete e.tabulatorElementDropEvent})},MoveRows.prototype.connect=function(e,t){var o=this;return this.connectedTable?(console.warn("Move Row Error - Table cannot accept connection, already connected to table:",this.connectedTable),!1):(this.connectedTable=e,this.connectedRow=t,this.table.element.classList.add("tabulator-movingrow-receiving"),o.table.rowManager.getDisplayRows().forEach(function(e){"row"===e.type&&e.modules.moveRow&&e.modules.moveRow.mouseup&&e.getElement().addEventListener("mouseup",e.modules.moveRow.mouseup)}),o.tableRowDropEvent=o.tableRowDrop.bind(o),o.table.element.addEventListener("mouseup",o.tableRowDropEvent),this.table.options.movableRowsReceivingStart.call(this.table,t,e),!0)},MoveRows.prototype.disconnect=function(e){var t=this;e===this.connectedTable?(this.connectedTable=!1,this.connectedRow=!1,this.table.element.classList.remove("tabulator-movingrow-receiving"),t.table.rowManager.getDisplayRows().forEach(function(e){"row"===e.type&&e.modules.moveRow&&e.modules.moveRow.mouseup&&e.getElement().removeEventListener("mouseup",e.modules.moveRow.mouseup)}),t.table.element.removeEventListener("mouseup",t.tableRowDropEvent),this.table.options.movableRowsReceivingStop.call(this.table,e)):console.warn("Move Row Error - trying to disconnect from non connected table")},MoveRows.prototype.dropComplete=function(e,t,o){var n=!1;if(o){switch(_typeof(this.table.options.movableRowsSender)){case"string":n=this.senders[this.table.options.movableRowsSender];break;case"function":n=this.table.options.movableRowsSender}n?n.call(this,this.moving.getComponent(),t?t.getComponent():void 0,e):this.table.options.movableRowsSender&&console.warn("Mover Row Error - no matching sender found:",this.table.options.movableRowsSender),this.table.options.movableRowsSent.call(this.table,this.moving.getComponent(),t?t.getComponent():void 0,e)}else this.table.options.movableRowsSentFailed.call(this.table,this.moving.getComponent(),t?t.getComponent():void 0,e);this.endMove()},MoveRows.prototype.tableRowDrop=function(e,t){var o=!1,n=!1;switch(console.trace("drop"),e.stopImmediatePropagation(),_typeof(this.table.options.movableRowsReceiver)){case"string":o=this.receivers[this.table.options.movableRowsReceiver];break;case"function":o=this.table.options.movableRowsReceiver}o?n=o.call(this,this.connectedRow.getComponent(),t?t.getComponent():void 0,this.connectedTable):console.warn("Mover Row Error - no matching receiver found:",this.table.options.movableRowsReceiver),n?this.table.options.movableRowsReceived.call(this.table,this.connectedRow.getComponent(),t?t.getComponent():void 0,this.connectedTable):this.table.options.movableRowsReceivedFailed.call(this.table,this.connectedRow.getComponent(),t?t.getComponent():void 0,this.connectedTable),this.table.modules.comms.send(this.connectedTable,"moveRow","dropcomplete",{row:t,success:n})},MoveRows.prototype.receivers={insert:function(e,t,o){return this.table.addRow(e.getData(),void 0,t),!0},add:function(e,t,o){return this.table.addRow(e.getData()),!0},update:function(e,t,o){return!!t&&(t.update(e.getData()),!0)},replace:function(e,t,o){return!!t&&(this.table.addRow(e.getData(),void 0,t),t.delete(),!0)}},MoveRows.prototype.senders={delete:function(e,t,o){e.delete()}},MoveRows.prototype.commsReceived=function(e,t,o){switch(t){case"connect":return this.connect(e,o.row);case"disconnect":return this.disconnect(e);case"dropcomplete":return this.dropComplete(e,o.row,o.success)}},Tabulator.prototype.registerModule("moveRow",MoveRows); \ No newline at end of file diff --git a/website/js/vendor/tabulator/js/modules/mutator.js b/website/js/vendor/tabulator/js/modules/mutator.js new file mode 100644 index 0000000..830b891 --- /dev/null +++ b/website/js/vendor/tabulator/js/modules/mutator.js @@ -0,0 +1,116 @@ +var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; + +/* Tabulator v4.8.3 (c) Oliver Folkerd */ + +var Mutator = function Mutator(table) { + this.table = table; //hold Tabulator object + this.allowedTypes = ["", "data", "edit", "clipboard"]; //list of muatation types + this.enabled = true; +}; + +//initialize column mutator +Mutator.prototype.initializeColumn = function (column) { + var self = this, + match = false, + config = {}; + + this.allowedTypes.forEach(function (type) { + var key = "mutator" + (type.charAt(0).toUpperCase() + type.slice(1)), + mutator; + + if (column.definition[key]) { + mutator = self.lookupMutator(column.definition[key]); + + if (mutator) { + match = true; + + config[key] = { + mutator: mutator, + params: column.definition[key + "Params"] || {} + }; + } + } + }); + + if (match) { + column.modules.mutate = config; + } +}; + +Mutator.prototype.lookupMutator = function (value) { + var mutator = false; + + //set column mutator + switch (typeof value === "undefined" ? "undefined" : _typeof(value)) { + case "string": + if (this.mutators[value]) { + mutator = this.mutators[value]; + } else { + console.warn("Mutator Error - No such mutator found, ignoring: ", value); + } + break; + + case "function": + mutator = value; + break; + } + + return mutator; +}; + +//apply mutator to row +Mutator.prototype.transformRow = function (data, type, updatedData) { + var self = this, + key = "mutator" + (type.charAt(0).toUpperCase() + type.slice(1)), + value; + + if (this.enabled) { + + self.table.columnManager.traverse(function (column) { + var mutator, params, component; + + if (column.modules.mutate) { + mutator = column.modules.mutate[key] || column.modules.mutate.mutator || false; + + if (mutator) { + value = column.getFieldValue(typeof updatedData !== "undefined" ? updatedData : data); + + if (type == "data" || typeof value !== "undefined") { + component = column.getComponent(); + params = typeof mutator.params === "function" ? mutator.params(value, data, type, component) : mutator.params; + column.setFieldValue(data, mutator.mutator(value, data, type, params, component)); + } + } + } + }); + } + + return data; +}; + +//apply mutator to new cell value +Mutator.prototype.transformCell = function (cell, value) { + var mutator = cell.column.modules.mutate.mutatorEdit || cell.column.modules.mutate.mutator || false, + tempData = {}; + + if (mutator) { + tempData = Object.assign(tempData, cell.row.getData()); + cell.column.setFieldValue(tempData, value); + return mutator.mutator(value, tempData, "edit", mutator.params, cell.getComponent()); + } else { + return value; + } +}; + +Mutator.prototype.enable = function () { + this.enabled = true; +}; + +Mutator.prototype.disable = function () { + this.enabled = false; +}; + +//default mutators +Mutator.prototype.mutators = {}; + +Tabulator.prototype.registerModule("mutator", Mutator); \ No newline at end of file diff --git a/website/js/vendor/tabulator/js/modules/mutator.min.js b/website/js/vendor/tabulator/js/modules/mutator.min.js new file mode 100644 index 0000000..8f4f037 --- /dev/null +++ b/website/js/vendor/tabulator/js/modules/mutator.min.js @@ -0,0 +1,2 @@ +/* Tabulator v4.8.3 (c) Oliver Folkerd */ +var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Mutator=function(t){this.table=t,this.allowedTypes=["","data","edit","clipboard"],this.enabled=!0};Mutator.prototype.initializeColumn=function(t){var o=this,e=!1,a={};this.allowedTypes.forEach(function(r){var u,n="mutator"+(r.charAt(0).toUpperCase()+r.slice(1));t.definition[n]&&(u=o.lookupMutator(t.definition[n]))&&(e=!0,a[n]={mutator:u,params:t.definition[n+"Params"]||{}})}),e&&(t.modules.mutate=a)},Mutator.prototype.lookupMutator=function(t){var o=!1;switch(void 0===t?"undefined":_typeof(t)){case"string":this.mutators[t]?o=this.mutators[t]:console.warn("Mutator Error - No such mutator found, ignoring: ",t);break;case"function":o=t}return o},Mutator.prototype.transformRow=function(t,o,e){var a,r=this,u="mutator"+(o.charAt(0).toUpperCase()+o.slice(1));return this.enabled&&r.table.columnManager.traverse(function(r){var n,i,s;r.modules.mutate&&(n=r.modules.mutate[u]||r.modules.mutate.mutator||!1)&&(a=r.getFieldValue(void 0!==e?e:t),"data"!=o&&void 0===a||(s=r.getComponent(),i="function"==typeof n.params?n.params(a,t,o,s):n.params,r.setFieldValue(t,n.mutator(a,t,o,i,s))))}),t},Mutator.prototype.transformCell=function(t,o){var e=t.column.modules.mutate.mutatorEdit||t.column.modules.mutate.mutator||!1,a={};return e?(a=Object.assign(a,t.row.getData()),t.column.setFieldValue(a,o),e.mutator(o,a,"edit",e.params,t.getComponent())):o},Mutator.prototype.enable=function(){this.enabled=!0},Mutator.prototype.disable=function(){this.enabled=!1},Mutator.prototype.mutators={},Tabulator.prototype.registerModule("mutator",Mutator); \ No newline at end of file diff --git a/website/js/vendor/tabulator/js/modules/page.js b/website/js/vendor/tabulator/js/modules/page.js new file mode 100644 index 0000000..81d5e1e --- /dev/null +++ b/website/js/vendor/tabulator/js/modules/page.js @@ -0,0 +1,730 @@ +/* Tabulator v4.8.3 (c) Oliver Folkerd */ + +var Page = function Page(table) { + + this.table = table; //hold Tabulator object + + this.mode = "local"; + this.progressiveLoad = false; + + this.size = 0; + this.page = 1; + this.count = 5; + this.max = 1; + + this.displayIndex = 0; //index in display pipeline + + this.initialLoad = true; + + this.pageSizes = []; + + this.dataReceivedNames = {}; + this.dataSentNames = {}; + + this.createElements(); +}; + +Page.prototype.createElements = function () { + + var button; + + this.element = document.createElement("span"); + this.element.classList.add("tabulator-paginator"); + + this.pagesElement = document.createElement("span"); + this.pagesElement.classList.add("tabulator-pages"); + + button = document.createElement("button"); + button.classList.add("tabulator-page"); + button.setAttribute("type", "button"); + button.setAttribute("role", "button"); + button.setAttribute("aria-label", ""); + button.setAttribute("title", ""); + + this.firstBut = button.cloneNode(true); + this.firstBut.setAttribute("data-page", "first"); + + this.prevBut = button.cloneNode(true); + this.prevBut.setAttribute("data-page", "prev"); + + this.nextBut = button.cloneNode(true); + this.nextBut.setAttribute("data-page", "next"); + + this.lastBut = button.cloneNode(true); + this.lastBut.setAttribute("data-page", "last"); + + if (this.table.options.paginationSizeSelector) { + this.pageSizeSelect = document.createElement("select"); + this.pageSizeSelect.classList.add("tabulator-page-size"); + } +}; + +Page.prototype.generatePageSizeSelectList = function () { + var _this = this; + + var pageSizes = []; + + if (this.pageSizeSelect) { + + if (Array.isArray(this.table.options.paginationSizeSelector)) { + pageSizes = this.table.options.paginationSizeSelector; + this.pageSizes = pageSizes; + + if (this.pageSizes.indexOf(this.size) == -1) { + pageSizes.unshift(this.size); + } + } else { + + if (this.pageSizes.indexOf(this.size) == -1) { + pageSizes = []; + + for (var i = 1; i < 5; i++) { + pageSizes.push(this.size * i); + } + + this.pageSizes = pageSizes; + } else { + pageSizes = this.pageSizes; + } + } + + while (this.pageSizeSelect.firstChild) { + this.pageSizeSelect.removeChild(this.pageSizeSelect.firstChild); + }pageSizes.forEach(function (item) { + var itemEl = document.createElement("option"); + itemEl.value = item; + + if (item === true) { + _this.table.modules.localize.bind("pagination|all", function (value) { + itemEl.innerHTML = value; + }); + } else { + itemEl.innerHTML = item; + } + + _this.pageSizeSelect.appendChild(itemEl); + }); + + this.pageSizeSelect.value = this.size; + } +}; + +//setup pageination +Page.prototype.initialize = function (hidden) { + var self = this, + pageSelectLabel, + testElRow, + testElCell; + + //update param names + this.dataSentNames = Object.assign({}, this.paginationDataSentNames); + this.dataSentNames = Object.assign(this.dataSentNames, this.table.options.paginationDataSent); + + this.dataReceivedNames = Object.assign({}, this.paginationDataReceivedNames); + this.dataReceivedNames = Object.assign(this.dataReceivedNames, this.table.options.paginationDataReceived); + + //build pagination element + + //bind localizations + self.table.modules.localize.bind("pagination|first", function (value) { + self.firstBut.innerHTML = value; + }); + + self.table.modules.localize.bind("pagination|first_title", function (value) { + self.firstBut.setAttribute("aria-label", value); + self.firstBut.setAttribute("title", value); + }); + + self.table.modules.localize.bind("pagination|prev", function (value) { + self.prevBut.innerHTML = value; + }); + + self.table.modules.localize.bind("pagination|prev_title", function (value) { + self.prevBut.setAttribute("aria-label", value); + self.prevBut.setAttribute("title", value); + }); + + self.table.modules.localize.bind("pagination|next", function (value) { + self.nextBut.innerHTML = value; + }); + + self.table.modules.localize.bind("pagination|next_title", function (value) { + self.nextBut.setAttribute("aria-label", value); + self.nextBut.setAttribute("title", value); + }); + + self.table.modules.localize.bind("pagination|last", function (value) { + self.lastBut.innerHTML = value; + }); + + self.table.modules.localize.bind("pagination|last_title", function (value) { + self.lastBut.setAttribute("aria-label", value); + self.lastBut.setAttribute("title", value); + }); + + //click bindings + self.firstBut.addEventListener("click", function () { + self.setPage(1).then(function () {}).catch(function () {}); + }); + + self.prevBut.addEventListener("click", function () { + self.previousPage().then(function () {}).catch(function () {}); + }); + + self.nextBut.addEventListener("click", function () { + self.nextPage().then(function () {}).catch(function () {}); + }); + + self.lastBut.addEventListener("click", function () { + self.setPage(self.max).then(function () {}).catch(function () {}); + }); + + if (self.table.options.paginationElement) { + self.element = self.table.options.paginationElement; + } + + if (this.pageSizeSelect) { + pageSelectLabel = document.createElement("label"); + + self.table.modules.localize.bind("pagination|page_size", function (value) { + self.pageSizeSelect.setAttribute("aria-label", value); + self.pageSizeSelect.setAttribute("title", value); + pageSelectLabel.innerHTML = value; + }); + + self.element.appendChild(pageSelectLabel); + self.element.appendChild(self.pageSizeSelect); + + self.pageSizeSelect.addEventListener("change", function (e) { + self.setPageSize(self.pageSizeSelect.value == "true" ? true : self.pageSizeSelect.value); + self.setPage(1).then(function () {}).catch(function () {}); + }); + } + + //append to DOM + self.element.appendChild(self.firstBut); + self.element.appendChild(self.prevBut); + self.element.appendChild(self.pagesElement); + self.element.appendChild(self.nextBut); + self.element.appendChild(self.lastBut); + + if (!self.table.options.paginationElement && !hidden) { + self.table.footerManager.append(self.element, self); + } + + //set default values + self.mode = self.table.options.pagination; + + if (self.table.options.paginationSize) { + self.size = self.table.options.paginationSize; + } else { + testElRow = document.createElement("div"); + testElRow.classList.add("tabulator-row"); + testElRow.style.visibility = hidden; + + testElCell = document.createElement("div"); + testElCell.classList.add("tabulator-cell"); + testElCell.innerHTML = "Page Row Test"; + + testElRow.appendChild(testElCell); + + self.table.rowManager.getTableElement().appendChild(testElRow); + + self.size = Math.floor(self.table.rowManager.getElement().clientHeight / testElRow.offsetHeight); + + self.table.rowManager.getTableElement().removeChild(testElRow); + } + + // self.page = self.table.options.paginationInitialPage || 1; + self.count = self.table.options.paginationButtonCount; + + self.generatePageSizeSelectList(); +}; + +Page.prototype.initializeProgressive = function (mode) { + this.initialize(true); + this.mode = "progressive_" + mode; + this.progressiveLoad = true; +}; + +Page.prototype.setDisplayIndex = function (index) { + this.displayIndex = index; +}; + +Page.prototype.getDisplayIndex = function () { + return this.displayIndex; +}; + +//calculate maximum page from number of rows +Page.prototype.setMaxRows = function (rowCount) { + if (!rowCount) { + this.max = 1; + } else { + this.max = this.size === true ? 1 : Math.ceil(rowCount / this.size); + } + + if (this.page > this.max) { + this.page = this.max; + } +}; + +//reset to first page without triggering action +Page.prototype.reset = function (force, columnsChanged) { + if (this.mode == "local" || force) { + this.page = 1; + } + + if (columnsChanged) { + this.initialLoad = true; + } + + return true; +}; + +//set the maxmum page +Page.prototype.setMaxPage = function (max) { + + max = parseInt(max); + + this.max = max || 1; + + if (this.page > this.max) { + this.page = this.max; + this.trigger(); + } +}; + +//set current page number +Page.prototype.setPage = function (page) { + var _this2 = this; + + var self = this; + + switch (page) { + case "first": + return this.setPage(1); + break; + + case "prev": + return this.previousPage(); + break; + + case "next": + return this.nextPage(); + break; + + case "last": + return this.setPage(this.max); + break; + } + + return new Promise(function (resolve, reject) { + + page = parseInt(page); + + if (page > 0 && page <= _this2.max) { + _this2.page = page; + _this2.trigger().then(function () { + resolve(); + }).catch(function () { + reject(); + }); + + if (self.table.options.persistence && self.table.modExists("persistence", true) && self.table.modules.persistence.config.page) { + self.table.modules.persistence.save("page"); + } + } else { + console.warn("Pagination Error - Requested page is out of range of 1 - " + _this2.max + ":", page); + reject(); + } + }); +}; + +Page.prototype.setPageToRow = function (row) { + var _this3 = this; + + return new Promise(function (resolve, reject) { + + var rows = _this3.table.rowManager.getDisplayRows(_this3.displayIndex - 1); + var index = rows.indexOf(row); + + if (index > -1) { + var page = _this3.size === true ? 1 : Math.ceil((index + 1) / _this3.size); + + _this3.setPage(page).then(function () { + resolve(); + }).catch(function () { + reject(); + }); + } else { + console.warn("Pagination Error - Requested row is not visible"); + reject(); + } + }); +}; + +Page.prototype.setPageSize = function (size) { + if (size !== true) { + size = parseInt(size); + } + + if (size > 0) { + this.size = size; + } + + if (this.pageSizeSelect) { + // this.pageSizeSelect.value = size; + this.generatePageSizeSelectList(); + } + + if (this.table.options.persistence && this.table.modExists("persistence", true) && this.table.modules.persistence.config.page) { + this.table.modules.persistence.save("page"); + } +}; + +//setup the pagination buttons +Page.prototype._setPageButtons = function () { + var self = this; + + var leftSize = Math.floor((this.count - 1) / 2); + var rightSize = Math.ceil((this.count - 1) / 2); + var min = this.max - this.page + leftSize + 1 < this.count ? this.max - this.count + 1 : Math.max(this.page - leftSize, 1); + var max = this.page <= rightSize ? Math.min(this.count, this.max) : Math.min(this.page + rightSize, this.max); + + while (self.pagesElement.firstChild) { + self.pagesElement.removeChild(self.pagesElement.firstChild); + }if (self.page == 1) { + self.firstBut.disabled = true; + self.prevBut.disabled = true; + } else { + self.firstBut.disabled = false; + self.prevBut.disabled = false; + } + + if (self.page == self.max) { + self.lastBut.disabled = true; + self.nextBut.disabled = true; + } else { + self.lastBut.disabled = false; + self.nextBut.disabled = false; + } + + for (var i = min; i <= max; i++) { + if (i > 0 && i <= self.max) { + self.pagesElement.appendChild(self._generatePageButton(i)); + } + } + + this.footerRedraw(); +}; + +Page.prototype._generatePageButton = function (page) { + var self = this, + button = document.createElement("button"); + + button.classList.add("tabulator-page"); + if (page == self.page) { + button.classList.add("active"); + } + + button.setAttribute("type", "button"); + button.setAttribute("role", "button"); + + self.table.modules.localize.bind("pagination|page_title", function (value) { + button.setAttribute("aria-label", value + " " + page); + button.setAttribute("title", value + " " + page); + }); + + button.setAttribute("data-page", page); + button.textContent = page; + + button.addEventListener("click", function (e) { + self.setPage(page).then(function () {}).catch(function () {}); + }); + + return button; +}; + +//previous page +Page.prototype.previousPage = function () { + var _this4 = this; + + return new Promise(function (resolve, reject) { + if (_this4.page > 1) { + _this4.page--; + _this4.trigger().then(function () { + resolve(); + }).catch(function () { + reject(); + }); + + if (_this4.table.options.persistence && _this4.table.modExists("persistence", true) && _this4.table.modules.persistence.config.page) { + _this4.table.modules.persistence.save("page"); + } + } else { + console.warn("Pagination Error - Previous page would be less than page 1:", 0); + reject(); + } + }); +}; + +//next page +Page.prototype.nextPage = function () { + var _this5 = this; + + return new Promise(function (resolve, reject) { + if (_this5.page < _this5.max) { + _this5.page++; + _this5.trigger().then(function () { + resolve(); + }).catch(function () { + reject(); + }); + + if (_this5.table.options.persistence && _this5.table.modExists("persistence", true) && _this5.table.modules.persistence.config.page) { + _this5.table.modules.persistence.save("page"); + } + } else { + if (!_this5.progressiveLoad) { + console.warn("Pagination Error - Next page would be greater than maximum page of " + _this5.max + ":", _this5.max + 1); + } + reject(); + } + }); +}; + +//return current page number +Page.prototype.getPage = function () { + return this.page; +}; + +//return max page number +Page.prototype.getPageMax = function () { + return this.max; +}; + +Page.prototype.getPageSize = function (size) { + return this.size; +}; + +Page.prototype.getMode = function () { + return this.mode; +}; + +//return appropriate rows for current page +Page.prototype.getRows = function (data) { + var output, start, end; + + if (this.mode == "local") { + output = []; + + if (this.size === true) { + start = 0; + end = data.length; + } else { + start = this.size * (this.page - 1); + end = start + parseInt(this.size); + } + + this._setPageButtons(); + + for (var i = start; i < end; i++) { + if (data[i]) { + output.push(data[i]); + } + } + + return output; + } else { + + this._setPageButtons(); + + return data.slice(0); + } +}; + +Page.prototype.trigger = function () { + var _this6 = this; + + var left; + + return new Promise(function (resolve, reject) { + + switch (_this6.mode) { + case "local": + left = _this6.table.rowManager.scrollLeft; + + _this6.table.rowManager.refreshActiveData("page"); + _this6.table.rowManager.scrollHorizontal(left); + + _this6.table.options.pageLoaded.call(_this6.table, _this6.getPage()); + resolve(); + break; + + case "remote": + case "progressive_load": + case "progressive_scroll": + _this6.table.modules.ajax.blockActiveRequest(); + _this6._getRemotePage().then(function () { + resolve(); + }).catch(function () { + reject(); + }); + break; + + default: + console.warn("Pagination Error - no such pagination mode:", _this6.mode); + reject(); + } + }); +}; + +Page.prototype._getRemotePage = function () { + var _this7 = this; + + var self = this, + oldParams, + pageParams; + + return new Promise(function (resolve, reject) { + + if (!self.table.modExists("ajax", true)) { + reject(); + } + + //record old params and restore after request has been made + oldParams = Tabulator.prototype.helpers.deepClone(self.table.modules.ajax.getParams() || {}); + pageParams = self.table.modules.ajax.getParams(); + + //configure request params + pageParams[_this7.dataSentNames.page] = self.page; + + //set page size if defined + if (_this7.size) { + pageParams[_this7.dataSentNames.size] = _this7.size; + } + + //set sort data if defined + if (_this7.table.options.ajaxSorting && _this7.table.modExists("sort")) { + var sorters = self.table.modules.sort.getSort(); + + sorters.forEach(function (item) { + delete item.column; + }); + + pageParams[_this7.dataSentNames.sorters] = sorters; + } + + //set filter data if defined + if (_this7.table.options.ajaxFiltering && _this7.table.modExists("filter")) { + var filters = self.table.modules.filter.getFilters(true, true); + pageParams[_this7.dataSentNames.filters] = filters; + } + + self.table.modules.ajax.setParams(pageParams); + + self.table.modules.ajax.sendRequest(_this7.progressiveLoad).then(function (data) { + self._parseRemoteData(data); + resolve(); + }).catch(function (e) { + reject(); + }); + + self.table.modules.ajax.setParams(oldParams); + }); +}; + +Page.prototype._parseRemoteData = function (data) { + var self = this, + left, + data, + margin; + + if (typeof data[this.dataReceivedNames.last_page] === "undefined") { + console.warn("Remote Pagination Error - Server response missing '" + this.dataReceivedNames.last_page + "' property"); + } + + if (data[this.dataReceivedNames.data]) { + this.max = parseInt(data[this.dataReceivedNames.last_page]) || 1; + + if (this.progressiveLoad) { + switch (this.mode) { + case "progressive_load": + + if (this.page == 1) { + this.table.rowManager.setData(data[this.dataReceivedNames.data], false, this.initialLoad && this.page == 1); + } else { + this.table.rowManager.addRows(data[this.dataReceivedNames.data]); + } + + if (this.page < this.max) { + setTimeout(function () { + self.nextPage().then(function () {}).catch(function () {}); + }, self.table.options.ajaxProgressiveLoadDelay); + } + break; + + case "progressive_scroll": + data = this.table.rowManager.getData().concat(data[this.dataReceivedNames.data]); + + this.table.rowManager.setData(data, true, this.initialLoad && this.page == 1); + + margin = this.table.options.ajaxProgressiveLoadScrollMargin || this.table.rowManager.element.clientHeight * 2; + + if (self.table.rowManager.element.scrollHeight <= self.table.rowManager.element.clientHeight + margin) { + self.nextPage().then(function () {}).catch(function () {}); + } + break; + } + } else { + left = this.table.rowManager.scrollLeft; + + this.table.rowManager.setData(data[this.dataReceivedNames.data], false, this.initialLoad && this.page == 1); + + this.table.rowManager.scrollHorizontal(left); + + this.table.columnManager.scrollHorizontal(left); + + this.table.options.pageLoaded.call(this.table, this.getPage()); + } + + this.initialLoad = false; + } else { + console.warn("Remote Pagination Error - Server response missing '" + this.dataReceivedNames.data + "' property"); + } +}; + +//handle the footer element being redrawn +Page.prototype.footerRedraw = function () { + var footer = this.table.footerManager.element; + + if (Math.ceil(footer.clientWidth) - footer.scrollWidth < 0) { + this.pagesElement.style.display = 'none'; + } else { + this.pagesElement.style.display = ''; + + if (Math.ceil(footer.clientWidth) - footer.scrollWidth < 0) { + this.pagesElement.style.display = 'none'; + } + } +}; + +//set the paramter names for pagination requests +Page.prototype.paginationDataSentNames = { + "page": "page", + "size": "size", + "sorters": "sorters", + // "sort_dir":"sort_dir", + "filters": "filters" + // "filter_value":"filter_value", + // "filter_type":"filter_type", +}; + +//set the property names for pagination responses +Page.prototype.paginationDataReceivedNames = { + "current_page": "current_page", + "last_page": "last_page", + "data": "data" +}; + +Tabulator.prototype.registerModule("page", Page); \ No newline at end of file diff --git a/website/js/vendor/tabulator/js/modules/page.min.js b/website/js/vendor/tabulator/js/modules/page.min.js new file mode 100644 index 0000000..58dbf2b --- /dev/null +++ b/website/js/vendor/tabulator/js/modules/page.min.js @@ -0,0 +1,2 @@ +/* Tabulator v4.8.3 (c) Oliver Folkerd */ +var Page=function(e){this.table=e,this.mode="local",this.progressiveLoad=!1,this.size=0,this.page=1,this.count=5,this.max=1,this.displayIndex=0,this.initialLoad=!0,this.pageSizes=[],this.dataReceivedNames={},this.dataSentNames={},this.createElements()};Page.prototype.createElements=function(){var e;this.element=document.createElement("span"),this.element.classList.add("tabulator-paginator"),this.pagesElement=document.createElement("span"),this.pagesElement.classList.add("tabulator-pages"),e=document.createElement("button"),e.classList.add("tabulator-page"),e.setAttribute("type","button"),e.setAttribute("role","button"),e.setAttribute("aria-label",""),e.setAttribute("title",""),this.firstBut=e.cloneNode(!0),this.firstBut.setAttribute("data-page","first"),this.prevBut=e.cloneNode(!0),this.prevBut.setAttribute("data-page","prev"),this.nextBut=e.cloneNode(!0),this.nextBut.setAttribute("data-page","next"),this.lastBut=e.cloneNode(!0),this.lastBut.setAttribute("data-page","last"),this.table.options.paginationSizeSelector&&(this.pageSizeSelect=document.createElement("select"),this.pageSizeSelect.classList.add("tabulator-page-size"))},Page.prototype.generatePageSizeSelectList=function(){var e=this,t=[];if(this.pageSizeSelect){if(Array.isArray(this.table.options.paginationSizeSelector))t=this.table.options.paginationSizeSelector,this.pageSizes=t,-1==this.pageSizes.indexOf(this.size)&&t.unshift(this.size);else if(-1==this.pageSizes.indexOf(this.size)){t=[];for(var a=1;a<5;a++)t.push(this.size*a);this.pageSizes=t}else t=this.pageSizes;for(;this.pageSizeSelect.firstChild;)this.pageSizeSelect.removeChild(this.pageSizeSelect.firstChild);t.forEach(function(t){var a=document.createElement("option");a.value=t,!0===t?e.table.modules.localize.bind("pagination|all",function(e){a.innerHTML=e}):a.innerHTML=t,e.pageSizeSelect.appendChild(a)}),this.pageSizeSelect.value=this.size}},Page.prototype.initialize=function(e){var t,a,i,s=this;this.dataSentNames=Object.assign({},this.paginationDataSentNames),this.dataSentNames=Object.assign(this.dataSentNames,this.table.options.paginationDataSent),this.dataReceivedNames=Object.assign({},this.paginationDataReceivedNames),this.dataReceivedNames=Object.assign(this.dataReceivedNames,this.table.options.paginationDataReceived),s.table.modules.localize.bind("pagination|first",function(e){s.firstBut.innerHTML=e}),s.table.modules.localize.bind("pagination|first_title",function(e){s.firstBut.setAttribute("aria-label",e),s.firstBut.setAttribute("title",e)}),s.table.modules.localize.bind("pagination|prev",function(e){s.prevBut.innerHTML=e}),s.table.modules.localize.bind("pagination|prev_title",function(e){s.prevBut.setAttribute("aria-label",e),s.prevBut.setAttribute("title",e)}),s.table.modules.localize.bind("pagination|next",function(e){s.nextBut.innerHTML=e}),s.table.modules.localize.bind("pagination|next_title",function(e){s.nextBut.setAttribute("aria-label",e),s.nextBut.setAttribute("title",e)}),s.table.modules.localize.bind("pagination|last",function(e){s.lastBut.innerHTML=e}),s.table.modules.localize.bind("pagination|last_title",function(e){s.lastBut.setAttribute("aria-label",e),s.lastBut.setAttribute("title",e)}),s.firstBut.addEventListener("click",function(){s.setPage(1).then(function(){}).catch(function(){})}),s.prevBut.addEventListener("click",function(){s.previousPage().then(function(){}).catch(function(){})}),s.nextBut.addEventListener("click",function(){s.nextPage().then(function(){}).catch(function(){})}),s.lastBut.addEventListener("click",function(){s.setPage(s.max).then(function(){}).catch(function(){})}),s.table.options.paginationElement&&(s.element=s.table.options.paginationElement),this.pageSizeSelect&&(t=document.createElement("label"),s.table.modules.localize.bind("pagination|page_size",function(e){s.pageSizeSelect.setAttribute("aria-label",e),s.pageSizeSelect.setAttribute("title",e),t.innerHTML=e}),s.element.appendChild(t),s.element.appendChild(s.pageSizeSelect),s.pageSizeSelect.addEventListener("change",function(e){s.setPageSize("true"==s.pageSizeSelect.value||s.pageSizeSelect.value),s.setPage(1).then(function(){}).catch(function(){})})),s.element.appendChild(s.firstBut),s.element.appendChild(s.prevBut),s.element.appendChild(s.pagesElement),s.element.appendChild(s.nextBut),s.element.appendChild(s.lastBut),s.table.options.paginationElement||e||s.table.footerManager.append(s.element,s),s.mode=s.table.options.pagination,s.table.options.paginationSize?s.size=s.table.options.paginationSize:(a=document.createElement("div"),a.classList.add("tabulator-row"),a.style.visibility=e,i=document.createElement("div"),i.classList.add("tabulator-cell"),i.innerHTML="Page Row Test",a.appendChild(i),s.table.rowManager.getTableElement().appendChild(a),s.size=Math.floor(s.table.rowManager.getElement().clientHeight/a.offsetHeight),s.table.rowManager.getTableElement().removeChild(a)),s.count=s.table.options.paginationButtonCount,s.generatePageSizeSelectList()},Page.prototype.initializeProgressive=function(e){this.initialize(!0),this.mode="progressive_"+e,this.progressiveLoad=!0},Page.prototype.setDisplayIndex=function(e){this.displayIndex=e},Page.prototype.getDisplayIndex=function(){return this.displayIndex},Page.prototype.setMaxRows=function(e){this.max=e?!0===this.size?1:Math.ceil(e/this.size):1,this.page>this.max&&(this.page=this.max)},Page.prototype.reset=function(e,t){return("local"==this.mode||e)&&(this.page=1),t&&(this.initialLoad=!0),!0},Page.prototype.setMaxPage=function(e){e=parseInt(e),this.max=e||1,this.page>this.max&&(this.page=this.max,this.trigger())},Page.prototype.setPage=function(e){var t=this,a=this;switch(e){case"first":return this.setPage(1);case"prev":return this.previousPage();case"next":return this.nextPage();case"last":return this.setPage(this.max)}return new Promise(function(i,s){e=parseInt(e),e>0&&e<=t.max?(t.page=e,t.trigger().then(function(){i()}).catch(function(){s()}),a.table.options.persistence&&a.table.modExists("persistence",!0)&&a.table.modules.persistence.config.page&&a.table.modules.persistence.save("page")):(console.warn("Pagination Error - Requested page is out of range of 1 - "+t.max+":",e),s())})},Page.prototype.setPageToRow=function(e){var t=this;return new Promise(function(a,i){var s=t.table.rowManager.getDisplayRows(t.displayIndex-1),n=s.indexOf(e);if(n>-1){var o=!0===t.size?1:Math.ceil((n+1)/t.size);t.setPage(o).then(function(){a()}).catch(function(){i()})}else console.warn("Pagination Error - Requested row is not visible"),i()})},Page.prototype.setPageSize=function(e){!0!==e&&(e=parseInt(e)),e>0&&(this.size=e),this.pageSizeSelect&&this.generatePageSizeSelectList(),this.table.options.persistence&&this.table.modExists("persistence",!0)&&this.table.modules.persistence.config.page&&this.table.modules.persistence.save("page")},Page.prototype._setPageButtons=function(){for(var e=this,t=Math.floor((this.count-1)/2),a=Math.ceil((this.count-1)/2),i=this.max-this.page+t+10&&n<=e.max&&e.pagesElement.appendChild(e._generatePageButton(n));this.footerRedraw()},Page.prototype._generatePageButton=function(e){var t=this,a=document.createElement("button");return a.classList.add("tabulator-page"),e==t.page&&a.classList.add("active"),a.setAttribute("type","button"),a.setAttribute("role","button"),t.table.modules.localize.bind("pagination|page_title",function(t){a.setAttribute("aria-label",t+" "+e),a.setAttribute("title",t+" "+e)}),a.setAttribute("data-page",e),a.textContent=e,a.addEventListener("click",function(a){t.setPage(e).then(function(){}).catch(function(){})}),a},Page.prototype.previousPage=function(){var e=this;return new Promise(function(t,a){e.page>1?(e.page--,e.trigger().then(function(){t()}).catch(function(){a()}),e.table.options.persistence&&e.table.modExists("persistence",!0)&&e.table.modules.persistence.config.page&&e.table.modules.persistence.save("page")):(console.warn("Pagination Error - Previous page would be less than page 1:",0),a())})},Page.prototype.nextPage=function(){var e=this;return new Promise(function(t,a){e.page i) { + output.splice(i, 0, column); + } else { + output.push(column); + } + } + }); + + return output; +}; + +//find matching columns +Persistence.prototype._findColumn = function (columns, subject) { + var type = subject.columns ? "group" : subject.field ? "field" : "object"; + + return columns.find(function (col) { + switch (type) { + case "group": + return col.title === subject.title && col.columns.length === subject.columns.length; + break; + + case "field": + return col.field === subject.field; + break; + + case "object": + return col === subject; + break; + } + }); +}; + +//save data +Persistence.prototype.save = function (type) { + var data = {}; + + switch (type) { + case "columns": + data = this.parseColumns(this.table.columnManager.getColumns()); + break; + + case "filter": + data = this.table.modules.filter.getFilters(); + break; + + case "sort": + data = this.validateSorters(this.table.modules.sort.getSort()); + break; + + case "group": + data = this.getGroupConfig(); + break; + + case "page": + data = this.getPageConfig(); + break; + } + + if (this.writeFunc) { + this.writeFunc(this.id, type, data); + } +}; + +//ensure sorters contain no function data +Persistence.prototype.validateSorters = function (data) { + data.forEach(function (item) { + item.column = item.field; + delete item.field; + }); + + return data; +}; + +Persistence.prototype.getGroupConfig = function () { + var data = {}; + + if (this.config.group) { + if (this.config.group === true || this.config.group.groupBy) { + data.groupBy = this.table.options.groupBy; + } + + if (this.config.group === true || this.config.group.groupStartOpen) { + data.groupStartOpen = this.table.options.groupStartOpen; + } + + if (this.config.group === true || this.config.group.groupHeader) { + data.groupHeader = this.table.options.groupHeader; + } + } + + return data; +}; + +Persistence.prototype.getPageConfig = function () { + var data = {}; + + if (this.config.page) { + if (this.config.page === true || this.config.page.size) { + data.paginationSize = this.table.modules.page.getPageSize(); + } + + if (this.config.page === true || this.config.page.page) { + data.paginationInitialPage = this.table.modules.page.getPage(); + } + } + + return data; +}; + +//parse columns for data to store +Persistence.prototype.parseColumns = function (columns) { + var self = this, + definitions = [], + excludedKeys = ["headerContextMenu", "headerMenu", "contextMenu", "clickMenu"]; + + columns.forEach(function (column) { + var defStore = {}, + colDef = column.getDefinition(), + keys; + + if (column.isGroup) { + defStore.title = colDef.title; + defStore.columns = self.parseColumns(column.getColumns()); + } else { + defStore.field = column.getField(); + + if (self.config.columns === true || self.config.columns == undefined) { + keys = Object.keys(colDef); + keys.push("width"); + } else { + keys = self.config.columns; + } + + keys.forEach(function (key) { + + switch (key) { + case "width": + defStore.width = column.getWidth(); + break; + case "visible": + defStore.visible = column.visible; + break; + + default: + if (typeof colDef[key] !== "function" && excludedKeys.indexOf(key) === -1) { + defStore[key] = colDef[key]; + } + } + }); + } + + definitions.push(defStore); + }); + + return definitions; +}; + +// read peristence information from storage +Persistence.prototype.readers = { + local: function local(id, type) { + var data = localStorage.getItem(id + "-" + type); + + return data ? JSON.parse(data) : false; + }, + cookie: function cookie(id, type) { + var cookie = document.cookie, + key = id + "-" + type, + cookiePos = cookie.indexOf(key + "="), + end, + data; + + //if cookie exists, decode and load column data into tabulator + if (cookiePos > -1) { + cookie = cookie.substr(cookiePos); + + end = cookie.indexOf(";"); + + if (end > -1) { + cookie = cookie.substr(0, end); + } + + data = cookie.replace(key + "=", ""); + } + + return data ? JSON.parse(data) : false; + } +}; + +//write persistence information to storage +Persistence.prototype.writers = { + local: function local(id, type, data) { + localStorage.setItem(id + "-" + type, JSON.stringify(data)); + }, + cookie: function cookie(id, type, data) { + var expireDate = new Date(); + + expireDate.setDate(expireDate.getDate() + 10000); + + document.cookie = id + "-" + type + "=" + JSON.stringify(data) + "; expires=" + expireDate.toUTCString(); + } +}; + +Tabulator.prototype.registerModule("persistence", Persistence); \ No newline at end of file diff --git a/website/js/vendor/tabulator/js/modules/persistence.min.js b/website/js/vendor/tabulator/js/modules/persistence.min.js new file mode 100644 index 0000000..13b6e88 --- /dev/null +++ b/website/js/vendor/tabulator/js/modules/persistence.min.js @@ -0,0 +1,2 @@ +/* Tabulator v4.8.3 (c) Oliver Folkerd */ +var Persistence=function(e){this.table=e,this.mode="",this.id="",this.defWatcherBlock=!1,this.config={},this.readFunc=!1,this.writeFunc=!1};Persistence.prototype.localStorageTest=function(){var e="_tabulator_test";try{return window.localStorage.setItem(e,e),window.localStorage.removeItem(e),!0}catch(e){return!1}},Persistence.prototype.initialize=function(){var e,t=this.table.options.persistenceMode,i=this.table.options.persistenceID;this.mode=!0!==t?t:this.localStorageTest()?"local":"cookie",this.table.options.persistenceReaderFunc?"function"==typeof this.table.options.persistenceReaderFunc?this.readFunc=this.table.options.persistenceReaderFunc:this.readers[this.table.options.persistenceReaderFunc]?this.readFunc=this.readers[this.table.options.persistenceReaderFunc]:console.warn("Persistence Read Error - invalid reader set",this.table.options.persistenceReaderFunc):this.readers[this.mode]?this.readFunc=this.readers[this.mode]:console.warn("Persistence Read Error - invalid reader set",this.mode),this.table.options.persistenceWriterFunc?"function"==typeof this.table.options.persistenceWriterFunc?this.writeFunc=this.table.options.persistenceWriterFunc:this.readers[this.table.options.persistenceWriterFunc]?this.writeFunc=this.readers[this.table.options.persistenceWriterFunc]:console.warn("Persistence Write Error - invalid reader set",this.table.options.persistenceWriterFunc):this.writers[this.mode]?this.writeFunc=this.writers[this.mode]:console.warn("Persistence Write Error - invalid writer set",this.mode),this.id="tabulator-"+(i||this.table.element.getAttribute("id")||""),this.config={sort:!0===this.table.options.persistence||this.table.options.persistence.sort,filter:!0===this.table.options.persistence||this.table.options.persistence.filter,group:!0===this.table.options.persistence||this.table.options.persistence.group,page:!0===this.table.options.persistence||this.table.options.persistence.page,columns:!0===this.table.options.persistence?["title","width","visible"]:this.table.options.persistence.columns},this.config.page&&(e=this.retreiveData("page"))&&(void 0===e.paginationSize||!0!==this.config.page&&!this.config.page.size||(this.table.options.paginationSize=e.paginationSize),void 0===e.paginationInitialPage||!0!==this.config.page&&!this.config.page.page||(this.table.options.paginationInitialPage=e.paginationInitialPage)),this.config.group&&(e=this.retreiveData("group"))&&(void 0===e.groupBy||!0!==this.config.group&&!this.config.group.groupBy||(this.table.options.groupBy=e.groupBy),void 0===e.groupStartOpen||!0!==this.config.group&&!this.config.group.groupStartOpen||(this.table.options.groupStartOpen=e.groupStartOpen),void 0===e.groupHeader||!0!==this.config.group&&!this.config.group.groupHeader||(this.table.options.groupHeader=e.groupHeader))},Persistence.prototype.initializeColumn=function(e){var t,i,o=this;this.config.columns&&(this.defWatcherBlock=!0,t=e.getDefinition(),i=!0===this.config.columns?Object.keys(t):this.config.columns,i.forEach(function(e){var i=Object.getOwnPropertyDescriptor(t,e),s=t[e];i&&Object.defineProperty(t,e,{set:function(e){s=e,o.defWatcherBlock||o.save("columns"),i.set&&i.set(e)},get:function(){return i.get&&i.get(),s}})}),this.defWatcherBlock=!1)},Persistence.prototype.load=function(e,t){var i=this.retreiveData(e);return t&&(i=i?this.mergeDefinition(t,i):t),i},Persistence.prototype.retreiveData=function(e){return!!this.readFunc&&this.readFunc(this.id,e)},Persistence.prototype.mergeDefinition=function(e,t){var i=this,o=[];return t=t||[],t.forEach(function(t,s){var n,r=i._findColumn(e,t);r&&(!0===i.config.columns||void 0==i.config.columns?(n=Object.keys(r),n.push("width")):n=i.config.columns,n.forEach(function(e){void 0!==t[e]&&(r[e]=t[e])}),r.columns&&(r.columns=i.mergeDefinition(r.columns,t.columns)),o.push(r))}),e.forEach(function(e,s){i._findColumn(t,e)||(o.length>s?o.splice(s,0,e):o.push(e))}),o},Persistence.prototype._findColumn=function(e,t){var i=t.columns?"group":t.field?"field":"object";return e.find(function(e){switch(i){case"group":return e.title===t.title&&e.columns.length===t.columns.length;case"field":return e.field===t.field;case"object":return e===t}})},Persistence.prototype.save=function(e){var t={};switch(e){case"columns":t=this.parseColumns(this.table.columnManager.getColumns());break;case"filter":t=this.table.modules.filter.getFilters();break;case"sort":t=this.validateSorters(this.table.modules.sort.getSort());break;case"group":t=this.getGroupConfig();break;case"page":t=this.getPageConfig()}this.writeFunc&&this.writeFunc(this.id,e,t)},Persistence.prototype.validateSorters=function(e){return e.forEach(function(e){e.column=e.field,delete e.field}),e},Persistence.prototype.getGroupConfig=function(){var e={};return this.config.group&&((!0===this.config.group||this.config.group.groupBy)&&(e.groupBy=this.table.options.groupBy),(!0===this.config.group||this.config.group.groupStartOpen)&&(e.groupStartOpen=this.table.options.groupStartOpen),(!0===this.config.group||this.config.group.groupHeader)&&(e.groupHeader=this.table.options.groupHeader)),e},Persistence.prototype.getPageConfig=function(){var e={};return this.config.page&&((!0===this.config.page||this.config.page.size)&&(e.paginationSize=this.table.modules.page.getPageSize()),(!0===this.config.page||this.config.page.page)&&(e.paginationInitialPage=this.table.modules.page.getPage())),e},Persistence.prototype.parseColumns=function(e){var t=this,i=[],o=["headerContextMenu","headerMenu","contextMenu","clickMenu"];return e.forEach(function(e){var s,n={},r=e.getDefinition();e.isGroup?(n.title=r.title,n.columns=t.parseColumns(e.getColumns())):(n.field=e.getField(),!0===t.config.columns||void 0==t.config.columns?(s=Object.keys(r),s.push("width")):s=t.config.columns,s.forEach(function(t){switch(t){case"width":n.width=e.getWidth();break;case"visible":n.visible=e.visible;break;default:"function"!=typeof r[t]&&-1===o.indexOf(t)&&(n[t]=r[t])}})),i.push(n)}),i},Persistence.prototype.readers={local:function(e,t){var i=localStorage.getItem(e+"-"+t);return!!i&&JSON.parse(i)},cookie:function(e,t){var i,o,s=document.cookie,n=e+"-"+t,r=s.indexOf(n+"=");return r>-1&&(s=s.substr(r),i=s.indexOf(";"),i>-1&&(s=s.substr(0,i)),o=s.replace(n+"=","")),!!o&&JSON.parse(o)}},Persistence.prototype.writers={local:function(e,t,i){localStorage.setItem(e+"-"+t,JSON.stringify(i))},cookie:function(e,t,i){var o=new Date;o.setDate(o.getDate()+1e4),document.cookie=e+"-"+t+"="+JSON.stringify(i)+"; expires="+o.toUTCString()}},Tabulator.prototype.registerModule("persistence",Persistence); \ No newline at end of file diff --git a/website/js/vendor/tabulator/js/modules/print.js b/website/js/vendor/tabulator/js/modules/print.js new file mode 100644 index 0000000..3ed4835 --- /dev/null +++ b/website/js/vendor/tabulator/js/modules/print.js @@ -0,0 +1,96 @@ +/* Tabulator v4.8.3 (c) Oliver Folkerd */ + +var Print = function Print(table) { + this.table = table; //hold Tabulator object + this.element = false; + this.manualBlock = false; +}; + +Print.prototype.initialize = function () { + window.addEventListener("beforeprint", this.replaceTable.bind(this)); + window.addEventListener("afterprint", this.cleanup.bind(this)); +}; + +Print.prototype.replaceTable = function () { + if (!this.manualBlock) { + this.element = document.createElement("div"); + this.element.classList.add("tabulator-print-table"); + + this.element.appendChild(this.table.modules.export.genereateTable(this.table.options.printConfig, this.table.options.printStyled, this.table.options.printRowRange, "print")); + + this.table.element.style.display = "none"; + + this.table.element.parentNode.insertBefore(this.element, this.table.element); + } +}; + +Print.prototype.cleanup = function () { + document.body.classList.remove("tabulator-print-fullscreen-hide"); + + if (this.element && this.element.parentNode) { + this.element.parentNode.removeChild(this.element); + this.table.element.style.display = ""; + } +}; + +Print.prototype.printFullscreen = function (visible, style, config) { + var scrollX = window.scrollX, + scrollY = window.scrollY, + headerEl = document.createElement("div"), + footerEl = document.createElement("div"), + tableEl = this.table.modules.export.genereateTable(typeof config != "undefined" ? config : this.table.options.printConfig, typeof style != "undefined" ? style : this.table.options.printStyled, visible, "print"), + headerContent, + footerContent; + + this.manualBlock = true; + + this.element = document.createElement("div"); + this.element.classList.add("tabulator-print-fullscreen"); + + if (this.table.options.printHeader) { + headerEl.classList.add("tabulator-print-header"); + + headerContent = typeof this.table.options.printHeader == "function" ? this.table.options.printHeader.call(this.table) : this.table.options.printHeader; + + if (typeof headerContent == "string") { + headerEl.innerHTML = headerContent; + } else { + headerEl.appendChild(headerContent); + } + + this.element.appendChild(headerEl); + } + + this.element.appendChild(tableEl); + + if (this.table.options.printFooter) { + footerEl.classList.add("tabulator-print-footer"); + + footerContent = typeof this.table.options.printFooter == "function" ? this.table.options.printFooter.call(this.table) : this.table.options.printFooter; + + if (typeof footerContent == "string") { + footerEl.innerHTML = footerContent; + } else { + footerEl.appendChild(footerContent); + } + + this.element.appendChild(footerEl); + } + + document.body.classList.add("tabulator-print-fullscreen-hide"); + document.body.appendChild(this.element); + + if (this.table.options.printFormatter) { + this.table.options.printFormatter(this.element, tableEl); + } + + window.print(); + + this.cleanup(); + + window.scrollTo(scrollX, scrollY); + + this.manualBlock = false; +}; + +Tabulator.prototype.registerModule("print", Print); \ No newline at end of file diff --git a/website/js/vendor/tabulator/js/modules/print.min.js b/website/js/vendor/tabulator/js/modules/print.min.js new file mode 100644 index 0000000..ef6d8b1 --- /dev/null +++ b/website/js/vendor/tabulator/js/modules/print.min.js @@ -0,0 +1,2 @@ +/* Tabulator v4.8.3 (c) Oliver Folkerd */ +var Print=function(t){this.table=t,this.element=!1,this.manualBlock=!1};Print.prototype.initialize=function(){window.addEventListener("beforeprint",this.replaceTable.bind(this)),window.addEventListener("afterprint",this.cleanup.bind(this))},Print.prototype.replaceTable=function(){this.manualBlock||(this.element=document.createElement("div"),this.element.classList.add("tabulator-print-table"),this.element.appendChild(this.table.modules.export.genereateTable(this.table.options.printConfig,this.table.options.printStyled,this.table.options.printRowRange,"print")),this.table.element.style.display="none",this.table.element.parentNode.insertBefore(this.element,this.table.element))},Print.prototype.cleanup=function(){document.body.classList.remove("tabulator-print-fullscreen-hide"),this.element&&this.element.parentNode&&(this.element.parentNode.removeChild(this.element),this.table.element.style.display="")},Print.prototype.printFullscreen=function(t,e,i){var n,l,o=window.scrollX,a=window.scrollY,s=document.createElement("div"),r=document.createElement("div"),p=this.table.modules.export.genereateTable(void 0!==i?i:this.table.options.printConfig,void 0!==e?e:this.table.options.printStyled,t,"print");this.manualBlock=!0,this.element=document.createElement("div"),this.element.classList.add("tabulator-print-fullscreen"),this.table.options.printHeader&&(s.classList.add("tabulator-print-header"),n="function"==typeof this.table.options.printHeader?this.table.options.printHeader.call(this.table):this.table.options.printHeader,"string"==typeof n?s.innerHTML=n:s.appendChild(n),this.element.appendChild(s)),this.element.appendChild(p),this.table.options.printFooter&&(r.classList.add("tabulator-print-footer"),l="function"==typeof this.table.options.printFooter?this.table.options.printFooter.call(this.table):this.table.options.printFooter,"string"==typeof l?r.innerHTML=l:r.appendChild(l),this.element.appendChild(r)),document.body.classList.add("tabulator-print-fullscreen-hide"),document.body.appendChild(this.element),this.table.options.printFormatter&&this.table.options.printFormatter(this.element,p),window.print(),this.cleanup(),window.scrollTo(o,a),this.manualBlock=!1},Tabulator.prototype.registerModule("print",Print); \ No newline at end of file diff --git a/website/js/vendor/tabulator/js/modules/reactive_data.js b/website/js/vendor/tabulator/js/modules/reactive_data.js new file mode 100644 index 0000000..def9edc --- /dev/null +++ b/website/js/vendor/tabulator/js/modules/reactive_data.js @@ -0,0 +1,323 @@ +/* Tabulator v4.8.3 (c) Oliver Folkerd */ + +var ReactiveData = function ReactiveData(table) { + this.table = table; //hold Tabulator object + this.data = false; + this.blocked = false; //block reactivity while performing update + this.origFuncs = {}; // hold original data array functions to allow replacement after data is done with + this.currentVersion = 0; +}; + +ReactiveData.prototype.watchData = function (data) { + var self = this, + pushFunc, + version; + + this.currentVersion++; + + version = this.currentVersion; + + self.unwatchData(); + + self.data = data; + + //override array push function + self.origFuncs.push = data.push; + + Object.defineProperty(self.data, "push", { + enumerable: false, + configurable: true, + value: function value() { + var args = Array.from(arguments); + + if (!self.blocked && version === self.currentVersion) { + args.forEach(function (arg) { + self.table.rowManager.addRowActual(arg, false); + }); + } + + return self.origFuncs.push.apply(data, arguments); + } + }); + + //override array unshift function + self.origFuncs.unshift = data.unshift; + + Object.defineProperty(self.data, "unshift", { + enumerable: false, + configurable: true, + value: function value() { + var args = Array.from(arguments); + + if (!self.blocked && version === self.currentVersion) { + args.forEach(function (arg) { + self.table.rowManager.addRowActual(arg, true); + }); + } + + return self.origFuncs.unshift.apply(data, arguments); + } + }); + + //override array shift function + self.origFuncs.shift = data.shift; + + Object.defineProperty(self.data, "shift", { + enumerable: false, + configurable: true, + value: function value() { + var row; + + if (!self.blocked && version === self.currentVersion) { + if (self.data.length) { + row = self.table.rowManager.getRowFromDataObject(self.data[0]); + + if (row) { + row.deleteActual(); + } + } + } + + return self.origFuncs.shift.call(data); + } + }); + + //override array pop function + self.origFuncs.pop = data.pop; + + Object.defineProperty(self.data, "pop", { + enumerable: false, + configurable: true, + value: function value() { + var row; + if (!self.blocked && version === self.currentVersion) { + if (self.data.length) { + row = self.table.rowManager.getRowFromDataObject(self.data[self.data.length - 1]); + + if (row) { + row.deleteActual(); + } + } + } + return self.origFuncs.pop.call(data); + } + }); + + //override array splice function + self.origFuncs.splice = data.splice; + + Object.defineProperty(self.data, "splice", { + enumerable: false, + configurable: true, + value: function value() { + var args = Array.from(arguments), + start = args[0] < 0 ? data.length + args[0] : args[0], + end = args[1], + newRows = args[2] ? args.slice(2) : false, + startRow; + + if (!self.blocked && version === self.currentVersion) { + + //add new rows + if (newRows) { + startRow = data[start] ? self.table.rowManager.getRowFromDataObject(data[start]) : false; + + if (startRow) { + newRows.forEach(function (rowData) { + self.table.rowManager.addRowActual(rowData, true, startRow, true); + }); + } else { + newRows = newRows.slice().reverse(); + + newRows.forEach(function (rowData) { + self.table.rowManager.addRowActual(rowData, true, false, true); + }); + } + } + + //delete removed rows + if (end !== 0) { + var oldRows = data.slice(start, typeof args[1] === "undefined" ? args[1] : start + end); + + oldRows.forEach(function (rowData, i) { + var row = self.table.rowManager.getRowFromDataObject(rowData); + + if (row) { + row.deleteActual(i !== oldRows.length - 1); + } + }); + } + + if (newRows || end !== 0) { + self.table.rowManager.reRenderInPosition(); + } + } + + return self.origFuncs.splice.apply(data, arguments); + } + }); +}; + +ReactiveData.prototype.unwatchData = function () { + if (this.data !== false) { + for (var key in this.origFuncs) { + Object.defineProperty(this.data, key, { + enumerable: true, + configurable: true, + writable: true, + value: this.origFuncs.key + }); + } + } +}; + +ReactiveData.prototype.watchRow = function (row) { + var data = row.getData(); + + this.blocked = true; + + for (var key in data) { + this.watchKey(row, data, key); + } + + if (this.table.options.dataTree) { + this.watchTreeChildren(row); + } + + this.blocked = false; +}; + +ReactiveData.prototype.watchTreeChildren = function (row) { + var self = this, + childField = row.getData()[this.table.options.dataTreeChildField], + origFuncs = {}; + + function rebuildTree() { + self.table.modules.dataTree.initializeRow(row); + self.table.modules.dataTree.layoutRow(row); + self.table.rowManager.refreshActiveData("tree", false, true); + } + + if (childField) { + + origFuncs.push = childField.push; + + Object.defineProperty(childField, "push", { + enumerable: false, + configurable: true, + value: function value() { + var result = origFuncs.push.apply(childField, arguments); + + rebuildTree(); + + return result; + } + }); + + origFuncs.unshift = childField.unshift; + + Object.defineProperty(childField, "unshift", { + enumerable: false, + configurable: true, + value: function value() { + var result = origFuncs.unshift.apply(childField, arguments); + + rebuildTree(); + + return result; + } + }); + + origFuncs.shift = childField.shift; + + Object.defineProperty(childField, "shift", { + enumerable: false, + configurable: true, + value: function value() { + var result = origFuncs.shift.call(childField); + + rebuildTree(); + + return result; + } + }); + + origFuncs.pop = childField.pop; + + Object.defineProperty(childField, "pop", { + enumerable: false, + configurable: true, + value: function value() { + var result = origFuncs.pop.call(childField); + + rebuildTree(); + + return result; + } + }); + + origFuncs.splice = childField.splice; + + Object.defineProperty(childField, "splice", { + enumerable: false, + configurable: true, + value: function value() { + var result = origFuncs.splice.apply(childField, arguments); + + rebuildTree(); + + return result; + } + }); + } +}; + +ReactiveData.prototype.watchKey = function (row, data, key) { + var self = this, + props = Object.getOwnPropertyDescriptor(data, key), + value = data[key], + version = this.currentVersion; + + Object.defineProperty(data, key, { + set: function set(newValue) { + value = newValue; + if (!self.blocked && version === self.currentVersion) { + var update = {}; + update[key] = newValue; + row.updateData(update); + } + + if (props.set) { + props.set(newValue); + } + }, + get: function get() { + + if (props.get) { + props.get(); + } + + return value; + } + }); +}; + +ReactiveData.prototype.unwatchRow = function (row) { + var data = row.getData(); + + for (var key in data) { + Object.defineProperty(data, key, { + value: data[key] + }); + } +}; + +ReactiveData.prototype.block = function () { + this.blocked = true; +}; + +ReactiveData.prototype.unblock = function () { + this.blocked = false; +}; + +Tabulator.prototype.registerModule("reactiveData", ReactiveData); \ No newline at end of file diff --git a/website/js/vendor/tabulator/js/modules/reactive_data.min.js b/website/js/vendor/tabulator/js/modules/reactive_data.min.js new file mode 100644 index 0000000..e97ddd5 --- /dev/null +++ b/website/js/vendor/tabulator/js/modules/reactive_data.min.js @@ -0,0 +1,2 @@ +/* Tabulator v4.8.3 (c) Oliver Folkerd */ +var ReactiveData=function(e){this.table=e,this.data=!1,this.blocked=!1,this.origFuncs={},this.currentVersion=0};ReactiveData.prototype.watchData=function(e){var t,a=this;this.currentVersion++,t=this.currentVersion,a.unwatchData(),a.data=e,a.origFuncs.push=e.push,Object.defineProperty(a.data,"push",{enumerable:!1,configurable:!0,value:function(){var r=Array.from(arguments);return a.blocked||t!==a.currentVersion||r.forEach(function(e){a.table.rowManager.addRowActual(e,!1)}),a.origFuncs.push.apply(e,arguments)}}),a.origFuncs.unshift=e.unshift,Object.defineProperty(a.data,"unshift",{enumerable:!1,configurable:!0,value:function(){var r=Array.from(arguments);return a.blocked||t!==a.currentVersion||r.forEach(function(e){a.table.rowManager.addRowActual(e,!0)}),a.origFuncs.unshift.apply(e,arguments)}}),a.origFuncs.shift=e.shift,Object.defineProperty(a.data,"shift",{enumerable:!1,configurable:!0,value:function(){var r;return a.blocked||t!==a.currentVersion||a.data.length&&(r=a.table.rowManager.getRowFromDataObject(a.data[0]))&&r.deleteActual(),a.origFuncs.shift.call(e)}}),a.origFuncs.pop=e.pop,Object.defineProperty(a.data,"pop",{enumerable:!1,configurable:!0,value:function(){var r;return a.blocked||t!==a.currentVersion||a.data.length&&(r=a.table.rowManager.getRowFromDataObject(a.data[a.data.length-1]))&&r.deleteActual(),a.origFuncs.pop.call(e)}}),a.origFuncs.splice=e.splice,Object.defineProperty(a.data,"splice",{enumerable:!1,configurable:!0,value:function(){var r,n=Array.from(arguments),o=n[0]<0?e.length+n[0]:n[0],i=n[1],c=!!n[2]&&n.slice(2);if(!a.blocked&&t===a.currentVersion){if(c&&(r=!!e[o]&&a.table.rowManager.getRowFromDataObject(e[o]),r?c.forEach(function(e){a.table.rowManager.addRowActual(e,!0,r,!0)}):(c=c.slice().reverse(),c.forEach(function(e){a.table.rowManager.addRowActual(e,!0,!1,!0)}))),0!==i){var u=e.slice(o,void 0===n[1]?n[1]:o+i);u.forEach(function(e,t){var r=a.table.rowManager.getRowFromDataObject(e);r&&r.deleteActual(t!==u.length-1)})}(c||0!==i)&&a.table.rowManager.reRenderInPosition()}return a.origFuncs.splice.apply(e,arguments)}})},ReactiveData.prototype.unwatchData=function(){if(!1!==this.data)for(var e in this.origFuncs)Object.defineProperty(this.data,e,{enumerable:!0,configurable:!0,writable:!0,value:this.origFuncs.key})},ReactiveData.prototype.watchRow=function(e){var t=e.getData();this.blocked=!0;for(var a in t)this.watchKey(e,t,a);this.table.options.dataTree&&this.watchTreeChildren(e),this.blocked=!1},ReactiveData.prototype.watchTreeChildren=function(e){function t(){a.table.modules.dataTree.initializeRow(e),a.table.modules.dataTree.layoutRow(e),a.table.rowManager.refreshActiveData("tree",!1,!0)}var a=this,r=e.getData()[this.table.options.dataTreeChildField],n={};r&&(n.push=r.push,Object.defineProperty(r,"push",{enumerable:!1,configurable:!0,value:function(){var e=n.push.apply(r,arguments);return t(),e}}),n.unshift=r.unshift,Object.defineProperty(r,"unshift",{enumerable:!1,configurable:!0,value:function(){var e=n.unshift.apply(r,arguments);return t(),e}}),n.shift=r.shift,Object.defineProperty(r,"shift",{enumerable:!1,configurable:!0,value:function(){var e=n.shift.call(r);return t(),e}}),n.pop=r.pop,Object.defineProperty(r,"pop",{enumerable:!1,configurable:!0,value:function(){var e=n.pop.call(r);return t(),e}}),n.splice=r.splice,Object.defineProperty(r,"splice",{enumerable:!1,configurable:!0,value:function(){var e=n.splice.apply(r,arguments);return t(),e}}))},ReactiveData.prototype.watchKey=function(e,t,a){var r=this,n=Object.getOwnPropertyDescriptor(t,a),o=t[a],i=this.currentVersion;Object.defineProperty(t,a,{set:function(t){if(o=t,!r.blocked&&i===r.currentVersion){var c={};c[a]=t,e.updateData(c)}n.set&&n.set(t)},get:function(){return n.get&&n.get(),o}})},ReactiveData.prototype.unwatchRow=function(e){var t=e.getData();for(var a in t)Object.defineProperty(t,a,{value:t[a]})},ReactiveData.prototype.block=function(){this.blocked=!0},ReactiveData.prototype.unblock=function(){this.blocked=!1},Tabulator.prototype.registerModule("reactiveData",ReactiveData); \ No newline at end of file diff --git a/website/js/vendor/tabulator/js/modules/resize_columns.js b/website/js/vendor/tabulator/js/modules/resize_columns.js new file mode 100644 index 0000000..bf2b04a --- /dev/null +++ b/website/js/vendor/tabulator/js/modules/resize_columns.js @@ -0,0 +1,171 @@ +/* Tabulator v4.8.3 (c) Oliver Folkerd */ + +var ResizeColumns = function ResizeColumns(table) { + this.table = table; //hold Tabulator object + this.startColumn = false; + this.startX = false; + this.startWidth = false; + this.handle = null; + this.prevHandle = null; +}; + +ResizeColumns.prototype.initializeColumn = function (type, column, element) { + var self = this, + variableHeight = false, + mode = this.table.options.resizableColumns; + + //set column resize mode + if (type === "header") { + variableHeight = column.definition.formatter == "textarea" || column.definition.variableHeight; + column.modules.resize = { variableHeight: variableHeight }; + } + + if (mode === true || mode == type) { + + var handle = document.createElement('div'); + handle.className = "tabulator-col-resize-handle"; + + var prevHandle = document.createElement('div'); + prevHandle.className = "tabulator-col-resize-handle prev"; + + handle.addEventListener("click", function (e) { + e.stopPropagation(); + }); + + var handleDown = function handleDown(e) { + var nearestColumn = column.getLastColumn(); + + if (nearestColumn && self._checkResizability(nearestColumn)) { + self.startColumn = column; + self._mouseDown(e, nearestColumn, handle); + } + }; + + handle.addEventListener("mousedown", handleDown); + handle.addEventListener("touchstart", handleDown, { passive: true }); + + //reszie column on double click + handle.addEventListener("dblclick", function (e) { + var col = column.getLastColumn(); + + if (col && self._checkResizability(col)) { + e.stopPropagation(); + col.reinitializeWidth(true); + } + }); + + prevHandle.addEventListener("click", function (e) { + e.stopPropagation(); + }); + + var prevHandleDown = function prevHandleDown(e) { + var nearestColumn, colIndex, prevColumn; + + nearestColumn = column.getFirstColumn(); + + if (nearestColumn) { + colIndex = self.table.columnManager.findColumnIndex(nearestColumn); + prevColumn = colIndex > 0 ? self.table.columnManager.getColumnByIndex(colIndex - 1) : false; + + if (prevColumn && self._checkResizability(prevColumn)) { + self.startColumn = column; + self._mouseDown(e, prevColumn, prevHandle); + } + } + }; + + prevHandle.addEventListener("mousedown", prevHandleDown); + prevHandle.addEventListener("touchstart", prevHandleDown, { passive: true }); + + //resize column on double click + prevHandle.addEventListener("dblclick", function (e) { + var nearestColumn, colIndex, prevColumn; + + nearestColumn = column.getFirstColumn(); + + if (nearestColumn) { + colIndex = self.table.columnManager.findColumnIndex(nearestColumn); + prevColumn = colIndex > 0 ? self.table.columnManager.getColumnByIndex(colIndex - 1) : false; + + if (prevColumn && self._checkResizability(prevColumn)) { + e.stopPropagation(); + prevColumn.reinitializeWidth(true); + } + } + }); + + element.appendChild(handle); + element.appendChild(prevHandle); + } +}; + +ResizeColumns.prototype._checkResizability = function (column) { + return typeof column.definition.resizable != "undefined" ? column.definition.resizable : this.table.options.resizableColumns; +}; + +ResizeColumns.prototype._mouseDown = function (e, column, handle) { + var self = this; + + self.table.element.classList.add("tabulator-block-select"); + + function mouseMove(e) { + // self.table.columnManager.tempScrollBlock(); + + if (self.table.rtl) { + column.setWidth(self.startWidth - ((typeof e.screenX === "undefined" ? e.touches[0].screenX : e.screenX) - self.startX)); + } else { + column.setWidth(self.startWidth + ((typeof e.screenX === "undefined" ? e.touches[0].screenX : e.screenX) - self.startX)); + } + + if (self.table.options.virtualDomHoz) { + self.table.vdomHoz.reinitialize(true); + } + + if (!self.table.browserSlow && column.modules.resize && column.modules.resize.variableHeight) { + column.checkCellHeights(); + } + } + + function mouseUp(e) { + + //block editor from taking action while resizing is taking place + if (self.startColumn.modules.edit) { + self.startColumn.modules.edit.blocked = false; + } + + if (self.table.browserSlow && column.modules.resize && column.modules.resize.variableHeight) { + column.checkCellHeights(); + } + + document.body.removeEventListener("mouseup", mouseUp); + document.body.removeEventListener("mousemove", mouseMove); + + handle.removeEventListener("touchmove", mouseMove); + handle.removeEventListener("touchend", mouseUp); + + self.table.element.classList.remove("tabulator-block-select"); + + if (self.table.options.persistence && self.table.modExists("persistence", true) && self.table.modules.persistence.config.columns) { + self.table.modules.persistence.save("columns"); + } + + self.table.options.columnResized.call(self.table, column.getComponent()); + } + + e.stopPropagation(); //prevent resize from interfereing with movable columns + + //block editor from taking action while resizing is taking place + if (self.startColumn.modules.edit) { + self.startColumn.modules.edit.blocked = true; + } + + self.startX = typeof e.screenX === "undefined" ? e.touches[0].screenX : e.screenX; + self.startWidth = column.getWidth(); + + document.body.addEventListener("mousemove", mouseMove); + document.body.addEventListener("mouseup", mouseUp); + handle.addEventListener("touchmove", mouseMove, { passive: true }); + handle.addEventListener("touchend", mouseUp); +}; + +Tabulator.prototype.registerModule("resizeColumns", ResizeColumns); \ No newline at end of file diff --git a/website/js/vendor/tabulator/js/modules/resize_columns.min.js b/website/js/vendor/tabulator/js/modules/resize_columns.min.js new file mode 100644 index 0000000..4987797 --- /dev/null +++ b/website/js/vendor/tabulator/js/modules/resize_columns.min.js @@ -0,0 +1,2 @@ +/* Tabulator v4.8.3 (c) Oliver Folkerd */ +var ResizeColumns=function(e){this.table=e,this.startColumn=!1,this.startX=!1,this.startWidth=!1,this.handle=null,this.prevHandle=null};ResizeColumns.prototype.initializeColumn=function(e,t,i){var o=this,n=!1,s=this.table.options.resizableColumns;if("header"===e&&(n="textarea"==t.definition.formatter||t.definition.variableHeight,t.modules.resize={variableHeight:n}),!0===s||s==e){var a=document.createElement("div");a.className="tabulator-col-resize-handle";var l=document.createElement("div");l.className="tabulator-col-resize-handle prev",a.addEventListener("click",function(e){e.stopPropagation()});var r=function(e){var i=t.getLastColumn();i&&o._checkResizability(i)&&(o.startColumn=t,o._mouseDown(e,i,a))};a.addEventListener("mousedown",r),a.addEventListener("touchstart",r,{passive:!0}),a.addEventListener("dblclick",function(e){var i=t.getLastColumn();i&&o._checkResizability(i)&&(e.stopPropagation(),i.reinitializeWidth(!0))}),l.addEventListener("click",function(e){e.stopPropagation()});var d=function(e){var i,n,s;(i=t.getFirstColumn())&&(n=o.table.columnManager.findColumnIndex(i),(s=n>0&&o.table.columnManager.getColumnByIndex(n-1))&&o._checkResizability(s)&&(o.startColumn=t,o._mouseDown(e,s,l)))};l.addEventListener("mousedown",d),l.addEventListener("touchstart",d,{passive:!0}),l.addEventListener("dblclick",function(e){var i,n,s;(i=t.getFirstColumn())&&(n=o.table.columnManager.findColumnIndex(i),(s=n>0&&o.table.columnManager.getColumnByIndex(n-1))&&o._checkResizability(s)&&(e.stopPropagation(),s.reinitializeWidth(!0)))}),i.appendChild(a),i.appendChild(l)}},ResizeColumns.prototype._checkResizability=function(e){return void 0!==e.definition.resizable?e.definition.resizable:this.table.options.resizableColumns},ResizeColumns.prototype._mouseDown=function(e,t,i){function o(e){s.table.rtl?t.setWidth(s.startWidth-((void 0===e.screenX?e.touches[0].screenX:e.screenX)-s.startX)):t.setWidth(s.startWidth+((void 0===e.screenX?e.touches[0].screenX:e.screenX)-s.startX)),s.table.options.virtualDomHoz&&s.table.vdomHoz.reinitialize(!0),!s.table.browserSlow&&t.modules.resize&&t.modules.resize.variableHeight&&t.checkCellHeights()}function n(e){s.startColumn.modules.edit&&(s.startColumn.modules.edit.blocked=!1),s.table.browserSlow&&t.modules.resize&&t.modules.resize.variableHeight&&t.checkCellHeights(),document.body.removeEventListener("mouseup",n),document.body.removeEventListener("mousemove",o),i.removeEventListener("touchmove",o),i.removeEventListener("touchend",n),s.table.element.classList.remove("tabulator-block-select"),s.table.options.persistence&&s.table.modExists("persistence",!0)&&s.table.modules.persistence.config.columns&&s.table.modules.persistence.save("columns"),s.table.options.columnResized.call(s.table,t.getComponent())}var s=this;s.table.element.classList.add("tabulator-block-select"),e.stopPropagation(),s.startColumn.modules.edit&&(s.startColumn.modules.edit.blocked=!0),s.startX=void 0===e.screenX?e.touches[0].screenX:e.screenX,s.startWidth=t.getWidth(),document.body.addEventListener("mousemove",o),document.body.addEventListener("mouseup",n),i.addEventListener("touchmove",o,{passive:!0}),i.addEventListener("touchend",n)},Tabulator.prototype.registerModule("resizeColumns",ResizeColumns); \ No newline at end of file diff --git a/website/js/vendor/tabulator/js/modules/resize_rows.js b/website/js/vendor/tabulator/js/modules/resize_rows.js new file mode 100644 index 0000000..d00b54a --- /dev/null +++ b/website/js/vendor/tabulator/js/modules/resize_rows.js @@ -0,0 +1,98 @@ +/* Tabulator v4.8.3 (c) Oliver Folkerd */ + +var ResizeRows = function ResizeRows(table) { + this.table = table; //hold Tabulator object + this.startColumn = false; + this.startY = false; + this.startHeight = false; + this.handle = null; + this.prevHandle = null; +}; + +ResizeRows.prototype.initializeRow = function (row) { + var self = this, + rowEl = row.getElement(); + + var handle = document.createElement('div'); + handle.className = "tabulator-row-resize-handle"; + + var prevHandle = document.createElement('div'); + prevHandle.className = "tabulator-row-resize-handle prev"; + + handle.addEventListener("click", function (e) { + e.stopPropagation(); + }); + + var handleDown = function handleDown(e) { + self.startRow = row; + self._mouseDown(e, row, handle); + }; + + handle.addEventListener("mousedown", handleDown); + handle.addEventListener("touchstart", handleDown, { passive: true }); + + prevHandle.addEventListener("click", function (e) { + e.stopPropagation(); + }); + + var prevHandleDown = function prevHandleDown(e) { + var prevRow = self.table.rowManager.prevDisplayRow(row); + + if (prevRow) { + self.startRow = prevRow; + self._mouseDown(e, prevRow, prevHandle); + } + }; + + prevHandle.addEventListener("mousedown", prevHandleDown); + prevHandle.addEventListener("touchstart", prevHandleDown, { passive: true }); + + rowEl.appendChild(handle); + rowEl.appendChild(prevHandle); +}; + +ResizeRows.prototype._mouseDown = function (e, row, handle) { + var self = this; + + self.table.element.classList.add("tabulator-block-select"); + + function mouseMove(e) { + row.setHeight(self.startHeight + ((typeof e.screenY === "undefined" ? e.touches[0].screenY : e.screenY) - self.startY)); + } + + function mouseUp(e) { + + // //block editor from taking action while resizing is taking place + // if(self.startColumn.modules.edit){ + // self.startColumn.modules.edit.blocked = false; + // } + + document.body.removeEventListener("mouseup", mouseMove); + document.body.removeEventListener("mousemove", mouseMove); + + handle.removeEventListener("touchmove", mouseMove); + handle.removeEventListener("touchend", mouseUp); + + self.table.element.classList.remove("tabulator-block-select"); + + self.table.options.rowResized.call(this.table, row.getComponent()); + } + + e.stopPropagation(); //prevent resize from interfereing with movable columns + + //block editor from taking action while resizing is taking place + // if(self.startColumn.modules.edit){ + // self.startColumn.modules.edit.blocked = true; + // } + + self.startY = typeof e.screenY === "undefined" ? e.touches[0].screenY : e.screenY; + self.startHeight = row.getHeight(); + + document.body.addEventListener("mousemove", mouseMove); + document.body.addEventListener("mouseup", mouseUp); + + handle.addEventListener("touchmove", mouseMove, { passive: true }); + handle.addEventListener("touchend", mouseUp); +}; + +Tabulator.prototype.registerModule("resizeRows", ResizeRows); \ No newline at end of file diff --git a/website/js/vendor/tabulator/js/modules/resize_rows.min.js b/website/js/vendor/tabulator/js/modules/resize_rows.min.js new file mode 100644 index 0000000..9167a11 --- /dev/null +++ b/website/js/vendor/tabulator/js/modules/resize_rows.min.js @@ -0,0 +1,2 @@ +/* Tabulator v4.8.3 (c) Oliver Folkerd */ +var ResizeRows=function(e){this.table=e,this.startColumn=!1,this.startY=!1,this.startHeight=!1,this.handle=null,this.prevHandle=null};ResizeRows.prototype.initializeRow=function(e){var t=this,o=e.getElement(),s=document.createElement("div");s.className="tabulator-row-resize-handle";var n=document.createElement("div");n.className="tabulator-row-resize-handle prev",s.addEventListener("click",function(e){e.stopPropagation()});var a=function(o){t.startRow=e,t._mouseDown(o,e,s)};s.addEventListener("mousedown",a),s.addEventListener("touchstart",a,{passive:!0}),n.addEventListener("click",function(e){e.stopPropagation()});var r=function(o){var s=t.table.rowManager.prevDisplayRow(e);s&&(t.startRow=s,t._mouseDown(o,s,n))};n.addEventListener("mousedown",r),n.addEventListener("touchstart",r,{passive:!0}),o.appendChild(s),o.appendChild(n)},ResizeRows.prototype._mouseDown=function(e,t,o){function s(e){t.setHeight(a.startHeight+((void 0===e.screenY?e.touches[0].screenY:e.screenY)-a.startY))}function n(e){document.body.removeEventListener("mouseup",s),document.body.removeEventListener("mousemove",s),o.removeEventListener("touchmove",s),o.removeEventListener("touchend",n),a.table.element.classList.remove("tabulator-block-select"),a.table.options.rowResized.call(this.table,t.getComponent())}var a=this;a.table.element.classList.add("tabulator-block-select"),e.stopPropagation(),a.startY=void 0===e.screenY?e.touches[0].screenY:e.screenY,a.startHeight=t.getHeight(),document.body.addEventListener("mousemove",s),document.body.addEventListener("mouseup",n),o.addEventListener("touchmove",s,{passive:!0}),o.addEventListener("touchend",n)},Tabulator.prototype.registerModule("resizeRows",ResizeRows); \ No newline at end of file diff --git a/website/js/vendor/tabulator/js/modules/resize_table.js b/website/js/vendor/tabulator/js/modules/resize_table.js new file mode 100644 index 0000000..9f796ca --- /dev/null +++ b/website/js/vendor/tabulator/js/modules/resize_table.js @@ -0,0 +1,117 @@ +/* Tabulator v4.8.3 (c) Oliver Folkerd */ + +var ResizeTable = function ResizeTable(table) { + this.table = table; //hold Tabulator object + this.binding = false; + this.observer = false; + this.containerObserver = false; + + this.tableHeight = 0; + this.tableWidth = 0; + this.containerHeight = 0; + this.containerWidth = 0; + + this.autoResize = false; +}; + +ResizeTable.prototype.initialize = function (row) { + var _this = this; + + var table = this.table, + tableStyle; + + this.tableHeight = table.element.clientHeight; + this.tableWidth = table.element.clientWidth; + + if (table.element.parentNode) { + this.containerHeight = table.element.parentNode.clientHeight; + this.containerWidth = table.element.parentNode.clientWidth; + } + + if (typeof ResizeObserver !== "undefined" && table.rowManager.getRenderMode() === "virtual") { + + this.autoResize = true; + + this.observer = new ResizeObserver(function (entry) { + if (!table.browserMobile || table.browserMobile && !table.modules.edit.currentCell) { + + var nodeHeight = Math.floor(entry[0].contentRect.height); + var nodeWidth = Math.floor(entry[0].contentRect.width); + + if (_this.tableHeight != nodeHeight || _this.tableWidth != nodeWidth) { + _this.tableHeight = nodeHeight; + _this.tableWidth = nodeWidth; + + if (table.element.parentNode) { + _this.containerHeight = table.element.parentNode.clientHeight; + _this.containerWidth = table.element.parentNode.clientWidth; + } + + if (table.options.virtualDomHoz) { + table.vdomHoz.reinitialize(true); + } + + table.redraw(); + } + } + }); + + this.observer.observe(table.element); + + tableStyle = window.getComputedStyle(table.element); + + if (this.table.element.parentNode && !this.table.rowManager.fixedHeight && (tableStyle.getPropertyValue("max-height") || tableStyle.getPropertyValue("min-height"))) { + + this.containerObserver = new ResizeObserver(function (entry) { + if (!table.browserMobile || table.browserMobile && !table.modules.edit.currentCell) { + + var nodeHeight = Math.floor(entry[0].contentRect.height); + var nodeWidth = Math.floor(entry[0].contentRect.width); + + if (_this.containerHeight != nodeHeight || _this.containerWidth != nodeWidth) { + _this.containerHeight = nodeHeight; + _this.containerWidth = nodeWidth; + _this.tableHeight = table.element.clientHeight; + _this.tableWidth = table.element.clientWidth; + } + + if (table.options.virtualDomHoz) { + table.vdomHoz.reinitialize(true); + } + + table.redraw(); + } + }); + + this.containerObserver.observe(this.table.element.parentNode); + } + } else { + this.binding = function () { + if (!table.browserMobile || table.browserMobile && !table.modules.edit.currentCell) { + if (table.options.virtualDomHoz) { + table.vdomHoz.reinitialize(true); + } + + table.redraw(); + } + }; + + window.addEventListener("resize", this.binding); + } +}; + +ResizeTable.prototype.clearBindings = function (row) { + if (this.binding) { + window.removeEventListener("resize", this.binding); + } + + if (this.observer) { + this.observer.unobserve(this.table.element); + } + + if (this.containerObserver) { + this.containerObserver.unobserve(this.table.element.parentNode); + } +}; + +Tabulator.prototype.registerModule("resizeTable", ResizeTable); \ No newline at end of file diff --git a/website/js/vendor/tabulator/js/modules/resize_table.min.js b/website/js/vendor/tabulator/js/modules/resize_table.min.js new file mode 100644 index 0000000..3adeed9 --- /dev/null +++ b/website/js/vendor/tabulator/js/modules/resize_table.min.js @@ -0,0 +1,2 @@ +/* Tabulator v4.8.3 (c) Oliver Folkerd */ +var ResizeTable=function(e){this.table=e,this.binding=!1,this.observer=!1,this.containerObserver=!1,this.tableHeight=0,this.tableWidth=0,this.containerHeight=0,this.containerWidth=0,this.autoResize=!1};ResizeTable.prototype.initialize=function(e){var t,i=this,n=this.table;this.tableHeight=n.element.clientHeight,this.tableWidth=n.element.clientWidth,n.element.parentNode&&(this.containerHeight=n.element.parentNode.clientHeight,this.containerWidth=n.element.parentNode.clientWidth),"undefined"!=typeof ResizeObserver&&"virtual"===n.rowManager.getRenderMode()?(this.autoResize=!0,this.observer=new ResizeObserver(function(e){if(!n.browserMobile||n.browserMobile&&!n.modules.edit.currentCell){var t=Math.floor(e[0].contentRect.height),r=Math.floor(e[0].contentRect.width);i.tableHeight==t&&i.tableWidth==r||(i.tableHeight=t,i.tableWidth=r,n.element.parentNode&&(i.containerHeight=n.element.parentNode.clientHeight,i.containerWidth=n.element.parentNode.clientWidth),n.options.virtualDomHoz&&n.vdomHoz.reinitialize(!0),n.redraw())}}),this.observer.observe(n.element),t=window.getComputedStyle(n.element),this.table.element.parentNode&&!this.table.rowManager.fixedHeight&&(t.getPropertyValue("max-height")||t.getPropertyValue("min-height"))&&(this.containerObserver=new ResizeObserver(function(e){if(!n.browserMobile||n.browserMobile&&!n.modules.edit.currentCell){var t=Math.floor(e[0].contentRect.height),r=Math.floor(e[0].contentRect.width);i.containerHeight==t&&i.containerWidth==r||(i.containerHeight=t,i.containerWidth=r,i.tableHeight=n.element.clientHeight,i.tableWidth=n.element.clientWidth),n.options.virtualDomHoz&&n.vdomHoz.reinitialize(!0),n.redraw()}}),this.containerObserver.observe(this.table.element.parentNode))):(this.binding=function(){(!n.browserMobile||n.browserMobile&&!n.modules.edit.currentCell)&&(n.options.virtualDomHoz&&n.vdomHoz.reinitialize(!0),n.redraw())},window.addEventListener("resize",this.binding))},ResizeTable.prototype.clearBindings=function(e){this.binding&&window.removeEventListener("resize",this.binding),this.observer&&this.observer.unobserve(this.table.element),this.containerObserver&&this.containerObserver.unobserve(this.table.element.parentNode)},Tabulator.prototype.registerModule("resizeTable",ResizeTable); \ No newline at end of file diff --git a/website/js/vendor/tabulator/js/modules/responsive_layout.js b/website/js/vendor/tabulator/js/modules/responsive_layout.js new file mode 100644 index 0000000..67fa6a3 --- /dev/null +++ b/website/js/vendor/tabulator/js/modules/responsive_layout.js @@ -0,0 +1,301 @@ +/* Tabulator v4.8.3 (c) Oliver Folkerd */ + +var ResponsiveLayout = function ResponsiveLayout(table) { + this.table = table; //hold Tabulator object + this.columns = []; + this.hiddenColumns = []; + this.mode = ""; + this.index = 0; + this.collapseFormatter = []; + this.collapseStartOpen = true; + this.collapseHandleColumn = false; +}; + +//generate resposive columns list +ResponsiveLayout.prototype.initialize = function () { + var self = this, + columns = []; + + this.mode = this.table.options.responsiveLayout; + this.collapseFormatter = this.table.options.responsiveLayoutCollapseFormatter || this.formatCollapsedData; + this.collapseStartOpen = this.table.options.responsiveLayoutCollapseStartOpen; + this.hiddenColumns = []; + + //detemine level of responsivity for each column + this.table.columnManager.columnsByIndex.forEach(function (column, i) { + if (column.modules.responsive) { + if (column.modules.responsive.order && column.modules.responsive.visible) { + column.modules.responsive.index = i; + columns.push(column); + + if (!column.visible && self.mode === "collapse") { + self.hiddenColumns.push(column); + } + } + } + }); + + //sort list by responsivity + columns = columns.reverse(); + columns = columns.sort(function (a, b) { + var diff = b.modules.responsive.order - a.modules.responsive.order; + return diff || b.modules.responsive.index - a.modules.responsive.index; + }); + + this.columns = columns; + + if (this.mode === "collapse") { + this.generateCollapsedContent(); + } + + //assign collapse column + for (var _iterator = this.table.columnManager.columnsByIndex, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) { + var _ref; + + if (_isArray) { + if (_i >= _iterator.length) break; + _ref = _iterator[_i++]; + } else { + _i = _iterator.next(); + if (_i.done) break; + _ref = _i.value; + } + + var col = _ref; + + if (col.definition.formatter == "responsiveCollapse") { + this.collapseHandleColumn = col; + break; + } + } + + if (this.collapseHandleColumn) { + if (this.hiddenColumns.length) { + this.collapseHandleColumn.show(); + } else { + this.collapseHandleColumn.hide(); + } + } +}; + +//define layout information +ResponsiveLayout.prototype.initializeColumn = function (column) { + var def = column.getDefinition(); + + column.modules.responsive = { order: typeof def.responsive === "undefined" ? 1 : def.responsive, visible: def.visible === false ? false : true }; +}; + +ResponsiveLayout.prototype.initializeRow = function (row) { + var el; + + if (row.type !== "calc") { + el = document.createElement("div"); + el.classList.add("tabulator-responsive-collapse"); + + row.modules.responsiveLayout = { + element: el, + open: this.collapseStartOpen + }; + + if (!this.collapseStartOpen) { + el.style.display = 'none'; + } + } +}; + +ResponsiveLayout.prototype.layoutRow = function (row) { + var rowEl = row.getElement(); + + if (row.modules.responsiveLayout) { + rowEl.appendChild(row.modules.responsiveLayout.element); + this.generateCollapsedRowContent(row); + } +}; + +//update column visibility +ResponsiveLayout.prototype.updateColumnVisibility = function (column, visible) { + var index; + if (column.modules.responsive) { + column.modules.responsive.visible = visible; + this.initialize(); + } +}; + +ResponsiveLayout.prototype.hideColumn = function (column) { + var colCount = this.hiddenColumns.length; + + column.hide(false, true); + + if (this.mode === "collapse") { + this.hiddenColumns.unshift(column); + this.generateCollapsedContent(); + + if (this.collapseHandleColumn && !colCount) { + this.collapseHandleColumn.show(); + } + } +}; + +ResponsiveLayout.prototype.showColumn = function (column) { + var index; + + column.show(false, true); + //set column width to prevent calculation loops on uninitialized columns + column.setWidth(column.getWidth()); + + if (this.mode === "collapse") { + index = this.hiddenColumns.indexOf(column); + + if (index > -1) { + this.hiddenColumns.splice(index, 1); + } + + this.generateCollapsedContent(); + + if (this.collapseHandleColumn && !this.hiddenColumns.length) { + this.collapseHandleColumn.hide(); + } + } +}; + +//redraw columns to fit space +ResponsiveLayout.prototype.update = function () { + var self = this, + working = true; + + while (working) { + + var width = self.table.modules.layout.getMode() == "fitColumns" ? self.table.columnManager.getFlexBaseWidth() : self.table.columnManager.getWidth(); + + var diff = (self.table.options.headerVisible ? self.table.columnManager.element.clientWidth : self.table.element.clientWidth) - width; + + if (diff < 0) { + //table is too wide + var column = self.columns[self.index]; + + if (column) { + self.hideColumn(column); + self.index++; + } else { + working = false; + } + } else { + + //table has spare space + var _column = self.columns[self.index - 1]; + + if (_column) { + if (diff > 0) { + if (diff >= _column.getWidth()) { + self.showColumn(_column); + self.index--; + } else { + working = false; + } + } else { + working = false; + } + } else { + working = false; + } + } + + if (!self.table.rowManager.activeRowsCount) { + self.table.rowManager.renderEmptyScroll(); + } + } +}; + +ResponsiveLayout.prototype.generateCollapsedContent = function () { + var self = this, + rows = this.table.rowManager.getDisplayRows(); + + rows.forEach(function (row) { + self.generateCollapsedRowContent(row); + }); +}; + +ResponsiveLayout.prototype.generateCollapsedRowContent = function (row) { + var el, contents; + + if (row.modules.responsiveLayout) { + el = row.modules.responsiveLayout.element; + + while (el.firstChild) { + el.removeChild(el.firstChild); + }contents = this.collapseFormatter(this.generateCollapsedRowData(row)); + if (contents) { + el.appendChild(contents); + } + } +}; + +ResponsiveLayout.prototype.generateCollapsedRowData = function (row) { + var self = this, + data = row.getData(), + output = [], + mockCellComponent; + + this.hiddenColumns.forEach(function (column) { + var value = column.getFieldValue(data); + + if (column.definition.title && column.field) { + if (column.modules.format && self.table.options.responsiveLayoutCollapseUseFormatters) { + + mockCellComponent = { + value: false, + data: {}, + getValue: function getValue() { + return value; + }, + getData: function getData() { + return data; + }, + getElement: function getElement() { + return document.createElement("div"); + }, + getRow: function getRow() { + return row.getComponent(); + }, + getColumn: function getColumn() { + return column.getComponent(); + } + }; + + output.push({ + title: column.definition.title, + value: column.modules.format.formatter.call(self.table.modules.format, mockCellComponent, column.modules.format.params) + }); + } else { + output.push({ + title: column.definition.title, + value: value + }); + } + } + }); + + return output; +}; + +ResponsiveLayout.prototype.formatCollapsedData = function (data) { + var list = document.createElement("table"), + listContents = ""; + + data.forEach(function (item) { + var div = document.createElement("div"); + + if (item.value instanceof Node) { + div.appendChild(item.value); + item.value = div.innerHTML; + } + + listContents += "" + item.title + "" + item.value + ""; + }); + + list.innerHTML = listContents; + + return Object.keys(data).length ? list : ""; +}; + +Tabulator.prototype.registerModule("responsiveLayout", ResponsiveLayout); \ No newline at end of file diff --git a/website/js/vendor/tabulator/js/modules/responsive_layout.min.js b/website/js/vendor/tabulator/js/modules/responsive_layout.min.js new file mode 100644 index 0000000..661f21a --- /dev/null +++ b/website/js/vendor/tabulator/js/modules/responsive_layout.min.js @@ -0,0 +1,2 @@ +/* Tabulator v4.8.3 (c) Oliver Folkerd */ +var ResponsiveLayout=function(e){this.table=e,this.columns=[],this.hiddenColumns=[],this.mode="",this.index=0,this.collapseFormatter=[],this.collapseStartOpen=!0,this.collapseHandleColumn=!1};ResponsiveLayout.prototype.initialize=function(){var e=this,t=[];this.mode=this.table.options.responsiveLayout,this.collapseFormatter=this.table.options.responsiveLayoutCollapseFormatter||this.formatCollapsedData,this.collapseStartOpen=this.table.options.responsiveLayoutCollapseStartOpen,this.hiddenColumns=[],this.table.columnManager.columnsByIndex.forEach(function(o,n){o.modules.responsive&&o.modules.responsive.order&&o.modules.responsive.visible&&(o.modules.responsive.index=n,t.push(o),o.visible||"collapse"!==e.mode||e.hiddenColumns.push(o))}),t=t.reverse(),t=t.sort(function(e,t){return t.modules.responsive.order-e.modules.responsive.order||t.modules.responsive.index-e.modules.responsive.index}),this.columns=t,"collapse"===this.mode&&this.generateCollapsedContent();for(var o=this.table.columnManager.columnsByIndex,n=Array.isArray(o),s=0,o=n?o:o[Symbol.iterator]();;){var i;if(n){if(s>=o.length)break;i=o[s++]}else{if(s=o.next(),s.done)break;i=s.value}var l=i;if("responsiveCollapse"==l.definition.formatter){this.collapseHandleColumn=l;break}}this.collapseHandleColumn&&(this.hiddenColumns.length?this.collapseHandleColumn.show():this.collapseHandleColumn.hide())},ResponsiveLayout.prototype.initializeColumn=function(e){var t=e.getDefinition();e.modules.responsive={order:void 0===t.responsive?1:t.responsive,visible:!1!==t.visible}},ResponsiveLayout.prototype.initializeRow=function(e){var t;"calc"!==e.type&&(t=document.createElement("div"),t.classList.add("tabulator-responsive-collapse"),e.modules.responsiveLayout={element:t,open:this.collapseStartOpen},this.collapseStartOpen||(t.style.display="none"))},ResponsiveLayout.prototype.layoutRow=function(e){var t=e.getElement();e.modules.responsiveLayout&&(t.appendChild(e.modules.responsiveLayout.element),this.generateCollapsedRowContent(e))},ResponsiveLayout.prototype.updateColumnVisibility=function(e,t){e.modules.responsive&&(e.modules.responsive.visible=t,this.initialize())},ResponsiveLayout.prototype.hideColumn=function(e){var t=this.hiddenColumns.length;e.hide(!1,!0),"collapse"===this.mode&&(this.hiddenColumns.unshift(e),this.generateCollapsedContent(),this.collapseHandleColumn&&!t&&this.collapseHandleColumn.show())},ResponsiveLayout.prototype.showColumn=function(e){var t;e.show(!1,!0),e.setWidth(e.getWidth()),"collapse"===this.mode&&(t=this.hiddenColumns.indexOf(e),t>-1&&this.hiddenColumns.splice(t,1),this.generateCollapsedContent(),this.collapseHandleColumn&&!this.hiddenColumns.length&&this.collapseHandleColumn.hide())},ResponsiveLayout.prototype.update=function(){for(var e=this,t=!0;t;){var o="fitColumns"==e.table.modules.layout.getMode()?e.table.columnManager.getFlexBaseWidth():e.table.columnManager.getWidth(),n=(e.table.options.headerVisible?e.table.columnManager.element.clientWidth:e.table.element.clientWidth)-o;if(n<0){var s=e.columns[e.index];s?(e.hideColumn(s),e.index++):t=!1}else{var i=e.columns[e.index-1];i&&n>0&&n>=i.getWidth()?(e.showColumn(i),e.index--):t=!1}e.table.rowManager.activeRowsCount||e.table.rowManager.renderEmptyScroll()}},ResponsiveLayout.prototype.generateCollapsedContent=function(){var e=this;this.table.rowManager.getDisplayRows().forEach(function(t){e.generateCollapsedRowContent(t)})},ResponsiveLayout.prototype.generateCollapsedRowContent=function(e){var t,o;if(e.modules.responsiveLayout){for(t=e.modules.responsiveLayout.element;t.firstChild;)t.removeChild(t.firstChild);o=this.collapseFormatter(this.generateCollapsedRowData(e)),o&&t.appendChild(o)}},ResponsiveLayout.prototype.generateCollapsedRowData=function(e){var t,o=this,n=e.getData(),s=[];return this.hiddenColumns.forEach(function(i){var l=i.getFieldValue(n);i.definition.title&&i.field&&(i.modules.format&&o.table.options.responsiveLayoutCollapseUseFormatters?(t={value:!1,data:{},getValue:function(){return l},getData:function(){return n},getElement:function(){return document.createElement("div")},getRow:function(){return e.getComponent()},getColumn:function(){return i.getComponent()}},s.push({title:i.definition.title,value:i.modules.format.formatter.call(o.table.modules.format,t,i.modules.format.params)})):s.push({title:i.definition.title,value:l}))}),s},ResponsiveLayout.prototype.formatCollapsedData=function(e){var t=document.createElement("table"),o="";return e.forEach(function(e){var t=document.createElement("div");e.value instanceof Node&&(t.appendChild(e.value),e.value=t.innerHTML),o+=""+e.title+""+e.value+""}),t.innerHTML=o,Object.keys(e).length?t:""},Tabulator.prototype.registerModule("responsiveLayout",ResponsiveLayout); \ No newline at end of file diff --git a/website/js/vendor/tabulator/js/modules/select_row.js b/website/js/vendor/tabulator/js/modules/select_row.js new file mode 100644 index 0000000..8ddf0b8 --- /dev/null +++ b/website/js/vendor/tabulator/js/modules/select_row.js @@ -0,0 +1,417 @@ +var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; + +/* Tabulator v4.8.3 (c) Oliver Folkerd */ + +var SelectRow = function SelectRow(table) { + this.table = table; //hold Tabulator object + this.selecting = false; //flag selecting in progress + this.lastClickedRow = false; //last clicked row + this.selectPrev = []; //hold previously selected element for drag drop selection + this.selectedRows = []; //hold selected rows + this.headerCheckboxElement = null; // hold header select element +}; + +SelectRow.prototype.clearSelectionData = function (silent) { + this.selecting = false; + this.lastClickedRow = false; + this.selectPrev = []; + this.selectedRows = []; + + if (!silent) { + this._rowSelectionChanged(); + } +}; + +SelectRow.prototype.initializeRow = function (row) { + var self = this, + element = row.getElement(); + + // trigger end of row selection + var endSelect = function endSelect() { + + setTimeout(function () { + self.selecting = false; + }, 50); + + document.body.removeEventListener("mouseup", endSelect); + }; + + row.modules.select = { selected: false }; + + //set row selection class + if (self.table.options.selectableCheck.call(this.table, row.getComponent())) { + element.classList.add("tabulator-selectable"); + element.classList.remove("tabulator-unselectable"); + + if (self.table.options.selectable && self.table.options.selectable != "highlight") { + if (self.table.options.selectableRangeMode === "click") { + element.addEventListener("click", function (e) { + if (e.shiftKey) { + self.table._clearSelection(); + self.lastClickedRow = self.lastClickedRow || row; + + var lastClickedRowIdx = self.table.rowManager.getDisplayRowIndex(self.lastClickedRow); + var rowIdx = self.table.rowManager.getDisplayRowIndex(row); + + var fromRowIdx = lastClickedRowIdx <= rowIdx ? lastClickedRowIdx : rowIdx; + var toRowIdx = lastClickedRowIdx >= rowIdx ? lastClickedRowIdx : rowIdx; + + var rows = self.table.rowManager.getDisplayRows().slice(0); + var toggledRows = rows.splice(fromRowIdx, toRowIdx - fromRowIdx + 1); + + if (e.ctrlKey || e.metaKey) { + toggledRows.forEach(function (toggledRow) { + if (toggledRow !== self.lastClickedRow) { + + if (self.table.options.selectable !== true && !self.isRowSelected(row)) { + if (self.selectedRows.length < self.table.options.selectable) { + self.toggleRow(toggledRow); + } + } else { + self.toggleRow(toggledRow); + } + } + }); + self.lastClickedRow = row; + } else { + self.deselectRows(undefined, true); + + if (self.table.options.selectable !== true) { + if (toggledRows.length > self.table.options.selectable) { + toggledRows = toggledRows.slice(0, self.table.options.selectable); + } + } + + self.selectRows(toggledRows); + } + self.table._clearSelection(); + } else if (e.ctrlKey || e.metaKey) { + self.toggleRow(row); + self.lastClickedRow = row; + } else { + self.deselectRows(undefined, true); + self.selectRows(row); + self.lastClickedRow = row; + } + }); + } else { + element.addEventListener("click", function (e) { + if (!self.table.modExists("edit") || !self.table.modules.edit.getCurrentCell()) { + self.table._clearSelection(); + } + + if (!self.selecting) { + self.toggleRow(row); + } + }); + + element.addEventListener("mousedown", function (e) { + if (e.shiftKey) { + self.table._clearSelection(); + + self.selecting = true; + + self.selectPrev = []; + + document.body.addEventListener("mouseup", endSelect); + document.body.addEventListener("keyup", endSelect); + + self.toggleRow(row); + + return false; + } + }); + + element.addEventListener("mouseenter", function (e) { + if (self.selecting) { + self.table._clearSelection(); + self.toggleRow(row); + + if (self.selectPrev[1] == row) { + self.toggleRow(self.selectPrev[0]); + } + } + }); + + element.addEventListener("mouseout", function (e) { + if (self.selecting) { + self.table._clearSelection(); + self.selectPrev.unshift(row); + } + }); + } + } + } else { + element.classList.add("tabulator-unselectable"); + element.classList.remove("tabulator-selectable"); + } +}; + +//toggle row selection +SelectRow.prototype.toggleRow = function (row) { + if (this.table.options.selectableCheck.call(this.table, row.getComponent())) { + if (row.modules.select && row.modules.select.selected) { + this._deselectRow(row); + } else { + this._selectRow(row); + } + } +}; + +//select a number of rows +SelectRow.prototype.selectRows = function (rows) { + var _this = this; + + var rowMatch; + + switch (typeof rows === "undefined" ? "undefined" : _typeof(rows)) { + case "undefined": + this.table.rowManager.rows.forEach(function (row) { + _this._selectRow(row, true, true); + }); + + this._rowSelectionChanged(); + break; + + case "string": + + rowMatch = this.table.rowManager.findRow(rows); + + if (rowMatch) { + this._selectRow(rowMatch, true, true); + } else { + this.table.rowManager.getRows(rows).forEach(function (row) { + _this._selectRow(row, true, true); + }); + } + + this._rowSelectionChanged(); + break; + + default: + if (Array.isArray(rows)) { + rows.forEach(function (row) { + _this._selectRow(row, true, true); + }); + + this._rowSelectionChanged(); + } else { + this._selectRow(rows, false, true); + } + break; + } +}; + +//select an individual row +SelectRow.prototype._selectRow = function (rowInfo, silent, force) { + var index; + + //handle max row count + if (!isNaN(this.table.options.selectable) && this.table.options.selectable !== true && !force) { + if (this.selectedRows.length >= this.table.options.selectable) { + if (this.table.options.selectableRollingSelection) { + this._deselectRow(this.selectedRows[0]); + } else { + return false; + } + } + } + + var row = this.table.rowManager.findRow(rowInfo); + + if (row) { + if (this.selectedRows.indexOf(row) == -1) { + if (!row.modules.select) { + row.modules.select = {}; + } + + row.modules.select.selected = true; + if (row.modules.select.checkboxEl) { + row.modules.select.checkboxEl.checked = true; + } + row.getElement().classList.add("tabulator-selected"); + + this.selectedRows.push(row); + + if (this.table.options.dataTreeSelectPropagate) { + this.childRowSelection(row, true); + } + + if (!silent) { + this.table.options.rowSelected.call(this.table, row.getComponent()); + } + + this._rowSelectionChanged(silent); + } + } else { + if (!silent) { + console.warn("Selection Error - No such row found, ignoring selection:" + rowInfo); + } + } +}; + +SelectRow.prototype.isRowSelected = function (row) { + return this.selectedRows.indexOf(row) !== -1; +}; + +//deselect a number of rows +SelectRow.prototype.deselectRows = function (rows, silent) { + var self = this, + rowCount; + + if (typeof rows == "undefined") { + + rowCount = self.selectedRows.length; + + for (var i = 0; i < rowCount; i++) { + self._deselectRow(self.selectedRows[0], true); + } + + self._rowSelectionChanged(silent); + } else { + if (Array.isArray(rows)) { + rows.forEach(function (row) { + self._deselectRow(row, true); + }); + + self._rowSelectionChanged(silent); + } else { + self._deselectRow(rows, silent); + } + } +}; + +//deselect an individual row +SelectRow.prototype._deselectRow = function (rowInfo, silent) { + var self = this, + row = self.table.rowManager.findRow(rowInfo), + index; + + if (row) { + index = self.selectedRows.findIndex(function (selectedRow) { + return selectedRow == row; + }); + + if (index > -1) { + + if (!row.modules.select) { + row.modules.select = {}; + } + + row.modules.select.selected = false; + if (row.modules.select.checkboxEl) { + row.modules.select.checkboxEl.checked = false; + } + row.getElement().classList.remove("tabulator-selected"); + self.selectedRows.splice(index, 1); + + if (this.table.options.dataTreeSelectPropagate) { + this.childRowSelection(row, false); + } + + if (!silent) { + self.table.options.rowDeselected.call(this.table, row.getComponent()); + } + + self._rowSelectionChanged(silent); + } + } else { + if (!silent) { + console.warn("Deselection Error - No such row found, ignoring selection:" + rowInfo); + } + } +}; + +SelectRow.prototype.getSelectedData = function () { + var data = []; + + this.selectedRows.forEach(function (row) { + data.push(row.getData()); + }); + + return data; +}; + +SelectRow.prototype.getSelectedRows = function () { + + var rows = []; + + this.selectedRows.forEach(function (row) { + rows.push(row.getComponent()); + }); + + return rows; +}; + +SelectRow.prototype._rowSelectionChanged = function (silent) { + if (this.headerCheckboxElement) { + if (this.selectedRows.length === 0) { + this.headerCheckboxElement.checked = false; + this.headerCheckboxElement.indeterminate = false; + } else if (this.table.rowManager.rows.length === this.selectedRows.length) { + this.headerCheckboxElement.checked = true; + this.headerCheckboxElement.indeterminate = false; + } else { + this.headerCheckboxElement.indeterminate = true; + this.headerCheckboxElement.checked = false; + } + } + + if (!silent) { + this.table.options.rowSelectionChanged.call(this.table, this.getSelectedData(), this.getSelectedRows()); + } +}; + +SelectRow.prototype.registerRowSelectCheckbox = function (row, element) { + if (!row._row.modules.select) { + row._row.modules.select = {}; + } + + row._row.modules.select.checkboxEl = element; +}; + +SelectRow.prototype.registerHeaderSelectCheckbox = function (element) { + this.headerCheckboxElement = element; +}; + +SelectRow.prototype.childRowSelection = function (row, select) { + var children = this.table.modules.dataTree.getChildren(row); + + if (select) { + for (var _iterator = children, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) { + var _ref; + + if (_isArray) { + if (_i >= _iterator.length) break; + _ref = _iterator[_i++]; + } else { + _i = _iterator.next(); + if (_i.done) break; + _ref = _i.value; + } + + var child = _ref; + + this._selectRow(child, true); + } + } else { + for (var _iterator2 = children, _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : _iterator2[Symbol.iterator]();;) { + var _ref2; + + if (_isArray2) { + if (_i2 >= _iterator2.length) break; + _ref2 = _iterator2[_i2++]; + } else { + _i2 = _iterator2.next(); + if (_i2.done) break; + _ref2 = _i2.value; + } + + var _child = _ref2; + + this._deselectRow(_child, true); + } + } +}; + +Tabulator.prototype.registerModule("selectRow", SelectRow); \ No newline at end of file diff --git a/website/js/vendor/tabulator/js/modules/select_row.min.js b/website/js/vendor/tabulator/js/modules/select_row.min.js new file mode 100644 index 0000000..9964b56 --- /dev/null +++ b/website/js/vendor/tabulator/js/modules/select_row.min.js @@ -0,0 +1,2 @@ +/* Tabulator v4.8.3 (c) Oliver Folkerd */ +var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},SelectRow=function(e){this.table=e,this.selecting=!1,this.lastClickedRow=!1,this.selectPrev=[],this.selectedRows=[],this.headerCheckboxElement=null};SelectRow.prototype.clearSelectionData=function(e){this.selecting=!1,this.lastClickedRow=!1,this.selectPrev=[],this.selectedRows=[],e||this._rowSelectionChanged()},SelectRow.prototype.initializeRow=function(e){var t=this,o=e.getElement(),l=function e(){setTimeout(function(){t.selecting=!1},50),document.body.removeEventListener("mouseup",e)};e.modules.select={selected:!1},t.table.options.selectableCheck.call(this.table,e.getComponent())?(o.classList.add("tabulator-selectable"),o.classList.remove("tabulator-unselectable"),t.table.options.selectable&&"highlight"!=t.table.options.selectable&&("click"===t.table.options.selectableRangeMode?o.addEventListener("click",function(o){if(o.shiftKey){t.table._clearSelection(),t.lastClickedRow=t.lastClickedRow||e;var l=t.table.rowManager.getDisplayRowIndex(t.lastClickedRow),s=t.table.rowManager.getDisplayRowIndex(e),c=l<=s?l:s,i=l>=s?l:s,n=t.table.rowManager.getDisplayRows().slice(0),a=n.splice(c,i-c+1);o.ctrlKey||o.metaKey?(a.forEach(function(o){o!==t.lastClickedRow&&(!0===t.table.options.selectable||t.isRowSelected(e)?t.toggleRow(o):t.selectedRows.lengtht.table.options.selectable&&(a=a.slice(0,t.table.options.selectable)),t.selectRows(a)),t.table._clearSelection()}else o.ctrlKey||o.metaKey?(t.toggleRow(e),t.lastClickedRow=e):(t.deselectRows(void 0,!0),t.selectRows(e),t.lastClickedRow=e)}):(o.addEventListener("click",function(o){t.table.modExists("edit")&&t.table.modules.edit.getCurrentCell()||t.table._clearSelection(),t.selecting||t.toggleRow(e)}),o.addEventListener("mousedown",function(o){if(o.shiftKey)return t.table._clearSelection(),t.selecting=!0,t.selectPrev=[],document.body.addEventListener("mouseup",l),document.body.addEventListener("keyup",l),t.toggleRow(e),!1}),o.addEventListener("mouseenter",function(o){t.selecting&&(t.table._clearSelection(),t.toggleRow(e),t.selectPrev[1]==e&&t.toggleRow(t.selectPrev[0]))}),o.addEventListener("mouseout",function(o){t.selecting&&(t.table._clearSelection(),t.selectPrev.unshift(e))})))):(o.classList.add("tabulator-unselectable"),o.classList.remove("tabulator-selectable"))},SelectRow.prototype.toggleRow=function(e){this.table.options.selectableCheck.call(this.table,e.getComponent())&&(e.modules.select&&e.modules.select.selected?this._deselectRow(e):this._selectRow(e))},SelectRow.prototype.selectRows=function(e){var t,o=this;switch(void 0===e?"undefined":_typeof(e)){case"undefined":this.table.rowManager.rows.forEach(function(e){o._selectRow(e,!0,!0)}),this._rowSelectionChanged();break;case"string":t=this.table.rowManager.findRow(e),t?this._selectRow(t,!0,!0):this.table.rowManager.getRows(e).forEach(function(e){o._selectRow(e,!0,!0)}),this._rowSelectionChanged();break;default:Array.isArray(e)?(e.forEach(function(e){o._selectRow(e,!0,!0)}),this._rowSelectionChanged()):this._selectRow(e,!1,!0)}},SelectRow.prototype._selectRow=function(e,t,o){if(!isNaN(this.table.options.selectable)&&!0!==this.table.options.selectable&&!o&&this.selectedRows.length>=this.table.options.selectable){if(!this.table.options.selectableRollingSelection)return!1;this._deselectRow(this.selectedRows[0])}var l=this.table.rowManager.findRow(e);l?-1==this.selectedRows.indexOf(l)&&(l.modules.select||(l.modules.select={}),l.modules.select.selected=!0,l.modules.select.checkboxEl&&(l.modules.select.checkboxEl.checked=!0),l.getElement().classList.add("tabulator-selected"),this.selectedRows.push(l),this.table.options.dataTreeSelectPropagate&&this.childRowSelection(l,!0),t||this.table.options.rowSelected.call(this.table,l.getComponent()),this._rowSelectionChanged(t)):t||console.warn("Selection Error - No such row found, ignoring selection:"+e)},SelectRow.prototype.isRowSelected=function(e){return-1!==this.selectedRows.indexOf(e)},SelectRow.prototype.deselectRows=function(e,t){var o,l=this;if(void 0===e){o=l.selectedRows.length;for(var s=0;s-1&&(s.modules.select||(s.modules.select={}),s.modules.select.selected=!1,s.modules.select.checkboxEl&&(s.modules.select.checkboxEl.checked=!1),s.getElement().classList.remove("tabulator-selected"),l.selectedRows.splice(o,1),this.table.options.dataTreeSelectPropagate&&this.childRowSelection(s,!1),t||l.table.options.rowDeselected.call(this.table,s.getComponent()),l._rowSelectionChanged(t)):t||console.warn("Deselection Error - No such row found, ignoring selection:"+e)},SelectRow.prototype.getSelectedData=function(){var e=[];return this.selectedRows.forEach(function(t){e.push(t.getData())}),e},SelectRow.prototype.getSelectedRows=function(){var e=[];return this.selectedRows.forEach(function(t){e.push(t.getComponent())}),e},SelectRow.prototype._rowSelectionChanged=function(e){this.headerCheckboxElement&&(0===this.selectedRows.length?(this.headerCheckboxElement.checked=!1,this.headerCheckboxElement.indeterminate=!1):this.table.rowManager.rows.length===this.selectedRows.length?(this.headerCheckboxElement.checked=!0,this.headerCheckboxElement.indeterminate=!1):(this.headerCheckboxElement.indeterminate=!0,this.headerCheckboxElement.checked=!1)),e||this.table.options.rowSelectionChanged.call(this.table,this.getSelectedData(),this.getSelectedRows())},SelectRow.prototype.registerRowSelectCheckbox=function(e,t){e._row.modules.select||(e._row.modules.select={}),e._row.modules.select.checkboxEl=t},SelectRow.prototype.registerHeaderSelectCheckbox=function(e){this.headerCheckboxElement=e},SelectRow.prototype.childRowSelection=function(e,t){var o=this.table.modules.dataTree.getChildren(e);if(t)for(var l=o,s=Array.isArray(l),c=0,l=s?l:l[Symbol.iterator]();;){var i;if(s){if(c>=l.length)break;i=l[c++]}else{if(c=l.next(),c.done)break;i=c.value}var n=i;this._selectRow(n,!0)}else for(var a=o,r=Array.isArray(a),d=0,a=r?a:a[Symbol.iterator]();;){var h;if(r){if(d>=a.length)break;h=a[d++]}else{if(d=a.next(),d.done)break;h=d.value}var w=h;this._deselectRow(w,!0)}},Tabulator.prototype.registerModule("selectRow",SelectRow); \ No newline at end of file diff --git a/website/js/vendor/tabulator/js/modules/sort.js b/website/js/vendor/tabulator/js/modules/sort.js new file mode 100644 index 0000000..beba8fa --- /dev/null +++ b/website/js/vendor/tabulator/js/modules/sort.js @@ -0,0 +1,580 @@ +var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; + +/* Tabulator v4.8.3 (c) Oliver Folkerd */ + +var Sort = function Sort(table) { + this.table = table; //hold Tabulator object + this.sortList = []; //holder current sort + this.changed = false; //has the sort changed since last render +}; + +//initialize column header for sorting +Sort.prototype.initializeColumn = function (column, content) { + var self = this, + sorter = false, + colEl, + arrowEl; + + switch (_typeof(column.definition.sorter)) { + case "string": + if (self.sorters[column.definition.sorter]) { + sorter = self.sorters[column.definition.sorter]; + } else { + console.warn("Sort Error - No such sorter found: ", column.definition.sorter); + } + break; + + case "function": + sorter = column.definition.sorter; + break; + } + + column.modules.sort = { + sorter: sorter, dir: "none", + params: column.definition.sorterParams || {}, + startingDir: column.definition.headerSortStartingDir || "asc", + tristate: typeof column.definition.headerSortTristate !== "undefined" ? column.definition.headerSortTristate : this.table.options.headerSortTristate + }; + + if (typeof column.definition.headerSort === "undefined" ? this.table.options.headerSort !== false : column.definition.headerSort !== false) { + + colEl = column.getElement(); + + colEl.classList.add("tabulator-sortable"); + + arrowEl = document.createElement("div"); + arrowEl.classList.add("tabulator-col-sorter"); + + if (_typeof(this.table.options.headerSortElement) == "object") { + arrowEl.appendChild(this.table.options.headerSortElement); + } else { + arrowEl.innerHTML = this.table.options.headerSortElement; + } + + //create sorter arrow + content.appendChild(arrowEl); + + column.modules.sort.element = arrowEl; + + //sort on click + colEl.addEventListener("click", function (e) { + var dir = "", + sorters = [], + match = false; + + if (column.modules.sort) { + if (column.modules.sort.tristate) { + if (column.modules.sort.dir == "none") { + dir = column.modules.sort.startingDir; + } else { + if (column.modules.sort.dir == column.modules.sort.startingDir) { + dir = column.modules.sort.dir == "asc" ? "desc" : "asc"; + } else { + dir = "none"; + } + } + } else { + switch (column.modules.sort.dir) { + case "asc": + dir = "desc"; + break; + + case "desc": + dir = "asc"; + break; + + default: + dir = column.modules.sort.startingDir; + } + } + + if (self.table.options.columnHeaderSortMulti && (e.shiftKey || e.ctrlKey)) { + sorters = self.getSort(); + + match = sorters.findIndex(function (sorter) { + return sorter.field === column.getField(); + }); + + if (match > -1) { + sorters[match].dir = dir; + + if (match != sorters.length - 1) { + match = sorters.splice(match, 1)[0]; + if (dir != "none") { + sorters.push(match); + } + } + } else { + if (dir != "none") { + sorters.push({ column: column, dir: dir }); + } + } + + //add to existing sort + self.setSort(sorters); + } else { + if (dir == "none") { + self.clear(); + } else { + //sort by column only + self.setSort(column, dir); + } + } + + self.table.rowManager.sorterRefresh(!self.sortList.length); + } + }); + } +}; + +//check if the sorters have changed since last use +Sort.prototype.hasChanged = function () { + var changed = this.changed; + this.changed = false; + return changed; +}; + +//return current sorters +Sort.prototype.getSort = function () { + var self = this, + sorters = []; + + self.sortList.forEach(function (item) { + if (item.column) { + sorters.push({ column: item.column.getComponent(), field: item.column.getField(), dir: item.dir }); + } + }); + + return sorters; +}; + +//change sort list and trigger sort +Sort.prototype.setSort = function (sortList, dir) { + var self = this, + newSortList = []; + + if (!Array.isArray(sortList)) { + sortList = [{ column: sortList, dir: dir }]; + } + + sortList.forEach(function (item) { + var column; + + column = self.table.columnManager.findColumn(item.column); + + if (column) { + item.column = column; + newSortList.push(item); + self.changed = true; + } else { + console.warn("Sort Warning - Sort field does not exist and is being ignored: ", item.column); + } + }); + + self.sortList = newSortList; + + if (this.table.options.persistence && this.table.modExists("persistence", true) && this.table.modules.persistence.config.sort) { + this.table.modules.persistence.save("sort"); + } +}; + +//clear sorters +Sort.prototype.clear = function () { + this.setSort([]); +}; + +//find appropriate sorter for column +Sort.prototype.findSorter = function (column) { + var row = this.table.rowManager.activeRows[0], + sorter = "string", + field, + value; + + if (row) { + row = row.getData(); + field = column.getField(); + + if (field) { + + value = column.getFieldValue(row); + + switch (typeof value === "undefined" ? "undefined" : _typeof(value)) { + case "undefined": + sorter = "string"; + break; + + case "boolean": + sorter = "boolean"; + break; + + default: + if (!isNaN(value) && value !== "") { + sorter = "number"; + } else { + if (value.match(/((^[0-9]+[a-z]+)|(^[a-z]+[0-9]+))+$/i)) { + sorter = "alphanum"; + } + } + break; + } + } + } + + return this.sorters[sorter]; +}; + +//work through sort list sorting data +Sort.prototype.sort = function (data) { + var self = this, + sortList = this.table.options.sortOrderReverse ? self.sortList.slice().reverse() : self.sortList, + sortListActual = [], + rowComponents = [], + lastSort; + + if (self.table.options.dataSorting) { + self.table.options.dataSorting.call(self.table, self.getSort()); + } + + self.clearColumnHeaders(); + + if (!self.table.options.ajaxSorting) { + + //build list of valid sorters and trigger column specific callbacks before sort begins + sortList.forEach(function (item, i) { + var sortObj = item.column.modules.sort; + + if (item.column && sortObj) { + + //if no sorter has been defined, take a guess + if (!sortObj.sorter) { + sortObj.sorter = self.findSorter(item.column); + } + + item.params = typeof sortObj.params === "function" ? sortObj.params(item.column.getComponent(), item.dir) : sortObj.params; + + sortListActual.push(item); + } + + self.setColumnHeader(item.column, item.dir); + }); + + //sort data + if (sortListActual.length) { + self._sortItems(data, sortListActual); + } + } else { + sortList.forEach(function (item, i) { + self.setColumnHeader(item.column, item.dir); + }); + } + + if (self.table.options.dataSorted) { + data.forEach(function (row) { + rowComponents.push(row.getComponent()); + }); + + self.table.options.dataSorted.call(self.table, self.getSort(), rowComponents); + } +}; + +//clear sort arrows on columns +Sort.prototype.clearColumnHeaders = function () { + this.table.columnManager.getRealColumns().forEach(function (column) { + if (column.modules.sort) { + column.modules.sort.dir = "none"; + column.getElement().setAttribute("aria-sort", "none"); + } + }); +}; + +//set the column header sort direction +Sort.prototype.setColumnHeader = function (column, dir) { + column.modules.sort.dir = dir; + column.getElement().setAttribute("aria-sort", dir); +}; + +//sort each item in sort list +Sort.prototype._sortItems = function (data, sortList) { + var _this = this; + + var sorterCount = sortList.length - 1; + + data.sort(function (a, b) { + var result; + + for (var i = sorterCount; i >= 0; i--) { + var sortItem = sortList[i]; + + result = _this._sortRow(a, b, sortItem.column, sortItem.dir, sortItem.params); + + if (result !== 0) { + break; + } + } + + return result; + }); +}; + +//process individual rows for a sort function on active data +Sort.prototype._sortRow = function (a, b, column, dir, params) { + var el1Comp, el2Comp, colComp; + + //switch elements depending on search direction + var el1 = dir == "asc" ? a : b; + var el2 = dir == "asc" ? b : a; + + a = column.getFieldValue(el1.getData()); + b = column.getFieldValue(el2.getData()); + + a = typeof a !== "undefined" ? a : ""; + b = typeof b !== "undefined" ? b : ""; + + el1Comp = el1.getComponent(); + el2Comp = el2.getComponent(); + + return column.modules.sort.sorter.call(this, a, b, el1Comp, el2Comp, column.getComponent(), dir, params); +}; + +//default data sorters +Sort.prototype.sorters = { + + //sort numbers + number: function number(a, b, aRow, bRow, column, dir, params) { + var alignEmptyValues = params.alignEmptyValues; + var decimal = params.decimalSeparator || "."; + var thousand = params.thousandSeparator || ","; + var emptyAlign = 0; + + a = parseFloat(String(a).split(thousand).join("").split(decimal).join(".")); + b = parseFloat(String(b).split(thousand).join("").split(decimal).join(".")); + + //handle non numeric values + if (isNaN(a)) { + emptyAlign = isNaN(b) ? 0 : -1; + } else if (isNaN(b)) { + emptyAlign = 1; + } else { + //compare valid values + return a - b; + } + + //fix empty values in position + if (alignEmptyValues === "top" && dir === "desc" || alignEmptyValues === "bottom" && dir === "asc") { + emptyAlign *= -1; + } + + return emptyAlign; + }, + + //sort strings + string: function string(a, b, aRow, bRow, column, dir, params) { + var alignEmptyValues = params.alignEmptyValues; + var emptyAlign = 0; + var locale; + + //handle empty values + if (!a) { + emptyAlign = !b ? 0 : -1; + } else if (!b) { + emptyAlign = 1; + } else { + //compare valid values + switch (_typeof(params.locale)) { + case "boolean": + if (params.locale) { + locale = this.table.modules.localize.getLocale(); + } + break; + case "string": + locale = params.locale; + break; + } + + return String(a).toLowerCase().localeCompare(String(b).toLowerCase(), locale); + } + + //fix empty values in position + if (alignEmptyValues === "top" && dir === "desc" || alignEmptyValues === "bottom" && dir === "asc") { + emptyAlign *= -1; + } + + return emptyAlign; + }, + + //sort date + date: function date(a, b, aRow, bRow, column, dir, params) { + if (!params.format) { + params.format = "DD/MM/YYYY"; + } + + return this.sorters.datetime.call(this, a, b, aRow, bRow, column, dir, params); + }, + + //sort HH:mm formatted times + time: function time(a, b, aRow, bRow, column, dir, params) { + if (!params.format) { + params.format = "HH:mm"; + } + + return this.sorters.datetime.call(this, a, b, aRow, bRow, column, dir, params); + }, + + //sort datetime + datetime: function datetime(a, b, aRow, bRow, column, dir, params) { + var format = params.format || "DD/MM/YYYY HH:mm:ss", + alignEmptyValues = params.alignEmptyValues, + emptyAlign = 0; + + if (typeof moment != "undefined") { + a = moment(a, format); + b = moment(b, format); + + if (!a.isValid()) { + emptyAlign = !b.isValid() ? 0 : -1; + } else if (!b.isValid()) { + emptyAlign = 1; + } else { + //compare valid values + return a - b; + } + + //fix empty values in position + if (alignEmptyValues === "top" && dir === "desc" || alignEmptyValues === "bottom" && dir === "asc") { + emptyAlign *= -1; + } + + return emptyAlign; + } else { + console.error("Sort Error - 'datetime' sorter is dependant on moment.js"); + } + }, + + //sort booleans + boolean: function boolean(a, b, aRow, bRow, column, dir, params) { + var el1 = a === true || a === "true" || a === "True" || a === 1 ? 1 : 0; + var el2 = b === true || b === "true" || b === "True" || b === 1 ? 1 : 0; + + return el1 - el2; + }, + + //sort if element contains any data + array: function array(a, b, aRow, bRow, column, dir, params) { + var el1 = 0; + var el2 = 0; + var type = params.type || "length"; + var alignEmptyValues = params.alignEmptyValues; + var emptyAlign = 0; + + function calc(value) { + + switch (type) { + case "length": + return value.length; + break; + + case "sum": + return value.reduce(function (c, d) { + return c + d; + }); + break; + + case "max": + return Math.max.apply(null, value); + break; + + case "min": + return Math.min.apply(null, value); + break; + + case "avg": + return value.reduce(function (c, d) { + return c + d; + }) / value.length; + break; + } + } + + //handle non array values + if (!Array.isArray(a)) { + alignEmptyValues = !Array.isArray(b) ? 0 : -1; + } else if (!Array.isArray(b)) { + alignEmptyValues = 1; + } else { + + //compare valid values + el1 = a ? calc(a) : 0; + el2 = b ? calc(b) : 0; + + return el1 - el2; + } + + //fix empty values in position + if (alignEmptyValues === "top" && dir === "desc" || alignEmptyValues === "bottom" && dir === "asc") { + emptyAlign *= -1; + } + + return emptyAlign; + }, + + //sort if element contains any data + exists: function exists(a, b, aRow, bRow, column, dir, params) { + var el1 = typeof a == "undefined" ? 0 : 1; + var el2 = typeof b == "undefined" ? 0 : 1; + + return el1 - el2; + }, + + //sort alpha numeric strings + alphanum: function alphanum(as, bs, aRow, bRow, column, dir, params) { + var a, + b, + a1, + b1, + i = 0, + L, + rx = /(\d+)|(\D+)/g, + rd = /\d/; + var alignEmptyValues = params.alignEmptyValues; + var emptyAlign = 0; + + //handle empty values + if (!as && as !== 0) { + emptyAlign = !bs && bs !== 0 ? 0 : -1; + } else if (!bs && bs !== 0) { + emptyAlign = 1; + } else { + + if (isFinite(as) && isFinite(bs)) return as - bs; + a = String(as).toLowerCase(); + b = String(bs).toLowerCase(); + if (a === b) return 0; + if (!(rd.test(a) && rd.test(b))) return a > b ? 1 : -1; + a = a.match(rx); + b = b.match(rx); + L = a.length > b.length ? b.length : a.length; + while (i < L) { + a1 = a[i]; + b1 = b[i++]; + if (a1 !== b1) { + if (isFinite(a1) && isFinite(b1)) { + if (a1.charAt(0) === "0") a1 = "." + a1; + if (b1.charAt(0) === "0") b1 = "." + b1; + return a1 - b1; + } else return a1 > b1 ? 1 : -1; + } + } + + return a.length > b.length; + } + + //fix empty values in position + if (alignEmptyValues === "top" && dir === "desc" || alignEmptyValues === "bottom" && dir === "asc") { + emptyAlign *= -1; + } + + return emptyAlign; + } +}; + +Tabulator.prototype.registerModule("sort", Sort); \ No newline at end of file diff --git a/website/js/vendor/tabulator/js/modules/sort.min.js b/website/js/vendor/tabulator/js/modules/sort.min.js new file mode 100644 index 0000000..e6e73ed --- /dev/null +++ b/website/js/vendor/tabulator/js/modules/sort.min.js @@ -0,0 +1,2 @@ +/* Tabulator v4.8.3 (c) Oliver Folkerd */ +var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Sort=function(t){this.table=t,this.sortList=[],this.changed=!1};Sort.prototype.initializeColumn=function(t,e){var r,o,n=this,i=!1;switch(_typeof(t.definition.sorter)){case"string":n.sorters[t.definition.sorter]?i=n.sorters[t.definition.sorter]:console.warn("Sort Error - No such sorter found: ",t.definition.sorter);break;case"function":i=t.definition.sorter}t.modules.sort={sorter:i,dir:"none",params:t.definition.sorterParams||{},startingDir:t.definition.headerSortStartingDir||"asc",tristate:void 0!==t.definition.headerSortTristate?t.definition.headerSortTristate:this.table.options.headerSortTristate},(void 0===t.definition.headerSort?!1!==this.table.options.headerSort:!1!==t.definition.headerSort)&&(r=t.getElement(),r.classList.add("tabulator-sortable"),o=document.createElement("div"),o.classList.add("tabulator-col-sorter"),"object"==_typeof(this.table.options.headerSortElement)?o.appendChild(this.table.options.headerSortElement):o.innerHTML=this.table.options.headerSortElement,e.appendChild(o),t.modules.sort.element=o,r.addEventListener("click",function(e){var r="",o=[],i=!1;if(t.modules.sort){if(t.modules.sort.tristate)r="none"==t.modules.sort.dir?t.modules.sort.startingDir:t.modules.sort.dir==t.modules.sort.startingDir?"asc"==t.modules.sort.dir?"desc":"asc":"none";else switch(t.modules.sort.dir){case"asc":r="desc";break;case"desc":r="asc";break;default:r=t.modules.sort.startingDir}n.table.options.columnHeaderSortMulti&&(e.shiftKey||e.ctrlKey)?(o=n.getSort(),i=o.findIndex(function(e){return e.field===t.getField()}),i>-1?(o[i].dir=r,i!=o.length-1&&(i=o.splice(i,1)[0],"none"!=r&&o.push(i))):"none"!=r&&o.push({column:t,dir:r}),n.setSort(o)):"none"==r?n.clear():n.setSort(t,r),n.table.rowManager.sorterRefresh(!n.sortList.length)}}))},Sort.prototype.hasChanged=function(){var t=this.changed;return this.changed=!1,t},Sort.prototype.getSort=function(){var t=this,e=[];return t.sortList.forEach(function(t){t.column&&e.push({column:t.column.getComponent(),field:t.column.getField(),dir:t.dir})}),e},Sort.prototype.setSort=function(t,e){var r=this,o=[];Array.isArray(t)||(t=[{column:t,dir:e}]),t.forEach(function(t){var e;e=r.table.columnManager.findColumn(t.column),e?(t.column=e,o.push(t),r.changed=!0):console.warn("Sort Warning - Sort field does not exist and is being ignored: ",t.column)}),r.sortList=o,this.table.options.persistence&&this.table.modExists("persistence",!0)&&this.table.modules.persistence.config.sort&&this.table.modules.persistence.save("sort")},Sort.prototype.clear=function(){this.setSort([])},Sort.prototype.findSorter=function(t){var e,r=this.table.rowManager.activeRows[0],o="string";if(r&&(r=r.getData(),t.getField()))switch(e=t.getFieldValue(r),void 0===e?"undefined":_typeof(e)){case"undefined":o="string";break;case"boolean":o="boolean";break;default:isNaN(e)||""===e?e.match(/((^[0-9]+[a-z]+)|(^[a-z]+[0-9]+))+$/i)&&(o="alphanum"):o="number"}return this.sorters[o]},Sort.prototype.sort=function(t){var e=this,r=this.table.options.sortOrderReverse?e.sortList.slice().reverse():e.sortList,o=[],n=[];e.table.options.dataSorting&&e.table.options.dataSorting.call(e.table,e.getSort()),e.clearColumnHeaders(),e.table.options.ajaxSorting?r.forEach(function(t,r){e.setColumnHeader(t.column,t.dir)}):(r.forEach(function(t,r){var n=t.column.modules.sort;t.column&&n&&(n.sorter||(n.sorter=e.findSorter(t.column)),t.params="function"==typeof n.params?n.params(t.column.getComponent(),t.dir):n.params,o.push(t)),e.setColumnHeader(t.column,t.dir)}),o.length&&e._sortItems(t,o)),e.table.options.dataSorted&&(t.forEach(function(t){n.push(t.getComponent())}),e.table.options.dataSorted.call(e.table,e.getSort(),n))},Sort.prototype.clearColumnHeaders=function(){this.table.columnManager.getRealColumns().forEach(function(t){t.modules.sort&&(t.modules.sort.dir="none",t.getElement().setAttribute("aria-sort","none"))})},Sort.prototype.setColumnHeader=function(t,e){t.modules.sort.dir=e,t.getElement().setAttribute("aria-sort",e)},Sort.prototype._sortItems=function(t,e){var r=this,o=e.length-1;t.sort(function(t,n){for(var i,s=o;s>=0;s--){var a=e[s];if(0!==(i=r._sortRow(t,n,a.column,a.dir,a.params)))break}return i})},Sort.prototype._sortRow=function(t,e,r,o,n){var i,s,a="asc"==o?t:e,l="asc"==o?e:t;return t=r.getFieldValue(a.getData()),e=r.getFieldValue(l.getData()),t=void 0!==t?t:"",e=void 0!==e?e:"",i=a.getComponent(),s=l.getComponent(),r.modules.sort.sorter.call(this,t,e,i,s,r.getComponent(),o,n)},Sort.prototype.sorters={number:function(t,e,r,o,n,i,s){var a=s.alignEmptyValues,l=s.decimalSeparator||".",u=s.thousandSeparator||",",c=0;if(t=parseFloat(String(t).split(u).join("").split(l).join(".")),e=parseFloat(String(e).split(u).join("").split(l).join(".")),isNaN(t))c=isNaN(e)?0:-1;else{if(!isNaN(e))return t-e;c=1}return("top"===a&&"desc"===i||"bottom"===a&&"asc"===i)&&(c*=-1),c},string:function(t,e,r,o,n,i,s){var a,l=s.alignEmptyValues,u=0;if(t){if(e){switch(_typeof(s.locale)){case"boolean":s.locale&&(a=this.table.modules.localize.getLocale());break;case"string":a=s.locale}return String(t).toLowerCase().localeCompare(String(e).toLowerCase(),a)}u=1}else u=e?-1:0;return("top"===l&&"desc"===i||"bottom"===l&&"asc"===i)&&(u*=-1),u},date:function(t,e,r,o,n,i,s){return s.format||(s.format="DD/MM/YYYY"),this.sorters.datetime.call(this,t,e,r,o,n,i,s)},time:function(t,e,r,o,n,i,s){return s.format||(s.format="HH:mm"),this.sorters.datetime.call(this,t,e,r,o,n,i,s)},datetime:function(t,e,r,o,n,i,s){var a=s.format||"DD/MM/YYYY HH:mm:ss",l=s.alignEmptyValues,u=0;if("undefined"!=typeof moment){if(t=moment(t,a),e=moment(e,a),t.isValid()){if(e.isValid())return t-e;u=1}else u=e.isValid()?-1:0;return("top"===l&&"desc"===i||"bottom"===l&&"asc"===i)&&(u*=-1),u}console.error("Sort Error - 'datetime' sorter is dependant on moment.js")},boolean:function(t,e,r,o,n,i,s){return(!0===t||"true"===t||"True"===t||1===t?1:0)-(!0===e||"true"===e||"True"===e||1===e?1:0)},array:function(t,e,r,o,n,i,s){function a(t){switch(c){case"length":return t.length;case"sum":return t.reduce(function(t,e){return t+e});case"max":return Math.max.apply(null,t);case"min":return Math.min.apply(null,t);case"avg":return t.reduce(function(t,e){return t+e})/t.length}}var l=0,u=0,c=s.type||"length",d=s.alignEmptyValues,m=0;if(Array.isArray(t)){if(Array.isArray(e))return l=t?a(t):0,u=e?a(e):0,l-u;d=1}else d=Array.isArray(e)?-1:0;return("top"===d&&"desc"===i||"bottom"===d&&"asc"===i)&&(m*=-1),m},exists:function(t,e,r,o,n,i,s){return(void 0===t?0:1)-(void 0===e?0:1)},alphanum:function(t,e,r,o,n,i,s){var a,l,u,c,d,m=0,f=/(\d+)|(\D+)/g,p=/\d/,h=s.alignEmptyValues,g=0;if(t||0===t){if(e||0===e){if(isFinite(t)&&isFinite(e))return t-e;if(a=String(t).toLowerCase(),l=String(e).toLowerCase(),a===l)return 0;if(!p.test(a)||!p.test(l))return a>l?1:-1;for(a=a.match(f),l=l.match(f),d=a.length>l.length?l.length:a.length;mc?1:-1;return a.length>l.length}g=1}else g=e||0===e?-1:0;return("top"===h&&"desc"===i||"bottom"===h&&"asc"===i)&&(g*=-1),g}},Tabulator.prototype.registerModule("sort",Sort); \ No newline at end of file diff --git a/website/js/vendor/tabulator/js/modules/validate.js b/website/js/vendor/tabulator/js/modules/validate.js new file mode 100644 index 0000000..b5708a7 --- /dev/null +++ b/website/js/vendor/tabulator/js/modules/validate.js @@ -0,0 +1,286 @@ +var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; + +/* Tabulator v4.8.3 (c) Oliver Folkerd */ + +var Validate = function Validate(table) { + this.table = table; + this.invalidCells = []; +}; + +//validate +Validate.prototype.initializeColumn = function (column) { + var self = this, + config = [], + validator; + + if (column.definition.validator) { + + if (Array.isArray(column.definition.validator)) { + column.definition.validator.forEach(function (item) { + validator = self._extractValidator(item); + + if (validator) { + config.push(validator); + } + }); + } else { + validator = this._extractValidator(column.definition.validator); + + if (validator) { + config.push(validator); + } + } + + column.modules.validate = config.length ? config : false; + } +}; + +Validate.prototype._extractValidator = function (value) { + var type, params, pos; + + switch (typeof value === "undefined" ? "undefined" : _typeof(value)) { + case "string": + pos = value.indexOf(':'); + + if (pos > -1) { + type = value.substring(0, pos); + params = value.substring(pos + 1); + } else { + type = value; + } + + return this._buildValidator(type, params); + break; + + case "function": + return this._buildValidator(value); + break; + + case "object": + return this._buildValidator(value.type, value.parameters); + break; + } +}; + +Validate.prototype._buildValidator = function (type, params) { + + var func = typeof type == "function" ? type : this.validators[type]; + + if (!func) { + console.warn("Validator Setup Error - No matching validator found:", type); + return false; + } else { + return { + type: typeof type == "function" ? "function" : type, + func: func, + params: params + }; + } +}; + +Validate.prototype.validate = function (validators, cell, value) { + var self = this, + valid = [], + invalidIndex = this.invalidCells.indexOf(cell); + + if (validators) { + validators.forEach(function (item) { + if (!item.func.call(self, cell.getComponent(), value, item.params)) { + valid.push({ + type: item.type, + parameters: item.params + }); + } + }); + } + + valid = valid.length ? valid : true; + + if (!cell.modules.validate) { + cell.modules.validate = {}; + } + + if (valid === true) { + cell.modules.validate.invalid = false; + cell.getElement().classList.remove("tabulator-validation-fail"); + + if (invalidIndex > -1) { + this.invalidCells.splice(invalidIndex, 1); + } + } else { + cell.modules.validate.invalid = true; + + if (this.table.options.validationMode !== "manual") { + cell.getElement().classList.add("tabulator-validation-fail"); + } + + if (invalidIndex == -1) { + this.invalidCells.push(cell); + } + } + + return valid; +}; + +Validate.prototype.getInvalidCells = function () { + var output = []; + + this.invalidCells.forEach(function (cell) { + output.push(cell.getComponent()); + }); + + return output; +}; + +Validate.prototype.clearValidation = function (cell) { + var invalidIndex; + + if (cell.modules.validate && cell.modules.validate.invalid) { + + cell.getElement().classList.remove("tabulator-validation-fail"); + cell.modules.validate.invalid = false; + + invalidIndex = this.invalidCells.indexOf(cell); + + if (invalidIndex > -1) { + this.invalidCells.splice(invalidIndex, 1); + } + } +}; + +Validate.prototype.validators = { + + //is integer + integer: function integer(cell, value, parameters) { + if (value === "" || value === null || typeof value === "undefined") { + return true; + } + value = Number(value); + return typeof value === 'number' && isFinite(value) && Math.floor(value) === value; + }, + + //is float + float: function float(cell, value, parameters) { + if (value === "" || value === null || typeof value === "undefined") { + return true; + } + value = Number(value); + return typeof value === 'number' && isFinite(value) && value % 1 !== 0; + }, + + //must be a number + numeric: function numeric(cell, value, parameters) { + if (value === "" || value === null || typeof value === "undefined") { + return true; + } + return !isNaN(value); + }, + + //must be a string + string: function string(cell, value, parameters) { + if (value === "" || value === null || typeof value === "undefined") { + return true; + } + return isNaN(value); + }, + + //maximum value + max: function max(cell, value, parameters) { + if (value === "" || value === null || typeof value === "undefined") { + return true; + } + return parseFloat(value) <= parameters; + }, + + //minimum value + min: function min(cell, value, parameters) { + if (value === "" || value === null || typeof value === "undefined") { + return true; + } + return parseFloat(value) >= parameters; + }, + + //starts with value + starts: function starts(cell, value, parameters) { + if (value === "" || value === null || typeof value === "undefined") { + return true; + } + return String(value).toLowerCase().startsWith(String(parameters).toLowerCase()); + }, + + //ends with value + ends: function ends(cell, value, parameters) { + if (value === "" || value === null || typeof value === "undefined") { + return true; + } + return String(value).toLowerCase().endsWith(String(parameters).toLowerCase()); + }, + + //minimum string length + minLength: function minLength(cell, value, parameters) { + if (value === "" || value === null || typeof value === "undefined") { + return true; + } + return String(value).length >= parameters; + }, + + //maximum string length + maxLength: function maxLength(cell, value, parameters) { + if (value === "" || value === null || typeof value === "undefined") { + return true; + } + return String(value).length <= parameters; + }, + + //in provided value list + in: function _in(cell, value, parameters) { + if (value === "" || value === null || typeof value === "undefined") { + return true; + } + if (typeof parameters == "string") { + parameters = parameters.split("|"); + } + + return value === "" || parameters.indexOf(value) > -1; + }, + + //must match provided regex + regex: function regex(cell, value, parameters) { + if (value === "" || value === null || typeof value === "undefined") { + return true; + } + var reg = new RegExp(parameters); + + return reg.test(value); + }, + + //value must be unique in this column + unique: function unique(cell, value, parameters) { + if (value === "" || value === null || typeof value === "undefined") { + return true; + } + var unique = true; + + var cellData = cell.getData(); + var column = cell.getColumn()._getSelf(); + + this.table.rowManager.rows.forEach(function (row) { + var data = row.getData(); + + if (data !== cellData) { + if (value == column.getFieldValue(data)) { + unique = false; + } + } + }); + + return unique; + }, + + //must have a value + required: function required(cell, value, parameters) { + return value !== "" && value !== null && typeof value !== "undefined"; + } +}; + +Tabulator.prototype.registerModule("validate", Validate); \ No newline at end of file diff --git a/website/js/vendor/tabulator/js/modules/validate.min.js b/website/js/vendor/tabulator/js/modules/validate.min.js new file mode 100644 index 0000000..917be7a --- /dev/null +++ b/website/js/vendor/tabulator/js/modules/validate.min.js @@ -0,0 +1,2 @@ +/* Tabulator v4.8.3 (c) Oliver Folkerd */ +var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Validate=function(t){this.table=t,this.invalidCells=[]};Validate.prototype.initializeColumn=function(t){var i,n=this,e=[];t.definition.validator&&(Array.isArray(t.definition.validator)?t.definition.validator.forEach(function(t){(i=n._extractValidator(t))&&e.push(i)}):(i=this._extractValidator(t.definition.validator))&&e.push(i),t.modules.validate=!!e.length&&e)},Validate.prototype._extractValidator=function(t){var i,n,e;switch(void 0===t?"undefined":_typeof(t)){case"string":return e=t.indexOf(":"),e>-1?(i=t.substring(0,e),n=t.substring(e+1)):i=t,this._buildValidator(i,n);case"function":return this._buildValidator(t);case"object":return this._buildValidator(t.type,t.parameters)}},Validate.prototype._buildValidator=function(t,i){var n="function"==typeof t?t:this.validators[t];return n?{type:"function"==typeof t?"function":t,func:n,params:i}:(console.warn("Validator Setup Error - No matching validator found:",t),!1)},Validate.prototype.validate=function(t,i,n){var e=this,a=[],o=this.invalidCells.indexOf(i);return t&&t.forEach(function(t){t.func.call(e,i.getComponent(),n,t.params)||a.push({type:t.type,parameters:t.params})}),a=!a.length||a,i.modules.validate||(i.modules.validate={}),!0===a?(i.modules.validate.invalid=!1,i.getElement().classList.remove("tabulator-validation-fail"),o>-1&&this.invalidCells.splice(o,1)):(i.modules.validate.invalid=!0,"manual"!==this.table.options.validationMode&&i.getElement().classList.add("tabulator-validation-fail"),-1==o&&this.invalidCells.push(i)),a},Validate.prototype.getInvalidCells=function(){var t=[];return this.invalidCells.forEach(function(i){t.push(i.getComponent())}),t},Validate.prototype.clearValidation=function(t){var i;t.modules.validate&&t.modules.validate.invalid&&(t.getElement().classList.remove("tabulator-validation-fail"),t.modules.validate.invalid=!1,(i=this.invalidCells.indexOf(t))>-1&&this.invalidCells.splice(i,1))},Validate.prototype.validators={integer:function(t,i,n){return""===i||null===i||void 0===i||"number"==typeof(i=Number(i))&&isFinite(i)&&Math.floor(i)===i},float:function(t,i,n){return""===i||null===i||void 0===i||"number"==typeof(i=Number(i))&&isFinite(i)&&i%1!=0},numeric:function(t,i,n){return""===i||null===i||void 0===i||!isNaN(i)},string:function(t,i,n){return""===i||null===i||void 0===i||isNaN(i)},max:function(t,i,n){return""===i||null===i||void 0===i||parseFloat(i)<=n},min:function(t,i,n){return""===i||null===i||void 0===i||parseFloat(i)>=n},starts:function(t,i,n){return""===i||null===i||void 0===i||String(i).toLowerCase().startsWith(String(n).toLowerCase())},ends:function(t,i,n){return""===i||null===i||void 0===i||String(i).toLowerCase().endsWith(String(n).toLowerCase())},minLength:function(t,i,n){return""===i||null===i||void 0===i||String(i).length>=n},maxLength:function(t,i,n){return""===i||null===i||void 0===i||String(i).length<=n},in:function(t,i,n){return""===i||null===i||void 0===i||("string"==typeof n&&(n=n.split("|")),""===i||n.indexOf(i)>-1)},regex:function(t,i,n){return""===i||null===i||void 0===i||new RegExp(n).test(i)},unique:function(t,i,n){if(""===i||null===i||void 0===i)return!0;var e=!0,a=t.getData(),o=t.getColumn()._getSelf();return this.table.rowManager.rows.forEach(function(t){var n=t.getData();n!==a&&i==o.getFieldValue(n)&&(e=!1)}),e},required:function(t,i,n){return""!==i&&null!==i&&void 0!==i}},Tabulator.prototype.registerModule("validate",Validate); \ No newline at end of file diff --git a/website/js/vendor/tabulator/js/tabulator.es2015.js b/website/js/vendor/tabulator/js/tabulator.es2015.js new file mode 100644 index 0000000..31daf6c --- /dev/null +++ b/website/js/vendor/tabulator/js/tabulator.es2015.js @@ -0,0 +1,23395 @@ +/* Tabulator v4.8.3 (c) Oliver Folkerd */ + +'use strict'; + +// https://tc39.github.io/ecma262/#sec-array.prototype.findIndex + +var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; + +if (!Array.prototype.findIndex) { + + Object.defineProperty(Array.prototype, 'findIndex', { + + value: function value(predicate) { + + // 1. Let O be ? ToObject(this value). + + if (this == null) { + + throw new TypeError('"this" is null or not defined'); + } + + var o = Object(this); + + // 2. Let len be ? ToLength(? Get(O, "length")). + + var len = o.length >>> 0; + + // 3. If IsCallable(predicate) is false, throw a TypeError exception. + + if (typeof predicate !== 'function') { + + throw new TypeError('predicate must be a function'); + } + + // 4. If thisArg was supplied, let T be thisArg; else let T be undefined. + + var thisArg = arguments[1]; + + // 5. Let k be 0. + + var k = 0; + + // 6. Repeat, while k < len + + while (k < len) { + + // a. Let Pk be ! ToString(k). + + // b. Let kValue be ? Get(O, Pk). + + // c. Let testResult be ToBoolean(? Call(predicate, T, « kValue, k, O »)). + + // d. If testResult is true, return k. + + var kValue = o[k]; + + if (predicate.call(thisArg, kValue, k, o)) { + + return k; + } + + // e. Increase k by 1. + + k++; + } + + // 7. Return -1. + + return -1; + } + + }); +} + +// https://tc39.github.io/ecma262/#sec-array.prototype.find + +if (!Array.prototype.find) { + + Object.defineProperty(Array.prototype, 'find', { + + value: function value(predicate) { + + // 1. Let O be ? ToObject(this value). + + if (this == null) { + + throw new TypeError('"this" is null or not defined'); + } + + var o = Object(this); + + // 2. Let len be ? ToLength(? Get(O, "length")). + + var len = o.length >>> 0; + + // 3. If IsCallable(predicate) is false, throw a TypeError exception. + + if (typeof predicate !== 'function') { + + throw new TypeError('predicate must be a function'); + } + + // 4. If thisArg was supplied, let T be thisArg; else let T be undefined. + + var thisArg = arguments[1]; + + // 5. Let k be 0. + + var k = 0; + + // 6. Repeat, while k < len + + while (k < len) { + + // a. Let Pk be ! ToString(k). + + // b. Let kValue be ? Get(O, Pk). + + // c. Let testResult be ToBoolean(? Call(predicate, T, « kValue, k, O »)). + + // d. If testResult is true, return kValue. + + var kValue = o[k]; + + if (predicate.call(thisArg, kValue, k, o)) { + + return kValue; + } + + // e. Increase k by 1. + + k++; + } + + // 7. Return undefined. + + return undefined; + } + + }); +} + +// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/includes#Polyfill + +if (!String.prototype.includes) { + + String.prototype.includes = function (search, start) { + + 'use strict'; + + if (search instanceof RegExp) { + + throw TypeError('first argument must not be a RegExp'); + } + + if (start === undefined) { + start = 0; + } + + return this.indexOf(search, start) !== -1; + }; +} + +// https://tc39.github.io/ecma262/#sec-array.prototype.includes + +if (!Array.prototype.includes) { + + Object.defineProperty(Array.prototype, 'includes', { + + value: function value(searchElement, fromIndex) { + + if (this == null) { + + throw new TypeError('"this" is null or not defined'); + } + + // 1. Let O be ? ToObject(this value). + + var o = Object(this); + + // 2. Let len be ? ToLength(? Get(O, "length")). + + var len = o.length >>> 0; + + // 3. If len is 0, return false. + + if (len === 0) { + + return false; + } + + // 4. Let n be ? ToInteger(fromIndex). + + // (If fromIndex is undefined, this step produces the value 0.) + + var n = fromIndex | 0; + + // 5. If n ≥ 0, then + + // a. Let k be n. + + // 6. Else n < 0, + + // a. Let k be len + n. + + // b. If k < 0, let k be 0. + + var k = Math.max(n >= 0 ? n : len - Math.abs(n), 0); + + function sameValueZero(x, y) { + + return x === y || typeof x === 'number' && typeof y === 'number' && isNaN(x) && isNaN(y); + } + + // 7. Repeat, while k < len + + while (k < len) { + + // a. Let elementK be the result of ? Get(O, ! ToString(k)). + + // b. If SameValueZero(searchElement, elementK) is true, return true. + + if (sameValueZero(o[k], searchElement)) { + + return true; + } + + // c. Increase k by 1. + + k++; + } + + // 8. Return false + + return false; + } + + }); +} + +// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/assign#Polyfill + +if (typeof Object.assign !== 'function') { + + // Must be writable: true, enumerable: false, configurable: true + + Object.defineProperty(Object, "assign", { + + value: function assign(target, varArgs) { + // .length of function is 2 + + 'use strict'; + + if (target === null || target === undefined) { + + throw new TypeError('Cannot convert undefined or null to object'); + } + + var to = Object(target); + + for (var index = 1; index < arguments.length; index++) { + + var nextSource = arguments[index]; + + if (nextSource !== null && nextSource !== undefined) { + + for (var nextKey in nextSource) { + + // Avoid bugs when hasOwnProperty is shadowed + + if (Object.prototype.hasOwnProperty.call(nextSource, nextKey)) { + + to[nextKey] = nextSource[nextKey]; + } + } + } + } + + return to; + }, + + writable: true, + + configurable: true + + }); +} + +var ColumnManager = function ColumnManager(table) { + + this.table = table; //hold parent table + + this.blockHozScrollEvent = false; + + this.headersElement = this.createHeadersElement(); + + this.element = this.createHeaderElement(); //containing element + + this.rowManager = null; //hold row manager object + + this.columns = []; // column definition object + + this.columnsByIndex = []; //columns by index + + this.columnsByField = {}; //columns by field + + this.scrollLeft = 0; + + this.element.insertBefore(this.headersElement, this.element.firstChild); +}; + +////////////// Setup Functions ///////////////// + + +ColumnManager.prototype.createHeadersElement = function () { + + var el = document.createElement("div"); + + el.classList.add("tabulator-headers"); + + return el; +}; + +ColumnManager.prototype.createHeaderElement = function () { + + var el = document.createElement("div"); + + el.classList.add("tabulator-header"); + + if (!this.table.options.headerVisible) { + + el.classList.add("tabulator-header-hidden"); + } + + return el; +}; + +ColumnManager.prototype.initialize = function () { + + var self = this; + + //scroll body along with header + + // self.element.addEventListener("scroll", function(e){ + + // if(!self.blockHozScrollEvent){ + + // self.table.rowManager.scrollHorizontal(self.element.scrollLeft); + + // } + + // }); +}; + +//link to row manager + +ColumnManager.prototype.setRowManager = function (manager) { + + this.rowManager = manager; +}; + +//return containing element + +ColumnManager.prototype.getElement = function () { + + return this.element; +}; + +//return header containing element + +ColumnManager.prototype.getHeadersElement = function () { + + return this.headersElement; +}; + +// ColumnManager.prototype.tempScrollBlock = function(){ + +// clearTimeout(this.blockHozScrollEvent); + +// this.blockHozScrollEvent = setTimeout(() => {this.blockHozScrollEvent = false;}, 50); + +// } + + +//scroll horizontally to match table body + +ColumnManager.prototype.scrollHorizontal = function (left) { + + var hozAdjust = 0, + scrollWidth = this.element.scrollWidth - this.table.element.clientWidth; + + // this.tempScrollBlock(); + + this.element.scrollLeft = left; + + //adjust for vertical scrollbar moving table when present + + if (left > scrollWidth) { + + hozAdjust = left - scrollWidth; + + this.element.style.marginLeft = -hozAdjust + "px"; + } else { + + this.element.style.marginLeft = 0; + } + + //keep frozen columns fixed in position + + //this._calcFrozenColumnsPos(hozAdjust + 3); + + + this.scrollLeft = left; + + if (this.table.modExists("frozenColumns")) { + + this.table.modules.frozenColumns.scrollHorizontal(); + } +}; + +///////////// Column Setup Functions ///////////// + + +ColumnManager.prototype.generateColumnsFromRowData = function (data) { + + var cols = [], + definitions = this.table.options.autoColumnsDefinitions, + row, + sorter; + + if (data && data.length) { + + row = data[0]; + + for (var key in row) { + + var col = { + + field: key, + + title: key + + }; + + var value = row[key]; + + switch (typeof value === 'undefined' ? 'undefined' : _typeof(value)) { + + case "undefined": + + sorter = "string"; + + break; + + case "boolean": + + sorter = "boolean"; + + break; + + case "object": + + if (Array.isArray(value)) { + + sorter = "array"; + } else { + + sorter = "string"; + } + + break; + + default: + + if (!isNaN(value) && value !== "") { + + sorter = "number"; + } else { + + if (value.match(/((^[0-9]+[a-z]+)|(^[a-z]+[0-9]+))+$/i)) { + + sorter = "alphanum"; + } else { + + sorter = "string"; + } + } + + break; + + } + + col.sorter = sorter; + + cols.push(col); + } + + if (definitions) { + + switch (typeof definitions === 'undefined' ? 'undefined' : _typeof(definitions)) { + + case "function": + + this.table.options.columns = definitions.call(this.table, cols); + + break; + + case "object": + + if (Array.isArray(definitions)) { + + cols.forEach(function (col) { + + var match = definitions.find(function (def) { + + return def.field === col.field; + }); + + if (match) { + + Object.assign(col, match); + } + }); + } else { + + cols.forEach(function (col) { + + if (definitions[col.field]) { + + Object.assign(col, definitions[col.field]); + } + }); + } + + this.table.options.columns = cols; + + break; + + } + } else { + + this.table.options.columns = cols; + } + + this.setColumns(this.table.options.columns); + } +}; + +ColumnManager.prototype.setColumns = function (cols, row) { + + var self = this; + + while (self.headersElement.firstChild) { + self.headersElement.removeChild(self.headersElement.firstChild); + }self.columns = []; + + self.columnsByIndex = []; + + self.columnsByField = {}; + + //reset frozen columns + + if (self.table.modExists("frozenColumns")) { + + self.table.modules.frozenColumns.reset(); + } + + cols.forEach(function (def, i) { + + self._addColumn(def); + }); + + self._reIndexColumns(); + + if (self.table.options.responsiveLayout && self.table.modExists("responsiveLayout", true)) { + + self.table.modules.responsiveLayout.initialize(); + } + + if (this.table.options.virtualDomHoz) { + + this.table.vdomHoz.reinitialize(false, true); + } + + self.redraw(true); +}; + +ColumnManager.prototype._addColumn = function (definition, before, nextToColumn) { + + var column = new Column(definition, this), + colEl = column.getElement(), + index = nextToColumn ? this.findColumnIndex(nextToColumn) : nextToColumn; + + if (nextToColumn && index > -1) { + + var parentIndex = this.columns.indexOf(nextToColumn.getTopColumn()); + + var nextEl = nextToColumn.getElement(); + + if (before) { + + this.columns.splice(parentIndex, 0, column); + + nextEl.parentNode.insertBefore(colEl, nextEl); + } else { + + this.columns.splice(parentIndex + 1, 0, column); + + nextEl.parentNode.insertBefore(colEl, nextEl.nextSibling); + } + } else { + + if (before) { + + this.columns.unshift(column); + + this.headersElement.insertBefore(column.getElement(), this.headersElement.firstChild); + } else { + + this.columns.push(column); + + this.headersElement.appendChild(column.getElement()); + } + + column.columnRendered(); + } + + return column; +}; + +ColumnManager.prototype.registerColumnField = function (col) { + + if (col.definition.field) { + + this.columnsByField[col.definition.field] = col; + } +}; + +ColumnManager.prototype.registerColumnPosition = function (col) { + + this.columnsByIndex.push(col); +}; + +ColumnManager.prototype._reIndexColumns = function () { + + this.columnsByIndex = []; + + this.columns.forEach(function (column) { + + column.reRegisterPosition(); + }); +}; + +//ensure column headers take up the correct amount of space in column groups + +ColumnManager.prototype._verticalAlignHeaders = function () { + + var self = this, + minHeight = 0; + + self.columns.forEach(function (column) { + + var height; + + column.clearVerticalAlign(); + + height = column.getHeight(); + + if (height > minHeight) { + + minHeight = height; + } + }); + + self.columns.forEach(function (column) { + + column.verticalAlign(self.table.options.columnHeaderVertAlign, minHeight); + }); + + self.rowManager.adjustTableSize(); +}; + +//////////////// Column Details ///////////////// + + +ColumnManager.prototype.findColumn = function (subject) { + + var self = this; + + if ((typeof subject === 'undefined' ? 'undefined' : _typeof(subject)) == "object") { + + if (subject instanceof Column) { + + //subject is column element + + return subject; + } else if (subject instanceof ColumnComponent) { + + //subject is public column component + + return subject._getSelf() || false; + } else if (typeof HTMLElement !== "undefined" && subject instanceof HTMLElement) { + + //subject is a HTML element of the column header + + var match = self.columns.find(function (column) { + + return column.element === subject; + }); + + return match || false; + } + } else { + + //subject should be treated as the field name of the column + + return this.columnsByField[subject] || false; + } + + //catch all for any other type of input + + + return false; +}; + +ColumnManager.prototype.getColumnByField = function (field) { + + return this.columnsByField[field]; +}; + +ColumnManager.prototype.getColumnsByFieldRoot = function (root) { + var _this = this; + + var matches = []; + + Object.keys(this.columnsByField).forEach(function (field) { + + var fieldRoot = field.split(".")[0]; + + if (fieldRoot === root) { + + matches.push(_this.columnsByField[field]); + } + }); + + return matches; +}; + +ColumnManager.prototype.getColumnByIndex = function (index) { + + return this.columnsByIndex[index]; +}; + +ColumnManager.prototype.getFirstVisibileColumn = function (index) { + + var index = this.columnsByIndex.findIndex(function (col) { + + return col.visible; + }); + + return index > -1 ? this.columnsByIndex[index] : false; +}; + +ColumnManager.prototype.getColumns = function () { + + return this.columns; +}; + +ColumnManager.prototype.findColumnIndex = function (column) { + + return this.columnsByIndex.findIndex(function (col) { + + return column === col; + }); +}; + +//return all columns that are not groups + +ColumnManager.prototype.getRealColumns = function () { + + return this.columnsByIndex; +}; + +//travers across columns and call action + +ColumnManager.prototype.traverse = function (callback) { + + var self = this; + + self.columnsByIndex.forEach(function (column, i) { + + callback(column, i); + }); +}; + +//get defintions of actual columns + +ColumnManager.prototype.getDefinitions = function (active) { + + var self = this, + output = []; + + self.columnsByIndex.forEach(function (column) { + + if (!active || active && column.visible) { + + output.push(column.getDefinition()); + } + }); + + return output; +}; + +//get full nested definition tree + +ColumnManager.prototype.getDefinitionTree = function () { + + var self = this, + output = []; + + self.columns.forEach(function (column) { + + output.push(column.getDefinition(true)); + }); + + return output; +}; + +ColumnManager.prototype.getComponents = function (structured) { + + var self = this, + output = [], + columns = structured ? self.columns : self.columnsByIndex; + + columns.forEach(function (column) { + + output.push(column.getComponent()); + }); + + return output; +}; + +ColumnManager.prototype.getWidth = function () { + + var width = 0; + + this.columnsByIndex.forEach(function (column) { + + if (column.visible) { + + width += column.getWidth(); + } + }); + + return width; +}; + +ColumnManager.prototype.moveColumn = function (from, to, after) { + + this.moveColumnActual(from, to, after); + + if (this.table.options.responsiveLayout && this.table.modExists("responsiveLayout", true)) { + + this.table.modules.responsiveLayout.initialize(); + } + + if (this.table.modExists("columnCalcs")) { + + this.table.modules.columnCalcs.recalc(this.table.rowManager.activeRows); + } + + to.element.parentNode.insertBefore(from.element, to.element); + + if (after) { + + to.element.parentNode.insertBefore(to.element, from.element); + } + + this._verticalAlignHeaders(); + + this.table.rowManager.reinitialize(); +}; + +ColumnManager.prototype.moveColumnActual = function (from, to, after) { + + if (from.parent.isGroup) { + + this._moveColumnInArray(from.parent.columns, from, to, after); + } else { + + this._moveColumnInArray(this.columns, from, to, after); + } + + this._moveColumnInArray(this.columnsByIndex, from, to, after, true); + + if (this.table.options.responsiveLayout && this.table.modExists("responsiveLayout", true)) { + + this.table.modules.responsiveLayout.initialize(); + } + + if (this.table.options.virtualDomHoz) { + + this.table.vdomHoz.reinitialize(true); + } + + if (this.table.options.columnMoved) { + + this.table.options.columnMoved.call(this.table, from.getComponent(), this.table.columnManager.getComponents()); + } + + if (this.table.options.persistence && this.table.modExists("persistence", true) && this.table.modules.persistence.config.columns) { + + this.table.modules.persistence.save("columns"); + } +}; + +ColumnManager.prototype._moveColumnInArray = function (columns, from, to, after, updateRows) { + var _this2 = this; + + var fromIndex = columns.indexOf(from), + toIndex, + rows = []; + + if (fromIndex > -1) { + + columns.splice(fromIndex, 1); + + toIndex = columns.indexOf(to); + + if (toIndex > -1) { + + if (after) { + + toIndex = toIndex + 1; + } + } else { + + toIndex = fromIndex; + } + + columns.splice(toIndex, 0, from); + + if (updateRows) { + + if (this.table.options.dataTree && this.table.modExists("dataTree", true)) { + + this.table.rowManager.rows.forEach(function (row) { + + rows = rows.concat(_this2.table.modules.dataTree.getTreeChildren(row, false, true)); + }); + } + + rows = rows.concat(this.table.rowManager.rows); + + rows.forEach(function (row) { + + if (row.cells.length) { + + var cell = row.cells.splice(fromIndex, 1)[0]; + + row.cells.splice(toIndex, 0, cell); + } + }); + } + } +}; + +ColumnManager.prototype.scrollToColumn = function (column, position, ifVisible) { + var _this3 = this; + + var left = 0, + offset = 0, + adjust = 0, + colEl = column.getElement(); + + return new Promise(function (resolve, reject) { + + if (typeof position === "undefined") { + + position = _this3.table.options.scrollToColumnPosition; + } + + if (typeof ifVisible === "undefined") { + + ifVisible = _this3.table.options.scrollToColumnIfVisible; + } + + if (column.visible) { + + //align to correct position + + switch (position) { + + case "middle": + + case "center": + + adjust = -_this3.element.clientWidth / 2; + + break; + + case "right": + + adjust = colEl.clientWidth - _this3.headersElement.clientWidth; + + break; + + } + + //check column visibility + + if (!ifVisible) { + + offset = colEl.offsetLeft; + + if (offset > 0 && offset + colEl.offsetWidth < _this3.element.clientWidth) { + + return false; + } + } + + //calculate scroll position + + left = colEl.offsetLeft + adjust; + + left = Math.max(Math.min(left, _this3.table.rowManager.element.scrollWidth - _this3.table.rowManager.element.clientWidth), 0); + + _this3.table.rowManager.scrollHorizontal(left); + + _this3.scrollHorizontal(left); + + resolve(); + } else { + + console.warn("Scroll Error - Column not visible"); + + reject("Scroll Error - Column not visible"); + } + }); +}; + +//////////////// Cell Management ///////////////// + + +ColumnManager.prototype.generateCells = function (row) { + + var self = this; + + var cells = []; + + self.columnsByIndex.forEach(function (column) { + + cells.push(column.generateCell(row)); + }); + + return cells; +}; + +//////////////// Column Management ///////////////// + + +ColumnManager.prototype.getFlexBaseWidth = function () { + + var self = this, + totalWidth = self.table.element.clientWidth, + //table element width + + fixedWidth = 0; + + //adjust for vertical scrollbar if present + + if (self.rowManager.element.scrollHeight > self.rowManager.element.clientHeight) { + + totalWidth -= self.rowManager.element.offsetWidth - self.rowManager.element.clientWidth; + } + + this.columnsByIndex.forEach(function (column) { + + var width, minWidth, colWidth; + + if (column.visible) { + + width = column.definition.width || 0; + + minWidth = typeof column.minWidth == "undefined" ? self.table.options.columnMinWidth : parseInt(column.minWidth); + + if (typeof width == "string") { + + if (width.indexOf("%") > -1) { + + colWidth = totalWidth / 100 * parseInt(width); + } else { + + colWidth = parseInt(width); + } + } else { + + colWidth = width; + } + + fixedWidth += colWidth > minWidth ? colWidth : minWidth; + } + }); + + return fixedWidth; +}; + +ColumnManager.prototype.addColumn = function (definition, before, nextToColumn) { + var _this4 = this; + + return new Promise(function (resolve, reject) { + + var column = _this4._addColumn(definition, before, nextToColumn); + + _this4._reIndexColumns(); + + if (_this4.table.options.responsiveLayout && _this4.table.modExists("responsiveLayout", true)) { + + _this4.table.modules.responsiveLayout.initialize(); + } + + if (_this4.table.modExists("columnCalcs")) { + + _this4.table.modules.columnCalcs.recalc(_this4.table.rowManager.activeRows); + } + + _this4.redraw(); + + if (_this4.table.modules.layout.getMode() != "fitColumns") { + + column.reinitializeWidth(); + } + + _this4._verticalAlignHeaders(); + + _this4.table.rowManager.reinitialize(); + + if (_this4.table.options.virtualDomHoz) { + + _this4.table.vdomHoz.reinitialize(); + } + + resolve(column); + }); +}; + +//remove column from system + +ColumnManager.prototype.deregisterColumn = function (column) { + + var field = column.getField(), + index; + + //remove from field list + + if (field) { + + delete this.columnsByField[field]; + } + + //remove from index list + + index = this.columnsByIndex.indexOf(column); + + if (index > -1) { + + this.columnsByIndex.splice(index, 1); + } + + //remove from column list + + index = this.columns.indexOf(column); + + if (index > -1) { + + this.columns.splice(index, 1); + } + + if (this.table.options.responsiveLayout && this.table.modExists("responsiveLayout", true)) { + + this.table.modules.responsiveLayout.initialize(); + } + + this._verticalAlignHeaders(); + + this.redraw(); +}; + +//redraw columns + +ColumnManager.prototype.redraw = function (force) { + + if (force) { + + if (Tabulator.prototype.helpers.elVisible(this.element)) { + + this._verticalAlignHeaders(); + } + + this.table.rowManager.resetScroll(); + + this.table.rowManager.reinitialize(); + } + + if (["fitColumns", "fitDataStretch"].indexOf(this.table.modules.layout.getMode()) > -1) { + + this.table.modules.layout.layout(); + } else { + + if (force) { + + this.table.modules.layout.layout(); + } else { + + if (this.table.options.responsiveLayout && this.table.modExists("responsiveLayout", true)) { + + this.table.modules.responsiveLayout.update(); + } + } + } + + if (this.table.modExists("frozenColumns")) { + + this.table.modules.frozenColumns.layout(); + } + + if (this.table.modExists("columnCalcs")) { + + this.table.modules.columnCalcs.recalc(this.table.rowManager.activeRows); + } + + if (force) { + + if (this.table.options.persistence && this.table.modExists("persistence", true) && this.table.modules.persistence.config.columns) { + + this.table.modules.persistence.save("columns"); + } + + if (this.table.modExists("columnCalcs")) { + + this.table.modules.columnCalcs.redraw(); + } + } + + this.table.footerManager.redraw(); +}; + +//public column object +var ColumnComponent = function ColumnComponent(column) { + this._column = column; + this.type = "ColumnComponent"; +}; + +ColumnComponent.prototype.getElement = function () { + return this._column.getElement(); +}; + +ColumnComponent.prototype.getDefinition = function () { + return this._column.getDefinition(); +}; + +ColumnComponent.prototype.getField = function () { + return this._column.getField(); +}; + +ColumnComponent.prototype.getCells = function () { + var cells = []; + + this._column.cells.forEach(function (cell) { + cells.push(cell.getComponent()); + }); + + return cells; +}; + +ColumnComponent.prototype.getVisibility = function () { + console.warn("getVisibility function is deprecated, you should now use the isVisible function"); + return this._column.visible; +}; + +ColumnComponent.prototype.isVisible = function () { + return this._column.visible; +}; + +ColumnComponent.prototype.show = function () { + if (this._column.isGroup) { + this._column.columns.forEach(function (column) { + column.show(); + }); + } else { + this._column.show(); + } +}; + +ColumnComponent.prototype.hide = function () { + if (this._column.isGroup) { + this._column.columns.forEach(function (column) { + column.hide(); + }); + } else { + this._column.hide(); + } +}; + +ColumnComponent.prototype.toggle = function () { + if (this._column.visible) { + this.hide(); + } else { + this.show(); + } +}; + +ColumnComponent.prototype.delete = function () { + return this._column.delete(); +}; + +ColumnComponent.prototype.getSubColumns = function () { + var output = []; + + if (this._column.columns.length) { + this._column.columns.forEach(function (column) { + output.push(column.getComponent()); + }); + } + + return output; +}; + +ColumnComponent.prototype.getParentColumn = function () { + return this._column.parent instanceof Column ? this._column.parent.getComponent() : false; +}; + +ColumnComponent.prototype._getSelf = function () { + return this._column; +}; + +ColumnComponent.prototype.scrollTo = function () { + return this._column.table.columnManager.scrollToColumn(this._column); +}; + +ColumnComponent.prototype.getTable = function () { + return this._column.table; +}; + +ColumnComponent.prototype.headerFilterFocus = function () { + if (this._column.table.modExists("filter", true)) { + this._column.table.modules.filter.setHeaderFilterFocus(this._column); + } +}; + +ColumnComponent.prototype.reloadHeaderFilter = function () { + if (this._column.table.modExists("filter", true)) { + this._column.table.modules.filter.reloadHeaderFilter(this._column); + } +}; + +ColumnComponent.prototype.getHeaderFilterValue = function () { + if (this._column.table.modExists("filter", true)) { + return this._column.table.modules.filter.getHeaderFilterValue(this._column); + } +}; + +ColumnComponent.prototype.setHeaderFilterValue = function (value) { + if (this._column.table.modExists("filter", true)) { + this._column.table.modules.filter.setHeaderFilterValue(this._column, value); + } +}; + +ColumnComponent.prototype.move = function (to, after) { + var toColumn = this._column.table.columnManager.findColumn(to); + + if (toColumn) { + this._column.table.columnManager.moveColumn(this._column, toColumn, after); + } else { + console.warn("Move Error - No matching column found:", toColumn); + } +}; + +ColumnComponent.prototype.getNextColumn = function () { + var nextCol = this._column.nextColumn(); + + return nextCol ? nextCol.getComponent() : false; +}; + +ColumnComponent.prototype.getPrevColumn = function () { + var prevCol = this._column.prevColumn(); + + return prevCol ? prevCol.getComponent() : false; +}; + +ColumnComponent.prototype.updateDefinition = function (updates) { + return this._column.updateDefinition(updates); +}; + +ColumnComponent.prototype.getWidth = function () { + return this._column.getWidth(); +}; + +ColumnComponent.prototype.setWidth = function (width) { + var result; + + if (width === true) { + result = this._column.reinitializeWidth(true); + } else { + result = this._column.setWidth(width); + } + + if (this._column.table.options.virtualDomHoz) { + this._column.table.vdomHoz.reinitialize(true); + } + + return result; +}; + +ColumnComponent.prototype.validate = function () { + return this._column.validate(); +}; + +var Column = function Column(def, parent) { + var self = this; + + this.table = parent.table; + this.definition = def; //column definition + this.parent = parent; //hold parent object + this.type = "column"; //type of element + this.columns = []; //child columns + this.cells = []; //cells bound to this column + this.element = this.createElement(); //column header element + this.contentElement = false; + this.titleHolderElement = false; + this.titleElement = false; + this.groupElement = this.createGroupElement(); //column group holder element + this.isGroup = false; + this.tooltip = false; //hold column tooltip + this.hozAlign = ""; //horizontal text alignment + this.vertAlign = ""; //vert text alignment + + //multi dimensional filed handling + this.field = ""; + this.fieldStructure = ""; + this.getFieldValue = ""; + this.setFieldValue = ""; + + this.titleFormatterRendered = false; + + this.setField(this.definition.field); + + if (this.table.options.invalidOptionWarnings) { + this.checkDefinition(); + } + + this.modules = {}; //hold module variables; + + this.cellEvents = { + cellClick: false, + cellDblClick: false, + cellContext: false, + cellTap: false, + cellDblTap: false, + cellTapHold: false, + cellMouseEnter: false, + cellMouseLeave: false, + cellMouseOver: false, + cellMouseOut: false, + cellMouseMove: false + }; + + this.width = null; //column width + this.widthStyled = ""; //column width prestyled to improve render efficiency + this.minWidth = null; //column minimum width + this.minWidthStyled = ""; //column minimum prestyled to improve render efficiency + this.widthFixed = false; //user has specified a width for this column + + this.visible = true; //default visible state + + this.component = null; + + this._mapDepricatedFunctionality(); + + //initialize column + if (def.columns) { + + this.isGroup = true; + + def.columns.forEach(function (def, i) { + var newCol = new Column(def, self); + self.attachColumn(newCol); + }); + + self.checkColumnVisibility(); + } else { + parent.registerColumnField(this); + } + + if (def.rowHandle && this.table.options.movableRows !== false && this.table.modExists("moveRow")) { + this.table.modules.moveRow.setHandle(true); + } + + this._buildHeader(); + + this.bindModuleColumns(); +}; + +Column.prototype.createElement = function () { + var el = document.createElement("div"); + + el.classList.add("tabulator-col"); + el.setAttribute("role", "columnheader"); + el.setAttribute("aria-sort", "none"); + + return el; +}; + +Column.prototype.createGroupElement = function () { + var el = document.createElement("div"); + + el.classList.add("tabulator-col-group-cols"); + + return el; +}; + +Column.prototype.checkDefinition = function () { + var _this5 = this; + + Object.keys(this.definition).forEach(function (key) { + if (_this5.defaultOptionList.indexOf(key) === -1) { + console.warn("Invalid column definition option in '" + (_this5.field || _this5.definition.title) + "' column:", key); + } + }); +}; + +Column.prototype.setField = function (field) { + this.field = field; + this.fieldStructure = field ? this.table.options.nestedFieldSeparator ? field.split(this.table.options.nestedFieldSeparator) : [field] : []; + this.getFieldValue = this.fieldStructure.length > 1 ? this._getNestedData : this._getFlatData; + this.setFieldValue = this.fieldStructure.length > 1 ? this._setNestedData : this._setFlatData; +}; + +//register column position with column manager +Column.prototype.registerColumnPosition = function (column) { + this.parent.registerColumnPosition(column); +}; + +//register column position with column manager +Column.prototype.registerColumnField = function (column) { + this.parent.registerColumnField(column); +}; + +//trigger position registration +Column.prototype.reRegisterPosition = function () { + if (this.isGroup) { + this.columns.forEach(function (column) { + column.reRegisterPosition(); + }); + } else { + this.registerColumnPosition(this); + } +}; + +Column.prototype._mapDepricatedFunctionality = function () { + if (typeof this.definition.hideInHtml !== "undefined") { + this.definition.htmlOutput = !this.definition.hideInHtml; + console.warn("hideInHtml column definition property is deprecated, you should now use htmlOutput"); + } + + if (typeof this.definition.align !== "undefined") { + this.definition.hozAlign = this.definition.align; + console.warn("align column definition property is deprecated, you should now use hozAlign"); + } + + if (typeof this.definition.downloadTitle !== "undefined") { + this.definition.titleDownload = this.definition.downloadTitle; + console.warn("downloadTitle definition property is deprecated, you should now use titleDownload"); + } +}; + +Column.prototype.setTooltip = function () { + var self = this, + def = self.definition; + + //set header tooltips + var tooltip = def.headerTooltip || def.tooltip === false ? def.headerTooltip : self.table.options.tooltipsHeader; + + if (tooltip) { + if (tooltip === true) { + if (def.field) { + self.table.modules.localize.bind("columns|" + def.field, function (value) { + self.element.setAttribute("title", value || def.title); + }); + } else { + self.element.setAttribute("title", def.title); + } + } else { + if (typeof tooltip == "function") { + tooltip = tooltip(self.getComponent()); + + if (tooltip === false) { + tooltip = ""; + } + } + + self.element.setAttribute("title", tooltip); + } + } else { + self.element.setAttribute("title", ""); + } +}; + +//build header element +Column.prototype._buildHeader = function () { + var self = this, + def = self.definition; + + while (self.element.firstChild) { + self.element.removeChild(self.element.firstChild); + }if (def.headerVertical) { + self.element.classList.add("tabulator-col-vertical"); + + if (def.headerVertical === "flip") { + self.element.classList.add("tabulator-col-vertical-flip"); + } + } + + self.contentElement = self._bindEvents(); + + self.contentElement = self._buildColumnHeaderContent(); + + self.element.appendChild(self.contentElement); + + if (self.isGroup) { + self._buildGroupHeader(); + } else { + self._buildColumnHeader(); + } + + self.setTooltip(); + + //set resizable handles + if (self.table.options.resizableColumns && self.table.modExists("resizeColumns")) { + self.table.modules.resizeColumns.initializeColumn("header", self, self.element); + } + + //set resizable handles + if (def.headerFilter && self.table.modExists("filter") && self.table.modExists("edit")) { + if (typeof def.headerFilterPlaceholder !== "undefined" && def.field) { + self.table.modules.localize.setHeaderFilterColumnPlaceholder(def.field, def.headerFilterPlaceholder); + } + + self.table.modules.filter.initializeColumn(self); + } + + //set resizable handles + if (self.table.modExists("frozenColumns")) { + self.table.modules.frozenColumns.initializeColumn(self); + } + + //set movable column + if (self.table.options.movableColumns && !self.isGroup && self.table.modExists("moveColumn")) { + self.table.modules.moveColumn.initializeColumn(self); + } + + //set calcs column + if ((def.topCalc || def.bottomCalc) && self.table.modExists("columnCalcs")) { + self.table.modules.columnCalcs.initializeColumn(self); + } + + //handle persistence + if (self.table.modExists("persistence") && self.table.modules.persistence.config.columns) { + self.table.modules.persistence.initializeColumn(self); + } + + //update header tooltip on mouse enter + self.element.addEventListener("mouseenter", function (e) { + self.setTooltip(); + }); +}; + +Column.prototype._bindEvents = function () { + + var self = this, + def = self.definition, + dblTap, + tapHold, + tap; + + //setup header click event bindings + if (typeof def.headerClick == "function") { + self.element.addEventListener("click", function (e) { + def.headerClick(e, self.getComponent()); + }); + } + + if (typeof def.headerDblClick == "function") { + self.element.addEventListener("dblclick", function (e) { + def.headerDblClick(e, self.getComponent()); + }); + } + + if (typeof def.headerContext == "function") { + self.element.addEventListener("contextmenu", function (e) { + def.headerContext(e, self.getComponent()); + }); + } + + //setup header tap event bindings + if (typeof def.headerTap == "function") { + tap = false; + + self.element.addEventListener("touchstart", function (e) { + tap = true; + }, { passive: true }); + + self.element.addEventListener("touchend", function (e) { + if (tap) { + def.headerTap(e, self.getComponent()); + } + + tap = false; + }); + } + + if (typeof def.headerDblTap == "function") { + dblTap = null; + + self.element.addEventListener("touchend", function (e) { + + if (dblTap) { + clearTimeout(dblTap); + dblTap = null; + + def.headerDblTap(e, self.getComponent()); + } else { + + dblTap = setTimeout(function () { + clearTimeout(dblTap); + dblTap = null; + }, 300); + } + }); + } + + if (typeof def.headerTapHold == "function") { + tapHold = null; + + self.element.addEventListener("touchstart", function (e) { + clearTimeout(tapHold); + + tapHold = setTimeout(function () { + clearTimeout(tapHold); + tapHold = null; + tap = false; + def.headerTapHold(e, self.getComponent()); + }, 1000); + }, { passive: true }); + + self.element.addEventListener("touchend", function (e) { + clearTimeout(tapHold); + tapHold = null; + }); + } + + //store column cell click event bindings + if (typeof def.cellClick == "function") { + self.cellEvents.cellClick = def.cellClick; + } + + if (typeof def.cellDblClick == "function") { + self.cellEvents.cellDblClick = def.cellDblClick; + } + + if (typeof def.cellContext == "function") { + self.cellEvents.cellContext = def.cellContext; + } + + //store column mouse event bindings + if (typeof def.cellMouseEnter == "function") { + self.cellEvents.cellMouseEnter = def.cellMouseEnter; + } + + if (typeof def.cellMouseLeave == "function") { + self.cellEvents.cellMouseLeave = def.cellMouseLeave; + } + + if (typeof def.cellMouseOver == "function") { + self.cellEvents.cellMouseOver = def.cellMouseOver; + } + + if (typeof def.cellMouseOut == "function") { + self.cellEvents.cellMouseOut = def.cellMouseOut; + } + + if (typeof def.cellMouseMove == "function") { + self.cellEvents.cellMouseMove = def.cellMouseMove; + } + + //setup column cell tap event bindings + if (typeof def.cellTap == "function") { + self.cellEvents.cellTap = def.cellTap; + } + + if (typeof def.cellDblTap == "function") { + self.cellEvents.cellDblTap = def.cellDblTap; + } + + if (typeof def.cellTapHold == "function") { + self.cellEvents.cellTapHold = def.cellTapHold; + } + + //setup column cell edit callbacks + if (typeof def.cellEdited == "function") { + self.cellEvents.cellEdited = def.cellEdited; + } + + if (typeof def.cellEditing == "function") { + self.cellEvents.cellEditing = def.cellEditing; + } + + if (typeof def.cellEditCancelled == "function") { + self.cellEvents.cellEditCancelled = def.cellEditCancelled; + } +}; + +//build header element for header +Column.prototype._buildColumnHeader = function () { + var _this6 = this; + + var def = this.definition, + table = this.table, + sortable; + + //set column sorter + if (table.modExists("sort")) { + table.modules.sort.initializeColumn(this, this.titleHolderElement); + } + + //set column header context menu + if ((def.headerContextMenu || def.headerClickMenu || def.headerMenu) && table.modExists("menu")) { + table.modules.menu.initializeColumnHeader(this); + } + + //set column formatter + if (table.modExists("format")) { + table.modules.format.initializeColumn(this); + } + + //set column editor + if (typeof def.editor != "undefined" && table.modExists("edit")) { + table.modules.edit.initializeColumn(this); + } + + //set colum validator + if (typeof def.validator != "undefined" && table.modExists("validate")) { + table.modules.validate.initializeColumn(this); + } + + //set column mutator + if (table.modExists("mutator")) { + table.modules.mutator.initializeColumn(this); + } + + //set column accessor + if (table.modExists("accessor")) { + table.modules.accessor.initializeColumn(this); + } + + //set respoviveLayout + if (_typeof(table.options.responsiveLayout) && table.modExists("responsiveLayout")) { + table.modules.responsiveLayout.initializeColumn(this); + } + + //set column visibility + if (typeof def.visible != "undefined") { + if (def.visible) { + this.show(true); + } else { + this.hide(true); + } + } + + //asign additional css classes to column header + if (def.cssClass) { + var classeNames = def.cssClass.split(" "); + classeNames.forEach(function (className) { + _this6.element.classList.add(className); + }); + } + + if (def.field) { + this.element.setAttribute("tabulator-field", def.field); + } + + //set min width if present + this.setMinWidth(typeof def.minWidth == "undefined" ? this.table.options.columnMinWidth : parseInt(def.minWidth)); + + this.reinitializeWidth(); + + //set tooltip if present + this.tooltip = this.definition.tooltip || this.definition.tooltip === false ? this.definition.tooltip : this.table.options.tooltips; + + //set orizontal text alignment + this.hozAlign = typeof this.definition.hozAlign == "undefined" ? this.table.options.cellHozAlign : this.definition.hozAlign; + this.vertAlign = typeof this.definition.vertAlign == "undefined" ? this.table.options.cellVertAlign : this.definition.vertAlign; + + this.titleElement.style.textAlign = this.definition.headerHozAlign || this.table.options.headerHozAlign; +}; + +Column.prototype._buildColumnHeaderContent = function () { + var def = this.definition, + table = this.table; + + var contentElement = document.createElement("div"); + contentElement.classList.add("tabulator-col-content"); + + this.titleHolderElement = document.createElement("div"); + this.titleHolderElement.classList.add("tabulator-col-title-holder"); + + contentElement.appendChild(this.titleHolderElement); + + this.titleElement = this._buildColumnHeaderTitle(); + + this.titleHolderElement.appendChild(this.titleElement); + + return contentElement; +}; + +//build title element of column +Column.prototype._buildColumnHeaderTitle = function () { + var self = this, + def = self.definition, + table = self.table, + title; + + var titleHolderElement = document.createElement("div"); + titleHolderElement.classList.add("tabulator-col-title"); + + if (def.editableTitle) { + var titleElement = document.createElement("input"); + titleElement.classList.add("tabulator-title-editor"); + + titleElement.addEventListener("click", function (e) { + e.stopPropagation(); + titleElement.focus(); + }); + + titleElement.addEventListener("change", function () { + def.title = titleElement.value; + table.options.columnTitleChanged.call(self.table, self.getComponent()); + }); + + titleHolderElement.appendChild(titleElement); + + if (def.field) { + table.modules.localize.bind("columns|" + def.field, function (text) { + titleElement.value = text || def.title || " "; + }); + } else { + titleElement.value = def.title || " "; + } + } else { + if (def.field) { + table.modules.localize.bind("columns|" + def.field, function (text) { + self._formatColumnHeaderTitle(titleHolderElement, text || def.title || " "); + }); + } else { + self._formatColumnHeaderTitle(titleHolderElement, def.title || " "); + } + } + + return titleHolderElement; +}; + +Column.prototype._formatColumnHeaderTitle = function (el, title) { + var _this7 = this; + + var formatter, contents, params, mockCell, onRendered; + + if (this.definition.titleFormatter && this.table.modExists("format")) { + + formatter = this.table.modules.format.getFormatter(this.definition.titleFormatter); + + onRendered = function onRendered(callback) { + _this7.titleFormatterRendered = callback; + }; + + mockCell = { + getValue: function getValue() { + return title; + }, + getElement: function getElement() { + return el; + } + }; + + params = this.definition.titleFormatterParams || {}; + + params = typeof params === "function" ? params() : params; + + contents = formatter.call(this.table.modules.format, mockCell, params, onRendered); + + switch (typeof contents === 'undefined' ? 'undefined' : _typeof(contents)) { + case "object": + if (contents instanceof Node) { + el.appendChild(contents); + } else { + el.innerHTML = ""; + console.warn("Format Error - Title formatter has returned a type of object, the only valid formatter object return is an instance of Node, the formatter returned:", contents); + } + break; + case "undefined": + case "null": + el.innerHTML = ""; + break; + default: + el.innerHTML = contents; + } + } else { + el.innerHTML = title; + } +}; + +//build header element for column group +Column.prototype._buildGroupHeader = function () { + var _this8 = this; + + this.element.classList.add("tabulator-col-group"); + this.element.setAttribute("role", "columngroup"); + this.element.setAttribute("aria-title", this.definition.title); + + //asign additional css classes to column header + if (this.definition.cssClass) { + var classeNames = this.definition.cssClass.split(" "); + classeNames.forEach(function (className) { + _this8.element.classList.add(className); + }); + } + + //set column header context menu + if ((this.definition.headerContextMenu || this.definition.headerMenu) && this.table.modExists("menu")) { + this.table.modules.menu.initializeColumnHeader(this); + } + + this.element.appendChild(this.groupElement); +}; + +//flat field lookup +Column.prototype._getFlatData = function (data) { + return data[this.field]; +}; + +//nested field lookup +Column.prototype._getNestedData = function (data) { + var dataObj = data, + structure = this.fieldStructure, + length = structure.length, + output; + + for (var _i = 0; _i < length; _i++) { + + dataObj = dataObj[structure[_i]]; + + output = dataObj; + + if (!dataObj) { + break; + } + } + + return output; +}; + +//flat field set +Column.prototype._setFlatData = function (data, value) { + if (this.field) { + data[this.field] = value; + } +}; + +//nested field set +Column.prototype._setNestedData = function (data, value) { + var dataObj = data, + structure = this.fieldStructure, + length = structure.length; + + for (var _i2 = 0; _i2 < length; _i2++) { + + if (_i2 == length - 1) { + dataObj[structure[_i2]] = value; + } else { + if (!dataObj[structure[_i2]]) { + if (typeof value !== "undefined") { + dataObj[structure[_i2]] = {}; + } else { + break; + } + } + + dataObj = dataObj[structure[_i2]]; + } + } +}; + +//attach column to this group +Column.prototype.attachColumn = function (column) { + var self = this; + + if (self.groupElement) { + self.columns.push(column); + self.groupElement.appendChild(column.getElement()); + } else { + console.warn("Column Warning - Column being attached to another column instead of column group"); + } +}; + +//vertically align header in column +Column.prototype.verticalAlign = function (alignment, height) { + + //calculate height of column header and group holder element + var parentHeight = this.parent.isGroup ? this.parent.getGroupElement().clientHeight : height || this.parent.getHeadersElement().clientHeight; + // var parentHeight = this.parent.isGroup ? this.parent.getGroupElement().clientHeight : this.parent.getHeadersElement().clientHeight; + + this.element.style.height = parentHeight + "px"; + + if (this.isGroup) { + this.groupElement.style.minHeight = parentHeight - this.contentElement.offsetHeight + "px"; + } + + //vertically align cell contents + if (!this.isGroup && alignment !== "top") { + if (alignment === "bottom") { + this.element.style.paddingTop = this.element.clientHeight - this.contentElement.offsetHeight + "px"; + } else { + this.element.style.paddingTop = (this.element.clientHeight - this.contentElement.offsetHeight) / 2 + "px"; + } + } + + this.columns.forEach(function (column) { + column.verticalAlign(alignment); + }); +}; + +//clear vertical alignmenet +Column.prototype.clearVerticalAlign = function () { + this.element.style.paddingTop = ""; + this.element.style.height = ""; + this.element.style.minHeight = ""; + this.groupElement.style.minHeight = ""; + + this.columns.forEach(function (column) { + column.clearVerticalAlign(); + }); +}; + +Column.prototype.bindModuleColumns = function () { + //check if rownum formatter is being used on a column + if (this.definition.formatter == "rownum") { + this.table.rowManager.rowNumColumn = this; + } +}; + +//// Retreive Column Information //// + +//return column header element +Column.prototype.getElement = function () { + return this.element; +}; + +//return colunm group element +Column.prototype.getGroupElement = function () { + return this.groupElement; +}; + +//return field name +Column.prototype.getField = function () { + return this.field; +}; + +//return the first column in a group +Column.prototype.getFirstColumn = function () { + if (!this.isGroup) { + return this; + } else { + if (this.columns.length) { + return this.columns[0].getFirstColumn(); + } else { + return false; + } + } +}; + +//return the last column in a group +Column.prototype.getLastColumn = function () { + if (!this.isGroup) { + return this; + } else { + if (this.columns.length) { + return this.columns[this.columns.length - 1].getLastColumn(); + } else { + return false; + } + } +}; + +//return all columns in a group +Column.prototype.getColumns = function () { + return this.columns; +}; + +//return all columns in a group +Column.prototype.getCells = function () { + return this.cells; +}; + +//retreive the top column in a group of columns +Column.prototype.getTopColumn = function () { + if (this.parent.isGroup) { + return this.parent.getTopColumn(); + } else { + return this; + } +}; + +//return column definition object +Column.prototype.getDefinition = function (updateBranches) { + var colDefs = []; + + if (this.isGroup && updateBranches) { + this.columns.forEach(function (column) { + colDefs.push(column.getDefinition(true)); + }); + + this.definition.columns = colDefs; + } + + return this.definition; +}; + +//////////////////// Actions //////////////////// + +Column.prototype.checkColumnVisibility = function () { + var visible = false; + + this.columns.forEach(function (column) { + if (column.visible) { + visible = true; + } + }); + + if (visible) { + this.show(); + this.parent.table.options.columnVisibilityChanged.call(this.table, this.getComponent(), false); + } else { + this.hide(); + } +}; + +//show column +Column.prototype.show = function (silent, responsiveToggle) { + if (!this.visible) { + this.visible = true; + + this.element.style.display = ""; + + if (this.parent.isGroup) { + this.parent.checkColumnVisibility(); + } + + this.cells.forEach(function (cell) { + cell.show(); + }); + + if (!this.isGroup && this.width === null) { + this.reinitializeWidth(); + } + + this.table.columnManager._verticalAlignHeaders(); + + if (this.table.options.persistence && this.table.modExists("persistence", true) && this.table.modules.persistence.config.columns) { + this.table.modules.persistence.save("columns"); + } + + if (!responsiveToggle && this.table.options.responsiveLayout && this.table.modExists("responsiveLayout", true)) { + this.table.modules.responsiveLayout.updateColumnVisibility(this, this.visible); + } + + if (!silent) { + this.table.options.columnVisibilityChanged.call(this.table, this.getComponent(), true); + } + + if (this.parent.isGroup) { + this.parent.matchChildWidths(); + } + } +}; + +//hide column +Column.prototype.hide = function (silent, responsiveToggle) { + if (this.visible) { + this.visible = false; + + this.element.style.display = "none"; + + this.table.columnManager._verticalAlignHeaders(); + + if (this.parent.isGroup) { + this.parent.checkColumnVisibility(); + } + + this.cells.forEach(function (cell) { + cell.hide(); + }); + + if (this.table.options.persistence && this.table.modExists("persistence", true) && this.table.modules.persistence.config.columns) { + this.table.modules.persistence.save("columns"); + } + + if (!responsiveToggle && this.table.options.responsiveLayout && this.table.modExists("responsiveLayout", true)) { + this.table.modules.responsiveLayout.updateColumnVisibility(this, this.visible); + } + + if (!silent) { + this.table.options.columnVisibilityChanged.call(this.table, this.getComponent(), false); + } + + if (this.parent.isGroup) { + this.parent.matchChildWidths(); + } + } +}; + +Column.prototype.matchChildWidths = function () { + var childWidth = 0; + + if (this.contentElement && this.columns.length) { + this.columns.forEach(function (column) { + if (column.visible) { + childWidth += column.getWidth(); + } + }); + + this.contentElement.style.maxWidth = childWidth - 1 + "px"; + + if (this.parent.isGroup) { + this.parent.matchChildWidths(); + } + } +}; + +Column.prototype.setWidth = function (width) { + this.widthFixed = true; + this.setWidthActual(width); +}; + +Column.prototype.setWidthActual = function (width) { + if (isNaN(width)) { + width = Math.floor(this.table.element.clientWidth / 100 * parseInt(width)); + } + + width = Math.max(this.minWidth, width); + + this.width = width; + this.widthStyled = width ? width + "px" : ""; + + this.element.style.width = this.widthStyled; + + if (!this.isGroup) { + this.cells.forEach(function (cell) { + cell.setWidth(); + }); + } + + if (this.parent.isGroup) { + this.parent.matchChildWidths(); + } + + //set resizable handles + if (this.table.modExists("frozenColumns")) { + this.table.modules.frozenColumns.layout(); + } +}; + +Column.prototype.checkCellHeights = function () { + var rows = []; + + this.cells.forEach(function (cell) { + if (cell.row.heightInitialized) { + if (cell.row.getElement().offsetParent !== null) { + rows.push(cell.row); + cell.row.clearCellHeight(); + } else { + cell.row.heightInitialized = false; + } + } + }); + + rows.forEach(function (row) { + row.calcHeight(); + }); + + rows.forEach(function (row) { + row.setCellHeight(); + }); +}; + +Column.prototype.getWidth = function () { + var width = 0; + + if (this.isGroup) { + this.columns.forEach(function (column) { + if (column.visible) { + width += column.getWidth(); + } + }); + } else { + width = this.width; + } + + return width; +}; + +Column.prototype.getHeight = function () { + return this.element.offsetHeight; +}; + +Column.prototype.setMinWidth = function (minWidth) { + this.minWidth = minWidth; + this.minWidthStyled = minWidth ? minWidth + "px" : ""; + + this.element.style.minWidth = this.minWidthStyled; + + this.cells.forEach(function (cell) { + cell.setMinWidth(); + }); +}; + +Column.prototype.delete = function () { + var _this9 = this; + + return new Promise(function (resolve, reject) { + + if (_this9.isGroup) { + _this9.columns.forEach(function (column) { + column.delete(); + }); + } + + //cancel edit if column is currently being edited + if (_this9.table.modExists("edit")) { + if (_this9.table.modules.edit.currentCell.column === _this9) { + _this9.table.modules.edit.cancelEdit(); + } + } + + var cellCount = _this9.cells.length; + + for (var _i3 = 0; _i3 < cellCount; _i3++) { + _this9.cells[0].delete(); + } + + if (_this9.element.parentNode) { + _this9.element.parentNode.removeChild(_this9.element); + } + + _this9.element = false; + _this9.contentElement = false; + _this9.titleElement = false; + _this9.groupElement = false; + + _this9.table.columnManager.deregisterColumn(_this9); + + if (_this9.table.options.virtualDomHoz) { + _this9.table.vdomHoz.reinitialize(true); + } + + resolve(); + }); +}; + +Column.prototype.columnRendered = function () { + if (this.titleFormatterRendered) { + this.titleFormatterRendered(); + } +}; + +Column.prototype.validate = function () { + var invalid = []; + + this.cells.forEach(function (cell) { + if (!cell.validate()) { + invalid.push(cell.getComponent()); + } + }); + + return invalid.length ? invalid : true; +}; + +//////////////// Cell Management ///////////////// + +//generate cell for this column +Column.prototype.generateCell = function (row) { + var self = this; + + var cell = new Cell(self, row); + + this.cells.push(cell); + + return cell; +}; + +Column.prototype.nextColumn = function () { + var index = this.table.columnManager.findColumnIndex(this); + return index > -1 ? this._nextVisibleColumn(index + 1) : false; +}; + +Column.prototype._nextVisibleColumn = function (index) { + var column = this.table.columnManager.getColumnByIndex(index); + return !column || column.visible ? column : this._nextVisibleColumn(index + 1); +}; + +Column.prototype.prevColumn = function () { + var index = this.table.columnManager.findColumnIndex(this); + return index > -1 ? this._prevVisibleColumn(index - 1) : false; +}; + +Column.prototype._prevVisibleColumn = function (index) { + var column = this.table.columnManager.getColumnByIndex(index); + return !column || column.visible ? column : this._prevVisibleColumn(index - 1); +}; + +Column.prototype.reinitializeWidth = function (force) { + this.widthFixed = false; + + //set width if present + if (typeof this.definition.width !== "undefined" && !force) { + this.setWidth(this.definition.width); + } + + //hide header filters to prevent them altering column width + if (this.table.modExists("filter")) { + this.table.modules.filter.hideHeaderFilterElements(); + } + + this.fitToData(); + + //show header filters again after layout is complete + if (this.table.modExists("filter")) { + this.table.modules.filter.showHeaderFilterElements(); + } +}; + +//set column width to maximum cell width +Column.prototype.fitToData = function () { + var self = this; + + if (!this.widthFixed) { + this.element.style.width = ""; + + self.cells.forEach(function (cell) { + cell.clearWidth(); + }); + } + + var maxWidth = this.element.offsetWidth; + + if (!self.width || !this.widthFixed) { + self.cells.forEach(function (cell) { + var width = cell.getWidth(); + + if (width > maxWidth) { + maxWidth = width; + } + }); + + if (maxWidth) { + self.setWidthActual(maxWidth + 1); + } + } +}; + +Column.prototype.updateDefinition = function (updates) { + var _this10 = this; + + return new Promise(function (resolve, reject) { + var definition; + + if (!_this10.isGroup) { + definition = Object.assign({}, _this10.getDefinition()); + definition = Object.assign(definition, updates); + + _this10.table.columnManager.addColumn(definition, false, _this10).then(function (column) { + + if (definition.field == _this10.field) { + _this10.field = false; //cleair field name to prevent deletion of duplicate column from arrays + } + + _this10.delete().then(function () { + resolve(column.getComponent()); + }).catch(function (err) { + reject(err); + }); + }).catch(function (err) { + reject(err); + }); + } else { + console.warn("Column Update Error - The updateDefinition function is only available on columns, not column groups"); + reject("Column Update Error - The updateDefinition function is only available on columns, not column groups"); + } + }); +}; + +Column.prototype.deleteCell = function (cell) { + var index = this.cells.indexOf(cell); + + if (index > -1) { + this.cells.splice(index, 1); + } +}; + +Column.prototype.defaultOptionList = ["title", "field", "columns", "visible", "align", "hozAlign", "vertAlign", "width", "minWidth", "widthGrow", "widthShrink", "resizable", "frozen", "responsive", "tooltip", "cssClass", "rowHandle", "hideInHtml", "print", "htmlOutput", "sorter", "sorterParams", "formatter", "formatterParams", "variableHeight", "editable", "editor", "editorParams", "validator", "mutator", "mutatorParams", "mutatorData", "mutatorDataParams", "mutatorEdit", "mutatorEditParams", "mutatorClipboard", "mutatorClipboardParams", "accessor", "accessorParams", "accessorData", "accessorDataParams", "accessorDownload", "accessorDownloadParams", "accessorClipboard", "accessorClipboardParams", "accessorPrint", "accessorPrintParams", "accessorHtmlOutput", "accessorHtmlOutputParams", "clipboard", "download", "downloadTitle", "topCalc", "topCalcParams", "topCalcFormatter", "topCalcFormatterParams", "bottomCalc", "bottomCalcParams", "bottomCalcFormatter", "bottomCalcFormatterParams", "cellClick", "cellDblClick", "cellContext", "cellTap", "cellDblTap", "cellTapHold", "cellMouseEnter", "cellMouseLeave", "cellMouseOver", "cellMouseOut", "cellMouseMove", "cellEditing", "cellEdited", "cellEditCancelled", "headerSort", "headerSortStartingDir", "headerSortTristate", "headerClick", "headerDblClick", "headerContext", "headerTap", "headerDblTap", "headerTapHold", "headerTooltip", "headerVertical", "headerHozAlign", "editableTitle", "titleFormatter", "titleFormatterParams", "headerFilter", "headerFilterPlaceholder", "headerFilterParams", "headerFilterEmptyCheck", "headerFilterFunc", "headerFilterFuncParams", "headerFilterLiveFilter", "print", "headerContextMenu", "headerMenu", "contextMenu", +// "headerClickMenu", +"clickMenu", "formatterPrint", "formatterPrintParams", "formatterClipboard", "formatterClipboardParams", "formatterHtmlOutput", "formatterHtmlOutputParams", "titlePrint", "titleClipboard", "titleHtmlOutput", "titleDownload"]; + +//////////////// Event Bindings ///////////////// + +//////////////// Object Generation ///////////////// +Column.prototype.getComponent = function () { + if (!this.component) { + this.component = new ColumnComponent(this); + } + + return this.component; +}; + +var RowManager = function RowManager(table) { + + this.table = table; + this.element = this.createHolderElement(); //containing element + this.tableElement = this.createTableElement(); //table element + this.heightFixer = this.createTableElement(); //table element + this.columnManager = null; //hold column manager object + this.height = 0; //hold height of table element + + this.firstRender = false; //handle first render + this.renderMode = "virtual"; //current rendering mode + this.fixedHeight = false; //current rendering mode + + this.rows = []; //hold row data objects + this.activeRows = []; //rows currently available to on display in the table + this.activeRowsCount = 0; //count of active rows + + this.displayRows = []; //rows currently on display in the table + this.displayRowsCount = 0; //count of display rows + + this.scrollTop = 0; + this.scrollLeft = 0; + + this.vDomRowHeight = 20; //approximation of row heights for padding + + this.vDomTop = 0; //hold position for first rendered row in the virtual DOM + this.vDomBottom = 0; //hold possition for last rendered row in the virtual DOM + + this.vDomScrollPosTop = 0; //last scroll position of the vDom top; + this.vDomScrollPosBottom = 0; //last scroll position of the vDom bottom; + + this.vDomTopPad = 0; //hold value of padding for top of virtual DOM + this.vDomBottomPad = 0; //hold value of padding for bottom of virtual DOM + + this.vDomMaxRenderChain = 90; //the maximum number of dom elements that can be rendered in 1 go + + this.vDomWindowBuffer = 0; //window row buffer before removing elements, to smooth scrolling + + this.vDomWindowMinTotalRows = 20; //minimum number of rows to be generated in virtual dom (prevent buffering issues on tables with tall rows) + this.vDomWindowMinMarginRows = 5; //minimum number of rows to be generated in virtual dom margin + + this.vDomTopNewRows = []; //rows to normalize after appending to optimize render speed + this.vDomBottomNewRows = []; //rows to normalize after appending to optimize render speed + + this.rowNumColumn = false; //hold column component for row number column + + this.redrawBlock = false; //prevent redraws to allow multiple data manipulations becore continuing + this.redrawBlockRestoreConfig = false; //store latest redraw function calls for when redraw is needed + this.redrawBlockRederInPosition = false; //store latest redraw function calls for when redraw is needed +}; + +//////////////// Setup Functions ///////////////// + +RowManager.prototype.createHolderElement = function () { + var el = document.createElement("div"); + + el.classList.add("tabulator-tableHolder"); + el.setAttribute("tabindex", 0); + + return el; +}; + +RowManager.prototype.createTableElement = function () { + var el = document.createElement("div"); + + el.classList.add("tabulator-table"); + + return el; +}; + +//return containing element +RowManager.prototype.getElement = function () { + return this.element; +}; + +//return table element +RowManager.prototype.getTableElement = function () { + return this.tableElement; +}; + +//return position of row in table +RowManager.prototype.getRowPosition = function (row, active) { + if (active) { + return this.activeRows.indexOf(row); + } else { + return this.rows.indexOf(row); + } +}; + +//link to column manager +RowManager.prototype.setColumnManager = function (manager) { + this.columnManager = manager; +}; + +RowManager.prototype.initialize = function () { + var self = this; + + self.setRenderMode(); + + //initialize manager + self.element.appendChild(self.tableElement); + + self.firstRender = true; + + //scroll header along with table body + self.element.addEventListener("scroll", function () { + var left = self.element.scrollLeft; + + //handle horizontal scrolling + if (self.scrollLeft != left) { + self.columnManager.scrollHorizontal(left); + + if (self.table.options.groupBy) { + self.table.modules.groupRows.scrollHeaders(left); + } + + if (self.table.modExists("columnCalcs")) { + self.table.modules.columnCalcs.scrollHorizontal(left); + } + + self.table.options.scrollHorizontal(left); + } + + self.scrollLeft = left; + }); + + //handle virtual dom scrolling + if (this.renderMode === "virtual") { + + self.element.addEventListener("scroll", function () { + var top = self.element.scrollTop; + var dir = self.scrollTop > top; + + //handle verical scrolling + if (self.scrollTop != top) { + self.scrollTop = top; + self.scrollVertical(dir); + + if (self.table.options.ajaxProgressiveLoad == "scroll") { + self.table.modules.ajax.nextPage(self.element.scrollHeight - self.element.clientHeight - top); + } + + self.table.options.scrollVertical(top); + } else { + self.scrollTop = top; + } + }); + } +}; + +////////////////// Row Manipulation ////////////////// + +RowManager.prototype.findRow = function (subject) { + var self = this; + + if ((typeof subject === 'undefined' ? 'undefined' : _typeof(subject)) == "object") { + + if (subject instanceof Row) { + //subject is row element + return subject; + } else if (subject instanceof RowComponent) { + //subject is public row component + return subject._getSelf() || false; + } else if (typeof HTMLElement !== "undefined" && subject instanceof HTMLElement) { + //subject is a HTML element of the row + var match = self.rows.find(function (row) { + return row.element === subject; + }); + + return match || false; + } + } else if (typeof subject == "undefined" || subject === null) { + return false; + } else { + //subject should be treated as the index of the row + var _match = self.rows.find(function (row) { + return row.data[self.table.options.index] == subject; + }); + + return _match || false; + } + + //catch all for any other type of input + + return false; +}; + +RowManager.prototype.getRowFromDataObject = function (data) { + var match = this.rows.find(function (row) { + return row.data === data; + }); + + return match || false; +}; + +RowManager.prototype.getRowFromPosition = function (position, active) { + if (active) { + return this.activeRows[position]; + } else { + return this.rows[position]; + } +}; + +RowManager.prototype.scrollToRow = function (row, position, ifVisible) { + var _this11 = this; + + var rowIndex = this.getDisplayRows().indexOf(row), + rowEl = row.getElement(), + rowTop, + offset = 0; + + return new Promise(function (resolve, reject) { + if (rowIndex > -1) { + + if (typeof position === "undefined") { + position = _this11.table.options.scrollToRowPosition; + } + + if (typeof ifVisible === "undefined") { + ifVisible = _this11.table.options.scrollToRowIfVisible; + } + + if (position === "nearest") { + switch (_this11.renderMode) { + case "classic": + rowTop = Tabulator.prototype.helpers.elOffset(rowEl).top; + position = Math.abs(_this11.element.scrollTop - rowTop) > Math.abs(_this11.element.scrollTop + _this11.element.clientHeight - rowTop) ? "bottom" : "top"; + break; + case "virtual": + position = Math.abs(_this11.vDomTop - rowIndex) > Math.abs(_this11.vDomBottom - rowIndex) ? "bottom" : "top"; + break; + } + } + + //check row visibility + if (!ifVisible) { + if (Tabulator.prototype.helpers.elVisible(rowEl)) { + offset = Tabulator.prototype.helpers.elOffset(rowEl).top - Tabulator.prototype.helpers.elOffset(_this11.element).top; + + if (offset > 0 && offset < _this11.element.clientHeight - rowEl.offsetHeight) { + return false; + } + } + } + + //scroll to row + switch (_this11.renderMode) { + case "classic": + _this11.element.scrollTop = Tabulator.prototype.helpers.elOffset(rowEl).top - Tabulator.prototype.helpers.elOffset(_this11.element).top + _this11.element.scrollTop; + break; + case "virtual": + _this11._virtualRenderFill(rowIndex, true); + break; + } + + //align to correct position + switch (position) { + case "middle": + case "center": + + if (_this11.element.scrollHeight - _this11.element.scrollTop == _this11.element.clientHeight) { + _this11.element.scrollTop = _this11.element.scrollTop + (rowEl.offsetTop - _this11.element.scrollTop) - (_this11.element.scrollHeight - rowEl.offsetTop) / 2; + } else { + _this11.element.scrollTop = _this11.element.scrollTop - _this11.element.clientHeight / 2; + } + + break; + + case "bottom": + + if (_this11.element.scrollHeight - _this11.element.scrollTop == _this11.element.clientHeight) { + _this11.element.scrollTop = _this11.element.scrollTop - (_this11.element.scrollHeight - rowEl.offsetTop) + rowEl.offsetHeight; + } else { + _this11.element.scrollTop = _this11.element.scrollTop - _this11.element.clientHeight + rowEl.offsetHeight; + } + + break; + } + + resolve(); + } else { + console.warn("Scroll Error - Row not visible"); + reject("Scroll Error - Row not visible"); + } + }); +}; + +////////////////// Data Handling ////////////////// + +RowManager.prototype.setData = function (data, renderInPosition, columnsChanged) { + var _this12 = this; + + var self = this; + + return new Promise(function (resolve, reject) { + if (renderInPosition && _this12.getDisplayRows().length) { + if (self.table.options.pagination) { + self._setDataActual(data, true); + } else { + _this12.reRenderInPosition(function () { + self._setDataActual(data); + }); + } + } else { + if (_this12.table.options.autoColumns && columnsChanged) { + _this12.table.columnManager.generateColumnsFromRowData(data); + } + _this12.resetScroll(); + + _this12._setDataActual(data); + } + + resolve(); + }); +}; + +RowManager.prototype._setDataActual = function (data, renderInPosition) { + var self = this; + + self.table.options.dataLoading.call(this.table, data); + + this._wipeElements(); + + if (this.table.options.history && this.table.modExists("history")) { + this.table.modules.history.clear(); + } + + if (Array.isArray(data)) { + + if (this.table.modExists("selectRow")) { + this.table.modules.selectRow.clearSelectionData(); + } + + if (this.table.options.reactiveData && this.table.modExists("reactiveData", true)) { + this.table.modules.reactiveData.watchData(data); + } + + data.forEach(function (def, i) { + if (def && (typeof def === 'undefined' ? 'undefined' : _typeof(def)) === "object") { + var row = new Row(def, self); + self.rows.push(row); + } else { + console.warn("Data Loading Warning - Invalid row data detected and ignored, expecting object but received:", def); + } + }); + + self.refreshActiveData(false, false, renderInPosition); + + self.table.options.dataLoaded.call(this.table, data); + } else { + console.error("Data Loading Error - Unable to process data due to invalid data type \nExpecting: array \nReceived: ", typeof data === 'undefined' ? 'undefined' : _typeof(data), "\nData: ", data); + } +}; + +RowManager.prototype._wipeElements = function () { + this.rows.forEach(function (row) { + row.wipe(); + }); + + if (this.table.options.groupBy && this.table.modExists("groupRows")) { + this.table.modules.groupRows.wipe(); + } + + this.rows = []; + this.activeRows = []; + this.activeRowsCount = 0; + this.displayRows = []; + this.displayRowsCount = 0; + + this.adjustTableSize(); +}; + +RowManager.prototype.deleteRow = function (row, blockRedraw) { + var allIndex = this.rows.indexOf(row), + activeIndex = this.activeRows.indexOf(row); + + if (activeIndex > -1) { + this.activeRows.splice(activeIndex, 1); + } + + if (allIndex > -1) { + this.rows.splice(allIndex, 1); + } + + this.setActiveRows(this.activeRows); + + this.displayRowIterator(function (rows) { + var displayIndex = rows.indexOf(row); + + if (displayIndex > -1) { + rows.splice(displayIndex, 1); + } + }); + + if (!blockRedraw) { + this.reRenderInPosition(); + } + + this.regenerateRowNumbers(); + + this.table.options.rowDeleted.call(this.table, row.getComponent()); + + if (this.table.options.dataChanged) { + this.table.options.dataChanged.call(this.table, this.getData()); + } + + if (this.table.options.groupBy && this.table.modExists("groupRows")) { + this.table.modules.groupRows.updateGroupRows(true); + } else if (this.table.options.pagination && this.table.modExists("page")) { + this.refreshActiveData(false, false, true); + } else { + if (this.table.options.pagination && this.table.modExists("page")) { + this.refreshActiveData("page"); + } + } +}; + +RowManager.prototype.addRow = function (data, pos, index, blockRedraw) { + + var row = this.addRowActual(data, pos, index, blockRedraw); + + if (this.table.options.history && this.table.modExists("history")) { + this.table.modules.history.action("rowAdd", row, { data: data, pos: pos, index: index }); + } + + return row; +}; + +//add multiple rows +RowManager.prototype.addRows = function (data, pos, index) { + var _this13 = this; + + var self = this, + length = 0, + rows = []; + + return new Promise(function (resolve, reject) { + pos = _this13.findAddRowPos(pos); + + if (!Array.isArray(data)) { + data = [data]; + } + + length = data.length - 1; + + if (typeof index == "undefined" && pos || typeof index !== "undefined" && !pos) { + data.reverse(); + } + + data.forEach(function (item, i) { + var row = self.addRow(item, pos, index, true); + rows.push(row); + }); + + if (_this13.table.options.groupBy && _this13.table.modExists("groupRows")) { + _this13.table.modules.groupRows.updateGroupRows(true); + } else if (_this13.table.options.pagination && _this13.table.modExists("page")) { + _this13.refreshActiveData(false, false, true); + } else { + _this13.reRenderInPosition(); + } + + //recalc column calculations if present + if (_this13.table.modExists("columnCalcs")) { + _this13.table.modules.columnCalcs.recalc(_this13.table.rowManager.activeRows); + } + + _this13.regenerateRowNumbers(); + resolve(rows); + }); +}; + +RowManager.prototype.findAddRowPos = function (pos) { + if (typeof pos === "undefined") { + pos = this.table.options.addRowPos; + } + + if (pos === "pos") { + pos = true; + } + + if (pos === "bottom") { + pos = false; + } + + return pos; +}; + +RowManager.prototype.addRowActual = function (data, pos, index, blockRedraw) { + var row = data instanceof Row ? data : new Row(data || {}, this), + top = this.findAddRowPos(pos), + allIndex = -1, + activeIndex, + dispRows; + + if (!index && this.table.options.pagination && this.table.options.paginationAddRow == "page") { + dispRows = this.getDisplayRows(); + + if (top) { + if (dispRows.length) { + index = dispRows[0]; + } else { + if (this.activeRows.length) { + index = this.activeRows[this.activeRows.length - 1]; + top = false; + } + } + } else { + if (dispRows.length) { + index = dispRows[dispRows.length - 1]; + top = dispRows.length < this.table.modules.page.getPageSize() ? false : true; + } + } + } + + if (typeof index !== "undefined") { + index = this.findRow(index); + } + + if (this.table.options.groupBy && this.table.modExists("groupRows")) { + this.table.modules.groupRows.assignRowToGroup(row); + + var groupRows = row.getGroup().rows; + + if (groupRows.length > 1) { + + if (!index || index && groupRows.indexOf(index) == -1) { + if (top) { + if (groupRows[0] !== row) { + index = groupRows[0]; + this._moveRowInArray(row.getGroup().rows, row, index, !top); + } + } else { + if (groupRows[groupRows.length - 1] !== row) { + index = groupRows[groupRows.length - 1]; + this._moveRowInArray(row.getGroup().rows, row, index, !top); + } + } + } else { + this._moveRowInArray(row.getGroup().rows, row, index, !top); + } + } + } + + if (index) { + allIndex = this.rows.indexOf(index); + } + + if (index && allIndex > -1) { + activeIndex = this.activeRows.indexOf(index); + + this.displayRowIterator(function (rows) { + var displayIndex = rows.indexOf(index); + + if (displayIndex > -1) { + rows.splice(top ? displayIndex : displayIndex + 1, 0, row); + } + }); + + if (activeIndex > -1) { + this.activeRows.splice(top ? activeIndex : activeIndex + 1, 0, row); + } + + this.rows.splice(top ? allIndex : allIndex + 1, 0, row); + } else { + + if (top) { + + this.displayRowIterator(function (rows) { + rows.unshift(row); + }); + + this.activeRows.unshift(row); + this.rows.unshift(row); + } else { + this.displayRowIterator(function (rows) { + rows.push(row); + }); + + this.activeRows.push(row); + this.rows.push(row); + } + } + + this.setActiveRows(this.activeRows); + + this.table.options.rowAdded.call(this.table, row.getComponent()); + + if (this.table.options.dataChanged) { + this.table.options.dataChanged.call(this.table, this.getData()); + } + + if (!blockRedraw) { + this.reRenderInPosition(); + } + + return row; +}; + +RowManager.prototype.moveRow = function (from, to, after) { + if (this.table.options.history && this.table.modExists("history")) { + this.table.modules.history.action("rowMove", from, { posFrom: this.getRowPosition(from), posTo: this.getRowPosition(to), to: to, after: after }); + } + + this.moveRowActual(from, to, after); + + this.regenerateRowNumbers(); + + this.table.options.rowMoved.call(this.table, from.getComponent()); +}; + +RowManager.prototype.moveRowActual = function (from, to, after) { + var _this14 = this; + + this._moveRowInArray(this.rows, from, to, after); + this._moveRowInArray(this.activeRows, from, to, after); + + this.displayRowIterator(function (rows) { + _this14._moveRowInArray(rows, from, to, after); + }); + + if (this.table.options.groupBy && this.table.modExists("groupRows")) { + + if (!after && to instanceof Group) { + to = this.table.rowManager.prevDisplayRow(from) || to; + } + + var toGroup = to.getGroup(); + var fromGroup = from.getGroup(); + + if (toGroup === fromGroup) { + this._moveRowInArray(toGroup.rows, from, to, after); + } else { + if (fromGroup) { + fromGroup.removeRow(from); + } + + toGroup.insertRow(from, to, after); + } + } +}; + +RowManager.prototype._moveRowInArray = function (rows, from, to, after) { + var fromIndex, toIndex, start, end; + + if (from !== to) { + + fromIndex = rows.indexOf(from); + + if (fromIndex > -1) { + + rows.splice(fromIndex, 1); + + toIndex = rows.indexOf(to); + + if (toIndex > -1) { + + if (after) { + rows.splice(toIndex + 1, 0, from); + } else { + rows.splice(toIndex, 0, from); + } + } else { + rows.splice(fromIndex, 0, from); + } + } + + //restyle rows + if (rows === this.getDisplayRows()) { + + start = fromIndex < toIndex ? fromIndex : toIndex; + end = toIndex > fromIndex ? toIndex : fromIndex + 1; + + for (var _i4 = start; _i4 <= end; _i4++) { + if (rows[_i4]) { + this.styleRow(rows[_i4], _i4); + } + } + } + } +}; + +RowManager.prototype.clearData = function () { + this.setData([]); +}; + +RowManager.prototype.getRowIndex = function (row) { + return this.findRowIndex(row, this.rows); +}; + +RowManager.prototype.getDisplayRowIndex = function (row) { + var index = this.getDisplayRows().indexOf(row); + return index > -1 ? index : false; +}; + +RowManager.prototype.nextDisplayRow = function (row, rowOnly) { + var index = this.getDisplayRowIndex(row), + nextRow = false; + + if (index !== false && index < this.displayRowsCount - 1) { + nextRow = this.getDisplayRows()[index + 1]; + } + + if (nextRow && (!(nextRow instanceof Row) || nextRow.type != "row")) { + return this.nextDisplayRow(nextRow, rowOnly); + } + + return nextRow; +}; + +RowManager.prototype.prevDisplayRow = function (row, rowOnly) { + var index = this.getDisplayRowIndex(row), + prevRow = false; + + if (index) { + prevRow = this.getDisplayRows()[index - 1]; + } + + if (rowOnly && prevRow && (!(prevRow instanceof Row) || prevRow.type != "row")) { + return this.prevDisplayRow(prevRow, rowOnly); + } + + return prevRow; +}; + +RowManager.prototype.findRowIndex = function (row, list) { + var rowIndex; + + row = this.findRow(row); + + if (row) { + rowIndex = list.indexOf(row); + + if (rowIndex > -1) { + return rowIndex; + } + } + + return false; +}; + +RowManager.prototype.getData = function (active, transform) { + var output = [], + rows = this.getRows(active); + + rows.forEach(function (row) { + if (row.type == "row") { + output.push(row.getData(transform || "data")); + } + }); + + return output; +}; + +RowManager.prototype.getComponents = function (active) { + var output = [], + rows = this.getRows(active); + + rows.forEach(function (row) { + output.push(row.getComponent()); + }); + + return output; +}; + +RowManager.prototype.getDataCount = function (active) { + var rows = this.getRows(active); + + return rows.length; +}; + +RowManager.prototype._genRemoteRequest = function () { + var _this15 = this; + + var table = this.table, + options = table.options, + params = {}; + + if (table.modExists("page")) { + //set sort data if defined + if (options.ajaxSorting) { + var sorters = this.table.modules.sort.getSort(); + + sorters.forEach(function (item) { + delete item.column; + }); + + params[this.table.modules.page.paginationDataSentNames.sorters] = sorters; + } + + //set filter data if defined + if (options.ajaxFiltering) { + var filters = this.table.modules.filter.getFilters(true, true); + + params[this.table.modules.page.paginationDataSentNames.filters] = filters; + } + + this.table.modules.ajax.setParams(params, true); + } + + table.modules.ajax.sendRequest().then(function (data) { + _this15._setDataActual(data, true); + }).catch(function (e) {}); +}; + +//choose the path to refresh data after a filter update +RowManager.prototype.filterRefresh = function () { + var table = this.table, + options = table.options, + left = this.scrollLeft; + + if (options.ajaxFiltering) { + if (options.pagination == "remote" && table.modExists("page")) { + table.modules.page.reset(true); + table.modules.page.setPage(1).then(function () {}).catch(function () {}); + } else if (options.ajaxProgressiveLoad) { + table.modules.ajax.loadData().then(function () {}).catch(function () {}); + } else { + //assume data is url, make ajax call to url to get data + this._genRemoteRequest(); + } + } else { + this.refreshActiveData("filter"); + } + + this.scrollHorizontal(left); +}; + +//choose the path to refresh data after a sorter update +RowManager.prototype.sorterRefresh = function (loadOrignalData) { + var table = this.table, + options = this.table.options, + left = this.scrollLeft; + + if (options.ajaxSorting) { + if ((options.pagination == "remote" || options.progressiveLoad) && table.modExists("page")) { + table.modules.page.reset(true); + table.modules.page.setPage(1).then(function () {}).catch(function () {}); + } else if (options.ajaxProgressiveLoad) { + table.modules.ajax.loadData().then(function () {}).catch(function () {}); + } else { + //assume data is url, make ajax call to url to get data + this._genRemoteRequest(); + } + } else { + this.refreshActiveData(loadOrignalData ? "filter" : "sort"); + } + + this.scrollHorizontal(left); +}; + +RowManager.prototype.scrollHorizontal = function (left) { + this.scrollLeft = left; + this.element.scrollLeft = left; + + if (this.table.options.groupBy) { + this.table.modules.groupRows.scrollHeaders(left); + } + + if (this.table.modExists("columnCalcs")) { + this.table.modules.columnCalcs.scrollHorizontal(left); + } +}; + +//set active data set +RowManager.prototype.refreshActiveData = function (stage, skipStage, renderInPosition) { + var self = this, + table = this.table, + cascadeOrder = ["all", "filter", "sort", "display", "freeze", "group", "tree", "page"], + displayIndex; + + if (this.redrawBlock) { + + if (!this.redrawBlockRestoreConfig || cascadeOrder.indexOf(stage) < cascadeOrder.indexOf(this.redrawBlockRestoreConfig.stage)) { + this.redrawBlockRestoreConfig = { + stage: stage, + skipStage: skipStage, + renderInPosition: renderInPosition + }; + } + + return; + } else { + + if (self.table.modExists("edit")) { + self.table.modules.edit.cancelEdit(); + } + + if (!stage) { + stage = "all"; + } + + if (table.options.selectable && !table.options.selectablePersistence && table.modExists("selectRow")) { + table.modules.selectRow.deselectRows(); + } + + //cascade through data refresh stages + switch (stage) { + case "all": + + case "filter": + if (!skipStage) { + if (table.modExists("filter")) { + self.setActiveRows(table.modules.filter.filter(self.rows)); + } else { + self.setActiveRows(self.rows.slice(0)); + } + } else { + skipStage = false; + } + + case "sort": + if (!skipStage) { + if (table.modExists("sort")) { + table.modules.sort.sort(this.activeRows); + } + } else { + skipStage = false; + } + + //regenerate row numbers for row number formatter if in use + this.regenerateRowNumbers(); + + //generic stage to allow for pipeline trigger after the data manipulation stage + case "display": + this.resetDisplayRows(); + + case "freeze": + if (!skipStage) { + if (this.table.modExists("frozenRows")) { + if (table.modules.frozenRows.isFrozen()) { + if (!table.modules.frozenRows.getDisplayIndex()) { + table.modules.frozenRows.setDisplayIndex(this.getNextDisplayIndex()); + } + + displayIndex = table.modules.frozenRows.getDisplayIndex(); + + displayIndex = self.setDisplayRows(table.modules.frozenRows.getRows(this.getDisplayRows(displayIndex - 1)), displayIndex); + + if (displayIndex !== true) { + table.modules.frozenRows.setDisplayIndex(displayIndex); + } + } + } + } else { + skipStage = false; + } + + case "group": + if (!skipStage) { + if (table.options.groupBy && table.modExists("groupRows")) { + + if (!table.modules.groupRows.getDisplayIndex()) { + table.modules.groupRows.setDisplayIndex(this.getNextDisplayIndex()); + } + + displayIndex = table.modules.groupRows.getDisplayIndex(); + + displayIndex = self.setDisplayRows(table.modules.groupRows.getRows(this.getDisplayRows(displayIndex - 1)), displayIndex); + + if (displayIndex !== true) { + table.modules.groupRows.setDisplayIndex(displayIndex); + } + } + } else { + skipStage = false; + } + + case "tree": + + if (!skipStage) { + if (table.options.dataTree && table.modExists("dataTree")) { + if (!table.modules.dataTree.getDisplayIndex()) { + table.modules.dataTree.setDisplayIndex(this.getNextDisplayIndex()); + } + + displayIndex = table.modules.dataTree.getDisplayIndex(); + + displayIndex = self.setDisplayRows(table.modules.dataTree.getRows(this.getDisplayRows(displayIndex - 1)), displayIndex); + + if (displayIndex !== true) { + table.modules.dataTree.setDisplayIndex(displayIndex); + } + } + } else { + skipStage = false; + } + + if (table.options.pagination && table.modExists("page") && !renderInPosition) { + if (table.modules.page.getMode() == "local") { + table.modules.page.reset(); + } + } + + case "page": + if (!skipStage) { + if (table.options.pagination && table.modExists("page")) { + + if (!table.modules.page.getDisplayIndex()) { + table.modules.page.setDisplayIndex(this.getNextDisplayIndex()); + } + + displayIndex = table.modules.page.getDisplayIndex(); + + if (table.modules.page.getMode() == "local") { + table.modules.page.setMaxRows(this.getDisplayRows(displayIndex - 1).length); + } + + displayIndex = self.setDisplayRows(table.modules.page.getRows(this.getDisplayRows(displayIndex - 1)), displayIndex); + + if (displayIndex !== true) { + table.modules.page.setDisplayIndex(displayIndex); + } + } + } else { + skipStage = false; + } + } + + if (Tabulator.prototype.helpers.elVisible(self.element)) { + if (renderInPosition) { + self.reRenderInPosition(); + } else { + + if (stage === "all" && this.table.options.virtualDomHoz) { + this.table.vdomHoz.dataChange(); + } + + self.renderTable(); + + if (table.options.layoutColumnsOnNewData) { + self.table.columnManager.redraw(true); + } + } + } + + if (table.modExists("columnCalcs")) { + table.modules.columnCalcs.recalc(this.activeRows); + } + } +}; + +//regenerate row numbers for row number formatter if in use +RowManager.prototype.regenerateRowNumbers = function () { + var _this16 = this; + + if (this.rowNumColumn) { + this.activeRows.forEach(function (row) { + var cell = row.getCell(_this16.rowNumColumn); + + if (cell) { + cell._generateContents(); + } + }); + } +}; + +RowManager.prototype.setActiveRows = function (activeRows) { + this.activeRows = activeRows; + this.activeRowsCount = this.activeRows.length; +}; + +//reset display rows array +RowManager.prototype.resetDisplayRows = function () { + this.displayRows = []; + + this.displayRows.push(this.activeRows.slice(0)); + + this.displayRowsCount = this.displayRows[0].length; + + if (this.table.modExists("frozenRows")) { + this.table.modules.frozenRows.setDisplayIndex(0); + } + + if (this.table.options.groupBy && this.table.modExists("groupRows")) { + this.table.modules.groupRows.setDisplayIndex(0); + } + + if (this.table.options.pagination && this.table.modExists("page")) { + this.table.modules.page.setDisplayIndex(0); + } +}; + +RowManager.prototype.getNextDisplayIndex = function () { + return this.displayRows.length; +}; + +//set display row pipeline data +RowManager.prototype.setDisplayRows = function (displayRows, index) { + + var output = true; + + if (index && typeof this.displayRows[index] != "undefined") { + this.displayRows[index] = displayRows; + output = true; + } else { + this.displayRows.push(displayRows); + output = index = this.displayRows.length - 1; + } + + if (index == this.displayRows.length - 1) { + this.displayRowsCount = this.displayRows[this.displayRows.length - 1].length; + } + + return output; +}; + +RowManager.prototype.getDisplayRows = function (index) { + if (typeof index == "undefined") { + return this.displayRows.length ? this.displayRows[this.displayRows.length - 1] : []; + } else { + return this.displayRows[index] || []; + } +}; + +RowManager.prototype.getVisibleRows = function (viewable) { + var topEdge = this.element.scrollTop, + bottomEdge = this.element.clientHeight + topEdge, + topFound = false, + topRow = 0, + bottomRow = 0, + rows = this.getDisplayRows(); + + if (viewable) { + + this.getDisplayRows(); + for (var i = this.vDomTop; i <= this.vDomBottom; i++) { + if (rows[i]) { + if (!topFound) { + if (topEdge - rows[i].getElement().offsetTop >= 0) { + topRow = i; + } else { + topFound = true; + + if (bottomEdge - rows[i].getElement().offsetTop >= 0) { + bottomRow = i; + } else { + break; + } + } + } else { + if (bottomEdge - rows[i].getElement().offsetTop >= 0) { + bottomRow = i; + } else { + break; + } + } + } + } + } else { + topRow = this.vDomTop; + bottomRow = this.vDomBottom; + } + + return rows.slice(topRow, bottomRow + 1); +}; + +//repeat action accross display rows +RowManager.prototype.displayRowIterator = function (callback) { + this.displayRows.forEach(callback); + + this.displayRowsCount = this.displayRows[this.displayRows.length - 1].length; +}; + +//return only actual rows (not group headers etc) +RowManager.prototype.getRows = function (active) { + var rows; + + switch (active) { + case "active": + rows = this.activeRows; + break; + + case "display": + rows = this.table.rowManager.getDisplayRows(); + break; + + case "visible": + rows = this.getVisibleRows(true); + break; + + case "selected": + rows = this.table.modules.selectRow.selectedRows; + break; + + default: + rows = this.rows; + } + + return rows; +}; + +///////////////// Table Rendering ///////////////// + +//trigger rerender of table in current position +RowManager.prototype.reRenderInPosition = function (callback) { + if (this.getRenderMode() == "virtual") { + + if (this.redrawBlock) { + if (callback) { + callback(); + } else { + this.redrawBlockRederInPosition = true; + } + } else { + var scrollTop = this.element.scrollTop; + var topRow = false; + var topOffset = false; + + var left = this.scrollLeft; + + var rows = this.getDisplayRows(); + + for (var i = this.vDomTop; i <= this.vDomBottom; i++) { + + if (rows[i]) { + var diff = scrollTop - rows[i].getElement().offsetTop; + + if (topOffset === false || Math.abs(diff) < topOffset) { + topOffset = diff; + topRow = i; + } else { + break; + } + } + } + + if (callback) { + callback(); + } + + this._virtualRenderFill(topRow === false ? this.displayRowsCount - 1 : topRow, true, topOffset || 0); + + this.scrollHorizontal(left); + } + } else { + this.renderTable(); + + if (callback) { + callback(); + } + } +}; + +RowManager.prototype.setRenderMode = function () { + + if (this.table.options.virtualDom) { + + this.renderMode = "virtual"; + + if (this.table.element.clientHeight || this.table.options.height) { + this.fixedHeight = true; + } else { + this.fixedHeight = false; + } + } else { + this.renderMode = "classic"; + } +}; + +RowManager.prototype.getRenderMode = function () { + return this.renderMode; +}; + +RowManager.prototype.renderTable = function () { + + this.table.options.renderStarted.call(this.table); + + this.element.scrollTop = 0; + + switch (this.renderMode) { + case "classic": + this._simpleRender(); + break; + + case "virtual": + this._virtualRenderFill(); + break; + } + + if (this.firstRender) { + if (this.displayRowsCount) { + this.firstRender = false; + this.table.modules.layout.layout(); + } else { + this.renderEmptyScroll(); + } + } + + if (this.table.modExists("frozenColumns")) { + this.table.modules.frozenColumns.layout(); + } + + if (!this.displayRowsCount) { + if (this.table.options.placeholder) { + + this.table.options.placeholder.setAttribute("tabulator-render-mode", this.renderMode); + + this.getElement().appendChild(this.table.options.placeholder); + this.table.options.placeholder.style.width = this.table.columnManager.getWidth() + "px"; + } + } + + this.table.options.renderComplete.call(this.table); +}; + +//simple render on heightless table +RowManager.prototype._simpleRender = function () { + this._clearVirtualDom(); + + if (this.displayRowsCount) { + this.checkClassicModeGroupHeaderWidth(); + } else { + this.renderEmptyScroll(); + } +}; + +RowManager.prototype.checkClassicModeGroupHeaderWidth = function () { + var self = this, + element = this.tableElement, + onlyGroupHeaders = true; + + self.getDisplayRows().forEach(function (row, index) { + self.styleRow(row, index); + element.appendChild(row.getElement()); + row.initialize(true); + + if (row.type !== "group") { + onlyGroupHeaders = false; + } + }); + + if (onlyGroupHeaders) { + element.style.minWidth = self.table.columnManager.getWidth() + "px"; + } else { + element.style.minWidth = ""; + } +}; + +//show scrollbars on empty table div +RowManager.prototype.renderEmptyScroll = function () { + if (this.table.options.placeholder) { + this.tableElement.style.display = "none"; + } else { + this.tableElement.style.minWidth = this.table.columnManager.getWidth() + "px"; + // this.tableElement.style.minHeight = "1px"; + // this.tableElement.style.visibility = "hidden"; + } +}; + +RowManager.prototype._clearVirtualDom = function () { + var element = this.tableElement; + + if (this.table.options.placeholder && this.table.options.placeholder.parentNode) { + this.table.options.placeholder.parentNode.removeChild(this.table.options.placeholder); + } + + // element.children.detach(); + while (element.firstChild) { + element.removeChild(element.firstChild); + }element.style.paddingTop = ""; + element.style.paddingBottom = ""; + element.style.minWidth = ""; + element.style.minHeight = ""; + element.style.display = ""; + element.style.visibility = ""; + + this.scrollTop = 0; + this.scrollLeft = 0; + this.vDomTop = 0; + this.vDomBottom = 0; + this.vDomTopPad = 0; + this.vDomBottomPad = 0; +}; + +RowManager.prototype.styleRow = function (row, index) { + var rowEl = row.getElement(); + + if (index % 2) { + rowEl.classList.add("tabulator-row-even"); + rowEl.classList.remove("tabulator-row-odd"); + } else { + rowEl.classList.add("tabulator-row-odd"); + rowEl.classList.remove("tabulator-row-even"); + } +}; + +//full virtual render +RowManager.prototype._virtualRenderFill = function (position, forceMove, offset) { + var self = this, + element = self.tableElement, + holder = self.element, + topPad = 0, + rowsHeight = 0, + topPadHeight = 0, + i = 0, + onlyGroupHeaders = true, + rows = self.getDisplayRows(); + + position = position || 0; + + offset = offset || 0; + + if (!position) { + self._clearVirtualDom(); + } else { + while (element.firstChild) { + element.removeChild(element.firstChild); + } //check if position is too close to bottom of table + var heightOccupied = (self.displayRowsCount - position + 1) * self.vDomRowHeight; + + if (heightOccupied < self.height) { + position -= Math.ceil((self.height - heightOccupied) / self.vDomRowHeight); + + if (position < 0) { + position = 0; + } + } + + //calculate initial pad + topPad = Math.min(Math.max(Math.floor(self.vDomWindowBuffer / self.vDomRowHeight), self.vDomWindowMinMarginRows), position); + position -= topPad; + } + + if (self.displayRowsCount && Tabulator.prototype.helpers.elVisible(self.element)) { + + self.vDomTop = position; + + self.vDomBottom = position - 1; + + while ((rowsHeight <= self.height + self.vDomWindowBuffer || i < self.vDomWindowMinTotalRows) && self.vDomBottom < self.displayRowsCount - 1) { + var index = self.vDomBottom + 1, + row = rows[index], + rowHeight = 0; + + self.styleRow(row, index); + + element.appendChild(row.getElement()); + + row.initialize(); + + if (!row.heightInitialized) { + row.normalizeHeight(true); + } + + // if(!row.initialized){ + // row.initialize(true); + // }else{ + // if(!row.heightInitialized){ + // row.normalizeHeight(true); + // } + // } + + rowHeight = row.getHeight(); + + if (i < topPad) { + topPadHeight += rowHeight; + } else { + rowsHeight += rowHeight; + } + + if (rowHeight > this.vDomWindowBuffer) { + this.vDomWindowBuffer = rowHeight * 2; + } + + if (row.type !== "group") { + onlyGroupHeaders = false; + } + + self.vDomBottom++; + i++; + } + + if (!position) { + this.vDomTopPad = 0; + //adjust rowheight to match average of rendered elements + self.vDomRowHeight = Math.floor((rowsHeight + topPadHeight) / i); + self.vDomBottomPad = self.vDomRowHeight * (self.displayRowsCount - self.vDomBottom - 1); + + self.vDomScrollHeight = topPadHeight + rowsHeight + self.vDomBottomPad - self.height; + } else { + self.vDomTopPad = !forceMove ? self.scrollTop - topPadHeight : self.vDomRowHeight * this.vDomTop + offset; + self.vDomBottomPad = self.vDomBottom == self.displayRowsCount - 1 ? 0 : Math.max(self.vDomScrollHeight - self.vDomTopPad - rowsHeight - topPadHeight, 0); + } + + element.style.paddingTop = self.vDomTopPad + "px"; + element.style.paddingBottom = self.vDomBottomPad + "px"; + + if (forceMove) { + this.scrollTop = self.vDomTopPad + topPadHeight + offset - (this.element.scrollWidth > this.element.clientWidth ? this.element.offsetHeight - this.element.clientHeight : 0); + } + + this.scrollTop = Math.min(this.scrollTop, this.element.scrollHeight - this.height); + + //adjust for horizontal scrollbar if present (and not at top of table) + if (this.element.scrollWidth > this.element.offsetWidth && forceMove) { + this.scrollTop += this.element.offsetHeight - this.element.clientHeight; + } + + this.vDomScrollPosTop = this.scrollTop; + this.vDomScrollPosBottom = this.scrollTop; + + holder.scrollTop = this.scrollTop; + + element.style.minWidth = onlyGroupHeaders ? self.table.columnManager.getWidth() + "px" : ""; + + if (self.table.options.groupBy) { + if (self.table.modules.layout.getMode() != "fitDataFill" && self.displayRowsCount == self.table.modules.groupRows.countGroups()) { + self.tableElement.style.minWidth = self.table.columnManager.getWidth(); + } + } + } else { + this.renderEmptyScroll(); + } + + if (!this.fixedHeight) { + this.adjustTableSize(); + } +}; + +//handle vertical scrolling +RowManager.prototype.scrollVertical = function (dir) { + var topDiff = this.scrollTop - this.vDomScrollPosTop; + var bottomDiff = this.scrollTop - this.vDomScrollPosBottom; + var margin = this.vDomWindowBuffer * 2; + + if (-topDiff > margin || bottomDiff > margin) { + //if big scroll redraw table; + var left = this.scrollLeft; + this._virtualRenderFill(Math.floor(this.element.scrollTop / this.element.scrollHeight * this.displayRowsCount)); + this.scrollHorizontal(left); + } else { + + if (dir) { + //scrolling up + if (topDiff < 0) { + + this._addTopRow(-topDiff); + } + + if (bottomDiff < 0) { + + //hide bottom row if needed + if (this.vDomScrollHeight - this.scrollTop > this.vDomWindowBuffer) { + this._removeBottomRow(-bottomDiff); + } else { + this.vDomScrollPosBottom = this.scrollTop; + } + } + } else { + //scrolling down + if (topDiff >= 0) { + + //hide top row if needed + if (this.scrollTop > this.vDomWindowBuffer) { + + this._removeTopRow(topDiff); + } else { + this.vDomScrollPosTop = this.scrollTop; + } + } + + if (bottomDiff >= 0) { + + this._addBottomRow(bottomDiff); + } + } + } +}; + +RowManager.prototype._addTopRow = function (topDiff) { + var i = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0; + + var table = this.tableElement, + rows = this.getDisplayRows(); + + if (this.vDomTop) { + var index = this.vDomTop - 1, + topRow = rows[index], + topRowHeight = topRow.getHeight() || this.vDomRowHeight; + + //hide top row if needed + if (topDiff >= topRowHeight) { + this.styleRow(topRow, index); + table.insertBefore(topRow.getElement(), table.firstChild); + if (!topRow.initialized || !topRow.heightInitialized) { + this.vDomTopNewRows.push(topRow); + + if (!topRow.heightInitialized) { + topRow.clearCellHeight(); + } + } + topRow.initialize(); + + this.vDomTopPad -= topRowHeight; + + if (this.vDomTopPad < 0) { + this.vDomTopPad = index * this.vDomRowHeight; + } + + if (!index) { + this.vDomTopPad = 0; + } + + table.style.paddingTop = this.vDomTopPad + "px"; + this.vDomScrollPosTop -= topRowHeight; + this.vDomTop--; + } + + topDiff = -(this.scrollTop - this.vDomScrollPosTop); + + if (topRow.getHeight() > this.vDomWindowBuffer) { + this.vDomWindowBuffer = topRow.getHeight() * 2; + } + + if (i < this.vDomMaxRenderChain && this.vDomTop && topDiff >= (rows[this.vDomTop - 1].getHeight() || this.vDomRowHeight)) { + this._addTopRow(topDiff, i + 1); + } else { + this._quickNormalizeRowHeight(this.vDomTopNewRows); + } + } +}; + +RowManager.prototype._removeTopRow = function (topDiff) { + var table = this.tableElement, + topRow = this.getDisplayRows()[this.vDomTop], + topRowHeight = topRow.getHeight() || this.vDomRowHeight; + + if (topDiff >= topRowHeight) { + + var rowEl = topRow.getElement(); + rowEl.parentNode.removeChild(rowEl); + + this.vDomTopPad += topRowHeight; + table.style.paddingTop = this.vDomTopPad + "px"; + this.vDomScrollPosTop += this.vDomTop ? topRowHeight : topRowHeight + this.vDomWindowBuffer; + this.vDomTop++; + + topDiff = this.scrollTop - this.vDomScrollPosTop; + + this._removeTopRow(topDiff); + } +}; + +RowManager.prototype._addBottomRow = function (bottomDiff) { + var i = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0; + + var table = this.tableElement, + rows = this.getDisplayRows(); + + if (this.vDomBottom < this.displayRowsCount - 1) { + var index = this.vDomBottom + 1, + bottomRow = rows[index], + bottomRowHeight = bottomRow.getHeight() || this.vDomRowHeight; + + //hide bottom row if needed + if (bottomDiff >= bottomRowHeight) { + this.styleRow(bottomRow, index); + table.appendChild(bottomRow.getElement()); + + if (!bottomRow.initialized || !bottomRow.heightInitialized) { + this.vDomBottomNewRows.push(bottomRow); + + if (!bottomRow.heightInitialized) { + bottomRow.clearCellHeight(); + } + } + + bottomRow.initialize(); + + this.vDomBottomPad -= bottomRowHeight; + + if (this.vDomBottomPad < 0 || index == this.displayRowsCount - 1) { + this.vDomBottomPad = 0; + } + + table.style.paddingBottom = this.vDomBottomPad + "px"; + this.vDomScrollPosBottom += bottomRowHeight; + this.vDomBottom++; + } + + bottomDiff = this.scrollTop - this.vDomScrollPosBottom; + + if (bottomRow.getHeight() > this.vDomWindowBuffer) { + this.vDomWindowBuffer = bottomRow.getHeight() * 2; + } + + if (i < this.vDomMaxRenderChain && this.vDomBottom < this.displayRowsCount - 1 && bottomDiff >= (rows[this.vDomBottom + 1].getHeight() || this.vDomRowHeight)) { + this._addBottomRow(bottomDiff, i + 1); + } else { + this._quickNormalizeRowHeight(this.vDomBottomNewRows); + } + } +}; + +RowManager.prototype._removeBottomRow = function (bottomDiff) { + var table = this.tableElement, + bottomRow = this.getDisplayRows()[this.vDomBottom], + bottomRowHeight = bottomRow.getHeight() || this.vDomRowHeight; + + if (bottomDiff >= bottomRowHeight) { + + var rowEl = bottomRow.getElement(); + + if (rowEl.parentNode) { + rowEl.parentNode.removeChild(rowEl); + } + + this.vDomBottomPad += bottomRowHeight; + + if (this.vDomBottomPad < 0) { + this.vDomBottomPad = 0; + } + + table.style.paddingBottom = this.vDomBottomPad + "px"; + this.vDomScrollPosBottom -= bottomRowHeight; + this.vDomBottom--; + + bottomDiff = -(this.scrollTop - this.vDomScrollPosBottom); + + this._removeBottomRow(bottomDiff); + } +}; + +RowManager.prototype._quickNormalizeRowHeight = function (rows) { + rows.forEach(function (row) { + row.calcHeight(); + }); + + rows.forEach(function (row) { + row.setCellHeight(); + }); + + rows.length = 0; +}; + +//normalize height of active rows +RowManager.prototype.normalizeHeight = function () { + this.activeRows.forEach(function (row) { + row.normalizeHeight(); + }); +}; + +//adjust the height of the table holder to fit in the Tabulator element +RowManager.prototype.adjustTableSize = function () { + var initialHeight = this.element.clientHeight, + modExists; + + if (this.renderMode === "virtual") { + var otherHeight = Math.floor(this.columnManager.getElement().offsetHeight + (this.table.footerManager && !this.table.footerManager.external ? this.table.footerManager.getElement().offsetHeight : 0)); + + if (this.fixedHeight) { + this.element.style.minHeight = "calc(100% - " + otherHeight + "px)"; + this.element.style.height = "calc(100% - " + otherHeight + "px)"; + this.element.style.maxHeight = "calc(100% - " + otherHeight + "px)"; + } else { + this.element.style.height = ""; + this.element.style.height = Math.floor(this.table.element.clientHeight) - otherHeight + "px"; + this.element.scrollTop = this.scrollTop; + } + + this.height = this.element.clientHeight; + this.vDomWindowBuffer = this.table.options.virtualDomBuffer || this.height; + + //check if the table has changed size when dealing with variable height tables + if (!this.fixedHeight && Math.floor(initialHeight) != Math.floor(this.element.clientHeight)) { + modExists = this.table.modExists("resizeTable"); + + if (modExists && !this.table.modules.resizeTable.autoResize || !modExists) { + this.redraw(); + } + } + } +}; + +//renitialize all rows +RowManager.prototype.reinitialize = function () { + this.rows.forEach(function (row) { + row.reinitialize(true); + }); +}; + +//prevent table from being redrawn +RowManager.prototype.blockRedraw = function () { + this.redrawBlock = true; + this.redrawBlockRestoreConfig = false; +}; + +//restore table redrawing +RowManager.prototype.restoreRedraw = function () { + this.redrawBlock = false; + + if (this.redrawBlockRestoreConfig) { + this.refreshActiveData(this.redrawBlockRestoreConfig.stage, this.redrawBlockRestoreConfig.skipStage, this.redrawBlockRestoreConfig.renderInPosition); + + this.redrawBlockRestoreConfig = false; + } else { + if (this.redrawBlockRederInPosition) { + this.reRenderInPosition(); + } + } + + this.redrawBlockRederInPosition = false; +}; + +//redraw table +RowManager.prototype.redraw = function (force) { + var pos = 0, + left = this.scrollLeft; + + this.adjustTableSize(); + + this.table.tableWidth = this.table.element.clientWidth; + + if (!force) { + if (this.renderMode == "classic") { + + if (this.table.options.groupBy) { + this.refreshActiveData("group", false, false); + } else { + this._simpleRender(); + } + } else { + this.reRenderInPosition(); + this.scrollHorizontal(left); + } + + if (!this.displayRowsCount) { + if (this.table.options.placeholder) { + this.getElement().appendChild(this.table.options.placeholder); + } + } + } else { + this.renderTable(); + } +}; + +RowManager.prototype.resetScroll = function () { + this.element.scrollLeft = 0; + this.element.scrollTop = 0; + + if (this.table.browser === "ie") { + var event = document.createEvent("Event"); + event.initEvent("scroll", false, true); + this.element.dispatchEvent(event); + } else { + this.element.dispatchEvent(new Event('scroll')); + } +}; + +var VDomHoz = function VDomHoz(table) { + this.table = table; + + this.element = this.table.rowManager.tableElement; + this.holderEl = this.table.rowManager.element; + + this.leftCol = 0; + this.rightCol = 0; + this.scrollLeft = 0; + + this.vDomScrollPosLeft = 0; + this.vDomScrollPosRight = 0; + + this.vDomPadLeft = 0; + this.vDomPadRight = 0; + + this.fitDataColAvg = 0; + + this.window = 200; //pixel margin to make column visible before it is shown on screen + + this.initialized = false; + + this.columns = []; + + if (this.compatabilityCheck()) { + this.initialize(); + } +}; + +VDomHoz.prototype.compatabilityCheck = function () { + var options = this.table.options, + frozen = false, + ok = true; + + if (options.layout == "fitDataTable") { + console.warn("Horizontal Vitrual DOM is not compatible with fitDataTable layout mode"); + ok = false; + } + + if (options.responsiveLayout) { + console.warn("Horizontal Vitrual DOM is not compatible with responsive columns"); + ok = false; + } + + if (this.table.rtl) { + console.warn("Horizontal Vitrual DOM is not currently compatible with RTL text direction"); + ok = false; + } + + // if(options.rowFormatter){ + // console.warn("Horizontal Vitrual DOM is not compatible with row formatters"); + // ok = false; + // } + + if (options.columns) { + frozen = options.columns.find(function (col) { + return col.frozen; + }); + + if (frozen) { + console.warn("Horizontal Vitrual DOM is not compatible with frozen columns"); + ok = false; + } + } + + if (!ok) { + options.virtualDomHoz = false; + } + + return ok; +}; + +VDomHoz.prototype.initialize = function () { + var _this17 = this; + + this.holderEl.addEventListener("scroll", function () { + var left = _this17.holderEl.scrollLeft; + + if (_this17.scrollLeft != left) { + _this17.scrollLeft = left; + _this17.scroll(left - (_this17.vDomScrollPosLeft + _this17.window)); + } + }); +}; + +VDomHoz.prototype.deinitialize = function () { + this.initialized = false; +}; + +VDomHoz.prototype.clear = function () { + this.columns = []; + + this.leftCol = -1; + this.rightCol = 0; + + this.vDomScrollPosLeft = 0; + this.vDomScrollPosRight = 0; + this.vDomPadLeft = 0; + this.vDomPadRight = 0; +}; + +VDomHoz.prototype.dataChange = function () { + var change = false, + collsWidth = 0, + colEnd = 0, + group, + row, + rowEl; + + if (this.table.options.layout === "fitData") { + this.table.columnManager.columnsByIndex.forEach(function (column) { + if (!column.definition.width && column.visible) { + change = true; + } + }); + + if (change) { + if (change && this.table.rowManager.getDisplayRows().length) { + // this.table.vdomHoz.deinitialize(); + + this.vDomScrollPosRight = this.scrollLeft + this.holderEl.clientWidth + this.window; + + if (this.table.options.groupBy) { + group = this.table.modules.groupRows.getGroups(false)[0]; + + row = group.getRows(false)[0]; + } else { + row = this.table.rowManager.getDisplayRows()[0]; + } + + if (row) { + + rowEl = row.getElement(); + + row.generateCells(); + + this.element.appendChild(rowEl); + + for (var colEnd = 0; colEnd < row.cells.length; colEnd++) { + var cell = row.cells[colEnd]; + rowEl.appendChild(cell.getElement()); + + cell.column.reinitializeWidth(); + + collsWidth += cell.column.getWidth(); + + if (collsWidth > this.vDomScrollPosRight) { + break; + } + } + + rowEl.parentNode.removeChild(rowEl); + + this.fitDataColAvg = Math.floor(collsWidth / (colEnd + 1)); + + for (colEnd; colEnd < this.table.columnManager.columnsByIndex.length; colEnd++) { + this.table.columnManager.columnsByIndex[colEnd].setWidth(this.fitDataColAvg); + } + + this.reinitialize(false, true); + } + } + } + } else { + if (this.table.options.layout === "fitColumns") { + this.table.modules.layout.layout(); + this.table.vdomHoz.reinitialize(false, true); + } + } +}; + +VDomHoz.prototype.fitDataLayoutOverride = function () { + for (var _i5 = this.leftCol; _i5 <= this.rightCol; _i5++) { + this.columns[_i5].reinitializeWidth(); + } +}; + +VDomHoz.prototype.reinitialize = function (update, blockRedraw) { + var _this18 = this; + + var old = { + cols: this.columns, + leftCol: this.leftCol, + rightCol: this.rightCol + }; + + if (update && !this.initialized) { + return; + } + + this.clear(); + + this.scrollLeft = this.holderEl.scrollLeft; + + this.vDomScrollPosLeft = this.scrollLeft - this.window; + this.vDomScrollPosRight = this.scrollLeft + this.holderEl.clientWidth + this.window; + + var colPos = 0; + + this.table.columnManager.columnsByIndex.forEach(function (column) { + var config = {}; + + if (column.visible) { + var width = column.getWidth(); + + config.leftPos = colPos; + config.rightPos = colPos + width; + + if (colPos + width > _this18.vDomScrollPosLeft && colPos < _this18.vDomScrollPosRight) { + //column is visible + + if (_this18.leftCol == -1) { + _this18.leftCol = _this18.columns.length; + _this18.vDomPadLeft = colPos; + } + + _this18.rightCol = _this18.columns.length; + } else { + // column is hidden + if (_this18.leftCol !== -1) { + _this18.vDomPadRight += width; + } + } + + _this18.columns.push(column); + + column.modules.vdomHoz = config; + + colPos += width; + } + }); + + this.element.style.paddingLeft = this.vDomPadLeft + "px"; + this.element.style.paddingRight = this.vDomPadRight + "px"; + + this.initialized = true; + + if (!blockRedraw) { + if (!update || this.reinitChanged(old)) { + this.renitializeRows(); + } + } + + this.holderEl.scrollLeft = this.scrollLeft; +}; + +VDomHoz.prototype.reinitChanged = function (old) { + var _this19 = this; + + var match = true; + + if (old.cols.length !== this.columns.length || old.leftCol !== this.leftCol || old.rightCol !== this.rightCol) { + return true; + } + + old.cols.forEach(function (col, i) { + if (col !== _this19.columns[i]) { + match = false; + } + }); + + return !match; +}; + +VDomHoz.prototype.renitializeRows = function () { + var _this20 = this; + + var rows = this.table.rowManager.getVisibleRows(); + rows.forEach(function (row) { + _this20.reinitializeRow(row, true); + }); +}; + +VDomHoz.prototype.scroll = function (diff) { + this.vDomScrollPosLeft += diff; + this.vDomScrollPosRight += diff; + + if (diff > this.holderEl.clientWidth * .8) { + this.reinitialize(); + } else { + if (diff > 0) { + //scroll right + this.addColRight(); + this.removeColLeft(); + } else { + //scroll left + this.addColLeft(); + this.removeColRight(); + } + } +}; + +VDomHoz.prototype.colPositionAdjust = function (start, end, diff) { + for (var _i6 = start; _i6 < end; _i6++) { + var column = this.columns[_i6]; + + column.modules.vdomHoz.leftPos -= diff; + column.modules.vdomHoz.rightPos -= diff; + } +}; + +VDomHoz.prototype.addColRight = function () { + var column = this.columns[this.rightCol + 1], + rows, + oldWidth, + widthDiff; + + if (column && column.modules.vdomHoz.leftPos <= this.vDomScrollPosRight) { + + rows = this.table.rowManager.getVisibleRows(); + + rows.forEach(function (row) { + if (row.type !== "group") { + var cell = row.getCell(column); + row.getElement().appendChild(cell.getElement()); + cell.cellRendered(); + } + }); + + if (this.fitDataColAvg) { + + oldWidth = column.getWidth(); + + if (oldWidth === this.fitDataColAvg) { + column.reinitializeWidth(); + + widthDiff = oldWidth - column.getWidth(); + + if (widthDiff) { + column.modules.vdomHoz.rightPos -= widthDiff; + this.colPositionAdjust(this.rightCol + 1, this.columns.length, widthDiff); + } + } + } + + this.rightCol++; + + if (this.rightCol >= this.columns.length - 1) { + this.vDomPadRight = 0; + } else { + this.vDomPadRight -= column.getWidth(); + } + + this.element.style.paddingRight = this.vDomPadRight + "px"; + + this.addColRight(); + } +}; + +VDomHoz.prototype.addColLeft = function () { + var column = this.columns[this.leftCol - 1], + rows; + + if (column && column.modules.vdomHoz.rightPos >= this.vDomScrollPosLeft) { + var rows = this.table.rowManager.getVisibleRows(); + + rows.forEach(function (row) { + if (row.type !== "group") { + var cell = row.getCell(column); + row.getElement().prepend(cell.getElement()); + cell.cellRendered(); + } + }); + + if (!this.leftCol) { + this.vDomPadLeft = 0; + } else { + this.vDomPadLeft -= column.getWidth(); + } + + this.element.style.paddingLeft = this.vDomPadLeft + "px"; + + this.leftCol--; + + this.addColLeft(); + } +}; + +VDomHoz.prototype.removeColRight = function (column) { + var column = this.columns[this.rightCol], + rows; + + if (column && column.modules.vdomHoz.leftPos > this.vDomScrollPosRight) { + rows = this.table.rowManager.getVisibleRows(); + + column.modules.vdomHoz.visible = false; + + rows.forEach(function (row) { + if (row.type !== "group") { + var cell = row.getCell(column); + row.getElement().removeChild(cell.getElement()); + } + }); + + this.vDomPadRight += column.getWidth(); + this.element.style.paddingRight = this.vDomPadRight + "px"; + + this.rightCol--; + + this.removeColRight(); + } +}; + +VDomHoz.prototype.removeColLeft = function () { + var column = this.columns[this.leftCol], + rows; + + if (column && column.modules.vdomHoz.rightPos < this.vDomScrollPosLeft) { + + rows = this.table.rowManager.getVisibleRows(); + + rows.forEach(function (row) { + if (row.type !== "group") { + var cell = row.getCell(column); + row.getElement().removeChild(cell.getElement()); + } + }); + + this.vDomPadLeft += column.getWidth(); + this.element.style.paddingLeft = this.vDomPadLeft + "px"; + + this.leftCol++; + + this.removeColLeft(); + } +}; + +VDomHoz.prototype.initializeRow = function (row) { + if (row.type !== "group") { + row.modules.vdomHoz = { + leftCol: this.leftCol, + rightCol: this.rightCol + }; + + for (var _i7 = this.leftCol; _i7 <= this.rightCol; _i7++) { + var column = this.columns[_i7]; + + if (column.visible) { + var cell = row.getCell(column); + + row.element.appendChild(cell.getElement()); + cell.cellRendered(); + } + } + } +}; + +VDomHoz.prototype.reinitializeRow = function (row, force) { + if (row.type !== "group") { + if (force || !row.modules.vdomHoz || row.modules.vdomHoz.leftCol !== this.leftCol || row.modules.vdomHoz.rightCol !== this.rightCol) { + while (row.element.firstChild) { + row.element.removeChild(row.element.firstChild); + }this.initializeRow(row); + } + } +}; +//public row object +var RowComponent = function RowComponent(row) { + this._row = row; +}; + +RowComponent.prototype.getData = function (transform) { + return this._row.getData(transform); +}; + +RowComponent.prototype.getElement = function () { + return this._row.getElement(); +}; + +RowComponent.prototype.getCells = function () { + var cells = []; + + this._row.getCells().forEach(function (cell) { + cells.push(cell.getComponent()); + }); + + return cells; +}; + +RowComponent.prototype.getCell = function (column) { + var cell = this._row.getCell(column); + return cell ? cell.getComponent() : false; +}; + +RowComponent.prototype.getIndex = function () { + return this._row.getData("data")[this._row.table.options.index]; +}; + +RowComponent.prototype.getPosition = function (active) { + return this._row.table.rowManager.getRowPosition(this._row, active); +}; + +RowComponent.prototype.delete = function () { + return this._row.delete(); +}; + +RowComponent.prototype.scrollTo = function () { + return this._row.table.rowManager.scrollToRow(this._row); +}; + +RowComponent.prototype.pageTo = function () { + if (this._row.table.modExists("page", true)) { + return this._row.table.modules.page.setPageToRow(this._row); + } +}; + +RowComponent.prototype.move = function (to, after) { + this._row.moveToRow(to, after); +}; + +RowComponent.prototype.update = function (data) { + return this._row.updateData(data); +}; + +RowComponent.prototype.normalizeHeight = function () { + this._row.normalizeHeight(true); +}; + +RowComponent.prototype.select = function () { + this._row.table.modules.selectRow.selectRows(this._row); +}; + +RowComponent.prototype.deselect = function () { + this._row.table.modules.selectRow.deselectRows(this._row); +}; + +RowComponent.prototype.toggleSelect = function () { + this._row.table.modules.selectRow.toggleRow(this._row); +}; + +RowComponent.prototype.isSelected = function () { + return this._row.table.modules.selectRow.isRowSelected(this._row); +}; + +RowComponent.prototype._getSelf = function () { + return this._row; +}; + +RowComponent.prototype.validate = function () { + return this._row.validate(); +}; + +RowComponent.prototype.freeze = function () { + if (this._row.table.modExists("frozenRows", true)) { + this._row.table.modules.frozenRows.freezeRow(this._row); + } +}; + +RowComponent.prototype.unfreeze = function () { + if (this._row.table.modExists("frozenRows", true)) { + this._row.table.modules.frozenRows.unfreezeRow(this._row); + } +}; + +RowComponent.prototype.isFrozen = function () { + if (this._row.table.modExists("frozenRows", true)) { + var index = this._row.table.modules.frozenRows.rows.indexOf(this._row); + return index > -1; + } + + return false; +}; + +RowComponent.prototype.treeCollapse = function () { + if (this._row.table.modExists("dataTree", true)) { + this._row.table.modules.dataTree.collapseRow(this._row); + } +}; + +RowComponent.prototype.treeExpand = function () { + if (this._row.table.modExists("dataTree", true)) { + this._row.table.modules.dataTree.expandRow(this._row); + } +}; + +RowComponent.prototype.treeToggle = function () { + if (this._row.table.modExists("dataTree", true)) { + this._row.table.modules.dataTree.toggleRow(this._row); + } +}; + +RowComponent.prototype.getTreeParent = function () { + if (this._row.table.modExists("dataTree", true)) { + return this._row.table.modules.dataTree.getTreeParent(this._row); + } + + return false; +}; + +RowComponent.prototype.getTreeChildren = function () { + if (this._row.table.modExists("dataTree", true)) { + return this._row.table.modules.dataTree.getTreeChildren(this._row, true); + } + + return false; +}; + +RowComponent.prototype.addTreeChild = function (data, pos, index) { + if (this._row.table.modExists("dataTree", true)) { + return this._row.table.modules.dataTree.addTreeChildRow(this._row, data, pos, index); + } + + return false; +}; + +RowComponent.prototype.reformat = function () { + return this._row.reinitialize(); +}; + +RowComponent.prototype.getGroup = function () { + return this._row.getGroup().getComponent(); +}; + +RowComponent.prototype.getTable = function () { + return this._row.table; +}; + +RowComponent.prototype.getNextRow = function () { + var row = this._row.nextRow(); + return row ? row.getComponent() : row; +}; + +RowComponent.prototype.getPrevRow = function () { + var row = this._row.prevRow(); + return row ? row.getComponent() : row; +}; + +var Row = function Row(data, parent) { + var type = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : "row"; + + this.table = parent.table; + this.parent = parent; + this.data = {}; + this.type = type; //type of element + this.element = this.createElement(); + this.modules = {}; //hold module variables; + this.cells = []; + this.height = 0; //hold element height + this.heightStyled = ""; //hold element height prestyled to improve render efficiency + this.manualHeight = false; //user has manually set row height + this.outerHeight = 0; //holde lements outer height + this.initialized = false; //element has been rendered + this.heightInitialized = false; //element has resized cells to fit + + this.component = null; + + this.setData(data); + this.generateElement(); +}; + +Row.prototype.createElement = function () { + var el = document.createElement("div"); + + el.classList.add("tabulator-row"); + el.setAttribute("role", "row"); + + return el; +}; + +Row.prototype.getElement = function () { + return this.element; +}; + +Row.prototype.detachElement = function () { + if (this.element && this.element.parentNode) { + this.element.parentNode.removeChild(this.element); + } +}; + +Row.prototype.generateElement = function () { + var self = this, + dblTap, + tapHold, + tap; + + //set row selection characteristics + if (self.table.options.selectable !== false && self.table.modExists("selectRow")) { + self.table.modules.selectRow.initializeRow(this); + } + + //setup movable rows + if (self.table.options.movableRows !== false && self.table.modExists("moveRow")) { + self.table.modules.moveRow.initializeRow(this); + } + + //setup data tree + if (self.table.options.dataTree !== false && self.table.modExists("dataTree")) { + self.table.modules.dataTree.initializeRow(this); + } + + //setup column colapse container + if (self.table.options.responsiveLayout === "collapse" && self.table.modExists("responsiveLayout")) { + self.table.modules.responsiveLayout.initializeRow(this); + } + + //set column menu + if ((self.table.options.rowContextMenu || self.table.options.rowClickMenu) && this.table.modExists("menu")) { + self.table.modules.menu.initializeRow(this); + } + + //handle row click events + if (self.table.options.rowClick) { + self.element.addEventListener("click", function (e) { + self.table.options.rowClick(e, self.getComponent()); + }); + } + + if (self.table.options.rowDblClick) { + self.element.addEventListener("dblclick", function (e) { + self.table.options.rowDblClick(e, self.getComponent()); + }); + } + + if (self.table.options.rowContext) { + self.element.addEventListener("contextmenu", function (e) { + self.table.options.rowContext(e, self.getComponent()); + }); + } + + //handle mouse events + if (self.table.options.rowMouseEnter) { + self.element.addEventListener("mouseenter", function (e) { + self.table.options.rowMouseEnter(e, self.getComponent()); + }); + } + + if (self.table.options.rowMouseLeave) { + self.element.addEventListener("mouseleave", function (e) { + self.table.options.rowMouseLeave(e, self.getComponent()); + }); + } + + if (self.table.options.rowMouseOver) { + self.element.addEventListener("mouseover", function (e) { + self.table.options.rowMouseOver(e, self.getComponent()); + }); + } + + if (self.table.options.rowMouseOut) { + self.element.addEventListener("mouseout", function (e) { + self.table.options.rowMouseOut(e, self.getComponent()); + }); + } + + if (self.table.options.rowMouseMove) { + self.element.addEventListener("mousemove", function (e) { + self.table.options.rowMouseMove(e, self.getComponent()); + }); + } + + if (self.table.options.rowTap) { + + tap = false; + + self.element.addEventListener("touchstart", function (e) { + tap = true; + }, { passive: true }); + + self.element.addEventListener("touchend", function (e) { + if (tap) { + self.table.options.rowTap(e, self.getComponent()); + } + + tap = false; + }); + } + + if (self.table.options.rowDblTap) { + + dblTap = null; + + self.element.addEventListener("touchend", function (e) { + + if (dblTap) { + clearTimeout(dblTap); + dblTap = null; + + self.table.options.rowDblTap(e, self.getComponent()); + } else { + + dblTap = setTimeout(function () { + clearTimeout(dblTap); + dblTap = null; + }, 300); + } + }); + } + + if (self.table.options.rowTapHold) { + + tapHold = null; + + self.element.addEventListener("touchstart", function (e) { + clearTimeout(tapHold); + + tapHold = setTimeout(function () { + clearTimeout(tapHold); + tapHold = null; + tap = false; + self.table.options.rowTapHold(e, self.getComponent()); + }, 1000); + }, { passive: true }); + + self.element.addEventListener("touchend", function (e) { + clearTimeout(tapHold); + tapHold = null; + }); + } +}; + +Row.prototype.generateCells = function () { + this.cells = this.table.columnManager.generateCells(this); +}; + +//functions to setup on first render +Row.prototype.initialize = function (force) { + var _this21 = this; + + if (!this.initialized || force) { + + this.deleteCells(); + + while (this.element.firstChild) { + this.element.removeChild(this.element.firstChild); + } //handle frozen cells + if (this.table.modExists("frozenColumns")) { + this.table.modules.frozenColumns.layoutRow(this); + } + + this.generateCells(); + + if (this.table.options.virtualDomHoz && this.table.vdomHoz.initialized) { + this.table.vdomHoz.initializeRow(this); + } else { + this.cells.forEach(function (cell) { + _this21.element.appendChild(cell.getElement()); + cell.cellRendered(); + }); + } + + if (force) { + this.normalizeHeight(); + } + + //setup movable rows + if (this.table.options.dataTree && this.table.modExists("dataTree")) { + this.table.modules.dataTree.layoutRow(this); + } + + //setup column colapse container + if (this.table.options.responsiveLayout === "collapse" && this.table.modExists("responsiveLayout")) { + this.table.modules.responsiveLayout.layoutRow(this); + } + + if (this.table.options.rowFormatter) { + this.table.options.rowFormatter(this.getComponent()); + } + + //set resizable handles + if (this.table.options.resizableRows && this.table.modExists("resizeRows")) { + this.table.modules.resizeRows.initializeRow(this); + } + + this.initialized = true; + } else { + if (this.table.options.virtualDomHoz) { + this.table.vdomHoz.reinitializeRow(this); + } + } +}; + +Row.prototype.reinitializeHeight = function () { + this.heightInitialized = false; + + if (this.element.offsetParent !== null) { + this.normalizeHeight(true); + } +}; + +Row.prototype.reinitialize = function (children) { + this.initialized = false; + this.heightInitialized = false; + + if (!this.manualHeight) { + this.height = 0; + this.heightStyled = ""; + } + + if (this.element.offsetParent !== null) { + this.initialize(true); + } + + if (this.table.options.dataTree && this.table.modExists("dataTree", true)) { + this.table.modules.dataTree.getTreeChildren(this, false, true).forEach(function (child) { + child.reinitialize(true); + }); + } +}; + +//get heights when doing bulk row style calcs in virtual DOM +Row.prototype.calcHeight = function (force) { + + var maxHeight = 0, + minHeight = this.table.options.resizableRows ? this.element.clientHeight : 0; + + this.cells.forEach(function (cell) { + var height = cell.getHeight(); + if (height > maxHeight) { + maxHeight = height; + } + }); + + if (force) { + this.height = Math.max(maxHeight, minHeight); + } else { + this.height = this.manualHeight ? this.height : Math.max(maxHeight, minHeight); + } + + this.heightStyled = this.height ? this.height + "px" : ""; + this.outerHeight = this.element.offsetHeight; +}; + +//set of cells +Row.prototype.setCellHeight = function () { + this.cells.forEach(function (cell) { + cell.setHeight(); + }); + + this.heightInitialized = true; +}; + +Row.prototype.clearCellHeight = function () { + this.cells.forEach(function (cell) { + cell.clearHeight(); + }); +}; + +//normalize the height of elements in the row +Row.prototype.normalizeHeight = function (force) { + + if (force) { + this.clearCellHeight(); + } + + this.calcHeight(force); + + this.setCellHeight(); +}; + +// Row.prototype.setHeight = function(height){ +// this.height = height; + +// this.setCellHeight(); +// }; + +//set height of rows +Row.prototype.setHeight = function (height, force) { + if (this.height != height || force) { + + this.manualHeight = true; + + this.height = height; + this.heightStyled = height ? height + "px" : ""; + + this.setCellHeight(); + + // this.outerHeight = this.element.outerHeight(); + this.outerHeight = this.element.offsetHeight; + } +}; + +//return rows outer height +Row.prototype.getHeight = function () { + return this.outerHeight; +}; + +//return rows outer Width +Row.prototype.getWidth = function () { + return this.element.offsetWidth; +}; + +//////////////// Cell Management ///////////////// + +Row.prototype.deleteCell = function (cell) { + var index = this.cells.indexOf(cell); + + if (index > -1) { + this.cells.splice(index, 1); + } +}; + +//////////////// Data Management ///////////////// + +Row.prototype.setData = function (data) { + if (this.table.modExists("mutator")) { + data = this.table.modules.mutator.transformRow(data, "data"); + } + + this.data = data; + + if (this.table.options.reactiveData && this.table.modExists("reactiveData", true)) { + this.table.modules.reactiveData.watchRow(this); + } +}; + +//update the rows data +Row.prototype.updateData = function (updatedData) { + var _this22 = this; + + var visible = Tabulator.prototype.helpers.elVisible(this.element), + tempData = {}, + newRowData; + + return new Promise(function (resolve, reject) { + + if (typeof updatedData === "string") { + updatedData = JSON.parse(updatedData); + } + + if (_this22.table.options.reactiveData && _this22.table.modExists("reactiveData", true)) { + _this22.table.modules.reactiveData.block(); + } + + //mutate incomming data if needed + if (_this22.table.modExists("mutator")) { + + tempData = Object.assign(tempData, _this22.data); + tempData = Object.assign(tempData, updatedData); + + newRowData = _this22.table.modules.mutator.transformRow(tempData, "data", updatedData); + } else { + newRowData = updatedData; + } + + //set data + for (var attrname in newRowData) { + _this22.data[attrname] = newRowData[attrname]; + } + + if (_this22.table.options.reactiveData && _this22.table.modExists("reactiveData", true)) { + _this22.table.modules.reactiveData.unblock(); + } + + //update affected cells only + for (var attrname in updatedData) { + + var columns = _this22.table.columnManager.getColumnsByFieldRoot(attrname); + + columns.forEach(function (column) { + var cell = _this22.getCell(column.getField()); + + if (cell) { + var value = column.getFieldValue(newRowData); + if (cell.getValue() != value) { + cell.setValueProcessData(value); + + if (visible) { + cell.cellRendered(); + } + } + } + }); + } + + if (_this22.table.options.groupUpdateOnCellEdit && _this22.table.options.groupBy && _this22.table.modExists("groupRows")) { + _this22.table.modules.groupRows.reassignRowToGroup(_this22.row); + } + + //Partial reinitialization if visible + if (visible) { + _this22.normalizeHeight(true); + + if (_this22.table.options.rowFormatter) { + _this22.table.options.rowFormatter(_this22.getComponent()); + } + } else { + _this22.initialized = false; + _this22.height = 0; + _this22.heightStyled = ""; + } + + if (_this22.table.options.dataTree !== false && _this22.table.modExists("dataTree") && _this22.table.modules.dataTree.redrawNeeded(updatedData)) { + _this22.table.modules.dataTree.initializeRow(_this22); + + if (visible) { + _this22.table.modules.dataTree.layoutRow(_this22); + _this22.table.rowManager.refreshActiveData("tree", false, true); + } + } + + //this.reinitialize(); + + _this22.table.options.rowUpdated.call(_this22.table, _this22.getComponent()); + + if (_this22.table.options.dataChanged) { + _this22.table.options.dataChanged.call(_this22.table, _this22.table.rowManager.getData()); + } + + resolve(); + }); +}; + +Row.prototype.getData = function (transform) { + if (transform) { + if (this.table.modExists("accessor")) { + return this.table.modules.accessor.transformRow(this, transform); + } + } + + return this.data; +}; + +Row.prototype.getCell = function (column) { + var match = false; + + column = this.table.columnManager.findColumn(column); + + match = this.cells.find(function (cell) { + return cell.column === column; + }); + + return match; +}; + +Row.prototype.getCellIndex = function (findCell) { + return this.cells.findIndex(function (cell) { + return cell === findCell; + }); +}; + +Row.prototype.findNextEditableCell = function (index) { + var nextCell = false; + + if (index < this.cells.length - 1) { + for (var i = index + 1; i < this.cells.length; i++) { + var cell = this.cells[i]; + + if (cell.column.modules.edit && Tabulator.prototype.helpers.elVisible(cell.getElement())) { + var allowEdit = true; + + if (typeof cell.column.modules.edit.check == "function") { + allowEdit = cell.column.modules.edit.check(cell.getComponent()); + } + + if (allowEdit) { + nextCell = cell; + break; + } + } + } + } + + return nextCell; +}; + +Row.prototype.findPrevEditableCell = function (index) { + var prevCell = false; + + if (index > 0) { + for (var i = index - 1; i >= 0; i--) { + var cell = this.cells[i], + allowEdit = true; + + if (cell.column.modules.edit && Tabulator.prototype.helpers.elVisible(cell.getElement())) { + if (typeof cell.column.modules.edit.check == "function") { + allowEdit = cell.column.modules.edit.check(cell.getComponent()); + } + + if (allowEdit) { + prevCell = cell; + break; + } + } + } + } + + return prevCell; +}; + +Row.prototype.getCells = function () { + return this.cells; +}; + +Row.prototype.nextRow = function () { + var row = this.table.rowManager.nextDisplayRow(this, true); + return row || false; +}; + +Row.prototype.prevRow = function () { + var row = this.table.rowManager.prevDisplayRow(this, true); + return row || false; +}; + +Row.prototype.moveToRow = function (to, before) { + var toRow = this.table.rowManager.findRow(to); + + if (toRow) { + this.table.rowManager.moveRowActual(this, toRow, !before); + this.table.rowManager.refreshActiveData("display", false, true); + } else { + console.warn("Move Error - No matching row found:", to); + } +}; + +Row.prototype.validate = function () { + var invalid = []; + + this.cells.forEach(function (cell) { + if (!cell.validate()) { + invalid.push(cell.getComponent()); + } + }); + + return invalid.length ? invalid : true; +}; + +///////////////////// Actions ///////////////////// + +Row.prototype.delete = function () { + var _this23 = this; + + return new Promise(function (resolve, reject) { + var index, rows; + + if (_this23.table.options.history && _this23.table.modExists("history")) { + + if (_this23.table.options.groupBy && _this23.table.modExists("groupRows")) { + rows = _this23.getGroup().rows; + index = rows.indexOf(_this23); + + if (index) { + index = rows[index - 1]; + } + } else { + index = _this23.table.rowManager.getRowIndex(_this23); + + if (index) { + index = _this23.table.rowManager.rows[index - 1]; + } + } + + _this23.table.modules.history.action("rowDelete", _this23, { data: _this23.getData(), pos: !index, index: index }); + } + + _this23.deleteActual(); + + resolve(); + }); +}; + +Row.prototype.deleteActual = function (blockRedraw) { + var index = this.table.rowManager.getRowIndex(this); + + this.detatchModules(); + + // if(this.table.options.dataTree && this.table.modExists("dataTree")){ + // this.table.modules.dataTree.collapseRow(this, true); + // } + + //remove any reactive data watchers from row object + if (this.table.options.reactiveData && this.table.modExists("reactiveData", true)) {} + // this.table.modules.reactiveData.unwatchRow(this); + + + //remove from group + if (this.modules.group) { + this.modules.group.removeRow(this); + } + + this.table.rowManager.deleteRow(this, blockRedraw); + + this.deleteCells(); + + this.initialized = false; + this.heightInitialized = false; + this.element = false; + + if (this.table.options.dataTree && this.table.modExists("dataTree", true)) { + this.table.modules.dataTree.rowDelete(this); + } + + //recalc column calculations if present + if (this.table.modExists("columnCalcs")) { + if (this.table.options.groupBy && this.table.modExists("groupRows")) { + this.table.modules.columnCalcs.recalcRowGroup(this); + } else { + this.table.modules.columnCalcs.recalc(this.table.rowManager.activeRows); + } + } +}; + +Row.prototype.detatchModules = function () { + //deselect row if it is selected + if (this.table.modExists("selectRow")) { + this.table.modules.selectRow._deselectRow(this, true); + } + + //cancel edit if row is currently being edited + if (this.table.modExists("edit")) { + if (this.table.modules.edit.currentCell.row === this) { + this.table.modules.edit.cancelEdit(); + } + } + + if (this.table.modExists("frozenRows")) { + this.table.modules.frozenRows.detachRow(this); + } +}; + +Row.prototype.deleteCells = function () { + var cellCount = this.cells.length; + + for (var _i8 = 0; _i8 < cellCount; _i8++) { + this.cells[0].delete(); + } +}; + +Row.prototype.wipe = function () { + this.detatchModules(); + this.deleteCells(); + + while (this.element.firstChild) { + this.element.removeChild(this.element.firstChild); + }this.element = false; + this.modules = {}; + + if (this.element.parentNode) { + this.element.parentNode.removeChild(this.element); + } +}; + +Row.prototype.getGroup = function () { + return this.modules.group || false; +}; + +//////////////// Object Generation ///////////////// +Row.prototype.getComponent = function () { + if (!this.component) { + this.component = new RowComponent(this); + } + + return this.component; +}; + +//public row object +var CellComponent = function CellComponent(cell) { + this._cell = cell; +}; + +CellComponent.prototype.getValue = function () { + return this._cell.getValue(); +}; + +CellComponent.prototype.getOldValue = function () { + return this._cell.getOldValue(); +}; + +CellComponent.prototype.getInitialValue = function () { + return this._cell.initialValue; +}; + +CellComponent.prototype.getElement = function () { + return this._cell.getElement(); +}; + +CellComponent.prototype.getRow = function () { + return this._cell.row.getComponent(); +}; + +CellComponent.prototype.getData = function () { + return this._cell.row.getData(); +}; + +CellComponent.prototype.getField = function () { + return this._cell.column.getField(); +}; + +CellComponent.prototype.getColumn = function () { + return this._cell.column.getComponent(); +}; + +CellComponent.prototype.setValue = function (value, mutate) { + if (typeof mutate == "undefined") { + mutate = true; + } + + this._cell.setValue(value, mutate); +}; + +CellComponent.prototype.restoreOldValue = function () { + this._cell.setValueActual(this._cell.getOldValue()); +}; + +CellComponent.prototype.restoreInitialValue = function () { + this._cell.setValueActual(this._cell.initialValue); +}; + +CellComponent.prototype.edit = function (force) { + return this._cell.edit(force); +}; + +CellComponent.prototype.cancelEdit = function () { + this._cell.cancelEdit(); +}; + +CellComponent.prototype.isEdited = function () { + return !!this._cell.modules.edit && this._cell.modules.edit.edited; +}; + +CellComponent.prototype.clearEdited = function () { + if (self.table.modExists("edit", true)) { + this._cell.table.modules.edit.clearEdited(this._cell); + } +}; + +CellComponent.prototype.isValid = function () { + return this._cell.modules.validate ? !this._cell.modules.validate.invalid : true; +}; + +CellComponent.prototype.validate = function () { + return this._cell.validate(); +}; + +CellComponent.prototype.clearValidation = function () { + if (this._cell.table.modExists("validate", true)) { + this._cell.table.modules.validate.clearValidation(this._cell); + } +}; + +CellComponent.prototype.nav = function () { + return this._cell.nav(); +}; + +CellComponent.prototype.checkHeight = function () { + this._cell.checkHeight(); +}; + +CellComponent.prototype.getTable = function () { + return this._cell.table; +}; + +CellComponent.prototype._getSelf = function () { + return this._cell; +}; + +var Cell = function Cell(column, row) { + + this.table = column.table; + this.column = column; + this.row = row; + this.element = null; + this.value = null; + this.initialValue; + this.oldValue = null; + this.modules = {}; + + this.height = null; + this.width = null; + this.minWidth = null; + + this.component = null; + + this.loaded = false; //track if the cell has been added to the DOM yet + + this.build(); +}; + +//////////////// Setup Functions ///////////////// + +//generate element +Cell.prototype.build = function () { + this.generateElement(); + + this.setWidth(); + + this._configureCell(); + + this.setValueActual(this.column.getFieldValue(this.row.data)); + + this.initialValue = this.value; +}; + +Cell.prototype.generateElement = function () { + this.element = document.createElement('div'); + this.element.className = "tabulator-cell"; + this.element.setAttribute("role", "gridcell"); + this.element = this.element; +}; + +Cell.prototype._configureCell = function () { + var self = this, + cellEvents = self.column.cellEvents, + element = self.element, + field = this.column.getField(), + vertAligns = { + top: "flex-start", + bottom: "flex-end", + middle: "center" + }, + hozAligns = { + left: "flex-start", + right: "flex-end", + center: "center" + }; + + //set text alignment + element.style.textAlign = self.column.hozAlign; + + if (self.column.vertAlign) { + element.style.display = "inline-flex"; + + element.style.alignItems = vertAligns[self.column.vertAlign] || ""; + + if (self.column.hozAlign) { + element.style.justifyContent = hozAligns[self.column.hozAlign] || ""; + } + } + + if (field) { + element.setAttribute("tabulator-field", field); + } + + //add class to cell if needed + if (self.column.definition.cssClass) { + var classNames = self.column.definition.cssClass.split(" "); + classNames.forEach(function (className) { + element.classList.add(className); + }); + } + + //update tooltip on mouse enter + if (this.table.options.tooltipGenerationMode === "hover") { + element.addEventListener("mouseenter", function (e) { + self._generateTooltip(); + }); + } + + self._bindClickEvents(cellEvents); + + self._bindTouchEvents(cellEvents); + + self._bindMouseEvents(cellEvents); + + if (self.column.modules.edit) { + self.table.modules.edit.bindEditor(self); + } + + if (self.column.definition.rowHandle && self.table.options.movableRows !== false && self.table.modExists("moveRow")) { + self.table.modules.moveRow.initializeCell(self); + } + + //hide cell if not visible + if (!self.column.visible) { + self.hide(); + } +}; + +Cell.prototype._bindClickEvents = function (cellEvents) { + var self = this, + element = self.element; + + //set event bindings + if (cellEvents.cellClick || self.table.options.cellClick) { + element.addEventListener("click", function (e) { + var component = self.getComponent(); + + if (cellEvents.cellClick) { + cellEvents.cellClick.call(self.table, e, component); + } + + if (self.table.options.cellClick) { + self.table.options.cellClick.call(self.table, e, component); + } + }); + } + + if (cellEvents.cellDblClick || this.table.options.cellDblClick) { + element.addEventListener("dblclick", function (e) { + var component = self.getComponent(); + + if (cellEvents.cellDblClick) { + cellEvents.cellDblClick.call(self.table, e, component); + } + + if (self.table.options.cellDblClick) { + self.table.options.cellDblClick.call(self.table, e, component); + } + }); + } else { + element.addEventListener("dblclick", function (e) { + + if (self.table.modExists("edit")) { + if (self.table.modules.edit.currentCell === self) { + return; //prevent instant selection of editor content + } + } + + e.preventDefault(); + + try { + if (document.selection) { + // IE + var range = document.body.createTextRange(); + range.moveToElementText(self.element); + range.select(); + } else if (window.getSelection) { + var range = document.createRange(); + range.selectNode(self.element); + window.getSelection().removeAllRanges(); + window.getSelection().addRange(range); + } + } catch (e) {} + }); + } + + if (cellEvents.cellContext || this.table.options.cellContext) { + element.addEventListener("contextmenu", function (e) { + var component = self.getComponent(); + + if (cellEvents.cellContext) { + cellEvents.cellContext.call(self.table, e, component); + } + + if (self.table.options.cellContext) { + self.table.options.cellContext.call(self.table, e, component); + } + }); + } +}; + +Cell.prototype._bindMouseEvents = function (cellEvents) { + var self = this, + element = self.element; + + if (cellEvents.cellMouseEnter || self.table.options.cellMouseEnter) { + element.addEventListener("mouseenter", function (e) { + var component = self.getComponent(); + + if (cellEvents.cellMouseEnter) { + cellEvents.cellMouseEnter.call(self.table, e, component); + } + + if (self.table.options.cellMouseEnter) { + self.table.options.cellMouseEnter.call(self.table, e, component); + } + }); + } + + if (cellEvents.cellMouseLeave || self.table.options.cellMouseLeave) { + element.addEventListener("mouseleave", function (e) { + var component = self.getComponent(); + + if (cellEvents.cellMouseLeave) { + cellEvents.cellMouseLeave.call(self.table, e, component); + } + + if (self.table.options.cellMouseLeave) { + self.table.options.cellMouseLeave.call(self.table, e, component); + } + }); + } + + if (cellEvents.cellMouseOver || self.table.options.cellMouseOver) { + element.addEventListener("mouseover", function (e) { + var component = self.getComponent(); + + if (cellEvents.cellMouseOver) { + cellEvents.cellMouseOver.call(self.table, e, component); + } + + if (self.table.options.cellMouseOver) { + self.table.options.cellMouseOver.call(self.table, e, component); + } + }); + } + + if (cellEvents.cellMouseOut || self.table.options.cellMouseOut) { + element.addEventListener("mouseout", function (e) { + var component = self.getComponent(); + + if (cellEvents.cellMouseOut) { + cellEvents.cellMouseOut.call(self.table, e, component); + } + + if (self.table.options.cellMouseOut) { + self.table.options.cellMouseOut.call(self.table, e, component); + } + }); + } + + if (cellEvents.cellMouseMove || self.table.options.cellMouseMove) { + element.addEventListener("mousemove", function (e) { + var component = self.getComponent(); + + if (cellEvents.cellMouseMove) { + cellEvents.cellMouseMove.call(self.table, e, component); + } + + if (self.table.options.cellMouseMove) { + self.table.options.cellMouseMove.call(self.table, e, component); + } + }); + } +}; + +Cell.prototype._bindTouchEvents = function (cellEvents) { + var self = this, + element = self.element, + dblTap, + tapHold, + tap; + + if (cellEvents.cellTap || this.table.options.cellTap) { + tap = false; + + element.addEventListener("touchstart", function (e) { + tap = true; + }, { passive: true }); + + element.addEventListener("touchend", function (e) { + if (tap) { + var component = self.getComponent(); + + if (cellEvents.cellTap) { + cellEvents.cellTap.call(self.table, e, component); + } + + if (self.table.options.cellTap) { + self.table.options.cellTap.call(self.table, e, component); + } + } + + tap = false; + }); + } + + if (cellEvents.cellDblTap || this.table.options.cellDblTap) { + dblTap = null; + + element.addEventListener("touchend", function (e) { + + if (dblTap) { + clearTimeout(dblTap); + dblTap = null; + + var component = self.getComponent(); + + if (cellEvents.cellDblTap) { + cellEvents.cellDblTap.call(self.table, e, component); + } + + if (self.table.options.cellDblTap) { + self.table.options.cellDblTap.call(self.table, e, component); + } + } else { + + dblTap = setTimeout(function () { + clearTimeout(dblTap); + dblTap = null; + }, 300); + } + }); + } + + if (cellEvents.cellTapHold || this.table.options.cellTapHold) { + tapHold = null; + + element.addEventListener("touchstart", function (e) { + clearTimeout(tapHold); + + tapHold = setTimeout(function () { + clearTimeout(tapHold); + tapHold = null; + tap = false; + var component = self.getComponent(); + + if (cellEvents.cellTapHold) { + cellEvents.cellTapHold.call(self.table, e, component); + } + + if (self.table.options.cellTapHold) { + self.table.options.cellTapHold.call(self.table, e, component); + } + }, 1000); + }, { passive: true }); + + element.addEventListener("touchend", function (e) { + clearTimeout(tapHold); + tapHold = null; + }); + } +}; + +//generate cell contents +Cell.prototype._generateContents = function () { + var val; + + if (this.table.modExists("format")) { + val = this.table.modules.format.formatValue(this); + } else { + val = this.element.innerHTML = this.value; + } + + switch (typeof val === 'undefined' ? 'undefined' : _typeof(val)) { + case "object": + if (val instanceof Node) { + + //clear previous cell contents + while (this.element.firstChild) { + this.element.removeChild(this.element.firstChild); + }this.element.appendChild(val); + } else { + this.element.innerHTML = ""; + + if (val != null) { + console.warn("Format Error - Formatter has returned a type of object, the only valid formatter object return is an instance of Node, the formatter returned:", val); + } + } + break; + case "undefined": + case "null": + this.element.innerHTML = ""; + break; + default: + this.element.innerHTML = val; + } +}; + +Cell.prototype.cellRendered = function () { + if (this.table.modExists("format") && this.table.modules.format.cellRendered) { + this.table.modules.format.cellRendered(this); + } +}; + +//generate tooltip text +Cell.prototype._generateTooltip = function () { + var tooltip = this.column.tooltip; + + if (tooltip) { + if (tooltip === true) { + tooltip = this.value; + } else if (typeof tooltip == "function") { + tooltip = tooltip(this.getComponent()); + + if (tooltip === false) { + tooltip = ""; + } + } + + if (typeof tooltip === "undefined") { + tooltip = ""; + } + + this.element.setAttribute("title", tooltip); + } else { + this.element.setAttribute("title", ""); + } +}; + +//////////////////// Getters //////////////////// +Cell.prototype.getElement = function () { + if (!this.loaded) { + this.loaded = true; + this.layoutElement(); + } + + return this.element; +}; + +Cell.prototype.getValue = function () { + return this.value; +}; + +Cell.prototype.getOldValue = function () { + return this.oldValue; +}; + +//////////////////// Actions //////////////////// + +Cell.prototype.setValue = function (value, mutate) { + + var changed = this.setValueProcessData(value, mutate), + component; + + if (changed) { + if (this.table.options.history && this.table.modExists("history")) { + this.table.modules.history.action("cellEdit", this, { oldValue: this.oldValue, newValue: this.value }); + } + + component = this.getComponent(); + + if (this.column.cellEvents.cellEdited) { + this.column.cellEvents.cellEdited.call(this.table, component); + } + + if (this.table.options.groupUpdateOnCellEdit && this.table.options.groupBy && this.table.modExists("groupRows")) { + this.table.modules.groupRows.reassignRowToGroup(this.row); + } + + this.cellRendered(); + + this.table.options.cellEdited.call(this.table, component); + + if (this.table.options.dataChanged) { + this.table.options.dataChanged.call(this.table, this.table.rowManager.getData()); + } + } +}; + +Cell.prototype.setValueProcessData = function (value, mutate) { + var changed = false; + + if (this.value != value) { + + changed = true; + + if (mutate) { + if (this.column.modules.mutate) { + value = this.table.modules.mutator.transformCell(this, value); + } + } + } + + this.setValueActual(value); + + if (changed && this.table.modExists("columnCalcs")) { + if (this.column.definition.topCalc || this.column.definition.bottomCalc) { + if (this.table.options.groupBy && this.table.modExists("groupRows")) { + + if (this.table.options.columnCalcs == "table" || this.table.options.columnCalcs == "both") { + this.table.modules.columnCalcs.recalc(this.table.rowManager.activeRows); + } + + if (this.table.options.columnCalcs != "table") { + this.table.modules.columnCalcs.recalcRowGroup(this.row); + } + } else { + this.table.modules.columnCalcs.recalc(this.table.rowManager.activeRows); + } + } + } + + return changed; +}; + +Cell.prototype.setValueActual = function (value) { + this.oldValue = this.value; + + this.value = value; + + if (this.table.options.reactiveData && this.table.modExists("reactiveData")) { + this.table.modules.reactiveData.block(); + } + + this.column.setFieldValue(this.row.data, value); + + if (this.table.options.reactiveData && this.table.modExists("reactiveData")) { + this.table.modules.reactiveData.unblock(); + } + + if (this.loaded) { + this.layoutElement(); + } +}; + +Cell.prototype.layoutElement = function () { + this._generateContents(); + this._generateTooltip(); + + //set resizable handles + if (this.table.options.resizableColumns && this.table.modExists("resizeColumns") && this.row.type === "row") { + this.table.modules.resizeColumns.initializeColumn("cell", this.column, this.element); + } + + if ((this.column.definition.contextMenu || this.column.definition.clickMenu) && this.table.modExists("menu")) { + this.table.modules.menu.initializeCell(this); + } + + //handle frozen cells + if (this.table.modExists("frozenColumns")) { + this.table.modules.frozenColumns.layoutElement(this.element, this.column); + } +}; + +Cell.prototype.setWidth = function () { + this.width = this.column.width; + this.element.style.width = this.column.widthStyled; +}; + +Cell.prototype.clearWidth = function () { + this.width = ""; + this.element.style.width = ""; +}; + +Cell.prototype.getWidth = function () { + return this.width || this.element.offsetWidth; +}; + +Cell.prototype.setMinWidth = function () { + this.minWidth = this.column.minWidth; + this.element.style.minWidth = this.column.minWidthStyled; +}; + +Cell.prototype.checkHeight = function () { + // var height = this.element.css("height"); + this.row.reinitializeHeight(); +}; + +Cell.prototype.clearHeight = function () { + this.element.style.height = ""; + this.height = null; +}; + +Cell.prototype.setHeight = function () { + this.height = this.row.height; + this.element.style.height = this.row.heightStyled; +}; + +Cell.prototype.getHeight = function () { + return this.height || this.element.offsetHeight; +}; + +Cell.prototype.show = function () { + this.element.style.display = this.column.vertAlign ? "inline-flex" : ""; +}; + +Cell.prototype.hide = function () { + this.element.style.display = "none"; +}; + +Cell.prototype.edit = function (force) { + if (this.table.modExists("edit", true)) { + return this.table.modules.edit.editCell(this, force); + } +}; + +Cell.prototype.cancelEdit = function () { + if (this.table.modExists("edit", true)) { + var editing = this.table.modules.edit.getCurrentCell(); + + if (editing && editing._getSelf() === this) { + this.table.modules.edit.cancelEdit(); + } else { + console.warn("Cancel Editor Error - This cell is not currently being edited "); + } + } +}; + +Cell.prototype.validate = function () { + if (this.column.modules.validate && this.table.modExists("validate", true)) { + var valid = this.table.modules.validate.validate(this.column.modules.validate, this, this.getValue()); + + return valid === true; + } else { + return true; + } +}; + +Cell.prototype.delete = function () { + if (!this.table.rowManager.redrawBlock && this.element.parentNode) { + this.element.parentNode.removeChild(this.element); + } + + if (this.modules.validate && this.modules.validate.invalid) { + this.table.modules.validate.clearValidation(this); + } + + if (this.modules.edit && this.modules.edit.edited) { + this.table.modules.edit.clearEdited(this); + } + + if (this.table.options.history) { + this.table.modules.history.clearComponentHistory(this); + } + + this.element = false; + this.column.deleteCell(this); + this.row.deleteCell(this); + this.calcs = {}; +}; + +//////////////// Navigation ///////////////// + +Cell.prototype.nav = function () { + + var self = this, + nextCell = false, + index = this.row.getCellIndex(this); + + return { + next: function next() { + var nextCell = this.right(), + nextRow; + + if (!nextCell) { + nextRow = self.table.rowManager.nextDisplayRow(self.row, true); + + if (nextRow) { + nextCell = nextRow.findNextEditableCell(-1); + + if (nextCell) { + nextCell.edit(); + return true; + } + } + } else { + return true; + } + + return false; + }, + prev: function prev() { + var nextCell = this.left(), + prevRow; + + if (!nextCell) { + prevRow = self.table.rowManager.prevDisplayRow(self.row, true); + + if (prevRow) { + nextCell = prevRow.findPrevEditableCell(prevRow.cells.length); + + if (nextCell) { + nextCell.edit(); + return true; + } + } + } else { + return true; + } + + return false; + }, + left: function left() { + + nextCell = self.row.findPrevEditableCell(index); + + if (nextCell) { + nextCell.edit(); + return true; + } else { + return false; + } + }, + right: function right() { + nextCell = self.row.findNextEditableCell(index); + + if (nextCell) { + nextCell.edit(); + return true; + } else { + return false; + } + }, + up: function up() { + var nextRow = self.table.rowManager.prevDisplayRow(self.row, true); + + if (nextRow) { + nextRow.cells[index].edit(); + } + }, + down: function down() { + var nextRow = self.table.rowManager.nextDisplayRow(self.row, true); + + if (nextRow) { + nextRow.cells[index].edit(); + } + } + + }; +}; + +Cell.prototype.getIndex = function () { + this.row.getCellIndex(this); +}; + +//////////////// Object Generation ///////////////// +Cell.prototype.getComponent = function () { + + if (!this.component) { + this.component = new CellComponent(this); + } + + return this.component; +}; +var FooterManager = function FooterManager(table) { + this.table = table; + this.active = false; + this.element = this.createElement(); //containing element + this.external = false; + this.links = []; + + this._initialize(); +}; + +FooterManager.prototype.createElement = function () { + var el = document.createElement("div"); + + el.classList.add("tabulator-footer"); + + return el; +}; + +FooterManager.prototype._initialize = function (element) { + if (this.table.options.footerElement) { + + switch (_typeof(this.table.options.footerElement)) { + case "string": + + if (this.table.options.footerElement[0] === "<") { + this.element.innerHTML = this.table.options.footerElement; + } else { + this.external = true; + this.element = document.querySelector(this.table.options.footerElement); + } + break; + default: + this.element = this.table.options.footerElement; + break; + } + } +}; + +FooterManager.prototype.getElement = function () { + return this.element; +}; + +FooterManager.prototype.append = function (element, parent) { + this.activate(parent); + + this.element.appendChild(element); + this.table.rowManager.adjustTableSize(); +}; + +FooterManager.prototype.prepend = function (element, parent) { + this.activate(parent); + + this.element.insertBefore(element, this.element.firstChild); + this.table.rowManager.adjustTableSize(); +}; + +FooterManager.prototype.remove = function (element) { + element.parentNode.removeChild(element); + this.deactivate(); +}; + +FooterManager.prototype.deactivate = function (force) { + if (!this.element.firstChild || force) { + if (!this.external) { + this.element.parentNode.removeChild(this.element); + } + this.active = false; + } + + // this.table.rowManager.adjustTableSize(); +}; + +FooterManager.prototype.activate = function (parent) { + if (!this.active) { + this.active = true; + if (!this.external) { + this.table.element.appendChild(this.getElement()); + this.table.element.style.display = ''; + } + } + + if (parent) { + this.links.push(parent); + } +}; + +FooterManager.prototype.redraw = function () { + this.links.forEach(function (link) { + link.footerRedraw(); + }); +}; + +var Tabulator = function Tabulator(element, options) { + + this.options = {}; + + this.columnManager = null; // hold Column Manager + this.rowManager = null; //hold Row Manager + this.footerManager = null; //holder Footer Manager + this.vdomHoz = null; //holder horizontal virtual dom + + + this.browser = ""; //hold current browser type + this.browserSlow = false; //handle reduced functionality for slower browsers + this.browserMobile = false; //check if running on moble, prevent resize cancelling edit on keyboard appearence + this.rtl = false; //check if the table is in RTL mode + + this.modules = {}; //hold all modules bound to this table + + if (this.initializeElement(element)) { + this.initializeOptions(options || {}); + this._create(); + } + + Tabulator.prototype.comms.register(this); //register table for inderdevice communication +}; + +//default setup options +Tabulator.prototype.defaultOptions = { + + height: false, //height of tabulator + minHeight: false, //minimum height of tabulator + maxHeight: false, //maximum height of tabulator + + layout: "fitData", ///layout type "fitColumns" | "fitData" + layoutColumnsOnNewData: false, //update column widths on setData + + columnMinWidth: 40, //minimum global width for a column + columnHeaderVertAlign: "top", //vertical alignment of column headers + columnVertAlign: false, // DEPRECATED - Left to allow warning + + resizableColumns: true, //resizable columns + resizableRows: false, //resizable rows + autoResize: true, //auto resize table + + columns: [], //store for colum header info + + cellHozAlign: "", //horizontal align columns + cellVertAlign: "", //vertical align columns + headerHozAlign: "", //horizontal header alignment + + + data: [], //default starting data + + autoColumns: false, //build columns from data row structure + autoColumnsDefinitions: false, + + reactiveData: false, //enable data reactivity + + nestedFieldSeparator: ".", //seperatpr for nested data + + tooltips: false, //Tool tip value + tooltipsHeader: false, //Tool tip for headers + tooltipGenerationMode: "load", //when to generate tooltips + + initialSort: false, //initial sorting criteria + initialFilter: false, //initial filtering criteria + initialHeaderFilter: false, //initial header filtering criteria + + columnHeaderSortMulti: true, //multiple or single column sorting + + sortOrderReverse: false, //reverse internal sort ordering + + headerSort: true, //set default global header sort + headerSortTristate: false, //set default tristate header sorting + headerSortElement: "
", //header sort element + + footerElement: false, //hold footer element + + index: "id", //filed for row index + + textDirection: "auto", + + keybindings: [], //array for keybindings + + tabEndNewRow: false, //create new row when tab to end of table + + invalidOptionWarnings: true, //allow toggling of invalid option warnings + + clipboard: false, //enable clipboard + clipboardCopyStyled: true, //formatted table data + clipboardCopyConfig: false, //clipboard config + clipboardCopyFormatter: false, //DEPRICATED - REMOVE in 5.0 + clipboardCopyRowRange: "active", //restrict clipboard to visible rows only + clipboardPasteParser: "table", //convert pasted clipboard data to rows + clipboardPasteAction: "insert", //how to insert pasted data into the table + + clipboardCopied: function clipboardCopied() {}, //data has been copied to the clipboard + clipboardPasted: function clipboardPasted() {}, //data has been pasted into the table + clipboardPasteError: function clipboardPasteError() {}, //data has not successfully been pasted into the table + + downloadDataFormatter: false, //function to manipulate table data before it is downloaded + downloadReady: function downloadReady(data, blob) { + return blob; + }, //function to manipulate download data + downloadComplete: false, //function to manipulate download data + downloadConfig: {}, //download config + downloadRowRange: "active", //restrict download to active rows only + + dataTree: false, //enable data tree + dataTreeFilter: true, //filter child rows + dataTreeSort: true, //sort child rows + dataTreeElementColumn: false, + dataTreeBranchElement: true, //show data tree branch element + dataTreeChildIndent: 9, //data tree child indent in px + dataTreeChildField: "_children", //data tre column field to look for child rows + dataTreeCollapseElement: false, //data tree row collapse element + dataTreeExpandElement: false, //data tree row expand element + dataTreeStartExpanded: false, + dataTreeRowExpanded: function dataTreeRowExpanded() {}, //row has been expanded + dataTreeRowCollapsed: function dataTreeRowCollapsed() {}, //row has been collapsed + dataTreeChildColumnCalcs: false, //include visible data tree rows in column calculations + dataTreeSelectPropagate: false, //seleccting a parent row selects its children + + printAsHtml: false, //enable print as html + printFormatter: false, //printing page formatter + printHeader: false, //page header contents + printFooter: false, //page footer contents + printCopyStyle: true, //DEPRICATED - REMOVE in 5.0 + printStyled: true, //enable print as html styling + printVisibleRows: true, //DEPRICATED - REMOVE in 5.0 + printRowRange: "visible", //restrict print to visible rows only + printConfig: {}, //print config options + + addRowPos: "bottom", //position to insert blank rows, top|bottom + + selectable: "highlight", //highlight rows on hover + selectableRangeMode: "drag", //highlight rows on hover + selectableRollingSelection: true, //roll selection once maximum number of selectable rows is reached + selectablePersistence: true, // maintain selection when table view is updated + selectableCheck: function selectableCheck(data, row) { + return true; + }, //check wheather row is selectable + + headerFilterLiveFilterDelay: 300, //delay before updating column after user types in header filter + headerFilterPlaceholder: false, //placeholder text to display in header filters + + headerVisible: true, //hide header + + history: false, //enable edit history + + locale: false, //current system language + langs: {}, + + virtualDom: true, //enable DOM virtualization + virtualDomBuffer: 0, // set virtual DOM buffer size + virtualDomHoz: false, //enable horizontal DOM virtualization + + persistentLayout: false, //DEPRICATED - REMOVE in 5.0 + persistentSort: false, //DEPRICATED - REMOVE in 5.0 + persistentFilter: false, //DEPRICATED - REMOVE in 5.0 + persistenceID: "", //key for persistent storage + persistenceMode: true, //mode for storing persistence information + persistenceReaderFunc: false, //function for handling persistence data reading + persistenceWriterFunc: false, //function for handling persistence data writing + + persistence: false, + + responsiveLayout: false, //responsive layout flags + responsiveLayoutCollapseStartOpen: true, //start showing collapsed data + responsiveLayoutCollapseUseFormatters: true, //responsive layout collapse formatter + responsiveLayoutCollapseFormatter: false, //responsive layout collapse formatter + + pagination: false, //set pagination type + paginationSize: false, //set number of rows to a page + paginationInitialPage: 1, //initail page to show on load + paginationButtonCount: 5, // set count of page button + paginationSizeSelector: false, //add pagination size selector element + paginationElement: false, //element to hold pagination numbers + paginationDataSent: {}, //pagination data sent to the server + paginationDataReceived: {}, //pagination data received from the server + paginationAddRow: "page", //add rows on table or page + + ajaxURL: false, //url for ajax loading + ajaxURLGenerator: false, + ajaxParams: {}, //params for ajax loading + ajaxConfig: "get", //ajax request type + ajaxContentType: "form", //ajax request type + ajaxRequestFunc: false, //promise function + ajaxLoader: true, //show loader + ajaxLoaderLoading: false, //loader element + ajaxLoaderError: false, //loader element + ajaxFiltering: false, + ajaxSorting: false, + ajaxProgressiveLoad: false, //progressive loading + ajaxProgressiveLoadDelay: 0, //delay between requests + ajaxProgressiveLoadScrollMargin: 0, //margin before scroll begins + + groupBy: false, //enable table grouping and set field to group by + groupStartOpen: true, //starting state of group + groupValues: false, + groupUpdateOnCellEdit: false, + + groupHeader: false, //header generation function + groupHeaderPrint: null, + groupHeaderClipboard: null, + groupHeaderHtmlOutput: null, + groupHeaderDownload: null, + + htmlOutputConfig: false, //html outypu config + + movableColumns: false, //enable movable columns + + movableRows: false, //enable movable rows + movableRowsConnectedTables: false, //tables for movable rows to be connected to + movableRowsConnectedElements: false, //other elements for movable rows to be connected to + movableRowsSender: false, + movableRowsReceiver: "insert", + movableRowsSendingStart: function movableRowsSendingStart() {}, + movableRowsSent: function movableRowsSent() {}, + movableRowsSentFailed: function movableRowsSentFailed() {}, + movableRowsSendingStop: function movableRowsSendingStop() {}, + movableRowsReceivingStart: function movableRowsReceivingStart() {}, + movableRowsReceived: function movableRowsReceived() {}, + movableRowsReceivedFailed: function movableRowsReceivedFailed() {}, + movableRowsReceivingStop: function movableRowsReceivingStop() {}, + movableRowsElementDrop: function movableRowsElementDrop() {}, + + scrollToRowPosition: "top", + scrollToRowIfVisible: true, + + scrollToColumnPosition: "left", + scrollToColumnIfVisible: true, + + rowFormatter: false, + rowFormatterPrint: null, + rowFormatterClipboard: null, + rowFormatterHtmlOutput: null, + + placeholder: false, + + //table building callbacks + tableBuilding: function tableBuilding() {}, + tableBuilt: function tableBuilt() {}, + + //render callbacks + renderStarted: function renderStarted() {}, + renderComplete: function renderComplete() {}, + + //row callbacks + rowClick: false, + rowDblClick: false, + rowContext: false, + rowTap: false, + rowDblTap: false, + rowTapHold: false, + rowMouseEnter: false, + rowMouseLeave: false, + rowMouseOver: false, + rowMouseOut: false, + rowMouseMove: false, + rowContextMenu: false, + rowClickMenu: false, + rowAdded: function rowAdded() {}, + rowDeleted: function rowDeleted() {}, + rowMoved: function rowMoved() {}, + rowUpdated: function rowUpdated() {}, + rowSelectionChanged: function rowSelectionChanged() {}, + rowSelected: function rowSelected() {}, + rowDeselected: function rowDeselected() {}, + rowResized: function rowResized() {}, + + //cell callbacks + //row callbacks + cellClick: false, + cellDblClick: false, + cellContext: false, + cellTap: false, + cellDblTap: false, + cellTapHold: false, + cellMouseEnter: false, + cellMouseLeave: false, + cellMouseOver: false, + cellMouseOut: false, + cellMouseMove: false, + cellEditing: function cellEditing() {}, + cellEdited: function cellEdited() {}, + cellEditCancelled: function cellEditCancelled() {}, + + //column callbacks + columnMoved: false, + columnResized: function columnResized() {}, + columnTitleChanged: function columnTitleChanged() {}, + columnVisibilityChanged: function columnVisibilityChanged() {}, + + //HTML iport callbacks + htmlImporting: function htmlImporting() {}, + htmlImported: function htmlImported() {}, + + //data callbacks + dataLoading: function dataLoading() {}, + dataLoaded: function dataLoaded() {}, + dataEdited: false, //DEPRECATED + dataChanged: false, + + //ajax callbacks + ajaxRequesting: function ajaxRequesting() {}, + ajaxResponse: false, + ajaxError: function ajaxError() {}, + + //filtering callbacks + dataFiltering: false, + dataFiltered: false, + + //sorting callbacks + dataSorting: function dataSorting() {}, + dataSorted: function dataSorted() {}, + + //grouping callbacks + groupToggleElement: "arrow", + groupClosedShowCalcs: false, + dataGrouping: function dataGrouping() {}, + dataGrouped: false, + groupVisibilityChanged: function groupVisibilityChanged() {}, + groupClick: false, + groupDblClick: false, + groupContext: false, + groupContextMenu: false, + groupClickMenu: false, + groupTap: false, + groupDblTap: false, + groupTapHold: false, + + columnCalcs: true, + + //pagination callbacks + pageLoaded: function pageLoaded() {}, + + //localization callbacks + localized: function localized() {}, + + //validation callbacks + validationMode: "blocking", + validationFailed: function validationFailed() {}, + + //history callbacks + historyUndo: function historyUndo() {}, + historyRedo: function historyRedo() {}, + + //scroll callbacks + scrollHorizontal: function scrollHorizontal() {}, + scrollVertical: function scrollVertical() {} +}; + +Tabulator.prototype.initializeOptions = function (options) { + + //warn user if option is not available + if (options.invalidOptionWarnings !== false) { + for (var key in options) { + if (typeof this.defaultOptions[key] === "undefined") { + console.warn("Invalid table constructor option:", key); + } + } + } + + //assign options to table + for (var key in this.defaultOptions) { + if (key in options) { + this.options[key] = options[key]; + } else { + if (Array.isArray(this.defaultOptions[key])) { + this.options[key] = Object.assign([], this.defaultOptions[key]); + } else if (_typeof(this.defaultOptions[key]) === "object" && this.defaultOptions[key] !== null) { + this.options[key] = Object.assign({}, this.defaultOptions[key]); + } else { + this.options[key] = this.defaultOptions[key]; + } + } + } +}; + +Tabulator.prototype.initializeElement = function (element) { + + if (typeof HTMLElement !== "undefined" && element instanceof HTMLElement) { + this.element = element; + return true; + } else if (typeof element === "string") { + this.element = document.querySelector(element); + + if (this.element) { + return true; + } else { + console.error("Tabulator Creation Error - no element found matching selector: ", element); + return false; + } + } else { + console.error("Tabulator Creation Error - Invalid element provided:", element); + return false; + } +}; + +Tabulator.prototype.rtlCheck = function () { + var style = window.getComputedStyle(this.element); + + switch (this.options.textDirection) { + case "auto": + if (style.direction !== "rtl") { + break; + }; + + case "rtl": + this.element.classList.add("tabulator-rtl"); + this.rtl = true; + break; + + case "ltr": + this.element.classList.add("tabulator-ltr"); + + default: + this.rtl = false; + } +}; + +//convert depricated functionality to new functions +Tabulator.prototype._mapDepricatedFunctionality = function () { + + //map depricated persistance setup options + if (this.options.persistentLayout || this.options.persistentSort || this.options.persistentFilter) { + if (!this.options.persistence) { + this.options.persistence = {}; + } + } + + if (this.options.dataEdited) { + console.warn("DEPRECATION WARNING - dataEdited option has been deprecated, please use the dataChanged option instead"); + this.options.dataChanged = this.options.dataEdited; + } + + if (this.options.downloadDataFormatter) { + console.warn("DEPRECATION WARNING - downloadDataFormatter option has been deprecated"); + } + + if (typeof this.options.clipboardCopyHeader !== "undefined") { + this.options.columnHeaders = this.options.clipboardCopyHeader; + console.warn("DEPRECATION WARNING - clipboardCopyHeader option has been deprecated, please use the columnHeaders property on the clipboardCopyConfig option"); + } + + if (this.options.printVisibleRows !== true) { + console.warn("printVisibleRows option is deprecated, you should now use the printRowRange option"); + + this.options.persistence.printRowRange = "active"; + } + + if (this.options.printCopyStyle !== true) { + console.warn("printCopyStyle option is deprecated, you should now use the printStyled option"); + + this.options.persistence.printStyled = this.options.printCopyStyle; + } + + if (this.options.persistentLayout) { + console.warn("persistentLayout option is deprecated, you should now use the persistence option"); + + if (this.options.persistence !== true && typeof this.options.persistence.columns === "undefined") { + this.options.persistence.columns = true; + } + } + + if (this.options.persistentSort) { + console.warn("persistentSort option is deprecated, you should now use the persistence option"); + + if (this.options.persistence !== true && typeof this.options.persistence.sort === "undefined") { + this.options.persistence.sort = true; + } + } + + if (this.options.persistentFilter) { + console.warn("persistentFilter option is deprecated, you should now use the persistence option"); + + if (this.options.persistence !== true && typeof this.options.persistence.filter === "undefined") { + this.options.persistence.filter = true; + } + } + + if (this.options.columnVertAlign) { + console.warn("columnVertAlign option is deprecated, you should now use the columnHeaderVertAlign option"); + + this.options.columnHeaderVertAlign = this.options.columnVertAlign; + } +}; + +Tabulator.prototype._clearSelection = function () { + + this.element.classList.add("tabulator-block-select"); + + if (window.getSelection) { + if (window.getSelection().empty) { + // Chrome + window.getSelection().empty(); + } else if (window.getSelection().removeAllRanges) { + // Firefox + window.getSelection().removeAllRanges(); + } + } else if (document.selection) { + // IE? + document.selection.empty(); + } + + this.element.classList.remove("tabulator-block-select"); +}; + +//concreate table +Tabulator.prototype._create = function () { + this._clearObjectPointers(); + + this._mapDepricatedFunctionality(); + + this.bindModules(); + + this.rtlCheck(); + + if (this.element.tagName === "TABLE") { + if (this.modExists("htmlTableImport", true)) { + this.modules.htmlTableImport.parseTable(); + } + } + + this.columnManager = new ColumnManager(this); + this.rowManager = new RowManager(this); + this.footerManager = new FooterManager(this); + + this.columnManager.setRowManager(this.rowManager); + this.rowManager.setColumnManager(this.columnManager); + + if (this.options.virtualDomHoz) { + this.vdomHoz = new VDomHoz(this); + } + + this._buildElement(); + + this._loadInitialData(); +}; + +//clear pointers to objects in default config object +Tabulator.prototype._clearObjectPointers = function () { + this.options.columns = this.options.columns.slice(0); + + if (!this.options.reactiveData) { + this.options.data = this.options.data.slice(0); + } +}; + +//build tabulator element +Tabulator.prototype._buildElement = function () { + var _this24 = this; + + var element = this.element, + mod = this.modules, + options = this.options; + + options.tableBuilding.call(this); + + element.classList.add("tabulator"); + element.setAttribute("role", "grid"); + + //empty element + while (element.firstChild) { + element.removeChild(element.firstChild); + } //set table height + if (options.height) { + options.height = isNaN(options.height) ? options.height : options.height + "px"; + element.style.height = options.height; + } + + //set table min height + if (options.minHeight !== false) { + options.minHeight = isNaN(options.minHeight) ? options.minHeight : options.minHeight + "px"; + element.style.minHeight = options.minHeight; + } + + //set table maxHeight + if (options.maxHeight !== false) { + options.maxHeight = isNaN(options.maxHeight) ? options.maxHeight : options.maxHeight + "px"; + element.style.maxHeight = options.maxHeight; + } + + this.columnManager.initialize(); + this.rowManager.initialize(); + + this._detectBrowser(); + + if (this.modExists("layout", true)) { + mod.layout.initialize(options.layout); + } + + //set localization + + mod.localize.initialize(); + + if (options.headerFilterPlaceholder !== false) { + mod.localize.setHeaderFilterPlaceholder(options.headerFilterPlaceholder); + } + + for (var locale in options.langs) { + mod.localize.installLang(locale, options.langs[locale]); + } + + mod.localize.setLocale(options.locale); + + //configure placeholder element + if (typeof options.placeholder == "string") { + + var el = document.createElement("div"); + el.classList.add("tabulator-placeholder"); + + var span = document.createElement("span"); + span.innerHTML = options.placeholder; + + el.appendChild(span); + + options.placeholder = el; + } + + //build table elements + element.appendChild(this.columnManager.getElement()); + element.appendChild(this.rowManager.getElement()); + + if (options.footerElement) { + this.footerManager.activate(); + } + + if (options.persistence && this.modExists("persistence", true)) { + mod.persistence.initialize(); + } + + if (options.persistence && this.modExists("persistence", true) && mod.persistence.config.columns) { + options.columns = mod.persistence.load("columns", options.columns); + } + + if (options.movableRows && this.modExists("moveRow")) { + mod.moveRow.initialize(); + } + + if (options.autoColumns && this.options.data) { + this.columnManager.generateColumnsFromRowData(this.options.data); + } + + if (this.modExists("columnCalcs")) { + mod.columnCalcs.initialize(); + } + + this.columnManager.setColumns(options.columns); + + if (options.dataTree && this.modExists("dataTree", true)) { + mod.dataTree.initialize(); + } + + if (this.modExists("frozenRows")) { + this.modules.frozenRows.initialize(); + } + + if ((options.persistence && this.modExists("persistence", true) && mod.persistence.config.sort || options.initialSort) && this.modExists("sort", true)) { + var sorters = []; + + if (options.persistence && this.modExists("persistence", true) && mod.persistence.config.sort) { + sorters = mod.persistence.load("sort"); + + if (sorters === false && options.initialSort) { + sorters = options.initialSort; + } + } else if (options.initialSort) { + sorters = options.initialSort; + } + + mod.sort.setSort(sorters); + } + + if ((options.persistence && this.modExists("persistence", true) && mod.persistence.config.filter || options.initialFilter) && this.modExists("filter", true)) { + var filters = []; + + if (options.persistence && this.modExists("persistence", true) && mod.persistence.config.filter) { + filters = mod.persistence.load("filter"); + + if (filters === false && options.initialFilter) { + filters = options.initialFilter; + } + } else if (options.initialFilter) { + filters = options.initialFilter; + } + + mod.filter.setFilter(filters); + } + + if (options.initialHeaderFilter && this.modExists("filter", true)) { + options.initialHeaderFilter.forEach(function (item) { + + var column = _this24.columnManager.findColumn(item.field); + + if (column) { + mod.filter.setHeaderFilterValue(column, item.value); + } else { + console.warn("Column Filter Error - No matching column found:", item.field); + return false; + } + }); + } + + if (this.modExists("ajax")) { + mod.ajax.initialize(); + } + + if (options.pagination && this.modExists("page", true)) { + mod.page.initialize(); + } + + if (options.groupBy && this.modExists("groupRows", true)) { + mod.groupRows.initialize(); + } + + if (this.modExists("keybindings")) { + mod.keybindings.initialize(); + } + + if (this.modExists("selectRow")) { + mod.selectRow.clearSelectionData(true); + } + + if (options.autoResize && this.modExists("resizeTable")) { + mod.resizeTable.initialize(); + } + + if (this.modExists("clipboard")) { + mod.clipboard.initialize(); + } + + if (options.printAsHtml && this.modExists("print")) { + mod.print.initialize(); + } + + options.tableBuilt.call(this); +}; + +Tabulator.prototype._loadInitialData = function () { + var self = this; + + if (self.options.pagination && self.modExists("page")) { + self.modules.page.reset(true, true); + + if (self.options.pagination == "local") { + if (self.options.data.length) { + self.rowManager.setData(self.options.data, false, true); + } else { + if ((self.options.ajaxURL || self.options.ajaxURLGenerator) && self.modExists("ajax")) { + self.modules.ajax.loadData(false, true).then(function () {}).catch(function () { + if (self.options.paginationInitialPage) { + self.modules.page.setPage(self.options.paginationInitialPage); + } + }); + + return; + } else { + self.rowManager.setData(self.options.data, false, true); + } + } + + if (self.options.paginationInitialPage) { + self.modules.page.setPage(self.options.paginationInitialPage); + } + } else { + if (self.options.ajaxURL) { + self.modules.page.setPage(self.options.paginationInitialPage).then(function () {}).catch(function () {}); + } else { + self.rowManager.setData([], false, true); + } + } + } else { + if (self.options.data.length) { + self.rowManager.setData(self.options.data); + } else { + if ((self.options.ajaxURL || self.options.ajaxURLGenerator) && self.modExists("ajax")) { + self.modules.ajax.loadData(false, true).then(function () {}).catch(function () {}); + } else { + self.rowManager.setData(self.options.data, false, true); + } + } + } +}; + +//deconstructor +Tabulator.prototype.destroy = function () { + var element = this.element; + + Tabulator.prototype.comms.deregister(this); //deregister table from inderdevice communication + + if (this.options.reactiveData && this.modExists("reactiveData", true)) { + this.modules.reactiveData.unwatchData(); + } + + //clear row data + this.rowManager.rows.forEach(function (row) { + row.wipe(); + }); + + this.rowManager.rows = []; + this.rowManager.activeRows = []; + this.rowManager.displayRows = []; + + //clear event bindings + if (this.options.autoResize && this.modExists("resizeTable")) { + this.modules.resizeTable.clearBindings(); + } + + if (this.modExists("keybindings")) { + this.modules.keybindings.clearBindings(); + } + + //clear DOM + while (element.firstChild) { + element.removeChild(element.firstChild); + }element.classList.remove("tabulator"); +}; + +Tabulator.prototype._detectBrowser = function () { + var ua = navigator.userAgent || navigator.vendor || window.opera; + + if (ua.indexOf("Trident") > -1) { + this.browser = "ie"; + this.browserSlow = true; + } else if (ua.indexOf("Edge") > -1) { + this.browser = "edge"; + this.browserSlow = true; + } else if (ua.indexOf("Firefox") > -1) { + this.browser = "firefox"; + this.browserSlow = false; + } else { + this.browser = "other"; + this.browserSlow = false; + } + + this.browserMobile = /(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino|android|ipad|playbook|silk/i.test(ua) || /1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(ua.substr(0, 4)); +}; + +////////////////// Data Handling ////////////////// + +//block table redrawing +Tabulator.prototype.blockRedraw = function () { + return this.rowManager.blockRedraw(); +}; + +//restore table redrawing +Tabulator.prototype.restoreRedraw = function () { + return this.rowManager.restoreRedraw(); +}; + +//local data from local file +Tabulator.prototype.setDataFromLocalFile = function (extensions) { + var _this25 = this; + + return new Promise(function (resolve, reject) { + var input = document.createElement("input"); + input.type = "file"; + input.accept = extensions || ".json,application/json"; + + input.addEventListener("change", function (e) { + var file = input.files[0], + reader = new FileReader(), + data; + + reader.readAsText(file); + + reader.onload = function (e) { + + try { + data = JSON.parse(reader.result); + } catch (e) { + console.warn("File Load Error - File contents is invalid JSON", e); + reject(e); + return; + } + + _this25.setData(data).then(function (data) { + resolve(data); + }).catch(function (err) { + resolve(err); + }); + }; + + reader.onerror = function (e) { + console.warn("File Load Error - Unable to read file"); + reject(); + }; + }); + + input.click(); + }); +}; + +//load data +Tabulator.prototype.setData = function (data, params, config) { + if (this.modExists("ajax")) { + this.modules.ajax.blockActiveRequest(); + } + + return this._setData(data, params, config, false, true); +}; + +Tabulator.prototype._setData = function (data, params, config, inPosition, columnsChanged) { + var self = this; + + if (typeof data === "string") { + if (data.indexOf("{") == 0 || data.indexOf("[") == 0) { + //data is a json encoded string + return self.rowManager.setData(JSON.parse(data), inPosition, columnsChanged); + } else { + + if (self.modExists("ajax", true)) { + if (params) { + self.modules.ajax.setParams(params); + } + + if (config) { + self.modules.ajax.setConfig(config); + } + + self.modules.ajax.setUrl(data); + + if (self.options.pagination == "remote" && self.modExists("page", true)) { + self.modules.page.reset(true, true); + return self.modules.page.setPage(1); + } else { + //assume data is url, make ajax call to url to get data + return self.modules.ajax.loadData(inPosition, columnsChanged); + } + } + } + } else { + if (data) { + //asume data is already an object + return self.rowManager.setData(data, inPosition, columnsChanged); + } else { + + //no data provided, check if ajaxURL is present; + if (self.modExists("ajax") && (self.modules.ajax.getUrl || self.options.ajaxURLGenerator)) { + + if (self.options.pagination == "remote" && self.modExists("page", true)) { + self.modules.page.reset(true, true); + return self.modules.page.setPage(1); + } else { + return self.modules.ajax.loadData(inPosition, columnsChanged); + } + } else { + //empty data + return self.rowManager.setData([], inPosition, columnsChanged); + } + } + } +}; + +//clear data +Tabulator.prototype.clearData = function () { + if (this.modExists("ajax")) { + this.modules.ajax.blockActiveRequest(); + } + + this.rowManager.clearData(); +}; + +//get table data array +Tabulator.prototype.getData = function (active) { + + if (active === true) { + console.warn("passing a boolean to the getData function is deprecated, you should now pass the string 'active'"); + active = "active"; + } + + return this.rowManager.getData(active); +}; + +//get table data array count +Tabulator.prototype.getDataCount = function (active) { + + if (active === true) { + console.warn("passing a boolean to the getDataCount function is deprecated, you should now pass the string 'active'"); + active = "active"; + } + + return this.rowManager.getDataCount(active); +}; + +//search for specific row components +Tabulator.prototype.searchRows = function (field, type, value) { + if (this.modExists("filter", true)) { + return this.modules.filter.search("rows", field, type, value); + } +}; + +//search for specific data +Tabulator.prototype.searchData = function (field, type, value) { + if (this.modExists("filter", true)) { + return this.modules.filter.search("data", field, type, value); + } +}; + +//get table html +Tabulator.prototype.getHtml = function (visible, style, config) { + if (this.modExists("export", true)) { + return this.modules.export.getHtml(visible, style, config); + } +}; + +//get print html +Tabulator.prototype.print = function (visible, style, config) { + if (this.modExists("print", true)) { + return this.modules.print.printFullscreen(visible, style, config); + } +}; + +//retrieve Ajax URL +Tabulator.prototype.getAjaxUrl = function () { + if (this.modExists("ajax", true)) { + return this.modules.ajax.getUrl(); + } +}; + +//replace data, keeping table in position with same sort +Tabulator.prototype.replaceData = function (data, params, config) { + if (this.modExists("ajax")) { + this.modules.ajax.blockActiveRequest(); + } + + return this._setData(data, params, config, true); +}; + +//update table data +Tabulator.prototype.updateData = function (data) { + var _this26 = this; + + var self = this; + var responses = 0; + + return new Promise(function (resolve, reject) { + if (_this26.modExists("ajax")) { + _this26.modules.ajax.blockActiveRequest(); + } + + if (typeof data === "string") { + data = JSON.parse(data); + } + + if (data) { + data.forEach(function (item) { + var row = self.rowManager.findRow(item[self.options.index]); + + if (row) { + responses++; + + row.updateData(item).then(function () { + responses--; + + if (!responses) { + resolve(); + } + }); + } + }); + } else { + console.warn("Update Error - No data provided"); + reject("Update Error - No data provided"); + } + }); +}; + +Tabulator.prototype.addData = function (data, pos, index) { + var _this27 = this; + + return new Promise(function (resolve, reject) { + if (_this27.modExists("ajax")) { + _this27.modules.ajax.blockActiveRequest(); + } + + if (typeof data === "string") { + data = JSON.parse(data); + } + + if (data) { + _this27.rowManager.addRows(data, pos, index).then(function (rows) { + var output = []; + + rows.forEach(function (row) { + output.push(row.getComponent()); + }); + + resolve(output); + }); + } else { + console.warn("Update Error - No data provided"); + reject("Update Error - No data provided"); + } + }); +}; + +//update table data +Tabulator.prototype.updateOrAddData = function (data) { + var _this28 = this; + + var self = this, + rows = [], + responses = 0; + + return new Promise(function (resolve, reject) { + if (_this28.modExists("ajax")) { + _this28.modules.ajax.blockActiveRequest(); + } + + if (typeof data === "string") { + data = JSON.parse(data); + } + + if (data) { + data.forEach(function (item) { + var row = self.rowManager.findRow(item[self.options.index]); + + responses++; + + if (row) { + row.updateData(item).then(function () { + responses--; + rows.push(row.getComponent()); + + if (!responses) { + resolve(rows); + } + }); + } else { + self.rowManager.addRows(item).then(function (newRows) { + responses--; + rows.push(newRows[0].getComponent()); + + if (!responses) { + resolve(rows); + } + }); + } + }); + } else { + console.warn("Update Error - No data provided"); + reject("Update Error - No data provided"); + } + }); +}; + +//get row object +Tabulator.prototype.getRow = function (index) { + var row = this.rowManager.findRow(index); + + if (row) { + return row.getComponent(); + } else { + console.warn("Find Error - No matching row found:", index); + return false; + } +}; + +//get row object +Tabulator.prototype.getRowFromPosition = function (position, active) { + var row = this.rowManager.getRowFromPosition(position, active); + + if (row) { + return row.getComponent(); + } else { + console.warn("Find Error - No matching row found:", position); + return false; + } +}; + +//delete row from table +Tabulator.prototype.deleteRow = function (index) { + var _this29 = this; + + return new Promise(function (resolve, reject) { + var self = _this29, + count = 0, + successCount = 0, + foundRows = []; + + function doneCheck() { + count++; + + if (count == index.length) { + if (successCount) { + self.rowManager.reRenderInPosition(); + resolve(); + } + } + } + + if (!Array.isArray(index)) { + index = [index]; + } + + //find matching rows + index.forEach(function (item) { + var row = _this29.rowManager.findRow(item, true); + + if (row) { + foundRows.push(row); + } else { + console.warn("Delete Error - No matching row found:", item); + reject("Delete Error - No matching row found"); + doneCheck(); + } + }); + + //sort rows into correct order to ensure smooth delete from table + foundRows.sort(function (a, b) { + return _this29.rowManager.rows.indexOf(a) > _this29.rowManager.rows.indexOf(b) ? 1 : -1; + }); + + foundRows.forEach(function (row) { + row.delete().then(function () { + successCount++; + doneCheck(); + }).catch(function (err) { + doneCheck(); + reject(err); + }); + }); + }); +}; + +//add row to table +Tabulator.prototype.addRow = function (data, pos, index) { + var _this30 = this; + + return new Promise(function (resolve, reject) { + if (typeof data === "string") { + data = JSON.parse(data); + } + + _this30.rowManager.addRows(data, pos, index).then(function (rows) { + //recalc column calculations if present + if (_this30.modExists("columnCalcs")) { + _this30.modules.columnCalcs.recalc(_this30.rowManager.activeRows); + } + + resolve(rows[0].getComponent()); + }); + }); +}; + +//update a row if it exitsts otherwise create it +Tabulator.prototype.updateOrAddRow = function (index, data) { + var _this31 = this; + + return new Promise(function (resolve, reject) { + var row = _this31.rowManager.findRow(index); + + if (typeof data === "string") { + data = JSON.parse(data); + } + + if (row) { + row.updateData(data).then(function () { + //recalc column calculations if present + if (_this31.modExists("columnCalcs")) { + _this31.modules.columnCalcs.recalc(_this31.rowManager.activeRows); + } + + resolve(row.getComponent()); + }).catch(function (err) { + reject(err); + }); + } else { + row = _this31.rowManager.addRows(data).then(function (rows) { + //recalc column calculations if present + if (_this31.modExists("columnCalcs")) { + _this31.modules.columnCalcs.recalc(_this31.rowManager.activeRows); + } + + resolve(rows[0].getComponent()); + }).catch(function (err) { + reject(err); + }); + } + }); +}; + +//update row data +Tabulator.prototype.updateRow = function (index, data) { + var _this32 = this; + + return new Promise(function (resolve, reject) { + var row = _this32.rowManager.findRow(index); + + if (typeof data === "string") { + data = JSON.parse(data); + } + + if (row) { + row.updateData(data).then(function () { + resolve(row.getComponent()); + }).catch(function (err) { + reject(err); + }); + } else { + console.warn("Update Error - No matching row found:", index); + reject("Update Error - No matching row found"); + } + }); +}; + +//scroll to row in DOM +Tabulator.prototype.scrollToRow = function (index, position, ifVisible) { + var _this33 = this; + + return new Promise(function (resolve, reject) { + var row = _this33.rowManager.findRow(index); + + if (row) { + _this33.rowManager.scrollToRow(row, position, ifVisible).then(function () { + resolve(); + }).catch(function (err) { + reject(err); + }); + } else { + console.warn("Scroll Error - No matching row found:", index); + reject("Scroll Error - No matching row found"); + } + }); +}; + +Tabulator.prototype.moveRow = function (from, to, after) { + var fromRow = this.rowManager.findRow(from); + + if (fromRow) { + fromRow.moveToRow(to, after); + } else { + console.warn("Move Error - No matching row found:", from); + } +}; + +Tabulator.prototype.getRows = function (active) { + + if (active === true) { + console.warn("passing a boolean to the getRows function is deprecated, you should now pass the string 'active'"); + active = "active"; + } + + return this.rowManager.getComponents(active); +}; + +//get position of row in table +Tabulator.prototype.getRowPosition = function (index, active) { + var row = this.rowManager.findRow(index); + + if (row) { + return this.rowManager.getRowPosition(row, active); + } else { + console.warn("Position Error - No matching row found:", index); + return false; + } +}; + +//copy table data to clipboard +Tabulator.prototype.copyToClipboard = function (selector) { + if (this.modExists("clipboard", true)) { + this.modules.clipboard.copy(selector); + } +}; + +/////////////// Column Functions /////////////// + +Tabulator.prototype.setColumns = function (definition) { + this.columnManager.setColumns(definition); +}; + +Tabulator.prototype.getColumns = function (structured) { + return this.columnManager.getComponents(structured); +}; + +Tabulator.prototype.getColumn = function (field) { + var col = this.columnManager.findColumn(field); + + if (col) { + return col.getComponent(); + } else { + console.warn("Find Error - No matching column found:", field); + return false; + } +}; + +Tabulator.prototype.getColumnDefinitions = function () { + return this.columnManager.getDefinitionTree(); +}; + +Tabulator.prototype.getColumnLayout = function () { + if (this.modExists("persistence", true)) { + return this.modules.persistence.parseColumns(this.columnManager.getColumns()); + } +}; + +Tabulator.prototype.setColumnLayout = function (layout) { + if (this.modExists("persistence", true)) { + this.columnManager.setColumns(this.modules.persistence.mergeDefinition(this.options.columns, layout)); + return true; + } + return false; +}; + +Tabulator.prototype.showColumn = function (field) { + var column = this.columnManager.findColumn(field); + + if (column) { + column.show(); + + if (this.options.responsiveLayout && this.modExists("responsiveLayout", true)) { + this.modules.responsiveLayout.update(); + } + } else { + console.warn("Column Show Error - No matching column found:", field); + return false; + } +}; + +Tabulator.prototype.hideColumn = function (field) { + var column = this.columnManager.findColumn(field); + + if (column) { + column.hide(); + + if (this.options.responsiveLayout && this.modExists("responsiveLayout", true)) { + this.modules.responsiveLayout.update(); + } + } else { + console.warn("Column Hide Error - No matching column found:", field); + return false; + } +}; + +Tabulator.prototype.toggleColumn = function (field) { + var column = this.columnManager.findColumn(field); + + if (column) { + if (column.visible) { + column.hide(); + } else { + column.show(); + } + } else { + console.warn("Column Visibility Toggle Error - No matching column found:", field); + return false; + } +}; + +Tabulator.prototype.addColumn = function (definition, before, field) { + var _this34 = this; + + return new Promise(function (resolve, reject) { + var column = _this34.columnManager.findColumn(field); + + _this34.columnManager.addColumn(definition, before, column).then(function (column) { + resolve(column.getComponent()); + }).catch(function (err) { + reject(err); + }); + }); +}; + +Tabulator.prototype.deleteColumn = function (field) { + var _this35 = this; + + return new Promise(function (resolve, reject) { + var column = _this35.columnManager.findColumn(field); + + if (column) { + column.delete().then(function () { + resolve(); + }).catch(function (err) { + reject(err); + }); + } else { + console.warn("Column Delete Error - No matching column found:", field); + reject(); + } + }); +}; + +Tabulator.prototype.updateColumnDefinition = function (field, definition) { + var _this36 = this; + + return new Promise(function (resolve, reject) { + var column = _this36.columnManager.findColumn(field); + + if (column) { + column.updateDefinition(definition).then(function (col) { + resolve(col); + }).catch(function (err) { + reject(err); + }); + } else { + console.warn("Column Update Error - No matching column found:", field); + reject(); + } + }); +}; + +Tabulator.prototype.moveColumn = function (from, to, after) { + var fromColumn = this.columnManager.findColumn(from); + var toColumn = this.columnManager.findColumn(to); + + if (fromColumn) { + if (toColumn) { + this.columnManager.moveColumn(fromColumn, toColumn, after); + } else { + console.warn("Move Error - No matching column found:", toColumn); + } + } else { + console.warn("Move Error - No matching column found:", from); + } +}; + +//scroll to column in DOM +Tabulator.prototype.scrollToColumn = function (field, position, ifVisible) { + var _this37 = this; + + return new Promise(function (resolve, reject) { + var column = _this37.columnManager.findColumn(field); + + if (column) { + _this37.columnManager.scrollToColumn(column, position, ifVisible).then(function () { + resolve(); + }).catch(function (err) { + reject(err); + }); + } else { + console.warn("Scroll Error - No matching column found:", field); + reject("Scroll Error - No matching column found"); + } + }); +}; + +//////////// Localization Functions //////////// +Tabulator.prototype.setLocale = function (locale) { + this.modules.localize.setLocale(locale); +}; + +Tabulator.prototype.getLocale = function () { + return this.modules.localize.getLocale(); +}; + +Tabulator.prototype.getLang = function (locale) { + return this.modules.localize.getLang(locale); +}; + +//////////// General Public Functions //////////// + +//redraw list without updating data +Tabulator.prototype.redraw = function (force) { + this.columnManager.redraw(force); + this.rowManager.redraw(force); +}; + +Tabulator.prototype.setHeight = function (height) { + + if (this.rowManager.renderMode !== "classic") { + this.options.height = isNaN(height) ? height : height + "px"; + this.element.style.height = this.options.height; + this.rowManager.setRenderMode(); + this.rowManager.redraw(); + } else { + console.warn("setHeight function is not available in classic render mode"); + } +}; + +///////////////////// Sorting //////////////////// + +//trigger sort +Tabulator.prototype.setSort = function (sortList, dir) { + if (this.modExists("sort", true)) { + this.modules.sort.setSort(sortList, dir); + this.rowManager.sorterRefresh(); + } +}; + +Tabulator.prototype.getSorters = function () { + if (this.modExists("sort", true)) { + return this.modules.sort.getSort(); + } +}; + +Tabulator.prototype.clearSort = function () { + if (this.modExists("sort", true)) { + this.modules.sort.clear(); + this.rowManager.sorterRefresh(); + } +}; + +///////////////////// Filtering //////////////////// + +//set standard filters +Tabulator.prototype.setFilter = function (field, type, value, params) { + if (this.modExists("filter", true)) { + this.modules.filter.setFilter(field, type, value, params); + this.rowManager.filterRefresh(); + } +}; + +//add filter to array +Tabulator.prototype.addFilter = function (field, type, value, params) { + if (this.modExists("filter", true)) { + this.modules.filter.addFilter(field, type, value, params); + this.rowManager.filterRefresh(); + } +}; + +//get all filters +Tabulator.prototype.getFilters = function (all) { + if (this.modExists("filter", true)) { + return this.modules.filter.getFilters(all); + } +}; + +Tabulator.prototype.setHeaderFilterFocus = function (field) { + if (this.modExists("filter", true)) { + var column = this.columnManager.findColumn(field); + + if (column) { + this.modules.filter.setHeaderFilterFocus(column); + } else { + console.warn("Column Filter Focus Error - No matching column found:", field); + return false; + } + } +}; + +Tabulator.prototype.getHeaderFilterValue = function (field) { + if (this.modExists("filter", true)) { + var column = this.columnManager.findColumn(field); + + if (column) { + return this.modules.filter.getHeaderFilterValue(column); + } else { + console.warn("Column Filter Error - No matching column found:", field); + } + } +}; + +Tabulator.prototype.setHeaderFilterValue = function (field, value) { + if (this.modExists("filter", true)) { + var column = this.columnManager.findColumn(field); + + if (column) { + this.modules.filter.setHeaderFilterValue(column, value); + } else { + console.warn("Column Filter Error - No matching column found:", field); + return false; + } + } +}; + +Tabulator.prototype.getHeaderFilters = function () { + if (this.modExists("filter", true)) { + return this.modules.filter.getHeaderFilters(); + } +}; + +//remove filter from array +Tabulator.prototype.removeFilter = function (field, type, value) { + if (this.modExists("filter", true)) { + this.modules.filter.removeFilter(field, type, value); + this.rowManager.filterRefresh(); + } +}; + +//clear filters +Tabulator.prototype.clearFilter = function (all) { + if (this.modExists("filter", true)) { + this.modules.filter.clearFilter(all); + this.rowManager.filterRefresh(); + } +}; + +//clear header filters +Tabulator.prototype.clearHeaderFilter = function () { + if (this.modExists("filter", true)) { + this.modules.filter.clearHeaderFilter(); + this.rowManager.filterRefresh(); + } +}; + +///////////////////// select //////////////////// +Tabulator.prototype.selectRow = function (rows) { + if (this.modExists("selectRow", true)) { + if (rows === true) { + console.warn("passing a boolean to the selectRowselectRow function is deprecated, you should now pass the string 'active'"); + rows = "active"; + } + this.modules.selectRow.selectRows(rows); + } +}; + +Tabulator.prototype.deselectRow = function (rows) { + if (this.modExists("selectRow", true)) { + this.modules.selectRow.deselectRows(rows); + } +}; + +Tabulator.prototype.toggleSelectRow = function (row) { + if (this.modExists("selectRow", true)) { + this.modules.selectRow.toggleRow(row); + } +}; + +Tabulator.prototype.getSelectedRows = function () { + if (this.modExists("selectRow", true)) { + return this.modules.selectRow.getSelectedRows(); + } +}; + +Tabulator.prototype.getSelectedData = function () { + if (this.modExists("selectRow", true)) { + return this.modules.selectRow.getSelectedData(); + } +}; + +///////////////////// validation //////////////////// +Tabulator.prototype.getInvalidCells = function () { + if (this.modExists("validate", true)) { + return this.modules.validate.getInvalidCells(); + } +}; + +Tabulator.prototype.clearCellValidation = function (cells) { + var _this38 = this; + + if (this.modExists("validate", true)) { + + if (!cells) { + cells = this.modules.validate.getInvalidCells(); + } + + if (!Array.isArray(cells)) { + cells = [cells]; + } + + cells.forEach(function (cell) { + _this38.modules.validate.clearValidation(cell._getSelf()); + }); + } +}; + +Tabulator.prototype.validate = function (cells) { + var output = []; + + //clear row data + this.rowManager.rows.forEach(function (row) { + var valid = row.validate(); + + if (valid !== true) { + output = output.concat(valid); + } + }); + + return output.length ? output : true; +}; + +//////////// Pagination Functions //////////// + +Tabulator.prototype.setMaxPage = function (max) { + if (this.options.pagination && this.modExists("page")) { + this.modules.page.setMaxPage(max); + } else { + return false; + } +}; + +Tabulator.prototype.setPage = function (page) { + if (this.options.pagination && this.modExists("page")) { + return this.modules.page.setPage(page); + } else { + return new Promise(function (resolve, reject) { + reject(); + }); + } +}; + +Tabulator.prototype.setPageToRow = function (row) { + var _this39 = this; + + return new Promise(function (resolve, reject) { + if (_this39.options.pagination && _this39.modExists("page")) { + row = _this39.rowManager.findRow(row); + + if (row) { + _this39.modules.page.setPageToRow(row).then(function () { + resolve(); + }).catch(function () { + reject(); + }); + } else { + reject(); + } + } else { + reject(); + } + }); +}; + +Tabulator.prototype.setPageSize = function (size) { + if (this.options.pagination && this.modExists("page")) { + this.modules.page.setPageSize(size); + this.modules.page.setPage(1).then(function () {}).catch(function () {}); + } else { + return false; + } +}; + +Tabulator.prototype.getPageSize = function () { + if (this.options.pagination && this.modExists("page", true)) { + return this.modules.page.getPageSize(); + } +}; + +Tabulator.prototype.previousPage = function () { + if (this.options.pagination && this.modExists("page")) { + this.modules.page.previousPage(); + } else { + return false; + } +}; + +Tabulator.prototype.nextPage = function () { + if (this.options.pagination && this.modExists("page")) { + this.modules.page.nextPage(); + } else { + return false; + } +}; + +Tabulator.prototype.getPage = function () { + if (this.options.pagination && this.modExists("page")) { + return this.modules.page.getPage(); + } else { + return false; + } +}; + +Tabulator.prototype.getPageMax = function () { + if (this.options.pagination && this.modExists("page")) { + return this.modules.page.getPageMax(); + } else { + return false; + } +}; + +///////////////// Grouping Functions /////////////// + +Tabulator.prototype.setGroupBy = function (groups) { + if (this.modExists("groupRows", true)) { + this.options.groupBy = groups; + this.modules.groupRows.initialize(); + this.rowManager.refreshActiveData("display"); + + if (this.options.persistence && this.modExists("persistence", true) && this.modules.persistence.config.group) { + this.modules.persistence.save("group"); + } + } else { + return false; + } +}; + +Tabulator.prototype.setGroupValues = function (groupValues) { + if (this.modExists("groupRows", true)) { + this.options.groupValues = groupValues; + this.modules.groupRows.initialize(); + this.rowManager.refreshActiveData("display"); + + if (this.options.persistence && this.modExists("persistence", true) && this.modules.persistence.config.group) { + this.modules.persistence.save("group"); + } + } else { + return false; + } +}; + +Tabulator.prototype.setGroupStartOpen = function (values) { + if (this.modExists("groupRows", true)) { + this.options.groupStartOpen = values; + this.modules.groupRows.initialize(); + if (this.options.groupBy) { + this.rowManager.refreshActiveData("group"); + + if (this.options.persistence && this.modExists("persistence", true) && this.modules.persistence.config.group) { + this.modules.persistence.save("group"); + } + } else { + console.warn("Grouping Update - cant refresh view, no groups have been set"); + } + } else { + return false; + } +}; + +Tabulator.prototype.setGroupHeader = function (values) { + if (this.modExists("groupRows", true)) { + this.options.groupHeader = values; + this.modules.groupRows.initialize(); + if (this.options.groupBy) { + this.rowManager.refreshActiveData("group"); + + if (this.options.persistence && this.modExists("persistence", true) && this.modules.persistence.config.group) { + this.modules.persistence.save("group"); + } + } else { + console.warn("Grouping Update - cant refresh view, no groups have been set"); + } + } else { + return false; + } +}; + +Tabulator.prototype.getGroups = function (values) { + if (this.modExists("groupRows", true)) { + return this.modules.groupRows.getGroups(true); + } else { + return false; + } +}; + +// get grouped table data in the same format as getData() +Tabulator.prototype.getGroupedData = function () { + if (this.modExists("groupRows", true)) { + return this.options.groupBy ? this.modules.groupRows.getGroupedData() : this.getData(); + } +}; + +Tabulator.prototype.getEditedCells = function () { + if (this.modExists("edit", true)) { + return this.modules.edit.getEditedCells(); + } +}; + +Tabulator.prototype.clearCellEdited = function (cells) { + var _this40 = this; + + if (this.modExists("edit", true)) { + + if (!cells) { + cells = this.modules.edit.getEditedCells(); + } + + if (!Array.isArray(cells)) { + cells = [cells]; + } + + cells.forEach(function (cell) { + _this40.modules.edit.clearEdited(cell._getSelf()); + }); + } +}; + +///////////////// Column Calculation Functions /////////////// +Tabulator.prototype.getCalcResults = function () { + if (this.modExists("columnCalcs", true)) { + return this.modules.columnCalcs.getResults(); + } else { + return false; + } +}; + +Tabulator.prototype.recalc = function () { + if (this.modExists("columnCalcs", true)) { + this.modules.columnCalcs.recalcAll(this.rowManager.activeRows); + } +}; + +/////////////// Navigation Management ////////////// + +Tabulator.prototype.navigatePrev = function () { + var cell = false; + + if (this.modExists("edit", true)) { + cell = this.modules.edit.currentCell; + + if (cell) { + return cell.nav().prev(); + } + } + + return false; +}; + +Tabulator.prototype.navigateNext = function () { + var cell = false; + + if (this.modExists("edit", true)) { + cell = this.modules.edit.currentCell; + + if (cell) { + return cell.nav().next(); + } + } + + return false; +}; + +Tabulator.prototype.navigateLeft = function () { + var cell = false; + + if (this.modExists("edit", true)) { + cell = this.modules.edit.currentCell; + + if (cell) { + e.preventDefault(); + return cell.nav().left(); + } + } + + return false; +}; + +Tabulator.prototype.navigateRight = function () { + var cell = false; + + if (this.modExists("edit", true)) { + cell = this.modules.edit.currentCell; + + if (cell) { + e.preventDefault(); + return cell.nav().right(); + } + } + + return false; +}; + +Tabulator.prototype.navigateUp = function () { + var cell = false; + + if (this.modExists("edit", true)) { + cell = this.modules.edit.currentCell; + + if (cell) { + e.preventDefault(); + return cell.nav().up(); + } + } + + return false; +}; + +Tabulator.prototype.navigateDown = function () { + var cell = false; + + if (this.modExists("edit", true)) { + cell = this.modules.edit.currentCell; + + if (cell) { + e.preventDefault(); + return cell.nav().down(); + } + } + + return false; +}; + +/////////////// History Management ////////////// +Tabulator.prototype.undo = function () { + if (this.options.history && this.modExists("history", true)) { + return this.modules.history.undo(); + } else { + return false; + } +}; + +Tabulator.prototype.redo = function () { + if (this.options.history && this.modExists("history", true)) { + return this.modules.history.redo(); + } else { + return false; + } +}; + +Tabulator.prototype.getHistoryUndoSize = function () { + if (this.options.history && this.modExists("history", true)) { + return this.modules.history.getHistoryUndoSize(); + } else { + return false; + } +}; + +Tabulator.prototype.getHistoryRedoSize = function () { + if (this.options.history && this.modExists("history", true)) { + return this.modules.history.getHistoryRedoSize(); + } else { + return false; + } +}; + +/////////////// Download Management ////////////// + +Tabulator.prototype.download = function (type, filename, options, active) { + if (this.modExists("download", true)) { + this.modules.download.download(type, filename, options, active); + } +}; + +Tabulator.prototype.downloadToTab = function (type, filename, options, active) { + if (this.modExists("download", true)) { + this.modules.download.download(type, filename, options, active, true); + } +}; + +/////////// Inter Table Communications /////////// + +Tabulator.prototype.tableComms = function (table, module, action, data) { + this.modules.comms.receive(table, module, action, data); +}; + +////////////// Extension Management ////////////// + +//object to hold module +Tabulator.prototype.moduleBindings = {}; + +//extend module +Tabulator.prototype.extendModule = function (name, property, values) { + + if (Tabulator.prototype.moduleBindings[name]) { + var source = Tabulator.prototype.moduleBindings[name].prototype[property]; + + if (source) { + if ((typeof values === 'undefined' ? 'undefined' : _typeof(values)) == "object") { + for (var key in values) { + source[key] = values[key]; + } + } else { + console.warn("Module Error - Invalid value type, it must be an object"); + } + } else { + console.warn("Module Error - property does not exist:", property); + } + } else { + console.warn("Module Error - module does not exist:", name); + } +}; + +//add module to tabulator +Tabulator.prototype.registerModule = function (name, module) { + var self = this; + Tabulator.prototype.moduleBindings[name] = module; +}; + +//ensure that module are bound to instantiated function +Tabulator.prototype.bindModules = function () { + this.modules = {}; + + for (var name in Tabulator.prototype.moduleBindings) { + this.modules[name] = new Tabulator.prototype.moduleBindings[name](this); + } +}; + +//Check for module +Tabulator.prototype.modExists = function (plugin, required) { + if (this.modules[plugin]) { + return true; + } else { + if (required) { + console.error("Tabulator Module Not Installed: " + plugin); + } + return false; + } +}; + +Tabulator.prototype.helpers = { + + elVisible: function elVisible(el) { + return !(el.offsetWidth <= 0 && el.offsetHeight <= 0); + }, + + elOffset: function elOffset(el) { + var box = el.getBoundingClientRect(); + + return { + top: box.top + window.pageYOffset - document.documentElement.clientTop, + left: box.left + window.pageXOffset - document.documentElement.clientLeft + }; + }, + + deepClone: function deepClone(obj) { + var clone = Object.assign(Array.isArray(obj) ? [] : {}, obj); + + for (var i in obj) { + if (obj[i] != null && _typeof(obj[i]) === "object") { + if (obj[i] instanceof Date) { + clone[i] = new Date(obj[i]); + } else { + clone[i] = this.deepClone(obj[i]); + } + } + } + return clone; + } +}; + +Tabulator.prototype.comms = { + tables: [], + register: function register(table) { + Tabulator.prototype.comms.tables.push(table); + }, + deregister: function deregister(table) { + var index = Tabulator.prototype.comms.tables.indexOf(table); + + if (index > -1) { + Tabulator.prototype.comms.tables.splice(index, 1); + } + }, + lookupTable: function lookupTable(query, silent) { + var results = [], + matches, + match; + + if (typeof query === "string") { + matches = document.querySelectorAll(query); + + if (matches.length) { + for (var i = 0; i < matches.length; i++) { + match = Tabulator.prototype.comms.matchElement(matches[i]); + + if (match) { + results.push(match); + } + } + } + } else if (typeof HTMLElement !== "undefined" && query instanceof HTMLElement || query instanceof Tabulator) { + match = Tabulator.prototype.comms.matchElement(query); + + if (match) { + results.push(match); + } + } else if (Array.isArray(query)) { + query.forEach(function (item) { + results = results.concat(Tabulator.prototype.comms.lookupTable(item)); + }); + } else { + if (!silent) { + console.warn("Table Connection Error - Invalid Selector", query); + } + } + + return results; + }, + matchElement: function matchElement(element) { + return Tabulator.prototype.comms.tables.find(function (table) { + return element instanceof Tabulator ? table === element : table.element === element; + }); + } +}; + +Tabulator.prototype.findTable = function (query) { + var results = Tabulator.prototype.comms.lookupTable(query, true); + return Array.isArray(results) && !results.length ? false : results; +}; + +var Layout = function Layout(table) { + + this.table = table; + + this.mode = null; +}; + +//initialize layout system + +Layout.prototype.initialize = function (layout) { + + if (this.modes[layout]) { + + this.mode = layout; + } else { + + console.warn("Layout Error - invalid mode set, defaulting to 'fitData' : " + layout); + + this.mode = 'fitData'; + } + + this.table.element.setAttribute("tabulator-layout", this.mode); +}; + +Layout.prototype.getMode = function () { + + return this.mode; +}; + +//trigger table layout + +Layout.prototype.layout = function () { + + this.modes[this.mode].call(this, this.table.columnManager.columnsByIndex); +}; + +//layout render functions + +Layout.prototype.modes = { + + //resize columns to fit data they contain + + "fitData": function fitData(columns) { + + if (this.table.options.virtualDomHoz) { + + this.table.vdomHoz.fitDataLayoutOverride(); + } else { + + columns.forEach(function (column) { + + column.reinitializeWidth(); + }); + } + + if (this.table.options.responsiveLayout && this.table.modExists("responsiveLayout", true)) { + + this.table.modules.responsiveLayout.update(); + } + }, + + //resize columns to fit data they contain and stretch row to fill table + + "fitDataFill": function fitDataFill(columns) { + + columns.forEach(function (column) { + + column.reinitializeWidth(); + }); + + if (this.table.options.responsiveLayout && this.table.modExists("responsiveLayout", true)) { + + this.table.modules.responsiveLayout.update(); + } + }, + + //resize columns to fit data they contain + + "fitDataTable": function fitDataTable(columns) { + + columns.forEach(function (column) { + + column.reinitializeWidth(); + }); + + if (this.table.options.responsiveLayout && this.table.modExists("responsiveLayout", true)) { + + this.table.modules.responsiveLayout.update(); + } + }, + + //resize columns to fit data the contain and stretch last column to fill table + + "fitDataStretch": function fitDataStretch(columns) { + var _this41 = this; + + var colsWidth = 0, + tableWidth = this.table.rowManager.element.clientWidth, + gap = 0, + lastCol = false; + + columns.forEach(function (column, i) { + + if (!column.widthFixed) { + + column.reinitializeWidth(); + } + + if (_this41.table.options.responsiveLayout ? column.modules.responsive.visible : column.visible) { + + lastCol = column; + } + + if (column.visible) { + + colsWidth += column.getWidth(); + } + }); + + if (lastCol) { + + gap = tableWidth - colsWidth + lastCol.getWidth(); + + if (this.table.options.responsiveLayout && this.table.modExists("responsiveLayout", true)) { + + lastCol.setWidth(0); + + this.table.modules.responsiveLayout.update(); + } + + if (gap > 0) { + + lastCol.setWidth(gap); + } else { + + lastCol.reinitializeWidth(); + } + } else { + + if (this.table.options.responsiveLayout && this.table.modExists("responsiveLayout", true)) { + + this.table.modules.responsiveLayout.update(); + } + } + }, + + //resize columns to fit + + "fitColumns": function fitColumns(columns) { + + var self = this; + + var totalWidth = self.table.element.clientWidth; //table element width + + var fixedWidth = 0; //total width of columns with a defined width + + var flexWidth = 0; //total width available to flexible columns + + var flexGrowUnits = 0; //total number of widthGrow blocks accross all columns + + var flexColWidth = 0; //desired width of flexible columns + + var flexColumns = []; //array of flexible width columns + + var fixedShrinkColumns = []; //array of fixed width columns that can shrink + + var flexShrinkUnits = 0; //total number of widthShrink blocks accross all columns + + var overflowWidth = 0; //horizontal overflow width + + var gapFill = 0; //number of pixels to be added to final column to close and half pixel gaps + + + function calcWidth(width) { + + var colWidth; + + if (typeof width == "string") { + + if (width.indexOf("%") > -1) { + + colWidth = totalWidth / 100 * parseInt(width); + } else { + + colWidth = parseInt(width); + } + } else { + + colWidth = width; + } + + return colWidth; + } + + //ensure columns resize to take up the correct amount of space + + function scaleColumns(columns, freeSpace, colWidth, shrinkCols) { + + var oversizeCols = [], + oversizeSpace = 0, + remainingSpace = 0, + nextColWidth = 0, + gap = 0, + changeUnits = 0, + undersizeCols = []; + + function calcGrow(col) { + + return colWidth * (col.column.definition.widthGrow || 1); + } + + function calcShrink(col) { + + return calcWidth(col.width) - colWidth * (col.column.definition.widthShrink || 0); + } + + columns.forEach(function (col, i) { + + var width = shrinkCols ? calcShrink(col) : calcGrow(col); + + if (col.column.minWidth >= width) { + + oversizeCols.push(col); + } else { + + undersizeCols.push(col); + + changeUnits += shrinkCols ? col.column.definition.widthShrink || 1 : col.column.definition.widthGrow || 1; + } + }); + + if (oversizeCols.length) { + + oversizeCols.forEach(function (col) { + + oversizeSpace += shrinkCols ? col.width - col.column.minWidth : col.column.minWidth; + + col.width = col.column.minWidth; + }); + + remainingSpace = freeSpace - oversizeSpace; + + nextColWidth = changeUnits ? Math.floor(remainingSpace / changeUnits) : remainingSpace; + + gap = remainingSpace - nextColWidth * changeUnits; + + gap += scaleColumns(undersizeCols, remainingSpace, nextColWidth, shrinkCols); + } else { + + gap = changeUnits ? freeSpace - Math.floor(freeSpace / changeUnits) * changeUnits : freeSpace; + + undersizeCols.forEach(function (column) { + + column.width = shrinkCols ? calcShrink(column) : calcGrow(column); + }); + } + + return gap; + } + + if (this.table.options.responsiveLayout && this.table.modExists("responsiveLayout", true)) { + + this.table.modules.responsiveLayout.update(); + } + + //adjust for vertical scrollbar if present + + if (this.table.rowManager.element.scrollHeight > this.table.rowManager.element.clientHeight) { + + totalWidth -= this.table.rowManager.element.offsetWidth - this.table.rowManager.element.clientWidth; + } + + columns.forEach(function (column) { + + var width, minWidth, colWidth; + + if (column.visible) { + + width = column.definition.width; + + minWidth = parseInt(column.minWidth); + + if (width) { + + colWidth = calcWidth(width); + + fixedWidth += colWidth > minWidth ? colWidth : minWidth; + + if (column.definition.widthShrink) { + + fixedShrinkColumns.push({ + + column: column, + + width: colWidth > minWidth ? colWidth : minWidth + + }); + + flexShrinkUnits += column.definition.widthShrink; + } + } else { + + flexColumns.push({ + + column: column, + + width: 0 + + }); + + flexGrowUnits += column.definition.widthGrow || 1; + } + } + }); + + //calculate available space + + flexWidth = totalWidth - fixedWidth; + + //calculate correct column size + + flexColWidth = Math.floor(flexWidth / flexGrowUnits); + + //generate column widths + + var gapFill = scaleColumns(flexColumns, flexWidth, flexColWidth, false); + + //increase width of last column to account for rounding errors + + if (flexColumns.length && gapFill > 0) { + + flexColumns[flexColumns.length - 1].width += +gapFill; + } + + //caculate space for columns to be shrunk into + + flexColumns.forEach(function (col) { + + flexWidth -= col.width; + }); + + overflowWidth = Math.abs(gapFill) + flexWidth; + + //shrink oversize columns if there is no available space + + if (overflowWidth > 0 && flexShrinkUnits) { + + gapFill = scaleColumns(fixedShrinkColumns, overflowWidth, Math.floor(overflowWidth / flexShrinkUnits), true); + } + + //decrease width of last column to account for rounding errors + + if (fixedShrinkColumns.length) { + + fixedShrinkColumns[fixedShrinkColumns.length - 1].width -= gapFill; + } + + flexColumns.forEach(function (col) { + + col.column.setWidth(col.width); + }); + + fixedShrinkColumns.forEach(function (col) { + + col.column.setWidth(col.width); + }); + } + +}; + +Tabulator.prototype.registerModule("layout", Layout); +var Localize = function Localize(table) { + this.table = table; //hold Tabulator object + this.locale = "default"; //current locale + this.lang = false; //current language + this.bindings = {}; //update events to call when locale is changed + this.langList = {}; +}; + +Localize.prototype.initialize = function () { + this.langList = Tabulator.prototype.helpers.deepClone(this.langs); +}; + +//set header placehoder +Localize.prototype.setHeaderFilterPlaceholder = function (placeholder) { + this.langList.default.headerFilters.default = placeholder; +}; + +//set header filter placeholder by column +Localize.prototype.setHeaderFilterColumnPlaceholder = function (column, placeholder) { + this.langList.default.headerFilters.columns[column] = placeholder; + + if (this.lang && !this.lang.headerFilters.columns[column]) { + this.lang.headerFilters.columns[column] = placeholder; + } +}; + +//setup a lang description object +Localize.prototype.installLang = function (locale, lang) { + if (this.langList[locale]) { + this._setLangProp(this.langList[locale], lang); + } else { + this.langList[locale] = lang; + } +}; + +Localize.prototype._setLangProp = function (lang, values) { + for (var key in values) { + if (lang[key] && _typeof(lang[key]) == "object") { + this._setLangProp(lang[key], values[key]); + } else { + lang[key] = values[key]; + } + } +}; + +//set current locale +Localize.prototype.setLocale = function (desiredLocale) { + var self = this; + + desiredLocale = desiredLocale || "default"; + + //fill in any matching languge values + function traverseLang(trans, path) { + for (var prop in trans) { + if (_typeof(trans[prop]) == "object") { + if (!path[prop]) { + path[prop] = {}; + } + traverseLang(trans[prop], path[prop]); + } else { + path[prop] = trans[prop]; + } + } + } + + //determing correct locale to load + if (desiredLocale === true && navigator.language) { + //get local from system + desiredLocale = navigator.language.toLowerCase(); + } + + if (desiredLocale) { + + //if locale is not set, check for matching top level locale else use default + if (!self.langList[desiredLocale]) { + var prefix = desiredLocale.split("-")[0]; + + if (self.langList[prefix]) { + console.warn("Localization Error - Exact matching locale not found, using closest match: ", desiredLocale, prefix); + desiredLocale = prefix; + } else { + console.warn("Localization Error - Matching locale not found, using default: ", desiredLocale); + desiredLocale = "default"; + } + } + } + + self.locale = desiredLocale; + + //load default lang template + self.lang = Tabulator.prototype.helpers.deepClone(self.langList.default || {}); + + if (desiredLocale != "default") { + traverseLang(self.langList[desiredLocale], self.lang); + } + + self.table.options.localized.call(self.table, self.locale, self.lang); + + self._executeBindings(); +}; + +//get current locale +Localize.prototype.getLocale = function (locale) { + return self.locale; +}; + +//get lang object for given local or current if none provided +Localize.prototype.getLang = function (locale) { + return locale ? this.langList[locale] : this.lang; +}; + +//get text for current locale +Localize.prototype.getText = function (path, value) { + var path = value ? path + "|" + value : path, + pathArray = path.split("|"), + text = this._getLangElement(pathArray, this.locale); + + // if(text === false){ + // console.warn("Localization Error - Matching localized text not found for given path: ", path); + // } + + return text || ""; +}; + +//traverse langs object and find localized copy +Localize.prototype._getLangElement = function (path, locale) { + var self = this; + var root = self.lang; + + path.forEach(function (level) { + var rootPath; + + if (root) { + rootPath = root[level]; + + if (typeof rootPath != "undefined") { + root = rootPath; + } else { + root = false; + } + } + }); + + return root; +}; + +//set update binding +Localize.prototype.bind = function (path, callback) { + if (!this.bindings[path]) { + this.bindings[path] = []; + } + + this.bindings[path].push(callback); + + callback(this.getText(path), this.lang); +}; + +//itterate through bindings and trigger updates +Localize.prototype._executeBindings = function () { + var self = this; + + var _loop = function _loop(path) { + self.bindings[path].forEach(function (binding) { + binding(self.getText(path), self.lang); + }); + }; + + for (var path in self.bindings) { + _loop(path); + } +}; + +//Localized text listings +Localize.prototype.langs = { + "default": { //hold default locale text + "groups": { + "item": "item", + "items": "items" + }, + "columns": {}, + "ajax": { + "loading": "Loading", + "error": "Error" + }, + "pagination": { + "page_size": "Page Size", + "page_title": "Show Page", + "first": "First", + "first_title": "First Page", + "last": "Last", + "last_title": "Last Page", + "prev": "Prev", + "prev_title": "Prev Page", + "next": "Next", + "next_title": "Next Page", + "all": "All" + }, + "headerFilters": { + "default": "filter column...", + "columns": {} + } + } +}; + +Tabulator.prototype.registerModule("localize", Localize); +var Comms = function Comms(table) { + this.table = table; +}; + +Comms.prototype.getConnections = function (selectors) { + var self = this, + connections = [], + connection; + + connection = Tabulator.prototype.comms.lookupTable(selectors); + + connection.forEach(function (con) { + if (self.table !== con) { + connections.push(con); + } + }); + + return connections; +}; + +Comms.prototype.send = function (selectors, module, action, data) { + var self = this, + connections = this.getConnections(selectors); + + connections.forEach(function (connection) { + connection.tableComms(self.table.element, module, action, data); + }); + + if (!connections.length && selectors) { + console.warn("Table Connection Error - No tables matching selector found", selectors); + } +}; + +Comms.prototype.receive = function (table, module, action, data) { + if (this.table.modExists(module)) { + return this.table.modules[module].commsReceived(table, action, data); + } else { + console.warn("Inter-table Comms Error - no such module:", module); + } +}; + +Tabulator.prototype.registerModule("comms", Comms); + +var Accessor = function Accessor(table) { + this.table = table; //hold Tabulator object + this.allowedTypes = ["", "data", "download", "clipboard", "print", "htmlOutput"]; //list of accessor types +}; + +//initialize column accessor +Accessor.prototype.initializeColumn = function (column) { + var self = this, + match = false, + config = {}; + + this.allowedTypes.forEach(function (type) { + var key = "accessor" + (type.charAt(0).toUpperCase() + type.slice(1)), + accessor; + + if (column.definition[key]) { + accessor = self.lookupAccessor(column.definition[key]); + + if (accessor) { + match = true; + + config[key] = { + accessor: accessor, + params: column.definition[key + "Params"] || {} + }; + } + } + }); + + if (match) { + column.modules.accessor = config; + } +}; + +Accessor.prototype.lookupAccessor = function (value) { + var accessor = false; + + //set column accessor + switch (typeof value === 'undefined' ? 'undefined' : _typeof(value)) { + case "string": + if (this.accessors[value]) { + accessor = this.accessors[value]; + } else { + console.warn("Accessor Error - No such accessor found, ignoring: ", value); + } + break; + + case "function": + accessor = value; + break; + } + + return accessor; +}; + +//apply accessor to row +Accessor.prototype.transformRow = function (row, type) { + var key = "accessor" + (type.charAt(0).toUpperCase() + type.slice(1)), + rowComponent = row.getComponent(); + + //clone data object with deep copy to isolate internal data from returned result + var data = Tabulator.prototype.helpers.deepClone(row.data || {}); + + this.table.columnManager.traverse(function (column) { + var value, accessor, params, colCompnent; + + if (column.modules.accessor) { + + accessor = column.modules.accessor[key] || column.modules.accessor.accessor || false; + + if (accessor) { + value = column.getFieldValue(data); + + if (value != "undefined") { + colCompnent = column.getComponent(); + params = typeof accessor.params === "function" ? accessor.params(value, data, type, colCompnent, rowComponent) : accessor.params; + column.setFieldValue(data, accessor.accessor(value, data, type, params, colCompnent, rowComponent)); + } + } + } + }); + + return data; +}, + +//default accessors +Accessor.prototype.accessors = {}; + +Tabulator.prototype.registerModule("accessor", Accessor); +var Ajax = function Ajax(table) { + + this.table = table; //hold Tabulator object + this.config = false; //hold config object for ajax request + this.url = ""; //request URL + this.urlGenerator = false; + this.params = false; //request parameters + + this.loaderElement = this.createLoaderElement(); //loader message div + this.msgElement = this.createMsgElement(); //message element + this.loadingElement = false; + this.errorElement = false; + this.loaderPromise = false; + + this.progressiveLoad = false; + this.loading = false; + + this.requestOrder = 0; //prevent requests comming out of sequence if overridden by another load request +}; + +//initialize setup options +Ajax.prototype.initialize = function () { + var template; + + this.loaderElement.appendChild(this.msgElement); + + if (this.table.options.ajaxLoaderLoading) { + if (typeof this.table.options.ajaxLoaderLoading == "string") { + template = document.createElement('template'); + template.innerHTML = this.table.options.ajaxLoaderLoading.trim(); + this.loadingElement = template.content.firstChild; + } else { + this.loadingElement = this.table.options.ajaxLoaderLoading; + } + } + + this.loaderPromise = this.table.options.ajaxRequestFunc || this.defaultLoaderPromise; + + this.urlGenerator = this.table.options.ajaxURLGenerator || this.defaultURLGenerator; + + if (this.table.options.ajaxLoaderError) { + if (typeof this.table.options.ajaxLoaderError == "string") { + template = document.createElement('template'); + template.innerHTML = this.table.options.ajaxLoaderError.trim(); + this.errorElement = template.content.firstChild; + } else { + this.errorElement = this.table.options.ajaxLoaderError; + } + } + + if (this.table.options.ajaxParams) { + this.setParams(this.table.options.ajaxParams); + } + + if (this.table.options.ajaxConfig) { + this.setConfig(this.table.options.ajaxConfig); + } + + if (this.table.options.ajaxURL) { + this.setUrl(this.table.options.ajaxURL); + } + + if (this.table.options.ajaxProgressiveLoad) { + if (this.table.options.pagination) { + this.progressiveLoad = false; + console.error("Progressive Load Error - Pagination and progressive load cannot be used at the same time"); + } else { + if (this.table.modExists("page")) { + this.progressiveLoad = this.table.options.ajaxProgressiveLoad; + this.table.modules.page.initializeProgressive(this.progressiveLoad); + } else { + console.error("Pagination plugin is required for progressive ajax loading"); + } + } + } +}; + +Ajax.prototype.createLoaderElement = function () { + var el = document.createElement("div"); + el.classList.add("tabulator-loader"); + return el; +}; + +Ajax.prototype.createMsgElement = function () { + var el = document.createElement("div"); + + el.classList.add("tabulator-loader-msg"); + el.setAttribute("role", "alert"); + + return el; +}; + +//set ajax params +Ajax.prototype.setParams = function (params, update) { + if (update) { + this.params = this.params || {}; + + for (var key in params) { + this.params[key] = params[key]; + } + } else { + this.params = params; + } +}; + +Ajax.prototype.getParams = function () { + return this.params || {}; +}; + +//load config object +Ajax.prototype.setConfig = function (config) { + this._loadDefaultConfig(); + + if (typeof config == "string") { + this.config.method = config; + } else { + for (var key in config) { + this.config[key] = config[key]; + } + } +}; + +//create config object from default +Ajax.prototype._loadDefaultConfig = function (force) { + var self = this; + if (!self.config || force) { + + self.config = {}; + + //load base config from defaults + for (var key in self.defaultConfig) { + self.config[key] = self.defaultConfig[key]; + } + } +}; + +//set request url +Ajax.prototype.setUrl = function (url) { + this.url = url; +}; + +//get request url +Ajax.prototype.getUrl = function () { + return this.url; +}; + +//lstandard loading function +Ajax.prototype.loadData = function (inPosition, columnsChanged) { + var self = this; + + if (this.progressiveLoad) { + return this._loadDataProgressive(); + } else { + return this._loadDataStandard(inPosition, columnsChanged); + } +}; + +Ajax.prototype.nextPage = function (diff) { + var margin; + + if (!this.loading) { + + margin = this.table.options.ajaxProgressiveLoadScrollMargin || this.table.rowManager.getElement().clientHeight * 2; + + if (diff < margin) { + this.table.modules.page.nextPage().then(function () {}).catch(function () {}); + } + } +}; + +Ajax.prototype.blockActiveRequest = function () { + this.requestOrder++; +}; + +Ajax.prototype._loadDataProgressive = function () { + this.table.rowManager.setData([]); + return this.table.modules.page.setPage(1); +}; + +Ajax.prototype._loadDataStandard = function (inPosition, columnsChanged) { + var _this42 = this; + + return new Promise(function (resolve, reject) { + _this42.sendRequest(inPosition).then(function (data) { + _this42.table.rowManager.setData(data, inPosition, columnsChanged).then(function () { + resolve(); + }).catch(function (e) { + reject(e); + }); + }).catch(function (e) { + reject(e); + }); + }); +}; + +Ajax.prototype.generateParamsList = function (data, prefix) { + var self = this, + output = []; + + prefix = prefix || ""; + + if (Array.isArray(data)) { + data.forEach(function (item, i) { + output = output.concat(self.generateParamsList(item, prefix ? prefix + "[" + i + "]" : i)); + }); + } else if ((typeof data === 'undefined' ? 'undefined' : _typeof(data)) === "object") { + for (var key in data) { + output = output.concat(self.generateParamsList(data[key], prefix ? prefix + "[" + key + "]" : key)); + } + } else { + output.push({ key: prefix, value: data }); + } + + return output; +}; + +Ajax.prototype.serializeParams = function (params) { + var output = this.generateParamsList(params), + encoded = []; + + output.forEach(function (item) { + encoded.push(encodeURIComponent(item.key) + "=" + encodeURIComponent(item.value)); + }); + + return encoded.join("&"); +}; + +//send ajax request +Ajax.prototype.sendRequest = function (silent) { + var _this43 = this; + + var self = this, + url = self.url, + requestNo, + esc, + query; + + self.requestOrder++; + requestNo = self.requestOrder; + + self._loadDefaultConfig(); + + return new Promise(function (resolve, reject) { + if (self.table.options.ajaxRequesting.call(_this43.table, self.url, self.params) !== false) { + + self.loading = true; + + if (!silent) { + self.showLoader(); + } + + _this43.loaderPromise(url, self.config, self.params).then(function (data) { + if (requestNo === self.requestOrder) { + if (self.table.options.ajaxResponse) { + data = self.table.options.ajaxResponse.call(self.table, self.url, self.params, data); + } + resolve(data); + + self.hideLoader(); + self.loading = false; + } else { + console.warn("Ajax Response Blocked - An active ajax request was blocked by an attempt to change table data while the request was being made"); + } + }).catch(function (error) { + console.error("Ajax Load Error: ", error); + self.table.options.ajaxError.call(self.table, error); + + self.showError(); + + setTimeout(function () { + self.hideLoader(); + }, 3000); + + self.loading = false; + + reject(); + }); + } else { + reject(); + } + }); +}; + +Ajax.prototype.showLoader = function () { + var shouldLoad = typeof this.table.options.ajaxLoader === "function" ? this.table.options.ajaxLoader() : this.table.options.ajaxLoader; + + if (shouldLoad) { + + this.hideLoader(); + + while (this.msgElement.firstChild) { + this.msgElement.removeChild(this.msgElement.firstChild); + }this.msgElement.classList.remove("tabulator-error"); + this.msgElement.classList.add("tabulator-loading"); + + if (this.loadingElement) { + this.msgElement.appendChild(this.loadingElement); + } else { + this.msgElement.innerHTML = this.table.modules.localize.getText("ajax|loading"); + } + + this.table.element.appendChild(this.loaderElement); + } +}; + +Ajax.prototype.showError = function () { + this.hideLoader(); + + while (this.msgElement.firstChild) { + this.msgElement.removeChild(this.msgElement.firstChild); + }this.msgElement.classList.remove("tabulator-loading"); + this.msgElement.classList.add("tabulator-error"); + + if (this.errorElement) { + this.msgElement.appendChild(this.errorElement); + } else { + this.msgElement.innerHTML = this.table.modules.localize.getText("ajax|error"); + } + + this.table.element.appendChild(this.loaderElement); +}; + +Ajax.prototype.hideLoader = function () { + if (this.loaderElement.parentNode) { + this.loaderElement.parentNode.removeChild(this.loaderElement); + } +}; + +//default ajax config object +Ajax.prototype.defaultConfig = { + method: "GET" +}; + +Ajax.prototype.defaultURLGenerator = function (url, config, params) { + + if (url) { + if (params && Object.keys(params).length) { + if (!config.method || config.method.toLowerCase() == "get") { + config.method = "get"; + + url += (url.includes("?") ? "&" : "?") + this.serializeParams(params); + } + } + } + + return url; +}; + +Ajax.prototype.defaultLoaderPromise = function (url, config, params) { + var self = this, + contentType; + + return new Promise(function (resolve, reject) { + + //set url + url = self.urlGenerator(url, config, params); + + //set body content if not GET request + if (config.method.toUpperCase() != "GET") { + contentType = _typeof(self.table.options.ajaxContentType) === "object" ? self.table.options.ajaxContentType : self.contentTypeFormatters[self.table.options.ajaxContentType]; + if (contentType) { + + for (var key in contentType.headers) { + if (!config.headers) { + config.headers = {}; + } + + if (typeof config.headers[key] === "undefined") { + config.headers[key] = contentType.headers[key]; + } + } + + config.body = contentType.body.call(self, url, config, params); + } else { + console.warn("Ajax Error - Invalid ajaxContentType value:", self.table.options.ajaxContentType); + } + } + + if (url) { + + //configure headers + if (typeof config.headers === "undefined") { + config.headers = {}; + } + + if (typeof config.headers.Accept === "undefined") { + config.headers.Accept = "application/json"; + } + + if (typeof config.headers["X-Requested-With"] === "undefined") { + config.headers["X-Requested-With"] = "XMLHttpRequest"; + } + + if (typeof config.mode === "undefined") { + config.mode = "cors"; + } + + if (config.mode == "cors") { + + if (typeof config.headers["Access-Control-Allow-Origin"] === "undefined") { + config.headers["Access-Control-Allow-Origin"] = window.location.origin; + } + + if (typeof config.credentials === "undefined") { + config.credentials = 'same-origin'; + } + } else { + if (typeof config.credentials === "undefined") { + config.credentials = 'include'; + } + } + + //send request + fetch(url, config).then(function (response) { + if (response.ok) { + response.json().then(function (data) { + resolve(data); + }).catch(function (error) { + reject(error); + console.warn("Ajax Load Error - Invalid JSON returned", error); + }); + } else { + console.error("Ajax Load Error - Connection Error: " + response.status, response.statusText); + reject(response); + } + }).catch(function (error) { + console.error("Ajax Load Error - Connection Error: ", error); + reject(error); + }); + } else { + console.warn("Ajax Load Error - No URL Set"); + resolve([]); + } + }); +}; + +Ajax.prototype.contentTypeFormatters = { + "json": { + headers: { + 'Content-Type': 'application/json' + }, + body: function body(url, config, params) { + return JSON.stringify(params); + } + }, + "form": { + headers: {}, + body: function body(url, config, params) { + var output = this.generateParamsList(params), + form = new FormData(); + + output.forEach(function (item) { + form.append(item.key, item.value); + }); + + return form; + } + } +}; + +Tabulator.prototype.registerModule("ajax", Ajax); + +//public calc object +var CalcComponent = function CalcComponent(row) { + this._row = row; +}; + +CalcComponent.prototype.getData = function (transform) { + return this._row.getData(transform); +}; + +CalcComponent.prototype.getElement = function () { + return this._row.getElement(); +}; + +CalcComponent.prototype.getTable = function () { + return this._row.table; +}; + +CalcComponent.prototype.getCells = function () { + var cells = []; + + this._row.getCells().forEach(function (cell) { + cells.push(cell.getComponent()); + }); + + return cells; +}; + +CalcComponent.prototype.getCell = function (column) { + var cell = this._row.getCell(column); + return cell ? cell.getComponent() : false; +}; + +CalcComponent.prototype._getSelf = function () { + return this._row; +}; + +var ColumnCalcs = function ColumnCalcs(table) { + this.table = table; //hold Tabulator object + this.topCalcs = []; + this.botCalcs = []; + this.genColumn = false; + this.topElement = this.createElement(); + this.botElement = this.createElement(); + this.topRow = false; + this.botRow = false; + this.topInitialized = false; + this.botInitialized = false; + + this.initialize(); +}; + +ColumnCalcs.prototype.createElement = function () { + var el = document.createElement("div"); + el.classList.add("tabulator-calcs-holder"); + return el; +}; + +ColumnCalcs.prototype.initialize = function () { + this.genColumn = new Column({ field: "value" }, this); +}; + +//dummy functions to handle being mock column manager +ColumnCalcs.prototype.registerColumnField = function () {}; + +//initialize column calcs +ColumnCalcs.prototype.initializeColumn = function (column) { + var def = column.definition; + + var config = { + topCalcParams: def.topCalcParams || {}, + botCalcParams: def.bottomCalcParams || {} + }; + + if (def.topCalc) { + + switch (_typeof(def.topCalc)) { + case "string": + if (this.calculations[def.topCalc]) { + config.topCalc = this.calculations[def.topCalc]; + } else { + console.warn("Column Calc Error - No such calculation found, ignoring: ", def.topCalc); + } + break; + + case "function": + config.topCalc = def.topCalc; + break; + + } + + if (config.topCalc) { + column.modules.columnCalcs = config; + this.topCalcs.push(column); + + if (this.table.options.columnCalcs != "group") { + this.initializeTopRow(); + } + } + } + + if (def.bottomCalc) { + switch (_typeof(def.bottomCalc)) { + case "string": + if (this.calculations[def.bottomCalc]) { + config.botCalc = this.calculations[def.bottomCalc]; + } else { + console.warn("Column Calc Error - No such calculation found, ignoring: ", def.bottomCalc); + } + break; + + case "function": + config.botCalc = def.bottomCalc; + break; + + } + + if (config.botCalc) { + column.modules.columnCalcs = config; + this.botCalcs.push(column); + + if (this.table.options.columnCalcs != "group") { + this.initializeBottomRow(); + } + } + } +}; + +ColumnCalcs.prototype.removeCalcs = function () { + var changed = false; + + if (this.topInitialized) { + this.topInitialized = false; + this.topElement.parentNode.removeChild(this.topElement); + changed = true; + } + + if (this.botInitialized) { + this.botInitialized = false; + this.table.footerManager.remove(this.botElement); + changed = true; + } + + if (changed) { + this.table.rowManager.adjustTableSize(); + } +}; + +ColumnCalcs.prototype.initializeTopRow = function () { + if (!this.topInitialized) { + // this.table.columnManager.headersElement.after(this.topElement); + this.table.columnManager.getElement().insertBefore(this.topElement, this.table.columnManager.headersElement.nextSibling); + this.topInitialized = true; + } +}; + +ColumnCalcs.prototype.initializeBottomRow = function () { + if (!this.botInitialized) { + this.table.footerManager.prepend(this.botElement); + this.botInitialized = true; + } +}; + +ColumnCalcs.prototype.scrollHorizontal = function (left) { + var hozAdjust = 0, + scrollWidth = this.table.columnManager.getElement().scrollWidth - this.table.element.clientWidth; + + if (this.botInitialized && this.botRow) { + this.botRow.getElement().style.marginLeft = -left + "px"; + } +}; + +ColumnCalcs.prototype.recalc = function (rows) { + var data, row; + + if (this.topInitialized || this.botInitialized) { + data = this.rowsToData(rows); + + if (this.topInitialized) { + if (this.topRow) { + this.topRow.deleteCells(); + } + + row = this.generateRow("top", this.rowsToData(rows)); + this.topRow = row; + while (this.topElement.firstChild) { + this.topElement.removeChild(this.topElement.firstChild); + }this.topElement.appendChild(row.getElement()); + row.initialize(true); + } + + if (this.botInitialized) { + if (this.botRow) { + this.botRow.deleteCells(); + } + + row = this.generateRow("bottom", this.rowsToData(rows)); + this.botRow = row; + while (this.botElement.firstChild) { + this.botElement.removeChild(this.botElement.firstChild); + }this.botElement.appendChild(row.getElement()); + row.initialize(true); + } + + this.table.rowManager.adjustTableSize(); + + //set resizable handles + if (this.table.modExists("frozenColumns")) { + this.table.modules.frozenColumns.layout(); + } + } +}; + +ColumnCalcs.prototype.recalcRowGroup = function (row) { + this.recalcGroup(this.table.modules.groupRows.getRowGroup(row)); +}; + +ColumnCalcs.prototype.recalcAll = function () { + var _this44 = this; + + if (this.topCalcs.length || this.botCalcs.length) { + if (this.table.options.columnCalcs !== "group") { + this.recalc(this.table.rowManager.activeRows); + } + + if (this.table.options.groupBy && this.table.options.columnCalcs !== "table") { + + var groups = table.modules.groupRows.getChildGroups(); + + groups.forEach(function (group) { + _this44.recalcGroup(group); + }); + } + } +}; + +ColumnCalcs.prototype.recalcGroup = function (group) { + var data, rowData; + + if (group) { + if (group.calcs) { + if (group.calcs.bottom) { + data = this.rowsToData(group.rows); + rowData = this.generateRowData("bottom", data); + + group.calcs.bottom.updateData(rowData); + group.calcs.bottom.reinitialize(); + } + + if (group.calcs.top) { + data = this.rowsToData(group.rows); + rowData = this.generateRowData("top", data); + + group.calcs.top.updateData(rowData); + group.calcs.top.reinitialize(); + } + } + } +}; + +//generate top stats row +ColumnCalcs.prototype.generateTopRow = function (rows) { + return this.generateRow("top", this.rowsToData(rows)); +}; +//generate bottom stats row +ColumnCalcs.prototype.generateBottomRow = function (rows) { + return this.generateRow("bottom", this.rowsToData(rows)); +}; + +ColumnCalcs.prototype.rowsToData = function (rows) { + var _this45 = this; + + var data = []; + + rows.forEach(function (row) { + data.push(row.getData()); + + if (_this45.table.options.dataTree && _this45.table.options.dataTreeChildColumnCalcs) { + if (row.modules.dataTree.open) { + var children = _this45.rowsToData(_this45.table.modules.dataTree.getFilteredTreeChildren(row)); + data = data.concat(children); + } + } + }); + + return data; +}; + +//generate stats row +ColumnCalcs.prototype.generateRow = function (pos, data) { + var self = this, + rowData = this.generateRowData(pos, data), + row; + + if (self.table.modExists("mutator")) { + self.table.modules.mutator.disable(); + } + + row = new Row(rowData, this, "calc"); + + if (self.table.modExists("mutator")) { + self.table.modules.mutator.enable(); + } + + row.getElement().classList.add("tabulator-calcs", "tabulator-calcs-" + pos); + + row.component = false; + + row.getComponent = function () { + if (!this.component) { + this.component = new CalcComponent(this); + } + + return this.component; + }; + + row.generateCells = function () { + + var cells = []; + + self.table.columnManager.columnsByIndex.forEach(function (column) { + + //set field name of mock column + self.genColumn.setField(column.getField()); + self.genColumn.hozAlign = column.hozAlign; + + if (column.definition[pos + "CalcFormatter"] && self.table.modExists("format")) { + self.genColumn.modules.format = { + formatter: self.table.modules.format.getFormatter(column.definition[pos + "CalcFormatter"]), + params: column.definition[pos + "CalcFormatterParams"] || {} + }; + } else { + self.genColumn.modules.format = { + formatter: self.table.modules.format.getFormatter("plaintext"), + params: {} + }; + } + + //ensure css class defintion is replicated to calculation cell + self.genColumn.definition.cssClass = column.definition.cssClass; + + //generate cell and assign to correct column + var cell = new Cell(self.genColumn, row); + cell.getElement(); + cell.column = column; + cell.setWidth(); + + column.cells.push(cell); + cells.push(cell); + + if (!column.visible) { + cell.hide(); + } + }); + + this.cells = cells; + }; + + return row; +}; + +//generate stats row +ColumnCalcs.prototype.generateRowData = function (pos, data) { + var rowData = {}, + calcs = pos == "top" ? this.topCalcs : this.botCalcs, + type = pos == "top" ? "topCalc" : "botCalc", + params, + paramKey; + + calcs.forEach(function (column) { + var values = []; + + if (column.modules.columnCalcs && column.modules.columnCalcs[type]) { + data.forEach(function (item) { + values.push(column.getFieldValue(item)); + }); + + paramKey = type + "Params"; + params = typeof column.modules.columnCalcs[paramKey] === "function" ? column.modules.columnCalcs[paramKey](values, data) : column.modules.columnCalcs[paramKey]; + + column.setFieldValue(rowData, column.modules.columnCalcs[type](values, data, params)); + } + }); + + return rowData; +}; + +ColumnCalcs.prototype.hasTopCalcs = function () { + return !!this.topCalcs.length; +}; + +ColumnCalcs.prototype.hasBottomCalcs = function () { + return !!this.botCalcs.length; +}; + +//handle table redraw +ColumnCalcs.prototype.redraw = function () { + if (this.topRow) { + this.topRow.normalizeHeight(true); + } + if (this.botRow) { + this.botRow.normalizeHeight(true); + } +}; + +//return the calculated +ColumnCalcs.prototype.getResults = function () { + var self = this, + results = {}, + groups; + + if (this.table.options.groupBy && this.table.modExists("groupRows")) { + groups = this.table.modules.groupRows.getGroups(true); + + groups.forEach(function (group) { + results[group.getKey()] = self.getGroupResults(group); + }); + } else { + results = { + top: this.topRow ? this.topRow.getData() : {}, + bottom: this.botRow ? this.botRow.getData() : {} + }; + } + + return results; +}; + +//get results from a group +ColumnCalcs.prototype.getGroupResults = function (group) { + var self = this, + groupObj = group._getSelf(), + subGroups = group.getSubGroups(), + subGroupResults = {}, + results = {}; + + subGroups.forEach(function (subgroup) { + subGroupResults[subgroup.getKey()] = self.getGroupResults(subgroup); + }); + + results = { + top: groupObj.calcs.top ? groupObj.calcs.top.getData() : {}, + bottom: groupObj.calcs.bottom ? groupObj.calcs.bottom.getData() : {}, + groups: subGroupResults + }; + + return results; +}; + +//default calculations +ColumnCalcs.prototype.calculations = { + "avg": function avg(values, data, calcParams) { + var output = 0, + precision = typeof calcParams.precision !== "undefined" ? calcParams.precision : 2; + + if (values.length) { + output = values.reduce(function (sum, value) { + return Number(sum) + Number(value); + }); + + output = output / values.length; + + output = precision !== false ? output.toFixed(precision) : output; + } + + return parseFloat(output).toString(); + }, + "max": function max(values, data, calcParams) { + var output = null, + precision = typeof calcParams.precision !== "undefined" ? calcParams.precision : false; + + values.forEach(function (value) { + + value = Number(value); + + if (value > output || output === null) { + output = value; + } + }); + + return output !== null ? precision !== false ? output.toFixed(precision) : output : ""; + }, + "min": function min(values, data, calcParams) { + var output = null, + precision = typeof calcParams.precision !== "undefined" ? calcParams.precision : false; + + values.forEach(function (value) { + + value = Number(value); + + if (value < output || output === null) { + output = value; + } + }); + + return output !== null ? precision !== false ? output.toFixed(precision) : output : ""; + }, + "sum": function sum(values, data, calcParams) { + var output = 0, + precision = typeof calcParams.precision !== "undefined" ? calcParams.precision : false; + + if (values.length) { + values.forEach(function (value) { + value = Number(value); + + output += !isNaN(value) ? Number(value) : 0; + }); + } + + return precision !== false ? output.toFixed(precision) : output; + }, + "concat": function concat(values, data, calcParams) { + var output = 0; + + if (values.length) { + output = values.reduce(function (sum, value) { + return String(sum) + String(value); + }); + } + + return output; + }, + "count": function count(values, data, calcParams) { + var output = 0; + + if (values.length) { + values.forEach(function (value) { + if (value) { + output++; + } + }); + } + + return output; + } +}; + +Tabulator.prototype.registerModule("columnCalcs", ColumnCalcs); + +var Clipboard = function Clipboard(table) { + this.table = table; + this.mode = true; + + this.pasteParser = function () {}; + this.pasteAction = function () {}; + this.customSelection = false; + this.rowRange = false; + this.blocked = true; //block copy actions not originating from this command +}; + +Clipboard.prototype.initialize = function () { + var _this46 = this; + + this.mode = this.table.options.clipboard; + + this.rowRange = this.table.options.clipboardCopyRowRange; + + if (this.mode === true || this.mode === "copy") { + this.table.element.addEventListener("copy", function (e) { + var plain, html, list; + + if (!_this46.blocked) { + e.preventDefault(); + + if (_this46.customSelection) { + plain = _this46.customSelection; + + if (_this46.table.options.clipboardCopyFormatter) { + plain = _this46.table.options.clipboardCopyFormatter("plain", plain); + } + } else { + + var list = _this46.table.modules.export.generateExportList(_this46.table.options.clipboardCopyConfig, _this46.table.options.clipboardCopyStyled, _this46.rowRange, "clipboard"); + + html = _this46.table.modules.export.genereateHTMLTable(list); + plain = html ? _this46.generatePlainContent(list) : ""; + + if (_this46.table.options.clipboardCopyFormatter) { + plain = _this46.table.options.clipboardCopyFormatter("plain", plain); + html = _this46.table.options.clipboardCopyFormatter("html", html); + } + } + + if (window.clipboardData && window.clipboardData.setData) { + window.clipboardData.setData('Text', plain); + } else if (e.clipboardData && e.clipboardData.setData) { + e.clipboardData.setData('text/plain', plain); + if (html) { + e.clipboardData.setData('text/html', html); + } + } else if (e.originalEvent && e.originalEvent.clipboardData.setData) { + e.originalEvent.clipboardData.setData('text/plain', plain); + if (html) { + e.originalEvent.clipboardData.setData('text/html', html); + } + } + + _this46.table.options.clipboardCopied.call(_this46.table, plain, html); + + _this46.reset(); + } + }); + } + + if (this.mode === true || this.mode === "paste") { + this.table.element.addEventListener("paste", function (e) { + _this46.paste(e); + }); + } + + this.setPasteParser(this.table.options.clipboardPasteParser); + this.setPasteAction(this.table.options.clipboardPasteAction); +}; + +Clipboard.prototype.reset = function () { + this.blocked = true; + this.customSelection = false; +}; + +Clipboard.prototype.generatePlainContent = function (list) { + var output = []; + + list.forEach(function (row) { + var rowData = []; + + row.columns.forEach(function (col) { + var value = ""; + + if (col) { + + if (row.type === "group") { + col.value = col.component.getKey(); + } + + if (col.value === null) { + value = ""; + } else { + switch (_typeof(col.value)) { + case "object": + value = JSON.stringify(col.value); + break; + + case "undefined": + value = ""; + break; + + default: + value = col.value; + } + } + } + + rowData.push(value); + }); + + output.push(rowData.join("\t")); + }); + + return output.join("\n"); +}; + +Clipboard.prototype.copy = function (range, internal) { + var range, sel, textRange; + this.blocked = false; + this.customSelection = false; + + if (this.mode === true || this.mode === "copy") { + + this.rowRange = range || this.table.options.clipboardCopyRowRange; + + if (typeof window.getSelection != "undefined" && typeof document.createRange != "undefined") { + range = document.createRange(); + range.selectNodeContents(this.table.element); + sel = window.getSelection(); + + if (sel.toString() && internal) { + this.customSelection = sel.toString(); + } + + sel.removeAllRanges(); + sel.addRange(range); + } else if (typeof document.selection != "undefined" && typeof document.body.createTextRange != "undefined") { + textRange = document.body.createTextRange(); + textRange.moveToElementText(this.table.element); + textRange.select(); + } + + document.execCommand('copy'); + + if (sel) { + sel.removeAllRanges(); + } + } +}; + +//PASTE EVENT HANDLING + +Clipboard.prototype.setPasteAction = function (action) { + + switch (typeof action === 'undefined' ? 'undefined' : _typeof(action)) { + case "string": + this.pasteAction = this.pasteActions[action]; + + if (!this.pasteAction) { + console.warn("Clipboard Error - No such paste action found:", action); + } + break; + + case "function": + this.pasteAction = action; + break; + } +}; + +Clipboard.prototype.setPasteParser = function (parser) { + switch (typeof parser === 'undefined' ? 'undefined' : _typeof(parser)) { + case "string": + this.pasteParser = this.pasteParsers[parser]; + + if (!this.pasteParser) { + console.warn("Clipboard Error - No such paste parser found:", parser); + } + break; + + case "function": + this.pasteParser = parser; + break; + } +}; + +Clipboard.prototype.paste = function (e) { + var data, rowData, rows; + + if (this.checkPaseOrigin(e)) { + + data = this.getPasteData(e); + + rowData = this.pasteParser.call(this, data); + + if (rowData) { + e.preventDefault(); + + if (this.table.modExists("mutator")) { + rowData = this.mutateData(rowData); + } + + rows = this.pasteAction.call(this, rowData); + this.table.options.clipboardPasted.call(this.table, data, rowData, rows); + } else { + this.table.options.clipboardPasteError.call(this.table, data); + } + } +}; + +Clipboard.prototype.mutateData = function (data) { + var self = this, + output = []; + + if (Array.isArray(data)) { + data.forEach(function (row) { + output.push(self.table.modules.mutator.transformRow(row, "clipboard")); + }); + } else { + output = data; + } + + return output; +}; + +Clipboard.prototype.checkPaseOrigin = function (e) { + var valid = true; + + if (e.target.tagName != "DIV" || this.table.modules.edit.currentCell) { + valid = false; + } + + return valid; +}; + +Clipboard.prototype.getPasteData = function (e) { + var data; + + if (window.clipboardData && window.clipboardData.getData) { + data = window.clipboardData.getData('Text'); + } else if (e.clipboardData && e.clipboardData.getData) { + data = e.clipboardData.getData('text/plain'); + } else if (e.originalEvent && e.originalEvent.clipboardData.getData) { + data = e.originalEvent.clipboardData.getData('text/plain'); + } + + return data; +}; + +Clipboard.prototype.pasteParsers = { + table: function table(clipboard) { + var data = [], + success = false, + headerFindSuccess = true, + columns = this.table.columnManager.columns, + columnMap = [], + rows = []; + + //get data from clipboard into array of columns and rows. + clipboard = clipboard.split("\n"); + + clipboard.forEach(function (row) { + data.push(row.split("\t")); + }); + + if (data.length && !(data.length === 1 && data[0].length < 2)) { + success = true; + + //check if headers are present by title + data[0].forEach(function (value) { + var column = columns.find(function (column) { + return value && column.definition.title && value.trim() && column.definition.title.trim() === value.trim(); + }); + + if (column) { + columnMap.push(column); + } else { + headerFindSuccess = false; + } + }); + + //check if column headers are present by field + if (!headerFindSuccess) { + headerFindSuccess = true; + columnMap = []; + + data[0].forEach(function (value) { + var column = columns.find(function (column) { + return value && column.field && value.trim() && column.field.trim() === value.trim(); + }); + + if (column) { + columnMap.push(column); + } else { + headerFindSuccess = false; + } + }); + + if (!headerFindSuccess) { + columnMap = this.table.columnManager.columnsByIndex; + } + } + + //remove header row if found + if (headerFindSuccess) { + data.shift(); + } + + data.forEach(function (item) { + var row = {}; + + item.forEach(function (value, i) { + if (columnMap[i]) { + row[columnMap[i].field] = value; + } + }); + + rows.push(row); + }); + + return rows; + } else { + return false; + } + } +}; + +Clipboard.prototype.pasteActions = { + replace: function replace(rows) { + return this.table.setData(rows); + }, + update: function update(rows) { + return this.table.updateOrAddData(rows); + }, + insert: function insert(rows) { + return this.table.addData(rows); + } +}; + +Tabulator.prototype.registerModule("clipboard", Clipboard); + +var DataTree = function DataTree(table) { + this.table = table; + this.indent = 10; + this.field = ""; + this.collapseEl = null; + this.expandEl = null; + this.branchEl = null; + this.elementField = false; + + this.startOpen = function () {}; + + this.displayIndex = 0; +}; + +DataTree.prototype.initialize = function () { + var dummyEl = null, + firstCol = this.table.columnManager.getFirstVisibileColumn(), + options = this.table.options; + + this.field = options.dataTreeChildField; + this.indent = options.dataTreeChildIndent; + this.elementField = options.dataTreeElementColumn || (firstCol ? firstCol.field : false); + + if (options.dataTreeBranchElement) { + + if (options.dataTreeBranchElement === true) { + this.branchEl = document.createElement("div"); + this.branchEl.classList.add("tabulator-data-tree-branch"); + } else { + if (typeof options.dataTreeBranchElement === "string") { + dummyEl = document.createElement("div"); + dummyEl.innerHTML = options.dataTreeBranchElement; + this.branchEl = dummyEl.firstChild; + } else { + this.branchEl = options.dataTreeBranchElement; + } + } + } + + if (options.dataTreeCollapseElement) { + if (typeof options.dataTreeCollapseElement === "string") { + dummyEl = document.createElement("div"); + dummyEl.innerHTML = options.dataTreeCollapseElement; + this.collapseEl = dummyEl.firstChild; + } else { + this.collapseEl = options.dataTreeCollapseElement; + } + } else { + this.collapseEl = document.createElement("div"); + this.collapseEl.classList.add("tabulator-data-tree-control"); + this.collapseEl.tabIndex = 0; + this.collapseEl.innerHTML = "
"; + } + + if (options.dataTreeExpandElement) { + if (typeof options.dataTreeExpandElement === "string") { + dummyEl = document.createElement("div"); + dummyEl.innerHTML = options.dataTreeExpandElement; + this.expandEl = dummyEl.firstChild; + } else { + this.expandEl = options.dataTreeExpandElement; + } + } else { + this.expandEl = document.createElement("div"); + this.expandEl.classList.add("tabulator-data-tree-control"); + this.expandEl.tabIndex = 0; + this.expandEl.innerHTML = "
"; + } + + switch (_typeof(options.dataTreeStartExpanded)) { + case "boolean": + this.startOpen = function (row, index) { + return options.dataTreeStartExpanded; + }; + break; + + case "function": + this.startOpen = options.dataTreeStartExpanded; + break; + + default: + this.startOpen = function (row, index) { + return options.dataTreeStartExpanded[index]; + }; + break; + } +}; + +DataTree.prototype.initializeRow = function (row) { + var childArray = row.getData()[this.field]; + var isArray = Array.isArray(childArray); + + var children = isArray || !isArray && (typeof childArray === 'undefined' ? 'undefined' : _typeof(childArray)) === "object" && childArray !== null; + + if (!children && row.modules.dataTree && row.modules.dataTree.branchEl) { + row.modules.dataTree.branchEl.parentNode.removeChild(row.modules.dataTree.branchEl); + } + + if (!children && row.modules.dataTree && row.modules.dataTree.controlEl) { + row.modules.dataTree.controlEl.parentNode.removeChild(row.modules.dataTree.controlEl); + } + + row.modules.dataTree = { + index: row.modules.dataTree ? row.modules.dataTree.index : 0, + open: children ? row.modules.dataTree ? row.modules.dataTree.open : this.startOpen(row.getComponent(), 0) : false, + controlEl: row.modules.dataTree && children ? row.modules.dataTree.controlEl : false, + branchEl: row.modules.dataTree && children ? row.modules.dataTree.branchEl : false, + parent: row.modules.dataTree ? row.modules.dataTree.parent : false, + children: children + }; +}; + +DataTree.prototype.layoutRow = function (row) { + var cell = this.elementField ? row.getCell(this.elementField) : row.getCells()[0], + el = cell.getElement(), + config = row.modules.dataTree; + + if (config.branchEl) { + if (config.branchEl.parentNode) { + config.branchEl.parentNode.removeChild(config.branchEl); + } + config.branchEl = false; + } + + if (config.controlEl) { + if (config.controlEl.parentNode) { + config.controlEl.parentNode.removeChild(config.controlEl); + } + config.controlEl = false; + } + + this.generateControlElement(row, el); + + row.element.classList.add("tabulator-tree-level-" + config.index); + + if (config.index) { + if (this.branchEl) { + config.branchEl = this.branchEl.cloneNode(true); + el.insertBefore(config.branchEl, el.firstChild); + + if (this.table.rtl) { + config.branchEl.style.marginRight = (config.branchEl.offsetWidth + config.branchEl.style.marginLeft) * (config.index - 1) + config.index * this.indent + "px"; + } else { + config.branchEl.style.marginLeft = (config.branchEl.offsetWidth + config.branchEl.style.marginRight) * (config.index - 1) + config.index * this.indent + "px"; + } + } else { + + if (this.table.rtl) { + el.style.paddingRight = parseInt(window.getComputedStyle(el, null).getPropertyValue('padding-right')) + config.index * this.indent + "px"; + } else { + el.style.paddingLeft = parseInt(window.getComputedStyle(el, null).getPropertyValue('padding-left')) + config.index * this.indent + "px"; + } + } + } +}; + +DataTree.prototype.generateControlElement = function (row, el) { + var _this47 = this; + + var config = row.modules.dataTree, + el = el || row.getCells()[0].getElement(), + oldControl = config.controlEl; + + if (config.children !== false) { + + if (config.open) { + config.controlEl = this.collapseEl.cloneNode(true); + config.controlEl.addEventListener("click", function (e) { + e.stopPropagation(); + _this47.collapseRow(row); + }); + } else { + config.controlEl = this.expandEl.cloneNode(true); + config.controlEl.addEventListener("click", function (e) { + e.stopPropagation(); + _this47.expandRow(row); + }); + } + + config.controlEl.addEventListener("mousedown", function (e) { + e.stopPropagation(); + }); + + if (oldControl && oldControl.parentNode === el) { + oldControl.parentNode.replaceChild(config.controlEl, oldControl); + } else { + el.insertBefore(config.controlEl, el.firstChild); + } + } +}; + +DataTree.prototype.setDisplayIndex = function (index) { + this.displayIndex = index; +}; + +DataTree.prototype.getDisplayIndex = function () { + return this.displayIndex; +}; + +DataTree.prototype.getRows = function (rows) { + var _this48 = this; + + var output = []; + + rows.forEach(function (row, i) { + var config, children; + + output.push(row); + + if (row instanceof Row) { + + config = row.modules.dataTree.children; + + if (!config.index && config.children !== false) { + children = _this48.getChildren(row); + + children.forEach(function (child) { + output.push(child); + }); + } + } + }); + + return output; +}; + +DataTree.prototype.getChildren = function (row) { + var _this49 = this; + + var config = row.modules.dataTree, + children = [], + output = []; + + if (config.children !== false && config.open) { + if (!Array.isArray(config.children)) { + config.children = this.generateChildren(row); + } + + if (this.table.modExists("filter") && this.table.options.dataTreeFilter) { + children = this.table.modules.filter.filter(config.children); + } else { + children = config.children; + } + + if (this.table.modExists("sort") && this.table.options.dataTreeSort) { + this.table.modules.sort.sort(children); + } + + children.forEach(function (child) { + output.push(child); + + var subChildren = _this49.getChildren(child); + + subChildren.forEach(function (sub) { + output.push(sub); + }); + }); + } + + return output; +}; + +DataTree.prototype.generateChildren = function (row) { + var _this50 = this; + + var children = []; + + var childArray = row.getData()[this.field]; + + if (!Array.isArray(childArray)) { + childArray = [childArray]; + } + + childArray.forEach(function (childData) { + var childRow = new Row(childData || {}, _this50.table.rowManager); + childRow.modules.dataTree.index = row.modules.dataTree.index + 1; + childRow.modules.dataTree.parent = row; + if (childRow.modules.dataTree.children) { + childRow.modules.dataTree.open = _this50.startOpen(childRow.getComponent(), childRow.modules.dataTree.index); + } + children.push(childRow); + }); + + return children; +}; + +DataTree.prototype.expandRow = function (row, silent) { + var config = row.modules.dataTree; + + if (config.children !== false) { + config.open = true; + + row.reinitialize(); + + this.table.rowManager.refreshActiveData("tree", false, true); + + this.table.options.dataTreeRowExpanded(row.getComponent(), row.modules.dataTree.index); + } +}; + +DataTree.prototype.collapseRow = function (row) { + var config = row.modules.dataTree; + + if (config.children !== false) { + config.open = false; + + row.reinitialize(); + + this.table.rowManager.refreshActiveData("tree", false, true); + + this.table.options.dataTreeRowCollapsed(row.getComponent(), row.modules.dataTree.index); + } +}; + +DataTree.prototype.toggleRow = function (row) { + var config = row.modules.dataTree; + + if (config.children !== false) { + if (config.open) { + this.collapseRow(row); + } else { + this.expandRow(row); + } + } +}; + +DataTree.prototype.getTreeParent = function (row) { + return row.modules.dataTree.parent ? row.modules.dataTree.parent.getComponent() : false; +}; + +DataTree.prototype.getFilteredTreeChildren = function (row) { + var config = row.modules.dataTree, + output = [], + children; + + if (config.children) { + + if (!Array.isArray(config.children)) { + config.children = this.generateChildren(row); + } + + if (this.table.modExists("filter") && this.table.options.dataTreeFilter) { + children = this.table.modules.filter.filter(config.children); + } else { + children = config.children; + } + + children.forEach(function (childRow) { + if (childRow instanceof Row) { + output.push(childRow); + } + }); + } + + return output; +}; + +DataTree.prototype.rowDelete = function (row) { + var parent = row.modules.dataTree.parent, + childIndex; + + if (parent) { + childIndex = this.findChildIndex(row, parent); + + if (childIndex !== false) { + parent.data[this.field].splice(childIndex, 1); + } + + if (!parent.data[this.field].length) { + delete parent.data[this.field]; + } + + this.initializeRow(parent); + this.layoutRow(parent); + } + + this.table.rowManager.refreshActiveData("tree", false, true); +}; + +DataTree.prototype.addTreeChildRow = function (row, data, top, index) { + var childIndex = false; + + if (typeof data === "string") { + data = JSON.parse(data); + } + + if (!Array.isArray(row.data[this.field])) { + row.data[this.field] = []; + + row.modules.dataTree.open = this.startOpen(row.getComponent(), row.modules.dataTree.index); + } + + if (typeof index !== "undefined") { + childIndex = this.findChildIndex(index, row); + + if (childIndex !== false) { + row.data[this.field].splice(top ? childIndex : childIndex + 1, 0, data); + } + } + + if (childIndex === false) { + if (top) { + row.data[this.field].unshift(data); + } else { + row.data[this.field].push(data); + } + } + + this.initializeRow(row); + this.layoutRow(row); + + this.table.rowManager.refreshActiveData("tree", false, true); +}; + +DataTree.prototype.findChildIndex = function (subject, parent) { + var _this51 = this; + + var match = false; + + if ((typeof subject === 'undefined' ? 'undefined' : _typeof(subject)) == "object") { + + if (subject instanceof Row) { + //subject is row element + match = subject.data; + } else if (subject instanceof RowComponent) { + //subject is public row component + match = subject._getSelf().data; + } else if (typeof HTMLElement !== "undefined" && subject instanceof HTMLElement) { + if (parent.modules.dataTree) { + match = parent.modules.dataTree.children.find(function (childRow) { + return childRow instanceof Row ? childRow.element === subject : false; + }); + + if (match) { + match = match.data; + } + } + } + } else if (typeof subject == "undefined" || subject === null) { + match = false; + } else { + //subject should be treated as the index of the row + match = parent.data[this.field].find(function (row) { + return row.data[_this51.table.options.index] == subject; + }); + } + + if (match) { + + if (Array.isArray(parent.data[this.field])) { + match = parent.data[this.field].indexOf(match); + } + + if (match == -1) { + match = false; + } + } + + //catch all for any other type of input + + return match; +}; + +DataTree.prototype.getTreeChildren = function (row, component, recurse) { + var _this52 = this; + + var config = row.modules.dataTree, + output = []; + + if (config.children) { + + if (!Array.isArray(config.children)) { + config.children = this.generateChildren(row); + } + + config.children.forEach(function (childRow) { + if (childRow instanceof Row) { + output.push(component ? childRow.getComponent() : childRow); + + if (recurse) { + output = output.concat(_this52.getTreeChildren(childRow, component, recurse)); + } + } + }); + } + + return output; +}; + +DataTree.prototype.checkForRestyle = function (cell) { + if (!cell.row.cells.indexOf(cell)) { + cell.row.reinitialize(); + } +}; + +DataTree.prototype.getChildField = function () { + return this.field; +}; + +DataTree.prototype.redrawNeeded = function (data) { + return (this.field ? typeof data[this.field] !== "undefined" : false) || (this.elementField ? typeof data[this.elementField] !== "undefined" : false); +}; + +Tabulator.prototype.registerModule("dataTree", DataTree); + +var Download = function Download(table) { + this.table = table; //hold Tabulator object +}; + +//trigger file download +Download.prototype.download = function (type, filename, options, range, interceptCallback) { + var self = this, + downloadFunc = false; + + function buildLink(data, mime) { + if (interceptCallback) { + if (interceptCallback === true) { + self.triggerDownload(data, mime, type, filename, true); + } else { + interceptCallback(data); + } + } else { + self.triggerDownload(data, mime, type, filename); + } + } + + if (typeof type == "function") { + downloadFunc = type; + } else { + if (self.downloaders[type]) { + downloadFunc = self.downloaders[type]; + } else { + console.warn("Download Error - No such download type found: ", type); + } + } + + if (downloadFunc) { + var list = this.generateExportList(range); + + downloadFunc.call(this.table, list, options || {}, buildLink); + } +}; + +Download.prototype.generateExportList = function (range) { + var list = this.table.modules.export.generateExportList(this.table.options.downloadConfig, false, range || this.table.options.downloadRowRange, "download"); + + //assign group header formatter + var groupHeader = this.table.options.groupHeaderDownload; + + if (groupHeader && !Array.isArray(groupHeader)) { + groupHeader = [groupHeader]; + } + + list.forEach(function (row) { + var group; + + if (row.type === "group") { + group = row.columns[0]; + + if (groupHeader && groupHeader[row.indent]) { + group.value = groupHeader[row.indent](group.value, row.component._group.getRowCount(), row.component._group.getData(), row.component); + } + } + }); + + return list; +}; + +Download.prototype.triggerDownload = function (data, mime, type, filename, newTab) { + var element = document.createElement('a'), + blob = new Blob([data], { type: mime }), + filename = filename || "Tabulator." + (typeof type === "function" ? "txt" : type); + + blob = this.table.options.downloadReady.call(this.table, data, blob); + + if (blob) { + + if (newTab) { + window.open(window.URL.createObjectURL(blob)); + } else { + if (navigator.msSaveOrOpenBlob) { + navigator.msSaveOrOpenBlob(blob, filename); + } else { + element.setAttribute('href', window.URL.createObjectURL(blob)); + + //set file title + element.setAttribute('download', filename); + + //trigger download + element.style.display = 'none'; + document.body.appendChild(element); + element.click(); + + //remove temporary link element + document.body.removeChild(element); + } + } + + if (this.table.options.downloadComplete) { + this.table.options.downloadComplete(); + } + } +}; + +Download.prototype.commsReceived = function (table, action, data) { + switch (action) { + case "intercept": + this.download(data.type, "", data.options, data.active, data.intercept); + break; + } +}; + +//downloaders +Download.prototype.downloaders = { + csv: function csv(list, options, setFileContents) { + var delimiter = options && options.delimiter ? options.delimiter : ",", + fileContents = [], + headers = []; + + list.forEach(function (row) { + var item = []; + + switch (row.type) { + case "group": + console.warn("Download Warning - CSV downloader cannot process row groups"); + break; + + case "calc": + console.warn("Download Warning - CSV downloader cannot process column calculations"); + break; + + case "header": + row.columns.forEach(function (col, i) { + if (col && col.depth === 1) { + headers[i] = typeof col.value == "undefined" || col.value === null ? "" : '"' + String(col.value).split('"').join('""') + '"'; + } + }); + break; + + case "row": + row.columns.forEach(function (col) { + + if (col) { + + switch (_typeof(col.value)) { + case "object": + col.value = JSON.stringify(col.value); + break; + + case "undefined": + case "null": + col.value = ""; + break; + } + + item.push('"' + String(col.value).split('"').join('""') + '"'); + } + }); + + fileContents.push(item.join(delimiter)); + break; + } + }); + + if (headers.length) { + fileContents.unshift(headers.join(delimiter)); + } + + fileContents = fileContents.join("\n"); + + if (options.bom) { + fileContents = '\uFEFF' + fileContents; + } + + setFileContents(fileContents, "text/csv"); + }, + + json: function json(list, options, setFileContents) { + var fileContents = []; + + list.forEach(function (row) { + var item = {}; + + switch (row.type) { + case "header": + break; + + case "group": + console.warn("Download Warning - JSON downloader cannot process row groups"); + break; + + case "calc": + console.warn("Download Warning - JSON downloader cannot process column calculations"); + break; + + case "row": + row.columns.forEach(function (col) { + if (col) { + item[col.component.getField()] = col.value; + } + }); + + fileContents.push(item); + break; + } + }); + + fileContents = JSON.stringify(fileContents, null, '\t'); + + setFileContents(fileContents, "application/json"); + }, + + pdf: function pdf(list, options, setFileContents) { + var header = [], + body = [], + autoTableParams = {}, + rowGroupStyles = options.rowGroupStyles || { + fontStyle: "bold", + fontSize: 12, + cellPadding: 6, + fillColor: 220 + }, + rowCalcStyles = options.rowCalcStyles || { + fontStyle: "bold", + fontSize: 10, + cellPadding: 4, + fillColor: 232 + }, + jsPDFParams = options.jsPDF || {}, + title = options && options.title ? options.title : ""; + + if (!jsPDFParams.orientation) { + jsPDFParams.orientation = options.orientation || "landscape"; + } + + if (!jsPDFParams.unit) { + jsPDFParams.unit = "pt"; + } + + //parse row list + list.forEach(function (row) { + var item = {}; + + switch (row.type) { + case "header": + header.push(parseRow(row)); + break; + + case "group": + body.push(parseRow(row, rowGroupStyles)); + break; + + case "calc": + body.push(parseRow(row, rowCalcStyles)); + break; + + case "row": + body.push(parseRow(row)); + break; + } + }); + + function parseRow(row, styles) { + var rowData = []; + + row.columns.forEach(function (col) { + var cell; + + if (col) { + switch (_typeof(col.value)) { + case "object": + col.value = JSON.stringify(col.value); + break; + + case "undefined": + case "null": + col.value = ""; + break; + } + + cell = { + content: col.value, + colSpan: col.width, + rowSpan: col.height + }; + + if (styles) { + cell.styles = styles; + } + + rowData.push(cell); + } else { + rowData.push(""); + } + }); + + return rowData; + } + + //configure PDF + var doc = new jsPDF(jsPDFParams); //set document to landscape, better for most tables + + if (options && options.autoTable) { + if (typeof options.autoTable === "function") { + autoTableParams = options.autoTable(doc) || {}; + } else { + autoTableParams = options.autoTable; + } + } + + if (title) { + autoTableParams.addPageContent = function (data) { + doc.text(title, 40, 30); + }; + } + + autoTableParams.head = header; + autoTableParams.body = body; + + doc.autoTable(autoTableParams); + + if (options && options.documentProcessing) { + options.documentProcessing(doc); + } + + setFileContents(doc.output("arraybuffer"), "application/pdf"); + }, + + xlsx: function xlsx(list, options, setFileContents) { + var self = this, + sheetName = options.sheetName || "Sheet1", + workbook = XLSX.utils.book_new(), + output; + + workbook.SheetNames = []; + workbook.Sheets = {}; + + function generateSheet() { + var rows = [], + merges = [], + worksheet = {}, + range = { s: { c: 0, r: 0 }, e: { c: list[0] ? list[0].columns.reduce(function (a, b) { + return a + (b && b.width ? b.width : 1); + }, 0) : 0, r: list.length } }; + + //parse row list + list.forEach(function (row, i) { + var rowData = []; + + row.columns.forEach(function (col, j) { + + if (col) { + rowData.push(!(col.value instanceof Date) && _typeof(col.value) === "object" ? JSON.stringify(col.value) : col.value); + + if (col.width > 1 || col.height > -1) { + merges.push({ s: { r: i, c: j }, e: { r: i + col.height - 1, c: j + col.width - 1 } }); + } + } else { + rowData.push(""); + } + }); + + rows.push(rowData); + }); + + //convert rows to worksheet + XLSX.utils.sheet_add_aoa(worksheet, rows); + + worksheet['!ref'] = XLSX.utils.encode_range(range); + + if (merges.length) { + worksheet["!merges"] = merges; + } + + return worksheet; + } + + if (options.sheetOnly) { + setFileContents(generateSheet()); + return; + } + + if (options.sheets) { + for (var sheet in options.sheets) { + + if (options.sheets[sheet] === true) { + workbook.SheetNames.push(sheet); + workbook.Sheets[sheet] = generateSheet(); + } else { + + workbook.SheetNames.push(sheet); + + this.modules.comms.send(options.sheets[sheet], "download", "intercept", { + type: "xlsx", + options: { sheetOnly: true }, + active: self.active, + intercept: function intercept(data) { + workbook.Sheets[sheet] = data; + } + }); + } + } + } else { + workbook.SheetNames.push(sheetName); + workbook.Sheets[sheetName] = generateSheet(); + } + + if (options.documentProcessing) { + workbook = options.documentProcessing(workbook); + } + + //convert workbook to binary array + function s2ab(s) { + var buf = new ArrayBuffer(s.length); + var view = new Uint8Array(buf); + for (var i = 0; i != s.length; ++i) { + view[i] = s.charCodeAt(i) & 0xFF; + }return buf; + } + + output = XLSX.write(workbook, { bookType: 'xlsx', bookSST: true, type: 'binary' }); + + setFileContents(s2ab(output), "application/octet-stream"); + }, + + html: function html(list, options, setFileContents) { + if (this.modExists("export", true)) { + setFileContents(this.modules.export.genereateHTMLTable(list), "text/html"); + } + } + +}; + +Tabulator.prototype.registerModule("download", Download); + +var Edit = function Edit(table) { + this.table = table; //hold Tabulator object + this.currentCell = false; //hold currently editing cell + this.mouseClick = false; //hold mousedown state to prevent click binding being overriden by editor opening + this.recursionBlock = false; //prevent focus recursion + this.invalidEdit = false; + this.editedCells = []; +}; + +//initialize column editor +Edit.prototype.initializeColumn = function (column) { + var self = this, + config = { + editor: false, + blocked: false, + check: column.definition.editable, + params: column.definition.editorParams || {} + }; + + //set column editor + switch (_typeof(column.definition.editor)) { + case "string": + + if (column.definition.editor === "tick") { + column.definition.editor = "tickCross"; + console.warn("DEPRECATION WARNING - the tick editor has been deprecated, please use the tickCross editor"); + } + + if (self.editors[column.definition.editor]) { + config.editor = self.editors[column.definition.editor]; + } else { + console.warn("Editor Error - No such editor found: ", column.definition.editor); + } + break; + + case "function": + config.editor = column.definition.editor; + break; + + case "boolean": + + if (column.definition.editor === true) { + + if (typeof column.definition.formatter !== "function") { + + if (column.definition.formatter === "tick") { + column.definition.formatter = "tickCross"; + console.warn("DEPRECATION WARNING - the tick editor has been deprecated, please use the tickCross editor"); + } + + if (self.editors[column.definition.formatter]) { + config.editor = self.editors[column.definition.formatter]; + } else { + config.editor = self.editors["input"]; + } + } else { + console.warn("Editor Error - Cannot auto lookup editor for a custom formatter: ", column.definition.formatter); + } + } + break; + } + + if (config.editor) { + column.modules.edit = config; + } +}; + +Edit.prototype.getCurrentCell = function () { + return this.currentCell ? this.currentCell.getComponent() : false; +}; + +Edit.prototype.clearEditor = function (cancel) { + var cell = this.currentCell, + cellEl; + + this.invalidEdit = false; + + if (cell) { + this.currentCell = false; + + cellEl = cell.getElement(); + + if (cancel) { + cell.validate(); + } else { + cellEl.classList.remove("tabulator-validation-fail"); + } + + cellEl.classList.remove("tabulator-editing"); + while (cellEl.firstChild) { + cellEl.removeChild(cellEl.firstChild); + }cell.row.getElement().classList.remove("tabulator-row-editing"); + } +}; + +Edit.prototype.cancelEdit = function () { + + if (this.currentCell) { + var cell = this.currentCell; + var component = this.currentCell.getComponent(); + + this.clearEditor(true); + cell.setValueActual(cell.getValue()); + cell.cellRendered(); + + if (cell.column.definition.editor == "textarea" || cell.column.definition.variableHeight) { + cell.row.normalizeHeight(true); + } + + if (cell.column.cellEvents.cellEditCancelled) { + cell.column.cellEvents.cellEditCancelled.call(this.table, component); + } + + this.table.options.cellEditCancelled.call(this.table, component); + } +}; + +//return a formatted value for a cell +Edit.prototype.bindEditor = function (cell) { + var self = this, + element = cell.getElement(); + + element.setAttribute("tabindex", 0); + + element.addEventListener("click", function (e) { + if (!element.classList.contains("tabulator-editing")) { + element.focus({ preventScroll: true }); + } + }); + + element.addEventListener("mousedown", function (e) { + if (e.button === 2) { + e.preventDefault(); + } else { + self.mouseClick = true; + } + }); + + element.addEventListener("focus", function (e) { + if (!self.recursionBlock) { + self.edit(cell, e, false); + } + }); +}; + +Edit.prototype.focusCellNoEvent = function (cell, block) { + this.recursionBlock = true; + if (!(block && this.table.browser === "ie")) { + cell.getElement().focus({ preventScroll: true }); + } + this.recursionBlock = false; +}; + +Edit.prototype.editCell = function (cell, forceEdit) { + this.focusCellNoEvent(cell); + this.edit(cell, false, forceEdit); +}; + +Edit.prototype.focusScrollAdjust = function (cell) { + if (this.table.rowManager.getRenderMode() == "virtual") { + var topEdge = this.table.rowManager.element.scrollTop, + bottomEdge = this.table.rowManager.element.clientHeight + this.table.rowManager.element.scrollTop, + rowEl = cell.row.getElement(), + offset = rowEl.offsetTop; + + if (rowEl.offsetTop < topEdge) { + this.table.rowManager.element.scrollTop -= topEdge - rowEl.offsetTop; + } else { + if (rowEl.offsetTop + rowEl.offsetHeight > bottomEdge) { + this.table.rowManager.element.scrollTop += rowEl.offsetTop + rowEl.offsetHeight - bottomEdge; + } + } + + var leftEdge = this.table.rowManager.element.scrollLeft, + rightEdge = this.table.rowManager.element.clientWidth + this.table.rowManager.element.scrollLeft, + cellEl = cell.getElement(), + offset = cellEl.offsetLeft; + + if (this.table.modExists("frozenColumns")) { + leftEdge += parseInt(this.table.modules.frozenColumns.leftMargin); + rightEdge -= parseInt(this.table.modules.frozenColumns.rightMargin); + } + + if (cellEl.offsetLeft < leftEdge) { + this.table.rowManager.element.scrollLeft -= leftEdge - cellEl.offsetLeft; + } else { + if (cellEl.offsetLeft + cellEl.offsetWidth > rightEdge) { + this.table.rowManager.element.scrollLeft += cellEl.offsetLeft + cellEl.offsetWidth - rightEdge; + } + } + } +}; + +Edit.prototype.edit = function (cell, e, forceEdit) { + var self = this, + allowEdit = true, + rendered = function rendered() {}, + element = cell.getElement(), + cellEditor, + component, + params; + + //prevent editing if another cell is refusing to leave focus (eg. validation fail) + if (this.currentCell) { + if (!this.invalidEdit) { + this.cancelEdit(); + } + return; + } + + //handle successfull value change + function success(value) { + if (self.currentCell === cell) { + var valid = true; + + if (cell.column.modules.validate && self.table.modExists("validate") && self.table.options.validationMode != "manual") { + valid = self.table.modules.validate.validate(cell.column.modules.validate, cell, value); + } + + if (valid === true || self.table.options.validationMode === "highlight") { + self.clearEditor(); + + if (!cell.modules.edit) { + cell.modules.edit = {}; + } + + cell.modules.edit.edited = true; + + if (self.editedCells.indexOf(cell) == -1) { + self.editedCells.push(cell); + } + + cell.setValue(value, true); + + if (self.table.options.dataTree && self.table.modExists("dataTree")) { + self.table.modules.dataTree.checkForRestyle(cell); + } + + if (valid !== true) { + element.classList.add("tabulator-validation-fail"); + self.table.options.validationFailed.call(self.table, cell.getComponent(), value, valid); + return false; + } + + return true; + } else { + self.invalidEdit = true; + element.classList.add("tabulator-validation-fail"); + self.focusCellNoEvent(cell, true); + rendered(); + self.table.options.validationFailed.call(self.table, cell.getComponent(), value, valid); + + return false; + } + } else { + // console.warn("Edit Success Error - cannot call success on a cell that is no longer being edited"); + } + } + + //handle aborted edit + function cancel() { + if (self.currentCell === cell) { + self.cancelEdit(); + + if (self.table.options.dataTree && self.table.modExists("dataTree")) { + self.table.modules.dataTree.checkForRestyle(cell); + } + } else { + // console.warn("Edit Success Error - cannot call cancel on a cell that is no longer being edited"); + } + } + + function onRendered(callback) { + rendered = callback; + } + + if (!cell.column.modules.edit.blocked) { + if (e) { + e.stopPropagation(); + } + + switch (_typeof(cell.column.modules.edit.check)) { + case "function": + allowEdit = cell.column.modules.edit.check(cell.getComponent()); + break; + + case "boolean": + allowEdit = cell.column.modules.edit.check; + break; + } + + if (allowEdit || forceEdit) { + + self.cancelEdit(); + + self.currentCell = cell; + + this.focusScrollAdjust(cell); + + component = cell.getComponent(); + + if (this.mouseClick) { + this.mouseClick = false; + + if (cell.column.cellEvents.cellClick) { + cell.column.cellEvents.cellClick.call(this.table, e, component); + } + } + + if (cell.column.cellEvents.cellEditing) { + cell.column.cellEvents.cellEditing.call(this.table, component); + } + + self.table.options.cellEditing.call(this.table, component); + + params = typeof cell.column.modules.edit.params === "function" ? cell.column.modules.edit.params(component) : cell.column.modules.edit.params; + + cellEditor = cell.column.modules.edit.editor.call(self, component, onRendered, success, cancel, params); + + //if editor returned, add to DOM, if false, abort edit + if (cellEditor !== false) { + + if (cellEditor instanceof Node) { + element.classList.add("tabulator-editing"); + cell.row.getElement().classList.add("tabulator-row-editing"); + while (element.firstChild) { + element.removeChild(element.firstChild); + }element.appendChild(cellEditor); + + //trigger onRendered Callback + rendered(); + + //prevent editing from triggering rowClick event + var children = element.children; + + for (var i = 0; i < children.length; i++) { + children[i].addEventListener("click", function (e) { + e.stopPropagation(); + }); + } + } else { + console.warn("Edit Error - Editor should return an instance of Node, the editor returned:", cellEditor); + element.blur(); + return false; + } + } else { + element.blur(); + return false; + } + + return true; + } else { + this.mouseClick = false; + element.blur(); + return false; + } + } else { + this.mouseClick = false; + element.blur(); + return false; + } +}; + +Edit.prototype.maskInput = function (el, options) { + var mask = options.mask, + maskLetter = typeof options.maskLetterChar !== "undefined" ? options.maskLetterChar : "A", + maskNumber = typeof options.maskNumberChar !== "undefined" ? options.maskNumberChar : "9", + maskWildcard = typeof options.maskWildcardChar !== "undefined" ? options.maskWildcardChar : "*", + success = false; + + function fillSymbols(index) { + var symbol = mask[index]; + if (typeof symbol !== "undefined" && symbol !== maskWildcard && symbol !== maskLetter && symbol !== maskNumber) { + el.value = el.value + "" + symbol; + fillSymbols(index + 1); + } + } + + el.addEventListener("keydown", function (e) { + var index = el.value.length, + char = e.key; + + if (e.keyCode > 46) { + if (index >= mask.length) { + e.preventDefault(); + e.stopPropagation(); + success = false; + return false; + } else { + switch (mask[index]) { + case maskLetter: + if (char.toUpperCase() == char.toLowerCase()) { + e.preventDefault(); + e.stopPropagation(); + success = false; + return false; + } + break; + + case maskNumber: + if (isNaN(char)) { + e.preventDefault(); + e.stopPropagation(); + success = false; + return false; + } + break; + + case maskWildcard: + break; + + default: + if (char !== mask[index]) { + e.preventDefault(); + e.stopPropagation(); + success = false; + return false; + } + } + } + + success = true; + } + + return; + }); + + el.addEventListener("keyup", function (e) { + if (e.keyCode > 46) { + if (options.maskAutoFill) { + fillSymbols(el.value.length); + } + } + }); + + if (!el.placeholder) { + el.placeholder = mask; + } + + if (options.maskAutoFill) { + fillSymbols(el.value.length); + } +}; + +Edit.prototype.getEditedCells = function () { + var output = []; + + this.editedCells.forEach(function (cell) { + output.push(cell.getComponent()); + }); + + return output; +}; + +Edit.prototype.clearEdited = function (cell) { + var editIndex; + + if (cell.modules.edit && cell.modules.edit.edited) { + cell.modules.edit.edited = false; + + if (cell.modules.validate) { + cell.modules.validate.invalid = false; + } + } + + editIndex = this.editedCells.indexOf(cell); + + if (editIndex > -1) { + this.editedCells.splice(editIndex, 1); + } +}; + +//default data editors +Edit.prototype.editors = { + + //input element + input: function input(cell, onRendered, success, cancel, editorParams) { + + //create and style input + var cellValue = cell.getValue(), + input = document.createElement("input"); + + input.setAttribute("type", editorParams.search ? "search" : "text"); + + input.style.padding = "4px"; + input.style.width = "100%"; + input.style.boxSizing = "border-box"; + + if (editorParams.elementAttributes && _typeof(editorParams.elementAttributes) == "object") { + for (var key in editorParams.elementAttributes) { + if (key.charAt(0) == "+") { + key = key.slice(1); + input.setAttribute(key, input.getAttribute(key) + editorParams.elementAttributes["+" + key]); + } else { + input.setAttribute(key, editorParams.elementAttributes[key]); + } + } + } + + input.value = typeof cellValue !== "undefined" ? cellValue : ""; + + onRendered(function () { + input.focus({ preventScroll: true }); + input.style.height = "100%"; + }); + + function onChange(e) { + if ((cellValue === null || typeof cellValue === "undefined") && input.value !== "" || input.value !== cellValue) { + if (success(input.value)) { + cellValue = input.value; //persist value if successfully validated incase editor is used as header filter + } + } else { + cancel(); + } + } + + //submit new value on blur or change + input.addEventListener("change", onChange); + input.addEventListener("blur", onChange); + + //submit new value on enter + input.addEventListener("keydown", function (e) { + switch (e.keyCode) { + // case 9: + case 13: + onChange(e); + break; + + case 27: + cancel(); + break; + + case 35: + case 36: + e.stopPropagation(); + break; + } + }); + + if (editorParams.mask) { + this.table.modules.edit.maskInput(input, editorParams); + } + + return input; + }, + + //resizable text area element + textarea: function textarea(cell, onRendered, success, cancel, editorParams) { + var self = this, + cellValue = cell.getValue(), + vertNav = editorParams.verticalNavigation || "hybrid", + value = String(cellValue !== null && typeof cellValue !== "undefined" ? cellValue : ""), + count = (value.match(/(?:\r\n|\r|\n)/g) || []).length + 1, + input = document.createElement("textarea"), + scrollHeight = 0; + + //create and style input + input.style.display = "block"; + input.style.padding = "2px"; + input.style.height = "100%"; + input.style.width = "100%"; + input.style.boxSizing = "border-box"; + input.style.whiteSpace = "pre-wrap"; + input.style.resize = "none"; + + if (editorParams.elementAttributes && _typeof(editorParams.elementAttributes) == "object") { + for (var key in editorParams.elementAttributes) { + if (key.charAt(0) == "+") { + key = key.slice(1); + input.setAttribute(key, input.getAttribute(key) + editorParams.elementAttributes["+" + key]); + } else { + input.setAttribute(key, editorParams.elementAttributes[key]); + } + } + } + + input.value = value; + + onRendered(function () { + input.focus({ preventScroll: true }); + input.style.height = "100%"; + + input.scrollHeight; + input.style.height = input.scrollHeight + "px"; + cell.getRow().normalizeHeight(); + }); + + function onChange(e) { + + if ((cellValue === null || typeof cellValue === "undefined") && input.value !== "" || input.value !== cellValue) { + + if (success(input.value)) { + cellValue = input.value; //persist value if successfully validated incase editor is used as header filter + } + + setTimeout(function () { + cell.getRow().normalizeHeight(); + }, 300); + } else { + cancel(); + } + } + + //submit new value on blur or change + input.addEventListener("change", onChange); + input.addEventListener("blur", onChange); + + input.addEventListener("keyup", function () { + + input.style.height = ""; + + var heightNow = input.scrollHeight; + + input.style.height = heightNow + "px"; + + if (heightNow != scrollHeight) { + scrollHeight = heightNow; + cell.getRow().normalizeHeight(); + } + }); + + input.addEventListener("keydown", function (e) { + + switch (e.keyCode) { + case 27: + cancel(); + break; + + case 38: + //up arrow + if (vertNav == "editor" || vertNav == "hybrid" && input.selectionStart) { + e.stopImmediatePropagation(); + e.stopPropagation(); + } + + break; + + case 40: + //down arrow + if (vertNav == "editor" || vertNav == "hybrid" && input.selectionStart !== input.value.length) { + e.stopImmediatePropagation(); + e.stopPropagation(); + } + break; + + case 35: + case 36: + e.stopPropagation(); + break; + } + }); + + if (editorParams.mask) { + this.table.modules.edit.maskInput(input, editorParams); + } + + return input; + }, + + //input element with type of number + number: function number(cell, onRendered, success, cancel, editorParams) { + + var cellValue = cell.getValue(), + vertNav = editorParams.verticalNavigation || "editor", + input = document.createElement("input"); + + input.setAttribute("type", "number"); + + if (typeof editorParams.max != "undefined") { + input.setAttribute("max", editorParams.max); + } + + if (typeof editorParams.min != "undefined") { + input.setAttribute("min", editorParams.min); + } + + if (typeof editorParams.step != "undefined") { + input.setAttribute("step", editorParams.step); + } + + //create and style input + input.style.padding = "4px"; + input.style.width = "100%"; + input.style.boxSizing = "border-box"; + + if (editorParams.elementAttributes && _typeof(editorParams.elementAttributes) == "object") { + for (var key in editorParams.elementAttributes) { + if (key.charAt(0) == "+") { + key = key.slice(1); + input.setAttribute(key, input.getAttribute(key) + editorParams.elementAttributes["+" + key]); + } else { + input.setAttribute(key, editorParams.elementAttributes[key]); + } + } + } + + input.value = cellValue; + + var blurFunc = function blurFunc(e) { + onChange(); + }; + + onRendered(function () { + //submit new value on blur + input.removeEventListener("blur", blurFunc); + + input.focus({ preventScroll: true }); + input.style.height = "100%"; + + //submit new value on blur + input.addEventListener("blur", blurFunc); + }); + + function onChange() { + var value = input.value; + + if (!isNaN(value) && value !== "") { + value = Number(value); + } + + if (value !== cellValue) { + if (success(value)) { + cellValue = value; //persist value if successfully validated incase editor is used as header filter + } + } else { + cancel(); + } + } + + //submit new value on enter + input.addEventListener("keydown", function (e) { + switch (e.keyCode) { + case 13: + // case 9: + onChange(); + break; + + case 27: + cancel(); + break; + + case 38: //up arrow + case 40: + //down arrow + if (vertNav == "editor") { + e.stopImmediatePropagation(); + e.stopPropagation(); + } + break; + + case 35: + case 36: + e.stopPropagation(); + break; + } + }); + + if (editorParams.mask) { + this.table.modules.edit.maskInput(input, editorParams); + } + + return input; + }, + + //input element with type of number + range: function range(cell, onRendered, success, cancel, editorParams) { + + var cellValue = cell.getValue(), + input = document.createElement("input"); + + input.setAttribute("type", "range"); + + if (typeof editorParams.max != "undefined") { + input.setAttribute("max", editorParams.max); + } + + if (typeof editorParams.min != "undefined") { + input.setAttribute("min", editorParams.min); + } + + if (typeof editorParams.step != "undefined") { + input.setAttribute("step", editorParams.step); + } + + //create and style input + input.style.padding = "4px"; + input.style.width = "100%"; + input.style.boxSizing = "border-box"; + + if (editorParams.elementAttributes && _typeof(editorParams.elementAttributes) == "object") { + for (var key in editorParams.elementAttributes) { + if (key.charAt(0) == "+") { + key = key.slice(1); + input.setAttribute(key, input.getAttribute(key) + editorParams.elementAttributes["+" + key]); + } else { + input.setAttribute(key, editorParams.elementAttributes[key]); + } + } + } + + input.value = cellValue; + + onRendered(function () { + input.focus({ preventScroll: true }); + input.style.height = "100%"; + }); + + function onChange() { + var value = input.value; + + if (!isNaN(value) && value !== "") { + value = Number(value); + } + + if (value != cellValue) { + if (success(value)) { + cellValue = value; //persist value if successfully validated incase editor is used as header filter + } + } else { + cancel(); + } + } + + //submit new value on blur + input.addEventListener("blur", function (e) { + onChange(); + }); + + //submit new value on enter + input.addEventListener("keydown", function (e) { + switch (e.keyCode) { + case 13: + // case 9: + onChange(); + break; + + case 27: + cancel(); + break; + } + }); + + return input; + }, + + //select + select: function select(cell, onRendered, success, cancel, editorParams) { + var _this53 = this; + + var self = this, + cellEl = cell.getElement(), + initialValue = cell.getValue(), + vertNav = editorParams.verticalNavigation || "editor", + initialDisplayValue = typeof initialValue !== "undefined" || initialValue === null ? Array.isArray(initialValue) ? initialValue : [initialValue] : typeof editorParams.defaultValue !== "undefined" ? editorParams.defaultValue : [], + input = document.createElement("input"), + listEl = document.createElement("div"), + multiselect = editorParams.multiselect, + dataItems = [], + currentItem = {}, + displayItems = [], + currentItems = [], + blurable = true, + blockListShow = false; + + if (Array.isArray(editorParams) || !Array.isArray(editorParams) && (typeof editorParams === 'undefined' ? 'undefined' : _typeof(editorParams)) === "object" && !editorParams.values) { + console.warn("DEPRECATION WARNING - values for the select editor must now be passed into the values property of the editorParams object, not as the editorParams object"); + editorParams = { values: editorParams }; + } + + function getUniqueColumnValues(field) { + var output = {}, + data = self.table.getData(), + column; + + if (field) { + column = self.table.columnManager.getColumnByField(field); + } else { + column = cell.getColumn()._getSelf(); + } + + if (column) { + data.forEach(function (row) { + var val = column.getFieldValue(row); + + if (val !== null && typeof val !== "undefined" && val !== "") { + output[val] = true; + } + }); + + if (editorParams.sortValuesList) { + if (editorParams.sortValuesList == "asc") { + output = Object.keys(output).sort(); + } else { + output = Object.keys(output).sort().reverse(); + } + } else { + output = Object.keys(output); + } + } else { + console.warn("unable to find matching column to create select lookup list:", field); + } + + return output; + } + + function parseItems(inputValues, curentValues) { + var dataList = []; + var displayList = []; + + function processComplexListItem(item) { + var item = { + label: item.label, + value: item.value, + itemParams: item.itemParams, + elementAttributes: item.elementAttributes, + element: false + }; + + // if(item.value === curentValue || (!isNaN(parseFloat(item.value)) && !isNaN(parseFloat(item.value)) && parseFloat(item.value) === parseFloat(curentValue))){ + // setCurrentItem(item); + // } + + if (curentValues.indexOf(item.value) > -1) { + setItem(item); + } + + dataList.push(item); + displayList.push(item); + + return item; + } + + if (typeof inputValues == "function") { + inputValues = inputValues(cell); + } + + if (Array.isArray(inputValues)) { + inputValues.forEach(function (value) { + var item; + + if ((typeof value === 'undefined' ? 'undefined' : _typeof(value)) === "object") { + + if (value.options) { + item = { + label: value.label, + group: true, + itemParams: value.itemParams, + elementAttributes: value.elementAttributes, + element: false + }; + + displayList.push(item); + + value.options.forEach(function (item) { + processComplexListItem(item); + }); + } else { + processComplexListItem(value); + } + } else { + + item = { + label: value, + value: value, + element: false + }; + + // if(item.value === curentValue || (!isNaN(parseFloat(item.value)) && !isNaN(parseFloat(item.value)) && parseFloat(item.value) === parseFloat(curentValue))){ + // setCurrentItem(item); + // } + + if (curentValues.indexOf(item.value) > -1) { + setItem(item); + } + + dataList.push(item); + displayList.push(item); + } + }); + } else { + for (var key in inputValues) { + var item = { + label: inputValues[key], + value: key, + element: false + }; + + // if(item.value === curentValue || (!isNaN(parseFloat(item.value)) && !isNaN(parseFloat(item.value)) && parseFloat(item.value) === parseFloat(curentValue))){ + // setCurrentItem(item); + // } + + if (curentValues.indexOf(item.value) > -1) { + setItem(item); + } + + dataList.push(item); + displayList.push(item); + } + } + + dataItems = dataList; + displayItems = displayList; + + fillList(); + } + + function fillList() { + while (listEl.firstChild) { + listEl.removeChild(listEl.firstChild); + }displayItems.forEach(function (item) { + + var el = item.element; + + if (!el) { + el = document.createElement("div"); + item.label = editorParams.listItemFormatter ? editorParams.listItemFormatter(item.value, item.label, cell, el, item.itemParams) : item.label; + if (item.group) { + el.classList.add("tabulator-edit-select-list-group"); + el.tabIndex = 0; + el.innerHTML = item.label === "" ? " " : item.label; + } else { + el.classList.add("tabulator-edit-select-list-item"); + el.tabIndex = 0; + el.innerHTML = item.label === "" ? " " : item.label; + + el.addEventListener("click", function () { + blockListShow = true; + + setTimeout(function () { + blockListShow = false; + }, 10); + + // setCurrentItem(item); + // chooseItem(); + if (multiselect) { + toggleItem(item); + input.focus(); + } else { + chooseItem(item); + } + }); + + // if(item === currentItem){ + // el.classList.add("active"); + // } + + if (currentItems.indexOf(item) > -1) { + el.classList.add("active"); + } + } + + if (item.elementAttributes && _typeof(item.elementAttributes) == "object") { + for (var key in item.elementAttributes) { + if (key.charAt(0) == "+") { + key = key.slice(1); + el.setAttribute(key, input.getAttribute(key) + item.elementAttributes["+" + key]); + } else { + el.setAttribute(key, item.elementAttributes[key]); + } + } + } + el.addEventListener("mousedown", function () { + blurable = false; + + setTimeout(function () { + blurable = true; + }, 10); + }); + + item.element = el; + } + + listEl.appendChild(el); + }); + } + + function setCurrentItem(item, active) { + + if (!multiselect && currentItem && currentItem.element) { + currentItem.element.classList.remove("active"); + } + + if (currentItem && currentItem.element) { + currentItem.element.classList.remove("focused"); + } + + currentItem = item; + + if (item.element) { + item.element.classList.add("focused"); + if (active) { + item.element.classList.add("active"); + } + } + + if (item && item.element && item.element.scrollIntoView) { + item.element.scrollIntoView({ behavior: 'smooth', block: 'nearest', inline: 'start' }); + } + } + + // function chooseItem(){ + // hideList(); + + // if(initialValue !== currentItem.value){ + // initialValue = currentItem.value; + // success(currentItem.value); + // }else{ + // cancel(); + // } + // } + + function setItem(item) { + var index = currentItems.indexOf(item); + + if (index == -1) { + currentItems.push(item); + setCurrentItem(item, true); + } + + fillInput(); + } + + function unsetItem(index) { + var item = currentItems[index]; + + if (index > -1) { + currentItems.splice(index, 1); + if (item.element) { + item.element.classList.remove("active"); + } + } + } + + function toggleItem(item) { + if (!item) { + item = currentItem; + } + + var index = currentItems.indexOf(item); + + if (index > -1) { + unsetItem(index); + } else { + if (multiselect !== true && currentItems.length >= multiselect) { + unsetItem(0); + } + + setItem(item); + } + + fillInput(); + } + + function chooseItem(item) { + hideList(); + + if (!item) { + item = currentItem; + } + + if (item) { + input.value = item.label; + success(item.value); + } + + initialDisplayValue = input.value; + } + + function chooseItems(silent) { + if (!silent) { + hideList(); + } + + var output = []; + + currentItems.forEach(function (item) { + output.push(item.value); + }); + + initialDisplayValue = input.value; + + success(output); + } + + function fillInput() { + var output = []; + + currentItems.forEach(function (item) { + output.push(item.label); + }); + + input.value = output.join(", "); + + if (self.currentCell === false) { + chooseItems(true); + } + } + + function unsetItems() { + + var len = currentItems.length; + + for (var _i9 = 0; _i9 < len; _i9++) { + unsetItem(0); + } + } + + function cancelItem() { + hideList(); + cancel(); + } + + function showList() { + currentItems = []; + + if (!listEl.parentNode) { + if (editorParams.values === true) { + parseItems(getUniqueColumnValues(), initialDisplayValue); + } else if (typeof editorParams.values === "string") { + parseItems(getUniqueColumnValues(editorParams.values), initialDisplayValue); + } else { + parseItems(editorParams.values || [], initialDisplayValue); + } + + var offset = Tabulator.prototype.helpers.elOffset(cellEl); + + listEl.style.minWidth = cellEl.offsetWidth + "px"; + + listEl.style.top = offset.top + cellEl.offsetHeight + "px"; + listEl.style.left = offset.left + "px"; + + listEl.addEventListener("mousedown", function (e) { + blurable = false; + + setTimeout(function () { + blurable = true; + }, 10); + }); + + document.body.appendChild(listEl); + } + } + + function hideList() { + if (listEl.parentNode) { + listEl.parentNode.removeChild(listEl); + } + + removeScrollListener(); + } + + function removeScrollListener() { + self.table.rowManager.element.removeEventListener("scroll", cancelItem); + } + + //style input + input.setAttribute("type", "text"); + + input.style.padding = "4px"; + input.style.width = "100%"; + input.style.boxSizing = "border-box"; + input.style.cursor = "default"; + input.readOnly = this.currentCell != false; + + if (editorParams.elementAttributes && _typeof(editorParams.elementAttributes) == "object") { + for (var key in editorParams.elementAttributes) { + if (key.charAt(0) == "+") { + key = key.slice(1); + input.setAttribute(key, input.getAttribute(key) + editorParams.elementAttributes["+" + key]); + } else { + input.setAttribute(key, editorParams.elementAttributes[key]); + } + } + } + + input.value = typeof initialValue !== "undefined" || initialValue === null ? initialValue : ""; + + // if(editorParams.values === true){ + // parseItems(getUniqueColumnValues(), initialValue); + // }else if(typeof editorParams.values === "string"){ + // parseItems(getUniqueColumnValues(editorParams.values), initialValue); + // }else{ + // parseItems(editorParams.values || [], initialValue); + // } + + input.addEventListener("search", function (e) { + if (!input.value) { + unsetItems(); + chooseItems(); + } + }); + + //allow key based navigation + input.addEventListener("keydown", function (e) { + var index; + + switch (e.keyCode) { + case 38: + //up arrow + index = dataItems.indexOf(currentItem); + + if (vertNav == "editor" || vertNav == "hybrid" && index) { + e.stopImmediatePropagation(); + e.stopPropagation(); + e.preventDefault(); + + if (index > 0) { + setCurrentItem(dataItems[index - 1], !multiselect); + } + } + break; + + case 40: + //down arrow + index = dataItems.indexOf(currentItem); + + if (vertNav == "editor" || vertNav == "hybrid" && index < dataItems.length - 1) { + e.stopImmediatePropagation(); + e.stopPropagation(); + e.preventDefault(); + + if (index < dataItems.length - 1) { + if (index == -1) { + setCurrentItem(dataItems[0], !multiselect); + } else { + setCurrentItem(dataItems[index + 1], !multiselect); + } + } + } + break; + + case 37: //left arrow + case 39: + //right arrow + e.stopImmediatePropagation(); + e.stopPropagation(); + e.preventDefault(); + break; + + case 13: + //enter + // chooseItem(); + + if (multiselect) { + toggleItem(); + } else { + chooseItem(); + } + + break; + + case 27: + //escape + cancelItem(); + break; + + case 9: + //tab + break; + + default: + if (self.currentCell === false) { + e.preventDefault(); + } + } + }); + + input.addEventListener("blur", function (e) { + if (blurable) { + if (multiselect) { + chooseItems(); + } else { + cancelItem(); + } + } + }); + + input.addEventListener("focus", function (e) { + if (!blockListShow) { + showList(); + } + }); + + //style list element + listEl = document.createElement("div"); + listEl.classList.add("tabulator-edit-select-list"); + + onRendered(function () { + input.style.height = "100%"; + input.focus({ preventScroll: true }); + }); + + setTimeout(function () { + _this53.table.rowManager.element.addEventListener("scroll", cancelItem); + }, 10); + + return input; + }, + + //autocomplete + autocomplete: function autocomplete(cell, onRendered, success, cancel, editorParams) { + var _this54 = this; + + var self = this, + cellEl = cell.getElement(), + initialValue = cell.getValue(), + vertNav = editorParams.verticalNavigation || "editor", + initialDisplayValue = typeof initialValue !== "undefined" || initialValue === null ? initialValue : typeof editorParams.defaultValue !== "undefined" ? editorParams.defaultValue : "", + input = document.createElement("input"), + listEl = document.createElement("div"), + allItems = [], + displayItems = [], + values = [], + currentItem = false, + blurable = true, + uniqueColumnValues = false; + + //style input + input.setAttribute("type", "search"); + + input.style.padding = "4px"; + input.style.width = "100%"; + input.style.boxSizing = "border-box"; + + if (editorParams.elementAttributes && _typeof(editorParams.elementAttributes) == "object") { + for (var key in editorParams.elementAttributes) { + if (key.charAt(0) == "+") { + key = key.slice(1); + input.setAttribute(key, input.getAttribute(key) + editorParams.elementAttributes["+" + key]); + } else { + input.setAttribute(key, editorParams.elementAttributes[key]); + } + } + } + + //style list element + listEl.classList.add("tabulator-edit-select-list"); + + listEl.addEventListener("mousedown", function (e) { + blurable = false; + + setTimeout(function () { + blurable = true; + }, 10); + }); + + function genUniqueColumnValues() { + if (editorParams.values === true) { + uniqueColumnValues = getUniqueColumnValues(); + } else if (typeof editorParams.values === "string") { + uniqueColumnValues = getUniqueColumnValues(editorParams.values); + } + } + + function getUniqueColumnValues(field) { + var output = {}, + data = self.table.getData(), + column; + + if (field) { + column = self.table.columnManager.getColumnByField(field); + } else { + column = cell.getColumn()._getSelf(); + } + + if (column) { + data.forEach(function (row) { + var val = column.getFieldValue(row); + + if (val !== null && typeof val !== "undefined" && val !== "") { + output[val] = true; + } + }); + + if (editorParams.sortValuesList) { + if (editorParams.sortValuesList == "asc") { + output = Object.keys(output).sort(); + } else { + output = Object.keys(output).sort().reverse(); + } + } else { + output = Object.keys(output); + } + } else { + console.warn("unable to find matching column to create autocomplete lookup list:", field); + } + + return output; + } + + function filterList(term, intialLoad) { + var matches = [], + values, + items, + searchEl; + + //lookup base values list + if (uniqueColumnValues) { + values = uniqueColumnValues; + } else { + values = editorParams.values || []; + } + + if (editorParams.searchFunc) { + matches = editorParams.searchFunc(term, values); + + if (matches instanceof Promise) { + + addNotice(typeof editorParams.searchingPlaceholder !== "undefined" ? editorParams.searchingPlaceholder : "Searching..."); + + matches.then(function (result) { + fillListIfNotEmpty(parseItems(result), intialLoad); + }).catch(function (err) { + console.err("error in autocomplete search promise:", err); + }); + } else { + fillListIfNotEmpty(parseItems(matches), intialLoad); + } + } else { + items = parseItems(values); + + if (term === "") { + if (editorParams.showListOnEmpty) { + matches = items; + } + } else { + items.forEach(function (item) { + if (item.value !== null || typeof item.value !== "undefined") { + if (String(item.value).toLowerCase().indexOf(String(term).toLowerCase()) > -1 || String(item.title).toLowerCase().indexOf(String(term).toLowerCase()) > -1) { + matches.push(item); + } + } + }); + } + + fillListIfNotEmpty(matches, intialLoad); + } + } + + function addNotice(notice) { + var searchEl = document.createElement("div"); + + clearList(); + + if (notice !== false) { + searchEl.classList.add("tabulator-edit-select-list-notice"); + searchEl.tabIndex = 0; + + if (notice instanceof Node) { + searchEl.appendChild(notice); + } else { + searchEl.innerHTML = notice; + } + + listEl.appendChild(searchEl); + } + } + + function parseItems(inputValues) { + var itemList = []; + + if (Array.isArray(inputValues)) { + inputValues.forEach(function (value) { + + var item = {}; + + if ((typeof value === 'undefined' ? 'undefined' : _typeof(value)) === "object") { + item.title = editorParams.listItemFormatter ? editorParams.listItemFormatter(value.value, value.label) : value.label; + item.value = value.value; + } else { + item.title = editorParams.listItemFormatter ? editorParams.listItemFormatter(value, value) : value; + item.value = value; + } + + itemList.push(item); + }); + } else { + for (var key in inputValues) { + var item = { + title: editorParams.listItemFormatter ? editorParams.listItemFormatter(key, inputValues[key]) : inputValues[key], + value: key + }; + + itemList.push(item); + } + } + + return itemList; + } + + function clearList() { + while (listEl.firstChild) { + listEl.removeChild(listEl.firstChild); + } + } + + function fillListIfNotEmpty(items, intialLoad) { + if (items.length) { + fillList(items, intialLoad); + } else { + if (editorParams.emptyPlaceholder) { + addNotice(editorParams.emptyPlaceholder); + } + } + } + + function fillList(items, intialLoad) { + var current = false; + + clearList(); + + displayItems = items; + + displayItems.forEach(function (item) { + var el = item.element; + + if (!el) { + el = document.createElement("div"); + el.classList.add("tabulator-edit-select-list-item"); + el.tabIndex = 0; + el.innerHTML = item.title; + + el.addEventListener("click", function (e) { + setCurrentItem(item); + chooseItem(); + }); + + el.addEventListener("mousedown", function (e) { + blurable = false; + + setTimeout(function () { + blurable = true; + }, 10); + }); + + item.element = el; + + if (intialLoad && item.value == initialValue) { + input.value = item.title; + item.element.classList.add("active"); + current = true; + } + + if (item === currentItem) { + item.element.classList.add("active"); + current = true; + } + } + + listEl.appendChild(el); + }); + + if (!current) { + setCurrentItem(false); + } + } + + function chooseItem() { + hideList(); + + if (currentItem) { + if (initialValue !== currentItem.value) { + initialValue = currentItem.value; + input.value = currentItem.title; + success(currentItem.value); + } else { + cancel(); + } + } else { + if (editorParams.freetext) { + initialValue = input.value; + success(input.value); + } else { + if (editorParams.allowEmpty && input.value === "") { + initialValue = input.value; + success(input.value); + } else { + cancel(); + } + } + } + } + + function showList() { + if (!listEl.parentNode) { + while (listEl.firstChild) { + listEl.removeChild(listEl.firstChild); + }var offset = Tabulator.prototype.helpers.elOffset(cellEl); + + listEl.style.minWidth = cellEl.offsetWidth + "px"; + + listEl.style.top = offset.top + cellEl.offsetHeight + "px"; + listEl.style.left = offset.left + "px"; + document.body.appendChild(listEl); + } + } + + function setCurrentItem(item, showInputValue) { + if (currentItem && currentItem.element) { + currentItem.element.classList.remove("active"); + } + + currentItem = item; + + if (item && item.element) { + item.element.classList.add("active"); + } + + if (item && item.element && item.element.scrollIntoView) { + item.element.scrollIntoView({ behavior: 'smooth', block: 'nearest', inline: 'start' }); + } + } + + function hideList() { + if (listEl.parentNode) { + listEl.parentNode.removeChild(listEl); + } + + removeScrollListener(); + } + + function cancelItem() { + hideList(); + cancel(); + } + + function removeScrollListener() { + self.table.rowManager.element.removeEventListener("scroll", cancelItem); + } + + //allow key based navigation + input.addEventListener("keydown", function (e) { + var index; + + switch (e.keyCode) { + case 38: + //up arrow + index = displayItems.indexOf(currentItem); + + if (vertNav == "editor" || vertNav == "hybrid" && index) { + e.stopImmediatePropagation(); + e.stopPropagation(); + e.preventDefault(); + + if (index > 0) { + setCurrentItem(displayItems[index - 1]); + } else { + setCurrentItem(false); + } + } + break; + + case 40: + //down arrow + + index = displayItems.indexOf(currentItem); + + if (vertNav == "editor" || vertNav == "hybrid" && index < displayItems.length - 1) { + + e.stopImmediatePropagation(); + e.stopPropagation(); + e.preventDefault(); + + if (index < displayItems.length - 1) { + if (index == -1) { + setCurrentItem(displayItems[0]); + } else { + setCurrentItem(displayItems[index + 1]); + } + } + } + break; + + case 37: //left arrow + case 39: + //right arrow + e.stopImmediatePropagation(); + e.stopPropagation(); + // e.preventDefault(); + break; + + case 13: + //enter + chooseItem(); + break; + + case 27: + //escape + cancelItem(); + break; + + case 36: //home + case 35: + //end + //prevent table navigation while using input element + e.stopImmediatePropagation(); + break; + } + }); + + input.addEventListener("keyup", function (e) { + + switch (e.keyCode) { + case 38: //up arrow + case 37: //left arrow + case 39: //up arrow + case 40: //right arrow + case 13: //enter + case 27: + //escape + break; + + default: + filterList(input.value); + } + }); + + input.addEventListener("search", function (e) { + filterList(input.value); + }); + + input.addEventListener("blur", function (e) { + if (blurable) { + chooseItem(); + } + }); + + input.addEventListener("focus", function (e) { + var value = initialDisplayValue; + genUniqueColumnValues(); + showList(); + input.value = value; + filterList(value, true); + }); + + onRendered(function () { + input.style.height = "100%"; + input.focus({ preventScroll: true }); + }); + + if (editorParams.mask) { + this.table.modules.edit.maskInput(input, editorParams); + } + + setTimeout(function () { + _this54.table.rowManager.element.addEventListener("scroll", cancelItem); + }, 10); + + genUniqueColumnValues(); + input.value = initialDisplayValue; + filterList(initialDisplayValue, true); + + return input; + }, + + //star rating + star: function star(cell, onRendered, success, cancel, editorParams) { + var self = this, + element = cell.getElement(), + value = cell.getValue(), + maxStars = element.getElementsByTagName("svg").length || 5, + size = element.getElementsByTagName("svg")[0] ? element.getElementsByTagName("svg")[0].getAttribute("width") : 14, + stars = [], + starsHolder = document.createElement("div"), + star = document.createElementNS('http://www.w3.org/2000/svg', "svg"); + + //change star type + function starChange(val) { + stars.forEach(function (star, i) { + if (i < val) { + if (self.table.browser == "ie") { + star.setAttribute("class", "tabulator-star-active"); + } else { + star.classList.replace("tabulator-star-inactive", "tabulator-star-active"); + } + + star.innerHTML = ''; + } else { + if (self.table.browser == "ie") { + star.setAttribute("class", "tabulator-star-inactive"); + } else { + star.classList.replace("tabulator-star-active", "tabulator-star-inactive"); + } + + star.innerHTML = ''; + } + }); + } + + //build stars + function buildStar(i) { + + var starHolder = document.createElement("span"); + var nextStar = star.cloneNode(true); + + stars.push(nextStar); + + starHolder.addEventListener("mouseenter", function (e) { + e.stopPropagation(); + e.stopImmediatePropagation(); + starChange(i); + }); + + starHolder.addEventListener("mousemove", function (e) { + e.stopPropagation(); + e.stopImmediatePropagation(); + }); + + starHolder.addEventListener("click", function (e) { + e.stopPropagation(); + e.stopImmediatePropagation(); + success(i); + element.blur(); + }); + + starHolder.appendChild(nextStar); + starsHolder.appendChild(starHolder); + } + + //handle keyboard navigation value change + function changeValue(val) { + value = val; + starChange(val); + } + + //style cell + element.style.whiteSpace = "nowrap"; + element.style.overflow = "hidden"; + element.style.textOverflow = "ellipsis"; + + //style holding element + starsHolder.style.verticalAlign = "middle"; + starsHolder.style.display = "inline-block"; + starsHolder.style.padding = "4px"; + + //style star + star.setAttribute("width", size); + star.setAttribute("height", size); + star.setAttribute("viewBox", "0 0 512 512"); + star.setAttribute("xml:space", "preserve"); + star.style.padding = "0 1px"; + + if (editorParams.elementAttributes && _typeof(editorParams.elementAttributes) == "object") { + for (var key in editorParams.elementAttributes) { + if (key.charAt(0) == "+") { + key = key.slice(1); + starsHolder.setAttribute(key, starsHolder.getAttribute(key) + editorParams.elementAttributes["+" + key]); + } else { + starsHolder.setAttribute(key, editorParams.elementAttributes[key]); + } + } + } + + //create correct number of stars + for (var i = 1; i <= maxStars; i++) { + buildStar(i); + } + + //ensure value does not exceed number of stars + value = Math.min(parseInt(value), maxStars); + + // set initial styling of stars + starChange(value); + + starsHolder.addEventListener("mousemove", function (e) { + starChange(0); + }); + + starsHolder.addEventListener("click", function (e) { + success(0); + }); + + element.addEventListener("blur", function (e) { + cancel(); + }); + + //allow key based navigation + element.addEventListener("keydown", function (e) { + switch (e.keyCode) { + case 39: + //right arrow + changeValue(value + 1); + break; + + case 37: + //left arrow + changeValue(value - 1); + break; + + case 13: + //enter + success(value); + break; + + case 27: + //escape + cancel(); + break; + } + }); + + return starsHolder; + }, + + //draggable progress bar + progress: function progress(cell, onRendered, success, cancel, editorParams) { + var element = cell.getElement(), + max = typeof editorParams.max === "undefined" ? element.getElementsByTagName("div")[0].getAttribute("max") || 100 : editorParams.max, + min = typeof editorParams.min === "undefined" ? element.getElementsByTagName("div")[0].getAttribute("min") || 0 : editorParams.min, + percent = (max - min) / 100, + value = cell.getValue() || 0, + handle = document.createElement("div"), + bar = document.createElement("div"), + mouseDrag, + mouseDragWidth; + + //set new value + function updateValue() { + var calcVal = percent * Math.round(bar.offsetWidth / (element.clientWidth / 100)) + min; + success(calcVal); + element.setAttribute("aria-valuenow", calcVal); + element.setAttribute("aria-label", value); + } + + //style handle + handle.style.position = "absolute"; + handle.style.right = "0"; + handle.style.top = "0"; + handle.style.bottom = "0"; + handle.style.width = "5px"; + handle.classList.add("tabulator-progress-handle"); + + //style bar + bar.style.display = "inline-block"; + bar.style.position = "relative"; + // bar.style.top = "8px"; + // bar.style.bottom = "8px"; + // bar.style.left = "4px"; + // bar.style.marginRight = "4px"; + bar.style.height = "100%"; + bar.style.backgroundColor = "#488CE9"; + bar.style.maxWidth = "100%"; + bar.style.minWidth = "0%"; + + if (editorParams.elementAttributes && _typeof(editorParams.elementAttributes) == "object") { + for (var key in editorParams.elementAttributes) { + if (key.charAt(0) == "+") { + key = key.slice(1); + bar.setAttribute(key, bar.getAttribute(key) + editorParams.elementAttributes["+" + key]); + } else { + bar.setAttribute(key, editorParams.elementAttributes[key]); + } + } + } + + //style cell + element.style.padding = "4px 4px"; + + //make sure value is in range + value = Math.min(parseFloat(value), max); + value = Math.max(parseFloat(value), min); + + //workout percentage + value = Math.round((value - min) / percent); + // bar.style.right = value + "%"; + bar.style.width = value + "%"; + + element.setAttribute("aria-valuemin", min); + element.setAttribute("aria-valuemax", max); + + bar.appendChild(handle); + + handle.addEventListener("mousedown", function (e) { + mouseDrag = e.screenX; + mouseDragWidth = bar.offsetWidth; + }); + + handle.addEventListener("mouseover", function () { + handle.style.cursor = "ew-resize"; + }); + + element.addEventListener("mousemove", function (e) { + if (mouseDrag) { + bar.style.width = mouseDragWidth + e.screenX - mouseDrag + "px"; + } + }); + + element.addEventListener("mouseup", function (e) { + if (mouseDrag) { + e.stopPropagation(); + e.stopImmediatePropagation(); + + mouseDrag = false; + mouseDragWidth = false; + + updateValue(); + } + }); + + //allow key based navigation + element.addEventListener("keydown", function (e) { + switch (e.keyCode) { + case 39: + //right arrow + e.preventDefault(); + bar.style.width = bar.clientWidth + element.clientWidth / 100 + "px"; + break; + + case 37: + //left arrow + e.preventDefault(); + bar.style.width = bar.clientWidth - element.clientWidth / 100 + "px"; + break; + + case 9: //tab + case 13: + //enter + updateValue(); + break; + + case 27: + //escape + cancel(); + break; + + } + }); + + element.addEventListener("blur", function () { + cancel(); + }); + + return bar; + }, + + //checkbox + tickCross: function tickCross(cell, onRendered, success, cancel, editorParams) { + var value = cell.getValue(), + input = document.createElement("input"), + tristate = editorParams.tristate, + indetermValue = typeof editorParams.indeterminateValue === "undefined" ? null : editorParams.indeterminateValue, + indetermState = false; + + input.setAttribute("type", "checkbox"); + input.style.marginTop = "5px"; + input.style.boxSizing = "border-box"; + + if (editorParams.elementAttributes && _typeof(editorParams.elementAttributes) == "object") { + for (var key in editorParams.elementAttributes) { + if (key.charAt(0) == "+") { + key = key.slice(1); + input.setAttribute(key, input.getAttribute(key) + editorParams.elementAttributes["+" + key]); + } else { + input.setAttribute(key, editorParams.elementAttributes[key]); + } + } + } + + input.value = value; + + if (tristate && (typeof value === "undefined" || value === indetermValue || value === "")) { + indetermState = true; + input.indeterminate = true; + } + + if (this.table.browser != "firefox") { + //prevent blur issue on mac firefox + onRendered(function () { + input.focus({ preventScroll: true }); + }); + } + + input.checked = value === true || value === "true" || value === "True" || value === 1; + + onRendered(function () { + input.focus(); + }); + + function setValue(blur) { + if (tristate) { + if (!blur) { + if (input.checked && !indetermState) { + input.checked = false; + input.indeterminate = true; + indetermState = true; + return indetermValue; + } else { + indetermState = false; + return input.checked; + } + } else { + if (indetermState) { + return indetermValue; + } else { + return input.checked; + } + } + } else { + return input.checked; + } + } + + //submit new value on blur + input.addEventListener("change", function (e) { + success(setValue()); + }); + + input.addEventListener("blur", function (e) { + success(setValue(true)); + }); + + //submit new value on enter + input.addEventListener("keydown", function (e) { + if (e.keyCode == 13) { + success(setValue()); + } + if (e.keyCode == 27) { + cancel(); + } + }); + + return input; + } +}; + +Tabulator.prototype.registerModule("edit", Edit); + +var ExportRow = function ExportRow(type, columns, component, indent) { + this.type = type; + this.columns = columns; + this.component = component || false; + this.indent = indent || 0; +}; + +var ExportColumn = function ExportColumn(value, component, width, height, depth) { + this.value = value; + this.component = component || false; + this.width = width; + this.height = height; + this.depth = depth; +}; + +var Export = function Export(table) { + this.table = table; //hold Tabulator object + this.config = {}; + this.cloneTableStyle = true; + this.colVisProp = ""; +}; + +Export.prototype.generateExportList = function (config, style, range, colVisProp) { + this.cloneTableStyle = style; + this.config = config || {}; + this.colVisProp = colVisProp; + + var headers = this.config.columnHeaders !== false ? this.headersToExportRows(this.generateColumnGroupHeaders()) : []; + var body = this.bodyToExportRows(this.rowLookup(range)); + + return headers.concat(body); +}; + +Export.prototype.genereateTable = function (config, style, range, colVisProp) { + var list = this.generateExportList(config, style, range, colVisProp); + + return this.genereateTableElement(list); +}; + +Export.prototype.rowLookup = function (range) { + var _this55 = this; + + var rows = []; + + if (typeof range == "function") { + range.call(this.table).forEach(function (row) { + row = _this55.table.rowManager.findRow(row); + + if (row) { + rows.push(row); + } + }); + } else { + switch (range) { + case true: + case "visible": + rows = this.table.rowManager.getVisibleRows(true); + break; + + case "all": + rows = this.table.rowManager.rows; + break; + + case "selected": + rows = this.table.modules.selectRow.selectedRows; + break; + + case "active": + default: + if (this.table.options.pagination) { + rows = this.table.rowManager.getDisplayRows(this.table.rowManager.displayRows.length - 2); + } else { + rows = this.table.rowManager.getDisplayRows(); + } + } + } + + return Object.assign([], rows); +}; + +Export.prototype.generateColumnGroupHeaders = function () { + var _this56 = this; + + var output = []; + + var columns = this.config.columnGroups !== false ? this.table.columnManager.columns : this.table.columnManager.columnsByIndex; + + columns.forEach(function (column) { + var colData = _this56.processColumnGroup(column); + + if (colData) { + output.push(colData); + } + }); + + return output; +}; + +Export.prototype.processColumnGroup = function (column) { + var _this57 = this; + + var subGroups = column.columns, + maxDepth = 0, + title = column.definition["title" + (this.colVisProp.charAt(0).toUpperCase() + this.colVisProp.slice(1))] || column.definition.title; + + var groupData = { + title: title, + column: column, + depth: 1 + }; + + if (subGroups.length) { + groupData.subGroups = []; + groupData.width = 0; + + subGroups.forEach(function (subGroup) { + var subGroupData = _this57.processColumnGroup(subGroup); + + if (subGroupData) { + groupData.width += subGroupData.width; + groupData.subGroups.push(subGroupData); + + if (subGroupData.depth > maxDepth) { + maxDepth = subGroupData.depth; + } + } + }); + + groupData.depth += maxDepth; + + if (!groupData.width) { + return false; + } + } else { + if (this.columnVisCheck(column)) { + groupData.width = 1; + } else { + return false; + } + } + + return groupData; +}; + +Export.prototype.columnVisCheck = function (column) { + return column.definition[this.colVisProp] !== false && (column.visible || !column.visible && column.definition[this.colVisProp]); +}; + +Export.prototype.headersToExportRows = function (columns) { + var headers = [], + headerDepth = 0, + exportRows = []; + + function parseColumnGroup(column, level) { + + var depth = headerDepth - level; + + if (typeof headers[level] === "undefined") { + headers[level] = []; + } + + column.height = column.subGroups ? 1 : depth - column.depth + 1; + + headers[level].push(column); + + if (column.height > 1) { + for (var _i10 = 1; _i10 < column.height; _i10++) { + + if (typeof headers[level + _i10] === "undefined") { + headers[level + _i10] = []; + } + + headers[level + _i10].push(false); + } + } + + if (column.width > 1) { + for (var _i11 = 1; _i11 < column.width; _i11++) { + headers[level].push(false); + } + } + + if (column.subGroups) { + column.subGroups.forEach(function (subGroup) { + parseColumnGroup(subGroup, level + 1); + }); + } + } + + //calculate maximum header debth + columns.forEach(function (column) { + if (column.depth > headerDepth) { + headerDepth = column.depth; + } + }); + + columns.forEach(function (column) { + parseColumnGroup(column, 0); + }); + + headers.forEach(function (header) { + var columns = []; + + header.forEach(function (col) { + if (col) { + columns.push(new ExportColumn(col.title, col.column.getComponent(), col.width, col.height, col.depth)); + } else { + columns.push(null); + } + }); + + exportRows.push(new ExportRow("header", columns)); + }); + + return exportRows; +}; + +Export.prototype.bodyToExportRows = function (rows) { + var _this58 = this; + + var columns = []; + var exportRows = []; + + this.table.columnManager.columnsByIndex.forEach(function (column) { + if (_this58.columnVisCheck(column)) { + columns.push(column.getComponent()); + } + }); + + if (this.config.columnCalcs !== false && this.table.modExists("columnCalcs")) { + if (this.table.modules.columnCalcs.topInitialized) { + rows.unshift(this.table.modules.columnCalcs.topRow); + } + + if (this.table.modules.columnCalcs.botInitialized) { + rows.push(this.table.modules.columnCalcs.botRow); + } + } + + rows = rows.filter(function (row) { + switch (row.type) { + case "group": + return _this58.config.rowGroups !== false; + break; + + case "calc": + return _this58.config.columnCalcs !== false; + break; + + case "row": + return !(_this58.table.options.dataTree && _this58.config.dataTree === false && row.modules.dataTree.parent); + break; + } + + return true; + }); + + rows.forEach(function (row, i) { + var rowData = row.getData(_this58.colVisProp); + var exportCols = []; + var indent = 0; + + switch (row.type) { + case "group": + indent = row.level; + exportCols.push(new ExportColumn(row.key, row.getComponent(), columns.length, 1)); + break; + + case "calc": + case "row": + columns.forEach(function (col) { + exportCols.push(new ExportColumn(col._column.getFieldValue(rowData), col, 1, 1)); + }); + + if (_this58.table.options.dataTree && _this58.config.dataTree !== false) { + indent = row.modules.dataTree.index; + } + break; + } + + exportRows.push(new ExportRow(row.type, exportCols, row.getComponent(), indent)); + }); + + return exportRows; +}; + +Export.prototype.genereateTableElement = function (list) { + var _this59 = this; + + var table = document.createElement("table"), + headerEl = document.createElement("thead"), + bodyEl = document.createElement("tbody"), + styles = this.lookupTableStyles(), + rowFormatter = this.table.options["rowFormatter" + (this.colVisProp.charAt(0).toUpperCase() + this.colVisProp.slice(1))], + setup = {}; + + setup.rowFormatter = rowFormatter !== null ? rowFormatter : this.table.options.rowFormatter; + + if (this.table.options.dataTree && this.config.dataTree !== false && this.table.modExists("columnCalcs")) { + setup.treeElementField = this.table.modules.dataTree.elementField; + } + + //assign group header formatter + setup.groupHeader = this.table.options["groupHeader" + (this.colVisProp.charAt(0).toUpperCase() + this.colVisProp.slice(1))]; + + if (setup.groupHeader && !Array.isArray(setup.groupHeader)) { + setup.groupHeader = [setup.groupHeader]; + } + + table.classList.add("tabulator-print-table"); + + this.mapElementStyles(this.table.columnManager.getHeadersElement(), headerEl, ["border-top", "border-left", "border-right", "border-bottom", "background-color", "color", "font-weight", "font-family", "font-size"]); + + if (list.length > 1000) { + console.warn("It may take a long time to render an HTML table with more than 1000 rows"); + } + + list.forEach(function (row, i) { + switch (row.type) { + case "header": + headerEl.appendChild(_this59.genereateHeaderElement(row, setup, styles)); + break; + + case "group": + bodyEl.appendChild(_this59.genereateGroupElement(row, setup, styles)); + break; + + case "calc": + bodyEl.appendChild(_this59.genereateCalcElement(row, setup, styles)); + break; + + case "row": + var rowEl = _this59.genereateRowElement(row, setup, styles); + _this59.mapElementStyles(i % 2 && styles.evenRow ? styles.evenRow : styles.oddRow, rowEl, ["border-top", "border-left", "border-right", "border-bottom", "color", "font-weight", "font-family", "font-size", "background-color"]); + bodyEl.appendChild(rowEl); + break; + } + }); + + if (headerEl.innerHTML) { + table.appendChild(headerEl); + } + + table.appendChild(bodyEl); + + this.mapElementStyles(this.table.element, table, ["border-top", "border-left", "border-right", "border-bottom"]); + return table; +}; + +Export.prototype.lookupTableStyles = function () { + var styles = {}; + + //lookup row styles + if (this.cloneTableStyle && window.getComputedStyle) { + styles.oddRow = this.table.element.querySelector(".tabulator-row-odd:not(.tabulator-group):not(.tabulator-calcs)"); + styles.evenRow = this.table.element.querySelector(".tabulator-row-even:not(.tabulator-group):not(.tabulator-calcs)"); + styles.calcRow = this.table.element.querySelector(".tabulator-row.tabulator-calcs"); + styles.firstRow = this.table.element.querySelector(".tabulator-row:not(.tabulator-group):not(.tabulator-calcs)"); + styles.firstGroup = this.table.element.getElementsByClassName("tabulator-group")[0]; + + if (styles.firstRow) { + styles.styleCells = styles.firstRow.getElementsByClassName("tabulator-cell"); + styles.firstCell = styles.styleCells[0]; + styles.lastCell = styles.styleCells[styles.styleCells.length - 1]; + } + } + + return styles; +}; + +Export.prototype.genereateHeaderElement = function (row, setup, styles) { + var _this60 = this; + + var rowEl = document.createElement("tr"); + + row.columns.forEach(function (column) { + if (column) { + var cellEl = document.createElement("th"); + var classNames = column.component._column.definition.cssClass ? column.component._column.definition.cssClass.split(" ") : []; + + cellEl.colSpan = column.width; + cellEl.rowSpan = column.height; + + cellEl.innerHTML = column.value; + + if (_this60.cloneTableStyle) { + cellEl.style.boxSizing = "border-box"; + } + + classNames.forEach(function (className) { + cellEl.classList.add(className); + }); + + _this60.mapElementStyles(column.component.getElement(), cellEl, ["text-align", "border-top", "border-left", "border-right", "border-bottom", "background-color", "color", "font-weight", "font-family", "font-size"]); + _this60.mapElementStyles(column.component._column.contentElement, cellEl, ["padding-top", "padding-left", "padding-right", "padding-bottom"]); + + if (column.component._column.visible) { + _this60.mapElementStyles(column.component.getElement(), cellEl, ["width"]); + } else { + if (column.component._column.definition.width) { + cellEl.style.width = column.component._column.definition.width + "px"; + } + } + + if (column.component._column.parent) { + _this60.mapElementStyles(column.component._column.parent.groupElement, cellEl, ["border-top"]); + } + + rowEl.appendChild(cellEl); + } + }); + + return rowEl; +}; + +Export.prototype.genereateGroupElement = function (row, setup, styles) { + + var rowEl = document.createElement("tr"), + cellEl = document.createElement("td"), + group = row.columns[0]; + + rowEl.classList.add("tabulator-print-table-row"); + + if (setup.groupHeader && setup.groupHeader[row.indent]) { + group.value = setup.groupHeader[row.indent](group.value, row.component._group.getRowCount(), row.component._group.getData(), row.component); + } else { + if (setup.groupHeader === false) { + group.value = group.value; + } else { + group.value = row.component._group.generator(group.value, row.component._group.getRowCount(), row.component._group.getData(), row.component); + } + } + + cellEl.colSpan = group.width; + cellEl.innerHTML = group.value; + + rowEl.classList.add("tabulator-print-table-group"); + rowEl.classList.add("tabulator-group-level-" + row.indent); + + if (group.component.isVisible()) { + rowEl.classList.add("tabulator-group-visible"); + } + + this.mapElementStyles(styles.firstGroup, rowEl, ["border-top", "border-left", "border-right", "border-bottom", "color", "font-weight", "font-family", "font-size", "background-color"]); + this.mapElementStyles(styles.firstGroup, cellEl, ["padding-top", "padding-left", "padding-right", "padding-bottom"]); + + rowEl.appendChild(cellEl); + + return rowEl; +}; + +Export.prototype.genereateCalcElement = function (row, setup, styles) { + var rowEl = this.genereateRowElement(row, setup, styles); + + rowEl.classList.add("tabulator-print-table-calcs"); + this.mapElementStyles(styles.calcRow, rowEl, ["border-top", "border-left", "border-right", "border-bottom", "color", "font-weight", "font-family", "font-size", "background-color"]); + + return rowEl; +}; + +Export.prototype.genereateRowElement = function (row, setup, styles) { + var _this61 = this; + + var rowEl = document.createElement("tr"); + + rowEl.classList.add("tabulator-print-table-row"); + + row.columns.forEach(function (col) { + + if (col) { + var cellEl = document.createElement("td"), + column = col.component._column, + value = col.value; + + var cellWrapper = { + modules: {}, + getValue: function getValue() { + return value; + }, + getField: function getField() { + return column.definition.field; + }, + getElement: function getElement() { + return cellEl; + }, + getColumn: function getColumn() { + return column.getComponent(); + }, + getData: function getData() { + return row.component.getData(); + }, + getRow: function getRow() { + return row.component; + }, + getComponent: function getComponent() { + return cellWrapper; + }, + column: column + }; + + var classNames = column.definition.cssClass ? column.definition.cssClass.split(" ") : []; + + classNames.forEach(function (className) { + cellEl.classList.add(className); + }); + + if (_this61.table.modExists("format") && _this61.config.formatCells !== false) { + value = _this61.table.modules.format.formatExportValue(cellWrapper, _this61.colVisProp); + } else { + switch (typeof value === 'undefined' ? 'undefined' : _typeof(value)) { + case "object": + value = JSON.stringify(value); + break; + + case "undefined": + case "null": + value = ""; + break; + + default: + value = value; + } + } + + if (value instanceof Node) { + cellEl.appendChild(value); + } else { + cellEl.innerHTML = value; + } + + if (styles.firstCell) { + _this61.mapElementStyles(styles.firstCell, cellEl, ["padding-top", "padding-left", "padding-right", "padding-bottom", "border-top", "border-left", "border-right", "border-bottom", "color", "font-weight", "font-family", "font-size"]); + + if (column.definition.align) { + cellEl.style.textAlign = column.definition.align; + } + } + + if (_this61.table.options.dataTree && _this61.config.dataTree !== false) { + if (setup.treeElementField && setup.treeElementField == column.field || !setup.treeElementField && i == 0) { + if (row.component._row.modules.dataTree.controlEl) { + cellEl.insertBefore(row.component._row.modules.dataTree.controlEl.cloneNode(true), cellEl.firstChild); + } + if (row.component._row.modules.dataTree.branchEl) { + cellEl.insertBefore(row.component._row.modules.dataTree.branchEl.cloneNode(true), cellEl.firstChild); + } + } + } + + rowEl.appendChild(cellEl); + + if (cellWrapper.modules.format && cellWrapper.modules.format.renderedCallback) { + cellWrapper.modules.format.renderedCallback(); + } + + if (setup.rowFormatter && _this61.config.formatCells !== false) { + setup.rowFormatter(row.component); + } + } + }); + + return rowEl; +}; + +Export.prototype.genereateHTMLTable = function (list) { + var holder = document.createElement("div"); + + holder.appendChild(this.genereateTableElement(list)); + + return holder.innerHTML; +}; + +Export.prototype.getHtml = function (visible, style, config, colVisProp) { + var list = this.generateExportList(config || this.table.options.htmlOutputConfig, style, visible, colVisProp || "htmlOutput"); + + return this.genereateHTMLTable(list); +}; + +Export.prototype.mapElementStyles = function (from, to, props) { + if (this.cloneTableStyle && from && to) { + + var lookup = { + "background-color": "backgroundColor", + "color": "fontColor", + "width": "width", + "font-weight": "fontWeight", + "font-family": "fontFamily", + "font-size": "fontSize", + "text-align": "textAlign", + "border-top": "borderTop", + "border-left": "borderLeft", + "border-right": "borderRight", + "border-bottom": "borderBottom", + "padding-top": "paddingTop", + "padding-left": "paddingLeft", + "padding-right": "paddingRight", + "padding-bottom": "paddingBottom" + }; + + if (window.getComputedStyle) { + var fromStyle = window.getComputedStyle(from); + + props.forEach(function (prop) { + to.style[lookup[prop]] = fromStyle.getPropertyValue(prop); + }); + } + } +}; + +Tabulator.prototype.registerModule("export", Export); + +var Filter = function Filter(table) { + + this.table = table; //hold Tabulator object + + this.filterList = []; //hold filter list + this.headerFilters = {}; //hold column filters + this.headerFilterColumns = []; //hold columns that use header filters + + this.prevHeaderFilterChangeCheck = ""; + this.prevHeaderFilterChangeCheck = "{}"; + + this.changed = false; //has filtering changed since last render +}; + +//initialize column header filter +Filter.prototype.initializeColumn = function (column, value) { + var self = this, + field = column.getField(), + params; + + //handle successfull value change + function success(value) { + var filterType = column.modules.filter.tagType == "input" && column.modules.filter.attrType == "text" || column.modules.filter.tagType == "textarea" ? "partial" : "match", + type = "", + filterChangeCheck = "", + filterFunc; + + if (typeof column.modules.filter.prevSuccess === "undefined" || column.modules.filter.prevSuccess !== value) { + + column.modules.filter.prevSuccess = value; + + if (!column.modules.filter.emptyFunc(value)) { + column.modules.filter.value = value; + + switch (_typeof(column.definition.headerFilterFunc)) { + case "string": + if (self.filters[column.definition.headerFilterFunc]) { + type = column.definition.headerFilterFunc; + filterFunc = function filterFunc(data) { + var params = column.definition.headerFilterFuncParams || {}; + var fieldVal = column.getFieldValue(data); + + params = typeof params === "function" ? params(value, fieldVal, data) : params; + + return self.filters[column.definition.headerFilterFunc](value, fieldVal, data, params); + }; + } else { + console.warn("Header Filter Error - Matching filter function not found: ", column.definition.headerFilterFunc); + } + break; + + case "function": + filterFunc = function filterFunc(data) { + var params = column.definition.headerFilterFuncParams || {}; + var fieldVal = column.getFieldValue(data); + + params = typeof params === "function" ? params(value, fieldVal, data) : params; + + return column.definition.headerFilterFunc(value, fieldVal, data, params); + }; + + type = filterFunc; + break; + } + + if (!filterFunc) { + switch (filterType) { + case "partial": + filterFunc = function filterFunc(data) { + var colVal = column.getFieldValue(data); + + if (typeof colVal !== 'undefined' && colVal !== null) { + return String(colVal).toLowerCase().indexOf(String(value).toLowerCase()) > -1; + } else { + return false; + } + }; + type = "like"; + break; + + default: + filterFunc = function filterFunc(data) { + return column.getFieldValue(data) == value; + }; + type = "="; + } + } + + self.headerFilters[field] = { value: value, func: filterFunc, type: type, params: params || {} }; + } else { + delete self.headerFilters[field]; + } + + filterChangeCheck = JSON.stringify(self.headerFilters); + + if (self.prevHeaderFilterChangeCheck !== filterChangeCheck) { + self.prevHeaderFilterChangeCheck = filterChangeCheck; + + self.changed = true; + self.table.rowManager.filterRefresh(); + } + } + + return true; + } + + column.modules.filter = { + success: success, + attrType: false, + tagType: false, + emptyFunc: false + }; + + this.generateHeaderFilterElement(column); +}; + +Filter.prototype.generateHeaderFilterElement = function (column, initialValue, reinitialize) { + var _this62 = this; + + var self = this, + success = column.modules.filter.success, + field = column.getField(), + filterElement, + editor, + editorElement, + cellWrapper, + typingTimer, + searchTrigger, + params; + + //handle aborted edit + function cancel() {} + + if (column.modules.filter.headerElement && column.modules.filter.headerElement.parentNode) { + column.contentElement.removeChild(column.modules.filter.headerElement.parentNode); + } + + if (field) { + + //set empty value function + column.modules.filter.emptyFunc = column.definition.headerFilterEmptyCheck || function (value) { + return !value && value !== "0"; + }; + + filterElement = document.createElement("div"); + filterElement.classList.add("tabulator-header-filter"); + + //set column editor + switch (_typeof(column.definition.headerFilter)) { + case "string": + if (self.table.modules.edit.editors[column.definition.headerFilter]) { + editor = self.table.modules.edit.editors[column.definition.headerFilter]; + + if ((column.definition.headerFilter === "tick" || column.definition.headerFilter === "tickCross") && !column.definition.headerFilterEmptyCheck) { + column.modules.filter.emptyFunc = function (value) { + return value !== true && value !== false; + }; + } + } else { + console.warn("Filter Error - Cannot build header filter, No such editor found: ", column.definition.editor); + } + break; + + case "function": + editor = column.definition.headerFilter; + break; + + case "boolean": + if (column.modules.edit && column.modules.edit.editor) { + editor = column.modules.edit.editor; + } else { + if (column.definition.formatter && self.table.modules.edit.editors[column.definition.formatter]) { + editor = self.table.modules.edit.editors[column.definition.formatter]; + + if ((column.definition.formatter === "tick" || column.definition.formatter === "tickCross") && !column.definition.headerFilterEmptyCheck) { + column.modules.filter.emptyFunc = function (value) { + return value !== true && value !== false; + }; + } + } else { + editor = self.table.modules.edit.editors["input"]; + } + } + break; + } + + if (editor) { + + cellWrapper = { + getValue: function getValue() { + return typeof initialValue !== "undefined" ? initialValue : ""; + }, + getField: function getField() { + return column.definition.field; + }, + getElement: function getElement() { + return filterElement; + }, + getColumn: function getColumn() { + return column.getComponent(); + }, + getRow: function getRow() { + return { + normalizeHeight: function normalizeHeight() {} + }; + } + }; + + params = column.definition.headerFilterParams || {}; + + params = typeof params === "function" ? params.call(self.table) : params; + + editorElement = editor.call(this.table.modules.edit, cellWrapper, function () {}, success, cancel, params); + + if (!editorElement) { + console.warn("Filter Error - Cannot add filter to " + field + " column, editor returned a value of false"); + return; + } + + if (!(editorElement instanceof Node)) { + console.warn("Filter Error - Cannot add filter to " + field + " column, editor should return an instance of Node, the editor returned:", editorElement); + return; + } + + //set Placeholder Text + if (field) { + self.table.modules.localize.bind("headerFilters|columns|" + column.definition.field, function (value) { + editorElement.setAttribute("placeholder", typeof value !== "undefined" && value ? value : self.table.modules.localize.getText("headerFilters|default")); + }); + } else { + self.table.modules.localize.bind("headerFilters|default", function (value) { + editorElement.setAttribute("placeholder", typeof self.column.definition.headerFilterPlaceholder !== "undefined" && self.column.definition.headerFilterPlaceholder ? self.column.definition.headerFilterPlaceholder : value); + }); + } + + //focus on element on click + editorElement.addEventListener("click", function (e) { + e.stopPropagation(); + editorElement.focus(); + }); + + editorElement.addEventListener("focus", function (e) { + var left = _this62.table.columnManager.element.scrollLeft; + + if (left !== _this62.table.rowManager.element.scrollLeft) { + _this62.table.rowManager.scrollHorizontal(left); + _this62.table.columnManager.scrollHorizontal(left); + } + }); + + //live update filters as user types + typingTimer = false; + + searchTrigger = function searchTrigger(e) { + if (typingTimer) { + clearTimeout(typingTimer); + } + + typingTimer = setTimeout(function () { + success(editorElement.value); + }, self.table.options.headerFilterLiveFilterDelay); + }; + + column.modules.filter.headerElement = editorElement; + column.modules.filter.attrType = editorElement.hasAttribute("type") ? editorElement.getAttribute("type").toLowerCase() : ""; + column.modules.filter.tagType = editorElement.tagName.toLowerCase(); + + if (column.definition.headerFilterLiveFilter !== false) { + + if (!(column.definition.headerFilter === 'autocomplete' || column.definition.headerFilter === 'tickCross' || (column.definition.editor === 'autocomplete' || column.definition.editor === 'tickCross') && column.definition.headerFilter === true)) { + editorElement.addEventListener("keyup", searchTrigger); + editorElement.addEventListener("search", searchTrigger); + + //update number filtered columns on change + if (column.modules.filter.attrType == "number") { + editorElement.addEventListener("change", function (e) { + success(editorElement.value); + }); + } + + //change text inputs to search inputs to allow for clearing of field + if (column.modules.filter.attrType == "text" && this.table.browser !== "ie") { + editorElement.setAttribute("type", "search"); + // editorElement.off("change blur"); //prevent blur from triggering filter and preventing selection click + } + } + + //prevent input and select elements from propegating click to column sorters etc + if (column.modules.filter.tagType == "input" || column.modules.filter.tagType == "select" || column.modules.filter.tagType == "textarea") { + editorElement.addEventListener("mousedown", function (e) { + e.stopPropagation(); + }); + } + } + + filterElement.appendChild(editorElement); + + column.contentElement.appendChild(filterElement); + + if (!reinitialize) { + self.headerFilterColumns.push(column); + } + } + } else { + console.warn("Filter Error - Cannot add header filter, column has no field set:", column.definition.title); + } +}; + +//hide all header filter elements (used to ensure correct column widths in "fitData" layout mode) +Filter.prototype.hideHeaderFilterElements = function () { + this.headerFilterColumns.forEach(function (column) { + if (column.modules.filter && column.modules.filter.headerElement) { + column.modules.filter.headerElement.style.display = 'none'; + } + }); +}; + +//show all header filter elements (used to ensure correct column widths in "fitData" layout mode) +Filter.prototype.showHeaderFilterElements = function () { + this.headerFilterColumns.forEach(function (column) { + if (column.modules.filter && column.modules.filter.headerElement) { + column.modules.filter.headerElement.style.display = ''; + } + }); +}; + +//programatically set focus of header filter +Filter.prototype.setHeaderFilterFocus = function (column) { + if (column.modules.filter && column.modules.filter.headerElement) { + column.modules.filter.headerElement.focus(); + } else { + console.warn("Column Filter Focus Error - No header filter set on column:", column.getField()); + } +}; + +//programmatically get value of header filter +Filter.prototype.getHeaderFilterValue = function (column) { + if (column.modules.filter && column.modules.filter.headerElement) { + return column.modules.filter.headerElement.value; + } else { + console.warn("Column Filter Error - No header filter set on column:", column.getField()); + } +}; + +//programatically set value of header filter +Filter.prototype.setHeaderFilterValue = function (column, value) { + if (column) { + if (column.modules.filter && column.modules.filter.headerElement) { + this.generateHeaderFilterElement(column, value, true); + column.modules.filter.success(value); + } else { + console.warn("Column Filter Error - No header filter set on column:", column.getField()); + } + } +}; + +Filter.prototype.reloadHeaderFilter = function (column) { + if (column) { + if (column.modules.filter && column.modules.filter.headerElement) { + this.generateHeaderFilterElement(column, column.modules.filter.value, true); + } else { + console.warn("Column Filter Error - No header filter set on column:", column.getField()); + } + } +}; + +//check if the filters has changed since last use +Filter.prototype.hasChanged = function () { + var changed = this.changed; + this.changed = false; + return changed; +}; + +//set standard filters +Filter.prototype.setFilter = function (field, type, value, params) { + var self = this; + + self.filterList = []; + + if (!Array.isArray(field)) { + field = [{ field: field, type: type, value: value, params: params }]; + } + + self.addFilter(field); +}; + +//add filter to array +Filter.prototype.addFilter = function (field, type, value, params) { + var self = this; + + if (!Array.isArray(field)) { + field = [{ field: field, type: type, value: value, params: params }]; + } + + field.forEach(function (filter) { + + filter = self.findFilter(filter); + + if (filter) { + self.filterList.push(filter); + + self.changed = true; + } + }); + + if (this.table.options.persistence && this.table.modExists("persistence", true) && this.table.modules.persistence.config.filter) { + this.table.modules.persistence.save("filter"); + } +}; + +Filter.prototype.findFilter = function (filter) { + var self = this, + column; + + if (Array.isArray(filter)) { + return this.findSubFilters(filter); + } + + var filterFunc = false; + + if (typeof filter.field == "function") { + filterFunc = function filterFunc(data) { + return filter.field(data, filter.type || {}); // pass params to custom filter function + }; + } else { + + if (self.filters[filter.type]) { + + column = self.table.columnManager.getColumnByField(filter.field); + + if (column) { + filterFunc = function filterFunc(data) { + return self.filters[filter.type](filter.value, column.getFieldValue(data), data, filter.params || {}); + }; + } else { + filterFunc = function filterFunc(data) { + return self.filters[filter.type](filter.value, data[filter.field], data, filter.params || {}); + }; + } + } else { + console.warn("Filter Error - No such filter type found, ignoring: ", filter.type); + } + } + + filter.func = filterFunc; + + return filter.func ? filter : false; +}; + +Filter.prototype.findSubFilters = function (filters) { + var self = this, + output = []; + + filters.forEach(function (filter) { + filter = self.findFilter(filter); + + if (filter) { + output.push(filter); + } + }); + + return output.length ? output : false; +}; + +//get all filters +Filter.prototype.getFilters = function (all, ajax) { + var output = []; + + if (all) { + output = this.getHeaderFilters(); + } + + if (ajax) { + output.forEach(function (item) { + if (typeof item.type == "function") { + item.type = "function"; + } + }); + } + + output = output.concat(this.filtersToArray(this.filterList, ajax)); + + return output; +}; + +//filter to Object +Filter.prototype.filtersToArray = function (filterList, ajax) { + var _this63 = this; + + var output = []; + + filterList.forEach(function (filter) { + var item; + + if (Array.isArray(filter)) { + output.push(_this63.filtersToArray(filter, ajax)); + } else { + item = { field: filter.field, type: filter.type, value: filter.value }; + + if (ajax) { + if (typeof item.type == "function") { + item.type = "function"; + } + } + + output.push(item); + } + }); + + return output; +}; + +//get all filters +Filter.prototype.getHeaderFilters = function () { + var self = this, + output = []; + + for (var key in this.headerFilters) { + output.push({ field: key, type: this.headerFilters[key].type, value: this.headerFilters[key].value }); + } + + return output; +}; + +//remove filter from array +Filter.prototype.removeFilter = function (field, type, value) { + var self = this; + + if (!Array.isArray(field)) { + field = [{ field: field, type: type, value: value }]; + } + + field.forEach(function (filter) { + var index = -1; + + if (_typeof(filter.field) == "object") { + index = self.filterList.findIndex(function (element) { + return filter === element; + }); + } else { + index = self.filterList.findIndex(function (element) { + return filter.field === element.field && filter.type === element.type && filter.value === element.value; + }); + } + + if (index > -1) { + self.filterList.splice(index, 1); + self.changed = true; + } else { + console.warn("Filter Error - No matching filter type found, ignoring: ", filter.type); + } + }); + + if (this.table.options.persistence && this.table.modExists("persistence", true) && this.table.modules.persistence.config.filter) { + this.table.modules.persistence.save("filter"); + } +}; + +//clear filters +Filter.prototype.clearFilter = function (all) { + this.filterList = []; + + if (all) { + this.clearHeaderFilter(); + } + + this.changed = true; + + if (this.table.options.persistence && this.table.modExists("persistence", true) && this.table.modules.persistence.config.filter) { + this.table.modules.persistence.save("filter"); + } +}; + +//clear header filters +Filter.prototype.clearHeaderFilter = function () { + var self = this; + + this.headerFilters = {}; + self.prevHeaderFilterChangeCheck = "{}"; + + this.headerFilterColumns.forEach(function (column) { + column.modules.filter.value = null; + column.modules.filter.prevSuccess = undefined; + self.reloadHeaderFilter(column); + }); + + this.changed = true; +}; + +//search data and return matching rows +Filter.prototype.search = function (searchType, field, type, value) { + var self = this, + activeRows = [], + filterList = []; + + if (!Array.isArray(field)) { + field = [{ field: field, type: type, value: value }]; + } + + field.forEach(function (filter) { + filter = self.findFilter(filter); + + if (filter) { + filterList.push(filter); + } + }); + + this.table.rowManager.rows.forEach(function (row) { + var match = true; + + filterList.forEach(function (filter) { + if (!self.filterRecurse(filter, row.getData())) { + match = false; + } + }); + + if (match) { + activeRows.push(searchType === "data" ? row.getData("data") : row.getComponent()); + } + }); + + return activeRows; +}; + +//filter row array +Filter.prototype.filter = function (rowList, filters) { + var self = this, + activeRows = [], + activeRowComponents = []; + + if (self.table.options.dataFiltering) { + self.table.options.dataFiltering.call(self.table, self.getFilters()); + } + + if (!self.table.options.ajaxFiltering && (self.filterList.length || Object.keys(self.headerFilters).length)) { + + rowList.forEach(function (row) { + if (self.filterRow(row)) { + activeRows.push(row); + } + }); + } else { + activeRows = rowList.slice(0); + } + + if (self.table.options.dataFiltered) { + + activeRows.forEach(function (row) { + activeRowComponents.push(row.getComponent()); + }); + + self.table.options.dataFiltered.call(self.table, self.getFilters(), activeRowComponents); + } + + return activeRows; +}; + +//filter individual row +Filter.prototype.filterRow = function (row, filters) { + var self = this, + match = true, + data = row.getData(); + + self.filterList.forEach(function (filter) { + if (!self.filterRecurse(filter, data)) { + match = false; + } + }); + + for (var field in self.headerFilters) { + if (!self.headerFilters[field].func(data)) { + match = false; + } + } + + return match; +}; + +Filter.prototype.filterRecurse = function (filter, data) { + var self = this, + match = false; + + if (Array.isArray(filter)) { + filter.forEach(function (subFilter) { + if (self.filterRecurse(subFilter, data)) { + match = true; + } + }); + } else { + match = filter.func(data); + } + + return match; +}; + +//list of available filters +Filter.prototype.filters = { + + //equal to + "=": function _(filterVal, rowVal, rowData, filterParams) { + return rowVal == filterVal ? true : false; + }, + + //less than + "<": function _(filterVal, rowVal, rowData, filterParams) { + return rowVal < filterVal ? true : false; + }, + + //less than or equal to + "<=": function _(filterVal, rowVal, rowData, filterParams) { + return rowVal <= filterVal ? true : false; + }, + + //greater than + ">": function _(filterVal, rowVal, rowData, filterParams) { + return rowVal > filterVal ? true : false; + }, + + //greater than or equal to + ">=": function _(filterVal, rowVal, rowData, filterParams) { + return rowVal >= filterVal ? true : false; + }, + + //not equal to + "!=": function _(filterVal, rowVal, rowData, filterParams) { + return rowVal != filterVal ? true : false; + }, + + "regex": function regex(filterVal, rowVal, rowData, filterParams) { + + if (typeof filterVal == "string") { + filterVal = new RegExp(filterVal); + } + + return filterVal.test(rowVal); + }, + + //contains the string + "like": function like(filterVal, rowVal, rowData, filterParams) { + if (filterVal === null || typeof filterVal === "undefined") { + return rowVal === filterVal ? true : false; + } else { + if (typeof rowVal !== 'undefined' && rowVal !== null) { + return String(rowVal).toLowerCase().indexOf(filterVal.toLowerCase()) > -1; + } else { + return false; + } + } + }, + + //contains the keywords + "keywords": function keywords(filterVal, rowVal, rowData, filterParams) { + var keywords = filterVal.toLowerCase().split(typeof filterParams.separator === "undefined" ? " " : filterParams.separator), + value = String(rowVal === null || typeof rowVal === "undefined" ? "" : rowVal).toLowerCase(), + matches = []; + + keywords.forEach(function (keyword) { + if (value.includes(keyword)) { + matches.push(true); + } + }); + + return filterParams.matchAll ? matches.length === keywords.length : !!matches.length; + }, + + //starts with the string + "starts": function starts(filterVal, rowVal, rowData, filterParams) { + if (filterVal === null || typeof filterVal === "undefined") { + return rowVal === filterVal ? true : false; + } else { + if (typeof rowVal !== 'undefined' && rowVal !== null) { + return String(rowVal).toLowerCase().startsWith(filterVal.toLowerCase()); + } else { + return false; + } + } + }, + + //ends with the string + "ends": function ends(filterVal, rowVal, rowData, filterParams) { + if (filterVal === null || typeof filterVal === "undefined") { + return rowVal === filterVal ? true : false; + } else { + if (typeof rowVal !== 'undefined' && rowVal !== null) { + return String(rowVal).toLowerCase().endsWith(filterVal.toLowerCase()); + } else { + return false; + } + } + }, + + //in array + "in": function _in(filterVal, rowVal, rowData, filterParams) { + if (Array.isArray(filterVal)) { + return filterVal.length ? filterVal.indexOf(rowVal) > -1 : true; + } else { + console.warn("Filter Error - filter value is not an array:", filterVal); + return false; + } + } +}; + +Tabulator.prototype.registerModule("filter", Filter); + +var Format = function Format(table) { + this.table = table; //hold Tabulator object +}; + +//initialize column formatter +Format.prototype.initializeColumn = function (column) { + column.modules.format = this.lookupFormatter(column, ""); + + if (typeof column.definition.formatterPrint !== "undefined") { + column.modules.format.print = this.lookupFormatter(column, "Print"); + } + + if (typeof column.definition.formatterClipboard !== "undefined") { + column.modules.format.clipboard = this.lookupFormatter(column, "Clipboard"); + } + + if (typeof column.definition.formatterHtmlOutput !== "undefined") { + column.modules.format.htmlOutput = this.lookupFormatter(column, "HtmlOutput"); + } +}; + +Format.prototype.lookupFormatter = function (column, type) { + var config = { params: column.definition["formatter" + type + "Params"] || {} }, + formatter = column.definition["formatter" + type]; + + //set column formatter + switch (typeof formatter === 'undefined' ? 'undefined' : _typeof(formatter)) { + case "string": + + if (formatter === "tick") { + formatter = "tickCross"; + + if (typeof config.params.crossElement == "undefined") { + config.params.crossElement = false; + } + + console.warn("DEPRECATION WARNING - the tick formatter has been deprecated, please use the tickCross formatter with the crossElement param set to false"); + } + + if (this.formatters[formatter]) { + config.formatter = this.formatters[formatter]; + } else { + console.warn("Formatter Error - No such formatter found: ", formatter); + config.formatter = this.formatters.plaintext; + } + break; + + case "function": + config.formatter = formatter; + break; + + default: + config.formatter = this.formatters.plaintext; + break; + } + + return config; +}; + +Format.prototype.cellRendered = function (cell) { + if (cell.modules.format && cell.modules.format.renderedCallback && !cell.modules.format.rendered) { + cell.modules.format.renderedCallback(); + cell.modules.format.rendered = true; + } +}; + +//return a formatted value for a cell +Format.prototype.formatValue = function (cell) { + var component = cell.getComponent(), + params = typeof cell.column.modules.format.params === "function" ? cell.column.modules.format.params(component) : cell.column.modules.format.params; + + function onRendered(callback) { + if (!cell.modules.format) { + cell.modules.format = {}; + } + + cell.modules.format.renderedCallback = callback; + cell.modules.format.rendered = false; + } + + return cell.column.modules.format.formatter.call(this, component, params, onRendered); +}; + +Format.prototype.formatExportValue = function (cell, type) { + var formatter = cell.column.modules.format[type], + params; + + if (formatter) { + var onRendered = function onRendered(callback) { + if (!cell.modules.format) { + cell.modules.format = {}; + } + + cell.modules.format.renderedCallback = callback; + cell.modules.format.rendered = false; + }; + + params = typeof formatter.params === "function" ? formatter.params(component) : formatter.params; + + return formatter.formatter.call(this, cell.getComponent(), params, onRendered); + } else { + return this.formatValue(cell); + } +}; + +Format.prototype.sanitizeHTML = function (value) { + if (value) { + var entityMap = { + '&': '&', + '<': '<', + '>': '>', + '"': '"', + "'": ''', + '/': '/', + '`': '`', + '=': '=' + }; + + return String(value).replace(/[&<>"'`=\/]/g, function (s) { + return entityMap[s]; + }); + } else { + return value; + } +}; + +Format.prototype.emptyToSpace = function (value) { + return value === null || typeof value === "undefined" || value === "" ? " " : value; +}; + +//get formatter for cell +Format.prototype.getFormatter = function (formatter) { + var formatter; + + switch (typeof formatter === 'undefined' ? 'undefined' : _typeof(formatter)) { + case "string": + if (this.formatters[formatter]) { + formatter = this.formatters[formatter]; + } else { + console.warn("Formatter Error - No such formatter found: ", formatter); + formatter = this.formatters.plaintext; + } + break; + + case "function": + formatter = formatter; + break; + + default: + formatter = this.formatters.plaintext; + break; + } + + return formatter; +}; + +//default data formatters +Format.prototype.formatters = { + //plain text value + plaintext: function plaintext(cell, formatterParams, onRendered) { + return this.emptyToSpace(this.sanitizeHTML(cell.getValue())); + }, + + //html text value + html: function html(cell, formatterParams, onRendered) { + return cell.getValue(); + }, + + //multiline text area + textarea: function textarea(cell, formatterParams, onRendered) { + cell.getElement().style.whiteSpace = "pre-wrap"; + return this.emptyToSpace(this.sanitizeHTML(cell.getValue())); + }, + + //currency formatting + money: function money(cell, formatterParams, onRendered) { + var floatVal = parseFloat(cell.getValue()), + number, + integer, + decimal, + rgx; + + var decimalSym = formatterParams.decimal || "."; + var thousandSym = formatterParams.thousand || ","; + var symbol = formatterParams.symbol || ""; + var after = !!formatterParams.symbolAfter; + var precision = typeof formatterParams.precision !== "undefined" ? formatterParams.precision : 2; + + if (isNaN(floatVal)) { + return this.emptyToSpace(this.sanitizeHTML(cell.getValue())); + } + + number = precision !== false ? floatVal.toFixed(precision) : floatVal; + number = String(number).split("."); + + integer = number[0]; + decimal = number.length > 1 ? decimalSym + number[1] : ""; + + rgx = /(\d+)(\d{3})/; + + while (rgx.test(integer)) { + integer = integer.replace(rgx, "$1" + thousandSym + "$2"); + } + + return after ? integer + decimal + symbol : symbol + integer + decimal; + }, + + //clickable anchor tag + link: function link(cell, formatterParams, onRendered) { + var value = cell.getValue(), + urlPrefix = formatterParams.urlPrefix || "", + download = formatterParams.download, + label = value, + el = document.createElement("a"), + data; + + if (formatterParams.labelField) { + data = cell.getData(); + label = data[formatterParams.labelField]; + } + + if (formatterParams.label) { + switch (_typeof(formatterParams.label)) { + case "string": + label = formatterParams.label; + break; + + case "function": + label = formatterParams.label(cell); + break; + } + } + + if (label) { + if (formatterParams.urlField) { + data = cell.getData(); + value = data[formatterParams.urlField]; + } + + if (formatterParams.url) { + switch (_typeof(formatterParams.url)) { + case "string": + value = formatterParams.url; + break; + + case "function": + value = formatterParams.url(cell); + break; + } + } + + el.setAttribute("href", urlPrefix + value); + + if (formatterParams.target) { + el.setAttribute("target", formatterParams.target); + } + + if (formatterParams.download) { + + if (typeof download == "function") { + download = download(cell); + } else { + download = download === true ? "" : download; + } + + el.setAttribute("download", download); + } + + el.innerHTML = this.emptyToSpace(this.sanitizeHTML(label)); + + return el; + } else { + return " "; + } + }, + + //image element + image: function image(cell, formatterParams, onRendered) { + var el = document.createElement("img"); + el.setAttribute("src", cell.getValue()); + + switch (_typeof(formatterParams.height)) { + case "number": + el.style.height = formatterParams.height + "px"; + break; + + case "string": + el.style.height = formatterParams.height; + break; + } + + switch (_typeof(formatterParams.width)) { + case "number": + el.style.width = formatterParams.width + "px"; + break; + + case "string": + el.style.width = formatterParams.width; + break; + } + + el.addEventListener("load", function () { + cell.getRow().normalizeHeight(); + }); + + return el; + }, + + //tick or cross + tickCross: function tickCross(cell, formatterParams, onRendered) { + var value = cell.getValue(), + element = cell.getElement(), + empty = formatterParams.allowEmpty, + truthy = formatterParams.allowTruthy, + tick = typeof formatterParams.tickElement !== "undefined" ? formatterParams.tickElement : '', + cross = typeof formatterParams.crossElement !== "undefined" ? formatterParams.crossElement : ''; + + if (truthy && value || value === true || value === "true" || value === "True" || value === 1 || value === "1") { + element.setAttribute("aria-checked", true); + return tick || ""; + } else { + if (empty && (value === "null" || value === "" || value === null || typeof value === "undefined")) { + element.setAttribute("aria-checked", "mixed"); + return ""; + } else { + element.setAttribute("aria-checked", false); + return cross || ""; + } + } + }, + + datetime: function datetime(cell, formatterParams, onRendered) { + var inputFormat = formatterParams.inputFormat || "YYYY-MM-DD hh:mm:ss"; + var outputFormat = formatterParams.outputFormat || "DD/MM/YYYY hh:mm:ss"; + var invalid = typeof formatterParams.invalidPlaceholder !== "undefined" ? formatterParams.invalidPlaceholder : ""; + var value = cell.getValue(); + + var newDatetime = moment(value, inputFormat); + + if (newDatetime.isValid()) { + return formatterParams.timezone ? newDatetime.tz(formatterParams.timezone).format(outputFormat) : newDatetime.format(outputFormat); + } else { + + if (invalid === true) { + return value; + } else if (typeof invalid === "function") { + return invalid(value); + } else { + return invalid; + } + } + }, + + datetimediff: function datetime(cell, formatterParams, onRendered) { + var inputFormat = formatterParams.inputFormat || "YYYY-MM-DD hh:mm:ss"; + var invalid = typeof formatterParams.invalidPlaceholder !== "undefined" ? formatterParams.invalidPlaceholder : ""; + var suffix = typeof formatterParams.suffix !== "undefined" ? formatterParams.suffix : false; + var unit = typeof formatterParams.unit !== "undefined" ? formatterParams.unit : undefined; + var humanize = typeof formatterParams.humanize !== "undefined" ? formatterParams.humanize : false; + var date = typeof formatterParams.date !== "undefined" ? formatterParams.date : moment(); + var value = cell.getValue(); + + var newDatetime = moment(value, inputFormat); + + if (newDatetime.isValid()) { + if (humanize) { + return moment.duration(newDatetime.diff(date)).humanize(suffix); + } else { + return newDatetime.diff(date, unit) + (suffix ? " " + suffix : ""); + } + } else { + + if (invalid === true) { + return value; + } else if (typeof invalid === "function") { + return invalid(value); + } else { + return invalid; + } + } + }, + + //select + lookup: function lookup(cell, formatterParams, onRendered) { + var value = cell.getValue(); + + if (typeof formatterParams[value] === "undefined") { + console.warn('Missing display value for ' + value); + return value; + } + + return formatterParams[value]; + }, + + //star rating + star: function star(cell, formatterParams, onRendered) { + var value = cell.getValue(), + element = cell.getElement(), + maxStars = formatterParams && formatterParams.stars ? formatterParams.stars : 5, + stars = document.createElement("span"), + star = document.createElementNS('http://www.w3.org/2000/svg', "svg"), + starActive = '', + starInactive = ''; + + //style stars holder + stars.style.verticalAlign = "middle"; + + //style star + star.setAttribute("width", "14"); + star.setAttribute("height", "14"); + star.setAttribute("viewBox", "0 0 512 512"); + star.setAttribute("xml:space", "preserve"); + star.style.padding = "0 1px"; + + value = value && !isNaN(value) ? parseInt(value) : 0; + + value = Math.max(0, Math.min(value, maxStars)); + + for (var i = 1; i <= maxStars; i++) { + var nextStar = star.cloneNode(true); + nextStar.innerHTML = i <= value ? starActive : starInactive; + + stars.appendChild(nextStar); + } + + element.style.whiteSpace = "nowrap"; + element.style.overflow = "hidden"; + element.style.textOverflow = "ellipsis"; + + element.setAttribute("aria-label", value); + + return stars; + }, + + traffic: function traffic(cell, formatterParams, onRendered) { + var value = this.sanitizeHTML(cell.getValue()) || 0, + el = document.createElement("span"), + max = formatterParams && formatterParams.max ? formatterParams.max : 100, + min = formatterParams && formatterParams.min ? formatterParams.min : 0, + colors = formatterParams && typeof formatterParams.color !== "undefined" ? formatterParams.color : ["red", "orange", "green"], + color = "#666666", + percent, + percentValue; + + if (isNaN(value) || typeof cell.getValue() === "undefined") { + return; + } + + el.classList.add("tabulator-traffic-light"); + + //make sure value is in range + percentValue = parseFloat(value) <= max ? parseFloat(value) : max; + percentValue = parseFloat(percentValue) >= min ? parseFloat(percentValue) : min; + + //workout percentage + percent = (max - min) / 100; + percentValue = Math.round((percentValue - min) / percent); + + //set color + switch (typeof colors === 'undefined' ? 'undefined' : _typeof(colors)) { + case "string": + color = colors; + break; + case "function": + color = colors(value); + break; + case "object": + if (Array.isArray(colors)) { + var unit = 100 / colors.length; + var index = Math.floor(percentValue / unit); + + index = Math.min(index, colors.length - 1); + index = Math.max(index, 0); + color = colors[index]; + break; + } + } + + el.style.backgroundColor = color; + + return el; + }, + + //progress bar + progress: function progress(cell, formatterParams, onRendered) { + //progress bar + var value = this.sanitizeHTML(cell.getValue()) || 0, + element = cell.getElement(), + max = formatterParams && formatterParams.max ? formatterParams.max : 100, + min = formatterParams && formatterParams.min ? formatterParams.min : 0, + legendAlign = formatterParams && formatterParams.legendAlign ? formatterParams.legendAlign : "center", + percent, + percentValue, + color, + legend, + legendColor, + top, + left, + right, + bottom; + + //make sure value is in range + percentValue = parseFloat(value) <= max ? parseFloat(value) : max; + percentValue = parseFloat(percentValue) >= min ? parseFloat(percentValue) : min; + + //workout percentage + percent = (max - min) / 100; + percentValue = Math.round((percentValue - min) / percent); + + //set bar color + switch (_typeof(formatterParams.color)) { + case "string": + color = formatterParams.color; + break; + case "function": + color = formatterParams.color(value); + break; + case "object": + if (Array.isArray(formatterParams.color)) { + var unit = 100 / formatterParams.color.length; + var index = Math.floor(percentValue / unit); + + index = Math.min(index, formatterParams.color.length - 1); + index = Math.max(index, 0); + color = formatterParams.color[index]; + break; + } + default: + color = "#2DC214"; + } + + //generate legend + switch (_typeof(formatterParams.legend)) { + case "string": + legend = formatterParams.legend; + break; + case "function": + legend = formatterParams.legend(value); + break; + case "boolean": + legend = value; + break; + default: + legend = false; + } + + //set legend color + switch (_typeof(formatterParams.legendColor)) { + case "string": + legendColor = formatterParams.legendColor; + break; + case "function": + legendColor = formatterParams.legendColor(value); + break; + case "object": + if (Array.isArray(formatterParams.legendColor)) { + var unit = 100 / formatterParams.legendColor.length; + var index = Math.floor(percentValue / unit); + + index = Math.min(index, formatterParams.legendColor.length - 1); + index = Math.max(index, 0); + legendColor = formatterParams.legendColor[index]; + } + break; + default: + legendColor = "#000"; + } + + element.style.minWidth = "30px"; + element.style.position = "relative"; + + element.setAttribute("aria-label", percentValue); + + var barEl = document.createElement("div"); + barEl.style.display = "inline-block"; + barEl.style.position = "relative"; + barEl.style.width = percentValue + "%"; + barEl.style.backgroundColor = color; + barEl.style.height = "100%"; + + barEl.setAttribute('data-max', max); + barEl.setAttribute('data-min', min); + + if (legend) { + var legendEl = document.createElement("div"); + legendEl.style.position = "absolute"; + legendEl.style.top = "4px"; + legendEl.style.left = 0; + legendEl.style.textAlign = legendAlign; + legendEl.style.width = "100%"; + legendEl.style.color = legendColor; + legendEl.innerHTML = legend; + } + + onRendered(function () { + + //handle custom element needed if formatter is to be included in printed/downloaded output + if (!(cell instanceof CellComponent)) { + var holderEl = document.createElement("div"); + holderEl.style.position = "absolute"; + holderEl.style.top = "4px"; + holderEl.style.bottom = "4px"; + holderEl.style.left = "4px"; + holderEl.style.right = "4px"; + + element.appendChild(holderEl); + + element = holderEl; + } + + element.appendChild(barEl); + + if (legend) { + element.appendChild(legendEl); + } + }); + + return ""; + }, + + //background color + color: function color(cell, formatterParams, onRendered) { + cell.getElement().style.backgroundColor = this.sanitizeHTML(cell.getValue()); + return ""; + }, + + //tick icon + buttonTick: function buttonTick(cell, formatterParams, onRendered) { + return ''; + }, + + //cross icon + buttonCross: function buttonCross(cell, formatterParams, onRendered) { + return ''; + }, + + //current row number + rownum: function rownum(cell, formatterParams, onRendered) { + return this.table.rowManager.activeRows.indexOf(cell.getRow()._getSelf()) + 1; + }, + + //row handle + handle: function handle(cell, formatterParams, onRendered) { + cell.getElement().classList.add("tabulator-row-handle"); + return "
"; + }, + + responsiveCollapse: function responsiveCollapse(cell, formatterParams, onRendered) { + var self = this, + open = false, + el = document.createElement("div"), + config = cell.getRow()._row.modules.responsiveLayout; + + el.classList.add("tabulator-responsive-collapse-toggle"); + el.innerHTML = "+-"; + + cell.getElement().classList.add("tabulator-row-handle"); + + function toggleList(isOpen) { + var collapseEl = config.element; + + config.open = isOpen; + + if (collapseEl) { + + if (config.open) { + el.classList.add("open"); + collapseEl.style.display = ''; + } else { + el.classList.remove("open"); + collapseEl.style.display = 'none'; + } + } + } + + el.addEventListener("click", function (e) { + e.stopImmediatePropagation(); + toggleList(!config.open); + }); + + toggleList(config.open); + + return el; + }, + + rowSelection: function rowSelection(cell, formatterParams, onRendered) { + var _this64 = this; + + var checkbox = document.createElement("input"); + + checkbox.type = 'checkbox'; + + if (this.table.modExists("selectRow", true)) { + + checkbox.addEventListener("click", function (e) { + e.stopPropagation(); + }); + + if (typeof cell.getRow == 'function') { + var row = cell.getRow(); + + if (row instanceof RowComponent) { + + checkbox.addEventListener("change", function (e) { + row.toggleSelect(); + }); + + checkbox.checked = row.isSelected && row.isSelected(); + this.table.modules.selectRow.registerRowSelectCheckbox(row, checkbox); + } else { + checkbox = ""; + } + } else { + checkbox.addEventListener("change", function (e) { + if (_this64.table.modules.selectRow.selectedRows.length) { + _this64.table.deselectRow(); + } else { + _this64.table.selectRow(formatterParams.rowRange); + } + }); + + this.table.modules.selectRow.registerHeaderSelectCheckbox(checkbox); + } + } + return checkbox; + } +}; + +Tabulator.prototype.registerModule("format", Format); + +var FrozenColumns = function FrozenColumns(table) { + this.table = table; //hold Tabulator object + this.leftColumns = []; + this.rightColumns = []; + this.leftMargin = 0; + this.rightMargin = 0; + this.rightPadding = 0; + this.initializationMode = "left"; + this.active = false; + this.scrollEndTimer = false; +}; + +//reset initial state +FrozenColumns.prototype.reset = function () { + this.initializationMode = "left"; + this.leftColumns = []; + this.rightColumns = []; + this.leftMargin = 0; + this.rightMargin = 0; + this.rightMargin = 0; + this.active = false; + + this.table.columnManager.headersElement.style.marginLeft = 0; + this.table.columnManager.element.style.paddingRight = 0; +}; + +//initialize specific column +FrozenColumns.prototype.initializeColumn = function (column) { + var config = { margin: 0, edge: false }; + + if (!column.isGroup) { + + if (this.frozenCheck(column)) { + + config.position = this.initializationMode; + + if (this.initializationMode == "left") { + this.leftColumns.push(column); + } else { + this.rightColumns.unshift(column); + } + + this.active = true; + + column.modules.frozen = config; + } else { + this.initializationMode = "right"; + } + } +}; + +FrozenColumns.prototype.frozenCheck = function (column) { + var frozen = false; + + if (column.parent.isGroup && column.definition.frozen) { + console.warn("Frozen Column Error - Parent column group must be frozen, not individual columns or sub column groups"); + } + + if (column.parent.isGroup) { + return this.frozenCheck(column.parent); + } else { + return column.definition.frozen; + } + + return frozen; +}; + +//quick layout to smooth horizontal scrolling +FrozenColumns.prototype.scrollHorizontal = function () { + var _this65 = this; + + var rows; + + if (this.active) { + clearTimeout(this.scrollEndTimer); + + //layout all rows after scroll is complete + this.scrollEndTimer = setTimeout(function () { + _this65.layout(); + }, 100); + + rows = this.table.rowManager.getVisibleRows(); + + this.calcMargins(); + + this.layoutColumnPosition(); + + this.layoutCalcRows(); + + rows.forEach(function (row) { + if (row.type === "row") { + _this65.layoutRow(row); + } + }); + + this.table.rowManager.tableElement.style.marginRight = this.rightMargin; + } +}; + +//calculate margins for rows +FrozenColumns.prototype.calcMargins = function () { + this.leftMargin = this._calcSpace(this.leftColumns, this.leftColumns.length) + "px"; + this.table.columnManager.headersElement.style.marginLeft = this.leftMargin; + + this.rightMargin = this._calcSpace(this.rightColumns, this.rightColumns.length) + "px"; + this.table.columnManager.element.style.paddingRight = this.rightMargin; + + //calculate right frozen columns + this.rightPadding = this.table.rowManager.element.clientWidth + this.table.columnManager.scrollLeft; +}; + +//layout calculation rows +FrozenColumns.prototype.layoutCalcRows = function () { + if (this.table.modExists("columnCalcs")) { + if (this.table.modules.columnCalcs.topInitialized && this.table.modules.columnCalcs.topRow) { + this.layoutRow(this.table.modules.columnCalcs.topRow); + } + if (this.table.modules.columnCalcs.botInitialized && this.table.modules.columnCalcs.botRow) { + this.layoutRow(this.table.modules.columnCalcs.botRow); + } + } +}; + +//calculate column positions and layout headers +FrozenColumns.prototype.layoutColumnPosition = function (allCells) { + var _this66 = this; + + var leftParents = []; + + this.leftColumns.forEach(function (column, i) { + column.modules.frozen.margin = _this66._calcSpace(_this66.leftColumns, i) + _this66.table.columnManager.scrollLeft + "px"; + + if (i == _this66.leftColumns.length - 1) { + column.modules.frozen.edge = true; + } else { + column.modules.frozen.edge = false; + } + + if (column.parent.isGroup) { + var parentEl = _this66.getColGroupParentElement(column); + if (!leftParents.includes(parentEl)) { + _this66.layoutElement(parentEl, column); + leftParents.push(parentEl); + } + + if (column.modules.frozen.edge) { + parentEl.classList.add("tabulator-frozen-" + column.modules.frozen.position); + } + } else { + _this66.layoutElement(column.getElement(), column); + } + + if (allCells) { + column.cells.forEach(function (cell) { + _this66.layoutElement(cell.getElement(), column); + }); + } + }); + + this.rightColumns.forEach(function (column, i) { + column.modules.frozen.margin = _this66.rightPadding - _this66._calcSpace(_this66.rightColumns, i + 1) + "px"; + + if (i == _this66.rightColumns.length - 1) { + column.modules.frozen.edge = true; + } else { + column.modules.frozen.edge = false; + } + + if (column.parent.isGroup) { + _this66.layoutElement(_this66.getColGroupParentElement(column), column); + } else { + _this66.layoutElement(column.getElement(), column); + } + + if (allCells) { + column.cells.forEach(function (cell) { + _this66.layoutElement(cell.getElement(), column); + }); + } + }); +}; + +FrozenColumns.prototype.getColGroupParentElement = function (column) { + return column.parent.isGroup ? this.getColGroupParentElement(column.parent) : column.getElement(); +}; + +//layout columns appropropriatly +FrozenColumns.prototype.layout = function () { + var self = this, + rightMargin = 0; + + if (self.active) { + + //calculate row padding + this.calcMargins(); + + // self.table.rowManager.activeRows.forEach(function(row){ + // self.layoutRow(row); + // }); + + // if(self.table.options.dataTree){ + self.table.rowManager.getDisplayRows().forEach(function (row) { + if (row.type === "row") { + self.layoutRow(row); + } + }); + // } + + this.layoutCalcRows(); + + //calculate left columns + this.layoutColumnPosition(true); + + // if(tableHolder.scrollHeight > tableHolder.clientHeight){ + // rightMargin -= tableHolder.offsetWidth - tableHolder.clientWidth; + // } + + this.table.rowManager.tableElement.style.marginRight = this.rightMargin; + } +}; + +FrozenColumns.prototype.layoutRow = function (row) { + var _this67 = this; + + var rowEl = row.getElement(); + + rowEl.style.paddingLeft = this.leftMargin; + // rowEl.style.paddingRight = this.rightMargin + "px"; + + this.leftColumns.forEach(function (column) { + var cell = row.getCell(column); + + if (cell) { + _this67.layoutElement(cell.getElement(), column); + } + }); + + this.rightColumns.forEach(function (column) { + var cell = row.getCell(column); + + if (cell) { + _this67.layoutElement(cell.getElement(), column); + } + }); +}; + +FrozenColumns.prototype.layoutElement = function (element, column) { + + if (column.modules.frozen) { + element.style.position = "absolute"; + element.style.left = column.modules.frozen.margin; + + element.classList.add("tabulator-frozen"); + + if (column.modules.frozen.edge) { + element.classList.add("tabulator-frozen-" + column.modules.frozen.position); + } + } +}; + +FrozenColumns.prototype._calcSpace = function (columns, index) { + var width = 0; + + for (var _i12 = 0; _i12 < index; _i12++) { + if (columns[_i12].visible) { + width += columns[_i12].getWidth(); + } + } + + return width; +}; + +Tabulator.prototype.registerModule("frozenColumns", FrozenColumns); +var FrozenRows = function FrozenRows(table) { + this.table = table; //hold Tabulator object + this.topElement = document.createElement("div"); + this.rows = []; + this.displayIndex = 0; //index in display pipeline +}; + +FrozenRows.prototype.initialize = function () { + this.rows = []; + + this.topElement.classList.add("tabulator-frozen-rows-holder"); + + // this.table.columnManager.element.append(this.topElement); + this.table.columnManager.getElement().insertBefore(this.topElement, this.table.columnManager.headersElement.nextSibling); +}; + +FrozenRows.prototype.setDisplayIndex = function (index) { + this.displayIndex = index; +}; + +FrozenRows.prototype.getDisplayIndex = function () { + return this.displayIndex; +}; + +FrozenRows.prototype.isFrozen = function () { + return !!this.rows.length; +}; + +//filter frozen rows out of display data +FrozenRows.prototype.getRows = function (rows) { + var self = this, + frozen = [], + output = rows.slice(0); + + this.rows.forEach(function (row) { + var index = output.indexOf(row); + + if (index > -1) { + output.splice(index, 1); + } + }); + + return output; +}; + +FrozenRows.prototype.freezeRow = function (row) { + if (!row.modules.frozen) { + row.modules.frozen = true; + this.topElement.appendChild(row.getElement()); + row.initialize(); + row.normalizeHeight(); + this.table.rowManager.adjustTableSize(); + + this.rows.push(row); + + this.table.rowManager.refreshActiveData("display"); + + this.styleRows(); + } else { + console.warn("Freeze Error - Row is already frozen"); + } +}; + +FrozenRows.prototype.unfreezeRow = function (row) { + var index = this.rows.indexOf(row); + + if (row.modules.frozen) { + + row.modules.frozen = false; + + this.detachRow(row); + + this.table.rowManager.adjustTableSize(); + + this.table.rowManager.refreshActiveData("display"); + + if (this.rows.length) { + this.styleRows(); + } + } else { + console.warn("Freeze Error - Row is already unfrozen"); + } +}; + +FrozenRows.prototype.detachRow = function (row) { + var index = this.rows.indexOf(row); + + if (index > -1) { + var rowEl = row.getElement(); + rowEl.parentNode.removeChild(rowEl); + + this.rows.splice(index, 1); + } +}; + +FrozenRows.prototype.styleRows = function (row) { + var self = this; + + this.rows.forEach(function (row, i) { + self.table.rowManager.styleRow(row, i); + }); +}; + +Tabulator.prototype.registerModule("frozenRows", FrozenRows); + +//public group object +var GroupComponent = function GroupComponent(group) { + this._group = group; + this.type = "GroupComponent"; +}; + +GroupComponent.prototype.getKey = function () { + return this._group.key; +}; + +GroupComponent.prototype.getField = function () { + return this._group.field; +}; + +GroupComponent.prototype.getElement = function () { + return this._group.element; +}; + +GroupComponent.prototype.getRows = function () { + return this._group.getRows(true); +}; + +GroupComponent.prototype.getSubGroups = function () { + return this._group.getSubGroups(true); +}; + +GroupComponent.prototype.getParentGroup = function () { + return this._group.parent ? this._group.parent.getComponent() : false; +}; + +GroupComponent.prototype.getVisibility = function () { + console.warn("getVisibility function is deprecated, you should now use the isVisible function"); + return this._group.visible; +}; + +GroupComponent.prototype.isVisible = function () { + return this._group.visible; +}; + +GroupComponent.prototype.show = function () { + this._group.show(); +}; + +GroupComponent.prototype.hide = function () { + this._group.hide(); +}; + +GroupComponent.prototype.toggle = function () { + this._group.toggleVisibility(); +}; + +GroupComponent.prototype._getSelf = function () { + return this._group; +}; + +GroupComponent.prototype.getTable = function () { + return this._group.groupManager.table; +}; + +////////////////////////////////////////////////// +//////////////// Group Functions ///////////////// +////////////////////////////////////////////////// + +var Group = function Group(groupManager, parent, level, key, field, generator, oldGroup) { + + this.groupManager = groupManager; + this.parent = parent; + this.key = key; + this.level = level; + this.field = field; + this.hasSubGroups = level < groupManager.groupIDLookups.length - 1; + this.addRow = this.hasSubGroups ? this._addRowToGroup : this._addRow; + this.type = "group"; //type of element + this.old = oldGroup; + this.rows = []; + this.groups = []; + this.groupList = []; + this.generator = generator; + this.elementContents = false; + this.height = 0; + this.outerHeight = 0; + this.initialized = false; + this.calcs = {}; + this.initialized = false; + this.modules = {}; + this.arrowElement = false; + + this.visible = oldGroup ? oldGroup.visible : typeof groupManager.startOpen[level] !== "undefined" ? groupManager.startOpen[level] : groupManager.startOpen[0]; + + this.component = null; + + this.createElements(); + this.addBindings(); + + this.createValueGroups(); +}; + +Group.prototype.wipe = function () { + if (this.groupList.length) { + this.groupList.forEach(function (group) { + group.wipe(); + }); + } else { + this.element = false; + this.arrowElement = false; + this.elementContents = false; + } +}; + +Group.prototype.createElements = function () { + var arrow = document.createElement("div"); + arrow.classList.add("tabulator-arrow"); + + this.element = document.createElement("div"); + this.element.classList.add("tabulator-row"); + this.element.classList.add("tabulator-group"); + this.element.classList.add("tabulator-group-level-" + this.level); + this.element.setAttribute("role", "rowgroup"); + + this.arrowElement = document.createElement("div"); + this.arrowElement.classList.add("tabulator-group-toggle"); + this.arrowElement.appendChild(arrow); + + //setup movable rows + if (this.groupManager.table.options.movableRows !== false && this.groupManager.table.modExists("moveRow")) { + this.groupManager.table.modules.moveRow.initializeGroupHeader(this); + } +}; + +Group.prototype.createValueGroups = function () { + var _this68 = this; + + var level = this.level + 1; + if (this.groupManager.allowedValues && this.groupManager.allowedValues[level]) { + this.groupManager.allowedValues[level].forEach(function (value) { + _this68._createGroup(value, level); + }); + } +}; + +Group.prototype.addBindings = function () { + var self = this, + dblTap, + tapHold, + tap, + toggleElement; + + //handle group click events + if (self.groupManager.table.options.groupClick) { + self.element.addEventListener("click", function (e) { + self.groupManager.table.options.groupClick.call(self.groupManager.table, e, self.getComponent()); + }); + } + + if (self.groupManager.table.options.groupDblClick) { + self.element.addEventListener("dblclick", function (e) { + self.groupManager.table.options.groupDblClick.call(self.groupManager.table, e, self.getComponent()); + }); + } + + if (self.groupManager.table.options.groupContext) { + self.element.addEventListener("contextmenu", function (e) { + self.groupManager.table.options.groupContext.call(self.groupManager.table, e, self.getComponent()); + }); + } + + if ((self.groupManager.table.options.groupContextMenu || self.groupManager.table.options.groupClickMenu) && self.groupManager.table.modExists("menu")) { + self.groupManager.table.modules.menu.initializeGroup.call(self.groupManager.table.modules.menu, self); + } + + if (self.groupManager.table.options.groupTap) { + + tap = false; + + self.element.addEventListener("touchstart", function (e) { + tap = true; + }, { passive: true }); + + self.element.addEventListener("touchend", function (e) { + if (tap) { + self.groupManager.table.options.groupTap(e, self.getComponent()); + } + + tap = false; + }); + } + + if (self.groupManager.table.options.groupDblTap) { + + dblTap = null; + + self.element.addEventListener("touchend", function (e) { + + if (dblTap) { + clearTimeout(dblTap); + dblTap = null; + + self.groupManager.table.options.groupDblTap(e, self.getComponent()); + } else { + + dblTap = setTimeout(function () { + clearTimeout(dblTap); + dblTap = null; + }, 300); + } + }); + } + + if (self.groupManager.table.options.groupTapHold) { + + tapHold = null; + + self.element.addEventListener("touchstart", function (e) { + clearTimeout(tapHold); + + tapHold = setTimeout(function () { + clearTimeout(tapHold); + tapHold = null; + tap = false; + self.groupManager.table.options.groupTapHold(e, self.getComponent()); + }, 1000); + }, { passive: true }); + + self.element.addEventListener("touchend", function (e) { + clearTimeout(tapHold); + tapHold = null; + }); + } + + if (self.groupManager.table.options.groupToggleElement) { + toggleElement = self.groupManager.table.options.groupToggleElement == "arrow" ? self.arrowElement : self.element; + + toggleElement.addEventListener("click", function (e) { + e.stopPropagation(); + e.stopImmediatePropagation(); + self.toggleVisibility(); + }); + } +}; + +Group.prototype._createGroup = function (groupID, level) { + var groupKey = level + "_" + groupID; + var group = new Group(this.groupManager, this, level, groupID, this.groupManager.groupIDLookups[level].field, this.groupManager.headerGenerator[level] || this.groupManager.headerGenerator[0], this.old ? this.old.groups[groupKey] : false); + + this.groups[groupKey] = group; + this.groupList.push(group); +}; + +Group.prototype._addRowToGroup = function (row) { + + var level = this.level + 1; + + if (this.hasSubGroups) { + var groupID = this.groupManager.groupIDLookups[level].func(row.getData()), + groupKey = level + "_" + groupID; + + if (this.groupManager.allowedValues && this.groupManager.allowedValues[level]) { + if (this.groups[groupKey]) { + this.groups[groupKey].addRow(row); + } + } else { + if (!this.groups[groupKey]) { + this._createGroup(groupID, level); + } + + this.groups[groupKey].addRow(row); + } + } +}; + +Group.prototype._addRow = function (row) { + this.rows.push(row); + row.modules.group = this; +}; + +Group.prototype.insertRow = function (row, to, after) { + var data = this.conformRowData({}); + + row.updateData(data); + + var toIndex = this.rows.indexOf(to); + + if (toIndex > -1) { + if (after) { + this.rows.splice(toIndex + 1, 0, row); + } else { + this.rows.splice(toIndex, 0, row); + } + } else { + if (after) { + this.rows.push(row); + } else { + this.rows.unshift(row); + } + } + + row.modules.group = this; + + this.generateGroupHeaderContents(); + + if (this.groupManager.table.modExists("columnCalcs") && this.groupManager.table.options.columnCalcs != "table") { + this.groupManager.table.modules.columnCalcs.recalcGroup(this); + } + + this.groupManager.updateGroupRows(true); +}; + +Group.prototype.scrollHeader = function (left) { + this.arrowElement.style.marginLeft = left; + + this.groupList.forEach(function (child) { + child.scrollHeader(left); + }); +}; + +Group.prototype.getRowIndex = function (row) {}; + +//update row data to match grouping contraints +Group.prototype.conformRowData = function (data) { + if (this.field) { + data[this.field] = this.key; + } else { + console.warn("Data Conforming Error - Cannot conform row data to match new group as groupBy is a function"); + } + + if (this.parent) { + data = this.parent.conformRowData(data); + } + + return data; +}; + +Group.prototype.removeRow = function (row) { + var index = this.rows.indexOf(row); + var el = row.getElement(); + + if (index > -1) { + this.rows.splice(index, 1); + } + + if (!this.groupManager.table.options.groupValues && !this.rows.length) { + if (this.parent) { + this.parent.removeGroup(this); + } else { + this.groupManager.removeGroup(this); + } + + this.groupManager.updateGroupRows(true); + } else { + + if (el.parentNode) { + el.parentNode.removeChild(el); + } + + this.generateGroupHeaderContents(); + + if (this.groupManager.table.modExists("columnCalcs") && this.groupManager.table.options.columnCalcs != "table") { + this.groupManager.table.modules.columnCalcs.recalcGroup(this); + } + } +}; + +Group.prototype.removeGroup = function (group) { + var groupKey = group.level + "_" + group.key, + index; + + if (this.groups[groupKey]) { + delete this.groups[groupKey]; + + index = this.groupList.indexOf(group); + + if (index > -1) { + this.groupList.splice(index, 1); + } + + if (!this.groupList.length) { + if (this.parent) { + this.parent.removeGroup(this); + } else { + this.groupManager.removeGroup(this); + } + } + } +}; + +Group.prototype.getHeadersAndRows = function (noCalc) { + var output = []; + + output.push(this); + + this._visSet(); + + if (this.visible) { + if (this.groupList.length) { + this.groupList.forEach(function (group) { + output = output.concat(group.getHeadersAndRows(noCalc)); + }); + } else { + if (!noCalc && this.groupManager.table.options.columnCalcs != "table" && this.groupManager.table.modExists("columnCalcs") && this.groupManager.table.modules.columnCalcs.hasTopCalcs()) { + if (this.calcs.top) { + this.calcs.top.detachElement(); + this.calcs.top.deleteCells(); + } + + this.calcs.top = this.groupManager.table.modules.columnCalcs.generateTopRow(this.rows); + output.push(this.calcs.top); + } + + output = output.concat(this.rows); + + if (!noCalc && this.groupManager.table.options.columnCalcs != "table" && this.groupManager.table.modExists("columnCalcs") && this.groupManager.table.modules.columnCalcs.hasBottomCalcs()) { + if (this.calcs.bottom) { + this.calcs.bottom.detachElement(); + this.calcs.bottom.deleteCells(); + } + + this.calcs.bottom = this.groupManager.table.modules.columnCalcs.generateBottomRow(this.rows); + output.push(this.calcs.bottom); + } + } + } else { + if (!this.groupList.length && this.groupManager.table.options.columnCalcs != "table") { + + if (this.groupManager.table.modExists("columnCalcs")) { + + if (!noCalc && this.groupManager.table.modules.columnCalcs.hasTopCalcs()) { + if (this.calcs.top) { + this.calcs.top.detachElement(); + this.calcs.top.deleteCells(); + } + + if (this.groupManager.table.options.groupClosedShowCalcs) { + this.calcs.top = this.groupManager.table.modules.columnCalcs.generateTopRow(this.rows); + output.push(this.calcs.top); + } + } + + if (!noCalc && this.groupManager.table.modules.columnCalcs.hasBottomCalcs()) { + if (this.calcs.bottom) { + this.calcs.bottom.detachElement(); + this.calcs.bottom.deleteCells(); + } + + if (this.groupManager.table.options.groupClosedShowCalcs) { + this.calcs.bottom = this.groupManager.table.modules.columnCalcs.generateBottomRow(this.rows); + output.push(this.calcs.bottom); + } + } + } + } + } + + return output; +}; + +Group.prototype.getData = function (visible, transform) { + var self = this, + output = []; + + this._visSet(); + + if (!visible || visible && this.visible) { + this.rows.forEach(function (row) { + output.push(row.getData(transform || "data")); + }); + } + + return output; +}; + +// Group.prototype.getRows = function(){ +// this._visSet(); + +// return this.visible ? this.rows : []; +// }; + +Group.prototype.getRowCount = function () { + var count = 0; + + if (this.groupList.length) { + this.groupList.forEach(function (group) { + count += group.getRowCount(); + }); + } else { + count = this.rows.length; + } + return count; +}; + +Group.prototype.toggleVisibility = function () { + if (this.visible) { + this.hide(); + } else { + this.show(); + } +}; + +Group.prototype.hide = function () { + this.visible = false; + + if (this.groupManager.table.rowManager.getRenderMode() == "classic" && !this.groupManager.table.options.pagination) { + + this.element.classList.remove("tabulator-group-visible"); + + if (this.groupList.length) { + this.groupList.forEach(function (group) { + + var rows = group.getHeadersAndRows(); + + rows.forEach(function (row) { + row.detachElement(); + }); + }); + } else { + this.rows.forEach(function (row) { + var rowEl = row.getElement(); + rowEl.parentNode.removeChild(rowEl); + }); + } + + this.groupManager.table.rowManager.setDisplayRows(this.groupManager.updateGroupRows(), this.groupManager.getDisplayIndex()); + + this.groupManager.table.rowManager.checkClassicModeGroupHeaderWidth(); + } else { + this.groupManager.updateGroupRows(true); + } + + this.groupManager.table.options.groupVisibilityChanged.call(this.table, this.getComponent(), false); +}; + +Group.prototype.show = function () { + var self = this; + + self.visible = true; + + if (this.groupManager.table.rowManager.getRenderMode() == "classic" && !this.groupManager.table.options.pagination) { + + this.element.classList.add("tabulator-group-visible"); + + var prev = self.getElement(); + + if (this.groupList.length) { + this.groupList.forEach(function (group) { + var rows = group.getHeadersAndRows(); + + rows.forEach(function (row) { + var rowEl = row.getElement(); + prev.parentNode.insertBefore(rowEl, prev.nextSibling); + row.initialize(); + prev = rowEl; + }); + }); + } else { + self.rows.forEach(function (row) { + var rowEl = row.getElement(); + prev.parentNode.insertBefore(rowEl, prev.nextSibling); + row.initialize(); + prev = rowEl; + }); + } + + this.groupManager.table.rowManager.setDisplayRows(this.groupManager.updateGroupRows(), this.groupManager.getDisplayIndex()); + + this.groupManager.table.rowManager.checkClassicModeGroupHeaderWidth(); + } else { + this.groupManager.updateGroupRows(true); + } + + this.groupManager.table.options.groupVisibilityChanged.call(this.table, this.getComponent(), true); +}; + +Group.prototype._visSet = function () { + var data = []; + + if (typeof this.visible == "function") { + + this.rows.forEach(function (row) { + data.push(row.getData()); + }); + + this.visible = this.visible(this.key, this.getRowCount(), data, this.getComponent()); + } +}; + +Group.prototype.getRowGroup = function (row) { + var match = false; + if (this.groupList.length) { + this.groupList.forEach(function (group) { + var result = group.getRowGroup(row); + + if (result) { + match = result; + } + }); + } else { + if (this.rows.find(function (item) { + return item === row; + })) { + match = this; + } + } + + return match; +}; + +Group.prototype.getSubGroups = function (component) { + var output = []; + + this.groupList.forEach(function (child) { + output.push(component ? child.getComponent() : child); + }); + + return output; +}; + +Group.prototype.getRows = function (compoment) { + var output = []; + + this.rows.forEach(function (row) { + output.push(compoment ? row.getComponent() : row); + }); + + return output; +}; + +Group.prototype.generateGroupHeaderContents = function () { + var data = []; + + this.rows.forEach(function (row) { + data.push(row.getData()); + }); + + this.elementContents = this.generator(this.key, this.getRowCount(), data, this.getComponent()); + + while (this.element.firstChild) { + this.element.removeChild(this.element.firstChild); + }if (typeof this.elementContents === "string") { + this.element.innerHTML = this.elementContents; + } else { + this.element.appendChild(this.elementContents); + } + + this.element.insertBefore(this.arrowElement, this.element.firstChild); +}; + +Group.prototype.getPath = function () { + var path = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : []; + + path.unshift(this.key); + if (this.parent) { + this.parent.getPath(path); + } + return path; +}; +////////////// Standard Row Functions ////////////// + +Group.prototype.getElement = function () { + this.addBindingsd = false; + + this._visSet(); + + if (this.visible) { + this.element.classList.add("tabulator-group-visible"); + } else { + this.element.classList.remove("tabulator-group-visible"); + } + + for (var i = 0; i < this.element.childNodes.length; ++i) { + this.element.childNodes[i].parentNode.removeChild(this.element.childNodes[i]); + } + + this.generateGroupHeaderContents(); + + // this.addBindings(); + + return this.element; +}; + +Group.prototype.detachElement = function () { + if (this.element && this.element.parentNode) { + this.element.parentNode.removeChild(this.element); + } +}; + +//normalize the height of elements in the row +Group.prototype.normalizeHeight = function () { + this.setHeight(this.element.clientHeight); +}; + +Group.prototype.initialize = function (force) { + if (!this.initialized || force) { + this.normalizeHeight(); + this.initialized = true; + } +}; + +Group.prototype.reinitialize = function () { + this.initialized = false; + this.height = 0; + + if (Tabulator.prototype.helpers.elVisible(this.element)) { + this.initialize(true); + } +}; + +Group.prototype.setHeight = function (height) { + if (this.height != height) { + this.height = height; + this.outerHeight = this.element.offsetHeight; + } +}; + +//return rows outer height +Group.prototype.getHeight = function () { + return this.outerHeight; +}; + +Group.prototype.getGroup = function () { + return this; +}; + +Group.prototype.reinitializeHeight = function () {}; +Group.prototype.calcHeight = function () {}; +Group.prototype.setCellHeight = function () {}; +Group.prototype.clearCellHeight = function () {}; + +//////////////// Object Generation ///////////////// +Group.prototype.getComponent = function () { + if (!this.component) { + this.component = new GroupComponent(this); + } + + return this.component; +}; + +////////////////////////////////////////////////// +////////////// Group Row Extension /////////////// +////////////////////////////////////////////////// + +var GroupRows = function GroupRows(table) { + + this.table = table; //hold Tabulator object + + this.groupIDLookups = false; //enable table grouping and set field to group by + this.startOpen = [function () { + return false; + }]; //starting state of group + this.headerGenerator = [function () { + return ""; + }]; + this.groupList = []; //ordered list of groups + this.allowedValues = false; + this.groups = {}; //hold row groups + this.displayIndex = 0; //index in display pipeline +}; + +//initialize group configuration +GroupRows.prototype.initialize = function () { + var self = this, + groupBy = self.table.options.groupBy, + startOpen = self.table.options.groupStartOpen, + groupHeader = self.table.options.groupHeader; + + this.allowedValues = self.table.options.groupValues; + + if (Array.isArray(groupBy) && Array.isArray(groupHeader) && groupBy.length > groupHeader.length) { + console.warn("Error creating group headers, groupHeader array is shorter than groupBy array"); + } + + self.headerGenerator = [function () { + return ""; + }]; + this.startOpen = [function () { + return false; + }]; //starting state of group + + self.table.modules.localize.bind("groups|item", function (langValue, lang) { + self.headerGenerator[0] = function (value, count, data) { + //header layout function + return (typeof value === "undefined" ? "" : value) + "(" + count + " " + (count === 1 ? langValue : lang.groups.items) + ")"; + }; + }); + + this.groupIDLookups = []; + + if (Array.isArray(groupBy) || groupBy) { + if (this.table.modExists("columnCalcs") && this.table.options.columnCalcs != "table" && this.table.options.columnCalcs != "both") { + this.table.modules.columnCalcs.removeCalcs(); + } + } else { + if (this.table.modExists("columnCalcs") && this.table.options.columnCalcs != "group") { + + var cols = this.table.columnManager.getRealColumns(); + + cols.forEach(function (col) { + if (col.definition.topCalc) { + self.table.modules.columnCalcs.initializeTopRow(); + } + + if (col.definition.bottomCalc) { + self.table.modules.columnCalcs.initializeBottomRow(); + } + }); + } + } + + if (!Array.isArray(groupBy)) { + groupBy = [groupBy]; + } + + groupBy.forEach(function (group, i) { + var lookupFunc, column; + + if (typeof group == "function") { + lookupFunc = group; + } else { + column = self.table.columnManager.getColumnByField(group); + + if (column) { + lookupFunc = function lookupFunc(data) { + return column.getFieldValue(data); + }; + } else { + lookupFunc = function lookupFunc(data) { + return data[group]; + }; + } + } + + self.groupIDLookups.push({ + field: typeof group === "function" ? false : group, + func: lookupFunc, + values: self.allowedValues ? self.allowedValues[i] : false + }); + }); + + if (startOpen) { + + if (!Array.isArray(startOpen)) { + startOpen = [startOpen]; + } + + startOpen.forEach(function (level) { + level = typeof level == "function" ? level : function () { + return true; + }; + }); + + self.startOpen = startOpen; + } + + if (groupHeader) { + self.headerGenerator = Array.isArray(groupHeader) ? groupHeader : [groupHeader]; + } + + this.initialized = true; +}; + +GroupRows.prototype.setDisplayIndex = function (index) { + this.displayIndex = index; +}; + +GroupRows.prototype.getDisplayIndex = function () { + return this.displayIndex; +}; + +//return appropriate rows with group headers +GroupRows.prototype.getRows = function (rows) { + if (this.groupIDLookups.length) { + + this.table.options.dataGrouping.call(this.table); + + this.generateGroups(rows); + + if (this.table.options.dataGrouped) { + this.table.options.dataGrouped.call(this.table, this.getGroups(true)); + } + + return this.updateGroupRows(); + } else { + return rows.slice(0); + } +}; + +GroupRows.prototype.getGroups = function (compoment) { + var groupComponents = []; + + this.groupList.forEach(function (group) { + groupComponents.push(compoment ? group.getComponent() : group); + }); + + return groupComponents; +}; + +GroupRows.prototype.getChildGroups = function (group) { + var _this69 = this; + + var groupComponents = []; + + if (!group) { + group = this; + } + + group.groupList.forEach(function (child) { + if (child.groupList.length) { + groupComponents = groupComponents.concat(_this69.getChildGroups(child)); + } else { + groupComponents.push(child); + } + }); + + return groupComponents; +}; + +GroupRows.prototype.wipe = function () { + this.groupList.forEach(function (group) { + group.wipe(); + }); +}; + +GroupRows.prototype.pullGroupListData = function (groupList) { + var self = this; + var groupListData = []; + + groupList.forEach(function (group) { + var groupHeader = {}; + groupHeader.level = 0; + groupHeader.rowCount = 0; + groupHeader.headerContent = ""; + var childData = []; + + if (group.hasSubGroups) { + childData = self.pullGroupListData(group.groupList); + + groupHeader.level = group.level; + groupHeader.rowCount = childData.length - group.groupList.length; // data length minus number of sub-headers + groupHeader.headerContent = group.generator(group.key, groupHeader.rowCount, group.rows, group); + + groupListData.push(groupHeader); + groupListData = groupListData.concat(childData); + } else { + groupHeader.level = group.level; + groupHeader.headerContent = group.generator(group.key, group.rows.length, group.rows, group); + groupHeader.rowCount = group.getRows().length; + + groupListData.push(groupHeader); + + group.getRows().forEach(function (row) { + groupListData.push(row.getData("data")); + }); + } + }); + + return groupListData; +}; + +GroupRows.prototype.getGroupedData = function () { + + return this.pullGroupListData(this.groupList); +}; + +GroupRows.prototype.getRowGroup = function (row) { + var match = false; + + this.groupList.forEach(function (group) { + var result = group.getRowGroup(row); + + if (result) { + match = result; + } + }); + + return match; +}; + +GroupRows.prototype.countGroups = function () { + return this.groupList.length; +}; + +GroupRows.prototype.generateGroups = function (rows) { + var self = this, + oldGroups = self.groups; + + self.groups = {}; + self.groupList = []; + + if (this.allowedValues && this.allowedValues[0]) { + this.allowedValues[0].forEach(function (value) { + self.createGroup(value, 0, oldGroups); + }); + + rows.forEach(function (row) { + self.assignRowToExistingGroup(row, oldGroups); + }); + } else { + rows.forEach(function (row) { + self.assignRowToGroup(row, oldGroups); + }); + } +}; + +GroupRows.prototype.createGroup = function (groupID, level, oldGroups) { + var groupKey = level + "_" + groupID, + group; + + oldGroups = oldGroups || []; + + group = new Group(this, false, level, groupID, this.groupIDLookups[0].field, this.headerGenerator[0], oldGroups[groupKey]); + + this.groups[groupKey] = group; + this.groupList.push(group); +}; + +// GroupRows.prototype.assignRowToGroup = function(row, oldGroups){ +// var groupID = this.groupIDLookups[0].func(row.getData()), +// groupKey = "0_" + groupID; + +// if(!this.groups[groupKey]){ +// this.createGroup(groupID, 0, oldGroups); +// } + +// this.groups[groupKey].addRow(row); +// }; + +GroupRows.prototype.assignRowToExistingGroup = function (row, oldGroups) { + var groupID = this.groupIDLookups[0].func(row.getData()), + groupKey = "0_" + groupID; + + if (this.groups[groupKey]) { + this.groups[groupKey].addRow(row); + } +}; + +GroupRows.prototype.assignRowToGroup = function (row, oldGroups) { + var groupID = this.groupIDLookups[0].func(row.getData()), + newGroupNeeded = !this.groups["0_" + groupID]; + + if (newGroupNeeded) { + this.createGroup(groupID, 0, oldGroups); + } + + this.groups["0_" + groupID].addRow(row); + + return !newGroupNeeded; +}; + +GroupRows.prototype.reassignRowToGroup = function (row) { + var oldRowGroup = row.getGroup(), + oldGroupPath = oldRowGroup.getPath(), + newGroupPath = this.getExpectedPath(row), + samePath = true; + // figure out if new group path is the same as old group path + var samePath = oldGroupPath.length == newGroupPath.length && oldGroupPath.every(function (element, index) { + return element === newGroupPath[index]; + }); + // refresh if they new path and old path aren't the same (aka the row's groupings have changed) + if (!samePath) { + oldRowGroup.removeRow(row); + this.assignRowToGroup(row, self.groups); + this.table.rowManager.refreshActiveData("group", false, true); + } +}; + +GroupRows.prototype.getExpectedPath = function (row) { + var groupPath = [], + rowData = row.getData(); + this.groupIDLookups.forEach(function (groupId) { + groupPath.push(groupId.func(rowData)); + }); + return groupPath; +}; + +GroupRows.prototype.updateGroupRows = function (force) { + var self = this, + output = [], + oldRowCount; + + self.groupList.forEach(function (group) { + output = output.concat(group.getHeadersAndRows()); + }); + + //force update of table display + if (force) { + + var displayIndex = self.table.rowManager.setDisplayRows(output, this.getDisplayIndex()); + + if (displayIndex !== true) { + this.setDisplayIndex(displayIndex); + } + + self.table.rowManager.refreshActiveData("group", true, true); + } + + return output; +}; + +GroupRows.prototype.scrollHeaders = function (left) { + if (this.table.options.virtualDomHoz) { + left -= this.table.vdomHoz.vDomPadLeft; + } + + left = left + "px"; + + this.groupList.forEach(function (group) { + group.scrollHeader(left); + }); +}; + +GroupRows.prototype.removeGroup = function (group) { + var groupKey = group.level + "_" + group.key, + index; + + if (this.groups[groupKey]) { + delete this.groups[groupKey]; + + index = this.groupList.indexOf(group); + + if (index > -1) { + this.groupList.splice(index, 1); + } + } +}; + +Tabulator.prototype.registerModule("groupRows", GroupRows); +var History = function History(table) { + this.table = table; //hold Tabulator object + + this.history = []; + this.index = -1; +}; + +History.prototype.clear = function () { + this.history = []; + this.index = -1; +}; + +History.prototype.action = function (type, component, data) { + + this.history = this.history.slice(0, this.index + 1); + + this.history.push({ + type: type, + component: component, + data: data + }); + + this.index++; +}; + +History.prototype.getHistoryUndoSize = function () { + return this.index + 1; +}; + +History.prototype.getHistoryRedoSize = function () { + return this.history.length - (this.index + 1); +}; + +History.prototype.clearComponentHistory = function (component) { + var index = this.history.findIndex(function (item) { + return item.component === component; + }); + + if (index > -1) { + this.history.splice(index, 1); + if (index <= this.index) { + this.index--; + } + + this.clearComponentHistory(component); + } +}; + +History.prototype.undo = function () { + + if (this.index > -1) { + var action = this.history[this.index]; + + this.undoers[action.type].call(this, action); + + this.index--; + + this.table.options.historyUndo.call(this.table, action.type, action.component.getComponent(), action.data); + + return true; + } else { + console.warn("History Undo Error - No more history to undo"); + return false; + } +}; + +History.prototype.redo = function () { + if (this.history.length - 1 > this.index) { + + this.index++; + + var action = this.history[this.index]; + + this.redoers[action.type].call(this, action); + + this.table.options.historyRedo.call(this.table, action.type, action.component.getComponent(), action.data); + + return true; + } else { + console.warn("History Redo Error - No more history to redo"); + return false; + } +}; + +History.prototype.undoers = { + cellEdit: function cellEdit(action) { + action.component.setValueProcessData(action.data.oldValue); + }, + + rowAdd: function rowAdd(action) { + action.component.deleteActual(); + }, + + rowDelete: function rowDelete(action) { + var newRow = this.table.rowManager.addRowActual(action.data.data, action.data.pos, action.data.index); + + if (this.table.options.groupBy && this.table.modExists("groupRows")) { + this.table.modules.groupRows.updateGroupRows(true); + } + + this._rebindRow(action.component, newRow); + }, + + rowMove: function rowMove(action) { + this.table.rowManager.moveRowActual(action.component, this.table.rowManager.rows[action.data.posFrom], !action.data.after); + this.table.rowManager.redraw(); + } +}; + +History.prototype.redoers = { + cellEdit: function cellEdit(action) { + action.component.setValueProcessData(action.data.newValue); + }, + + rowAdd: function rowAdd(action) { + var newRow = this.table.rowManager.addRowActual(action.data.data, action.data.pos, action.data.index); + + if (this.table.options.groupBy && this.table.modExists("groupRows")) { + this.table.modules.groupRows.updateGroupRows(true); + } + + this._rebindRow(action.component, newRow); + }, + + rowDelete: function rowDelete(action) { + action.component.deleteActual(); + }, + + rowMove: function rowMove(action) { + this.table.rowManager.moveRowActual(action.component, this.table.rowManager.rows[action.data.posTo], action.data.after); + this.table.rowManager.redraw(); + } +}; + +//rebind rows to new element after deletion +History.prototype._rebindRow = function (oldRow, newRow) { + this.history.forEach(function (action) { + if (action.component instanceof Row) { + if (action.component === oldRow) { + action.component = newRow; + } + } else if (action.component instanceof Cell) { + if (action.component.row === oldRow) { + var field = action.component.column.getField(); + + if (field) { + action.component = newRow.getCell(field); + } + } + } + }); +}; + +Tabulator.prototype.registerModule("history", History); +var HtmlTableImport = function HtmlTableImport(table) { + this.table = table; //hold Tabulator object + this.fieldIndex = []; + this.hasIndex = false; +}; + +HtmlTableImport.prototype.parseTable = function () { + var self = this, + element = self.table.element, + options = self.table.options, + columns = options.columns, + headers = element.getElementsByTagName("th"), + rows = element.getElementsByTagName("tbody")[0], + data = [], + newTable; + + self.hasIndex = false; + + self.table.options.htmlImporting.call(this.table); + + rows = rows ? rows.getElementsByTagName("tr") : []; + + //check for tablator inline options + self._extractOptions(element, options); + + if (headers.length) { + self._extractHeaders(headers, rows); + } else { + self._generateBlankHeaders(headers, rows); + } + + //iterate through table rows and build data set + for (var index = 0; index < rows.length; index++) { + var row = rows[index], + cells = row.getElementsByTagName("td"), + item = {}; + + //create index if the dont exist in table + if (!self.hasIndex) { + item[options.index] = index; + } + + for (var i = 0; i < cells.length; i++) { + var cell = cells[i]; + if (typeof this.fieldIndex[i] !== "undefined") { + item[this.fieldIndex[i]] = cell.innerHTML; + } + } + + //add row data to item + data.push(item); + } + + //create new element + var newElement = document.createElement("div"); + + //transfer attributes to new element + var attributes = element.attributes; + + // loop through attributes and apply them on div + + for (var i in attributes) { + if (_typeof(attributes[i]) == "object") { + newElement.setAttribute(attributes[i].name, attributes[i].value); + } + } + + // replace table with div element + element.parentNode.replaceChild(newElement, element); + + options.data = data; + + self.table.options.htmlImported.call(this.table); + + // // newElement.tabulator(options); + + this.table.element = newElement; +}; + +//extract tabulator attribute options +HtmlTableImport.prototype._extractOptions = function (element, options, defaultOptions) { + var attributes = element.attributes; + var optionsArr = defaultOptions ? Object.assign([], defaultOptions) : Object.keys(options); + var optionsList = {}; + + optionsArr.forEach(function (item) { + optionsList[item.toLowerCase()] = item; + }); + + for (var index in attributes) { + var attrib = attributes[index]; + var name; + + if (attrib && (typeof attrib === 'undefined' ? 'undefined' : _typeof(attrib)) == "object" && attrib.name && attrib.name.indexOf("tabulator-") === 0) { + name = attrib.name.replace("tabulator-", ""); + + if (typeof optionsList[name] !== "undefined") { + options[optionsList[name]] = this._attribValue(attrib.value); + } + } + } +}; + +//get value of attribute +HtmlTableImport.prototype._attribValue = function (value) { + if (value === "true") { + return true; + } + + if (value === "false") { + return false; + } + + return value; +}; + +//find column if it has already been defined +HtmlTableImport.prototype._findCol = function (title) { + var match = this.table.options.columns.find(function (column) { + return column.title === title; + }); + + return match || false; +}; + +//extract column from headers +HtmlTableImport.prototype._extractHeaders = function (headers, rows) { + for (var index = 0; index < headers.length; index++) { + var header = headers[index], + exists = false, + col = this._findCol(header.textContent), + width, + attributes; + + if (col) { + exists = true; + } else { + col = { title: header.textContent.trim() }; + } + + if (!col.field) { + col.field = header.textContent.trim().toLowerCase().replace(" ", "_"); + } + + width = header.getAttribute("width"); + + if (width && !col.width) { + col.width = width; + } + + //check for tablator inline options + attributes = header.attributes; + + // //check for tablator inline options + this._extractOptions(header, col, Column.prototype.defaultOptionList); + + this.fieldIndex[index] = col.field; + + if (col.field == this.table.options.index) { + this.hasIndex = true; + } + + if (!exists) { + this.table.options.columns.push(col); + } + } +}; + +//generate blank headers +HtmlTableImport.prototype._generateBlankHeaders = function (headers, rows) { + for (var index = 0; index < headers.length; index++) { + var header = headers[index], + col = { title: "", field: "col" + index }; + + this.fieldIndex[index] = col.field; + + var width = header.getAttribute("width"); + + if (width) { + col.width = width; + } + + this.table.options.columns.push(col); + } +}; + +Tabulator.prototype.registerModule("htmlTableImport", HtmlTableImport); +var Keybindings = function Keybindings(table) { + this.table = table; //hold Tabulator object + this.watchKeys = null; + this.pressedKeys = null; + this.keyupBinding = false; + this.keydownBinding = false; +}; + +Keybindings.prototype.initialize = function () { + var bindings = this.table.options.keybindings, + mergedBindings = {}; + + this.watchKeys = {}; + this.pressedKeys = []; + + if (bindings !== false) { + + for (var key in this.bindings) { + mergedBindings[key] = this.bindings[key]; + } + + if (Object.keys(bindings).length) { + + for (var _key in bindings) { + mergedBindings[_key] = bindings[_key]; + } + } + + this.mapBindings(mergedBindings); + this.bindEvents(); + } +}; + +Keybindings.prototype.mapBindings = function (bindings) { + var _this70 = this; + + var self = this; + + var _loop2 = function _loop2(key) { + + if (_this70.actions[key]) { + + if (bindings[key]) { + + if (_typeof(bindings[key]) !== "object") { + bindings[key] = [bindings[key]]; + } + + bindings[key].forEach(function (binding) { + self.mapBinding(key, binding); + }); + } + } else { + console.warn("Key Binding Error - no such action:", key); + } + }; + + for (var key in bindings) { + _loop2(key); + } +}; + +Keybindings.prototype.mapBinding = function (action, symbolsList) { + var self = this; + + var binding = { + action: this.actions[action], + keys: [], + ctrl: false, + shift: false, + meta: false + }; + + var symbols = symbolsList.toString().toLowerCase().split(" ").join("").split("+"); + + symbols.forEach(function (symbol) { + switch (symbol) { + case "ctrl": + binding.ctrl = true; + break; + + case "shift": + binding.shift = true; + break; + + case "meta": + binding.meta = true; + break; + + default: + symbol = parseInt(symbol); + binding.keys.push(symbol); + + if (!self.watchKeys[symbol]) { + self.watchKeys[symbol] = []; + } + + self.watchKeys[symbol].push(binding); + } + }); +}; + +Keybindings.prototype.bindEvents = function () { + var self = this; + + this.keyupBinding = function (e) { + var code = e.keyCode; + var bindings = self.watchKeys[code]; + + if (bindings) { + + self.pressedKeys.push(code); + + bindings.forEach(function (binding) { + self.checkBinding(e, binding); + }); + } + }; + + this.keydownBinding = function (e) { + var code = e.keyCode; + var bindings = self.watchKeys[code]; + + if (bindings) { + + var index = self.pressedKeys.indexOf(code); + + if (index > -1) { + self.pressedKeys.splice(index, 1); + } + } + }; + + this.table.element.addEventListener("keydown", this.keyupBinding); + + this.table.element.addEventListener("keyup", this.keydownBinding); +}; + +Keybindings.prototype.clearBindings = function () { + if (this.keyupBinding) { + this.table.element.removeEventListener("keydown", this.keyupBinding); + } + + if (this.keydownBinding) { + this.table.element.removeEventListener("keyup", this.keydownBinding); + } +}; + +Keybindings.prototype.checkBinding = function (e, binding) { + var self = this, + match = true; + + if (e.ctrlKey == binding.ctrl && e.shiftKey == binding.shift && e.metaKey == binding.meta) { + binding.keys.forEach(function (key) { + var index = self.pressedKeys.indexOf(key); + + if (index == -1) { + match = false; + } + }); + + if (match) { + binding.action.call(self, e); + } + + return true; + } + + return false; +}; + +//default bindings +Keybindings.prototype.bindings = { + navPrev: "shift + 9", + navNext: 9, + navUp: 38, + navDown: 40, + scrollPageUp: 33, + scrollPageDown: 34, + scrollToStart: 36, + scrollToEnd: 35, + undo: "ctrl + 90", + redo: "ctrl + 89", + copyToClipboard: "ctrl + 67" +}; + +//default actions +Keybindings.prototype.actions = { + keyBlock: function keyBlock(e) { + e.stopPropagation(); + e.preventDefault(); + }, + scrollPageUp: function scrollPageUp(e) { + var rowManager = this.table.rowManager, + newPos = rowManager.scrollTop - rowManager.height, + scrollMax = rowManager.element.scrollHeight; + + e.preventDefault(); + + if (rowManager.displayRowsCount) { + if (newPos >= 0) { + rowManager.element.scrollTop = newPos; + } else { + rowManager.scrollToRow(rowManager.getDisplayRows()[0]); + } + } + + this.table.element.focus(); + }, + scrollPageDown: function scrollPageDown(e) { + var rowManager = this.table.rowManager, + newPos = rowManager.scrollTop + rowManager.height, + scrollMax = rowManager.element.scrollHeight; + + e.preventDefault(); + + if (rowManager.displayRowsCount) { + if (newPos <= scrollMax) { + rowManager.element.scrollTop = newPos; + } else { + rowManager.scrollToRow(rowManager.getDisplayRows()[rowManager.displayRowsCount - 1]); + } + } + + this.table.element.focus(); + }, + scrollToStart: function scrollToStart(e) { + var rowManager = this.table.rowManager; + + e.preventDefault(); + + if (rowManager.displayRowsCount) { + rowManager.scrollToRow(rowManager.getDisplayRows()[0]); + } + + this.table.element.focus(); + }, + scrollToEnd: function scrollToEnd(e) { + var rowManager = this.table.rowManager; + + e.preventDefault(); + + if (rowManager.displayRowsCount) { + rowManager.scrollToRow(rowManager.getDisplayRows()[rowManager.displayRowsCount - 1]); + } + + this.table.element.focus(); + }, + navPrev: function navPrev(e) { + var cell = false; + + if (this.table.modExists("edit")) { + cell = this.table.modules.edit.currentCell; + + if (cell) { + e.preventDefault(); + cell.nav().prev(); + } + } + }, + + navNext: function navNext(e) { + var cell = false; + var newRow = this.table.options.tabEndNewRow; + var nav; + + if (this.table.modExists("edit")) { + cell = this.table.modules.edit.currentCell; + + if (cell) { + e.preventDefault(); + + nav = cell.nav(); + + if (!nav.next()) { + if (newRow) { + + cell.getElement().firstChild.blur(); + + if (newRow === true) { + newRow = this.table.addRow({}); + } else { + if (typeof newRow == "function") { + newRow = this.table.addRow(newRow(cell.row.getComponent())); + } else { + newRow = this.table.addRow(Object.assign({}, newRow)); + } + } + + newRow.then(function () { + setTimeout(function () { + nav.next(); + }); + }); + } + } + } + } + }, + + navLeft: function navLeft(e) { + var cell = false; + + if (this.table.modExists("edit")) { + cell = this.table.modules.edit.currentCell; + + if (cell) { + e.preventDefault(); + cell.nav().left(); + } + } + }, + + navRight: function navRight(e) { + var cell = false; + + if (this.table.modExists("edit")) { + cell = this.table.modules.edit.currentCell; + + if (cell) { + e.preventDefault(); + cell.nav().right(); + } + } + }, + + navUp: function navUp(e) { + var cell = false; + + if (this.table.modExists("edit")) { + cell = this.table.modules.edit.currentCell; + + if (cell) { + e.preventDefault(); + cell.nav().up(); + } + } + }, + + navDown: function navDown(e) { + var cell = false; + + if (this.table.modExists("edit")) { + cell = this.table.modules.edit.currentCell; + + if (cell) { + e.preventDefault(); + cell.nav().down(); + } + } + }, + + undo: function undo(e) { + var cell = false; + if (this.table.options.history && this.table.modExists("history") && this.table.modExists("edit")) { + + cell = this.table.modules.edit.currentCell; + + if (!cell) { + e.preventDefault(); + this.table.modules.history.undo(); + } + } + }, + + redo: function redo(e) { + var cell = false; + if (this.table.options.history && this.table.modExists("history") && this.table.modExists("edit")) { + + cell = this.table.modules.edit.currentCell; + + if (!cell) { + e.preventDefault(); + this.table.modules.history.redo(); + } + } + }, + + copyToClipboard: function copyToClipboard(e) { + if (!this.table.modules.edit.currentCell) { + if (this.table.modExists("clipboard", true)) { + this.table.modules.clipboard.copy(false, true); + } + } + } +}; + +Tabulator.prototype.registerModule("keybindings", Keybindings); +var Menu = function Menu(table) { + this.table = table; //hold Tabulator object + this.menuEl = false; + this.blurEvent = this.hideMenu.bind(this); + this.escEvent = this.escMenu.bind(this); + this.nestedMenuBlock = false; +}; + +Menu.prototype.initializeColumnHeader = function (column) { + var _this71 = this; + + var headerMenuEl; + + if (column.definition.headerContextMenu) { + column.getElement().addEventListener("contextmenu", this.LoadMenuEvent.bind(this, column, column.definition.headerContextMenu)); + this.tapHold(column, column.definition.headerContextMenu); + } + + // if(column.definition.headerClickMenu){ + // column.getElement().addEventListener("click", this.LoadMenuEvent.bind(this, column, column.definition.headerClickMenu)); + // } + + if (column.definition.headerMenu) { + + headerMenuEl = document.createElement("span"); + headerMenuEl.classList.add("tabulator-header-menu-button"); + headerMenuEl.innerHTML = "⋮"; + + headerMenuEl.addEventListener("click", function (e) { + var menu = typeof column.definition.headerMenu == "function" ? column.definition.headerMenu(column.getComponent(), e) : column.definition.headerMenu; + e.stopPropagation(); + e.preventDefault(); + + _this71.loadMenu(e, column, menu); + }); + + column.titleElement.insertBefore(headerMenuEl, column.titleElement.firstChild); + } +}; + +Menu.prototype.LoadMenuEvent = function (component, menu, e) { + menu = typeof menu == "function" ? menu(component.getComponent(), e) : menu; + + // if(component instanceof Cell){ + // e.stopImmediatePropagation(); + // } + + this.loadMenu(e, component, menu); +}; + +Menu.prototype.tapHold = function (component, menu) { + var _this72 = this; + + var element = component.getElement(), + tapHold = null, + loaded = false; + + element.addEventListener("touchstart", function (e) { + clearTimeout(tapHold); + loaded = false; + + tapHold = setTimeout(function () { + clearTimeout(tapHold); + tapHold = null; + loaded = true; + + _this72.LoadMenuEvent(component, menu, e); + }, 1000); + }, { passive: true }); + + element.addEventListener("touchend", function (e) { + clearTimeout(tapHold); + tapHold = null; + + if (loaded) { + e.preventDefault(); + } + }); +}; + +Menu.prototype.initializeCell = function (cell) { + if (cell.column.definition.contextMenu) { + cell.getElement().addEventListener("contextmenu", this.LoadMenuEvent.bind(this, cell, cell.column.definition.contextMenu)); + this.tapHold(cell, cell.column.definition.contextMenu); + } + + if (cell.column.definition.clickMenu) { + cell.getElement().addEventListener("click", this.LoadMenuEvent.bind(this, cell, cell.column.definition.clickMenu)); + } +}; + +Menu.prototype.initializeRow = function (row) { + if (this.table.options.rowContextMenu) { + row.getElement().addEventListener("contextmenu", this.LoadMenuEvent.bind(this, row, this.table.options.rowContextMenu)); + this.tapHold(row, this.table.options.rowContextMenu); + } + + if (this.table.options.rowClickMenu) { + row.getElement().addEventListener("click", this.LoadMenuEvent.bind(this, row, this.table.options.rowClickMenu)); + } +}; + +Menu.prototype.initializeGroup = function (group) { + if (this.table.options.groupContextMenu) { + group.getElement().addEventListener("contextmenu", this.LoadMenuEvent.bind(this, group, this.table.options.groupContextMenu)); + this.tapHold(group, this.table.options.groupContextMenu); + } + + if (this.table.options.groupClickMenu) { + group.getElement().addEventListener("click", this.LoadMenuEvent.bind(this, group, this.table.options.groupClickMenu)); + } +}; + +Menu.prototype.loadMenu = function (e, component, menu) { + var _this73 = this; + + var docHeight = Math.max(document.body.offsetHeight, window.innerHeight), + touch = !(e instanceof MouseEvent); + + if (!touch) { + e.preventDefault(); + } + + //abort if no menu set + if (!menu || !menu.length) { + return; + } + + if (this.nestedMenuBlock) { + //abort if child menu already open + if (this.isOpen()) { + return; + } + } else { + this.nestedMenuBlock = setTimeout(function () { + _this73.nestedMenuBlock = false; + }, 100); + } + + this.hideMenu(); + + this.menuEl = document.createElement("div"); + this.menuEl.classList.add("tabulator-menu"); + + menu.forEach(function (item) { + var itemEl = document.createElement("div"); + var label = item.label; + var disabled = item.disabled; + + if (item.separator) { + itemEl.classList.add("tabulator-menu-separator"); + } else { + itemEl.classList.add("tabulator-menu-item"); + + if (typeof label == "function") { + label = label(component.getComponent()); + } + + if (label instanceof Node) { + itemEl.appendChild(label); + } else { + itemEl.innerHTML = label; + } + + if (typeof disabled == "function") { + disabled = disabled(component.getComponent()); + } + + if (disabled) { + itemEl.classList.add("tabulator-menu-item-disabled"); + itemEl.addEventListener("click", function (e) { + e.stopPropagation(); + }); + } else { + itemEl.addEventListener("click", function (e) { + _this73.hideMenu(); + item.action(e, component.getComponent()); + }); + } + } + + _this73.menuEl.appendChild(itemEl); + }); + + this.menuEl.style.top = (touch ? e.touches[0].pageY : e.pageY) + "px"; + this.menuEl.style.left = (touch ? e.touches[0].pageX : e.pageX) + "px"; + + setTimeout(function () { + _this73.table.rowManager.element.addEventListener("scroll", _this73.blurEvent); + document.body.addEventListener("click", _this73.blurEvent); + document.body.addEventListener("contextmenu", _this73.blurEvent); + document.body.addEventListener("keydown", _this73.escEvent); + }, 100); + + document.body.appendChild(this.menuEl); + + //move menu to start on right edge if it is too close to the edge of the screen + if (e.pageX + this.menuEl.offsetWidth >= document.body.offsetWidth) { + this.menuEl.style.left = ""; + this.menuEl.style.right = document.body.offsetWidth - e.pageX + "px"; + } + + //move menu to start on bottom edge if it is too close to the edge of the screen + if (e.pageY + this.menuEl.offsetHeight >= docHeight) { + this.menuEl.style.top = ""; + this.menuEl.style.bottom = docHeight - e.pageY + "px"; + } +}; + +Menu.prototype.isOpen = function () { + return !!this.menuEl.parentNode; +}; + +Menu.prototype.escMenu = function (e) { + if (e.keyCode == 27) { + this.hideMenu(); + } +}; + +Menu.prototype.hideMenu = function () { + if (this.menuEl.parentNode) { + this.menuEl.parentNode.removeChild(this.menuEl); + } + + if (this.escEvent) { + document.body.removeEventListener("keydown", this.escEvent); + } + + if (this.blurEvent) { + document.body.removeEventListener("click", this.blurEvent); + document.body.removeEventListener("contextmenu", this.blurEvent); + this.table.rowManager.element.removeEventListener("scroll", this.blurEvent); + } +}; + +//default accessors +Menu.prototype.menus = {}; + +Tabulator.prototype.registerModule("menu", Menu); +var MoveColumns = function MoveColumns(table) { + this.table = table; //hold Tabulator object + this.placeholderElement = this.createPlaceholderElement(); + this.hoverElement = false; //floating column header element + this.checkTimeout = false; //click check timeout holder + this.checkPeriod = 250; //period to wait on mousedown to consider this a move and not a click + this.moving = false; //currently moving column + this.toCol = false; //destination column + this.toColAfter = false; //position of moving column relative to the desitnation column + this.startX = 0; //starting position within header element + this.autoScrollMargin = 40; //auto scroll on edge when within margin + this.autoScrollStep = 5; //auto scroll distance in pixels + this.autoScrollTimeout = false; //auto scroll timeout + this.touchMove = false; + + this.moveHover = this.moveHover.bind(this); + this.endMove = this.endMove.bind(this); +}; + +MoveColumns.prototype.createPlaceholderElement = function () { + var el = document.createElement("div"); + + el.classList.add("tabulator-col"); + el.classList.add("tabulator-col-placeholder"); + + return el; +}; + +MoveColumns.prototype.initializeColumn = function (column) { + var self = this, + config = {}, + colEl; + + if (!column.modules.frozen) { + + colEl = column.getElement(); + + config.mousemove = function (e) { + if (column.parent === self.moving.parent) { + if ((self.touchMove ? e.touches[0].pageX : e.pageX) - Tabulator.prototype.helpers.elOffset(colEl).left + self.table.columnManager.element.scrollLeft > column.getWidth() / 2) { + if (self.toCol !== column || !self.toColAfter) { + colEl.parentNode.insertBefore(self.placeholderElement, colEl.nextSibling); + self.moveColumn(column, true); + } + } else { + if (self.toCol !== column || self.toColAfter) { + colEl.parentNode.insertBefore(self.placeholderElement, colEl); + self.moveColumn(column, false); + } + } + } + }.bind(self); + + colEl.addEventListener("mousedown", function (e) { + self.touchMove = false; + if (e.which === 1) { + self.checkTimeout = setTimeout(function () { + self.startMove(e, column); + }, self.checkPeriod); + } + }); + + colEl.addEventListener("mouseup", function (e) { + if (e.which === 1) { + if (self.checkTimeout) { + clearTimeout(self.checkTimeout); + } + } + }); + + self.bindTouchEvents(column); + } + + column.modules.moveColumn = config; +}; + +MoveColumns.prototype.bindTouchEvents = function (column) { + var self = this, + colEl = column.getElement(), + startXMove = false, + //shifting center position of the cell + dir = false, + currentCol, + nextCol, + prevCol, + nextColWidth, + prevColWidth, + nextColWidthLast, + prevColWidthLast; + + colEl.addEventListener("touchstart", function (e) { + self.checkTimeout = setTimeout(function () { + self.touchMove = true; + currentCol = column; + nextCol = column.nextColumn(); + nextColWidth = nextCol ? nextCol.getWidth() / 2 : 0; + prevCol = column.prevColumn(); + prevColWidth = prevCol ? prevCol.getWidth() / 2 : 0; + nextColWidthLast = 0; + prevColWidthLast = 0; + startXMove = false; + + self.startMove(e, column); + }, self.checkPeriod); + }, { passive: true }); + + colEl.addEventListener("touchmove", function (e) { + var halfCol, diff, moveToCol; + + if (self.moving) { + self.moveHover(e); + + if (!startXMove) { + startXMove = e.touches[0].pageX; + } + + diff = e.touches[0].pageX - startXMove; + + if (diff > 0) { + if (nextCol && diff - nextColWidthLast > nextColWidth) { + moveToCol = nextCol; + + if (moveToCol !== column) { + startXMove = e.touches[0].pageX; + moveToCol.getElement().parentNode.insertBefore(self.placeholderElement, moveToCol.getElement().nextSibling); + self.moveColumn(moveToCol, true); + } + } + } else { + if (prevCol && -diff - prevColWidthLast > prevColWidth) { + moveToCol = prevCol; + + if (moveToCol !== column) { + startXMove = e.touches[0].pageX; + moveToCol.getElement().parentNode.insertBefore(self.placeholderElement, moveToCol.getElement()); + self.moveColumn(moveToCol, false); + } + } + } + + if (moveToCol) { + currentCol = moveToCol; + nextCol = moveToCol.nextColumn(); + nextColWidthLast = nextColWidth; + nextColWidth = nextCol ? nextCol.getWidth() / 2 : 0; + prevCol = moveToCol.prevColumn(); + prevColWidthLast = prevColWidth; + prevColWidth = prevCol ? prevCol.getWidth() / 2 : 0; + } + } + }, { passive: true }); + + colEl.addEventListener("touchend", function (e) { + if (self.checkTimeout) { + clearTimeout(self.checkTimeout); + } + if (self.moving) { + self.endMove(e); + } + }); +}; + +MoveColumns.prototype.startMove = function (e, column) { + var element = column.getElement(); + + this.moving = column; + this.startX = (this.touchMove ? e.touches[0].pageX : e.pageX) - Tabulator.prototype.helpers.elOffset(element).left; + + this.table.element.classList.add("tabulator-block-select"); + + //create placeholder + this.placeholderElement.style.width = column.getWidth() + "px"; + this.placeholderElement.style.height = column.getHeight() + "px"; + + element.parentNode.insertBefore(this.placeholderElement, element); + element.parentNode.removeChild(element); + + //create hover element + this.hoverElement = element.cloneNode(true); + this.hoverElement.classList.add("tabulator-moving"); + + this.table.columnManager.getElement().appendChild(this.hoverElement); + + this.hoverElement.style.left = "0"; + this.hoverElement.style.bottom = "0"; + + if (!this.touchMove) { + this._bindMouseMove(); + + document.body.addEventListener("mousemove", this.moveHover); + document.body.addEventListener("mouseup", this.endMove); + } + + this.moveHover(e); +}; + +MoveColumns.prototype._bindMouseMove = function () { + this.table.columnManager.columnsByIndex.forEach(function (column) { + if (column.modules.moveColumn.mousemove) { + column.getElement().addEventListener("mousemove", column.modules.moveColumn.mousemove); + } + }); +}; + +MoveColumns.prototype._unbindMouseMove = function () { + this.table.columnManager.columnsByIndex.forEach(function (column) { + if (column.modules.moveColumn.mousemove) { + column.getElement().removeEventListener("mousemove", column.modules.moveColumn.mousemove); + } + }); +}; + +MoveColumns.prototype.moveColumn = function (column, after) { + var movingCells = this.moving.getCells(); + + this.toCol = column; + this.toColAfter = after; + + if (after) { + column.getCells().forEach(function (cell, i) { + var cellEl = cell.getElement(); + cellEl.parentNode.insertBefore(movingCells[i].getElement(), cellEl.nextSibling); + }); + } else { + column.getCells().forEach(function (cell, i) { + var cellEl = cell.getElement(); + cellEl.parentNode.insertBefore(movingCells[i].getElement(), cellEl); + }); + } +}; + +MoveColumns.prototype.endMove = function (e) { + if (e.which === 1 || this.touchMove) { + this._unbindMouseMove(); + + this.placeholderElement.parentNode.insertBefore(this.moving.getElement(), this.placeholderElement.nextSibling); + this.placeholderElement.parentNode.removeChild(this.placeholderElement); + this.hoverElement.parentNode.removeChild(this.hoverElement); + + this.table.element.classList.remove("tabulator-block-select"); + + if (this.toCol) { + this.table.columnManager.moveColumnActual(this.moving, this.toCol, this.toColAfter); + } + + this.moving = false; + this.toCol = false; + this.toColAfter = false; + + if (!this.touchMove) { + document.body.removeEventListener("mousemove", this.moveHover); + document.body.removeEventListener("mouseup", this.endMove); + } + } +}; + +MoveColumns.prototype.moveHover = function (e) { + var self = this, + columnHolder = self.table.columnManager.getElement(), + scrollLeft = columnHolder.scrollLeft, + xPos = (self.touchMove ? e.touches[0].pageX : e.pageX) - Tabulator.prototype.helpers.elOffset(columnHolder).left + scrollLeft, + scrollPos; + + self.hoverElement.style.left = xPos - self.startX + "px"; + + if (xPos - scrollLeft < self.autoScrollMargin) { + if (!self.autoScrollTimeout) { + self.autoScrollTimeout = setTimeout(function () { + scrollPos = Math.max(0, scrollLeft - 5); + self.table.rowManager.getElement().scrollLeft = scrollPos; + self.autoScrollTimeout = false; + }, 1); + } + } + + if (scrollLeft + columnHolder.clientWidth - xPos < self.autoScrollMargin) { + if (!self.autoScrollTimeout) { + self.autoScrollTimeout = setTimeout(function () { + scrollPos = Math.min(columnHolder.clientWidth, scrollLeft + 5); + self.table.rowManager.getElement().scrollLeft = scrollPos; + self.autoScrollTimeout = false; + }, 1); + } + } +}; + +Tabulator.prototype.registerModule("moveColumn", MoveColumns); + +var MoveRows = function MoveRows(table) { + + this.table = table; //hold Tabulator object + this.placeholderElement = this.createPlaceholderElement(); + this.hoverElement = false; //floating row header element + this.checkTimeout = false; //click check timeout holder + this.checkPeriod = 150; //period to wait on mousedown to consider this a move and not a click + this.moving = false; //currently moving row + this.toRow = false; //destination row + this.toRowAfter = false; //position of moving row relative to the desitnation row + this.hasHandle = false; //row has handle instead of fully movable row + this.startY = 0; //starting Y position within header element + this.startX = 0; //starting X position within header element + + this.moveHover = this.moveHover.bind(this); + this.endMove = this.endMove.bind(this); + this.tableRowDropEvent = false; + + this.touchMove = false; + + this.connection = false; + this.connectionSelectorsTables = false; + this.connectionSelectorsElements = false; + this.connectionElements = []; + this.connections = []; + + this.connectedTable = false; + this.connectedRow = false; +}; + +MoveRows.prototype.createPlaceholderElement = function () { + var el = document.createElement("div"); + + el.classList.add("tabulator-row"); + el.classList.add("tabulator-row-placeholder"); + + return el; +}; + +MoveRows.prototype.initialize = function (handle) { + this.connectionSelectorsTables = this.table.options.movableRowsConnectedTables; + this.connectionSelectorsElements = this.table.options.movableRowsConnectedElements; + + this.connection = this.connectionSelectorsTables || this.connectionSelectorsElements; +}; + +MoveRows.prototype.setHandle = function (handle) { + this.hasHandle = handle; +}; + +MoveRows.prototype.initializeGroupHeader = function (group) { + var self = this, + config = {}, + rowEl; + + //inter table drag drop + config.mouseup = function (e) { + self.tableRowDrop(e, row); + }.bind(self); + + //same table drag drop + config.mousemove = function (e) { + if (e.pageY - Tabulator.prototype.helpers.elOffset(group.element).top + self.table.rowManager.element.scrollTop > group.getHeight() / 2) { + if (self.toRow !== group || !self.toRowAfter) { + var rowEl = group.getElement(); + rowEl.parentNode.insertBefore(self.placeholderElement, rowEl.nextSibling); + self.moveRow(group, true); + } + } else { + if (self.toRow !== group || self.toRowAfter) { + var rowEl = group.getElement(); + if (rowEl.previousSibling) { + rowEl.parentNode.insertBefore(self.placeholderElement, rowEl); + self.moveRow(group, false); + } + } + } + }.bind(self); + + group.modules.moveRow = config; +}; + +MoveRows.prototype.initializeRow = function (row) { + var self = this, + config = {}, + rowEl; + + //inter table drag drop + config.mouseup = function (e) { + self.tableRowDrop(e, row); + }.bind(self); + + //same table drag drop + config.mousemove = function (e) { + if (e.pageY - Tabulator.prototype.helpers.elOffset(row.element).top + self.table.rowManager.element.scrollTop > row.getHeight() / 2) { + if (self.toRow !== row || !self.toRowAfter) { + var rowEl = row.getElement(); + rowEl.parentNode.insertBefore(self.placeholderElement, rowEl.nextSibling); + self.moveRow(row, true); + } + } else { + if (self.toRow !== row || self.toRowAfter) { + var rowEl = row.getElement(); + rowEl.parentNode.insertBefore(self.placeholderElement, rowEl); + self.moveRow(row, false); + } + } + }.bind(self); + + if (!this.hasHandle) { + + rowEl = row.getElement(); + + rowEl.addEventListener("mousedown", function (e) { + if (e.which === 1) { + self.checkTimeout = setTimeout(function () { + self.startMove(e, row); + }, self.checkPeriod); + } + }); + + rowEl.addEventListener("mouseup", function (e) { + if (e.which === 1) { + if (self.checkTimeout) { + clearTimeout(self.checkTimeout); + } + } + }); + + this.bindTouchEvents(row, row.getElement()); + } + + row.modules.moveRow = config; +}; + +MoveRows.prototype.initializeCell = function (cell) { + var self = this, + cellEl = cell.getElement(); + + cellEl.addEventListener("mousedown", function (e) { + if (e.which === 1) { + self.checkTimeout = setTimeout(function () { + self.startMove(e, cell.row); + }, self.checkPeriod); + } + }); + + cellEl.addEventListener("mouseup", function (e) { + if (e.which === 1) { + if (self.checkTimeout) { + clearTimeout(self.checkTimeout); + } + } + }); + + this.bindTouchEvents(cell.row, cell.getElement()); +}; + +MoveRows.prototype.bindTouchEvents = function (row, element) { + var self = this, + startYMove = false, + //shifting center position of the cell + dir = false, + currentRow, + nextRow, + prevRow, + nextRowHeight, + prevRowHeight, + nextRowHeightLast, + prevRowHeightLast; + + element.addEventListener("touchstart", function (e) { + self.checkTimeout = setTimeout(function () { + self.touchMove = true; + currentRow = row; + nextRow = row.nextRow(); + nextRowHeight = nextRow ? nextRow.getHeight() / 2 : 0; + prevRow = row.prevRow(); + prevRowHeight = prevRow ? prevRow.getHeight() / 2 : 0; + nextRowHeightLast = 0; + prevRowHeightLast = 0; + startYMove = false; + + self.startMove(e, row); + }, self.checkPeriod); + }, { passive: true }); + this.moving, this.toRow, this.toRowAfter; + element.addEventListener("touchmove", function (e) { + + var halfCol, diff, moveToRow; + + if (self.moving) { + e.preventDefault(); + + self.moveHover(e); + + if (!startYMove) { + startYMove = e.touches[0].pageY; + } + + diff = e.touches[0].pageY - startYMove; + + if (diff > 0) { + if (nextRow && diff - nextRowHeightLast > nextRowHeight) { + moveToRow = nextRow; + + if (moveToRow !== row) { + startYMove = e.touches[0].pageY; + moveToRow.getElement().parentNode.insertBefore(self.placeholderElement, moveToRow.getElement().nextSibling); + self.moveRow(moveToRow, true); + } + } + } else { + if (prevRow && -diff - prevRowHeightLast > prevRowHeight) { + moveToRow = prevRow; + + if (moveToRow !== row) { + startYMove = e.touches[0].pageY; + moveToRow.getElement().parentNode.insertBefore(self.placeholderElement, moveToRow.getElement()); + self.moveRow(moveToRow, false); + } + } + } + + if (moveToRow) { + currentRow = moveToRow; + nextRow = moveToRow.nextRow(); + nextRowHeightLast = nextRowHeight; + nextRowHeight = nextRow ? nextRow.getHeight() / 2 : 0; + prevRow = moveToRow.prevRow(); + prevRowHeightLast = prevRowHeight; + prevRowHeight = prevRow ? prevRow.getHeight() / 2 : 0; + } + } + }); + + element.addEventListener("touchend", function (e) { + if (self.checkTimeout) { + clearTimeout(self.checkTimeout); + } + if (self.moving) { + self.endMove(e); + self.touchMove = false; + } + }); +}; + +MoveRows.prototype._bindMouseMove = function () { + var self = this; + + self.table.rowManager.getDisplayRows().forEach(function (row) { + if ((row.type === "row" || row.type === "group") && row.modules.moveRow.mousemove) { + row.getElement().addEventListener("mousemove", row.modules.moveRow.mousemove); + } + }); +}; + +MoveRows.prototype._unbindMouseMove = function () { + var self = this; + + self.table.rowManager.getDisplayRows().forEach(function (row) { + if ((row.type === "row" || row.type === "group") && row.modules.moveRow.mousemove) { + row.getElement().removeEventListener("mousemove", row.modules.moveRow.mousemove); + } + }); +}; + +MoveRows.prototype.startMove = function (e, row) { + var element = row.getElement(); + + this.setStartPosition(e, row); + + this.moving = row; + + this.table.element.classList.add("tabulator-block-select"); + + //create placeholder + this.placeholderElement.style.width = row.getWidth() + "px"; + this.placeholderElement.style.height = row.getHeight() + "px"; + + if (!this.connection) { + element.parentNode.insertBefore(this.placeholderElement, element); + element.parentNode.removeChild(element); + } else { + this.table.element.classList.add("tabulator-movingrow-sending"); + this.connectToTables(row); + } + + //create hover element + this.hoverElement = element.cloneNode(true); + this.hoverElement.classList.add("tabulator-moving"); + + if (this.connection) { + document.body.appendChild(this.hoverElement); + this.hoverElement.style.left = "0"; + this.hoverElement.style.top = "0"; + this.hoverElement.style.width = this.table.element.clientWidth + "px"; + this.hoverElement.style.whiteSpace = "nowrap"; + this.hoverElement.style.overflow = "hidden"; + this.hoverElement.style.pointerEvents = "none"; + } else { + this.table.rowManager.getTableElement().appendChild(this.hoverElement); + + this.hoverElement.style.left = "0"; + this.hoverElement.style.top = "0"; + + this._bindMouseMove(); + } + + document.body.addEventListener("mousemove", this.moveHover); + document.body.addEventListener("mouseup", this.endMove); + + this.moveHover(e); +}; + +MoveRows.prototype.setStartPosition = function (e, row) { + var pageX = this.touchMove ? e.touches[0].pageX : e.pageX, + pageY = this.touchMove ? e.touches[0].pageY : e.pageY, + element, + position; + + element = row.getElement(); + if (this.connection) { + position = element.getBoundingClientRect(); + + this.startX = position.left - pageX + window.pageXOffset; + this.startY = position.top - pageY + window.pageYOffset; + } else { + this.startY = pageY - element.getBoundingClientRect().top; + } +}; + +MoveRows.prototype.endMove = function (e) { + if (!e || e.which === 1 || this.touchMove) { + this._unbindMouseMove(); + + if (!this.connection) { + this.placeholderElement.parentNode.insertBefore(this.moving.getElement(), this.placeholderElement.nextSibling); + this.placeholderElement.parentNode.removeChild(this.placeholderElement); + } + + this.hoverElement.parentNode.removeChild(this.hoverElement); + + this.table.element.classList.remove("tabulator-block-select"); + + if (this.toRow) { + this.table.rowManager.moveRow(this.moving, this.toRow, this.toRowAfter); + } + + this.moving = false; + this.toRow = false; + this.toRowAfter = false; + + document.body.removeEventListener("mousemove", this.moveHover); + document.body.removeEventListener("mouseup", this.endMove); + + if (this.connection) { + this.table.element.classList.remove("tabulator-movingrow-sending"); + this.disconnectFromTables(); + } + } +}; + +MoveRows.prototype.moveRow = function (row, after) { + this.toRow = row; + this.toRowAfter = after; +}; + +MoveRows.prototype.moveHover = function (e) { + if (this.connection) { + this.moveHoverConnections.call(this, e); + } else { + this.moveHoverTable.call(this, e); + } +}; + +MoveRows.prototype.moveHoverTable = function (e) { + var rowHolder = this.table.rowManager.getElement(), + scrollTop = rowHolder.scrollTop, + yPos = (this.touchMove ? e.touches[0].pageY : e.pageY) - rowHolder.getBoundingClientRect().top + scrollTop, + scrollPos; + + this.hoverElement.style.top = yPos - this.startY + "px"; +}; + +MoveRows.prototype.moveHoverConnections = function (e) { + this.hoverElement.style.left = this.startX + (this.touchMove ? e.touches[0].pageX : e.pageX) + "px"; + this.hoverElement.style.top = this.startY + (this.touchMove ? e.touches[0].pageY : e.pageY) + "px"; +}; + +MoveRows.prototype.elementRowDrop = function (e, element, row) { + if (this.table.options.movableRowsElementDrop) { + this.table.options.movableRowsElementDrop(e, element, row ? row.getComponent() : false); + } +}; + +//establish connection with other tables +MoveRows.prototype.connectToTables = function (row) { + var _this74 = this; + + var connectionTables; + + if (this.connectionSelectorsTables) { + connectionTables = this.table.modules.comms.getConnections(this.connectionSelectorsTables); + + this.table.options.movableRowsSendingStart.call(this.table, connectionTables); + + this.table.modules.comms.send(this.connectionSelectorsTables, "moveRow", "connect", { + row: row + }); + } + + if (this.connectionSelectorsElements) { + + this.connectionElements = []; + + if (!Array.isArray(this.connectionSelectorsElements)) { + this.connectionSelectorsElements = [this.connectionSelectorsElements]; + } + + this.connectionSelectorsElements.forEach(function (query) { + if (typeof query === "string") { + _this74.connectionElements = _this74.connectionElements.concat(Array.prototype.slice.call(document.querySelectorAll(query))); + } else { + _this74.connectionElements.push(query); + } + }); + + this.connectionElements.forEach(function (element) { + var dropEvent = function dropEvent(e) { + _this74.elementRowDrop(e, element, _this74.moving); + }; + + element.addEventListener("mouseup", dropEvent); + element.tabulatorElementDropEvent = dropEvent; + + element.classList.add("tabulator-movingrow-receiving"); + }); + } +}; + +//disconnect from other tables +MoveRows.prototype.disconnectFromTables = function () { + var connectionTables; + + if (this.connectionSelectorsTables) { + connectionTables = this.table.modules.comms.getConnections(this.connectionSelectorsTables); + + this.table.options.movableRowsSendingStop.call(this.table, connectionTables); + + this.table.modules.comms.send(this.connectionSelectorsTables, "moveRow", "disconnect"); + } + + this.connectionElements.forEach(function (element) { + element.classList.remove("tabulator-movingrow-receiving"); + element.removeEventListener("mouseup", element.tabulatorElementDropEvent); + delete element.tabulatorElementDropEvent; + }); +}; + +//accept incomming connection +MoveRows.prototype.connect = function (table, row) { + var self = this; + if (!this.connectedTable) { + this.connectedTable = table; + this.connectedRow = row; + + this.table.element.classList.add("tabulator-movingrow-receiving"); + + self.table.rowManager.getDisplayRows().forEach(function (row) { + if (row.type === "row" && row.modules.moveRow && row.modules.moveRow.mouseup) { + row.getElement().addEventListener("mouseup", row.modules.moveRow.mouseup); + } + }); + + self.tableRowDropEvent = self.tableRowDrop.bind(self); + + self.table.element.addEventListener("mouseup", self.tableRowDropEvent); + + this.table.options.movableRowsReceivingStart.call(this.table, row, table); + + return true; + } else { + console.warn("Move Row Error - Table cannot accept connection, already connected to table:", this.connectedTable); + return false; + } +}; + +//close incomming connection +MoveRows.prototype.disconnect = function (table) { + var self = this; + if (table === this.connectedTable) { + this.connectedTable = false; + this.connectedRow = false; + + this.table.element.classList.remove("tabulator-movingrow-receiving"); + + self.table.rowManager.getDisplayRows().forEach(function (row) { + if (row.type === "row" && row.modules.moveRow && row.modules.moveRow.mouseup) { + row.getElement().removeEventListener("mouseup", row.modules.moveRow.mouseup); + } + }); + + self.table.element.removeEventListener("mouseup", self.tableRowDropEvent); + + this.table.options.movableRowsReceivingStop.call(this.table, table); + } else { + console.warn("Move Row Error - trying to disconnect from non connected table"); + } +}; + +MoveRows.prototype.dropComplete = function (table, row, success) { + var sender = false; + + if (success) { + + switch (_typeof(this.table.options.movableRowsSender)) { + case "string": + sender = this.senders[this.table.options.movableRowsSender]; + break; + + case "function": + sender = this.table.options.movableRowsSender; + break; + } + + if (sender) { + sender.call(this, this.moving.getComponent(), row ? row.getComponent() : undefined, table); + } else { + if (this.table.options.movableRowsSender) { + console.warn("Mover Row Error - no matching sender found:", this.table.options.movableRowsSender); + } + } + + this.table.options.movableRowsSent.call(this.table, this.moving.getComponent(), row ? row.getComponent() : undefined, table); + } else { + this.table.options.movableRowsSentFailed.call(this.table, this.moving.getComponent(), row ? row.getComponent() : undefined, table); + } + + this.endMove(); +}; + +MoveRows.prototype.tableRowDrop = function (e, row) { + var receiver = false, + success = false; + + console.trace("drop"); + + e.stopImmediatePropagation(); + + switch (_typeof(this.table.options.movableRowsReceiver)) { + case "string": + receiver = this.receivers[this.table.options.movableRowsReceiver]; + break; + + case "function": + receiver = this.table.options.movableRowsReceiver; + break; + } + + if (receiver) { + success = receiver.call(this, this.connectedRow.getComponent(), row ? row.getComponent() : undefined, this.connectedTable); + } else { + console.warn("Mover Row Error - no matching receiver found:", this.table.options.movableRowsReceiver); + } + + if (success) { + this.table.options.movableRowsReceived.call(this.table, this.connectedRow.getComponent(), row ? row.getComponent() : undefined, this.connectedTable); + } else { + this.table.options.movableRowsReceivedFailed.call(this.table, this.connectedRow.getComponent(), row ? row.getComponent() : undefined, this.connectedTable); + } + + this.table.modules.comms.send(this.connectedTable, "moveRow", "dropcomplete", { + row: row, + success: success + }); +}; + +MoveRows.prototype.receivers = { + insert: function insert(fromRow, toRow, fromTable) { + this.table.addRow(fromRow.getData(), undefined, toRow); + return true; + }, + + add: function add(fromRow, toRow, fromTable) { + this.table.addRow(fromRow.getData()); + return true; + }, + + update: function update(fromRow, toRow, fromTable) { + if (toRow) { + toRow.update(fromRow.getData()); + return true; + } + + return false; + }, + + replace: function replace(fromRow, toRow, fromTable) { + if (toRow) { + this.table.addRow(fromRow.getData(), undefined, toRow); + toRow.delete(); + return true; + } + + return false; + } +}; + +MoveRows.prototype.senders = { + delete: function _delete(fromRow, toRow, toTable) { + fromRow.delete(); + } +}; + +MoveRows.prototype.commsReceived = function (table, action, data) { + switch (action) { + case "connect": + return this.connect(table, data.row); + break; + + case "disconnect": + return this.disconnect(table); + break; + + case "dropcomplete": + return this.dropComplete(table, data.row, data.success); + break; + } +}; + +Tabulator.prototype.registerModule("moveRow", MoveRows); +var Mutator = function Mutator(table) { + this.table = table; //hold Tabulator object + this.allowedTypes = ["", "data", "edit", "clipboard"]; //list of muatation types + this.enabled = true; +}; + +//initialize column mutator +Mutator.prototype.initializeColumn = function (column) { + var self = this, + match = false, + config = {}; + + this.allowedTypes.forEach(function (type) { + var key = "mutator" + (type.charAt(0).toUpperCase() + type.slice(1)), + mutator; + + if (column.definition[key]) { + mutator = self.lookupMutator(column.definition[key]); + + if (mutator) { + match = true; + + config[key] = { + mutator: mutator, + params: column.definition[key + "Params"] || {} + }; + } + } + }); + + if (match) { + column.modules.mutate = config; + } +}; + +Mutator.prototype.lookupMutator = function (value) { + var mutator = false; + + //set column mutator + switch (typeof value === 'undefined' ? 'undefined' : _typeof(value)) { + case "string": + if (this.mutators[value]) { + mutator = this.mutators[value]; + } else { + console.warn("Mutator Error - No such mutator found, ignoring: ", value); + } + break; + + case "function": + mutator = value; + break; + } + + return mutator; +}; + +//apply mutator to row +Mutator.prototype.transformRow = function (data, type, updatedData) { + var self = this, + key = "mutator" + (type.charAt(0).toUpperCase() + type.slice(1)), + value; + + if (this.enabled) { + + self.table.columnManager.traverse(function (column) { + var mutator, params, component; + + if (column.modules.mutate) { + mutator = column.modules.mutate[key] || column.modules.mutate.mutator || false; + + if (mutator) { + value = column.getFieldValue(typeof updatedData !== "undefined" ? updatedData : data); + + if (type == "data" || typeof value !== "undefined") { + component = column.getComponent(); + params = typeof mutator.params === "function" ? mutator.params(value, data, type, component) : mutator.params; + column.setFieldValue(data, mutator.mutator(value, data, type, params, component)); + } + } + } + }); + } + + return data; +}; + +//apply mutator to new cell value +Mutator.prototype.transformCell = function (cell, value) { + var mutator = cell.column.modules.mutate.mutatorEdit || cell.column.modules.mutate.mutator || false, + tempData = {}; + + if (mutator) { + tempData = Object.assign(tempData, cell.row.getData()); + cell.column.setFieldValue(tempData, value); + return mutator.mutator(value, tempData, "edit", mutator.params, cell.getComponent()); + } else { + return value; + } +}; + +Mutator.prototype.enable = function () { + this.enabled = true; +}; + +Mutator.prototype.disable = function () { + this.enabled = false; +}; + +//default mutators +Mutator.prototype.mutators = {}; + +Tabulator.prototype.registerModule("mutator", Mutator); +var Page = function Page(table) { + + this.table = table; //hold Tabulator object + + this.mode = "local"; + this.progressiveLoad = false; + + this.size = 0; + this.page = 1; + this.count = 5; + this.max = 1; + + this.displayIndex = 0; //index in display pipeline + + this.initialLoad = true; + + this.pageSizes = []; + + this.dataReceivedNames = {}; + this.dataSentNames = {}; + + this.createElements(); +}; + +Page.prototype.createElements = function () { + + var button; + + this.element = document.createElement("span"); + this.element.classList.add("tabulator-paginator"); + + this.pagesElement = document.createElement("span"); + this.pagesElement.classList.add("tabulator-pages"); + + button = document.createElement("button"); + button.classList.add("tabulator-page"); + button.setAttribute("type", "button"); + button.setAttribute("role", "button"); + button.setAttribute("aria-label", ""); + button.setAttribute("title", ""); + + this.firstBut = button.cloneNode(true); + this.firstBut.setAttribute("data-page", "first"); + + this.prevBut = button.cloneNode(true); + this.prevBut.setAttribute("data-page", "prev"); + + this.nextBut = button.cloneNode(true); + this.nextBut.setAttribute("data-page", "next"); + + this.lastBut = button.cloneNode(true); + this.lastBut.setAttribute("data-page", "last"); + + if (this.table.options.paginationSizeSelector) { + this.pageSizeSelect = document.createElement("select"); + this.pageSizeSelect.classList.add("tabulator-page-size"); + } +}; + +Page.prototype.generatePageSizeSelectList = function () { + var _this75 = this; + + var pageSizes = []; + + if (this.pageSizeSelect) { + + if (Array.isArray(this.table.options.paginationSizeSelector)) { + pageSizes = this.table.options.paginationSizeSelector; + this.pageSizes = pageSizes; + + if (this.pageSizes.indexOf(this.size) == -1) { + pageSizes.unshift(this.size); + } + } else { + + if (this.pageSizes.indexOf(this.size) == -1) { + pageSizes = []; + + for (var _i13 = 1; _i13 < 5; _i13++) { + pageSizes.push(this.size * _i13); + } + + this.pageSizes = pageSizes; + } else { + pageSizes = this.pageSizes; + } + } + + while (this.pageSizeSelect.firstChild) { + this.pageSizeSelect.removeChild(this.pageSizeSelect.firstChild); + }pageSizes.forEach(function (item) { + var itemEl = document.createElement("option"); + itemEl.value = item; + + if (item === true) { + _this75.table.modules.localize.bind("pagination|all", function (value) { + itemEl.innerHTML = value; + }); + } else { + itemEl.innerHTML = item; + } + + _this75.pageSizeSelect.appendChild(itemEl); + }); + + this.pageSizeSelect.value = this.size; + } +}; + +//setup pageination +Page.prototype.initialize = function (hidden) { + var self = this, + pageSelectLabel, + testElRow, + testElCell; + + //update param names + this.dataSentNames = Object.assign({}, this.paginationDataSentNames); + this.dataSentNames = Object.assign(this.dataSentNames, this.table.options.paginationDataSent); + + this.dataReceivedNames = Object.assign({}, this.paginationDataReceivedNames); + this.dataReceivedNames = Object.assign(this.dataReceivedNames, this.table.options.paginationDataReceived); + + //build pagination element + + //bind localizations + self.table.modules.localize.bind("pagination|first", function (value) { + self.firstBut.innerHTML = value; + }); + + self.table.modules.localize.bind("pagination|first_title", function (value) { + self.firstBut.setAttribute("aria-label", value); + self.firstBut.setAttribute("title", value); + }); + + self.table.modules.localize.bind("pagination|prev", function (value) { + self.prevBut.innerHTML = value; + }); + + self.table.modules.localize.bind("pagination|prev_title", function (value) { + self.prevBut.setAttribute("aria-label", value); + self.prevBut.setAttribute("title", value); + }); + + self.table.modules.localize.bind("pagination|next", function (value) { + self.nextBut.innerHTML = value; + }); + + self.table.modules.localize.bind("pagination|next_title", function (value) { + self.nextBut.setAttribute("aria-label", value); + self.nextBut.setAttribute("title", value); + }); + + self.table.modules.localize.bind("pagination|last", function (value) { + self.lastBut.innerHTML = value; + }); + + self.table.modules.localize.bind("pagination|last_title", function (value) { + self.lastBut.setAttribute("aria-label", value); + self.lastBut.setAttribute("title", value); + }); + + //click bindings + self.firstBut.addEventListener("click", function () { + self.setPage(1).then(function () {}).catch(function () {}); + }); + + self.prevBut.addEventListener("click", function () { + self.previousPage().then(function () {}).catch(function () {}); + }); + + self.nextBut.addEventListener("click", function () { + self.nextPage().then(function () {}).catch(function () {}); + }); + + self.lastBut.addEventListener("click", function () { + self.setPage(self.max).then(function () {}).catch(function () {}); + }); + + if (self.table.options.paginationElement) { + self.element = self.table.options.paginationElement; + } + + if (this.pageSizeSelect) { + pageSelectLabel = document.createElement("label"); + + self.table.modules.localize.bind("pagination|page_size", function (value) { + self.pageSizeSelect.setAttribute("aria-label", value); + self.pageSizeSelect.setAttribute("title", value); + pageSelectLabel.innerHTML = value; + }); + + self.element.appendChild(pageSelectLabel); + self.element.appendChild(self.pageSizeSelect); + + self.pageSizeSelect.addEventListener("change", function (e) { + self.setPageSize(self.pageSizeSelect.value == "true" ? true : self.pageSizeSelect.value); + self.setPage(1).then(function () {}).catch(function () {}); + }); + } + + //append to DOM + self.element.appendChild(self.firstBut); + self.element.appendChild(self.prevBut); + self.element.appendChild(self.pagesElement); + self.element.appendChild(self.nextBut); + self.element.appendChild(self.lastBut); + + if (!self.table.options.paginationElement && !hidden) { + self.table.footerManager.append(self.element, self); + } + + //set default values + self.mode = self.table.options.pagination; + + if (self.table.options.paginationSize) { + self.size = self.table.options.paginationSize; + } else { + testElRow = document.createElement("div"); + testElRow.classList.add("tabulator-row"); + testElRow.style.visibility = hidden; + + testElCell = document.createElement("div"); + testElCell.classList.add("tabulator-cell"); + testElCell.innerHTML = "Page Row Test"; + + testElRow.appendChild(testElCell); + + self.table.rowManager.getTableElement().appendChild(testElRow); + + self.size = Math.floor(self.table.rowManager.getElement().clientHeight / testElRow.offsetHeight); + + self.table.rowManager.getTableElement().removeChild(testElRow); + } + + // self.page = self.table.options.paginationInitialPage || 1; + self.count = self.table.options.paginationButtonCount; + + self.generatePageSizeSelectList(); +}; + +Page.prototype.initializeProgressive = function (mode) { + this.initialize(true); + this.mode = "progressive_" + mode; + this.progressiveLoad = true; +}; + +Page.prototype.setDisplayIndex = function (index) { + this.displayIndex = index; +}; + +Page.prototype.getDisplayIndex = function () { + return this.displayIndex; +}; + +//calculate maximum page from number of rows +Page.prototype.setMaxRows = function (rowCount) { + if (!rowCount) { + this.max = 1; + } else { + this.max = this.size === true ? 1 : Math.ceil(rowCount / this.size); + } + + if (this.page > this.max) { + this.page = this.max; + } +}; + +//reset to first page without triggering action +Page.prototype.reset = function (force, columnsChanged) { + if (this.mode == "local" || force) { + this.page = 1; + } + + if (columnsChanged) { + this.initialLoad = true; + } + + return true; +}; + +//set the maxmum page +Page.prototype.setMaxPage = function (max) { + + max = parseInt(max); + + this.max = max || 1; + + if (this.page > this.max) { + this.page = this.max; + this.trigger(); + } +}; + +//set current page number +Page.prototype.setPage = function (page) { + var _this76 = this; + + var self = this; + + switch (page) { + case "first": + return this.setPage(1); + break; + + case "prev": + return this.previousPage(); + break; + + case "next": + return this.nextPage(); + break; + + case "last": + return this.setPage(this.max); + break; + } + + return new Promise(function (resolve, reject) { + + page = parseInt(page); + + if (page > 0 && page <= _this76.max) { + _this76.page = page; + _this76.trigger().then(function () { + resolve(); + }).catch(function () { + reject(); + }); + + if (self.table.options.persistence && self.table.modExists("persistence", true) && self.table.modules.persistence.config.page) { + self.table.modules.persistence.save("page"); + } + } else { + console.warn("Pagination Error - Requested page is out of range of 1 - " + _this76.max + ":", page); + reject(); + } + }); +}; + +Page.prototype.setPageToRow = function (row) { + var _this77 = this; + + return new Promise(function (resolve, reject) { + + var rows = _this77.table.rowManager.getDisplayRows(_this77.displayIndex - 1); + var index = rows.indexOf(row); + + if (index > -1) { + var page = _this77.size === true ? 1 : Math.ceil((index + 1) / _this77.size); + + _this77.setPage(page).then(function () { + resolve(); + }).catch(function () { + reject(); + }); + } else { + console.warn("Pagination Error - Requested row is not visible"); + reject(); + } + }); +}; + +Page.prototype.setPageSize = function (size) { + if (size !== true) { + size = parseInt(size); + } + + if (size > 0) { + this.size = size; + } + + if (this.pageSizeSelect) { + // this.pageSizeSelect.value = size; + this.generatePageSizeSelectList(); + } + + if (this.table.options.persistence && this.table.modExists("persistence", true) && this.table.modules.persistence.config.page) { + this.table.modules.persistence.save("page"); + } +}; + +//setup the pagination buttons +Page.prototype._setPageButtons = function () { + var self = this; + + var leftSize = Math.floor((this.count - 1) / 2); + var rightSize = Math.ceil((this.count - 1) / 2); + var min = this.max - this.page + leftSize + 1 < this.count ? this.max - this.count + 1 : Math.max(this.page - leftSize, 1); + var max = this.page <= rightSize ? Math.min(this.count, this.max) : Math.min(this.page + rightSize, this.max); + + while (self.pagesElement.firstChild) { + self.pagesElement.removeChild(self.pagesElement.firstChild); + }if (self.page == 1) { + self.firstBut.disabled = true; + self.prevBut.disabled = true; + } else { + self.firstBut.disabled = false; + self.prevBut.disabled = false; + } + + if (self.page == self.max) { + self.lastBut.disabled = true; + self.nextBut.disabled = true; + } else { + self.lastBut.disabled = false; + self.nextBut.disabled = false; + } + + for (var _i14 = min; _i14 <= max; _i14++) { + if (_i14 > 0 && _i14 <= self.max) { + self.pagesElement.appendChild(self._generatePageButton(_i14)); + } + } + + this.footerRedraw(); +}; + +Page.prototype._generatePageButton = function (page) { + var self = this, + button = document.createElement("button"); + + button.classList.add("tabulator-page"); + if (page == self.page) { + button.classList.add("active"); + } + + button.setAttribute("type", "button"); + button.setAttribute("role", "button"); + + self.table.modules.localize.bind("pagination|page_title", function (value) { + button.setAttribute("aria-label", value + " " + page); + button.setAttribute("title", value + " " + page); + }); + + button.setAttribute("data-page", page); + button.textContent = page; + + button.addEventListener("click", function (e) { + self.setPage(page).then(function () {}).catch(function () {}); + }); + + return button; +}; + +//previous page +Page.prototype.previousPage = function () { + var _this78 = this; + + return new Promise(function (resolve, reject) { + if (_this78.page > 1) { + _this78.page--; + _this78.trigger().then(function () { + resolve(); + }).catch(function () { + reject(); + }); + + if (_this78.table.options.persistence && _this78.table.modExists("persistence", true) && _this78.table.modules.persistence.config.page) { + _this78.table.modules.persistence.save("page"); + } + } else { + console.warn("Pagination Error - Previous page would be less than page 1:", 0); + reject(); + } + }); +}; + +//next page +Page.prototype.nextPage = function () { + var _this79 = this; + + return new Promise(function (resolve, reject) { + if (_this79.page < _this79.max) { + _this79.page++; + _this79.trigger().then(function () { + resolve(); + }).catch(function () { + reject(); + }); + + if (_this79.table.options.persistence && _this79.table.modExists("persistence", true) && _this79.table.modules.persistence.config.page) { + _this79.table.modules.persistence.save("page"); + } + } else { + if (!_this79.progressiveLoad) { + console.warn("Pagination Error - Next page would be greater than maximum page of " + _this79.max + ":", _this79.max + 1); + } + reject(); + } + }); +}; + +//return current page number +Page.prototype.getPage = function () { + return this.page; +}; + +//return max page number +Page.prototype.getPageMax = function () { + return this.max; +}; + +Page.prototype.getPageSize = function (size) { + return this.size; +}; + +Page.prototype.getMode = function () { + return this.mode; +}; + +//return appropriate rows for current page +Page.prototype.getRows = function (data) { + var output, start, end; + + if (this.mode == "local") { + output = []; + + if (this.size === true) { + start = 0; + end = data.length; + } else { + start = this.size * (this.page - 1); + end = start + parseInt(this.size); + } + + this._setPageButtons(); + + for (var _i15 = start; _i15 < end; _i15++) { + if (data[_i15]) { + output.push(data[_i15]); + } + } + + return output; + } else { + + this._setPageButtons(); + + return data.slice(0); + } +}; + +Page.prototype.trigger = function () { + var _this80 = this; + + var left; + + return new Promise(function (resolve, reject) { + + switch (_this80.mode) { + case "local": + left = _this80.table.rowManager.scrollLeft; + + _this80.table.rowManager.refreshActiveData("page"); + _this80.table.rowManager.scrollHorizontal(left); + + _this80.table.options.pageLoaded.call(_this80.table, _this80.getPage()); + resolve(); + break; + + case "remote": + case "progressive_load": + case "progressive_scroll": + _this80.table.modules.ajax.blockActiveRequest(); + _this80._getRemotePage().then(function () { + resolve(); + }).catch(function () { + reject(); + }); + break; + + default: + console.warn("Pagination Error - no such pagination mode:", _this80.mode); + reject(); + } + }); +}; + +Page.prototype._getRemotePage = function () { + var _this81 = this; + + var self = this, + oldParams, + pageParams; + + return new Promise(function (resolve, reject) { + + if (!self.table.modExists("ajax", true)) { + reject(); + } + + //record old params and restore after request has been made + oldParams = Tabulator.prototype.helpers.deepClone(self.table.modules.ajax.getParams() || {}); + pageParams = self.table.modules.ajax.getParams(); + + //configure request params + pageParams[_this81.dataSentNames.page] = self.page; + + //set page size if defined + if (_this81.size) { + pageParams[_this81.dataSentNames.size] = _this81.size; + } + + //set sort data if defined + if (_this81.table.options.ajaxSorting && _this81.table.modExists("sort")) { + var sorters = self.table.modules.sort.getSort(); + + sorters.forEach(function (item) { + delete item.column; + }); + + pageParams[_this81.dataSentNames.sorters] = sorters; + } + + //set filter data if defined + if (_this81.table.options.ajaxFiltering && _this81.table.modExists("filter")) { + var filters = self.table.modules.filter.getFilters(true, true); + pageParams[_this81.dataSentNames.filters] = filters; + } + + self.table.modules.ajax.setParams(pageParams); + + self.table.modules.ajax.sendRequest(_this81.progressiveLoad).then(function (data) { + self._parseRemoteData(data); + resolve(); + }).catch(function (e) { + reject(); + }); + + self.table.modules.ajax.setParams(oldParams); + }); +}; + +Page.prototype._parseRemoteData = function (data) { + var self = this, + left, + data, + margin; + + if (typeof data[this.dataReceivedNames.last_page] === "undefined") { + console.warn("Remote Pagination Error - Server response missing '" + this.dataReceivedNames.last_page + "' property"); + } + + if (data[this.dataReceivedNames.data]) { + this.max = parseInt(data[this.dataReceivedNames.last_page]) || 1; + + if (this.progressiveLoad) { + switch (this.mode) { + case "progressive_load": + + if (this.page == 1) { + this.table.rowManager.setData(data[this.dataReceivedNames.data], false, this.initialLoad && this.page == 1); + } else { + this.table.rowManager.addRows(data[this.dataReceivedNames.data]); + } + + if (this.page < this.max) { + setTimeout(function () { + self.nextPage().then(function () {}).catch(function () {}); + }, self.table.options.ajaxProgressiveLoadDelay); + } + break; + + case "progressive_scroll": + data = this.table.rowManager.getData().concat(data[this.dataReceivedNames.data]); + + this.table.rowManager.setData(data, true, this.initialLoad && this.page == 1); + + margin = this.table.options.ajaxProgressiveLoadScrollMargin || this.table.rowManager.element.clientHeight * 2; + + if (self.table.rowManager.element.scrollHeight <= self.table.rowManager.element.clientHeight + margin) { + self.nextPage().then(function () {}).catch(function () {}); + } + break; + } + } else { + left = this.table.rowManager.scrollLeft; + + this.table.rowManager.setData(data[this.dataReceivedNames.data], false, this.initialLoad && this.page == 1); + + this.table.rowManager.scrollHorizontal(left); + + this.table.columnManager.scrollHorizontal(left); + + this.table.options.pageLoaded.call(this.table, this.getPage()); + } + + this.initialLoad = false; + } else { + console.warn("Remote Pagination Error - Server response missing '" + this.dataReceivedNames.data + "' property"); + } +}; + +//handle the footer element being redrawn +Page.prototype.footerRedraw = function () { + var footer = this.table.footerManager.element; + + if (Math.ceil(footer.clientWidth) - footer.scrollWidth < 0) { + this.pagesElement.style.display = 'none'; + } else { + this.pagesElement.style.display = ''; + + if (Math.ceil(footer.clientWidth) - footer.scrollWidth < 0) { + this.pagesElement.style.display = 'none'; + } + } +}; + +//set the paramter names for pagination requests +Page.prototype.paginationDataSentNames = { + "page": "page", + "size": "size", + "sorters": "sorters", + // "sort_dir":"sort_dir", + "filters": "filters" + // "filter_value":"filter_value", + // "filter_type":"filter_type", +}; + +//set the property names for pagination responses +Page.prototype.paginationDataReceivedNames = { + "current_page": "current_page", + "last_page": "last_page", + "data": "data" +}; + +Tabulator.prototype.registerModule("page", Page); + +var Persistence = function Persistence(table) { + this.table = table; //hold Tabulator object + this.mode = ""; + this.id = ""; + // this.persistProps = ["field", "width", "visible"]; + this.defWatcherBlock = false; + this.config = {}; + this.readFunc = false; + this.writeFunc = false; +}; + +// Test for whether localStorage is available for use. +Persistence.prototype.localStorageTest = function () { + var testKey = "_tabulator_test"; + + try { + window.localStorage.setItem(testKey, testKey); + window.localStorage.removeItem(testKey); + return true; + } catch (e) { + return false; + } +}; + +//setup parameters +Persistence.prototype.initialize = function () { + //determine persistent layout storage type + + var mode = this.table.options.persistenceMode, + id = this.table.options.persistenceID, + retreivedData; + + this.mode = mode !== true ? mode : this.localStorageTest() ? "local" : "cookie"; + + if (this.table.options.persistenceReaderFunc) { + if (typeof this.table.options.persistenceReaderFunc === "function") { + this.readFunc = this.table.options.persistenceReaderFunc; + } else { + if (this.readers[this.table.options.persistenceReaderFunc]) { + this.readFunc = this.readers[this.table.options.persistenceReaderFunc]; + } else { + console.warn("Persistence Read Error - invalid reader set", this.table.options.persistenceReaderFunc); + } + } + } else { + if (this.readers[this.mode]) { + this.readFunc = this.readers[this.mode]; + } else { + console.warn("Persistence Read Error - invalid reader set", this.mode); + } + } + + if (this.table.options.persistenceWriterFunc) { + if (typeof this.table.options.persistenceWriterFunc === "function") { + this.writeFunc = this.table.options.persistenceWriterFunc; + } else { + if (this.readers[this.table.options.persistenceWriterFunc]) { + this.writeFunc = this.readers[this.table.options.persistenceWriterFunc]; + } else { + console.warn("Persistence Write Error - invalid reader set", this.table.options.persistenceWriterFunc); + } + } + } else { + if (this.writers[this.mode]) { + this.writeFunc = this.writers[this.mode]; + } else { + console.warn("Persistence Write Error - invalid writer set", this.mode); + } + } + + //set storage tag + this.id = "tabulator-" + (id || this.table.element.getAttribute("id") || ""); + + this.config = { + sort: this.table.options.persistence === true || this.table.options.persistence.sort, + filter: this.table.options.persistence === true || this.table.options.persistence.filter, + group: this.table.options.persistence === true || this.table.options.persistence.group, + page: this.table.options.persistence === true || this.table.options.persistence.page, + columns: this.table.options.persistence === true ? ["title", "width", "visible"] : this.table.options.persistence.columns + }; + + //load pagination data if needed + if (this.config.page) { + retreivedData = this.retreiveData("page"); + + if (retreivedData) { + if (typeof retreivedData.paginationSize !== "undefined" && (this.config.page === true || this.config.page.size)) { + this.table.options.paginationSize = retreivedData.paginationSize; + } + + if (typeof retreivedData.paginationInitialPage !== "undefined" && (this.config.page === true || this.config.page.page)) { + this.table.options.paginationInitialPage = retreivedData.paginationInitialPage; + } + } + } + + //load group data if needed + if (this.config.group) { + retreivedData = this.retreiveData("group"); + + if (retreivedData) { + if (typeof retreivedData.groupBy !== "undefined" && (this.config.group === true || this.config.group.groupBy)) { + this.table.options.groupBy = retreivedData.groupBy; + } + if (typeof retreivedData.groupStartOpen !== "undefined" && (this.config.group === true || this.config.group.groupStartOpen)) { + this.table.options.groupStartOpen = retreivedData.groupStartOpen; + } + if (typeof retreivedData.groupHeader !== "undefined" && (this.config.group === true || this.config.group.groupHeader)) { + this.table.options.groupHeader = retreivedData.groupHeader; + } + } + } +}; + +Persistence.prototype.initializeColumn = function (column) { + var self = this, + def, + keys; + + if (this.config.columns) { + this.defWatcherBlock = true; + + def = column.getDefinition(); + + keys = this.config.columns === true ? Object.keys(def) : this.config.columns; + + keys.forEach(function (key) { + var props = Object.getOwnPropertyDescriptor(def, key); + var value = def[key]; + if (props) { + Object.defineProperty(def, key, { + set: function set(newValue) { + value = newValue; + + if (!self.defWatcherBlock) { + self.save("columns"); + } + + if (props.set) { + props.set(newValue); + } + }, + get: function get() { + if (props.get) { + props.get(); + } + return value; + } + }); + } + }); + + this.defWatcherBlock = false; + } +}; + +//load saved definitions +Persistence.prototype.load = function (type, current) { + var data = this.retreiveData(type); + + if (current) { + data = data ? this.mergeDefinition(current, data) : current; + } + + return data; +}; + +//retreive data from memory +Persistence.prototype.retreiveData = function (type) { + return this.readFunc ? this.readFunc(this.id, type) : false; +}; + +//merge old and new column definitions +Persistence.prototype.mergeDefinition = function (oldCols, newCols) { + var self = this, + output = []; + + // oldCols = oldCols || []; + newCols = newCols || []; + + newCols.forEach(function (column, to) { + + var from = self._findColumn(oldCols, column), + keys; + + if (from) { + + if (self.config.columns === true || self.config.columns == undefined) { + keys = Object.keys(from); + keys.push("width"); + } else { + keys = self.config.columns; + } + + keys.forEach(function (key) { + if (typeof column[key] !== "undefined") { + from[key] = column[key]; + } + }); + + if (from.columns) { + from.columns = self.mergeDefinition(from.columns, column.columns); + } + + output.push(from); + } + }); + + oldCols.forEach(function (column, i) { + var from = self._findColumn(newCols, column); + if (!from) { + if (output.length > i) { + output.splice(i, 0, column); + } else { + output.push(column); + } + } + }); + + return output; +}; + +//find matching columns +Persistence.prototype._findColumn = function (columns, subject) { + var type = subject.columns ? "group" : subject.field ? "field" : "object"; + + return columns.find(function (col) { + switch (type) { + case "group": + return col.title === subject.title && col.columns.length === subject.columns.length; + break; + + case "field": + return col.field === subject.field; + break; + + case "object": + return col === subject; + break; + } + }); +}; + +//save data +Persistence.prototype.save = function (type) { + var data = {}; + + switch (type) { + case "columns": + data = this.parseColumns(this.table.columnManager.getColumns()); + break; + + case "filter": + data = this.table.modules.filter.getFilters(); + break; + + case "sort": + data = this.validateSorters(this.table.modules.sort.getSort()); + break; + + case "group": + data = this.getGroupConfig(); + break; + + case "page": + data = this.getPageConfig(); + break; + } + + if (this.writeFunc) { + this.writeFunc(this.id, type, data); + } +}; + +//ensure sorters contain no function data +Persistence.prototype.validateSorters = function (data) { + data.forEach(function (item) { + item.column = item.field; + delete item.field; + }); + + return data; +}; + +Persistence.prototype.getGroupConfig = function () { + var data = {}; + + if (this.config.group) { + if (this.config.group === true || this.config.group.groupBy) { + data.groupBy = this.table.options.groupBy; + } + + if (this.config.group === true || this.config.group.groupStartOpen) { + data.groupStartOpen = this.table.options.groupStartOpen; + } + + if (this.config.group === true || this.config.group.groupHeader) { + data.groupHeader = this.table.options.groupHeader; + } + } + + return data; +}; + +Persistence.prototype.getPageConfig = function () { + var data = {}; + + if (this.config.page) { + if (this.config.page === true || this.config.page.size) { + data.paginationSize = this.table.modules.page.getPageSize(); + } + + if (this.config.page === true || this.config.page.page) { + data.paginationInitialPage = this.table.modules.page.getPage(); + } + } + + return data; +}; + +//parse columns for data to store +Persistence.prototype.parseColumns = function (columns) { + var self = this, + definitions = [], + excludedKeys = ["headerContextMenu", "headerMenu", "contextMenu", "clickMenu"]; + + columns.forEach(function (column) { + var defStore = {}, + colDef = column.getDefinition(), + keys; + + if (column.isGroup) { + defStore.title = colDef.title; + defStore.columns = self.parseColumns(column.getColumns()); + } else { + defStore.field = column.getField(); + + if (self.config.columns === true || self.config.columns == undefined) { + keys = Object.keys(colDef); + keys.push("width"); + } else { + keys = self.config.columns; + } + + keys.forEach(function (key) { + + switch (key) { + case "width": + defStore.width = column.getWidth(); + break; + case "visible": + defStore.visible = column.visible; + break; + + default: + if (typeof colDef[key] !== "function" && excludedKeys.indexOf(key) === -1) { + defStore[key] = colDef[key]; + } + } + }); + } + + definitions.push(defStore); + }); + + return definitions; +}; + +// read peristence information from storage +Persistence.prototype.readers = { + local: function local(id, type) { + var data = localStorage.getItem(id + "-" + type); + + return data ? JSON.parse(data) : false; + }, + cookie: function cookie(id, type) { + var cookie = document.cookie, + key = id + "-" + type, + cookiePos = cookie.indexOf(key + "="), + end, + data; + + //if cookie exists, decode and load column data into tabulator + if (cookiePos > -1) { + cookie = cookie.substr(cookiePos); + + end = cookie.indexOf(";"); + + if (end > -1) { + cookie = cookie.substr(0, end); + } + + data = cookie.replace(key + "=", ""); + } + + return data ? JSON.parse(data) : false; + } +}; + +//write persistence information to storage +Persistence.prototype.writers = { + local: function local(id, type, data) { + localStorage.setItem(id + "-" + type, JSON.stringify(data)); + }, + cookie: function cookie(id, type, data) { + var expireDate = new Date(); + + expireDate.setDate(expireDate.getDate() + 10000); + + document.cookie = id + "-" + type + "=" + JSON.stringify(data) + "; expires=" + expireDate.toUTCString(); + } +}; + +Tabulator.prototype.registerModule("persistence", Persistence); + +var Print = function Print(table) { + this.table = table; //hold Tabulator object + this.element = false; + this.manualBlock = false; +}; + +Print.prototype.initialize = function () { + window.addEventListener("beforeprint", this.replaceTable.bind(this)); + window.addEventListener("afterprint", this.cleanup.bind(this)); +}; + +Print.prototype.replaceTable = function () { + if (!this.manualBlock) { + this.element = document.createElement("div"); + this.element.classList.add("tabulator-print-table"); + + this.element.appendChild(this.table.modules.export.genereateTable(this.table.options.printConfig, this.table.options.printStyled, this.table.options.printRowRange, "print")); + + this.table.element.style.display = "none"; + + this.table.element.parentNode.insertBefore(this.element, this.table.element); + } +}; + +Print.prototype.cleanup = function () { + document.body.classList.remove("tabulator-print-fullscreen-hide"); + + if (this.element && this.element.parentNode) { + this.element.parentNode.removeChild(this.element); + this.table.element.style.display = ""; + } +}; + +Print.prototype.printFullscreen = function (visible, style, config) { + var scrollX = window.scrollX, + scrollY = window.scrollY, + headerEl = document.createElement("div"), + footerEl = document.createElement("div"), + tableEl = this.table.modules.export.genereateTable(typeof config != "undefined" ? config : this.table.options.printConfig, typeof style != "undefined" ? style : this.table.options.printStyled, visible, "print"), + headerContent, + footerContent; + + this.manualBlock = true; + + this.element = document.createElement("div"); + this.element.classList.add("tabulator-print-fullscreen"); + + if (this.table.options.printHeader) { + headerEl.classList.add("tabulator-print-header"); + + headerContent = typeof this.table.options.printHeader == "function" ? this.table.options.printHeader.call(this.table) : this.table.options.printHeader; + + if (typeof headerContent == "string") { + headerEl.innerHTML = headerContent; + } else { + headerEl.appendChild(headerContent); + } + + this.element.appendChild(headerEl); + } + + this.element.appendChild(tableEl); + + if (this.table.options.printFooter) { + footerEl.classList.add("tabulator-print-footer"); + + footerContent = typeof this.table.options.printFooter == "function" ? this.table.options.printFooter.call(this.table) : this.table.options.printFooter; + + if (typeof footerContent == "string") { + footerEl.innerHTML = footerContent; + } else { + footerEl.appendChild(footerContent); + } + + this.element.appendChild(footerEl); + } + + document.body.classList.add("tabulator-print-fullscreen-hide"); + document.body.appendChild(this.element); + + if (this.table.options.printFormatter) { + this.table.options.printFormatter(this.element, tableEl); + } + + window.print(); + + this.cleanup(); + + window.scrollTo(scrollX, scrollY); + + this.manualBlock = false; +}; + +Tabulator.prototype.registerModule("print", Print); +var ReactiveData = function ReactiveData(table) { + this.table = table; //hold Tabulator object + this.data = false; + this.blocked = false; //block reactivity while performing update + this.origFuncs = {}; // hold original data array functions to allow replacement after data is done with + this.currentVersion = 0; +}; + +ReactiveData.prototype.watchData = function (data) { + var self = this, + pushFunc, + version; + + this.currentVersion++; + + version = this.currentVersion; + + self.unwatchData(); + + self.data = data; + + //override array push function + self.origFuncs.push = data.push; + + Object.defineProperty(self.data, "push", { + enumerable: false, + configurable: true, + value: function value() { + var args = Array.from(arguments); + + if (!self.blocked && version === self.currentVersion) { + args.forEach(function (arg) { + self.table.rowManager.addRowActual(arg, false); + }); + } + + return self.origFuncs.push.apply(data, arguments); + } + }); + + //override array unshift function + self.origFuncs.unshift = data.unshift; + + Object.defineProperty(self.data, "unshift", { + enumerable: false, + configurable: true, + value: function value() { + var args = Array.from(arguments); + + if (!self.blocked && version === self.currentVersion) { + args.forEach(function (arg) { + self.table.rowManager.addRowActual(arg, true); + }); + } + + return self.origFuncs.unshift.apply(data, arguments); + } + }); + + //override array shift function + self.origFuncs.shift = data.shift; + + Object.defineProperty(self.data, "shift", { + enumerable: false, + configurable: true, + value: function value() { + var row; + + if (!self.blocked && version === self.currentVersion) { + if (self.data.length) { + row = self.table.rowManager.getRowFromDataObject(self.data[0]); + + if (row) { + row.deleteActual(); + } + } + } + + return self.origFuncs.shift.call(data); + } + }); + + //override array pop function + self.origFuncs.pop = data.pop; + + Object.defineProperty(self.data, "pop", { + enumerable: false, + configurable: true, + value: function value() { + var row; + if (!self.blocked && version === self.currentVersion) { + if (self.data.length) { + row = self.table.rowManager.getRowFromDataObject(self.data[self.data.length - 1]); + + if (row) { + row.deleteActual(); + } + } + } + return self.origFuncs.pop.call(data); + } + }); + + //override array splice function + self.origFuncs.splice = data.splice; + + Object.defineProperty(self.data, "splice", { + enumerable: false, + configurable: true, + value: function value() { + var args = Array.from(arguments), + start = args[0] < 0 ? data.length + args[0] : args[0], + end = args[1], + newRows = args[2] ? args.slice(2) : false, + startRow; + + if (!self.blocked && version === self.currentVersion) { + + //add new rows + if (newRows) { + startRow = data[start] ? self.table.rowManager.getRowFromDataObject(data[start]) : false; + + if (startRow) { + newRows.forEach(function (rowData) { + self.table.rowManager.addRowActual(rowData, true, startRow, true); + }); + } else { + newRows = newRows.slice().reverse(); + + newRows.forEach(function (rowData) { + self.table.rowManager.addRowActual(rowData, true, false, true); + }); + } + } + + //delete removed rows + if (end !== 0) { + var oldRows = data.slice(start, typeof args[1] === "undefined" ? args[1] : start + end); + + oldRows.forEach(function (rowData, i) { + var row = self.table.rowManager.getRowFromDataObject(rowData); + + if (row) { + row.deleteActual(i !== oldRows.length - 1); + } + }); + } + + if (newRows || end !== 0) { + self.table.rowManager.reRenderInPosition(); + } + } + + return self.origFuncs.splice.apply(data, arguments); + } + }); +}; + +ReactiveData.prototype.unwatchData = function () { + if (this.data !== false) { + for (var key in this.origFuncs) { + Object.defineProperty(this.data, key, { + enumerable: true, + configurable: true, + writable: true, + value: this.origFuncs.key + }); + } + } +}; + +ReactiveData.prototype.watchRow = function (row) { + var data = row.getData(); + + this.blocked = true; + + for (var key in data) { + this.watchKey(row, data, key); + } + + if (this.table.options.dataTree) { + this.watchTreeChildren(row); + } + + this.blocked = false; +}; + +ReactiveData.prototype.watchTreeChildren = function (row) { + var self = this, + childField = row.getData()[this.table.options.dataTreeChildField], + origFuncs = {}; + + function rebuildTree() { + self.table.modules.dataTree.initializeRow(row); + self.table.modules.dataTree.layoutRow(row); + self.table.rowManager.refreshActiveData("tree", false, true); + } + + if (childField) { + + origFuncs.push = childField.push; + + Object.defineProperty(childField, "push", { + enumerable: false, + configurable: true, + value: function value() { + var result = origFuncs.push.apply(childField, arguments); + + rebuildTree(); + + return result; + } + }); + + origFuncs.unshift = childField.unshift; + + Object.defineProperty(childField, "unshift", { + enumerable: false, + configurable: true, + value: function value() { + var result = origFuncs.unshift.apply(childField, arguments); + + rebuildTree(); + + return result; + } + }); + + origFuncs.shift = childField.shift; + + Object.defineProperty(childField, "shift", { + enumerable: false, + configurable: true, + value: function value() { + var result = origFuncs.shift.call(childField); + + rebuildTree(); + + return result; + } + }); + + origFuncs.pop = childField.pop; + + Object.defineProperty(childField, "pop", { + enumerable: false, + configurable: true, + value: function value() { + var result = origFuncs.pop.call(childField); + + rebuildTree(); + + return result; + } + }); + + origFuncs.splice = childField.splice; + + Object.defineProperty(childField, "splice", { + enumerable: false, + configurable: true, + value: function value() { + var result = origFuncs.splice.apply(childField, arguments); + + rebuildTree(); + + return result; + } + }); + } +}; + +ReactiveData.prototype.watchKey = function (row, data, key) { + var self = this, + props = Object.getOwnPropertyDescriptor(data, key), + value = data[key], + version = this.currentVersion; + + Object.defineProperty(data, key, { + set: function set(newValue) { + value = newValue; + if (!self.blocked && version === self.currentVersion) { + var update = {}; + update[key] = newValue; + row.updateData(update); + } + + if (props.set) { + props.set(newValue); + } + }, + get: function get() { + + if (props.get) { + props.get(); + } + + return value; + } + }); +}; + +ReactiveData.prototype.unwatchRow = function (row) { + var data = row.getData(); + + for (var key in data) { + Object.defineProperty(data, key, { + value: data[key] + }); + } +}; + +ReactiveData.prototype.block = function () { + this.blocked = true; +}; + +ReactiveData.prototype.unblock = function () { + this.blocked = false; +}; + +Tabulator.prototype.registerModule("reactiveData", ReactiveData); + +var ResizeColumns = function ResizeColumns(table) { + this.table = table; //hold Tabulator object + this.startColumn = false; + this.startX = false; + this.startWidth = false; + this.handle = null; + this.prevHandle = null; +}; + +ResizeColumns.prototype.initializeColumn = function (type, column, element) { + var self = this, + variableHeight = false, + mode = this.table.options.resizableColumns; + + //set column resize mode + if (type === "header") { + variableHeight = column.definition.formatter == "textarea" || column.definition.variableHeight; + column.modules.resize = { variableHeight: variableHeight }; + } + + if (mode === true || mode == type) { + + var handle = document.createElement('div'); + handle.className = "tabulator-col-resize-handle"; + + var prevHandle = document.createElement('div'); + prevHandle.className = "tabulator-col-resize-handle prev"; + + handle.addEventListener("click", function (e) { + e.stopPropagation(); + }); + + var handleDown = function handleDown(e) { + var nearestColumn = column.getLastColumn(); + + if (nearestColumn && self._checkResizability(nearestColumn)) { + self.startColumn = column; + self._mouseDown(e, nearestColumn, handle); + } + }; + + handle.addEventListener("mousedown", handleDown); + handle.addEventListener("touchstart", handleDown, { passive: true }); + + //reszie column on double click + handle.addEventListener("dblclick", function (e) { + var col = column.getLastColumn(); + + if (col && self._checkResizability(col)) { + e.stopPropagation(); + col.reinitializeWidth(true); + } + }); + + prevHandle.addEventListener("click", function (e) { + e.stopPropagation(); + }); + + var prevHandleDown = function prevHandleDown(e) { + var nearestColumn, colIndex, prevColumn; + + nearestColumn = column.getFirstColumn(); + + if (nearestColumn) { + colIndex = self.table.columnManager.findColumnIndex(nearestColumn); + prevColumn = colIndex > 0 ? self.table.columnManager.getColumnByIndex(colIndex - 1) : false; + + if (prevColumn && self._checkResizability(prevColumn)) { + self.startColumn = column; + self._mouseDown(e, prevColumn, prevHandle); + } + } + }; + + prevHandle.addEventListener("mousedown", prevHandleDown); + prevHandle.addEventListener("touchstart", prevHandleDown, { passive: true }); + + //resize column on double click + prevHandle.addEventListener("dblclick", function (e) { + var nearestColumn, colIndex, prevColumn; + + nearestColumn = column.getFirstColumn(); + + if (nearestColumn) { + colIndex = self.table.columnManager.findColumnIndex(nearestColumn); + prevColumn = colIndex > 0 ? self.table.columnManager.getColumnByIndex(colIndex - 1) : false; + + if (prevColumn && self._checkResizability(prevColumn)) { + e.stopPropagation(); + prevColumn.reinitializeWidth(true); + } + } + }); + + element.appendChild(handle); + element.appendChild(prevHandle); + } +}; + +ResizeColumns.prototype._checkResizability = function (column) { + return typeof column.definition.resizable != "undefined" ? column.definition.resizable : this.table.options.resizableColumns; +}; + +ResizeColumns.prototype._mouseDown = function (e, column, handle) { + var self = this; + + self.table.element.classList.add("tabulator-block-select"); + + function mouseMove(e) { + // self.table.columnManager.tempScrollBlock(); + + if (self.table.rtl) { + column.setWidth(self.startWidth - ((typeof e.screenX === "undefined" ? e.touches[0].screenX : e.screenX) - self.startX)); + } else { + column.setWidth(self.startWidth + ((typeof e.screenX === "undefined" ? e.touches[0].screenX : e.screenX) - self.startX)); + } + + if (self.table.options.virtualDomHoz) { + self.table.vdomHoz.reinitialize(true); + } + + if (!self.table.browserSlow && column.modules.resize && column.modules.resize.variableHeight) { + column.checkCellHeights(); + } + } + + function mouseUp(e) { + + //block editor from taking action while resizing is taking place + if (self.startColumn.modules.edit) { + self.startColumn.modules.edit.blocked = false; + } + + if (self.table.browserSlow && column.modules.resize && column.modules.resize.variableHeight) { + column.checkCellHeights(); + } + + document.body.removeEventListener("mouseup", mouseUp); + document.body.removeEventListener("mousemove", mouseMove); + + handle.removeEventListener("touchmove", mouseMove); + handle.removeEventListener("touchend", mouseUp); + + self.table.element.classList.remove("tabulator-block-select"); + + if (self.table.options.persistence && self.table.modExists("persistence", true) && self.table.modules.persistence.config.columns) { + self.table.modules.persistence.save("columns"); + } + + self.table.options.columnResized.call(self.table, column.getComponent()); + } + + e.stopPropagation(); //prevent resize from interfereing with movable columns + + //block editor from taking action while resizing is taking place + if (self.startColumn.modules.edit) { + self.startColumn.modules.edit.blocked = true; + } + + self.startX = typeof e.screenX === "undefined" ? e.touches[0].screenX : e.screenX; + self.startWidth = column.getWidth(); + + document.body.addEventListener("mousemove", mouseMove); + document.body.addEventListener("mouseup", mouseUp); + handle.addEventListener("touchmove", mouseMove, { passive: true }); + handle.addEventListener("touchend", mouseUp); +}; + +Tabulator.prototype.registerModule("resizeColumns", ResizeColumns); +var ResizeRows = function ResizeRows(table) { + this.table = table; //hold Tabulator object + this.startColumn = false; + this.startY = false; + this.startHeight = false; + this.handle = null; + this.prevHandle = null; +}; + +ResizeRows.prototype.initializeRow = function (row) { + var self = this, + rowEl = row.getElement(); + + var handle = document.createElement('div'); + handle.className = "tabulator-row-resize-handle"; + + var prevHandle = document.createElement('div'); + prevHandle.className = "tabulator-row-resize-handle prev"; + + handle.addEventListener("click", function (e) { + e.stopPropagation(); + }); + + var handleDown = function handleDown(e) { + self.startRow = row; + self._mouseDown(e, row, handle); + }; + + handle.addEventListener("mousedown", handleDown); + handle.addEventListener("touchstart", handleDown, { passive: true }); + + prevHandle.addEventListener("click", function (e) { + e.stopPropagation(); + }); + + var prevHandleDown = function prevHandleDown(e) { + var prevRow = self.table.rowManager.prevDisplayRow(row); + + if (prevRow) { + self.startRow = prevRow; + self._mouseDown(e, prevRow, prevHandle); + } + }; + + prevHandle.addEventListener("mousedown", prevHandleDown); + prevHandle.addEventListener("touchstart", prevHandleDown, { passive: true }); + + rowEl.appendChild(handle); + rowEl.appendChild(prevHandle); +}; + +ResizeRows.prototype._mouseDown = function (e, row, handle) { + var self = this; + + self.table.element.classList.add("tabulator-block-select"); + + function mouseMove(e) { + row.setHeight(self.startHeight + ((typeof e.screenY === "undefined" ? e.touches[0].screenY : e.screenY) - self.startY)); + } + + function mouseUp(e) { + + // //block editor from taking action while resizing is taking place + // if(self.startColumn.modules.edit){ + // self.startColumn.modules.edit.blocked = false; + // } + + document.body.removeEventListener("mouseup", mouseMove); + document.body.removeEventListener("mousemove", mouseMove); + + handle.removeEventListener("touchmove", mouseMove); + handle.removeEventListener("touchend", mouseUp); + + self.table.element.classList.remove("tabulator-block-select"); + + self.table.options.rowResized.call(this.table, row.getComponent()); + } + + e.stopPropagation(); //prevent resize from interfereing with movable columns + + //block editor from taking action while resizing is taking place + // if(self.startColumn.modules.edit){ + // self.startColumn.modules.edit.blocked = true; + // } + + self.startY = typeof e.screenY === "undefined" ? e.touches[0].screenY : e.screenY; + self.startHeight = row.getHeight(); + + document.body.addEventListener("mousemove", mouseMove); + document.body.addEventListener("mouseup", mouseUp); + + handle.addEventListener("touchmove", mouseMove, { passive: true }); + handle.addEventListener("touchend", mouseUp); +}; + +Tabulator.prototype.registerModule("resizeRows", ResizeRows); +var ResizeTable = function ResizeTable(table) { + this.table = table; //hold Tabulator object + this.binding = false; + this.observer = false; + this.containerObserver = false; + + this.tableHeight = 0; + this.tableWidth = 0; + this.containerHeight = 0; + this.containerWidth = 0; + + this.autoResize = false; +}; + +ResizeTable.prototype.initialize = function (row) { + var _this82 = this; + + var table = this.table, + tableStyle; + + this.tableHeight = table.element.clientHeight; + this.tableWidth = table.element.clientWidth; + + if (table.element.parentNode) { + this.containerHeight = table.element.parentNode.clientHeight; + this.containerWidth = table.element.parentNode.clientWidth; + } + + if (typeof ResizeObserver !== "undefined" && table.rowManager.getRenderMode() === "virtual") { + + this.autoResize = true; + + this.observer = new ResizeObserver(function (entry) { + if (!table.browserMobile || table.browserMobile && !table.modules.edit.currentCell) { + + var nodeHeight = Math.floor(entry[0].contentRect.height); + var nodeWidth = Math.floor(entry[0].contentRect.width); + + if (_this82.tableHeight != nodeHeight || _this82.tableWidth != nodeWidth) { + _this82.tableHeight = nodeHeight; + _this82.tableWidth = nodeWidth; + + if (table.element.parentNode) { + _this82.containerHeight = table.element.parentNode.clientHeight; + _this82.containerWidth = table.element.parentNode.clientWidth; + } + + if (table.options.virtualDomHoz) { + table.vdomHoz.reinitialize(true); + } + + table.redraw(); + } + } + }); + + this.observer.observe(table.element); + + tableStyle = window.getComputedStyle(table.element); + + if (this.table.element.parentNode && !this.table.rowManager.fixedHeight && (tableStyle.getPropertyValue("max-height") || tableStyle.getPropertyValue("min-height"))) { + + this.containerObserver = new ResizeObserver(function (entry) { + if (!table.browserMobile || table.browserMobile && !table.modules.edit.currentCell) { + + var nodeHeight = Math.floor(entry[0].contentRect.height); + var nodeWidth = Math.floor(entry[0].contentRect.width); + + if (_this82.containerHeight != nodeHeight || _this82.containerWidth != nodeWidth) { + _this82.containerHeight = nodeHeight; + _this82.containerWidth = nodeWidth; + _this82.tableHeight = table.element.clientHeight; + _this82.tableWidth = table.element.clientWidth; + } + + if (table.options.virtualDomHoz) { + table.vdomHoz.reinitialize(true); + } + + table.redraw(); + } + }); + + this.containerObserver.observe(this.table.element.parentNode); + } + } else { + this.binding = function () { + if (!table.browserMobile || table.browserMobile && !table.modules.edit.currentCell) { + if (table.options.virtualDomHoz) { + table.vdomHoz.reinitialize(true); + } + + table.redraw(); + } + }; + + window.addEventListener("resize", this.binding); + } +}; + +ResizeTable.prototype.clearBindings = function (row) { + if (this.binding) { + window.removeEventListener("resize", this.binding); + } + + if (this.observer) { + this.observer.unobserve(this.table.element); + } + + if (this.containerObserver) { + this.containerObserver.unobserve(this.table.element.parentNode); + } +}; + +Tabulator.prototype.registerModule("resizeTable", ResizeTable); +var ResponsiveLayout = function ResponsiveLayout(table) { + this.table = table; //hold Tabulator object + this.columns = []; + this.hiddenColumns = []; + this.mode = ""; + this.index = 0; + this.collapseFormatter = []; + this.collapseStartOpen = true; + this.collapseHandleColumn = false; +}; + +//generate resposive columns list +ResponsiveLayout.prototype.initialize = function () { + var self = this, + columns = []; + + this.mode = this.table.options.responsiveLayout; + this.collapseFormatter = this.table.options.responsiveLayoutCollapseFormatter || this.formatCollapsedData; + this.collapseStartOpen = this.table.options.responsiveLayoutCollapseStartOpen; + this.hiddenColumns = []; + + //detemine level of responsivity for each column + this.table.columnManager.columnsByIndex.forEach(function (column, i) { + if (column.modules.responsive) { + if (column.modules.responsive.order && column.modules.responsive.visible) { + column.modules.responsive.index = i; + columns.push(column); + + if (!column.visible && self.mode === "collapse") { + self.hiddenColumns.push(column); + } + } + } + }); + + //sort list by responsivity + columns = columns.reverse(); + columns = columns.sort(function (a, b) { + var diff = b.modules.responsive.order - a.modules.responsive.order; + return diff || b.modules.responsive.index - a.modules.responsive.index; + }); + + this.columns = columns; + + if (this.mode === "collapse") { + this.generateCollapsedContent(); + } + + //assign collapse column + for (var _iterator = this.table.columnManager.columnsByIndex, _isArray = Array.isArray(_iterator), _i16 = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) { + var _ref; + + if (_isArray) { + if (_i16 >= _iterator.length) break; + _ref = _iterator[_i16++]; + } else { + _i16 = _iterator.next(); + if (_i16.done) break; + _ref = _i16.value; + } + + var col = _ref; + + if (col.definition.formatter == "responsiveCollapse") { + this.collapseHandleColumn = col; + break; + } + } + + if (this.collapseHandleColumn) { + if (this.hiddenColumns.length) { + this.collapseHandleColumn.show(); + } else { + this.collapseHandleColumn.hide(); + } + } +}; + +//define layout information +ResponsiveLayout.prototype.initializeColumn = function (column) { + var def = column.getDefinition(); + + column.modules.responsive = { order: typeof def.responsive === "undefined" ? 1 : def.responsive, visible: def.visible === false ? false : true }; +}; + +ResponsiveLayout.prototype.initializeRow = function (row) { + var el; + + if (row.type !== "calc") { + el = document.createElement("div"); + el.classList.add("tabulator-responsive-collapse"); + + row.modules.responsiveLayout = { + element: el, + open: this.collapseStartOpen + }; + + if (!this.collapseStartOpen) { + el.style.display = 'none'; + } + } +}; + +ResponsiveLayout.prototype.layoutRow = function (row) { + var rowEl = row.getElement(); + + if (row.modules.responsiveLayout) { + rowEl.appendChild(row.modules.responsiveLayout.element); + this.generateCollapsedRowContent(row); + } +}; + +//update column visibility +ResponsiveLayout.prototype.updateColumnVisibility = function (column, visible) { + var index; + if (column.modules.responsive) { + column.modules.responsive.visible = visible; + this.initialize(); + } +}; + +ResponsiveLayout.prototype.hideColumn = function (column) { + var colCount = this.hiddenColumns.length; + + column.hide(false, true); + + if (this.mode === "collapse") { + this.hiddenColumns.unshift(column); + this.generateCollapsedContent(); + + if (this.collapseHandleColumn && !colCount) { + this.collapseHandleColumn.show(); + } + } +}; + +ResponsiveLayout.prototype.showColumn = function (column) { + var index; + + column.show(false, true); + //set column width to prevent calculation loops on uninitialized columns + column.setWidth(column.getWidth()); + + if (this.mode === "collapse") { + index = this.hiddenColumns.indexOf(column); + + if (index > -1) { + this.hiddenColumns.splice(index, 1); + } + + this.generateCollapsedContent(); + + if (this.collapseHandleColumn && !this.hiddenColumns.length) { + this.collapseHandleColumn.hide(); + } + } +}; + +//redraw columns to fit space +ResponsiveLayout.prototype.update = function () { + var self = this, + working = true; + + while (working) { + + var width = self.table.modules.layout.getMode() == "fitColumns" ? self.table.columnManager.getFlexBaseWidth() : self.table.columnManager.getWidth(); + + var diff = (self.table.options.headerVisible ? self.table.columnManager.element.clientWidth : self.table.element.clientWidth) - width; + + if (diff < 0) { + //table is too wide + var column = self.columns[self.index]; + + if (column) { + self.hideColumn(column); + self.index++; + } else { + working = false; + } + } else { + + //table has spare space + var _column = self.columns[self.index - 1]; + + if (_column) { + if (diff > 0) { + if (diff >= _column.getWidth()) { + self.showColumn(_column); + self.index--; + } else { + working = false; + } + } else { + working = false; + } + } else { + working = false; + } + } + + if (!self.table.rowManager.activeRowsCount) { + self.table.rowManager.renderEmptyScroll(); + } + } +}; + +ResponsiveLayout.prototype.generateCollapsedContent = function () { + var self = this, + rows = this.table.rowManager.getDisplayRows(); + + rows.forEach(function (row) { + self.generateCollapsedRowContent(row); + }); +}; + +ResponsiveLayout.prototype.generateCollapsedRowContent = function (row) { + var el, contents; + + if (row.modules.responsiveLayout) { + el = row.modules.responsiveLayout.element; + + while (el.firstChild) { + el.removeChild(el.firstChild); + }contents = this.collapseFormatter(this.generateCollapsedRowData(row)); + if (contents) { + el.appendChild(contents); + } + } +}; + +ResponsiveLayout.prototype.generateCollapsedRowData = function (row) { + var self = this, + data = row.getData(), + output = [], + mockCellComponent; + + this.hiddenColumns.forEach(function (column) { + var value = column.getFieldValue(data); + + if (column.definition.title && column.field) { + if (column.modules.format && self.table.options.responsiveLayoutCollapseUseFormatters) { + + mockCellComponent = { + value: false, + data: {}, + getValue: function getValue() { + return value; + }, + getData: function getData() { + return data; + }, + getElement: function getElement() { + return document.createElement("div"); + }, + getRow: function getRow() { + return row.getComponent(); + }, + getColumn: function getColumn() { + return column.getComponent(); + } + }; + + output.push({ + title: column.definition.title, + value: column.modules.format.formatter.call(self.table.modules.format, mockCellComponent, column.modules.format.params) + }); + } else { + output.push({ + title: column.definition.title, + value: value + }); + } + } + }); + + return output; +}; + +ResponsiveLayout.prototype.formatCollapsedData = function (data) { + var list = document.createElement("table"), + listContents = ""; + + data.forEach(function (item) { + var div = document.createElement("div"); + + if (item.value instanceof Node) { + div.appendChild(item.value); + item.value = div.innerHTML; + } + + listContents += "" + item.title + "" + item.value + ""; + }); + + list.innerHTML = listContents; + + return Object.keys(data).length ? list : ""; +}; + +Tabulator.prototype.registerModule("responsiveLayout", ResponsiveLayout); + +var SelectRow = function SelectRow(table) { + this.table = table; //hold Tabulator object + this.selecting = false; //flag selecting in progress + this.lastClickedRow = false; //last clicked row + this.selectPrev = []; //hold previously selected element for drag drop selection + this.selectedRows = []; //hold selected rows + this.headerCheckboxElement = null; // hold header select element +}; + +SelectRow.prototype.clearSelectionData = function (silent) { + this.selecting = false; + this.lastClickedRow = false; + this.selectPrev = []; + this.selectedRows = []; + + if (!silent) { + this._rowSelectionChanged(); + } +}; + +SelectRow.prototype.initializeRow = function (row) { + var self = this, + element = row.getElement(); + + // trigger end of row selection + var endSelect = function endSelect() { + + setTimeout(function () { + self.selecting = false; + }, 50); + + document.body.removeEventListener("mouseup", endSelect); + }; + + row.modules.select = { selected: false }; + + //set row selection class + if (self.table.options.selectableCheck.call(this.table, row.getComponent())) { + element.classList.add("tabulator-selectable"); + element.classList.remove("tabulator-unselectable"); + + if (self.table.options.selectable && self.table.options.selectable != "highlight") { + if (self.table.options.selectableRangeMode === "click") { + element.addEventListener("click", function (e) { + if (e.shiftKey) { + self.table._clearSelection(); + self.lastClickedRow = self.lastClickedRow || row; + + var lastClickedRowIdx = self.table.rowManager.getDisplayRowIndex(self.lastClickedRow); + var rowIdx = self.table.rowManager.getDisplayRowIndex(row); + + var fromRowIdx = lastClickedRowIdx <= rowIdx ? lastClickedRowIdx : rowIdx; + var toRowIdx = lastClickedRowIdx >= rowIdx ? lastClickedRowIdx : rowIdx; + + var rows = self.table.rowManager.getDisplayRows().slice(0); + var toggledRows = rows.splice(fromRowIdx, toRowIdx - fromRowIdx + 1); + + if (e.ctrlKey || e.metaKey) { + toggledRows.forEach(function (toggledRow) { + if (toggledRow !== self.lastClickedRow) { + + if (self.table.options.selectable !== true && !self.isRowSelected(row)) { + if (self.selectedRows.length < self.table.options.selectable) { + self.toggleRow(toggledRow); + } + } else { + self.toggleRow(toggledRow); + } + } + }); + self.lastClickedRow = row; + } else { + self.deselectRows(undefined, true); + + if (self.table.options.selectable !== true) { + if (toggledRows.length > self.table.options.selectable) { + toggledRows = toggledRows.slice(0, self.table.options.selectable); + } + } + + self.selectRows(toggledRows); + } + self.table._clearSelection(); + } else if (e.ctrlKey || e.metaKey) { + self.toggleRow(row); + self.lastClickedRow = row; + } else { + self.deselectRows(undefined, true); + self.selectRows(row); + self.lastClickedRow = row; + } + }); + } else { + element.addEventListener("click", function (e) { + if (!self.table.modExists("edit") || !self.table.modules.edit.getCurrentCell()) { + self.table._clearSelection(); + } + + if (!self.selecting) { + self.toggleRow(row); + } + }); + + element.addEventListener("mousedown", function (e) { + if (e.shiftKey) { + self.table._clearSelection(); + + self.selecting = true; + + self.selectPrev = []; + + document.body.addEventListener("mouseup", endSelect); + document.body.addEventListener("keyup", endSelect); + + self.toggleRow(row); + + return false; + } + }); + + element.addEventListener("mouseenter", function (e) { + if (self.selecting) { + self.table._clearSelection(); + self.toggleRow(row); + + if (self.selectPrev[1] == row) { + self.toggleRow(self.selectPrev[0]); + } + } + }); + + element.addEventListener("mouseout", function (e) { + if (self.selecting) { + self.table._clearSelection(); + self.selectPrev.unshift(row); + } + }); + } + } + } else { + element.classList.add("tabulator-unselectable"); + element.classList.remove("tabulator-selectable"); + } +}; + +//toggle row selection +SelectRow.prototype.toggleRow = function (row) { + if (this.table.options.selectableCheck.call(this.table, row.getComponent())) { + if (row.modules.select && row.modules.select.selected) { + this._deselectRow(row); + } else { + this._selectRow(row); + } + } +}; + +//select a number of rows +SelectRow.prototype.selectRows = function (rows) { + var _this83 = this; + + var rowMatch; + + switch (typeof rows === 'undefined' ? 'undefined' : _typeof(rows)) { + case "undefined": + this.table.rowManager.rows.forEach(function (row) { + _this83._selectRow(row, true, true); + }); + + this._rowSelectionChanged(); + break; + + case "string": + + rowMatch = this.table.rowManager.findRow(rows); + + if (rowMatch) { + this._selectRow(rowMatch, true, true); + } else { + this.table.rowManager.getRows(rows).forEach(function (row) { + _this83._selectRow(row, true, true); + }); + } + + this._rowSelectionChanged(); + break; + + default: + if (Array.isArray(rows)) { + rows.forEach(function (row) { + _this83._selectRow(row, true, true); + }); + + this._rowSelectionChanged(); + } else { + this._selectRow(rows, false, true); + } + break; + } +}; + +//select an individual row +SelectRow.prototype._selectRow = function (rowInfo, silent, force) { + var index; + + //handle max row count + if (!isNaN(this.table.options.selectable) && this.table.options.selectable !== true && !force) { + if (this.selectedRows.length >= this.table.options.selectable) { + if (this.table.options.selectableRollingSelection) { + this._deselectRow(this.selectedRows[0]); + } else { + return false; + } + } + } + + var row = this.table.rowManager.findRow(rowInfo); + + if (row) { + if (this.selectedRows.indexOf(row) == -1) { + if (!row.modules.select) { + row.modules.select = {}; + } + + row.modules.select.selected = true; + if (row.modules.select.checkboxEl) { + row.modules.select.checkboxEl.checked = true; + } + row.getElement().classList.add("tabulator-selected"); + + this.selectedRows.push(row); + + if (this.table.options.dataTreeSelectPropagate) { + this.childRowSelection(row, true); + } + + if (!silent) { + this.table.options.rowSelected.call(this.table, row.getComponent()); + } + + this._rowSelectionChanged(silent); + } + } else { + if (!silent) { + console.warn("Selection Error - No such row found, ignoring selection:" + rowInfo); + } + } +}; + +SelectRow.prototype.isRowSelected = function (row) { + return this.selectedRows.indexOf(row) !== -1; +}; + +//deselect a number of rows +SelectRow.prototype.deselectRows = function (rows, silent) { + var self = this, + rowCount; + + if (typeof rows == "undefined") { + + rowCount = self.selectedRows.length; + + for (var _i17 = 0; _i17 < rowCount; _i17++) { + self._deselectRow(self.selectedRows[0], true); + } + + self._rowSelectionChanged(silent); + } else { + if (Array.isArray(rows)) { + rows.forEach(function (row) { + self._deselectRow(row, true); + }); + + self._rowSelectionChanged(silent); + } else { + self._deselectRow(rows, silent); + } + } +}; + +//deselect an individual row +SelectRow.prototype._deselectRow = function (rowInfo, silent) { + var self = this, + row = self.table.rowManager.findRow(rowInfo), + index; + + if (row) { + index = self.selectedRows.findIndex(function (selectedRow) { + return selectedRow == row; + }); + + if (index > -1) { + + if (!row.modules.select) { + row.modules.select = {}; + } + + row.modules.select.selected = false; + if (row.modules.select.checkboxEl) { + row.modules.select.checkboxEl.checked = false; + } + row.getElement().classList.remove("tabulator-selected"); + self.selectedRows.splice(index, 1); + + if (this.table.options.dataTreeSelectPropagate) { + this.childRowSelection(row, false); + } + + if (!silent) { + self.table.options.rowDeselected.call(this.table, row.getComponent()); + } + + self._rowSelectionChanged(silent); + } + } else { + if (!silent) { + console.warn("Deselection Error - No such row found, ignoring selection:" + rowInfo); + } + } +}; + +SelectRow.prototype.getSelectedData = function () { + var data = []; + + this.selectedRows.forEach(function (row) { + data.push(row.getData()); + }); + + return data; +}; + +SelectRow.prototype.getSelectedRows = function () { + + var rows = []; + + this.selectedRows.forEach(function (row) { + rows.push(row.getComponent()); + }); + + return rows; +}; + +SelectRow.prototype._rowSelectionChanged = function (silent) { + if (this.headerCheckboxElement) { + if (this.selectedRows.length === 0) { + this.headerCheckboxElement.checked = false; + this.headerCheckboxElement.indeterminate = false; + } else if (this.table.rowManager.rows.length === this.selectedRows.length) { + this.headerCheckboxElement.checked = true; + this.headerCheckboxElement.indeterminate = false; + } else { + this.headerCheckboxElement.indeterminate = true; + this.headerCheckboxElement.checked = false; + } + } + + if (!silent) { + this.table.options.rowSelectionChanged.call(this.table, this.getSelectedData(), this.getSelectedRows()); + } +}; + +SelectRow.prototype.registerRowSelectCheckbox = function (row, element) { + if (!row._row.modules.select) { + row._row.modules.select = {}; + } + + row._row.modules.select.checkboxEl = element; +}; + +SelectRow.prototype.registerHeaderSelectCheckbox = function (element) { + this.headerCheckboxElement = element; +}; + +SelectRow.prototype.childRowSelection = function (row, select) { + var children = this.table.modules.dataTree.getChildren(row); + + if (select) { + for (var _iterator2 = children, _isArray2 = Array.isArray(_iterator2), _i18 = 0, _iterator2 = _isArray2 ? _iterator2 : _iterator2[Symbol.iterator]();;) { + var _ref2; + + if (_isArray2) { + if (_i18 >= _iterator2.length) break; + _ref2 = _iterator2[_i18++]; + } else { + _i18 = _iterator2.next(); + if (_i18.done) break; + _ref2 = _i18.value; + } + + var child = _ref2; + + this._selectRow(child, true); + } + } else { + for (var _iterator3 = children, _isArray3 = Array.isArray(_iterator3), _i19 = 0, _iterator3 = _isArray3 ? _iterator3 : _iterator3[Symbol.iterator]();;) { + var _ref3; + + if (_isArray3) { + if (_i19 >= _iterator3.length) break; + _ref3 = _iterator3[_i19++]; + } else { + _i19 = _iterator3.next(); + if (_i19.done) break; + _ref3 = _i19.value; + } + + var _child = _ref3; + + this._deselectRow(_child, true); + } + } +}; + +Tabulator.prototype.registerModule("selectRow", SelectRow); + +var Sort = function Sort(table) { + this.table = table; //hold Tabulator object + this.sortList = []; //holder current sort + this.changed = false; //has the sort changed since last render +}; + +//initialize column header for sorting +Sort.prototype.initializeColumn = function (column, content) { + var self = this, + sorter = false, + colEl, + arrowEl; + + switch (_typeof(column.definition.sorter)) { + case "string": + if (self.sorters[column.definition.sorter]) { + sorter = self.sorters[column.definition.sorter]; + } else { + console.warn("Sort Error - No such sorter found: ", column.definition.sorter); + } + break; + + case "function": + sorter = column.definition.sorter; + break; + } + + column.modules.sort = { + sorter: sorter, dir: "none", + params: column.definition.sorterParams || {}, + startingDir: column.definition.headerSortStartingDir || "asc", + tristate: typeof column.definition.headerSortTristate !== "undefined" ? column.definition.headerSortTristate : this.table.options.headerSortTristate + }; + + if (typeof column.definition.headerSort === "undefined" ? this.table.options.headerSort !== false : column.definition.headerSort !== false) { + + colEl = column.getElement(); + + colEl.classList.add("tabulator-sortable"); + + arrowEl = document.createElement("div"); + arrowEl.classList.add("tabulator-col-sorter"); + + if (_typeof(this.table.options.headerSortElement) == "object") { + arrowEl.appendChild(this.table.options.headerSortElement); + } else { + arrowEl.innerHTML = this.table.options.headerSortElement; + } + + //create sorter arrow + content.appendChild(arrowEl); + + column.modules.sort.element = arrowEl; + + //sort on click + colEl.addEventListener("click", function (e) { + var dir = "", + sorters = [], + match = false; + + if (column.modules.sort) { + if (column.modules.sort.tristate) { + if (column.modules.sort.dir == "none") { + dir = column.modules.sort.startingDir; + } else { + if (column.modules.sort.dir == column.modules.sort.startingDir) { + dir = column.modules.sort.dir == "asc" ? "desc" : "asc"; + } else { + dir = "none"; + } + } + } else { + switch (column.modules.sort.dir) { + case "asc": + dir = "desc"; + break; + + case "desc": + dir = "asc"; + break; + + default: + dir = column.modules.sort.startingDir; + } + } + + if (self.table.options.columnHeaderSortMulti && (e.shiftKey || e.ctrlKey)) { + sorters = self.getSort(); + + match = sorters.findIndex(function (sorter) { + return sorter.field === column.getField(); + }); + + if (match > -1) { + sorters[match].dir = dir; + + if (match != sorters.length - 1) { + match = sorters.splice(match, 1)[0]; + if (dir != "none") { + sorters.push(match); + } + } + } else { + if (dir != "none") { + sorters.push({ column: column, dir: dir }); + } + } + + //add to existing sort + self.setSort(sorters); + } else { + if (dir == "none") { + self.clear(); + } else { + //sort by column only + self.setSort(column, dir); + } + } + + self.table.rowManager.sorterRefresh(!self.sortList.length); + } + }); + } +}; + +//check if the sorters have changed since last use +Sort.prototype.hasChanged = function () { + var changed = this.changed; + this.changed = false; + return changed; +}; + +//return current sorters +Sort.prototype.getSort = function () { + var self = this, + sorters = []; + + self.sortList.forEach(function (item) { + if (item.column) { + sorters.push({ column: item.column.getComponent(), field: item.column.getField(), dir: item.dir }); + } + }); + + return sorters; +}; + +//change sort list and trigger sort +Sort.prototype.setSort = function (sortList, dir) { + var self = this, + newSortList = []; + + if (!Array.isArray(sortList)) { + sortList = [{ column: sortList, dir: dir }]; + } + + sortList.forEach(function (item) { + var column; + + column = self.table.columnManager.findColumn(item.column); + + if (column) { + item.column = column; + newSortList.push(item); + self.changed = true; + } else { + console.warn("Sort Warning - Sort field does not exist and is being ignored: ", item.column); + } + }); + + self.sortList = newSortList; + + if (this.table.options.persistence && this.table.modExists("persistence", true) && this.table.modules.persistence.config.sort) { + this.table.modules.persistence.save("sort"); + } +}; + +//clear sorters +Sort.prototype.clear = function () { + this.setSort([]); +}; + +//find appropriate sorter for column +Sort.prototype.findSorter = function (column) { + var row = this.table.rowManager.activeRows[0], + sorter = "string", + field, + value; + + if (row) { + row = row.getData(); + field = column.getField(); + + if (field) { + + value = column.getFieldValue(row); + + switch (typeof value === 'undefined' ? 'undefined' : _typeof(value)) { + case "undefined": + sorter = "string"; + break; + + case "boolean": + sorter = "boolean"; + break; + + default: + if (!isNaN(value) && value !== "") { + sorter = "number"; + } else { + if (value.match(/((^[0-9]+[a-z]+)|(^[a-z]+[0-9]+))+$/i)) { + sorter = "alphanum"; + } + } + break; + } + } + } + + return this.sorters[sorter]; +}; + +//work through sort list sorting data +Sort.prototype.sort = function (data) { + var self = this, + sortList = this.table.options.sortOrderReverse ? self.sortList.slice().reverse() : self.sortList, + sortListActual = [], + rowComponents = [], + lastSort; + + if (self.table.options.dataSorting) { + self.table.options.dataSorting.call(self.table, self.getSort()); + } + + self.clearColumnHeaders(); + + if (!self.table.options.ajaxSorting) { + + //build list of valid sorters and trigger column specific callbacks before sort begins + sortList.forEach(function (item, i) { + var sortObj = item.column.modules.sort; + + if (item.column && sortObj) { + + //if no sorter has been defined, take a guess + if (!sortObj.sorter) { + sortObj.sorter = self.findSorter(item.column); + } + + item.params = typeof sortObj.params === "function" ? sortObj.params(item.column.getComponent(), item.dir) : sortObj.params; + + sortListActual.push(item); + } + + self.setColumnHeader(item.column, item.dir); + }); + + //sort data + if (sortListActual.length) { + self._sortItems(data, sortListActual); + } + } else { + sortList.forEach(function (item, i) { + self.setColumnHeader(item.column, item.dir); + }); + } + + if (self.table.options.dataSorted) { + data.forEach(function (row) { + rowComponents.push(row.getComponent()); + }); + + self.table.options.dataSorted.call(self.table, self.getSort(), rowComponents); + } +}; + +//clear sort arrows on columns +Sort.prototype.clearColumnHeaders = function () { + this.table.columnManager.getRealColumns().forEach(function (column) { + if (column.modules.sort) { + column.modules.sort.dir = "none"; + column.getElement().setAttribute("aria-sort", "none"); + } + }); +}; + +//set the column header sort direction +Sort.prototype.setColumnHeader = function (column, dir) { + column.modules.sort.dir = dir; + column.getElement().setAttribute("aria-sort", dir); +}; + +//sort each item in sort list +Sort.prototype._sortItems = function (data, sortList) { + var _this84 = this; + + var sorterCount = sortList.length - 1; + + data.sort(function (a, b) { + var result; + + for (var i = sorterCount; i >= 0; i--) { + var sortItem = sortList[i]; + + result = _this84._sortRow(a, b, sortItem.column, sortItem.dir, sortItem.params); + + if (result !== 0) { + break; + } + } + + return result; + }); +}; + +//process individual rows for a sort function on active data +Sort.prototype._sortRow = function (a, b, column, dir, params) { + var el1Comp, el2Comp, colComp; + + //switch elements depending on search direction + var el1 = dir == "asc" ? a : b; + var el2 = dir == "asc" ? b : a; + + a = column.getFieldValue(el1.getData()); + b = column.getFieldValue(el2.getData()); + + a = typeof a !== "undefined" ? a : ""; + b = typeof b !== "undefined" ? b : ""; + + el1Comp = el1.getComponent(); + el2Comp = el2.getComponent(); + + return column.modules.sort.sorter.call(this, a, b, el1Comp, el2Comp, column.getComponent(), dir, params); +}; + +//default data sorters +Sort.prototype.sorters = { + + //sort numbers + number: function number(a, b, aRow, bRow, column, dir, params) { + var alignEmptyValues = params.alignEmptyValues; + var decimal = params.decimalSeparator || "."; + var thousand = params.thousandSeparator || ","; + var emptyAlign = 0; + + a = parseFloat(String(a).split(thousand).join("").split(decimal).join(".")); + b = parseFloat(String(b).split(thousand).join("").split(decimal).join(".")); + + //handle non numeric values + if (isNaN(a)) { + emptyAlign = isNaN(b) ? 0 : -1; + } else if (isNaN(b)) { + emptyAlign = 1; + } else { + //compare valid values + return a - b; + } + + //fix empty values in position + if (alignEmptyValues === "top" && dir === "desc" || alignEmptyValues === "bottom" && dir === "asc") { + emptyAlign *= -1; + } + + return emptyAlign; + }, + + //sort strings + string: function string(a, b, aRow, bRow, column, dir, params) { + var alignEmptyValues = params.alignEmptyValues; + var emptyAlign = 0; + var locale; + + //handle empty values + if (!a) { + emptyAlign = !b ? 0 : -1; + } else if (!b) { + emptyAlign = 1; + } else { + //compare valid values + switch (_typeof(params.locale)) { + case "boolean": + if (params.locale) { + locale = this.table.modules.localize.getLocale(); + } + break; + case "string": + locale = params.locale; + break; + } + + return String(a).toLowerCase().localeCompare(String(b).toLowerCase(), locale); + } + + //fix empty values in position + if (alignEmptyValues === "top" && dir === "desc" || alignEmptyValues === "bottom" && dir === "asc") { + emptyAlign *= -1; + } + + return emptyAlign; + }, + + //sort date + date: function date(a, b, aRow, bRow, column, dir, params) { + if (!params.format) { + params.format = "DD/MM/YYYY"; + } + + return this.sorters.datetime.call(this, a, b, aRow, bRow, column, dir, params); + }, + + //sort HH:mm formatted times + time: function time(a, b, aRow, bRow, column, dir, params) { + if (!params.format) { + params.format = "HH:mm"; + } + + return this.sorters.datetime.call(this, a, b, aRow, bRow, column, dir, params); + }, + + //sort datetime + datetime: function datetime(a, b, aRow, bRow, column, dir, params) { + var format = params.format || "DD/MM/YYYY HH:mm:ss", + alignEmptyValues = params.alignEmptyValues, + emptyAlign = 0; + + if (typeof moment != "undefined") { + a = moment(a, format); + b = moment(b, format); + + if (!a.isValid()) { + emptyAlign = !b.isValid() ? 0 : -1; + } else if (!b.isValid()) { + emptyAlign = 1; + } else { + //compare valid values + return a - b; + } + + //fix empty values in position + if (alignEmptyValues === "top" && dir === "desc" || alignEmptyValues === "bottom" && dir === "asc") { + emptyAlign *= -1; + } + + return emptyAlign; + } else { + console.error("Sort Error - 'datetime' sorter is dependant on moment.js"); + } + }, + + //sort booleans + boolean: function boolean(a, b, aRow, bRow, column, dir, params) { + var el1 = a === true || a === "true" || a === "True" || a === 1 ? 1 : 0; + var el2 = b === true || b === "true" || b === "True" || b === 1 ? 1 : 0; + + return el1 - el2; + }, + + //sort if element contains any data + array: function array(a, b, aRow, bRow, column, dir, params) { + var el1 = 0; + var el2 = 0; + var type = params.type || "length"; + var alignEmptyValues = params.alignEmptyValues; + var emptyAlign = 0; + + function calc(value) { + + switch (type) { + case "length": + return value.length; + break; + + case "sum": + return value.reduce(function (c, d) { + return c + d; + }); + break; + + case "max": + return Math.max.apply(null, value); + break; + + case "min": + return Math.min.apply(null, value); + break; + + case "avg": + return value.reduce(function (c, d) { + return c + d; + }) / value.length; + break; + } + } + + //handle non array values + if (!Array.isArray(a)) { + alignEmptyValues = !Array.isArray(b) ? 0 : -1; + } else if (!Array.isArray(b)) { + alignEmptyValues = 1; + } else { + + //compare valid values + el1 = a ? calc(a) : 0; + el2 = b ? calc(b) : 0; + + return el1 - el2; + } + + //fix empty values in position + if (alignEmptyValues === "top" && dir === "desc" || alignEmptyValues === "bottom" && dir === "asc") { + emptyAlign *= -1; + } + + return emptyAlign; + }, + + //sort if element contains any data + exists: function exists(a, b, aRow, bRow, column, dir, params) { + var el1 = typeof a == "undefined" ? 0 : 1; + var el2 = typeof b == "undefined" ? 0 : 1; + + return el1 - el2; + }, + + //sort alpha numeric strings + alphanum: function alphanum(as, bs, aRow, bRow, column, dir, params) { + var a, + b, + a1, + b1, + i = 0, + L, + rx = /(\d+)|(\D+)/g, + rd = /\d/; + var alignEmptyValues = params.alignEmptyValues; + var emptyAlign = 0; + + //handle empty values + if (!as && as !== 0) { + emptyAlign = !bs && bs !== 0 ? 0 : -1; + } else if (!bs && bs !== 0) { + emptyAlign = 1; + } else { + + if (isFinite(as) && isFinite(bs)) return as - bs; + a = String(as).toLowerCase(); + b = String(bs).toLowerCase(); + if (a === b) return 0; + if (!(rd.test(a) && rd.test(b))) return a > b ? 1 : -1; + a = a.match(rx); + b = b.match(rx); + L = a.length > b.length ? b.length : a.length; + while (i < L) { + a1 = a[i]; + b1 = b[i++]; + if (a1 !== b1) { + if (isFinite(a1) && isFinite(b1)) { + if (a1.charAt(0) === "0") a1 = "." + a1; + if (b1.charAt(0) === "0") b1 = "." + b1; + return a1 - b1; + } else return a1 > b1 ? 1 : -1; + } + } + + return a.length > b.length; + } + + //fix empty values in position + if (alignEmptyValues === "top" && dir === "desc" || alignEmptyValues === "bottom" && dir === "asc") { + emptyAlign *= -1; + } + + return emptyAlign; + } +}; + +Tabulator.prototype.registerModule("sort", Sort); + +var Validate = function Validate(table) { + this.table = table; + this.invalidCells = []; +}; + +//validate +Validate.prototype.initializeColumn = function (column) { + var self = this, + config = [], + validator; + + if (column.definition.validator) { + + if (Array.isArray(column.definition.validator)) { + column.definition.validator.forEach(function (item) { + validator = self._extractValidator(item); + + if (validator) { + config.push(validator); + } + }); + } else { + validator = this._extractValidator(column.definition.validator); + + if (validator) { + config.push(validator); + } + } + + column.modules.validate = config.length ? config : false; + } +}; + +Validate.prototype._extractValidator = function (value) { + var type, params, pos; + + switch (typeof value === 'undefined' ? 'undefined' : _typeof(value)) { + case "string": + pos = value.indexOf(':'); + + if (pos > -1) { + type = value.substring(0, pos); + params = value.substring(pos + 1); + } else { + type = value; + } + + return this._buildValidator(type, params); + break; + + case "function": + return this._buildValidator(value); + break; + + case "object": + return this._buildValidator(value.type, value.parameters); + break; + } +}; + +Validate.prototype._buildValidator = function (type, params) { + + var func = typeof type == "function" ? type : this.validators[type]; + + if (!func) { + console.warn("Validator Setup Error - No matching validator found:", type); + return false; + } else { + return { + type: typeof type == "function" ? "function" : type, + func: func, + params: params + }; + } +}; + +Validate.prototype.validate = function (validators, cell, value) { + var self = this, + valid = [], + invalidIndex = this.invalidCells.indexOf(cell); + + if (validators) { + validators.forEach(function (item) { + if (!item.func.call(self, cell.getComponent(), value, item.params)) { + valid.push({ + type: item.type, + parameters: item.params + }); + } + }); + } + + valid = valid.length ? valid : true; + + if (!cell.modules.validate) { + cell.modules.validate = {}; + } + + if (valid === true) { + cell.modules.validate.invalid = false; + cell.getElement().classList.remove("tabulator-validation-fail"); + + if (invalidIndex > -1) { + this.invalidCells.splice(invalidIndex, 1); + } + } else { + cell.modules.validate.invalid = true; + + if (this.table.options.validationMode !== "manual") { + cell.getElement().classList.add("tabulator-validation-fail"); + } + + if (invalidIndex == -1) { + this.invalidCells.push(cell); + } + } + + return valid; +}; + +Validate.prototype.getInvalidCells = function () { + var output = []; + + this.invalidCells.forEach(function (cell) { + output.push(cell.getComponent()); + }); + + return output; +}; + +Validate.prototype.clearValidation = function (cell) { + var invalidIndex; + + if (cell.modules.validate && cell.modules.validate.invalid) { + + cell.getElement().classList.remove("tabulator-validation-fail"); + cell.modules.validate.invalid = false; + + invalidIndex = this.invalidCells.indexOf(cell); + + if (invalidIndex > -1) { + this.invalidCells.splice(invalidIndex, 1); + } + } +}; + +Validate.prototype.validators = { + + //is integer + integer: function integer(cell, value, parameters) { + if (value === "" || value === null || typeof value === "undefined") { + return true; + } + value = Number(value); + return typeof value === 'number' && isFinite(value) && Math.floor(value) === value; + }, + + //is float + float: function float(cell, value, parameters) { + if (value === "" || value === null || typeof value === "undefined") { + return true; + } + value = Number(value); + return typeof value === 'number' && isFinite(value) && value % 1 !== 0; + }, + + //must be a number + numeric: function numeric(cell, value, parameters) { + if (value === "" || value === null || typeof value === "undefined") { + return true; + } + return !isNaN(value); + }, + + //must be a string + string: function string(cell, value, parameters) { + if (value === "" || value === null || typeof value === "undefined") { + return true; + } + return isNaN(value); + }, + + //maximum value + max: function max(cell, value, parameters) { + if (value === "" || value === null || typeof value === "undefined") { + return true; + } + return parseFloat(value) <= parameters; + }, + + //minimum value + min: function min(cell, value, parameters) { + if (value === "" || value === null || typeof value === "undefined") { + return true; + } + return parseFloat(value) >= parameters; + }, + + //starts with value + starts: function starts(cell, value, parameters) { + if (value === "" || value === null || typeof value === "undefined") { + return true; + } + return String(value).toLowerCase().startsWith(String(parameters).toLowerCase()); + }, + + //ends with value + ends: function ends(cell, value, parameters) { + if (value === "" || value === null || typeof value === "undefined") { + return true; + } + return String(value).toLowerCase().endsWith(String(parameters).toLowerCase()); + }, + + //minimum string length + minLength: function minLength(cell, value, parameters) { + if (value === "" || value === null || typeof value === "undefined") { + return true; + } + return String(value).length >= parameters; + }, + + //maximum string length + maxLength: function maxLength(cell, value, parameters) { + if (value === "" || value === null || typeof value === "undefined") { + return true; + } + return String(value).length <= parameters; + }, + + //in provided value list + in: function _in(cell, value, parameters) { + if (value === "" || value === null || typeof value === "undefined") { + return true; + } + if (typeof parameters == "string") { + parameters = parameters.split("|"); + } + + return value === "" || parameters.indexOf(value) > -1; + }, + + //must match provided regex + regex: function regex(cell, value, parameters) { + if (value === "" || value === null || typeof value === "undefined") { + return true; + } + var reg = new RegExp(parameters); + + return reg.test(value); + }, + + //value must be unique in this column + unique: function unique(cell, value, parameters) { + if (value === "" || value === null || typeof value === "undefined") { + return true; + } + var unique = true; + + var cellData = cell.getData(); + var column = cell.getColumn()._getSelf(); + + this.table.rowManager.rows.forEach(function (row) { + var data = row.getData(); + + if (data !== cellData) { + if (value == column.getFieldValue(data)) { + unique = false; + } + } + }); + + return unique; + }, + + //must have a value + required: function required(cell, value, parameters) { + return value !== "" && value !== null && typeof value !== "undefined"; + } +}; + +Tabulator.prototype.registerModule("validate", Validate); + +export default Tabulator; \ No newline at end of file diff --git a/website/js/vendor/tabulator/js/tabulator.js b/website/js/vendor/tabulator/js/tabulator.js new file mode 100644 index 0000000..81f6fef --- /dev/null +++ b/website/js/vendor/tabulator/js/tabulator.js @@ -0,0 +1,26250 @@ +var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; + +/* Tabulator v4.8.3 (c) Oliver Folkerd */ + +;(function (global, factory) { + if ((typeof exports === 'undefined' ? 'undefined' : _typeof(exports)) === 'object' && typeof module !== 'undefined') { + module.exports = factory(); + } else if (typeof define === 'function' && define.amd) { + define(factory); + } else { + global.Tabulator = factory(); + } +})(this, function () { + + 'use strict'; + + // https://tc39.github.io/ecma262/#sec-array.prototype.findIndex + + + if (!Array.prototype.findIndex) { + + Object.defineProperty(Array.prototype, 'findIndex', { + + value: function value(predicate) { + + // 1. Let O be ? ToObject(this value). + + + if (this == null) { + + throw new TypeError('"this" is null or not defined'); + } + + var o = Object(this); + + // 2. Let len be ? ToLength(? Get(O, "length")). + + + var len = o.length >>> 0; + + // 3. If IsCallable(predicate) is false, throw a TypeError exception. + + + if (typeof predicate !== 'function') { + + throw new TypeError('predicate must be a function'); + } + + // 4. If thisArg was supplied, let T be thisArg; else let T be undefined. + + + var thisArg = arguments[1]; + + // 5. Let k be 0. + + + var k = 0; + + // 6. Repeat, while k < len + + + while (k < len) { + + // a. Let Pk be ! ToString(k). + + + // b. Let kValue be ? Get(O, Pk). + + + // c. Let testResult be ToBoolean(? Call(predicate, T, « kValue, k, O »)). + + + // d. If testResult is true, return k. + + + var kValue = o[k]; + + if (predicate.call(thisArg, kValue, k, o)) { + + return k; + } + + // e. Increase k by 1. + + + k++; + } + + // 7. Return -1. + + + return -1; + } + + }); + } + + // https://tc39.github.io/ecma262/#sec-array.prototype.find + + + if (!Array.prototype.find) { + + Object.defineProperty(Array.prototype, 'find', { + + value: function value(predicate) { + + // 1. Let O be ? ToObject(this value). + + + if (this == null) { + + throw new TypeError('"this" is null or not defined'); + } + + var o = Object(this); + + // 2. Let len be ? ToLength(? Get(O, "length")). + + + var len = o.length >>> 0; + + // 3. If IsCallable(predicate) is false, throw a TypeError exception. + + + if (typeof predicate !== 'function') { + + throw new TypeError('predicate must be a function'); + } + + // 4. If thisArg was supplied, let T be thisArg; else let T be undefined. + + + var thisArg = arguments[1]; + + // 5. Let k be 0. + + + var k = 0; + + // 6. Repeat, while k < len + + + while (k < len) { + + // a. Let Pk be ! ToString(k). + + + // b. Let kValue be ? Get(O, Pk). + + + // c. Let testResult be ToBoolean(? Call(predicate, T, « kValue, k, O »)). + + + // d. If testResult is true, return kValue. + + + var kValue = o[k]; + + if (predicate.call(thisArg, kValue, k, o)) { + + return kValue; + } + + // e. Increase k by 1. + + + k++; + } + + // 7. Return undefined. + + + return undefined; + } + + }); + } + + // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/includes#Polyfill + + + if (!String.prototype.includes) { + + String.prototype.includes = function (search, start) { + + 'use strict'; + + if (search instanceof RegExp) { + + throw TypeError('first argument must not be a RegExp'); + } + + if (start === undefined) { + start = 0; + } + + return this.indexOf(search, start) !== -1; + }; + } + + // https://tc39.github.io/ecma262/#sec-array.prototype.includes + + + if (!Array.prototype.includes) { + + Object.defineProperty(Array.prototype, 'includes', { + + value: function value(searchElement, fromIndex) { + + if (this == null) { + + throw new TypeError('"this" is null or not defined'); + } + + // 1. Let O be ? ToObject(this value). + + + var o = Object(this); + + // 2. Let len be ? ToLength(? Get(O, "length")). + + + var len = o.length >>> 0; + + // 3. If len is 0, return false. + + + if (len === 0) { + + return false; + } + + // 4. Let n be ? ToInteger(fromIndex). + + + // (If fromIndex is undefined, this step produces the value 0.) + + + var n = fromIndex | 0; + + // 5. If n ≥ 0, then + + + // a. Let k be n. + + + // 6. Else n < 0, + + + // a. Let k be len + n. + + + // b. If k < 0, let k be 0. + + + var k = Math.max(n >= 0 ? n : len - Math.abs(n), 0); + + function sameValueZero(x, y) { + + return x === y || typeof x === 'number' && typeof y === 'number' && isNaN(x) && isNaN(y); + } + + // 7. Repeat, while k < len + + + while (k < len) { + + // a. Let elementK be the result of ? Get(O, ! ToString(k)). + + + // b. If SameValueZero(searchElement, elementK) is true, return true. + + + if (sameValueZero(o[k], searchElement)) { + + return true; + } + + // c. Increase k by 1. + + + k++; + } + + // 8. Return false + + + return false; + } + + }); + } + + // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/assign#Polyfill + + + if (typeof Object.assign !== 'function') { + + // Must be writable: true, enumerable: false, configurable: true + + + Object.defineProperty(Object, "assign", { + + value: function assign(target, varArgs) { + // .length of function is 2 + + + 'use strict'; + + if (target === null || target === undefined) { + + throw new TypeError('Cannot convert undefined or null to object'); + } + + var to = Object(target); + + for (var index = 1; index < arguments.length; index++) { + + var nextSource = arguments[index]; + + if (nextSource !== null && nextSource !== undefined) { + + for (var nextKey in nextSource) { + + // Avoid bugs when hasOwnProperty is shadowed + + + if (Object.prototype.hasOwnProperty.call(nextSource, nextKey)) { + + to[nextKey] = nextSource[nextKey]; + } + } + } + } + + return to; + }, + + writable: true, + + configurable: true + + }); + } + + var ColumnManager = function ColumnManager(table) { + + this.table = table; //hold parent table + + + this.blockHozScrollEvent = false; + + this.headersElement = this.createHeadersElement(); + + this.element = this.createHeaderElement(); //containing element + + + this.rowManager = null; //hold row manager object + + + this.columns = []; // column definition object + + + this.columnsByIndex = []; //columns by index + + + this.columnsByField = {}; //columns by field + + + this.scrollLeft = 0; + + this.element.insertBefore(this.headersElement, this.element.firstChild); + }; + + ////////////// Setup Functions ///////////////// + + + ColumnManager.prototype.createHeadersElement = function () { + + var el = document.createElement("div"); + + el.classList.add("tabulator-headers"); + + return el; + }; + + ColumnManager.prototype.createHeaderElement = function () { + + var el = document.createElement("div"); + + el.classList.add("tabulator-header"); + + if (!this.table.options.headerVisible) { + + el.classList.add("tabulator-header-hidden"); + } + + return el; + }; + + ColumnManager.prototype.initialize = function () { + + var self = this; + + //scroll body along with header + + + // self.element.addEventListener("scroll", function(e){ + + + // if(!self.blockHozScrollEvent){ + + + // self.table.rowManager.scrollHorizontal(self.element.scrollLeft); + + + // } + + + // }); + + }; + + //link to row manager + + + ColumnManager.prototype.setRowManager = function (manager) { + + this.rowManager = manager; + }; + + //return containing element + + + ColumnManager.prototype.getElement = function () { + + return this.element; + }; + + //return header containing element + + + ColumnManager.prototype.getHeadersElement = function () { + + return this.headersElement; + }; + + // ColumnManager.prototype.tempScrollBlock = function(){ + + + // clearTimeout(this.blockHozScrollEvent); + + + // this.blockHozScrollEvent = setTimeout(() => {this.blockHozScrollEvent = false;}, 50); + + + // } + + + //scroll horizontally to match table body + + + ColumnManager.prototype.scrollHorizontal = function (left) { + + var hozAdjust = 0, + scrollWidth = this.element.scrollWidth - this.table.element.clientWidth; + + // this.tempScrollBlock(); + + + this.element.scrollLeft = left; + + //adjust for vertical scrollbar moving table when present + + + if (left > scrollWidth) { + + hozAdjust = left - scrollWidth; + + this.element.style.marginLeft = -hozAdjust + "px"; + } else { + + this.element.style.marginLeft = 0; + } + + //keep frozen columns fixed in position + + + //this._calcFrozenColumnsPos(hozAdjust + 3); + + + this.scrollLeft = left; + + if (this.table.modExists("frozenColumns")) { + + this.table.modules.frozenColumns.scrollHorizontal(); + } + }; + + ///////////// Column Setup Functions ///////////// + + + ColumnManager.prototype.generateColumnsFromRowData = function (data) { + + var cols = [], + definitions = this.table.options.autoColumnsDefinitions, + row, + sorter; + + if (data && data.length) { + + row = data[0]; + + for (var key in row) { + + var col = { + + field: key, + + title: key + + }; + + var value = row[key]; + + switch (typeof value === 'undefined' ? 'undefined' : _typeof(value)) { + + case "undefined": + + sorter = "string"; + + break; + + case "boolean": + + sorter = "boolean"; + + break; + + case "object": + + if (Array.isArray(value)) { + + sorter = "array"; + } else { + + sorter = "string"; + } + + break; + + default: + + if (!isNaN(value) && value !== "") { + + sorter = "number"; + } else { + + if (value.match(/((^[0-9]+[a-z]+)|(^[a-z]+[0-9]+))+$/i)) { + + sorter = "alphanum"; + } else { + + sorter = "string"; + } + } + + break; + + } + + col.sorter = sorter; + + cols.push(col); + } + + if (definitions) { + + switch (typeof definitions === 'undefined' ? 'undefined' : _typeof(definitions)) { + + case "function": + + this.table.options.columns = definitions.call(this.table, cols); + + break; + + case "object": + + if (Array.isArray(definitions)) { + + cols.forEach(function (col) { + + var match = definitions.find(function (def) { + + return def.field === col.field; + }); + + if (match) { + + Object.assign(col, match); + } + }); + } else { + + cols.forEach(function (col) { + + if (definitions[col.field]) { + + Object.assign(col, definitions[col.field]); + } + }); + } + + this.table.options.columns = cols; + + break; + + } + } else { + + this.table.options.columns = cols; + } + + this.setColumns(this.table.options.columns); + } + }; + + ColumnManager.prototype.setColumns = function (cols, row) { + + var self = this; + + while (self.headersElement.firstChild) { + self.headersElement.removeChild(self.headersElement.firstChild); + }self.columns = []; + + self.columnsByIndex = []; + + self.columnsByField = {}; + + //reset frozen columns + + + if (self.table.modExists("frozenColumns")) { + + self.table.modules.frozenColumns.reset(); + } + + cols.forEach(function (def, i) { + + self._addColumn(def); + }); + + self._reIndexColumns(); + + if (self.table.options.responsiveLayout && self.table.modExists("responsiveLayout", true)) { + + self.table.modules.responsiveLayout.initialize(); + } + + if (this.table.options.virtualDomHoz) { + + this.table.vdomHoz.reinitialize(false, true); + } + + self.redraw(true); + }; + + ColumnManager.prototype._addColumn = function (definition, before, nextToColumn) { + + var column = new Column(definition, this), + colEl = column.getElement(), + index = nextToColumn ? this.findColumnIndex(nextToColumn) : nextToColumn; + + if (nextToColumn && index > -1) { + + var parentIndex = this.columns.indexOf(nextToColumn.getTopColumn()); + + var nextEl = nextToColumn.getElement(); + + if (before) { + + this.columns.splice(parentIndex, 0, column); + + nextEl.parentNode.insertBefore(colEl, nextEl); + } else { + + this.columns.splice(parentIndex + 1, 0, column); + + nextEl.parentNode.insertBefore(colEl, nextEl.nextSibling); + } + } else { + + if (before) { + + this.columns.unshift(column); + + this.headersElement.insertBefore(column.getElement(), this.headersElement.firstChild); + } else { + + this.columns.push(column); + + this.headersElement.appendChild(column.getElement()); + } + + column.columnRendered(); + } + + return column; + }; + + ColumnManager.prototype.registerColumnField = function (col) { + + if (col.definition.field) { + + this.columnsByField[col.definition.field] = col; + } + }; + + ColumnManager.prototype.registerColumnPosition = function (col) { + + this.columnsByIndex.push(col); + }; + + ColumnManager.prototype._reIndexColumns = function () { + + this.columnsByIndex = []; + + this.columns.forEach(function (column) { + + column.reRegisterPosition(); + }); + }; + + //ensure column headers take up the correct amount of space in column groups + + + ColumnManager.prototype._verticalAlignHeaders = function () { + + var self = this, + minHeight = 0; + + self.columns.forEach(function (column) { + + var height; + + column.clearVerticalAlign(); + + height = column.getHeight(); + + if (height > minHeight) { + + minHeight = height; + } + }); + + self.columns.forEach(function (column) { + + column.verticalAlign(self.table.options.columnHeaderVertAlign, minHeight); + }); + + self.rowManager.adjustTableSize(); + }; + + //////////////// Column Details ///////////////// + + + ColumnManager.prototype.findColumn = function (subject) { + + var self = this; + + if ((typeof subject === 'undefined' ? 'undefined' : _typeof(subject)) == "object") { + + if (subject instanceof Column) { + + //subject is column element + + + return subject; + } else if (subject instanceof ColumnComponent) { + + //subject is public column component + + + return subject._getSelf() || false; + } else if (typeof HTMLElement !== "undefined" && subject instanceof HTMLElement) { + + //subject is a HTML element of the column header + + + var match = self.columns.find(function (column) { + + return column.element === subject; + }); + + return match || false; + } + } else { + + //subject should be treated as the field name of the column + + + return this.columnsByField[subject] || false; + } + + //catch all for any other type of input + + + return false; + }; + + ColumnManager.prototype.getColumnByField = function (field) { + + return this.columnsByField[field]; + }; + + ColumnManager.prototype.getColumnsByFieldRoot = function (root) { + var _this = this; + + var matches = []; + + Object.keys(this.columnsByField).forEach(function (field) { + + var fieldRoot = field.split(".")[0]; + + if (fieldRoot === root) { + + matches.push(_this.columnsByField[field]); + } + }); + + return matches; + }; + + ColumnManager.prototype.getColumnByIndex = function (index) { + + return this.columnsByIndex[index]; + }; + + ColumnManager.prototype.getFirstVisibileColumn = function (index) { + + var index = this.columnsByIndex.findIndex(function (col) { + + return col.visible; + }); + + return index > -1 ? this.columnsByIndex[index] : false; + }; + + ColumnManager.prototype.getColumns = function () { + + return this.columns; + }; + + ColumnManager.prototype.findColumnIndex = function (column) { + + return this.columnsByIndex.findIndex(function (col) { + + return column === col; + }); + }; + + //return all columns that are not groups + + + ColumnManager.prototype.getRealColumns = function () { + + return this.columnsByIndex; + }; + + //travers across columns and call action + + + ColumnManager.prototype.traverse = function (callback) { + + var self = this; + + self.columnsByIndex.forEach(function (column, i) { + + callback(column, i); + }); + }; + + //get defintions of actual columns + + + ColumnManager.prototype.getDefinitions = function (active) { + + var self = this, + output = []; + + self.columnsByIndex.forEach(function (column) { + + if (!active || active && column.visible) { + + output.push(column.getDefinition()); + } + }); + + return output; + }; + + //get full nested definition tree + + + ColumnManager.prototype.getDefinitionTree = function () { + + var self = this, + output = []; + + self.columns.forEach(function (column) { + + output.push(column.getDefinition(true)); + }); + + return output; + }; + + ColumnManager.prototype.getComponents = function (structured) { + + var self = this, + output = [], + columns = structured ? self.columns : self.columnsByIndex; + + columns.forEach(function (column) { + + output.push(column.getComponent()); + }); + + return output; + }; + + ColumnManager.prototype.getWidth = function () { + + var width = 0; + + this.columnsByIndex.forEach(function (column) { + + if (column.visible) { + + width += column.getWidth(); + } + }); + + return width; + }; + + ColumnManager.prototype.moveColumn = function (from, to, after) { + + this.moveColumnActual(from, to, after); + + if (this.table.options.responsiveLayout && this.table.modExists("responsiveLayout", true)) { + + this.table.modules.responsiveLayout.initialize(); + } + + if (this.table.modExists("columnCalcs")) { + + this.table.modules.columnCalcs.recalc(this.table.rowManager.activeRows); + } + + to.element.parentNode.insertBefore(from.element, to.element); + + if (after) { + + to.element.parentNode.insertBefore(to.element, from.element); + } + + this._verticalAlignHeaders(); + + this.table.rowManager.reinitialize(); + }; + + ColumnManager.prototype.moveColumnActual = function (from, to, after) { + + if (from.parent.isGroup) { + + this._moveColumnInArray(from.parent.columns, from, to, after); + } else { + + this._moveColumnInArray(this.columns, from, to, after); + } + + this._moveColumnInArray(this.columnsByIndex, from, to, after, true); + + if (this.table.options.responsiveLayout && this.table.modExists("responsiveLayout", true)) { + + this.table.modules.responsiveLayout.initialize(); + } + + if (this.table.options.virtualDomHoz) { + + this.table.vdomHoz.reinitialize(true); + } + + if (this.table.options.columnMoved) { + + this.table.options.columnMoved.call(this.table, from.getComponent(), this.table.columnManager.getComponents()); + } + + if (this.table.options.persistence && this.table.modExists("persistence", true) && this.table.modules.persistence.config.columns) { + + this.table.modules.persistence.save("columns"); + } + }; + + ColumnManager.prototype._moveColumnInArray = function (columns, from, to, after, updateRows) { + var _this2 = this; + + var fromIndex = columns.indexOf(from), + toIndex, + rows = []; + + if (fromIndex > -1) { + + columns.splice(fromIndex, 1); + + toIndex = columns.indexOf(to); + + if (toIndex > -1) { + + if (after) { + + toIndex = toIndex + 1; + } + } else { + + toIndex = fromIndex; + } + + columns.splice(toIndex, 0, from); + + if (updateRows) { + + if (this.table.options.dataTree && this.table.modExists("dataTree", true)) { + + this.table.rowManager.rows.forEach(function (row) { + + rows = rows.concat(_this2.table.modules.dataTree.getTreeChildren(row, false, true)); + }); + } + + rows = rows.concat(this.table.rowManager.rows); + + rows.forEach(function (row) { + + if (row.cells.length) { + + var cell = row.cells.splice(fromIndex, 1)[0]; + + row.cells.splice(toIndex, 0, cell); + } + }); + } + } + }; + + ColumnManager.prototype.scrollToColumn = function (column, position, ifVisible) { + var _this3 = this; + + var left = 0, + offset = 0, + adjust = 0, + colEl = column.getElement(); + + return new Promise(function (resolve, reject) { + + if (typeof position === "undefined") { + + position = _this3.table.options.scrollToColumnPosition; + } + + if (typeof ifVisible === "undefined") { + + ifVisible = _this3.table.options.scrollToColumnIfVisible; + } + + if (column.visible) { + + //align to correct position + + + switch (position) { + + case "middle": + + case "center": + + adjust = -_this3.element.clientWidth / 2; + + break; + + case "right": + + adjust = colEl.clientWidth - _this3.headersElement.clientWidth; + + break; + + } + + //check column visibility + + + if (!ifVisible) { + + offset = colEl.offsetLeft; + + if (offset > 0 && offset + colEl.offsetWidth < _this3.element.clientWidth) { + + return false; + } + } + + //calculate scroll position + + + left = colEl.offsetLeft + adjust; + + left = Math.max(Math.min(left, _this3.table.rowManager.element.scrollWidth - _this3.table.rowManager.element.clientWidth), 0); + + _this3.table.rowManager.scrollHorizontal(left); + + _this3.scrollHorizontal(left); + + resolve(); + } else { + + console.warn("Scroll Error - Column not visible"); + + reject("Scroll Error - Column not visible"); + } + }); + }; + + //////////////// Cell Management ///////////////// + + + ColumnManager.prototype.generateCells = function (row) { + + var self = this; + + var cells = []; + + self.columnsByIndex.forEach(function (column) { + + cells.push(column.generateCell(row)); + }); + + return cells; + }; + + //////////////// Column Management ///////////////// + + + ColumnManager.prototype.getFlexBaseWidth = function () { + + var self = this, + totalWidth = self.table.element.clientWidth, + //table element width + + + fixedWidth = 0; + + //adjust for vertical scrollbar if present + + + if (self.rowManager.element.scrollHeight > self.rowManager.element.clientHeight) { + + totalWidth -= self.rowManager.element.offsetWidth - self.rowManager.element.clientWidth; + } + + this.columnsByIndex.forEach(function (column) { + + var width, minWidth, colWidth; + + if (column.visible) { + + width = column.definition.width || 0; + + minWidth = typeof column.minWidth == "undefined" ? self.table.options.columnMinWidth : parseInt(column.minWidth); + + if (typeof width == "string") { + + if (width.indexOf("%") > -1) { + + colWidth = totalWidth / 100 * parseInt(width); + } else { + + colWidth = parseInt(width); + } + } else { + + colWidth = width; + } + + fixedWidth += colWidth > minWidth ? colWidth : minWidth; + } + }); + + return fixedWidth; + }; + + ColumnManager.prototype.addColumn = function (definition, before, nextToColumn) { + var _this4 = this; + + return new Promise(function (resolve, reject) { + + var column = _this4._addColumn(definition, before, nextToColumn); + + _this4._reIndexColumns(); + + if (_this4.table.options.responsiveLayout && _this4.table.modExists("responsiveLayout", true)) { + + _this4.table.modules.responsiveLayout.initialize(); + } + + if (_this4.table.modExists("columnCalcs")) { + + _this4.table.modules.columnCalcs.recalc(_this4.table.rowManager.activeRows); + } + + _this4.redraw(); + + if (_this4.table.modules.layout.getMode() != "fitColumns") { + + column.reinitializeWidth(); + } + + _this4._verticalAlignHeaders(); + + _this4.table.rowManager.reinitialize(); + + if (_this4.table.options.virtualDomHoz) { + + _this4.table.vdomHoz.reinitialize(); + } + + resolve(column); + }); + }; + + //remove column from system + + + ColumnManager.prototype.deregisterColumn = function (column) { + + var field = column.getField(), + index; + + //remove from field list + + + if (field) { + + delete this.columnsByField[field]; + } + + //remove from index list + + + index = this.columnsByIndex.indexOf(column); + + if (index > -1) { + + this.columnsByIndex.splice(index, 1); + } + + //remove from column list + + + index = this.columns.indexOf(column); + + if (index > -1) { + + this.columns.splice(index, 1); + } + + if (this.table.options.responsiveLayout && this.table.modExists("responsiveLayout", true)) { + + this.table.modules.responsiveLayout.initialize(); + } + + this._verticalAlignHeaders(); + + this.redraw(); + }; + + //redraw columns + + + ColumnManager.prototype.redraw = function (force) { + + if (force) { + + if (Tabulator.prototype.helpers.elVisible(this.element)) { + + this._verticalAlignHeaders(); + } + + this.table.rowManager.resetScroll(); + + this.table.rowManager.reinitialize(); + } + + if (["fitColumns", "fitDataStretch"].indexOf(this.table.modules.layout.getMode()) > -1) { + + this.table.modules.layout.layout(); + } else { + + if (force) { + + this.table.modules.layout.layout(); + } else { + + if (this.table.options.responsiveLayout && this.table.modExists("responsiveLayout", true)) { + + this.table.modules.responsiveLayout.update(); + } + } + } + + if (this.table.modExists("frozenColumns")) { + + this.table.modules.frozenColumns.layout(); + } + + if (this.table.modExists("columnCalcs")) { + + this.table.modules.columnCalcs.recalc(this.table.rowManager.activeRows); + } + + if (force) { + + if (this.table.options.persistence && this.table.modExists("persistence", true) && this.table.modules.persistence.config.columns) { + + this.table.modules.persistence.save("columns"); + } + + if (this.table.modExists("columnCalcs")) { + + this.table.modules.columnCalcs.redraw(); + } + } + + this.table.footerManager.redraw(); + }; + + //public column object + + var ColumnComponent = function ColumnComponent(column) { + + this._column = column; + + this.type = "ColumnComponent"; + }; + + ColumnComponent.prototype.getElement = function () { + + return this._column.getElement(); + }; + + ColumnComponent.prototype.getDefinition = function () { + + return this._column.getDefinition(); + }; + + ColumnComponent.prototype.getField = function () { + + return this._column.getField(); + }; + + ColumnComponent.prototype.getCells = function () { + + var cells = []; + + this._column.cells.forEach(function (cell) { + + cells.push(cell.getComponent()); + }); + + return cells; + }; + + ColumnComponent.prototype.getVisibility = function () { + + console.warn("getVisibility function is deprecated, you should now use the isVisible function"); + + return this._column.visible; + }; + + ColumnComponent.prototype.isVisible = function () { + + return this._column.visible; + }; + + ColumnComponent.prototype.show = function () { + + if (this._column.isGroup) { + + this._column.columns.forEach(function (column) { + + column.show(); + }); + } else { + + this._column.show(); + } + }; + + ColumnComponent.prototype.hide = function () { + + if (this._column.isGroup) { + + this._column.columns.forEach(function (column) { + + column.hide(); + }); + } else { + + this._column.hide(); + } + }; + + ColumnComponent.prototype.toggle = function () { + + if (this._column.visible) { + + this.hide(); + } else { + + this.show(); + } + }; + + ColumnComponent.prototype.delete = function () { + + return this._column.delete(); + }; + + ColumnComponent.prototype.getSubColumns = function () { + + var output = []; + + if (this._column.columns.length) { + + this._column.columns.forEach(function (column) { + + output.push(column.getComponent()); + }); + } + + return output; + }; + + ColumnComponent.prototype.getParentColumn = function () { + + return this._column.parent instanceof Column ? this._column.parent.getComponent() : false; + }; + + ColumnComponent.prototype._getSelf = function () { + + return this._column; + }; + + ColumnComponent.prototype.scrollTo = function () { + + return this._column.table.columnManager.scrollToColumn(this._column); + }; + + ColumnComponent.prototype.getTable = function () { + + return this._column.table; + }; + + ColumnComponent.prototype.headerFilterFocus = function () { + + if (this._column.table.modExists("filter", true)) { + + this._column.table.modules.filter.setHeaderFilterFocus(this._column); + } + }; + + ColumnComponent.prototype.reloadHeaderFilter = function () { + + if (this._column.table.modExists("filter", true)) { + + this._column.table.modules.filter.reloadHeaderFilter(this._column); + } + }; + + ColumnComponent.prototype.getHeaderFilterValue = function () { + + if (this._column.table.modExists("filter", true)) { + + return this._column.table.modules.filter.getHeaderFilterValue(this._column); + } + }; + + ColumnComponent.prototype.setHeaderFilterValue = function (value) { + + if (this._column.table.modExists("filter", true)) { + + this._column.table.modules.filter.setHeaderFilterValue(this._column, value); + } + }; + + ColumnComponent.prototype.move = function (to, after) { + + var toColumn = this._column.table.columnManager.findColumn(to); + + if (toColumn) { + + this._column.table.columnManager.moveColumn(this._column, toColumn, after); + } else { + + console.warn("Move Error - No matching column found:", toColumn); + } + }; + + ColumnComponent.prototype.getNextColumn = function () { + + var nextCol = this._column.nextColumn(); + + return nextCol ? nextCol.getComponent() : false; + }; + + ColumnComponent.prototype.getPrevColumn = function () { + + var prevCol = this._column.prevColumn(); + + return prevCol ? prevCol.getComponent() : false; + }; + + ColumnComponent.prototype.updateDefinition = function (updates) { + + return this._column.updateDefinition(updates); + }; + + ColumnComponent.prototype.getWidth = function () { + + return this._column.getWidth(); + }; + + ColumnComponent.prototype.setWidth = function (width) { + + var result; + + if (width === true) { + + result = this._column.reinitializeWidth(true); + } else { + + result = this._column.setWidth(width); + } + + if (this._column.table.options.virtualDomHoz) { + + this._column.table.vdomHoz.reinitialize(true); + } + + return result; + }; + + ColumnComponent.prototype.validate = function () { + + return this._column.validate(); + }; + + var Column = function Column(def, parent) { + + var self = this; + + this.table = parent.table; + + this.definition = def; //column definition + + this.parent = parent; //hold parent object + + this.type = "column"; //type of element + + this.columns = []; //child columns + + this.cells = []; //cells bound to this column + + this.element = this.createElement(); //column header element + + this.contentElement = false; + + this.titleHolderElement = false; + + this.titleElement = false; + + this.groupElement = this.createGroupElement(); //column group holder element + + this.isGroup = false; + + this.tooltip = false; //hold column tooltip + + this.hozAlign = ""; //horizontal text alignment + + this.vertAlign = ""; //vert text alignment + + + //multi dimensional filed handling + + this.field = ""; + + this.fieldStructure = ""; + + this.getFieldValue = ""; + + this.setFieldValue = ""; + + this.titleFormatterRendered = false; + + this.setField(this.definition.field); + + if (this.table.options.invalidOptionWarnings) { + + this.checkDefinition(); + } + + this.modules = {}; //hold module variables; + + + this.cellEvents = { + + cellClick: false, + + cellDblClick: false, + + cellContext: false, + + cellTap: false, + + cellDblTap: false, + + cellTapHold: false, + + cellMouseEnter: false, + + cellMouseLeave: false, + + cellMouseOver: false, + + cellMouseOut: false, + + cellMouseMove: false + + }; + + this.width = null; //column width + + this.widthStyled = ""; //column width prestyled to improve render efficiency + + this.minWidth = null; //column minimum width + + this.minWidthStyled = ""; //column minimum prestyled to improve render efficiency + + this.widthFixed = false; //user has specified a width for this column + + + this.visible = true; //default visible state + + + this.component = null; + + this._mapDepricatedFunctionality(); + + //initialize column + + if (def.columns) { + + this.isGroup = true; + + def.columns.forEach(function (def, i) { + + var newCol = new Column(def, self); + + self.attachColumn(newCol); + }); + + self.checkColumnVisibility(); + } else { + + parent.registerColumnField(this); + } + + if (def.rowHandle && this.table.options.movableRows !== false && this.table.modExists("moveRow")) { + + this.table.modules.moveRow.setHandle(true); + } + + this._buildHeader(); + + this.bindModuleColumns(); + }; + + Column.prototype.createElement = function () { + + var el = document.createElement("div"); + + el.classList.add("tabulator-col"); + + el.setAttribute("role", "columnheader"); + + el.setAttribute("aria-sort", "none"); + + return el; + }; + + Column.prototype.createGroupElement = function () { + + var el = document.createElement("div"); + + el.classList.add("tabulator-col-group-cols"); + + return el; + }; + + Column.prototype.checkDefinition = function () { + var _this5 = this; + + Object.keys(this.definition).forEach(function (key) { + + if (_this5.defaultOptionList.indexOf(key) === -1) { + + console.warn("Invalid column definition option in '" + (_this5.field || _this5.definition.title) + "' column:", key); + } + }); + }; + + Column.prototype.setField = function (field) { + + this.field = field; + + this.fieldStructure = field ? this.table.options.nestedFieldSeparator ? field.split(this.table.options.nestedFieldSeparator) : [field] : []; + + this.getFieldValue = this.fieldStructure.length > 1 ? this._getNestedData : this._getFlatData; + + this.setFieldValue = this.fieldStructure.length > 1 ? this._setNestedData : this._setFlatData; + }; + + //register column position with column manager + + Column.prototype.registerColumnPosition = function (column) { + + this.parent.registerColumnPosition(column); + }; + + //register column position with column manager + + Column.prototype.registerColumnField = function (column) { + + this.parent.registerColumnField(column); + }; + + //trigger position registration + + Column.prototype.reRegisterPosition = function () { + + if (this.isGroup) { + + this.columns.forEach(function (column) { + + column.reRegisterPosition(); + }); + } else { + + this.registerColumnPosition(this); + } + }; + + Column.prototype._mapDepricatedFunctionality = function () { + + if (typeof this.definition.hideInHtml !== "undefined") { + + this.definition.htmlOutput = !this.definition.hideInHtml; + + console.warn("hideInHtml column definition property is deprecated, you should now use htmlOutput"); + } + + if (typeof this.definition.align !== "undefined") { + + this.definition.hozAlign = this.definition.align; + + console.warn("align column definition property is deprecated, you should now use hozAlign"); + } + + if (typeof this.definition.downloadTitle !== "undefined") { + + this.definition.titleDownload = this.definition.downloadTitle; + + console.warn("downloadTitle definition property is deprecated, you should now use titleDownload"); + } + }; + + Column.prototype.setTooltip = function () { + + var self = this, + def = self.definition; + + //set header tooltips + + var tooltip = def.headerTooltip || def.tooltip === false ? def.headerTooltip : self.table.options.tooltipsHeader; + + if (tooltip) { + + if (tooltip === true) { + + if (def.field) { + + self.table.modules.localize.bind("columns|" + def.field, function (value) { + + self.element.setAttribute("title", value || def.title); + }); + } else { + + self.element.setAttribute("title", def.title); + } + } else { + + if (typeof tooltip == "function") { + + tooltip = tooltip(self.getComponent()); + + if (tooltip === false) { + + tooltip = ""; + } + } + + self.element.setAttribute("title", tooltip); + } + } else { + + self.element.setAttribute("title", ""); + } + }; + + //build header element + + Column.prototype._buildHeader = function () { + + var self = this, + def = self.definition; + + while (self.element.firstChild) { + self.element.removeChild(self.element.firstChild); + }if (def.headerVertical) { + + self.element.classList.add("tabulator-col-vertical"); + + if (def.headerVertical === "flip") { + + self.element.classList.add("tabulator-col-vertical-flip"); + } + } + + self.contentElement = self._bindEvents(); + + self.contentElement = self._buildColumnHeaderContent(); + + self.element.appendChild(self.contentElement); + + if (self.isGroup) { + + self._buildGroupHeader(); + } else { + + self._buildColumnHeader(); + } + + self.setTooltip(); + + //set resizable handles + + if (self.table.options.resizableColumns && self.table.modExists("resizeColumns")) { + + self.table.modules.resizeColumns.initializeColumn("header", self, self.element); + } + + //set resizable handles + + if (def.headerFilter && self.table.modExists("filter") && self.table.modExists("edit")) { + + if (typeof def.headerFilterPlaceholder !== "undefined" && def.field) { + + self.table.modules.localize.setHeaderFilterColumnPlaceholder(def.field, def.headerFilterPlaceholder); + } + + self.table.modules.filter.initializeColumn(self); + } + + //set resizable handles + + if (self.table.modExists("frozenColumns")) { + + self.table.modules.frozenColumns.initializeColumn(self); + } + + //set movable column + + if (self.table.options.movableColumns && !self.isGroup && self.table.modExists("moveColumn")) { + + self.table.modules.moveColumn.initializeColumn(self); + } + + //set calcs column + + if ((def.topCalc || def.bottomCalc) && self.table.modExists("columnCalcs")) { + + self.table.modules.columnCalcs.initializeColumn(self); + } + + //handle persistence + + if (self.table.modExists("persistence") && self.table.modules.persistence.config.columns) { + + self.table.modules.persistence.initializeColumn(self); + } + + //update header tooltip on mouse enter + + self.element.addEventListener("mouseenter", function (e) { + + self.setTooltip(); + }); + }; + + Column.prototype._bindEvents = function () { + + var self = this, + def = self.definition, + dblTap, + tapHold, + tap; + + //setup header click event bindings + + if (typeof def.headerClick == "function") { + + self.element.addEventListener("click", function (e) { + def.headerClick(e, self.getComponent()); + }); + } + + if (typeof def.headerDblClick == "function") { + + self.element.addEventListener("dblclick", function (e) { + def.headerDblClick(e, self.getComponent()); + }); + } + + if (typeof def.headerContext == "function") { + + self.element.addEventListener("contextmenu", function (e) { + def.headerContext(e, self.getComponent()); + }); + } + + //setup header tap event bindings + + if (typeof def.headerTap == "function") { + + tap = false; + + self.element.addEventListener("touchstart", function (e) { + + tap = true; + }, { passive: true }); + + self.element.addEventListener("touchend", function (e) { + + if (tap) { + + def.headerTap(e, self.getComponent()); + } + + tap = false; + }); + } + + if (typeof def.headerDblTap == "function") { + + dblTap = null; + + self.element.addEventListener("touchend", function (e) { + + if (dblTap) { + + clearTimeout(dblTap); + + dblTap = null; + + def.headerDblTap(e, self.getComponent()); + } else { + + dblTap = setTimeout(function () { + + clearTimeout(dblTap); + + dblTap = null; + }, 300); + } + }); + } + + if (typeof def.headerTapHold == "function") { + + tapHold = null; + + self.element.addEventListener("touchstart", function (e) { + + clearTimeout(tapHold); + + tapHold = setTimeout(function () { + + clearTimeout(tapHold); + + tapHold = null; + + tap = false; + + def.headerTapHold(e, self.getComponent()); + }, 1000); + }, { passive: true }); + + self.element.addEventListener("touchend", function (e) { + + clearTimeout(tapHold); + + tapHold = null; + }); + } + + //store column cell click event bindings + + if (typeof def.cellClick == "function") { + + self.cellEvents.cellClick = def.cellClick; + } + + if (typeof def.cellDblClick == "function") { + + self.cellEvents.cellDblClick = def.cellDblClick; + } + + if (typeof def.cellContext == "function") { + + self.cellEvents.cellContext = def.cellContext; + } + + //store column mouse event bindings + + if (typeof def.cellMouseEnter == "function") { + + self.cellEvents.cellMouseEnter = def.cellMouseEnter; + } + + if (typeof def.cellMouseLeave == "function") { + + self.cellEvents.cellMouseLeave = def.cellMouseLeave; + } + + if (typeof def.cellMouseOver == "function") { + + self.cellEvents.cellMouseOver = def.cellMouseOver; + } + + if (typeof def.cellMouseOut == "function") { + + self.cellEvents.cellMouseOut = def.cellMouseOut; + } + + if (typeof def.cellMouseMove == "function") { + + self.cellEvents.cellMouseMove = def.cellMouseMove; + } + + //setup column cell tap event bindings + + if (typeof def.cellTap == "function") { + + self.cellEvents.cellTap = def.cellTap; + } + + if (typeof def.cellDblTap == "function") { + + self.cellEvents.cellDblTap = def.cellDblTap; + } + + if (typeof def.cellTapHold == "function") { + + self.cellEvents.cellTapHold = def.cellTapHold; + } + + //setup column cell edit callbacks + + if (typeof def.cellEdited == "function") { + + self.cellEvents.cellEdited = def.cellEdited; + } + + if (typeof def.cellEditing == "function") { + + self.cellEvents.cellEditing = def.cellEditing; + } + + if (typeof def.cellEditCancelled == "function") { + + self.cellEvents.cellEditCancelled = def.cellEditCancelled; + } + }; + + //build header element for header + + Column.prototype._buildColumnHeader = function () { + var _this6 = this; + + var def = this.definition, + table = this.table, + sortable; + + //set column sorter + + if (table.modExists("sort")) { + + table.modules.sort.initializeColumn(this, this.titleHolderElement); + } + + //set column header context menu + + if ((def.headerContextMenu || def.headerClickMenu || def.headerMenu) && table.modExists("menu")) { + + table.modules.menu.initializeColumnHeader(this); + } + + //set column formatter + + if (table.modExists("format")) { + + table.modules.format.initializeColumn(this); + } + + //set column editor + + if (typeof def.editor != "undefined" && table.modExists("edit")) { + + table.modules.edit.initializeColumn(this); + } + + //set colum validator + + if (typeof def.validator != "undefined" && table.modExists("validate")) { + + table.modules.validate.initializeColumn(this); + } + + //set column mutator + + if (table.modExists("mutator")) { + + table.modules.mutator.initializeColumn(this); + } + + //set column accessor + + if (table.modExists("accessor")) { + + table.modules.accessor.initializeColumn(this); + } + + //set respoviveLayout + + if (_typeof(table.options.responsiveLayout) && table.modExists("responsiveLayout")) { + + table.modules.responsiveLayout.initializeColumn(this); + } + + //set column visibility + + if (typeof def.visible != "undefined") { + + if (def.visible) { + + this.show(true); + } else { + + this.hide(true); + } + } + + //asign additional css classes to column header + + if (def.cssClass) { + + var classeNames = def.cssClass.split(" "); + + classeNames.forEach(function (className) { + + _this6.element.classList.add(className); + }); + } + + if (def.field) { + + this.element.setAttribute("tabulator-field", def.field); + } + + //set min width if present + + this.setMinWidth(typeof def.minWidth == "undefined" ? this.table.options.columnMinWidth : parseInt(def.minWidth)); + + this.reinitializeWidth(); + + //set tooltip if present + + this.tooltip = this.definition.tooltip || this.definition.tooltip === false ? this.definition.tooltip : this.table.options.tooltips; + + //set orizontal text alignment + + this.hozAlign = typeof this.definition.hozAlign == "undefined" ? this.table.options.cellHozAlign : this.definition.hozAlign; + + this.vertAlign = typeof this.definition.vertAlign == "undefined" ? this.table.options.cellVertAlign : this.definition.vertAlign; + + this.titleElement.style.textAlign = this.definition.headerHozAlign || this.table.options.headerHozAlign; + }; + + Column.prototype._buildColumnHeaderContent = function () { + + var def = this.definition, + table = this.table; + + var contentElement = document.createElement("div"); + + contentElement.classList.add("tabulator-col-content"); + + this.titleHolderElement = document.createElement("div"); + + this.titleHolderElement.classList.add("tabulator-col-title-holder"); + + contentElement.appendChild(this.titleHolderElement); + + this.titleElement = this._buildColumnHeaderTitle(); + + this.titleHolderElement.appendChild(this.titleElement); + + return contentElement; + }; + + //build title element of column + + Column.prototype._buildColumnHeaderTitle = function () { + + var self = this, + def = self.definition, + table = self.table, + title; + + var titleHolderElement = document.createElement("div"); + + titleHolderElement.classList.add("tabulator-col-title"); + + if (def.editableTitle) { + + var titleElement = document.createElement("input"); + + titleElement.classList.add("tabulator-title-editor"); + + titleElement.addEventListener("click", function (e) { + + e.stopPropagation(); + + titleElement.focus(); + }); + + titleElement.addEventListener("change", function () { + + def.title = titleElement.value; + + table.options.columnTitleChanged.call(self.table, self.getComponent()); + }); + + titleHolderElement.appendChild(titleElement); + + if (def.field) { + + table.modules.localize.bind("columns|" + def.field, function (text) { + + titleElement.value = text || def.title || " "; + }); + } else { + + titleElement.value = def.title || " "; + } + } else { + + if (def.field) { + + table.modules.localize.bind("columns|" + def.field, function (text) { + + self._formatColumnHeaderTitle(titleHolderElement, text || def.title || " "); + }); + } else { + + self._formatColumnHeaderTitle(titleHolderElement, def.title || " "); + } + } + + return titleHolderElement; + }; + + Column.prototype._formatColumnHeaderTitle = function (el, title) { + var _this7 = this; + + var formatter, contents, params, mockCell, onRendered; + + if (this.definition.titleFormatter && this.table.modExists("format")) { + + formatter = this.table.modules.format.getFormatter(this.definition.titleFormatter); + + onRendered = function onRendered(callback) { + + _this7.titleFormatterRendered = callback; + }; + + mockCell = { + + getValue: function getValue() { + + return title; + }, + + getElement: function getElement() { + + return el; + } + + }; + + params = this.definition.titleFormatterParams || {}; + + params = typeof params === "function" ? params() : params; + + contents = formatter.call(this.table.modules.format, mockCell, params, onRendered); + + switch (typeof contents === 'undefined' ? 'undefined' : _typeof(contents)) { + + case "object": + + if (contents instanceof Node) { + + el.appendChild(contents); + } else { + + el.innerHTML = ""; + + console.warn("Format Error - Title formatter has returned a type of object, the only valid formatter object return is an instance of Node, the formatter returned:", contents); + } + + break; + + case "undefined": + + case "null": + + el.innerHTML = ""; + + break; + + default: + + el.innerHTML = contents; + + } + } else { + + el.innerHTML = title; + } + }; + + //build header element for column group + + Column.prototype._buildGroupHeader = function () { + var _this8 = this; + + this.element.classList.add("tabulator-col-group"); + + this.element.setAttribute("role", "columngroup"); + + this.element.setAttribute("aria-title", this.definition.title); + + //asign additional css classes to column header + + if (this.definition.cssClass) { + + var classeNames = this.definition.cssClass.split(" "); + + classeNames.forEach(function (className) { + + _this8.element.classList.add(className); + }); + } + + //set column header context menu + + if ((this.definition.headerContextMenu || this.definition.headerMenu) && this.table.modExists("menu")) { + + this.table.modules.menu.initializeColumnHeader(this); + } + + this.element.appendChild(this.groupElement); + }; + + //flat field lookup + + Column.prototype._getFlatData = function (data) { + + return data[this.field]; + }; + + //nested field lookup + + Column.prototype._getNestedData = function (data) { + + var dataObj = data, + structure = this.fieldStructure, + length = structure.length, + output; + + for (var _i = 0; _i < length; _i++) { + + dataObj = dataObj[structure[_i]]; + + output = dataObj; + + if (!dataObj) { + + break; + } + } + + return output; + }; + + //flat field set + + Column.prototype._setFlatData = function (data, value) { + + if (this.field) { + + data[this.field] = value; + } + }; + + //nested field set + + Column.prototype._setNestedData = function (data, value) { + + var dataObj = data, + structure = this.fieldStructure, + length = structure.length; + + for (var _i2 = 0; _i2 < length; _i2++) { + + if (_i2 == length - 1) { + + dataObj[structure[_i2]] = value; + } else { + + if (!dataObj[structure[_i2]]) { + + if (typeof value !== "undefined") { + + dataObj[structure[_i2]] = {}; + } else { + + break; + } + } + + dataObj = dataObj[structure[_i2]]; + } + } + }; + + //attach column to this group + + Column.prototype.attachColumn = function (column) { + + var self = this; + + if (self.groupElement) { + + self.columns.push(column); + + self.groupElement.appendChild(column.getElement()); + } else { + + console.warn("Column Warning - Column being attached to another column instead of column group"); + } + }; + + //vertically align header in column + + Column.prototype.verticalAlign = function (alignment, height) { + + //calculate height of column header and group holder element + + var parentHeight = this.parent.isGroup ? this.parent.getGroupElement().clientHeight : height || this.parent.getHeadersElement().clientHeight; + + // var parentHeight = this.parent.isGroup ? this.parent.getGroupElement().clientHeight : this.parent.getHeadersElement().clientHeight; + + + this.element.style.height = parentHeight + "px"; + + if (this.isGroup) { + + this.groupElement.style.minHeight = parentHeight - this.contentElement.offsetHeight + "px"; + } + + //vertically align cell contents + + if (!this.isGroup && alignment !== "top") { + + if (alignment === "bottom") { + + this.element.style.paddingTop = this.element.clientHeight - this.contentElement.offsetHeight + "px"; + } else { + + this.element.style.paddingTop = (this.element.clientHeight - this.contentElement.offsetHeight) / 2 + "px"; + } + } + + this.columns.forEach(function (column) { + + column.verticalAlign(alignment); + }); + }; + + //clear vertical alignmenet + + Column.prototype.clearVerticalAlign = function () { + + this.element.style.paddingTop = ""; + + this.element.style.height = ""; + + this.element.style.minHeight = ""; + + this.groupElement.style.minHeight = ""; + + this.columns.forEach(function (column) { + + column.clearVerticalAlign(); + }); + }; + + Column.prototype.bindModuleColumns = function () { + + //check if rownum formatter is being used on a column + + if (this.definition.formatter == "rownum") { + + this.table.rowManager.rowNumColumn = this; + } + }; + + //// Retreive Column Information //// + + + //return column header element + + Column.prototype.getElement = function () { + + return this.element; + }; + + //return colunm group element + + Column.prototype.getGroupElement = function () { + + return this.groupElement; + }; + + //return field name + + Column.prototype.getField = function () { + + return this.field; + }; + + //return the first column in a group + + Column.prototype.getFirstColumn = function () { + + if (!this.isGroup) { + + return this; + } else { + + if (this.columns.length) { + + return this.columns[0].getFirstColumn(); + } else { + + return false; + } + } + }; + + //return the last column in a group + + Column.prototype.getLastColumn = function () { + + if (!this.isGroup) { + + return this; + } else { + + if (this.columns.length) { + + return this.columns[this.columns.length - 1].getLastColumn(); + } else { + + return false; + } + } + }; + + //return all columns in a group + + Column.prototype.getColumns = function () { + + return this.columns; + }; + + //return all columns in a group + + Column.prototype.getCells = function () { + + return this.cells; + }; + + //retreive the top column in a group of columns + + Column.prototype.getTopColumn = function () { + + if (this.parent.isGroup) { + + return this.parent.getTopColumn(); + } else { + + return this; + } + }; + + //return column definition object + + Column.prototype.getDefinition = function (updateBranches) { + + var colDefs = []; + + if (this.isGroup && updateBranches) { + + this.columns.forEach(function (column) { + + colDefs.push(column.getDefinition(true)); + }); + + this.definition.columns = colDefs; + } + + return this.definition; + }; + + //////////////////// Actions //////////////////// + + + Column.prototype.checkColumnVisibility = function () { + + var visible = false; + + this.columns.forEach(function (column) { + + if (column.visible) { + + visible = true; + } + }); + + if (visible) { + + this.show(); + + this.parent.table.options.columnVisibilityChanged.call(this.table, this.getComponent(), false); + } else { + + this.hide(); + } + }; + + //show column + + Column.prototype.show = function (silent, responsiveToggle) { + + if (!this.visible) { + + this.visible = true; + + this.element.style.display = ""; + + if (this.parent.isGroup) { + + this.parent.checkColumnVisibility(); + } + + this.cells.forEach(function (cell) { + + cell.show(); + }); + + if (!this.isGroup && this.width === null) { + + this.reinitializeWidth(); + } + + this.table.columnManager._verticalAlignHeaders(); + + if (this.table.options.persistence && this.table.modExists("persistence", true) && this.table.modules.persistence.config.columns) { + + this.table.modules.persistence.save("columns"); + } + + if (!responsiveToggle && this.table.options.responsiveLayout && this.table.modExists("responsiveLayout", true)) { + + this.table.modules.responsiveLayout.updateColumnVisibility(this, this.visible); + } + + if (!silent) { + + this.table.options.columnVisibilityChanged.call(this.table, this.getComponent(), true); + } + + if (this.parent.isGroup) { + + this.parent.matchChildWidths(); + } + } + }; + + //hide column + + Column.prototype.hide = function (silent, responsiveToggle) { + + if (this.visible) { + + this.visible = false; + + this.element.style.display = "none"; + + this.table.columnManager._verticalAlignHeaders(); + + if (this.parent.isGroup) { + + this.parent.checkColumnVisibility(); + } + + this.cells.forEach(function (cell) { + + cell.hide(); + }); + + if (this.table.options.persistence && this.table.modExists("persistence", true) && this.table.modules.persistence.config.columns) { + + this.table.modules.persistence.save("columns"); + } + + if (!responsiveToggle && this.table.options.responsiveLayout && this.table.modExists("responsiveLayout", true)) { + + this.table.modules.responsiveLayout.updateColumnVisibility(this, this.visible); + } + + if (!silent) { + + this.table.options.columnVisibilityChanged.call(this.table, this.getComponent(), false); + } + + if (this.parent.isGroup) { + + this.parent.matchChildWidths(); + } + } + }; + + Column.prototype.matchChildWidths = function () { + + var childWidth = 0; + + if (this.contentElement && this.columns.length) { + + this.columns.forEach(function (column) { + + if (column.visible) { + + childWidth += column.getWidth(); + } + }); + + this.contentElement.style.maxWidth = childWidth - 1 + "px"; + + if (this.parent.isGroup) { + + this.parent.matchChildWidths(); + } + } + }; + + Column.prototype.setWidth = function (width) { + + this.widthFixed = true; + + this.setWidthActual(width); + }; + + Column.prototype.setWidthActual = function (width) { + + if (isNaN(width)) { + + width = Math.floor(this.table.element.clientWidth / 100 * parseInt(width)); + } + + width = Math.max(this.minWidth, width); + + this.width = width; + + this.widthStyled = width ? width + "px" : ""; + + this.element.style.width = this.widthStyled; + + if (!this.isGroup) { + + this.cells.forEach(function (cell) { + + cell.setWidth(); + }); + } + + if (this.parent.isGroup) { + + this.parent.matchChildWidths(); + } + + //set resizable handles + + if (this.table.modExists("frozenColumns")) { + + this.table.modules.frozenColumns.layout(); + } + }; + + Column.prototype.checkCellHeights = function () { + + var rows = []; + + this.cells.forEach(function (cell) { + + if (cell.row.heightInitialized) { + + if (cell.row.getElement().offsetParent !== null) { + + rows.push(cell.row); + + cell.row.clearCellHeight(); + } else { + + cell.row.heightInitialized = false; + } + } + }); + + rows.forEach(function (row) { + + row.calcHeight(); + }); + + rows.forEach(function (row) { + + row.setCellHeight(); + }); + }; + + Column.prototype.getWidth = function () { + + var width = 0; + + if (this.isGroup) { + + this.columns.forEach(function (column) { + + if (column.visible) { + + width += column.getWidth(); + } + }); + } else { + + width = this.width; + } + + return width; + }; + + Column.prototype.getHeight = function () { + + return this.element.offsetHeight; + }; + + Column.prototype.setMinWidth = function (minWidth) { + + this.minWidth = minWidth; + + this.minWidthStyled = minWidth ? minWidth + "px" : ""; + + this.element.style.minWidth = this.minWidthStyled; + + this.cells.forEach(function (cell) { + + cell.setMinWidth(); + }); + }; + + Column.prototype.delete = function () { + var _this9 = this; + + return new Promise(function (resolve, reject) { + + if (_this9.isGroup) { + + _this9.columns.forEach(function (column) { + + column.delete(); + }); + } + + //cancel edit if column is currently being edited + + if (_this9.table.modExists("edit")) { + + if (_this9.table.modules.edit.currentCell.column === _this9) { + + _this9.table.modules.edit.cancelEdit(); + } + } + + var cellCount = _this9.cells.length; + + for (var _i3 = 0; _i3 < cellCount; _i3++) { + + _this9.cells[0].delete(); + } + + if (_this9.element.parentNode) { + + _this9.element.parentNode.removeChild(_this9.element); + } + + _this9.element = false; + + _this9.contentElement = false; + + _this9.titleElement = false; + + _this9.groupElement = false; + + _this9.table.columnManager.deregisterColumn(_this9); + + if (_this9.table.options.virtualDomHoz) { + + _this9.table.vdomHoz.reinitialize(true); + } + + resolve(); + }); + }; + + Column.prototype.columnRendered = function () { + + if (this.titleFormatterRendered) { + + this.titleFormatterRendered(); + } + }; + + Column.prototype.validate = function () { + + var invalid = []; + + this.cells.forEach(function (cell) { + + if (!cell.validate()) { + + invalid.push(cell.getComponent()); + } + }); + + return invalid.length ? invalid : true; + }; + + //////////////// Cell Management ///////////////// + + + //generate cell for this column + + Column.prototype.generateCell = function (row) { + + var self = this; + + var cell = new Cell(self, row); + + this.cells.push(cell); + + return cell; + }; + + Column.prototype.nextColumn = function () { + + var index = this.table.columnManager.findColumnIndex(this); + + return index > -1 ? this._nextVisibleColumn(index + 1) : false; + }; + + Column.prototype._nextVisibleColumn = function (index) { + + var column = this.table.columnManager.getColumnByIndex(index); + + return !column || column.visible ? column : this._nextVisibleColumn(index + 1); + }; + + Column.prototype.prevColumn = function () { + + var index = this.table.columnManager.findColumnIndex(this); + + return index > -1 ? this._prevVisibleColumn(index - 1) : false; + }; + + Column.prototype._prevVisibleColumn = function (index) { + + var column = this.table.columnManager.getColumnByIndex(index); + + return !column || column.visible ? column : this._prevVisibleColumn(index - 1); + }; + + Column.prototype.reinitializeWidth = function (force) { + + this.widthFixed = false; + + //set width if present + + if (typeof this.definition.width !== "undefined" && !force) { + + this.setWidth(this.definition.width); + } + + //hide header filters to prevent them altering column width + + if (this.table.modExists("filter")) { + + this.table.modules.filter.hideHeaderFilterElements(); + } + + this.fitToData(); + + //show header filters again after layout is complete + + if (this.table.modExists("filter")) { + + this.table.modules.filter.showHeaderFilterElements(); + } + }; + + //set column width to maximum cell width + + Column.prototype.fitToData = function () { + + var self = this; + + if (!this.widthFixed) { + + this.element.style.width = ""; + + self.cells.forEach(function (cell) { + + cell.clearWidth(); + }); + } + + var maxWidth = this.element.offsetWidth; + + if (!self.width || !this.widthFixed) { + + self.cells.forEach(function (cell) { + + var width = cell.getWidth(); + + if (width > maxWidth) { + + maxWidth = width; + } + }); + + if (maxWidth) { + + self.setWidthActual(maxWidth + 1); + } + } + }; + + Column.prototype.updateDefinition = function (updates) { + var _this10 = this; + + return new Promise(function (resolve, reject) { + + var definition; + + if (!_this10.isGroup) { + + definition = Object.assign({}, _this10.getDefinition()); + + definition = Object.assign(definition, updates); + + _this10.table.columnManager.addColumn(definition, false, _this10).then(function (column) { + + if (definition.field == _this10.field) { + + _this10.field = false; //cleair field name to prevent deletion of duplicate column from arrays + } + + _this10.delete().then(function () { + + resolve(column.getComponent()); + }).catch(function (err) { + + reject(err); + }); + }).catch(function (err) { + + reject(err); + }); + } else { + + console.warn("Column Update Error - The updateDefinition function is only available on columns, not column groups"); + + reject("Column Update Error - The updateDefinition function is only available on columns, not column groups"); + } + }); + }; + + Column.prototype.deleteCell = function (cell) { + + var index = this.cells.indexOf(cell); + + if (index > -1) { + + this.cells.splice(index, 1); + } + }; + + Column.prototype.defaultOptionList = ["title", "field", "columns", "visible", "align", "hozAlign", "vertAlign", "width", "minWidth", "widthGrow", "widthShrink", "resizable", "frozen", "responsive", "tooltip", "cssClass", "rowHandle", "hideInHtml", "print", "htmlOutput", "sorter", "sorterParams", "formatter", "formatterParams", "variableHeight", "editable", "editor", "editorParams", "validator", "mutator", "mutatorParams", "mutatorData", "mutatorDataParams", "mutatorEdit", "mutatorEditParams", "mutatorClipboard", "mutatorClipboardParams", "accessor", "accessorParams", "accessorData", "accessorDataParams", "accessorDownload", "accessorDownloadParams", "accessorClipboard", "accessorClipboardParams", "accessorPrint", "accessorPrintParams", "accessorHtmlOutput", "accessorHtmlOutputParams", "clipboard", "download", "downloadTitle", "topCalc", "topCalcParams", "topCalcFormatter", "topCalcFormatterParams", "bottomCalc", "bottomCalcParams", "bottomCalcFormatter", "bottomCalcFormatterParams", "cellClick", "cellDblClick", "cellContext", "cellTap", "cellDblTap", "cellTapHold", "cellMouseEnter", "cellMouseLeave", "cellMouseOver", "cellMouseOut", "cellMouseMove", "cellEditing", "cellEdited", "cellEditCancelled", "headerSort", "headerSortStartingDir", "headerSortTristate", "headerClick", "headerDblClick", "headerContext", "headerTap", "headerDblTap", "headerTapHold", "headerTooltip", "headerVertical", "headerHozAlign", "editableTitle", "titleFormatter", "titleFormatterParams", "headerFilter", "headerFilterPlaceholder", "headerFilterParams", "headerFilterEmptyCheck", "headerFilterFunc", "headerFilterFuncParams", "headerFilterLiveFilter", "print", "headerContextMenu", "headerMenu", "contextMenu", + + // "headerClickMenu", + + "clickMenu", "formatterPrint", "formatterPrintParams", "formatterClipboard", "formatterClipboardParams", "formatterHtmlOutput", "formatterHtmlOutputParams", "titlePrint", "titleClipboard", "titleHtmlOutput", "titleDownload"]; + + //////////////// Event Bindings ///////////////// + + + //////////////// Object Generation ///////////////// + + Column.prototype.getComponent = function () { + + if (!this.component) { + + this.component = new ColumnComponent(this); + } + + return this.component; + }; + + var RowManager = function RowManager(table) { + + this.table = table; + + this.element = this.createHolderElement(); //containing element + + this.tableElement = this.createTableElement(); //table element + + this.heightFixer = this.createTableElement(); //table element + + this.columnManager = null; //hold column manager object + + this.height = 0; //hold height of table element + + + this.firstRender = false; //handle first render + + this.renderMode = "virtual"; //current rendering mode + + this.fixedHeight = false; //current rendering mode + + + this.rows = []; //hold row data objects + + this.activeRows = []; //rows currently available to on display in the table + + this.activeRowsCount = 0; //count of active rows + + + this.displayRows = []; //rows currently on display in the table + + this.displayRowsCount = 0; //count of display rows + + + this.scrollTop = 0; + + this.scrollLeft = 0; + + this.vDomRowHeight = 20; //approximation of row heights for padding + + + this.vDomTop = 0; //hold position for first rendered row in the virtual DOM + + this.vDomBottom = 0; //hold possition for last rendered row in the virtual DOM + + + this.vDomScrollPosTop = 0; //last scroll position of the vDom top; + + this.vDomScrollPosBottom = 0; //last scroll position of the vDom bottom; + + + this.vDomTopPad = 0; //hold value of padding for top of virtual DOM + + this.vDomBottomPad = 0; //hold value of padding for bottom of virtual DOM + + + this.vDomMaxRenderChain = 90; //the maximum number of dom elements that can be rendered in 1 go + + + this.vDomWindowBuffer = 0; //window row buffer before removing elements, to smooth scrolling + + + this.vDomWindowMinTotalRows = 20; //minimum number of rows to be generated in virtual dom (prevent buffering issues on tables with tall rows) + + this.vDomWindowMinMarginRows = 5; //minimum number of rows to be generated in virtual dom margin + + + this.vDomTopNewRows = []; //rows to normalize after appending to optimize render speed + + this.vDomBottomNewRows = []; //rows to normalize after appending to optimize render speed + + + this.rowNumColumn = false; //hold column component for row number column + + + this.redrawBlock = false; //prevent redraws to allow multiple data manipulations becore continuing + + this.redrawBlockRestoreConfig = false; //store latest redraw function calls for when redraw is needed + + this.redrawBlockRederInPosition = false; //store latest redraw function calls for when redraw is needed + }; + + //////////////// Setup Functions ///////////////// + + + RowManager.prototype.createHolderElement = function () { + + var el = document.createElement("div"); + + el.classList.add("tabulator-tableHolder"); + + el.setAttribute("tabindex", 0); + + return el; + }; + + RowManager.prototype.createTableElement = function () { + + var el = document.createElement("div"); + + el.classList.add("tabulator-table"); + + return el; + }; + + //return containing element + + RowManager.prototype.getElement = function () { + + return this.element; + }; + + //return table element + + RowManager.prototype.getTableElement = function () { + + return this.tableElement; + }; + + //return position of row in table + + RowManager.prototype.getRowPosition = function (row, active) { + + if (active) { + + return this.activeRows.indexOf(row); + } else { + + return this.rows.indexOf(row); + } + }; + + //link to column manager + + RowManager.prototype.setColumnManager = function (manager) { + + this.columnManager = manager; + }; + + RowManager.prototype.initialize = function () { + + var self = this; + + self.setRenderMode(); + + //initialize manager + + self.element.appendChild(self.tableElement); + + self.firstRender = true; + + //scroll header along with table body + + self.element.addEventListener("scroll", function () { + + var left = self.element.scrollLeft; + + //handle horizontal scrolling + + if (self.scrollLeft != left) { + + self.columnManager.scrollHorizontal(left); + + if (self.table.options.groupBy) { + + self.table.modules.groupRows.scrollHeaders(left); + } + + if (self.table.modExists("columnCalcs")) { + + self.table.modules.columnCalcs.scrollHorizontal(left); + } + + self.table.options.scrollHorizontal(left); + } + + self.scrollLeft = left; + }); + + //handle virtual dom scrolling + + if (this.renderMode === "virtual") { + + self.element.addEventListener("scroll", function () { + + var top = self.element.scrollTop; + + var dir = self.scrollTop > top; + + //handle verical scrolling + + if (self.scrollTop != top) { + + self.scrollTop = top; + + self.scrollVertical(dir); + + if (self.table.options.ajaxProgressiveLoad == "scroll") { + + self.table.modules.ajax.nextPage(self.element.scrollHeight - self.element.clientHeight - top); + } + + self.table.options.scrollVertical(top); + } else { + + self.scrollTop = top; + } + }); + } + }; + + ////////////////// Row Manipulation ////////////////// + + + RowManager.prototype.findRow = function (subject) { + + var self = this; + + if ((typeof subject === 'undefined' ? 'undefined' : _typeof(subject)) == "object") { + + if (subject instanceof Row) { + + //subject is row element + + return subject; + } else if (subject instanceof RowComponent) { + + //subject is public row component + + return subject._getSelf() || false; + } else if (typeof HTMLElement !== "undefined" && subject instanceof HTMLElement) { + + //subject is a HTML element of the row + + var match = self.rows.find(function (row) { + + return row.element === subject; + }); + + return match || false; + } + } else if (typeof subject == "undefined" || subject === null) { + + return false; + } else { + + //subject should be treated as the index of the row + + var _match = self.rows.find(function (row) { + + return row.data[self.table.options.index] == subject; + }); + + return _match || false; + } + + //catch all for any other type of input + + + return false; + }; + + RowManager.prototype.getRowFromDataObject = function (data) { + + var match = this.rows.find(function (row) { + + return row.data === data; + }); + + return match || false; + }; + + RowManager.prototype.getRowFromPosition = function (position, active) { + + if (active) { + + return this.activeRows[position]; + } else { + + return this.rows[position]; + } + }; + + RowManager.prototype.scrollToRow = function (row, position, ifVisible) { + var _this11 = this; + + var rowIndex = this.getDisplayRows().indexOf(row), + rowEl = row.getElement(), + rowTop, + offset = 0; + + return new Promise(function (resolve, reject) { + + if (rowIndex > -1) { + + if (typeof position === "undefined") { + + position = _this11.table.options.scrollToRowPosition; + } + + if (typeof ifVisible === "undefined") { + + ifVisible = _this11.table.options.scrollToRowIfVisible; + } + + if (position === "nearest") { + + switch (_this11.renderMode) { + + case "classic": + + rowTop = Tabulator.prototype.helpers.elOffset(rowEl).top; + + position = Math.abs(_this11.element.scrollTop - rowTop) > Math.abs(_this11.element.scrollTop + _this11.element.clientHeight - rowTop) ? "bottom" : "top"; + + break; + + case "virtual": + + position = Math.abs(_this11.vDomTop - rowIndex) > Math.abs(_this11.vDomBottom - rowIndex) ? "bottom" : "top"; + + break; + + } + } + + //check row visibility + + if (!ifVisible) { + + if (Tabulator.prototype.helpers.elVisible(rowEl)) { + + offset = Tabulator.prototype.helpers.elOffset(rowEl).top - Tabulator.prototype.helpers.elOffset(_this11.element).top; + + if (offset > 0 && offset < _this11.element.clientHeight - rowEl.offsetHeight) { + + return false; + } + } + } + + //scroll to row + + switch (_this11.renderMode) { + + case "classic": + + _this11.element.scrollTop = Tabulator.prototype.helpers.elOffset(rowEl).top - Tabulator.prototype.helpers.elOffset(_this11.element).top + _this11.element.scrollTop; + + break; + + case "virtual": + + _this11._virtualRenderFill(rowIndex, true); + + break; + + } + + //align to correct position + + switch (position) { + + case "middle": + + case "center": + + if (_this11.element.scrollHeight - _this11.element.scrollTop == _this11.element.clientHeight) { + + _this11.element.scrollTop = _this11.element.scrollTop + (rowEl.offsetTop - _this11.element.scrollTop) - (_this11.element.scrollHeight - rowEl.offsetTop) / 2; + } else { + + _this11.element.scrollTop = _this11.element.scrollTop - _this11.element.clientHeight / 2; + } + + break; + + case "bottom": + + if (_this11.element.scrollHeight - _this11.element.scrollTop == _this11.element.clientHeight) { + + _this11.element.scrollTop = _this11.element.scrollTop - (_this11.element.scrollHeight - rowEl.offsetTop) + rowEl.offsetHeight; + } else { + + _this11.element.scrollTop = _this11.element.scrollTop - _this11.element.clientHeight + rowEl.offsetHeight; + } + + break; + + } + + resolve(); + } else { + + console.warn("Scroll Error - Row not visible"); + + reject("Scroll Error - Row not visible"); + } + }); + }; + + ////////////////// Data Handling ////////////////// + + + RowManager.prototype.setData = function (data, renderInPosition, columnsChanged) { + var _this12 = this; + + var self = this; + + return new Promise(function (resolve, reject) { + + if (renderInPosition && _this12.getDisplayRows().length) { + + if (self.table.options.pagination) { + + self._setDataActual(data, true); + } else { + + _this12.reRenderInPosition(function () { + + self._setDataActual(data); + }); + } + } else { + + if (_this12.table.options.autoColumns && columnsChanged) { + + _this12.table.columnManager.generateColumnsFromRowData(data); + } + + _this12.resetScroll(); + + _this12._setDataActual(data); + } + + resolve(); + }); + }; + + RowManager.prototype._setDataActual = function (data, renderInPosition) { + + var self = this; + + self.table.options.dataLoading.call(this.table, data); + + this._wipeElements(); + + if (this.table.options.history && this.table.modExists("history")) { + + this.table.modules.history.clear(); + } + + if (Array.isArray(data)) { + + if (this.table.modExists("selectRow")) { + + this.table.modules.selectRow.clearSelectionData(); + } + + if (this.table.options.reactiveData && this.table.modExists("reactiveData", true)) { + + this.table.modules.reactiveData.watchData(data); + } + + data.forEach(function (def, i) { + + if (def && (typeof def === 'undefined' ? 'undefined' : _typeof(def)) === "object") { + + var row = new Row(def, self); + + self.rows.push(row); + } else { + + console.warn("Data Loading Warning - Invalid row data detected and ignored, expecting object but received:", def); + } + }); + + self.refreshActiveData(false, false, renderInPosition); + + self.table.options.dataLoaded.call(this.table, data); + } else { + + console.error("Data Loading Error - Unable to process data due to invalid data type \nExpecting: array \nReceived: ", typeof data === 'undefined' ? 'undefined' : _typeof(data), "\nData: ", data); + } + }; + + RowManager.prototype._wipeElements = function () { + + this.rows.forEach(function (row) { + + row.wipe(); + }); + + if (this.table.options.groupBy && this.table.modExists("groupRows")) { + + this.table.modules.groupRows.wipe(); + } + + this.rows = []; + + this.activeRows = []; + + this.activeRowsCount = 0; + + this.displayRows = []; + + this.displayRowsCount = 0; + + this.adjustTableSize(); + }; + + RowManager.prototype.deleteRow = function (row, blockRedraw) { + + var allIndex = this.rows.indexOf(row), + activeIndex = this.activeRows.indexOf(row); + + if (activeIndex > -1) { + + this.activeRows.splice(activeIndex, 1); + } + + if (allIndex > -1) { + + this.rows.splice(allIndex, 1); + } + + this.setActiveRows(this.activeRows); + + this.displayRowIterator(function (rows) { + + var displayIndex = rows.indexOf(row); + + if (displayIndex > -1) { + + rows.splice(displayIndex, 1); + } + }); + + if (!blockRedraw) { + + this.reRenderInPosition(); + } + + this.regenerateRowNumbers(); + + this.table.options.rowDeleted.call(this.table, row.getComponent()); + + if (this.table.options.dataChanged) { + + this.table.options.dataChanged.call(this.table, this.getData()); + } + + if (this.table.options.groupBy && this.table.modExists("groupRows")) { + + this.table.modules.groupRows.updateGroupRows(true); + } else if (this.table.options.pagination && this.table.modExists("page")) { + + this.refreshActiveData(false, false, true); + } else { + + if (this.table.options.pagination && this.table.modExists("page")) { + + this.refreshActiveData("page"); + } + } + }; + + RowManager.prototype.addRow = function (data, pos, index, blockRedraw) { + + var row = this.addRowActual(data, pos, index, blockRedraw); + + if (this.table.options.history && this.table.modExists("history")) { + + this.table.modules.history.action("rowAdd", row, { data: data, pos: pos, index: index }); + } + + return row; + }; + + //add multiple rows + + RowManager.prototype.addRows = function (data, pos, index) { + var _this13 = this; + + var self = this, + length = 0, + rows = []; + + return new Promise(function (resolve, reject) { + + pos = _this13.findAddRowPos(pos); + + if (!Array.isArray(data)) { + + data = [data]; + } + + length = data.length - 1; + + if (typeof index == "undefined" && pos || typeof index !== "undefined" && !pos) { + + data.reverse(); + } + + data.forEach(function (item, i) { + + var row = self.addRow(item, pos, index, true); + + rows.push(row); + }); + + if (_this13.table.options.groupBy && _this13.table.modExists("groupRows")) { + + _this13.table.modules.groupRows.updateGroupRows(true); + } else if (_this13.table.options.pagination && _this13.table.modExists("page")) { + + _this13.refreshActiveData(false, false, true); + } else { + + _this13.reRenderInPosition(); + } + + //recalc column calculations if present + + if (_this13.table.modExists("columnCalcs")) { + + _this13.table.modules.columnCalcs.recalc(_this13.table.rowManager.activeRows); + } + + _this13.regenerateRowNumbers(); + + resolve(rows); + }); + }; + + RowManager.prototype.findAddRowPos = function (pos) { + + if (typeof pos === "undefined") { + + pos = this.table.options.addRowPos; + } + + if (pos === "pos") { + + pos = true; + } + + if (pos === "bottom") { + + pos = false; + } + + return pos; + }; + + RowManager.prototype.addRowActual = function (data, pos, index, blockRedraw) { + + var row = data instanceof Row ? data : new Row(data || {}, this), + top = this.findAddRowPos(pos), + allIndex = -1, + activeIndex, + dispRows; + + if (!index && this.table.options.pagination && this.table.options.paginationAddRow == "page") { + + dispRows = this.getDisplayRows(); + + if (top) { + + if (dispRows.length) { + + index = dispRows[0]; + } else { + + if (this.activeRows.length) { + + index = this.activeRows[this.activeRows.length - 1]; + + top = false; + } + } + } else { + + if (dispRows.length) { + + index = dispRows[dispRows.length - 1]; + + top = dispRows.length < this.table.modules.page.getPageSize() ? false : true; + } + } + } + + if (typeof index !== "undefined") { + + index = this.findRow(index); + } + + if (this.table.options.groupBy && this.table.modExists("groupRows")) { + + this.table.modules.groupRows.assignRowToGroup(row); + + var groupRows = row.getGroup().rows; + + if (groupRows.length > 1) { + + if (!index || index && groupRows.indexOf(index) == -1) { + + if (top) { + + if (groupRows[0] !== row) { + + index = groupRows[0]; + + this._moveRowInArray(row.getGroup().rows, row, index, !top); + } + } else { + + if (groupRows[groupRows.length - 1] !== row) { + + index = groupRows[groupRows.length - 1]; + + this._moveRowInArray(row.getGroup().rows, row, index, !top); + } + } + } else { + + this._moveRowInArray(row.getGroup().rows, row, index, !top); + } + } + } + + if (index) { + + allIndex = this.rows.indexOf(index); + } + + if (index && allIndex > -1) { + + activeIndex = this.activeRows.indexOf(index); + + this.displayRowIterator(function (rows) { + + var displayIndex = rows.indexOf(index); + + if (displayIndex > -1) { + + rows.splice(top ? displayIndex : displayIndex + 1, 0, row); + } + }); + + if (activeIndex > -1) { + + this.activeRows.splice(top ? activeIndex : activeIndex + 1, 0, row); + } + + this.rows.splice(top ? allIndex : allIndex + 1, 0, row); + } else { + + if (top) { + + this.displayRowIterator(function (rows) { + + rows.unshift(row); + }); + + this.activeRows.unshift(row); + + this.rows.unshift(row); + } else { + + this.displayRowIterator(function (rows) { + + rows.push(row); + }); + + this.activeRows.push(row); + + this.rows.push(row); + } + } + + this.setActiveRows(this.activeRows); + + this.table.options.rowAdded.call(this.table, row.getComponent()); + + if (this.table.options.dataChanged) { + + this.table.options.dataChanged.call(this.table, this.getData()); + } + + if (!blockRedraw) { + + this.reRenderInPosition(); + } + + return row; + }; + + RowManager.prototype.moveRow = function (from, to, after) { + + if (this.table.options.history && this.table.modExists("history")) { + + this.table.modules.history.action("rowMove", from, { posFrom: this.getRowPosition(from), posTo: this.getRowPosition(to), to: to, after: after }); + } + + this.moveRowActual(from, to, after); + + this.regenerateRowNumbers(); + + this.table.options.rowMoved.call(this.table, from.getComponent()); + }; + + RowManager.prototype.moveRowActual = function (from, to, after) { + var _this14 = this; + + this._moveRowInArray(this.rows, from, to, after); + + this._moveRowInArray(this.activeRows, from, to, after); + + this.displayRowIterator(function (rows) { + + _this14._moveRowInArray(rows, from, to, after); + }); + + if (this.table.options.groupBy && this.table.modExists("groupRows")) { + + if (!after && to instanceof Group) { + + to = this.table.rowManager.prevDisplayRow(from) || to; + } + + var toGroup = to.getGroup(); + + var fromGroup = from.getGroup(); + + if (toGroup === fromGroup) { + + this._moveRowInArray(toGroup.rows, from, to, after); + } else { + + if (fromGroup) { + + fromGroup.removeRow(from); + } + + toGroup.insertRow(from, to, after); + } + } + }; + + RowManager.prototype._moveRowInArray = function (rows, from, to, after) { + + var fromIndex, toIndex, start, end; + + if (from !== to) { + + fromIndex = rows.indexOf(from); + + if (fromIndex > -1) { + + rows.splice(fromIndex, 1); + + toIndex = rows.indexOf(to); + + if (toIndex > -1) { + + if (after) { + + rows.splice(toIndex + 1, 0, from); + } else { + + rows.splice(toIndex, 0, from); + } + } else { + + rows.splice(fromIndex, 0, from); + } + } + + //restyle rows + + if (rows === this.getDisplayRows()) { + + start = fromIndex < toIndex ? fromIndex : toIndex; + + end = toIndex > fromIndex ? toIndex : fromIndex + 1; + + for (var _i4 = start; _i4 <= end; _i4++) { + + if (rows[_i4]) { + + this.styleRow(rows[_i4], _i4); + } + } + } + } + }; + + RowManager.prototype.clearData = function () { + + this.setData([]); + }; + + RowManager.prototype.getRowIndex = function (row) { + + return this.findRowIndex(row, this.rows); + }; + + RowManager.prototype.getDisplayRowIndex = function (row) { + + var index = this.getDisplayRows().indexOf(row); + + return index > -1 ? index : false; + }; + + RowManager.prototype.nextDisplayRow = function (row, rowOnly) { + + var index = this.getDisplayRowIndex(row), + nextRow = false; + + if (index !== false && index < this.displayRowsCount - 1) { + + nextRow = this.getDisplayRows()[index + 1]; + } + + if (nextRow && (!(nextRow instanceof Row) || nextRow.type != "row")) { + + return this.nextDisplayRow(nextRow, rowOnly); + } + + return nextRow; + }; + + RowManager.prototype.prevDisplayRow = function (row, rowOnly) { + + var index = this.getDisplayRowIndex(row), + prevRow = false; + + if (index) { + + prevRow = this.getDisplayRows()[index - 1]; + } + + if (rowOnly && prevRow && (!(prevRow instanceof Row) || prevRow.type != "row")) { + + return this.prevDisplayRow(prevRow, rowOnly); + } + + return prevRow; + }; + + RowManager.prototype.findRowIndex = function (row, list) { + + var rowIndex; + + row = this.findRow(row); + + if (row) { + + rowIndex = list.indexOf(row); + + if (rowIndex > -1) { + + return rowIndex; + } + } + + return false; + }; + + RowManager.prototype.getData = function (active, transform) { + + var output = [], + rows = this.getRows(active); + + rows.forEach(function (row) { + + if (row.type == "row") { + + output.push(row.getData(transform || "data")); + } + }); + + return output; + }; + + RowManager.prototype.getComponents = function (active) { + + var output = [], + rows = this.getRows(active); + + rows.forEach(function (row) { + + output.push(row.getComponent()); + }); + + return output; + }; + + RowManager.prototype.getDataCount = function (active) { + + var rows = this.getRows(active); + + return rows.length; + }; + + RowManager.prototype._genRemoteRequest = function () { + var _this15 = this; + + var table = this.table, + options = table.options, + params = {}; + + if (table.modExists("page")) { + + //set sort data if defined + + if (options.ajaxSorting) { + + var sorters = this.table.modules.sort.getSort(); + + sorters.forEach(function (item) { + + delete item.column; + }); + + params[this.table.modules.page.paginationDataSentNames.sorters] = sorters; + } + + //set filter data if defined + + if (options.ajaxFiltering) { + + var filters = this.table.modules.filter.getFilters(true, true); + + params[this.table.modules.page.paginationDataSentNames.filters] = filters; + } + + this.table.modules.ajax.setParams(params, true); + } + + table.modules.ajax.sendRequest().then(function (data) { + + _this15._setDataActual(data, true); + }).catch(function (e) {}); + }; + + //choose the path to refresh data after a filter update + + RowManager.prototype.filterRefresh = function () { + + var table = this.table, + options = table.options, + left = this.scrollLeft; + + if (options.ajaxFiltering) { + + if (options.pagination == "remote" && table.modExists("page")) { + + table.modules.page.reset(true); + + table.modules.page.setPage(1).then(function () {}).catch(function () {}); + } else if (options.ajaxProgressiveLoad) { + + table.modules.ajax.loadData().then(function () {}).catch(function () {}); + } else { + + //assume data is url, make ajax call to url to get data + + this._genRemoteRequest(); + } + } else { + + this.refreshActiveData("filter"); + } + + this.scrollHorizontal(left); + }; + + //choose the path to refresh data after a sorter update + + RowManager.prototype.sorterRefresh = function (loadOrignalData) { + + var table = this.table, + options = this.table.options, + left = this.scrollLeft; + + if (options.ajaxSorting) { + + if ((options.pagination == "remote" || options.progressiveLoad) && table.modExists("page")) { + + table.modules.page.reset(true); + + table.modules.page.setPage(1).then(function () {}).catch(function () {}); + } else if (options.ajaxProgressiveLoad) { + + table.modules.ajax.loadData().then(function () {}).catch(function () {}); + } else { + + //assume data is url, make ajax call to url to get data + + this._genRemoteRequest(); + } + } else { + + this.refreshActiveData(loadOrignalData ? "filter" : "sort"); + } + + this.scrollHorizontal(left); + }; + + RowManager.prototype.scrollHorizontal = function (left) { + + this.scrollLeft = left; + + this.element.scrollLeft = left; + + if (this.table.options.groupBy) { + + this.table.modules.groupRows.scrollHeaders(left); + } + + if (this.table.modExists("columnCalcs")) { + + this.table.modules.columnCalcs.scrollHorizontal(left); + } + }; + + //set active data set + + RowManager.prototype.refreshActiveData = function (stage, skipStage, renderInPosition) { + + var self = this, + table = this.table, + cascadeOrder = ["all", "filter", "sort", "display", "freeze", "group", "tree", "page"], + displayIndex; + + if (this.redrawBlock) { + + if (!this.redrawBlockRestoreConfig || cascadeOrder.indexOf(stage) < cascadeOrder.indexOf(this.redrawBlockRestoreConfig.stage)) { + + this.redrawBlockRestoreConfig = { + + stage: stage, + + skipStage: skipStage, + + renderInPosition: renderInPosition + + }; + } + + return; + } else { + + if (self.table.modExists("edit")) { + + self.table.modules.edit.cancelEdit(); + } + + if (!stage) { + + stage = "all"; + } + + if (table.options.selectable && !table.options.selectablePersistence && table.modExists("selectRow")) { + + table.modules.selectRow.deselectRows(); + } + + //cascade through data refresh stages + + switch (stage) { + + case "all": + + case "filter": + + if (!skipStage) { + + if (table.modExists("filter")) { + + self.setActiveRows(table.modules.filter.filter(self.rows)); + } else { + + self.setActiveRows(self.rows.slice(0)); + } + } else { + + skipStage = false; + } + + case "sort": + + if (!skipStage) { + + if (table.modExists("sort")) { + + table.modules.sort.sort(this.activeRows); + } + } else { + + skipStage = false; + } + + //regenerate row numbers for row number formatter if in use + + this.regenerateRowNumbers(); + + //generic stage to allow for pipeline trigger after the data manipulation stage + + case "display": + + this.resetDisplayRows(); + + case "freeze": + + if (!skipStage) { + + if (this.table.modExists("frozenRows")) { + + if (table.modules.frozenRows.isFrozen()) { + + if (!table.modules.frozenRows.getDisplayIndex()) { + + table.modules.frozenRows.setDisplayIndex(this.getNextDisplayIndex()); + } + + displayIndex = table.modules.frozenRows.getDisplayIndex(); + + displayIndex = self.setDisplayRows(table.modules.frozenRows.getRows(this.getDisplayRows(displayIndex - 1)), displayIndex); + + if (displayIndex !== true) { + + table.modules.frozenRows.setDisplayIndex(displayIndex); + } + } + } + } else { + + skipStage = false; + } + + case "group": + + if (!skipStage) { + + if (table.options.groupBy && table.modExists("groupRows")) { + + if (!table.modules.groupRows.getDisplayIndex()) { + + table.modules.groupRows.setDisplayIndex(this.getNextDisplayIndex()); + } + + displayIndex = table.modules.groupRows.getDisplayIndex(); + + displayIndex = self.setDisplayRows(table.modules.groupRows.getRows(this.getDisplayRows(displayIndex - 1)), displayIndex); + + if (displayIndex !== true) { + + table.modules.groupRows.setDisplayIndex(displayIndex); + } + } + } else { + + skipStage = false; + } + + case "tree": + + if (!skipStage) { + + if (table.options.dataTree && table.modExists("dataTree")) { + + if (!table.modules.dataTree.getDisplayIndex()) { + + table.modules.dataTree.setDisplayIndex(this.getNextDisplayIndex()); + } + + displayIndex = table.modules.dataTree.getDisplayIndex(); + + displayIndex = self.setDisplayRows(table.modules.dataTree.getRows(this.getDisplayRows(displayIndex - 1)), displayIndex); + + if (displayIndex !== true) { + + table.modules.dataTree.setDisplayIndex(displayIndex); + } + } + } else { + + skipStage = false; + } + + if (table.options.pagination && table.modExists("page") && !renderInPosition) { + + if (table.modules.page.getMode() == "local") { + + table.modules.page.reset(); + } + } + + case "page": + + if (!skipStage) { + + if (table.options.pagination && table.modExists("page")) { + + if (!table.modules.page.getDisplayIndex()) { + + table.modules.page.setDisplayIndex(this.getNextDisplayIndex()); + } + + displayIndex = table.modules.page.getDisplayIndex(); + + if (table.modules.page.getMode() == "local") { + + table.modules.page.setMaxRows(this.getDisplayRows(displayIndex - 1).length); + } + + displayIndex = self.setDisplayRows(table.modules.page.getRows(this.getDisplayRows(displayIndex - 1)), displayIndex); + + if (displayIndex !== true) { + + table.modules.page.setDisplayIndex(displayIndex); + } + } + } else { + + skipStage = false; + } + + } + + if (Tabulator.prototype.helpers.elVisible(self.element)) { + + if (renderInPosition) { + + self.reRenderInPosition(); + } else { + + if (stage === "all" && this.table.options.virtualDomHoz) { + + this.table.vdomHoz.dataChange(); + } + + self.renderTable(); + + if (table.options.layoutColumnsOnNewData) { + + self.table.columnManager.redraw(true); + } + } + } + + if (table.modExists("columnCalcs")) { + + table.modules.columnCalcs.recalc(this.activeRows); + } + } + }; + + //regenerate row numbers for row number formatter if in use + + RowManager.prototype.regenerateRowNumbers = function () { + var _this16 = this; + + if (this.rowNumColumn) { + + this.activeRows.forEach(function (row) { + + var cell = row.getCell(_this16.rowNumColumn); + + if (cell) { + + cell._generateContents(); + } + }); + } + }; + + RowManager.prototype.setActiveRows = function (activeRows) { + + this.activeRows = activeRows; + + this.activeRowsCount = this.activeRows.length; + }; + + //reset display rows array + + RowManager.prototype.resetDisplayRows = function () { + + this.displayRows = []; + + this.displayRows.push(this.activeRows.slice(0)); + + this.displayRowsCount = this.displayRows[0].length; + + if (this.table.modExists("frozenRows")) { + + this.table.modules.frozenRows.setDisplayIndex(0); + } + + if (this.table.options.groupBy && this.table.modExists("groupRows")) { + + this.table.modules.groupRows.setDisplayIndex(0); + } + + if (this.table.options.pagination && this.table.modExists("page")) { + + this.table.modules.page.setDisplayIndex(0); + } + }; + + RowManager.prototype.getNextDisplayIndex = function () { + + return this.displayRows.length; + }; + + //set display row pipeline data + + RowManager.prototype.setDisplayRows = function (displayRows, index) { + + var output = true; + + if (index && typeof this.displayRows[index] != "undefined") { + + this.displayRows[index] = displayRows; + + output = true; + } else { + + this.displayRows.push(displayRows); + + output = index = this.displayRows.length - 1; + } + + if (index == this.displayRows.length - 1) { + + this.displayRowsCount = this.displayRows[this.displayRows.length - 1].length; + } + + return output; + }; + + RowManager.prototype.getDisplayRows = function (index) { + + if (typeof index == "undefined") { + + return this.displayRows.length ? this.displayRows[this.displayRows.length - 1] : []; + } else { + + return this.displayRows[index] || []; + } + }; + + RowManager.prototype.getVisibleRows = function (viewable) { + + var topEdge = this.element.scrollTop, + bottomEdge = this.element.clientHeight + topEdge, + topFound = false, + topRow = 0, + bottomRow = 0, + rows = this.getDisplayRows(); + + if (viewable) { + + this.getDisplayRows(); + + for (var i = this.vDomTop; i <= this.vDomBottom; i++) { + + if (rows[i]) { + + if (!topFound) { + + if (topEdge - rows[i].getElement().offsetTop >= 0) { + + topRow = i; + } else { + + topFound = true; + + if (bottomEdge - rows[i].getElement().offsetTop >= 0) { + + bottomRow = i; + } else { + + break; + } + } + } else { + + if (bottomEdge - rows[i].getElement().offsetTop >= 0) { + + bottomRow = i; + } else { + + break; + } + } + } + } + } else { + + topRow = this.vDomTop; + + bottomRow = this.vDomBottom; + } + + return rows.slice(topRow, bottomRow + 1); + }; + + //repeat action accross display rows + + RowManager.prototype.displayRowIterator = function (callback) { + + this.displayRows.forEach(callback); + + this.displayRowsCount = this.displayRows[this.displayRows.length - 1].length; + }; + + //return only actual rows (not group headers etc) + + RowManager.prototype.getRows = function (active) { + + var rows; + + switch (active) { + + case "active": + + rows = this.activeRows; + + break; + + case "display": + + rows = this.table.rowManager.getDisplayRows(); + + break; + + case "visible": + + rows = this.getVisibleRows(true); + + break; + + case "selected": + + rows = this.table.modules.selectRow.selectedRows; + + break; + + default: + + rows = this.rows; + + } + + return rows; + }; + + ///////////////// Table Rendering ///////////////// + + + //trigger rerender of table in current position + + RowManager.prototype.reRenderInPosition = function (callback) { + + if (this.getRenderMode() == "virtual") { + + if (this.redrawBlock) { + + if (callback) { + + callback(); + } else { + + this.redrawBlockRederInPosition = true; + } + } else { + + var scrollTop = this.element.scrollTop; + + var topRow = false; + + var topOffset = false; + + var left = this.scrollLeft; + + var rows = this.getDisplayRows(); + + for (var i = this.vDomTop; i <= this.vDomBottom; i++) { + + if (rows[i]) { + + var diff = scrollTop - rows[i].getElement().offsetTop; + + if (topOffset === false || Math.abs(diff) < topOffset) { + + topOffset = diff; + + topRow = i; + } else { + + break; + } + } + } + + if (callback) { + + callback(); + } + + this._virtualRenderFill(topRow === false ? this.displayRowsCount - 1 : topRow, true, topOffset || 0); + + this.scrollHorizontal(left); + } + } else { + + this.renderTable(); + + if (callback) { + + callback(); + } + } + }; + + RowManager.prototype.setRenderMode = function () { + + if (this.table.options.virtualDom) { + + this.renderMode = "virtual"; + + if (this.table.element.clientHeight || this.table.options.height) { + + this.fixedHeight = true; + } else { + + this.fixedHeight = false; + } + } else { + + this.renderMode = "classic"; + } + }; + + RowManager.prototype.getRenderMode = function () { + + return this.renderMode; + }; + + RowManager.prototype.renderTable = function () { + + this.table.options.renderStarted.call(this.table); + + this.element.scrollTop = 0; + + switch (this.renderMode) { + + case "classic": + + this._simpleRender(); + + break; + + case "virtual": + + this._virtualRenderFill(); + + break; + + } + + if (this.firstRender) { + + if (this.displayRowsCount) { + + this.firstRender = false; + + this.table.modules.layout.layout(); + } else { + + this.renderEmptyScroll(); + } + } + + if (this.table.modExists("frozenColumns")) { + + this.table.modules.frozenColumns.layout(); + } + + if (!this.displayRowsCount) { + + if (this.table.options.placeholder) { + + this.table.options.placeholder.setAttribute("tabulator-render-mode", this.renderMode); + + this.getElement().appendChild(this.table.options.placeholder); + + this.table.options.placeholder.style.width = this.table.columnManager.getWidth() + "px"; + } + } + + this.table.options.renderComplete.call(this.table); + }; + + //simple render on heightless table + + RowManager.prototype._simpleRender = function () { + + this._clearVirtualDom(); + + if (this.displayRowsCount) { + + this.checkClassicModeGroupHeaderWidth(); + } else { + + this.renderEmptyScroll(); + } + }; + + RowManager.prototype.checkClassicModeGroupHeaderWidth = function () { + + var self = this, + element = this.tableElement, + onlyGroupHeaders = true; + + self.getDisplayRows().forEach(function (row, index) { + + self.styleRow(row, index); + + element.appendChild(row.getElement()); + + row.initialize(true); + + if (row.type !== "group") { + + onlyGroupHeaders = false; + } + }); + + if (onlyGroupHeaders) { + + element.style.minWidth = self.table.columnManager.getWidth() + "px"; + } else { + + element.style.minWidth = ""; + } + }; + + //show scrollbars on empty table div + + RowManager.prototype.renderEmptyScroll = function () { + + if (this.table.options.placeholder) { + + this.tableElement.style.display = "none"; + } else { + + this.tableElement.style.minWidth = this.table.columnManager.getWidth() + "px"; + + // this.tableElement.style.minHeight = "1px"; + + // this.tableElement.style.visibility = "hidden"; + } + }; + + RowManager.prototype._clearVirtualDom = function () { + + var element = this.tableElement; + + if (this.table.options.placeholder && this.table.options.placeholder.parentNode) { + + this.table.options.placeholder.parentNode.removeChild(this.table.options.placeholder); + } + + // element.children.detach(); + + while (element.firstChild) { + element.removeChild(element.firstChild); + }element.style.paddingTop = ""; + + element.style.paddingBottom = ""; + + element.style.minWidth = ""; + + element.style.minHeight = ""; + + element.style.display = ""; + + element.style.visibility = ""; + + this.scrollTop = 0; + + this.scrollLeft = 0; + + this.vDomTop = 0; + + this.vDomBottom = 0; + + this.vDomTopPad = 0; + + this.vDomBottomPad = 0; + }; + + RowManager.prototype.styleRow = function (row, index) { + + var rowEl = row.getElement(); + + if (index % 2) { + + rowEl.classList.add("tabulator-row-even"); + + rowEl.classList.remove("tabulator-row-odd"); + } else { + + rowEl.classList.add("tabulator-row-odd"); + + rowEl.classList.remove("tabulator-row-even"); + } + }; + + //full virtual render + + RowManager.prototype._virtualRenderFill = function (position, forceMove, offset) { + + var self = this, + element = self.tableElement, + holder = self.element, + topPad = 0, + rowsHeight = 0, + topPadHeight = 0, + i = 0, + onlyGroupHeaders = true, + rows = self.getDisplayRows(); + + position = position || 0; + + offset = offset || 0; + + if (!position) { + + self._clearVirtualDom(); + } else { + + while (element.firstChild) { + element.removeChild(element.firstChild); + } //check if position is too close to bottom of table + + var heightOccupied = (self.displayRowsCount - position + 1) * self.vDomRowHeight; + + if (heightOccupied < self.height) { + + position -= Math.ceil((self.height - heightOccupied) / self.vDomRowHeight); + + if (position < 0) { + + position = 0; + } + } + + //calculate initial pad + + topPad = Math.min(Math.max(Math.floor(self.vDomWindowBuffer / self.vDomRowHeight), self.vDomWindowMinMarginRows), position); + + position -= topPad; + } + + if (self.displayRowsCount && Tabulator.prototype.helpers.elVisible(self.element)) { + + self.vDomTop = position; + + self.vDomBottom = position - 1; + + while ((rowsHeight <= self.height + self.vDomWindowBuffer || i < self.vDomWindowMinTotalRows) && self.vDomBottom < self.displayRowsCount - 1) { + + var index = self.vDomBottom + 1, + row = rows[index], + rowHeight = 0; + + self.styleRow(row, index); + + element.appendChild(row.getElement()); + + row.initialize(); + + if (!row.heightInitialized) { + + row.normalizeHeight(true); + } + + // if(!row.initialized){ + + // row.initialize(true); + + // }else{ + + // if(!row.heightInitialized){ + + // row.normalizeHeight(true); + + // } + + // } + + + rowHeight = row.getHeight(); + + if (i < topPad) { + + topPadHeight += rowHeight; + } else { + + rowsHeight += rowHeight; + } + + if (rowHeight > this.vDomWindowBuffer) { + + this.vDomWindowBuffer = rowHeight * 2; + } + + if (row.type !== "group") { + + onlyGroupHeaders = false; + } + + self.vDomBottom++; + + i++; + } + + if (!position) { + + this.vDomTopPad = 0; + + //adjust rowheight to match average of rendered elements + + self.vDomRowHeight = Math.floor((rowsHeight + topPadHeight) / i); + + self.vDomBottomPad = self.vDomRowHeight * (self.displayRowsCount - self.vDomBottom - 1); + + self.vDomScrollHeight = topPadHeight + rowsHeight + self.vDomBottomPad - self.height; + } else { + + self.vDomTopPad = !forceMove ? self.scrollTop - topPadHeight : self.vDomRowHeight * this.vDomTop + offset; + + self.vDomBottomPad = self.vDomBottom == self.displayRowsCount - 1 ? 0 : Math.max(self.vDomScrollHeight - self.vDomTopPad - rowsHeight - topPadHeight, 0); + } + + element.style.paddingTop = self.vDomTopPad + "px"; + + element.style.paddingBottom = self.vDomBottomPad + "px"; + + if (forceMove) { + + this.scrollTop = self.vDomTopPad + topPadHeight + offset - (this.element.scrollWidth > this.element.clientWidth ? this.element.offsetHeight - this.element.clientHeight : 0); + } + + this.scrollTop = Math.min(this.scrollTop, this.element.scrollHeight - this.height); + + //adjust for horizontal scrollbar if present (and not at top of table) + + if (this.element.scrollWidth > this.element.offsetWidth && forceMove) { + + this.scrollTop += this.element.offsetHeight - this.element.clientHeight; + } + + this.vDomScrollPosTop = this.scrollTop; + + this.vDomScrollPosBottom = this.scrollTop; + + holder.scrollTop = this.scrollTop; + + element.style.minWidth = onlyGroupHeaders ? self.table.columnManager.getWidth() + "px" : ""; + + if (self.table.options.groupBy) { + + if (self.table.modules.layout.getMode() != "fitDataFill" && self.displayRowsCount == self.table.modules.groupRows.countGroups()) { + + self.tableElement.style.minWidth = self.table.columnManager.getWidth(); + } + } + } else { + + this.renderEmptyScroll(); + } + + if (!this.fixedHeight) { + + this.adjustTableSize(); + } + }; + + //handle vertical scrolling + + RowManager.prototype.scrollVertical = function (dir) { + + var topDiff = this.scrollTop - this.vDomScrollPosTop; + + var bottomDiff = this.scrollTop - this.vDomScrollPosBottom; + + var margin = this.vDomWindowBuffer * 2; + + if (-topDiff > margin || bottomDiff > margin) { + + //if big scroll redraw table; + + var left = this.scrollLeft; + + this._virtualRenderFill(Math.floor(this.element.scrollTop / this.element.scrollHeight * this.displayRowsCount)); + + this.scrollHorizontal(left); + } else { + + if (dir) { + + //scrolling up + + if (topDiff < 0) { + + this._addTopRow(-topDiff); + } + + if (bottomDiff < 0) { + + //hide bottom row if needed + + if (this.vDomScrollHeight - this.scrollTop > this.vDomWindowBuffer) { + + this._removeBottomRow(-bottomDiff); + } else { + + this.vDomScrollPosBottom = this.scrollTop; + } + } + } else { + + //scrolling down + + if (topDiff >= 0) { + + //hide top row if needed + + if (this.scrollTop > this.vDomWindowBuffer) { + + this._removeTopRow(topDiff); + } else { + + this.vDomScrollPosTop = this.scrollTop; + } + } + + if (bottomDiff >= 0) { + + this._addBottomRow(bottomDiff); + } + } + } + }; + + RowManager.prototype._addTopRow = function (topDiff) { + var i = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0; + + + var table = this.tableElement, + rows = this.getDisplayRows(); + + if (this.vDomTop) { + + var index = this.vDomTop - 1, + topRow = rows[index], + topRowHeight = topRow.getHeight() || this.vDomRowHeight; + + //hide top row if needed + + if (topDiff >= topRowHeight) { + + this.styleRow(topRow, index); + + table.insertBefore(topRow.getElement(), table.firstChild); + + if (!topRow.initialized || !topRow.heightInitialized) { + + this.vDomTopNewRows.push(topRow); + + if (!topRow.heightInitialized) { + + topRow.clearCellHeight(); + } + } + + topRow.initialize(); + + this.vDomTopPad -= topRowHeight; + + if (this.vDomTopPad < 0) { + + this.vDomTopPad = index * this.vDomRowHeight; + } + + if (!index) { + + this.vDomTopPad = 0; + } + + table.style.paddingTop = this.vDomTopPad + "px"; + + this.vDomScrollPosTop -= topRowHeight; + + this.vDomTop--; + } + + topDiff = -(this.scrollTop - this.vDomScrollPosTop); + + if (topRow.getHeight() > this.vDomWindowBuffer) { + + this.vDomWindowBuffer = topRow.getHeight() * 2; + } + + if (i < this.vDomMaxRenderChain && this.vDomTop && topDiff >= (rows[this.vDomTop - 1].getHeight() || this.vDomRowHeight)) { + + this._addTopRow(topDiff, i + 1); + } else { + + this._quickNormalizeRowHeight(this.vDomTopNewRows); + } + } + }; + + RowManager.prototype._removeTopRow = function (topDiff) { + + var table = this.tableElement, + topRow = this.getDisplayRows()[this.vDomTop], + topRowHeight = topRow.getHeight() || this.vDomRowHeight; + + if (topDiff >= topRowHeight) { + + var rowEl = topRow.getElement(); + + rowEl.parentNode.removeChild(rowEl); + + this.vDomTopPad += topRowHeight; + + table.style.paddingTop = this.vDomTopPad + "px"; + + this.vDomScrollPosTop += this.vDomTop ? topRowHeight : topRowHeight + this.vDomWindowBuffer; + + this.vDomTop++; + + topDiff = this.scrollTop - this.vDomScrollPosTop; + + this._removeTopRow(topDiff); + } + }; + + RowManager.prototype._addBottomRow = function (bottomDiff) { + var i = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0; + + + var table = this.tableElement, + rows = this.getDisplayRows(); + + if (this.vDomBottom < this.displayRowsCount - 1) { + + var index = this.vDomBottom + 1, + bottomRow = rows[index], + bottomRowHeight = bottomRow.getHeight() || this.vDomRowHeight; + + //hide bottom row if needed + + if (bottomDiff >= bottomRowHeight) { + + this.styleRow(bottomRow, index); + + table.appendChild(bottomRow.getElement()); + + if (!bottomRow.initialized || !bottomRow.heightInitialized) { + + this.vDomBottomNewRows.push(bottomRow); + + if (!bottomRow.heightInitialized) { + + bottomRow.clearCellHeight(); + } + } + + bottomRow.initialize(); + + this.vDomBottomPad -= bottomRowHeight; + + if (this.vDomBottomPad < 0 || index == this.displayRowsCount - 1) { + + this.vDomBottomPad = 0; + } + + table.style.paddingBottom = this.vDomBottomPad + "px"; + + this.vDomScrollPosBottom += bottomRowHeight; + + this.vDomBottom++; + } + + bottomDiff = this.scrollTop - this.vDomScrollPosBottom; + + if (bottomRow.getHeight() > this.vDomWindowBuffer) { + + this.vDomWindowBuffer = bottomRow.getHeight() * 2; + } + + if (i < this.vDomMaxRenderChain && this.vDomBottom < this.displayRowsCount - 1 && bottomDiff >= (rows[this.vDomBottom + 1].getHeight() || this.vDomRowHeight)) { + + this._addBottomRow(bottomDiff, i + 1); + } else { + + this._quickNormalizeRowHeight(this.vDomBottomNewRows); + } + } + }; + + RowManager.prototype._removeBottomRow = function (bottomDiff) { + + var table = this.tableElement, + bottomRow = this.getDisplayRows()[this.vDomBottom], + bottomRowHeight = bottomRow.getHeight() || this.vDomRowHeight; + + if (bottomDiff >= bottomRowHeight) { + + var rowEl = bottomRow.getElement(); + + if (rowEl.parentNode) { + + rowEl.parentNode.removeChild(rowEl); + } + + this.vDomBottomPad += bottomRowHeight; + + if (this.vDomBottomPad < 0) { + + this.vDomBottomPad = 0; + } + + table.style.paddingBottom = this.vDomBottomPad + "px"; + + this.vDomScrollPosBottom -= bottomRowHeight; + + this.vDomBottom--; + + bottomDiff = -(this.scrollTop - this.vDomScrollPosBottom); + + this._removeBottomRow(bottomDiff); + } + }; + + RowManager.prototype._quickNormalizeRowHeight = function (rows) { + + rows.forEach(function (row) { + + row.calcHeight(); + }); + + rows.forEach(function (row) { + + row.setCellHeight(); + }); + + rows.length = 0; + }; + + //normalize height of active rows + + RowManager.prototype.normalizeHeight = function () { + + this.activeRows.forEach(function (row) { + + row.normalizeHeight(); + }); + }; + + //adjust the height of the table holder to fit in the Tabulator element + + RowManager.prototype.adjustTableSize = function () { + + var initialHeight = this.element.clientHeight, + modExists; + + if (this.renderMode === "virtual") { + + var otherHeight = Math.floor(this.columnManager.getElement().offsetHeight + (this.table.footerManager && !this.table.footerManager.external ? this.table.footerManager.getElement().offsetHeight : 0)); + + if (this.fixedHeight) { + + this.element.style.minHeight = "calc(100% - " + otherHeight + "px)"; + + this.element.style.height = "calc(100% - " + otherHeight + "px)"; + + this.element.style.maxHeight = "calc(100% - " + otherHeight + "px)"; + } else { + + this.element.style.height = ""; + + this.element.style.height = Math.floor(this.table.element.clientHeight) - otherHeight + "px"; + + this.element.scrollTop = this.scrollTop; + } + + this.height = this.element.clientHeight; + + this.vDomWindowBuffer = this.table.options.virtualDomBuffer || this.height; + + //check if the table has changed size when dealing with variable height tables + + if (!this.fixedHeight && Math.floor(initialHeight) != Math.floor(this.element.clientHeight)) { + + modExists = this.table.modExists("resizeTable"); + + if (modExists && !this.table.modules.resizeTable.autoResize || !modExists) { + + this.redraw(); + } + } + } + }; + + //renitialize all rows + + RowManager.prototype.reinitialize = function () { + + this.rows.forEach(function (row) { + + row.reinitialize(true); + }); + }; + + //prevent table from being redrawn + + RowManager.prototype.blockRedraw = function () { + + this.redrawBlock = true; + + this.redrawBlockRestoreConfig = false; + }; + + //restore table redrawing + + RowManager.prototype.restoreRedraw = function () { + + this.redrawBlock = false; + + if (this.redrawBlockRestoreConfig) { + + this.refreshActiveData(this.redrawBlockRestoreConfig.stage, this.redrawBlockRestoreConfig.skipStage, this.redrawBlockRestoreConfig.renderInPosition); + + this.redrawBlockRestoreConfig = false; + } else { + + if (this.redrawBlockRederInPosition) { + + this.reRenderInPosition(); + } + } + + this.redrawBlockRederInPosition = false; + }; + + //redraw table + + RowManager.prototype.redraw = function (force) { + + var pos = 0, + left = this.scrollLeft; + + this.adjustTableSize(); + + this.table.tableWidth = this.table.element.clientWidth; + + if (!force) { + + if (this.renderMode == "classic") { + + if (this.table.options.groupBy) { + + this.refreshActiveData("group", false, false); + } else { + + this._simpleRender(); + } + } else { + + this.reRenderInPosition(); + + this.scrollHorizontal(left); + } + + if (!this.displayRowsCount) { + + if (this.table.options.placeholder) { + + this.getElement().appendChild(this.table.options.placeholder); + } + } + } else { + + this.renderTable(); + } + }; + + RowManager.prototype.resetScroll = function () { + + this.element.scrollLeft = 0; + + this.element.scrollTop = 0; + + if (this.table.browser === "ie") { + + var event = document.createEvent("Event"); + + event.initEvent("scroll", false, true); + + this.element.dispatchEvent(event); + } else { + + this.element.dispatchEvent(new Event('scroll')); + } + }; + + var VDomHoz = function VDomHoz(table) { + + this.table = table; + + this.element = this.table.rowManager.tableElement; + + this.holderEl = this.table.rowManager.element; + + this.leftCol = 0; + + this.rightCol = 0; + + this.scrollLeft = 0; + + this.vDomScrollPosLeft = 0; + + this.vDomScrollPosRight = 0; + + this.vDomPadLeft = 0; + + this.vDomPadRight = 0; + + this.fitDataColAvg = 0; + + this.window = 200; //pixel margin to make column visible before it is shown on screen + + + this.initialized = false; + + this.columns = []; + + if (this.compatabilityCheck()) { + + this.initialize(); + } + }; + + VDomHoz.prototype.compatabilityCheck = function () { + + var options = this.table.options, + frozen = false, + ok = true; + + if (options.layout == "fitDataTable") { + + console.warn("Horizontal Vitrual DOM is not compatible with fitDataTable layout mode"); + + ok = false; + } + + if (options.responsiveLayout) { + + console.warn("Horizontal Vitrual DOM is not compatible with responsive columns"); + + ok = false; + } + + if (this.table.rtl) { + + console.warn("Horizontal Vitrual DOM is not currently compatible with RTL text direction"); + + ok = false; + } + + // if(options.rowFormatter){ + + // console.warn("Horizontal Vitrual DOM is not compatible with row formatters"); + + // ok = false; + + // } + + + if (options.columns) { + + frozen = options.columns.find(function (col) { + + return col.frozen; + }); + + if (frozen) { + + console.warn("Horizontal Vitrual DOM is not compatible with frozen columns"); + + ok = false; + } + } + + if (!ok) { + + options.virtualDomHoz = false; + } + + return ok; + }; + + VDomHoz.prototype.initialize = function () { + var _this17 = this; + + this.holderEl.addEventListener("scroll", function () { + + var left = _this17.holderEl.scrollLeft; + + if (_this17.scrollLeft != left) { + + _this17.scrollLeft = left; + + _this17.scroll(left - (_this17.vDomScrollPosLeft + _this17.window)); + } + }); + }; + + VDomHoz.prototype.deinitialize = function () { + + this.initialized = false; + }; + + VDomHoz.prototype.clear = function () { + + this.columns = []; + + this.leftCol = -1; + + this.rightCol = 0; + + this.vDomScrollPosLeft = 0; + + this.vDomScrollPosRight = 0; + + this.vDomPadLeft = 0; + + this.vDomPadRight = 0; + }; + + VDomHoz.prototype.dataChange = function () { + + var change = false, + collsWidth = 0, + colEnd = 0, + group, + row, + rowEl; + + if (this.table.options.layout === "fitData") { + + this.table.columnManager.columnsByIndex.forEach(function (column) { + + if (!column.definition.width && column.visible) { + + change = true; + } + }); + + if (change) { + + if (change && this.table.rowManager.getDisplayRows().length) { + + // this.table.vdomHoz.deinitialize(); + + + this.vDomScrollPosRight = this.scrollLeft + this.holderEl.clientWidth + this.window; + + if (this.table.options.groupBy) { + + group = this.table.modules.groupRows.getGroups(false)[0]; + + row = group.getRows(false)[0]; + } else { + + row = this.table.rowManager.getDisplayRows()[0]; + } + + if (row) { + + rowEl = row.getElement(); + + row.generateCells(); + + this.element.appendChild(rowEl); + + for (var colEnd = 0; colEnd < row.cells.length; colEnd++) { + + var cell = row.cells[colEnd]; + + rowEl.appendChild(cell.getElement()); + + cell.column.reinitializeWidth(); + + collsWidth += cell.column.getWidth(); + + if (collsWidth > this.vDomScrollPosRight) { + + break; + } + } + + rowEl.parentNode.removeChild(rowEl); + + this.fitDataColAvg = Math.floor(collsWidth / (colEnd + 1)); + + for (colEnd; colEnd < this.table.columnManager.columnsByIndex.length; colEnd++) { + + this.table.columnManager.columnsByIndex[colEnd].setWidth(this.fitDataColAvg); + } + + this.reinitialize(false, true); + } + } + } + } else { + + if (this.table.options.layout === "fitColumns") { + + this.table.modules.layout.layout(); + + this.table.vdomHoz.reinitialize(false, true); + } + } + }; + + VDomHoz.prototype.fitDataLayoutOverride = function () { + + for (var _i5 = this.leftCol; _i5 <= this.rightCol; _i5++) { + + this.columns[_i5].reinitializeWidth(); + } + }; + + VDomHoz.prototype.reinitialize = function (update, blockRedraw) { + var _this18 = this; + + var old = { + + cols: this.columns, + + leftCol: this.leftCol, + + rightCol: this.rightCol + + }; + + if (update && !this.initialized) { + + return; + } + + this.clear(); + + this.scrollLeft = this.holderEl.scrollLeft; + + this.vDomScrollPosLeft = this.scrollLeft - this.window; + + this.vDomScrollPosRight = this.scrollLeft + this.holderEl.clientWidth + this.window; + + var colPos = 0; + + this.table.columnManager.columnsByIndex.forEach(function (column) { + + var config = {}; + + if (column.visible) { + + var width = column.getWidth(); + + config.leftPos = colPos; + + config.rightPos = colPos + width; + + if (colPos + width > _this18.vDomScrollPosLeft && colPos < _this18.vDomScrollPosRight) { + + //column is visible + + + if (_this18.leftCol == -1) { + + _this18.leftCol = _this18.columns.length; + + _this18.vDomPadLeft = colPos; + } + + _this18.rightCol = _this18.columns.length; + } else { + + // column is hidden + + if (_this18.leftCol !== -1) { + + _this18.vDomPadRight += width; + } + } + + _this18.columns.push(column); + + column.modules.vdomHoz = config; + + colPos += width; + } + }); + + this.element.style.paddingLeft = this.vDomPadLeft + "px"; + + this.element.style.paddingRight = this.vDomPadRight + "px"; + + this.initialized = true; + + if (!blockRedraw) { + + if (!update || this.reinitChanged(old)) { + + this.renitializeRows(); + } + } + + this.holderEl.scrollLeft = this.scrollLeft; + }; + + VDomHoz.prototype.reinitChanged = function (old) { + var _this19 = this; + + var match = true; + + if (old.cols.length !== this.columns.length || old.leftCol !== this.leftCol || old.rightCol !== this.rightCol) { + + return true; + } + + old.cols.forEach(function (col, i) { + + if (col !== _this19.columns[i]) { + + match = false; + } + }); + + return !match; + }; + + VDomHoz.prototype.renitializeRows = function () { + var _this20 = this; + + var rows = this.table.rowManager.getVisibleRows(); + + rows.forEach(function (row) { + + _this20.reinitializeRow(row, true); + }); + }; + + VDomHoz.prototype.scroll = function (diff) { + + this.vDomScrollPosLeft += diff; + + this.vDomScrollPosRight += diff; + + if (diff > this.holderEl.clientWidth * .8) { + + this.reinitialize(); + } else { + + if (diff > 0) { + + //scroll right + + this.addColRight(); + + this.removeColLeft(); + } else { + + //scroll left + + this.addColLeft(); + + this.removeColRight(); + } + } + }; + + VDomHoz.prototype.colPositionAdjust = function (start, end, diff) { + + for (var _i6 = start; _i6 < end; _i6++) { + + var column = this.columns[_i6]; + + column.modules.vdomHoz.leftPos -= diff; + + column.modules.vdomHoz.rightPos -= diff; + } + }; + + VDomHoz.prototype.addColRight = function () { + + var column = this.columns[this.rightCol + 1], + rows, + oldWidth, + widthDiff; + + if (column && column.modules.vdomHoz.leftPos <= this.vDomScrollPosRight) { + + rows = this.table.rowManager.getVisibleRows(); + + rows.forEach(function (row) { + + if (row.type !== "group") { + + var cell = row.getCell(column); + + row.getElement().appendChild(cell.getElement()); + + cell.cellRendered(); + } + }); + + if (this.fitDataColAvg) { + + oldWidth = column.getWidth(); + + if (oldWidth === this.fitDataColAvg) { + + column.reinitializeWidth(); + + widthDiff = oldWidth - column.getWidth(); + + if (widthDiff) { + + column.modules.vdomHoz.rightPos -= widthDiff; + + this.colPositionAdjust(this.rightCol + 1, this.columns.length, widthDiff); + } + } + } + + this.rightCol++; + + if (this.rightCol >= this.columns.length - 1) { + + this.vDomPadRight = 0; + } else { + + this.vDomPadRight -= column.getWidth(); + } + + this.element.style.paddingRight = this.vDomPadRight + "px"; + + this.addColRight(); + } + }; + + VDomHoz.prototype.addColLeft = function () { + + var column = this.columns[this.leftCol - 1], + rows; + + if (column && column.modules.vdomHoz.rightPos >= this.vDomScrollPosLeft) { + + var rows = this.table.rowManager.getVisibleRows(); + + rows.forEach(function (row) { + + if (row.type !== "group") { + + var cell = row.getCell(column); + + row.getElement().prepend(cell.getElement()); + + cell.cellRendered(); + } + }); + + if (!this.leftCol) { + + this.vDomPadLeft = 0; + } else { + + this.vDomPadLeft -= column.getWidth(); + } + + this.element.style.paddingLeft = this.vDomPadLeft + "px"; + + this.leftCol--; + + this.addColLeft(); + } + }; + + VDomHoz.prototype.removeColRight = function (column) { + + var column = this.columns[this.rightCol], + rows; + + if (column && column.modules.vdomHoz.leftPos > this.vDomScrollPosRight) { + + rows = this.table.rowManager.getVisibleRows(); + + column.modules.vdomHoz.visible = false; + + rows.forEach(function (row) { + + if (row.type !== "group") { + + var cell = row.getCell(column); + + row.getElement().removeChild(cell.getElement()); + } + }); + + this.vDomPadRight += column.getWidth(); + + this.element.style.paddingRight = this.vDomPadRight + "px"; + + this.rightCol--; + + this.removeColRight(); + } + }; + + VDomHoz.prototype.removeColLeft = function () { + + var column = this.columns[this.leftCol], + rows; + + if (column && column.modules.vdomHoz.rightPos < this.vDomScrollPosLeft) { + + rows = this.table.rowManager.getVisibleRows(); + + rows.forEach(function (row) { + + if (row.type !== "group") { + + var cell = row.getCell(column); + + row.getElement().removeChild(cell.getElement()); + } + }); + + this.vDomPadLeft += column.getWidth(); + + this.element.style.paddingLeft = this.vDomPadLeft + "px"; + + this.leftCol++; + + this.removeColLeft(); + } + }; + + VDomHoz.prototype.initializeRow = function (row) { + + if (row.type !== "group") { + + row.modules.vdomHoz = { + + leftCol: this.leftCol, + + rightCol: this.rightCol + + }; + + for (var _i7 = this.leftCol; _i7 <= this.rightCol; _i7++) { + + var column = this.columns[_i7]; + + if (column.visible) { + + var cell = row.getCell(column); + + row.element.appendChild(cell.getElement()); + + cell.cellRendered(); + } + } + } + }; + + VDomHoz.prototype.reinitializeRow = function (row, force) { + + if (row.type !== "group") { + + if (force || !row.modules.vdomHoz || row.modules.vdomHoz.leftCol !== this.leftCol || row.modules.vdomHoz.rightCol !== this.rightCol) { + + while (row.element.firstChild) { + row.element.removeChild(row.element.firstChild); + }this.initializeRow(row); + } + } + }; + + //public row object + + var RowComponent = function RowComponent(row) { + + this._row = row; + }; + + RowComponent.prototype.getData = function (transform) { + + return this._row.getData(transform); + }; + + RowComponent.prototype.getElement = function () { + + return this._row.getElement(); + }; + + RowComponent.prototype.getCells = function () { + + var cells = []; + + this._row.getCells().forEach(function (cell) { + + cells.push(cell.getComponent()); + }); + + return cells; + }; + + RowComponent.prototype.getCell = function (column) { + + var cell = this._row.getCell(column); + + return cell ? cell.getComponent() : false; + }; + + RowComponent.prototype.getIndex = function () { + + return this._row.getData("data")[this._row.table.options.index]; + }; + + RowComponent.prototype.getPosition = function (active) { + + return this._row.table.rowManager.getRowPosition(this._row, active); + }; + + RowComponent.prototype.delete = function () { + + return this._row.delete(); + }; + + RowComponent.prototype.scrollTo = function () { + + return this._row.table.rowManager.scrollToRow(this._row); + }; + + RowComponent.prototype.pageTo = function () { + + if (this._row.table.modExists("page", true)) { + + return this._row.table.modules.page.setPageToRow(this._row); + } + }; + + RowComponent.prototype.move = function (to, after) { + + this._row.moveToRow(to, after); + }; + + RowComponent.prototype.update = function (data) { + + return this._row.updateData(data); + }; + + RowComponent.prototype.normalizeHeight = function () { + + this._row.normalizeHeight(true); + }; + + RowComponent.prototype.select = function () { + + this._row.table.modules.selectRow.selectRows(this._row); + }; + + RowComponent.prototype.deselect = function () { + + this._row.table.modules.selectRow.deselectRows(this._row); + }; + + RowComponent.prototype.toggleSelect = function () { + + this._row.table.modules.selectRow.toggleRow(this._row); + }; + + RowComponent.prototype.isSelected = function () { + + return this._row.table.modules.selectRow.isRowSelected(this._row); + }; + + RowComponent.prototype._getSelf = function () { + + return this._row; + }; + + RowComponent.prototype.validate = function () { + + return this._row.validate(); + }; + + RowComponent.prototype.freeze = function () { + + if (this._row.table.modExists("frozenRows", true)) { + + this._row.table.modules.frozenRows.freezeRow(this._row); + } + }; + + RowComponent.prototype.unfreeze = function () { + + if (this._row.table.modExists("frozenRows", true)) { + + this._row.table.modules.frozenRows.unfreezeRow(this._row); + } + }; + + RowComponent.prototype.isFrozen = function () { + + if (this._row.table.modExists("frozenRows", true)) { + + var index = this._row.table.modules.frozenRows.rows.indexOf(this._row); + + return index > -1; + } + + return false; + }; + + RowComponent.prototype.treeCollapse = function () { + + if (this._row.table.modExists("dataTree", true)) { + + this._row.table.modules.dataTree.collapseRow(this._row); + } + }; + + RowComponent.prototype.treeExpand = function () { + + if (this._row.table.modExists("dataTree", true)) { + + this._row.table.modules.dataTree.expandRow(this._row); + } + }; + + RowComponent.prototype.treeToggle = function () { + + if (this._row.table.modExists("dataTree", true)) { + + this._row.table.modules.dataTree.toggleRow(this._row); + } + }; + + RowComponent.prototype.getTreeParent = function () { + + if (this._row.table.modExists("dataTree", true)) { + + return this._row.table.modules.dataTree.getTreeParent(this._row); + } + + return false; + }; + + RowComponent.prototype.getTreeChildren = function () { + + if (this._row.table.modExists("dataTree", true)) { + + return this._row.table.modules.dataTree.getTreeChildren(this._row, true); + } + + return false; + }; + + RowComponent.prototype.addTreeChild = function (data, pos, index) { + + if (this._row.table.modExists("dataTree", true)) { + + return this._row.table.modules.dataTree.addTreeChildRow(this._row, data, pos, index); + } + + return false; + }; + + RowComponent.prototype.reformat = function () { + + return this._row.reinitialize(); + }; + + RowComponent.prototype.getGroup = function () { + + return this._row.getGroup().getComponent(); + }; + + RowComponent.prototype.getTable = function () { + + return this._row.table; + }; + + RowComponent.prototype.getNextRow = function () { + + var row = this._row.nextRow(); + + return row ? row.getComponent() : row; + }; + + RowComponent.prototype.getPrevRow = function () { + + var row = this._row.prevRow(); + + return row ? row.getComponent() : row; + }; + + var Row = function Row(data, parent) { + var type = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : "row"; + + + this.table = parent.table; + + this.parent = parent; + + this.data = {}; + + this.type = type; //type of element + + this.element = this.createElement(); + + this.modules = {}; //hold module variables; + + this.cells = []; + + this.height = 0; //hold element height + + this.heightStyled = ""; //hold element height prestyled to improve render efficiency + + this.manualHeight = false; //user has manually set row height + + this.outerHeight = 0; //holde lements outer height + + this.initialized = false; //element has been rendered + + this.heightInitialized = false; //element has resized cells to fit + + + this.component = null; + + this.setData(data); + + this.generateElement(); + }; + + Row.prototype.createElement = function () { + + var el = document.createElement("div"); + + el.classList.add("tabulator-row"); + + el.setAttribute("role", "row"); + + return el; + }; + + Row.prototype.getElement = function () { + + return this.element; + }; + + Row.prototype.detachElement = function () { + + if (this.element && this.element.parentNode) { + + this.element.parentNode.removeChild(this.element); + } + }; + + Row.prototype.generateElement = function () { + + var self = this, + dblTap, + tapHold, + tap; + + //set row selection characteristics + + if (self.table.options.selectable !== false && self.table.modExists("selectRow")) { + + self.table.modules.selectRow.initializeRow(this); + } + + //setup movable rows + + if (self.table.options.movableRows !== false && self.table.modExists("moveRow")) { + + self.table.modules.moveRow.initializeRow(this); + } + + //setup data tree + + if (self.table.options.dataTree !== false && self.table.modExists("dataTree")) { + + self.table.modules.dataTree.initializeRow(this); + } + + //setup column colapse container + + if (self.table.options.responsiveLayout === "collapse" && self.table.modExists("responsiveLayout")) { + + self.table.modules.responsiveLayout.initializeRow(this); + } + + //set column menu + + if ((self.table.options.rowContextMenu || self.table.options.rowClickMenu) && this.table.modExists("menu")) { + + self.table.modules.menu.initializeRow(this); + } + + //handle row click events + + if (self.table.options.rowClick) { + + self.element.addEventListener("click", function (e) { + + self.table.options.rowClick(e, self.getComponent()); + }); + } + + if (self.table.options.rowDblClick) { + + self.element.addEventListener("dblclick", function (e) { + + self.table.options.rowDblClick(e, self.getComponent()); + }); + } + + if (self.table.options.rowContext) { + + self.element.addEventListener("contextmenu", function (e) { + + self.table.options.rowContext(e, self.getComponent()); + }); + } + + //handle mouse events + + if (self.table.options.rowMouseEnter) { + + self.element.addEventListener("mouseenter", function (e) { + + self.table.options.rowMouseEnter(e, self.getComponent()); + }); + } + + if (self.table.options.rowMouseLeave) { + + self.element.addEventListener("mouseleave", function (e) { + + self.table.options.rowMouseLeave(e, self.getComponent()); + }); + } + + if (self.table.options.rowMouseOver) { + + self.element.addEventListener("mouseover", function (e) { + + self.table.options.rowMouseOver(e, self.getComponent()); + }); + } + + if (self.table.options.rowMouseOut) { + + self.element.addEventListener("mouseout", function (e) { + + self.table.options.rowMouseOut(e, self.getComponent()); + }); + } + + if (self.table.options.rowMouseMove) { + + self.element.addEventListener("mousemove", function (e) { + + self.table.options.rowMouseMove(e, self.getComponent()); + }); + } + + if (self.table.options.rowTap) { + + tap = false; + + self.element.addEventListener("touchstart", function (e) { + + tap = true; + }, { passive: true }); + + self.element.addEventListener("touchend", function (e) { + + if (tap) { + + self.table.options.rowTap(e, self.getComponent()); + } + + tap = false; + }); + } + + if (self.table.options.rowDblTap) { + + dblTap = null; + + self.element.addEventListener("touchend", function (e) { + + if (dblTap) { + + clearTimeout(dblTap); + + dblTap = null; + + self.table.options.rowDblTap(e, self.getComponent()); + } else { + + dblTap = setTimeout(function () { + + clearTimeout(dblTap); + + dblTap = null; + }, 300); + } + }); + } + + if (self.table.options.rowTapHold) { + + tapHold = null; + + self.element.addEventListener("touchstart", function (e) { + + clearTimeout(tapHold); + + tapHold = setTimeout(function () { + + clearTimeout(tapHold); + + tapHold = null; + + tap = false; + + self.table.options.rowTapHold(e, self.getComponent()); + }, 1000); + }, { passive: true }); + + self.element.addEventListener("touchend", function (e) { + + clearTimeout(tapHold); + + tapHold = null; + }); + } + }; + + Row.prototype.generateCells = function () { + + this.cells = this.table.columnManager.generateCells(this); + }; + + //functions to setup on first render + + Row.prototype.initialize = function (force) { + var _this21 = this; + + if (!this.initialized || force) { + + this.deleteCells(); + + while (this.element.firstChild) { + this.element.removeChild(this.element.firstChild); + } //handle frozen cells + + if (this.table.modExists("frozenColumns")) { + + this.table.modules.frozenColumns.layoutRow(this); + } + + this.generateCells(); + + if (this.table.options.virtualDomHoz && this.table.vdomHoz.initialized) { + + this.table.vdomHoz.initializeRow(this); + } else { + + this.cells.forEach(function (cell) { + + _this21.element.appendChild(cell.getElement()); + + cell.cellRendered(); + }); + } + + if (force) { + + this.normalizeHeight(); + } + + //setup movable rows + + if (this.table.options.dataTree && this.table.modExists("dataTree")) { + + this.table.modules.dataTree.layoutRow(this); + } + + //setup column colapse container + + if (this.table.options.responsiveLayout === "collapse" && this.table.modExists("responsiveLayout")) { + + this.table.modules.responsiveLayout.layoutRow(this); + } + + if (this.table.options.rowFormatter) { + + this.table.options.rowFormatter(this.getComponent()); + } + + //set resizable handles + + if (this.table.options.resizableRows && this.table.modExists("resizeRows")) { + + this.table.modules.resizeRows.initializeRow(this); + } + + this.initialized = true; + } else { + + if (this.table.options.virtualDomHoz) { + + this.table.vdomHoz.reinitializeRow(this); + } + } + }; + + Row.prototype.reinitializeHeight = function () { + + this.heightInitialized = false; + + if (this.element.offsetParent !== null) { + + this.normalizeHeight(true); + } + }; + + Row.prototype.reinitialize = function (children) { + + this.initialized = false; + + this.heightInitialized = false; + + if (!this.manualHeight) { + + this.height = 0; + + this.heightStyled = ""; + } + + if (this.element.offsetParent !== null) { + + this.initialize(true); + } + + if (this.table.options.dataTree && this.table.modExists("dataTree", true)) { + + this.table.modules.dataTree.getTreeChildren(this, false, true).forEach(function (child) { + + child.reinitialize(true); + }); + } + }; + + //get heights when doing bulk row style calcs in virtual DOM + + Row.prototype.calcHeight = function (force) { + + var maxHeight = 0, + minHeight = this.table.options.resizableRows ? this.element.clientHeight : 0; + + this.cells.forEach(function (cell) { + + var height = cell.getHeight(); + + if (height > maxHeight) { + + maxHeight = height; + } + }); + + if (force) { + + this.height = Math.max(maxHeight, minHeight); + } else { + + this.height = this.manualHeight ? this.height : Math.max(maxHeight, minHeight); + } + + this.heightStyled = this.height ? this.height + "px" : ""; + + this.outerHeight = this.element.offsetHeight; + }; + + //set of cells + + Row.prototype.setCellHeight = function () { + + this.cells.forEach(function (cell) { + + cell.setHeight(); + }); + + this.heightInitialized = true; + }; + + Row.prototype.clearCellHeight = function () { + + this.cells.forEach(function (cell) { + + cell.clearHeight(); + }); + }; + + //normalize the height of elements in the row + + Row.prototype.normalizeHeight = function (force) { + + if (force) { + + this.clearCellHeight(); + } + + this.calcHeight(force); + + this.setCellHeight(); + }; + + // Row.prototype.setHeight = function(height){ + + // this.height = height; + + + // this.setCellHeight(); + + // }; + + + //set height of rows + + Row.prototype.setHeight = function (height, force) { + + if (this.height != height || force) { + + this.manualHeight = true; + + this.height = height; + + this.heightStyled = height ? height + "px" : ""; + + this.setCellHeight(); + + // this.outerHeight = this.element.outerHeight(); + + this.outerHeight = this.element.offsetHeight; + } + }; + + //return rows outer height + + Row.prototype.getHeight = function () { + + return this.outerHeight; + }; + + //return rows outer Width + + Row.prototype.getWidth = function () { + + return this.element.offsetWidth; + }; + + //////////////// Cell Management ///////////////// + + + Row.prototype.deleteCell = function (cell) { + + var index = this.cells.indexOf(cell); + + if (index > -1) { + + this.cells.splice(index, 1); + } + }; + + //////////////// Data Management ///////////////// + + + Row.prototype.setData = function (data) { + + if (this.table.modExists("mutator")) { + + data = this.table.modules.mutator.transformRow(data, "data"); + } + + this.data = data; + + if (this.table.options.reactiveData && this.table.modExists("reactiveData", true)) { + + this.table.modules.reactiveData.watchRow(this); + } + }; + + //update the rows data + + Row.prototype.updateData = function (updatedData) { + var _this22 = this; + + var visible = Tabulator.prototype.helpers.elVisible(this.element), + tempData = {}, + newRowData; + + return new Promise(function (resolve, reject) { + + if (typeof updatedData === "string") { + + updatedData = JSON.parse(updatedData); + } + + if (_this22.table.options.reactiveData && _this22.table.modExists("reactiveData", true)) { + + _this22.table.modules.reactiveData.block(); + } + + //mutate incomming data if needed + + if (_this22.table.modExists("mutator")) { + + tempData = Object.assign(tempData, _this22.data); + + tempData = Object.assign(tempData, updatedData); + + newRowData = _this22.table.modules.mutator.transformRow(tempData, "data", updatedData); + } else { + + newRowData = updatedData; + } + + //set data + + for (var attrname in newRowData) { + + _this22.data[attrname] = newRowData[attrname]; + } + + if (_this22.table.options.reactiveData && _this22.table.modExists("reactiveData", true)) { + + _this22.table.modules.reactiveData.unblock(); + } + + //update affected cells only + + for (var attrname in updatedData) { + + var columns = _this22.table.columnManager.getColumnsByFieldRoot(attrname); + + columns.forEach(function (column) { + + var cell = _this22.getCell(column.getField()); + + if (cell) { + + var value = column.getFieldValue(newRowData); + + if (cell.getValue() != value) { + + cell.setValueProcessData(value); + + if (visible) { + + cell.cellRendered(); + } + } + } + }); + } + + if (_this22.table.options.groupUpdateOnCellEdit && _this22.table.options.groupBy && _this22.table.modExists("groupRows")) { + + _this22.table.modules.groupRows.reassignRowToGroup(_this22.row); + } + + //Partial reinitialization if visible + + if (visible) { + + _this22.normalizeHeight(true); + + if (_this22.table.options.rowFormatter) { + + _this22.table.options.rowFormatter(_this22.getComponent()); + } + } else { + + _this22.initialized = false; + + _this22.height = 0; + + _this22.heightStyled = ""; + } + + if (_this22.table.options.dataTree !== false && _this22.table.modExists("dataTree") && _this22.table.modules.dataTree.redrawNeeded(updatedData)) { + + _this22.table.modules.dataTree.initializeRow(_this22); + + if (visible) { + + _this22.table.modules.dataTree.layoutRow(_this22); + + _this22.table.rowManager.refreshActiveData("tree", false, true); + } + } + + //this.reinitialize(); + + + _this22.table.options.rowUpdated.call(_this22.table, _this22.getComponent()); + + if (_this22.table.options.dataChanged) { + + _this22.table.options.dataChanged.call(_this22.table, _this22.table.rowManager.getData()); + } + + resolve(); + }); + }; + + Row.prototype.getData = function (transform) { + + if (transform) { + + if (this.table.modExists("accessor")) { + + return this.table.modules.accessor.transformRow(this, transform); + } + } + + return this.data; + }; + + Row.prototype.getCell = function (column) { + + var match = false; + + column = this.table.columnManager.findColumn(column); + + match = this.cells.find(function (cell) { + + return cell.column === column; + }); + + return match; + }; + + Row.prototype.getCellIndex = function (findCell) { + + return this.cells.findIndex(function (cell) { + + return cell === findCell; + }); + }; + + Row.prototype.findNextEditableCell = function (index) { + + var nextCell = false; + + if (index < this.cells.length - 1) { + + for (var i = index + 1; i < this.cells.length; i++) { + + var cell = this.cells[i]; + + if (cell.column.modules.edit && Tabulator.prototype.helpers.elVisible(cell.getElement())) { + + var allowEdit = true; + + if (typeof cell.column.modules.edit.check == "function") { + + allowEdit = cell.column.modules.edit.check(cell.getComponent()); + } + + if (allowEdit) { + + nextCell = cell; + + break; + } + } + } + } + + return nextCell; + }; + + Row.prototype.findPrevEditableCell = function (index) { + + var prevCell = false; + + if (index > 0) { + + for (var i = index - 1; i >= 0; i--) { + + var cell = this.cells[i], + allowEdit = true; + + if (cell.column.modules.edit && Tabulator.prototype.helpers.elVisible(cell.getElement())) { + + if (typeof cell.column.modules.edit.check == "function") { + + allowEdit = cell.column.modules.edit.check(cell.getComponent()); + } + + if (allowEdit) { + + prevCell = cell; + + break; + } + } + } + } + + return prevCell; + }; + + Row.prototype.getCells = function () { + + return this.cells; + }; + + Row.prototype.nextRow = function () { + + var row = this.table.rowManager.nextDisplayRow(this, true); + + return row || false; + }; + + Row.prototype.prevRow = function () { + + var row = this.table.rowManager.prevDisplayRow(this, true); + + return row || false; + }; + + Row.prototype.moveToRow = function (to, before) { + + var toRow = this.table.rowManager.findRow(to); + + if (toRow) { + + this.table.rowManager.moveRowActual(this, toRow, !before); + + this.table.rowManager.refreshActiveData("display", false, true); + } else { + + console.warn("Move Error - No matching row found:", to); + } + }; + + Row.prototype.validate = function () { + + var invalid = []; + + this.cells.forEach(function (cell) { + + if (!cell.validate()) { + + invalid.push(cell.getComponent()); + } + }); + + return invalid.length ? invalid : true; + }; + + ///////////////////// Actions ///////////////////// + + + Row.prototype.delete = function () { + var _this23 = this; + + return new Promise(function (resolve, reject) { + + var index, rows; + + if (_this23.table.options.history && _this23.table.modExists("history")) { + + if (_this23.table.options.groupBy && _this23.table.modExists("groupRows")) { + + rows = _this23.getGroup().rows; + + index = rows.indexOf(_this23); + + if (index) { + + index = rows[index - 1]; + } + } else { + + index = _this23.table.rowManager.getRowIndex(_this23); + + if (index) { + + index = _this23.table.rowManager.rows[index - 1]; + } + } + + _this23.table.modules.history.action("rowDelete", _this23, { data: _this23.getData(), pos: !index, index: index }); + } + + _this23.deleteActual(); + + resolve(); + }); + }; + + Row.prototype.deleteActual = function (blockRedraw) { + + var index = this.table.rowManager.getRowIndex(this); + + this.detatchModules(); + + // if(this.table.options.dataTree && this.table.modExists("dataTree")){ + + // this.table.modules.dataTree.collapseRow(this, true); + + // } + + + //remove any reactive data watchers from row object + + if (this.table.options.reactiveData && this.table.modExists("reactiveData", true)) {} + + // this.table.modules.reactiveData.unwatchRow(this); + + //remove from group + + if (this.modules.group) { + + this.modules.group.removeRow(this); + } + + this.table.rowManager.deleteRow(this, blockRedraw); + + this.deleteCells(); + + this.initialized = false; + + this.heightInitialized = false; + + this.element = false; + + if (this.table.options.dataTree && this.table.modExists("dataTree", true)) { + + this.table.modules.dataTree.rowDelete(this); + } + + //recalc column calculations if present + + if (this.table.modExists("columnCalcs")) { + + if (this.table.options.groupBy && this.table.modExists("groupRows")) { + + this.table.modules.columnCalcs.recalcRowGroup(this); + } else { + + this.table.modules.columnCalcs.recalc(this.table.rowManager.activeRows); + } + } + }; + + Row.prototype.detatchModules = function () { + + //deselect row if it is selected + + if (this.table.modExists("selectRow")) { + + this.table.modules.selectRow._deselectRow(this, true); + } + + //cancel edit if row is currently being edited + + if (this.table.modExists("edit")) { + + if (this.table.modules.edit.currentCell.row === this) { + + this.table.modules.edit.cancelEdit(); + } + } + + if (this.table.modExists("frozenRows")) { + + this.table.modules.frozenRows.detachRow(this); + } + }; + + Row.prototype.deleteCells = function () { + + var cellCount = this.cells.length; + + for (var _i8 = 0; _i8 < cellCount; _i8++) { + + this.cells[0].delete(); + } + }; + + Row.prototype.wipe = function () { + + this.detatchModules(); + + this.deleteCells(); + + while (this.element.firstChild) { + this.element.removeChild(this.element.firstChild); + }this.element = false; + + this.modules = {}; + + if (this.element.parentNode) { + + this.element.parentNode.removeChild(this.element); + } + }; + + Row.prototype.getGroup = function () { + + return this.modules.group || false; + }; + + //////////////// Object Generation ///////////////// + + Row.prototype.getComponent = function () { + + if (!this.component) { + + this.component = new RowComponent(this); + } + + return this.component; + }; + + //public row object + + var CellComponent = function CellComponent(cell) { + + this._cell = cell; + }; + + CellComponent.prototype.getValue = function () { + + return this._cell.getValue(); + }; + + CellComponent.prototype.getOldValue = function () { + + return this._cell.getOldValue(); + }; + + CellComponent.prototype.getInitialValue = function () { + + return this._cell.initialValue; + }; + + CellComponent.prototype.getElement = function () { + + return this._cell.getElement(); + }; + + CellComponent.prototype.getRow = function () { + + return this._cell.row.getComponent(); + }; + + CellComponent.prototype.getData = function () { + + return this._cell.row.getData(); + }; + + CellComponent.prototype.getField = function () { + + return this._cell.column.getField(); + }; + + CellComponent.prototype.getColumn = function () { + + return this._cell.column.getComponent(); + }; + + CellComponent.prototype.setValue = function (value, mutate) { + + if (typeof mutate == "undefined") { + + mutate = true; + } + + this._cell.setValue(value, mutate); + }; + + CellComponent.prototype.restoreOldValue = function () { + + this._cell.setValueActual(this._cell.getOldValue()); + }; + + CellComponent.prototype.restoreInitialValue = function () { + + this._cell.setValueActual(this._cell.initialValue); + }; + + CellComponent.prototype.edit = function (force) { + + return this._cell.edit(force); + }; + + CellComponent.prototype.cancelEdit = function () { + + this._cell.cancelEdit(); + }; + + CellComponent.prototype.isEdited = function () { + + return !!this._cell.modules.edit && this._cell.modules.edit.edited; + }; + + CellComponent.prototype.clearEdited = function () { + + if (self.table.modExists("edit", true)) { + + this._cell.table.modules.edit.clearEdited(this._cell); + } + }; + + CellComponent.prototype.isValid = function () { + + return this._cell.modules.validate ? !this._cell.modules.validate.invalid : true; + }; + + CellComponent.prototype.validate = function () { + + return this._cell.validate(); + }; + + CellComponent.prototype.clearValidation = function () { + + if (this._cell.table.modExists("validate", true)) { + + this._cell.table.modules.validate.clearValidation(this._cell); + } + }; + + CellComponent.prototype.nav = function () { + + return this._cell.nav(); + }; + + CellComponent.prototype.checkHeight = function () { + + this._cell.checkHeight(); + }; + + CellComponent.prototype.getTable = function () { + + return this._cell.table; + }; + + CellComponent.prototype._getSelf = function () { + + return this._cell; + }; + + var Cell = function Cell(column, row) { + + this.table = column.table; + + this.column = column; + + this.row = row; + + this.element = null; + + this.value = null; + + this.initialValue; + + this.oldValue = null; + + this.modules = {}; + + this.height = null; + + this.width = null; + + this.minWidth = null; + + this.component = null; + + this.loaded = false; //track if the cell has been added to the DOM yet + + + this.build(); + }; + + //////////////// Setup Functions ///////////////// + + + //generate element + + Cell.prototype.build = function () { + + this.generateElement(); + + this.setWidth(); + + this._configureCell(); + + this.setValueActual(this.column.getFieldValue(this.row.data)); + + this.initialValue = this.value; + }; + + Cell.prototype.generateElement = function () { + + this.element = document.createElement('div'); + + this.element.className = "tabulator-cell"; + + this.element.setAttribute("role", "gridcell"); + + this.element = this.element; + }; + + Cell.prototype._configureCell = function () { + + var self = this, + cellEvents = self.column.cellEvents, + element = self.element, + field = this.column.getField(), + vertAligns = { + + top: "flex-start", + + bottom: "flex-end", + + middle: "center" + + }, + hozAligns = { + + left: "flex-start", + + right: "flex-end", + + center: "center" + + }; + + //set text alignment + + element.style.textAlign = self.column.hozAlign; + + if (self.column.vertAlign) { + + element.style.display = "inline-flex"; + + element.style.alignItems = vertAligns[self.column.vertAlign] || ""; + + if (self.column.hozAlign) { + + element.style.justifyContent = hozAligns[self.column.hozAlign] || ""; + } + } + + if (field) { + + element.setAttribute("tabulator-field", field); + } + + //add class to cell if needed + + if (self.column.definition.cssClass) { + + var classNames = self.column.definition.cssClass.split(" "); + + classNames.forEach(function (className) { + + element.classList.add(className); + }); + } + + //update tooltip on mouse enter + + if (this.table.options.tooltipGenerationMode === "hover") { + + element.addEventListener("mouseenter", function (e) { + + self._generateTooltip(); + }); + } + + self._bindClickEvents(cellEvents); + + self._bindTouchEvents(cellEvents); + + self._bindMouseEvents(cellEvents); + + if (self.column.modules.edit) { + + self.table.modules.edit.bindEditor(self); + } + + if (self.column.definition.rowHandle && self.table.options.movableRows !== false && self.table.modExists("moveRow")) { + + self.table.modules.moveRow.initializeCell(self); + } + + //hide cell if not visible + + if (!self.column.visible) { + + self.hide(); + } + }; + + Cell.prototype._bindClickEvents = function (cellEvents) { + + var self = this, + element = self.element; + + //set event bindings + + if (cellEvents.cellClick || self.table.options.cellClick) { + + element.addEventListener("click", function (e) { + + var component = self.getComponent(); + + if (cellEvents.cellClick) { + + cellEvents.cellClick.call(self.table, e, component); + } + + if (self.table.options.cellClick) { + + self.table.options.cellClick.call(self.table, e, component); + } + }); + } + + if (cellEvents.cellDblClick || this.table.options.cellDblClick) { + + element.addEventListener("dblclick", function (e) { + + var component = self.getComponent(); + + if (cellEvents.cellDblClick) { + + cellEvents.cellDblClick.call(self.table, e, component); + } + + if (self.table.options.cellDblClick) { + + self.table.options.cellDblClick.call(self.table, e, component); + } + }); + } else { + + element.addEventListener("dblclick", function (e) { + + if (self.table.modExists("edit")) { + + if (self.table.modules.edit.currentCell === self) { + + return; //prevent instant selection of editor content + } + } + + e.preventDefault(); + + try { + + if (document.selection) { + // IE + + var range = document.body.createTextRange(); + + range.moveToElementText(self.element); + + range.select(); + } else if (window.getSelection) { + + var range = document.createRange(); + + range.selectNode(self.element); + + window.getSelection().removeAllRanges(); + + window.getSelection().addRange(range); + } + } catch (e) {} + }); + } + + if (cellEvents.cellContext || this.table.options.cellContext) { + + element.addEventListener("contextmenu", function (e) { + + var component = self.getComponent(); + + if (cellEvents.cellContext) { + + cellEvents.cellContext.call(self.table, e, component); + } + + if (self.table.options.cellContext) { + + self.table.options.cellContext.call(self.table, e, component); + } + }); + } + }; + + Cell.prototype._bindMouseEvents = function (cellEvents) { + + var self = this, + element = self.element; + + if (cellEvents.cellMouseEnter || self.table.options.cellMouseEnter) { + + element.addEventListener("mouseenter", function (e) { + + var component = self.getComponent(); + + if (cellEvents.cellMouseEnter) { + + cellEvents.cellMouseEnter.call(self.table, e, component); + } + + if (self.table.options.cellMouseEnter) { + + self.table.options.cellMouseEnter.call(self.table, e, component); + } + }); + } + + if (cellEvents.cellMouseLeave || self.table.options.cellMouseLeave) { + + element.addEventListener("mouseleave", function (e) { + + var component = self.getComponent(); + + if (cellEvents.cellMouseLeave) { + + cellEvents.cellMouseLeave.call(self.table, e, component); + } + + if (self.table.options.cellMouseLeave) { + + self.table.options.cellMouseLeave.call(self.table, e, component); + } + }); + } + + if (cellEvents.cellMouseOver || self.table.options.cellMouseOver) { + + element.addEventListener("mouseover", function (e) { + + var component = self.getComponent(); + + if (cellEvents.cellMouseOver) { + + cellEvents.cellMouseOver.call(self.table, e, component); + } + + if (self.table.options.cellMouseOver) { + + self.table.options.cellMouseOver.call(self.table, e, component); + } + }); + } + + if (cellEvents.cellMouseOut || self.table.options.cellMouseOut) { + + element.addEventListener("mouseout", function (e) { + + var component = self.getComponent(); + + if (cellEvents.cellMouseOut) { + + cellEvents.cellMouseOut.call(self.table, e, component); + } + + if (self.table.options.cellMouseOut) { + + self.table.options.cellMouseOut.call(self.table, e, component); + } + }); + } + + if (cellEvents.cellMouseMove || self.table.options.cellMouseMove) { + + element.addEventListener("mousemove", function (e) { + + var component = self.getComponent(); + + if (cellEvents.cellMouseMove) { + + cellEvents.cellMouseMove.call(self.table, e, component); + } + + if (self.table.options.cellMouseMove) { + + self.table.options.cellMouseMove.call(self.table, e, component); + } + }); + } + }; + + Cell.prototype._bindTouchEvents = function (cellEvents) { + + var self = this, + element = self.element, + dblTap, + tapHold, + tap; + + if (cellEvents.cellTap || this.table.options.cellTap) { + + tap = false; + + element.addEventListener("touchstart", function (e) { + + tap = true; + }, { passive: true }); + + element.addEventListener("touchend", function (e) { + + if (tap) { + + var component = self.getComponent(); + + if (cellEvents.cellTap) { + + cellEvents.cellTap.call(self.table, e, component); + } + + if (self.table.options.cellTap) { + + self.table.options.cellTap.call(self.table, e, component); + } + } + + tap = false; + }); + } + + if (cellEvents.cellDblTap || this.table.options.cellDblTap) { + + dblTap = null; + + element.addEventListener("touchend", function (e) { + + if (dblTap) { + + clearTimeout(dblTap); + + dblTap = null; + + var component = self.getComponent(); + + if (cellEvents.cellDblTap) { + + cellEvents.cellDblTap.call(self.table, e, component); + } + + if (self.table.options.cellDblTap) { + + self.table.options.cellDblTap.call(self.table, e, component); + } + } else { + + dblTap = setTimeout(function () { + + clearTimeout(dblTap); + + dblTap = null; + }, 300); + } + }); + } + + if (cellEvents.cellTapHold || this.table.options.cellTapHold) { + + tapHold = null; + + element.addEventListener("touchstart", function (e) { + + clearTimeout(tapHold); + + tapHold = setTimeout(function () { + + clearTimeout(tapHold); + + tapHold = null; + + tap = false; + + var component = self.getComponent(); + + if (cellEvents.cellTapHold) { + + cellEvents.cellTapHold.call(self.table, e, component); + } + + if (self.table.options.cellTapHold) { + + self.table.options.cellTapHold.call(self.table, e, component); + } + }, 1000); + }, { passive: true }); + + element.addEventListener("touchend", function (e) { + + clearTimeout(tapHold); + + tapHold = null; + }); + } + }; + + //generate cell contents + + Cell.prototype._generateContents = function () { + + var val; + + if (this.table.modExists("format")) { + + val = this.table.modules.format.formatValue(this); + } else { + + val = this.element.innerHTML = this.value; + } + + switch (typeof val === 'undefined' ? 'undefined' : _typeof(val)) { + + case "object": + + if (val instanceof Node) { + + //clear previous cell contents + + while (this.element.firstChild) { + this.element.removeChild(this.element.firstChild); + }this.element.appendChild(val); + } else { + + this.element.innerHTML = ""; + + if (val != null) { + + console.warn("Format Error - Formatter has returned a type of object, the only valid formatter object return is an instance of Node, the formatter returned:", val); + } + } + + break; + + case "undefined": + + case "null": + + this.element.innerHTML = ""; + + break; + + default: + + this.element.innerHTML = val; + + } + }; + + Cell.prototype.cellRendered = function () { + + if (this.table.modExists("format") && this.table.modules.format.cellRendered) { + + this.table.modules.format.cellRendered(this); + } + }; + + //generate tooltip text + + Cell.prototype._generateTooltip = function () { + + var tooltip = this.column.tooltip; + + if (tooltip) { + + if (tooltip === true) { + + tooltip = this.value; + } else if (typeof tooltip == "function") { + + tooltip = tooltip(this.getComponent()); + + if (tooltip === false) { + + tooltip = ""; + } + } + + if (typeof tooltip === "undefined") { + + tooltip = ""; + } + + this.element.setAttribute("title", tooltip); + } else { + + this.element.setAttribute("title", ""); + } + }; + + //////////////////// Getters //////////////////// + + Cell.prototype.getElement = function () { + + if (!this.loaded) { + + this.loaded = true; + + this.layoutElement(); + } + + return this.element; + }; + + Cell.prototype.getValue = function () { + + return this.value; + }; + + Cell.prototype.getOldValue = function () { + + return this.oldValue; + }; + + //////////////////// Actions //////////////////// + + + Cell.prototype.setValue = function (value, mutate) { + + var changed = this.setValueProcessData(value, mutate), + component; + + if (changed) { + + if (this.table.options.history && this.table.modExists("history")) { + + this.table.modules.history.action("cellEdit", this, { oldValue: this.oldValue, newValue: this.value }); + } + + component = this.getComponent(); + + if (this.column.cellEvents.cellEdited) { + + this.column.cellEvents.cellEdited.call(this.table, component); + } + + if (this.table.options.groupUpdateOnCellEdit && this.table.options.groupBy && this.table.modExists("groupRows")) { + + this.table.modules.groupRows.reassignRowToGroup(this.row); + } + + this.cellRendered(); + + this.table.options.cellEdited.call(this.table, component); + + if (this.table.options.dataChanged) { + + this.table.options.dataChanged.call(this.table, this.table.rowManager.getData()); + } + } + }; + + Cell.prototype.setValueProcessData = function (value, mutate) { + + var changed = false; + + if (this.value != value) { + + changed = true; + + if (mutate) { + + if (this.column.modules.mutate) { + + value = this.table.modules.mutator.transformCell(this, value); + } + } + } + + this.setValueActual(value); + + if (changed && this.table.modExists("columnCalcs")) { + + if (this.column.definition.topCalc || this.column.definition.bottomCalc) { + + if (this.table.options.groupBy && this.table.modExists("groupRows")) { + + if (this.table.options.columnCalcs == "table" || this.table.options.columnCalcs == "both") { + + this.table.modules.columnCalcs.recalc(this.table.rowManager.activeRows); + } + + if (this.table.options.columnCalcs != "table") { + + this.table.modules.columnCalcs.recalcRowGroup(this.row); + } + } else { + + this.table.modules.columnCalcs.recalc(this.table.rowManager.activeRows); + } + } + } + + return changed; + }; + + Cell.prototype.setValueActual = function (value) { + + this.oldValue = this.value; + + this.value = value; + + if (this.table.options.reactiveData && this.table.modExists("reactiveData")) { + + this.table.modules.reactiveData.block(); + } + + this.column.setFieldValue(this.row.data, value); + + if (this.table.options.reactiveData && this.table.modExists("reactiveData")) { + + this.table.modules.reactiveData.unblock(); + } + + if (this.loaded) { + + this.layoutElement(); + } + }; + + Cell.prototype.layoutElement = function () { + + this._generateContents(); + + this._generateTooltip(); + + //set resizable handles + + if (this.table.options.resizableColumns && this.table.modExists("resizeColumns") && this.row.type === "row") { + + this.table.modules.resizeColumns.initializeColumn("cell", this.column, this.element); + } + + if ((this.column.definition.contextMenu || this.column.definition.clickMenu) && this.table.modExists("menu")) { + + this.table.modules.menu.initializeCell(this); + } + + //handle frozen cells + + if (this.table.modExists("frozenColumns")) { + + this.table.modules.frozenColumns.layoutElement(this.element, this.column); + } + }; + + Cell.prototype.setWidth = function () { + + this.width = this.column.width; + + this.element.style.width = this.column.widthStyled; + }; + + Cell.prototype.clearWidth = function () { + + this.width = ""; + + this.element.style.width = ""; + }; + + Cell.prototype.getWidth = function () { + + return this.width || this.element.offsetWidth; + }; + + Cell.prototype.setMinWidth = function () { + + this.minWidth = this.column.minWidth; + + this.element.style.minWidth = this.column.minWidthStyled; + }; + + Cell.prototype.checkHeight = function () { + + // var height = this.element.css("height"); + + this.row.reinitializeHeight(); + }; + + Cell.prototype.clearHeight = function () { + + this.element.style.height = ""; + + this.height = null; + }; + + Cell.prototype.setHeight = function () { + + this.height = this.row.height; + + this.element.style.height = this.row.heightStyled; + }; + + Cell.prototype.getHeight = function () { + + return this.height || this.element.offsetHeight; + }; + + Cell.prototype.show = function () { + + this.element.style.display = this.column.vertAlign ? "inline-flex" : ""; + }; + + Cell.prototype.hide = function () { + + this.element.style.display = "none"; + }; + + Cell.prototype.edit = function (force) { + + if (this.table.modExists("edit", true)) { + + return this.table.modules.edit.editCell(this, force); + } + }; + + Cell.prototype.cancelEdit = function () { + + if (this.table.modExists("edit", true)) { + + var editing = this.table.modules.edit.getCurrentCell(); + + if (editing && editing._getSelf() === this) { + + this.table.modules.edit.cancelEdit(); + } else { + + console.warn("Cancel Editor Error - This cell is not currently being edited "); + } + } + }; + + Cell.prototype.validate = function () { + + if (this.column.modules.validate && this.table.modExists("validate", true)) { + + var valid = this.table.modules.validate.validate(this.column.modules.validate, this, this.getValue()); + + return valid === true; + } else { + + return true; + } + }; + + Cell.prototype.delete = function () { + + if (!this.table.rowManager.redrawBlock && this.element.parentNode) { + + this.element.parentNode.removeChild(this.element); + } + + if (this.modules.validate && this.modules.validate.invalid) { + + this.table.modules.validate.clearValidation(this); + } + + if (this.modules.edit && this.modules.edit.edited) { + + this.table.modules.edit.clearEdited(this); + } + + if (this.table.options.history) { + + this.table.modules.history.clearComponentHistory(this); + } + + this.element = false; + + this.column.deleteCell(this); + + this.row.deleteCell(this); + + this.calcs = {}; + }; + + //////////////// Navigation ///////////////// + + + Cell.prototype.nav = function () { + + var self = this, + nextCell = false, + index = this.row.getCellIndex(this); + + return { + + next: function next() { + + var nextCell = this.right(), + nextRow; + + if (!nextCell) { + + nextRow = self.table.rowManager.nextDisplayRow(self.row, true); + + if (nextRow) { + + nextCell = nextRow.findNextEditableCell(-1); + + if (nextCell) { + + nextCell.edit(); + + return true; + } + } + } else { + + return true; + } + + return false; + }, + + prev: function prev() { + + var nextCell = this.left(), + prevRow; + + if (!nextCell) { + + prevRow = self.table.rowManager.prevDisplayRow(self.row, true); + + if (prevRow) { + + nextCell = prevRow.findPrevEditableCell(prevRow.cells.length); + + if (nextCell) { + + nextCell.edit(); + + return true; + } + } + } else { + + return true; + } + + return false; + }, + + left: function left() { + + nextCell = self.row.findPrevEditableCell(index); + + if (nextCell) { + + nextCell.edit(); + + return true; + } else { + + return false; + } + }, + + right: function right() { + + nextCell = self.row.findNextEditableCell(index); + + if (nextCell) { + + nextCell.edit(); + + return true; + } else { + + return false; + } + }, + + up: function up() { + + var nextRow = self.table.rowManager.prevDisplayRow(self.row, true); + + if (nextRow) { + + nextRow.cells[index].edit(); + } + }, + + down: function down() { + + var nextRow = self.table.rowManager.nextDisplayRow(self.row, true); + + if (nextRow) { + + nextRow.cells[index].edit(); + } + } + + }; + }; + + Cell.prototype.getIndex = function () { + + this.row.getCellIndex(this); + }; + + //////////////// Object Generation ///////////////// + + Cell.prototype.getComponent = function () { + + if (!this.component) { + + this.component = new CellComponent(this); + } + + return this.component; + }; + + var FooterManager = function FooterManager(table) { + + this.table = table; + + this.active = false; + + this.element = this.createElement(); //containing element + + this.external = false; + + this.links = []; + + this._initialize(); + }; + + FooterManager.prototype.createElement = function () { + + var el = document.createElement("div"); + + el.classList.add("tabulator-footer"); + + return el; + }; + + FooterManager.prototype._initialize = function (element) { + + if (this.table.options.footerElement) { + + switch (_typeof(this.table.options.footerElement)) { + + case "string": + + if (this.table.options.footerElement[0] === "<") { + + this.element.innerHTML = this.table.options.footerElement; + } else { + + this.external = true; + + this.element = document.querySelector(this.table.options.footerElement); + } + + break; + + default: + + this.element = this.table.options.footerElement; + + break; + + } + } + }; + + FooterManager.prototype.getElement = function () { + + return this.element; + }; + + FooterManager.prototype.append = function (element, parent) { + + this.activate(parent); + + this.element.appendChild(element); + + this.table.rowManager.adjustTableSize(); + }; + + FooterManager.prototype.prepend = function (element, parent) { + + this.activate(parent); + + this.element.insertBefore(element, this.element.firstChild); + + this.table.rowManager.adjustTableSize(); + }; + + FooterManager.prototype.remove = function (element) { + + element.parentNode.removeChild(element); + + this.deactivate(); + }; + + FooterManager.prototype.deactivate = function (force) { + + if (!this.element.firstChild || force) { + + if (!this.external) { + + this.element.parentNode.removeChild(this.element); + } + + this.active = false; + } + + // this.table.rowManager.adjustTableSize(); + }; + + FooterManager.prototype.activate = function (parent) { + + if (!this.active) { + + this.active = true; + + if (!this.external) { + + this.table.element.appendChild(this.getElement()); + + this.table.element.style.display = ''; + } + } + + if (parent) { + + this.links.push(parent); + } + }; + + FooterManager.prototype.redraw = function () { + + this.links.forEach(function (link) { + + link.footerRedraw(); + }); + }; + + var Tabulator = function Tabulator(element, options) { + + this.options = {}; + + this.columnManager = null; // hold Column Manager + + this.rowManager = null; //hold Row Manager + + this.footerManager = null; //holder Footer Manager + + this.vdomHoz = null; //holder horizontal virtual dom + + + this.browser = ""; //hold current browser type + + this.browserSlow = false; //handle reduced functionality for slower browsers + + this.browserMobile = false; //check if running on moble, prevent resize cancelling edit on keyboard appearence + + this.rtl = false; //check if the table is in RTL mode + + + this.modules = {}; //hold all modules bound to this table + + + if (this.initializeElement(element)) { + + this.initializeOptions(options || {}); + + this._create(); + } + + Tabulator.prototype.comms.register(this); //register table for inderdevice communication + }; + + //default setup options + + Tabulator.prototype.defaultOptions = { + + height: false, //height of tabulator + + minHeight: false, //minimum height of tabulator + + maxHeight: false, //maximum height of tabulator + + + layout: "fitData", ///layout type "fitColumns" | "fitData" + + layoutColumnsOnNewData: false, //update column widths on setData + + + columnMinWidth: 40, //minimum global width for a column + + columnHeaderVertAlign: "top", //vertical alignment of column headers + + columnVertAlign: false, // DEPRECATED - Left to allow warning + + + resizableColumns: true, //resizable columns + + resizableRows: false, //resizable rows + + autoResize: true, //auto resize table + + + columns: [], //store for colum header info + + + cellHozAlign: "", //horizontal align columns + + cellVertAlign: "", //vertical align columns + + headerHozAlign: "", //horizontal header alignment + + + data: [], //default starting data + + + autoColumns: false, //build columns from data row structure + + autoColumnsDefinitions: false, + + reactiveData: false, //enable data reactivity + + + nestedFieldSeparator: ".", //seperatpr for nested data + + + tooltips: false, //Tool tip value + + tooltipsHeader: false, //Tool tip for headers + + tooltipGenerationMode: "load", //when to generate tooltips + + + initialSort: false, //initial sorting criteria + + initialFilter: false, //initial filtering criteria + + initialHeaderFilter: false, //initial header filtering criteria + + + columnHeaderSortMulti: true, //multiple or single column sorting + + + sortOrderReverse: false, //reverse internal sort ordering + + + headerSort: true, //set default global header sort + + headerSortTristate: false, //set default tristate header sorting + + headerSortElement: "
", //header sort element + + + footerElement: false, //hold footer element + + + index: "id", //filed for row index + + + textDirection: "auto", + + keybindings: [], //array for keybindings + + + tabEndNewRow: false, //create new row when tab to end of table + + + invalidOptionWarnings: true, //allow toggling of invalid option warnings + + + clipboard: false, //enable clipboard + + clipboardCopyStyled: true, //formatted table data + + clipboardCopyConfig: false, //clipboard config + + clipboardCopyFormatter: false, //DEPRICATED - REMOVE in 5.0 + + clipboardCopyRowRange: "active", //restrict clipboard to visible rows only + + clipboardPasteParser: "table", //convert pasted clipboard data to rows + + clipboardPasteAction: "insert", //how to insert pasted data into the table + + + clipboardCopied: function clipboardCopied() {}, //data has been copied to the clipboard + + clipboardPasted: function clipboardPasted() {}, //data has been pasted into the table + + clipboardPasteError: function clipboardPasteError() {}, //data has not successfully been pasted into the table + + + downloadDataFormatter: false, //function to manipulate table data before it is downloaded + + downloadReady: function downloadReady(data, blob) { + return blob; + }, //function to manipulate download data + + downloadComplete: false, //function to manipulate download data + + downloadConfig: {}, //download config + + downloadRowRange: "active", //restrict download to active rows only + + + dataTree: false, //enable data tree + + dataTreeFilter: true, //filter child rows + + dataTreeSort: true, //sort child rows + + dataTreeElementColumn: false, + + dataTreeBranchElement: true, //show data tree branch element + + dataTreeChildIndent: 9, //data tree child indent in px + + dataTreeChildField: "_children", //data tre column field to look for child rows + + dataTreeCollapseElement: false, //data tree row collapse element + + dataTreeExpandElement: false, //data tree row expand element + + dataTreeStartExpanded: false, + + dataTreeRowExpanded: function dataTreeRowExpanded() {}, //row has been expanded + + dataTreeRowCollapsed: function dataTreeRowCollapsed() {}, //row has been collapsed + + dataTreeChildColumnCalcs: false, //include visible data tree rows in column calculations + + dataTreeSelectPropagate: false, //seleccting a parent row selects its children + + + printAsHtml: false, //enable print as html + + printFormatter: false, //printing page formatter + + printHeader: false, //page header contents + + printFooter: false, //page footer contents + + printCopyStyle: true, //DEPRICATED - REMOVE in 5.0 + + printStyled: true, //enable print as html styling + + printVisibleRows: true, //DEPRICATED - REMOVE in 5.0 + + printRowRange: "visible", //restrict print to visible rows only + + printConfig: {}, //print config options + + + addRowPos: "bottom", //position to insert blank rows, top|bottom + + + selectable: "highlight", //highlight rows on hover + + selectableRangeMode: "drag", //highlight rows on hover + + selectableRollingSelection: true, //roll selection once maximum number of selectable rows is reached + + selectablePersistence: true, // maintain selection when table view is updated + + selectableCheck: function selectableCheck(data, row) { + return true; + }, //check wheather row is selectable + + + headerFilterLiveFilterDelay: 300, //delay before updating column after user types in header filter + + headerFilterPlaceholder: false, //placeholder text to display in header filters + + + headerVisible: true, //hide header + + + history: false, //enable edit history + + + locale: false, //current system language + + langs: {}, + + virtualDom: true, //enable DOM virtualization + + virtualDomBuffer: 0, // set virtual DOM buffer size + + virtualDomHoz: false, //enable horizontal DOM virtualization + + + persistentLayout: false, //DEPRICATED - REMOVE in 5.0 + + persistentSort: false, //DEPRICATED - REMOVE in 5.0 + + persistentFilter: false, //DEPRICATED - REMOVE in 5.0 + + persistenceID: "", //key for persistent storage + + persistenceMode: true, //mode for storing persistence information + + persistenceReaderFunc: false, //function for handling persistence data reading + + persistenceWriterFunc: false, //function for handling persistence data writing + + + persistence: false, + + responsiveLayout: false, //responsive layout flags + + responsiveLayoutCollapseStartOpen: true, //start showing collapsed data + + responsiveLayoutCollapseUseFormatters: true, //responsive layout collapse formatter + + responsiveLayoutCollapseFormatter: false, //responsive layout collapse formatter + + + pagination: false, //set pagination type + + paginationSize: false, //set number of rows to a page + + paginationInitialPage: 1, //initail page to show on load + + paginationButtonCount: 5, // set count of page button + + paginationSizeSelector: false, //add pagination size selector element + + paginationElement: false, //element to hold pagination numbers + + paginationDataSent: {}, //pagination data sent to the server + + paginationDataReceived: {}, //pagination data received from the server + + paginationAddRow: "page", //add rows on table or page + + + ajaxURL: false, //url for ajax loading + + ajaxURLGenerator: false, + + ajaxParams: {}, //params for ajax loading + + ajaxConfig: "get", //ajax request type + + ajaxContentType: "form", //ajax request type + + ajaxRequestFunc: false, //promise function + + ajaxLoader: true, //show loader + + ajaxLoaderLoading: false, //loader element + + ajaxLoaderError: false, //loader element + + ajaxFiltering: false, + + ajaxSorting: false, + + ajaxProgressiveLoad: false, //progressive loading + + ajaxProgressiveLoadDelay: 0, //delay between requests + + ajaxProgressiveLoadScrollMargin: 0, //margin before scroll begins + + + groupBy: false, //enable table grouping and set field to group by + + groupStartOpen: true, //starting state of group + + groupValues: false, + + groupUpdateOnCellEdit: false, + + groupHeader: false, //header generation function + + groupHeaderPrint: null, + + groupHeaderClipboard: null, + + groupHeaderHtmlOutput: null, + + groupHeaderDownload: null, + + htmlOutputConfig: false, //html outypu config + + + movableColumns: false, //enable movable columns + + + movableRows: false, //enable movable rows + + movableRowsConnectedTables: false, //tables for movable rows to be connected to + + movableRowsConnectedElements: false, //other elements for movable rows to be connected to + + movableRowsSender: false, + + movableRowsReceiver: "insert", + + movableRowsSendingStart: function movableRowsSendingStart() {}, + + movableRowsSent: function movableRowsSent() {}, + + movableRowsSentFailed: function movableRowsSentFailed() {}, + + movableRowsSendingStop: function movableRowsSendingStop() {}, + + movableRowsReceivingStart: function movableRowsReceivingStart() {}, + + movableRowsReceived: function movableRowsReceived() {}, + + movableRowsReceivedFailed: function movableRowsReceivedFailed() {}, + + movableRowsReceivingStop: function movableRowsReceivingStop() {}, + + movableRowsElementDrop: function movableRowsElementDrop() {}, + + scrollToRowPosition: "top", + + scrollToRowIfVisible: true, + + scrollToColumnPosition: "left", + + scrollToColumnIfVisible: true, + + rowFormatter: false, + + rowFormatterPrint: null, + + rowFormatterClipboard: null, + + rowFormatterHtmlOutput: null, + + placeholder: false, + + //table building callbacks + + tableBuilding: function tableBuilding() {}, + + tableBuilt: function tableBuilt() {}, + + //render callbacks + + renderStarted: function renderStarted() {}, + + renderComplete: function renderComplete() {}, + + //row callbacks + + rowClick: false, + + rowDblClick: false, + + rowContext: false, + + rowTap: false, + + rowDblTap: false, + + rowTapHold: false, + + rowMouseEnter: false, + + rowMouseLeave: false, + + rowMouseOver: false, + + rowMouseOut: false, + + rowMouseMove: false, + + rowContextMenu: false, + + rowClickMenu: false, + + rowAdded: function rowAdded() {}, + + rowDeleted: function rowDeleted() {}, + + rowMoved: function rowMoved() {}, + + rowUpdated: function rowUpdated() {}, + + rowSelectionChanged: function rowSelectionChanged() {}, + + rowSelected: function rowSelected() {}, + + rowDeselected: function rowDeselected() {}, + + rowResized: function rowResized() {}, + + //cell callbacks + + //row callbacks + + cellClick: false, + + cellDblClick: false, + + cellContext: false, + + cellTap: false, + + cellDblTap: false, + + cellTapHold: false, + + cellMouseEnter: false, + + cellMouseLeave: false, + + cellMouseOver: false, + + cellMouseOut: false, + + cellMouseMove: false, + + cellEditing: function cellEditing() {}, + + cellEdited: function cellEdited() {}, + + cellEditCancelled: function cellEditCancelled() {}, + + //column callbacks + + columnMoved: false, + + columnResized: function columnResized() {}, + + columnTitleChanged: function columnTitleChanged() {}, + + columnVisibilityChanged: function columnVisibilityChanged() {}, + + //HTML iport callbacks + + htmlImporting: function htmlImporting() {}, + + htmlImported: function htmlImported() {}, + + //data callbacks + + dataLoading: function dataLoading() {}, + + dataLoaded: function dataLoaded() {}, + + dataEdited: false, //DEPRECATED + + dataChanged: false, + + //ajax callbacks + + ajaxRequesting: function ajaxRequesting() {}, + + ajaxResponse: false, + + ajaxError: function ajaxError() {}, + + //filtering callbacks + + dataFiltering: false, + + dataFiltered: false, + + //sorting callbacks + + dataSorting: function dataSorting() {}, + + dataSorted: function dataSorted() {}, + + //grouping callbacks + + groupToggleElement: "arrow", + + groupClosedShowCalcs: false, + + dataGrouping: function dataGrouping() {}, + + dataGrouped: false, + + groupVisibilityChanged: function groupVisibilityChanged() {}, + + groupClick: false, + + groupDblClick: false, + + groupContext: false, + + groupContextMenu: false, + + groupClickMenu: false, + + groupTap: false, + + groupDblTap: false, + + groupTapHold: false, + + columnCalcs: true, + + //pagination callbacks + + pageLoaded: function pageLoaded() {}, + + //localization callbacks + + localized: function localized() {}, + + //validation callbacks + + validationMode: "blocking", + + validationFailed: function validationFailed() {}, + + //history callbacks + + historyUndo: function historyUndo() {}, + + historyRedo: function historyRedo() {}, + + //scroll callbacks + + scrollHorizontal: function scrollHorizontal() {}, + + scrollVertical: function scrollVertical() {} + + }; + + Tabulator.prototype.initializeOptions = function (options) { + + //warn user if option is not available + + if (options.invalidOptionWarnings !== false) { + + for (var key in options) { + + if (typeof this.defaultOptions[key] === "undefined") { + + console.warn("Invalid table constructor option:", key); + } + } + } + + //assign options to table + + for (var key in this.defaultOptions) { + + if (key in options) { + + this.options[key] = options[key]; + } else { + + if (Array.isArray(this.defaultOptions[key])) { + + this.options[key] = Object.assign([], this.defaultOptions[key]); + } else if (_typeof(this.defaultOptions[key]) === "object" && this.defaultOptions[key] !== null) { + + this.options[key] = Object.assign({}, this.defaultOptions[key]); + } else { + + this.options[key] = this.defaultOptions[key]; + } + } + } + }; + + Tabulator.prototype.initializeElement = function (element) { + + if (typeof HTMLElement !== "undefined" && element instanceof HTMLElement) { + + this.element = element; + + return true; + } else if (typeof element === "string") { + + this.element = document.querySelector(element); + + if (this.element) { + + return true; + } else { + + console.error("Tabulator Creation Error - no element found matching selector: ", element); + + return false; + } + } else { + + console.error("Tabulator Creation Error - Invalid element provided:", element); + + return false; + } + }; + + Tabulator.prototype.rtlCheck = function () { + + var style = window.getComputedStyle(this.element); + + switch (this.options.textDirection) { + + case "auto": + + if (style.direction !== "rtl") { + + break; + }; + + case "rtl": + + this.element.classList.add("tabulator-rtl"); + + this.rtl = true; + + break; + + case "ltr": + + this.element.classList.add("tabulator-ltr"); + + default: + + this.rtl = false; + + } + }; + + //convert depricated functionality to new functions + + Tabulator.prototype._mapDepricatedFunctionality = function () { + + //map depricated persistance setup options + + if (this.options.persistentLayout || this.options.persistentSort || this.options.persistentFilter) { + + if (!this.options.persistence) { + + this.options.persistence = {}; + } + } + + if (this.options.dataEdited) { + + console.warn("DEPRECATION WARNING - dataEdited option has been deprecated, please use the dataChanged option instead"); + + this.options.dataChanged = this.options.dataEdited; + } + + if (this.options.downloadDataFormatter) { + + console.warn("DEPRECATION WARNING - downloadDataFormatter option has been deprecated"); + } + + if (typeof this.options.clipboardCopyHeader !== "undefined") { + + this.options.columnHeaders = this.options.clipboardCopyHeader; + + console.warn("DEPRECATION WARNING - clipboardCopyHeader option has been deprecated, please use the columnHeaders property on the clipboardCopyConfig option"); + } + + if (this.options.printVisibleRows !== true) { + + console.warn("printVisibleRows option is deprecated, you should now use the printRowRange option"); + + this.options.persistence.printRowRange = "active"; + } + + if (this.options.printCopyStyle !== true) { + + console.warn("printCopyStyle option is deprecated, you should now use the printStyled option"); + + this.options.persistence.printStyled = this.options.printCopyStyle; + } + + if (this.options.persistentLayout) { + + console.warn("persistentLayout option is deprecated, you should now use the persistence option"); + + if (this.options.persistence !== true && typeof this.options.persistence.columns === "undefined") { + + this.options.persistence.columns = true; + } + } + + if (this.options.persistentSort) { + + console.warn("persistentSort option is deprecated, you should now use the persistence option"); + + if (this.options.persistence !== true && typeof this.options.persistence.sort === "undefined") { + + this.options.persistence.sort = true; + } + } + + if (this.options.persistentFilter) { + + console.warn("persistentFilter option is deprecated, you should now use the persistence option"); + + if (this.options.persistence !== true && typeof this.options.persistence.filter === "undefined") { + + this.options.persistence.filter = true; + } + } + + if (this.options.columnVertAlign) { + + console.warn("columnVertAlign option is deprecated, you should now use the columnHeaderVertAlign option"); + + this.options.columnHeaderVertAlign = this.options.columnVertAlign; + } + }; + + Tabulator.prototype._clearSelection = function () { + + this.element.classList.add("tabulator-block-select"); + + if (window.getSelection) { + + if (window.getSelection().empty) { + // Chrome + + window.getSelection().empty(); + } else if (window.getSelection().removeAllRanges) { + // Firefox + + window.getSelection().removeAllRanges(); + } + } else if (document.selection) { + // IE? + + document.selection.empty(); + } + + this.element.classList.remove("tabulator-block-select"); + }; + + //concreate table + + Tabulator.prototype._create = function () { + + this._clearObjectPointers(); + + this._mapDepricatedFunctionality(); + + this.bindModules(); + + this.rtlCheck(); + + if (this.element.tagName === "TABLE") { + + if (this.modExists("htmlTableImport", true)) { + + this.modules.htmlTableImport.parseTable(); + } + } + + this.columnManager = new ColumnManager(this); + + this.rowManager = new RowManager(this); + + this.footerManager = new FooterManager(this); + + this.columnManager.setRowManager(this.rowManager); + + this.rowManager.setColumnManager(this.columnManager); + + if (this.options.virtualDomHoz) { + + this.vdomHoz = new VDomHoz(this); + } + + this._buildElement(); + + this._loadInitialData(); + }; + + //clear pointers to objects in default config object + + Tabulator.prototype._clearObjectPointers = function () { + + this.options.columns = this.options.columns.slice(0); + + if (!this.options.reactiveData) { + + this.options.data = this.options.data.slice(0); + } + }; + + //build tabulator element + + Tabulator.prototype._buildElement = function () { + var _this24 = this; + + var element = this.element, + mod = this.modules, + options = this.options; + + options.tableBuilding.call(this); + + element.classList.add("tabulator"); + + element.setAttribute("role", "grid"); + + //empty element + + while (element.firstChild) { + element.removeChild(element.firstChild); + } //set table height + + if (options.height) { + + options.height = isNaN(options.height) ? options.height : options.height + "px"; + + element.style.height = options.height; + } + + //set table min height + + if (options.minHeight !== false) { + + options.minHeight = isNaN(options.minHeight) ? options.minHeight : options.minHeight + "px"; + + element.style.minHeight = options.minHeight; + } + + //set table maxHeight + + if (options.maxHeight !== false) { + + options.maxHeight = isNaN(options.maxHeight) ? options.maxHeight : options.maxHeight + "px"; + + element.style.maxHeight = options.maxHeight; + } + + this.columnManager.initialize(); + + this.rowManager.initialize(); + + this._detectBrowser(); + + if (this.modExists("layout", true)) { + + mod.layout.initialize(options.layout); + } + + //set localization + + + mod.localize.initialize(); + + if (options.headerFilterPlaceholder !== false) { + + mod.localize.setHeaderFilterPlaceholder(options.headerFilterPlaceholder); + } + + for (var locale in options.langs) { + + mod.localize.installLang(locale, options.langs[locale]); + } + + mod.localize.setLocale(options.locale); + + //configure placeholder element + + if (typeof options.placeholder == "string") { + + var el = document.createElement("div"); + + el.classList.add("tabulator-placeholder"); + + var span = document.createElement("span"); + + span.innerHTML = options.placeholder; + + el.appendChild(span); + + options.placeholder = el; + } + + //build table elements + + element.appendChild(this.columnManager.getElement()); + + element.appendChild(this.rowManager.getElement()); + + if (options.footerElement) { + + this.footerManager.activate(); + } + + if (options.persistence && this.modExists("persistence", true)) { + + mod.persistence.initialize(); + } + + if (options.persistence && this.modExists("persistence", true) && mod.persistence.config.columns) { + + options.columns = mod.persistence.load("columns", options.columns); + } + + if (options.movableRows && this.modExists("moveRow")) { + + mod.moveRow.initialize(); + } + + if (options.autoColumns && this.options.data) { + + this.columnManager.generateColumnsFromRowData(this.options.data); + } + + if (this.modExists("columnCalcs")) { + + mod.columnCalcs.initialize(); + } + + this.columnManager.setColumns(options.columns); + + if (options.dataTree && this.modExists("dataTree", true)) { + + mod.dataTree.initialize(); + } + + if (this.modExists("frozenRows")) { + + this.modules.frozenRows.initialize(); + } + + if ((options.persistence && this.modExists("persistence", true) && mod.persistence.config.sort || options.initialSort) && this.modExists("sort", true)) { + + var sorters = []; + + if (options.persistence && this.modExists("persistence", true) && mod.persistence.config.sort) { + + sorters = mod.persistence.load("sort"); + + if (sorters === false && options.initialSort) { + + sorters = options.initialSort; + } + } else if (options.initialSort) { + + sorters = options.initialSort; + } + + mod.sort.setSort(sorters); + } + + if ((options.persistence && this.modExists("persistence", true) && mod.persistence.config.filter || options.initialFilter) && this.modExists("filter", true)) { + + var filters = []; + + if (options.persistence && this.modExists("persistence", true) && mod.persistence.config.filter) { + + filters = mod.persistence.load("filter"); + + if (filters === false && options.initialFilter) { + + filters = options.initialFilter; + } + } else if (options.initialFilter) { + + filters = options.initialFilter; + } + + mod.filter.setFilter(filters); + } + + if (options.initialHeaderFilter && this.modExists("filter", true)) { + + options.initialHeaderFilter.forEach(function (item) { + + var column = _this24.columnManager.findColumn(item.field); + + if (column) { + + mod.filter.setHeaderFilterValue(column, item.value); + } else { + + console.warn("Column Filter Error - No matching column found:", item.field); + + return false; + } + }); + } + + if (this.modExists("ajax")) { + + mod.ajax.initialize(); + } + + if (options.pagination && this.modExists("page", true)) { + + mod.page.initialize(); + } + + if (options.groupBy && this.modExists("groupRows", true)) { + + mod.groupRows.initialize(); + } + + if (this.modExists("keybindings")) { + + mod.keybindings.initialize(); + } + + if (this.modExists("selectRow")) { + + mod.selectRow.clearSelectionData(true); + } + + if (options.autoResize && this.modExists("resizeTable")) { + + mod.resizeTable.initialize(); + } + + if (this.modExists("clipboard")) { + + mod.clipboard.initialize(); + } + + if (options.printAsHtml && this.modExists("print")) { + + mod.print.initialize(); + } + + options.tableBuilt.call(this); + }; + + Tabulator.prototype._loadInitialData = function () { + + var self = this; + + if (self.options.pagination && self.modExists("page")) { + + self.modules.page.reset(true, true); + + if (self.options.pagination == "local") { + + if (self.options.data.length) { + + self.rowManager.setData(self.options.data, false, true); + } else { + + if ((self.options.ajaxURL || self.options.ajaxURLGenerator) && self.modExists("ajax")) { + + self.modules.ajax.loadData(false, true).then(function () {}).catch(function () { + + if (self.options.paginationInitialPage) { + + self.modules.page.setPage(self.options.paginationInitialPage); + } + }); + + return; + } else { + + self.rowManager.setData(self.options.data, false, true); + } + } + + if (self.options.paginationInitialPage) { + + self.modules.page.setPage(self.options.paginationInitialPage); + } + } else { + + if (self.options.ajaxURL) { + + self.modules.page.setPage(self.options.paginationInitialPage).then(function () {}).catch(function () {}); + } else { + + self.rowManager.setData([], false, true); + } + } + } else { + + if (self.options.data.length) { + + self.rowManager.setData(self.options.data); + } else { + + if ((self.options.ajaxURL || self.options.ajaxURLGenerator) && self.modExists("ajax")) { + + self.modules.ajax.loadData(false, true).then(function () {}).catch(function () {}); + } else { + + self.rowManager.setData(self.options.data, false, true); + } + } + } + }; + + //deconstructor + + Tabulator.prototype.destroy = function () { + + var element = this.element; + + Tabulator.prototype.comms.deregister(this); //deregister table from inderdevice communication + + + if (this.options.reactiveData && this.modExists("reactiveData", true)) { + + this.modules.reactiveData.unwatchData(); + } + + //clear row data + + this.rowManager.rows.forEach(function (row) { + + row.wipe(); + }); + + this.rowManager.rows = []; + + this.rowManager.activeRows = []; + + this.rowManager.displayRows = []; + + //clear event bindings + + if (this.options.autoResize && this.modExists("resizeTable")) { + + this.modules.resizeTable.clearBindings(); + } + + if (this.modExists("keybindings")) { + + this.modules.keybindings.clearBindings(); + } + + //clear DOM + + while (element.firstChild) { + element.removeChild(element.firstChild); + }element.classList.remove("tabulator"); + }; + + Tabulator.prototype._detectBrowser = function () { + + var ua = navigator.userAgent || navigator.vendor || window.opera; + + if (ua.indexOf("Trident") > -1) { + + this.browser = "ie"; + + this.browserSlow = true; + } else if (ua.indexOf("Edge") > -1) { + + this.browser = "edge"; + + this.browserSlow = true; + } else if (ua.indexOf("Firefox") > -1) { + + this.browser = "firefox"; + + this.browserSlow = false; + } else { + + this.browser = "other"; + + this.browserSlow = false; + } + + this.browserMobile = /(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino|android|ipad|playbook|silk/i.test(ua) || /1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(ua.substr(0, 4)); + }; + + ////////////////// Data Handling ////////////////// + + + //block table redrawing + + Tabulator.prototype.blockRedraw = function () { + + return this.rowManager.blockRedraw(); + }; + + //restore table redrawing + + Tabulator.prototype.restoreRedraw = function () { + + return this.rowManager.restoreRedraw(); + }; + + //local data from local file + + Tabulator.prototype.setDataFromLocalFile = function (extensions) { + var _this25 = this; + + return new Promise(function (resolve, reject) { + + var input = document.createElement("input"); + + input.type = "file"; + + input.accept = extensions || ".json,application/json"; + + input.addEventListener("change", function (e) { + + var file = input.files[0], + reader = new FileReader(), + data; + + reader.readAsText(file); + + reader.onload = function (e) { + + try { + + data = JSON.parse(reader.result); + } catch (e) { + + console.warn("File Load Error - File contents is invalid JSON", e); + + reject(e); + + return; + } + + _this25.setData(data).then(function (data) { + + resolve(data); + }).catch(function (err) { + + resolve(err); + }); + }; + + reader.onerror = function (e) { + + console.warn("File Load Error - Unable to read file"); + + reject(); + }; + }); + + input.click(); + }); + }; + + //load data + + Tabulator.prototype.setData = function (data, params, config) { + + if (this.modExists("ajax")) { + + this.modules.ajax.blockActiveRequest(); + } + + return this._setData(data, params, config, false, true); + }; + + Tabulator.prototype._setData = function (data, params, config, inPosition, columnsChanged) { + + var self = this; + + if (typeof data === "string") { + + if (data.indexOf("{") == 0 || data.indexOf("[") == 0) { + + //data is a json encoded string + + return self.rowManager.setData(JSON.parse(data), inPosition, columnsChanged); + } else { + + if (self.modExists("ajax", true)) { + + if (params) { + + self.modules.ajax.setParams(params); + } + + if (config) { + + self.modules.ajax.setConfig(config); + } + + self.modules.ajax.setUrl(data); + + if (self.options.pagination == "remote" && self.modExists("page", true)) { + + self.modules.page.reset(true, true); + + return self.modules.page.setPage(1); + } else { + + //assume data is url, make ajax call to url to get data + + return self.modules.ajax.loadData(inPosition, columnsChanged); + } + } + } + } else { + + if (data) { + + //asume data is already an object + + return self.rowManager.setData(data, inPosition, columnsChanged); + } else { + + //no data provided, check if ajaxURL is present; + + if (self.modExists("ajax") && (self.modules.ajax.getUrl || self.options.ajaxURLGenerator)) { + + if (self.options.pagination == "remote" && self.modExists("page", true)) { + + self.modules.page.reset(true, true); + + return self.modules.page.setPage(1); + } else { + + return self.modules.ajax.loadData(inPosition, columnsChanged); + } + } else { + + //empty data + + return self.rowManager.setData([], inPosition, columnsChanged); + } + } + } + }; + + //clear data + + Tabulator.prototype.clearData = function () { + + if (this.modExists("ajax")) { + + this.modules.ajax.blockActiveRequest(); + } + + this.rowManager.clearData(); + }; + + //get table data array + + Tabulator.prototype.getData = function (active) { + + if (active === true) { + + console.warn("passing a boolean to the getData function is deprecated, you should now pass the string 'active'"); + + active = "active"; + } + + return this.rowManager.getData(active); + }; + + //get table data array count + + Tabulator.prototype.getDataCount = function (active) { + + if (active === true) { + + console.warn("passing a boolean to the getDataCount function is deprecated, you should now pass the string 'active'"); + + active = "active"; + } + + return this.rowManager.getDataCount(active); + }; + + //search for specific row components + + Tabulator.prototype.searchRows = function (field, type, value) { + + if (this.modExists("filter", true)) { + + return this.modules.filter.search("rows", field, type, value); + } + }; + + //search for specific data + + Tabulator.prototype.searchData = function (field, type, value) { + + if (this.modExists("filter", true)) { + + return this.modules.filter.search("data", field, type, value); + } + }; + + //get table html + + Tabulator.prototype.getHtml = function (visible, style, config) { + + if (this.modExists("export", true)) { + + return this.modules.export.getHtml(visible, style, config); + } + }; + + //get print html + + Tabulator.prototype.print = function (visible, style, config) { + + if (this.modExists("print", true)) { + + return this.modules.print.printFullscreen(visible, style, config); + } + }; + + //retrieve Ajax URL + + Tabulator.prototype.getAjaxUrl = function () { + + if (this.modExists("ajax", true)) { + + return this.modules.ajax.getUrl(); + } + }; + + //replace data, keeping table in position with same sort + + Tabulator.prototype.replaceData = function (data, params, config) { + + if (this.modExists("ajax")) { + + this.modules.ajax.blockActiveRequest(); + } + + return this._setData(data, params, config, true); + }; + + //update table data + + Tabulator.prototype.updateData = function (data) { + var _this26 = this; + + var self = this; + + var responses = 0; + + return new Promise(function (resolve, reject) { + + if (_this26.modExists("ajax")) { + + _this26.modules.ajax.blockActiveRequest(); + } + + if (typeof data === "string") { + + data = JSON.parse(data); + } + + if (data) { + + data.forEach(function (item) { + + var row = self.rowManager.findRow(item[self.options.index]); + + if (row) { + + responses++; + + row.updateData(item).then(function () { + + responses--; + + if (!responses) { + + resolve(); + } + }); + } + }); + } else { + + console.warn("Update Error - No data provided"); + + reject("Update Error - No data provided"); + } + }); + }; + + Tabulator.prototype.addData = function (data, pos, index) { + var _this27 = this; + + return new Promise(function (resolve, reject) { + + if (_this27.modExists("ajax")) { + + _this27.modules.ajax.blockActiveRequest(); + } + + if (typeof data === "string") { + + data = JSON.parse(data); + } + + if (data) { + + _this27.rowManager.addRows(data, pos, index).then(function (rows) { + + var output = []; + + rows.forEach(function (row) { + + output.push(row.getComponent()); + }); + + resolve(output); + }); + } else { + + console.warn("Update Error - No data provided"); + + reject("Update Error - No data provided"); + } + }); + }; + + //update table data + + Tabulator.prototype.updateOrAddData = function (data) { + var _this28 = this; + + var self = this, + rows = [], + responses = 0; + + return new Promise(function (resolve, reject) { + + if (_this28.modExists("ajax")) { + + _this28.modules.ajax.blockActiveRequest(); + } + + if (typeof data === "string") { + + data = JSON.parse(data); + } + + if (data) { + + data.forEach(function (item) { + + var row = self.rowManager.findRow(item[self.options.index]); + + responses++; + + if (row) { + + row.updateData(item).then(function () { + + responses--; + + rows.push(row.getComponent()); + + if (!responses) { + + resolve(rows); + } + }); + } else { + + self.rowManager.addRows(item).then(function (newRows) { + + responses--; + + rows.push(newRows[0].getComponent()); + + if (!responses) { + + resolve(rows); + } + }); + } + }); + } else { + + console.warn("Update Error - No data provided"); + + reject("Update Error - No data provided"); + } + }); + }; + + //get row object + + Tabulator.prototype.getRow = function (index) { + + var row = this.rowManager.findRow(index); + + if (row) { + + return row.getComponent(); + } else { + + console.warn("Find Error - No matching row found:", index); + + return false; + } + }; + + //get row object + + Tabulator.prototype.getRowFromPosition = function (position, active) { + + var row = this.rowManager.getRowFromPosition(position, active); + + if (row) { + + return row.getComponent(); + } else { + + console.warn("Find Error - No matching row found:", position); + + return false; + } + }; + + //delete row from table + + Tabulator.prototype.deleteRow = function (index) { + var _this29 = this; + + return new Promise(function (resolve, reject) { + + var self = _this29, + count = 0, + successCount = 0, + foundRows = []; + + function doneCheck() { + + count++; + + if (count == index.length) { + + if (successCount) { + + self.rowManager.reRenderInPosition(); + + resolve(); + } + } + } + + if (!Array.isArray(index)) { + + index = [index]; + } + + //find matching rows + + index.forEach(function (item) { + + var row = _this29.rowManager.findRow(item, true); + + if (row) { + + foundRows.push(row); + } else { + + console.warn("Delete Error - No matching row found:", item); + + reject("Delete Error - No matching row found"); + + doneCheck(); + } + }); + + //sort rows into correct order to ensure smooth delete from table + + foundRows.sort(function (a, b) { + + return _this29.rowManager.rows.indexOf(a) > _this29.rowManager.rows.indexOf(b) ? 1 : -1; + }); + + foundRows.forEach(function (row) { + + row.delete().then(function () { + + successCount++; + + doneCheck(); + }).catch(function (err) { + + doneCheck(); + + reject(err); + }); + }); + }); + }; + + //add row to table + + Tabulator.prototype.addRow = function (data, pos, index) { + var _this30 = this; + + return new Promise(function (resolve, reject) { + + if (typeof data === "string") { + + data = JSON.parse(data); + } + + _this30.rowManager.addRows(data, pos, index).then(function (rows) { + + //recalc column calculations if present + + if (_this30.modExists("columnCalcs")) { + + _this30.modules.columnCalcs.recalc(_this30.rowManager.activeRows); + } + + resolve(rows[0].getComponent()); + }); + }); + }; + + //update a row if it exitsts otherwise create it + + Tabulator.prototype.updateOrAddRow = function (index, data) { + var _this31 = this; + + return new Promise(function (resolve, reject) { + + var row = _this31.rowManager.findRow(index); + + if (typeof data === "string") { + + data = JSON.parse(data); + } + + if (row) { + + row.updateData(data).then(function () { + + //recalc column calculations if present + + if (_this31.modExists("columnCalcs")) { + + _this31.modules.columnCalcs.recalc(_this31.rowManager.activeRows); + } + + resolve(row.getComponent()); + }).catch(function (err) { + + reject(err); + }); + } else { + + row = _this31.rowManager.addRows(data).then(function (rows) { + + //recalc column calculations if present + + if (_this31.modExists("columnCalcs")) { + + _this31.modules.columnCalcs.recalc(_this31.rowManager.activeRows); + } + + resolve(rows[0].getComponent()); + }).catch(function (err) { + + reject(err); + }); + } + }); + }; + + //update row data + + Tabulator.prototype.updateRow = function (index, data) { + var _this32 = this; + + return new Promise(function (resolve, reject) { + + var row = _this32.rowManager.findRow(index); + + if (typeof data === "string") { + + data = JSON.parse(data); + } + + if (row) { + + row.updateData(data).then(function () { + + resolve(row.getComponent()); + }).catch(function (err) { + + reject(err); + }); + } else { + + console.warn("Update Error - No matching row found:", index); + + reject("Update Error - No matching row found"); + } + }); + }; + + //scroll to row in DOM + + Tabulator.prototype.scrollToRow = function (index, position, ifVisible) { + var _this33 = this; + + return new Promise(function (resolve, reject) { + + var row = _this33.rowManager.findRow(index); + + if (row) { + + _this33.rowManager.scrollToRow(row, position, ifVisible).then(function () { + + resolve(); + }).catch(function (err) { + + reject(err); + }); + } else { + + console.warn("Scroll Error - No matching row found:", index); + + reject("Scroll Error - No matching row found"); + } + }); + }; + + Tabulator.prototype.moveRow = function (from, to, after) { + + var fromRow = this.rowManager.findRow(from); + + if (fromRow) { + + fromRow.moveToRow(to, after); + } else { + + console.warn("Move Error - No matching row found:", from); + } + }; + + Tabulator.prototype.getRows = function (active) { + + if (active === true) { + + console.warn("passing a boolean to the getRows function is deprecated, you should now pass the string 'active'"); + + active = "active"; + } + + return this.rowManager.getComponents(active); + }; + + //get position of row in table + + Tabulator.prototype.getRowPosition = function (index, active) { + + var row = this.rowManager.findRow(index); + + if (row) { + + return this.rowManager.getRowPosition(row, active); + } else { + + console.warn("Position Error - No matching row found:", index); + + return false; + } + }; + + //copy table data to clipboard + + Tabulator.prototype.copyToClipboard = function (selector) { + + if (this.modExists("clipboard", true)) { + + this.modules.clipboard.copy(selector); + } + }; + + /////////////// Column Functions /////////////// + + + Tabulator.prototype.setColumns = function (definition) { + + this.columnManager.setColumns(definition); + }; + + Tabulator.prototype.getColumns = function (structured) { + + return this.columnManager.getComponents(structured); + }; + + Tabulator.prototype.getColumn = function (field) { + + var col = this.columnManager.findColumn(field); + + if (col) { + + return col.getComponent(); + } else { + + console.warn("Find Error - No matching column found:", field); + + return false; + } + }; + + Tabulator.prototype.getColumnDefinitions = function () { + + return this.columnManager.getDefinitionTree(); + }; + + Tabulator.prototype.getColumnLayout = function () { + + if (this.modExists("persistence", true)) { + + return this.modules.persistence.parseColumns(this.columnManager.getColumns()); + } + }; + + Tabulator.prototype.setColumnLayout = function (layout) { + + if (this.modExists("persistence", true)) { + + this.columnManager.setColumns(this.modules.persistence.mergeDefinition(this.options.columns, layout)); + + return true; + } + + return false; + }; + + Tabulator.prototype.showColumn = function (field) { + + var column = this.columnManager.findColumn(field); + + if (column) { + + column.show(); + + if (this.options.responsiveLayout && this.modExists("responsiveLayout", true)) { + + this.modules.responsiveLayout.update(); + } + } else { + + console.warn("Column Show Error - No matching column found:", field); + + return false; + } + }; + + Tabulator.prototype.hideColumn = function (field) { + + var column = this.columnManager.findColumn(field); + + if (column) { + + column.hide(); + + if (this.options.responsiveLayout && this.modExists("responsiveLayout", true)) { + + this.modules.responsiveLayout.update(); + } + } else { + + console.warn("Column Hide Error - No matching column found:", field); + + return false; + } + }; + + Tabulator.prototype.toggleColumn = function (field) { + + var column = this.columnManager.findColumn(field); + + if (column) { + + if (column.visible) { + + column.hide(); + } else { + + column.show(); + } + } else { + + console.warn("Column Visibility Toggle Error - No matching column found:", field); + + return false; + } + }; + + Tabulator.prototype.addColumn = function (definition, before, field) { + var _this34 = this; + + return new Promise(function (resolve, reject) { + + var column = _this34.columnManager.findColumn(field); + + _this34.columnManager.addColumn(definition, before, column).then(function (column) { + + resolve(column.getComponent()); + }).catch(function (err) { + + reject(err); + }); + }); + }; + + Tabulator.prototype.deleteColumn = function (field) { + var _this35 = this; + + return new Promise(function (resolve, reject) { + + var column = _this35.columnManager.findColumn(field); + + if (column) { + + column.delete().then(function () { + + resolve(); + }).catch(function (err) { + + reject(err); + }); + } else { + + console.warn("Column Delete Error - No matching column found:", field); + + reject(); + } + }); + }; + + Tabulator.prototype.updateColumnDefinition = function (field, definition) { + var _this36 = this; + + return new Promise(function (resolve, reject) { + + var column = _this36.columnManager.findColumn(field); + + if (column) { + + column.updateDefinition(definition).then(function (col) { + + resolve(col); + }).catch(function (err) { + + reject(err); + }); + } else { + + console.warn("Column Update Error - No matching column found:", field); + + reject(); + } + }); + }; + + Tabulator.prototype.moveColumn = function (from, to, after) { + + var fromColumn = this.columnManager.findColumn(from); + + var toColumn = this.columnManager.findColumn(to); + + if (fromColumn) { + + if (toColumn) { + + this.columnManager.moveColumn(fromColumn, toColumn, after); + } else { + + console.warn("Move Error - No matching column found:", toColumn); + } + } else { + + console.warn("Move Error - No matching column found:", from); + } + }; + + //scroll to column in DOM + + Tabulator.prototype.scrollToColumn = function (field, position, ifVisible) { + var _this37 = this; + + return new Promise(function (resolve, reject) { + + var column = _this37.columnManager.findColumn(field); + + if (column) { + + _this37.columnManager.scrollToColumn(column, position, ifVisible).then(function () { + + resolve(); + }).catch(function (err) { + + reject(err); + }); + } else { + + console.warn("Scroll Error - No matching column found:", field); + + reject("Scroll Error - No matching column found"); + } + }); + }; + + //////////// Localization Functions //////////// + + Tabulator.prototype.setLocale = function (locale) { + + this.modules.localize.setLocale(locale); + }; + + Tabulator.prototype.getLocale = function () { + + return this.modules.localize.getLocale(); + }; + + Tabulator.prototype.getLang = function (locale) { + + return this.modules.localize.getLang(locale); + }; + + //////////// General Public Functions //////////// + + + //redraw list without updating data + + Tabulator.prototype.redraw = function (force) { + + this.columnManager.redraw(force); + + this.rowManager.redraw(force); + }; + + Tabulator.prototype.setHeight = function (height) { + + if (this.rowManager.renderMode !== "classic") { + + this.options.height = isNaN(height) ? height : height + "px"; + + this.element.style.height = this.options.height; + + this.rowManager.setRenderMode(); + + this.rowManager.redraw(); + } else { + + console.warn("setHeight function is not available in classic render mode"); + } + }; + + ///////////////////// Sorting //////////////////// + + + //trigger sort + + Tabulator.prototype.setSort = function (sortList, dir) { + + if (this.modExists("sort", true)) { + + this.modules.sort.setSort(sortList, dir); + + this.rowManager.sorterRefresh(); + } + }; + + Tabulator.prototype.getSorters = function () { + + if (this.modExists("sort", true)) { + + return this.modules.sort.getSort(); + } + }; + + Tabulator.prototype.clearSort = function () { + + if (this.modExists("sort", true)) { + + this.modules.sort.clear(); + + this.rowManager.sorterRefresh(); + } + }; + + ///////////////////// Filtering //////////////////// + + + //set standard filters + + Tabulator.prototype.setFilter = function (field, type, value, params) { + + if (this.modExists("filter", true)) { + + this.modules.filter.setFilter(field, type, value, params); + + this.rowManager.filterRefresh(); + } + }; + + //add filter to array + + Tabulator.prototype.addFilter = function (field, type, value, params) { + + if (this.modExists("filter", true)) { + + this.modules.filter.addFilter(field, type, value, params); + + this.rowManager.filterRefresh(); + } + }; + + //get all filters + + Tabulator.prototype.getFilters = function (all) { + + if (this.modExists("filter", true)) { + + return this.modules.filter.getFilters(all); + } + }; + + Tabulator.prototype.setHeaderFilterFocus = function (field) { + + if (this.modExists("filter", true)) { + + var column = this.columnManager.findColumn(field); + + if (column) { + + this.modules.filter.setHeaderFilterFocus(column); + } else { + + console.warn("Column Filter Focus Error - No matching column found:", field); + + return false; + } + } + }; + + Tabulator.prototype.getHeaderFilterValue = function (field) { + + if (this.modExists("filter", true)) { + + var column = this.columnManager.findColumn(field); + + if (column) { + + return this.modules.filter.getHeaderFilterValue(column); + } else { + + console.warn("Column Filter Error - No matching column found:", field); + } + } + }; + + Tabulator.prototype.setHeaderFilterValue = function (field, value) { + + if (this.modExists("filter", true)) { + + var column = this.columnManager.findColumn(field); + + if (column) { + + this.modules.filter.setHeaderFilterValue(column, value); + } else { + + console.warn("Column Filter Error - No matching column found:", field); + + return false; + } + } + }; + + Tabulator.prototype.getHeaderFilters = function () { + + if (this.modExists("filter", true)) { + + return this.modules.filter.getHeaderFilters(); + } + }; + + //remove filter from array + + Tabulator.prototype.removeFilter = function (field, type, value) { + + if (this.modExists("filter", true)) { + + this.modules.filter.removeFilter(field, type, value); + + this.rowManager.filterRefresh(); + } + }; + + //clear filters + + Tabulator.prototype.clearFilter = function (all) { + + if (this.modExists("filter", true)) { + + this.modules.filter.clearFilter(all); + + this.rowManager.filterRefresh(); + } + }; + + //clear header filters + + Tabulator.prototype.clearHeaderFilter = function () { + + if (this.modExists("filter", true)) { + + this.modules.filter.clearHeaderFilter(); + + this.rowManager.filterRefresh(); + } + }; + + ///////////////////// select //////////////////// + + Tabulator.prototype.selectRow = function (rows) { + + if (this.modExists("selectRow", true)) { + + if (rows === true) { + + console.warn("passing a boolean to the selectRowselectRow function is deprecated, you should now pass the string 'active'"); + + rows = "active"; + } + + this.modules.selectRow.selectRows(rows); + } + }; + + Tabulator.prototype.deselectRow = function (rows) { + + if (this.modExists("selectRow", true)) { + + this.modules.selectRow.deselectRows(rows); + } + }; + + Tabulator.prototype.toggleSelectRow = function (row) { + + if (this.modExists("selectRow", true)) { + + this.modules.selectRow.toggleRow(row); + } + }; + + Tabulator.prototype.getSelectedRows = function () { + + if (this.modExists("selectRow", true)) { + + return this.modules.selectRow.getSelectedRows(); + } + }; + + Tabulator.prototype.getSelectedData = function () { + + if (this.modExists("selectRow", true)) { + + return this.modules.selectRow.getSelectedData(); + } + }; + + ///////////////////// validation //////////////////// + + Tabulator.prototype.getInvalidCells = function () { + + if (this.modExists("validate", true)) { + + return this.modules.validate.getInvalidCells(); + } + }; + + Tabulator.prototype.clearCellValidation = function (cells) { + var _this38 = this; + + if (this.modExists("validate", true)) { + + if (!cells) { + + cells = this.modules.validate.getInvalidCells(); + } + + if (!Array.isArray(cells)) { + + cells = [cells]; + } + + cells.forEach(function (cell) { + + _this38.modules.validate.clearValidation(cell._getSelf()); + }); + } + }; + + Tabulator.prototype.validate = function (cells) { + + var output = []; + + //clear row data + + this.rowManager.rows.forEach(function (row) { + + var valid = row.validate(); + + if (valid !== true) { + + output = output.concat(valid); + } + }); + + return output.length ? output : true; + }; + + //////////// Pagination Functions //////////// + + + Tabulator.prototype.setMaxPage = function (max) { + + if (this.options.pagination && this.modExists("page")) { + + this.modules.page.setMaxPage(max); + } else { + + return false; + } + }; + + Tabulator.prototype.setPage = function (page) { + + if (this.options.pagination && this.modExists("page")) { + + return this.modules.page.setPage(page); + } else { + + return new Promise(function (resolve, reject) { + reject(); + }); + } + }; + + Tabulator.prototype.setPageToRow = function (row) { + var _this39 = this; + + return new Promise(function (resolve, reject) { + + if (_this39.options.pagination && _this39.modExists("page")) { + + row = _this39.rowManager.findRow(row); + + if (row) { + + _this39.modules.page.setPageToRow(row).then(function () { + + resolve(); + }).catch(function () { + + reject(); + }); + } else { + + reject(); + } + } else { + + reject(); + } + }); + }; + + Tabulator.prototype.setPageSize = function (size) { + + if (this.options.pagination && this.modExists("page")) { + + this.modules.page.setPageSize(size); + + this.modules.page.setPage(1).then(function () {}).catch(function () {}); + } else { + + return false; + } + }; + + Tabulator.prototype.getPageSize = function () { + + if (this.options.pagination && this.modExists("page", true)) { + + return this.modules.page.getPageSize(); + } + }; + + Tabulator.prototype.previousPage = function () { + + if (this.options.pagination && this.modExists("page")) { + + this.modules.page.previousPage(); + } else { + + return false; + } + }; + + Tabulator.prototype.nextPage = function () { + + if (this.options.pagination && this.modExists("page")) { + + this.modules.page.nextPage(); + } else { + + return false; + } + }; + + Tabulator.prototype.getPage = function () { + + if (this.options.pagination && this.modExists("page")) { + + return this.modules.page.getPage(); + } else { + + return false; + } + }; + + Tabulator.prototype.getPageMax = function () { + + if (this.options.pagination && this.modExists("page")) { + + return this.modules.page.getPageMax(); + } else { + + return false; + } + }; + + ///////////////// Grouping Functions /////////////// + + + Tabulator.prototype.setGroupBy = function (groups) { + + if (this.modExists("groupRows", true)) { + + this.options.groupBy = groups; + + this.modules.groupRows.initialize(); + + this.rowManager.refreshActiveData("display"); + + if (this.options.persistence && this.modExists("persistence", true) && this.modules.persistence.config.group) { + + this.modules.persistence.save("group"); + } + } else { + + return false; + } + }; + + Tabulator.prototype.setGroupValues = function (groupValues) { + + if (this.modExists("groupRows", true)) { + + this.options.groupValues = groupValues; + + this.modules.groupRows.initialize(); + + this.rowManager.refreshActiveData("display"); + + if (this.options.persistence && this.modExists("persistence", true) && this.modules.persistence.config.group) { + + this.modules.persistence.save("group"); + } + } else { + + return false; + } + }; + + Tabulator.prototype.setGroupStartOpen = function (values) { + + if (this.modExists("groupRows", true)) { + + this.options.groupStartOpen = values; + + this.modules.groupRows.initialize(); + + if (this.options.groupBy) { + + this.rowManager.refreshActiveData("group"); + + if (this.options.persistence && this.modExists("persistence", true) && this.modules.persistence.config.group) { + + this.modules.persistence.save("group"); + } + } else { + + console.warn("Grouping Update - cant refresh view, no groups have been set"); + } + } else { + + return false; + } + }; + + Tabulator.prototype.setGroupHeader = function (values) { + + if (this.modExists("groupRows", true)) { + + this.options.groupHeader = values; + + this.modules.groupRows.initialize(); + + if (this.options.groupBy) { + + this.rowManager.refreshActiveData("group"); + + if (this.options.persistence && this.modExists("persistence", true) && this.modules.persistence.config.group) { + + this.modules.persistence.save("group"); + } + } else { + + console.warn("Grouping Update - cant refresh view, no groups have been set"); + } + } else { + + return false; + } + }; + + Tabulator.prototype.getGroups = function (values) { + + if (this.modExists("groupRows", true)) { + + return this.modules.groupRows.getGroups(true); + } else { + + return false; + } + }; + + // get grouped table data in the same format as getData() + + Tabulator.prototype.getGroupedData = function () { + + if (this.modExists("groupRows", true)) { + + return this.options.groupBy ? this.modules.groupRows.getGroupedData() : this.getData(); + } + }; + + Tabulator.prototype.getEditedCells = function () { + + if (this.modExists("edit", true)) { + + return this.modules.edit.getEditedCells(); + } + }; + + Tabulator.prototype.clearCellEdited = function (cells) { + var _this40 = this; + + if (this.modExists("edit", true)) { + + if (!cells) { + + cells = this.modules.edit.getEditedCells(); + } + + if (!Array.isArray(cells)) { + + cells = [cells]; + } + + cells.forEach(function (cell) { + + _this40.modules.edit.clearEdited(cell._getSelf()); + }); + } + }; + + ///////////////// Column Calculation Functions /////////////// + + Tabulator.prototype.getCalcResults = function () { + + if (this.modExists("columnCalcs", true)) { + + return this.modules.columnCalcs.getResults(); + } else { + + return false; + } + }; + + Tabulator.prototype.recalc = function () { + + if (this.modExists("columnCalcs", true)) { + + this.modules.columnCalcs.recalcAll(this.rowManager.activeRows); + } + }; + + /////////////// Navigation Management ////////////// + + + Tabulator.prototype.navigatePrev = function () { + + var cell = false; + + if (this.modExists("edit", true)) { + + cell = this.modules.edit.currentCell; + + if (cell) { + + return cell.nav().prev(); + } + } + + return false; + }; + + Tabulator.prototype.navigateNext = function () { + + var cell = false; + + if (this.modExists("edit", true)) { + + cell = this.modules.edit.currentCell; + + if (cell) { + + return cell.nav().next(); + } + } + + return false; + }; + + Tabulator.prototype.navigateLeft = function () { + + var cell = false; + + if (this.modExists("edit", true)) { + + cell = this.modules.edit.currentCell; + + if (cell) { + + e.preventDefault(); + + return cell.nav().left(); + } + } + + return false; + }; + + Tabulator.prototype.navigateRight = function () { + + var cell = false; + + if (this.modExists("edit", true)) { + + cell = this.modules.edit.currentCell; + + if (cell) { + + e.preventDefault(); + + return cell.nav().right(); + } + } + + return false; + }; + + Tabulator.prototype.navigateUp = function () { + + var cell = false; + + if (this.modExists("edit", true)) { + + cell = this.modules.edit.currentCell; + + if (cell) { + + e.preventDefault(); + + return cell.nav().up(); + } + } + + return false; + }; + + Tabulator.prototype.navigateDown = function () { + + var cell = false; + + if (this.modExists("edit", true)) { + + cell = this.modules.edit.currentCell; + + if (cell) { + + e.preventDefault(); + + return cell.nav().down(); + } + } + + return false; + }; + + /////////////// History Management ////////////// + + Tabulator.prototype.undo = function () { + + if (this.options.history && this.modExists("history", true)) { + + return this.modules.history.undo(); + } else { + + return false; + } + }; + + Tabulator.prototype.redo = function () { + + if (this.options.history && this.modExists("history", true)) { + + return this.modules.history.redo(); + } else { + + return false; + } + }; + + Tabulator.prototype.getHistoryUndoSize = function () { + + if (this.options.history && this.modExists("history", true)) { + + return this.modules.history.getHistoryUndoSize(); + } else { + + return false; + } + }; + + Tabulator.prototype.getHistoryRedoSize = function () { + + if (this.options.history && this.modExists("history", true)) { + + return this.modules.history.getHistoryRedoSize(); + } else { + + return false; + } + }; + + /////////////// Download Management ////////////// + + + Tabulator.prototype.download = function (type, filename, options, active) { + + if (this.modExists("download", true)) { + + this.modules.download.download(type, filename, options, active); + } + }; + + Tabulator.prototype.downloadToTab = function (type, filename, options, active) { + + if (this.modExists("download", true)) { + + this.modules.download.download(type, filename, options, active, true); + } + }; + + /////////// Inter Table Communications /////////// + + + Tabulator.prototype.tableComms = function (table, module, action, data) { + + this.modules.comms.receive(table, module, action, data); + }; + + ////////////// Extension Management ////////////// + + + //object to hold module + + Tabulator.prototype.moduleBindings = {}; + + //extend module + + Tabulator.prototype.extendModule = function (name, property, values) { + + if (Tabulator.prototype.moduleBindings[name]) { + + var source = Tabulator.prototype.moduleBindings[name].prototype[property]; + + if (source) { + + if ((typeof values === 'undefined' ? 'undefined' : _typeof(values)) == "object") { + + for (var key in values) { + + source[key] = values[key]; + } + } else { + + console.warn("Module Error - Invalid value type, it must be an object"); + } + } else { + + console.warn("Module Error - property does not exist:", property); + } + } else { + + console.warn("Module Error - module does not exist:", name); + } + }; + + //add module to tabulator + + Tabulator.prototype.registerModule = function (name, module) { + + var self = this; + + Tabulator.prototype.moduleBindings[name] = module; + }; + + //ensure that module are bound to instantiated function + + Tabulator.prototype.bindModules = function () { + + this.modules = {}; + + for (var name in Tabulator.prototype.moduleBindings) { + + this.modules[name] = new Tabulator.prototype.moduleBindings[name](this); + } + }; + + //Check for module + + Tabulator.prototype.modExists = function (plugin, required) { + + if (this.modules[plugin]) { + + return true; + } else { + + if (required) { + + console.error("Tabulator Module Not Installed: " + plugin); + } + + return false; + } + }; + + Tabulator.prototype.helpers = { + + elVisible: function elVisible(el) { + + return !(el.offsetWidth <= 0 && el.offsetHeight <= 0); + }, + + elOffset: function elOffset(el) { + + var box = el.getBoundingClientRect(); + + return { + + top: box.top + window.pageYOffset - document.documentElement.clientTop, + + left: box.left + window.pageXOffset - document.documentElement.clientLeft + + }; + }, + + deepClone: function deepClone(obj) { + + var clone = Object.assign(Array.isArray(obj) ? [] : {}, obj); + + for (var i in obj) { + + if (obj[i] != null && _typeof(obj[i]) === "object") { + + if (obj[i] instanceof Date) { + + clone[i] = new Date(obj[i]); + } else { + + clone[i] = this.deepClone(obj[i]); + } + } + } + + return clone; + } + + }; + + Tabulator.prototype.comms = { + + tables: [], + + register: function register(table) { + + Tabulator.prototype.comms.tables.push(table); + }, + + deregister: function deregister(table) { + + var index = Tabulator.prototype.comms.tables.indexOf(table); + + if (index > -1) { + + Tabulator.prototype.comms.tables.splice(index, 1); + } + }, + + lookupTable: function lookupTable(query, silent) { + + var results = [], + matches, + match; + + if (typeof query === "string") { + + matches = document.querySelectorAll(query); + + if (matches.length) { + + for (var i = 0; i < matches.length; i++) { + + match = Tabulator.prototype.comms.matchElement(matches[i]); + + if (match) { + + results.push(match); + } + } + } + } else if (typeof HTMLElement !== "undefined" && query instanceof HTMLElement || query instanceof Tabulator) { + + match = Tabulator.prototype.comms.matchElement(query); + + if (match) { + + results.push(match); + } + } else if (Array.isArray(query)) { + + query.forEach(function (item) { + + results = results.concat(Tabulator.prototype.comms.lookupTable(item)); + }); + } else { + + if (!silent) { + + console.warn("Table Connection Error - Invalid Selector", query); + } + } + + return results; + }, + + matchElement: function matchElement(element) { + + return Tabulator.prototype.comms.tables.find(function (table) { + + return element instanceof Tabulator ? table === element : table.element === element; + }); + } + + }; + + Tabulator.prototype.findTable = function (query) { + + var results = Tabulator.prototype.comms.lookupTable(query, true); + + return Array.isArray(results) && !results.length ? false : results; + }; + + var Layout = function Layout(table) { + + this.table = table; + + this.mode = null; + }; + + //initialize layout system + + + Layout.prototype.initialize = function (layout) { + + if (this.modes[layout]) { + + this.mode = layout; + } else { + + console.warn("Layout Error - invalid mode set, defaulting to 'fitData' : " + layout); + + this.mode = 'fitData'; + } + + this.table.element.setAttribute("tabulator-layout", this.mode); + }; + + Layout.prototype.getMode = function () { + + return this.mode; + }; + + //trigger table layout + + + Layout.prototype.layout = function () { + + this.modes[this.mode].call(this, this.table.columnManager.columnsByIndex); + }; + + //layout render functions + + + Layout.prototype.modes = { + + //resize columns to fit data they contain + + + "fitData": function fitData(columns) { + + if (this.table.options.virtualDomHoz) { + + this.table.vdomHoz.fitDataLayoutOverride(); + } else { + + columns.forEach(function (column) { + + column.reinitializeWidth(); + }); + } + + if (this.table.options.responsiveLayout && this.table.modExists("responsiveLayout", true)) { + + this.table.modules.responsiveLayout.update(); + } + }, + + //resize columns to fit data they contain and stretch row to fill table + + + "fitDataFill": function fitDataFill(columns) { + + columns.forEach(function (column) { + + column.reinitializeWidth(); + }); + + if (this.table.options.responsiveLayout && this.table.modExists("responsiveLayout", true)) { + + this.table.modules.responsiveLayout.update(); + } + }, + + //resize columns to fit data they contain + + + "fitDataTable": function fitDataTable(columns) { + + columns.forEach(function (column) { + + column.reinitializeWidth(); + }); + + if (this.table.options.responsiveLayout && this.table.modExists("responsiveLayout", true)) { + + this.table.modules.responsiveLayout.update(); + } + }, + + //resize columns to fit data the contain and stretch last column to fill table + + + "fitDataStretch": function fitDataStretch(columns) { + var _this41 = this; + + var colsWidth = 0, + tableWidth = this.table.rowManager.element.clientWidth, + gap = 0, + lastCol = false; + + columns.forEach(function (column, i) { + + if (!column.widthFixed) { + + column.reinitializeWidth(); + } + + if (_this41.table.options.responsiveLayout ? column.modules.responsive.visible : column.visible) { + + lastCol = column; + } + + if (column.visible) { + + colsWidth += column.getWidth(); + } + }); + + if (lastCol) { + + gap = tableWidth - colsWidth + lastCol.getWidth(); + + if (this.table.options.responsiveLayout && this.table.modExists("responsiveLayout", true)) { + + lastCol.setWidth(0); + + this.table.modules.responsiveLayout.update(); + } + + if (gap > 0) { + + lastCol.setWidth(gap); + } else { + + lastCol.reinitializeWidth(); + } + } else { + + if (this.table.options.responsiveLayout && this.table.modExists("responsiveLayout", true)) { + + this.table.modules.responsiveLayout.update(); + } + } + }, + + //resize columns to fit + + + "fitColumns": function fitColumns(columns) { + + var self = this; + + var totalWidth = self.table.element.clientWidth; //table element width + + + var fixedWidth = 0; //total width of columns with a defined width + + + var flexWidth = 0; //total width available to flexible columns + + + var flexGrowUnits = 0; //total number of widthGrow blocks accross all columns + + + var flexColWidth = 0; //desired width of flexible columns + + + var flexColumns = []; //array of flexible width columns + + + var fixedShrinkColumns = []; //array of fixed width columns that can shrink + + + var flexShrinkUnits = 0; //total number of widthShrink blocks accross all columns + + + var overflowWidth = 0; //horizontal overflow width + + + var gapFill = 0; //number of pixels to be added to final column to close and half pixel gaps + + + function calcWidth(width) { + + var colWidth; + + if (typeof width == "string") { + + if (width.indexOf("%") > -1) { + + colWidth = totalWidth / 100 * parseInt(width); + } else { + + colWidth = parseInt(width); + } + } else { + + colWidth = width; + } + + return colWidth; + } + + //ensure columns resize to take up the correct amount of space + + + function scaleColumns(columns, freeSpace, colWidth, shrinkCols) { + + var oversizeCols = [], + oversizeSpace = 0, + remainingSpace = 0, + nextColWidth = 0, + gap = 0, + changeUnits = 0, + undersizeCols = []; + + function calcGrow(col) { + + return colWidth * (col.column.definition.widthGrow || 1); + } + + function calcShrink(col) { + + return calcWidth(col.width) - colWidth * (col.column.definition.widthShrink || 0); + } + + columns.forEach(function (col, i) { + + var width = shrinkCols ? calcShrink(col) : calcGrow(col); + + if (col.column.minWidth >= width) { + + oversizeCols.push(col); + } else { + + undersizeCols.push(col); + + changeUnits += shrinkCols ? col.column.definition.widthShrink || 1 : col.column.definition.widthGrow || 1; + } + }); + + if (oversizeCols.length) { + + oversizeCols.forEach(function (col) { + + oversizeSpace += shrinkCols ? col.width - col.column.minWidth : col.column.minWidth; + + col.width = col.column.minWidth; + }); + + remainingSpace = freeSpace - oversizeSpace; + + nextColWidth = changeUnits ? Math.floor(remainingSpace / changeUnits) : remainingSpace; + + gap = remainingSpace - nextColWidth * changeUnits; + + gap += scaleColumns(undersizeCols, remainingSpace, nextColWidth, shrinkCols); + } else { + + gap = changeUnits ? freeSpace - Math.floor(freeSpace / changeUnits) * changeUnits : freeSpace; + + undersizeCols.forEach(function (column) { + + column.width = shrinkCols ? calcShrink(column) : calcGrow(column); + }); + } + + return gap; + } + + if (this.table.options.responsiveLayout && this.table.modExists("responsiveLayout", true)) { + + this.table.modules.responsiveLayout.update(); + } + + //adjust for vertical scrollbar if present + + + if (this.table.rowManager.element.scrollHeight > this.table.rowManager.element.clientHeight) { + + totalWidth -= this.table.rowManager.element.offsetWidth - this.table.rowManager.element.clientWidth; + } + + columns.forEach(function (column) { + + var width, minWidth, colWidth; + + if (column.visible) { + + width = column.definition.width; + + minWidth = parseInt(column.minWidth); + + if (width) { + + colWidth = calcWidth(width); + + fixedWidth += colWidth > minWidth ? colWidth : minWidth; + + if (column.definition.widthShrink) { + + fixedShrinkColumns.push({ + + column: column, + + width: colWidth > minWidth ? colWidth : minWidth + + }); + + flexShrinkUnits += column.definition.widthShrink; + } + } else { + + flexColumns.push({ + + column: column, + + width: 0 + + }); + + flexGrowUnits += column.definition.widthGrow || 1; + } + } + }); + + //calculate available space + + + flexWidth = totalWidth - fixedWidth; + + //calculate correct column size + + + flexColWidth = Math.floor(flexWidth / flexGrowUnits); + + //generate column widths + + + var gapFill = scaleColumns(flexColumns, flexWidth, flexColWidth, false); + + //increase width of last column to account for rounding errors + + + if (flexColumns.length && gapFill > 0) { + + flexColumns[flexColumns.length - 1].width += +gapFill; + } + + //caculate space for columns to be shrunk into + + + flexColumns.forEach(function (col) { + + flexWidth -= col.width; + }); + + overflowWidth = Math.abs(gapFill) + flexWidth; + + //shrink oversize columns if there is no available space + + + if (overflowWidth > 0 && flexShrinkUnits) { + + gapFill = scaleColumns(fixedShrinkColumns, overflowWidth, Math.floor(overflowWidth / flexShrinkUnits), true); + } + + //decrease width of last column to account for rounding errors + + + if (fixedShrinkColumns.length) { + + fixedShrinkColumns[fixedShrinkColumns.length - 1].width -= gapFill; + } + + flexColumns.forEach(function (col) { + + col.column.setWidth(col.width); + }); + + fixedShrinkColumns.forEach(function (col) { + + col.column.setWidth(col.width); + }); + } + + }; + + Tabulator.prototype.registerModule("layout", Layout); + + var Localize = function Localize(table) { + + this.table = table; //hold Tabulator object + + this.locale = "default"; //current locale + + this.lang = false; //current language + + this.bindings = {}; //update events to call when locale is changed + + this.langList = {}; + }; + + Localize.prototype.initialize = function () { + + this.langList = Tabulator.prototype.helpers.deepClone(this.langs); + }; + + //set header placehoder + + Localize.prototype.setHeaderFilterPlaceholder = function (placeholder) { + + this.langList.default.headerFilters.default = placeholder; + }; + + //set header filter placeholder by column + + Localize.prototype.setHeaderFilterColumnPlaceholder = function (column, placeholder) { + + this.langList.default.headerFilters.columns[column] = placeholder; + + if (this.lang && !this.lang.headerFilters.columns[column]) { + + this.lang.headerFilters.columns[column] = placeholder; + } + }; + + //setup a lang description object + + Localize.prototype.installLang = function (locale, lang) { + + if (this.langList[locale]) { + + this._setLangProp(this.langList[locale], lang); + } else { + + this.langList[locale] = lang; + } + }; + + Localize.prototype._setLangProp = function (lang, values) { + + for (var key in values) { + + if (lang[key] && _typeof(lang[key]) == "object") { + + this._setLangProp(lang[key], values[key]); + } else { + + lang[key] = values[key]; + } + } + }; + + //set current locale + + Localize.prototype.setLocale = function (desiredLocale) { + + var self = this; + + desiredLocale = desiredLocale || "default"; + + //fill in any matching languge values + + function traverseLang(trans, path) { + + for (var prop in trans) { + + if (_typeof(trans[prop]) == "object") { + + if (!path[prop]) { + + path[prop] = {}; + } + + traverseLang(trans[prop], path[prop]); + } else { + + path[prop] = trans[prop]; + } + } + } + + //determing correct locale to load + + if (desiredLocale === true && navigator.language) { + + //get local from system + + desiredLocale = navigator.language.toLowerCase(); + } + + if (desiredLocale) { + + //if locale is not set, check for matching top level locale else use default + + if (!self.langList[desiredLocale]) { + + var prefix = desiredLocale.split("-")[0]; + + if (self.langList[prefix]) { + + console.warn("Localization Error - Exact matching locale not found, using closest match: ", desiredLocale, prefix); + + desiredLocale = prefix; + } else { + + console.warn("Localization Error - Matching locale not found, using default: ", desiredLocale); + + desiredLocale = "default"; + } + } + } + + self.locale = desiredLocale; + + //load default lang template + + self.lang = Tabulator.prototype.helpers.deepClone(self.langList.default || {}); + + if (desiredLocale != "default") { + + traverseLang(self.langList[desiredLocale], self.lang); + } + + self.table.options.localized.call(self.table, self.locale, self.lang); + + self._executeBindings(); + }; + + //get current locale + + Localize.prototype.getLocale = function (locale) { + + return self.locale; + }; + + //get lang object for given local or current if none provided + + Localize.prototype.getLang = function (locale) { + + return locale ? this.langList[locale] : this.lang; + }; + + //get text for current locale + + Localize.prototype.getText = function (path, value) { + + var path = value ? path + "|" + value : path, + pathArray = path.split("|"), + text = this._getLangElement(pathArray, this.locale); + + // if(text === false){ + + // console.warn("Localization Error - Matching localized text not found for given path: ", path); + + // } + + + return text || ""; + }; + + //traverse langs object and find localized copy + + Localize.prototype._getLangElement = function (path, locale) { + + var self = this; + + var root = self.lang; + + path.forEach(function (level) { + + var rootPath; + + if (root) { + + rootPath = root[level]; + + if (typeof rootPath != "undefined") { + + root = rootPath; + } else { + + root = false; + } + } + }); + + return root; + }; + + //set update binding + + Localize.prototype.bind = function (path, callback) { + + if (!this.bindings[path]) { + + this.bindings[path] = []; + } + + this.bindings[path].push(callback); + + callback(this.getText(path), this.lang); + }; + + //itterate through bindings and trigger updates + + Localize.prototype._executeBindings = function () { + + var self = this; + + var _loop = function _loop(path) { + + self.bindings[path].forEach(function (binding) { + + binding(self.getText(path), self.lang); + }); + }; + + for (var path in self.bindings) { + _loop(path); + } + }; + + //Localized text listings + + Localize.prototype.langs = { + + "default": { //hold default locale text + + "groups": { + + "item": "item", + + "items": "items" + + }, + + "columns": {}, + + "ajax": { + + "loading": "Loading", + + "error": "Error" + + }, + + "pagination": { + + "page_size": "Page Size", + + "page_title": "Show Page", + + "first": "First", + + "first_title": "First Page", + + "last": "Last", + + "last_title": "Last Page", + + "prev": "Prev", + + "prev_title": "Prev Page", + + "next": "Next", + + "next_title": "Next Page", + + "all": "All" + + }, + + "headerFilters": { + + "default": "filter column...", + + "columns": {} + + } + + } + + }; + + Tabulator.prototype.registerModule("localize", Localize); + + var Comms = function Comms(table) { + + this.table = table; + }; + + Comms.prototype.getConnections = function (selectors) { + + var self = this, + connections = [], + connection; + + connection = Tabulator.prototype.comms.lookupTable(selectors); + + connection.forEach(function (con) { + + if (self.table !== con) { + + connections.push(con); + } + }); + + return connections; + }; + + Comms.prototype.send = function (selectors, module, action, data) { + + var self = this, + connections = this.getConnections(selectors); + + connections.forEach(function (connection) { + + connection.tableComms(self.table.element, module, action, data); + }); + + if (!connections.length && selectors) { + + console.warn("Table Connection Error - No tables matching selector found", selectors); + } + }; + + Comms.prototype.receive = function (table, module, action, data) { + + if (this.table.modExists(module)) { + + return this.table.modules[module].commsReceived(table, action, data); + } else { + + console.warn("Inter-table Comms Error - no such module:", module); + } + }; + + Tabulator.prototype.registerModule("comms", Comms); + + var Accessor = function Accessor(table) { + this.table = table; //hold Tabulator object + this.allowedTypes = ["", "data", "download", "clipboard", "print", "htmlOutput"]; //list of accessor types + }; + + //initialize column accessor + Accessor.prototype.initializeColumn = function (column) { + var self = this, + match = false, + config = {}; + + this.allowedTypes.forEach(function (type) { + var key = "accessor" + (type.charAt(0).toUpperCase() + type.slice(1)), + accessor; + + if (column.definition[key]) { + accessor = self.lookupAccessor(column.definition[key]); + + if (accessor) { + match = true; + + config[key] = { + accessor: accessor, + params: column.definition[key + "Params"] || {} + }; + } + } + }); + + if (match) { + column.modules.accessor = config; + } + }; + + Accessor.prototype.lookupAccessor = function (value) { + var accessor = false; + + //set column accessor + switch (typeof value === 'undefined' ? 'undefined' : _typeof(value)) { + case "string": + if (this.accessors[value]) { + accessor = this.accessors[value]; + } else { + console.warn("Accessor Error - No such accessor found, ignoring: ", value); + } + break; + + case "function": + accessor = value; + break; + } + + return accessor; + }; + + //apply accessor to row + Accessor.prototype.transformRow = function (row, type) { + var key = "accessor" + (type.charAt(0).toUpperCase() + type.slice(1)), + rowComponent = row.getComponent(); + + //clone data object with deep copy to isolate internal data from returned result + var data = Tabulator.prototype.helpers.deepClone(row.data || {}); + + this.table.columnManager.traverse(function (column) { + var value, accessor, params, colCompnent; + + if (column.modules.accessor) { + + accessor = column.modules.accessor[key] || column.modules.accessor.accessor || false; + + if (accessor) { + value = column.getFieldValue(data); + + if (value != "undefined") { + colCompnent = column.getComponent(); + params = typeof accessor.params === "function" ? accessor.params(value, data, type, colCompnent, rowComponent) : accessor.params; + column.setFieldValue(data, accessor.accessor(value, data, type, params, colCompnent, rowComponent)); + } + } + } + }); + + return data; + }, + + //default accessors + Accessor.prototype.accessors = {}; + + Tabulator.prototype.registerModule("accessor", Accessor); + var Ajax = function Ajax(table) { + + this.table = table; //hold Tabulator object + this.config = false; //hold config object for ajax request + this.url = ""; //request URL + this.urlGenerator = false; + this.params = false; //request parameters + + this.loaderElement = this.createLoaderElement(); //loader message div + this.msgElement = this.createMsgElement(); //message element + this.loadingElement = false; + this.errorElement = false; + this.loaderPromise = false; + + this.progressiveLoad = false; + this.loading = false; + + this.requestOrder = 0; //prevent requests comming out of sequence if overridden by another load request + }; + + //initialize setup options + Ajax.prototype.initialize = function () { + var template; + + this.loaderElement.appendChild(this.msgElement); + + if (this.table.options.ajaxLoaderLoading) { + if (typeof this.table.options.ajaxLoaderLoading == "string") { + template = document.createElement('template'); + template.innerHTML = this.table.options.ajaxLoaderLoading.trim(); + this.loadingElement = template.content.firstChild; + } else { + this.loadingElement = this.table.options.ajaxLoaderLoading; + } + } + + this.loaderPromise = this.table.options.ajaxRequestFunc || this.defaultLoaderPromise; + + this.urlGenerator = this.table.options.ajaxURLGenerator || this.defaultURLGenerator; + + if (this.table.options.ajaxLoaderError) { + if (typeof this.table.options.ajaxLoaderError == "string") { + template = document.createElement('template'); + template.innerHTML = this.table.options.ajaxLoaderError.trim(); + this.errorElement = template.content.firstChild; + } else { + this.errorElement = this.table.options.ajaxLoaderError; + } + } + + if (this.table.options.ajaxParams) { + this.setParams(this.table.options.ajaxParams); + } + + if (this.table.options.ajaxConfig) { + this.setConfig(this.table.options.ajaxConfig); + } + + if (this.table.options.ajaxURL) { + this.setUrl(this.table.options.ajaxURL); + } + + if (this.table.options.ajaxProgressiveLoad) { + if (this.table.options.pagination) { + this.progressiveLoad = false; + console.error("Progressive Load Error - Pagination and progressive load cannot be used at the same time"); + } else { + if (this.table.modExists("page")) { + this.progressiveLoad = this.table.options.ajaxProgressiveLoad; + this.table.modules.page.initializeProgressive(this.progressiveLoad); + } else { + console.error("Pagination plugin is required for progressive ajax loading"); + } + } + } + }; + + Ajax.prototype.createLoaderElement = function () { + var el = document.createElement("div"); + el.classList.add("tabulator-loader"); + return el; + }; + + Ajax.prototype.createMsgElement = function () { + var el = document.createElement("div"); + + el.classList.add("tabulator-loader-msg"); + el.setAttribute("role", "alert"); + + return el; + }; + + //set ajax params + Ajax.prototype.setParams = function (params, update) { + if (update) { + this.params = this.params || {}; + + for (var key in params) { + this.params[key] = params[key]; + } + } else { + this.params = params; + } + }; + + Ajax.prototype.getParams = function () { + return this.params || {}; + }; + + //load config object + Ajax.prototype.setConfig = function (config) { + this._loadDefaultConfig(); + + if (typeof config == "string") { + this.config.method = config; + } else { + for (var key in config) { + this.config[key] = config[key]; + } + } + }; + + //create config object from default + Ajax.prototype._loadDefaultConfig = function (force) { + var self = this; + if (!self.config || force) { + + self.config = {}; + + //load base config from defaults + for (var key in self.defaultConfig) { + self.config[key] = self.defaultConfig[key]; + } + } + }; + + //set request url + Ajax.prototype.setUrl = function (url) { + this.url = url; + }; + + //get request url + Ajax.prototype.getUrl = function () { + return this.url; + }; + + //lstandard loading function + Ajax.prototype.loadData = function (inPosition, columnsChanged) { + var self = this; + + if (this.progressiveLoad) { + return this._loadDataProgressive(); + } else { + return this._loadDataStandard(inPosition, columnsChanged); + } + }; + + Ajax.prototype.nextPage = function (diff) { + var margin; + + if (!this.loading) { + + margin = this.table.options.ajaxProgressiveLoadScrollMargin || this.table.rowManager.getElement().clientHeight * 2; + + if (diff < margin) { + this.table.modules.page.nextPage().then(function () {}).catch(function () {}); + } + } + }; + + Ajax.prototype.blockActiveRequest = function () { + this.requestOrder++; + }; + + Ajax.prototype._loadDataProgressive = function () { + this.table.rowManager.setData([]); + return this.table.modules.page.setPage(1); + }; + + Ajax.prototype._loadDataStandard = function (inPosition, columnsChanged) { + var _this42 = this; + + return new Promise(function (resolve, reject) { + _this42.sendRequest(inPosition).then(function (data) { + _this42.table.rowManager.setData(data, inPosition, columnsChanged).then(function () { + resolve(); + }).catch(function (e) { + reject(e); + }); + }).catch(function (e) { + reject(e); + }); + }); + }; + + Ajax.prototype.generateParamsList = function (data, prefix) { + var self = this, + output = []; + + prefix = prefix || ""; + + if (Array.isArray(data)) { + data.forEach(function (item, i) { + output = output.concat(self.generateParamsList(item, prefix ? prefix + "[" + i + "]" : i)); + }); + } else if ((typeof data === 'undefined' ? 'undefined' : _typeof(data)) === "object") { + for (var key in data) { + output = output.concat(self.generateParamsList(data[key], prefix ? prefix + "[" + key + "]" : key)); + } + } else { + output.push({ key: prefix, value: data }); + } + + return output; + }; + + Ajax.prototype.serializeParams = function (params) { + var output = this.generateParamsList(params), + encoded = []; + + output.forEach(function (item) { + encoded.push(encodeURIComponent(item.key) + "=" + encodeURIComponent(item.value)); + }); + + return encoded.join("&"); + }; + + //send ajax request + Ajax.prototype.sendRequest = function (silent) { + var _this43 = this; + + var self = this, + url = self.url, + requestNo, + esc, + query; + + self.requestOrder++; + requestNo = self.requestOrder; + + self._loadDefaultConfig(); + + return new Promise(function (resolve, reject) { + if (self.table.options.ajaxRequesting.call(_this43.table, self.url, self.params) !== false) { + + self.loading = true; + + if (!silent) { + self.showLoader(); + } + + _this43.loaderPromise(url, self.config, self.params).then(function (data) { + if (requestNo === self.requestOrder) { + if (self.table.options.ajaxResponse) { + data = self.table.options.ajaxResponse.call(self.table, self.url, self.params, data); + } + resolve(data); + + self.hideLoader(); + self.loading = false; + } else { + console.warn("Ajax Response Blocked - An active ajax request was blocked by an attempt to change table data while the request was being made"); + } + }).catch(function (error) { + console.error("Ajax Load Error: ", error); + self.table.options.ajaxError.call(self.table, error); + + self.showError(); + + setTimeout(function () { + self.hideLoader(); + }, 3000); + + self.loading = false; + + reject(); + }); + } else { + reject(); + } + }); + }; + + Ajax.prototype.showLoader = function () { + var shouldLoad = typeof this.table.options.ajaxLoader === "function" ? this.table.options.ajaxLoader() : this.table.options.ajaxLoader; + + if (shouldLoad) { + + this.hideLoader(); + + while (this.msgElement.firstChild) { + this.msgElement.removeChild(this.msgElement.firstChild); + }this.msgElement.classList.remove("tabulator-error"); + this.msgElement.classList.add("tabulator-loading"); + + if (this.loadingElement) { + this.msgElement.appendChild(this.loadingElement); + } else { + this.msgElement.innerHTML = this.table.modules.localize.getText("ajax|loading"); + } + + this.table.element.appendChild(this.loaderElement); + } + }; + + Ajax.prototype.showError = function () { + this.hideLoader(); + + while (this.msgElement.firstChild) { + this.msgElement.removeChild(this.msgElement.firstChild); + }this.msgElement.classList.remove("tabulator-loading"); + this.msgElement.classList.add("tabulator-error"); + + if (this.errorElement) { + this.msgElement.appendChild(this.errorElement); + } else { + this.msgElement.innerHTML = this.table.modules.localize.getText("ajax|error"); + } + + this.table.element.appendChild(this.loaderElement); + }; + + Ajax.prototype.hideLoader = function () { + if (this.loaderElement.parentNode) { + this.loaderElement.parentNode.removeChild(this.loaderElement); + } + }; + + //default ajax config object + Ajax.prototype.defaultConfig = { + method: "GET" + }; + + Ajax.prototype.defaultURLGenerator = function (url, config, params) { + + if (url) { + if (params && Object.keys(params).length) { + if (!config.method || config.method.toLowerCase() == "get") { + config.method = "get"; + + url += (url.includes("?") ? "&" : "?") + this.serializeParams(params); + } + } + } + + return url; + }; + + Ajax.prototype.defaultLoaderPromise = function (url, config, params) { + var self = this, + contentType; + + return new Promise(function (resolve, reject) { + + //set url + url = self.urlGenerator(url, config, params); + + //set body content if not GET request + if (config.method.toUpperCase() != "GET") { + contentType = _typeof(self.table.options.ajaxContentType) === "object" ? self.table.options.ajaxContentType : self.contentTypeFormatters[self.table.options.ajaxContentType]; + if (contentType) { + + for (var key in contentType.headers) { + if (!config.headers) { + config.headers = {}; + } + + if (typeof config.headers[key] === "undefined") { + config.headers[key] = contentType.headers[key]; + } + } + + config.body = contentType.body.call(self, url, config, params); + } else { + console.warn("Ajax Error - Invalid ajaxContentType value:", self.table.options.ajaxContentType); + } + } + + if (url) { + + //configure headers + if (typeof config.headers === "undefined") { + config.headers = {}; + } + + if (typeof config.headers.Accept === "undefined") { + config.headers.Accept = "application/json"; + } + + if (typeof config.headers["X-Requested-With"] === "undefined") { + config.headers["X-Requested-With"] = "XMLHttpRequest"; + } + + if (typeof config.mode === "undefined") { + config.mode = "cors"; + } + + if (config.mode == "cors") { + + if (typeof config.headers["Access-Control-Allow-Origin"] === "undefined") { + config.headers["Access-Control-Allow-Origin"] = window.location.origin; + } + + if (typeof config.credentials === "undefined") { + config.credentials = 'same-origin'; + } + } else { + if (typeof config.credentials === "undefined") { + config.credentials = 'include'; + } + } + + //send request + fetch(url, config).then(function (response) { + if (response.ok) { + response.json().then(function (data) { + resolve(data); + }).catch(function (error) { + reject(error); + console.warn("Ajax Load Error - Invalid JSON returned", error); + }); + } else { + console.error("Ajax Load Error - Connection Error: " + response.status, response.statusText); + reject(response); + } + }).catch(function (error) { + console.error("Ajax Load Error - Connection Error: ", error); + reject(error); + }); + } else { + console.warn("Ajax Load Error - No URL Set"); + resolve([]); + } + }); + }; + + Ajax.prototype.contentTypeFormatters = { + "json": { + headers: { + 'Content-Type': 'application/json' + }, + body: function body(url, config, params) { + return JSON.stringify(params); + } + }, + "form": { + headers: {}, + body: function body(url, config, params) { + var output = this.generateParamsList(params), + form = new FormData(); + + output.forEach(function (item) { + form.append(item.key, item.value); + }); + + return form; + } + } + }; + + Tabulator.prototype.registerModule("ajax", Ajax); + + //public calc object + var CalcComponent = function CalcComponent(row) { + this._row = row; + }; + + CalcComponent.prototype.getData = function (transform) { + return this._row.getData(transform); + }; + + CalcComponent.prototype.getElement = function () { + return this._row.getElement(); + }; + + CalcComponent.prototype.getTable = function () { + return this._row.table; + }; + + CalcComponent.prototype.getCells = function () { + var cells = []; + + this._row.getCells().forEach(function (cell) { + cells.push(cell.getComponent()); + }); + + return cells; + }; + + CalcComponent.prototype.getCell = function (column) { + var cell = this._row.getCell(column); + return cell ? cell.getComponent() : false; + }; + + CalcComponent.prototype._getSelf = function () { + return this._row; + }; + + var ColumnCalcs = function ColumnCalcs(table) { + this.table = table; //hold Tabulator object + this.topCalcs = []; + this.botCalcs = []; + this.genColumn = false; + this.topElement = this.createElement(); + this.botElement = this.createElement(); + this.topRow = false; + this.botRow = false; + this.topInitialized = false; + this.botInitialized = false; + + this.initialize(); + }; + + ColumnCalcs.prototype.createElement = function () { + var el = document.createElement("div"); + el.classList.add("tabulator-calcs-holder"); + return el; + }; + + ColumnCalcs.prototype.initialize = function () { + this.genColumn = new Column({ field: "value" }, this); + }; + + //dummy functions to handle being mock column manager + ColumnCalcs.prototype.registerColumnField = function () {}; + + //initialize column calcs + ColumnCalcs.prototype.initializeColumn = function (column) { + var def = column.definition; + + var config = { + topCalcParams: def.topCalcParams || {}, + botCalcParams: def.bottomCalcParams || {} + }; + + if (def.topCalc) { + + switch (_typeof(def.topCalc)) { + case "string": + if (this.calculations[def.topCalc]) { + config.topCalc = this.calculations[def.topCalc]; + } else { + console.warn("Column Calc Error - No such calculation found, ignoring: ", def.topCalc); + } + break; + + case "function": + config.topCalc = def.topCalc; + break; + + } + + if (config.topCalc) { + column.modules.columnCalcs = config; + this.topCalcs.push(column); + + if (this.table.options.columnCalcs != "group") { + this.initializeTopRow(); + } + } + } + + if (def.bottomCalc) { + switch (_typeof(def.bottomCalc)) { + case "string": + if (this.calculations[def.bottomCalc]) { + config.botCalc = this.calculations[def.bottomCalc]; + } else { + console.warn("Column Calc Error - No such calculation found, ignoring: ", def.bottomCalc); + } + break; + + case "function": + config.botCalc = def.bottomCalc; + break; + + } + + if (config.botCalc) { + column.modules.columnCalcs = config; + this.botCalcs.push(column); + + if (this.table.options.columnCalcs != "group") { + this.initializeBottomRow(); + } + } + } + }; + + ColumnCalcs.prototype.removeCalcs = function () { + var changed = false; + + if (this.topInitialized) { + this.topInitialized = false; + this.topElement.parentNode.removeChild(this.topElement); + changed = true; + } + + if (this.botInitialized) { + this.botInitialized = false; + this.table.footerManager.remove(this.botElement); + changed = true; + } + + if (changed) { + this.table.rowManager.adjustTableSize(); + } + }; + + ColumnCalcs.prototype.initializeTopRow = function () { + if (!this.topInitialized) { + // this.table.columnManager.headersElement.after(this.topElement); + this.table.columnManager.getElement().insertBefore(this.topElement, this.table.columnManager.headersElement.nextSibling); + this.topInitialized = true; + } + }; + + ColumnCalcs.prototype.initializeBottomRow = function () { + if (!this.botInitialized) { + this.table.footerManager.prepend(this.botElement); + this.botInitialized = true; + } + }; + + ColumnCalcs.prototype.scrollHorizontal = function (left) { + var hozAdjust = 0, + scrollWidth = this.table.columnManager.getElement().scrollWidth - this.table.element.clientWidth; + + if (this.botInitialized && this.botRow) { + this.botRow.getElement().style.marginLeft = -left + "px"; + } + }; + + ColumnCalcs.prototype.recalc = function (rows) { + var data, row; + + if (this.topInitialized || this.botInitialized) { + data = this.rowsToData(rows); + + if (this.topInitialized) { + if (this.topRow) { + this.topRow.deleteCells(); + } + + row = this.generateRow("top", this.rowsToData(rows)); + this.topRow = row; + while (this.topElement.firstChild) { + this.topElement.removeChild(this.topElement.firstChild); + }this.topElement.appendChild(row.getElement()); + row.initialize(true); + } + + if (this.botInitialized) { + if (this.botRow) { + this.botRow.deleteCells(); + } + + row = this.generateRow("bottom", this.rowsToData(rows)); + this.botRow = row; + while (this.botElement.firstChild) { + this.botElement.removeChild(this.botElement.firstChild); + }this.botElement.appendChild(row.getElement()); + row.initialize(true); + } + + this.table.rowManager.adjustTableSize(); + + //set resizable handles + if (this.table.modExists("frozenColumns")) { + this.table.modules.frozenColumns.layout(); + } + } + }; + + ColumnCalcs.prototype.recalcRowGroup = function (row) { + this.recalcGroup(this.table.modules.groupRows.getRowGroup(row)); + }; + + ColumnCalcs.prototype.recalcAll = function () { + var _this44 = this; + + if (this.topCalcs.length || this.botCalcs.length) { + if (this.table.options.columnCalcs !== "group") { + this.recalc(this.table.rowManager.activeRows); + } + + if (this.table.options.groupBy && this.table.options.columnCalcs !== "table") { + + var groups = table.modules.groupRows.getChildGroups(); + + groups.forEach(function (group) { + _this44.recalcGroup(group); + }); + } + } + }; + + ColumnCalcs.prototype.recalcGroup = function (group) { + var data, rowData; + + if (group) { + if (group.calcs) { + if (group.calcs.bottom) { + data = this.rowsToData(group.rows); + rowData = this.generateRowData("bottom", data); + + group.calcs.bottom.updateData(rowData); + group.calcs.bottom.reinitialize(); + } + + if (group.calcs.top) { + data = this.rowsToData(group.rows); + rowData = this.generateRowData("top", data); + + group.calcs.top.updateData(rowData); + group.calcs.top.reinitialize(); + } + } + } + }; + + //generate top stats row + ColumnCalcs.prototype.generateTopRow = function (rows) { + return this.generateRow("top", this.rowsToData(rows)); + }; + //generate bottom stats row + ColumnCalcs.prototype.generateBottomRow = function (rows) { + return this.generateRow("bottom", this.rowsToData(rows)); + }; + + ColumnCalcs.prototype.rowsToData = function (rows) { + var _this45 = this; + + var data = []; + + rows.forEach(function (row) { + data.push(row.getData()); + + if (_this45.table.options.dataTree && _this45.table.options.dataTreeChildColumnCalcs) { + if (row.modules.dataTree.open) { + var children = _this45.rowsToData(_this45.table.modules.dataTree.getFilteredTreeChildren(row)); + data = data.concat(children); + } + } + }); + + return data; + }; + + //generate stats row + ColumnCalcs.prototype.generateRow = function (pos, data) { + var self = this, + rowData = this.generateRowData(pos, data), + row; + + if (self.table.modExists("mutator")) { + self.table.modules.mutator.disable(); + } + + row = new Row(rowData, this, "calc"); + + if (self.table.modExists("mutator")) { + self.table.modules.mutator.enable(); + } + + row.getElement().classList.add("tabulator-calcs", "tabulator-calcs-" + pos); + + row.component = false; + + row.getComponent = function () { + if (!this.component) { + this.component = new CalcComponent(this); + } + + return this.component; + }; + + row.generateCells = function () { + + var cells = []; + + self.table.columnManager.columnsByIndex.forEach(function (column) { + + //set field name of mock column + self.genColumn.setField(column.getField()); + self.genColumn.hozAlign = column.hozAlign; + + if (column.definition[pos + "CalcFormatter"] && self.table.modExists("format")) { + self.genColumn.modules.format = { + formatter: self.table.modules.format.getFormatter(column.definition[pos + "CalcFormatter"]), + params: column.definition[pos + "CalcFormatterParams"] || {} + }; + } else { + self.genColumn.modules.format = { + formatter: self.table.modules.format.getFormatter("plaintext"), + params: {} + }; + } + + //ensure css class defintion is replicated to calculation cell + self.genColumn.definition.cssClass = column.definition.cssClass; + + //generate cell and assign to correct column + var cell = new Cell(self.genColumn, row); + cell.getElement(); + cell.column = column; + cell.setWidth(); + + column.cells.push(cell); + cells.push(cell); + + if (!column.visible) { + cell.hide(); + } + }); + + this.cells = cells; + }; + + return row; + }; + + //generate stats row + ColumnCalcs.prototype.generateRowData = function (pos, data) { + var rowData = {}, + calcs = pos == "top" ? this.topCalcs : this.botCalcs, + type = pos == "top" ? "topCalc" : "botCalc", + params, + paramKey; + + calcs.forEach(function (column) { + var values = []; + + if (column.modules.columnCalcs && column.modules.columnCalcs[type]) { + data.forEach(function (item) { + values.push(column.getFieldValue(item)); + }); + + paramKey = type + "Params"; + params = typeof column.modules.columnCalcs[paramKey] === "function" ? column.modules.columnCalcs[paramKey](values, data) : column.modules.columnCalcs[paramKey]; + + column.setFieldValue(rowData, column.modules.columnCalcs[type](values, data, params)); + } + }); + + return rowData; + }; + + ColumnCalcs.prototype.hasTopCalcs = function () { + return !!this.topCalcs.length; + }; + + ColumnCalcs.prototype.hasBottomCalcs = function () { + return !!this.botCalcs.length; + }; + + //handle table redraw + ColumnCalcs.prototype.redraw = function () { + if (this.topRow) { + this.topRow.normalizeHeight(true); + } + if (this.botRow) { + this.botRow.normalizeHeight(true); + } + }; + + //return the calculated + ColumnCalcs.prototype.getResults = function () { + var self = this, + results = {}, + groups; + + if (this.table.options.groupBy && this.table.modExists("groupRows")) { + groups = this.table.modules.groupRows.getGroups(true); + + groups.forEach(function (group) { + results[group.getKey()] = self.getGroupResults(group); + }); + } else { + results = { + top: this.topRow ? this.topRow.getData() : {}, + bottom: this.botRow ? this.botRow.getData() : {} + }; + } + + return results; + }; + + //get results from a group + ColumnCalcs.prototype.getGroupResults = function (group) { + var self = this, + groupObj = group._getSelf(), + subGroups = group.getSubGroups(), + subGroupResults = {}, + results = {}; + + subGroups.forEach(function (subgroup) { + subGroupResults[subgroup.getKey()] = self.getGroupResults(subgroup); + }); + + results = { + top: groupObj.calcs.top ? groupObj.calcs.top.getData() : {}, + bottom: groupObj.calcs.bottom ? groupObj.calcs.bottom.getData() : {}, + groups: subGroupResults + }; + + return results; + }; + + //default calculations + ColumnCalcs.prototype.calculations = { + "avg": function avg(values, data, calcParams) { + var output = 0, + precision = typeof calcParams.precision !== "undefined" ? calcParams.precision : 2; + + if (values.length) { + output = values.reduce(function (sum, value) { + return Number(sum) + Number(value); + }); + + output = output / values.length; + + output = precision !== false ? output.toFixed(precision) : output; + } + + return parseFloat(output).toString(); + }, + "max": function max(values, data, calcParams) { + var output = null, + precision = typeof calcParams.precision !== "undefined" ? calcParams.precision : false; + + values.forEach(function (value) { + + value = Number(value); + + if (value > output || output === null) { + output = value; + } + }); + + return output !== null ? precision !== false ? output.toFixed(precision) : output : ""; + }, + "min": function min(values, data, calcParams) { + var output = null, + precision = typeof calcParams.precision !== "undefined" ? calcParams.precision : false; + + values.forEach(function (value) { + + value = Number(value); + + if (value < output || output === null) { + output = value; + } + }); + + return output !== null ? precision !== false ? output.toFixed(precision) : output : ""; + }, + "sum": function sum(values, data, calcParams) { + var output = 0, + precision = typeof calcParams.precision !== "undefined" ? calcParams.precision : false; + + if (values.length) { + values.forEach(function (value) { + value = Number(value); + + output += !isNaN(value) ? Number(value) : 0; + }); + } + + return precision !== false ? output.toFixed(precision) : output; + }, + "concat": function concat(values, data, calcParams) { + var output = 0; + + if (values.length) { + output = values.reduce(function (sum, value) { + return String(sum) + String(value); + }); + } + + return output; + }, + "count": function count(values, data, calcParams) { + var output = 0; + + if (values.length) { + values.forEach(function (value) { + if (value) { + output++; + } + }); + } + + return output; + } + }; + + Tabulator.prototype.registerModule("columnCalcs", ColumnCalcs); + + var Clipboard = function Clipboard(table) { + this.table = table; + this.mode = true; + + this.pasteParser = function () {}; + this.pasteAction = function () {}; + this.customSelection = false; + this.rowRange = false; + this.blocked = true; //block copy actions not originating from this command + }; + + Clipboard.prototype.initialize = function () { + var _this46 = this; + + this.mode = this.table.options.clipboard; + + this.rowRange = this.table.options.clipboardCopyRowRange; + + if (this.mode === true || this.mode === "copy") { + this.table.element.addEventListener("copy", function (e) { + var plain, html, list; + + if (!_this46.blocked) { + e.preventDefault(); + + if (_this46.customSelection) { + plain = _this46.customSelection; + + if (_this46.table.options.clipboardCopyFormatter) { + plain = _this46.table.options.clipboardCopyFormatter("plain", plain); + } + } else { + + var list = _this46.table.modules.export.generateExportList(_this46.table.options.clipboardCopyConfig, _this46.table.options.clipboardCopyStyled, _this46.rowRange, "clipboard"); + + html = _this46.table.modules.export.genereateHTMLTable(list); + plain = html ? _this46.generatePlainContent(list) : ""; + + if (_this46.table.options.clipboardCopyFormatter) { + plain = _this46.table.options.clipboardCopyFormatter("plain", plain); + html = _this46.table.options.clipboardCopyFormatter("html", html); + } + } + + if (window.clipboardData && window.clipboardData.setData) { + window.clipboardData.setData('Text', plain); + } else if (e.clipboardData && e.clipboardData.setData) { + e.clipboardData.setData('text/plain', plain); + if (html) { + e.clipboardData.setData('text/html', html); + } + } else if (e.originalEvent && e.originalEvent.clipboardData.setData) { + e.originalEvent.clipboardData.setData('text/plain', plain); + if (html) { + e.originalEvent.clipboardData.setData('text/html', html); + } + } + + _this46.table.options.clipboardCopied.call(_this46.table, plain, html); + + _this46.reset(); + } + }); + } + + if (this.mode === true || this.mode === "paste") { + this.table.element.addEventListener("paste", function (e) { + _this46.paste(e); + }); + } + + this.setPasteParser(this.table.options.clipboardPasteParser); + this.setPasteAction(this.table.options.clipboardPasteAction); + }; + + Clipboard.prototype.reset = function () { + this.blocked = true; + this.customSelection = false; + }; + + Clipboard.prototype.generatePlainContent = function (list) { + var output = []; + + list.forEach(function (row) { + var rowData = []; + + row.columns.forEach(function (col) { + var value = ""; + + if (col) { + + if (row.type === "group") { + col.value = col.component.getKey(); + } + + if (col.value === null) { + value = ""; + } else { + switch (_typeof(col.value)) { + case "object": + value = JSON.stringify(col.value); + break; + + case "undefined": + value = ""; + break; + + default: + value = col.value; + } + } + } + + rowData.push(value); + }); + + output.push(rowData.join("\t")); + }); + + return output.join("\n"); + }; + + Clipboard.prototype.copy = function (range, internal) { + var range, sel, textRange; + this.blocked = false; + this.customSelection = false; + + if (this.mode === true || this.mode === "copy") { + + this.rowRange = range || this.table.options.clipboardCopyRowRange; + + if (typeof window.getSelection != "undefined" && typeof document.createRange != "undefined") { + range = document.createRange(); + range.selectNodeContents(this.table.element); + sel = window.getSelection(); + + if (sel.toString() && internal) { + this.customSelection = sel.toString(); + } + + sel.removeAllRanges(); + sel.addRange(range); + } else if (typeof document.selection != "undefined" && typeof document.body.createTextRange != "undefined") { + textRange = document.body.createTextRange(); + textRange.moveToElementText(this.table.element); + textRange.select(); + } + + document.execCommand('copy'); + + if (sel) { + sel.removeAllRanges(); + } + } + }; + + //PASTE EVENT HANDLING + + Clipboard.prototype.setPasteAction = function (action) { + + switch (typeof action === 'undefined' ? 'undefined' : _typeof(action)) { + case "string": + this.pasteAction = this.pasteActions[action]; + + if (!this.pasteAction) { + console.warn("Clipboard Error - No such paste action found:", action); + } + break; + + case "function": + this.pasteAction = action; + break; + } + }; + + Clipboard.prototype.setPasteParser = function (parser) { + switch (typeof parser === 'undefined' ? 'undefined' : _typeof(parser)) { + case "string": + this.pasteParser = this.pasteParsers[parser]; + + if (!this.pasteParser) { + console.warn("Clipboard Error - No such paste parser found:", parser); + } + break; + + case "function": + this.pasteParser = parser; + break; + } + }; + + Clipboard.prototype.paste = function (e) { + var data, rowData, rows; + + if (this.checkPaseOrigin(e)) { + + data = this.getPasteData(e); + + rowData = this.pasteParser.call(this, data); + + if (rowData) { + e.preventDefault(); + + if (this.table.modExists("mutator")) { + rowData = this.mutateData(rowData); + } + + rows = this.pasteAction.call(this, rowData); + this.table.options.clipboardPasted.call(this.table, data, rowData, rows); + } else { + this.table.options.clipboardPasteError.call(this.table, data); + } + } + }; + + Clipboard.prototype.mutateData = function (data) { + var self = this, + output = []; + + if (Array.isArray(data)) { + data.forEach(function (row) { + output.push(self.table.modules.mutator.transformRow(row, "clipboard")); + }); + } else { + output = data; + } + + return output; + }; + + Clipboard.prototype.checkPaseOrigin = function (e) { + var valid = true; + + if (e.target.tagName != "DIV" || this.table.modules.edit.currentCell) { + valid = false; + } + + return valid; + }; + + Clipboard.prototype.getPasteData = function (e) { + var data; + + if (window.clipboardData && window.clipboardData.getData) { + data = window.clipboardData.getData('Text'); + } else if (e.clipboardData && e.clipboardData.getData) { + data = e.clipboardData.getData('text/plain'); + } else if (e.originalEvent && e.originalEvent.clipboardData.getData) { + data = e.originalEvent.clipboardData.getData('text/plain'); + } + + return data; + }; + + Clipboard.prototype.pasteParsers = { + table: function table(clipboard) { + var data = [], + success = false, + headerFindSuccess = true, + columns = this.table.columnManager.columns, + columnMap = [], + rows = []; + + //get data from clipboard into array of columns and rows. + clipboard = clipboard.split("\n"); + + clipboard.forEach(function (row) { + data.push(row.split("\t")); + }); + + if (data.length && !(data.length === 1 && data[0].length < 2)) { + success = true; + + //check if headers are present by title + data[0].forEach(function (value) { + var column = columns.find(function (column) { + return value && column.definition.title && value.trim() && column.definition.title.trim() === value.trim(); + }); + + if (column) { + columnMap.push(column); + } else { + headerFindSuccess = false; + } + }); + + //check if column headers are present by field + if (!headerFindSuccess) { + headerFindSuccess = true; + columnMap = []; + + data[0].forEach(function (value) { + var column = columns.find(function (column) { + return value && column.field && value.trim() && column.field.trim() === value.trim(); + }); + + if (column) { + columnMap.push(column); + } else { + headerFindSuccess = false; + } + }); + + if (!headerFindSuccess) { + columnMap = this.table.columnManager.columnsByIndex; + } + } + + //remove header row if found + if (headerFindSuccess) { + data.shift(); + } + + data.forEach(function (item) { + var row = {}; + + item.forEach(function (value, i) { + if (columnMap[i]) { + row[columnMap[i].field] = value; + } + }); + + rows.push(row); + }); + + return rows; + } else { + return false; + } + } + }; + + Clipboard.prototype.pasteActions = { + replace: function replace(rows) { + return this.table.setData(rows); + }, + update: function update(rows) { + return this.table.updateOrAddData(rows); + }, + insert: function insert(rows) { + return this.table.addData(rows); + } + }; + + Tabulator.prototype.registerModule("clipboard", Clipboard); + + var DataTree = function DataTree(table) { + this.table = table; + this.indent = 10; + this.field = ""; + this.collapseEl = null; + this.expandEl = null; + this.branchEl = null; + this.elementField = false; + + this.startOpen = function () {}; + + this.displayIndex = 0; + }; + + DataTree.prototype.initialize = function () { + var dummyEl = null, + firstCol = this.table.columnManager.getFirstVisibileColumn(), + options = this.table.options; + + this.field = options.dataTreeChildField; + this.indent = options.dataTreeChildIndent; + this.elementField = options.dataTreeElementColumn || (firstCol ? firstCol.field : false); + + if (options.dataTreeBranchElement) { + + if (options.dataTreeBranchElement === true) { + this.branchEl = document.createElement("div"); + this.branchEl.classList.add("tabulator-data-tree-branch"); + } else { + if (typeof options.dataTreeBranchElement === "string") { + dummyEl = document.createElement("div"); + dummyEl.innerHTML = options.dataTreeBranchElement; + this.branchEl = dummyEl.firstChild; + } else { + this.branchEl = options.dataTreeBranchElement; + } + } + } + + if (options.dataTreeCollapseElement) { + if (typeof options.dataTreeCollapseElement === "string") { + dummyEl = document.createElement("div"); + dummyEl.innerHTML = options.dataTreeCollapseElement; + this.collapseEl = dummyEl.firstChild; + } else { + this.collapseEl = options.dataTreeCollapseElement; + } + } else { + this.collapseEl = document.createElement("div"); + this.collapseEl.classList.add("tabulator-data-tree-control"); + this.collapseEl.tabIndex = 0; + this.collapseEl.innerHTML = "
"; + } + + if (options.dataTreeExpandElement) { + if (typeof options.dataTreeExpandElement === "string") { + dummyEl = document.createElement("div"); + dummyEl.innerHTML = options.dataTreeExpandElement; + this.expandEl = dummyEl.firstChild; + } else { + this.expandEl = options.dataTreeExpandElement; + } + } else { + this.expandEl = document.createElement("div"); + this.expandEl.classList.add("tabulator-data-tree-control"); + this.expandEl.tabIndex = 0; + this.expandEl.innerHTML = "
"; + } + + switch (_typeof(options.dataTreeStartExpanded)) { + case "boolean": + this.startOpen = function (row, index) { + return options.dataTreeStartExpanded; + }; + break; + + case "function": + this.startOpen = options.dataTreeStartExpanded; + break; + + default: + this.startOpen = function (row, index) { + return options.dataTreeStartExpanded[index]; + }; + break; + } + }; + + DataTree.prototype.initializeRow = function (row) { + var childArray = row.getData()[this.field]; + var isArray = Array.isArray(childArray); + + var children = isArray || !isArray && (typeof childArray === 'undefined' ? 'undefined' : _typeof(childArray)) === "object" && childArray !== null; + + if (!children && row.modules.dataTree && row.modules.dataTree.branchEl) { + row.modules.dataTree.branchEl.parentNode.removeChild(row.modules.dataTree.branchEl); + } + + if (!children && row.modules.dataTree && row.modules.dataTree.controlEl) { + row.modules.dataTree.controlEl.parentNode.removeChild(row.modules.dataTree.controlEl); + } + + row.modules.dataTree = { + index: row.modules.dataTree ? row.modules.dataTree.index : 0, + open: children ? row.modules.dataTree ? row.modules.dataTree.open : this.startOpen(row.getComponent(), 0) : false, + controlEl: row.modules.dataTree && children ? row.modules.dataTree.controlEl : false, + branchEl: row.modules.dataTree && children ? row.modules.dataTree.branchEl : false, + parent: row.modules.dataTree ? row.modules.dataTree.parent : false, + children: children + }; + }; + + DataTree.prototype.layoutRow = function (row) { + var cell = this.elementField ? row.getCell(this.elementField) : row.getCells()[0], + el = cell.getElement(), + config = row.modules.dataTree; + + if (config.branchEl) { + if (config.branchEl.parentNode) { + config.branchEl.parentNode.removeChild(config.branchEl); + } + config.branchEl = false; + } + + if (config.controlEl) { + if (config.controlEl.parentNode) { + config.controlEl.parentNode.removeChild(config.controlEl); + } + config.controlEl = false; + } + + this.generateControlElement(row, el); + + row.element.classList.add("tabulator-tree-level-" + config.index); + + if (config.index) { + if (this.branchEl) { + config.branchEl = this.branchEl.cloneNode(true); + el.insertBefore(config.branchEl, el.firstChild); + + if (this.table.rtl) { + config.branchEl.style.marginRight = (config.branchEl.offsetWidth + config.branchEl.style.marginLeft) * (config.index - 1) + config.index * this.indent + "px"; + } else { + config.branchEl.style.marginLeft = (config.branchEl.offsetWidth + config.branchEl.style.marginRight) * (config.index - 1) + config.index * this.indent + "px"; + } + } else { + + if (this.table.rtl) { + el.style.paddingRight = parseInt(window.getComputedStyle(el, null).getPropertyValue('padding-right')) + config.index * this.indent + "px"; + } else { + el.style.paddingLeft = parseInt(window.getComputedStyle(el, null).getPropertyValue('padding-left')) + config.index * this.indent + "px"; + } + } + } + }; + + DataTree.prototype.generateControlElement = function (row, el) { + var _this47 = this; + + var config = row.modules.dataTree, + el = el || row.getCells()[0].getElement(), + oldControl = config.controlEl; + + if (config.children !== false) { + + if (config.open) { + config.controlEl = this.collapseEl.cloneNode(true); + config.controlEl.addEventListener("click", function (e) { + e.stopPropagation(); + _this47.collapseRow(row); + }); + } else { + config.controlEl = this.expandEl.cloneNode(true); + config.controlEl.addEventListener("click", function (e) { + e.stopPropagation(); + _this47.expandRow(row); + }); + } + + config.controlEl.addEventListener("mousedown", function (e) { + e.stopPropagation(); + }); + + if (oldControl && oldControl.parentNode === el) { + oldControl.parentNode.replaceChild(config.controlEl, oldControl); + } else { + el.insertBefore(config.controlEl, el.firstChild); + } + } + }; + + DataTree.prototype.setDisplayIndex = function (index) { + this.displayIndex = index; + }; + + DataTree.prototype.getDisplayIndex = function () { + return this.displayIndex; + }; + + DataTree.prototype.getRows = function (rows) { + var _this48 = this; + + var output = []; + + rows.forEach(function (row, i) { + var config, children; + + output.push(row); + + if (row instanceof Row) { + + config = row.modules.dataTree.children; + + if (!config.index && config.children !== false) { + children = _this48.getChildren(row); + + children.forEach(function (child) { + output.push(child); + }); + } + } + }); + + return output; + }; + + DataTree.prototype.getChildren = function (row) { + var _this49 = this; + + var config = row.modules.dataTree, + children = [], + output = []; + + if (config.children !== false && config.open) { + if (!Array.isArray(config.children)) { + config.children = this.generateChildren(row); + } + + if (this.table.modExists("filter") && this.table.options.dataTreeFilter) { + children = this.table.modules.filter.filter(config.children); + } else { + children = config.children; + } + + if (this.table.modExists("sort") && this.table.options.dataTreeSort) { + this.table.modules.sort.sort(children); + } + + children.forEach(function (child) { + output.push(child); + + var subChildren = _this49.getChildren(child); + + subChildren.forEach(function (sub) { + output.push(sub); + }); + }); + } + + return output; + }; + + DataTree.prototype.generateChildren = function (row) { + var _this50 = this; + + var children = []; + + var childArray = row.getData()[this.field]; + + if (!Array.isArray(childArray)) { + childArray = [childArray]; + } + + childArray.forEach(function (childData) { + var childRow = new Row(childData || {}, _this50.table.rowManager); + childRow.modules.dataTree.index = row.modules.dataTree.index + 1; + childRow.modules.dataTree.parent = row; + if (childRow.modules.dataTree.children) { + childRow.modules.dataTree.open = _this50.startOpen(childRow.getComponent(), childRow.modules.dataTree.index); + } + children.push(childRow); + }); + + return children; + }; + + DataTree.prototype.expandRow = function (row, silent) { + var config = row.modules.dataTree; + + if (config.children !== false) { + config.open = true; + + row.reinitialize(); + + this.table.rowManager.refreshActiveData("tree", false, true); + + this.table.options.dataTreeRowExpanded(row.getComponent(), row.modules.dataTree.index); + } + }; + + DataTree.prototype.collapseRow = function (row) { + var config = row.modules.dataTree; + + if (config.children !== false) { + config.open = false; + + row.reinitialize(); + + this.table.rowManager.refreshActiveData("tree", false, true); + + this.table.options.dataTreeRowCollapsed(row.getComponent(), row.modules.dataTree.index); + } + }; + + DataTree.prototype.toggleRow = function (row) { + var config = row.modules.dataTree; + + if (config.children !== false) { + if (config.open) { + this.collapseRow(row); + } else { + this.expandRow(row); + } + } + }; + + DataTree.prototype.getTreeParent = function (row) { + return row.modules.dataTree.parent ? row.modules.dataTree.parent.getComponent() : false; + }; + + DataTree.prototype.getFilteredTreeChildren = function (row) { + var config = row.modules.dataTree, + output = [], + children; + + if (config.children) { + + if (!Array.isArray(config.children)) { + config.children = this.generateChildren(row); + } + + if (this.table.modExists("filter") && this.table.options.dataTreeFilter) { + children = this.table.modules.filter.filter(config.children); + } else { + children = config.children; + } + + children.forEach(function (childRow) { + if (childRow instanceof Row) { + output.push(childRow); + } + }); + } + + return output; + }; + + DataTree.prototype.rowDelete = function (row) { + var parent = row.modules.dataTree.parent, + childIndex; + + if (parent) { + childIndex = this.findChildIndex(row, parent); + + if (childIndex !== false) { + parent.data[this.field].splice(childIndex, 1); + } + + if (!parent.data[this.field].length) { + delete parent.data[this.field]; + } + + this.initializeRow(parent); + this.layoutRow(parent); + } + + this.table.rowManager.refreshActiveData("tree", false, true); + }; + + DataTree.prototype.addTreeChildRow = function (row, data, top, index) { + var childIndex = false; + + if (typeof data === "string") { + data = JSON.parse(data); + } + + if (!Array.isArray(row.data[this.field])) { + row.data[this.field] = []; + + row.modules.dataTree.open = this.startOpen(row.getComponent(), row.modules.dataTree.index); + } + + if (typeof index !== "undefined") { + childIndex = this.findChildIndex(index, row); + + if (childIndex !== false) { + row.data[this.field].splice(top ? childIndex : childIndex + 1, 0, data); + } + } + + if (childIndex === false) { + if (top) { + row.data[this.field].unshift(data); + } else { + row.data[this.field].push(data); + } + } + + this.initializeRow(row); + this.layoutRow(row); + + this.table.rowManager.refreshActiveData("tree", false, true); + }; + + DataTree.prototype.findChildIndex = function (subject, parent) { + var _this51 = this; + + var match = false; + + if ((typeof subject === 'undefined' ? 'undefined' : _typeof(subject)) == "object") { + + if (subject instanceof Row) { + //subject is row element + match = subject.data; + } else if (subject instanceof RowComponent) { + //subject is public row component + match = subject._getSelf().data; + } else if (typeof HTMLElement !== "undefined" && subject instanceof HTMLElement) { + if (parent.modules.dataTree) { + match = parent.modules.dataTree.children.find(function (childRow) { + return childRow instanceof Row ? childRow.element === subject : false; + }); + + if (match) { + match = match.data; + } + } + } + } else if (typeof subject == "undefined" || subject === null) { + match = false; + } else { + //subject should be treated as the index of the row + match = parent.data[this.field].find(function (row) { + return row.data[_this51.table.options.index] == subject; + }); + } + + if (match) { + + if (Array.isArray(parent.data[this.field])) { + match = parent.data[this.field].indexOf(match); + } + + if (match == -1) { + match = false; + } + } + + //catch all for any other type of input + + return match; + }; + + DataTree.prototype.getTreeChildren = function (row, component, recurse) { + var _this52 = this; + + var config = row.modules.dataTree, + output = []; + + if (config.children) { + + if (!Array.isArray(config.children)) { + config.children = this.generateChildren(row); + } + + config.children.forEach(function (childRow) { + if (childRow instanceof Row) { + output.push(component ? childRow.getComponent() : childRow); + + if (recurse) { + output = output.concat(_this52.getTreeChildren(childRow, component, recurse)); + } + } + }); + } + + return output; + }; + + DataTree.prototype.checkForRestyle = function (cell) { + if (!cell.row.cells.indexOf(cell)) { + cell.row.reinitialize(); + } + }; + + DataTree.prototype.getChildField = function () { + return this.field; + }; + + DataTree.prototype.redrawNeeded = function (data) { + return (this.field ? typeof data[this.field] !== "undefined" : false) || (this.elementField ? typeof data[this.elementField] !== "undefined" : false); + }; + + Tabulator.prototype.registerModule("dataTree", DataTree); + + var Download = function Download(table) { + this.table = table; //hold Tabulator object + }; + + //trigger file download + Download.prototype.download = function (type, filename, options, range, interceptCallback) { + var self = this, + downloadFunc = false; + + function buildLink(data, mime) { + if (interceptCallback) { + if (interceptCallback === true) { + self.triggerDownload(data, mime, type, filename, true); + } else { + interceptCallback(data); + } + } else { + self.triggerDownload(data, mime, type, filename); + } + } + + if (typeof type == "function") { + downloadFunc = type; + } else { + if (self.downloaders[type]) { + downloadFunc = self.downloaders[type]; + } else { + console.warn("Download Error - No such download type found: ", type); + } + } + + if (downloadFunc) { + var list = this.generateExportList(range); + + downloadFunc.call(this.table, list, options || {}, buildLink); + } + }; + + Download.prototype.generateExportList = function (range) { + var list = this.table.modules.export.generateExportList(this.table.options.downloadConfig, false, range || this.table.options.downloadRowRange, "download"); + + //assign group header formatter + var groupHeader = this.table.options.groupHeaderDownload; + + if (groupHeader && !Array.isArray(groupHeader)) { + groupHeader = [groupHeader]; + } + + list.forEach(function (row) { + var group; + + if (row.type === "group") { + group = row.columns[0]; + + if (groupHeader && groupHeader[row.indent]) { + group.value = groupHeader[row.indent](group.value, row.component._group.getRowCount(), row.component._group.getData(), row.component); + } + } + }); + + return list; + }; + + Download.prototype.triggerDownload = function (data, mime, type, filename, newTab) { + var element = document.createElement('a'), + blob = new Blob([data], { type: mime }), + filename = filename || "Tabulator." + (typeof type === "function" ? "txt" : type); + + blob = this.table.options.downloadReady.call(this.table, data, blob); + + if (blob) { + + if (newTab) { + window.open(window.URL.createObjectURL(blob)); + } else { + if (navigator.msSaveOrOpenBlob) { + navigator.msSaveOrOpenBlob(blob, filename); + } else { + element.setAttribute('href', window.URL.createObjectURL(blob)); + + //set file title + element.setAttribute('download', filename); + + //trigger download + element.style.display = 'none'; + document.body.appendChild(element); + element.click(); + + //remove temporary link element + document.body.removeChild(element); + } + } + + if (this.table.options.downloadComplete) { + this.table.options.downloadComplete(); + } + } + }; + + Download.prototype.commsReceived = function (table, action, data) { + switch (action) { + case "intercept": + this.download(data.type, "", data.options, data.active, data.intercept); + break; + } + }; + + //downloaders + Download.prototype.downloaders = { + csv: function csv(list, options, setFileContents) { + var delimiter = options && options.delimiter ? options.delimiter : ",", + fileContents = [], + headers = []; + + list.forEach(function (row) { + var item = []; + + switch (row.type) { + case "group": + console.warn("Download Warning - CSV downloader cannot process row groups"); + break; + + case "calc": + console.warn("Download Warning - CSV downloader cannot process column calculations"); + break; + + case "header": + row.columns.forEach(function (col, i) { + if (col && col.depth === 1) { + headers[i] = typeof col.value == "undefined" || col.value === null ? "" : '"' + String(col.value).split('"').join('""') + '"'; + } + }); + break; + + case "row": + row.columns.forEach(function (col) { + + if (col) { + + switch (_typeof(col.value)) { + case "object": + col.value = JSON.stringify(col.value); + break; + + case "undefined": + case "null": + col.value = ""; + break; + } + + item.push('"' + String(col.value).split('"').join('""') + '"'); + } + }); + + fileContents.push(item.join(delimiter)); + break; + } + }); + + if (headers.length) { + fileContents.unshift(headers.join(delimiter)); + } + + fileContents = fileContents.join("\n"); + + if (options.bom) { + fileContents = '\uFEFF' + fileContents; + } + + setFileContents(fileContents, "text/csv"); + }, + + json: function json(list, options, setFileContents) { + var fileContents = []; + + list.forEach(function (row) { + var item = {}; + + switch (row.type) { + case "header": + break; + + case "group": + console.warn("Download Warning - JSON downloader cannot process row groups"); + break; + + case "calc": + console.warn("Download Warning - JSON downloader cannot process column calculations"); + break; + + case "row": + row.columns.forEach(function (col) { + if (col) { + item[col.component.getField()] = col.value; + } + }); + + fileContents.push(item); + break; + } + }); + + fileContents = JSON.stringify(fileContents, null, '\t'); + + setFileContents(fileContents, "application/json"); + }, + + pdf: function pdf(list, options, setFileContents) { + var header = [], + body = [], + autoTableParams = {}, + rowGroupStyles = options.rowGroupStyles || { + fontStyle: "bold", + fontSize: 12, + cellPadding: 6, + fillColor: 220 + }, + rowCalcStyles = options.rowCalcStyles || { + fontStyle: "bold", + fontSize: 10, + cellPadding: 4, + fillColor: 232 + }, + jsPDFParams = options.jsPDF || {}, + title = options && options.title ? options.title : ""; + + if (!jsPDFParams.orientation) { + jsPDFParams.orientation = options.orientation || "landscape"; + } + + if (!jsPDFParams.unit) { + jsPDFParams.unit = "pt"; + } + + //parse row list + list.forEach(function (row) { + var item = {}; + + switch (row.type) { + case "header": + header.push(parseRow(row)); + break; + + case "group": + body.push(parseRow(row, rowGroupStyles)); + break; + + case "calc": + body.push(parseRow(row, rowCalcStyles)); + break; + + case "row": + body.push(parseRow(row)); + break; + } + }); + + function parseRow(row, styles) { + var rowData = []; + + row.columns.forEach(function (col) { + var cell; + + if (col) { + switch (_typeof(col.value)) { + case "object": + col.value = JSON.stringify(col.value); + break; + + case "undefined": + case "null": + col.value = ""; + break; + } + + cell = { + content: col.value, + colSpan: col.width, + rowSpan: col.height + }; + + if (styles) { + cell.styles = styles; + } + + rowData.push(cell); + } else { + rowData.push(""); + } + }); + + return rowData; + } + + //configure PDF + var doc = new jsPDF(jsPDFParams); //set document to landscape, better for most tables + + if (options && options.autoTable) { + if (typeof options.autoTable === "function") { + autoTableParams = options.autoTable(doc) || {}; + } else { + autoTableParams = options.autoTable; + } + } + + if (title) { + autoTableParams.addPageContent = function (data) { + doc.text(title, 40, 30); + }; + } + + autoTableParams.head = header; + autoTableParams.body = body; + + doc.autoTable(autoTableParams); + + if (options && options.documentProcessing) { + options.documentProcessing(doc); + } + + setFileContents(doc.output("arraybuffer"), "application/pdf"); + }, + + xlsx: function xlsx(list, options, setFileContents) { + var self = this, + sheetName = options.sheetName || "Sheet1", + workbook = XLSX.utils.book_new(), + output; + + workbook.SheetNames = []; + workbook.Sheets = {}; + + function generateSheet() { + var rows = [], + merges = [], + worksheet = {}, + range = { s: { c: 0, r: 0 }, e: { c: list[0] ? list[0].columns.reduce(function (a, b) { + return a + (b && b.width ? b.width : 1); + }, 0) : 0, r: list.length } }; + + //parse row list + list.forEach(function (row, i) { + var rowData = []; + + row.columns.forEach(function (col, j) { + + if (col) { + rowData.push(!(col.value instanceof Date) && _typeof(col.value) === "object" ? JSON.stringify(col.value) : col.value); + + if (col.width > 1 || col.height > -1) { + merges.push({ s: { r: i, c: j }, e: { r: i + col.height - 1, c: j + col.width - 1 } }); + } + } else { + rowData.push(""); + } + }); + + rows.push(rowData); + }); + + //convert rows to worksheet + XLSX.utils.sheet_add_aoa(worksheet, rows); + + worksheet['!ref'] = XLSX.utils.encode_range(range); + + if (merges.length) { + worksheet["!merges"] = merges; + } + + return worksheet; + } + + if (options.sheetOnly) { + setFileContents(generateSheet()); + return; + } + + if (options.sheets) { + for (var sheet in options.sheets) { + + if (options.sheets[sheet] === true) { + workbook.SheetNames.push(sheet); + workbook.Sheets[sheet] = generateSheet(); + } else { + + workbook.SheetNames.push(sheet); + + this.modules.comms.send(options.sheets[sheet], "download", "intercept", { + type: "xlsx", + options: { sheetOnly: true }, + active: self.active, + intercept: function intercept(data) { + workbook.Sheets[sheet] = data; + } + }); + } + } + } else { + workbook.SheetNames.push(sheetName); + workbook.Sheets[sheetName] = generateSheet(); + } + + if (options.documentProcessing) { + workbook = options.documentProcessing(workbook); + } + + //convert workbook to binary array + function s2ab(s) { + var buf = new ArrayBuffer(s.length); + var view = new Uint8Array(buf); + for (var i = 0; i != s.length; ++i) { + view[i] = s.charCodeAt(i) & 0xFF; + }return buf; + } + + output = XLSX.write(workbook, { bookType: 'xlsx', bookSST: true, type: 'binary' }); + + setFileContents(s2ab(output), "application/octet-stream"); + }, + + html: function html(list, options, setFileContents) { + if (this.modExists("export", true)) { + setFileContents(this.modules.export.genereateHTMLTable(list), "text/html"); + } + } + + }; + + Tabulator.prototype.registerModule("download", Download); + + var Edit = function Edit(table) { + this.table = table; //hold Tabulator object + this.currentCell = false; //hold currently editing cell + this.mouseClick = false; //hold mousedown state to prevent click binding being overriden by editor opening + this.recursionBlock = false; //prevent focus recursion + this.invalidEdit = false; + this.editedCells = []; + }; + + //initialize column editor + Edit.prototype.initializeColumn = function (column) { + var self = this, + config = { + editor: false, + blocked: false, + check: column.definition.editable, + params: column.definition.editorParams || {} + }; + + //set column editor + switch (_typeof(column.definition.editor)) { + case "string": + + if (column.definition.editor === "tick") { + column.definition.editor = "tickCross"; + console.warn("DEPRECATION WARNING - the tick editor has been deprecated, please use the tickCross editor"); + } + + if (self.editors[column.definition.editor]) { + config.editor = self.editors[column.definition.editor]; + } else { + console.warn("Editor Error - No such editor found: ", column.definition.editor); + } + break; + + case "function": + config.editor = column.definition.editor; + break; + + case "boolean": + + if (column.definition.editor === true) { + + if (typeof column.definition.formatter !== "function") { + + if (column.definition.formatter === "tick") { + column.definition.formatter = "tickCross"; + console.warn("DEPRECATION WARNING - the tick editor has been deprecated, please use the tickCross editor"); + } + + if (self.editors[column.definition.formatter]) { + config.editor = self.editors[column.definition.formatter]; + } else { + config.editor = self.editors["input"]; + } + } else { + console.warn("Editor Error - Cannot auto lookup editor for a custom formatter: ", column.definition.formatter); + } + } + break; + } + + if (config.editor) { + column.modules.edit = config; + } + }; + + Edit.prototype.getCurrentCell = function () { + return this.currentCell ? this.currentCell.getComponent() : false; + }; + + Edit.prototype.clearEditor = function (cancel) { + var cell = this.currentCell, + cellEl; + + this.invalidEdit = false; + + if (cell) { + this.currentCell = false; + + cellEl = cell.getElement(); + + if (cancel) { + cell.validate(); + } else { + cellEl.classList.remove("tabulator-validation-fail"); + } + + cellEl.classList.remove("tabulator-editing"); + while (cellEl.firstChild) { + cellEl.removeChild(cellEl.firstChild); + }cell.row.getElement().classList.remove("tabulator-row-editing"); + } + }; + + Edit.prototype.cancelEdit = function () { + + if (this.currentCell) { + var cell = this.currentCell; + var component = this.currentCell.getComponent(); + + this.clearEditor(true); + cell.setValueActual(cell.getValue()); + cell.cellRendered(); + + if (cell.column.definition.editor == "textarea" || cell.column.definition.variableHeight) { + cell.row.normalizeHeight(true); + } + + if (cell.column.cellEvents.cellEditCancelled) { + cell.column.cellEvents.cellEditCancelled.call(this.table, component); + } + + this.table.options.cellEditCancelled.call(this.table, component); + } + }; + + //return a formatted value for a cell + Edit.prototype.bindEditor = function (cell) { + var self = this, + element = cell.getElement(); + + element.setAttribute("tabindex", 0); + + element.addEventListener("click", function (e) { + if (!element.classList.contains("tabulator-editing")) { + element.focus({ preventScroll: true }); + } + }); + + element.addEventListener("mousedown", function (e) { + if (e.button === 2) { + e.preventDefault(); + } else { + self.mouseClick = true; + } + }); + + element.addEventListener("focus", function (e) { + if (!self.recursionBlock) { + self.edit(cell, e, false); + } + }); + }; + + Edit.prototype.focusCellNoEvent = function (cell, block) { + this.recursionBlock = true; + if (!(block && this.table.browser === "ie")) { + cell.getElement().focus({ preventScroll: true }); + } + this.recursionBlock = false; + }; + + Edit.prototype.editCell = function (cell, forceEdit) { + this.focusCellNoEvent(cell); + this.edit(cell, false, forceEdit); + }; + + Edit.prototype.focusScrollAdjust = function (cell) { + if (this.table.rowManager.getRenderMode() == "virtual") { + var topEdge = this.table.rowManager.element.scrollTop, + bottomEdge = this.table.rowManager.element.clientHeight + this.table.rowManager.element.scrollTop, + rowEl = cell.row.getElement(), + offset = rowEl.offsetTop; + + if (rowEl.offsetTop < topEdge) { + this.table.rowManager.element.scrollTop -= topEdge - rowEl.offsetTop; + } else { + if (rowEl.offsetTop + rowEl.offsetHeight > bottomEdge) { + this.table.rowManager.element.scrollTop += rowEl.offsetTop + rowEl.offsetHeight - bottomEdge; + } + } + + var leftEdge = this.table.rowManager.element.scrollLeft, + rightEdge = this.table.rowManager.element.clientWidth + this.table.rowManager.element.scrollLeft, + cellEl = cell.getElement(), + offset = cellEl.offsetLeft; + + if (this.table.modExists("frozenColumns")) { + leftEdge += parseInt(this.table.modules.frozenColumns.leftMargin); + rightEdge -= parseInt(this.table.modules.frozenColumns.rightMargin); + } + + if (cellEl.offsetLeft < leftEdge) { + this.table.rowManager.element.scrollLeft -= leftEdge - cellEl.offsetLeft; + } else { + if (cellEl.offsetLeft + cellEl.offsetWidth > rightEdge) { + this.table.rowManager.element.scrollLeft += cellEl.offsetLeft + cellEl.offsetWidth - rightEdge; + } + } + } + }; + + Edit.prototype.edit = function (cell, e, forceEdit) { + var self = this, + allowEdit = true, + rendered = function rendered() {}, + element = cell.getElement(), + cellEditor, + component, + params; + + //prevent editing if another cell is refusing to leave focus (eg. validation fail) + if (this.currentCell) { + if (!this.invalidEdit) { + this.cancelEdit(); + } + return; + } + + //handle successfull value change + function success(value) { + if (self.currentCell === cell) { + var valid = true; + + if (cell.column.modules.validate && self.table.modExists("validate") && self.table.options.validationMode != "manual") { + valid = self.table.modules.validate.validate(cell.column.modules.validate, cell, value); + } + + if (valid === true || self.table.options.validationMode === "highlight") { + self.clearEditor(); + + if (!cell.modules.edit) { + cell.modules.edit = {}; + } + + cell.modules.edit.edited = true; + + if (self.editedCells.indexOf(cell) == -1) { + self.editedCells.push(cell); + } + + cell.setValue(value, true); + + if (self.table.options.dataTree && self.table.modExists("dataTree")) { + self.table.modules.dataTree.checkForRestyle(cell); + } + + if (valid !== true) { + element.classList.add("tabulator-validation-fail"); + self.table.options.validationFailed.call(self.table, cell.getComponent(), value, valid); + return false; + } + + return true; + } else { + self.invalidEdit = true; + element.classList.add("tabulator-validation-fail"); + self.focusCellNoEvent(cell, true); + rendered(); + self.table.options.validationFailed.call(self.table, cell.getComponent(), value, valid); + + return false; + } + } else { + // console.warn("Edit Success Error - cannot call success on a cell that is no longer being edited"); + } + } + + //handle aborted edit + function cancel() { + if (self.currentCell === cell) { + self.cancelEdit(); + + if (self.table.options.dataTree && self.table.modExists("dataTree")) { + self.table.modules.dataTree.checkForRestyle(cell); + } + } else { + // console.warn("Edit Success Error - cannot call cancel on a cell that is no longer being edited"); + } + } + + function onRendered(callback) { + rendered = callback; + } + + if (!cell.column.modules.edit.blocked) { + if (e) { + e.stopPropagation(); + } + + switch (_typeof(cell.column.modules.edit.check)) { + case "function": + allowEdit = cell.column.modules.edit.check(cell.getComponent()); + break; + + case "boolean": + allowEdit = cell.column.modules.edit.check; + break; + } + + if (allowEdit || forceEdit) { + + self.cancelEdit(); + + self.currentCell = cell; + + this.focusScrollAdjust(cell); + + component = cell.getComponent(); + + if (this.mouseClick) { + this.mouseClick = false; + + if (cell.column.cellEvents.cellClick) { + cell.column.cellEvents.cellClick.call(this.table, e, component); + } + } + + if (cell.column.cellEvents.cellEditing) { + cell.column.cellEvents.cellEditing.call(this.table, component); + } + + self.table.options.cellEditing.call(this.table, component); + + params = typeof cell.column.modules.edit.params === "function" ? cell.column.modules.edit.params(component) : cell.column.modules.edit.params; + + cellEditor = cell.column.modules.edit.editor.call(self, component, onRendered, success, cancel, params); + + //if editor returned, add to DOM, if false, abort edit + if (cellEditor !== false) { + + if (cellEditor instanceof Node) { + element.classList.add("tabulator-editing"); + cell.row.getElement().classList.add("tabulator-row-editing"); + while (element.firstChild) { + element.removeChild(element.firstChild); + }element.appendChild(cellEditor); + + //trigger onRendered Callback + rendered(); + + //prevent editing from triggering rowClick event + var children = element.children; + + for (var i = 0; i < children.length; i++) { + children[i].addEventListener("click", function (e) { + e.stopPropagation(); + }); + } + } else { + console.warn("Edit Error - Editor should return an instance of Node, the editor returned:", cellEditor); + element.blur(); + return false; + } + } else { + element.blur(); + return false; + } + + return true; + } else { + this.mouseClick = false; + element.blur(); + return false; + } + } else { + this.mouseClick = false; + element.blur(); + return false; + } + }; + + Edit.prototype.maskInput = function (el, options) { + var mask = options.mask, + maskLetter = typeof options.maskLetterChar !== "undefined" ? options.maskLetterChar : "A", + maskNumber = typeof options.maskNumberChar !== "undefined" ? options.maskNumberChar : "9", + maskWildcard = typeof options.maskWildcardChar !== "undefined" ? options.maskWildcardChar : "*", + success = false; + + function fillSymbols(index) { + var symbol = mask[index]; + if (typeof symbol !== "undefined" && symbol !== maskWildcard && symbol !== maskLetter && symbol !== maskNumber) { + el.value = el.value + "" + symbol; + fillSymbols(index + 1); + } + } + + el.addEventListener("keydown", function (e) { + var index = el.value.length, + char = e.key; + + if (e.keyCode > 46) { + if (index >= mask.length) { + e.preventDefault(); + e.stopPropagation(); + success = false; + return false; + } else { + switch (mask[index]) { + case maskLetter: + if (char.toUpperCase() == char.toLowerCase()) { + e.preventDefault(); + e.stopPropagation(); + success = false; + return false; + } + break; + + case maskNumber: + if (isNaN(char)) { + e.preventDefault(); + e.stopPropagation(); + success = false; + return false; + } + break; + + case maskWildcard: + break; + + default: + if (char !== mask[index]) { + e.preventDefault(); + e.stopPropagation(); + success = false; + return false; + } + } + } + + success = true; + } + + return; + }); + + el.addEventListener("keyup", function (e) { + if (e.keyCode > 46) { + if (options.maskAutoFill) { + fillSymbols(el.value.length); + } + } + }); + + if (!el.placeholder) { + el.placeholder = mask; + } + + if (options.maskAutoFill) { + fillSymbols(el.value.length); + } + }; + + Edit.prototype.getEditedCells = function () { + var output = []; + + this.editedCells.forEach(function (cell) { + output.push(cell.getComponent()); + }); + + return output; + }; + + Edit.prototype.clearEdited = function (cell) { + var editIndex; + + if (cell.modules.edit && cell.modules.edit.edited) { + cell.modules.edit.edited = false; + + if (cell.modules.validate) { + cell.modules.validate.invalid = false; + } + } + + editIndex = this.editedCells.indexOf(cell); + + if (editIndex > -1) { + this.editedCells.splice(editIndex, 1); + } + }; + + //default data editors + Edit.prototype.editors = { + + //input element + input: function input(cell, onRendered, success, cancel, editorParams) { + + //create and style input + var cellValue = cell.getValue(), + input = document.createElement("input"); + + input.setAttribute("type", editorParams.search ? "search" : "text"); + + input.style.padding = "4px"; + input.style.width = "100%"; + input.style.boxSizing = "border-box"; + + if (editorParams.elementAttributes && _typeof(editorParams.elementAttributes) == "object") { + for (var key in editorParams.elementAttributes) { + if (key.charAt(0) == "+") { + key = key.slice(1); + input.setAttribute(key, input.getAttribute(key) + editorParams.elementAttributes["+" + key]); + } else { + input.setAttribute(key, editorParams.elementAttributes[key]); + } + } + } + + input.value = typeof cellValue !== "undefined" ? cellValue : ""; + + onRendered(function () { + input.focus({ preventScroll: true }); + input.style.height = "100%"; + }); + + function onChange(e) { + if ((cellValue === null || typeof cellValue === "undefined") && input.value !== "" || input.value !== cellValue) { + if (success(input.value)) { + cellValue = input.value; //persist value if successfully validated incase editor is used as header filter + } + } else { + cancel(); + } + } + + //submit new value on blur or change + input.addEventListener("change", onChange); + input.addEventListener("blur", onChange); + + //submit new value on enter + input.addEventListener("keydown", function (e) { + switch (e.keyCode) { + // case 9: + case 13: + onChange(e); + break; + + case 27: + cancel(); + break; + + case 35: + case 36: + e.stopPropagation(); + break; + } + }); + + if (editorParams.mask) { + this.table.modules.edit.maskInput(input, editorParams); + } + + return input; + }, + + //resizable text area element + textarea: function textarea(cell, onRendered, success, cancel, editorParams) { + var self = this, + cellValue = cell.getValue(), + vertNav = editorParams.verticalNavigation || "hybrid", + value = String(cellValue !== null && typeof cellValue !== "undefined" ? cellValue : ""), + count = (value.match(/(?:\r\n|\r|\n)/g) || []).length + 1, + input = document.createElement("textarea"), + scrollHeight = 0; + + //create and style input + input.style.display = "block"; + input.style.padding = "2px"; + input.style.height = "100%"; + input.style.width = "100%"; + input.style.boxSizing = "border-box"; + input.style.whiteSpace = "pre-wrap"; + input.style.resize = "none"; + + if (editorParams.elementAttributes && _typeof(editorParams.elementAttributes) == "object") { + for (var key in editorParams.elementAttributes) { + if (key.charAt(0) == "+") { + key = key.slice(1); + input.setAttribute(key, input.getAttribute(key) + editorParams.elementAttributes["+" + key]); + } else { + input.setAttribute(key, editorParams.elementAttributes[key]); + } + } + } + + input.value = value; + + onRendered(function () { + input.focus({ preventScroll: true }); + input.style.height = "100%"; + + input.scrollHeight; + input.style.height = input.scrollHeight + "px"; + cell.getRow().normalizeHeight(); + }); + + function onChange(e) { + + if ((cellValue === null || typeof cellValue === "undefined") && input.value !== "" || input.value !== cellValue) { + + if (success(input.value)) { + cellValue = input.value; //persist value if successfully validated incase editor is used as header filter + } + + setTimeout(function () { + cell.getRow().normalizeHeight(); + }, 300); + } else { + cancel(); + } + } + + //submit new value on blur or change + input.addEventListener("change", onChange); + input.addEventListener("blur", onChange); + + input.addEventListener("keyup", function () { + + input.style.height = ""; + + var heightNow = input.scrollHeight; + + input.style.height = heightNow + "px"; + + if (heightNow != scrollHeight) { + scrollHeight = heightNow; + cell.getRow().normalizeHeight(); + } + }); + + input.addEventListener("keydown", function (e) { + + switch (e.keyCode) { + case 27: + cancel(); + break; + + case 38: + //up arrow + if (vertNav == "editor" || vertNav == "hybrid" && input.selectionStart) { + e.stopImmediatePropagation(); + e.stopPropagation(); + } + + break; + + case 40: + //down arrow + if (vertNav == "editor" || vertNav == "hybrid" && input.selectionStart !== input.value.length) { + e.stopImmediatePropagation(); + e.stopPropagation(); + } + break; + + case 35: + case 36: + e.stopPropagation(); + break; + } + }); + + if (editorParams.mask) { + this.table.modules.edit.maskInput(input, editorParams); + } + + return input; + }, + + //input element with type of number + number: function number(cell, onRendered, success, cancel, editorParams) { + + var cellValue = cell.getValue(), + vertNav = editorParams.verticalNavigation || "editor", + input = document.createElement("input"); + + input.setAttribute("type", "number"); + + if (typeof editorParams.max != "undefined") { + input.setAttribute("max", editorParams.max); + } + + if (typeof editorParams.min != "undefined") { + input.setAttribute("min", editorParams.min); + } + + if (typeof editorParams.step != "undefined") { + input.setAttribute("step", editorParams.step); + } + + //create and style input + input.style.padding = "4px"; + input.style.width = "100%"; + input.style.boxSizing = "border-box"; + + if (editorParams.elementAttributes && _typeof(editorParams.elementAttributes) == "object") { + for (var key in editorParams.elementAttributes) { + if (key.charAt(0) == "+") { + key = key.slice(1); + input.setAttribute(key, input.getAttribute(key) + editorParams.elementAttributes["+" + key]); + } else { + input.setAttribute(key, editorParams.elementAttributes[key]); + } + } + } + + input.value = cellValue; + + var blurFunc = function blurFunc(e) { + onChange(); + }; + + onRendered(function () { + //submit new value on blur + input.removeEventListener("blur", blurFunc); + + input.focus({ preventScroll: true }); + input.style.height = "100%"; + + //submit new value on blur + input.addEventListener("blur", blurFunc); + }); + + function onChange() { + var value = input.value; + + if (!isNaN(value) && value !== "") { + value = Number(value); + } + + if (value !== cellValue) { + if (success(value)) { + cellValue = value; //persist value if successfully validated incase editor is used as header filter + } + } else { + cancel(); + } + } + + //submit new value on enter + input.addEventListener("keydown", function (e) { + switch (e.keyCode) { + case 13: + // case 9: + onChange(); + break; + + case 27: + cancel(); + break; + + case 38: //up arrow + case 40: + //down arrow + if (vertNav == "editor") { + e.stopImmediatePropagation(); + e.stopPropagation(); + } + break; + + case 35: + case 36: + e.stopPropagation(); + break; + } + }); + + if (editorParams.mask) { + this.table.modules.edit.maskInput(input, editorParams); + } + + return input; + }, + + //input element with type of number + range: function range(cell, onRendered, success, cancel, editorParams) { + + var cellValue = cell.getValue(), + input = document.createElement("input"); + + input.setAttribute("type", "range"); + + if (typeof editorParams.max != "undefined") { + input.setAttribute("max", editorParams.max); + } + + if (typeof editorParams.min != "undefined") { + input.setAttribute("min", editorParams.min); + } + + if (typeof editorParams.step != "undefined") { + input.setAttribute("step", editorParams.step); + } + + //create and style input + input.style.padding = "4px"; + input.style.width = "100%"; + input.style.boxSizing = "border-box"; + + if (editorParams.elementAttributes && _typeof(editorParams.elementAttributes) == "object") { + for (var key in editorParams.elementAttributes) { + if (key.charAt(0) == "+") { + key = key.slice(1); + input.setAttribute(key, input.getAttribute(key) + editorParams.elementAttributes["+" + key]); + } else { + input.setAttribute(key, editorParams.elementAttributes[key]); + } + } + } + + input.value = cellValue; + + onRendered(function () { + input.focus({ preventScroll: true }); + input.style.height = "100%"; + }); + + function onChange() { + var value = input.value; + + if (!isNaN(value) && value !== "") { + value = Number(value); + } + + if (value != cellValue) { + if (success(value)) { + cellValue = value; //persist value if successfully validated incase editor is used as header filter + } + } else { + cancel(); + } + } + + //submit new value on blur + input.addEventListener("blur", function (e) { + onChange(); + }); + + //submit new value on enter + input.addEventListener("keydown", function (e) { + switch (e.keyCode) { + case 13: + // case 9: + onChange(); + break; + + case 27: + cancel(); + break; + } + }); + + return input; + }, + + //select + select: function select(cell, onRendered, success, cancel, editorParams) { + var _this53 = this; + + var self = this, + cellEl = cell.getElement(), + initialValue = cell.getValue(), + vertNav = editorParams.verticalNavigation || "editor", + initialDisplayValue = typeof initialValue !== "undefined" || initialValue === null ? Array.isArray(initialValue) ? initialValue : [initialValue] : typeof editorParams.defaultValue !== "undefined" ? editorParams.defaultValue : [], + input = document.createElement("input"), + listEl = document.createElement("div"), + multiselect = editorParams.multiselect, + dataItems = [], + currentItem = {}, + displayItems = [], + currentItems = [], + blurable = true, + blockListShow = false; + + if (Array.isArray(editorParams) || !Array.isArray(editorParams) && (typeof editorParams === 'undefined' ? 'undefined' : _typeof(editorParams)) === "object" && !editorParams.values) { + console.warn("DEPRECATION WARNING - values for the select editor must now be passed into the values property of the editorParams object, not as the editorParams object"); + editorParams = { values: editorParams }; + } + + function getUniqueColumnValues(field) { + var output = {}, + data = self.table.getData(), + column; + + if (field) { + column = self.table.columnManager.getColumnByField(field); + } else { + column = cell.getColumn()._getSelf(); + } + + if (column) { + data.forEach(function (row) { + var val = column.getFieldValue(row); + + if (val !== null && typeof val !== "undefined" && val !== "") { + output[val] = true; + } + }); + + if (editorParams.sortValuesList) { + if (editorParams.sortValuesList == "asc") { + output = Object.keys(output).sort(); + } else { + output = Object.keys(output).sort().reverse(); + } + } else { + output = Object.keys(output); + } + } else { + console.warn("unable to find matching column to create select lookup list:", field); + } + + return output; + } + + function parseItems(inputValues, curentValues) { + var dataList = []; + var displayList = []; + + function processComplexListItem(item) { + var item = { + label: item.label, + value: item.value, + itemParams: item.itemParams, + elementAttributes: item.elementAttributes, + element: false + }; + + // if(item.value === curentValue || (!isNaN(parseFloat(item.value)) && !isNaN(parseFloat(item.value)) && parseFloat(item.value) === parseFloat(curentValue))){ + // setCurrentItem(item); + // } + + if (curentValues.indexOf(item.value) > -1) { + setItem(item); + } + + dataList.push(item); + displayList.push(item); + + return item; + } + + if (typeof inputValues == "function") { + inputValues = inputValues(cell); + } + + if (Array.isArray(inputValues)) { + inputValues.forEach(function (value) { + var item; + + if ((typeof value === 'undefined' ? 'undefined' : _typeof(value)) === "object") { + + if (value.options) { + item = { + label: value.label, + group: true, + itemParams: value.itemParams, + elementAttributes: value.elementAttributes, + element: false + }; + + displayList.push(item); + + value.options.forEach(function (item) { + processComplexListItem(item); + }); + } else { + processComplexListItem(value); + } + } else { + + item = { + label: value, + value: value, + element: false + }; + + // if(item.value === curentValue || (!isNaN(parseFloat(item.value)) && !isNaN(parseFloat(item.value)) && parseFloat(item.value) === parseFloat(curentValue))){ + // setCurrentItem(item); + // } + + if (curentValues.indexOf(item.value) > -1) { + setItem(item); + } + + dataList.push(item); + displayList.push(item); + } + }); + } else { + for (var key in inputValues) { + var item = { + label: inputValues[key], + value: key, + element: false + }; + + // if(item.value === curentValue || (!isNaN(parseFloat(item.value)) && !isNaN(parseFloat(item.value)) && parseFloat(item.value) === parseFloat(curentValue))){ + // setCurrentItem(item); + // } + + if (curentValues.indexOf(item.value) > -1) { + setItem(item); + } + + dataList.push(item); + displayList.push(item); + } + } + + dataItems = dataList; + displayItems = displayList; + + fillList(); + } + + function fillList() { + while (listEl.firstChild) { + listEl.removeChild(listEl.firstChild); + }displayItems.forEach(function (item) { + + var el = item.element; + + if (!el) { + el = document.createElement("div"); + item.label = editorParams.listItemFormatter ? editorParams.listItemFormatter(item.value, item.label, cell, el, item.itemParams) : item.label; + if (item.group) { + el.classList.add("tabulator-edit-select-list-group"); + el.tabIndex = 0; + el.innerHTML = item.label === "" ? " " : item.label; + } else { + el.classList.add("tabulator-edit-select-list-item"); + el.tabIndex = 0; + el.innerHTML = item.label === "" ? " " : item.label; + + el.addEventListener("click", function () { + blockListShow = true; + + setTimeout(function () { + blockListShow = false; + }, 10); + + // setCurrentItem(item); + // chooseItem(); + if (multiselect) { + toggleItem(item); + input.focus(); + } else { + chooseItem(item); + } + }); + + // if(item === currentItem){ + // el.classList.add("active"); + // } + + if (currentItems.indexOf(item) > -1) { + el.classList.add("active"); + } + } + + if (item.elementAttributes && _typeof(item.elementAttributes) == "object") { + for (var key in item.elementAttributes) { + if (key.charAt(0) == "+") { + key = key.slice(1); + el.setAttribute(key, input.getAttribute(key) + item.elementAttributes["+" + key]); + } else { + el.setAttribute(key, item.elementAttributes[key]); + } + } + } + el.addEventListener("mousedown", function () { + blurable = false; + + setTimeout(function () { + blurable = true; + }, 10); + }); + + item.element = el; + } + + listEl.appendChild(el); + }); + } + + function setCurrentItem(item, active) { + + if (!multiselect && currentItem && currentItem.element) { + currentItem.element.classList.remove("active"); + } + + if (currentItem && currentItem.element) { + currentItem.element.classList.remove("focused"); + } + + currentItem = item; + + if (item.element) { + item.element.classList.add("focused"); + if (active) { + item.element.classList.add("active"); + } + } + + if (item && item.element && item.element.scrollIntoView) { + item.element.scrollIntoView({ behavior: 'smooth', block: 'nearest', inline: 'start' }); + } + } + + // function chooseItem(){ + // hideList(); + + // if(initialValue !== currentItem.value){ + // initialValue = currentItem.value; + // success(currentItem.value); + // }else{ + // cancel(); + // } + // } + + function setItem(item) { + var index = currentItems.indexOf(item); + + if (index == -1) { + currentItems.push(item); + setCurrentItem(item, true); + } + + fillInput(); + } + + function unsetItem(index) { + var item = currentItems[index]; + + if (index > -1) { + currentItems.splice(index, 1); + if (item.element) { + item.element.classList.remove("active"); + } + } + } + + function toggleItem(item) { + if (!item) { + item = currentItem; + } + + var index = currentItems.indexOf(item); + + if (index > -1) { + unsetItem(index); + } else { + if (multiselect !== true && currentItems.length >= multiselect) { + unsetItem(0); + } + + setItem(item); + } + + fillInput(); + } + + function chooseItem(item) { + hideList(); + + if (!item) { + item = currentItem; + } + + if (item) { + input.value = item.label; + success(item.value); + } + + initialDisplayValue = input.value; + } + + function chooseItems(silent) { + if (!silent) { + hideList(); + } + + var output = []; + + currentItems.forEach(function (item) { + output.push(item.value); + }); + + initialDisplayValue = input.value; + + success(output); + } + + function fillInput() { + var output = []; + + currentItems.forEach(function (item) { + output.push(item.label); + }); + + input.value = output.join(", "); + + if (self.currentCell === false) { + chooseItems(true); + } + } + + function unsetItems() { + + var len = currentItems.length; + + for (var _i9 = 0; _i9 < len; _i9++) { + unsetItem(0); + } + } + + function cancelItem() { + hideList(); + cancel(); + } + + function showList() { + currentItems = []; + + if (!listEl.parentNode) { + if (editorParams.values === true) { + parseItems(getUniqueColumnValues(), initialDisplayValue); + } else if (typeof editorParams.values === "string") { + parseItems(getUniqueColumnValues(editorParams.values), initialDisplayValue); + } else { + parseItems(editorParams.values || [], initialDisplayValue); + } + + var offset = Tabulator.prototype.helpers.elOffset(cellEl); + + listEl.style.minWidth = cellEl.offsetWidth + "px"; + + listEl.style.top = offset.top + cellEl.offsetHeight + "px"; + listEl.style.left = offset.left + "px"; + + listEl.addEventListener("mousedown", function (e) { + blurable = false; + + setTimeout(function () { + blurable = true; + }, 10); + }); + + document.body.appendChild(listEl); + } + } + + function hideList() { + if (listEl.parentNode) { + listEl.parentNode.removeChild(listEl); + } + + removeScrollListener(); + } + + function removeScrollListener() { + self.table.rowManager.element.removeEventListener("scroll", cancelItem); + } + + //style input + input.setAttribute("type", "text"); + + input.style.padding = "4px"; + input.style.width = "100%"; + input.style.boxSizing = "border-box"; + input.style.cursor = "default"; + input.readOnly = this.currentCell != false; + + if (editorParams.elementAttributes && _typeof(editorParams.elementAttributes) == "object") { + for (var key in editorParams.elementAttributes) { + if (key.charAt(0) == "+") { + key = key.slice(1); + input.setAttribute(key, input.getAttribute(key) + editorParams.elementAttributes["+" + key]); + } else { + input.setAttribute(key, editorParams.elementAttributes[key]); + } + } + } + + input.value = typeof initialValue !== "undefined" || initialValue === null ? initialValue : ""; + + // if(editorParams.values === true){ + // parseItems(getUniqueColumnValues(), initialValue); + // }else if(typeof editorParams.values === "string"){ + // parseItems(getUniqueColumnValues(editorParams.values), initialValue); + // }else{ + // parseItems(editorParams.values || [], initialValue); + // } + + input.addEventListener("search", function (e) { + if (!input.value) { + unsetItems(); + chooseItems(); + } + }); + + //allow key based navigation + input.addEventListener("keydown", function (e) { + var index; + + switch (e.keyCode) { + case 38: + //up arrow + index = dataItems.indexOf(currentItem); + + if (vertNav == "editor" || vertNav == "hybrid" && index) { + e.stopImmediatePropagation(); + e.stopPropagation(); + e.preventDefault(); + + if (index > 0) { + setCurrentItem(dataItems[index - 1], !multiselect); + } + } + break; + + case 40: + //down arrow + index = dataItems.indexOf(currentItem); + + if (vertNav == "editor" || vertNav == "hybrid" && index < dataItems.length - 1) { + e.stopImmediatePropagation(); + e.stopPropagation(); + e.preventDefault(); + + if (index < dataItems.length - 1) { + if (index == -1) { + setCurrentItem(dataItems[0], !multiselect); + } else { + setCurrentItem(dataItems[index + 1], !multiselect); + } + } + } + break; + + case 37: //left arrow + case 39: + //right arrow + e.stopImmediatePropagation(); + e.stopPropagation(); + e.preventDefault(); + break; + + case 13: + //enter + // chooseItem(); + + if (multiselect) { + toggleItem(); + } else { + chooseItem(); + } + + break; + + case 27: + //escape + cancelItem(); + break; + + case 9: + //tab + break; + + default: + if (self.currentCell === false) { + e.preventDefault(); + } + } + }); + + input.addEventListener("blur", function (e) { + if (blurable) { + if (multiselect) { + chooseItems(); + } else { + cancelItem(); + } + } + }); + + input.addEventListener("focus", function (e) { + if (!blockListShow) { + showList(); + } + }); + + //style list element + listEl = document.createElement("div"); + listEl.classList.add("tabulator-edit-select-list"); + + onRendered(function () { + input.style.height = "100%"; + input.focus({ preventScroll: true }); + }); + + setTimeout(function () { + _this53.table.rowManager.element.addEventListener("scroll", cancelItem); + }, 10); + + return input; + }, + + //autocomplete + autocomplete: function autocomplete(cell, onRendered, success, cancel, editorParams) { + var _this54 = this; + + var self = this, + cellEl = cell.getElement(), + initialValue = cell.getValue(), + vertNav = editorParams.verticalNavigation || "editor", + initialDisplayValue = typeof initialValue !== "undefined" || initialValue === null ? initialValue : typeof editorParams.defaultValue !== "undefined" ? editorParams.defaultValue : "", + input = document.createElement("input"), + listEl = document.createElement("div"), + allItems = [], + displayItems = [], + values = [], + currentItem = false, + blurable = true, + uniqueColumnValues = false; + + //style input + input.setAttribute("type", "search"); + + input.style.padding = "4px"; + input.style.width = "100%"; + input.style.boxSizing = "border-box"; + + if (editorParams.elementAttributes && _typeof(editorParams.elementAttributes) == "object") { + for (var key in editorParams.elementAttributes) { + if (key.charAt(0) == "+") { + key = key.slice(1); + input.setAttribute(key, input.getAttribute(key) + editorParams.elementAttributes["+" + key]); + } else { + input.setAttribute(key, editorParams.elementAttributes[key]); + } + } + } + + //style list element + listEl.classList.add("tabulator-edit-select-list"); + + listEl.addEventListener("mousedown", function (e) { + blurable = false; + + setTimeout(function () { + blurable = true; + }, 10); + }); + + function genUniqueColumnValues() { + if (editorParams.values === true) { + uniqueColumnValues = getUniqueColumnValues(); + } else if (typeof editorParams.values === "string") { + uniqueColumnValues = getUniqueColumnValues(editorParams.values); + } + } + + function getUniqueColumnValues(field) { + var output = {}, + data = self.table.getData(), + column; + + if (field) { + column = self.table.columnManager.getColumnByField(field); + } else { + column = cell.getColumn()._getSelf(); + } + + if (column) { + data.forEach(function (row) { + var val = column.getFieldValue(row); + + if (val !== null && typeof val !== "undefined" && val !== "") { + output[val] = true; + } + }); + + if (editorParams.sortValuesList) { + if (editorParams.sortValuesList == "asc") { + output = Object.keys(output).sort(); + } else { + output = Object.keys(output).sort().reverse(); + } + } else { + output = Object.keys(output); + } + } else { + console.warn("unable to find matching column to create autocomplete lookup list:", field); + } + + return output; + } + + function filterList(term, intialLoad) { + var matches = [], + values, + items, + searchEl; + + //lookup base values list + if (uniqueColumnValues) { + values = uniqueColumnValues; + } else { + values = editorParams.values || []; + } + + if (editorParams.searchFunc) { + matches = editorParams.searchFunc(term, values); + + if (matches instanceof Promise) { + + addNotice(typeof editorParams.searchingPlaceholder !== "undefined" ? editorParams.searchingPlaceholder : "Searching..."); + + matches.then(function (result) { + fillListIfNotEmpty(parseItems(result), intialLoad); + }).catch(function (err) { + console.err("error in autocomplete search promise:", err); + }); + } else { + fillListIfNotEmpty(parseItems(matches), intialLoad); + } + } else { + items = parseItems(values); + + if (term === "") { + if (editorParams.showListOnEmpty) { + matches = items; + } + } else { + items.forEach(function (item) { + if (item.value !== null || typeof item.value !== "undefined") { + if (String(item.value).toLowerCase().indexOf(String(term).toLowerCase()) > -1 || String(item.title).toLowerCase().indexOf(String(term).toLowerCase()) > -1) { + matches.push(item); + } + } + }); + } + + fillListIfNotEmpty(matches, intialLoad); + } + } + + function addNotice(notice) { + var searchEl = document.createElement("div"); + + clearList(); + + if (notice !== false) { + searchEl.classList.add("tabulator-edit-select-list-notice"); + searchEl.tabIndex = 0; + + if (notice instanceof Node) { + searchEl.appendChild(notice); + } else { + searchEl.innerHTML = notice; + } + + listEl.appendChild(searchEl); + } + } + + function parseItems(inputValues) { + var itemList = []; + + if (Array.isArray(inputValues)) { + inputValues.forEach(function (value) { + + var item = {}; + + if ((typeof value === 'undefined' ? 'undefined' : _typeof(value)) === "object") { + item.title = editorParams.listItemFormatter ? editorParams.listItemFormatter(value.value, value.label) : value.label; + item.value = value.value; + } else { + item.title = editorParams.listItemFormatter ? editorParams.listItemFormatter(value, value) : value; + item.value = value; + } + + itemList.push(item); + }); + } else { + for (var key in inputValues) { + var item = { + title: editorParams.listItemFormatter ? editorParams.listItemFormatter(key, inputValues[key]) : inputValues[key], + value: key + }; + + itemList.push(item); + } + } + + return itemList; + } + + function clearList() { + while (listEl.firstChild) { + listEl.removeChild(listEl.firstChild); + } + } + + function fillListIfNotEmpty(items, intialLoad) { + if (items.length) { + fillList(items, intialLoad); + } else { + if (editorParams.emptyPlaceholder) { + addNotice(editorParams.emptyPlaceholder); + } + } + } + + function fillList(items, intialLoad) { + var current = false; + + clearList(); + + displayItems = items; + + displayItems.forEach(function (item) { + var el = item.element; + + if (!el) { + el = document.createElement("div"); + el.classList.add("tabulator-edit-select-list-item"); + el.tabIndex = 0; + el.innerHTML = item.title; + + el.addEventListener("click", function (e) { + setCurrentItem(item); + chooseItem(); + }); + + el.addEventListener("mousedown", function (e) { + blurable = false; + + setTimeout(function () { + blurable = true; + }, 10); + }); + + item.element = el; + + if (intialLoad && item.value == initialValue) { + input.value = item.title; + item.element.classList.add("active"); + current = true; + } + + if (item === currentItem) { + item.element.classList.add("active"); + current = true; + } + } + + listEl.appendChild(el); + }); + + if (!current) { + setCurrentItem(false); + } + } + + function chooseItem() { + hideList(); + + if (currentItem) { + if (initialValue !== currentItem.value) { + initialValue = currentItem.value; + input.value = currentItem.title; + success(currentItem.value); + } else { + cancel(); + } + } else { + if (editorParams.freetext) { + initialValue = input.value; + success(input.value); + } else { + if (editorParams.allowEmpty && input.value === "") { + initialValue = input.value; + success(input.value); + } else { + cancel(); + } + } + } + } + + function showList() { + if (!listEl.parentNode) { + while (listEl.firstChild) { + listEl.removeChild(listEl.firstChild); + }var offset = Tabulator.prototype.helpers.elOffset(cellEl); + + listEl.style.minWidth = cellEl.offsetWidth + "px"; + + listEl.style.top = offset.top + cellEl.offsetHeight + "px"; + listEl.style.left = offset.left + "px"; + document.body.appendChild(listEl); + } + } + + function setCurrentItem(item, showInputValue) { + if (currentItem && currentItem.element) { + currentItem.element.classList.remove("active"); + } + + currentItem = item; + + if (item && item.element) { + item.element.classList.add("active"); + } + + if (item && item.element && item.element.scrollIntoView) { + item.element.scrollIntoView({ behavior: 'smooth', block: 'nearest', inline: 'start' }); + } + } + + function hideList() { + if (listEl.parentNode) { + listEl.parentNode.removeChild(listEl); + } + + removeScrollListener(); + } + + function cancelItem() { + hideList(); + cancel(); + } + + function removeScrollListener() { + self.table.rowManager.element.removeEventListener("scroll", cancelItem); + } + + //allow key based navigation + input.addEventListener("keydown", function (e) { + var index; + + switch (e.keyCode) { + case 38: + //up arrow + index = displayItems.indexOf(currentItem); + + if (vertNav == "editor" || vertNav == "hybrid" && index) { + e.stopImmediatePropagation(); + e.stopPropagation(); + e.preventDefault(); + + if (index > 0) { + setCurrentItem(displayItems[index - 1]); + } else { + setCurrentItem(false); + } + } + break; + + case 40: + //down arrow + + index = displayItems.indexOf(currentItem); + + if (vertNav == "editor" || vertNav == "hybrid" && index < displayItems.length - 1) { + + e.stopImmediatePropagation(); + e.stopPropagation(); + e.preventDefault(); + + if (index < displayItems.length - 1) { + if (index == -1) { + setCurrentItem(displayItems[0]); + } else { + setCurrentItem(displayItems[index + 1]); + } + } + } + break; + + case 37: //left arrow + case 39: + //right arrow + e.stopImmediatePropagation(); + e.stopPropagation(); + // e.preventDefault(); + break; + + case 13: + //enter + chooseItem(); + break; + + case 27: + //escape + cancelItem(); + break; + + case 36: //home + case 35: + //end + //prevent table navigation while using input element + e.stopImmediatePropagation(); + break; + } + }); + + input.addEventListener("keyup", function (e) { + + switch (e.keyCode) { + case 38: //up arrow + case 37: //left arrow + case 39: //up arrow + case 40: //right arrow + case 13: //enter + case 27: + //escape + break; + + default: + filterList(input.value); + } + }); + + input.addEventListener("search", function (e) { + filterList(input.value); + }); + + input.addEventListener("blur", function (e) { + if (blurable) { + chooseItem(); + } + }); + + input.addEventListener("focus", function (e) { + var value = initialDisplayValue; + genUniqueColumnValues(); + showList(); + input.value = value; + filterList(value, true); + }); + + onRendered(function () { + input.style.height = "100%"; + input.focus({ preventScroll: true }); + }); + + if (editorParams.mask) { + this.table.modules.edit.maskInput(input, editorParams); + } + + setTimeout(function () { + _this54.table.rowManager.element.addEventListener("scroll", cancelItem); + }, 10); + + genUniqueColumnValues(); + input.value = initialDisplayValue; + filterList(initialDisplayValue, true); + + return input; + }, + + //star rating + star: function star(cell, onRendered, success, cancel, editorParams) { + var self = this, + element = cell.getElement(), + value = cell.getValue(), + maxStars = element.getElementsByTagName("svg").length || 5, + size = element.getElementsByTagName("svg")[0] ? element.getElementsByTagName("svg")[0].getAttribute("width") : 14, + stars = [], + starsHolder = document.createElement("div"), + star = document.createElementNS('http://www.w3.org/2000/svg', "svg"); + + //change star type + function starChange(val) { + stars.forEach(function (star, i) { + if (i < val) { + if (self.table.browser == "ie") { + star.setAttribute("class", "tabulator-star-active"); + } else { + star.classList.replace("tabulator-star-inactive", "tabulator-star-active"); + } + + star.innerHTML = ''; + } else { + if (self.table.browser == "ie") { + star.setAttribute("class", "tabulator-star-inactive"); + } else { + star.classList.replace("tabulator-star-active", "tabulator-star-inactive"); + } + + star.innerHTML = ''; + } + }); + } + + //build stars + function buildStar(i) { + + var starHolder = document.createElement("span"); + var nextStar = star.cloneNode(true); + + stars.push(nextStar); + + starHolder.addEventListener("mouseenter", function (e) { + e.stopPropagation(); + e.stopImmediatePropagation(); + starChange(i); + }); + + starHolder.addEventListener("mousemove", function (e) { + e.stopPropagation(); + e.stopImmediatePropagation(); + }); + + starHolder.addEventListener("click", function (e) { + e.stopPropagation(); + e.stopImmediatePropagation(); + success(i); + element.blur(); + }); + + starHolder.appendChild(nextStar); + starsHolder.appendChild(starHolder); + } + + //handle keyboard navigation value change + function changeValue(val) { + value = val; + starChange(val); + } + + //style cell + element.style.whiteSpace = "nowrap"; + element.style.overflow = "hidden"; + element.style.textOverflow = "ellipsis"; + + //style holding element + starsHolder.style.verticalAlign = "middle"; + starsHolder.style.display = "inline-block"; + starsHolder.style.padding = "4px"; + + //style star + star.setAttribute("width", size); + star.setAttribute("height", size); + star.setAttribute("viewBox", "0 0 512 512"); + star.setAttribute("xml:space", "preserve"); + star.style.padding = "0 1px"; + + if (editorParams.elementAttributes && _typeof(editorParams.elementAttributes) == "object") { + for (var key in editorParams.elementAttributes) { + if (key.charAt(0) == "+") { + key = key.slice(1); + starsHolder.setAttribute(key, starsHolder.getAttribute(key) + editorParams.elementAttributes["+" + key]); + } else { + starsHolder.setAttribute(key, editorParams.elementAttributes[key]); + } + } + } + + //create correct number of stars + for (var i = 1; i <= maxStars; i++) { + buildStar(i); + } + + //ensure value does not exceed number of stars + value = Math.min(parseInt(value), maxStars); + + // set initial styling of stars + starChange(value); + + starsHolder.addEventListener("mousemove", function (e) { + starChange(0); + }); + + starsHolder.addEventListener("click", function (e) { + success(0); + }); + + element.addEventListener("blur", function (e) { + cancel(); + }); + + //allow key based navigation + element.addEventListener("keydown", function (e) { + switch (e.keyCode) { + case 39: + //right arrow + changeValue(value + 1); + break; + + case 37: + //left arrow + changeValue(value - 1); + break; + + case 13: + //enter + success(value); + break; + + case 27: + //escape + cancel(); + break; + } + }); + + return starsHolder; + }, + + //draggable progress bar + progress: function progress(cell, onRendered, success, cancel, editorParams) { + var element = cell.getElement(), + max = typeof editorParams.max === "undefined" ? element.getElementsByTagName("div")[0].getAttribute("max") || 100 : editorParams.max, + min = typeof editorParams.min === "undefined" ? element.getElementsByTagName("div")[0].getAttribute("min") || 0 : editorParams.min, + percent = (max - min) / 100, + value = cell.getValue() || 0, + handle = document.createElement("div"), + bar = document.createElement("div"), + mouseDrag, + mouseDragWidth; + + //set new value + function updateValue() { + var calcVal = percent * Math.round(bar.offsetWidth / (element.clientWidth / 100)) + min; + success(calcVal); + element.setAttribute("aria-valuenow", calcVal); + element.setAttribute("aria-label", value); + } + + //style handle + handle.style.position = "absolute"; + handle.style.right = "0"; + handle.style.top = "0"; + handle.style.bottom = "0"; + handle.style.width = "5px"; + handle.classList.add("tabulator-progress-handle"); + + //style bar + bar.style.display = "inline-block"; + bar.style.position = "relative"; + // bar.style.top = "8px"; + // bar.style.bottom = "8px"; + // bar.style.left = "4px"; + // bar.style.marginRight = "4px"; + bar.style.height = "100%"; + bar.style.backgroundColor = "#488CE9"; + bar.style.maxWidth = "100%"; + bar.style.minWidth = "0%"; + + if (editorParams.elementAttributes && _typeof(editorParams.elementAttributes) == "object") { + for (var key in editorParams.elementAttributes) { + if (key.charAt(0) == "+") { + key = key.slice(1); + bar.setAttribute(key, bar.getAttribute(key) + editorParams.elementAttributes["+" + key]); + } else { + bar.setAttribute(key, editorParams.elementAttributes[key]); + } + } + } + + //style cell + element.style.padding = "4px 4px"; + + //make sure value is in range + value = Math.min(parseFloat(value), max); + value = Math.max(parseFloat(value), min); + + //workout percentage + value = Math.round((value - min) / percent); + // bar.style.right = value + "%"; + bar.style.width = value + "%"; + + element.setAttribute("aria-valuemin", min); + element.setAttribute("aria-valuemax", max); + + bar.appendChild(handle); + + handle.addEventListener("mousedown", function (e) { + mouseDrag = e.screenX; + mouseDragWidth = bar.offsetWidth; + }); + + handle.addEventListener("mouseover", function () { + handle.style.cursor = "ew-resize"; + }); + + element.addEventListener("mousemove", function (e) { + if (mouseDrag) { + bar.style.width = mouseDragWidth + e.screenX - mouseDrag + "px"; + } + }); + + element.addEventListener("mouseup", function (e) { + if (mouseDrag) { + e.stopPropagation(); + e.stopImmediatePropagation(); + + mouseDrag = false; + mouseDragWidth = false; + + updateValue(); + } + }); + + //allow key based navigation + element.addEventListener("keydown", function (e) { + switch (e.keyCode) { + case 39: + //right arrow + e.preventDefault(); + bar.style.width = bar.clientWidth + element.clientWidth / 100 + "px"; + break; + + case 37: + //left arrow + e.preventDefault(); + bar.style.width = bar.clientWidth - element.clientWidth / 100 + "px"; + break; + + case 9: //tab + case 13: + //enter + updateValue(); + break; + + case 27: + //escape + cancel(); + break; + + } + }); + + element.addEventListener("blur", function () { + cancel(); + }); + + return bar; + }, + + //checkbox + tickCross: function tickCross(cell, onRendered, success, cancel, editorParams) { + var value = cell.getValue(), + input = document.createElement("input"), + tristate = editorParams.tristate, + indetermValue = typeof editorParams.indeterminateValue === "undefined" ? null : editorParams.indeterminateValue, + indetermState = false; + + input.setAttribute("type", "checkbox"); + input.style.marginTop = "5px"; + input.style.boxSizing = "border-box"; + + if (editorParams.elementAttributes && _typeof(editorParams.elementAttributes) == "object") { + for (var key in editorParams.elementAttributes) { + if (key.charAt(0) == "+") { + key = key.slice(1); + input.setAttribute(key, input.getAttribute(key) + editorParams.elementAttributes["+" + key]); + } else { + input.setAttribute(key, editorParams.elementAttributes[key]); + } + } + } + + input.value = value; + + if (tristate && (typeof value === "undefined" || value === indetermValue || value === "")) { + indetermState = true; + input.indeterminate = true; + } + + if (this.table.browser != "firefox") { + //prevent blur issue on mac firefox + onRendered(function () { + input.focus({ preventScroll: true }); + }); + } + + input.checked = value === true || value === "true" || value === "True" || value === 1; + + onRendered(function () { + input.focus(); + }); + + function setValue(blur) { + if (tristate) { + if (!blur) { + if (input.checked && !indetermState) { + input.checked = false; + input.indeterminate = true; + indetermState = true; + return indetermValue; + } else { + indetermState = false; + return input.checked; + } + } else { + if (indetermState) { + return indetermValue; + } else { + return input.checked; + } + } + } else { + return input.checked; + } + } + + //submit new value on blur + input.addEventListener("change", function (e) { + success(setValue()); + }); + + input.addEventListener("blur", function (e) { + success(setValue(true)); + }); + + //submit new value on enter + input.addEventListener("keydown", function (e) { + if (e.keyCode == 13) { + success(setValue()); + } + if (e.keyCode == 27) { + cancel(); + } + }); + + return input; + } + }; + + Tabulator.prototype.registerModule("edit", Edit); + + var ExportRow = function ExportRow(type, columns, component, indent) { + this.type = type; + this.columns = columns; + this.component = component || false; + this.indent = indent || 0; + }; + + var ExportColumn = function ExportColumn(value, component, width, height, depth) { + this.value = value; + this.component = component || false; + this.width = width; + this.height = height; + this.depth = depth; + }; + + var Export = function Export(table) { + this.table = table; //hold Tabulator object + this.config = {}; + this.cloneTableStyle = true; + this.colVisProp = ""; + }; + + Export.prototype.generateExportList = function (config, style, range, colVisProp) { + this.cloneTableStyle = style; + this.config = config || {}; + this.colVisProp = colVisProp; + + var headers = this.config.columnHeaders !== false ? this.headersToExportRows(this.generateColumnGroupHeaders()) : []; + var body = this.bodyToExportRows(this.rowLookup(range)); + + return headers.concat(body); + }; + + Export.prototype.genereateTable = function (config, style, range, colVisProp) { + var list = this.generateExportList(config, style, range, colVisProp); + + return this.genereateTableElement(list); + }; + + Export.prototype.rowLookup = function (range) { + var _this55 = this; + + var rows = []; + + if (typeof range == "function") { + range.call(this.table).forEach(function (row) { + row = _this55.table.rowManager.findRow(row); + + if (row) { + rows.push(row); + } + }); + } else { + switch (range) { + case true: + case "visible": + rows = this.table.rowManager.getVisibleRows(true); + break; + + case "all": + rows = this.table.rowManager.rows; + break; + + case "selected": + rows = this.table.modules.selectRow.selectedRows; + break; + + case "active": + default: + if (this.table.options.pagination) { + rows = this.table.rowManager.getDisplayRows(this.table.rowManager.displayRows.length - 2); + } else { + rows = this.table.rowManager.getDisplayRows(); + } + } + } + + return Object.assign([], rows); + }; + + Export.prototype.generateColumnGroupHeaders = function () { + var _this56 = this; + + var output = []; + + var columns = this.config.columnGroups !== false ? this.table.columnManager.columns : this.table.columnManager.columnsByIndex; + + columns.forEach(function (column) { + var colData = _this56.processColumnGroup(column); + + if (colData) { + output.push(colData); + } + }); + + return output; + }; + + Export.prototype.processColumnGroup = function (column) { + var _this57 = this; + + var subGroups = column.columns, + maxDepth = 0, + title = column.definition["title" + (this.colVisProp.charAt(0).toUpperCase() + this.colVisProp.slice(1))] || column.definition.title; + + var groupData = { + title: title, + column: column, + depth: 1 + }; + + if (subGroups.length) { + groupData.subGroups = []; + groupData.width = 0; + + subGroups.forEach(function (subGroup) { + var subGroupData = _this57.processColumnGroup(subGroup); + + if (subGroupData) { + groupData.width += subGroupData.width; + groupData.subGroups.push(subGroupData); + + if (subGroupData.depth > maxDepth) { + maxDepth = subGroupData.depth; + } + } + }); + + groupData.depth += maxDepth; + + if (!groupData.width) { + return false; + } + } else { + if (this.columnVisCheck(column)) { + groupData.width = 1; + } else { + return false; + } + } + + return groupData; + }; + + Export.prototype.columnVisCheck = function (column) { + return column.definition[this.colVisProp] !== false && (column.visible || !column.visible && column.definition[this.colVisProp]); + }; + + Export.prototype.headersToExportRows = function (columns) { + var headers = [], + headerDepth = 0, + exportRows = []; + + function parseColumnGroup(column, level) { + + var depth = headerDepth - level; + + if (typeof headers[level] === "undefined") { + headers[level] = []; + } + + column.height = column.subGroups ? 1 : depth - column.depth + 1; + + headers[level].push(column); + + if (column.height > 1) { + for (var _i10 = 1; _i10 < column.height; _i10++) { + + if (typeof headers[level + _i10] === "undefined") { + headers[level + _i10] = []; + } + + headers[level + _i10].push(false); + } + } + + if (column.width > 1) { + for (var _i11 = 1; _i11 < column.width; _i11++) { + headers[level].push(false); + } + } + + if (column.subGroups) { + column.subGroups.forEach(function (subGroup) { + parseColumnGroup(subGroup, level + 1); + }); + } + } + + //calculate maximum header debth + columns.forEach(function (column) { + if (column.depth > headerDepth) { + headerDepth = column.depth; + } + }); + + columns.forEach(function (column) { + parseColumnGroup(column, 0); + }); + + headers.forEach(function (header) { + var columns = []; + + header.forEach(function (col) { + if (col) { + columns.push(new ExportColumn(col.title, col.column.getComponent(), col.width, col.height, col.depth)); + } else { + columns.push(null); + } + }); + + exportRows.push(new ExportRow("header", columns)); + }); + + return exportRows; + }; + + Export.prototype.bodyToExportRows = function (rows) { + var _this58 = this; + + var columns = []; + var exportRows = []; + + this.table.columnManager.columnsByIndex.forEach(function (column) { + if (_this58.columnVisCheck(column)) { + columns.push(column.getComponent()); + } + }); + + if (this.config.columnCalcs !== false && this.table.modExists("columnCalcs")) { + if (this.table.modules.columnCalcs.topInitialized) { + rows.unshift(this.table.modules.columnCalcs.topRow); + } + + if (this.table.modules.columnCalcs.botInitialized) { + rows.push(this.table.modules.columnCalcs.botRow); + } + } + + rows = rows.filter(function (row) { + switch (row.type) { + case "group": + return _this58.config.rowGroups !== false; + break; + + case "calc": + return _this58.config.columnCalcs !== false; + break; + + case "row": + return !(_this58.table.options.dataTree && _this58.config.dataTree === false && row.modules.dataTree.parent); + break; + } + + return true; + }); + + rows.forEach(function (row, i) { + var rowData = row.getData(_this58.colVisProp); + var exportCols = []; + var indent = 0; + + switch (row.type) { + case "group": + indent = row.level; + exportCols.push(new ExportColumn(row.key, row.getComponent(), columns.length, 1)); + break; + + case "calc": + case "row": + columns.forEach(function (col) { + exportCols.push(new ExportColumn(col._column.getFieldValue(rowData), col, 1, 1)); + }); + + if (_this58.table.options.dataTree && _this58.config.dataTree !== false) { + indent = row.modules.dataTree.index; + } + break; + } + + exportRows.push(new ExportRow(row.type, exportCols, row.getComponent(), indent)); + }); + + return exportRows; + }; + + Export.prototype.genereateTableElement = function (list) { + var _this59 = this; + + var table = document.createElement("table"), + headerEl = document.createElement("thead"), + bodyEl = document.createElement("tbody"), + styles = this.lookupTableStyles(), + rowFormatter = this.table.options["rowFormatter" + (this.colVisProp.charAt(0).toUpperCase() + this.colVisProp.slice(1))], + setup = {}; + + setup.rowFormatter = rowFormatter !== null ? rowFormatter : this.table.options.rowFormatter; + + if (this.table.options.dataTree && this.config.dataTree !== false && this.table.modExists("columnCalcs")) { + setup.treeElementField = this.table.modules.dataTree.elementField; + } + + //assign group header formatter + setup.groupHeader = this.table.options["groupHeader" + (this.colVisProp.charAt(0).toUpperCase() + this.colVisProp.slice(1))]; + + if (setup.groupHeader && !Array.isArray(setup.groupHeader)) { + setup.groupHeader = [setup.groupHeader]; + } + + table.classList.add("tabulator-print-table"); + + this.mapElementStyles(this.table.columnManager.getHeadersElement(), headerEl, ["border-top", "border-left", "border-right", "border-bottom", "background-color", "color", "font-weight", "font-family", "font-size"]); + + if (list.length > 1000) { + console.warn("It may take a long time to render an HTML table with more than 1000 rows"); + } + + list.forEach(function (row, i) { + switch (row.type) { + case "header": + headerEl.appendChild(_this59.genereateHeaderElement(row, setup, styles)); + break; + + case "group": + bodyEl.appendChild(_this59.genereateGroupElement(row, setup, styles)); + break; + + case "calc": + bodyEl.appendChild(_this59.genereateCalcElement(row, setup, styles)); + break; + + case "row": + var rowEl = _this59.genereateRowElement(row, setup, styles); + _this59.mapElementStyles(i % 2 && styles.evenRow ? styles.evenRow : styles.oddRow, rowEl, ["border-top", "border-left", "border-right", "border-bottom", "color", "font-weight", "font-family", "font-size", "background-color"]); + bodyEl.appendChild(rowEl); + break; + } + }); + + if (headerEl.innerHTML) { + table.appendChild(headerEl); + } + + table.appendChild(bodyEl); + + this.mapElementStyles(this.table.element, table, ["border-top", "border-left", "border-right", "border-bottom"]); + return table; + }; + + Export.prototype.lookupTableStyles = function () { + var styles = {}; + + //lookup row styles + if (this.cloneTableStyle && window.getComputedStyle) { + styles.oddRow = this.table.element.querySelector(".tabulator-row-odd:not(.tabulator-group):not(.tabulator-calcs)"); + styles.evenRow = this.table.element.querySelector(".tabulator-row-even:not(.tabulator-group):not(.tabulator-calcs)"); + styles.calcRow = this.table.element.querySelector(".tabulator-row.tabulator-calcs"); + styles.firstRow = this.table.element.querySelector(".tabulator-row:not(.tabulator-group):not(.tabulator-calcs)"); + styles.firstGroup = this.table.element.getElementsByClassName("tabulator-group")[0]; + + if (styles.firstRow) { + styles.styleCells = styles.firstRow.getElementsByClassName("tabulator-cell"); + styles.firstCell = styles.styleCells[0]; + styles.lastCell = styles.styleCells[styles.styleCells.length - 1]; + } + } + + return styles; + }; + + Export.prototype.genereateHeaderElement = function (row, setup, styles) { + var _this60 = this; + + var rowEl = document.createElement("tr"); + + row.columns.forEach(function (column) { + if (column) { + var cellEl = document.createElement("th"); + var classNames = column.component._column.definition.cssClass ? column.component._column.definition.cssClass.split(" ") : []; + + cellEl.colSpan = column.width; + cellEl.rowSpan = column.height; + + cellEl.innerHTML = column.value; + + if (_this60.cloneTableStyle) { + cellEl.style.boxSizing = "border-box"; + } + + classNames.forEach(function (className) { + cellEl.classList.add(className); + }); + + _this60.mapElementStyles(column.component.getElement(), cellEl, ["text-align", "border-top", "border-left", "border-right", "border-bottom", "background-color", "color", "font-weight", "font-family", "font-size"]); + _this60.mapElementStyles(column.component._column.contentElement, cellEl, ["padding-top", "padding-left", "padding-right", "padding-bottom"]); + + if (column.component._column.visible) { + _this60.mapElementStyles(column.component.getElement(), cellEl, ["width"]); + } else { + if (column.component._column.definition.width) { + cellEl.style.width = column.component._column.definition.width + "px"; + } + } + + if (column.component._column.parent) { + _this60.mapElementStyles(column.component._column.parent.groupElement, cellEl, ["border-top"]); + } + + rowEl.appendChild(cellEl); + } + }); + + return rowEl; + }; + + Export.prototype.genereateGroupElement = function (row, setup, styles) { + + var rowEl = document.createElement("tr"), + cellEl = document.createElement("td"), + group = row.columns[0]; + + rowEl.classList.add("tabulator-print-table-row"); + + if (setup.groupHeader && setup.groupHeader[row.indent]) { + group.value = setup.groupHeader[row.indent](group.value, row.component._group.getRowCount(), row.component._group.getData(), row.component); + } else { + if (setup.groupHeader === false) { + group.value = group.value; + } else { + group.value = row.component._group.generator(group.value, row.component._group.getRowCount(), row.component._group.getData(), row.component); + } + } + + cellEl.colSpan = group.width; + cellEl.innerHTML = group.value; + + rowEl.classList.add("tabulator-print-table-group"); + rowEl.classList.add("tabulator-group-level-" + row.indent); + + if (group.component.isVisible()) { + rowEl.classList.add("tabulator-group-visible"); + } + + this.mapElementStyles(styles.firstGroup, rowEl, ["border-top", "border-left", "border-right", "border-bottom", "color", "font-weight", "font-family", "font-size", "background-color"]); + this.mapElementStyles(styles.firstGroup, cellEl, ["padding-top", "padding-left", "padding-right", "padding-bottom"]); + + rowEl.appendChild(cellEl); + + return rowEl; + }; + + Export.prototype.genereateCalcElement = function (row, setup, styles) { + var rowEl = this.genereateRowElement(row, setup, styles); + + rowEl.classList.add("tabulator-print-table-calcs"); + this.mapElementStyles(styles.calcRow, rowEl, ["border-top", "border-left", "border-right", "border-bottom", "color", "font-weight", "font-family", "font-size", "background-color"]); + + return rowEl; + }; + + Export.prototype.genereateRowElement = function (row, setup, styles) { + var _this61 = this; + + var rowEl = document.createElement("tr"); + + rowEl.classList.add("tabulator-print-table-row"); + + row.columns.forEach(function (col) { + + if (col) { + var cellEl = document.createElement("td"), + column = col.component._column, + value = col.value; + + var cellWrapper = { + modules: {}, + getValue: function getValue() { + return value; + }, + getField: function getField() { + return column.definition.field; + }, + getElement: function getElement() { + return cellEl; + }, + getColumn: function getColumn() { + return column.getComponent(); + }, + getData: function getData() { + return row.component.getData(); + }, + getRow: function getRow() { + return row.component; + }, + getComponent: function getComponent() { + return cellWrapper; + }, + column: column + }; + + var classNames = column.definition.cssClass ? column.definition.cssClass.split(" ") : []; + + classNames.forEach(function (className) { + cellEl.classList.add(className); + }); + + if (_this61.table.modExists("format") && _this61.config.formatCells !== false) { + value = _this61.table.modules.format.formatExportValue(cellWrapper, _this61.colVisProp); + } else { + switch (typeof value === 'undefined' ? 'undefined' : _typeof(value)) { + case "object": + value = JSON.stringify(value); + break; + + case "undefined": + case "null": + value = ""; + break; + + default: + value = value; + } + } + + if (value instanceof Node) { + cellEl.appendChild(value); + } else { + cellEl.innerHTML = value; + } + + if (styles.firstCell) { + _this61.mapElementStyles(styles.firstCell, cellEl, ["padding-top", "padding-left", "padding-right", "padding-bottom", "border-top", "border-left", "border-right", "border-bottom", "color", "font-weight", "font-family", "font-size"]); + + if (column.definition.align) { + cellEl.style.textAlign = column.definition.align; + } + } + + if (_this61.table.options.dataTree && _this61.config.dataTree !== false) { + if (setup.treeElementField && setup.treeElementField == column.field || !setup.treeElementField && i == 0) { + if (row.component._row.modules.dataTree.controlEl) { + cellEl.insertBefore(row.component._row.modules.dataTree.controlEl.cloneNode(true), cellEl.firstChild); + } + if (row.component._row.modules.dataTree.branchEl) { + cellEl.insertBefore(row.component._row.modules.dataTree.branchEl.cloneNode(true), cellEl.firstChild); + } + } + } + + rowEl.appendChild(cellEl); + + if (cellWrapper.modules.format && cellWrapper.modules.format.renderedCallback) { + cellWrapper.modules.format.renderedCallback(); + } + + if (setup.rowFormatter && _this61.config.formatCells !== false) { + setup.rowFormatter(row.component); + } + } + }); + + return rowEl; + }; + + Export.prototype.genereateHTMLTable = function (list) { + var holder = document.createElement("div"); + + holder.appendChild(this.genereateTableElement(list)); + + return holder.innerHTML; + }; + + Export.prototype.getHtml = function (visible, style, config, colVisProp) { + var list = this.generateExportList(config || this.table.options.htmlOutputConfig, style, visible, colVisProp || "htmlOutput"); + + return this.genereateHTMLTable(list); + }; + + Export.prototype.mapElementStyles = function (from, to, props) { + if (this.cloneTableStyle && from && to) { + + var lookup = { + "background-color": "backgroundColor", + "color": "fontColor", + "width": "width", + "font-weight": "fontWeight", + "font-family": "fontFamily", + "font-size": "fontSize", + "text-align": "textAlign", + "border-top": "borderTop", + "border-left": "borderLeft", + "border-right": "borderRight", + "border-bottom": "borderBottom", + "padding-top": "paddingTop", + "padding-left": "paddingLeft", + "padding-right": "paddingRight", + "padding-bottom": "paddingBottom" + }; + + if (window.getComputedStyle) { + var fromStyle = window.getComputedStyle(from); + + props.forEach(function (prop) { + to.style[lookup[prop]] = fromStyle.getPropertyValue(prop); + }); + } + } + }; + + Tabulator.prototype.registerModule("export", Export); + + var Filter = function Filter(table) { + + this.table = table; //hold Tabulator object + + this.filterList = []; //hold filter list + this.headerFilters = {}; //hold column filters + this.headerFilterColumns = []; //hold columns that use header filters + + this.prevHeaderFilterChangeCheck = ""; + this.prevHeaderFilterChangeCheck = "{}"; + + this.changed = false; //has filtering changed since last render + }; + + //initialize column header filter + Filter.prototype.initializeColumn = function (column, value) { + var self = this, + field = column.getField(), + params; + + //handle successfull value change + function success(value) { + var filterType = column.modules.filter.tagType == "input" && column.modules.filter.attrType == "text" || column.modules.filter.tagType == "textarea" ? "partial" : "match", + type = "", + filterChangeCheck = "", + filterFunc; + + if (typeof column.modules.filter.prevSuccess === "undefined" || column.modules.filter.prevSuccess !== value) { + + column.modules.filter.prevSuccess = value; + + if (!column.modules.filter.emptyFunc(value)) { + column.modules.filter.value = value; + + switch (_typeof(column.definition.headerFilterFunc)) { + case "string": + if (self.filters[column.definition.headerFilterFunc]) { + type = column.definition.headerFilterFunc; + filterFunc = function filterFunc(data) { + var params = column.definition.headerFilterFuncParams || {}; + var fieldVal = column.getFieldValue(data); + + params = typeof params === "function" ? params(value, fieldVal, data) : params; + + return self.filters[column.definition.headerFilterFunc](value, fieldVal, data, params); + }; + } else { + console.warn("Header Filter Error - Matching filter function not found: ", column.definition.headerFilterFunc); + } + break; + + case "function": + filterFunc = function filterFunc(data) { + var params = column.definition.headerFilterFuncParams || {}; + var fieldVal = column.getFieldValue(data); + + params = typeof params === "function" ? params(value, fieldVal, data) : params; + + return column.definition.headerFilterFunc(value, fieldVal, data, params); + }; + + type = filterFunc; + break; + } + + if (!filterFunc) { + switch (filterType) { + case "partial": + filterFunc = function filterFunc(data) { + var colVal = column.getFieldValue(data); + + if (typeof colVal !== 'undefined' && colVal !== null) { + return String(colVal).toLowerCase().indexOf(String(value).toLowerCase()) > -1; + } else { + return false; + } + }; + type = "like"; + break; + + default: + filterFunc = function filterFunc(data) { + return column.getFieldValue(data) == value; + }; + type = "="; + } + } + + self.headerFilters[field] = { value: value, func: filterFunc, type: type, params: params || {} }; + } else { + delete self.headerFilters[field]; + } + + filterChangeCheck = JSON.stringify(self.headerFilters); + + if (self.prevHeaderFilterChangeCheck !== filterChangeCheck) { + self.prevHeaderFilterChangeCheck = filterChangeCheck; + + self.changed = true; + self.table.rowManager.filterRefresh(); + } + } + + return true; + } + + column.modules.filter = { + success: success, + attrType: false, + tagType: false, + emptyFunc: false + }; + + this.generateHeaderFilterElement(column); + }; + + Filter.prototype.generateHeaderFilterElement = function (column, initialValue, reinitialize) { + var _this62 = this; + + var self = this, + success = column.modules.filter.success, + field = column.getField(), + filterElement, + editor, + editorElement, + cellWrapper, + typingTimer, + searchTrigger, + params; + + //handle aborted edit + function cancel() {} + + if (column.modules.filter.headerElement && column.modules.filter.headerElement.parentNode) { + column.contentElement.removeChild(column.modules.filter.headerElement.parentNode); + } + + if (field) { + + //set empty value function + column.modules.filter.emptyFunc = column.definition.headerFilterEmptyCheck || function (value) { + return !value && value !== "0"; + }; + + filterElement = document.createElement("div"); + filterElement.classList.add("tabulator-header-filter"); + + //set column editor + switch (_typeof(column.definition.headerFilter)) { + case "string": + if (self.table.modules.edit.editors[column.definition.headerFilter]) { + editor = self.table.modules.edit.editors[column.definition.headerFilter]; + + if ((column.definition.headerFilter === "tick" || column.definition.headerFilter === "tickCross") && !column.definition.headerFilterEmptyCheck) { + column.modules.filter.emptyFunc = function (value) { + return value !== true && value !== false; + }; + } + } else { + console.warn("Filter Error - Cannot build header filter, No such editor found: ", column.definition.editor); + } + break; + + case "function": + editor = column.definition.headerFilter; + break; + + case "boolean": + if (column.modules.edit && column.modules.edit.editor) { + editor = column.modules.edit.editor; + } else { + if (column.definition.formatter && self.table.modules.edit.editors[column.definition.formatter]) { + editor = self.table.modules.edit.editors[column.definition.formatter]; + + if ((column.definition.formatter === "tick" || column.definition.formatter === "tickCross") && !column.definition.headerFilterEmptyCheck) { + column.modules.filter.emptyFunc = function (value) { + return value !== true && value !== false; + }; + } + } else { + editor = self.table.modules.edit.editors["input"]; + } + } + break; + } + + if (editor) { + + cellWrapper = { + getValue: function getValue() { + return typeof initialValue !== "undefined" ? initialValue : ""; + }, + getField: function getField() { + return column.definition.field; + }, + getElement: function getElement() { + return filterElement; + }, + getColumn: function getColumn() { + return column.getComponent(); + }, + getRow: function getRow() { + return { + normalizeHeight: function normalizeHeight() {} + }; + } + }; + + params = column.definition.headerFilterParams || {}; + + params = typeof params === "function" ? params.call(self.table) : params; + + editorElement = editor.call(this.table.modules.edit, cellWrapper, function () {}, success, cancel, params); + + if (!editorElement) { + console.warn("Filter Error - Cannot add filter to " + field + " column, editor returned a value of false"); + return; + } + + if (!(editorElement instanceof Node)) { + console.warn("Filter Error - Cannot add filter to " + field + " column, editor should return an instance of Node, the editor returned:", editorElement); + return; + } + + //set Placeholder Text + if (field) { + self.table.modules.localize.bind("headerFilters|columns|" + column.definition.field, function (value) { + editorElement.setAttribute("placeholder", typeof value !== "undefined" && value ? value : self.table.modules.localize.getText("headerFilters|default")); + }); + } else { + self.table.modules.localize.bind("headerFilters|default", function (value) { + editorElement.setAttribute("placeholder", typeof self.column.definition.headerFilterPlaceholder !== "undefined" && self.column.definition.headerFilterPlaceholder ? self.column.definition.headerFilterPlaceholder : value); + }); + } + + //focus on element on click + editorElement.addEventListener("click", function (e) { + e.stopPropagation(); + editorElement.focus(); + }); + + editorElement.addEventListener("focus", function (e) { + var left = _this62.table.columnManager.element.scrollLeft; + + if (left !== _this62.table.rowManager.element.scrollLeft) { + _this62.table.rowManager.scrollHorizontal(left); + _this62.table.columnManager.scrollHorizontal(left); + } + }); + + //live update filters as user types + typingTimer = false; + + searchTrigger = function searchTrigger(e) { + if (typingTimer) { + clearTimeout(typingTimer); + } + + typingTimer = setTimeout(function () { + success(editorElement.value); + }, self.table.options.headerFilterLiveFilterDelay); + }; + + column.modules.filter.headerElement = editorElement; + column.modules.filter.attrType = editorElement.hasAttribute("type") ? editorElement.getAttribute("type").toLowerCase() : ""; + column.modules.filter.tagType = editorElement.tagName.toLowerCase(); + + if (column.definition.headerFilterLiveFilter !== false) { + + if (!(column.definition.headerFilter === 'autocomplete' || column.definition.headerFilter === 'tickCross' || (column.definition.editor === 'autocomplete' || column.definition.editor === 'tickCross') && column.definition.headerFilter === true)) { + editorElement.addEventListener("keyup", searchTrigger); + editorElement.addEventListener("search", searchTrigger); + + //update number filtered columns on change + if (column.modules.filter.attrType == "number") { + editorElement.addEventListener("change", function (e) { + success(editorElement.value); + }); + } + + //change text inputs to search inputs to allow for clearing of field + if (column.modules.filter.attrType == "text" && this.table.browser !== "ie") { + editorElement.setAttribute("type", "search"); + // editorElement.off("change blur"); //prevent blur from triggering filter and preventing selection click + } + } + + //prevent input and select elements from propegating click to column sorters etc + if (column.modules.filter.tagType == "input" || column.modules.filter.tagType == "select" || column.modules.filter.tagType == "textarea") { + editorElement.addEventListener("mousedown", function (e) { + e.stopPropagation(); + }); + } + } + + filterElement.appendChild(editorElement); + + column.contentElement.appendChild(filterElement); + + if (!reinitialize) { + self.headerFilterColumns.push(column); + } + } + } else { + console.warn("Filter Error - Cannot add header filter, column has no field set:", column.definition.title); + } + }; + + //hide all header filter elements (used to ensure correct column widths in "fitData" layout mode) + Filter.prototype.hideHeaderFilterElements = function () { + this.headerFilterColumns.forEach(function (column) { + if (column.modules.filter && column.modules.filter.headerElement) { + column.modules.filter.headerElement.style.display = 'none'; + } + }); + }; + + //show all header filter elements (used to ensure correct column widths in "fitData" layout mode) + Filter.prototype.showHeaderFilterElements = function () { + this.headerFilterColumns.forEach(function (column) { + if (column.modules.filter && column.modules.filter.headerElement) { + column.modules.filter.headerElement.style.display = ''; + } + }); + }; + + //programatically set focus of header filter + Filter.prototype.setHeaderFilterFocus = function (column) { + if (column.modules.filter && column.modules.filter.headerElement) { + column.modules.filter.headerElement.focus(); + } else { + console.warn("Column Filter Focus Error - No header filter set on column:", column.getField()); + } + }; + + //programmatically get value of header filter + Filter.prototype.getHeaderFilterValue = function (column) { + if (column.modules.filter && column.modules.filter.headerElement) { + return column.modules.filter.headerElement.value; + } else { + console.warn("Column Filter Error - No header filter set on column:", column.getField()); + } + }; + + //programatically set value of header filter + Filter.prototype.setHeaderFilterValue = function (column, value) { + if (column) { + if (column.modules.filter && column.modules.filter.headerElement) { + this.generateHeaderFilterElement(column, value, true); + column.modules.filter.success(value); + } else { + console.warn("Column Filter Error - No header filter set on column:", column.getField()); + } + } + }; + + Filter.prototype.reloadHeaderFilter = function (column) { + if (column) { + if (column.modules.filter && column.modules.filter.headerElement) { + this.generateHeaderFilterElement(column, column.modules.filter.value, true); + } else { + console.warn("Column Filter Error - No header filter set on column:", column.getField()); + } + } + }; + + //check if the filters has changed since last use + Filter.prototype.hasChanged = function () { + var changed = this.changed; + this.changed = false; + return changed; + }; + + //set standard filters + Filter.prototype.setFilter = function (field, type, value, params) { + var self = this; + + self.filterList = []; + + if (!Array.isArray(field)) { + field = [{ field: field, type: type, value: value, params: params }]; + } + + self.addFilter(field); + }; + + //add filter to array + Filter.prototype.addFilter = function (field, type, value, params) { + var self = this; + + if (!Array.isArray(field)) { + field = [{ field: field, type: type, value: value, params: params }]; + } + + field.forEach(function (filter) { + + filter = self.findFilter(filter); + + if (filter) { + self.filterList.push(filter); + + self.changed = true; + } + }); + + if (this.table.options.persistence && this.table.modExists("persistence", true) && this.table.modules.persistence.config.filter) { + this.table.modules.persistence.save("filter"); + } + }; + + Filter.prototype.findFilter = function (filter) { + var self = this, + column; + + if (Array.isArray(filter)) { + return this.findSubFilters(filter); + } + + var filterFunc = false; + + if (typeof filter.field == "function") { + filterFunc = function filterFunc(data) { + return filter.field(data, filter.type || {}); // pass params to custom filter function + }; + } else { + + if (self.filters[filter.type]) { + + column = self.table.columnManager.getColumnByField(filter.field); + + if (column) { + filterFunc = function filterFunc(data) { + return self.filters[filter.type](filter.value, column.getFieldValue(data), data, filter.params || {}); + }; + } else { + filterFunc = function filterFunc(data) { + return self.filters[filter.type](filter.value, data[filter.field], data, filter.params || {}); + }; + } + } else { + console.warn("Filter Error - No such filter type found, ignoring: ", filter.type); + } + } + + filter.func = filterFunc; + + return filter.func ? filter : false; + }; + + Filter.prototype.findSubFilters = function (filters) { + var self = this, + output = []; + + filters.forEach(function (filter) { + filter = self.findFilter(filter); + + if (filter) { + output.push(filter); + } + }); + + return output.length ? output : false; + }; + + //get all filters + Filter.prototype.getFilters = function (all, ajax) { + var output = []; + + if (all) { + output = this.getHeaderFilters(); + } + + if (ajax) { + output.forEach(function (item) { + if (typeof item.type == "function") { + item.type = "function"; + } + }); + } + + output = output.concat(this.filtersToArray(this.filterList, ajax)); + + return output; + }; + + //filter to Object + Filter.prototype.filtersToArray = function (filterList, ajax) { + var _this63 = this; + + var output = []; + + filterList.forEach(function (filter) { + var item; + + if (Array.isArray(filter)) { + output.push(_this63.filtersToArray(filter, ajax)); + } else { + item = { field: filter.field, type: filter.type, value: filter.value }; + + if (ajax) { + if (typeof item.type == "function") { + item.type = "function"; + } + } + + output.push(item); + } + }); + + return output; + }; + + //get all filters + Filter.prototype.getHeaderFilters = function () { + var self = this, + output = []; + + for (var key in this.headerFilters) { + output.push({ field: key, type: this.headerFilters[key].type, value: this.headerFilters[key].value }); + } + + return output; + }; + + //remove filter from array + Filter.prototype.removeFilter = function (field, type, value) { + var self = this; + + if (!Array.isArray(field)) { + field = [{ field: field, type: type, value: value }]; + } + + field.forEach(function (filter) { + var index = -1; + + if (_typeof(filter.field) == "object") { + index = self.filterList.findIndex(function (element) { + return filter === element; + }); + } else { + index = self.filterList.findIndex(function (element) { + return filter.field === element.field && filter.type === element.type && filter.value === element.value; + }); + } + + if (index > -1) { + self.filterList.splice(index, 1); + self.changed = true; + } else { + console.warn("Filter Error - No matching filter type found, ignoring: ", filter.type); + } + }); + + if (this.table.options.persistence && this.table.modExists("persistence", true) && this.table.modules.persistence.config.filter) { + this.table.modules.persistence.save("filter"); + } + }; + + //clear filters + Filter.prototype.clearFilter = function (all) { + this.filterList = []; + + if (all) { + this.clearHeaderFilter(); + } + + this.changed = true; + + if (this.table.options.persistence && this.table.modExists("persistence", true) && this.table.modules.persistence.config.filter) { + this.table.modules.persistence.save("filter"); + } + }; + + //clear header filters + Filter.prototype.clearHeaderFilter = function () { + var self = this; + + this.headerFilters = {}; + self.prevHeaderFilterChangeCheck = "{}"; + + this.headerFilterColumns.forEach(function (column) { + column.modules.filter.value = null; + column.modules.filter.prevSuccess = undefined; + self.reloadHeaderFilter(column); + }); + + this.changed = true; + }; + + //search data and return matching rows + Filter.prototype.search = function (searchType, field, type, value) { + var self = this, + activeRows = [], + filterList = []; + + if (!Array.isArray(field)) { + field = [{ field: field, type: type, value: value }]; + } + + field.forEach(function (filter) { + filter = self.findFilter(filter); + + if (filter) { + filterList.push(filter); + } + }); + + this.table.rowManager.rows.forEach(function (row) { + var match = true; + + filterList.forEach(function (filter) { + if (!self.filterRecurse(filter, row.getData())) { + match = false; + } + }); + + if (match) { + activeRows.push(searchType === "data" ? row.getData("data") : row.getComponent()); + } + }); + + return activeRows; + }; + + //filter row array + Filter.prototype.filter = function (rowList, filters) { + var self = this, + activeRows = [], + activeRowComponents = []; + + if (self.table.options.dataFiltering) { + self.table.options.dataFiltering.call(self.table, self.getFilters()); + } + + if (!self.table.options.ajaxFiltering && (self.filterList.length || Object.keys(self.headerFilters).length)) { + + rowList.forEach(function (row) { + if (self.filterRow(row)) { + activeRows.push(row); + } + }); + } else { + activeRows = rowList.slice(0); + } + + if (self.table.options.dataFiltered) { + + activeRows.forEach(function (row) { + activeRowComponents.push(row.getComponent()); + }); + + self.table.options.dataFiltered.call(self.table, self.getFilters(), activeRowComponents); + } + + return activeRows; + }; + + //filter individual row + Filter.prototype.filterRow = function (row, filters) { + var self = this, + match = true, + data = row.getData(); + + self.filterList.forEach(function (filter) { + if (!self.filterRecurse(filter, data)) { + match = false; + } + }); + + for (var field in self.headerFilters) { + if (!self.headerFilters[field].func(data)) { + match = false; + } + } + + return match; + }; + + Filter.prototype.filterRecurse = function (filter, data) { + var self = this, + match = false; + + if (Array.isArray(filter)) { + filter.forEach(function (subFilter) { + if (self.filterRecurse(subFilter, data)) { + match = true; + } + }); + } else { + match = filter.func(data); + } + + return match; + }; + + //list of available filters + Filter.prototype.filters = { + + //equal to + "=": function _(filterVal, rowVal, rowData, filterParams) { + return rowVal == filterVal ? true : false; + }, + + //less than + "<": function _(filterVal, rowVal, rowData, filterParams) { + return rowVal < filterVal ? true : false; + }, + + //less than or equal to + "<=": function _(filterVal, rowVal, rowData, filterParams) { + return rowVal <= filterVal ? true : false; + }, + + //greater than + ">": function _(filterVal, rowVal, rowData, filterParams) { + return rowVal > filterVal ? true : false; + }, + + //greater than or equal to + ">=": function _(filterVal, rowVal, rowData, filterParams) { + return rowVal >= filterVal ? true : false; + }, + + //not equal to + "!=": function _(filterVal, rowVal, rowData, filterParams) { + return rowVal != filterVal ? true : false; + }, + + "regex": function regex(filterVal, rowVal, rowData, filterParams) { + + if (typeof filterVal == "string") { + filterVal = new RegExp(filterVal); + } + + return filterVal.test(rowVal); + }, + + //contains the string + "like": function like(filterVal, rowVal, rowData, filterParams) { + if (filterVal === null || typeof filterVal === "undefined") { + return rowVal === filterVal ? true : false; + } else { + if (typeof rowVal !== 'undefined' && rowVal !== null) { + return String(rowVal).toLowerCase().indexOf(filterVal.toLowerCase()) > -1; + } else { + return false; + } + } + }, + + //contains the keywords + "keywords": function keywords(filterVal, rowVal, rowData, filterParams) { + var keywords = filterVal.toLowerCase().split(typeof filterParams.separator === "undefined" ? " " : filterParams.separator), + value = String(rowVal === null || typeof rowVal === "undefined" ? "" : rowVal).toLowerCase(), + matches = []; + + keywords.forEach(function (keyword) { + if (value.includes(keyword)) { + matches.push(true); + } + }); + + return filterParams.matchAll ? matches.length === keywords.length : !!matches.length; + }, + + //starts with the string + "starts": function starts(filterVal, rowVal, rowData, filterParams) { + if (filterVal === null || typeof filterVal === "undefined") { + return rowVal === filterVal ? true : false; + } else { + if (typeof rowVal !== 'undefined' && rowVal !== null) { + return String(rowVal).toLowerCase().startsWith(filterVal.toLowerCase()); + } else { + return false; + } + } + }, + + //ends with the string + "ends": function ends(filterVal, rowVal, rowData, filterParams) { + if (filterVal === null || typeof filterVal === "undefined") { + return rowVal === filterVal ? true : false; + } else { + if (typeof rowVal !== 'undefined' && rowVal !== null) { + return String(rowVal).toLowerCase().endsWith(filterVal.toLowerCase()); + } else { + return false; + } + } + }, + + //in array + "in": function _in(filterVal, rowVal, rowData, filterParams) { + if (Array.isArray(filterVal)) { + return filterVal.length ? filterVal.indexOf(rowVal) > -1 : true; + } else { + console.warn("Filter Error - filter value is not an array:", filterVal); + return false; + } + } + }; + + Tabulator.prototype.registerModule("filter", Filter); + + var Format = function Format(table) { + this.table = table; //hold Tabulator object + }; + + //initialize column formatter + Format.prototype.initializeColumn = function (column) { + column.modules.format = this.lookupFormatter(column, ""); + + if (typeof column.definition.formatterPrint !== "undefined") { + column.modules.format.print = this.lookupFormatter(column, "Print"); + } + + if (typeof column.definition.formatterClipboard !== "undefined") { + column.modules.format.clipboard = this.lookupFormatter(column, "Clipboard"); + } + + if (typeof column.definition.formatterHtmlOutput !== "undefined") { + column.modules.format.htmlOutput = this.lookupFormatter(column, "HtmlOutput"); + } + }; + + Format.prototype.lookupFormatter = function (column, type) { + var config = { params: column.definition["formatter" + type + "Params"] || {} }, + formatter = column.definition["formatter" + type]; + + //set column formatter + switch (typeof formatter === 'undefined' ? 'undefined' : _typeof(formatter)) { + case "string": + + if (formatter === "tick") { + formatter = "tickCross"; + + if (typeof config.params.crossElement == "undefined") { + config.params.crossElement = false; + } + + console.warn("DEPRECATION WARNING - the tick formatter has been deprecated, please use the tickCross formatter with the crossElement param set to false"); + } + + if (this.formatters[formatter]) { + config.formatter = this.formatters[formatter]; + } else { + console.warn("Formatter Error - No such formatter found: ", formatter); + config.formatter = this.formatters.plaintext; + } + break; + + case "function": + config.formatter = formatter; + break; + + default: + config.formatter = this.formatters.plaintext; + break; + } + + return config; + }; + + Format.prototype.cellRendered = function (cell) { + if (cell.modules.format && cell.modules.format.renderedCallback && !cell.modules.format.rendered) { + cell.modules.format.renderedCallback(); + cell.modules.format.rendered = true; + } + }; + + //return a formatted value for a cell + Format.prototype.formatValue = function (cell) { + var component = cell.getComponent(), + params = typeof cell.column.modules.format.params === "function" ? cell.column.modules.format.params(component) : cell.column.modules.format.params; + + function onRendered(callback) { + if (!cell.modules.format) { + cell.modules.format = {}; + } + + cell.modules.format.renderedCallback = callback; + cell.modules.format.rendered = false; + } + + return cell.column.modules.format.formatter.call(this, component, params, onRendered); + }; + + Format.prototype.formatExportValue = function (cell, type) { + var formatter = cell.column.modules.format[type], + params; + + if (formatter) { + var onRendered = function onRendered(callback) { + if (!cell.modules.format) { + cell.modules.format = {}; + } + + cell.modules.format.renderedCallback = callback; + cell.modules.format.rendered = false; + }; + + params = typeof formatter.params === "function" ? formatter.params(component) : formatter.params; + + return formatter.formatter.call(this, cell.getComponent(), params, onRendered); + } else { + return this.formatValue(cell); + } + }; + + Format.prototype.sanitizeHTML = function (value) { + if (value) { + var entityMap = { + '&': '&', + '<': '<', + '>': '>', + '"': '"', + "'": ''', + '/': '/', + '`': '`', + '=': '=' + }; + + return String(value).replace(/[&<>"'`=\/]/g, function (s) { + return entityMap[s]; + }); + } else { + return value; + } + }; + + Format.prototype.emptyToSpace = function (value) { + return value === null || typeof value === "undefined" || value === "" ? " " : value; + }; + + //get formatter for cell + Format.prototype.getFormatter = function (formatter) { + var formatter; + + switch (typeof formatter === 'undefined' ? 'undefined' : _typeof(formatter)) { + case "string": + if (this.formatters[formatter]) { + formatter = this.formatters[formatter]; + } else { + console.warn("Formatter Error - No such formatter found: ", formatter); + formatter = this.formatters.plaintext; + } + break; + + case "function": + formatter = formatter; + break; + + default: + formatter = this.formatters.plaintext; + break; + } + + return formatter; + }; + + //default data formatters + Format.prototype.formatters = { + //plain text value + plaintext: function plaintext(cell, formatterParams, onRendered) { + return this.emptyToSpace(this.sanitizeHTML(cell.getValue())); + }, + + //html text value + html: function html(cell, formatterParams, onRendered) { + return cell.getValue(); + }, + + //multiline text area + textarea: function textarea(cell, formatterParams, onRendered) { + cell.getElement().style.whiteSpace = "pre-wrap"; + return this.emptyToSpace(this.sanitizeHTML(cell.getValue())); + }, + + //currency formatting + money: function money(cell, formatterParams, onRendered) { + var floatVal = parseFloat(cell.getValue()), + number, + integer, + decimal, + rgx; + + var decimalSym = formatterParams.decimal || "."; + var thousandSym = formatterParams.thousand || ","; + var symbol = formatterParams.symbol || ""; + var after = !!formatterParams.symbolAfter; + var precision = typeof formatterParams.precision !== "undefined" ? formatterParams.precision : 2; + + if (isNaN(floatVal)) { + return this.emptyToSpace(this.sanitizeHTML(cell.getValue())); + } + + number = precision !== false ? floatVal.toFixed(precision) : floatVal; + number = String(number).split("."); + + integer = number[0]; + decimal = number.length > 1 ? decimalSym + number[1] : ""; + + rgx = /(\d+)(\d{3})/; + + while (rgx.test(integer)) { + integer = integer.replace(rgx, "$1" + thousandSym + "$2"); + } + + return after ? integer + decimal + symbol : symbol + integer + decimal; + }, + + //clickable anchor tag + link: function link(cell, formatterParams, onRendered) { + var value = cell.getValue(), + urlPrefix = formatterParams.urlPrefix || "", + download = formatterParams.download, + label = value, + el = document.createElement("a"), + data; + + if (formatterParams.labelField) { + data = cell.getData(); + label = data[formatterParams.labelField]; + } + + if (formatterParams.label) { + switch (_typeof(formatterParams.label)) { + case "string": + label = formatterParams.label; + break; + + case "function": + label = formatterParams.label(cell); + break; + } + } + + if (label) { + if (formatterParams.urlField) { + data = cell.getData(); + value = data[formatterParams.urlField]; + } + + if (formatterParams.url) { + switch (_typeof(formatterParams.url)) { + case "string": + value = formatterParams.url; + break; + + case "function": + value = formatterParams.url(cell); + break; + } + } + + el.setAttribute("href", urlPrefix + value); + + if (formatterParams.target) { + el.setAttribute("target", formatterParams.target); + } + + if (formatterParams.download) { + + if (typeof download == "function") { + download = download(cell); + } else { + download = download === true ? "" : download; + } + + el.setAttribute("download", download); + } + + el.innerHTML = this.emptyToSpace(this.sanitizeHTML(label)); + + return el; + } else { + return " "; + } + }, + + //image element + image: function image(cell, formatterParams, onRendered) { + var el = document.createElement("img"); + el.setAttribute("src", cell.getValue()); + + switch (_typeof(formatterParams.height)) { + case "number": + el.style.height = formatterParams.height + "px"; + break; + + case "string": + el.style.height = formatterParams.height; + break; + } + + switch (_typeof(formatterParams.width)) { + case "number": + el.style.width = formatterParams.width + "px"; + break; + + case "string": + el.style.width = formatterParams.width; + break; + } + + el.addEventListener("load", function () { + cell.getRow().normalizeHeight(); + }); + + return el; + }, + + //tick or cross + tickCross: function tickCross(cell, formatterParams, onRendered) { + var value = cell.getValue(), + element = cell.getElement(), + empty = formatterParams.allowEmpty, + truthy = formatterParams.allowTruthy, + tick = typeof formatterParams.tickElement !== "undefined" ? formatterParams.tickElement : '', + cross = typeof formatterParams.crossElement !== "undefined" ? formatterParams.crossElement : ''; + + if (truthy && value || value === true || value === "true" || value === "True" || value === 1 || value === "1") { + element.setAttribute("aria-checked", true); + return tick || ""; + } else { + if (empty && (value === "null" || value === "" || value === null || typeof value === "undefined")) { + element.setAttribute("aria-checked", "mixed"); + return ""; + } else { + element.setAttribute("aria-checked", false); + return cross || ""; + } + } + }, + + datetime: function datetime(cell, formatterParams, onRendered) { + var inputFormat = formatterParams.inputFormat || "YYYY-MM-DD hh:mm:ss"; + var outputFormat = formatterParams.outputFormat || "DD/MM/YYYY hh:mm:ss"; + var invalid = typeof formatterParams.invalidPlaceholder !== "undefined" ? formatterParams.invalidPlaceholder : ""; + var value = cell.getValue(); + + var newDatetime = moment(value, inputFormat); + + if (newDatetime.isValid()) { + return formatterParams.timezone ? newDatetime.tz(formatterParams.timezone).format(outputFormat) : newDatetime.format(outputFormat); + } else { + + if (invalid === true) { + return value; + } else if (typeof invalid === "function") { + return invalid(value); + } else { + return invalid; + } + } + }, + + datetimediff: function datetime(cell, formatterParams, onRendered) { + var inputFormat = formatterParams.inputFormat || "YYYY-MM-DD hh:mm:ss"; + var invalid = typeof formatterParams.invalidPlaceholder !== "undefined" ? formatterParams.invalidPlaceholder : ""; + var suffix = typeof formatterParams.suffix !== "undefined" ? formatterParams.suffix : false; + var unit = typeof formatterParams.unit !== "undefined" ? formatterParams.unit : undefined; + var humanize = typeof formatterParams.humanize !== "undefined" ? formatterParams.humanize : false; + var date = typeof formatterParams.date !== "undefined" ? formatterParams.date : moment(); + var value = cell.getValue(); + + var newDatetime = moment(value, inputFormat); + + if (newDatetime.isValid()) { + if (humanize) { + return moment.duration(newDatetime.diff(date)).humanize(suffix); + } else { + return newDatetime.diff(date, unit) + (suffix ? " " + suffix : ""); + } + } else { + + if (invalid === true) { + return value; + } else if (typeof invalid === "function") { + return invalid(value); + } else { + return invalid; + } + } + }, + + //select + lookup: function lookup(cell, formatterParams, onRendered) { + var value = cell.getValue(); + + if (typeof formatterParams[value] === "undefined") { + console.warn('Missing display value for ' + value); + return value; + } + + return formatterParams[value]; + }, + + //star rating + star: function star(cell, formatterParams, onRendered) { + var value = cell.getValue(), + element = cell.getElement(), + maxStars = formatterParams && formatterParams.stars ? formatterParams.stars : 5, + stars = document.createElement("span"), + star = document.createElementNS('http://www.w3.org/2000/svg', "svg"), + starActive = '', + starInactive = ''; + + //style stars holder + stars.style.verticalAlign = "middle"; + + //style star + star.setAttribute("width", "14"); + star.setAttribute("height", "14"); + star.setAttribute("viewBox", "0 0 512 512"); + star.setAttribute("xml:space", "preserve"); + star.style.padding = "0 1px"; + + value = value && !isNaN(value) ? parseInt(value) : 0; + + value = Math.max(0, Math.min(value, maxStars)); + + for (var i = 1; i <= maxStars; i++) { + var nextStar = star.cloneNode(true); + nextStar.innerHTML = i <= value ? starActive : starInactive; + + stars.appendChild(nextStar); + } + + element.style.whiteSpace = "nowrap"; + element.style.overflow = "hidden"; + element.style.textOverflow = "ellipsis"; + + element.setAttribute("aria-label", value); + + return stars; + }, + + traffic: function traffic(cell, formatterParams, onRendered) { + var value = this.sanitizeHTML(cell.getValue()) || 0, + el = document.createElement("span"), + max = formatterParams && formatterParams.max ? formatterParams.max : 100, + min = formatterParams && formatterParams.min ? formatterParams.min : 0, + colors = formatterParams && typeof formatterParams.color !== "undefined" ? formatterParams.color : ["red", "orange", "green"], + color = "#666666", + percent, + percentValue; + + if (isNaN(value) || typeof cell.getValue() === "undefined") { + return; + } + + el.classList.add("tabulator-traffic-light"); + + //make sure value is in range + percentValue = parseFloat(value) <= max ? parseFloat(value) : max; + percentValue = parseFloat(percentValue) >= min ? parseFloat(percentValue) : min; + + //workout percentage + percent = (max - min) / 100; + percentValue = Math.round((percentValue - min) / percent); + + //set color + switch (typeof colors === 'undefined' ? 'undefined' : _typeof(colors)) { + case "string": + color = colors; + break; + case "function": + color = colors(value); + break; + case "object": + if (Array.isArray(colors)) { + var unit = 100 / colors.length; + var index = Math.floor(percentValue / unit); + + index = Math.min(index, colors.length - 1); + index = Math.max(index, 0); + color = colors[index]; + break; + } + } + + el.style.backgroundColor = color; + + return el; + }, + + //progress bar + progress: function progress(cell, formatterParams, onRendered) { + //progress bar + var value = this.sanitizeHTML(cell.getValue()) || 0, + element = cell.getElement(), + max = formatterParams && formatterParams.max ? formatterParams.max : 100, + min = formatterParams && formatterParams.min ? formatterParams.min : 0, + legendAlign = formatterParams && formatterParams.legendAlign ? formatterParams.legendAlign : "center", + percent, + percentValue, + color, + legend, + legendColor, + top, + left, + right, + bottom; + + //make sure value is in range + percentValue = parseFloat(value) <= max ? parseFloat(value) : max; + percentValue = parseFloat(percentValue) >= min ? parseFloat(percentValue) : min; + + //workout percentage + percent = (max - min) / 100; + percentValue = Math.round((percentValue - min) / percent); + + //set bar color + switch (_typeof(formatterParams.color)) { + case "string": + color = formatterParams.color; + break; + case "function": + color = formatterParams.color(value); + break; + case "object": + if (Array.isArray(formatterParams.color)) { + var unit = 100 / formatterParams.color.length; + var index = Math.floor(percentValue / unit); + + index = Math.min(index, formatterParams.color.length - 1); + index = Math.max(index, 0); + color = formatterParams.color[index]; + break; + } + default: + color = "#2DC214"; + } + + //generate legend + switch (_typeof(formatterParams.legend)) { + case "string": + legend = formatterParams.legend; + break; + case "function": + legend = formatterParams.legend(value); + break; + case "boolean": + legend = value; + break; + default: + legend = false; + } + + //set legend color + switch (_typeof(formatterParams.legendColor)) { + case "string": + legendColor = formatterParams.legendColor; + break; + case "function": + legendColor = formatterParams.legendColor(value); + break; + case "object": + if (Array.isArray(formatterParams.legendColor)) { + var unit = 100 / formatterParams.legendColor.length; + var index = Math.floor(percentValue / unit); + + index = Math.min(index, formatterParams.legendColor.length - 1); + index = Math.max(index, 0); + legendColor = formatterParams.legendColor[index]; + } + break; + default: + legendColor = "#000"; + } + + element.style.minWidth = "30px"; + element.style.position = "relative"; + + element.setAttribute("aria-label", percentValue); + + var barEl = document.createElement("div"); + barEl.style.display = "inline-block"; + barEl.style.position = "relative"; + barEl.style.width = percentValue + "%"; + barEl.style.backgroundColor = color; + barEl.style.height = "100%"; + + barEl.setAttribute('data-max', max); + barEl.setAttribute('data-min', min); + + if (legend) { + var legendEl = document.createElement("div"); + legendEl.style.position = "absolute"; + legendEl.style.top = "4px"; + legendEl.style.left = 0; + legendEl.style.textAlign = legendAlign; + legendEl.style.width = "100%"; + legendEl.style.color = legendColor; + legendEl.innerHTML = legend; + } + + onRendered(function () { + + //handle custom element needed if formatter is to be included in printed/downloaded output + if (!(cell instanceof CellComponent)) { + var holderEl = document.createElement("div"); + holderEl.style.position = "absolute"; + holderEl.style.top = "4px"; + holderEl.style.bottom = "4px"; + holderEl.style.left = "4px"; + holderEl.style.right = "4px"; + + element.appendChild(holderEl); + + element = holderEl; + } + + element.appendChild(barEl); + + if (legend) { + element.appendChild(legendEl); + } + }); + + return ""; + }, + + //background color + color: function color(cell, formatterParams, onRendered) { + cell.getElement().style.backgroundColor = this.sanitizeHTML(cell.getValue()); + return ""; + }, + + //tick icon + buttonTick: function buttonTick(cell, formatterParams, onRendered) { + return ''; + }, + + //cross icon + buttonCross: function buttonCross(cell, formatterParams, onRendered) { + return ''; + }, + + //current row number + rownum: function rownum(cell, formatterParams, onRendered) { + return this.table.rowManager.activeRows.indexOf(cell.getRow()._getSelf()) + 1; + }, + + //row handle + handle: function handle(cell, formatterParams, onRendered) { + cell.getElement().classList.add("tabulator-row-handle"); + return "
"; + }, + + responsiveCollapse: function responsiveCollapse(cell, formatterParams, onRendered) { + var self = this, + open = false, + el = document.createElement("div"), + config = cell.getRow()._row.modules.responsiveLayout; + + el.classList.add("tabulator-responsive-collapse-toggle"); + el.innerHTML = "+-"; + + cell.getElement().classList.add("tabulator-row-handle"); + + function toggleList(isOpen) { + var collapseEl = config.element; + + config.open = isOpen; + + if (collapseEl) { + + if (config.open) { + el.classList.add("open"); + collapseEl.style.display = ''; + } else { + el.classList.remove("open"); + collapseEl.style.display = 'none'; + } + } + } + + el.addEventListener("click", function (e) { + e.stopImmediatePropagation(); + toggleList(!config.open); + }); + + toggleList(config.open); + + return el; + }, + + rowSelection: function rowSelection(cell, formatterParams, onRendered) { + var _this64 = this; + + var checkbox = document.createElement("input"); + + checkbox.type = 'checkbox'; + + if (this.table.modExists("selectRow", true)) { + + checkbox.addEventListener("click", function (e) { + e.stopPropagation(); + }); + + if (typeof cell.getRow == 'function') { + var row = cell.getRow(); + + if (row instanceof RowComponent) { + + checkbox.addEventListener("change", function (e) { + row.toggleSelect(); + }); + + checkbox.checked = row.isSelected && row.isSelected(); + this.table.modules.selectRow.registerRowSelectCheckbox(row, checkbox); + } else { + checkbox = ""; + } + } else { + checkbox.addEventListener("change", function (e) { + if (_this64.table.modules.selectRow.selectedRows.length) { + _this64.table.deselectRow(); + } else { + _this64.table.selectRow(formatterParams.rowRange); + } + }); + + this.table.modules.selectRow.registerHeaderSelectCheckbox(checkbox); + } + } + return checkbox; + } + }; + + Tabulator.prototype.registerModule("format", Format); + + var FrozenColumns = function FrozenColumns(table) { + this.table = table; //hold Tabulator object + this.leftColumns = []; + this.rightColumns = []; + this.leftMargin = 0; + this.rightMargin = 0; + this.rightPadding = 0; + this.initializationMode = "left"; + this.active = false; + this.scrollEndTimer = false; + }; + + //reset initial state + FrozenColumns.prototype.reset = function () { + this.initializationMode = "left"; + this.leftColumns = []; + this.rightColumns = []; + this.leftMargin = 0; + this.rightMargin = 0; + this.rightMargin = 0; + this.active = false; + + this.table.columnManager.headersElement.style.marginLeft = 0; + this.table.columnManager.element.style.paddingRight = 0; + }; + + //initialize specific column + FrozenColumns.prototype.initializeColumn = function (column) { + var config = { margin: 0, edge: false }; + + if (!column.isGroup) { + + if (this.frozenCheck(column)) { + + config.position = this.initializationMode; + + if (this.initializationMode == "left") { + this.leftColumns.push(column); + } else { + this.rightColumns.unshift(column); + } + + this.active = true; + + column.modules.frozen = config; + } else { + this.initializationMode = "right"; + } + } + }; + + FrozenColumns.prototype.frozenCheck = function (column) { + var frozen = false; + + if (column.parent.isGroup && column.definition.frozen) { + console.warn("Frozen Column Error - Parent column group must be frozen, not individual columns or sub column groups"); + } + + if (column.parent.isGroup) { + return this.frozenCheck(column.parent); + } else { + return column.definition.frozen; + } + + return frozen; + }; + + //quick layout to smooth horizontal scrolling + FrozenColumns.prototype.scrollHorizontal = function () { + var _this65 = this; + + var rows; + + if (this.active) { + clearTimeout(this.scrollEndTimer); + + //layout all rows after scroll is complete + this.scrollEndTimer = setTimeout(function () { + _this65.layout(); + }, 100); + + rows = this.table.rowManager.getVisibleRows(); + + this.calcMargins(); + + this.layoutColumnPosition(); + + this.layoutCalcRows(); + + rows.forEach(function (row) { + if (row.type === "row") { + _this65.layoutRow(row); + } + }); + + this.table.rowManager.tableElement.style.marginRight = this.rightMargin; + } + }; + + //calculate margins for rows + FrozenColumns.prototype.calcMargins = function () { + this.leftMargin = this._calcSpace(this.leftColumns, this.leftColumns.length) + "px"; + this.table.columnManager.headersElement.style.marginLeft = this.leftMargin; + + this.rightMargin = this._calcSpace(this.rightColumns, this.rightColumns.length) + "px"; + this.table.columnManager.element.style.paddingRight = this.rightMargin; + + //calculate right frozen columns + this.rightPadding = this.table.rowManager.element.clientWidth + this.table.columnManager.scrollLeft; + }; + + //layout calculation rows + FrozenColumns.prototype.layoutCalcRows = function () { + if (this.table.modExists("columnCalcs")) { + if (this.table.modules.columnCalcs.topInitialized && this.table.modules.columnCalcs.topRow) { + this.layoutRow(this.table.modules.columnCalcs.topRow); + } + if (this.table.modules.columnCalcs.botInitialized && this.table.modules.columnCalcs.botRow) { + this.layoutRow(this.table.modules.columnCalcs.botRow); + } + } + }; + + //calculate column positions and layout headers + FrozenColumns.prototype.layoutColumnPosition = function (allCells) { + var _this66 = this; + + var leftParents = []; + + this.leftColumns.forEach(function (column, i) { + column.modules.frozen.margin = _this66._calcSpace(_this66.leftColumns, i) + _this66.table.columnManager.scrollLeft + "px"; + + if (i == _this66.leftColumns.length - 1) { + column.modules.frozen.edge = true; + } else { + column.modules.frozen.edge = false; + } + + if (column.parent.isGroup) { + var parentEl = _this66.getColGroupParentElement(column); + if (!leftParents.includes(parentEl)) { + _this66.layoutElement(parentEl, column); + leftParents.push(parentEl); + } + + if (column.modules.frozen.edge) { + parentEl.classList.add("tabulator-frozen-" + column.modules.frozen.position); + } + } else { + _this66.layoutElement(column.getElement(), column); + } + + if (allCells) { + column.cells.forEach(function (cell) { + _this66.layoutElement(cell.getElement(), column); + }); + } + }); + + this.rightColumns.forEach(function (column, i) { + column.modules.frozen.margin = _this66.rightPadding - _this66._calcSpace(_this66.rightColumns, i + 1) + "px"; + + if (i == _this66.rightColumns.length - 1) { + column.modules.frozen.edge = true; + } else { + column.modules.frozen.edge = false; + } + + if (column.parent.isGroup) { + _this66.layoutElement(_this66.getColGroupParentElement(column), column); + } else { + _this66.layoutElement(column.getElement(), column); + } + + if (allCells) { + column.cells.forEach(function (cell) { + _this66.layoutElement(cell.getElement(), column); + }); + } + }); + }; + + FrozenColumns.prototype.getColGroupParentElement = function (column) { + return column.parent.isGroup ? this.getColGroupParentElement(column.parent) : column.getElement(); + }; + + //layout columns appropropriatly + FrozenColumns.prototype.layout = function () { + var self = this, + rightMargin = 0; + + if (self.active) { + + //calculate row padding + this.calcMargins(); + + // self.table.rowManager.activeRows.forEach(function(row){ + // self.layoutRow(row); + // }); + + // if(self.table.options.dataTree){ + self.table.rowManager.getDisplayRows().forEach(function (row) { + if (row.type === "row") { + self.layoutRow(row); + } + }); + // } + + this.layoutCalcRows(); + + //calculate left columns + this.layoutColumnPosition(true); + + // if(tableHolder.scrollHeight > tableHolder.clientHeight){ + // rightMargin -= tableHolder.offsetWidth - tableHolder.clientWidth; + // } + + this.table.rowManager.tableElement.style.marginRight = this.rightMargin; + } + }; + + FrozenColumns.prototype.layoutRow = function (row) { + var _this67 = this; + + var rowEl = row.getElement(); + + rowEl.style.paddingLeft = this.leftMargin; + // rowEl.style.paddingRight = this.rightMargin + "px"; + + this.leftColumns.forEach(function (column) { + var cell = row.getCell(column); + + if (cell) { + _this67.layoutElement(cell.getElement(), column); + } + }); + + this.rightColumns.forEach(function (column) { + var cell = row.getCell(column); + + if (cell) { + _this67.layoutElement(cell.getElement(), column); + } + }); + }; + + FrozenColumns.prototype.layoutElement = function (element, column) { + + if (column.modules.frozen) { + element.style.position = "absolute"; + element.style.left = column.modules.frozen.margin; + + element.classList.add("tabulator-frozen"); + + if (column.modules.frozen.edge) { + element.classList.add("tabulator-frozen-" + column.modules.frozen.position); + } + } + }; + + FrozenColumns.prototype._calcSpace = function (columns, index) { + var width = 0; + + for (var _i12 = 0; _i12 < index; _i12++) { + if (columns[_i12].visible) { + width += columns[_i12].getWidth(); + } + } + + return width; + }; + + Tabulator.prototype.registerModule("frozenColumns", FrozenColumns); + var FrozenRows = function FrozenRows(table) { + this.table = table; //hold Tabulator object + this.topElement = document.createElement("div"); + this.rows = []; + this.displayIndex = 0; //index in display pipeline + }; + + FrozenRows.prototype.initialize = function () { + this.rows = []; + + this.topElement.classList.add("tabulator-frozen-rows-holder"); + + // this.table.columnManager.element.append(this.topElement); + this.table.columnManager.getElement().insertBefore(this.topElement, this.table.columnManager.headersElement.nextSibling); + }; + + FrozenRows.prototype.setDisplayIndex = function (index) { + this.displayIndex = index; + }; + + FrozenRows.prototype.getDisplayIndex = function () { + return this.displayIndex; + }; + + FrozenRows.prototype.isFrozen = function () { + return !!this.rows.length; + }; + + //filter frozen rows out of display data + FrozenRows.prototype.getRows = function (rows) { + var self = this, + frozen = [], + output = rows.slice(0); + + this.rows.forEach(function (row) { + var index = output.indexOf(row); + + if (index > -1) { + output.splice(index, 1); + } + }); + + return output; + }; + + FrozenRows.prototype.freezeRow = function (row) { + if (!row.modules.frozen) { + row.modules.frozen = true; + this.topElement.appendChild(row.getElement()); + row.initialize(); + row.normalizeHeight(); + this.table.rowManager.adjustTableSize(); + + this.rows.push(row); + + this.table.rowManager.refreshActiveData("display"); + + this.styleRows(); + } else { + console.warn("Freeze Error - Row is already frozen"); + } + }; + + FrozenRows.prototype.unfreezeRow = function (row) { + var index = this.rows.indexOf(row); + + if (row.modules.frozen) { + + row.modules.frozen = false; + + this.detachRow(row); + + this.table.rowManager.adjustTableSize(); + + this.table.rowManager.refreshActiveData("display"); + + if (this.rows.length) { + this.styleRows(); + } + } else { + console.warn("Freeze Error - Row is already unfrozen"); + } + }; + + FrozenRows.prototype.detachRow = function (row) { + var index = this.rows.indexOf(row); + + if (index > -1) { + var rowEl = row.getElement(); + rowEl.parentNode.removeChild(rowEl); + + this.rows.splice(index, 1); + } + }; + + FrozenRows.prototype.styleRows = function (row) { + var self = this; + + this.rows.forEach(function (row, i) { + self.table.rowManager.styleRow(row, i); + }); + }; + + Tabulator.prototype.registerModule("frozenRows", FrozenRows); + + //public group object + var GroupComponent = function GroupComponent(group) { + this._group = group; + this.type = "GroupComponent"; + }; + + GroupComponent.prototype.getKey = function () { + return this._group.key; + }; + + GroupComponent.prototype.getField = function () { + return this._group.field; + }; + + GroupComponent.prototype.getElement = function () { + return this._group.element; + }; + + GroupComponent.prototype.getRows = function () { + return this._group.getRows(true); + }; + + GroupComponent.prototype.getSubGroups = function () { + return this._group.getSubGroups(true); + }; + + GroupComponent.prototype.getParentGroup = function () { + return this._group.parent ? this._group.parent.getComponent() : false; + }; + + GroupComponent.prototype.getVisibility = function () { + console.warn("getVisibility function is deprecated, you should now use the isVisible function"); + return this._group.visible; + }; + + GroupComponent.prototype.isVisible = function () { + return this._group.visible; + }; + + GroupComponent.prototype.show = function () { + this._group.show(); + }; + + GroupComponent.prototype.hide = function () { + this._group.hide(); + }; + + GroupComponent.prototype.toggle = function () { + this._group.toggleVisibility(); + }; + + GroupComponent.prototype._getSelf = function () { + return this._group; + }; + + GroupComponent.prototype.getTable = function () { + return this._group.groupManager.table; + }; + + ////////////////////////////////////////////////// + //////////////// Group Functions ///////////////// + ////////////////////////////////////////////////// + + var Group = function Group(groupManager, parent, level, key, field, generator, oldGroup) { + + this.groupManager = groupManager; + this.parent = parent; + this.key = key; + this.level = level; + this.field = field; + this.hasSubGroups = level < groupManager.groupIDLookups.length - 1; + this.addRow = this.hasSubGroups ? this._addRowToGroup : this._addRow; + this.type = "group"; //type of element + this.old = oldGroup; + this.rows = []; + this.groups = []; + this.groupList = []; + this.generator = generator; + this.elementContents = false; + this.height = 0; + this.outerHeight = 0; + this.initialized = false; + this.calcs = {}; + this.initialized = false; + this.modules = {}; + this.arrowElement = false; + + this.visible = oldGroup ? oldGroup.visible : typeof groupManager.startOpen[level] !== "undefined" ? groupManager.startOpen[level] : groupManager.startOpen[0]; + + this.component = null; + + this.createElements(); + this.addBindings(); + + this.createValueGroups(); + }; + + Group.prototype.wipe = function () { + if (this.groupList.length) { + this.groupList.forEach(function (group) { + group.wipe(); + }); + } else { + this.element = false; + this.arrowElement = false; + this.elementContents = false; + } + }; + + Group.prototype.createElements = function () { + var arrow = document.createElement("div"); + arrow.classList.add("tabulator-arrow"); + + this.element = document.createElement("div"); + this.element.classList.add("tabulator-row"); + this.element.classList.add("tabulator-group"); + this.element.classList.add("tabulator-group-level-" + this.level); + this.element.setAttribute("role", "rowgroup"); + + this.arrowElement = document.createElement("div"); + this.arrowElement.classList.add("tabulator-group-toggle"); + this.arrowElement.appendChild(arrow); + + //setup movable rows + if (this.groupManager.table.options.movableRows !== false && this.groupManager.table.modExists("moveRow")) { + this.groupManager.table.modules.moveRow.initializeGroupHeader(this); + } + }; + + Group.prototype.createValueGroups = function () { + var _this68 = this; + + var level = this.level + 1; + if (this.groupManager.allowedValues && this.groupManager.allowedValues[level]) { + this.groupManager.allowedValues[level].forEach(function (value) { + _this68._createGroup(value, level); + }); + } + }; + + Group.prototype.addBindings = function () { + var self = this, + dblTap, + tapHold, + tap, + toggleElement; + + //handle group click events + if (self.groupManager.table.options.groupClick) { + self.element.addEventListener("click", function (e) { + self.groupManager.table.options.groupClick.call(self.groupManager.table, e, self.getComponent()); + }); + } + + if (self.groupManager.table.options.groupDblClick) { + self.element.addEventListener("dblclick", function (e) { + self.groupManager.table.options.groupDblClick.call(self.groupManager.table, e, self.getComponent()); + }); + } + + if (self.groupManager.table.options.groupContext) { + self.element.addEventListener("contextmenu", function (e) { + self.groupManager.table.options.groupContext.call(self.groupManager.table, e, self.getComponent()); + }); + } + + if ((self.groupManager.table.options.groupContextMenu || self.groupManager.table.options.groupClickMenu) && self.groupManager.table.modExists("menu")) { + self.groupManager.table.modules.menu.initializeGroup.call(self.groupManager.table.modules.menu, self); + } + + if (self.groupManager.table.options.groupTap) { + + tap = false; + + self.element.addEventListener("touchstart", function (e) { + tap = true; + }, { passive: true }); + + self.element.addEventListener("touchend", function (e) { + if (tap) { + self.groupManager.table.options.groupTap(e, self.getComponent()); + } + + tap = false; + }); + } + + if (self.groupManager.table.options.groupDblTap) { + + dblTap = null; + + self.element.addEventListener("touchend", function (e) { + + if (dblTap) { + clearTimeout(dblTap); + dblTap = null; + + self.groupManager.table.options.groupDblTap(e, self.getComponent()); + } else { + + dblTap = setTimeout(function () { + clearTimeout(dblTap); + dblTap = null; + }, 300); + } + }); + } + + if (self.groupManager.table.options.groupTapHold) { + + tapHold = null; + + self.element.addEventListener("touchstart", function (e) { + clearTimeout(tapHold); + + tapHold = setTimeout(function () { + clearTimeout(tapHold); + tapHold = null; + tap = false; + self.groupManager.table.options.groupTapHold(e, self.getComponent()); + }, 1000); + }, { passive: true }); + + self.element.addEventListener("touchend", function (e) { + clearTimeout(tapHold); + tapHold = null; + }); + } + + if (self.groupManager.table.options.groupToggleElement) { + toggleElement = self.groupManager.table.options.groupToggleElement == "arrow" ? self.arrowElement : self.element; + + toggleElement.addEventListener("click", function (e) { + e.stopPropagation(); + e.stopImmediatePropagation(); + self.toggleVisibility(); + }); + } + }; + + Group.prototype._createGroup = function (groupID, level) { + var groupKey = level + "_" + groupID; + var group = new Group(this.groupManager, this, level, groupID, this.groupManager.groupIDLookups[level].field, this.groupManager.headerGenerator[level] || this.groupManager.headerGenerator[0], this.old ? this.old.groups[groupKey] : false); + + this.groups[groupKey] = group; + this.groupList.push(group); + }; + + Group.prototype._addRowToGroup = function (row) { + + var level = this.level + 1; + + if (this.hasSubGroups) { + var groupID = this.groupManager.groupIDLookups[level].func(row.getData()), + groupKey = level + "_" + groupID; + + if (this.groupManager.allowedValues && this.groupManager.allowedValues[level]) { + if (this.groups[groupKey]) { + this.groups[groupKey].addRow(row); + } + } else { + if (!this.groups[groupKey]) { + this._createGroup(groupID, level); + } + + this.groups[groupKey].addRow(row); + } + } + }; + + Group.prototype._addRow = function (row) { + this.rows.push(row); + row.modules.group = this; + }; + + Group.prototype.insertRow = function (row, to, after) { + var data = this.conformRowData({}); + + row.updateData(data); + + var toIndex = this.rows.indexOf(to); + + if (toIndex > -1) { + if (after) { + this.rows.splice(toIndex + 1, 0, row); + } else { + this.rows.splice(toIndex, 0, row); + } + } else { + if (after) { + this.rows.push(row); + } else { + this.rows.unshift(row); + } + } + + row.modules.group = this; + + this.generateGroupHeaderContents(); + + if (this.groupManager.table.modExists("columnCalcs") && this.groupManager.table.options.columnCalcs != "table") { + this.groupManager.table.modules.columnCalcs.recalcGroup(this); + } + + this.groupManager.updateGroupRows(true); + }; + + Group.prototype.scrollHeader = function (left) { + this.arrowElement.style.marginLeft = left; + + this.groupList.forEach(function (child) { + child.scrollHeader(left); + }); + }; + + Group.prototype.getRowIndex = function (row) {}; + + //update row data to match grouping contraints + Group.prototype.conformRowData = function (data) { + if (this.field) { + data[this.field] = this.key; + } else { + console.warn("Data Conforming Error - Cannot conform row data to match new group as groupBy is a function"); + } + + if (this.parent) { + data = this.parent.conformRowData(data); + } + + return data; + }; + + Group.prototype.removeRow = function (row) { + var index = this.rows.indexOf(row); + var el = row.getElement(); + + if (index > -1) { + this.rows.splice(index, 1); + } + + if (!this.groupManager.table.options.groupValues && !this.rows.length) { + if (this.parent) { + this.parent.removeGroup(this); + } else { + this.groupManager.removeGroup(this); + } + + this.groupManager.updateGroupRows(true); + } else { + + if (el.parentNode) { + el.parentNode.removeChild(el); + } + + this.generateGroupHeaderContents(); + + if (this.groupManager.table.modExists("columnCalcs") && this.groupManager.table.options.columnCalcs != "table") { + this.groupManager.table.modules.columnCalcs.recalcGroup(this); + } + } + }; + + Group.prototype.removeGroup = function (group) { + var groupKey = group.level + "_" + group.key, + index; + + if (this.groups[groupKey]) { + delete this.groups[groupKey]; + + index = this.groupList.indexOf(group); + + if (index > -1) { + this.groupList.splice(index, 1); + } + + if (!this.groupList.length) { + if (this.parent) { + this.parent.removeGroup(this); + } else { + this.groupManager.removeGroup(this); + } + } + } + }; + + Group.prototype.getHeadersAndRows = function (noCalc) { + var output = []; + + output.push(this); + + this._visSet(); + + if (this.visible) { + if (this.groupList.length) { + this.groupList.forEach(function (group) { + output = output.concat(group.getHeadersAndRows(noCalc)); + }); + } else { + if (!noCalc && this.groupManager.table.options.columnCalcs != "table" && this.groupManager.table.modExists("columnCalcs") && this.groupManager.table.modules.columnCalcs.hasTopCalcs()) { + if (this.calcs.top) { + this.calcs.top.detachElement(); + this.calcs.top.deleteCells(); + } + + this.calcs.top = this.groupManager.table.modules.columnCalcs.generateTopRow(this.rows); + output.push(this.calcs.top); + } + + output = output.concat(this.rows); + + if (!noCalc && this.groupManager.table.options.columnCalcs != "table" && this.groupManager.table.modExists("columnCalcs") && this.groupManager.table.modules.columnCalcs.hasBottomCalcs()) { + if (this.calcs.bottom) { + this.calcs.bottom.detachElement(); + this.calcs.bottom.deleteCells(); + } + + this.calcs.bottom = this.groupManager.table.modules.columnCalcs.generateBottomRow(this.rows); + output.push(this.calcs.bottom); + } + } + } else { + if (!this.groupList.length && this.groupManager.table.options.columnCalcs != "table") { + + if (this.groupManager.table.modExists("columnCalcs")) { + + if (!noCalc && this.groupManager.table.modules.columnCalcs.hasTopCalcs()) { + if (this.calcs.top) { + this.calcs.top.detachElement(); + this.calcs.top.deleteCells(); + } + + if (this.groupManager.table.options.groupClosedShowCalcs) { + this.calcs.top = this.groupManager.table.modules.columnCalcs.generateTopRow(this.rows); + output.push(this.calcs.top); + } + } + + if (!noCalc && this.groupManager.table.modules.columnCalcs.hasBottomCalcs()) { + if (this.calcs.bottom) { + this.calcs.bottom.detachElement(); + this.calcs.bottom.deleteCells(); + } + + if (this.groupManager.table.options.groupClosedShowCalcs) { + this.calcs.bottom = this.groupManager.table.modules.columnCalcs.generateBottomRow(this.rows); + output.push(this.calcs.bottom); + } + } + } + } + } + + return output; + }; + + Group.prototype.getData = function (visible, transform) { + var self = this, + output = []; + + this._visSet(); + + if (!visible || visible && this.visible) { + this.rows.forEach(function (row) { + output.push(row.getData(transform || "data")); + }); + } + + return output; + }; + + // Group.prototype.getRows = function(){ + // this._visSet(); + + // return this.visible ? this.rows : []; + // }; + + Group.prototype.getRowCount = function () { + var count = 0; + + if (this.groupList.length) { + this.groupList.forEach(function (group) { + count += group.getRowCount(); + }); + } else { + count = this.rows.length; + } + return count; + }; + + Group.prototype.toggleVisibility = function () { + if (this.visible) { + this.hide(); + } else { + this.show(); + } + }; + + Group.prototype.hide = function () { + this.visible = false; + + if (this.groupManager.table.rowManager.getRenderMode() == "classic" && !this.groupManager.table.options.pagination) { + + this.element.classList.remove("tabulator-group-visible"); + + if (this.groupList.length) { + this.groupList.forEach(function (group) { + + var rows = group.getHeadersAndRows(); + + rows.forEach(function (row) { + row.detachElement(); + }); + }); + } else { + this.rows.forEach(function (row) { + var rowEl = row.getElement(); + rowEl.parentNode.removeChild(rowEl); + }); + } + + this.groupManager.table.rowManager.setDisplayRows(this.groupManager.updateGroupRows(), this.groupManager.getDisplayIndex()); + + this.groupManager.table.rowManager.checkClassicModeGroupHeaderWidth(); + } else { + this.groupManager.updateGroupRows(true); + } + + this.groupManager.table.options.groupVisibilityChanged.call(this.table, this.getComponent(), false); + }; + + Group.prototype.show = function () { + var self = this; + + self.visible = true; + + if (this.groupManager.table.rowManager.getRenderMode() == "classic" && !this.groupManager.table.options.pagination) { + + this.element.classList.add("tabulator-group-visible"); + + var prev = self.getElement(); + + if (this.groupList.length) { + this.groupList.forEach(function (group) { + var rows = group.getHeadersAndRows(); + + rows.forEach(function (row) { + var rowEl = row.getElement(); + prev.parentNode.insertBefore(rowEl, prev.nextSibling); + row.initialize(); + prev = rowEl; + }); + }); + } else { + self.rows.forEach(function (row) { + var rowEl = row.getElement(); + prev.parentNode.insertBefore(rowEl, prev.nextSibling); + row.initialize(); + prev = rowEl; + }); + } + + this.groupManager.table.rowManager.setDisplayRows(this.groupManager.updateGroupRows(), this.groupManager.getDisplayIndex()); + + this.groupManager.table.rowManager.checkClassicModeGroupHeaderWidth(); + } else { + this.groupManager.updateGroupRows(true); + } + + this.groupManager.table.options.groupVisibilityChanged.call(this.table, this.getComponent(), true); + }; + + Group.prototype._visSet = function () { + var data = []; + + if (typeof this.visible == "function") { + + this.rows.forEach(function (row) { + data.push(row.getData()); + }); + + this.visible = this.visible(this.key, this.getRowCount(), data, this.getComponent()); + } + }; + + Group.prototype.getRowGroup = function (row) { + var match = false; + if (this.groupList.length) { + this.groupList.forEach(function (group) { + var result = group.getRowGroup(row); + + if (result) { + match = result; + } + }); + } else { + if (this.rows.find(function (item) { + return item === row; + })) { + match = this; + } + } + + return match; + }; + + Group.prototype.getSubGroups = function (component) { + var output = []; + + this.groupList.forEach(function (child) { + output.push(component ? child.getComponent() : child); + }); + + return output; + }; + + Group.prototype.getRows = function (compoment) { + var output = []; + + this.rows.forEach(function (row) { + output.push(compoment ? row.getComponent() : row); + }); + + return output; + }; + + Group.prototype.generateGroupHeaderContents = function () { + var data = []; + + this.rows.forEach(function (row) { + data.push(row.getData()); + }); + + this.elementContents = this.generator(this.key, this.getRowCount(), data, this.getComponent()); + + while (this.element.firstChild) { + this.element.removeChild(this.element.firstChild); + }if (typeof this.elementContents === "string") { + this.element.innerHTML = this.elementContents; + } else { + this.element.appendChild(this.elementContents); + } + + this.element.insertBefore(this.arrowElement, this.element.firstChild); + }; + + Group.prototype.getPath = function () { + var path = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : []; + + path.unshift(this.key); + if (this.parent) { + this.parent.getPath(path); + } + return path; + }; + ////////////// Standard Row Functions ////////////// + + Group.prototype.getElement = function () { + this.addBindingsd = false; + + this._visSet(); + + if (this.visible) { + this.element.classList.add("tabulator-group-visible"); + } else { + this.element.classList.remove("tabulator-group-visible"); + } + + for (var i = 0; i < this.element.childNodes.length; ++i) { + this.element.childNodes[i].parentNode.removeChild(this.element.childNodes[i]); + } + + this.generateGroupHeaderContents(); + + // this.addBindings(); + + return this.element; + }; + + Group.prototype.detachElement = function () { + if (this.element && this.element.parentNode) { + this.element.parentNode.removeChild(this.element); + } + }; + + //normalize the height of elements in the row + Group.prototype.normalizeHeight = function () { + this.setHeight(this.element.clientHeight); + }; + + Group.prototype.initialize = function (force) { + if (!this.initialized || force) { + this.normalizeHeight(); + this.initialized = true; + } + }; + + Group.prototype.reinitialize = function () { + this.initialized = false; + this.height = 0; + + if (Tabulator.prototype.helpers.elVisible(this.element)) { + this.initialize(true); + } + }; + + Group.prototype.setHeight = function (height) { + if (this.height != height) { + this.height = height; + this.outerHeight = this.element.offsetHeight; + } + }; + + //return rows outer height + Group.prototype.getHeight = function () { + return this.outerHeight; + }; + + Group.prototype.getGroup = function () { + return this; + }; + + Group.prototype.reinitializeHeight = function () {}; + Group.prototype.calcHeight = function () {}; + Group.prototype.setCellHeight = function () {}; + Group.prototype.clearCellHeight = function () {}; + + //////////////// Object Generation ///////////////// + Group.prototype.getComponent = function () { + if (!this.component) { + this.component = new GroupComponent(this); + } + + return this.component; + }; + + ////////////////////////////////////////////////// + ////////////// Group Row Extension /////////////// + ////////////////////////////////////////////////// + + var GroupRows = function GroupRows(table) { + + this.table = table; //hold Tabulator object + + this.groupIDLookups = false; //enable table grouping and set field to group by + this.startOpen = [function () { + return false; + }]; //starting state of group + this.headerGenerator = [function () { + return ""; + }]; + this.groupList = []; //ordered list of groups + this.allowedValues = false; + this.groups = {}; //hold row groups + this.displayIndex = 0; //index in display pipeline + }; + + //initialize group configuration + GroupRows.prototype.initialize = function () { + var self = this, + groupBy = self.table.options.groupBy, + startOpen = self.table.options.groupStartOpen, + groupHeader = self.table.options.groupHeader; + + this.allowedValues = self.table.options.groupValues; + + if (Array.isArray(groupBy) && Array.isArray(groupHeader) && groupBy.length > groupHeader.length) { + console.warn("Error creating group headers, groupHeader array is shorter than groupBy array"); + } + + self.headerGenerator = [function () { + return ""; + }]; + this.startOpen = [function () { + return false; + }]; //starting state of group + + self.table.modules.localize.bind("groups|item", function (langValue, lang) { + self.headerGenerator[0] = function (value, count, data) { + //header layout function + return (typeof value === "undefined" ? "" : value) + "(" + count + " " + (count === 1 ? langValue : lang.groups.items) + ")"; + }; + }); + + this.groupIDLookups = []; + + if (Array.isArray(groupBy) || groupBy) { + if (this.table.modExists("columnCalcs") && this.table.options.columnCalcs != "table" && this.table.options.columnCalcs != "both") { + this.table.modules.columnCalcs.removeCalcs(); + } + } else { + if (this.table.modExists("columnCalcs") && this.table.options.columnCalcs != "group") { + + var cols = this.table.columnManager.getRealColumns(); + + cols.forEach(function (col) { + if (col.definition.topCalc) { + self.table.modules.columnCalcs.initializeTopRow(); + } + + if (col.definition.bottomCalc) { + self.table.modules.columnCalcs.initializeBottomRow(); + } + }); + } + } + + if (!Array.isArray(groupBy)) { + groupBy = [groupBy]; + } + + groupBy.forEach(function (group, i) { + var lookupFunc, column; + + if (typeof group == "function") { + lookupFunc = group; + } else { + column = self.table.columnManager.getColumnByField(group); + + if (column) { + lookupFunc = function lookupFunc(data) { + return column.getFieldValue(data); + }; + } else { + lookupFunc = function lookupFunc(data) { + return data[group]; + }; + } + } + + self.groupIDLookups.push({ + field: typeof group === "function" ? false : group, + func: lookupFunc, + values: self.allowedValues ? self.allowedValues[i] : false + }); + }); + + if (startOpen) { + + if (!Array.isArray(startOpen)) { + startOpen = [startOpen]; + } + + startOpen.forEach(function (level) { + level = typeof level == "function" ? level : function () { + return true; + }; + }); + + self.startOpen = startOpen; + } + + if (groupHeader) { + self.headerGenerator = Array.isArray(groupHeader) ? groupHeader : [groupHeader]; + } + + this.initialized = true; + }; + + GroupRows.prototype.setDisplayIndex = function (index) { + this.displayIndex = index; + }; + + GroupRows.prototype.getDisplayIndex = function () { + return this.displayIndex; + }; + + //return appropriate rows with group headers + GroupRows.prototype.getRows = function (rows) { + if (this.groupIDLookups.length) { + + this.table.options.dataGrouping.call(this.table); + + this.generateGroups(rows); + + if (this.table.options.dataGrouped) { + this.table.options.dataGrouped.call(this.table, this.getGroups(true)); + } + + return this.updateGroupRows(); + } else { + return rows.slice(0); + } + }; + + GroupRows.prototype.getGroups = function (compoment) { + var groupComponents = []; + + this.groupList.forEach(function (group) { + groupComponents.push(compoment ? group.getComponent() : group); + }); + + return groupComponents; + }; + + GroupRows.prototype.getChildGroups = function (group) { + var _this69 = this; + + var groupComponents = []; + + if (!group) { + group = this; + } + + group.groupList.forEach(function (child) { + if (child.groupList.length) { + groupComponents = groupComponents.concat(_this69.getChildGroups(child)); + } else { + groupComponents.push(child); + } + }); + + return groupComponents; + }; + + GroupRows.prototype.wipe = function () { + this.groupList.forEach(function (group) { + group.wipe(); + }); + }; + + GroupRows.prototype.pullGroupListData = function (groupList) { + var self = this; + var groupListData = []; + + groupList.forEach(function (group) { + var groupHeader = {}; + groupHeader.level = 0; + groupHeader.rowCount = 0; + groupHeader.headerContent = ""; + var childData = []; + + if (group.hasSubGroups) { + childData = self.pullGroupListData(group.groupList); + + groupHeader.level = group.level; + groupHeader.rowCount = childData.length - group.groupList.length; // data length minus number of sub-headers + groupHeader.headerContent = group.generator(group.key, groupHeader.rowCount, group.rows, group); + + groupListData.push(groupHeader); + groupListData = groupListData.concat(childData); + } else { + groupHeader.level = group.level; + groupHeader.headerContent = group.generator(group.key, group.rows.length, group.rows, group); + groupHeader.rowCount = group.getRows().length; + + groupListData.push(groupHeader); + + group.getRows().forEach(function (row) { + groupListData.push(row.getData("data")); + }); + } + }); + + return groupListData; + }; + + GroupRows.prototype.getGroupedData = function () { + + return this.pullGroupListData(this.groupList); + }; + + GroupRows.prototype.getRowGroup = function (row) { + var match = false; + + this.groupList.forEach(function (group) { + var result = group.getRowGroup(row); + + if (result) { + match = result; + } + }); + + return match; + }; + + GroupRows.prototype.countGroups = function () { + return this.groupList.length; + }; + + GroupRows.prototype.generateGroups = function (rows) { + var self = this, + oldGroups = self.groups; + + self.groups = {}; + self.groupList = []; + + if (this.allowedValues && this.allowedValues[0]) { + this.allowedValues[0].forEach(function (value) { + self.createGroup(value, 0, oldGroups); + }); + + rows.forEach(function (row) { + self.assignRowToExistingGroup(row, oldGroups); + }); + } else { + rows.forEach(function (row) { + self.assignRowToGroup(row, oldGroups); + }); + } + }; + + GroupRows.prototype.createGroup = function (groupID, level, oldGroups) { + var groupKey = level + "_" + groupID, + group; + + oldGroups = oldGroups || []; + + group = new Group(this, false, level, groupID, this.groupIDLookups[0].field, this.headerGenerator[0], oldGroups[groupKey]); + + this.groups[groupKey] = group; + this.groupList.push(group); + }; + + // GroupRows.prototype.assignRowToGroup = function(row, oldGroups){ + // var groupID = this.groupIDLookups[0].func(row.getData()), + // groupKey = "0_" + groupID; + + // if(!this.groups[groupKey]){ + // this.createGroup(groupID, 0, oldGroups); + // } + + // this.groups[groupKey].addRow(row); + // }; + + GroupRows.prototype.assignRowToExistingGroup = function (row, oldGroups) { + var groupID = this.groupIDLookups[0].func(row.getData()), + groupKey = "0_" + groupID; + + if (this.groups[groupKey]) { + this.groups[groupKey].addRow(row); + } + }; + + GroupRows.prototype.assignRowToGroup = function (row, oldGroups) { + var groupID = this.groupIDLookups[0].func(row.getData()), + newGroupNeeded = !this.groups["0_" + groupID]; + + if (newGroupNeeded) { + this.createGroup(groupID, 0, oldGroups); + } + + this.groups["0_" + groupID].addRow(row); + + return !newGroupNeeded; + }; + + GroupRows.prototype.reassignRowToGroup = function (row) { + var oldRowGroup = row.getGroup(), + oldGroupPath = oldRowGroup.getPath(), + newGroupPath = this.getExpectedPath(row), + samePath = true; + // figure out if new group path is the same as old group path + var samePath = oldGroupPath.length == newGroupPath.length && oldGroupPath.every(function (element, index) { + return element === newGroupPath[index]; + }); + // refresh if they new path and old path aren't the same (aka the row's groupings have changed) + if (!samePath) { + oldRowGroup.removeRow(row); + this.assignRowToGroup(row, self.groups); + this.table.rowManager.refreshActiveData("group", false, true); + } + }; + + GroupRows.prototype.getExpectedPath = function (row) { + var groupPath = [], + rowData = row.getData(); + this.groupIDLookups.forEach(function (groupId) { + groupPath.push(groupId.func(rowData)); + }); + return groupPath; + }; + + GroupRows.prototype.updateGroupRows = function (force) { + var self = this, + output = [], + oldRowCount; + + self.groupList.forEach(function (group) { + output = output.concat(group.getHeadersAndRows()); + }); + + //force update of table display + if (force) { + + var displayIndex = self.table.rowManager.setDisplayRows(output, this.getDisplayIndex()); + + if (displayIndex !== true) { + this.setDisplayIndex(displayIndex); + } + + self.table.rowManager.refreshActiveData("group", true, true); + } + + return output; + }; + + GroupRows.prototype.scrollHeaders = function (left) { + if (this.table.options.virtualDomHoz) { + left -= this.table.vdomHoz.vDomPadLeft; + } + + left = left + "px"; + + this.groupList.forEach(function (group) { + group.scrollHeader(left); + }); + }; + + GroupRows.prototype.removeGroup = function (group) { + var groupKey = group.level + "_" + group.key, + index; + + if (this.groups[groupKey]) { + delete this.groups[groupKey]; + + index = this.groupList.indexOf(group); + + if (index > -1) { + this.groupList.splice(index, 1); + } + } + }; + + Tabulator.prototype.registerModule("groupRows", GroupRows); + var History = function History(table) { + this.table = table; //hold Tabulator object + + this.history = []; + this.index = -1; + }; + + History.prototype.clear = function () { + this.history = []; + this.index = -1; + }; + + History.prototype.action = function (type, component, data) { + + this.history = this.history.slice(0, this.index + 1); + + this.history.push({ + type: type, + component: component, + data: data + }); + + this.index++; + }; + + History.prototype.getHistoryUndoSize = function () { + return this.index + 1; + }; + + History.prototype.getHistoryRedoSize = function () { + return this.history.length - (this.index + 1); + }; + + History.prototype.clearComponentHistory = function (component) { + var index = this.history.findIndex(function (item) { + return item.component === component; + }); + + if (index > -1) { + this.history.splice(index, 1); + if (index <= this.index) { + this.index--; + } + + this.clearComponentHistory(component); + } + }; + + History.prototype.undo = function () { + + if (this.index > -1) { + var action = this.history[this.index]; + + this.undoers[action.type].call(this, action); + + this.index--; + + this.table.options.historyUndo.call(this.table, action.type, action.component.getComponent(), action.data); + + return true; + } else { + console.warn("History Undo Error - No more history to undo"); + return false; + } + }; + + History.prototype.redo = function () { + if (this.history.length - 1 > this.index) { + + this.index++; + + var action = this.history[this.index]; + + this.redoers[action.type].call(this, action); + + this.table.options.historyRedo.call(this.table, action.type, action.component.getComponent(), action.data); + + return true; + } else { + console.warn("History Redo Error - No more history to redo"); + return false; + } + }; + + History.prototype.undoers = { + cellEdit: function cellEdit(action) { + action.component.setValueProcessData(action.data.oldValue); + }, + + rowAdd: function rowAdd(action) { + action.component.deleteActual(); + }, + + rowDelete: function rowDelete(action) { + var newRow = this.table.rowManager.addRowActual(action.data.data, action.data.pos, action.data.index); + + if (this.table.options.groupBy && this.table.modExists("groupRows")) { + this.table.modules.groupRows.updateGroupRows(true); + } + + this._rebindRow(action.component, newRow); + }, + + rowMove: function rowMove(action) { + this.table.rowManager.moveRowActual(action.component, this.table.rowManager.rows[action.data.posFrom], !action.data.after); + this.table.rowManager.redraw(); + } + }; + + History.prototype.redoers = { + cellEdit: function cellEdit(action) { + action.component.setValueProcessData(action.data.newValue); + }, + + rowAdd: function rowAdd(action) { + var newRow = this.table.rowManager.addRowActual(action.data.data, action.data.pos, action.data.index); + + if (this.table.options.groupBy && this.table.modExists("groupRows")) { + this.table.modules.groupRows.updateGroupRows(true); + } + + this._rebindRow(action.component, newRow); + }, + + rowDelete: function rowDelete(action) { + action.component.deleteActual(); + }, + + rowMove: function rowMove(action) { + this.table.rowManager.moveRowActual(action.component, this.table.rowManager.rows[action.data.posTo], action.data.after); + this.table.rowManager.redraw(); + } + }; + + //rebind rows to new element after deletion + History.prototype._rebindRow = function (oldRow, newRow) { + this.history.forEach(function (action) { + if (action.component instanceof Row) { + if (action.component === oldRow) { + action.component = newRow; + } + } else if (action.component instanceof Cell) { + if (action.component.row === oldRow) { + var field = action.component.column.getField(); + + if (field) { + action.component = newRow.getCell(field); + } + } + } + }); + }; + + Tabulator.prototype.registerModule("history", History); + var HtmlTableImport = function HtmlTableImport(table) { + this.table = table; //hold Tabulator object + this.fieldIndex = []; + this.hasIndex = false; + }; + + HtmlTableImport.prototype.parseTable = function () { + var self = this, + element = self.table.element, + options = self.table.options, + columns = options.columns, + headers = element.getElementsByTagName("th"), + rows = element.getElementsByTagName("tbody")[0], + data = [], + newTable; + + self.hasIndex = false; + + self.table.options.htmlImporting.call(this.table); + + rows = rows ? rows.getElementsByTagName("tr") : []; + + //check for tablator inline options + self._extractOptions(element, options); + + if (headers.length) { + self._extractHeaders(headers, rows); + } else { + self._generateBlankHeaders(headers, rows); + } + + //iterate through table rows and build data set + for (var index = 0; index < rows.length; index++) { + var row = rows[index], + cells = row.getElementsByTagName("td"), + item = {}; + + //create index if the dont exist in table + if (!self.hasIndex) { + item[options.index] = index; + } + + for (var i = 0; i < cells.length; i++) { + var cell = cells[i]; + if (typeof this.fieldIndex[i] !== "undefined") { + item[this.fieldIndex[i]] = cell.innerHTML; + } + } + + //add row data to item + data.push(item); + } + + //create new element + var newElement = document.createElement("div"); + + //transfer attributes to new element + var attributes = element.attributes; + + // loop through attributes and apply them on div + + for (var i in attributes) { + if (_typeof(attributes[i]) == "object") { + newElement.setAttribute(attributes[i].name, attributes[i].value); + } + } + + // replace table with div element + element.parentNode.replaceChild(newElement, element); + + options.data = data; + + self.table.options.htmlImported.call(this.table); + + // // newElement.tabulator(options); + + this.table.element = newElement; + }; + + //extract tabulator attribute options + HtmlTableImport.prototype._extractOptions = function (element, options, defaultOptions) { + var attributes = element.attributes; + var optionsArr = defaultOptions ? Object.assign([], defaultOptions) : Object.keys(options); + var optionsList = {}; + + optionsArr.forEach(function (item) { + optionsList[item.toLowerCase()] = item; + }); + + for (var index in attributes) { + var attrib = attributes[index]; + var name; + + if (attrib && (typeof attrib === 'undefined' ? 'undefined' : _typeof(attrib)) == "object" && attrib.name && attrib.name.indexOf("tabulator-") === 0) { + name = attrib.name.replace("tabulator-", ""); + + if (typeof optionsList[name] !== "undefined") { + options[optionsList[name]] = this._attribValue(attrib.value); + } + } + } + }; + + //get value of attribute + HtmlTableImport.prototype._attribValue = function (value) { + if (value === "true") { + return true; + } + + if (value === "false") { + return false; + } + + return value; + }; + + //find column if it has already been defined + HtmlTableImport.prototype._findCol = function (title) { + var match = this.table.options.columns.find(function (column) { + return column.title === title; + }); + + return match || false; + }; + + //extract column from headers + HtmlTableImport.prototype._extractHeaders = function (headers, rows) { + for (var index = 0; index < headers.length; index++) { + var header = headers[index], + exists = false, + col = this._findCol(header.textContent), + width, + attributes; + + if (col) { + exists = true; + } else { + col = { title: header.textContent.trim() }; + } + + if (!col.field) { + col.field = header.textContent.trim().toLowerCase().replace(" ", "_"); + } + + width = header.getAttribute("width"); + + if (width && !col.width) { + col.width = width; + } + + //check for tablator inline options + attributes = header.attributes; + + // //check for tablator inline options + this._extractOptions(header, col, Column.prototype.defaultOptionList); + + this.fieldIndex[index] = col.field; + + if (col.field == this.table.options.index) { + this.hasIndex = true; + } + + if (!exists) { + this.table.options.columns.push(col); + } + } + }; + + //generate blank headers + HtmlTableImport.prototype._generateBlankHeaders = function (headers, rows) { + for (var index = 0; index < headers.length; index++) { + var header = headers[index], + col = { title: "", field: "col" + index }; + + this.fieldIndex[index] = col.field; + + var width = header.getAttribute("width"); + + if (width) { + col.width = width; + } + + this.table.options.columns.push(col); + } + }; + + Tabulator.prototype.registerModule("htmlTableImport", HtmlTableImport); + var Keybindings = function Keybindings(table) { + this.table = table; //hold Tabulator object + this.watchKeys = null; + this.pressedKeys = null; + this.keyupBinding = false; + this.keydownBinding = false; + }; + + Keybindings.prototype.initialize = function () { + var bindings = this.table.options.keybindings, + mergedBindings = {}; + + this.watchKeys = {}; + this.pressedKeys = []; + + if (bindings !== false) { + + for (var key in this.bindings) { + mergedBindings[key] = this.bindings[key]; + } + + if (Object.keys(bindings).length) { + + for (var _key in bindings) { + mergedBindings[_key] = bindings[_key]; + } + } + + this.mapBindings(mergedBindings); + this.bindEvents(); + } + }; + + Keybindings.prototype.mapBindings = function (bindings) { + var _this70 = this; + + var self = this; + + var _loop2 = function _loop2(key) { + + if (_this70.actions[key]) { + + if (bindings[key]) { + + if (_typeof(bindings[key]) !== "object") { + bindings[key] = [bindings[key]]; + } + + bindings[key].forEach(function (binding) { + self.mapBinding(key, binding); + }); + } + } else { + console.warn("Key Binding Error - no such action:", key); + } + }; + + for (var key in bindings) { + _loop2(key); + } + }; + + Keybindings.prototype.mapBinding = function (action, symbolsList) { + var self = this; + + var binding = { + action: this.actions[action], + keys: [], + ctrl: false, + shift: false, + meta: false + }; + + var symbols = symbolsList.toString().toLowerCase().split(" ").join("").split("+"); + + symbols.forEach(function (symbol) { + switch (symbol) { + case "ctrl": + binding.ctrl = true; + break; + + case "shift": + binding.shift = true; + break; + + case "meta": + binding.meta = true; + break; + + default: + symbol = parseInt(symbol); + binding.keys.push(symbol); + + if (!self.watchKeys[symbol]) { + self.watchKeys[symbol] = []; + } + + self.watchKeys[symbol].push(binding); + } + }); + }; + + Keybindings.prototype.bindEvents = function () { + var self = this; + + this.keyupBinding = function (e) { + var code = e.keyCode; + var bindings = self.watchKeys[code]; + + if (bindings) { + + self.pressedKeys.push(code); + + bindings.forEach(function (binding) { + self.checkBinding(e, binding); + }); + } + }; + + this.keydownBinding = function (e) { + var code = e.keyCode; + var bindings = self.watchKeys[code]; + + if (bindings) { + + var index = self.pressedKeys.indexOf(code); + + if (index > -1) { + self.pressedKeys.splice(index, 1); + } + } + }; + + this.table.element.addEventListener("keydown", this.keyupBinding); + + this.table.element.addEventListener("keyup", this.keydownBinding); + }; + + Keybindings.prototype.clearBindings = function () { + if (this.keyupBinding) { + this.table.element.removeEventListener("keydown", this.keyupBinding); + } + + if (this.keydownBinding) { + this.table.element.removeEventListener("keyup", this.keydownBinding); + } + }; + + Keybindings.prototype.checkBinding = function (e, binding) { + var self = this, + match = true; + + if (e.ctrlKey == binding.ctrl && e.shiftKey == binding.shift && e.metaKey == binding.meta) { + binding.keys.forEach(function (key) { + var index = self.pressedKeys.indexOf(key); + + if (index == -1) { + match = false; + } + }); + + if (match) { + binding.action.call(self, e); + } + + return true; + } + + return false; + }; + + //default bindings + Keybindings.prototype.bindings = { + navPrev: "shift + 9", + navNext: 9, + navUp: 38, + navDown: 40, + scrollPageUp: 33, + scrollPageDown: 34, + scrollToStart: 36, + scrollToEnd: 35, + undo: "ctrl + 90", + redo: "ctrl + 89", + copyToClipboard: "ctrl + 67" + }; + + //default actions + Keybindings.prototype.actions = { + keyBlock: function keyBlock(e) { + e.stopPropagation(); + e.preventDefault(); + }, + scrollPageUp: function scrollPageUp(e) { + var rowManager = this.table.rowManager, + newPos = rowManager.scrollTop - rowManager.height, + scrollMax = rowManager.element.scrollHeight; + + e.preventDefault(); + + if (rowManager.displayRowsCount) { + if (newPos >= 0) { + rowManager.element.scrollTop = newPos; + } else { + rowManager.scrollToRow(rowManager.getDisplayRows()[0]); + } + } + + this.table.element.focus(); + }, + scrollPageDown: function scrollPageDown(e) { + var rowManager = this.table.rowManager, + newPos = rowManager.scrollTop + rowManager.height, + scrollMax = rowManager.element.scrollHeight; + + e.preventDefault(); + + if (rowManager.displayRowsCount) { + if (newPos <= scrollMax) { + rowManager.element.scrollTop = newPos; + } else { + rowManager.scrollToRow(rowManager.getDisplayRows()[rowManager.displayRowsCount - 1]); + } + } + + this.table.element.focus(); + }, + scrollToStart: function scrollToStart(e) { + var rowManager = this.table.rowManager; + + e.preventDefault(); + + if (rowManager.displayRowsCount) { + rowManager.scrollToRow(rowManager.getDisplayRows()[0]); + } + + this.table.element.focus(); + }, + scrollToEnd: function scrollToEnd(e) { + var rowManager = this.table.rowManager; + + e.preventDefault(); + + if (rowManager.displayRowsCount) { + rowManager.scrollToRow(rowManager.getDisplayRows()[rowManager.displayRowsCount - 1]); + } + + this.table.element.focus(); + }, + navPrev: function navPrev(e) { + var cell = false; + + if (this.table.modExists("edit")) { + cell = this.table.modules.edit.currentCell; + + if (cell) { + e.preventDefault(); + cell.nav().prev(); + } + } + }, + + navNext: function navNext(e) { + var cell = false; + var newRow = this.table.options.tabEndNewRow; + var nav; + + if (this.table.modExists("edit")) { + cell = this.table.modules.edit.currentCell; + + if (cell) { + e.preventDefault(); + + nav = cell.nav(); + + if (!nav.next()) { + if (newRow) { + + cell.getElement().firstChild.blur(); + + if (newRow === true) { + newRow = this.table.addRow({}); + } else { + if (typeof newRow == "function") { + newRow = this.table.addRow(newRow(cell.row.getComponent())); + } else { + newRow = this.table.addRow(Object.assign({}, newRow)); + } + } + + newRow.then(function () { + setTimeout(function () { + nav.next(); + }); + }); + } + } + } + } + }, + + navLeft: function navLeft(e) { + var cell = false; + + if (this.table.modExists("edit")) { + cell = this.table.modules.edit.currentCell; + + if (cell) { + e.preventDefault(); + cell.nav().left(); + } + } + }, + + navRight: function navRight(e) { + var cell = false; + + if (this.table.modExists("edit")) { + cell = this.table.modules.edit.currentCell; + + if (cell) { + e.preventDefault(); + cell.nav().right(); + } + } + }, + + navUp: function navUp(e) { + var cell = false; + + if (this.table.modExists("edit")) { + cell = this.table.modules.edit.currentCell; + + if (cell) { + e.preventDefault(); + cell.nav().up(); + } + } + }, + + navDown: function navDown(e) { + var cell = false; + + if (this.table.modExists("edit")) { + cell = this.table.modules.edit.currentCell; + + if (cell) { + e.preventDefault(); + cell.nav().down(); + } + } + }, + + undo: function undo(e) { + var cell = false; + if (this.table.options.history && this.table.modExists("history") && this.table.modExists("edit")) { + + cell = this.table.modules.edit.currentCell; + + if (!cell) { + e.preventDefault(); + this.table.modules.history.undo(); + } + } + }, + + redo: function redo(e) { + var cell = false; + if (this.table.options.history && this.table.modExists("history") && this.table.modExists("edit")) { + + cell = this.table.modules.edit.currentCell; + + if (!cell) { + e.preventDefault(); + this.table.modules.history.redo(); + } + } + }, + + copyToClipboard: function copyToClipboard(e) { + if (!this.table.modules.edit.currentCell) { + if (this.table.modExists("clipboard", true)) { + this.table.modules.clipboard.copy(false, true); + } + } + } + }; + + Tabulator.prototype.registerModule("keybindings", Keybindings); + var Menu = function Menu(table) { + this.table = table; //hold Tabulator object + this.menuEl = false; + this.blurEvent = this.hideMenu.bind(this); + this.escEvent = this.escMenu.bind(this); + this.nestedMenuBlock = false; + }; + + Menu.prototype.initializeColumnHeader = function (column) { + var _this71 = this; + + var headerMenuEl; + + if (column.definition.headerContextMenu) { + column.getElement().addEventListener("contextmenu", this.LoadMenuEvent.bind(this, column, column.definition.headerContextMenu)); + this.tapHold(column, column.definition.headerContextMenu); + } + + // if(column.definition.headerClickMenu){ + // column.getElement().addEventListener("click", this.LoadMenuEvent.bind(this, column, column.definition.headerClickMenu)); + // } + + if (column.definition.headerMenu) { + + headerMenuEl = document.createElement("span"); + headerMenuEl.classList.add("tabulator-header-menu-button"); + headerMenuEl.innerHTML = "⋮"; + + headerMenuEl.addEventListener("click", function (e) { + var menu = typeof column.definition.headerMenu == "function" ? column.definition.headerMenu(column.getComponent(), e) : column.definition.headerMenu; + e.stopPropagation(); + e.preventDefault(); + + _this71.loadMenu(e, column, menu); + }); + + column.titleElement.insertBefore(headerMenuEl, column.titleElement.firstChild); + } + }; + + Menu.prototype.LoadMenuEvent = function (component, menu, e) { + menu = typeof menu == "function" ? menu(component.getComponent(), e) : menu; + + // if(component instanceof Cell){ + // e.stopImmediatePropagation(); + // } + + this.loadMenu(e, component, menu); + }; + + Menu.prototype.tapHold = function (component, menu) { + var _this72 = this; + + var element = component.getElement(), + tapHold = null, + loaded = false; + + element.addEventListener("touchstart", function (e) { + clearTimeout(tapHold); + loaded = false; + + tapHold = setTimeout(function () { + clearTimeout(tapHold); + tapHold = null; + loaded = true; + + _this72.LoadMenuEvent(component, menu, e); + }, 1000); + }, { passive: true }); + + element.addEventListener("touchend", function (e) { + clearTimeout(tapHold); + tapHold = null; + + if (loaded) { + e.preventDefault(); + } + }); + }; + + Menu.prototype.initializeCell = function (cell) { + if (cell.column.definition.contextMenu) { + cell.getElement().addEventListener("contextmenu", this.LoadMenuEvent.bind(this, cell, cell.column.definition.contextMenu)); + this.tapHold(cell, cell.column.definition.contextMenu); + } + + if (cell.column.definition.clickMenu) { + cell.getElement().addEventListener("click", this.LoadMenuEvent.bind(this, cell, cell.column.definition.clickMenu)); + } + }; + + Menu.prototype.initializeRow = function (row) { + if (this.table.options.rowContextMenu) { + row.getElement().addEventListener("contextmenu", this.LoadMenuEvent.bind(this, row, this.table.options.rowContextMenu)); + this.tapHold(row, this.table.options.rowContextMenu); + } + + if (this.table.options.rowClickMenu) { + row.getElement().addEventListener("click", this.LoadMenuEvent.bind(this, row, this.table.options.rowClickMenu)); + } + }; + + Menu.prototype.initializeGroup = function (group) { + if (this.table.options.groupContextMenu) { + group.getElement().addEventListener("contextmenu", this.LoadMenuEvent.bind(this, group, this.table.options.groupContextMenu)); + this.tapHold(group, this.table.options.groupContextMenu); + } + + if (this.table.options.groupClickMenu) { + group.getElement().addEventListener("click", this.LoadMenuEvent.bind(this, group, this.table.options.groupClickMenu)); + } + }; + + Menu.prototype.loadMenu = function (e, component, menu) { + var _this73 = this; + + var docHeight = Math.max(document.body.offsetHeight, window.innerHeight), + touch = !(e instanceof MouseEvent); + + if (!touch) { + e.preventDefault(); + } + + //abort if no menu set + if (!menu || !menu.length) { + return; + } + + if (this.nestedMenuBlock) { + //abort if child menu already open + if (this.isOpen()) { + return; + } + } else { + this.nestedMenuBlock = setTimeout(function () { + _this73.nestedMenuBlock = false; + }, 100); + } + + this.hideMenu(); + + this.menuEl = document.createElement("div"); + this.menuEl.classList.add("tabulator-menu"); + + menu.forEach(function (item) { + var itemEl = document.createElement("div"); + var label = item.label; + var disabled = item.disabled; + + if (item.separator) { + itemEl.classList.add("tabulator-menu-separator"); + } else { + itemEl.classList.add("tabulator-menu-item"); + + if (typeof label == "function") { + label = label(component.getComponent()); + } + + if (label instanceof Node) { + itemEl.appendChild(label); + } else { + itemEl.innerHTML = label; + } + + if (typeof disabled == "function") { + disabled = disabled(component.getComponent()); + } + + if (disabled) { + itemEl.classList.add("tabulator-menu-item-disabled"); + itemEl.addEventListener("click", function (e) { + e.stopPropagation(); + }); + } else { + itemEl.addEventListener("click", function (e) { + _this73.hideMenu(); + item.action(e, component.getComponent()); + }); + } + } + + _this73.menuEl.appendChild(itemEl); + }); + + this.menuEl.style.top = (touch ? e.touches[0].pageY : e.pageY) + "px"; + this.menuEl.style.left = (touch ? e.touches[0].pageX : e.pageX) + "px"; + + setTimeout(function () { + _this73.table.rowManager.element.addEventListener("scroll", _this73.blurEvent); + document.body.addEventListener("click", _this73.blurEvent); + document.body.addEventListener("contextmenu", _this73.blurEvent); + document.body.addEventListener("keydown", _this73.escEvent); + }, 100); + + document.body.appendChild(this.menuEl); + + //move menu to start on right edge if it is too close to the edge of the screen + if (e.pageX + this.menuEl.offsetWidth >= document.body.offsetWidth) { + this.menuEl.style.left = ""; + this.menuEl.style.right = document.body.offsetWidth - e.pageX + "px"; + } + + //move menu to start on bottom edge if it is too close to the edge of the screen + if (e.pageY + this.menuEl.offsetHeight >= docHeight) { + this.menuEl.style.top = ""; + this.menuEl.style.bottom = docHeight - e.pageY + "px"; + } + }; + + Menu.prototype.isOpen = function () { + return !!this.menuEl.parentNode; + }; + + Menu.prototype.escMenu = function (e) { + if (e.keyCode == 27) { + this.hideMenu(); + } + }; + + Menu.prototype.hideMenu = function () { + if (this.menuEl.parentNode) { + this.menuEl.parentNode.removeChild(this.menuEl); + } + + if (this.escEvent) { + document.body.removeEventListener("keydown", this.escEvent); + } + + if (this.blurEvent) { + document.body.removeEventListener("click", this.blurEvent); + document.body.removeEventListener("contextmenu", this.blurEvent); + this.table.rowManager.element.removeEventListener("scroll", this.blurEvent); + } + }; + + //default accessors + Menu.prototype.menus = {}; + + Tabulator.prototype.registerModule("menu", Menu); + var MoveColumns = function MoveColumns(table) { + this.table = table; //hold Tabulator object + this.placeholderElement = this.createPlaceholderElement(); + this.hoverElement = false; //floating column header element + this.checkTimeout = false; //click check timeout holder + this.checkPeriod = 250; //period to wait on mousedown to consider this a move and not a click + this.moving = false; //currently moving column + this.toCol = false; //destination column + this.toColAfter = false; //position of moving column relative to the desitnation column + this.startX = 0; //starting position within header element + this.autoScrollMargin = 40; //auto scroll on edge when within margin + this.autoScrollStep = 5; //auto scroll distance in pixels + this.autoScrollTimeout = false; //auto scroll timeout + this.touchMove = false; + + this.moveHover = this.moveHover.bind(this); + this.endMove = this.endMove.bind(this); + }; + + MoveColumns.prototype.createPlaceholderElement = function () { + var el = document.createElement("div"); + + el.classList.add("tabulator-col"); + el.classList.add("tabulator-col-placeholder"); + + return el; + }; + + MoveColumns.prototype.initializeColumn = function (column) { + var self = this, + config = {}, + colEl; + + if (!column.modules.frozen) { + + colEl = column.getElement(); + + config.mousemove = function (e) { + if (column.parent === self.moving.parent) { + if ((self.touchMove ? e.touches[0].pageX : e.pageX) - Tabulator.prototype.helpers.elOffset(colEl).left + self.table.columnManager.element.scrollLeft > column.getWidth() / 2) { + if (self.toCol !== column || !self.toColAfter) { + colEl.parentNode.insertBefore(self.placeholderElement, colEl.nextSibling); + self.moveColumn(column, true); + } + } else { + if (self.toCol !== column || self.toColAfter) { + colEl.parentNode.insertBefore(self.placeholderElement, colEl); + self.moveColumn(column, false); + } + } + } + }.bind(self); + + colEl.addEventListener("mousedown", function (e) { + self.touchMove = false; + if (e.which === 1) { + self.checkTimeout = setTimeout(function () { + self.startMove(e, column); + }, self.checkPeriod); + } + }); + + colEl.addEventListener("mouseup", function (e) { + if (e.which === 1) { + if (self.checkTimeout) { + clearTimeout(self.checkTimeout); + } + } + }); + + self.bindTouchEvents(column); + } + + column.modules.moveColumn = config; + }; + + MoveColumns.prototype.bindTouchEvents = function (column) { + var self = this, + colEl = column.getElement(), + startXMove = false, + //shifting center position of the cell + dir = false, + currentCol, + nextCol, + prevCol, + nextColWidth, + prevColWidth, + nextColWidthLast, + prevColWidthLast; + + colEl.addEventListener("touchstart", function (e) { + self.checkTimeout = setTimeout(function () { + self.touchMove = true; + currentCol = column; + nextCol = column.nextColumn(); + nextColWidth = nextCol ? nextCol.getWidth() / 2 : 0; + prevCol = column.prevColumn(); + prevColWidth = prevCol ? prevCol.getWidth() / 2 : 0; + nextColWidthLast = 0; + prevColWidthLast = 0; + startXMove = false; + + self.startMove(e, column); + }, self.checkPeriod); + }, { passive: true }); + + colEl.addEventListener("touchmove", function (e) { + var halfCol, diff, moveToCol; + + if (self.moving) { + self.moveHover(e); + + if (!startXMove) { + startXMove = e.touches[0].pageX; + } + + diff = e.touches[0].pageX - startXMove; + + if (diff > 0) { + if (nextCol && diff - nextColWidthLast > nextColWidth) { + moveToCol = nextCol; + + if (moveToCol !== column) { + startXMove = e.touches[0].pageX; + moveToCol.getElement().parentNode.insertBefore(self.placeholderElement, moveToCol.getElement().nextSibling); + self.moveColumn(moveToCol, true); + } + } + } else { + if (prevCol && -diff - prevColWidthLast > prevColWidth) { + moveToCol = prevCol; + + if (moveToCol !== column) { + startXMove = e.touches[0].pageX; + moveToCol.getElement().parentNode.insertBefore(self.placeholderElement, moveToCol.getElement()); + self.moveColumn(moveToCol, false); + } + } + } + + if (moveToCol) { + currentCol = moveToCol; + nextCol = moveToCol.nextColumn(); + nextColWidthLast = nextColWidth; + nextColWidth = nextCol ? nextCol.getWidth() / 2 : 0; + prevCol = moveToCol.prevColumn(); + prevColWidthLast = prevColWidth; + prevColWidth = prevCol ? prevCol.getWidth() / 2 : 0; + } + } + }, { passive: true }); + + colEl.addEventListener("touchend", function (e) { + if (self.checkTimeout) { + clearTimeout(self.checkTimeout); + } + if (self.moving) { + self.endMove(e); + } + }); + }; + + MoveColumns.prototype.startMove = function (e, column) { + var element = column.getElement(); + + this.moving = column; + this.startX = (this.touchMove ? e.touches[0].pageX : e.pageX) - Tabulator.prototype.helpers.elOffset(element).left; + + this.table.element.classList.add("tabulator-block-select"); + + //create placeholder + this.placeholderElement.style.width = column.getWidth() + "px"; + this.placeholderElement.style.height = column.getHeight() + "px"; + + element.parentNode.insertBefore(this.placeholderElement, element); + element.parentNode.removeChild(element); + + //create hover element + this.hoverElement = element.cloneNode(true); + this.hoverElement.classList.add("tabulator-moving"); + + this.table.columnManager.getElement().appendChild(this.hoverElement); + + this.hoverElement.style.left = "0"; + this.hoverElement.style.bottom = "0"; + + if (!this.touchMove) { + this._bindMouseMove(); + + document.body.addEventListener("mousemove", this.moveHover); + document.body.addEventListener("mouseup", this.endMove); + } + + this.moveHover(e); + }; + + MoveColumns.prototype._bindMouseMove = function () { + this.table.columnManager.columnsByIndex.forEach(function (column) { + if (column.modules.moveColumn.mousemove) { + column.getElement().addEventListener("mousemove", column.modules.moveColumn.mousemove); + } + }); + }; + + MoveColumns.prototype._unbindMouseMove = function () { + this.table.columnManager.columnsByIndex.forEach(function (column) { + if (column.modules.moveColumn.mousemove) { + column.getElement().removeEventListener("mousemove", column.modules.moveColumn.mousemove); + } + }); + }; + + MoveColumns.prototype.moveColumn = function (column, after) { + var movingCells = this.moving.getCells(); + + this.toCol = column; + this.toColAfter = after; + + if (after) { + column.getCells().forEach(function (cell, i) { + var cellEl = cell.getElement(); + cellEl.parentNode.insertBefore(movingCells[i].getElement(), cellEl.nextSibling); + }); + } else { + column.getCells().forEach(function (cell, i) { + var cellEl = cell.getElement(); + cellEl.parentNode.insertBefore(movingCells[i].getElement(), cellEl); + }); + } + }; + + MoveColumns.prototype.endMove = function (e) { + if (e.which === 1 || this.touchMove) { + this._unbindMouseMove(); + + this.placeholderElement.parentNode.insertBefore(this.moving.getElement(), this.placeholderElement.nextSibling); + this.placeholderElement.parentNode.removeChild(this.placeholderElement); + this.hoverElement.parentNode.removeChild(this.hoverElement); + + this.table.element.classList.remove("tabulator-block-select"); + + if (this.toCol) { + this.table.columnManager.moveColumnActual(this.moving, this.toCol, this.toColAfter); + } + + this.moving = false; + this.toCol = false; + this.toColAfter = false; + + if (!this.touchMove) { + document.body.removeEventListener("mousemove", this.moveHover); + document.body.removeEventListener("mouseup", this.endMove); + } + } + }; + + MoveColumns.prototype.moveHover = function (e) { + var self = this, + columnHolder = self.table.columnManager.getElement(), + scrollLeft = columnHolder.scrollLeft, + xPos = (self.touchMove ? e.touches[0].pageX : e.pageX) - Tabulator.prototype.helpers.elOffset(columnHolder).left + scrollLeft, + scrollPos; + + self.hoverElement.style.left = xPos - self.startX + "px"; + + if (xPos - scrollLeft < self.autoScrollMargin) { + if (!self.autoScrollTimeout) { + self.autoScrollTimeout = setTimeout(function () { + scrollPos = Math.max(0, scrollLeft - 5); + self.table.rowManager.getElement().scrollLeft = scrollPos; + self.autoScrollTimeout = false; + }, 1); + } + } + + if (scrollLeft + columnHolder.clientWidth - xPos < self.autoScrollMargin) { + if (!self.autoScrollTimeout) { + self.autoScrollTimeout = setTimeout(function () { + scrollPos = Math.min(columnHolder.clientWidth, scrollLeft + 5); + self.table.rowManager.getElement().scrollLeft = scrollPos; + self.autoScrollTimeout = false; + }, 1); + } + } + }; + + Tabulator.prototype.registerModule("moveColumn", MoveColumns); + + var MoveRows = function MoveRows(table) { + + this.table = table; //hold Tabulator object + this.placeholderElement = this.createPlaceholderElement(); + this.hoverElement = false; //floating row header element + this.checkTimeout = false; //click check timeout holder + this.checkPeriod = 150; //period to wait on mousedown to consider this a move and not a click + this.moving = false; //currently moving row + this.toRow = false; //destination row + this.toRowAfter = false; //position of moving row relative to the desitnation row + this.hasHandle = false; //row has handle instead of fully movable row + this.startY = 0; //starting Y position within header element + this.startX = 0; //starting X position within header element + + this.moveHover = this.moveHover.bind(this); + this.endMove = this.endMove.bind(this); + this.tableRowDropEvent = false; + + this.touchMove = false; + + this.connection = false; + this.connectionSelectorsTables = false; + this.connectionSelectorsElements = false; + this.connectionElements = []; + this.connections = []; + + this.connectedTable = false; + this.connectedRow = false; + }; + + MoveRows.prototype.createPlaceholderElement = function () { + var el = document.createElement("div"); + + el.classList.add("tabulator-row"); + el.classList.add("tabulator-row-placeholder"); + + return el; + }; + + MoveRows.prototype.initialize = function (handle) { + this.connectionSelectorsTables = this.table.options.movableRowsConnectedTables; + this.connectionSelectorsElements = this.table.options.movableRowsConnectedElements; + + this.connection = this.connectionSelectorsTables || this.connectionSelectorsElements; + }; + + MoveRows.prototype.setHandle = function (handle) { + this.hasHandle = handle; + }; + + MoveRows.prototype.initializeGroupHeader = function (group) { + var self = this, + config = {}, + rowEl; + + //inter table drag drop + config.mouseup = function (e) { + self.tableRowDrop(e, row); + }.bind(self); + + //same table drag drop + config.mousemove = function (e) { + if (e.pageY - Tabulator.prototype.helpers.elOffset(group.element).top + self.table.rowManager.element.scrollTop > group.getHeight() / 2) { + if (self.toRow !== group || !self.toRowAfter) { + var rowEl = group.getElement(); + rowEl.parentNode.insertBefore(self.placeholderElement, rowEl.nextSibling); + self.moveRow(group, true); + } + } else { + if (self.toRow !== group || self.toRowAfter) { + var rowEl = group.getElement(); + if (rowEl.previousSibling) { + rowEl.parentNode.insertBefore(self.placeholderElement, rowEl); + self.moveRow(group, false); + } + } + } + }.bind(self); + + group.modules.moveRow = config; + }; + + MoveRows.prototype.initializeRow = function (row) { + var self = this, + config = {}, + rowEl; + + //inter table drag drop + config.mouseup = function (e) { + self.tableRowDrop(e, row); + }.bind(self); + + //same table drag drop + config.mousemove = function (e) { + if (e.pageY - Tabulator.prototype.helpers.elOffset(row.element).top + self.table.rowManager.element.scrollTop > row.getHeight() / 2) { + if (self.toRow !== row || !self.toRowAfter) { + var rowEl = row.getElement(); + rowEl.parentNode.insertBefore(self.placeholderElement, rowEl.nextSibling); + self.moveRow(row, true); + } + } else { + if (self.toRow !== row || self.toRowAfter) { + var rowEl = row.getElement(); + rowEl.parentNode.insertBefore(self.placeholderElement, rowEl); + self.moveRow(row, false); + } + } + }.bind(self); + + if (!this.hasHandle) { + + rowEl = row.getElement(); + + rowEl.addEventListener("mousedown", function (e) { + if (e.which === 1) { + self.checkTimeout = setTimeout(function () { + self.startMove(e, row); + }, self.checkPeriod); + } + }); + + rowEl.addEventListener("mouseup", function (e) { + if (e.which === 1) { + if (self.checkTimeout) { + clearTimeout(self.checkTimeout); + } + } + }); + + this.bindTouchEvents(row, row.getElement()); + } + + row.modules.moveRow = config; + }; + + MoveRows.prototype.initializeCell = function (cell) { + var self = this, + cellEl = cell.getElement(); + + cellEl.addEventListener("mousedown", function (e) { + if (e.which === 1) { + self.checkTimeout = setTimeout(function () { + self.startMove(e, cell.row); + }, self.checkPeriod); + } + }); + + cellEl.addEventListener("mouseup", function (e) { + if (e.which === 1) { + if (self.checkTimeout) { + clearTimeout(self.checkTimeout); + } + } + }); + + this.bindTouchEvents(cell.row, cell.getElement()); + }; + + MoveRows.prototype.bindTouchEvents = function (row, element) { + var self = this, + startYMove = false, + //shifting center position of the cell + dir = false, + currentRow, + nextRow, + prevRow, + nextRowHeight, + prevRowHeight, + nextRowHeightLast, + prevRowHeightLast; + + element.addEventListener("touchstart", function (e) { + self.checkTimeout = setTimeout(function () { + self.touchMove = true; + currentRow = row; + nextRow = row.nextRow(); + nextRowHeight = nextRow ? nextRow.getHeight() / 2 : 0; + prevRow = row.prevRow(); + prevRowHeight = prevRow ? prevRow.getHeight() / 2 : 0; + nextRowHeightLast = 0; + prevRowHeightLast = 0; + startYMove = false; + + self.startMove(e, row); + }, self.checkPeriod); + }, { passive: true }); + this.moving, this.toRow, this.toRowAfter; + element.addEventListener("touchmove", function (e) { + + var halfCol, diff, moveToRow; + + if (self.moving) { + e.preventDefault(); + + self.moveHover(e); + + if (!startYMove) { + startYMove = e.touches[0].pageY; + } + + diff = e.touches[0].pageY - startYMove; + + if (diff > 0) { + if (nextRow && diff - nextRowHeightLast > nextRowHeight) { + moveToRow = nextRow; + + if (moveToRow !== row) { + startYMove = e.touches[0].pageY; + moveToRow.getElement().parentNode.insertBefore(self.placeholderElement, moveToRow.getElement().nextSibling); + self.moveRow(moveToRow, true); + } + } + } else { + if (prevRow && -diff - prevRowHeightLast > prevRowHeight) { + moveToRow = prevRow; + + if (moveToRow !== row) { + startYMove = e.touches[0].pageY; + moveToRow.getElement().parentNode.insertBefore(self.placeholderElement, moveToRow.getElement()); + self.moveRow(moveToRow, false); + } + } + } + + if (moveToRow) { + currentRow = moveToRow; + nextRow = moveToRow.nextRow(); + nextRowHeightLast = nextRowHeight; + nextRowHeight = nextRow ? nextRow.getHeight() / 2 : 0; + prevRow = moveToRow.prevRow(); + prevRowHeightLast = prevRowHeight; + prevRowHeight = prevRow ? prevRow.getHeight() / 2 : 0; + } + } + }); + + element.addEventListener("touchend", function (e) { + if (self.checkTimeout) { + clearTimeout(self.checkTimeout); + } + if (self.moving) { + self.endMove(e); + self.touchMove = false; + } + }); + }; + + MoveRows.prototype._bindMouseMove = function () { + var self = this; + + self.table.rowManager.getDisplayRows().forEach(function (row) { + if ((row.type === "row" || row.type === "group") && row.modules.moveRow.mousemove) { + row.getElement().addEventListener("mousemove", row.modules.moveRow.mousemove); + } + }); + }; + + MoveRows.prototype._unbindMouseMove = function () { + var self = this; + + self.table.rowManager.getDisplayRows().forEach(function (row) { + if ((row.type === "row" || row.type === "group") && row.modules.moveRow.mousemove) { + row.getElement().removeEventListener("mousemove", row.modules.moveRow.mousemove); + } + }); + }; + + MoveRows.prototype.startMove = function (e, row) { + var element = row.getElement(); + + this.setStartPosition(e, row); + + this.moving = row; + + this.table.element.classList.add("tabulator-block-select"); + + //create placeholder + this.placeholderElement.style.width = row.getWidth() + "px"; + this.placeholderElement.style.height = row.getHeight() + "px"; + + if (!this.connection) { + element.parentNode.insertBefore(this.placeholderElement, element); + element.parentNode.removeChild(element); + } else { + this.table.element.classList.add("tabulator-movingrow-sending"); + this.connectToTables(row); + } + + //create hover element + this.hoverElement = element.cloneNode(true); + this.hoverElement.classList.add("tabulator-moving"); + + if (this.connection) { + document.body.appendChild(this.hoverElement); + this.hoverElement.style.left = "0"; + this.hoverElement.style.top = "0"; + this.hoverElement.style.width = this.table.element.clientWidth + "px"; + this.hoverElement.style.whiteSpace = "nowrap"; + this.hoverElement.style.overflow = "hidden"; + this.hoverElement.style.pointerEvents = "none"; + } else { + this.table.rowManager.getTableElement().appendChild(this.hoverElement); + + this.hoverElement.style.left = "0"; + this.hoverElement.style.top = "0"; + + this._bindMouseMove(); + } + + document.body.addEventListener("mousemove", this.moveHover); + document.body.addEventListener("mouseup", this.endMove); + + this.moveHover(e); + }; + + MoveRows.prototype.setStartPosition = function (e, row) { + var pageX = this.touchMove ? e.touches[0].pageX : e.pageX, + pageY = this.touchMove ? e.touches[0].pageY : e.pageY, + element, + position; + + element = row.getElement(); + if (this.connection) { + position = element.getBoundingClientRect(); + + this.startX = position.left - pageX + window.pageXOffset; + this.startY = position.top - pageY + window.pageYOffset; + } else { + this.startY = pageY - element.getBoundingClientRect().top; + } + }; + + MoveRows.prototype.endMove = function (e) { + if (!e || e.which === 1 || this.touchMove) { + this._unbindMouseMove(); + + if (!this.connection) { + this.placeholderElement.parentNode.insertBefore(this.moving.getElement(), this.placeholderElement.nextSibling); + this.placeholderElement.parentNode.removeChild(this.placeholderElement); + } + + this.hoverElement.parentNode.removeChild(this.hoverElement); + + this.table.element.classList.remove("tabulator-block-select"); + + if (this.toRow) { + this.table.rowManager.moveRow(this.moving, this.toRow, this.toRowAfter); + } + + this.moving = false; + this.toRow = false; + this.toRowAfter = false; + + document.body.removeEventListener("mousemove", this.moveHover); + document.body.removeEventListener("mouseup", this.endMove); + + if (this.connection) { + this.table.element.classList.remove("tabulator-movingrow-sending"); + this.disconnectFromTables(); + } + } + }; + + MoveRows.prototype.moveRow = function (row, after) { + this.toRow = row; + this.toRowAfter = after; + }; + + MoveRows.prototype.moveHover = function (e) { + if (this.connection) { + this.moveHoverConnections.call(this, e); + } else { + this.moveHoverTable.call(this, e); + } + }; + + MoveRows.prototype.moveHoverTable = function (e) { + var rowHolder = this.table.rowManager.getElement(), + scrollTop = rowHolder.scrollTop, + yPos = (this.touchMove ? e.touches[0].pageY : e.pageY) - rowHolder.getBoundingClientRect().top + scrollTop, + scrollPos; + + this.hoverElement.style.top = yPos - this.startY + "px"; + }; + + MoveRows.prototype.moveHoverConnections = function (e) { + this.hoverElement.style.left = this.startX + (this.touchMove ? e.touches[0].pageX : e.pageX) + "px"; + this.hoverElement.style.top = this.startY + (this.touchMove ? e.touches[0].pageY : e.pageY) + "px"; + }; + + MoveRows.prototype.elementRowDrop = function (e, element, row) { + if (this.table.options.movableRowsElementDrop) { + this.table.options.movableRowsElementDrop(e, element, row ? row.getComponent() : false); + } + }; + + //establish connection with other tables + MoveRows.prototype.connectToTables = function (row) { + var _this74 = this; + + var connectionTables; + + if (this.connectionSelectorsTables) { + connectionTables = this.table.modules.comms.getConnections(this.connectionSelectorsTables); + + this.table.options.movableRowsSendingStart.call(this.table, connectionTables); + + this.table.modules.comms.send(this.connectionSelectorsTables, "moveRow", "connect", { + row: row + }); + } + + if (this.connectionSelectorsElements) { + + this.connectionElements = []; + + if (!Array.isArray(this.connectionSelectorsElements)) { + this.connectionSelectorsElements = [this.connectionSelectorsElements]; + } + + this.connectionSelectorsElements.forEach(function (query) { + if (typeof query === "string") { + _this74.connectionElements = _this74.connectionElements.concat(Array.prototype.slice.call(document.querySelectorAll(query))); + } else { + _this74.connectionElements.push(query); + } + }); + + this.connectionElements.forEach(function (element) { + var dropEvent = function dropEvent(e) { + _this74.elementRowDrop(e, element, _this74.moving); + }; + + element.addEventListener("mouseup", dropEvent); + element.tabulatorElementDropEvent = dropEvent; + + element.classList.add("tabulator-movingrow-receiving"); + }); + } + }; + + //disconnect from other tables + MoveRows.prototype.disconnectFromTables = function () { + var connectionTables; + + if (this.connectionSelectorsTables) { + connectionTables = this.table.modules.comms.getConnections(this.connectionSelectorsTables); + + this.table.options.movableRowsSendingStop.call(this.table, connectionTables); + + this.table.modules.comms.send(this.connectionSelectorsTables, "moveRow", "disconnect"); + } + + this.connectionElements.forEach(function (element) { + element.classList.remove("tabulator-movingrow-receiving"); + element.removeEventListener("mouseup", element.tabulatorElementDropEvent); + delete element.tabulatorElementDropEvent; + }); + }; + + //accept incomming connection + MoveRows.prototype.connect = function (table, row) { + var self = this; + if (!this.connectedTable) { + this.connectedTable = table; + this.connectedRow = row; + + this.table.element.classList.add("tabulator-movingrow-receiving"); + + self.table.rowManager.getDisplayRows().forEach(function (row) { + if (row.type === "row" && row.modules.moveRow && row.modules.moveRow.mouseup) { + row.getElement().addEventListener("mouseup", row.modules.moveRow.mouseup); + } + }); + + self.tableRowDropEvent = self.tableRowDrop.bind(self); + + self.table.element.addEventListener("mouseup", self.tableRowDropEvent); + + this.table.options.movableRowsReceivingStart.call(this.table, row, table); + + return true; + } else { + console.warn("Move Row Error - Table cannot accept connection, already connected to table:", this.connectedTable); + return false; + } + }; + + //close incomming connection + MoveRows.prototype.disconnect = function (table) { + var self = this; + if (table === this.connectedTable) { + this.connectedTable = false; + this.connectedRow = false; + + this.table.element.classList.remove("tabulator-movingrow-receiving"); + + self.table.rowManager.getDisplayRows().forEach(function (row) { + if (row.type === "row" && row.modules.moveRow && row.modules.moveRow.mouseup) { + row.getElement().removeEventListener("mouseup", row.modules.moveRow.mouseup); + } + }); + + self.table.element.removeEventListener("mouseup", self.tableRowDropEvent); + + this.table.options.movableRowsReceivingStop.call(this.table, table); + } else { + console.warn("Move Row Error - trying to disconnect from non connected table"); + } + }; + + MoveRows.prototype.dropComplete = function (table, row, success) { + var sender = false; + + if (success) { + + switch (_typeof(this.table.options.movableRowsSender)) { + case "string": + sender = this.senders[this.table.options.movableRowsSender]; + break; + + case "function": + sender = this.table.options.movableRowsSender; + break; + } + + if (sender) { + sender.call(this, this.moving.getComponent(), row ? row.getComponent() : undefined, table); + } else { + if (this.table.options.movableRowsSender) { + console.warn("Mover Row Error - no matching sender found:", this.table.options.movableRowsSender); + } + } + + this.table.options.movableRowsSent.call(this.table, this.moving.getComponent(), row ? row.getComponent() : undefined, table); + } else { + this.table.options.movableRowsSentFailed.call(this.table, this.moving.getComponent(), row ? row.getComponent() : undefined, table); + } + + this.endMove(); + }; + + MoveRows.prototype.tableRowDrop = function (e, row) { + var receiver = false, + success = false; + + console.trace("drop"); + + e.stopImmediatePropagation(); + + switch (_typeof(this.table.options.movableRowsReceiver)) { + case "string": + receiver = this.receivers[this.table.options.movableRowsReceiver]; + break; + + case "function": + receiver = this.table.options.movableRowsReceiver; + break; + } + + if (receiver) { + success = receiver.call(this, this.connectedRow.getComponent(), row ? row.getComponent() : undefined, this.connectedTable); + } else { + console.warn("Mover Row Error - no matching receiver found:", this.table.options.movableRowsReceiver); + } + + if (success) { + this.table.options.movableRowsReceived.call(this.table, this.connectedRow.getComponent(), row ? row.getComponent() : undefined, this.connectedTable); + } else { + this.table.options.movableRowsReceivedFailed.call(this.table, this.connectedRow.getComponent(), row ? row.getComponent() : undefined, this.connectedTable); + } + + this.table.modules.comms.send(this.connectedTable, "moveRow", "dropcomplete", { + row: row, + success: success + }); + }; + + MoveRows.prototype.receivers = { + insert: function insert(fromRow, toRow, fromTable) { + this.table.addRow(fromRow.getData(), undefined, toRow); + return true; + }, + + add: function add(fromRow, toRow, fromTable) { + this.table.addRow(fromRow.getData()); + return true; + }, + + update: function update(fromRow, toRow, fromTable) { + if (toRow) { + toRow.update(fromRow.getData()); + return true; + } + + return false; + }, + + replace: function replace(fromRow, toRow, fromTable) { + if (toRow) { + this.table.addRow(fromRow.getData(), undefined, toRow); + toRow.delete(); + return true; + } + + return false; + } + }; + + MoveRows.prototype.senders = { + delete: function _delete(fromRow, toRow, toTable) { + fromRow.delete(); + } + }; + + MoveRows.prototype.commsReceived = function (table, action, data) { + switch (action) { + case "connect": + return this.connect(table, data.row); + break; + + case "disconnect": + return this.disconnect(table); + break; + + case "dropcomplete": + return this.dropComplete(table, data.row, data.success); + break; + } + }; + + Tabulator.prototype.registerModule("moveRow", MoveRows); + var Mutator = function Mutator(table) { + this.table = table; //hold Tabulator object + this.allowedTypes = ["", "data", "edit", "clipboard"]; //list of muatation types + this.enabled = true; + }; + + //initialize column mutator + Mutator.prototype.initializeColumn = function (column) { + var self = this, + match = false, + config = {}; + + this.allowedTypes.forEach(function (type) { + var key = "mutator" + (type.charAt(0).toUpperCase() + type.slice(1)), + mutator; + + if (column.definition[key]) { + mutator = self.lookupMutator(column.definition[key]); + + if (mutator) { + match = true; + + config[key] = { + mutator: mutator, + params: column.definition[key + "Params"] || {} + }; + } + } + }); + + if (match) { + column.modules.mutate = config; + } + }; + + Mutator.prototype.lookupMutator = function (value) { + var mutator = false; + + //set column mutator + switch (typeof value === 'undefined' ? 'undefined' : _typeof(value)) { + case "string": + if (this.mutators[value]) { + mutator = this.mutators[value]; + } else { + console.warn("Mutator Error - No such mutator found, ignoring: ", value); + } + break; + + case "function": + mutator = value; + break; + } + + return mutator; + }; + + //apply mutator to row + Mutator.prototype.transformRow = function (data, type, updatedData) { + var self = this, + key = "mutator" + (type.charAt(0).toUpperCase() + type.slice(1)), + value; + + if (this.enabled) { + + self.table.columnManager.traverse(function (column) { + var mutator, params, component; + + if (column.modules.mutate) { + mutator = column.modules.mutate[key] || column.modules.mutate.mutator || false; + + if (mutator) { + value = column.getFieldValue(typeof updatedData !== "undefined" ? updatedData : data); + + if (type == "data" || typeof value !== "undefined") { + component = column.getComponent(); + params = typeof mutator.params === "function" ? mutator.params(value, data, type, component) : mutator.params; + column.setFieldValue(data, mutator.mutator(value, data, type, params, component)); + } + } + } + }); + } + + return data; + }; + + //apply mutator to new cell value + Mutator.prototype.transformCell = function (cell, value) { + var mutator = cell.column.modules.mutate.mutatorEdit || cell.column.modules.mutate.mutator || false, + tempData = {}; + + if (mutator) { + tempData = Object.assign(tempData, cell.row.getData()); + cell.column.setFieldValue(tempData, value); + return mutator.mutator(value, tempData, "edit", mutator.params, cell.getComponent()); + } else { + return value; + } + }; + + Mutator.prototype.enable = function () { + this.enabled = true; + }; + + Mutator.prototype.disable = function () { + this.enabled = false; + }; + + //default mutators + Mutator.prototype.mutators = {}; + + Tabulator.prototype.registerModule("mutator", Mutator); + var Page = function Page(table) { + + this.table = table; //hold Tabulator object + + this.mode = "local"; + this.progressiveLoad = false; + + this.size = 0; + this.page = 1; + this.count = 5; + this.max = 1; + + this.displayIndex = 0; //index in display pipeline + + this.initialLoad = true; + + this.pageSizes = []; + + this.dataReceivedNames = {}; + this.dataSentNames = {}; + + this.createElements(); + }; + + Page.prototype.createElements = function () { + + var button; + + this.element = document.createElement("span"); + this.element.classList.add("tabulator-paginator"); + + this.pagesElement = document.createElement("span"); + this.pagesElement.classList.add("tabulator-pages"); + + button = document.createElement("button"); + button.classList.add("tabulator-page"); + button.setAttribute("type", "button"); + button.setAttribute("role", "button"); + button.setAttribute("aria-label", ""); + button.setAttribute("title", ""); + + this.firstBut = button.cloneNode(true); + this.firstBut.setAttribute("data-page", "first"); + + this.prevBut = button.cloneNode(true); + this.prevBut.setAttribute("data-page", "prev"); + + this.nextBut = button.cloneNode(true); + this.nextBut.setAttribute("data-page", "next"); + + this.lastBut = button.cloneNode(true); + this.lastBut.setAttribute("data-page", "last"); + + if (this.table.options.paginationSizeSelector) { + this.pageSizeSelect = document.createElement("select"); + this.pageSizeSelect.classList.add("tabulator-page-size"); + } + }; + + Page.prototype.generatePageSizeSelectList = function () { + var _this75 = this; + + var pageSizes = []; + + if (this.pageSizeSelect) { + + if (Array.isArray(this.table.options.paginationSizeSelector)) { + pageSizes = this.table.options.paginationSizeSelector; + this.pageSizes = pageSizes; + + if (this.pageSizes.indexOf(this.size) == -1) { + pageSizes.unshift(this.size); + } + } else { + + if (this.pageSizes.indexOf(this.size) == -1) { + pageSizes = []; + + for (var _i13 = 1; _i13 < 5; _i13++) { + pageSizes.push(this.size * _i13); + } + + this.pageSizes = pageSizes; + } else { + pageSizes = this.pageSizes; + } + } + + while (this.pageSizeSelect.firstChild) { + this.pageSizeSelect.removeChild(this.pageSizeSelect.firstChild); + }pageSizes.forEach(function (item) { + var itemEl = document.createElement("option"); + itemEl.value = item; + + if (item === true) { + _this75.table.modules.localize.bind("pagination|all", function (value) { + itemEl.innerHTML = value; + }); + } else { + itemEl.innerHTML = item; + } + + _this75.pageSizeSelect.appendChild(itemEl); + }); + + this.pageSizeSelect.value = this.size; + } + }; + + //setup pageination + Page.prototype.initialize = function (hidden) { + var self = this, + pageSelectLabel, + testElRow, + testElCell; + + //update param names + this.dataSentNames = Object.assign({}, this.paginationDataSentNames); + this.dataSentNames = Object.assign(this.dataSentNames, this.table.options.paginationDataSent); + + this.dataReceivedNames = Object.assign({}, this.paginationDataReceivedNames); + this.dataReceivedNames = Object.assign(this.dataReceivedNames, this.table.options.paginationDataReceived); + + //build pagination element + + //bind localizations + self.table.modules.localize.bind("pagination|first", function (value) { + self.firstBut.innerHTML = value; + }); + + self.table.modules.localize.bind("pagination|first_title", function (value) { + self.firstBut.setAttribute("aria-label", value); + self.firstBut.setAttribute("title", value); + }); + + self.table.modules.localize.bind("pagination|prev", function (value) { + self.prevBut.innerHTML = value; + }); + + self.table.modules.localize.bind("pagination|prev_title", function (value) { + self.prevBut.setAttribute("aria-label", value); + self.prevBut.setAttribute("title", value); + }); + + self.table.modules.localize.bind("pagination|next", function (value) { + self.nextBut.innerHTML = value; + }); + + self.table.modules.localize.bind("pagination|next_title", function (value) { + self.nextBut.setAttribute("aria-label", value); + self.nextBut.setAttribute("title", value); + }); + + self.table.modules.localize.bind("pagination|last", function (value) { + self.lastBut.innerHTML = value; + }); + + self.table.modules.localize.bind("pagination|last_title", function (value) { + self.lastBut.setAttribute("aria-label", value); + self.lastBut.setAttribute("title", value); + }); + + //click bindings + self.firstBut.addEventListener("click", function () { + self.setPage(1).then(function () {}).catch(function () {}); + }); + + self.prevBut.addEventListener("click", function () { + self.previousPage().then(function () {}).catch(function () {}); + }); + + self.nextBut.addEventListener("click", function () { + self.nextPage().then(function () {}).catch(function () {}); + }); + + self.lastBut.addEventListener("click", function () { + self.setPage(self.max).then(function () {}).catch(function () {}); + }); + + if (self.table.options.paginationElement) { + self.element = self.table.options.paginationElement; + } + + if (this.pageSizeSelect) { + pageSelectLabel = document.createElement("label"); + + self.table.modules.localize.bind("pagination|page_size", function (value) { + self.pageSizeSelect.setAttribute("aria-label", value); + self.pageSizeSelect.setAttribute("title", value); + pageSelectLabel.innerHTML = value; + }); + + self.element.appendChild(pageSelectLabel); + self.element.appendChild(self.pageSizeSelect); + + self.pageSizeSelect.addEventListener("change", function (e) { + self.setPageSize(self.pageSizeSelect.value == "true" ? true : self.pageSizeSelect.value); + self.setPage(1).then(function () {}).catch(function () {}); + }); + } + + //append to DOM + self.element.appendChild(self.firstBut); + self.element.appendChild(self.prevBut); + self.element.appendChild(self.pagesElement); + self.element.appendChild(self.nextBut); + self.element.appendChild(self.lastBut); + + if (!self.table.options.paginationElement && !hidden) { + self.table.footerManager.append(self.element, self); + } + + //set default values + self.mode = self.table.options.pagination; + + if (self.table.options.paginationSize) { + self.size = self.table.options.paginationSize; + } else { + testElRow = document.createElement("div"); + testElRow.classList.add("tabulator-row"); + testElRow.style.visibility = hidden; + + testElCell = document.createElement("div"); + testElCell.classList.add("tabulator-cell"); + testElCell.innerHTML = "Page Row Test"; + + testElRow.appendChild(testElCell); + + self.table.rowManager.getTableElement().appendChild(testElRow); + + self.size = Math.floor(self.table.rowManager.getElement().clientHeight / testElRow.offsetHeight); + + self.table.rowManager.getTableElement().removeChild(testElRow); + } + + // self.page = self.table.options.paginationInitialPage || 1; + self.count = self.table.options.paginationButtonCount; + + self.generatePageSizeSelectList(); + }; + + Page.prototype.initializeProgressive = function (mode) { + this.initialize(true); + this.mode = "progressive_" + mode; + this.progressiveLoad = true; + }; + + Page.prototype.setDisplayIndex = function (index) { + this.displayIndex = index; + }; + + Page.prototype.getDisplayIndex = function () { + return this.displayIndex; + }; + + //calculate maximum page from number of rows + Page.prototype.setMaxRows = function (rowCount) { + if (!rowCount) { + this.max = 1; + } else { + this.max = this.size === true ? 1 : Math.ceil(rowCount / this.size); + } + + if (this.page > this.max) { + this.page = this.max; + } + }; + + //reset to first page without triggering action + Page.prototype.reset = function (force, columnsChanged) { + if (this.mode == "local" || force) { + this.page = 1; + } + + if (columnsChanged) { + this.initialLoad = true; + } + + return true; + }; + + //set the maxmum page + Page.prototype.setMaxPage = function (max) { + + max = parseInt(max); + + this.max = max || 1; + + if (this.page > this.max) { + this.page = this.max; + this.trigger(); + } + }; + + //set current page number + Page.prototype.setPage = function (page) { + var _this76 = this; + + var self = this; + + switch (page) { + case "first": + return this.setPage(1); + break; + + case "prev": + return this.previousPage(); + break; + + case "next": + return this.nextPage(); + break; + + case "last": + return this.setPage(this.max); + break; + } + + return new Promise(function (resolve, reject) { + + page = parseInt(page); + + if (page > 0 && page <= _this76.max) { + _this76.page = page; + _this76.trigger().then(function () { + resolve(); + }).catch(function () { + reject(); + }); + + if (self.table.options.persistence && self.table.modExists("persistence", true) && self.table.modules.persistence.config.page) { + self.table.modules.persistence.save("page"); + } + } else { + console.warn("Pagination Error - Requested page is out of range of 1 - " + _this76.max + ":", page); + reject(); + } + }); + }; + + Page.prototype.setPageToRow = function (row) { + var _this77 = this; + + return new Promise(function (resolve, reject) { + + var rows = _this77.table.rowManager.getDisplayRows(_this77.displayIndex - 1); + var index = rows.indexOf(row); + + if (index > -1) { + var page = _this77.size === true ? 1 : Math.ceil((index + 1) / _this77.size); + + _this77.setPage(page).then(function () { + resolve(); + }).catch(function () { + reject(); + }); + } else { + console.warn("Pagination Error - Requested row is not visible"); + reject(); + } + }); + }; + + Page.prototype.setPageSize = function (size) { + if (size !== true) { + size = parseInt(size); + } + + if (size > 0) { + this.size = size; + } + + if (this.pageSizeSelect) { + // this.pageSizeSelect.value = size; + this.generatePageSizeSelectList(); + } + + if (this.table.options.persistence && this.table.modExists("persistence", true) && this.table.modules.persistence.config.page) { + this.table.modules.persistence.save("page"); + } + }; + + //setup the pagination buttons + Page.prototype._setPageButtons = function () { + var self = this; + + var leftSize = Math.floor((this.count - 1) / 2); + var rightSize = Math.ceil((this.count - 1) / 2); + var min = this.max - this.page + leftSize + 1 < this.count ? this.max - this.count + 1 : Math.max(this.page - leftSize, 1); + var max = this.page <= rightSize ? Math.min(this.count, this.max) : Math.min(this.page + rightSize, this.max); + + while (self.pagesElement.firstChild) { + self.pagesElement.removeChild(self.pagesElement.firstChild); + }if (self.page == 1) { + self.firstBut.disabled = true; + self.prevBut.disabled = true; + } else { + self.firstBut.disabled = false; + self.prevBut.disabled = false; + } + + if (self.page == self.max) { + self.lastBut.disabled = true; + self.nextBut.disabled = true; + } else { + self.lastBut.disabled = false; + self.nextBut.disabled = false; + } + + for (var _i14 = min; _i14 <= max; _i14++) { + if (_i14 > 0 && _i14 <= self.max) { + self.pagesElement.appendChild(self._generatePageButton(_i14)); + } + } + + this.footerRedraw(); + }; + + Page.prototype._generatePageButton = function (page) { + var self = this, + button = document.createElement("button"); + + button.classList.add("tabulator-page"); + if (page == self.page) { + button.classList.add("active"); + } + + button.setAttribute("type", "button"); + button.setAttribute("role", "button"); + + self.table.modules.localize.bind("pagination|page_title", function (value) { + button.setAttribute("aria-label", value + " " + page); + button.setAttribute("title", value + " " + page); + }); + + button.setAttribute("data-page", page); + button.textContent = page; + + button.addEventListener("click", function (e) { + self.setPage(page).then(function () {}).catch(function () {}); + }); + + return button; + }; + + //previous page + Page.prototype.previousPage = function () { + var _this78 = this; + + return new Promise(function (resolve, reject) { + if (_this78.page > 1) { + _this78.page--; + _this78.trigger().then(function () { + resolve(); + }).catch(function () { + reject(); + }); + + if (_this78.table.options.persistence && _this78.table.modExists("persistence", true) && _this78.table.modules.persistence.config.page) { + _this78.table.modules.persistence.save("page"); + } + } else { + console.warn("Pagination Error - Previous page would be less than page 1:", 0); + reject(); + } + }); + }; + + //next page + Page.prototype.nextPage = function () { + var _this79 = this; + + return new Promise(function (resolve, reject) { + if (_this79.page < _this79.max) { + _this79.page++; + _this79.trigger().then(function () { + resolve(); + }).catch(function () { + reject(); + }); + + if (_this79.table.options.persistence && _this79.table.modExists("persistence", true) && _this79.table.modules.persistence.config.page) { + _this79.table.modules.persistence.save("page"); + } + } else { + if (!_this79.progressiveLoad) { + console.warn("Pagination Error - Next page would be greater than maximum page of " + _this79.max + ":", _this79.max + 1); + } + reject(); + } + }); + }; + + //return current page number + Page.prototype.getPage = function () { + return this.page; + }; + + //return max page number + Page.prototype.getPageMax = function () { + return this.max; + }; + + Page.prototype.getPageSize = function (size) { + return this.size; + }; + + Page.prototype.getMode = function () { + return this.mode; + }; + + //return appropriate rows for current page + Page.prototype.getRows = function (data) { + var output, start, end; + + if (this.mode == "local") { + output = []; + + if (this.size === true) { + start = 0; + end = data.length; + } else { + start = this.size * (this.page - 1); + end = start + parseInt(this.size); + } + + this._setPageButtons(); + + for (var _i15 = start; _i15 < end; _i15++) { + if (data[_i15]) { + output.push(data[_i15]); + } + } + + return output; + } else { + + this._setPageButtons(); + + return data.slice(0); + } + }; + + Page.prototype.trigger = function () { + var _this80 = this; + + var left; + + return new Promise(function (resolve, reject) { + + switch (_this80.mode) { + case "local": + left = _this80.table.rowManager.scrollLeft; + + _this80.table.rowManager.refreshActiveData("page"); + _this80.table.rowManager.scrollHorizontal(left); + + _this80.table.options.pageLoaded.call(_this80.table, _this80.getPage()); + resolve(); + break; + + case "remote": + case "progressive_load": + case "progressive_scroll": + _this80.table.modules.ajax.blockActiveRequest(); + _this80._getRemotePage().then(function () { + resolve(); + }).catch(function () { + reject(); + }); + break; + + default: + console.warn("Pagination Error - no such pagination mode:", _this80.mode); + reject(); + } + }); + }; + + Page.prototype._getRemotePage = function () { + var _this81 = this; + + var self = this, + oldParams, + pageParams; + + return new Promise(function (resolve, reject) { + + if (!self.table.modExists("ajax", true)) { + reject(); + } + + //record old params and restore after request has been made + oldParams = Tabulator.prototype.helpers.deepClone(self.table.modules.ajax.getParams() || {}); + pageParams = self.table.modules.ajax.getParams(); + + //configure request params + pageParams[_this81.dataSentNames.page] = self.page; + + //set page size if defined + if (_this81.size) { + pageParams[_this81.dataSentNames.size] = _this81.size; + } + + //set sort data if defined + if (_this81.table.options.ajaxSorting && _this81.table.modExists("sort")) { + var sorters = self.table.modules.sort.getSort(); + + sorters.forEach(function (item) { + delete item.column; + }); + + pageParams[_this81.dataSentNames.sorters] = sorters; + } + + //set filter data if defined + if (_this81.table.options.ajaxFiltering && _this81.table.modExists("filter")) { + var filters = self.table.modules.filter.getFilters(true, true); + pageParams[_this81.dataSentNames.filters] = filters; + } + + self.table.modules.ajax.setParams(pageParams); + + self.table.modules.ajax.sendRequest(_this81.progressiveLoad).then(function (data) { + self._parseRemoteData(data); + resolve(); + }).catch(function (e) { + reject(); + }); + + self.table.modules.ajax.setParams(oldParams); + }); + }; + + Page.prototype._parseRemoteData = function (data) { + var self = this, + left, + data, + margin; + + if (typeof data[this.dataReceivedNames.last_page] === "undefined") { + console.warn("Remote Pagination Error - Server response missing '" + this.dataReceivedNames.last_page + "' property"); + } + + if (data[this.dataReceivedNames.data]) { + this.max = parseInt(data[this.dataReceivedNames.last_page]) || 1; + + if (this.progressiveLoad) { + switch (this.mode) { + case "progressive_load": + + if (this.page == 1) { + this.table.rowManager.setData(data[this.dataReceivedNames.data], false, this.initialLoad && this.page == 1); + } else { + this.table.rowManager.addRows(data[this.dataReceivedNames.data]); + } + + if (this.page < this.max) { + setTimeout(function () { + self.nextPage().then(function () {}).catch(function () {}); + }, self.table.options.ajaxProgressiveLoadDelay); + } + break; + + case "progressive_scroll": + data = this.table.rowManager.getData().concat(data[this.dataReceivedNames.data]); + + this.table.rowManager.setData(data, true, this.initialLoad && this.page == 1); + + margin = this.table.options.ajaxProgressiveLoadScrollMargin || this.table.rowManager.element.clientHeight * 2; + + if (self.table.rowManager.element.scrollHeight <= self.table.rowManager.element.clientHeight + margin) { + self.nextPage().then(function () {}).catch(function () {}); + } + break; + } + } else { + left = this.table.rowManager.scrollLeft; + + this.table.rowManager.setData(data[this.dataReceivedNames.data], false, this.initialLoad && this.page == 1); + + this.table.rowManager.scrollHorizontal(left); + + this.table.columnManager.scrollHorizontal(left); + + this.table.options.pageLoaded.call(this.table, this.getPage()); + } + + this.initialLoad = false; + } else { + console.warn("Remote Pagination Error - Server response missing '" + this.dataReceivedNames.data + "' property"); + } + }; + + //handle the footer element being redrawn + Page.prototype.footerRedraw = function () { + var footer = this.table.footerManager.element; + + if (Math.ceil(footer.clientWidth) - footer.scrollWidth < 0) { + this.pagesElement.style.display = 'none'; + } else { + this.pagesElement.style.display = ''; + + if (Math.ceil(footer.clientWidth) - footer.scrollWidth < 0) { + this.pagesElement.style.display = 'none'; + } + } + }; + + //set the paramter names for pagination requests + Page.prototype.paginationDataSentNames = { + "page": "page", + "size": "size", + "sorters": "sorters", + // "sort_dir":"sort_dir", + "filters": "filters" + // "filter_value":"filter_value", + // "filter_type":"filter_type", + }; + + //set the property names for pagination responses + Page.prototype.paginationDataReceivedNames = { + "current_page": "current_page", + "last_page": "last_page", + "data": "data" + }; + + Tabulator.prototype.registerModule("page", Page); + + var Persistence = function Persistence(table) { + this.table = table; //hold Tabulator object + this.mode = ""; + this.id = ""; + // this.persistProps = ["field", "width", "visible"]; + this.defWatcherBlock = false; + this.config = {}; + this.readFunc = false; + this.writeFunc = false; + }; + + // Test for whether localStorage is available for use. + Persistence.prototype.localStorageTest = function () { + var testKey = "_tabulator_test"; + + try { + window.localStorage.setItem(testKey, testKey); + window.localStorage.removeItem(testKey); + return true; + } catch (e) { + return false; + } + }; + + //setup parameters + Persistence.prototype.initialize = function () { + //determine persistent layout storage type + + var mode = this.table.options.persistenceMode, + id = this.table.options.persistenceID, + retreivedData; + + this.mode = mode !== true ? mode : this.localStorageTest() ? "local" : "cookie"; + + if (this.table.options.persistenceReaderFunc) { + if (typeof this.table.options.persistenceReaderFunc === "function") { + this.readFunc = this.table.options.persistenceReaderFunc; + } else { + if (this.readers[this.table.options.persistenceReaderFunc]) { + this.readFunc = this.readers[this.table.options.persistenceReaderFunc]; + } else { + console.warn("Persistence Read Error - invalid reader set", this.table.options.persistenceReaderFunc); + } + } + } else { + if (this.readers[this.mode]) { + this.readFunc = this.readers[this.mode]; + } else { + console.warn("Persistence Read Error - invalid reader set", this.mode); + } + } + + if (this.table.options.persistenceWriterFunc) { + if (typeof this.table.options.persistenceWriterFunc === "function") { + this.writeFunc = this.table.options.persistenceWriterFunc; + } else { + if (this.readers[this.table.options.persistenceWriterFunc]) { + this.writeFunc = this.readers[this.table.options.persistenceWriterFunc]; + } else { + console.warn("Persistence Write Error - invalid reader set", this.table.options.persistenceWriterFunc); + } + } + } else { + if (this.writers[this.mode]) { + this.writeFunc = this.writers[this.mode]; + } else { + console.warn("Persistence Write Error - invalid writer set", this.mode); + } + } + + //set storage tag + this.id = "tabulator-" + (id || this.table.element.getAttribute("id") || ""); + + this.config = { + sort: this.table.options.persistence === true || this.table.options.persistence.sort, + filter: this.table.options.persistence === true || this.table.options.persistence.filter, + group: this.table.options.persistence === true || this.table.options.persistence.group, + page: this.table.options.persistence === true || this.table.options.persistence.page, + columns: this.table.options.persistence === true ? ["title", "width", "visible"] : this.table.options.persistence.columns + }; + + //load pagination data if needed + if (this.config.page) { + retreivedData = this.retreiveData("page"); + + if (retreivedData) { + if (typeof retreivedData.paginationSize !== "undefined" && (this.config.page === true || this.config.page.size)) { + this.table.options.paginationSize = retreivedData.paginationSize; + } + + if (typeof retreivedData.paginationInitialPage !== "undefined" && (this.config.page === true || this.config.page.page)) { + this.table.options.paginationInitialPage = retreivedData.paginationInitialPage; + } + } + } + + //load group data if needed + if (this.config.group) { + retreivedData = this.retreiveData("group"); + + if (retreivedData) { + if (typeof retreivedData.groupBy !== "undefined" && (this.config.group === true || this.config.group.groupBy)) { + this.table.options.groupBy = retreivedData.groupBy; + } + if (typeof retreivedData.groupStartOpen !== "undefined" && (this.config.group === true || this.config.group.groupStartOpen)) { + this.table.options.groupStartOpen = retreivedData.groupStartOpen; + } + if (typeof retreivedData.groupHeader !== "undefined" && (this.config.group === true || this.config.group.groupHeader)) { + this.table.options.groupHeader = retreivedData.groupHeader; + } + } + } + }; + + Persistence.prototype.initializeColumn = function (column) { + var self = this, + def, + keys; + + if (this.config.columns) { + this.defWatcherBlock = true; + + def = column.getDefinition(); + + keys = this.config.columns === true ? Object.keys(def) : this.config.columns; + + keys.forEach(function (key) { + var props = Object.getOwnPropertyDescriptor(def, key); + var value = def[key]; + if (props) { + Object.defineProperty(def, key, { + set: function set(newValue) { + value = newValue; + + if (!self.defWatcherBlock) { + self.save("columns"); + } + + if (props.set) { + props.set(newValue); + } + }, + get: function get() { + if (props.get) { + props.get(); + } + return value; + } + }); + } + }); + + this.defWatcherBlock = false; + } + }; + + //load saved definitions + Persistence.prototype.load = function (type, current) { + var data = this.retreiveData(type); + + if (current) { + data = data ? this.mergeDefinition(current, data) : current; + } + + return data; + }; + + //retreive data from memory + Persistence.prototype.retreiveData = function (type) { + return this.readFunc ? this.readFunc(this.id, type) : false; + }; + + //merge old and new column definitions + Persistence.prototype.mergeDefinition = function (oldCols, newCols) { + var self = this, + output = []; + + // oldCols = oldCols || []; + newCols = newCols || []; + + newCols.forEach(function (column, to) { + + var from = self._findColumn(oldCols, column), + keys; + + if (from) { + + if (self.config.columns === true || self.config.columns == undefined) { + keys = Object.keys(from); + keys.push("width"); + } else { + keys = self.config.columns; + } + + keys.forEach(function (key) { + if (typeof column[key] !== "undefined") { + from[key] = column[key]; + } + }); + + if (from.columns) { + from.columns = self.mergeDefinition(from.columns, column.columns); + } + + output.push(from); + } + }); + + oldCols.forEach(function (column, i) { + var from = self._findColumn(newCols, column); + if (!from) { + if (output.length > i) { + output.splice(i, 0, column); + } else { + output.push(column); + } + } + }); + + return output; + }; + + //find matching columns + Persistence.prototype._findColumn = function (columns, subject) { + var type = subject.columns ? "group" : subject.field ? "field" : "object"; + + return columns.find(function (col) { + switch (type) { + case "group": + return col.title === subject.title && col.columns.length === subject.columns.length; + break; + + case "field": + return col.field === subject.field; + break; + + case "object": + return col === subject; + break; + } + }); + }; + + //save data + Persistence.prototype.save = function (type) { + var data = {}; + + switch (type) { + case "columns": + data = this.parseColumns(this.table.columnManager.getColumns()); + break; + + case "filter": + data = this.table.modules.filter.getFilters(); + break; + + case "sort": + data = this.validateSorters(this.table.modules.sort.getSort()); + break; + + case "group": + data = this.getGroupConfig(); + break; + + case "page": + data = this.getPageConfig(); + break; + } + + if (this.writeFunc) { + this.writeFunc(this.id, type, data); + } + }; + + //ensure sorters contain no function data + Persistence.prototype.validateSorters = function (data) { + data.forEach(function (item) { + item.column = item.field; + delete item.field; + }); + + return data; + }; + + Persistence.prototype.getGroupConfig = function () { + var data = {}; + + if (this.config.group) { + if (this.config.group === true || this.config.group.groupBy) { + data.groupBy = this.table.options.groupBy; + } + + if (this.config.group === true || this.config.group.groupStartOpen) { + data.groupStartOpen = this.table.options.groupStartOpen; + } + + if (this.config.group === true || this.config.group.groupHeader) { + data.groupHeader = this.table.options.groupHeader; + } + } + + return data; + }; + + Persistence.prototype.getPageConfig = function () { + var data = {}; + + if (this.config.page) { + if (this.config.page === true || this.config.page.size) { + data.paginationSize = this.table.modules.page.getPageSize(); + } + + if (this.config.page === true || this.config.page.page) { + data.paginationInitialPage = this.table.modules.page.getPage(); + } + } + + return data; + }; + + //parse columns for data to store + Persistence.prototype.parseColumns = function (columns) { + var self = this, + definitions = [], + excludedKeys = ["headerContextMenu", "headerMenu", "contextMenu", "clickMenu"]; + + columns.forEach(function (column) { + var defStore = {}, + colDef = column.getDefinition(), + keys; + + if (column.isGroup) { + defStore.title = colDef.title; + defStore.columns = self.parseColumns(column.getColumns()); + } else { + defStore.field = column.getField(); + + if (self.config.columns === true || self.config.columns == undefined) { + keys = Object.keys(colDef); + keys.push("width"); + } else { + keys = self.config.columns; + } + + keys.forEach(function (key) { + + switch (key) { + case "width": + defStore.width = column.getWidth(); + break; + case "visible": + defStore.visible = column.visible; + break; + + default: + if (typeof colDef[key] !== "function" && excludedKeys.indexOf(key) === -1) { + defStore[key] = colDef[key]; + } + } + }); + } + + definitions.push(defStore); + }); + + return definitions; + }; + + // read peristence information from storage + Persistence.prototype.readers = { + local: function local(id, type) { + var data = localStorage.getItem(id + "-" + type); + + return data ? JSON.parse(data) : false; + }, + cookie: function cookie(id, type) { + var cookie = document.cookie, + key = id + "-" + type, + cookiePos = cookie.indexOf(key + "="), + end, + data; + + //if cookie exists, decode and load column data into tabulator + if (cookiePos > -1) { + cookie = cookie.substr(cookiePos); + + end = cookie.indexOf(";"); + + if (end > -1) { + cookie = cookie.substr(0, end); + } + + data = cookie.replace(key + "=", ""); + } + + return data ? JSON.parse(data) : false; + } + }; + + //write persistence information to storage + Persistence.prototype.writers = { + local: function local(id, type, data) { + localStorage.setItem(id + "-" + type, JSON.stringify(data)); + }, + cookie: function cookie(id, type, data) { + var expireDate = new Date(); + + expireDate.setDate(expireDate.getDate() + 10000); + + document.cookie = id + "-" + type + "=" + JSON.stringify(data) + "; expires=" + expireDate.toUTCString(); + } + }; + + Tabulator.prototype.registerModule("persistence", Persistence); + + var Print = function Print(table) { + this.table = table; //hold Tabulator object + this.element = false; + this.manualBlock = false; + }; + + Print.prototype.initialize = function () { + window.addEventListener("beforeprint", this.replaceTable.bind(this)); + window.addEventListener("afterprint", this.cleanup.bind(this)); + }; + + Print.prototype.replaceTable = function () { + if (!this.manualBlock) { + this.element = document.createElement("div"); + this.element.classList.add("tabulator-print-table"); + + this.element.appendChild(this.table.modules.export.genereateTable(this.table.options.printConfig, this.table.options.printStyled, this.table.options.printRowRange, "print")); + + this.table.element.style.display = "none"; + + this.table.element.parentNode.insertBefore(this.element, this.table.element); + } + }; + + Print.prototype.cleanup = function () { + document.body.classList.remove("tabulator-print-fullscreen-hide"); + + if (this.element && this.element.parentNode) { + this.element.parentNode.removeChild(this.element); + this.table.element.style.display = ""; + } + }; + + Print.prototype.printFullscreen = function (visible, style, config) { + var scrollX = window.scrollX, + scrollY = window.scrollY, + headerEl = document.createElement("div"), + footerEl = document.createElement("div"), + tableEl = this.table.modules.export.genereateTable(typeof config != "undefined" ? config : this.table.options.printConfig, typeof style != "undefined" ? style : this.table.options.printStyled, visible, "print"), + headerContent, + footerContent; + + this.manualBlock = true; + + this.element = document.createElement("div"); + this.element.classList.add("tabulator-print-fullscreen"); + + if (this.table.options.printHeader) { + headerEl.classList.add("tabulator-print-header"); + + headerContent = typeof this.table.options.printHeader == "function" ? this.table.options.printHeader.call(this.table) : this.table.options.printHeader; + + if (typeof headerContent == "string") { + headerEl.innerHTML = headerContent; + } else { + headerEl.appendChild(headerContent); + } + + this.element.appendChild(headerEl); + } + + this.element.appendChild(tableEl); + + if (this.table.options.printFooter) { + footerEl.classList.add("tabulator-print-footer"); + + footerContent = typeof this.table.options.printFooter == "function" ? this.table.options.printFooter.call(this.table) : this.table.options.printFooter; + + if (typeof footerContent == "string") { + footerEl.innerHTML = footerContent; + } else { + footerEl.appendChild(footerContent); + } + + this.element.appendChild(footerEl); + } + + document.body.classList.add("tabulator-print-fullscreen-hide"); + document.body.appendChild(this.element); + + if (this.table.options.printFormatter) { + this.table.options.printFormatter(this.element, tableEl); + } + + window.print(); + + this.cleanup(); + + window.scrollTo(scrollX, scrollY); + + this.manualBlock = false; + }; + + Tabulator.prototype.registerModule("print", Print); + var ReactiveData = function ReactiveData(table) { + this.table = table; //hold Tabulator object + this.data = false; + this.blocked = false; //block reactivity while performing update + this.origFuncs = {}; // hold original data array functions to allow replacement after data is done with + this.currentVersion = 0; + }; + + ReactiveData.prototype.watchData = function (data) { + var self = this, + pushFunc, + version; + + this.currentVersion++; + + version = this.currentVersion; + + self.unwatchData(); + + self.data = data; + + //override array push function + self.origFuncs.push = data.push; + + Object.defineProperty(self.data, "push", { + enumerable: false, + configurable: true, + value: function value() { + var args = Array.from(arguments); + + if (!self.blocked && version === self.currentVersion) { + args.forEach(function (arg) { + self.table.rowManager.addRowActual(arg, false); + }); + } + + return self.origFuncs.push.apply(data, arguments); + } + }); + + //override array unshift function + self.origFuncs.unshift = data.unshift; + + Object.defineProperty(self.data, "unshift", { + enumerable: false, + configurable: true, + value: function value() { + var args = Array.from(arguments); + + if (!self.blocked && version === self.currentVersion) { + args.forEach(function (arg) { + self.table.rowManager.addRowActual(arg, true); + }); + } + + return self.origFuncs.unshift.apply(data, arguments); + } + }); + + //override array shift function + self.origFuncs.shift = data.shift; + + Object.defineProperty(self.data, "shift", { + enumerable: false, + configurable: true, + value: function value() { + var row; + + if (!self.blocked && version === self.currentVersion) { + if (self.data.length) { + row = self.table.rowManager.getRowFromDataObject(self.data[0]); + + if (row) { + row.deleteActual(); + } + } + } + + return self.origFuncs.shift.call(data); + } + }); + + //override array pop function + self.origFuncs.pop = data.pop; + + Object.defineProperty(self.data, "pop", { + enumerable: false, + configurable: true, + value: function value() { + var row; + if (!self.blocked && version === self.currentVersion) { + if (self.data.length) { + row = self.table.rowManager.getRowFromDataObject(self.data[self.data.length - 1]); + + if (row) { + row.deleteActual(); + } + } + } + return self.origFuncs.pop.call(data); + } + }); + + //override array splice function + self.origFuncs.splice = data.splice; + + Object.defineProperty(self.data, "splice", { + enumerable: false, + configurable: true, + value: function value() { + var args = Array.from(arguments), + start = args[0] < 0 ? data.length + args[0] : args[0], + end = args[1], + newRows = args[2] ? args.slice(2) : false, + startRow; + + if (!self.blocked && version === self.currentVersion) { + + //add new rows + if (newRows) { + startRow = data[start] ? self.table.rowManager.getRowFromDataObject(data[start]) : false; + + if (startRow) { + newRows.forEach(function (rowData) { + self.table.rowManager.addRowActual(rowData, true, startRow, true); + }); + } else { + newRows = newRows.slice().reverse(); + + newRows.forEach(function (rowData) { + self.table.rowManager.addRowActual(rowData, true, false, true); + }); + } + } + + //delete removed rows + if (end !== 0) { + var oldRows = data.slice(start, typeof args[1] === "undefined" ? args[1] : start + end); + + oldRows.forEach(function (rowData, i) { + var row = self.table.rowManager.getRowFromDataObject(rowData); + + if (row) { + row.deleteActual(i !== oldRows.length - 1); + } + }); + } + + if (newRows || end !== 0) { + self.table.rowManager.reRenderInPosition(); + } + } + + return self.origFuncs.splice.apply(data, arguments); + } + }); + }; + + ReactiveData.prototype.unwatchData = function () { + if (this.data !== false) { + for (var key in this.origFuncs) { + Object.defineProperty(this.data, key, { + enumerable: true, + configurable: true, + writable: true, + value: this.origFuncs.key + }); + } + } + }; + + ReactiveData.prototype.watchRow = function (row) { + var data = row.getData(); + + this.blocked = true; + + for (var key in data) { + this.watchKey(row, data, key); + } + + if (this.table.options.dataTree) { + this.watchTreeChildren(row); + } + + this.blocked = false; + }; + + ReactiveData.prototype.watchTreeChildren = function (row) { + var self = this, + childField = row.getData()[this.table.options.dataTreeChildField], + origFuncs = {}; + + function rebuildTree() { + self.table.modules.dataTree.initializeRow(row); + self.table.modules.dataTree.layoutRow(row); + self.table.rowManager.refreshActiveData("tree", false, true); + } + + if (childField) { + + origFuncs.push = childField.push; + + Object.defineProperty(childField, "push", { + enumerable: false, + configurable: true, + value: function value() { + var result = origFuncs.push.apply(childField, arguments); + + rebuildTree(); + + return result; + } + }); + + origFuncs.unshift = childField.unshift; + + Object.defineProperty(childField, "unshift", { + enumerable: false, + configurable: true, + value: function value() { + var result = origFuncs.unshift.apply(childField, arguments); + + rebuildTree(); + + return result; + } + }); + + origFuncs.shift = childField.shift; + + Object.defineProperty(childField, "shift", { + enumerable: false, + configurable: true, + value: function value() { + var result = origFuncs.shift.call(childField); + + rebuildTree(); + + return result; + } + }); + + origFuncs.pop = childField.pop; + + Object.defineProperty(childField, "pop", { + enumerable: false, + configurable: true, + value: function value() { + var result = origFuncs.pop.call(childField); + + rebuildTree(); + + return result; + } + }); + + origFuncs.splice = childField.splice; + + Object.defineProperty(childField, "splice", { + enumerable: false, + configurable: true, + value: function value() { + var result = origFuncs.splice.apply(childField, arguments); + + rebuildTree(); + + return result; + } + }); + } + }; + + ReactiveData.prototype.watchKey = function (row, data, key) { + var self = this, + props = Object.getOwnPropertyDescriptor(data, key), + value = data[key], + version = this.currentVersion; + + Object.defineProperty(data, key, { + set: function set(newValue) { + value = newValue; + if (!self.blocked && version === self.currentVersion) { + var update = {}; + update[key] = newValue; + row.updateData(update); + } + + if (props.set) { + props.set(newValue); + } + }, + get: function get() { + + if (props.get) { + props.get(); + } + + return value; + } + }); + }; + + ReactiveData.prototype.unwatchRow = function (row) { + var data = row.getData(); + + for (var key in data) { + Object.defineProperty(data, key, { + value: data[key] + }); + } + }; + + ReactiveData.prototype.block = function () { + this.blocked = true; + }; + + ReactiveData.prototype.unblock = function () { + this.blocked = false; + }; + + Tabulator.prototype.registerModule("reactiveData", ReactiveData); + + var ResizeColumns = function ResizeColumns(table) { + this.table = table; //hold Tabulator object + this.startColumn = false; + this.startX = false; + this.startWidth = false; + this.handle = null; + this.prevHandle = null; + }; + + ResizeColumns.prototype.initializeColumn = function (type, column, element) { + var self = this, + variableHeight = false, + mode = this.table.options.resizableColumns; + + //set column resize mode + if (type === "header") { + variableHeight = column.definition.formatter == "textarea" || column.definition.variableHeight; + column.modules.resize = { variableHeight: variableHeight }; + } + + if (mode === true || mode == type) { + + var handle = document.createElement('div'); + handle.className = "tabulator-col-resize-handle"; + + var prevHandle = document.createElement('div'); + prevHandle.className = "tabulator-col-resize-handle prev"; + + handle.addEventListener("click", function (e) { + e.stopPropagation(); + }); + + var handleDown = function handleDown(e) { + var nearestColumn = column.getLastColumn(); + + if (nearestColumn && self._checkResizability(nearestColumn)) { + self.startColumn = column; + self._mouseDown(e, nearestColumn, handle); + } + }; + + handle.addEventListener("mousedown", handleDown); + handle.addEventListener("touchstart", handleDown, { passive: true }); + + //reszie column on double click + handle.addEventListener("dblclick", function (e) { + var col = column.getLastColumn(); + + if (col && self._checkResizability(col)) { + e.stopPropagation(); + col.reinitializeWidth(true); + } + }); + + prevHandle.addEventListener("click", function (e) { + e.stopPropagation(); + }); + + var prevHandleDown = function prevHandleDown(e) { + var nearestColumn, colIndex, prevColumn; + + nearestColumn = column.getFirstColumn(); + + if (nearestColumn) { + colIndex = self.table.columnManager.findColumnIndex(nearestColumn); + prevColumn = colIndex > 0 ? self.table.columnManager.getColumnByIndex(colIndex - 1) : false; + + if (prevColumn && self._checkResizability(prevColumn)) { + self.startColumn = column; + self._mouseDown(e, prevColumn, prevHandle); + } + } + }; + + prevHandle.addEventListener("mousedown", prevHandleDown); + prevHandle.addEventListener("touchstart", prevHandleDown, { passive: true }); + + //resize column on double click + prevHandle.addEventListener("dblclick", function (e) { + var nearestColumn, colIndex, prevColumn; + + nearestColumn = column.getFirstColumn(); + + if (nearestColumn) { + colIndex = self.table.columnManager.findColumnIndex(nearestColumn); + prevColumn = colIndex > 0 ? self.table.columnManager.getColumnByIndex(colIndex - 1) : false; + + if (prevColumn && self._checkResizability(prevColumn)) { + e.stopPropagation(); + prevColumn.reinitializeWidth(true); + } + } + }); + + element.appendChild(handle); + element.appendChild(prevHandle); + } + }; + + ResizeColumns.prototype._checkResizability = function (column) { + return typeof column.definition.resizable != "undefined" ? column.definition.resizable : this.table.options.resizableColumns; + }; + + ResizeColumns.prototype._mouseDown = function (e, column, handle) { + var self = this; + + self.table.element.classList.add("tabulator-block-select"); + + function mouseMove(e) { + // self.table.columnManager.tempScrollBlock(); + + if (self.table.rtl) { + column.setWidth(self.startWidth - ((typeof e.screenX === "undefined" ? e.touches[0].screenX : e.screenX) - self.startX)); + } else { + column.setWidth(self.startWidth + ((typeof e.screenX === "undefined" ? e.touches[0].screenX : e.screenX) - self.startX)); + } + + if (self.table.options.virtualDomHoz) { + self.table.vdomHoz.reinitialize(true); + } + + if (!self.table.browserSlow && column.modules.resize && column.modules.resize.variableHeight) { + column.checkCellHeights(); + } + } + + function mouseUp(e) { + + //block editor from taking action while resizing is taking place + if (self.startColumn.modules.edit) { + self.startColumn.modules.edit.blocked = false; + } + + if (self.table.browserSlow && column.modules.resize && column.modules.resize.variableHeight) { + column.checkCellHeights(); + } + + document.body.removeEventListener("mouseup", mouseUp); + document.body.removeEventListener("mousemove", mouseMove); + + handle.removeEventListener("touchmove", mouseMove); + handle.removeEventListener("touchend", mouseUp); + + self.table.element.classList.remove("tabulator-block-select"); + + if (self.table.options.persistence && self.table.modExists("persistence", true) && self.table.modules.persistence.config.columns) { + self.table.modules.persistence.save("columns"); + } + + self.table.options.columnResized.call(self.table, column.getComponent()); + } + + e.stopPropagation(); //prevent resize from interfereing with movable columns + + //block editor from taking action while resizing is taking place + if (self.startColumn.modules.edit) { + self.startColumn.modules.edit.blocked = true; + } + + self.startX = typeof e.screenX === "undefined" ? e.touches[0].screenX : e.screenX; + self.startWidth = column.getWidth(); + + document.body.addEventListener("mousemove", mouseMove); + document.body.addEventListener("mouseup", mouseUp); + handle.addEventListener("touchmove", mouseMove, { passive: true }); + handle.addEventListener("touchend", mouseUp); + }; + + Tabulator.prototype.registerModule("resizeColumns", ResizeColumns); + var ResizeRows = function ResizeRows(table) { + this.table = table; //hold Tabulator object + this.startColumn = false; + this.startY = false; + this.startHeight = false; + this.handle = null; + this.prevHandle = null; + }; + + ResizeRows.prototype.initializeRow = function (row) { + var self = this, + rowEl = row.getElement(); + + var handle = document.createElement('div'); + handle.className = "tabulator-row-resize-handle"; + + var prevHandle = document.createElement('div'); + prevHandle.className = "tabulator-row-resize-handle prev"; + + handle.addEventListener("click", function (e) { + e.stopPropagation(); + }); + + var handleDown = function handleDown(e) { + self.startRow = row; + self._mouseDown(e, row, handle); + }; + + handle.addEventListener("mousedown", handleDown); + handle.addEventListener("touchstart", handleDown, { passive: true }); + + prevHandle.addEventListener("click", function (e) { + e.stopPropagation(); + }); + + var prevHandleDown = function prevHandleDown(e) { + var prevRow = self.table.rowManager.prevDisplayRow(row); + + if (prevRow) { + self.startRow = prevRow; + self._mouseDown(e, prevRow, prevHandle); + } + }; + + prevHandle.addEventListener("mousedown", prevHandleDown); + prevHandle.addEventListener("touchstart", prevHandleDown, { passive: true }); + + rowEl.appendChild(handle); + rowEl.appendChild(prevHandle); + }; + + ResizeRows.prototype._mouseDown = function (e, row, handle) { + var self = this; + + self.table.element.classList.add("tabulator-block-select"); + + function mouseMove(e) { + row.setHeight(self.startHeight + ((typeof e.screenY === "undefined" ? e.touches[0].screenY : e.screenY) - self.startY)); + } + + function mouseUp(e) { + + // //block editor from taking action while resizing is taking place + // if(self.startColumn.modules.edit){ + // self.startColumn.modules.edit.blocked = false; + // } + + document.body.removeEventListener("mouseup", mouseMove); + document.body.removeEventListener("mousemove", mouseMove); + + handle.removeEventListener("touchmove", mouseMove); + handle.removeEventListener("touchend", mouseUp); + + self.table.element.classList.remove("tabulator-block-select"); + + self.table.options.rowResized.call(this.table, row.getComponent()); + } + + e.stopPropagation(); //prevent resize from interfereing with movable columns + + //block editor from taking action while resizing is taking place + // if(self.startColumn.modules.edit){ + // self.startColumn.modules.edit.blocked = true; + // } + + self.startY = typeof e.screenY === "undefined" ? e.touches[0].screenY : e.screenY; + self.startHeight = row.getHeight(); + + document.body.addEventListener("mousemove", mouseMove); + document.body.addEventListener("mouseup", mouseUp); + + handle.addEventListener("touchmove", mouseMove, { passive: true }); + handle.addEventListener("touchend", mouseUp); + }; + + Tabulator.prototype.registerModule("resizeRows", ResizeRows); + var ResizeTable = function ResizeTable(table) { + this.table = table; //hold Tabulator object + this.binding = false; + this.observer = false; + this.containerObserver = false; + + this.tableHeight = 0; + this.tableWidth = 0; + this.containerHeight = 0; + this.containerWidth = 0; + + this.autoResize = false; + }; + + ResizeTable.prototype.initialize = function (row) { + var _this82 = this; + + var table = this.table, + tableStyle; + + this.tableHeight = table.element.clientHeight; + this.tableWidth = table.element.clientWidth; + + if (table.element.parentNode) { + this.containerHeight = table.element.parentNode.clientHeight; + this.containerWidth = table.element.parentNode.clientWidth; + } + + if (typeof ResizeObserver !== "undefined" && table.rowManager.getRenderMode() === "virtual") { + + this.autoResize = true; + + this.observer = new ResizeObserver(function (entry) { + if (!table.browserMobile || table.browserMobile && !table.modules.edit.currentCell) { + + var nodeHeight = Math.floor(entry[0].contentRect.height); + var nodeWidth = Math.floor(entry[0].contentRect.width); + + if (_this82.tableHeight != nodeHeight || _this82.tableWidth != nodeWidth) { + _this82.tableHeight = nodeHeight; + _this82.tableWidth = nodeWidth; + + if (table.element.parentNode) { + _this82.containerHeight = table.element.parentNode.clientHeight; + _this82.containerWidth = table.element.parentNode.clientWidth; + } + + if (table.options.virtualDomHoz) { + table.vdomHoz.reinitialize(true); + } + + table.redraw(); + } + } + }); + + this.observer.observe(table.element); + + tableStyle = window.getComputedStyle(table.element); + + if (this.table.element.parentNode && !this.table.rowManager.fixedHeight && (tableStyle.getPropertyValue("max-height") || tableStyle.getPropertyValue("min-height"))) { + + this.containerObserver = new ResizeObserver(function (entry) { + if (!table.browserMobile || table.browserMobile && !table.modules.edit.currentCell) { + + var nodeHeight = Math.floor(entry[0].contentRect.height); + var nodeWidth = Math.floor(entry[0].contentRect.width); + + if (_this82.containerHeight != nodeHeight || _this82.containerWidth != nodeWidth) { + _this82.containerHeight = nodeHeight; + _this82.containerWidth = nodeWidth; + _this82.tableHeight = table.element.clientHeight; + _this82.tableWidth = table.element.clientWidth; + } + + if (table.options.virtualDomHoz) { + table.vdomHoz.reinitialize(true); + } + + table.redraw(); + } + }); + + this.containerObserver.observe(this.table.element.parentNode); + } + } else { + this.binding = function () { + if (!table.browserMobile || table.browserMobile && !table.modules.edit.currentCell) { + if (table.options.virtualDomHoz) { + table.vdomHoz.reinitialize(true); + } + + table.redraw(); + } + }; + + window.addEventListener("resize", this.binding); + } + }; + + ResizeTable.prototype.clearBindings = function (row) { + if (this.binding) { + window.removeEventListener("resize", this.binding); + } + + if (this.observer) { + this.observer.unobserve(this.table.element); + } + + if (this.containerObserver) { + this.containerObserver.unobserve(this.table.element.parentNode); + } + }; + + Tabulator.prototype.registerModule("resizeTable", ResizeTable); + var ResponsiveLayout = function ResponsiveLayout(table) { + this.table = table; //hold Tabulator object + this.columns = []; + this.hiddenColumns = []; + this.mode = ""; + this.index = 0; + this.collapseFormatter = []; + this.collapseStartOpen = true; + this.collapseHandleColumn = false; + }; + + //generate resposive columns list + ResponsiveLayout.prototype.initialize = function () { + var self = this, + columns = []; + + this.mode = this.table.options.responsiveLayout; + this.collapseFormatter = this.table.options.responsiveLayoutCollapseFormatter || this.formatCollapsedData; + this.collapseStartOpen = this.table.options.responsiveLayoutCollapseStartOpen; + this.hiddenColumns = []; + + //detemine level of responsivity for each column + this.table.columnManager.columnsByIndex.forEach(function (column, i) { + if (column.modules.responsive) { + if (column.modules.responsive.order && column.modules.responsive.visible) { + column.modules.responsive.index = i; + columns.push(column); + + if (!column.visible && self.mode === "collapse") { + self.hiddenColumns.push(column); + } + } + } + }); + + //sort list by responsivity + columns = columns.reverse(); + columns = columns.sort(function (a, b) { + var diff = b.modules.responsive.order - a.modules.responsive.order; + return diff || b.modules.responsive.index - a.modules.responsive.index; + }); + + this.columns = columns; + + if (this.mode === "collapse") { + this.generateCollapsedContent(); + } + + //assign collapse column + for (var _iterator = this.table.columnManager.columnsByIndex, _isArray = Array.isArray(_iterator), _i16 = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) { + var _ref; + + if (_isArray) { + if (_i16 >= _iterator.length) break; + _ref = _iterator[_i16++]; + } else { + _i16 = _iterator.next(); + if (_i16.done) break; + _ref = _i16.value; + } + + var col = _ref; + + if (col.definition.formatter == "responsiveCollapse") { + this.collapseHandleColumn = col; + break; + } + } + + if (this.collapseHandleColumn) { + if (this.hiddenColumns.length) { + this.collapseHandleColumn.show(); + } else { + this.collapseHandleColumn.hide(); + } + } + }; + + //define layout information + ResponsiveLayout.prototype.initializeColumn = function (column) { + var def = column.getDefinition(); + + column.modules.responsive = { order: typeof def.responsive === "undefined" ? 1 : def.responsive, visible: def.visible === false ? false : true }; + }; + + ResponsiveLayout.prototype.initializeRow = function (row) { + var el; + + if (row.type !== "calc") { + el = document.createElement("div"); + el.classList.add("tabulator-responsive-collapse"); + + row.modules.responsiveLayout = { + element: el, + open: this.collapseStartOpen + }; + + if (!this.collapseStartOpen) { + el.style.display = 'none'; + } + } + }; + + ResponsiveLayout.prototype.layoutRow = function (row) { + var rowEl = row.getElement(); + + if (row.modules.responsiveLayout) { + rowEl.appendChild(row.modules.responsiveLayout.element); + this.generateCollapsedRowContent(row); + } + }; + + //update column visibility + ResponsiveLayout.prototype.updateColumnVisibility = function (column, visible) { + var index; + if (column.modules.responsive) { + column.modules.responsive.visible = visible; + this.initialize(); + } + }; + + ResponsiveLayout.prototype.hideColumn = function (column) { + var colCount = this.hiddenColumns.length; + + column.hide(false, true); + + if (this.mode === "collapse") { + this.hiddenColumns.unshift(column); + this.generateCollapsedContent(); + + if (this.collapseHandleColumn && !colCount) { + this.collapseHandleColumn.show(); + } + } + }; + + ResponsiveLayout.prototype.showColumn = function (column) { + var index; + + column.show(false, true); + //set column width to prevent calculation loops on uninitialized columns + column.setWidth(column.getWidth()); + + if (this.mode === "collapse") { + index = this.hiddenColumns.indexOf(column); + + if (index > -1) { + this.hiddenColumns.splice(index, 1); + } + + this.generateCollapsedContent(); + + if (this.collapseHandleColumn && !this.hiddenColumns.length) { + this.collapseHandleColumn.hide(); + } + } + }; + + //redraw columns to fit space + ResponsiveLayout.prototype.update = function () { + var self = this, + working = true; + + while (working) { + + var width = self.table.modules.layout.getMode() == "fitColumns" ? self.table.columnManager.getFlexBaseWidth() : self.table.columnManager.getWidth(); + + var diff = (self.table.options.headerVisible ? self.table.columnManager.element.clientWidth : self.table.element.clientWidth) - width; + + if (diff < 0) { + //table is too wide + var column = self.columns[self.index]; + + if (column) { + self.hideColumn(column); + self.index++; + } else { + working = false; + } + } else { + + //table has spare space + var _column = self.columns[self.index - 1]; + + if (_column) { + if (diff > 0) { + if (diff >= _column.getWidth()) { + self.showColumn(_column); + self.index--; + } else { + working = false; + } + } else { + working = false; + } + } else { + working = false; + } + } + + if (!self.table.rowManager.activeRowsCount) { + self.table.rowManager.renderEmptyScroll(); + } + } + }; + + ResponsiveLayout.prototype.generateCollapsedContent = function () { + var self = this, + rows = this.table.rowManager.getDisplayRows(); + + rows.forEach(function (row) { + self.generateCollapsedRowContent(row); + }); + }; + + ResponsiveLayout.prototype.generateCollapsedRowContent = function (row) { + var el, contents; + + if (row.modules.responsiveLayout) { + el = row.modules.responsiveLayout.element; + + while (el.firstChild) { + el.removeChild(el.firstChild); + }contents = this.collapseFormatter(this.generateCollapsedRowData(row)); + if (contents) { + el.appendChild(contents); + } + } + }; + + ResponsiveLayout.prototype.generateCollapsedRowData = function (row) { + var self = this, + data = row.getData(), + output = [], + mockCellComponent; + + this.hiddenColumns.forEach(function (column) { + var value = column.getFieldValue(data); + + if (column.definition.title && column.field) { + if (column.modules.format && self.table.options.responsiveLayoutCollapseUseFormatters) { + + mockCellComponent = { + value: false, + data: {}, + getValue: function getValue() { + return value; + }, + getData: function getData() { + return data; + }, + getElement: function getElement() { + return document.createElement("div"); + }, + getRow: function getRow() { + return row.getComponent(); + }, + getColumn: function getColumn() { + return column.getComponent(); + } + }; + + output.push({ + title: column.definition.title, + value: column.modules.format.formatter.call(self.table.modules.format, mockCellComponent, column.modules.format.params) + }); + } else { + output.push({ + title: column.definition.title, + value: value + }); + } + } + }); + + return output; + }; + + ResponsiveLayout.prototype.formatCollapsedData = function (data) { + var list = document.createElement("table"), + listContents = ""; + + data.forEach(function (item) { + var div = document.createElement("div"); + + if (item.value instanceof Node) { + div.appendChild(item.value); + item.value = div.innerHTML; + } + + listContents += "" + item.title + "" + item.value + ""; + }); + + list.innerHTML = listContents; + + return Object.keys(data).length ? list : ""; + }; + + Tabulator.prototype.registerModule("responsiveLayout", ResponsiveLayout); + + var SelectRow = function SelectRow(table) { + this.table = table; //hold Tabulator object + this.selecting = false; //flag selecting in progress + this.lastClickedRow = false; //last clicked row + this.selectPrev = []; //hold previously selected element for drag drop selection + this.selectedRows = []; //hold selected rows + this.headerCheckboxElement = null; // hold header select element + }; + + SelectRow.prototype.clearSelectionData = function (silent) { + this.selecting = false; + this.lastClickedRow = false; + this.selectPrev = []; + this.selectedRows = []; + + if (!silent) { + this._rowSelectionChanged(); + } + }; + + SelectRow.prototype.initializeRow = function (row) { + var self = this, + element = row.getElement(); + + // trigger end of row selection + var endSelect = function endSelect() { + + setTimeout(function () { + self.selecting = false; + }, 50); + + document.body.removeEventListener("mouseup", endSelect); + }; + + row.modules.select = { selected: false }; + + //set row selection class + if (self.table.options.selectableCheck.call(this.table, row.getComponent())) { + element.classList.add("tabulator-selectable"); + element.classList.remove("tabulator-unselectable"); + + if (self.table.options.selectable && self.table.options.selectable != "highlight") { + if (self.table.options.selectableRangeMode === "click") { + element.addEventListener("click", function (e) { + if (e.shiftKey) { + self.table._clearSelection(); + self.lastClickedRow = self.lastClickedRow || row; + + var lastClickedRowIdx = self.table.rowManager.getDisplayRowIndex(self.lastClickedRow); + var rowIdx = self.table.rowManager.getDisplayRowIndex(row); + + var fromRowIdx = lastClickedRowIdx <= rowIdx ? lastClickedRowIdx : rowIdx; + var toRowIdx = lastClickedRowIdx >= rowIdx ? lastClickedRowIdx : rowIdx; + + var rows = self.table.rowManager.getDisplayRows().slice(0); + var toggledRows = rows.splice(fromRowIdx, toRowIdx - fromRowIdx + 1); + + if (e.ctrlKey || e.metaKey) { + toggledRows.forEach(function (toggledRow) { + if (toggledRow !== self.lastClickedRow) { + + if (self.table.options.selectable !== true && !self.isRowSelected(row)) { + if (self.selectedRows.length < self.table.options.selectable) { + self.toggleRow(toggledRow); + } + } else { + self.toggleRow(toggledRow); + } + } + }); + self.lastClickedRow = row; + } else { + self.deselectRows(undefined, true); + + if (self.table.options.selectable !== true) { + if (toggledRows.length > self.table.options.selectable) { + toggledRows = toggledRows.slice(0, self.table.options.selectable); + } + } + + self.selectRows(toggledRows); + } + self.table._clearSelection(); + } else if (e.ctrlKey || e.metaKey) { + self.toggleRow(row); + self.lastClickedRow = row; + } else { + self.deselectRows(undefined, true); + self.selectRows(row); + self.lastClickedRow = row; + } + }); + } else { + element.addEventListener("click", function (e) { + if (!self.table.modExists("edit") || !self.table.modules.edit.getCurrentCell()) { + self.table._clearSelection(); + } + + if (!self.selecting) { + self.toggleRow(row); + } + }); + + element.addEventListener("mousedown", function (e) { + if (e.shiftKey) { + self.table._clearSelection(); + + self.selecting = true; + + self.selectPrev = []; + + document.body.addEventListener("mouseup", endSelect); + document.body.addEventListener("keyup", endSelect); + + self.toggleRow(row); + + return false; + } + }); + + element.addEventListener("mouseenter", function (e) { + if (self.selecting) { + self.table._clearSelection(); + self.toggleRow(row); + + if (self.selectPrev[1] == row) { + self.toggleRow(self.selectPrev[0]); + } + } + }); + + element.addEventListener("mouseout", function (e) { + if (self.selecting) { + self.table._clearSelection(); + self.selectPrev.unshift(row); + } + }); + } + } + } else { + element.classList.add("tabulator-unselectable"); + element.classList.remove("tabulator-selectable"); + } + }; + + //toggle row selection + SelectRow.prototype.toggleRow = function (row) { + if (this.table.options.selectableCheck.call(this.table, row.getComponent())) { + if (row.modules.select && row.modules.select.selected) { + this._deselectRow(row); + } else { + this._selectRow(row); + } + } + }; + + //select a number of rows + SelectRow.prototype.selectRows = function (rows) { + var _this83 = this; + + var rowMatch; + + switch (typeof rows === 'undefined' ? 'undefined' : _typeof(rows)) { + case "undefined": + this.table.rowManager.rows.forEach(function (row) { + _this83._selectRow(row, true, true); + }); + + this._rowSelectionChanged(); + break; + + case "string": + + rowMatch = this.table.rowManager.findRow(rows); + + if (rowMatch) { + this._selectRow(rowMatch, true, true); + } else { + this.table.rowManager.getRows(rows).forEach(function (row) { + _this83._selectRow(row, true, true); + }); + } + + this._rowSelectionChanged(); + break; + + default: + if (Array.isArray(rows)) { + rows.forEach(function (row) { + _this83._selectRow(row, true, true); + }); + + this._rowSelectionChanged(); + } else { + this._selectRow(rows, false, true); + } + break; + } + }; + + //select an individual row + SelectRow.prototype._selectRow = function (rowInfo, silent, force) { + var index; + + //handle max row count + if (!isNaN(this.table.options.selectable) && this.table.options.selectable !== true && !force) { + if (this.selectedRows.length >= this.table.options.selectable) { + if (this.table.options.selectableRollingSelection) { + this._deselectRow(this.selectedRows[0]); + } else { + return false; + } + } + } + + var row = this.table.rowManager.findRow(rowInfo); + + if (row) { + if (this.selectedRows.indexOf(row) == -1) { + if (!row.modules.select) { + row.modules.select = {}; + } + + row.modules.select.selected = true; + if (row.modules.select.checkboxEl) { + row.modules.select.checkboxEl.checked = true; + } + row.getElement().classList.add("tabulator-selected"); + + this.selectedRows.push(row); + + if (this.table.options.dataTreeSelectPropagate) { + this.childRowSelection(row, true); + } + + if (!silent) { + this.table.options.rowSelected.call(this.table, row.getComponent()); + } + + this._rowSelectionChanged(silent); + } + } else { + if (!silent) { + console.warn("Selection Error - No such row found, ignoring selection:" + rowInfo); + } + } + }; + + SelectRow.prototype.isRowSelected = function (row) { + return this.selectedRows.indexOf(row) !== -1; + }; + + //deselect a number of rows + SelectRow.prototype.deselectRows = function (rows, silent) { + var self = this, + rowCount; + + if (typeof rows == "undefined") { + + rowCount = self.selectedRows.length; + + for (var _i17 = 0; _i17 < rowCount; _i17++) { + self._deselectRow(self.selectedRows[0], true); + } + + self._rowSelectionChanged(silent); + } else { + if (Array.isArray(rows)) { + rows.forEach(function (row) { + self._deselectRow(row, true); + }); + + self._rowSelectionChanged(silent); + } else { + self._deselectRow(rows, silent); + } + } + }; + + //deselect an individual row + SelectRow.prototype._deselectRow = function (rowInfo, silent) { + var self = this, + row = self.table.rowManager.findRow(rowInfo), + index; + + if (row) { + index = self.selectedRows.findIndex(function (selectedRow) { + return selectedRow == row; + }); + + if (index > -1) { + + if (!row.modules.select) { + row.modules.select = {}; + } + + row.modules.select.selected = false; + if (row.modules.select.checkboxEl) { + row.modules.select.checkboxEl.checked = false; + } + row.getElement().classList.remove("tabulator-selected"); + self.selectedRows.splice(index, 1); + + if (this.table.options.dataTreeSelectPropagate) { + this.childRowSelection(row, false); + } + + if (!silent) { + self.table.options.rowDeselected.call(this.table, row.getComponent()); + } + + self._rowSelectionChanged(silent); + } + } else { + if (!silent) { + console.warn("Deselection Error - No such row found, ignoring selection:" + rowInfo); + } + } + }; + + SelectRow.prototype.getSelectedData = function () { + var data = []; + + this.selectedRows.forEach(function (row) { + data.push(row.getData()); + }); + + return data; + }; + + SelectRow.prototype.getSelectedRows = function () { + + var rows = []; + + this.selectedRows.forEach(function (row) { + rows.push(row.getComponent()); + }); + + return rows; + }; + + SelectRow.prototype._rowSelectionChanged = function (silent) { + if (this.headerCheckboxElement) { + if (this.selectedRows.length === 0) { + this.headerCheckboxElement.checked = false; + this.headerCheckboxElement.indeterminate = false; + } else if (this.table.rowManager.rows.length === this.selectedRows.length) { + this.headerCheckboxElement.checked = true; + this.headerCheckboxElement.indeterminate = false; + } else { + this.headerCheckboxElement.indeterminate = true; + this.headerCheckboxElement.checked = false; + } + } + + if (!silent) { + this.table.options.rowSelectionChanged.call(this.table, this.getSelectedData(), this.getSelectedRows()); + } + }; + + SelectRow.prototype.registerRowSelectCheckbox = function (row, element) { + if (!row._row.modules.select) { + row._row.modules.select = {}; + } + + row._row.modules.select.checkboxEl = element; + }; + + SelectRow.prototype.registerHeaderSelectCheckbox = function (element) { + this.headerCheckboxElement = element; + }; + + SelectRow.prototype.childRowSelection = function (row, select) { + var children = this.table.modules.dataTree.getChildren(row); + + if (select) { + for (var _iterator2 = children, _isArray2 = Array.isArray(_iterator2), _i18 = 0, _iterator2 = _isArray2 ? _iterator2 : _iterator2[Symbol.iterator]();;) { + var _ref2; + + if (_isArray2) { + if (_i18 >= _iterator2.length) break; + _ref2 = _iterator2[_i18++]; + } else { + _i18 = _iterator2.next(); + if (_i18.done) break; + _ref2 = _i18.value; + } + + var child = _ref2; + + this._selectRow(child, true); + } + } else { + for (var _iterator3 = children, _isArray3 = Array.isArray(_iterator3), _i19 = 0, _iterator3 = _isArray3 ? _iterator3 : _iterator3[Symbol.iterator]();;) { + var _ref3; + + if (_isArray3) { + if (_i19 >= _iterator3.length) break; + _ref3 = _iterator3[_i19++]; + } else { + _i19 = _iterator3.next(); + if (_i19.done) break; + _ref3 = _i19.value; + } + + var _child = _ref3; + + this._deselectRow(_child, true); + } + } + }; + + Tabulator.prototype.registerModule("selectRow", SelectRow); + + var Sort = function Sort(table) { + this.table = table; //hold Tabulator object + this.sortList = []; //holder current sort + this.changed = false; //has the sort changed since last render + }; + + //initialize column header for sorting + Sort.prototype.initializeColumn = function (column, content) { + var self = this, + sorter = false, + colEl, + arrowEl; + + switch (_typeof(column.definition.sorter)) { + case "string": + if (self.sorters[column.definition.sorter]) { + sorter = self.sorters[column.definition.sorter]; + } else { + console.warn("Sort Error - No such sorter found: ", column.definition.sorter); + } + break; + + case "function": + sorter = column.definition.sorter; + break; + } + + column.modules.sort = { + sorter: sorter, dir: "none", + params: column.definition.sorterParams || {}, + startingDir: column.definition.headerSortStartingDir || "asc", + tristate: typeof column.definition.headerSortTristate !== "undefined" ? column.definition.headerSortTristate : this.table.options.headerSortTristate + }; + + if (typeof column.definition.headerSort === "undefined" ? this.table.options.headerSort !== false : column.definition.headerSort !== false) { + + colEl = column.getElement(); + + colEl.classList.add("tabulator-sortable"); + + arrowEl = document.createElement("div"); + arrowEl.classList.add("tabulator-col-sorter"); + + if (_typeof(this.table.options.headerSortElement) == "object") { + arrowEl.appendChild(this.table.options.headerSortElement); + } else { + arrowEl.innerHTML = this.table.options.headerSortElement; + } + + //create sorter arrow + content.appendChild(arrowEl); + + column.modules.sort.element = arrowEl; + + //sort on click + colEl.addEventListener("click", function (e) { + var dir = "", + sorters = [], + match = false; + + if (column.modules.sort) { + if (column.modules.sort.tristate) { + if (column.modules.sort.dir == "none") { + dir = column.modules.sort.startingDir; + } else { + if (column.modules.sort.dir == column.modules.sort.startingDir) { + dir = column.modules.sort.dir == "asc" ? "desc" : "asc"; + } else { + dir = "none"; + } + } + } else { + switch (column.modules.sort.dir) { + case "asc": + dir = "desc"; + break; + + case "desc": + dir = "asc"; + break; + + default: + dir = column.modules.sort.startingDir; + } + } + + if (self.table.options.columnHeaderSortMulti && (e.shiftKey || e.ctrlKey)) { + sorters = self.getSort(); + + match = sorters.findIndex(function (sorter) { + return sorter.field === column.getField(); + }); + + if (match > -1) { + sorters[match].dir = dir; + + if (match != sorters.length - 1) { + match = sorters.splice(match, 1)[0]; + if (dir != "none") { + sorters.push(match); + } + } + } else { + if (dir != "none") { + sorters.push({ column: column, dir: dir }); + } + } + + //add to existing sort + self.setSort(sorters); + } else { + if (dir == "none") { + self.clear(); + } else { + //sort by column only + self.setSort(column, dir); + } + } + + self.table.rowManager.sorterRefresh(!self.sortList.length); + } + }); + } + }; + + //check if the sorters have changed since last use + Sort.prototype.hasChanged = function () { + var changed = this.changed; + this.changed = false; + return changed; + }; + + //return current sorters + Sort.prototype.getSort = function () { + var self = this, + sorters = []; + + self.sortList.forEach(function (item) { + if (item.column) { + sorters.push({ column: item.column.getComponent(), field: item.column.getField(), dir: item.dir }); + } + }); + + return sorters; + }; + + //change sort list and trigger sort + Sort.prototype.setSort = function (sortList, dir) { + var self = this, + newSortList = []; + + if (!Array.isArray(sortList)) { + sortList = [{ column: sortList, dir: dir }]; + } + + sortList.forEach(function (item) { + var column; + + column = self.table.columnManager.findColumn(item.column); + + if (column) { + item.column = column; + newSortList.push(item); + self.changed = true; + } else { + console.warn("Sort Warning - Sort field does not exist and is being ignored: ", item.column); + } + }); + + self.sortList = newSortList; + + if (this.table.options.persistence && this.table.modExists("persistence", true) && this.table.modules.persistence.config.sort) { + this.table.modules.persistence.save("sort"); + } + }; + + //clear sorters + Sort.prototype.clear = function () { + this.setSort([]); + }; + + //find appropriate sorter for column + Sort.prototype.findSorter = function (column) { + var row = this.table.rowManager.activeRows[0], + sorter = "string", + field, + value; + + if (row) { + row = row.getData(); + field = column.getField(); + + if (field) { + + value = column.getFieldValue(row); + + switch (typeof value === 'undefined' ? 'undefined' : _typeof(value)) { + case "undefined": + sorter = "string"; + break; + + case "boolean": + sorter = "boolean"; + break; + + default: + if (!isNaN(value) && value !== "") { + sorter = "number"; + } else { + if (value.match(/((^[0-9]+[a-z]+)|(^[a-z]+[0-9]+))+$/i)) { + sorter = "alphanum"; + } + } + break; + } + } + } + + return this.sorters[sorter]; + }; + + //work through sort list sorting data + Sort.prototype.sort = function (data) { + var self = this, + sortList = this.table.options.sortOrderReverse ? self.sortList.slice().reverse() : self.sortList, + sortListActual = [], + rowComponents = [], + lastSort; + + if (self.table.options.dataSorting) { + self.table.options.dataSorting.call(self.table, self.getSort()); + } + + self.clearColumnHeaders(); + + if (!self.table.options.ajaxSorting) { + + //build list of valid sorters and trigger column specific callbacks before sort begins + sortList.forEach(function (item, i) { + var sortObj = item.column.modules.sort; + + if (item.column && sortObj) { + + //if no sorter has been defined, take a guess + if (!sortObj.sorter) { + sortObj.sorter = self.findSorter(item.column); + } + + item.params = typeof sortObj.params === "function" ? sortObj.params(item.column.getComponent(), item.dir) : sortObj.params; + + sortListActual.push(item); + } + + self.setColumnHeader(item.column, item.dir); + }); + + //sort data + if (sortListActual.length) { + self._sortItems(data, sortListActual); + } + } else { + sortList.forEach(function (item, i) { + self.setColumnHeader(item.column, item.dir); + }); + } + + if (self.table.options.dataSorted) { + data.forEach(function (row) { + rowComponents.push(row.getComponent()); + }); + + self.table.options.dataSorted.call(self.table, self.getSort(), rowComponents); + } + }; + + //clear sort arrows on columns + Sort.prototype.clearColumnHeaders = function () { + this.table.columnManager.getRealColumns().forEach(function (column) { + if (column.modules.sort) { + column.modules.sort.dir = "none"; + column.getElement().setAttribute("aria-sort", "none"); + } + }); + }; + + //set the column header sort direction + Sort.prototype.setColumnHeader = function (column, dir) { + column.modules.sort.dir = dir; + column.getElement().setAttribute("aria-sort", dir); + }; + + //sort each item in sort list + Sort.prototype._sortItems = function (data, sortList) { + var _this84 = this; + + var sorterCount = sortList.length - 1; + + data.sort(function (a, b) { + var result; + + for (var i = sorterCount; i >= 0; i--) { + var sortItem = sortList[i]; + + result = _this84._sortRow(a, b, sortItem.column, sortItem.dir, sortItem.params); + + if (result !== 0) { + break; + } + } + + return result; + }); + }; + + //process individual rows for a sort function on active data + Sort.prototype._sortRow = function (a, b, column, dir, params) { + var el1Comp, el2Comp, colComp; + + //switch elements depending on search direction + var el1 = dir == "asc" ? a : b; + var el2 = dir == "asc" ? b : a; + + a = column.getFieldValue(el1.getData()); + b = column.getFieldValue(el2.getData()); + + a = typeof a !== "undefined" ? a : ""; + b = typeof b !== "undefined" ? b : ""; + + el1Comp = el1.getComponent(); + el2Comp = el2.getComponent(); + + return column.modules.sort.sorter.call(this, a, b, el1Comp, el2Comp, column.getComponent(), dir, params); + }; + + //default data sorters + Sort.prototype.sorters = { + + //sort numbers + number: function number(a, b, aRow, bRow, column, dir, params) { + var alignEmptyValues = params.alignEmptyValues; + var decimal = params.decimalSeparator || "."; + var thousand = params.thousandSeparator || ","; + var emptyAlign = 0; + + a = parseFloat(String(a).split(thousand).join("").split(decimal).join(".")); + b = parseFloat(String(b).split(thousand).join("").split(decimal).join(".")); + + //handle non numeric values + if (isNaN(a)) { + emptyAlign = isNaN(b) ? 0 : -1; + } else if (isNaN(b)) { + emptyAlign = 1; + } else { + //compare valid values + return a - b; + } + + //fix empty values in position + if (alignEmptyValues === "top" && dir === "desc" || alignEmptyValues === "bottom" && dir === "asc") { + emptyAlign *= -1; + } + + return emptyAlign; + }, + + //sort strings + string: function string(a, b, aRow, bRow, column, dir, params) { + var alignEmptyValues = params.alignEmptyValues; + var emptyAlign = 0; + var locale; + + //handle empty values + if (!a) { + emptyAlign = !b ? 0 : -1; + } else if (!b) { + emptyAlign = 1; + } else { + //compare valid values + switch (_typeof(params.locale)) { + case "boolean": + if (params.locale) { + locale = this.table.modules.localize.getLocale(); + } + break; + case "string": + locale = params.locale; + break; + } + + return String(a).toLowerCase().localeCompare(String(b).toLowerCase(), locale); + } + + //fix empty values in position + if (alignEmptyValues === "top" && dir === "desc" || alignEmptyValues === "bottom" && dir === "asc") { + emptyAlign *= -1; + } + + return emptyAlign; + }, + + //sort date + date: function date(a, b, aRow, bRow, column, dir, params) { + if (!params.format) { + params.format = "DD/MM/YYYY"; + } + + return this.sorters.datetime.call(this, a, b, aRow, bRow, column, dir, params); + }, + + //sort HH:mm formatted times + time: function time(a, b, aRow, bRow, column, dir, params) { + if (!params.format) { + params.format = "HH:mm"; + } + + return this.sorters.datetime.call(this, a, b, aRow, bRow, column, dir, params); + }, + + //sort datetime + datetime: function datetime(a, b, aRow, bRow, column, dir, params) { + var format = params.format || "DD/MM/YYYY HH:mm:ss", + alignEmptyValues = params.alignEmptyValues, + emptyAlign = 0; + + if (typeof moment != "undefined") { + a = moment(a, format); + b = moment(b, format); + + if (!a.isValid()) { + emptyAlign = !b.isValid() ? 0 : -1; + } else if (!b.isValid()) { + emptyAlign = 1; + } else { + //compare valid values + return a - b; + } + + //fix empty values in position + if (alignEmptyValues === "top" && dir === "desc" || alignEmptyValues === "bottom" && dir === "asc") { + emptyAlign *= -1; + } + + return emptyAlign; + } else { + console.error("Sort Error - 'datetime' sorter is dependant on moment.js"); + } + }, + + //sort booleans + boolean: function boolean(a, b, aRow, bRow, column, dir, params) { + var el1 = a === true || a === "true" || a === "True" || a === 1 ? 1 : 0; + var el2 = b === true || b === "true" || b === "True" || b === 1 ? 1 : 0; + + return el1 - el2; + }, + + //sort if element contains any data + array: function array(a, b, aRow, bRow, column, dir, params) { + var el1 = 0; + var el2 = 0; + var type = params.type || "length"; + var alignEmptyValues = params.alignEmptyValues; + var emptyAlign = 0; + + function calc(value) { + + switch (type) { + case "length": + return value.length; + break; + + case "sum": + return value.reduce(function (c, d) { + return c + d; + }); + break; + + case "max": + return Math.max.apply(null, value); + break; + + case "min": + return Math.min.apply(null, value); + break; + + case "avg": + return value.reduce(function (c, d) { + return c + d; + }) / value.length; + break; + } + } + + //handle non array values + if (!Array.isArray(a)) { + alignEmptyValues = !Array.isArray(b) ? 0 : -1; + } else if (!Array.isArray(b)) { + alignEmptyValues = 1; + } else { + + //compare valid values + el1 = a ? calc(a) : 0; + el2 = b ? calc(b) : 0; + + return el1 - el2; + } + + //fix empty values in position + if (alignEmptyValues === "top" && dir === "desc" || alignEmptyValues === "bottom" && dir === "asc") { + emptyAlign *= -1; + } + + return emptyAlign; + }, + + //sort if element contains any data + exists: function exists(a, b, aRow, bRow, column, dir, params) { + var el1 = typeof a == "undefined" ? 0 : 1; + var el2 = typeof b == "undefined" ? 0 : 1; + + return el1 - el2; + }, + + //sort alpha numeric strings + alphanum: function alphanum(as, bs, aRow, bRow, column, dir, params) { + var a, + b, + a1, + b1, + i = 0, + L, + rx = /(\d+)|(\D+)/g, + rd = /\d/; + var alignEmptyValues = params.alignEmptyValues; + var emptyAlign = 0; + + //handle empty values + if (!as && as !== 0) { + emptyAlign = !bs && bs !== 0 ? 0 : -1; + } else if (!bs && bs !== 0) { + emptyAlign = 1; + } else { + + if (isFinite(as) && isFinite(bs)) return as - bs; + a = String(as).toLowerCase(); + b = String(bs).toLowerCase(); + if (a === b) return 0; + if (!(rd.test(a) && rd.test(b))) return a > b ? 1 : -1; + a = a.match(rx); + b = b.match(rx); + L = a.length > b.length ? b.length : a.length; + while (i < L) { + a1 = a[i]; + b1 = b[i++]; + if (a1 !== b1) { + if (isFinite(a1) && isFinite(b1)) { + if (a1.charAt(0) === "0") a1 = "." + a1; + if (b1.charAt(0) === "0") b1 = "." + b1; + return a1 - b1; + } else return a1 > b1 ? 1 : -1; + } + } + + return a.length > b.length; + } + + //fix empty values in position + if (alignEmptyValues === "top" && dir === "desc" || alignEmptyValues === "bottom" && dir === "asc") { + emptyAlign *= -1; + } + + return emptyAlign; + } + }; + + Tabulator.prototype.registerModule("sort", Sort); + + var Validate = function Validate(table) { + this.table = table; + this.invalidCells = []; + }; + + //validate + Validate.prototype.initializeColumn = function (column) { + var self = this, + config = [], + validator; + + if (column.definition.validator) { + + if (Array.isArray(column.definition.validator)) { + column.definition.validator.forEach(function (item) { + validator = self._extractValidator(item); + + if (validator) { + config.push(validator); + } + }); + } else { + validator = this._extractValidator(column.definition.validator); + + if (validator) { + config.push(validator); + } + } + + column.modules.validate = config.length ? config : false; + } + }; + + Validate.prototype._extractValidator = function (value) { + var type, params, pos; + + switch (typeof value === 'undefined' ? 'undefined' : _typeof(value)) { + case "string": + pos = value.indexOf(':'); + + if (pos > -1) { + type = value.substring(0, pos); + params = value.substring(pos + 1); + } else { + type = value; + } + + return this._buildValidator(type, params); + break; + + case "function": + return this._buildValidator(value); + break; + + case "object": + return this._buildValidator(value.type, value.parameters); + break; + } + }; + + Validate.prototype._buildValidator = function (type, params) { + + var func = typeof type == "function" ? type : this.validators[type]; + + if (!func) { + console.warn("Validator Setup Error - No matching validator found:", type); + return false; + } else { + return { + type: typeof type == "function" ? "function" : type, + func: func, + params: params + }; + } + }; + + Validate.prototype.validate = function (validators, cell, value) { + var self = this, + valid = [], + invalidIndex = this.invalidCells.indexOf(cell); + + if (validators) { + validators.forEach(function (item) { + if (!item.func.call(self, cell.getComponent(), value, item.params)) { + valid.push({ + type: item.type, + parameters: item.params + }); + } + }); + } + + valid = valid.length ? valid : true; + + if (!cell.modules.validate) { + cell.modules.validate = {}; + } + + if (valid === true) { + cell.modules.validate.invalid = false; + cell.getElement().classList.remove("tabulator-validation-fail"); + + if (invalidIndex > -1) { + this.invalidCells.splice(invalidIndex, 1); + } + } else { + cell.modules.validate.invalid = true; + + if (this.table.options.validationMode !== "manual") { + cell.getElement().classList.add("tabulator-validation-fail"); + } + + if (invalidIndex == -1) { + this.invalidCells.push(cell); + } + } + + return valid; + }; + + Validate.prototype.getInvalidCells = function () { + var output = []; + + this.invalidCells.forEach(function (cell) { + output.push(cell.getComponent()); + }); + + return output; + }; + + Validate.prototype.clearValidation = function (cell) { + var invalidIndex; + + if (cell.modules.validate && cell.modules.validate.invalid) { + + cell.getElement().classList.remove("tabulator-validation-fail"); + cell.modules.validate.invalid = false; + + invalidIndex = this.invalidCells.indexOf(cell); + + if (invalidIndex > -1) { + this.invalidCells.splice(invalidIndex, 1); + } + } + }; + + Validate.prototype.validators = { + + //is integer + integer: function integer(cell, value, parameters) { + if (value === "" || value === null || typeof value === "undefined") { + return true; + } + value = Number(value); + return typeof value === 'number' && isFinite(value) && Math.floor(value) === value; + }, + + //is float + float: function float(cell, value, parameters) { + if (value === "" || value === null || typeof value === "undefined") { + return true; + } + value = Number(value); + return typeof value === 'number' && isFinite(value) && value % 1 !== 0; + }, + + //must be a number + numeric: function numeric(cell, value, parameters) { + if (value === "" || value === null || typeof value === "undefined") { + return true; + } + return !isNaN(value); + }, + + //must be a string + string: function string(cell, value, parameters) { + if (value === "" || value === null || typeof value === "undefined") { + return true; + } + return isNaN(value); + }, + + //maximum value + max: function max(cell, value, parameters) { + if (value === "" || value === null || typeof value === "undefined") { + return true; + } + return parseFloat(value) <= parameters; + }, + + //minimum value + min: function min(cell, value, parameters) { + if (value === "" || value === null || typeof value === "undefined") { + return true; + } + return parseFloat(value) >= parameters; + }, + + //starts with value + starts: function starts(cell, value, parameters) { + if (value === "" || value === null || typeof value === "undefined") { + return true; + } + return String(value).toLowerCase().startsWith(String(parameters).toLowerCase()); + }, + + //ends with value + ends: function ends(cell, value, parameters) { + if (value === "" || value === null || typeof value === "undefined") { + return true; + } + return String(value).toLowerCase().endsWith(String(parameters).toLowerCase()); + }, + + //minimum string length + minLength: function minLength(cell, value, parameters) { + if (value === "" || value === null || typeof value === "undefined") { + return true; + } + return String(value).length >= parameters; + }, + + //maximum string length + maxLength: function maxLength(cell, value, parameters) { + if (value === "" || value === null || typeof value === "undefined") { + return true; + } + return String(value).length <= parameters; + }, + + //in provided value list + in: function _in(cell, value, parameters) { + if (value === "" || value === null || typeof value === "undefined") { + return true; + } + if (typeof parameters == "string") { + parameters = parameters.split("|"); + } + + return value === "" || parameters.indexOf(value) > -1; + }, + + //must match provided regex + regex: function regex(cell, value, parameters) { + if (value === "" || value === null || typeof value === "undefined") { + return true; + } + var reg = new RegExp(parameters); + + return reg.test(value); + }, + + //value must be unique in this column + unique: function unique(cell, value, parameters) { + if (value === "" || value === null || typeof value === "undefined") { + return true; + } + var unique = true; + + var cellData = cell.getData(); + var column = cell.getColumn()._getSelf(); + + this.table.rowManager.rows.forEach(function (row) { + var data = row.getData(); + + if (data !== cellData) { + if (value == column.getFieldValue(data)) { + unique = false; + } + } + }); + + return unique; + }, + + //must have a value + required: function required(cell, value, parameters) { + return value !== "" && value !== null && typeof value !== "undefined"; + } + }; + + Tabulator.prototype.registerModule("validate", Validate); + + return Tabulator; +}); \ No newline at end of file diff --git a/website/js/vendor/tabulator/js/tabulator.min.js b/website/js/vendor/tabulator/js/tabulator.min.js new file mode 100644 index 0000000..314b978 --- /dev/null +++ b/website/js/vendor/tabulator/js/tabulator.min.js @@ -0,0 +1,13 @@ +/* Tabulator v4.8.3 (c) Oliver Folkerd */ +var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};!function(e,t){"object"===("undefined"==typeof exports?"undefined":_typeof(exports))&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):e.Tabulator=t()}(this,function(){"use strict";Array.prototype.findIndex||Object.defineProperty(Array.prototype,"findIndex",{value:function(e){if(null==this)throw new TypeError('"this" is null or not defined');var t=Object(this),o=t.length>>>0;if("function"!=typeof e)throw new TypeError("predicate must be a function");for(var i=arguments[1],n=0;n>>0;if("function"!=typeof e)throw new TypeError("predicate must be a function");for(var i=arguments[1],n=0;n>>0;if(0===i)return!1;for(var n=0|t,s=Math.max(n>=0?n:i-Math.abs(n),0);so?(t=e-o,this.element.style.marginLeft=-t+"px"):this.element.style.marginLeft=0,this.scrollLeft=e,this.table.modExists("frozenColumns")&&this.table.modules.frozenColumns.scrollHorizontal()},t.prototype.generateColumnsFromRowData=function(e){var t,o,i=[],n=this.table.options.autoColumnsDefinitions;if(e&&e.length){t=e[0];for(var s in t){var a={field:s,title:s},r=t[s];switch(void 0===r?"undefined":_typeof(r)){case"undefined":o="string";break;case"boolean":o="boolean";break;case"object":o=Array.isArray(r)?"array":"string";break;default:o=isNaN(r)||""===r?r.match(/((^[0-9]+[a-z]+)|(^[a-z]+[0-9]+))+$/i)?"alphanum":"string":"number"}a.sorter=o,i.push(a)}if(n)switch(void 0===n?"undefined":_typeof(n)){case"function":this.table.options.columns=n.call(this.table,i);break;case"object":Array.isArray(n)?i.forEach(function(e){var t=n.find(function(t){return t.field===e.field});t&&Object.assign(e,t)}):i.forEach(function(e){n[e.field]&&Object.assign(e,n[e.field])}),this.table.options.columns=i}else this.table.options.columns=i;this.setColumns(this.table.options.columns)}},t.prototype.setColumns=function(e,t){for(var o=this;o.headersElement.firstChild;)o.headersElement.removeChild(o.headersElement.firstChild);o.columns=[],o.columnsByIndex=[],o.columnsByField={},o.table.modExists("frozenColumns")&&o.table.modules.frozenColumns.reset(),e.forEach(function(e,t){o._addColumn(e)}),o._reIndexColumns(),o.table.options.responsiveLayout&&o.table.modExists("responsiveLayout",!0)&&o.table.modules.responsiveLayout.initialize(),this.table.options.virtualDomHoz&&this.table.vdomHoz.reinitialize(!1,!0),o.redraw(!0)},t.prototype._addColumn=function(e,t,o){var i=new n(e,this),s=i.getElement(),a=o?this.findColumnIndex(o):o;if(o&&a>-1){var r=this.columns.indexOf(o.getTopColumn()),l=o.getElement();t?(this.columns.splice(r,0,i),l.parentNode.insertBefore(s,l)):(this.columns.splice(r+1,0,i),l.parentNode.insertBefore(s,l.nextSibling))}else t?(this.columns.unshift(i),this.headersElement.insertBefore(i.getElement(),this.headersElement.firstChild)):(this.columns.push(i),this.headersElement.appendChild(i.getElement())),i.columnRendered();return i},t.prototype.registerColumnField=function(e){e.definition.field&&(this.columnsByField[e.definition.field]=e)},t.prototype.registerColumnPosition=function(e){this.columnsByIndex.push(e)},t.prototype._reIndexColumns=function(){this.columnsByIndex=[],this.columns.forEach(function(e){e.reRegisterPosition()})},t.prototype._verticalAlignHeaders=function(){var e=this,t=0;e.columns.forEach(function(e){var o;e.clearVerticalAlign(),(o=e.getHeight())>t&&(t=o)}),e.columns.forEach(function(o){o.verticalAlign(e.table.options.columnHeaderVertAlign,t)}),e.rowManager.adjustTableSize()},t.prototype.findColumn=function(e){var t=this;if("object"!=(void 0===e?"undefined":_typeof(e)))return this.columnsByField[e]||!1;if(e instanceof n)return e;if(e instanceof o)return e._getSelf()||!1;if("undefined"!=typeof HTMLElement&&e instanceof HTMLElement){return t.columns.find(function(t){return t.element===e})||!1}return!1},t.prototype.getColumnByField=function(e){return this.columnsByField[e]},t.prototype.getColumnsByFieldRoot=function(e){var t=this,o=[];return Object.keys(this.columnsByField).forEach(function(i){i.split(".")[0]===e&&o.push(t.columnsByField[i])}),o},t.prototype.getColumnByIndex=function(e){return this.columnsByIndex[e]},t.prototype.getFirstVisibileColumn=function(e){var e=this.columnsByIndex.findIndex(function(e){return e.visible});return e>-1&&this.columnsByIndex[e]},t.prototype.getColumns=function(){return this.columns},t.prototype.findColumnIndex=function(e){return this.columnsByIndex.findIndex(function(t){return e===t})},t.prototype.getRealColumns=function(){return this.columnsByIndex},t.prototype.traverse=function(e){this.columnsByIndex.forEach(function(t,o){e(t,o)})},t.prototype.getDefinitions=function(e){var t=this,o=[];return t.columnsByIndex.forEach(function(t){(!e||e&&t.visible)&&o.push(t.getDefinition())}),o},t.prototype.getDefinitionTree=function(){var e=this,t=[];return e.columns.forEach(function(e){t.push(e.getDefinition(!0))}),t},t.prototype.getComponents=function(e){var t=this,o=[];return(e?t.columns:t.columnsByIndex).forEach(function(e){o.push(e.getComponent())}),o},t.prototype.getWidth=function(){var e=0;return this.columnsByIndex.forEach(function(t){t.visible&&(e+=t.getWidth())}),e},t.prototype.moveColumn=function(e,t,o){this.moveColumnActual(e,t,o),this.table.options.responsiveLayout&&this.table.modExists("responsiveLayout",!0)&&this.table.modules.responsiveLayout.initialize(),this.table.modExists("columnCalcs")&&this.table.modules.columnCalcs.recalc(this.table.rowManager.activeRows),t.element.parentNode.insertBefore(e.element,t.element),o&&t.element.parentNode.insertBefore(t.element,e.element),this._verticalAlignHeaders(),this.table.rowManager.reinitialize()},t.prototype.moveColumnActual=function(e,t,o){e.parent.isGroup?this._moveColumnInArray(e.parent.columns,e,t,o):this._moveColumnInArray(this.columns,e,t,o),this._moveColumnInArray(this.columnsByIndex,e,t,o,!0),this.table.options.responsiveLayout&&this.table.modExists("responsiveLayout",!0)&&this.table.modules.responsiveLayout.initialize(),this.table.options.virtualDomHoz&&this.table.vdomHoz.reinitialize(!0),this.table.options.columnMoved&&this.table.options.columnMoved.call(this.table,e.getComponent(),this.table.columnManager.getComponents()),this.table.options.persistence&&this.table.modExists("persistence",!0)&&this.table.modules.persistence.config.columns&&this.table.modules.persistence.save("columns")},t.prototype._moveColumnInArray=function(e,t,o,i,n){var s,a=this,r=e.indexOf(t),l=[];r>-1&&(e.splice(r,1),s=e.indexOf(o),s>-1?i&&(s+=1):s=r,e.splice(s,0,t),n&&(this.table.options.dataTree&&this.table.modExists("dataTree",!0)&&this.table.rowManager.rows.forEach(function(e){l=l.concat(a.table.modules.dataTree.getTreeChildren(e,!1,!0))}),l=l.concat(this.table.rowManager.rows),l.forEach(function(e){if(e.cells.length){var t=e.cells.splice(r,1)[0];e.cells.splice(s,0,t)}})))},t.prototype.scrollToColumn=function(e,t,o){var i=this,n=0,s=0,a=0,r=e.getElement();return new Promise(function(l,c){if(void 0===t&&(t=i.table.options.scrollToColumnPosition),void 0===o&&(o=i.table.options.scrollToColumnIfVisible),e.visible){switch(t){case"middle":case"center":a=-i.element.clientWidth/2;break;case"right":a=r.clientWidth-i.headersElement.clientWidth}if(!o&&(s=r.offsetLeft)>0&&s+r.offsetWidthe.rowManager.element.clientHeight&&(t-=e.rowManager.element.offsetWidth-e.rowManager.element.clientWidth),this.columnsByIndex.forEach(function(i){var n,s,a;i.visible&&(n=i.definition.width||0,s=void 0===i.minWidth?e.table.options.columnMinWidth:parseInt(i.minWidth),a="string"==typeof n?n.indexOf("%")>-1?t/100*parseInt(n):parseInt(n):n,o+=a>s?a:s)}),o},t.prototype.addColumn=function(e,t,o){var i=this;return new Promise(function(n,s){var a=i._addColumn(e,t,o);i._reIndexColumns(),i.table.options.responsiveLayout&&i.table.modExists("responsiveLayout",!0)&&i.table.modules.responsiveLayout.initialize(),i.table.modExists("columnCalcs")&&i.table.modules.columnCalcs.recalc(i.table.rowManager.activeRows),i.redraw(),"fitColumns"!=i.table.modules.layout.getMode()&&a.reinitializeWidth(),i._verticalAlignHeaders(),i.table.rowManager.reinitialize(),i.table.options.virtualDomHoz&&i.table.vdomHoz.reinitialize(),n(a)})},t.prototype.deregisterColumn=function(e){var t,o=e.getField();o&&delete this.columnsByField[o],t=this.columnsByIndex.indexOf(e),t>-1&&this.columnsByIndex.splice(t,1),t=this.columns.indexOf(e),t>-1&&this.columns.splice(t,1),this.table.options.responsiveLayout&&this.table.modExists("responsiveLayout",!0)&&this.table.modules.responsiveLayout.initialize(),this._verticalAlignHeaders(),this.redraw()},t.prototype.redraw=function(e){e&&(h.prototype.helpers.elVisible(this.element)&&this._verticalAlignHeaders(),this.table.rowManager.resetScroll(),this.table.rowManager.reinitialize()),["fitColumns","fitDataStretch"].indexOf(this.table.modules.layout.getMode())>-1?this.table.modules.layout.layout():e?this.table.modules.layout.layout():this.table.options.responsiveLayout&&this.table.modExists("responsiveLayout",!0)&&this.table.modules.responsiveLayout.update(),this.table.modExists("frozenColumns")&&this.table.modules.frozenColumns.layout(),this.table.modExists("columnCalcs")&&this.table.modules.columnCalcs.recalc(this.table.rowManager.activeRows),e&&(this.table.options.persistence&&this.table.modExists("persistence",!0)&&this.table.modules.persistence.config.columns&&this.table.modules.persistence.save("columns"),this.table.modExists("columnCalcs")&&this.table.modules.columnCalcs.redraw()),this.table.footerManager.redraw()};var o=function(e){this._column=e,this.type="ColumnComponent"};o.prototype.getElement=function(){return this._column.getElement()},o.prototype.getDefinition=function(){return this._column.getDefinition()},o.prototype.getField=function(){return this._column.getField()},o.prototype.getCells=function(){var e=[];return this._column.cells.forEach(function(t){e.push(t.getComponent())}),e},o.prototype.getVisibility=function(){return console.warn("getVisibility function is deprecated, you should now use the isVisible function"),this._column.visible},o.prototype.isVisible=function(){return this._column.visible},o.prototype.show=function(){this._column.isGroup?this._column.columns.forEach(function(e){e.show()}):this._column.show()},o.prototype.hide=function(){this._column.isGroup?this._column.columns.forEach(function(e){e.hide()}):this._column.hide()},o.prototype.toggle=function(){this._column.visible?this.hide():this.show()},o.prototype.delete=function(){return this._column.delete()},o.prototype.getSubColumns=function(){var e=[];return this._column.columns.length&&this._column.columns.forEach(function(t){e.push(t.getComponent())}),e},o.prototype.getParentColumn=function(){return this._column.parent instanceof n&&this._column.parent.getComponent()},o.prototype._getSelf=function(){return this._column},o.prototype.scrollTo=function(){return this._column.table.columnManager.scrollToColumn(this._column)},o.prototype.getTable=function(){return this._column.table},o.prototype.headerFilterFocus=function(){this._column.table.modExists("filter",!0)&&this._column.table.modules.filter.setHeaderFilterFocus(this._column)},o.prototype.reloadHeaderFilter=function(){this._column.table.modExists("filter",!0)&&this._column.table.modules.filter.reloadHeaderFilter(this._column)},o.prototype.getHeaderFilterValue=function(){if(this._column.table.modExists("filter",!0))return this._column.table.modules.filter.getHeaderFilterValue(this._column)},o.prototype.setHeaderFilterValue=function(e){this._column.table.modExists("filter",!0)&&this._column.table.modules.filter.setHeaderFilterValue(this._column,e)},o.prototype.move=function(e,t){var o=this._column.table.columnManager.findColumn(e);o?this._column.table.columnManager.moveColumn(this._column,o,t):console.warn("Move Error - No matching column found:",o)},o.prototype.getNextColumn=function(){var e=this._column.nextColumn();return!!e&&e.getComponent()},o.prototype.getPrevColumn=function(){var e=this._column.prevColumn();return!!e&&e.getComponent()},o.prototype.updateDefinition=function(e){return this._column.updateDefinition(e)},o.prototype.getWidth=function(){return this._column.getWidth()},o.prototype.setWidth=function(e){var t;return t=!0===e?this._column.reinitializeWidth(!0):this._column.setWidth(e),this._column.table.options.virtualDomHoz&&this._column.table.vdomHoz.reinitialize(!0),t},o.prototype.validate=function(){return this._column.validate()};var n=function e(t,o){var i=this;this.table=o.table,this.definition=t,this.parent=o,this.type="column",this.columns=[],this.cells=[],this.element=this.createElement(),this.contentElement=!1,this.titleHolderElement=!1,this.titleElement=!1,this.groupElement=this.createGroupElement(),this.isGroup=!1,this.tooltip=!1,this.hozAlign="",this.vertAlign="",this.field="",this.fieldStructure="",this.getFieldValue="",this.setFieldValue="",this.titleFormatterRendered=!1,this.setField(this.definition.field),this.table.options.invalidOptionWarnings&&this.checkDefinition(),this.modules={},this.cellEvents={cellClick:!1,cellDblClick:!1,cellContext:!1,cellTap:!1,cellDblTap:!1,cellTapHold:!1,cellMouseEnter:!1,cellMouseLeave:!1,cellMouseOver:!1,cellMouseOut:!1,cellMouseMove:!1},this.width=null,this.widthStyled="",this.minWidth=null,this.minWidthStyled="",this.widthFixed=!1,this.visible=!0,this.component=null,this._mapDepricatedFunctionality(),t.columns?(this.isGroup=!0,t.columns.forEach(function(t,o){var n=new e(t,i);i.attachColumn(n)}),i.checkColumnVisibility()):o.registerColumnField(this),t.rowHandle&&!1!==this.table.options.movableRows&&this.table.modExists("moveRow")&&this.table.modules.moveRow.setHandle(!0),this._buildHeader(),this.bindModuleColumns()};n.prototype.createElement=function(){var e=document.createElement("div");return e.classList.add("tabulator-col"),e.setAttribute("role","columnheader"),e.setAttribute("aria-sort","none"),e},n.prototype.createGroupElement=function(){var e=document.createElement("div");return e.classList.add("tabulator-col-group-cols"),e},n.prototype.checkDefinition=function(){var e=this;Object.keys(this.definition).forEach(function(t){-1===e.defaultOptionList.indexOf(t)&&console.warn("Invalid column definition option in '"+(e.field||e.definition.title)+"' column:",t)})},n.prototype.setField=function(e){this.field=e,this.fieldStructure=e?this.table.options.nestedFieldSeparator?e.split(this.table.options.nestedFieldSeparator):[e]:[],this.getFieldValue=this.fieldStructure.length>1?this._getNestedData:this._getFlatData,this.setFieldValue=this.fieldStructure.length>1?this._setNestedData:this._setFlatData},n.prototype.registerColumnPosition=function(e){this.parent.registerColumnPosition(e)},n.prototype.registerColumnField=function(e){this.parent.registerColumnField(e)},n.prototype.reRegisterPosition=function(){this.isGroup?this.columns.forEach(function(e){e.reRegisterPosition()}):this.registerColumnPosition(this)},n.prototype._mapDepricatedFunctionality=function(){void 0!==this.definition.hideInHtml&&(this.definition.htmlOutput=!this.definition.hideInHtml,console.warn("hideInHtml column definition property is deprecated, you should now use htmlOutput")),void 0!==this.definition.align&&(this.definition.hozAlign=this.definition.align,console.warn("align column definition property is deprecated, you should now use hozAlign")),void 0!==this.definition.downloadTitle&&(this.definition.titleDownload=this.definition.downloadTitle,console.warn("downloadTitle definition property is deprecated, you should now use titleDownload"))},n.prototype.setTooltip=function(){var e=this,t=e.definition,o=t.headerTooltip||!1===t.tooltip?t.headerTooltip:e.table.options.tooltipsHeader;o?!0===o?t.field?e.table.modules.localize.bind("columns|"+t.field,function(o){e.element.setAttribute("title",o||t.title)}):e.element.setAttribute("title",t.title):("function"==typeof o&&!1===(o=o(e.getComponent()))&&(o=""),e.element.setAttribute("title",o)):e.element.setAttribute("title","")},n.prototype._buildHeader=function(){for(var e=this,t=e.definition;e.element.firstChild;)e.element.removeChild(e.element.firstChild);t.headerVertical&&(e.element.classList.add("tabulator-col-vertical"),"flip"===t.headerVertical&&e.element.classList.add("tabulator-col-vertical-flip")),e.contentElement=e._bindEvents(),e.contentElement=e._buildColumnHeaderContent(),e.element.appendChild(e.contentElement),e.isGroup?e._buildGroupHeader():e._buildColumnHeader(),e.setTooltip(),e.table.options.resizableColumns&&e.table.modExists("resizeColumns")&&e.table.modules.resizeColumns.initializeColumn("header",e,e.element),t.headerFilter&&e.table.modExists("filter")&&e.table.modExists("edit")&&(void 0!==t.headerFilterPlaceholder&&t.field&&e.table.modules.localize.setHeaderFilterColumnPlaceholder(t.field,t.headerFilterPlaceholder),e.table.modules.filter.initializeColumn(e)),e.table.modExists("frozenColumns")&&e.table.modules.frozenColumns.initializeColumn(e),e.table.options.movableColumns&&!e.isGroup&&e.table.modExists("moveColumn")&&e.table.modules.moveColumn.initializeColumn(e),(t.topCalc||t.bottomCalc)&&e.table.modExists("columnCalcs")&&e.table.modules.columnCalcs.initializeColumn(e),e.table.modExists("persistence")&&e.table.modules.persistence.config.columns&&e.table.modules.persistence.initializeColumn(e),e.element.addEventListener("mouseenter",function(t){e.setTooltip()})},n.prototype._bindEvents=function(){var e,t,o,i=this,n=i.definition;"function"==typeof n.headerClick&&i.element.addEventListener("click",function(e){n.headerClick(e,i.getComponent())}),"function"==typeof n.headerDblClick&&i.element.addEventListener("dblclick",function(e){n.headerDblClick(e,i.getComponent())}),"function"==typeof n.headerContext&&i.element.addEventListener("contextmenu",function(e){n.headerContext(e,i.getComponent())}),"function"==typeof n.headerTap&&(o=!1,i.element.addEventListener("touchstart",function(e){o=!0},{passive:!0}),i.element.addEventListener("touchend",function(e){o&&n.headerTap(e,i.getComponent()),o=!1})),"function"==typeof n.headerDblTap&&(e=null,i.element.addEventListener("touchend",function(t){e?(clearTimeout(e),e=null,n.headerDblTap(t,i.getComponent())):e=setTimeout(function(){clearTimeout(e),e=null},300)})),"function"==typeof n.headerTapHold&&(t=null,i.element.addEventListener("touchstart",function(e){clearTimeout(t),t=setTimeout(function(){clearTimeout(t),t=null,o=!1,n.headerTapHold(e,i.getComponent())},1e3)},{passive:!0}),i.element.addEventListener("touchend",function(e){clearTimeout(t),t=null})),"function"==typeof n.cellClick&&(i.cellEvents.cellClick=n.cellClick),"function"==typeof n.cellDblClick&&(i.cellEvents.cellDblClick=n.cellDblClick),"function"==typeof n.cellContext&&(i.cellEvents.cellContext=n.cellContext),"function"==typeof n.cellMouseEnter&&(i.cellEvents.cellMouseEnter=n.cellMouseEnter),"function"==typeof n.cellMouseLeave&&(i.cellEvents.cellMouseLeave=n.cellMouseLeave),"function"==typeof n.cellMouseOver&&(i.cellEvents.cellMouseOver=n.cellMouseOver),"function"==typeof n.cellMouseOut&&(i.cellEvents.cellMouseOut=n.cellMouseOut),"function"==typeof n.cellMouseMove&&(i.cellEvents.cellMouseMove=n.cellMouseMove),"function"==typeof n.cellTap&&(i.cellEvents.cellTap=n.cellTap),"function"==typeof n.cellDblTap&&(i.cellEvents.cellDblTap=n.cellDblTap),"function"==typeof n.cellTapHold&&(i.cellEvents.cellTapHold=n.cellTapHold),"function"==typeof n.cellEdited&&(i.cellEvents.cellEdited=n.cellEdited),"function"==typeof n.cellEditing&&(i.cellEvents.cellEditing=n.cellEditing),"function"==typeof n.cellEditCancelled&&(i.cellEvents.cellEditCancelled=n.cellEditCancelled)},n.prototype._buildColumnHeader=function(){var e=this,t=this.definition,o=this.table;if(o.modExists("sort")&&o.modules.sort.initializeColumn(this,this.titleHolderElement),(t.headerContextMenu||t.headerClickMenu||t.headerMenu)&&o.modExists("menu")&&o.modules.menu.initializeColumnHeader(this),o.modExists("format")&&o.modules.format.initializeColumn(this),void 0!==t.editor&&o.modExists("edit")&&o.modules.edit.initializeColumn(this),void 0!==t.validator&&o.modExists("validate")&&o.modules.validate.initializeColumn(this),o.modExists("mutator")&&o.modules.mutator.initializeColumn(this),o.modExists("accessor")&&o.modules.accessor.initializeColumn(this),_typeof(o.options.responsiveLayout)&&o.modExists("responsiveLayout")&&o.modules.responsiveLayout.initializeColumn(this),void 0!==t.visible&&(t.visible?this.show(!0):this.hide(!0)),t.cssClass){t.cssClass.split(" ").forEach(function(t){e.element.classList.add(t)})}t.field&&this.element.setAttribute("tabulator-field",t.field),this.setMinWidth(void 0===t.minWidth?this.table.options.columnMinWidth:parseInt(t.minWidth)),this.reinitializeWidth(),this.tooltip=this.definition.tooltip||!1===this.definition.tooltip?this.definition.tooltip:this.table.options.tooltips,this.hozAlign=void 0===this.definition.hozAlign?this.table.options.cellHozAlign:this.definition.hozAlign,this.vertAlign=void 0===this.definition.vertAlign?this.table.options.cellVertAlign:this.definition.vertAlign,this.titleElement.style.textAlign=this.definition.headerHozAlign||this.table.options.headerHozAlign},n.prototype._buildColumnHeaderContent=function(){var e=(this.definition,this.table,document.createElement("div"));return e.classList.add("tabulator-col-content"),this.titleHolderElement=document.createElement("div"),this.titleHolderElement.classList.add("tabulator-col-title-holder"),e.appendChild(this.titleHolderElement),this.titleElement=this._buildColumnHeaderTitle(),this.titleHolderElement.appendChild(this.titleElement),e},n.prototype._buildColumnHeaderTitle=function(){var e=this,t=e.definition,o=e.table,i=document.createElement("div");if(i.classList.add("tabulator-col-title"),t.editableTitle){var n=document.createElement("input");n.classList.add("tabulator-title-editor"),n.addEventListener("click",function(e){e.stopPropagation(),n.focus()}),n.addEventListener("change",function(){t.title=n.value,o.options.columnTitleChanged.call(e.table,e.getComponent())}),i.appendChild(n),t.field?o.modules.localize.bind("columns|"+t.field,function(e){n.value=e||t.title||" "}):n.value=t.title||" "}else t.field?o.modules.localize.bind("columns|"+t.field,function(o){e._formatColumnHeaderTitle(i,o||t.title||" ")}):e._formatColumnHeaderTitle(i,t.title||" ");return i},n.prototype._formatColumnHeaderTitle=function(e,t){var o,i,n,s,a,r=this;if(this.definition.titleFormatter&&this.table.modExists("format"))switch(o=this.table.modules.format.getFormatter(this.definition.titleFormatter),a=function(e){r.titleFormatterRendered=e},s={getValue:function(){return t},getElement:function(){return e}},n=this.definition.titleFormatterParams||{},n="function"==typeof n?n():n,i=o.call(this.table.modules.format,s,n,a),void 0===i?"undefined":_typeof(i)){case"object":i instanceof Node?e.appendChild(i):(e.innerHTML="",console.warn("Format Error - Title formatter has returned a type of object, the only valid formatter object return is an instance of Node, the formatter returned:",i));break;case"undefined":case"null":e.innerHTML="";break;default:e.innerHTML=i}else e.innerHTML=t},n.prototype._buildGroupHeader=function(){var e=this;if(this.element.classList.add("tabulator-col-group"),this.element.setAttribute("role","columngroup"),this.element.setAttribute("aria-title",this.definition.title),this.definition.cssClass){this.definition.cssClass.split(" ").forEach(function(t){e.element.classList.add(t)})}(this.definition.headerContextMenu||this.definition.headerMenu)&&this.table.modExists("menu")&&this.table.modules.menu.initializeColumnHeader(this),this.element.appendChild(this.groupElement)},n.prototype._getFlatData=function(e){return e[this.field]},n.prototype._getNestedData=function(e){for(var t,o=e,i=this.fieldStructure,n=i.length,s=0;s-1&&this._nextVisibleColumn(e+1)},n.prototype._nextVisibleColumn=function(e){var t=this.table.columnManager.getColumnByIndex(e);return!t||t.visible?t:this._nextVisibleColumn(e+1)},n.prototype.prevColumn=function(){var e=this.table.columnManager.findColumnIndex(this);return e>-1&&this._prevVisibleColumn(e-1)},n.prototype._prevVisibleColumn=function(e){var t=this.table.columnManager.getColumnByIndex(e);return!t||t.visible?t:this._prevVisibleColumn(e-1)},n.prototype.reinitializeWidth=function(e){this.widthFixed=!1,void 0===this.definition.width||e||this.setWidth(this.definition.width),this.table.modExists("filter")&&this.table.modules.filter.hideHeaderFilterElements(),this.fitToData(),this.table.modExists("filter")&&this.table.modules.filter.showHeaderFilterElements()},n.prototype.fitToData=function(){var e=this;this.widthFixed||(this.element.style.width="",e.cells.forEach(function(e){e.clearWidth()}));var t=this.element.offsetWidth;e.width&&this.widthFixed||(e.cells.forEach(function(e){var o=e.getWidth();o>t&&(t=o)}),t&&e.setWidthActual(t+1))},n.prototype.updateDefinition=function(e){var t=this;return new Promise(function(o,i){var n;t.isGroup?(console.warn("Column Update Error - The updateDefinition function is only available on columns, not column groups"),i("Column Update Error - The updateDefinition function is only available on columns, not column groups")):(n=Object.assign({},t.getDefinition()),n=Object.assign(n,e),t.table.columnManager.addColumn(n,!1,t).then(function(e){n.field==t.field&&(t.field=!1),t.delete().then(function(){o(e.getComponent())}).catch(function(e){i(e)})}).catch(function(e){i(e)}))})},n.prototype.deleteCell=function(e){var t=this.cells.indexOf(e);t>-1&&this.cells.splice(t,1)},n.prototype.defaultOptionList=["title","field","columns","visible","align","hozAlign","vertAlign","width","minWidth","widthGrow","widthShrink","resizable","frozen","responsive","tooltip","cssClass","rowHandle","hideInHtml","print","htmlOutput","sorter","sorterParams","formatter","formatterParams","variableHeight","editable","editor","editorParams","validator","mutator","mutatorParams","mutatorData","mutatorDataParams","mutatorEdit","mutatorEditParams","mutatorClipboard","mutatorClipboardParams","accessor","accessorParams","accessorData","accessorDataParams","accessorDownload","accessorDownloadParams","accessorClipboard","accessorClipboardParams","accessorPrint","accessorPrintParams","accessorHtmlOutput","accessorHtmlOutputParams","clipboard","download","downloadTitle","topCalc","topCalcParams","topCalcFormatter","topCalcFormatterParams","bottomCalc","bottomCalcParams","bottomCalcFormatter","bottomCalcFormatterParams","cellClick","cellDblClick","cellContext","cellTap","cellDblTap","cellTapHold","cellMouseEnter","cellMouseLeave","cellMouseOver","cellMouseOut","cellMouseMove","cellEditing","cellEdited","cellEditCancelled","headerSort","headerSortStartingDir","headerSortTristate","headerClick","headerDblClick","headerContext","headerTap","headerDblTap","headerTapHold","headerTooltip","headerVertical","headerHozAlign","editableTitle","titleFormatter","titleFormatterParams","headerFilter","headerFilterPlaceholder","headerFilterParams","headerFilterEmptyCheck","headerFilterFunc","headerFilterFuncParams","headerFilterLiveFilter","print","headerContextMenu","headerMenu","contextMenu","clickMenu","formatterPrint","formatterPrintParams","formatterClipboard","formatterClipboardParams","formatterHtmlOutput","formatterHtmlOutputParams","titlePrint","titleClipboard","titleHtmlOutput","titleDownload"],n.prototype.getComponent=function(){return this.component||(this.component=new o(this)),this.component};var s=function(e){this.table=e,this.element=this.createHolderElement(),this.tableElement=this.createTableElement(),this.heightFixer=this.createTableElement(),this.columnManager=null,this.height=0,this.firstRender=!1,this.renderMode="virtual",this.fixedHeight=!1,this.rows=[],this.activeRows=[],this.activeRowsCount=0,this.displayRows=[],this.displayRowsCount=0,this.scrollTop=0,this.scrollLeft=0,this.vDomRowHeight=20,this.vDomTop=0,this.vDomBottom=0,this.vDomScrollPosTop=0,this.vDomScrollPosBottom=0,this.vDomTopPad=0,this.vDomBottomPad=0,this.vDomMaxRenderChain=90,this.vDomWindowBuffer=0,this.vDomWindowMinTotalRows=20,this.vDomWindowMinMarginRows=5,this.vDomTopNewRows=[],this.vDomBottomNewRows=[],this.rowNumColumn=!1,this.redrawBlock=!1,this.redrawBlockRestoreConfig=!1,this.redrawBlockRederInPosition=!1};s.prototype.createHolderElement=function(){var e=document.createElement("div");return e.classList.add("tabulator-tableHolder"),e.setAttribute("tabindex",0),e},s.prototype.createTableElement=function(){var e=document.createElement("div");return e.classList.add("tabulator-table"),e},s.prototype.getElement=function(){return this.element},s.prototype.getTableElement=function(){return this.tableElement},s.prototype.getRowPosition=function(e,t){return t?this.activeRows.indexOf(e):this.rows.indexOf(e)},s.prototype.setColumnManager=function(e){this.columnManager=e},s.prototype.initialize=function(){var e=this;e.setRenderMode(),e.element.appendChild(e.tableElement),e.firstRender=!0,e.element.addEventListener("scroll",function(){var t=e.element.scrollLeft;e.scrollLeft!=t&&(e.columnManager.scrollHorizontal(t),e.table.options.groupBy&&e.table.modules.groupRows.scrollHeaders(t),e.table.modExists("columnCalcs")&&e.table.modules.columnCalcs.scrollHorizontal(t),e.table.options.scrollHorizontal(t)),e.scrollLeft=t}),"virtual"===this.renderMode&&e.element.addEventListener("scroll",function(){var t=e.element.scrollTop,o=e.scrollTop>t;e.scrollTop!=t?(e.scrollTop=t,e.scrollVertical(o),"scroll"==e.table.options.ajaxProgressiveLoad&&e.table.modules.ajax.nextPage(e.element.scrollHeight-e.element.clientHeight-t),e.table.options.scrollVertical(t)):e.scrollTop=t})},s.prototype.findRow=function(e){var t=this;if("object"!=(void 0===e?"undefined":_typeof(e))){if(void 0===e||null===e)return!1;return t.rows.find(function(o){return o.data[t.table.options.index]==e})||!1}if(e instanceof l)return e;if(e instanceof r)return e._getSelf()||!1;if("undefined"!=typeof HTMLElement&&e instanceof HTMLElement){return t.rows.find(function(t){return t.element===e})||!1}return!1},s.prototype.getRowFromDataObject=function(e){return this.rows.find(function(t){return t.data===e})||!1},s.prototype.getRowFromPosition=function(e,t){return t?this.activeRows[e]:this.rows[e]},s.prototype.scrollToRow=function(e,t,o){var i,n=this,s=this.getDisplayRows().indexOf(e),a=e.getElement(),r=0;return new Promise(function(e,l){if(s>-1){if(void 0===t&&(t=n.table.options.scrollToRowPosition),void 0===o&&(o=n.table.options.scrollToRowIfVisible),"nearest"===t)switch(n.renderMode){case"classic":i=h.prototype.helpers.elOffset(a).top,t=Math.abs(n.element.scrollTop-i)>Math.abs(n.element.scrollTop+n.element.clientHeight-i)?"bottom":"top";break;case"virtual":t=Math.abs(n.vDomTop-s)>Math.abs(n.vDomBottom-s)?"bottom":"top"}if(!o&&h.prototype.helpers.elVisible(a)&&(r=h.prototype.helpers.elOffset(a).top-h.prototype.helpers.elOffset(n.element).top)>0&&r-1&&this.activeRows.splice(i,1),o>-1&&this.rows.splice(o,1),this.setActiveRows(this.activeRows),this.displayRowIterator(function(t){var o=t.indexOf(e);o>-1&&t.splice(o,1)}),t||this.reRenderInPosition(),this.regenerateRowNumbers(),this.table.options.rowDeleted.call(this.table,e.getComponent()),this.table.options.dataChanged&&this.table.options.dataChanged.call(this.table,this.getData()),this.table.options.groupBy&&this.table.modExists("groupRows")?this.table.modules.groupRows.updateGroupRows(!0):this.table.options.pagination&&this.table.modExists("page")?this.refreshActiveData(!1,!1,!0):this.table.options.pagination&&this.table.modExists("page")&&this.refreshActiveData("page")},s.prototype.addRow=function(e,t,o,i){var n=this.addRowActual(e,t,o,i);return this.table.options.history&&this.table.modExists("history")&&this.table.modules.history.action("rowAdd",n,{data:e,pos:t,index:o}),n},s.prototype.addRows=function(e,t,o){var i=this,n=this,s=0,a=[];return new Promise(function(r,l){t=i.findAddRowPos(t),Array.isArray(e)||(e=[e]),s=e.length-1,(void 0===o&&t||void 0!==o&&!t)&&e.reverse(),e.forEach(function(e,i){var s=n.addRow(e,t,o,!0);a.push(s)}),i.table.options.groupBy&&i.table.modExists("groupRows")?i.table.modules.groupRows.updateGroupRows(!0):i.table.options.pagination&&i.table.modExists("page")?i.refreshActiveData(!1,!1,!0):i.reRenderInPosition(),i.table.modExists("columnCalcs")&&i.table.modules.columnCalcs.recalc(i.table.rowManager.activeRows),i.regenerateRowNumbers(),r(a)})},s.prototype.findAddRowPos=function(e){return void 0===e&&(e=this.table.options.addRowPos),"pos"===e&&(e=!0),"bottom"===e&&(e=!1),e},s.prototype.addRowActual=function(e,t,o,i){var n,s,a=e instanceof l?e:new l(e||{},this),r=this.findAddRowPos(t),c=-1;if(!o&&this.table.options.pagination&&"page"==this.table.options.paginationAddRow&&(s=this.getDisplayRows(),r?s.length?o=s[0]:this.activeRows.length&&(o=this.activeRows[this.activeRows.length-1],r=!1):s.length&&(o=s[s.length-1],r=!(s.length1&&(!o||o&&-1==u.indexOf(o)?r?u[0]!==a&&(o=u[0],this._moveRowInArray(a.getGroup().rows,a,o,!r)):u[u.length-1]!==a&&(o=u[u.length-1],this._moveRowInArray(a.getGroup().rows,a,o,!r)):this._moveRowInArray(a.getGroup().rows,a,o,!r))}return o&&(c=this.rows.indexOf(o)),o&&c>-1?(n=this.activeRows.indexOf(o),this.displayRowIterator(function(e){var t=e.indexOf(o);t>-1&&e.splice(r?t:t+1,0,a)}),n>-1&&this.activeRows.splice(r?n:n+1,0,a),this.rows.splice(r?c:c+1,0,a)):r?(this.displayRowIterator(function(e){e.unshift(a)}),this.activeRows.unshift(a),this.rows.unshift(a)):(this.displayRowIterator(function(e){e.push(a)}),this.activeRows.push(a),this.rows.push(a)),this.setActiveRows(this.activeRows),this.table.options.rowAdded.call(this.table,a.getComponent()),this.table.options.dataChanged&&this.table.options.dataChanged.call(this.table,this.getData()),i||this.reRenderInPosition(),a},s.prototype.moveRow=function(e,t,o){this.table.options.history&&this.table.modExists("history")&&this.table.modules.history.action("rowMove",e,{posFrom:this.getRowPosition(e),posTo:this.getRowPosition(t),to:t,after:o}),this.moveRowActual(e,t,o),this.regenerateRowNumbers(),this.table.options.rowMoved.call(this.table,e.getComponent())},s.prototype.moveRowActual=function(e,t,o){var i=this;if(this._moveRowInArray(this.rows,e,t,o),this._moveRowInArray(this.activeRows,e,t,o),this.displayRowIterator(function(n){i._moveRowInArray(n,e,t,o)}),this.table.options.groupBy&&this.table.modExists("groupRows")){!o&&t instanceof H&&(t=this.table.rowManager.prevDisplayRow(e)||t);var n=t.getGroup(),s=e.getGroup();n===s?this._moveRowInArray(n.rows,e,t,o):(s&&s.removeRow(e),n.insertRow(e,t,o))}},s.prototype._moveRowInArray=function(e,t,o,i){var n,s,a,r;if(t!==o&&(n=e.indexOf(t),n>-1&&(e.splice(n,1),s=e.indexOf(o),s>-1?i?e.splice(s+1,0,t):e.splice(s,0,t):e.splice(n,0,t)),e===this.getDisplayRows())){a=nn?s:n+1;for(var l=a;l<=r;l++)e[l]&&this.styleRow(e[l],l)}},s.prototype.clearData=function(){this.setData([])},s.prototype.getRowIndex=function(e){return this.findRowIndex(e,this.rows)},s.prototype.getDisplayRowIndex=function(e){var t=this.getDisplayRows().indexOf(e);return t>-1&&t},s.prototype.nextDisplayRow=function(e,t){var o=this.getDisplayRowIndex(e),i=!1;return!1!==o&&o-1)&&o},s.prototype.getData=function(e,t){var o=[];return this.getRows(e).forEach(function(e){"row"==e.type&&o.push(e.getData(t||"data"))}),o},s.prototype.getComponents=function(e){var t=[];return this.getRows(e).forEach(function(e){t.push(e.getComponent())}),t},s.prototype.getDataCount=function(e){return this.getRows(e).length},s.prototype._genRemoteRequest=function(){var e=this,t=this.table,o=t.options,i={};if(t.modExists("page")){if(o.ajaxSorting){var n=this.table.modules.sort.getSort();n.forEach(function(e){delete e.column}),i[this.table.modules.page.paginationDataSentNames.sorters]=n}if(o.ajaxFiltering){var s=this.table.modules.filter.getFilters(!0,!0);i[this.table.modules.page.paginationDataSentNames.filters]=s}this.table.modules.ajax.setParams(i,!0)}t.modules.ajax.sendRequest().then(function(t){e._setDataActual(t,!0)}).catch(function(e){})},s.prototype.filterRefresh=function(){var e=this.table,t=e.options,o=this.scrollLeft;t.ajaxFiltering?"remote"==t.pagination&&e.modExists("page")?(e.modules.page.reset(!0),e.modules.page.setPage(1).then(function(){}).catch(function(){})):t.ajaxProgressiveLoad?e.modules.ajax.loadData().then(function(){}).catch(function(){}):this._genRemoteRequest():this.refreshActiveData("filter"),this.scrollHorizontal(o)},s.prototype.sorterRefresh=function(e){var t=this.table,o=this.table.options,i=this.scrollLeft;o.ajaxSorting?("remote"==o.pagination||o.progressiveLoad)&&t.modExists("page")?(t.modules.page.reset(!0),t.modules.page.setPage(1).then(function(){}).catch(function(){})):o.ajaxProgressiveLoad?t.modules.ajax.loadData().then(function(){}).catch(function(){}):this._genRemoteRequest():this.refreshActiveData(e?"filter":"sort"),this.scrollHorizontal(i)},s.prototype.scrollHorizontal=function(e){this.scrollLeft=e,this.element.scrollLeft=e,this.table.options.groupBy&&this.table.modules.groupRows.scrollHeaders(e),this.table.modExists("columnCalcs")&&this.table.modules.columnCalcs.scrollHorizontal(e)},s.prototype.refreshActiveData=function(e,t,o){var i,n=this,s=this.table,a=["all","filter","sort","display","freeze","group","tree","page"];if(this.redrawBlock)return void((!this.redrawBlockRestoreConfig||a.indexOf(e)=0))break;s=r}else if(t-a[r].getElement().offsetTop>=0)n=r;else{if(i=!0,!(o-a[r].getElement().offsetTop>=0))break;s=r}}else n=this.vDomTop,s=this.vDomBottom;return a.slice(n,s+1)},s.prototype.displayRowIterator=function(e){this.displayRows.forEach(e),this.displayRowsCount=this.displayRows[this.displayRows.length-1].length},s.prototype.getRows=function(e){var t;switch(e){case"active":t=this.activeRows;break;case"display":t=this.table.rowManager.getDisplayRows();break;case"visible":t=this.getVisibleRows(!0);break;case"selected":t=this.table.modules.selectRow.selectedRows;break;default:t=this.rows}return t},s.prototype.reRenderInPosition=function(e){if("virtual"==this.getRenderMode())if(this.redrawBlock)e?e():this.redrawBlockRederInPosition=!0;else{for(var t=this.element.scrollTop,o=!1,i=!1,n=this.scrollLeft,s=this.getDisplayRows(),a=this.vDomTop;a<=this.vDomBottom;a++)if(s[a]){var r=t-s[a].getElement().offsetTop;if(!(!1===i||Math.abs(r)this.vDomWindowBuffer&&(this.vDomWindowBuffer=2*g),"group"!==f.type&&(u=!1),i.vDomBottom++,c++}e?(i.vDomTopPad=t?i.vDomRowHeight*this.vDomTop+o:i.scrollTop-l,i.vDomBottomPad=i.vDomBottom==i.displayRowsCount-1?0:Math.max(i.vDomScrollHeight-i.vDomTopPad-r-l,0)):(this.vDomTopPad=0,i.vDomRowHeight=Math.floor((r+l)/c),i.vDomBottomPad=i.vDomRowHeight*(i.displayRowsCount-i.vDomBottom-1),i.vDomScrollHeight=l+r+i.vDomBottomPad-i.height),n.style.paddingTop=i.vDomTopPad+"px",n.style.paddingBottom=i.vDomBottomPad+"px",t&&(this.scrollTop=i.vDomTopPad+l+o-(this.element.scrollWidth>this.element.clientWidth?this.element.offsetHeight-this.element.clientHeight:0)),this.scrollTop=Math.min(this.scrollTop,this.element.scrollHeight-this.height),this.element.scrollWidth>this.element.offsetWidth&&t&&(this.scrollTop+=this.element.offsetHeight-this.element.clientHeight),this.vDomScrollPosTop=this.scrollTop,this.vDomScrollPosBottom=this.scrollTop,s.scrollTop=this.scrollTop,n.style.minWidth=u?i.table.columnManager.getWidth()+"px":"",i.table.options.groupBy&&"fitDataFill"!=i.table.modules.layout.getMode()&&i.displayRowsCount==i.table.modules.groupRows.countGroups()&&(i.tableElement.style.minWidth=i.table.columnManager.getWidth())}else this.renderEmptyScroll();this.fixedHeight||this.adjustTableSize()},s.prototype.scrollVertical=function(e){var t=this.scrollTop-this.vDomScrollPosTop,o=this.scrollTop-this.vDomScrollPosBottom,i=2*this.vDomWindowBuffer;if(-t>i||o>i){var n=this.scrollLeft;this._virtualRenderFill(Math.floor(this.element.scrollTop/this.element.scrollHeight*this.displayRowsCount)),this.scrollHorizontal(n)}else e?(t<0&&this._addTopRow(-t),o<0&&(this.vDomScrollHeight-this.scrollTop>this.vDomWindowBuffer?this._removeBottomRow(-o):this.vDomScrollPosBottom=this.scrollTop)):(t>=0&&(this.scrollTop>this.vDomWindowBuffer?this._removeTopRow(t):this.vDomScrollPosTop=this.scrollTop),o>=0&&this._addBottomRow(o))},s.prototype._addTopRow=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,o=this.tableElement,i=this.getDisplayRows();if(this.vDomTop){var n=this.vDomTop-1,s=i[n],a=s.getHeight()||this.vDomRowHeight;e>=a&&(this.styleRow(s,n),o.insertBefore(s.getElement(),o.firstChild),s.initialized&&s.heightInitialized||(this.vDomTopNewRows.push(s),s.heightInitialized||s.clearCellHeight()),s.initialize(),this.vDomTopPad-=a,this.vDomTopPad<0&&(this.vDomTopPad=n*this.vDomRowHeight),n||(this.vDomTopPad=0),o.style.paddingTop=this.vDomTopPad+"px",this.vDomScrollPosTop-=a,this.vDomTop--),e=-(this.scrollTop-this.vDomScrollPosTop),s.getHeight()>this.vDomWindowBuffer&&(this.vDomWindowBuffer=2*s.getHeight()),t=(i[this.vDomTop-1].getHeight()||this.vDomRowHeight)?this._addTopRow(e,t+1):this._quickNormalizeRowHeight(this.vDomTopNewRows)}},s.prototype._removeTopRow=function(e){var t=this.tableElement,o=this.getDisplayRows()[this.vDomTop],i=o.getHeight()||this.vDomRowHeight;if(e>=i){var n=o.getElement();n.parentNode.removeChild(n),this.vDomTopPad+=i,t.style.paddingTop=this.vDomTopPad+"px",this.vDomScrollPosTop+=this.vDomTop?i:i+this.vDomWindowBuffer,this.vDomTop++,e=this.scrollTop-this.vDomScrollPosTop,this._removeTopRow(e)}},s.prototype._addBottomRow=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,o=this.tableElement,i=this.getDisplayRows();if(this.vDomBottom=a&&(this.styleRow(s,n),o.appendChild(s.getElement()),s.initialized&&s.heightInitialized||(this.vDomBottomNewRows.push(s),s.heightInitialized||s.clearCellHeight()),s.initialize(),this.vDomBottomPad-=a,(this.vDomBottomPad<0||n==this.displayRowsCount-1)&&(this.vDomBottomPad=0),o.style.paddingBottom=this.vDomBottomPad+"px",this.vDomScrollPosBottom+=a,this.vDomBottom++),e=this.scrollTop-this.vDomScrollPosBottom,s.getHeight()>this.vDomWindowBuffer&&(this.vDomWindowBuffer=2*s.getHeight()),t=(i[this.vDomBottom+1].getHeight()||this.vDomRowHeight)?this._addBottomRow(e,t+1):this._quickNormalizeRowHeight(this.vDomBottomNewRows)}},s.prototype._removeBottomRow=function(e){var t=this.tableElement,o=this.getDisplayRows()[this.vDomBottom],i=o.getHeight()||this.vDomRowHeight;if(e>=i){var n=o.getElement();n.parentNode&&n.parentNode.removeChild(n),this.vDomBottomPad+=i,this.vDomBottomPad<0&&(this.vDomBottomPad=0),t.style.paddingBottom=this.vDomBottomPad+"px",this.vDomScrollPosBottom-=i,this.vDomBottom--,e=-(this.scrollTop-this.vDomScrollPosBottom),this._removeBottomRow(e)}},s.prototype._quickNormalizeRowHeight=function(e){e.forEach(function(e){e.calcHeight()}),e.forEach(function(e){e.setCellHeight()}),e.length=0},s.prototype.normalizeHeight=function(){this.activeRows.forEach(function(e){e.normalizeHeight()})},s.prototype.adjustTableSize=function(){var e,t=this.element.clientHeight;if("virtual"===this.renderMode){var o=Math.floor(this.columnManager.getElement().offsetHeight+(this.table.footerManager&&!this.table.footerManager.external?this.table.footerManager.getElement().offsetHeight:0));this.fixedHeight?(this.element.style.minHeight="calc(100% - "+o+"px)",this.element.style.height="calc(100% - "+o+"px)",this.element.style.maxHeight="calc(100% - "+o+"px)"):(this.element.style.height="",this.element.style.height=Math.floor(this.table.element.clientHeight)-o+"px",this.element.scrollTop=this.scrollTop),this.height=this.element.clientHeight,this.vDomWindowBuffer=this.table.options.virtualDomBuffer||this.height,this.fixedHeight||Math.floor(t)==Math.floor(this.element.clientHeight)||((e=this.table.modExists("resizeTable"))&&!this.table.modules.resizeTable.autoResize||!e)&&this.redraw()}},s.prototype.reinitialize=function(){this.rows.forEach(function(e){e.reinitialize(!0)})},s.prototype.blockRedraw=function(){this.redrawBlock=!0,this.redrawBlockRestoreConfig=!1},s.prototype.restoreRedraw=function(){this.redrawBlock=!1,this.redrawBlockRestoreConfig?(this.refreshActiveData(this.redrawBlockRestoreConfig.stage,this.redrawBlockRestoreConfig.skipStage,this.redrawBlockRestoreConfig.renderInPosition), +this.redrawBlockRestoreConfig=!1):this.redrawBlockRederInPosition&&this.reRenderInPosition(),this.redrawBlockRederInPosition=!1},s.prototype.redraw=function(e){var t=this.scrollLeft;this.adjustTableSize(),this.table.tableWidth=this.table.element.clientWidth,e?this.renderTable():("classic"==this.renderMode?this.table.options.groupBy?this.refreshActiveData("group",!1,!1):this._simpleRender():(this.reRenderInPosition(),this.scrollHorizontal(t)),this.displayRowsCount||this.table.options.placeholder&&this.getElement().appendChild(this.table.options.placeholder))},s.prototype.resetScroll=function(){if(this.element.scrollLeft=0,this.element.scrollTop=0,"ie"===this.table.browser){var e=document.createEvent("Event");e.initEvent("scroll",!1,!0),this.element.dispatchEvent(e)}else this.element.dispatchEvent(new Event("scroll"))};var a=function(e){this.table=e,this.element=this.table.rowManager.tableElement,this.holderEl=this.table.rowManager.element,this.leftCol=0,this.rightCol=0,this.scrollLeft=0,this.vDomScrollPosLeft=0,this.vDomScrollPosRight=0,this.vDomPadLeft=0,this.vDomPadRight=0,this.fitDataColAvg=0,this.window=200,this.initialized=!1,this.columns=[],this.compatabilityCheck()&&this.initialize()};a.prototype.compatabilityCheck=function(){var e=this.table.options,t=!0;return"fitDataTable"==e.layout&&(console.warn("Horizontal Vitrual DOM is not compatible with fitDataTable layout mode"),t=!1),e.responsiveLayout&&(console.warn("Horizontal Vitrual DOM is not compatible with responsive columns"),t=!1),this.table.rtl&&(console.warn("Horizontal Vitrual DOM is not currently compatible with RTL text direction"),t=!1),e.columns&&e.columns.find(function(e){return e.frozen})&&(console.warn("Horizontal Vitrual DOM is not compatible with frozen columns"),t=!1),t||(e.virtualDomHoz=!1),t},a.prototype.initialize=function(){var e=this;this.holderEl.addEventListener("scroll",function(){var t=e.holderEl.scrollLeft;e.scrollLeft!=t&&(e.scrollLeft=t,e.scroll(t-(e.vDomScrollPosLeft+e.window)))})},a.prototype.deinitialize=function(){this.initialized=!1},a.prototype.clear=function(){this.columns=[],this.leftCol=-1,this.rightCol=0,this.vDomScrollPosLeft=0,this.vDomScrollPosRight=0,this.vDomPadLeft=0,this.vDomPadRight=0},a.prototype.dataChange=function(){var e,t,o,i=!1,n=0,s=0;if("fitData"===this.table.options.layout){if(this.table.columnManager.columnsByIndex.forEach(function(e){!e.definition.width&&e.visible&&(i=!0)}),i&&i&&this.table.rowManager.getDisplayRows().length&&(this.vDomScrollPosRight=this.scrollLeft+this.holderEl.clientWidth+this.window,this.table.options.groupBy?(e=this.table.modules.groupRows.getGroups(!1)[0],t=e.getRows(!1)[0]):t=this.table.rowManager.getDisplayRows()[0],t)){o=t.getElement(),t.generateCells(),this.element.appendChild(o);for(var s=0;sthis.vDomScrollPosRight)break}for(o.parentNode.removeChild(o),this.fitDataColAvg=Math.floor(n/(s+1)),s;so.vDomScrollPosLeft&&n.8*this.holderEl.clientWidth?this.reinitialize():e>0?(this.addColRight(),this.removeColLeft()):(this.addColLeft(),this.removeColRight())},a.prototype.colPositionAdjust=function(e,t,o){for(var i=e;i=this.columns.length-1?this.vDomPadRight=0:this.vDomPadRight-=i.getWidth(),this.element.style.paddingRight=this.vDomPadRight+"px",this.addColRight())},a.prototype.addColLeft=function(){var e=this.columns[this.leftCol-1];if(e&&e.modules.vdomHoz.rightPos>=this.vDomScrollPosLeft){this.table.rowManager.getVisibleRows().forEach(function(t){if("group"!==t.type){var o=t.getCell(e);t.getElement().prepend(o.getElement()),o.cellRendered()}}),this.leftCol?this.vDomPadLeft-=e.getWidth():this.vDomPadLeft=0,this.element.style.paddingLeft=this.vDomPadLeft+"px",this.leftCol--,this.addColLeft()}},a.prototype.removeColRight=function(e){var t,e=this.columns[this.rightCol];e&&e.modules.vdomHoz.leftPos>this.vDomScrollPosRight&&(t=this.table.rowManager.getVisibleRows(),e.modules.vdomHoz.visible=!1,t.forEach(function(t){if("group"!==t.type){var o=t.getCell(e);t.getElement().removeChild(o.getElement())}}),this.vDomPadRight+=e.getWidth(),this.element.style.paddingRight=this.vDomPadRight+"px",this.rightCol--,this.removeColRight())},a.prototype.removeColLeft=function(){var e,t=this.columns[this.leftCol];t&&t.modules.vdomHoz.rightPos-1}return!1},r.prototype.treeCollapse=function(){this._row.table.modExists("dataTree",!0)&&this._row.table.modules.dataTree.collapseRow(this._row)},r.prototype.treeExpand=function(){this._row.table.modExists("dataTree",!0)&&this._row.table.modules.dataTree.expandRow(this._row)},r.prototype.treeToggle=function(){this._row.table.modExists("dataTree",!0)&&this._row.table.modules.dataTree.toggleRow(this._row)},r.prototype.getTreeParent=function(){return!!this._row.table.modExists("dataTree",!0)&&this._row.table.modules.dataTree.getTreeParent(this._row)},r.prototype.getTreeChildren=function(){return!!this._row.table.modExists("dataTree",!0)&&this._row.table.modules.dataTree.getTreeChildren(this._row,!0)},r.prototype.addTreeChild=function(e,t,o){return!!this._row.table.modExists("dataTree",!0)&&this._row.table.modules.dataTree.addTreeChildRow(this._row,e,t,o)},r.prototype.reformat=function(){return this._row.reinitialize()},r.prototype.getGroup=function(){return this._row.getGroup().getComponent()},r.prototype.getTable=function(){return this._row.table},r.prototype.getNextRow=function(){var e=this._row.nextRow();return e?e.getComponent():e},r.prototype.getPrevRow=function(){var e=this._row.prevRow();return e?e.getComponent():e};var l=function(e,t){var o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"row";this.table=t.table,this.parent=t,this.data={},this.type=o,this.element=this.createElement(),this.modules={},this.cells=[],this.height=0,this.heightStyled="",this.manualHeight=!1,this.outerHeight=0,this.initialized=!1,this.heightInitialized=!1,this.component=null,this.setData(e),this.generateElement()};l.prototype.createElement=function(){var e=document.createElement("div");return e.classList.add("tabulator-row"),e.setAttribute("role","row"),e},l.prototype.getElement=function(){return this.element},l.prototype.detachElement=function(){this.element&&this.element.parentNode&&this.element.parentNode.removeChild(this.element)},l.prototype.generateElement=function(){var e,t,o,i=this;!1!==i.table.options.selectable&&i.table.modExists("selectRow")&&i.table.modules.selectRow.initializeRow(this),!1!==i.table.options.movableRows&&i.table.modExists("moveRow")&&i.table.modules.moveRow.initializeRow(this),!1!==i.table.options.dataTree&&i.table.modExists("dataTree")&&i.table.modules.dataTree.initializeRow(this),"collapse"===i.table.options.responsiveLayout&&i.table.modExists("responsiveLayout")&&i.table.modules.responsiveLayout.initializeRow(this),(i.table.options.rowContextMenu||i.table.options.rowClickMenu)&&this.table.modExists("menu")&&i.table.modules.menu.initializeRow(this),i.table.options.rowClick&&i.element.addEventListener("click",function(e){i.table.options.rowClick(e,i.getComponent())}),i.table.options.rowDblClick&&i.element.addEventListener("dblclick",function(e){i.table.options.rowDblClick(e,i.getComponent())}),i.table.options.rowContext&&i.element.addEventListener("contextmenu",function(e){i.table.options.rowContext(e,i.getComponent())}),i.table.options.rowMouseEnter&&i.element.addEventListener("mouseenter",function(e){i.table.options.rowMouseEnter(e,i.getComponent())}),i.table.options.rowMouseLeave&&i.element.addEventListener("mouseleave",function(e){i.table.options.rowMouseLeave(e,i.getComponent())}),i.table.options.rowMouseOver&&i.element.addEventListener("mouseover",function(e){i.table.options.rowMouseOver(e,i.getComponent())}),i.table.options.rowMouseOut&&i.element.addEventListener("mouseout",function(e){i.table.options.rowMouseOut(e,i.getComponent())}),i.table.options.rowMouseMove&&i.element.addEventListener("mousemove",function(e){i.table.options.rowMouseMove(e,i.getComponent())}),i.table.options.rowTap&&(o=!1,i.element.addEventListener("touchstart",function(e){o=!0},{passive:!0}),i.element.addEventListener("touchend",function(e){o&&i.table.options.rowTap(e,i.getComponent()),o=!1})),i.table.options.rowDblTap&&(e=null,i.element.addEventListener("touchend",function(t){e?(clearTimeout(e),e=null,i.table.options.rowDblTap(t,i.getComponent())):e=setTimeout(function(){clearTimeout(e),e=null},300)})),i.table.options.rowTapHold&&(t=null,i.element.addEventListener("touchstart",function(e){clearTimeout(t),t=setTimeout(function(){clearTimeout(t),t=null,o=!1,i.table.options.rowTapHold(e,i.getComponent())},1e3)},{passive:!0}),i.element.addEventListener("touchend",function(e){clearTimeout(t),t=null}))},l.prototype.generateCells=function(){this.cells=this.table.columnManager.generateCells(this)},l.prototype.initialize=function(e){var t=this;if(!this.initialized||e){for(this.deleteCells();this.element.firstChild;)this.element.removeChild(this.element.firstChild);this.table.modExists("frozenColumns")&&this.table.modules.frozenColumns.layoutRow(this),this.generateCells(),this.table.options.virtualDomHoz&&this.table.vdomHoz.initialized?this.table.vdomHoz.initializeRow(this):this.cells.forEach(function(e){t.element.appendChild(e.getElement()),e.cellRendered()}),e&&this.normalizeHeight(),this.table.options.dataTree&&this.table.modExists("dataTree")&&this.table.modules.dataTree.layoutRow(this),"collapse"===this.table.options.responsiveLayout&&this.table.modExists("responsiveLayout")&&this.table.modules.responsiveLayout.layoutRow(this),this.table.options.rowFormatter&&this.table.options.rowFormatter(this.getComponent()),this.table.options.resizableRows&&this.table.modExists("resizeRows")&&this.table.modules.resizeRows.initializeRow(this),this.initialized=!0}else this.table.options.virtualDomHoz&&this.table.vdomHoz.reinitializeRow(this)},l.prototype.reinitializeHeight=function(){this.heightInitialized=!1,null!==this.element.offsetParent&&this.normalizeHeight(!0)},l.prototype.reinitialize=function(e){this.initialized=!1,this.heightInitialized=!1,this.manualHeight||(this.height=0,this.heightStyled=""),null!==this.element.offsetParent&&this.initialize(!0),this.table.options.dataTree&&this.table.modExists("dataTree",!0)&&this.table.modules.dataTree.getTreeChildren(this,!1,!0).forEach(function(e){e.reinitialize(!0)})},l.prototype.calcHeight=function(e){var t=0,o=this.table.options.resizableRows?this.element.clientHeight:0;this.cells.forEach(function(e){var o=e.getHeight();o>t&&(t=o)}),this.height=e?Math.max(t,o):this.manualHeight?this.height:Math.max(t,o),this.heightStyled=this.height?this.height+"px":"",this.outerHeight=this.element.offsetHeight},l.prototype.setCellHeight=function(){this.cells.forEach(function(e){e.setHeight()}),this.heightInitialized=!0},l.prototype.clearCellHeight=function(){this.cells.forEach(function(e){e.clearHeight()})},l.prototype.normalizeHeight=function(e){e&&this.clearCellHeight(),this.calcHeight(e),this.setCellHeight()},l.prototype.setHeight=function(e,t){(this.height!=e||t)&&(this.manualHeight=!0,this.height=e,this.heightStyled=e?e+"px":"",this.setCellHeight(),this.outerHeight=this.element.offsetHeight)},l.prototype.getHeight=function(){return this.outerHeight},l.prototype.getWidth=function(){return this.element.offsetWidth},l.prototype.deleteCell=function(e){var t=this.cells.indexOf(e);t>-1&&this.cells.splice(t,1)},l.prototype.setData=function(e){this.table.modExists("mutator")&&(e=this.table.modules.mutator.transformRow(e,"data")),this.data=e,this.table.options.reactiveData&&this.table.modExists("reactiveData",!0)&&this.table.modules.reactiveData.watchRow(this)},l.prototype.updateData=function(e){var t,o=this,i=h.prototype.helpers.elVisible(this.element),n={};return new Promise(function(s,a){"string"==typeof e&&(e=JSON.parse(e)),o.table.options.reactiveData&&o.table.modExists("reactiveData",!0)&&o.table.modules.reactiveData.block(),o.table.modExists("mutator")?(n=Object.assign(n,o.data),n=Object.assign(n,e),t=o.table.modules.mutator.transformRow(n,"data",e)):t=e;for(var r in t)o.data[r]=t[r];o.table.options.reactiveData&&o.table.modExists("reactiveData",!0)&&o.table.modules.reactiveData.unblock();for(var r in e){o.table.columnManager.getColumnsByFieldRoot(r).forEach(function(e){var n=o.getCell(e.getField());if(n){var s=e.getFieldValue(t);n.getValue()!=s&&(n.setValueProcessData(s),i&&n.cellRendered())}})}o.table.options.groupUpdateOnCellEdit&&o.table.options.groupBy&&o.table.modExists("groupRows")&&o.table.modules.groupRows.reassignRowToGroup(o.row),i?(o.normalizeHeight(!0),o.table.options.rowFormatter&&o.table.options.rowFormatter(o.getComponent())):(o.initialized=!1,o.height=0,o.heightStyled=""),!1!==o.table.options.dataTree&&o.table.modExists("dataTree")&&o.table.modules.dataTree.redrawNeeded(e)&&(o.table.modules.dataTree.initializeRow(o),i&&(o.table.modules.dataTree.layoutRow(o),o.table.rowManager.refreshActiveData("tree",!1,!0))),o.table.options.rowUpdated.call(o.table,o.getComponent()),o.table.options.dataChanged&&o.table.options.dataChanged.call(o.table,o.table.rowManager.getData()),s()})},l.prototype.getData=function(e){return e&&this.table.modExists("accessor")?this.table.modules.accessor.transformRow(this,e):this.data},l.prototype.getCell=function(e){return e=this.table.columnManager.findColumn(e),this.cells.find(function(t){return t.column===e})},l.prototype.getCellIndex=function(e){return this.cells.findIndex(function(t){return t===e})},l.prototype.findNextEditableCell=function(e){var t=!1;if(e0)for(var o=e-1;o>=0;o--){var i=this.cells[o],n=!0;if(i.column.modules.edit&&h.prototype.helpers.elVisible(i.getElement())&&("function"==typeof i.column.modules.edit.check&&(n=i.column.modules.edit.check(i.getComponent())),n)){t=i;break}}return t},l.prototype.getCells=function(){return this.cells},l.prototype.nextRow=function(){return this.table.rowManager.nextDisplayRow(this,!0)||!1},l.prototype.prevRow=function(){return this.table.rowManager.prevDisplayRow(this,!0)||!1},l.prototype.moveToRow=function(e,t){var o=this.table.rowManager.findRow(e);o?(this.table.rowManager.moveRowActual(this,o,!t),this.table.rowManager.refreshActiveData("display",!1,!0)):console.warn("Move Error - No matching row found:",e)},l.prototype.validate=function(){var e=[];return this.cells.forEach(function(t){t.validate()||e.push(t.getComponent())}),!e.length||e},l.prototype.delete=function(){var e=this;return new Promise(function(t,o){var i,n;e.table.options.history&&e.table.modExists("history")&&(e.table.options.groupBy&&e.table.modExists("groupRows")?(n=e.getGroup().rows,(i=n.indexOf(e))&&(i=n[i-1])):(i=e.table.rowManager.getRowIndex(e))&&(i=e.table.rowManager.rows[i-1]),e.table.modules.history.action("rowDelete",e,{data:e.getData(),pos:!i,index:i})),e.deleteActual(),t()})},l.prototype.deleteActual=function(e){this.table.rowManager.getRowIndex(this);this.detatchModules(),this.table.options.reactiveData&&this.table.modExists("reactiveData",!0),this.modules.group&&this.modules.group.removeRow(this),this.table.rowManager.deleteRow(this,e),this.deleteCells(),this.initialized=!1,this.heightInitialized=!1,this.element=!1,this.table.options.dataTree&&this.table.modExists("dataTree",!0)&&this.table.modules.dataTree.rowDelete(this),this.table.modExists("columnCalcs")&&(this.table.options.groupBy&&this.table.modExists("groupRows")?this.table.modules.columnCalcs.recalcRowGroup(this):this.table.modules.columnCalcs.recalc(this.table.rowManager.activeRows))},l.prototype.detatchModules=function(){this.table.modExists("selectRow")&&this.table.modules.selectRow._deselectRow(this,!0),this.table.modExists("edit")&&this.table.modules.edit.currentCell.row===this&&this.table.modules.edit.cancelEdit(),this.table.modExists("frozenRows")&&this.table.modules.frozenRows.detachRow(this)},l.prototype.deleteCells=function(){for(var e=this.cells.length,t=0;t",footerElement:!1,index:"id",textDirection:"auto",keybindings:[],tabEndNewRow:!1,invalidOptionWarnings:!0,clipboard:!1,clipboardCopyStyled:!0,clipboardCopyConfig:!1,clipboardCopyFormatter:!1,clipboardCopyRowRange:"active",clipboardPasteParser:"table",clipboardPasteAction:"insert",clipboardCopied:function(){},clipboardPasted:function(){},clipboardPasteError:function(){},downloadDataFormatter:!1,downloadReady:function(e,t){return t},downloadComplete:!1,downloadConfig:{},downloadRowRange:"active",dataTree:!1,dataTreeFilter:!0,dataTreeSort:!0,dataTreeElementColumn:!1,dataTreeBranchElement:!0,dataTreeChildIndent:9,dataTreeChildField:"_children",dataTreeCollapseElement:!1,dataTreeExpandElement:!1,dataTreeStartExpanded:!1,dataTreeRowExpanded:function(){},dataTreeRowCollapsed:function(){},dataTreeChildColumnCalcs:!1,dataTreeSelectPropagate:!1,printAsHtml:!1,printFormatter:!1,printHeader:!1,printFooter:!1,printCopyStyle:!0,printStyled:!0,printVisibleRows:!0,printRowRange:"visible",printConfig:{},addRowPos:"bottom",selectable:"highlight",selectableRangeMode:"drag",selectableRollingSelection:!0,selectablePersistence:!0,selectableCheck:function(e,t){return!0},headerFilterLiveFilterDelay:300,headerFilterPlaceholder:!1,headerVisible:!0,history:!1,locale:!1,langs:{},virtualDom:!0,virtualDomBuffer:0,virtualDomHoz:!1,persistentLayout:!1,persistentSort:!1,persistentFilter:!1,persistenceID:"",persistenceMode:!0,persistenceReaderFunc:!1,persistenceWriterFunc:!1,persistence:!1,responsiveLayout:!1,responsiveLayoutCollapseStartOpen:!0,responsiveLayoutCollapseUseFormatters:!0,responsiveLayoutCollapseFormatter:!1,pagination:!1,paginationSize:!1,paginationInitialPage:1,paginationButtonCount:5,paginationSizeSelector:!1,paginationElement:!1,paginationDataSent:{},paginationDataReceived:{},paginationAddRow:"page",ajaxURL:!1,ajaxURLGenerator:!1,ajaxParams:{},ajaxConfig:"get",ajaxContentType:"form",ajaxRequestFunc:!1,ajaxLoader:!0,ajaxLoaderLoading:!1,ajaxLoaderError:!1,ajaxFiltering:!1,ajaxSorting:!1,ajaxProgressiveLoad:!1,ajaxProgressiveLoadDelay:0,ajaxProgressiveLoadScrollMargin:0,groupBy:!1,groupStartOpen:!0,groupValues:!1,groupUpdateOnCellEdit:!1,groupHeader:!1,groupHeaderPrint:null,groupHeaderClipboard:null,groupHeaderHtmlOutput:null,groupHeaderDownload:null,htmlOutputConfig:!1,movableColumns:!1,movableRows:!1,movableRowsConnectedTables:!1,movableRowsConnectedElements:!1,movableRowsSender:!1,movableRowsReceiver:"insert",movableRowsSendingStart:function(){},movableRowsSent:function(){},movableRowsSentFailed:function(){},movableRowsSendingStop:function(){},movableRowsReceivingStart:function(){},movableRowsReceived:function(){},movableRowsReceivedFailed:function(){},movableRowsReceivingStop:function(){},movableRowsElementDrop:function(){},scrollToRowPosition:"top",scrollToRowIfVisible:!0,scrollToColumnPosition:"left",scrollToColumnIfVisible:!0,rowFormatter:!1,rowFormatterPrint:null,rowFormatterClipboard:null,rowFormatterHtmlOutput:null,placeholder:!1,tableBuilding:function(){},tableBuilt:function(){},renderStarted:function(){},renderComplete:function(){},rowClick:!1,rowDblClick:!1,rowContext:!1,rowTap:!1,rowDblTap:!1,rowTapHold:!1,rowMouseEnter:!1,rowMouseLeave:!1,rowMouseOver:!1,rowMouseOut:!1,rowMouseMove:!1,rowContextMenu:!1,rowClickMenu:!1,rowAdded:function(){},rowDeleted:function(){},rowMoved:function(){},rowUpdated:function(){},rowSelectionChanged:function(){},rowSelected:function(){},rowDeselected:function(){},rowResized:function(){},cellClick:!1,cellDblClick:!1,cellContext:!1,cellTap:!1,cellDblTap:!1,cellTapHold:!1,cellMouseEnter:!1,cellMouseLeave:!1,cellMouseOver:!1,cellMouseOut:!1,cellMouseMove:!1,cellEditing:function(){},cellEdited:function(){},cellEditCancelled:function(){},columnMoved:!1,columnResized:function(){},columnTitleChanged:function(){},columnVisibilityChanged:function(){},htmlImporting:function(){},htmlImported:function(){},dataLoading:function(){},dataLoaded:function(){},dataEdited:!1,dataChanged:!1,ajaxRequesting:function(){},ajaxResponse:!1,ajaxError:function(){},dataFiltering:!1,dataFiltered:!1,dataSorting:function(){},dataSorted:function(){},groupToggleElement:"arrow",groupClosedShowCalcs:!1,dataGrouping:function(){},dataGrouped:!1,groupVisibilityChanged:function(){},groupClick:!1,groupDblClick:!1,groupContext:!1,groupContextMenu:!1,groupClickMenu:!1,groupTap:!1,groupDblTap:!1,groupTapHold:!1,columnCalcs:!0,pageLoaded:function(){},localized:function(){},validationMode:"blocking",validationFailed:function(){},historyUndo:function(){},historyRedo:function(){},scrollHorizontal:function(){},scrollVertical:function(){}},h.prototype.initializeOptions=function(e){if(!1!==e.invalidOptionWarnings)for(var t in e)void 0===this.defaultOptions[t]&&console.warn("Invalid table constructor option:",t);for(var t in this.defaultOptions)t in e?this.options[t]=e[t]:Array.isArray(this.defaultOptions[t])?this.options[t]=Object.assign([],this.defaultOptions[t]):"object"===_typeof(this.defaultOptions[t])&&null!==this.defaultOptions[t]?this.options[t]=Object.assign({},this.defaultOptions[t]):this.options[t]=this.defaultOptions[t]},h.prototype.initializeElement=function(e){return"undefined"!=typeof HTMLElement&&e instanceof HTMLElement?(this.element=e,!0):"string"==typeof e?(this.element=document.querySelector(e),!!this.element||(console.error("Tabulator Creation Error - no element found matching selector: ",e),!1)):(console.error("Tabulator Creation Error - Invalid element provided:",e),!1)},h.prototype.rtlCheck=function(){var e=window.getComputedStyle(this.element);switch(this.options.textDirection){case"auto":if("rtl"!==e.direction)break;case"rtl":this.element.classList.add("tabulator-rtl"),this.rtl=!0;break;case"ltr":this.element.classList.add("tabulator-ltr");default:this.rtl=!1}},h.prototype._mapDepricatedFunctionality=function(){(this.options.persistentLayout||this.options.persistentSort||this.options.persistentFilter)&&(this.options.persistence||(this.options.persistence={})),this.options.dataEdited&&(console.warn("DEPRECATION WARNING - dataEdited option has been deprecated, please use the dataChanged option instead"),this.options.dataChanged=this.options.dataEdited),this.options.downloadDataFormatter&&console.warn("DEPRECATION WARNING - downloadDataFormatter option has been deprecated"),void 0!==this.options.clipboardCopyHeader&&(this.options.columnHeaders=this.options.clipboardCopyHeader,console.warn("DEPRECATION WARNING - clipboardCopyHeader option has been deprecated, please use the columnHeaders property on the clipboardCopyConfig option")),!0!==this.options.printVisibleRows&&(console.warn("printVisibleRows option is deprecated, you should now use the printRowRange option"),this.options.persistence.printRowRange="active"),!0!==this.options.printCopyStyle&&(console.warn("printCopyStyle option is deprecated, you should now use the printStyled option"),this.options.persistence.printStyled=this.options.printCopyStyle),this.options.persistentLayout&&(console.warn("persistentLayout option is deprecated, you should now use the persistence option"),!0!==this.options.persistence&&void 0===this.options.persistence.columns&&(this.options.persistence.columns=!0)),this.options.persistentSort&&(console.warn("persistentSort option is deprecated, you should now use the persistence option"),!0!==this.options.persistence&&void 0===this.options.persistence.sort&&(this.options.persistence.sort=!0)),this.options.persistentFilter&&(console.warn("persistentFilter option is deprecated, you should now use the persistence option"),!0!==this.options.persistence&&void 0===this.options.persistence.filter&&(this.options.persistence.filter=!0)),this.options.columnVertAlign&&(console.warn("columnVertAlign option is deprecated, you should now use the columnHeaderVertAlign option"),this.options.columnHeaderVertAlign=this.options.columnVertAlign)},h.prototype._clearSelection=function(){this.element.classList.add("tabulator-block-select"),window.getSelection?window.getSelection().empty?window.getSelection().empty():window.getSelection().removeAllRanges&&window.getSelection().removeAllRanges():document.selection&&document.selection.empty(),this.element.classList.remove("tabulator-block-select")},h.prototype._create=function(){this._clearObjectPointers(),this._mapDepricatedFunctionality(),this.bindModules(),this.rtlCheck(),"TABLE"===this.element.tagName&&this.modExists("htmlTableImport",!0)&&this.modules.htmlTableImport.parseTable(),this.columnManager=new t(this),this.rowManager=new s(this),this.footerManager=new d(this),this.columnManager.setRowManager(this.rowManager),this.rowManager.setColumnManager(this.columnManager),this.options.virtualDomHoz&&(this.vdomHoz=new a(this)),this._buildElement(),this._loadInitialData()},h.prototype._clearObjectPointers=function(){this.options.columns=this.options.columns.slice(0),this.options.reactiveData||(this.options.data=this.options.data.slice(0))},h.prototype._buildElement=function(){var e=this,t=this.element,o=this.modules,i=this.options;for(i.tableBuilding.call(this),t.classList.add("tabulator"),t.setAttribute("role","grid");t.firstChild;)t.removeChild(t.firstChild);i.height&&(i.height=isNaN(i.height)?i.height:i.height+"px",t.style.height=i.height),!1!==i.minHeight&&(i.minHeight=isNaN(i.minHeight)?i.minHeight:i.minHeight+"px",t.style.minHeight=i.minHeight),!1!==i.maxHeight&&(i.maxHeight=isNaN(i.maxHeight)?i.maxHeight:i.maxHeight+"px",t.style.maxHeight=i.maxHeight),this.columnManager.initialize(),this.rowManager.initialize(),this._detectBrowser(),this.modExists("layout",!0)&&o.layout.initialize(i.layout),o.localize.initialize(),!1!==i.headerFilterPlaceholder&&o.localize.setHeaderFilterPlaceholder(i.headerFilterPlaceholder);for(var n in i.langs)o.localize.installLang(n,i.langs[n]);if(o.localize.setLocale(i.locale),"string"==typeof i.placeholder){var s=document.createElement("div");s.classList.add("tabulator-placeholder");var a=document.createElement("span");a.innerHTML=i.placeholder,s.appendChild(a),i.placeholder=s}if(t.appendChild(this.columnManager.getElement()),t.appendChild(this.rowManager.getElement()),i.footerElement&&this.footerManager.activate(),i.persistence&&this.modExists("persistence",!0)&&o.persistence.initialize(),i.persistence&&this.modExists("persistence",!0)&&o.persistence.config.columns&&(i.columns=o.persistence.load("columns",i.columns)),i.movableRows&&this.modExists("moveRow")&&o.moveRow.initialize(),i.autoColumns&&this.options.data&&this.columnManager.generateColumnsFromRowData(this.options.data),this.modExists("columnCalcs")&&o.columnCalcs.initialize(),this.columnManager.setColumns(i.columns),i.dataTree&&this.modExists("dataTree",!0)&&o.dataTree.initialize(),this.modExists("frozenRows")&&this.modules.frozenRows.initialize(),(i.persistence&&this.modExists("persistence",!0)&&o.persistence.config.sort||i.initialSort)&&this.modExists("sort",!0)){var r=[];i.persistence&&this.modExists("persistence",!0)&&o.persistence.config.sort?!1===(r=o.persistence.load("sort"))&&i.initialSort&&(r=i.initialSort):i.initialSort&&(r=i.initialSort),o.sort.setSort(r)}if((i.persistence&&this.modExists("persistence",!0)&&o.persistence.config.filter||i.initialFilter)&&this.modExists("filter",!0)){var l=[];i.persistence&&this.modExists("persistence",!0)&&o.persistence.config.filter?!1===(l=o.persistence.load("filter"))&&i.initialFilter&&(l=i.initialFilter):i.initialFilter&&(l=i.initialFilter),o.filter.setFilter(l)}i.initialHeaderFilter&&this.modExists("filter",!0)&&i.initialHeaderFilter.forEach(function(t){var i=e.columnManager.findColumn(t.field);if(!i)return console.warn("Column Filter Error - No matching column found:",t.field),!1;o.filter.setHeaderFilterValue(i,t.value)}),this.modExists("ajax")&&o.ajax.initialize(),i.pagination&&this.modExists("page",!0)&&o.page.initialize(),i.groupBy&&this.modExists("groupRows",!0)&&o.groupRows.initialize(),this.modExists("keybindings")&&o.keybindings.initialize(),this.modExists("selectRow")&&o.selectRow.clearSelectionData(!0),i.autoResize&&this.modExists("resizeTable")&&o.resizeTable.initialize(),this.modExists("clipboard")&&o.clipboard.initialize(),i.printAsHtml&&this.modExists("print")&&o.print.initialize(),i.tableBuilt.call(this)},h.prototype._loadInitialData=function(){var e=this;if(e.options.pagination&&e.modExists("page"))if(e.modules.page.reset(!0,!0),"local"==e.options.pagination){if(e.options.data.length)e.rowManager.setData(e.options.data,!1,!0);else{if((e.options.ajaxURL||e.options.ajaxURLGenerator)&&e.modExists("ajax"))return void e.modules.ajax.loadData(!1,!0).then(function(){}).catch(function(){e.options.paginationInitialPage&&e.modules.page.setPage(e.options.paginationInitialPage)});e.rowManager.setData(e.options.data,!1,!0)}e.options.paginationInitialPage&&e.modules.page.setPage(e.options.paginationInitialPage)}else e.options.ajaxURL?e.modules.page.setPage(e.options.paginationInitialPage).then(function(){}).catch(function(){}):e.rowManager.setData([],!1,!0);else e.options.data.length?e.rowManager.setData(e.options.data):(e.options.ajaxURL||e.options.ajaxURLGenerator)&&e.modExists("ajax")?e.modules.ajax.loadData(!1,!0).then(function(){}).catch(function(){}):e.rowManager.setData(e.options.data,!1,!0)},h.prototype.destroy=function(){var e=this.element;for(h.prototype.comms.deregister(this),this.options.reactiveData&&this.modExists("reactiveData",!0)&&this.modules.reactiveData.unwatchData(),this.rowManager.rows.forEach(function(e){e.wipe()}),this.rowManager.rows=[],this.rowManager.activeRows=[],this.rowManager.displayRows=[],this.options.autoResize&&this.modExists("resizeTable")&&this.modules.resizeTable.clearBindings(),this.modExists("keybindings")&&this.modules.keybindings.clearBindings();e.firstChild;)e.removeChild(e.firstChild);e.classList.remove("tabulator")},h.prototype._detectBrowser=function(){var e=navigator.userAgent||navigator.vendor||window.opera;e.indexOf("Trident")>-1?(this.browser="ie",this.browserSlow=!0):e.indexOf("Edge")>-1?(this.browser="edge",this.browserSlow=!0):e.indexOf("Firefox")>-1?(this.browser="firefox",this.browserSlow=!1):(this.browser="other",this.browserSlow=!1),this.browserMobile=/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino|android|ipad|playbook|silk/i.test(e)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(e.substr(0,4))},h.prototype.blockRedraw=function(){return this.rowManager.blockRedraw()},h.prototype.restoreRedraw=function(){return this.rowManager.restoreRedraw()},h.prototype.setDataFromLocalFile=function(e){var t=this;return new Promise(function(o,i){var n=document.createElement("input");n.type="file",n.accept=e||".json,application/json",n.addEventListener("change",function(e){var s,a=n.files[0],r=new FileReader;r.readAsText(a),r.onload=function(e){try{s=JSON.parse(r.result)}catch(e){return console.warn("File Load Error - File contents is invalid JSON",e),void i(e)}t.setData(s).then(function(e){o(e)}).catch(function(e){o(e)})},r.onerror=function(e){console.warn("File Load Error - Unable to read file"),i()}}),n.click()})},h.prototype.setData=function(e,t,o){return this.modExists("ajax")&&this.modules.ajax.blockActiveRequest(),this._setData(e,t,o,!1,!0)},h.prototype._setData=function(e,t,o,i,n){var s=this;return"string"!=typeof e?e?s.rowManager.setData(e,i,n):s.modExists("ajax")&&(s.modules.ajax.getUrl||s.options.ajaxURLGenerator)?"remote"==s.options.pagination&&s.modExists("page",!0)?(s.modules.page.reset(!0,!0),s.modules.page.setPage(1)):s.modules.ajax.loadData(i,n):s.rowManager.setData([],i,n):0==e.indexOf("{")||0==e.indexOf("[")?s.rowManager.setData(JSON.parse(e),i,n):s.modExists("ajax",!0)?(t&&s.modules.ajax.setParams(t),o&&s.modules.ajax.setConfig(o),s.modules.ajax.setUrl(e),"remote"==s.options.pagination&&s.modExists("page",!0)?(s.modules.page.reset(!0,!0),s.modules.page.setPage(1)):s.modules.ajax.loadData(i,n)):void 0},h.prototype.clearData=function(){this.modExists("ajax")&&this.modules.ajax.blockActiveRequest(),this.rowManager.clearData()},h.prototype.getData=function(e){return!0===e&&(console.warn("passing a boolean to the getData function is deprecated, you should now pass the string 'active'"),e="active"),this.rowManager.getData(e)},h.prototype.getDataCount=function(e){return!0===e&&(console.warn("passing a boolean to the getDataCount function is deprecated, you should now pass the string 'active'"),e="active"),this.rowManager.getDataCount(e)},h.prototype.searchRows=function(e,t,o){if(this.modExists("filter",!0))return this.modules.filter.search("rows",e,t,o)},h.prototype.searchData=function(e,t,o){if(this.modExists("filter",!0))return this.modules.filter.search("data",e,t,o)},h.prototype.getHtml=function(e,t,o){if(this.modExists("export",!0))return this.modules.export.getHtml(e,t,o)},h.prototype.print=function(e,t,o){if(this.modExists("print",!0))return this.modules.print.printFullscreen(e,t,o)},h.prototype.getAjaxUrl=function(){if(this.modExists("ajax",!0))return this.modules.ajax.getUrl()},h.prototype.replaceData=function(e,t,o){return this.modExists("ajax")&&this.modules.ajax.blockActiveRequest(),this._setData(e,t,o,!0)},h.prototype.updateData=function(e){var t=this,o=this,i=0;return new Promise(function(n,s){t.modExists("ajax")&&t.modules.ajax.blockActiveRequest(),"string"==typeof e&&(e=JSON.parse(e)),e?e.forEach(function(e){var t=o.rowManager.findRow(e[o.options.index]);t&&(i++,t.updateData(e).then(function(){--i||n()}))}):(console.warn("Update Error - No data provided"),s("Update Error - No data provided"))})},h.prototype.addData=function(e,t,o){var i=this;return new Promise(function(n,s){i.modExists("ajax")&&i.modules.ajax.blockActiveRequest(),"string"==typeof e&&(e=JSON.parse(e)),e?i.rowManager.addRows(e,t,o).then(function(e){var t=[];e.forEach(function(e){t.push(e.getComponent())}),n(t)}):(console.warn("Update Error - No data provided"),s("Update Error - No data provided"))})},h.prototype.updateOrAddData=function(e){var t=this,o=this,i=[],n=0;return new Promise(function(s,a){t.modExists("ajax")&&t.modules.ajax.blockActiveRequest(),"string"==typeof e&&(e=JSON.parse(e)),e?e.forEach(function(e){var t=o.rowManager.findRow(e[o.options.index]);n++,t?t.updateData(e).then(function(){n--,i.push(t.getComponent()),n||s(i)}):o.rowManager.addRows(e).then(function(e){n--,i.push(e[0].getComponent()),n||s(i)})}):(console.warn("Update Error - No data provided"),a("Update Error - No data provided"))})},h.prototype.getRow=function(e){var t=this.rowManager.findRow(e);return t?t.getComponent():(console.warn("Find Error - No matching row found:",e),!1)},h.prototype.getRowFromPosition=function(e,t){var o=this.rowManager.getRowFromPosition(e,t);return o?o.getComponent():(console.warn("Find Error - No matching row found:",e),!1)},h.prototype.deleteRow=function(e){var t=this;return new Promise(function(o,i){function n(){++a==e.length&&r&&(s.rowManager.reRenderInPosition(),o())}var s=t,a=0,r=0,l=[];Array.isArray(e)||(e=[e]),e.forEach(function(e){var o=t.rowManager.findRow(e,!0);o?l.push(o):(console.warn("Delete Error - No matching row found:",e),i("Delete Error - No matching row found"),n())}),l.sort(function(e,o){return t.rowManager.rows.indexOf(e)>t.rowManager.rows.indexOf(o)?1:-1}),l.forEach(function(e){e.delete().then(function(){r++,n()}).catch(function(e){n(),i(e)})})})},h.prototype.addRow=function(e,t,o){var i=this;return new Promise(function(n,s){"string"==typeof e&&(e=JSON.parse(e)),i.rowManager.addRows(e,t,o).then(function(e){i.modExists("columnCalcs")&&i.modules.columnCalcs.recalc(i.rowManager.activeRows),n(e[0].getComponent())})})},h.prototype.updateOrAddRow=function(e,t){var o=this;return new Promise(function(i,n){var s=o.rowManager.findRow(e);"string"==typeof t&&(t=JSON.parse(t)),s?s.updateData(t).then(function(){o.modExists("columnCalcs")&&o.modules.columnCalcs.recalc(o.rowManager.activeRows),i(s.getComponent())}).catch(function(e){n(e)}):s=o.rowManager.addRows(t).then(function(e){o.modExists("columnCalcs")&&o.modules.columnCalcs.recalc(o.rowManager.activeRows),i(e[0].getComponent())}).catch(function(e){n(e)})})},h.prototype.updateRow=function(e,t){var o=this;return new Promise(function(i,n){var s=o.rowManager.findRow(e);"string"==typeof t&&(t=JSON.parse(t)),s?s.updateData(t).then(function(){i(s.getComponent())}).catch(function(e){n(e)}):(console.warn("Update Error - No matching row found:",e),n("Update Error - No matching row found"))})},h.prototype.scrollToRow=function(e,t,o){var i=this;return new Promise(function(n,s){var a=i.rowManager.findRow(e);a?i.rowManager.scrollToRow(a,t,o).then(function(){n()}).catch(function(e){s(e)}):(console.warn("Scroll Error - No matching row found:",e),s("Scroll Error - No matching row found"))})},h.prototype.moveRow=function(e,t,o){var i=this.rowManager.findRow(e);i?i.moveToRow(t,o):console.warn("Move Error - No matching row found:",e)},h.prototype.getRows=function(e){return!0===e&&(console.warn("passing a boolean to the getRows function is deprecated, you should now pass the string 'active'"),e="active"),this.rowManager.getComponents(e)},h.prototype.getRowPosition=function(e,t){var o=this.rowManager.findRow(e);return o?this.rowManager.getRowPosition(o,t):(console.warn("Position Error - No matching row found:",e),!1)},h.prototype.copyToClipboard=function(e){this.modExists("clipboard",!0)&&this.modules.clipboard.copy(e)},h.prototype.setColumns=function(e){this.columnManager.setColumns(e)},h.prototype.getColumns=function(e){return this.columnManager.getComponents(e)},h.prototype.getColumn=function(e){var t=this.columnManager.findColumn(e);return t?t.getComponent():(console.warn("Find Error - No matching column found:",e),!1)},h.prototype.getColumnDefinitions=function(){return this.columnManager.getDefinitionTree()},h.prototype.getColumnLayout=function(){if(this.modExists("persistence",!0))return this.modules.persistence.parseColumns(this.columnManager.getColumns())},h.prototype.setColumnLayout=function(e){return!!this.modExists("persistence",!0)&&(this.columnManager.setColumns(this.modules.persistence.mergeDefinition(this.options.columns,e)),!0)},h.prototype.showColumn=function(e){var t=this.columnManager.findColumn(e);if(!t)return console.warn("Column Show Error - No matching column found:",e),!1;t.show(),this.options.responsiveLayout&&this.modExists("responsiveLayout",!0)&&this.modules.responsiveLayout.update()},h.prototype.hideColumn=function(e){var t=this.columnManager.findColumn(e);if(!t)return console.warn("Column Hide Error - No matching column found:",e),!1;t.hide(),this.options.responsiveLayout&&this.modExists("responsiveLayout",!0)&&this.modules.responsiveLayout.update()},h.prototype.toggleColumn=function(e){var t=this.columnManager.findColumn(e);if(!t)return console.warn("Column Visibility Toggle Error - No matching column found:",e),!1;t.visible?t.hide():t.show()},h.prototype.addColumn=function(e,t,o){var i=this;return new Promise(function(n,s){var a=i.columnManager.findColumn(o);i.columnManager.addColumn(e,t,a).then(function(e){n(e.getComponent())}).catch(function(e){s(e)})})},h.prototype.deleteColumn=function(e){var t=this;return new Promise(function(o,i){var n=t.columnManager.findColumn(e);n?n.delete().then(function(){o()}).catch(function(e){i(e)}):(console.warn("Column Delete Error - No matching column found:",e),i())})},h.prototype.updateColumnDefinition=function(e,t){var o=this;return new Promise(function(i,n){var s=o.columnManager.findColumn(e);s?s.updateDefinition(t).then(function(e){i(e)}).catch(function(e){n(e)}):(console.warn("Column Update Error - No matching column found:",e),n())})},h.prototype.moveColumn=function(e,t,o){var i=this.columnManager.findColumn(e),n=this.columnManager.findColumn(t);i?n?this.columnManager.moveColumn(i,n,o):console.warn("Move Error - No matching column found:",n):console.warn("Move Error - No matching column found:",e)},h.prototype.scrollToColumn=function(e,t,o){var i=this;return new Promise(function(n,s){var a=i.columnManager.findColumn(e);a?i.columnManager.scrollToColumn(a,t,o).then(function(){n()}).catch(function(e){s(e)}):(console.warn("Scroll Error - No matching column found:",e),s("Scroll Error - No matching column found"))})},h.prototype.setLocale=function(e){this.modules.localize.setLocale(e)},h.prototype.getLocale=function(){return this.modules.localize.getLocale()},h.prototype.getLang=function(e){return this.modules.localize.getLang(e)},h.prototype.redraw=function(e){this.columnManager.redraw(e),this.rowManager.redraw(e)},h.prototype.setHeight=function(e){"classic"!==this.rowManager.renderMode?(this.options.height=isNaN(e)?e:e+"px",this.element.style.height=this.options.height,this.rowManager.setRenderMode(),this.rowManager.redraw()):console.warn("setHeight function is not available in classic render mode")}, +h.prototype.setSort=function(e,t){this.modExists("sort",!0)&&(this.modules.sort.setSort(e,t),this.rowManager.sorterRefresh())},h.prototype.getSorters=function(){if(this.modExists("sort",!0))return this.modules.sort.getSort()},h.prototype.clearSort=function(){this.modExists("sort",!0)&&(this.modules.sort.clear(),this.rowManager.sorterRefresh())},h.prototype.setFilter=function(e,t,o,i){this.modExists("filter",!0)&&(this.modules.filter.setFilter(e,t,o,i),this.rowManager.filterRefresh())},h.prototype.addFilter=function(e,t,o,i){this.modExists("filter",!0)&&(this.modules.filter.addFilter(e,t,o,i),this.rowManager.filterRefresh())},h.prototype.getFilters=function(e){if(this.modExists("filter",!0))return this.modules.filter.getFilters(e)},h.prototype.setHeaderFilterFocus=function(e){if(this.modExists("filter",!0)){var t=this.columnManager.findColumn(e);if(!t)return console.warn("Column Filter Focus Error - No matching column found:",e),!1;this.modules.filter.setHeaderFilterFocus(t)}},h.prototype.getHeaderFilterValue=function(e){if(this.modExists("filter",!0)){var t=this.columnManager.findColumn(e);if(t)return this.modules.filter.getHeaderFilterValue(t);console.warn("Column Filter Error - No matching column found:",e)}},h.prototype.setHeaderFilterValue=function(e,t){if(this.modExists("filter",!0)){var o=this.columnManager.findColumn(e);if(!o)return console.warn("Column Filter Error - No matching column found:",e),!1;this.modules.filter.setHeaderFilterValue(o,t)}},h.prototype.getHeaderFilters=function(){if(this.modExists("filter",!0))return this.modules.filter.getHeaderFilters()},h.prototype.removeFilter=function(e,t,o){this.modExists("filter",!0)&&(this.modules.filter.removeFilter(e,t,o),this.rowManager.filterRefresh())},h.prototype.clearFilter=function(e){this.modExists("filter",!0)&&(this.modules.filter.clearFilter(e),this.rowManager.filterRefresh())},h.prototype.clearHeaderFilter=function(){this.modExists("filter",!0)&&(this.modules.filter.clearHeaderFilter(),this.rowManager.filterRefresh())},h.prototype.selectRow=function(e){this.modExists("selectRow",!0)&&(!0===e&&(console.warn("passing a boolean to the selectRowselectRow function is deprecated, you should now pass the string 'active'"),e="active"),this.modules.selectRow.selectRows(e))},h.prototype.deselectRow=function(e){this.modExists("selectRow",!0)&&this.modules.selectRow.deselectRows(e)},h.prototype.toggleSelectRow=function(e){this.modExists("selectRow",!0)&&this.modules.selectRow.toggleRow(e)},h.prototype.getSelectedRows=function(){if(this.modExists("selectRow",!0))return this.modules.selectRow.getSelectedRows()},h.prototype.getSelectedData=function(){if(this.modExists("selectRow",!0))return this.modules.selectRow.getSelectedData()},h.prototype.getInvalidCells=function(){if(this.modExists("validate",!0))return this.modules.validate.getInvalidCells()},h.prototype.clearCellValidation=function(e){var t=this;this.modExists("validate",!0)&&(e||(e=this.modules.validate.getInvalidCells()),Array.isArray(e)||(e=[e]),e.forEach(function(e){t.modules.validate.clearValidation(e._getSelf())}))},h.prototype.validate=function(e){var t=[];return this.rowManager.rows.forEach(function(e){var o=e.validate();!0!==o&&(t=t.concat(o))}),!t.length||t},h.prototype.setMaxPage=function(e){if(!this.options.pagination||!this.modExists("page"))return!1;this.modules.page.setMaxPage(e)},h.prototype.setPage=function(e){return this.options.pagination&&this.modExists("page")?this.modules.page.setPage(e):new Promise(function(e,t){t()})},h.prototype.setPageToRow=function(e){var t=this;return new Promise(function(o,i){t.options.pagination&&t.modExists("page")?(e=t.rowManager.findRow(e),e?t.modules.page.setPageToRow(e).then(function(){o()}).catch(function(){i()}):i()):i()})},h.prototype.setPageSize=function(e){if(!this.options.pagination||!this.modExists("page"))return!1;this.modules.page.setPageSize(e),this.modules.page.setPage(1).then(function(){}).catch(function(){})},h.prototype.getPageSize=function(){if(this.options.pagination&&this.modExists("page",!0))return this.modules.page.getPageSize()},h.prototype.previousPage=function(){if(!this.options.pagination||!this.modExists("page"))return!1;this.modules.page.previousPage()},h.prototype.nextPage=function(){if(!this.options.pagination||!this.modExists("page"))return!1;this.modules.page.nextPage()},h.prototype.getPage=function(){return!(!this.options.pagination||!this.modExists("page"))&&this.modules.page.getPage()},h.prototype.getPageMax=function(){return!(!this.options.pagination||!this.modExists("page"))&&this.modules.page.getPageMax()},h.prototype.setGroupBy=function(e){if(!this.modExists("groupRows",!0))return!1;this.options.groupBy=e,this.modules.groupRows.initialize(),this.rowManager.refreshActiveData("display"),this.options.persistence&&this.modExists("persistence",!0)&&this.modules.persistence.config.group&&this.modules.persistence.save("group")},h.prototype.setGroupValues=function(e){if(!this.modExists("groupRows",!0))return!1;this.options.groupValues=e,this.modules.groupRows.initialize(),this.rowManager.refreshActiveData("display"),this.options.persistence&&this.modExists("persistence",!0)&&this.modules.persistence.config.group&&this.modules.persistence.save("group")},h.prototype.setGroupStartOpen=function(e){if(!this.modExists("groupRows",!0))return!1;this.options.groupStartOpen=e,this.modules.groupRows.initialize(),this.options.groupBy?(this.rowManager.refreshActiveData("group"),this.options.persistence&&this.modExists("persistence",!0)&&this.modules.persistence.config.group&&this.modules.persistence.save("group")):console.warn("Grouping Update - cant refresh view, no groups have been set")},h.prototype.setGroupHeader=function(e){if(!this.modExists("groupRows",!0))return!1;this.options.groupHeader=e,this.modules.groupRows.initialize(),this.options.groupBy?(this.rowManager.refreshActiveData("group"),this.options.persistence&&this.modExists("persistence",!0)&&this.modules.persistence.config.group&&this.modules.persistence.save("group")):console.warn("Grouping Update - cant refresh view, no groups have been set")},h.prototype.getGroups=function(e){return!!this.modExists("groupRows",!0)&&this.modules.groupRows.getGroups(!0)},h.prototype.getGroupedData=function(){if(this.modExists("groupRows",!0))return this.options.groupBy?this.modules.groupRows.getGroupedData():this.getData()},h.prototype.getEditedCells=function(){if(this.modExists("edit",!0))return this.modules.edit.getEditedCells()},h.prototype.clearCellEdited=function(e){var t=this;this.modExists("edit",!0)&&(e||(e=this.modules.edit.getEditedCells()),Array.isArray(e)||(e=[e]),e.forEach(function(e){t.modules.edit.clearEdited(e._getSelf())}))},h.prototype.getCalcResults=function(){return!!this.modExists("columnCalcs",!0)&&this.modules.columnCalcs.getResults()},h.prototype.recalc=function(){this.modExists("columnCalcs",!0)&&this.modules.columnCalcs.recalcAll(this.rowManager.activeRows)},h.prototype.navigatePrev=function(){var e=!1;return!(!this.modExists("edit",!0)||!(e=this.modules.edit.currentCell))&&e.nav().prev()},h.prototype.navigateNext=function(){var e=!1;return!(!this.modExists("edit",!0)||!(e=this.modules.edit.currentCell))&&e.nav().next()},h.prototype.navigateLeft=function(){var t=!1;return!(!this.modExists("edit",!0)||!(t=this.modules.edit.currentCell))&&(e.preventDefault(),t.nav().left())},h.prototype.navigateRight=function(){var t=!1;return!(!this.modExists("edit",!0)||!(t=this.modules.edit.currentCell))&&(e.preventDefault(),t.nav().right())},h.prototype.navigateUp=function(){var t=!1;return!(!this.modExists("edit",!0)||!(t=this.modules.edit.currentCell))&&(e.preventDefault(),t.nav().up())},h.prototype.navigateDown=function(){var t=!1;return!(!this.modExists("edit",!0)||!(t=this.modules.edit.currentCell))&&(e.preventDefault(),t.nav().down())},h.prototype.undo=function(){return!(!this.options.history||!this.modExists("history",!0))&&this.modules.history.undo()},h.prototype.redo=function(){return!(!this.options.history||!this.modExists("history",!0))&&this.modules.history.redo()},h.prototype.getHistoryUndoSize=function(){return!(!this.options.history||!this.modExists("history",!0))&&this.modules.history.getHistoryUndoSize()},h.prototype.getHistoryRedoSize=function(){return!(!this.options.history||!this.modExists("history",!0))&&this.modules.history.getHistoryRedoSize()},h.prototype.download=function(e,t,o,i){this.modExists("download",!0)&&this.modules.download.download(e,t,o,i)},h.prototype.downloadToTab=function(e,t,o,i){this.modExists("download",!0)&&this.modules.download.download(e,t,o,i,!0)},h.prototype.tableComms=function(e,t,o,i){this.modules.comms.receive(e,t,o,i)},h.prototype.moduleBindings={},h.prototype.extendModule=function(e,t,o){if(h.prototype.moduleBindings[e]){var i=h.prototype.moduleBindings[e].prototype[t];if(i)if("object"==(void 0===o?"undefined":_typeof(o)))for(var n in o)i[n]=o[n];else console.warn("Module Error - Invalid value type, it must be an object");else console.warn("Module Error - property does not exist:",t)}else console.warn("Module Error - module does not exist:",e)},h.prototype.registerModule=function(e,t){h.prototype.moduleBindings[e]=t},h.prototype.bindModules=function(){this.modules={};for(var e in h.prototype.moduleBindings)this.modules[e]=new h.prototype.moduleBindings[e](this)},h.prototype.modExists=function(e,t){return!!this.modules[e]||(t&&console.error("Tabulator Module Not Installed: "+e),!1)},h.prototype.helpers={elVisible:function(e){return!(e.offsetWidth<=0&&e.offsetHeight<=0)},elOffset:function(e){var t=e.getBoundingClientRect();return{top:t.top+window.pageYOffset-document.documentElement.clientTop,left:t.left+window.pageXOffset-document.documentElement.clientLeft}},deepClone:function(e){var t=Object.assign(Array.isArray(e)?[]:{},e);for(var o in e)null!=e[o]&&"object"===_typeof(e[o])&&(e[o]instanceof Date?t[o]=new Date(e[o]):t[o]=this.deepClone(e[o]));return t}},h.prototype.comms={tables:[],register:function(e){h.prototype.comms.tables.push(e)},deregister:function(e){var t=h.prototype.comms.tables.indexOf(e);t>-1&&h.prototype.comms.tables.splice(t,1)},lookupTable:function(e,t){var o,i,n=[];if("string"==typeof e){if(o=document.querySelectorAll(e),o.length)for(var s=0;s0?s.setWidth(n):s.reinitializeWidth()):this.table.options.responsiveLayout&&this.table.modExists("responsiveLayout",!0)&&this.table.modules.responsiveLayout.update()},fitColumns:function(e){function t(e){return"string"==typeof e?e.indexOf("%")>-1?n/100*parseInt(e):parseInt(e):e}function o(e,i,n,s){function a(e){return n*(e.column.definition.widthGrow||1)}function r(e){return t(e.width)-n*(e.column.definition.widthShrink||0)}var l=[],c=0,u=0,d=0,h=0,p=0,m=[];return e.forEach(function(e,t){var o=s?r(e):a(e);e.column.minWidth>=o?l.push(e):(m.push(e),p+=s?e.column.definition.widthShrink||1:e.column.definition.widthGrow||1)}),l.length?(l.forEach(function(e){c+=s?e.width-e.column.minWidth:e.column.minWidth,e.width=e.column.minWidth}),u=i-c,d=p?Math.floor(u/p):u,h=u-d*p,h+=o(m,u,d,s)):(h=p?i-Math.floor(i/p)*p:i,m.forEach(function(e){e.width=s?r(e):a(e)})),h}var i=this,n=i.table.element.clientWidth,s=0,a=0,r=0,l=0,c=[],u=[],d=0,h=0,p=0;this.table.options.responsiveLayout&&this.table.modExists("responsiveLayout",!0)&&this.table.modules.responsiveLayout.update(),this.table.rowManager.element.scrollHeight>this.table.rowManager.element.clientHeight&&(n-=this.table.rowManager.element.offsetWidth-this.table.rowManager.element.clientWidth),e.forEach(function(e){var o,i,n;e.visible&&(o=e.definition.width,i=parseInt(e.minWidth),o?(n=t(o),s+=n>i?n:i,e.definition.widthShrink&&(u.push({column:e,width:n>i?n:i}),d+=e.definition.widthShrink)):(c.push({column:e,width:0}),r+=e.definition.widthGrow||1))}),a=n-s,l=Math.floor(a/r);var p=o(c,a,l,!1);c.length&&p>0&&(c[c.length-1].width+=+p),c.forEach(function(e){a-=e.width}),h=Math.abs(p)+a,h>0&&d&&(p=o(u,h,Math.floor(h/d),!0)),u.length&&(u[u.length-1].width-=p),c.forEach(function(e){e.column.setWidth(e.width)}),u.forEach(function(e){e.column.setWidth(e.width)})}},h.prototype.registerModule("layout",p);var m=function(e){this.table=e,this.locale="default",this.lang=!1,this.bindings={},this.langList={}};m.prototype.initialize=function(){this.langList=h.prototype.helpers.deepClone(this.langs)},m.prototype.setHeaderFilterPlaceholder=function(e){this.langList.default.headerFilters.default=e},m.prototype.setHeaderFilterColumnPlaceholder=function(e,t){this.langList.default.headerFilters.columns[e]=t,this.lang&&!this.lang.headerFilters.columns[e]&&(this.lang.headerFilters.columns[e]=t)},m.prototype.installLang=function(e,t){this.langList[e]?this._setLangProp(this.langList[e],t):this.langList[e]=t},m.prototype._setLangProp=function(e,t){for(var o in t)e[o]&&"object"==_typeof(e[o])?this._setLangProp(e[o],t[o]):e[o]=t[o]},m.prototype.setLocale=function(e){function t(e,o){for(var i in e)"object"==_typeof(e[i])?(o[i]||(o[i]={}),t(e[i],o[i])):o[i]=e[i]}var o=this;if(e=e||"default",!0===e&&navigator.language&&(e=navigator.language.toLowerCase()),e&&!o.langList[e]){var i=e.split("-")[0];o.langList[i]?(console.warn("Localization Error - Exact matching locale not found, using closest match: ",e,i),e=i):(console.warn("Localization Error - Matching locale not found, using default: ",e),e="default")}o.locale=e,o.lang=h.prototype.helpers.deepClone(o.langList.default||{}),"default"!=e&&t(o.langList[e],o.lang),o.table.options.localized.call(o.table,o.locale,o.lang),o._executeBindings()},m.prototype.getLocale=function(e){return self.locale},m.prototype.getLang=function(e){return e?this.langList[e]:this.lang},m.prototype.getText=function(e,t){var e=t?e+"|"+t:e,o=e.split("|");return this._getLangElement(o,this.locale)||""},m.prototype._getLangElement=function(e,t){var o=this,i=o.lang;return e.forEach(function(e){var t;i&&(t=i[e],i=void 0!==t&&t)}),i},m.prototype.bind=function(e,t){this.bindings[e]||(this.bindings[e]=[]),this.bindings[e].push(t),t(this.getText(e),this.lang)},m.prototype._executeBindings=function(){var e=this;for(var t in e.bindings)!function(t){e.bindings[t].forEach(function(o){o(e.getText(t),e.lang)})}(t)},m.prototype.langs={default:{groups:{item:"item",items:"items"},columns:{},ajax:{loading:"Loading",error:"Error"},pagination:{page_size:"Page Size",page_title:"Show Page",first:"First",first_title:"First Page",last:"Last",last_title:"Last Page",prev:"Prev",prev_title:"Prev Page",next:"Next",next_title:"Next Page",all:"All"},headerFilters:{default:"filter column...",columns:{}}}},h.prototype.registerModule("localize",m);var f=function(e){this.table=e};f.prototype.getConnections=function(e){var t,o=this,i=[];return t=h.prototype.comms.lookupTable(e),t.forEach(function(e){o.table!==e&&i.push(e)}),i},f.prototype.send=function(e,t,o,i){var n=this,s=this.getConnections(e);s.forEach(function(e){e.tableComms(n.table.element,t,o,i)}),!s.length&&e&&console.warn("Table Connection Error - No tables matching selector found",e)},f.prototype.receive=function(e,t,o,i){if(this.table.modExists(t))return this.table.modules[t].commsReceived(e,o,i);console.warn("Inter-table Comms Error - no such module:",t)},h.prototype.registerModule("comms",f);var g=function(e){this.table=e,this.allowedTypes=["","data","download","clipboard","print","htmlOutput"]};g.prototype.initializeColumn=function(e){var t=this,o=!1,i={};this.allowedTypes.forEach(function(n){var s,a="accessor"+(n.charAt(0).toUpperCase()+n.slice(1));e.definition[a]&&(s=t.lookupAccessor(e.definition[a]))&&(o=!0,i[a]={accessor:s,params:e.definition[a+"Params"]||{}})}),o&&(e.modules.accessor=i)},g.prototype.lookupAccessor=function(e){var t=!1;switch(void 0===e?"undefined":_typeof(e)){case"string":this.accessors[e]?t=this.accessors[e]:console.warn("Accessor Error - No such accessor found, ignoring: ",e);break;case"function":t=e}return t},g.prototype.transformRow=function(e,t){var o="accessor"+(t.charAt(0).toUpperCase()+t.slice(1)),i=e.getComponent(),n=h.prototype.helpers.deepClone(e.data||{});return this.table.columnManager.traverse(function(e){var s,a,r,l;e.modules.accessor&&(a=e.modules.accessor[o]||e.modules.accessor.accessor||!1)&&"undefined"!=(s=e.getFieldValue(n))&&(l=e.getComponent(),r="function"==typeof a.params?a.params(s,n,t,l,i):a.params,e.setFieldValue(n,a.accessor(s,n,t,r,l,i)))}),n},g.prototype.accessors={},h.prototype.registerModule("accessor",g);var b=function(e){this.table=e,this.config=!1,this.url="",this.urlGenerator=!1,this.params=!1,this.loaderElement=this.createLoaderElement(),this.msgElement=this.createMsgElement(),this.loadingElement=!1,this.errorElement=!1,this.loaderPromise=!1,this.progressiveLoad=!1,this.loading=!1,this.requestOrder=0};b.prototype.initialize=function(){var e;this.loaderElement.appendChild(this.msgElement),this.table.options.ajaxLoaderLoading&&("string"==typeof this.table.options.ajaxLoaderLoading?(e=document.createElement("template"),e.innerHTML=this.table.options.ajaxLoaderLoading.trim(),this.loadingElement=e.content.firstChild):this.loadingElement=this.table.options.ajaxLoaderLoading),this.loaderPromise=this.table.options.ajaxRequestFunc||this.defaultLoaderPromise,this.urlGenerator=this.table.options.ajaxURLGenerator||this.defaultURLGenerator,this.table.options.ajaxLoaderError&&("string"==typeof this.table.options.ajaxLoaderError?(e=document.createElement("template"),e.innerHTML=this.table.options.ajaxLoaderError.trim(),this.errorElement=e.content.firstChild):this.errorElement=this.table.options.ajaxLoaderError),this.table.options.ajaxParams&&this.setParams(this.table.options.ajaxParams),this.table.options.ajaxConfig&&this.setConfig(this.table.options.ajaxConfig),this.table.options.ajaxURL&&this.setUrl(this.table.options.ajaxURL),this.table.options.ajaxProgressiveLoad&&(this.table.options.pagination?(this.progressiveLoad=!1,console.error("Progressive Load Error - Pagination and progressive load cannot be used at the same time")):this.table.modExists("page")?(this.progressiveLoad=this.table.options.ajaxProgressiveLoad,this.table.modules.page.initializeProgressive(this.progressiveLoad)):console.error("Pagination plugin is required for progressive ajax loading"))},b.prototype.createLoaderElement=function(){var e=document.createElement("div");return e.classList.add("tabulator-loader"),e},b.prototype.createMsgElement=function(){var e=document.createElement("div");return e.classList.add("tabulator-loader-msg"),e.setAttribute("role","alert"),e},b.prototype.setParams=function(e,t){if(t){this.params=this.params||{};for(var o in e)this.params[o]=e[o]}else this.params=e},b.prototype.getParams=function(){return this.params||{}},b.prototype.setConfig=function(e){if(this._loadDefaultConfig(),"string"==typeof e)this.config.method=e;else for(var t in e)this.config[t]=e[t]},b.prototype._loadDefaultConfig=function(e){var t=this;if(!t.config||e){t.config={};for(var o in t.defaultConfig)t.config[o]=t.defaultConfig[o]}},b.prototype.setUrl=function(e){this.url=e},b.prototype.getUrl=function(){return this.url},b.prototype.loadData=function(e,t){return this.progressiveLoad?this._loadDataProgressive():this._loadDataStandard(e,t)},b.prototype.nextPage=function(e){var t;this.loading||(t=this.table.options.ajaxProgressiveLoadScrollMargin||2*this.table.rowManager.getElement().clientHeight,ei||null===i)&&(i=e)}),null!==i?!1!==n?i.toFixed(n):i:""},min:function(e,t,o){var i=null,n=void 0!==o.precision&&o.precision;return e.forEach(function(e){((e=Number(e))"),o.dataTreeExpandElement?"string"==typeof o.dataTreeExpandElement?(e=document.createElement("div"),e.innerHTML=o.dataTreeExpandElement,this.expandEl=e.firstChild):this.expandEl=o.dataTreeExpandElement:(this.expandEl=document.createElement("div"),this.expandEl.classList.add("tabulator-data-tree-control"),this.expandEl.tabIndex=0,this.expandEl.innerHTML="
"),_typeof(o.dataTreeStartExpanded)){case"boolean":this.startOpen=function(e,t){return o.dataTreeStartExpanded};break;case"function":this.startOpen=o.dataTreeStartExpanded;break;default:this.startOpen=function(e,t){return o.dataTreeStartExpanded[t]}}},E.prototype.initializeRow=function(e){var t=e.getData()[this.field],o=Array.isArray(t),i=o||!o&&"object"===(void 0===t?"undefined":_typeof(t))&&null!==t;!i&&e.modules.dataTree&&e.modules.dataTree.branchEl&&e.modules.dataTree.branchEl.parentNode.removeChild(e.modules.dataTree.branchEl),!i&&e.modules.dataTree&&e.modules.dataTree.controlEl&&e.modules.dataTree.controlEl.parentNode.removeChild(e.modules.dataTree.controlEl),e.modules.dataTree={index:e.modules.dataTree?e.modules.dataTree.index:0,open:!!i&&(e.modules.dataTree?e.modules.dataTree.open:this.startOpen(e.getComponent(),0)),controlEl:!(!e.modules.dataTree||!i)&&e.modules.dataTree.controlEl,branchEl:!(!e.modules.dataTree||!i)&&e.modules.dataTree.branchEl,parent:!!e.modules.dataTree&&e.modules.dataTree.parent,children:i}},E.prototype.layoutRow=function(e){var t=this.elementField?e.getCell(this.elementField):e.getCells()[0],o=t.getElement(),i=e.modules.dataTree;i.branchEl&&(i.branchEl.parentNode&&i.branchEl.parentNode.removeChild(i.branchEl),i.branchEl=!1),i.controlEl&&(i.controlEl.parentNode&&i.controlEl.parentNode.removeChild(i.controlEl),i.controlEl=!1),this.generateControlElement(e,o),e.element.classList.add("tabulator-tree-level-"+i.index),i.index&&(this.branchEl?(i.branchEl=this.branchEl.cloneNode(!0),o.insertBefore(i.branchEl,o.firstChild),this.table.rtl?i.branchEl.style.marginRight=(i.branchEl.offsetWidth+i.branchEl.style.marginLeft)*(i.index-1)+i.index*this.indent+"px":i.branchEl.style.marginLeft=(i.branchEl.offsetWidth+i.branchEl.style.marginRight)*(i.index-1)+i.index*this.indent+"px"):this.table.rtl?o.style.paddingRight=parseInt(window.getComputedStyle(o,null).getPropertyValue("padding-right"))+i.index*this.indent+"px":o.style.paddingLeft=parseInt(window.getComputedStyle(o,null).getPropertyValue("padding-left"))+i.index*this.indent+"px")},E.prototype.generateControlElement=function(e,t){var o=this,i=e.modules.dataTree,t=t||e.getCells()[0].getElement(),n=i.controlEl;!1!==i.children&&(i.open?(i.controlEl=this.collapseEl.cloneNode(!0),i.controlEl.addEventListener("click",function(t){t.stopPropagation(),o.collapseRow(e)})):(i.controlEl=this.expandEl.cloneNode(!0),i.controlEl.addEventListener("click",function(t){t.stopPropagation(),o.expandRow(e)})),i.controlEl.addEventListener("mousedown",function(e){e.stopPropagation()}),n&&n.parentNode===t?n.parentNode.replaceChild(i.controlEl,n):t.insertBefore(i.controlEl,t.firstChild))},E.prototype.setDisplayIndex=function(e){this.displayIndex=e},E.prototype.getDisplayIndex=function(){return this.displayIndex},E.prototype.getRows=function(e){var t=this,o=[];return e.forEach(function(e,i){var n,s;o.push(e),e instanceof l&&(n=e.modules.dataTree.children,n.index||!1===n.children||(s=t.getChildren(e),s.forEach(function(e){o.push(e)})))}),o},E.prototype.getChildren=function(e){var t=this,o=e.modules.dataTree,i=[],n=[];return!1!==o.children&&o.open&&(Array.isArray(o.children)||(o.children=this.generateChildren(e)),i=this.table.modExists("filter")&&this.table.options.dataTreeFilter?this.table.modules.filter.filter(o.children):o.children,this.table.modExists("sort")&&this.table.options.dataTreeSort&&this.table.modules.sort.sort(i),i.forEach(function(e){n.push(e),t.getChildren(e).forEach(function(e){n.push(e)})})),n},E.prototype.generateChildren=function(e){var t=this,o=[],i=e.getData()[this.field];return Array.isArray(i)||(i=[i]),i.forEach(function(i){var n=new l(i||{},t.table.rowManager);n.modules.dataTree.index=e.modules.dataTree.index+1,n.modules.dataTree.parent=e,n.modules.dataTree.children&&(n.modules.dataTree.open=t.startOpen(n.getComponent(),n.modules.dataTree.index)),o.push(n)}),o},E.prototype.expandRow=function(e,t){var o=e.modules.dataTree;!1!==o.children&&(o.open=!0,e.reinitialize(),this.table.rowManager.refreshActiveData("tree",!1,!0),this.table.options.dataTreeRowExpanded(e.getComponent(),e.modules.dataTree.index))},E.prototype.collapseRow=function(e){var t=e.modules.dataTree;!1!==t.children&&(t.open=!1,e.reinitialize(),this.table.rowManager.refreshActiveData("tree",!1,!0),this.table.options.dataTreeRowCollapsed(e.getComponent(),e.modules.dataTree.index))},E.prototype.toggleRow=function(e){var t=e.modules.dataTree;!1!==t.children&&(t.open?this.collapseRow(e):this.expandRow(e))},E.prototype.getTreeParent=function(e){return!!e.modules.dataTree.parent&&e.modules.dataTree.parent.getComponent()},E.prototype.getFilteredTreeChildren=function(e){var t,o=e.modules.dataTree,i=[];return o.children&&(Array.isArray(o.children)||(o.children=this.generateChildren(e)),t=this.table.modExists("filter")&&this.table.options.dataTreeFilter?this.table.modules.filter.filter(o.children):o.children,t.forEach(function(e){e instanceof l&&i.push(e)})),i},E.prototype.rowDelete=function(e){var t,o=e.modules.dataTree.parent;o&&(t=this.findChildIndex(e,o),!1!==t&&o.data[this.field].splice(t,1),o.data[this.field].length||delete o.data[this.field],this.initializeRow(o),this.layoutRow(o)),this.table.rowManager.refreshActiveData("tree",!1,!0)},E.prototype.addTreeChildRow=function(e,t,o,i){var n=!1;"string"==typeof t&&(t=JSON.parse(t)),Array.isArray(e.data[this.field])||(e.data[this.field]=[],e.modules.dataTree.open=this.startOpen(e.getComponent(),e.modules.dataTree.index)),void 0!==i&&!1!==(n=this.findChildIndex(i,e))&&e.data[this.field].splice(o?n:n+1,0,t),!1===n&&(o?e.data[this.field].unshift(t):e.data[this.field].push(t)),this.initializeRow(e),this.layoutRow(e),this.table.rowManager.refreshActiveData("tree",!1,!0)},E.prototype.findChildIndex=function(e,t){var o=this,i=!1;return"object"==(void 0===e?"undefined":_typeof(e))?e instanceof l?i=e.data:e instanceof r?i=e._getSelf().data:"undefined"!=typeof HTMLElement&&e instanceof HTMLElement&&t.modules.dataTree&&(i=t.modules.dataTree.children.find(function(t){return t instanceof l&&t.element===e}))&&(i=i.data):i=void 0!==e&&null!==e&&t.data[this.field].find(function(t){return t.data[o.table.options.index]==e}),i&&(Array.isArray(t.data[this.field])&&(i=t.data[this.field].indexOf(i)),-1==i&&(i=!1)),i},E.prototype.getTreeChildren=function(e,t,o){var i=this,n=e.modules.dataTree,s=[];return n.children&&(Array.isArray(n.children)||(n.children=this.generateChildren(e)),n.children.forEach(function(e){e instanceof l&&(s.push(t?e.getComponent():e),o&&(s=s.concat(i.getTreeChildren(e,t,o))))})),s},E.prototype.checkForRestyle=function(e){e.row.cells.indexOf(e)||e.row.reinitialize()},E.prototype.getChildField=function(){return this.field},E.prototype.redrawNeeded=function(e){return!!this.field&&void 0!==e[this.field]||!!this.elementField&&void 0!==e[this.elementField]},h.prototype.registerModule("dataTree",E);var C=function(e){this.table=e};C.prototype.download=function(e,t,o,i,n){function s(o,i){n?!0===n?a.triggerDownload(o,i,e,t,!0):n(o):a.triggerDownload(o,i,e,t)}var a=this,r=!1;if("function"==typeof e?r=e:a.downloaders[e]?r=a.downloaders[e]:console.warn("Download Error - No such download type found: ",e),r){var l=this.generateExportList(i);r.call(this.table,l,o||{},s)}},C.prototype.generateExportList=function(e){var t=this.table.modules.export.generateExportList(this.table.options.downloadConfig,!1,e||this.table.options.downloadRowRange,"download"),o=this.table.options.groupHeaderDownload;return o&&!Array.isArray(o)&&(o=[o]),t.forEach(function(e){var t;"group"===e.type&&(t=e.columns[0],o&&o[e.indent]&&(t.value=o[e.indent](t.value,e.component._group.getRowCount(),e.component._group.getData(),e.component)))}),t},C.prototype.triggerDownload=function(e,t,o,i,n){var s=document.createElement("a"),a=new Blob([e],{type:t}),i=i||"Tabulator."+("function"==typeof o?"txt":o);(a=this.table.options.downloadReady.call(this.table,e,a))&&(n?window.open(window.URL.createObjectURL(a)):navigator.msSaveOrOpenBlob?navigator.msSaveOrOpenBlob(a,i):(s.setAttribute("href",window.URL.createObjectURL(a)),s.setAttribute("download",i),s.style.display="none",document.body.appendChild(s),s.click(),document.body.removeChild(s)),this.table.options.downloadComplete&&this.table.options.downloadComplete())},C.prototype.commsReceived=function(e,t,o){switch(t){case"intercept":this.download(o.type,"",o.options,o.active,o.intercept)}},C.prototype.downloaders={csv:function(e,t,o){var i=t&&t.delimiter?t.delimiter:",",n=[],s=[];e.forEach(function(e){var t=[];switch(e.type){case"group":console.warn("Download Warning - CSV downloader cannot process row groups");break;case"calc":console.warn("Download Warning - CSV downloader cannot process column calculations");break;case"header":e.columns.forEach(function(e,t){e&&1===e.depth&&(s[t]=void 0===e.value||null===e.value?"":'"'+String(e.value).split('"').join('""')+'"')});break;case"row":e.columns.forEach(function(e){if(e){switch(_typeof(e.value)){case"object":e.value=JSON.stringify(e.value);break;case"undefined":case"null":e.value=""}t.push('"'+String(e.value).split('"').join('""')+'"')}}),n.push(t.join(i))}}),s.length&&n.unshift(s.join(i)),n=n.join("\n"),t.bom&&(n="\ufeff"+n),o(n,"text/csv")},json:function(e,t,o){var i=[];e.forEach(function(e){var t={};switch(e.type){case"header":break;case"group":console.warn("Download Warning - JSON downloader cannot process row groups");break;case"calc":console.warn("Download Warning - JSON downloader cannot process column calculations");break;case"row":e.columns.forEach(function(e){e&&(t[e.component.getField()]=e.value)}),i.push(t)}}),i=JSON.stringify(i,null,"\t"),o(i,"application/json")},pdf:function(e,t,o){function i(e,t){var o=[];return e.columns.forEach(function(e){var i;if(e){switch(_typeof(e.value)){case"object":e.value=JSON.stringify(e.value);break;case"undefined":case"null":e.value=""}i={content:e.value,colSpan:e.width,rowSpan:e.height},t&&(i.styles=t),o.push(i)}else o.push("")}),o}var n=[],s=[],a={},r=t.rowGroupStyles||{fontStyle:"bold",fontSize:12,cellPadding:6,fillColor:220},l=t.rowCalcStyles||{fontStyle:"bold",fontSize:10,cellPadding:4,fillColor:232},c=t.jsPDF||{},u=t&&t.title?t.title:"";c.orientation||(c.orientation=t.orientation||"landscape"),c.unit||(c.unit="pt"),e.forEach(function(e){switch(e.type){case"header":n.push(i(e));break;case"group":s.push(i(e,r));break;case"calc":s.push(i(e,l));break;case"row":s.push(i(e))}});var d=new jsPDF(c);t&&t.autoTable&&(a="function"==typeof t.autoTable?t.autoTable(d)||{}:t.autoTable),u&&(a.addPageContent=function(e){d.text(u,40,30)}),a.head=n,a.body=s,d.autoTable(a),t&&t.documentProcessing&&t.documentProcessing(d),o(d.output("arraybuffer"),"application/pdf")},xlsx:function(e,t,o){function i(){var t=[],o=[],i={},n={s:{c:0,r:0},e:{c:e[0]?e[0].columns.reduce(function(e,t){return e+(t&&t.width?t.width:1)},0):0,r:e.length}};return e.forEach(function(e,i){var n=[];e.columns.forEach(function(e,t){e?(n.push(e.value instanceof Date||"object"!==_typeof(e.value)?e.value:JSON.stringify(e.value)),(e.width>1||e.height>-1)&&o.push({s:{r:i,c:t},e:{r:i+e.height-1,c:t+e.width-1}})):n.push("")}),t.push(n)}),XLSX.utils.sheet_add_aoa(i,t),i["!ref"]=XLSX.utils.encode_range(n),o.length&&(i["!merges"]=o),i}var n,s=this,a=t.sheetName||"Sheet1",r=XLSX.utils.book_new();if(r.SheetNames=[],r.Sheets={},t.sheetOnly)return void o(i());if(t.sheets)for(var l in t.sheets)!0===t.sheets[l]?(r.SheetNames.push(l),r.Sheets[l]=i()):(r.SheetNames.push(l),this.modules.comms.send(t.sheets[l],"download","intercept",{type:"xlsx",options:{sheetOnly:!0},active:s.active,intercept:function(e){r.Sheets[l]=e}}));else r.SheetNames.push(a),r.Sheets[a]=i();t.documentProcessing&&(r=t.documentProcessing(r)),n=XLSX.write(r,{bookType:"xlsx",bookSST:!0,type:"binary"}),o(function(e){for(var t=new ArrayBuffer(e.length),o=new Uint8Array(t),i=0;i!=e.length;++i)o[i]=255&e.charCodeAt(i);return t}(n),"application/octet-stream")},html:function(e,t,o){this.modExists("export",!0)&&o(this.modules.export.genereateHTMLTable(e),"text/html")}},h.prototype.registerModule("download",C);var R=function(e){this.table=e,this.currentCell=!1,this.mouseClick=!1,this.recursionBlock=!1,this.invalidEdit=!1,this.editedCells=[]};R.prototype.initializeColumn=function(e){var t=this,o={editor:!1,blocked:!1,check:e.definition.editable,params:e.definition.editorParams||{}};switch(_typeof(e.definition.editor)){case"string":"tick"===e.definition.editor&&(e.definition.editor="tickCross",console.warn("DEPRECATION WARNING - the tick editor has been deprecated, please use the tickCross editor")),t.editors[e.definition.editor]?o.editor=t.editors[e.definition.editor]:console.warn("Editor Error - No such editor found: ",e.definition.editor);break;case"function":o.editor=e.definition.editor;break;case"boolean":!0===e.definition.editor&&("function"!=typeof e.definition.formatter?("tick"===e.definition.formatter&&(e.definition.formatter="tickCross",console.warn("DEPRECATION WARNING - the tick editor has been deprecated, please use the tickCross editor")),t.editors[e.definition.formatter]?o.editor=t.editors[e.definition.formatter]:o.editor=t.editors.input):console.warn("Editor Error - Cannot auto lookup editor for a custom formatter: ",e.definition.formatter))}o.editor&&(e.modules.edit=o)},R.prototype.getCurrentCell=function(){return!!this.currentCell&&this.currentCell.getComponent()},R.prototype.clearEditor=function(e){var t,o=this.currentCell;if(this.invalidEdit=!1,o){for(this.currentCell=!1,t=o.getElement(),e?o.validate():t.classList.remove("tabulator-validation-fail"),t.classList.remove("tabulator-editing");t.firstChild;)t.removeChild(t.firstChild);o.row.getElement().classList.remove("tabulator-row-editing")}},R.prototype.cancelEdit=function(){if(this.currentCell){var e=this.currentCell,t=this.currentCell.getComponent();this.clearEditor(!0),e.setValueActual(e.getValue()),e.cellRendered(),("textarea"==e.column.definition.editor||e.column.definition.variableHeight)&&e.row.normalizeHeight(!0),e.column.cellEvents.cellEditCancelled&&e.column.cellEvents.cellEditCancelled.call(this.table,t),this.table.options.cellEditCancelled.call(this.table,t)}},R.prototype.bindEditor=function(e){var t=this,o=e.getElement();o.setAttribute("tabindex",0),o.addEventListener("click",function(e){o.classList.contains("tabulator-editing")||o.focus({preventScroll:!0})}),o.addEventListener("mousedown",function(e){2===e.button?e.preventDefault():t.mouseClick=!0}),o.addEventListener("focus",function(o){t.recursionBlock||t.edit(e,o,!1)})},R.prototype.focusCellNoEvent=function(e,t){this.recursionBlock=!0,t&&"ie"===this.table.browser||e.getElement().focus({preventScroll:!0}),this.recursionBlock=!1},R.prototype.editCell=function(e,t){this.focusCellNoEvent(e),this.edit(e,!1,t)},R.prototype.focusScrollAdjust=function(e){if("virtual"==this.table.rowManager.getRenderMode()){var t=this.table.rowManager.element.scrollTop,o=this.table.rowManager.element.clientHeight+this.table.rowManager.element.scrollTop,i=e.row.getElement();i.offsetTop;i.offsetTopo&&(this.table.rowManager.element.scrollTop+=i.offsetTop+i.offsetHeight-o);var n=this.table.rowManager.element.scrollLeft,s=this.table.rowManager.element.clientWidth+this.table.rowManager.element.scrollLeft,a=e.getElement();a.offsetLeft;this.table.modExists("frozenColumns")&&(n+=parseInt(this.table.modules.frozenColumns.leftMargin),s-=parseInt(this.table.modules.frozenColumns.rightMargin)),a.offsetLefts&&(this.table.rowManager.element.scrollLeft+=a.offsetLeft+a.offsetWidth-s)}},R.prototype.edit=function(e,t,o){function i(t){if(c.currentCell===e){var o=!0;return e.column.modules.validate&&c.table.modExists("validate")&&"manual"!=c.table.options.validationMode&&(o=c.table.modules.validate.validate(e.column.modules.validate,e,t)),!0===o||"highlight"===c.table.options.validationMode?(c.clearEditor(),e.modules.edit||(e.modules.edit={}),e.modules.edit.edited=!0,-1==c.editedCells.indexOf(e)&&c.editedCells.push(e),e.setValue(t,!0),c.table.options.dataTree&&c.table.modExists("dataTree")&&c.table.modules.dataTree.checkForRestyle(e),!0===o||(h.classList.add("tabulator-validation-fail"),c.table.options.validationFailed.call(c.table,e.getComponent(),t,o),!1)):(c.invalidEdit=!0,h.classList.add("tabulator-validation-fail"),c.focusCellNoEvent(e,!0),d(),c.table.options.validationFailed.call(c.table,e.getComponent(),t,o),!1)}}function n(){c.currentCell===e&&(c.cancelEdit(),c.table.options.dataTree&&c.table.modExists("dataTree")&&c.table.modules.dataTree.checkForRestyle(e))}function s(e){d=e}var a,r,l,c=this,u=!0,d=function(){},h=e.getElement();if(this.currentCell)return void(this.invalidEdit||this.cancelEdit());if(e.column.modules.edit.blocked)return this.mouseClick=!1,h.blur(),!1;switch(t&&t.stopPropagation(),_typeof(e.column.modules.edit.check)){case"function":u=e.column.modules.edit.check(e.getComponent());break;case"boolean":u=e.column.modules.edit.check}if(u||o){if(c.cancelEdit(),c.currentCell=e,this.focusScrollAdjust(e),r=e.getComponent(),this.mouseClick&&(this.mouseClick=!1,e.column.cellEvents.cellClick&&e.column.cellEvents.cellClick.call(this.table,t,r)),e.column.cellEvents.cellEditing&&e.column.cellEvents.cellEditing.call(this.table,r),c.table.options.cellEditing.call(this.table,r),l="function"==typeof e.column.modules.edit.params?e.column.modules.edit.params(r):e.column.modules.edit.params,!1===(a=e.column.modules.edit.editor.call(c,r,s,i,n,l)))return h.blur(),!1;if(!(a instanceof Node))return console.warn("Edit Error - Editor should return an instance of Node, the editor returned:",a),h.blur(),!1;for(h.classList.add("tabulator-editing"),e.row.getElement().classList.add("tabulator-row-editing");h.firstChild;)h.removeChild(h.firstChild);h.appendChild(a),d();for(var p=h.children,m=0;m46){if(o>=i.length)return t.preventDefault(),t.stopPropagation(),r=!1,!1;switch(i[o]){case n:if(l.toUpperCase()==l.toLowerCase())return t.preventDefault(),t.stopPropagation(),r=!1,!1;break;case s:if(isNaN(l))return t.preventDefault(),t.stopPropagation(),r=!1,!1;break;case a:break;default:if(l!==i[o])return t.preventDefault(),t.stopPropagation(),r=!1,!1}r=!0}}),e.addEventListener("keyup",function(i){i.keyCode>46&&t.maskAutoFill&&o(e.value.length)}),e.placeholder||(e.placeholder=i),t.maskAutoFill&&o(e.value.length)},R.prototype.getEditedCells=function(){var e=[];return this.editedCells.forEach(function(t){e.push(t.getComponent())}),e},R.prototype.clearEdited=function(e){var t;e.modules.edit&&e.modules.edit.edited&&(e.modules.edit.edited=!1,e.modules.validate&&(e.modules.validate.invalid=!1)),(t=this.editedCells.indexOf(e))>-1&&this.editedCells.splice(t,1)},R.prototype.editors={input:function(e,t,o,i,n){function s(e){(null===a||void 0===a)&&""!==r.value||r.value!==a?o(r.value)&&(a=r.value):i()}var a=e.getValue(),r=document.createElement("input");if(r.setAttribute("type",n.search?"search":"text"),r.style.padding="4px",r.style.width="100%",r.style.boxSizing="border-box",n.elementAttributes&&"object"==_typeof(n.elementAttributes))for(var l in n.elementAttributes)"+"==l.charAt(0)?(l=l.slice(1),r.setAttribute(l,r.getAttribute(l)+n.elementAttributes["+"+l])):r.setAttribute(l,n.elementAttributes[l]);return r.value=void 0!==a?a:"",t(function(){r.focus({preventScroll:!0}),r.style.height="100%"}),r.addEventListener("change",s),r.addEventListener("blur",s),r.addEventListener("keydown",function(e){switch(e.keyCode){case 13:s(e);break;case 27:i();break;case 35:case 36:e.stopPropagation()}}),n.mask&&this.table.modules.edit.maskInput(r,n),r},textarea:function(e,t,o,i,n){function s(t){(null===a||void 0===a)&&""!==c.value||c.value!==a?(o(c.value)&&(a=c.value),setTimeout(function(){e.getRow().normalizeHeight()},300)):i()}var a=e.getValue(),r=n.verticalNavigation||"hybrid",l=String(null!==a&&void 0!==a?a:""),c=(l.match(/(?:\r\n|\r|\n)/g),document.createElement("textarea")),u=0;if(c.style.display="block",c.style.padding="2px",c.style.height="100%",c.style.width="100%",c.style.boxSizing="border-box",c.style.whiteSpace="pre-wrap",c.style.resize="none",n.elementAttributes&&"object"==_typeof(n.elementAttributes))for(var d in n.elementAttributes)"+"==d.charAt(0)?(d=d.slice(1),c.setAttribute(d,c.getAttribute(d)+n.elementAttributes["+"+d])):c.setAttribute(d,n.elementAttributes[d]);return c.value=l,t(function(){c.focus({preventScroll:!0}),c.style.height="100%",c.scrollHeight,c.style.height=c.scrollHeight+"px",e.getRow().normalizeHeight()}),c.addEventListener("change",s),c.addEventListener("blur",s),c.addEventListener("keyup",function(){c.style.height="";var t=c.scrollHeight;c.style.height=t+"px",t!=u&&(u=t,e.getRow().normalizeHeight())}),c.addEventListener("keydown",function(e){switch(e.keyCode){case 27:i();break;case 38:("editor"==r||"hybrid"==r&&c.selectionStart)&&(e.stopImmediatePropagation(),e.stopPropagation());break;case 40:("editor"==r||"hybrid"==r&&c.selectionStart!==c.value.length)&&(e.stopImmediatePropagation(),e.stopPropagation());break;case 35:case 36:e.stopPropagation()}}),n.mask&&this.table.modules.edit.maskInput(c,n),c},number:function(e,t,o,i,n){function s(){var e=l.value;isNaN(e)||""===e||(e=Number(e)),e!==a?o(e)&&(a=e):i()}var a=e.getValue(),r=n.verticalNavigation||"editor",l=document.createElement("input");if(l.setAttribute("type","number"),void 0!==n.max&&l.setAttribute("max",n.max),void 0!==n.min&&l.setAttribute("min",n.min),void 0!==n.step&&l.setAttribute("step",n.step),l.style.padding="4px",l.style.width="100%",l.style.boxSizing="border-box",n.elementAttributes&&"object"==_typeof(n.elementAttributes))for(var c in n.elementAttributes)"+"==c.charAt(0)?(c=c.slice(1),l.setAttribute(c,l.getAttribute(c)+n.elementAttributes["+"+c])):l.setAttribute(c,n.elementAttributes[c]);l.value=a;var u=function(e){s()};return t(function(){l.removeEventListener("blur",u),l.focus({preventScroll:!0}),l.style.height="100%",l.addEventListener("blur",u)}),l.addEventListener("keydown",function(e){switch(e.keyCode){case 13:s();break;case 27:i();break;case 38:case 40:"editor"==r&&(e.stopImmediatePropagation(),e.stopPropagation());break;case 35:case 36:e.stopPropagation()}}),n.mask&&this.table.modules.edit.maskInput(l,n),l},range:function(e,t,o,i,n){function s(){var e=r.value;isNaN(e)||""===e||(e=Number(e)),e!=a?o(e)&&(a=e):i()}var a=e.getValue(),r=document.createElement("input");if(r.setAttribute("type","range"),void 0!==n.max&&r.setAttribute("max",n.max), +void 0!==n.min&&r.setAttribute("min",n.min),void 0!==n.step&&r.setAttribute("step",n.step),r.style.padding="4px",r.style.width="100%",r.style.boxSizing="border-box",n.elementAttributes&&"object"==_typeof(n.elementAttributes))for(var l in n.elementAttributes)"+"==l.charAt(0)?(l=l.slice(1),r.setAttribute(l,r.getAttribute(l)+n.elementAttributes["+"+l])):r.setAttribute(l,n.elementAttributes[l]);return r.value=a,t(function(){r.focus({preventScroll:!0}),r.style.height="100%"}),r.addEventListener("blur",function(e){s()}),r.addEventListener("keydown",function(e){switch(e.keyCode){case 13:s();break;case 27:i()}}),r},select:function(e,t,o,i,n){function s(t){var o,i={},s=C.table.getData();return o=t?C.table.columnManager.getColumnByField(t):e.getColumn()._getSelf(),o?(s.forEach(function(e){var t=o.getFieldValue(e);null!==t&&void 0!==t&&""!==t&&(i[t]=!0)}),i=n.sortValuesList?"asc"==n.sortValuesList?Object.keys(i).sort():Object.keys(i).sort().reverse():Object.keys(i)):console.warn("unable to find matching column to create select lookup list:",t),i}function a(t,o){function i(e){var e={label:e.label,value:e.value,itemParams:e.itemParams,elementAttributes:e.elementAttributes,element:!1};return o.indexOf(e.value)>-1&&c(e),n.push(e),s.push(e),e}var n=[],s=[];if("function"==typeof t&&(t=t(e)),Array.isArray(t))t.forEach(function(e){var t;"object"===(void 0===e?"undefined":_typeof(e))?e.options?(t={label:e.label,group:!0,itemParams:e.itemParams,elementAttributes:e.elementAttributes,element:!1},s.push(t),e.options.forEach(function(e){i(e)})):i(e):(t={label:e,value:e,element:!1},o.indexOf(t.value)>-1&&c(t),n.push(t),s.push(t))});else for(var a in t){var l={label:t[a],value:a,element:!1};o.indexOf(l.value)>-1&&c(l),n.push(l),s.push(l)}z=n,H=s,r()}function r(){for(;D.firstChild;)D.removeChild(D.firstChild);H.forEach(function(t){var o=t.element;if(!o){if(o=document.createElement("div"),t.label=n.listItemFormatter?n.listItemFormatter(t.value,t.label,e,o,t.itemParams):t.label,t.group?(o.classList.add("tabulator-edit-select-list-group"),o.tabIndex=0,o.innerHTML=""===t.label?" ":t.label):(o.classList.add("tabulator-edit-select-list-item"),o.tabIndex=0,o.innerHTML=""===t.label?" ":t.label,o.addEventListener("click",function(){_=!0,setTimeout(function(){_=!1},10),k?(d(t),T.focus()):p(t)}),P.indexOf(t)>-1&&o.classList.add("active")),t.elementAttributes&&"object"==_typeof(t.elementAttributes))for(var i in t.elementAttributes)"+"==i.charAt(0)?(i=i.slice(1),o.setAttribute(i,T.getAttribute(i)+t.elementAttributes["+"+i])):o.setAttribute(i,t.elementAttributes[i]);o.addEventListener("mousedown",function(){A=!1,setTimeout(function(){A=!0},10)}),t.element=o}D.appendChild(o)})}function l(e,t){!k&&S&&S.element&&S.element.classList.remove("active"),S&&S.element&&S.element.classList.remove("focused"),S=e,e.element&&(e.element.classList.add("focused"),t&&e.element.classList.add("active")),e&&e.element&&e.element.scrollIntoView&&e.element.scrollIntoView({behavior:"smooth",block:"nearest",inline:"start"})}function c(e){-1==P.indexOf(e)&&(P.push(e),l(e,!0)),f()}function u(e){var t=P[e];e>-1&&(P.splice(e,1),t.element&&t.element.classList.remove("active"))}function d(e){e||(e=S);var t=P.indexOf(e);t>-1?u(t):(!0!==k&&P.length>=k&&u(0),c(e)),f()}function p(e){y(),e||(e=S),e&&(T.value=e.label,o(e.value)),L=T.value}function m(e){e||y();var t=[];P.forEach(function(e){t.push(e.value)}),L=T.value,o(t)}function f(){var e=[];P.forEach(function(t){e.push(t.label)}),T.value=e.join(", "),!1===C.currentCell&&m(!0)}function g(){for(var e=P.length,t=0;t0&&l(z[t-1],!k));break;case 40:t=z.indexOf(S),("editor"==M||"hybrid"==M&&t-1||String(t.title).toLowerCase().indexOf(String(e).toLowerCase())>-1)&&s.push(t)}),d(s,t))}function l(e){var t=document.createElement("div");u(),!1!==e&&(t.classList.add("tabulator-edit-select-list-notice"),t.tabIndex=0,e instanceof Node?t.appendChild(e):t.innerHTML=e,T.appendChild(t))}function c(e){var t=[];if(Array.isArray(e))e.forEach(function(e){var o={};"object"===(void 0===e?"undefined":_typeof(e))?(o.title=n.listItemFormatter?n.listItemFormatter(e.value,e.label):e.label,o.value=e.value):(o.title=n.listItemFormatter?n.listItemFormatter(e,e):e,o.value=e),t.push(o)});else for(var o in e){var i={title:n.listItemFormatter?n.listItemFormatter(o,e[o]):e[o],value:o};t.push(i)}return t}function u(){for(;T.firstChild;)T.removeChild(T.firstChild)}function d(e,t){e.length?p(e,t):n.emptyPlaceholder&&l(n.emptyPlaceholder)}function p(e,t){var o=!1;u(),D=e,D.forEach(function(e){var i=e.element;i||(i=document.createElement("div"),i.classList.add("tabulator-edit-select-list-item"),i.tabIndex=0,i.innerHTML=e.title,i.addEventListener("click",function(t){g(e),m()}),i.addEventListener("mousedown",function(e){z=!1,setTimeout(function(){z=!0},10)}),e.element=i,t&&e.value==R&&(L.value=e.title,e.element.classList.add("active"),o=!0),e===k&&(e.element.classList.add("active"),o=!0)),T.appendChild(i)}),o||g(!1)}function m(){b(),k?R!==k.value?(R=k.value,L.value=k.title,o(k.value)):i():n.freetext?(R=L.value,o(L.value)):n.allowEmpty&&""===L.value?(R=L.value,o(L.value)):i()}function f(){if(!T.parentNode){for(;T.firstChild;)T.removeChild(T.firstChild);var e=h.prototype.helpers.elOffset(C);T.style.minWidth=C.offsetWidth+"px",T.style.top=e.top+C.offsetHeight+"px",T.style.left=e.left+"px",document.body.appendChild(T)}}function g(e,t){k&&k.element&&k.element.classList.remove("active"),k=e,e&&e.element&&e.element.classList.add("active"),e&&e.element&&e.element.scrollIntoView&&e.element.scrollIntoView({behavior:"smooth",block:"nearest",inline:"start"})}function b(){T.parentNode&&T.parentNode.removeChild(T),y()}function v(){b(),i()}function y(){E.table.rowManager.element.removeEventListener("scroll",v)}var w=this,E=this,C=e.getElement(),R=e.getValue(),x=n.verticalNavigation||"editor",M=void 0!==R||null===R?R:void 0!==n.defaultValue?n.defaultValue:"",L=document.createElement("input"),T=document.createElement("div"),D=[],k=!1,z=!0,S=!1;if(L.setAttribute("type","search"),L.style.padding="4px",L.style.width="100%",L.style.boxSizing="border-box",n.elementAttributes&&"object"==_typeof(n.elementAttributes))for(var H in n.elementAttributes)"+"==H.charAt(0)?(H=H.slice(1),L.setAttribute(H,L.getAttribute(H)+n.elementAttributes["+"+H])):L.setAttribute(H,n.elementAttributes[H]);return T.classList.add("tabulator-edit-select-list"),T.addEventListener("mousedown",function(e){z=!1,setTimeout(function(){z=!0},10)}),L.addEventListener("keydown",function(e){var t;switch(e.keyCode){case 38:t=D.indexOf(k),("editor"==x||"hybrid"==x&&t)&&(e.stopImmediatePropagation(),e.stopPropagation(),e.preventDefault(),g(t>0?D[t-1]:!1));break;case 40:t=D.indexOf(k),("editor"==x||"hybrid"==x&&t'):("ie"==r.table.browser?t.setAttribute("class","tabulator-star-inactive"):t.classList.replace("tabulator-star-active","tabulator-star-inactive"),t.innerHTML='')})}function a(e){c=e,s(e)}var r=this,l=e.getElement(),c=e.getValue(),u=l.getElementsByTagName("svg").length||5,d=l.getElementsByTagName("svg")[0]?l.getElementsByTagName("svg")[0].getAttribute("width"):14,h=[],p=document.createElement("div"),m=document.createElementNS("http://www.w3.org/2000/svg","svg");if(l.style.whiteSpace="nowrap",l.style.overflow="hidden",l.style.textOverflow="ellipsis",p.style.verticalAlign="middle",p.style.display="inline-block",p.style.padding="4px",m.setAttribute("width",d),m.setAttribute("height",d),m.setAttribute("viewBox","0 0 512 512"),m.setAttribute("xml:space","preserve"),m.style.padding="0 1px",n.elementAttributes&&"object"==_typeof(n.elementAttributes))for(var f in n.elementAttributes)"+"==f.charAt(0)?(f=f.slice(1),p.setAttribute(f,p.getAttribute(f)+n.elementAttributes["+"+f])):p.setAttribute(f,n.elementAttributes[f]);for(var g=1;g<=u;g++)!function(e){var t=document.createElement("span"),i=m.cloneNode(!0);h.push(i),t.addEventListener("mouseenter",function(t){t.stopPropagation(),t.stopImmediatePropagation(),s(e)}),t.addEventListener("mousemove",function(e){e.stopPropagation(),e.stopImmediatePropagation()}),t.addEventListener("click",function(t){t.stopPropagation(),t.stopImmediatePropagation(),o(e),l.blur()}),t.appendChild(i),p.appendChild(t)}(g);return c=Math.min(parseInt(c),u),s(c),p.addEventListener("mousemove",function(e){s(0)}),p.addEventListener("click",function(e){o(0)}),l.addEventListener("blur",function(e){i()}),l.addEventListener("keydown",function(e){switch(e.keyCode){case 39:a(c+1);break;case 37:a(c-1);break;case 13:o(c);break;case 27:i()}}),p},progress:function(e,t,o,i,n){function s(){var e=d*Math.round(m.offsetWidth/(l.clientWidth/100))+u;o(e),l.setAttribute("aria-valuenow",e),l.setAttribute("aria-label",h)}var a,r,l=e.getElement(),c=void 0===n.max?l.getElementsByTagName("div")[0].getAttribute("max")||100:n.max,u=void 0===n.min?l.getElementsByTagName("div")[0].getAttribute("min")||0:n.min,d=(c-u)/100,h=e.getValue()||0,p=document.createElement("div"),m=document.createElement("div");if(p.style.position="absolute",p.style.right="0",p.style.top="0",p.style.bottom="0",p.style.width="5px",p.classList.add("tabulator-progress-handle"),m.style.display="inline-block",m.style.position="relative",m.style.height="100%",m.style.backgroundColor="#488CE9",m.style.maxWidth="100%",m.style.minWidth="0%",n.elementAttributes&&"object"==_typeof(n.elementAttributes))for(var f in n.elementAttributes)"+"==f.charAt(0)?(f=f.slice(1),m.setAttribute(f,m.getAttribute(f)+n.elementAttributes["+"+f])):m.setAttribute(f,n.elementAttributes[f]);return l.style.padding="4px 4px",h=Math.min(parseFloat(h),c),h=Math.max(parseFloat(h),u),h=Math.round((h-u)/d),m.style.width=h+"%",l.setAttribute("aria-valuemin",u),l.setAttribute("aria-valuemax",c),m.appendChild(p),p.addEventListener("mousedown",function(e){a=e.screenX,r=m.offsetWidth}),p.addEventListener("mouseover",function(){p.style.cursor="ew-resize"}),l.addEventListener("mousemove",function(e){a&&(m.style.width=r+e.screenX-a+"px")}),l.addEventListener("mouseup",function(e){a&&(e.stopPropagation(),e.stopImmediatePropagation(),a=!1,r=!1,s())}),l.addEventListener("keydown",function(e){switch(e.keyCode){case 39:e.preventDefault(),m.style.width=m.clientWidth+l.clientWidth/100+"px";break;case 37:e.preventDefault(),m.style.width=m.clientWidth-l.clientWidth/100+"px";break;case 9:case 13:s();break;case 27:i()}}),l.addEventListener("blur",function(){i()}),m},tickCross:function(e,t,o,i,n){function s(e){return l?e?u?c:r.checked:r.checked&&!u?(r.checked=!1,r.indeterminate=!0,u=!0,c):(u=!1,r.checked):r.checked}var a=e.getValue(),r=document.createElement("input"),l=n.tristate,c=void 0===n.indeterminateValue?null:n.indeterminateValue,u=!1;if(r.setAttribute("type","checkbox"),r.style.marginTop="5px",r.style.boxSizing="border-box",n.elementAttributes&&"object"==_typeof(n.elementAttributes))for(var d in n.elementAttributes)"+"==d.charAt(0)?(d=d.slice(1),r.setAttribute(d,r.getAttribute(d)+n.elementAttributes["+"+d])):r.setAttribute(d,n.elementAttributes[d]);return r.value=a,!l||void 0!==a&&a!==c&&""!==a||(u=!0,r.indeterminate=!0),"firefox"!=this.table.browser&&t(function(){r.focus({preventScroll:!0})}),r.checked=!0===a||"true"===a||"True"===a||1===a,t(function(){r.focus()}),r.addEventListener("change",function(e){o(s())}),r.addEventListener("blur",function(e){o(s(!0))}),r.addEventListener("keydown",function(e){13==e.keyCode&&o(s()),27==e.keyCode&&i()}),r}},h.prototype.registerModule("edit",R);var x=function(e,t,o,i){this.type=e,this.columns=t,this.component=o||!1,this.indent=i||0},M=function(e,t,o,i,n){this.value=e,this.component=t||!1,this.width=o,this.height=i,this.depth=n},L=function(e){this.table=e,this.config={},this.cloneTableStyle=!0,this.colVisProp=""};L.prototype.generateExportList=function(e,t,o,i){this.cloneTableStyle=t,this.config=e||{},this.colVisProp=i;var n=!1!==this.config.columnHeaders?this.headersToExportRows(this.generateColumnGroupHeaders()):[],s=this.bodyToExportRows(this.rowLookup(o));return n.concat(s)},L.prototype.genereateTable=function(e,t,o,i){var n=this.generateExportList(e,t,o,i);return this.genereateTableElement(n)},L.prototype.rowLookup=function(e){var t=this,o=[];if("function"==typeof e)e.call(this.table).forEach(function(e){(e=t.table.rowManager.findRow(e))&&o.push(e)});else switch(e){case!0:case"visible":o=this.table.rowManager.getVisibleRows(!0);break;case"all":o=this.table.rowManager.rows;break;case"selected":o=this.table.modules.selectRow.selectedRows;break;case"active":default:o=this.table.options.pagination?this.table.rowManager.getDisplayRows(this.table.rowManager.displayRows.length-2):this.table.rowManager.getDisplayRows()}return Object.assign([],o)},L.prototype.generateColumnGroupHeaders=function(){var e=this,t=[];return(!1!==this.config.columnGroups?this.table.columnManager.columns:this.table.columnManager.columnsByIndex).forEach(function(o){var i=e.processColumnGroup(o);i&&t.push(i)}),t},L.prototype.processColumnGroup=function(e){var t=this,o=e.columns,i=0,n=e.definition["title"+(this.colVisProp.charAt(0).toUpperCase()+this.colVisProp.slice(1))]||e.definition.title,s={title:n,column:e,depth:1};if(o.length){if(s.subGroups=[],s.width=0,o.forEach(function(e){var o=t.processColumnGroup(e);o&&(s.width+=o.width,s.subGroups.push(o),o.depth>i&&(i=o.depth))}),s.depth+=i,!s.width)return!1}else{if(!this.columnVisCheck(e))return!1;s.width=1}return s},L.prototype.columnVisCheck=function(e){return!1!==e.definition[this.colVisProp]&&(e.visible||!e.visible&&e.definition[this.colVisProp])},L.prototype.headersToExportRows=function(e){function t(e,n){var s=i-n;if(void 0===o[n]&&(o[n]=[]),e.height=e.subGroups?1:s-e.depth+1,o[n].push(e),e.height>1)for(var a=1;a1)for(var r=1;ri&&(i=e.depth)}),e.forEach(function(e){t(e,0)}),o.forEach(function(e){var t=[];e.forEach(function(e){e?t.push(new M(e.title,e.column.getComponent(),e.width,e.height,e.depth)):t.push(null)}),n.push(new x("header",t))}),n},L.prototype.bodyToExportRows=function(e){var t=this,o=[],i=[];return this.table.columnManager.columnsByIndex.forEach(function(e){t.columnVisCheck(e)&&o.push(e.getComponent())}),!1!==this.config.columnCalcs&&this.table.modExists("columnCalcs")&&(this.table.modules.columnCalcs.topInitialized&&e.unshift(this.table.modules.columnCalcs.topRow),this.table.modules.columnCalcs.botInitialized&&e.push(this.table.modules.columnCalcs.botRow)),e=e.filter(function(e){switch(e.type){case"group":return!1!==t.config.rowGroups;case"calc":return!1!==t.config.columnCalcs;case"row":return!(t.table.options.dataTree&&!1===t.config.dataTree&&e.modules.dataTree.parent)}return!0}),e.forEach(function(e,n){var s=e.getData(t.colVisProp),a=[],r=0;switch(e.type){case"group":r=e.level,a.push(new M(e.key,e.getComponent(),o.length,1));break;case"calc":case"row":o.forEach(function(e){a.push(new M(e._column.getFieldValue(s),e,1,1))}),t.table.options.dataTree&&!1!==t.config.dataTree&&(r=e.modules.dataTree.index)}i.push(new x(e.type,a,e.getComponent(),r))}),i},L.prototype.genereateTableElement=function(e){var t=this,o=document.createElement("table"),i=document.createElement("thead"),n=document.createElement("tbody"),s=this.lookupTableStyles(),a=this.table.options["rowFormatter"+(this.colVisProp.charAt(0).toUpperCase()+this.colVisProp.slice(1))],r={};return r.rowFormatter=null!==a?a:this.table.options.rowFormatter,this.table.options.dataTree&&!1!==this.config.dataTree&&this.table.modExists("columnCalcs")&&(r.treeElementField=this.table.modules.dataTree.elementField),r.groupHeader=this.table.options["groupHeader"+(this.colVisProp.charAt(0).toUpperCase()+this.colVisProp.slice(1))],r.groupHeader&&!Array.isArray(r.groupHeader)&&(r.groupHeader=[r.groupHeader]),o.classList.add("tabulator-print-table"),this.mapElementStyles(this.table.columnManager.getHeadersElement(),i,["border-top","border-left","border-right","border-bottom","background-color","color","font-weight","font-family","font-size"]),e.length>1e3&&console.warn("It may take a long time to render an HTML table with more than 1000 rows"),e.forEach(function(e,o){switch(e.type){case"header":i.appendChild(t.genereateHeaderElement(e,r,s));break;case"group":n.appendChild(t.genereateGroupElement(e,r,s));break;case"calc":n.appendChild(t.genereateCalcElement(e,r,s));break;case"row":var a=t.genereateRowElement(e,r,s);t.mapElementStyles(o%2&&s.evenRow?s.evenRow:s.oddRow,a,["border-top","border-left","border-right","border-bottom","color","font-weight","font-family","font-size","background-color"]),n.appendChild(a)}}),i.innerHTML&&o.appendChild(i),o.appendChild(n),this.mapElementStyles(this.table.element,o,["border-top","border-left","border-right","border-bottom"]),o},L.prototype.lookupTableStyles=function(){var e={};return this.cloneTableStyle&&window.getComputedStyle&&(e.oddRow=this.table.element.querySelector(".tabulator-row-odd:not(.tabulator-group):not(.tabulator-calcs)"),e.evenRow=this.table.element.querySelector(".tabulator-row-even:not(.tabulator-group):not(.tabulator-calcs)"),e.calcRow=this.table.element.querySelector(".tabulator-row.tabulator-calcs"),e.firstRow=this.table.element.querySelector(".tabulator-row:not(.tabulator-group):not(.tabulator-calcs)"),e.firstGroup=this.table.element.getElementsByClassName("tabulator-group")[0],e.firstRow&&(e.styleCells=e.firstRow.getElementsByClassName("tabulator-cell"),e.firstCell=e.styleCells[0],e.lastCell=e.styleCells[e.styleCells.length-1])),e},L.prototype.genereateHeaderElement=function(e,t,o){var i=this,n=document.createElement("tr");return e.columns.forEach(function(e){if(e){var t=document.createElement("th"),o=e.component._column.definition.cssClass?e.component._column.definition.cssClass.split(" "):[];t.colSpan=e.width,t.rowSpan=e.height,t.innerHTML=e.value,i.cloneTableStyle&&(t.style.boxSizing="border-box"),o.forEach(function(e){t.classList.add(e)}),i.mapElementStyles(e.component.getElement(),t,["text-align","border-top","border-left","border-right","border-bottom","background-color","color","font-weight","font-family","font-size"]),i.mapElementStyles(e.component._column.contentElement,t,["padding-top","padding-left","padding-right","padding-bottom"]),e.component._column.visible?i.mapElementStyles(e.component.getElement(),t,["width"]):e.component._column.definition.width&&(t.style.width=e.component._column.definition.width+"px"),e.component._column.parent&&i.mapElementStyles(e.component._column.parent.groupElement,t,["border-top"]),n.appendChild(t)}}),n},L.prototype.genereateGroupElement=function(e,t,o){var i=document.createElement("tr"),n=document.createElement("td"),s=e.columns[0];return i.classList.add("tabulator-print-table-row"),t.groupHeader&&t.groupHeader[e.indent]?s.value=t.groupHeader[e.indent](s.value,e.component._group.getRowCount(),e.component._group.getData(),e.component):!1===t.groupHeader?s.value=s.value:s.value=e.component._group.generator(s.value,e.component._group.getRowCount(),e.component._group.getData(),e.component),n.colSpan=s.width,n.innerHTML=s.value,i.classList.add("tabulator-print-table-group"),i.classList.add("tabulator-group-level-"+e.indent),s.component.isVisible()&&i.classList.add("tabulator-group-visible"),this.mapElementStyles(o.firstGroup,i,["border-top","border-left","border-right","border-bottom","color","font-weight","font-family","font-size","background-color"]),this.mapElementStyles(o.firstGroup,n,["padding-top","padding-left","padding-right","padding-bottom"]),i.appendChild(n),i},L.prototype.genereateCalcElement=function(e,t,o){var i=this.genereateRowElement(e,t,o);return i.classList.add("tabulator-print-table-calcs"),this.mapElementStyles(o.calcRow,i,["border-top","border-left","border-right","border-bottom","color","font-weight","font-family","font-size","background-color"]),i},L.prototype.genereateRowElement=function(e,t,o){var n=this,s=document.createElement("tr");return s.classList.add("tabulator-print-table-row"),e.columns.forEach(function(a){if(a){var r=document.createElement("td"),l=a.component._column,c=a.value,u={modules:{},getValue:function(){return c},getField:function(){return l.definition.field},getElement:function(){return r},getColumn:function(){return l.getComponent()},getData:function(){return e.component.getData()},getRow:function(){return e.component},getComponent:function(){return u},column:l};if((l.definition.cssClass?l.definition.cssClass.split(" "):[]).forEach(function(e){r.classList.add(e)}),n.table.modExists("format")&&!1!==n.config.formatCells)c=n.table.modules.format.formatExportValue(u,n.colVisProp);else switch(void 0===c?"undefined":_typeof(c)){case"object":c=JSON.stringify(c);break;case"undefined":case"null":c="";break;default:c=c}c instanceof Node?r.appendChild(c):r.innerHTML=c,o.firstCell&&(n.mapElementStyles(o.firstCell,r,["padding-top","padding-left","padding-right","padding-bottom","border-top","border-left","border-right","border-bottom","color","font-weight","font-family","font-size"]),l.definition.align&&(r.style.textAlign=l.definition.align)),n.table.options.dataTree&&!1!==n.config.dataTree&&(t.treeElementField&&t.treeElementField==l.field||!t.treeElementField&&0==i)&&(e.component._row.modules.dataTree.controlEl&&r.insertBefore(e.component._row.modules.dataTree.controlEl.cloneNode(!0),r.firstChild),e.component._row.modules.dataTree.branchEl&&r.insertBefore(e.component._row.modules.dataTree.branchEl.cloneNode(!0),r.firstChild)),s.appendChild(r),u.modules.format&&u.modules.format.renderedCallback&&u.modules.format.renderedCallback(),t.rowFormatter&&!1!==n.config.formatCells&&t.rowFormatter(e.component)}}),s},L.prototype.genereateHTMLTable=function(e){var t=document.createElement("div");return t.appendChild(this.genereateTableElement(e)),t.innerHTML},L.prototype.getHtml=function(e,t,o,i){var n=this.generateExportList(o||this.table.options.htmlOutputConfig,t,e,i||"htmlOutput");return this.genereateHTMLTable(n)},L.prototype.mapElementStyles=function(e,t,o){if(this.cloneTableStyle&&e&&t){var i={"background-color":"backgroundColor",color:"fontColor",width:"width","font-weight":"fontWeight","font-family":"fontFamily","font-size":"fontSize","text-align":"textAlign","border-top":"borderTop","border-left":"borderLeft","border-right":"borderRight","border-bottom":"borderBottom","padding-top":"paddingTop","padding-left":"paddingLeft","padding-right":"paddingRight","padding-bottom":"paddingBottom"};if(window.getComputedStyle){var n=window.getComputedStyle(e);o.forEach(function(e){t.style[i[e]]=n.getPropertyValue(e)})}}},h.prototype.registerModule("export",L);var T=function(e){this.table=e,this.filterList=[],this.headerFilters={},this.headerFilterColumns=[],this.prevHeaderFilterChangeCheck="",this.prevHeaderFilterChangeCheck="{}",this.changed=!1};T.prototype.initializeColumn=function(e,t){function o(t){var o,a="input"==e.modules.filter.tagType&&"text"==e.modules.filter.attrType||"textarea"==e.modules.filter.tagType?"partial":"match",r="",l="";if(void 0===e.modules.filter.prevSuccess||e.modules.filter.prevSuccess!==t){if(e.modules.filter.prevSuccess=t,e.modules.filter.emptyFunc(t))delete n.headerFilters[s];else{switch(e.modules.filter.value=t,_typeof(e.definition.headerFilterFunc)){case"string":n.filters[e.definition.headerFilterFunc]?(r=e.definition.headerFilterFunc,o=function(o){var i=e.definition.headerFilterFuncParams||{},s=e.getFieldValue(o);return i="function"==typeof i?i(t,s,o):i,n.filters[e.definition.headerFilterFunc](t,s,o,i)}):console.warn("Header Filter Error - Matching filter function not found: ",e.definition.headerFilterFunc);break;case"function":o=function(o){var i=e.definition.headerFilterFuncParams||{},n=e.getFieldValue(o);return i="function"==typeof i?i(t,n,o):i,e.definition.headerFilterFunc(t,n,o,i)},r=o}if(!o)switch(a){case"partial":o=function(o){var i=e.getFieldValue(o);return void 0!==i&&null!==i&&String(i).toLowerCase().indexOf(String(t).toLowerCase())>-1},r="like";break;default:o=function(o){return e.getFieldValue(o)==t},r="="}n.headerFilters[s]={value:t,func:o,type:r,params:i||{}}}l=JSON.stringify(n.headerFilters),n.prevHeaderFilterChangeCheck!==l&&(n.prevHeaderFilterChangeCheck=l,n.changed=!0,n.table.rowManager.filterRefresh())}return!0}var i,n=this,s=e.getField();e.modules.filter={success:o,attrType:!1,tagType:!1,emptyFunc:!1},this.generateHeaderFilterElement(e)},T.prototype.generateHeaderFilterElement=function(e,t,o){function i(){}var n,s,a,r,l,c,u,d=this,h=this,p=e.modules.filter.success,m=e.getField();if(e.modules.filter.headerElement&&e.modules.filter.headerElement.parentNode&&e.contentElement.removeChild(e.modules.filter.headerElement.parentNode),m){switch(e.modules.filter.emptyFunc=e.definition.headerFilterEmptyCheck||function(e){return!e&&"0"!==e},n=document.createElement("div"),n.classList.add("tabulator-header-filter"),_typeof(e.definition.headerFilter)){case"string":h.table.modules.edit.editors[e.definition.headerFilter]?(s=h.table.modules.edit.editors[e.definition.headerFilter],"tick"!==e.definition.headerFilter&&"tickCross"!==e.definition.headerFilter||e.definition.headerFilterEmptyCheck||(e.modules.filter.emptyFunc=function(e){return!0!==e&&!1!==e})):console.warn("Filter Error - Cannot build header filter, No such editor found: ",e.definition.editor);break;case"function":s=e.definition.headerFilter;break;case"boolean":e.modules.edit&&e.modules.edit.editor?s=e.modules.edit.editor:e.definition.formatter&&h.table.modules.edit.editors[e.definition.formatter]?(s=h.table.modules.edit.editors[e.definition.formatter],"tick"!==e.definition.formatter&&"tickCross"!==e.definition.formatter||e.definition.headerFilterEmptyCheck||(e.modules.filter.emptyFunc=function(e){return!0!==e&&!1!==e})):s=h.table.modules.edit.editors.input}if(s){if(r={getValue:function(){return void 0!==t?t:""},getField:function(){return e.definition.field},getElement:function(){return n},getColumn:function(){return e.getComponent()},getRow:function(){return{normalizeHeight:function(){}}}},u=e.definition.headerFilterParams||{},u="function"==typeof u?u.call(h.table):u,!(a=s.call(this.table.modules.edit,r,function(){},p,i,u)))return void console.warn("Filter Error - Cannot add filter to "+m+" column, editor returned a value of false");if(!(a instanceof Node))return void console.warn("Filter Error - Cannot add filter to "+m+" column, editor should return an instance of Node, the editor returned:",a);m?h.table.modules.localize.bind("headerFilters|columns|"+e.definition.field,function(e){a.setAttribute("placeholder",void 0!==e&&e?e:h.table.modules.localize.getText("headerFilters|default"))}):h.table.modules.localize.bind("headerFilters|default",function(e){a.setAttribute("placeholder",void 0!==h.column.definition.headerFilterPlaceholder&&h.column.definition.headerFilterPlaceholder?h.column.definition.headerFilterPlaceholder:e)}),a.addEventListener("click",function(e){e.stopPropagation(),a.focus()}), +a.addEventListener("focus",function(e){var t=d.table.columnManager.element.scrollLeft;t!==d.table.rowManager.element.scrollLeft&&(d.table.rowManager.scrollHorizontal(t),d.table.columnManager.scrollHorizontal(t))}),l=!1,c=function(e){l&&clearTimeout(l),l=setTimeout(function(){p(a.value)},h.table.options.headerFilterLiveFilterDelay)},e.modules.filter.headerElement=a,e.modules.filter.attrType=a.hasAttribute("type")?a.getAttribute("type").toLowerCase():"",e.modules.filter.tagType=a.tagName.toLowerCase(),!1!==e.definition.headerFilterLiveFilter&&("autocomplete"!==e.definition.headerFilter&&"tickCross"!==e.definition.headerFilter&&("autocomplete"!==e.definition.editor&&"tickCross"!==e.definition.editor||!0!==e.definition.headerFilter)&&(a.addEventListener("keyup",c),a.addEventListener("search",c),"number"==e.modules.filter.attrType&&a.addEventListener("change",function(e){p(a.value)}),"text"==e.modules.filter.attrType&&"ie"!==this.table.browser&&a.setAttribute("type","search")),"input"!=e.modules.filter.tagType&&"select"!=e.modules.filter.tagType&&"textarea"!=e.modules.filter.tagType||a.addEventListener("mousedown",function(e){e.stopPropagation()})),n.appendChild(a),e.contentElement.appendChild(n),o||h.headerFilterColumns.push(e)}}else console.warn("Filter Error - Cannot add header filter, column has no field set:",e.definition.title)},T.prototype.hideHeaderFilterElements=function(){this.headerFilterColumns.forEach(function(e){e.modules.filter&&e.modules.filter.headerElement&&(e.modules.filter.headerElement.style.display="none")})},T.prototype.showHeaderFilterElements=function(){this.headerFilterColumns.forEach(function(e){e.modules.filter&&e.modules.filter.headerElement&&(e.modules.filter.headerElement.style.display="")})},T.prototype.setHeaderFilterFocus=function(e){e.modules.filter&&e.modules.filter.headerElement?e.modules.filter.headerElement.focus():console.warn("Column Filter Focus Error - No header filter set on column:",e.getField())},T.prototype.getHeaderFilterValue=function(e){if(e.modules.filter&&e.modules.filter.headerElement)return e.modules.filter.headerElement.value;console.warn("Column Filter Error - No header filter set on column:",e.getField())},T.prototype.setHeaderFilterValue=function(e,t){e&&(e.modules.filter&&e.modules.filter.headerElement?(this.generateHeaderFilterElement(e,t,!0),e.modules.filter.success(t)):console.warn("Column Filter Error - No header filter set on column:",e.getField()))},T.prototype.reloadHeaderFilter=function(e){e&&(e.modules.filter&&e.modules.filter.headerElement?this.generateHeaderFilterElement(e,e.modules.filter.value,!0):console.warn("Column Filter Error - No header filter set on column:",e.getField()))},T.prototype.hasChanged=function(){var e=this.changed;return this.changed=!1,e},T.prototype.setFilter=function(e,t,o,i){var n=this;n.filterList=[],Array.isArray(e)||(e=[{field:e,type:t,value:o,params:i}]),n.addFilter(e)},T.prototype.addFilter=function(e,t,o,i){var n=this;Array.isArray(e)||(e=[{field:e,type:t,value:o,params:i}]),e.forEach(function(e){(e=n.findFilter(e))&&(n.filterList.push(e),n.changed=!0)}),this.table.options.persistence&&this.table.modExists("persistence",!0)&&this.table.modules.persistence.config.filter&&this.table.modules.persistence.save("filter")},T.prototype.findFilter=function(e){var t,o=this;if(Array.isArray(e))return this.findSubFilters(e);var i=!1;return"function"==typeof e.field?i=function(t){return e.field(t,e.type||{})}:o.filters[e.type]?(t=o.table.columnManager.getColumnByField(e.field),i=t?function(i){return o.filters[e.type](e.value,t.getFieldValue(i),i,e.params||{})}:function(t){return o.filters[e.type](e.value,t[e.field],t,e.params||{})}):console.warn("Filter Error - No such filter type found, ignoring: ",e.type),e.func=i,!!e.func&&e},T.prototype.findSubFilters=function(e){var t=this,o=[];return e.forEach(function(e){(e=t.findFilter(e))&&o.push(e)}),!!o.length&&o},T.prototype.getFilters=function(e,t){var o=[];return e&&(o=this.getHeaderFilters()),t&&o.forEach(function(e){"function"==typeof e.type&&(e.type="function")}),o=o.concat(this.filtersToArray(this.filterList,t))},T.prototype.filtersToArray=function(e,t){var o=this,i=[];return e.forEach(function(e){var n;Array.isArray(e)?i.push(o.filtersToArray(e,t)):(n={field:e.field,type:e.type,value:e.value},t&&"function"==typeof n.type&&(n.type="function"),i.push(n))}),i},T.prototype.getHeaderFilters=function(){var e=[];for(var t in this.headerFilters)e.push({field:t,type:this.headerFilters[t].type,value:this.headerFilters[t].value});return e},T.prototype.removeFilter=function(e,t,o){var i=this;Array.isArray(e)||(e=[{field:e,type:t,value:o}]),e.forEach(function(e){var t=-1;t="object"==_typeof(e.field)?i.filterList.findIndex(function(t){return e===t}):i.filterList.findIndex(function(t){return e.field===t.field&&e.type===t.type&&e.value===t.value}),t>-1?(i.filterList.splice(t,1),i.changed=!0):console.warn("Filter Error - No matching filter type found, ignoring: ",e.type)}),this.table.options.persistence&&this.table.modExists("persistence",!0)&&this.table.modules.persistence.config.filter&&this.table.modules.persistence.save("filter")},T.prototype.clearFilter=function(e){this.filterList=[],e&&this.clearHeaderFilter(),this.changed=!0,this.table.options.persistence&&this.table.modExists("persistence",!0)&&this.table.modules.persistence.config.filter&&this.table.modules.persistence.save("filter")},T.prototype.clearHeaderFilter=function(){var e=this;this.headerFilters={},e.prevHeaderFilterChangeCheck="{}",this.headerFilterColumns.forEach(function(t){t.modules.filter.value=null,t.modules.filter.prevSuccess=void 0,e.reloadHeaderFilter(t)}),this.changed=!0},T.prototype.search=function(e,t,o,i){var n=this,s=[],a=[];return Array.isArray(t)||(t=[{field:t,type:o,value:i}]),t.forEach(function(e){(e=n.findFilter(e))&&a.push(e)}),this.table.rowManager.rows.forEach(function(t){var o=!0;a.forEach(function(e){n.filterRecurse(e,t.getData())||(o=!1)}),o&&s.push("data"===e?t.getData("data"):t.getComponent())}),s},T.prototype.filter=function(e,t){var o=this,i=[],n=[];return o.table.options.dataFiltering&&o.table.options.dataFiltering.call(o.table,o.getFilters()),o.table.options.ajaxFiltering||!o.filterList.length&&!Object.keys(o.headerFilters).length?i=e.slice(0):e.forEach(function(e){o.filterRow(e)&&i.push(e)}),o.table.options.dataFiltered&&(i.forEach(function(e){n.push(e.getComponent())}),o.table.options.dataFiltered.call(o.table,o.getFilters(),n)),i},T.prototype.filterRow=function(e,t){var o=this,i=!0,n=e.getData();o.filterList.forEach(function(e){o.filterRecurse(e,n)||(i=!1)});for(var s in o.headerFilters)o.headerFilters[s].func(n)||(i=!1);return i},T.prototype.filterRecurse=function(e,t){var o=this,i=!1;return Array.isArray(e)?e.forEach(function(e){o.filterRecurse(e,t)&&(i=!0)}):i=e.func(t),i},T.prototype.filters={"=":function(e,t,o,i){return t==e},"<":function(e,t,o,i){return t":function(e,t,o,i){return t>e},">=":function(e,t,o,i){return t>=e},"!=":function(e,t,o,i){return t!=e},regex:function(e,t,o,i){return"string"==typeof e&&(e=new RegExp(e)),e.test(t)},like:function(e,t,o,i){return null===e||void 0===e?t===e:void 0!==t&&null!==t&&String(t).toLowerCase().indexOf(e.toLowerCase())>-1},keywords:function(e,t,o,i){var n=e.toLowerCase().split(void 0===i.separator?" ":i.separator),s=String(null===t||void 0===t?"":t).toLowerCase(),a=[];return n.forEach(function(e){s.includes(e)&&a.push(!0)}),i.matchAll?a.length===n.length:!!a.length},starts:function(e,t,o,i){return null===e||void 0===e?t===e:void 0!==t&&null!==t&&String(t).toLowerCase().startsWith(e.toLowerCase())},ends:function(e,t,o,i){return null===e||void 0===e?t===e:void 0!==t&&null!==t&&String(t).toLowerCase().endsWith(e.toLowerCase())},in:function(e,t,o,i){return Array.isArray(e)?!e.length||e.indexOf(t)>-1:(console.warn("Filter Error - filter value is not an array:",e),!1)}},h.prototype.registerModule("filter",T);var D=function(e){this.table=e};D.prototype.initializeColumn=function(e){e.modules.format=this.lookupFormatter(e,""),void 0!==e.definition.formatterPrint&&(e.modules.format.print=this.lookupFormatter(e,"Print")),void 0!==e.definition.formatterClipboard&&(e.modules.format.clipboard=this.lookupFormatter(e,"Clipboard")),void 0!==e.definition.formatterHtmlOutput&&(e.modules.format.htmlOutput=this.lookupFormatter(e,"HtmlOutput"))},D.prototype.lookupFormatter=function(e,t){var o={params:e.definition["formatter"+t+"Params"]||{}},i=e.definition["formatter"+t];switch(void 0===i?"undefined":_typeof(i)){case"string":"tick"===i&&(i="tickCross",void 0===o.params.crossElement&&(o.params.crossElement=!1),console.warn("DEPRECATION WARNING - the tick formatter has been deprecated, please use the tickCross formatter with the crossElement param set to false")),this.formatters[i]?o.formatter=this.formatters[i]:(console.warn("Formatter Error - No such formatter found: ",i),o.formatter=this.formatters.plaintext);break;case"function":o.formatter=i;break;default:o.formatter=this.formatters.plaintext}return o},D.prototype.cellRendered=function(e){e.modules.format&&e.modules.format.renderedCallback&&!e.modules.format.rendered&&(e.modules.format.renderedCallback(),e.modules.format.rendered=!0)},D.prototype.formatValue=function(e){function t(t){e.modules.format||(e.modules.format={}),e.modules.format.renderedCallback=t,e.modules.format.rendered=!1}var o=e.getComponent(),i="function"==typeof e.column.modules.format.params?e.column.modules.format.params(o):e.column.modules.format.params;return e.column.modules.format.formatter.call(this,o,i,t)},D.prototype.formatExportValue=function(e,t){var o,i=e.column.modules.format[t];if(i){var n=function(t){e.modules.format||(e.modules.format={}),e.modules.format.renderedCallback=t,e.modules.format.rendered=!1};return o="function"==typeof i.params?i.params(component):i.params,i.formatter.call(this,e.getComponent(),o,n)}return this.formatValue(e)},D.prototype.sanitizeHTML=function(e){if(e){var t={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/","`":"`","=":"="};return String(e).replace(/[&<>"'`=\/]/g,function(e){return t[e]})}return e},D.prototype.emptyToSpace=function(e){return null===e||void 0===e||""===e?" ":e},D.prototype.getFormatter=function(e){var e;switch(void 0===e?"undefined":_typeof(e)){case"string":this.formatters[e]?e=this.formatters[e]:(console.warn("Formatter Error - No such formatter found: ",e),e=this.formatters.plaintext);break;case"function":e=e;break;default:e=this.formatters.plaintext}return e},D.prototype.formatters={plaintext:function(e,t,o){return this.emptyToSpace(this.sanitizeHTML(e.getValue()))},html:function(e,t,o){return e.getValue()},textarea:function(e,t,o){return e.getElement().style.whiteSpace="pre-wrap",this.emptyToSpace(this.sanitizeHTML(e.getValue()))},money:function(e,t,o){var i,n,s,a,r=parseFloat(e.getValue()),l=t.decimal||".",c=t.thousand||",",u=t.symbol||"",d=!!t.symbolAfter,h=void 0!==t.precision?t.precision:2;if(isNaN(r))return this.emptyToSpace(this.sanitizeHTML(e.getValue()));for(i=!1!==h?r.toFixed(h):r,i=String(i).split("."),n=i[0],s=i.length>1?l+i[1]:"",a=/(\d+)(\d{3})/;a.test(n);)n=n.replace(a,"$1"+c+"$2");return d?n+s+u:u+n+s},link:function(e,t,o){var i,n=e.getValue(),s=t.urlPrefix||"",a=t.download,r=n,l=document.createElement("a");if(t.labelField&&(i=e.getData(),r=i[t.labelField]),t.label)switch(_typeof(t.label)){case"string":r=t.label;break;case"function":r=t.label(e)}if(r){if(t.urlField&&(i=e.getData(),n=i[t.urlField]),t.url)switch(_typeof(t.url)){case"string":n=t.url;break;case"function":n=t.url(e)}return l.setAttribute("href",s+n),t.target&&l.setAttribute("target",t.target),t.download&&(a="function"==typeof a?a(e):!0===a?"":a,l.setAttribute("download",a)),l.innerHTML=this.emptyToSpace(this.sanitizeHTML(r)),l}return" "},image:function(e,t,o){var i=document.createElement("img");switch(i.setAttribute("src",e.getValue()),_typeof(t.height)){case"number":i.style.height=t.height+"px";break;case"string":i.style.height=t.height}switch(_typeof(t.width)){case"number":i.style.width=t.width+"px";break;case"string":i.style.width=t.width}return i.addEventListener("load",function(){e.getRow().normalizeHeight()}),i},tickCross:function(e,t,o){var i=e.getValue(),n=e.getElement(),s=t.allowEmpty,a=t.allowTruthy,r=void 0!==t.tickElement?t.tickElement:'',l=void 0!==t.crossElement?t.crossElement:'';return a&&i||!0===i||"true"===i||"True"===i||1===i||"1"===i?(n.setAttribute("aria-checked",!0),r||""):!s||"null"!==i&&""!==i&&null!==i&&void 0!==i?(n.setAttribute("aria-checked",!1),l||""):(n.setAttribute("aria-checked","mixed"),"")},datetime:function(e,t,o){var i=t.inputFormat||"YYYY-MM-DD hh:mm:ss",n=t.outputFormat||"DD/MM/YYYY hh:mm:ss",s=void 0!==t.invalidPlaceholder?t.invalidPlaceholder:"",a=e.getValue(),r=moment(a,i);return r.isValid()?t.timezone?r.tz(t.timezone).format(n):r.format(n):!0===s?a:"function"==typeof s?s(a):s},datetimediff:function(e,t,o){var i=t.inputFormat||"YYYY-MM-DD hh:mm:ss",n=void 0!==t.invalidPlaceholder?t.invalidPlaceholder:"",s=void 0!==t.suffix&&t.suffix,a=void 0!==t.unit?t.unit:void 0,r=void 0!==t.humanize&&t.humanize,l=void 0!==t.date?t.date:moment(),c=e.getValue(),u=moment(c,i);return u.isValid()?r?moment.duration(u.diff(l)).humanize(s):u.diff(l,a)+(s?" "+s:""):!0===n?c:"function"==typeof n?n(c):n},lookup:function(e,t,o){var i=e.getValue();return void 0===t[i]?(console.warn("Missing display value for "+i),i):t[i]},star:function(e,t,o){var i=e.getValue(),n=e.getElement(),s=t&&t.stars?t.stars:5,a=document.createElement("span"),r=document.createElementNS("http://www.w3.org/2000/svg","svg");a.style.verticalAlign="middle",r.setAttribute("width","14"),r.setAttribute("height","14"),r.setAttribute("viewBox","0 0 512 512"),r.setAttribute("xml:space","preserve"),r.style.padding="0 1px",i=i&&!isNaN(i)?parseInt(i):0,i=Math.max(0,Math.min(i,s));for(var l=1;l<=s;l++){var c=r.cloneNode(!0);c.innerHTML=l<=i?'':'',a.appendChild(c)}return n.style.whiteSpace="nowrap",n.style.overflow="hidden",n.style.textOverflow="ellipsis",n.setAttribute("aria-label",i),a},traffic:function(e,t,o){var i,n,s=this.sanitizeHTML(e.getValue())||0,a=document.createElement("span"),r=t&&t.max?t.max:100,l=t&&t.min?t.min:0,c=t&&void 0!==t.color?t.color:["red","orange","green"],u="#666666";if(!isNaN(s)&&void 0!==e.getValue()){switch(a.classList.add("tabulator-traffic-light"),n=parseFloat(s)<=r?parseFloat(s):r,n=parseFloat(n)>=l?parseFloat(n):l,i=(r-l)/100,n=Math.round((n-l)/i),void 0===c?"undefined":_typeof(c)){case"string":u=c;break;case"function":u=c(s);break;case"object":if(Array.isArray(c)){var d=100/c.length,h=Math.floor(n/d);h=Math.min(h,c.length-1),h=Math.max(h,0),u=c[h];break}}return a.style.backgroundColor=u,a}},progress:function(e,t,o){var i,n,s,a,r,l=this.sanitizeHTML(e.getValue())||0,u=e.getElement(),d=t&&t.max?t.max:100,h=t&&t.min?t.min:0,p=t&&t.legendAlign?t.legendAlign:"center";switch(n=parseFloat(l)<=d?parseFloat(l):d,n=parseFloat(n)>=h?parseFloat(n):h,i=(d-h)/100,n=Math.round((n-h)/i),_typeof(t.color)){case"string":s=t.color;break;case"function":s=t.color(l);break;case"object":if(Array.isArray(t.color)){var m=100/t.color.length,f=Math.floor(n/m);f=Math.min(f,t.color.length-1),f=Math.max(f,0),s=t.color[f];break}default:s="#2DC214"}switch(_typeof(t.legend)){case"string":a=t.legend;break;case"function":a=t.legend(l);break;case"boolean":a=l;break;default:a=!1}switch(_typeof(t.legendColor)){case"string":r=t.legendColor;break;case"function":r=t.legendColor(l);break;case"object":if(Array.isArray(t.legendColor)){var m=100/t.legendColor.length,f=Math.floor(n/m);f=Math.min(f,t.legendColor.length-1),f=Math.max(f,0),r=t.legendColor[f]}break;default:r="#000"}u.style.minWidth="30px",u.style.position="relative",u.setAttribute("aria-label",n);var g=document.createElement("div");if(g.style.display="inline-block",g.style.position="relative",g.style.width=n+"%",g.style.backgroundColor=s,g.style.height="100%",g.setAttribute("data-max",d),g.setAttribute("data-min",h),a){var b=document.createElement("div");b.style.position="absolute",b.style.top="4px",b.style.left=0,b.style.textAlign=p,b.style.width="100%",b.style.color=r,b.innerHTML=a}return o(function(){if(!(e instanceof c)){var t=document.createElement("div");t.style.position="absolute",t.style.top="4px",t.style.bottom="4px",t.style.left="4px",t.style.right="4px",u.appendChild(t),u=t}u.appendChild(g),a&&u.appendChild(b)}),""},color:function(e,t,o){return e.getElement().style.backgroundColor=this.sanitizeHTML(e.getValue()),""},buttonTick:function(e,t,o){return''},buttonCross:function(e,t,o){return''},rownum:function(e,t,o){return this.table.rowManager.activeRows.indexOf(e.getRow()._getSelf())+1},handle:function(e,t,o){return e.getElement().classList.add("tabulator-row-handle"),"
"},responsiveCollapse:function(e,t,o){function i(e){var t=s.element;s.open=e,t&&(s.open?(n.classList.add("open"),t.style.display=""):(n.classList.remove("open"),t.style.display="none"))}var n=document.createElement("div"),s=e.getRow()._row.modules.responsiveLayout;return n.classList.add("tabulator-responsive-collapse-toggle"),n.innerHTML="+-",e.getElement().classList.add("tabulator-row-handle"),n.addEventListener("click",function(e){e.stopImmediatePropagation(),i(!s.open)}),i(s.open),n},rowSelection:function(e,t,o){var i=this,n=document.createElement("input");if(n.type="checkbox",this.table.modExists("selectRow",!0))if(n.addEventListener("click",function(e){e.stopPropagation()}),"function"==typeof e.getRow){var s=e.getRow();s instanceof r?(n.addEventListener("change",function(e){s.toggleSelect()}),n.checked=s.isSelected&&s.isSelected(),this.table.modules.selectRow.registerRowSelectCheckbox(s,n)):n=""}else n.addEventListener("change",function(e){i.table.modules.selectRow.selectedRows.length?i.table.deselectRow():i.table.selectRow(t.rowRange)}),this.table.modules.selectRow.registerHeaderSelectCheckbox(n);return n}},h.prototype.registerModule("format",D);var k=function(e){this.table=e,this.leftColumns=[],this.rightColumns=[],this.leftMargin=0,this.rightMargin=0,this.rightPadding=0,this.initializationMode="left",this.active=!1,this.scrollEndTimer=!1};k.prototype.reset=function(){this.initializationMode="left",this.leftColumns=[],this.rightColumns=[],this.leftMargin=0,this.rightMargin=0,this.rightMargin=0,this.active=!1,this.table.columnManager.headersElement.style.marginLeft=0,this.table.columnManager.element.style.paddingRight=0},k.prototype.initializeColumn=function(e){var t={margin:0,edge:!1};e.isGroup||(this.frozenCheck(e)?(t.position=this.initializationMode,"left"==this.initializationMode?this.leftColumns.push(e):this.rightColumns.unshift(e),this.active=!0,e.modules.frozen=t):this.initializationMode="right")},k.prototype.frozenCheck=function(e){return e.parent.isGroup&&e.definition.frozen&&console.warn("Frozen Column Error - Parent column group must be frozen, not individual columns or sub column groups"),e.parent.isGroup?this.frozenCheck(e.parent):e.definition.frozen},k.prototype.scrollHorizontal=function(){var e,t=this;this.active&&(clearTimeout(this.scrollEndTimer),this.scrollEndTimer=setTimeout(function(){t.layout()},100),e=this.table.rowManager.getVisibleRows(),this.calcMargins(),this.layoutColumnPosition(),this.layoutCalcRows(),e.forEach(function(e){"row"===e.type&&t.layoutRow(e)}),this.table.rowManager.tableElement.style.marginRight=this.rightMargin)},k.prototype.calcMargins=function(){this.leftMargin=this._calcSpace(this.leftColumns,this.leftColumns.length)+"px",this.table.columnManager.headersElement.style.marginLeft=this.leftMargin,this.rightMargin=this._calcSpace(this.rightColumns,this.rightColumns.length)+"px",this.table.columnManager.element.style.paddingRight=this.rightMargin,this.rightPadding=this.table.rowManager.element.clientWidth+this.table.columnManager.scrollLeft},k.prototype.layoutCalcRows=function(){this.table.modExists("columnCalcs")&&(this.table.modules.columnCalcs.topInitialized&&this.table.modules.columnCalcs.topRow&&this.layoutRow(this.table.modules.columnCalcs.topRow),this.table.modules.columnCalcs.botInitialized&&this.table.modules.columnCalcs.botRow&&this.layoutRow(this.table.modules.columnCalcs.botRow))},k.prototype.layoutColumnPosition=function(e){var t=this,o=[];this.leftColumns.forEach(function(i,n){if(i.modules.frozen.margin=t._calcSpace(t.leftColumns,n)+t.table.columnManager.scrollLeft+"px",n==t.leftColumns.length-1?i.modules.frozen.edge=!0:i.modules.frozen.edge=!1,i.parent.isGroup){var s=t.getColGroupParentElement(i);o.includes(s)||(t.layoutElement(s,i),o.push(s)),i.modules.frozen.edge&&s.classList.add("tabulator-frozen-"+i.modules.frozen.position)}else t.layoutElement(i.getElement(),i);e&&i.cells.forEach(function(e){t.layoutElement(e.getElement(),i)})}),this.rightColumns.forEach(function(o,i){o.modules.frozen.margin=t.rightPadding-t._calcSpace(t.rightColumns,i+1)+"px",i==t.rightColumns.length-1?o.modules.frozen.edge=!0:o.modules.frozen.edge=!1,o.parent.isGroup?t.layoutElement(t.getColGroupParentElement(o),o):t.layoutElement(o.getElement(),o),e&&o.cells.forEach(function(e){t.layoutElement(e.getElement(),o)})})},k.prototype.getColGroupParentElement=function(e){return e.parent.isGroup?this.getColGroupParentElement(e.parent):e.getElement()},k.prototype.layout=function(){var e=this;e.active&&(this.calcMargins(),e.table.rowManager.getDisplayRows().forEach(function(t){"row"===t.type&&e.layoutRow(t)}),this.layoutCalcRows(),this.layoutColumnPosition(!0),this.table.rowManager.tableElement.style.marginRight=this.rightMargin)},k.prototype.layoutRow=function(e){var t=this;e.getElement().style.paddingLeft=this.leftMargin,this.leftColumns.forEach(function(o){var i=e.getCell(o);i&&t.layoutElement(i.getElement(),o)}),this.rightColumns.forEach(function(o){var i=e.getCell(o);i&&t.layoutElement(i.getElement(),o)})},k.prototype.layoutElement=function(e,t){t.modules.frozen&&(e.style.position="absolute",e.style.left=t.modules.frozen.margin,e.classList.add("tabulator-frozen"),t.modules.frozen.edge&&e.classList.add("tabulator-frozen-"+t.modules.frozen.position))},k.prototype._calcSpace=function(e,t){for(var o=0,i=0;i-1&&t.splice(o,1)}),t},z.prototype.freezeRow=function(e){e.modules.frozen?console.warn("Freeze Error - Row is already frozen"):(e.modules.frozen=!0,this.topElement.appendChild(e.getElement()),e.initialize(),e.normalizeHeight(),this.table.rowManager.adjustTableSize(),this.rows.push(e),this.table.rowManager.refreshActiveData("display"),this.styleRows())},z.prototype.unfreezeRow=function(e){this.rows.indexOf(e);e.modules.frozen?(e.modules.frozen=!1,this.detachRow(e),this.table.rowManager.adjustTableSize(),this.table.rowManager.refreshActiveData("display"),this.rows.length&&this.styleRows()):console.warn("Freeze Error - Row is already unfrozen")},z.prototype.detachRow=function(e){var t=this.rows.indexOf(e);if(t>-1){var o=e.getElement();o.parentNode.removeChild(o),this.rows.splice(t,1)}},z.prototype.styleRows=function(e){var t=this;this.rows.forEach(function(e,o){t.table.rowManager.styleRow(e,o)})},h.prototype.registerModule("frozenRows",z);var S=function(e){this._group=e,this.type="GroupComponent"};S.prototype.getKey=function(){return this._group.key},S.prototype.getField=function(){return this._group.field},S.prototype.getElement=function(){return this._group.element},S.prototype.getRows=function(){return this._group.getRows(!0)},S.prototype.getSubGroups=function(){return this._group.getSubGroups(!0)},S.prototype.getParentGroup=function(){return!!this._group.parent&&this._group.parent.getComponent()},S.prototype.getVisibility=function(){return console.warn("getVisibility function is deprecated, you should now use the isVisible function"),this._group.visible},S.prototype.isVisible=function(){return this._group.visible},S.prototype.show=function(){this._group.show()},S.prototype.hide=function(){this._group.hide()},S.prototype.toggle=function(){this._group.toggleVisibility()},S.prototype._getSelf=function(){return this._group},S.prototype.getTable=function(){return this._group.groupManager.table};var H=function(e,t,o,i,n,s,a){this.groupManager=e,this.parent=t,this.key=i,this.level=o,this.field=n,this.hasSubGroups=o-1?o?this.rows.splice(n+1,0,e):this.rows.splice(n,0,e):o?this.rows.push(e):this.rows.unshift(e),e.modules.group=this,this.generateGroupHeaderContents(),this.groupManager.table.modExists("columnCalcs")&&"table"!=this.groupManager.table.options.columnCalcs&&this.groupManager.table.modules.columnCalcs.recalcGroup(this),this.groupManager.updateGroupRows(!0)},H.prototype.scrollHeader=function(e){this.arrowElement.style.marginLeft=e,this.groupList.forEach(function(t){t.scrollHeader(e)})},H.prototype.getRowIndex=function(e){},H.prototype.conformRowData=function(e){return this.field?e[this.field]=this.key:console.warn("Data Conforming Error - Cannot conform row data to match new group as groupBy is a function"),this.parent&&(e=this.parent.conformRowData(e)),e},H.prototype.removeRow=function(e){var t=this.rows.indexOf(e),o=e.getElement();t>-1&&this.rows.splice(t,1),this.groupManager.table.options.groupValues||this.rows.length?(o.parentNode&&o.parentNode.removeChild(o),this.generateGroupHeaderContents(),this.groupManager.table.modExists("columnCalcs")&&"table"!=this.groupManager.table.options.columnCalcs&&this.groupManager.table.modules.columnCalcs.recalcGroup(this)):(this.parent?this.parent.removeGroup(this):this.groupManager.removeGroup(this),this.groupManager.updateGroupRows(!0))},H.prototype.removeGroup=function(e){var t,o=e.level+"_"+e.key;this.groups[o]&&(delete this.groups[o],t=this.groupList.indexOf(e),t>-1&&this.groupList.splice(t,1),this.groupList.length||(this.parent?this.parent.removeGroup(this):this.groupManager.removeGroup(this)))},H.prototype.getHeadersAndRows=function(e){var t=[];return t.push(this),this._visSet(),this.visible?this.groupList.length?this.groupList.forEach(function(o){t=t.concat(o.getHeadersAndRows(e))}):(!e&&"table"!=this.groupManager.table.options.columnCalcs&&this.groupManager.table.modExists("columnCalcs")&&this.groupManager.table.modules.columnCalcs.hasTopCalcs()&&(this.calcs.top&&(this.calcs.top.detachElement(),this.calcs.top.deleteCells()),this.calcs.top=this.groupManager.table.modules.columnCalcs.generateTopRow(this.rows),t.push(this.calcs.top)),t=t.concat(this.rows),!e&&"table"!=this.groupManager.table.options.columnCalcs&&this.groupManager.table.modExists("columnCalcs")&&this.groupManager.table.modules.columnCalcs.hasBottomCalcs()&&(this.calcs.bottom&&(this.calcs.bottom.detachElement(),this.calcs.bottom.deleteCells()),this.calcs.bottom=this.groupManager.table.modules.columnCalcs.generateBottomRow(this.rows),t.push(this.calcs.bottom))):this.groupList.length||"table"==this.groupManager.table.options.columnCalcs||this.groupManager.table.modExists("columnCalcs")&&(!e&&this.groupManager.table.modules.columnCalcs.hasTopCalcs()&&(this.calcs.top&&(this.calcs.top.detachElement(),this.calcs.top.deleteCells()),this.groupManager.table.options.groupClosedShowCalcs&&(this.calcs.top=this.groupManager.table.modules.columnCalcs.generateTopRow(this.rows),t.push(this.calcs.top))),!e&&this.groupManager.table.modules.columnCalcs.hasBottomCalcs()&&(this.calcs.bottom&&(this.calcs.bottom.detachElement(),this.calcs.bottom.deleteCells()),this.groupManager.table.options.groupClosedShowCalcs&&(this.calcs.bottom=this.groupManager.table.modules.columnCalcs.generateBottomRow(this.rows),t.push(this.calcs.bottom)))),t},H.prototype.getData=function(e,t){var o=[];return this._visSet(),(!e||e&&this.visible)&&this.rows.forEach(function(e){o.push(e.getData(t||"data"))}),o},H.prototype.getRowCount=function(){var e=0;return this.groupList.length?this.groupList.forEach(function(t){e+=t.getRowCount()}):e=this.rows.length,e},H.prototype.toggleVisibility=function(){this.visible?this.hide():this.show()},H.prototype.hide=function(){this.visible=!1,"classic"!=this.groupManager.table.rowManager.getRenderMode()||this.groupManager.table.options.pagination?this.groupManager.updateGroupRows(!0):(this.element.classList.remove("tabulator-group-visible"),this.groupList.length?this.groupList.forEach(function(e){e.getHeadersAndRows().forEach(function(e){e.detachElement()})}):this.rows.forEach(function(e){var t=e.getElement();t.parentNode.removeChild(t)}),this.groupManager.table.rowManager.setDisplayRows(this.groupManager.updateGroupRows(),this.groupManager.getDisplayIndex()),this.groupManager.table.rowManager.checkClassicModeGroupHeaderWidth()),this.groupManager.table.options.groupVisibilityChanged.call(this.table,this.getComponent(),!1)},H.prototype.show=function(){var e=this;if(e.visible=!0,"classic"!=this.groupManager.table.rowManager.getRenderMode()||this.groupManager.table.options.pagination)this.groupManager.updateGroupRows(!0);else{this.element.classList.add("tabulator-group-visible");var t=e.getElement();this.groupList.length?this.groupList.forEach(function(e){e.getHeadersAndRows().forEach(function(e){var o=e.getElement();t.parentNode.insertBefore(o,t.nextSibling),e.initialize(),t=o})}):e.rows.forEach(function(e){var o=e.getElement();t.parentNode.insertBefore(o,t.nextSibling),e.initialize(),t=o}),this.groupManager.table.rowManager.setDisplayRows(this.groupManager.updateGroupRows(),this.groupManager.getDisplayIndex()),this.groupManager.table.rowManager.checkClassicModeGroupHeaderWidth()}this.groupManager.table.options.groupVisibilityChanged.call(this.table,this.getComponent(),!0)},H.prototype._visSet=function(){var e=[];"function"==typeof this.visible&&(this.rows.forEach(function(t){e.push(t.getData())}),this.visible=this.visible(this.key,this.getRowCount(),e,this.getComponent()))},H.prototype.getRowGroup=function(e){var t=!1;return this.groupList.length?this.groupList.forEach(function(o){var i=o.getRowGroup(e);i&&(t=i)}):this.rows.find(function(t){return t===e})&&(t=this),t},H.prototype.getSubGroups=function(e){var t=[];return this.groupList.forEach(function(o){t.push(e?o.getComponent():o)}),t},H.prototype.getRows=function(e){var t=[];return this.rows.forEach(function(o){t.push(e?o.getComponent():o)}),t},H.prototype.generateGroupHeaderContents=function(){var e=[];for(this.rows.forEach(function(t){e.push(t.getData())}),this.elementContents=this.generator(this.key,this.getRowCount(),e,this.getComponent());this.element.firstChild;)this.element.removeChild(this.element.firstChild);"string"==typeof this.elementContents?this.element.innerHTML=this.elementContents:this.element.appendChild(this.elementContents),this.element.insertBefore(this.arrowElement,this.element.firstChild)},H.prototype.getPath=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return e.unshift(this.key),this.parent&&this.parent.getPath(e),e},H.prototype.getElement=function(){this.addBindingsd=!1,this._visSet(),this.visible?this.element.classList.add("tabulator-group-visible"):this.element.classList.remove("tabulator-group-visible");for(var e=0;ei.length&&console.warn("Error creating group headers, groupHeader array is shorter than groupBy array"),e.headerGenerator=[function(){return""}],this.startOpen=[function(){return!1}],e.table.modules.localize.bind("groups|item",function(t,o){e.headerGenerator[0]=function(e,i,n){return(void 0===e?"":e)+"("+i+" "+(1===i?t:o.groups.items)+")"}}),this.groupIDLookups=[],Array.isArray(t)||t)this.table.modExists("columnCalcs")&&"table"!=this.table.options.columnCalcs&&"both"!=this.table.options.columnCalcs&&this.table.modules.columnCalcs.removeCalcs();else if(this.table.modExists("columnCalcs")&&"group"!=this.table.options.columnCalcs){var n=this.table.columnManager.getRealColumns();n.forEach(function(t){t.definition.topCalc&&e.table.modules.columnCalcs.initializeTopRow(),t.definition.bottomCalc&&e.table.modules.columnCalcs.initializeBottomRow()})}Array.isArray(t)||(t=[t]),t.forEach(function(t,o){var i,n;"function"==typeof t?i=t:(n=e.table.columnManager.getColumnByField(t),i=n?function(e){return n.getFieldValue(e)}:function(e){return e[t]}),e.groupIDLookups.push({field:"function"!=typeof t&&t,func:i,values:!!e.allowedValues&&e.allowedValues[o]})}),o&&(Array.isArray(o)||(o=[o]),o.forEach(function(e){e="function"==typeof e?e:function(){return!0}}),e.startOpen=o),i&&(e.headerGenerator=Array.isArray(i)?i:[i]),this.initialized=!0},P.prototype.setDisplayIndex=function(e){this.displayIndex=e},P.prototype.getDisplayIndex=function(){return this.displayIndex},P.prototype.getRows=function(e){return this.groupIDLookups.length?(this.table.options.dataGrouping.call(this.table),this.generateGroups(e),this.table.options.dataGrouped&&this.table.options.dataGrouped.call(this.table,this.getGroups(!0)),this.updateGroupRows()):e.slice(0)},P.prototype.getGroups=function(e){var t=[];return this.groupList.forEach(function(o){t.push(e?o.getComponent():o)}),t},P.prototype.getChildGroups=function(e){var t=this,o=[];return e||(e=this),e.groupList.forEach(function(e){e.groupList.length?o=o.concat(t.getChildGroups(e)):o.push(e)}),o},P.prototype.wipe=function(){this.groupList.forEach(function(e){e.wipe()})},P.prototype.pullGroupListData=function(e){var t=this,o=[];return e.forEach(function(e){var i={};i.level=0,i.rowCount=0,i.headerContent="";var n=[];e.hasSubGroups?(n=t.pullGroupListData(e.groupList),i.level=e.level,i.rowCount=n.length-e.groupList.length,i.headerContent=e.generator(e.key,i.rowCount,e.rows,e),o.push(i),o=o.concat(n)):(i.level=e.level,i.headerContent=e.generator(e.key,e.rows.length,e.rows,e),i.rowCount=e.getRows().length,o.push(i),e.getRows().forEach(function(e){o.push(e.getData("data"))}))}),o},P.prototype.getGroupedData=function(){return this.pullGroupListData(this.groupList)},P.prototype.getRowGroup=function(e){var t=!1;return this.groupList.forEach(function(o){var i=o.getRowGroup(e);i&&(t=i)}),t},P.prototype.countGroups=function(){return this.groupList.length},P.prototype.generateGroups=function(e){var t=this,o=t.groups;t.groups={},t.groupList=[],this.allowedValues&&this.allowedValues[0]?(this.allowedValues[0].forEach(function(e){t.createGroup(e,0,o)}),e.forEach(function(e){t.assignRowToExistingGroup(e,o)})):e.forEach(function(e){t.assignRowToGroup(e,o)})},P.prototype.createGroup=function(e,t,o){var i,n=t+"_"+e;o=o||[],i=new H(this,!1,t,e,this.groupIDLookups[0].field,this.headerGenerator[0],o[n]),this.groups[n]=i,this.groupList.push(i)},P.prototype.assignRowToExistingGroup=function(e,t){var o=this.groupIDLookups[0].func(e.getData()),i="0_"+o;this.groups[i]&&this.groups[i].addRow(e)},P.prototype.assignRowToGroup=function(e,t){var o=this.groupIDLookups[0].func(e.getData()),i=!this.groups["0_"+o];return i&&this.createGroup(o,0,t),this.groups["0_"+o].addRow(e),!i},P.prototype.reassignRowToGroup=function(e){var t=e.getGroup(),o=t.getPath(),i=this.getExpectedPath(e);o.length==i.length&&o.every(function(e,t){return e===i[t]})||(t.removeRow(e),this.assignRowToGroup(e,self.groups),this.table.rowManager.refreshActiveData("group",!1,!0))},P.prototype.getExpectedPath=function(e){var t=[],o=e.getData();return this.groupIDLookups.forEach(function(e){t.push(e.func(o))}),t},P.prototype.updateGroupRows=function(e){var t=this,o=[];if(t.groupList.forEach(function(e){o=o.concat(e.getHeadersAndRows())}),e){var i=t.table.rowManager.setDisplayRows(o,this.getDisplayIndex());!0!==i&&this.setDisplayIndex(i),t.table.rowManager.refreshActiveData("group",!0,!0)}return o},P.prototype.scrollHeaders=function(e){this.table.options.virtualDomHoz&&(e-=this.table.vdomHoz.vDomPadLeft),e+="px",this.groupList.forEach(function(t){t.scrollHeader(e)})},P.prototype.removeGroup=function(e){var t,o=e.level+"_"+e.key;this.groups[o]&&(delete this.groups[o],(t=this.groupList.indexOf(e))>-1&&this.groupList.splice(t,1))},h.prototype.registerModule("groupRows",P);var A=function(e){this.table=e,this.history=[],this.index=-1};A.prototype.clear=function(){this.history=[],this.index=-1},A.prototype.action=function(e,t,o){this.history=this.history.slice(0,this.index+1),this.history.push({type:e,component:t,data:o}),this.index++},A.prototype.getHistoryUndoSize=function(){return this.index+1},A.prototype.getHistoryRedoSize=function(){return this.history.length-(this.index+1)},A.prototype.clearComponentHistory=function(e){var t=this.history.findIndex(function(t){return t.component===e});t>-1&&(this.history.splice(t,1),t<=this.index&&this.index--,this.clearComponentHistory(e))},A.prototype.undo=function(){if(this.index>-1){var e=this.history[this.index];return this.undoers[e.type].call(this,e),this.index--,this.table.options.historyUndo.call(this.table,e.type,e.component.getComponent(),e.data),!0}return console.warn("History Undo Error - No more history to undo"),!1},A.prototype.redo=function(){if(this.history.length-1>this.index){this.index++;var e=this.history[this.index];return this.redoers[e.type].call(this,e),this.table.options.historyRedo.call(this.table,e.type,e.component.getComponent(),e.data),!0}return console.warn("History Redo Error - No more history to redo"),!1},A.prototype.undoers={cellEdit:function(e){e.component.setValueProcessData(e.data.oldValue)},rowAdd:function(e){e.component.deleteActual()},rowDelete:function(e){var t=this.table.rowManager.addRowActual(e.data.data,e.data.pos,e.data.index);this.table.options.groupBy&&this.table.modExists("groupRows")&&this.table.modules.groupRows.updateGroupRows(!0),this._rebindRow(e.component,t)},rowMove:function(e){this.table.rowManager.moveRowActual(e.component,this.table.rowManager.rows[e.data.posFrom],!e.data.after),this.table.rowManager.redraw()}},A.prototype.redoers={cellEdit:function(e){e.component.setValueProcessData(e.data.newValue)},rowAdd:function(e){var t=this.table.rowManager.addRowActual(e.data.data,e.data.pos,e.data.index);this.table.options.groupBy&&this.table.modExists("groupRows")&&this.table.modules.groupRows.updateGroupRows(!0),this._rebindRow(e.component,t)},rowDelete:function(e){e.component.deleteActual()},rowMove:function(e){this.table.rowManager.moveRowActual(e.component,this.table.rowManager.rows[e.data.posTo],e.data.after),this.table.rowManager.redraw()}},A.prototype._rebindRow=function(e,t){this.history.forEach(function(o){if(o.component instanceof l)o.component===e&&(o.component=t);else if(o.component instanceof u&&o.component.row===e){var i=o.component.column.getField();i&&(o.component=t.getCell(i))}})},h.prototype.registerModule("history",A);var _=function(e){this.table=e,this.fieldIndex=[],this.hasIndex=!1};_.prototype.parseTable=function(){var e=this,t=e.table.element,o=e.table.options,i=(o.columns,t.getElementsByTagName("th")),n=t.getElementsByTagName("tbody")[0],s=[];e.hasIndex=!1,e.table.options.htmlImporting.call(this.table),n=n?n.getElementsByTagName("tr"):[],e._extractOptions(t,o),i.length?e._extractHeaders(i,n):e._generateBlankHeaders(i,n);for(var a=0;a-1&&e.pressedKeys.splice(i,1)}},this.table.element.addEventListener("keydown",this.keyupBinding),this.table.element.addEventListener("keyup",this.keydownBinding)},F.prototype.clearBindings=function(){this.keyupBinding&&this.table.element.removeEventListener("keydown",this.keyupBinding),this.keydownBinding&&this.table.element.removeEventListener("keyup",this.keydownBinding)},F.prototype.checkBinding=function(e,t){var o=this,i=!0;return e.ctrlKey==t.ctrl&&e.shiftKey==t.shift&&e.metaKey==t.meta&&(t.keys.forEach(function(e){-1==o.pressedKeys.indexOf(e)&&(i=!1)}),i&&t.action.call(o,e),!0)},F.prototype.bindings={navPrev:"shift + 9",navNext:9,navUp:38,navDown:40,scrollPageUp:33,scrollPageDown:34,scrollToStart:36,scrollToEnd:35,undo:"ctrl + 90",redo:"ctrl + 89",copyToClipboard:"ctrl + 67"},F.prototype.actions={keyBlock:function(e){e.stopPropagation(),e.preventDefault()},scrollPageUp:function(e){var t=this.table.rowManager,o=t.scrollTop-t.height;t.element.scrollHeight;e.preventDefault(),t.displayRowsCount&&(o>=0?t.element.scrollTop=o:t.scrollToRow(t.getDisplayRows()[0])),this.table.element.focus()},scrollPageDown:function(e){var t=this.table.rowManager,o=t.scrollTop+t.height,i=t.element.scrollHeight;e.preventDefault(),t.displayRowsCount&&(o<=i?t.element.scrollTop=o:t.scrollToRow(t.getDisplayRows()[t.displayRowsCount-1])),this.table.element.focus()},scrollToStart:function(e){var t=this.table.rowManager;e.preventDefault(),t.displayRowsCount&&t.scrollToRow(t.getDisplayRows()[0]),this.table.element.focus()},scrollToEnd:function(e){var t=this.table.rowManager;e.preventDefault(),t.displayRowsCount&&t.scrollToRow(t.getDisplayRows()[t.displayRowsCount-1]),this.table.element.focus()},navPrev:function(e){var t=!1;this.table.modExists("edit")&&(t=this.table.modules.edit.currentCell)&&(e.preventDefault(),t.nav().prev())},navNext:function(e){var t,o=!1,i=this.table.options.tabEndNewRow;this.table.modExists("edit")&&(o=this.table.modules.edit.currentCell)&&(e.preventDefault(),t=o.nav(),t.next()||i&&(o.getElement().firstChild.blur(),i=!0===i?this.table.addRow({}):"function"==typeof i?this.table.addRow(i(o.row.getComponent())):this.table.addRow(Object.assign({},i)),i.then(function(){setTimeout(function(){t.next()})})))},navLeft:function(e){var t=!1;this.table.modExists("edit")&&(t=this.table.modules.edit.currentCell)&&(e.preventDefault(),t.nav().left())},navRight:function(e){var t=!1;this.table.modExists("edit")&&(t=this.table.modules.edit.currentCell)&&(e.preventDefault(),t.nav().right())},navUp:function(e){var t=!1;this.table.modExists("edit")&&(t=this.table.modules.edit.currentCell)&&(e.preventDefault(),t.nav().up())},navDown:function(e){var t=!1;this.table.modExists("edit")&&(t=this.table.modules.edit.currentCell)&&(e.preventDefault(),t.nav().down())},undo:function(e){this.table.options.history&&this.table.modExists("history")&&this.table.modExists("edit")&&(this.table.modules.edit.currentCell||(e.preventDefault(),this.table.modules.history.undo()))},redo:function(e){this.table.options.history&&this.table.modExists("history")&&this.table.modExists("edit")&&(this.table.modules.edit.currentCell||(e.preventDefault(),this.table.modules.history.redo()))},copyToClipboard:function(e){this.table.modules.edit.currentCell||this.table.modExists("clipboard",!0)&&this.table.modules.clipboard.copy(!1,!0)}},h.prototype.registerModule("keybindings",F);var N=function(e){this.table=e,this.menuEl=!1,this.blurEvent=this.hideMenu.bind(this),this.escEvent=this.escMenu.bind(this),this.nestedMenuBlock=!1};N.prototype.initializeColumnHeader=function(e){var t,o=this;e.definition.headerContextMenu&&(e.getElement().addEventListener("contextmenu",this.LoadMenuEvent.bind(this,e,e.definition.headerContextMenu)),this.tapHold(e,e.definition.headerContextMenu)),e.definition.headerMenu&&(t=document.createElement("span"),t.classList.add("tabulator-header-menu-button"),t.innerHTML="⋮",t.addEventListener("click",function(t){var i="function"==typeof e.definition.headerMenu?e.definition.headerMenu(e.getComponent(),t):e.definition.headerMenu;t.stopPropagation(),t.preventDefault(),o.loadMenu(t,e,i)}),e.titleElement.insertBefore(t,e.titleElement.firstChild))},N.prototype.LoadMenuEvent=function(e,t,o){t="function"==typeof t?t(e.getComponent(),o):t,this.loadMenu(o,e,t)},N.prototype.tapHold=function(e,t){var o=this,i=e.getElement(),n=null,s=!1;i.addEventListener("touchstart",function(i){clearTimeout(n),s=!1,n=setTimeout(function(){clearTimeout(n),n=null,s=!0,o.LoadMenuEvent(e,t,i)},1e3)},{passive:!0}),i.addEventListener("touchend",function(e){clearTimeout(n),n=null,s&&e.preventDefault()})},N.prototype.initializeCell=function(e){e.column.definition.contextMenu&&(e.getElement().addEventListener("contextmenu",this.LoadMenuEvent.bind(this,e,e.column.definition.contextMenu)),this.tapHold(e,e.column.definition.contextMenu)),e.column.definition.clickMenu&&e.getElement().addEventListener("click",this.LoadMenuEvent.bind(this,e,e.column.definition.clickMenu))},N.prototype.initializeRow=function(e){this.table.options.rowContextMenu&&(e.getElement().addEventListener("contextmenu",this.LoadMenuEvent.bind(this,e,this.table.options.rowContextMenu)),this.tapHold(e,this.table.options.rowContextMenu)),this.table.options.rowClickMenu&&e.getElement().addEventListener("click",this.LoadMenuEvent.bind(this,e,this.table.options.rowClickMenu))},N.prototype.initializeGroup=function(e){this.table.options.groupContextMenu&&(e.getElement().addEventListener("contextmenu",this.LoadMenuEvent.bind(this,e,this.table.options.groupContextMenu)),this.tapHold(e,this.table.options.groupContextMenu)),this.table.options.groupClickMenu&&e.getElement().addEventListener("click",this.LoadMenuEvent.bind(this,e,this.table.options.groupClickMenu))},N.prototype.loadMenu=function(e,t,o){var i=this,n=Math.max(document.body.offsetHeight,window.innerHeight),s=!(e instanceof MouseEvent);if(s||e.preventDefault(),o&&o.length){if(this.nestedMenuBlock){if(this.isOpen())return}else this.nestedMenuBlock=setTimeout(function(){i.nestedMenuBlock=!1},100);this.hideMenu(),this.menuEl=document.createElement("div"),this.menuEl.classList.add("tabulator-menu"),o.forEach(function(e){var o=document.createElement("div"),n=e.label,s=e.disabled;e.separator?o.classList.add("tabulator-menu-separator"):(o.classList.add("tabulator-menu-item"),"function"==typeof n&&(n=n(t.getComponent())),n instanceof Node?o.appendChild(n):o.innerHTML=n,"function"==typeof s&&(s=s(t.getComponent())),s?(o.classList.add("tabulator-menu-item-disabled"),o.addEventListener("click",function(e){e.stopPropagation()})):o.addEventListener("click",function(o){i.hideMenu(),e.action(o,t.getComponent())})),i.menuEl.appendChild(o)}),this.menuEl.style.top=(s?e.touches[0].pageY:e.pageY)+"px",this.menuEl.style.left=(s?e.touches[0].pageX:e.pageX)+"px",setTimeout(function(){i.table.rowManager.element.addEventListener("scroll",i.blurEvent),document.body.addEventListener("click",i.blurEvent),document.body.addEventListener("contextmenu",i.blurEvent),document.body.addEventListener("keydown",i.escEvent)},100),document.body.appendChild(this.menuEl),e.pageX+this.menuEl.offsetWidth>=document.body.offsetWidth&&(this.menuEl.style.left="",this.menuEl.style.right=document.body.offsetWidth-e.pageX+"px"),e.pageY+this.menuEl.offsetHeight>=n&&(this.menuEl.style.top="",this.menuEl.style.bottom=n-e.pageY+"px")}},N.prototype.isOpen=function(){return!!this.menuEl.parentNode},N.prototype.escMenu=function(e){27==e.keyCode&&this.hideMenu()},N.prototype.hideMenu=function(){this.menuEl.parentNode&&this.menuEl.parentNode.removeChild(this.menuEl),this.escEvent&&document.body.removeEventListener("keydown",this.escEvent),this.blurEvent&&(document.body.removeEventListener("click",this.blurEvent),document.body.removeEventListener("contextmenu",this.blurEvent),this.table.rowManager.element.removeEventListener("scroll",this.blurEvent))},N.prototype.menus={},h.prototype.registerModule("menu",N);var B=function(e){this.table=e,this.placeholderElement=this.createPlaceholderElement(),this.hoverElement=!1,this.checkTimeout=!1,this.checkPeriod=250,this.moving=!1,this.toCol=!1,this.toColAfter=!1,this.startX=0,this.autoScrollMargin=40,this.autoScrollStep=5,this.autoScrollTimeout=!1,this.touchMove=!1,this.moveHover=this.moveHover.bind(this),this.endMove=this.endMove.bind(this)};B.prototype.createPlaceholderElement=function(){var e=document.createElement("div");return e.classList.add("tabulator-col"),e.classList.add("tabulator-col-placeholder"),e},B.prototype.initializeColumn=function(e){var t,o=this,i={};e.modules.frozen||(t=e.getElement(),i.mousemove=function(i){e.parent===o.moving.parent&&((o.touchMove?i.touches[0].pageX:i.pageX)-h.prototype.helpers.elOffset(t).left+o.table.columnManager.element.scrollLeft>e.getWidth()/2?o.toCol===e&&o.toColAfter||(t.parentNode.insertBefore(o.placeholderElement,t.nextSibling),o.moveColumn(e,!0)):(o.toCol!==e||o.toColAfter)&&(t.parentNode.insertBefore(o.placeholderElement,t),o.moveColumn(e,!1)))}.bind(o),t.addEventListener("mousedown",function(t){o.touchMove=!1,1===t.which&&(o.checkTimeout=setTimeout(function(){o.startMove(t,e)},o.checkPeriod))}),t.addEventListener("mouseup",function(e){1===e.which&&o.checkTimeout&&clearTimeout(o.checkTimeout)}),o.bindTouchEvents(e)),e.modules.moveColumn=i},B.prototype.bindTouchEvents=function(e){var t,o,i,n,s,a,r,l=this,c=e.getElement(),u=!1;c.addEventListener("touchstart",function(c){l.checkTimeout=setTimeout(function(){l.touchMove=!0,t=e,o=e.nextColumn(),n=o?o.getWidth()/2:0,i=e.prevColumn(),s=i?i.getWidth()/2:0,a=0,r=0,u=!1,l.startMove(c,e)},l.checkPeriod)},{passive:!0}),c.addEventListener("touchmove",function(c){var d,h;l.moving&&(l.moveHover(c),u||(u=c.touches[0].pageX),d=c.touches[0].pageX-u,d>0?o&&d-a>n&&(h=o)!==e&&(u=c.touches[0].pageX,h.getElement().parentNode.insertBefore(l.placeholderElement,h.getElement().nextSibling),l.moveColumn(h,!0)):i&&-d-r>s&&(h=i)!==e&&(u=c.touches[0].pageX,h.getElement().parentNode.insertBefore(l.placeholderElement,h.getElement()),l.moveColumn(h,!1)),h&&(t=h,o=h.nextColumn(),a=n,n=o?o.getWidth()/2:0,i=h.prevColumn(),r=s,s=i?i.getWidth()/2:0))},{passive:!0}),c.addEventListener("touchend",function(e){l.checkTimeout&&clearTimeout(l.checkTimeout),l.moving&&l.endMove(e)})},B.prototype.startMove=function(e,t){var o=t.getElement();this.moving=t,this.startX=(this.touchMove?e.touches[0].pageX:e.pageX)-h.prototype.helpers.elOffset(o).left,this.table.element.classList.add("tabulator-block-select"),this.placeholderElement.style.width=t.getWidth()+"px",this.placeholderElement.style.height=t.getHeight()+"px",o.parentNode.insertBefore(this.placeholderElement,o),o.parentNode.removeChild(o),this.hoverElement=o.cloneNode(!0),this.hoverElement.classList.add("tabulator-moving"),this.table.columnManager.getElement().appendChild(this.hoverElement),this.hoverElement.style.left="0",this.hoverElement.style.bottom="0",this.touchMove||(this._bindMouseMove(),document.body.addEventListener("mousemove",this.moveHover),document.body.addEventListener("mouseup",this.endMove)),this.moveHover(e)},B.prototype._bindMouseMove=function(){this.table.columnManager.columnsByIndex.forEach(function(e){e.modules.moveColumn.mousemove&&e.getElement().addEventListener("mousemove",e.modules.moveColumn.mousemove)})},B.prototype._unbindMouseMove=function(){this.table.columnManager.columnsByIndex.forEach(function(e){e.modules.moveColumn.mousemove&&e.getElement().removeEventListener("mousemove",e.modules.moveColumn.mousemove)})},B.prototype.moveColumn=function(e,t){var o=this.moving.getCells();this.toCol=e,this.toColAfter=t,t?e.getCells().forEach(function(e,t){var i=e.getElement();i.parentNode.insertBefore(o[t].getElement(),i.nextSibling)}):e.getCells().forEach(function(e,t){var i=e.getElement();i.parentNode.insertBefore(o[t].getElement(),i)})},B.prototype.endMove=function(e){(1===e.which||this.touchMove)&&(this._unbindMouseMove(),this.placeholderElement.parentNode.insertBefore(this.moving.getElement(),this.placeholderElement.nextSibling),this.placeholderElement.parentNode.removeChild(this.placeholderElement), +this.hoverElement.parentNode.removeChild(this.hoverElement),this.table.element.classList.remove("tabulator-block-select"),this.toCol&&this.table.columnManager.moveColumnActual(this.moving,this.toCol,this.toColAfter),this.moving=!1,this.toCol=!1,this.toColAfter=!1,this.touchMove||(document.body.removeEventListener("mousemove",this.moveHover),document.body.removeEventListener("mouseup",this.endMove)))},B.prototype.moveHover=function(e){var t,o=this,i=o.table.columnManager.getElement(),n=i.scrollLeft,s=(o.touchMove?e.touches[0].pageX:e.pageX)-h.prototype.helpers.elOffset(i).left+n;o.hoverElement.style.left=s-o.startX+"px",s-ne.getHeight()/2){if(t.toRow!==e||!t.toRowAfter){var i=e.getElement();i.parentNode.insertBefore(t.placeholderElement,i.nextSibling),t.moveRow(e,!0)}}else if(t.toRow!==e||t.toRowAfter){var i=e.getElement();i.previousSibling&&(i.parentNode.insertBefore(t.placeholderElement,i),t.moveRow(e,!1))}}.bind(t),e.modules.moveRow=o},O.prototype.initializeRow=function(e){var t,o=this,i={};i.mouseup=function(t){o.tableRowDrop(t,e)}.bind(o),i.mousemove=function(t){if(t.pageY-h.prototype.helpers.elOffset(e.element).top+o.table.rowManager.element.scrollTop>e.getHeight()/2){if(o.toRow!==e||!o.toRowAfter){var i=e.getElement();i.parentNode.insertBefore(o.placeholderElement,i.nextSibling),o.moveRow(e,!0)}}else if(o.toRow!==e||o.toRowAfter){var i=e.getElement();i.parentNode.insertBefore(o.placeholderElement,i),o.moveRow(e,!1)}}.bind(o),this.hasHandle||(t=e.getElement(),t.addEventListener("mousedown",function(t){1===t.which&&(o.checkTimeout=setTimeout(function(){o.startMove(t,e)},o.checkPeriod))}),t.addEventListener("mouseup",function(e){1===e.which&&o.checkTimeout&&clearTimeout(o.checkTimeout)}),this.bindTouchEvents(e,e.getElement())),e.modules.moveRow=i},O.prototype.initializeCell=function(e){var t=this,o=e.getElement();o.addEventListener("mousedown",function(o){1===o.which&&(t.checkTimeout=setTimeout(function(){t.startMove(o,e.row)},t.checkPeriod))}),o.addEventListener("mouseup",function(e){1===e.which&&t.checkTimeout&&clearTimeout(t.checkTimeout)}),this.bindTouchEvents(e.row,e.getElement())},O.prototype.bindTouchEvents=function(e,t){var o,i,n,s,a,r,l,c=this,u=!1;t.addEventListener("touchstart",function(t){c.checkTimeout=setTimeout(function(){c.touchMove=!0,o=e,i=e.nextRow(),s=i?i.getHeight()/2:0,n=e.prevRow(),a=n?n.getHeight()/2:0,r=0,l=0,u=!1,c.startMove(t,e)},c.checkPeriod)},{passive:!0}),this.moving,this.toRow,this.toRowAfter,t.addEventListener("touchmove",function(t){var d,h;c.moving&&(t.preventDefault(),c.moveHover(t),u||(u=t.touches[0].pageY),d=t.touches[0].pageY-u,d>0?i&&d-r>s&&(h=i)!==e&&(u=t.touches[0].pageY,h.getElement().parentNode.insertBefore(c.placeholderElement,h.getElement().nextSibling),c.moveRow(h,!0)):n&&-d-l>a&&(h=n)!==e&&(u=t.touches[0].pageY,h.getElement().parentNode.insertBefore(c.placeholderElement,h.getElement()),c.moveRow(h,!1)),h&&(o=h,i=h.nextRow(),r=s,s=i?i.getHeight()/2:0,n=h.prevRow(),l=a,a=n?n.getHeight()/2:0))}),t.addEventListener("touchend",function(e){c.checkTimeout&&clearTimeout(c.checkTimeout),c.moving&&(c.endMove(e),c.touchMove=!1)})},O.prototype._bindMouseMove=function(){this.table.rowManager.getDisplayRows().forEach(function(e){"row"!==e.type&&"group"!==e.type||!e.modules.moveRow.mousemove||e.getElement().addEventListener("mousemove",e.modules.moveRow.mousemove)})},O.prototype._unbindMouseMove=function(){this.table.rowManager.getDisplayRows().forEach(function(e){"row"!==e.type&&"group"!==e.type||!e.modules.moveRow.mousemove||e.getElement().removeEventListener("mousemove",e.modules.moveRow.mousemove)})},O.prototype.startMove=function(e,t){var o=t.getElement();this.setStartPosition(e,t),this.moving=t,this.table.element.classList.add("tabulator-block-select"),this.placeholderElement.style.width=t.getWidth()+"px",this.placeholderElement.style.height=t.getHeight()+"px",this.connection?(this.table.element.classList.add("tabulator-movingrow-sending"),this.connectToTables(t)):(o.parentNode.insertBefore(this.placeholderElement,o),o.parentNode.removeChild(o)),this.hoverElement=o.cloneNode(!0),this.hoverElement.classList.add("tabulator-moving"),this.connection?(document.body.appendChild(this.hoverElement),this.hoverElement.style.left="0",this.hoverElement.style.top="0",this.hoverElement.style.width=this.table.element.clientWidth+"px",this.hoverElement.style.whiteSpace="nowrap",this.hoverElement.style.overflow="hidden",this.hoverElement.style.pointerEvents="none"):(this.table.rowManager.getTableElement().appendChild(this.hoverElement),this.hoverElement.style.left="0",this.hoverElement.style.top="0",this._bindMouseMove()),document.body.addEventListener("mousemove",this.moveHover),document.body.addEventListener("mouseup",this.endMove),this.moveHover(e)},O.prototype.setStartPosition=function(e,t){var o,i,n=this.touchMove?e.touches[0].pageX:e.pageX,s=this.touchMove?e.touches[0].pageY:e.pageY;o=t.getElement(),this.connection?(i=o.getBoundingClientRect(),this.startX=i.left-n+window.pageXOffset,this.startY=i.top-s+window.pageYOffset):this.startY=s-o.getBoundingClientRect().top},O.prototype.endMove=function(e){e&&1!==e.which&&!this.touchMove||(this._unbindMouseMove(),this.connection||(this.placeholderElement.parentNode.insertBefore(this.moving.getElement(),this.placeholderElement.nextSibling),this.placeholderElement.parentNode.removeChild(this.placeholderElement)),this.hoverElement.parentNode.removeChild(this.hoverElement),this.table.element.classList.remove("tabulator-block-select"),this.toRow&&this.table.rowManager.moveRow(this.moving,this.toRow,this.toRowAfter),this.moving=!1,this.toRow=!1,this.toRowAfter=!1,document.body.removeEventListener("mousemove",this.moveHover),document.body.removeEventListener("mouseup",this.endMove),this.connection&&(this.table.element.classList.remove("tabulator-movingrow-sending"),this.disconnectFromTables()))},O.prototype.moveRow=function(e,t){this.toRow=e,this.toRowAfter=t},O.prototype.moveHover=function(e){this.connection?this.moveHoverConnections.call(this,e):this.moveHoverTable.call(this,e)},O.prototype.moveHoverTable=function(e){var t=this.table.rowManager.getElement(),o=t.scrollTop,i=(this.touchMove?e.touches[0].pageY:e.pageY)-t.getBoundingClientRect().top+o;this.hoverElement.style.top=i-this.startY+"px"},O.prototype.moveHoverConnections=function(e){this.hoverElement.style.left=this.startX+(this.touchMove?e.touches[0].pageX:e.pageX)+"px",this.hoverElement.style.top=this.startY+(this.touchMove?e.touches[0].pageY:e.pageY)+"px"},O.prototype.elementRowDrop=function(e,t,o){this.table.options.movableRowsElementDrop&&this.table.options.movableRowsElementDrop(e,t,!!o&&o.getComponent())},O.prototype.connectToTables=function(e){var t,o=this;this.connectionSelectorsTables&&(t=this.table.modules.comms.getConnections(this.connectionSelectorsTables),this.table.options.movableRowsSendingStart.call(this.table,t),this.table.modules.comms.send(this.connectionSelectorsTables,"moveRow","connect",{row:e})),this.connectionSelectorsElements&&(this.connectionElements=[],Array.isArray(this.connectionSelectorsElements)||(this.connectionSelectorsElements=[this.connectionSelectorsElements]),this.connectionSelectorsElements.forEach(function(e){"string"==typeof e?o.connectionElements=o.connectionElements.concat(Array.prototype.slice.call(document.querySelectorAll(e))):o.connectionElements.push(e)}),this.connectionElements.forEach(function(e){var t=function(t){o.elementRowDrop(t,e,o.moving)};e.addEventListener("mouseup",t),e.tabulatorElementDropEvent=t,e.classList.add("tabulator-movingrow-receiving")}))},O.prototype.disconnectFromTables=function(){var e;this.connectionSelectorsTables&&(e=this.table.modules.comms.getConnections(this.connectionSelectorsTables),this.table.options.movableRowsSendingStop.call(this.table,e),this.table.modules.comms.send(this.connectionSelectorsTables,"moveRow","disconnect")),this.connectionElements.forEach(function(e){e.classList.remove("tabulator-movingrow-receiving"),e.removeEventListener("mouseup",e.tabulatorElementDropEvent),delete e.tabulatorElementDropEvent})},O.prototype.connect=function(e,t){var o=this;return this.connectedTable?(console.warn("Move Row Error - Table cannot accept connection, already connected to table:",this.connectedTable),!1):(this.connectedTable=e,this.connectedRow=t,this.table.element.classList.add("tabulator-movingrow-receiving"),o.table.rowManager.getDisplayRows().forEach(function(e){"row"===e.type&&e.modules.moveRow&&e.modules.moveRow.mouseup&&e.getElement().addEventListener("mouseup",e.modules.moveRow.mouseup)}),o.tableRowDropEvent=o.tableRowDrop.bind(o),o.table.element.addEventListener("mouseup",o.tableRowDropEvent),this.table.options.movableRowsReceivingStart.call(this.table,t,e),!0)},O.prototype.disconnect=function(e){var t=this;e===this.connectedTable?(this.connectedTable=!1,this.connectedRow=!1,this.table.element.classList.remove("tabulator-movingrow-receiving"),t.table.rowManager.getDisplayRows().forEach(function(e){"row"===e.type&&e.modules.moveRow&&e.modules.moveRow.mouseup&&e.getElement().removeEventListener("mouseup",e.modules.moveRow.mouseup)}),t.table.element.removeEventListener("mouseup",t.tableRowDropEvent),this.table.options.movableRowsReceivingStop.call(this.table,e)):console.warn("Move Row Error - trying to disconnect from non connected table")},O.prototype.dropComplete=function(e,t,o){var i=!1;if(o){switch(_typeof(this.table.options.movableRowsSender)){case"string":i=this.senders[this.table.options.movableRowsSender];break;case"function":i=this.table.options.movableRowsSender}i?i.call(this,this.moving.getComponent(),t?t.getComponent():void 0,e):this.table.options.movableRowsSender&&console.warn("Mover Row Error - no matching sender found:",this.table.options.movableRowsSender),this.table.options.movableRowsSent.call(this.table,this.moving.getComponent(),t?t.getComponent():void 0,e)}else this.table.options.movableRowsSentFailed.call(this.table,this.moving.getComponent(),t?t.getComponent():void 0,e);this.endMove()},O.prototype.tableRowDrop=function(e,t){var o=!1,i=!1;switch(console.trace("drop"),e.stopImmediatePropagation(),_typeof(this.table.options.movableRowsReceiver)){case"string":o=this.receivers[this.table.options.movableRowsReceiver];break;case"function":o=this.table.options.movableRowsReceiver}o?i=o.call(this,this.connectedRow.getComponent(),t?t.getComponent():void 0,this.connectedTable):console.warn("Mover Row Error - no matching receiver found:",this.table.options.movableRowsReceiver),i?this.table.options.movableRowsReceived.call(this.table,this.connectedRow.getComponent(),t?t.getComponent():void 0,this.connectedTable):this.table.options.movableRowsReceivedFailed.call(this.table,this.connectedRow.getComponent(),t?t.getComponent():void 0,this.connectedTable),this.table.modules.comms.send(this.connectedTable,"moveRow","dropcomplete",{row:t,success:i})},O.prototype.receivers={insert:function(e,t,o){return this.table.addRow(e.getData(),void 0,t),!0},add:function(e,t,o){return this.table.addRow(e.getData()),!0},update:function(e,t,o){return!!t&&(t.update(e.getData()),!0)},replace:function(e,t,o){return!!t&&(this.table.addRow(e.getData(),void 0,t),t.delete(),!0)}},O.prototype.senders={delete:function(e,t,o){e.delete()}},O.prototype.commsReceived=function(e,t,o){switch(t){case"connect":return this.connect(e,o.row);case"disconnect":return this.disconnect(e);case"dropcomplete":return this.dropComplete(e,o.row,o.success)}},h.prototype.registerModule("moveRow",O);var I=function(e){this.table=e,this.allowedTypes=["","data","edit","clipboard"],this.enabled=!0};I.prototype.initializeColumn=function(e){var t=this,o=!1,i={};this.allowedTypes.forEach(function(n){var s,a="mutator"+(n.charAt(0).toUpperCase()+n.slice(1));e.definition[a]&&(s=t.lookupMutator(e.definition[a]))&&(o=!0,i[a]={mutator:s,params:e.definition[a+"Params"]||{}})}),o&&(e.modules.mutate=i)},I.prototype.lookupMutator=function(e){var t=!1;switch(void 0===e?"undefined":_typeof(e)){case"string":this.mutators[e]?t=this.mutators[e]:console.warn("Mutator Error - No such mutator found, ignoring: ",e);break;case"function":t=e}return t},I.prototype.transformRow=function(e,t,o){var i,n=this,s="mutator"+(t.charAt(0).toUpperCase()+t.slice(1));return this.enabled&&n.table.columnManager.traverse(function(n){var a,r,l;n.modules.mutate&&(a=n.modules.mutate[s]||n.modules.mutate.mutator||!1)&&(i=n.getFieldValue(void 0!==o?o:e),"data"!=t&&void 0===i||(l=n.getComponent(),r="function"==typeof a.params?a.params(i,e,t,l):a.params,n.setFieldValue(e,a.mutator(i,e,t,r,l))))}),e},I.prototype.transformCell=function(e,t){var o=e.column.modules.mutate.mutatorEdit||e.column.modules.mutate.mutator||!1,i={};return o?(i=Object.assign(i,e.row.getData()),e.column.setFieldValue(i,t),o.mutator(t,i,"edit",o.params,e.getComponent())):t},I.prototype.enable=function(){this.enabled=!0},I.prototype.disable=function(){this.enabled=!1},I.prototype.mutators={},h.prototype.registerModule("mutator",I);var V=function(e){this.table=e,this.mode="local",this.progressiveLoad=!1,this.size=0,this.page=1,this.count=5,this.max=1,this.displayIndex=0,this.initialLoad=!0,this.pageSizes=[],this.dataReceivedNames={},this.dataSentNames={},this.createElements()};V.prototype.createElements=function(){var e;this.element=document.createElement("span"),this.element.classList.add("tabulator-paginator"),this.pagesElement=document.createElement("span"),this.pagesElement.classList.add("tabulator-pages"),e=document.createElement("button"),e.classList.add("tabulator-page"),e.setAttribute("type","button"),e.setAttribute("role","button"),e.setAttribute("aria-label",""),e.setAttribute("title",""),this.firstBut=e.cloneNode(!0),this.firstBut.setAttribute("data-page","first"),this.prevBut=e.cloneNode(!0),this.prevBut.setAttribute("data-page","prev"),this.nextBut=e.cloneNode(!0),this.nextBut.setAttribute("data-page","next"),this.lastBut=e.cloneNode(!0),this.lastBut.setAttribute("data-page","last"),this.table.options.paginationSizeSelector&&(this.pageSizeSelect=document.createElement("select"),this.pageSizeSelect.classList.add("tabulator-page-size"))},V.prototype.generatePageSizeSelectList=function(){var e=this,t=[];if(this.pageSizeSelect){if(Array.isArray(this.table.options.paginationSizeSelector))t=this.table.options.paginationSizeSelector,this.pageSizes=t,-1==this.pageSizes.indexOf(this.size)&&t.unshift(this.size);else if(-1==this.pageSizes.indexOf(this.size)){t=[];for(var o=1;o<5;o++)t.push(this.size*o);this.pageSizes=t}else t=this.pageSizes;for(;this.pageSizeSelect.firstChild;)this.pageSizeSelect.removeChild(this.pageSizeSelect.firstChild);t.forEach(function(t){var o=document.createElement("option");o.value=t,!0===t?e.table.modules.localize.bind("pagination|all",function(e){o.innerHTML=e}):o.innerHTML=t,e.pageSizeSelect.appendChild(o)}),this.pageSizeSelect.value=this.size}},V.prototype.initialize=function(e){var t,o,i,n=this;this.dataSentNames=Object.assign({},this.paginationDataSentNames),this.dataSentNames=Object.assign(this.dataSentNames,this.table.options.paginationDataSent),this.dataReceivedNames=Object.assign({},this.paginationDataReceivedNames),this.dataReceivedNames=Object.assign(this.dataReceivedNames,this.table.options.paginationDataReceived),n.table.modules.localize.bind("pagination|first",function(e){n.firstBut.innerHTML=e}),n.table.modules.localize.bind("pagination|first_title",function(e){n.firstBut.setAttribute("aria-label",e),n.firstBut.setAttribute("title",e)}),n.table.modules.localize.bind("pagination|prev",function(e){n.prevBut.innerHTML=e}),n.table.modules.localize.bind("pagination|prev_title",function(e){n.prevBut.setAttribute("aria-label",e),n.prevBut.setAttribute("title",e)}),n.table.modules.localize.bind("pagination|next",function(e){n.nextBut.innerHTML=e}),n.table.modules.localize.bind("pagination|next_title",function(e){n.nextBut.setAttribute("aria-label",e),n.nextBut.setAttribute("title",e)}),n.table.modules.localize.bind("pagination|last",function(e){n.lastBut.innerHTML=e}),n.table.modules.localize.bind("pagination|last_title",function(e){n.lastBut.setAttribute("aria-label",e),n.lastBut.setAttribute("title",e)}),n.firstBut.addEventListener("click",function(){n.setPage(1).then(function(){}).catch(function(){})}),n.prevBut.addEventListener("click",function(){n.previousPage().then(function(){}).catch(function(){})}),n.nextBut.addEventListener("click",function(){n.nextPage().then(function(){}).catch(function(){})}),n.lastBut.addEventListener("click",function(){n.setPage(n.max).then(function(){}).catch(function(){})}),n.table.options.paginationElement&&(n.element=n.table.options.paginationElement),this.pageSizeSelect&&(t=document.createElement("label"),n.table.modules.localize.bind("pagination|page_size",function(e){n.pageSizeSelect.setAttribute("aria-label",e),n.pageSizeSelect.setAttribute("title",e),t.innerHTML=e}),n.element.appendChild(t),n.element.appendChild(n.pageSizeSelect),n.pageSizeSelect.addEventListener("change",function(e){n.setPageSize("true"==n.pageSizeSelect.value||n.pageSizeSelect.value),n.setPage(1).then(function(){}).catch(function(){})})),n.element.appendChild(n.firstBut),n.element.appendChild(n.prevBut),n.element.appendChild(n.pagesElement),n.element.appendChild(n.nextBut),n.element.appendChild(n.lastBut),n.table.options.paginationElement||e||n.table.footerManager.append(n.element,n),n.mode=n.table.options.pagination,n.table.options.paginationSize?n.size=n.table.options.paginationSize:(o=document.createElement("div"),o.classList.add("tabulator-row"),o.style.visibility=e,i=document.createElement("div"),i.classList.add("tabulator-cell"),i.innerHTML="Page Row Test",o.appendChild(i),n.table.rowManager.getTableElement().appendChild(o),n.size=Math.floor(n.table.rowManager.getElement().clientHeight/o.offsetHeight),n.table.rowManager.getTableElement().removeChild(o)),n.count=n.table.options.paginationButtonCount,n.generatePageSizeSelectList()},V.prototype.initializeProgressive=function(e){this.initialize(!0),this.mode="progressive_"+e,this.progressiveLoad=!0},V.prototype.setDisplayIndex=function(e){this.displayIndex=e},V.prototype.getDisplayIndex=function(){return this.displayIndex},V.prototype.setMaxRows=function(e){this.max=e?!0===this.size?1:Math.ceil(e/this.size):1,this.page>this.max&&(this.page=this.max)},V.prototype.reset=function(e,t){return("local"==this.mode||e)&&(this.page=1),t&&(this.initialLoad=!0),!0},V.prototype.setMaxPage=function(e){e=parseInt(e),this.max=e||1,this.page>this.max&&(this.page=this.max,this.trigger())},V.prototype.setPage=function(e){var t=this,o=this;switch(e){case"first":return this.setPage(1);case"prev":return this.previousPage();case"next":return this.nextPage();case"last":return this.setPage(this.max)}return new Promise(function(i,n){e=parseInt(e),e>0&&e<=t.max?(t.page=e,t.trigger().then(function(){i()}).catch(function(){n()}),o.table.options.persistence&&o.table.modExists("persistence",!0)&&o.table.modules.persistence.config.page&&o.table.modules.persistence.save("page")):(console.warn("Pagination Error - Requested page is out of range of 1 - "+t.max+":",e),n())})},V.prototype.setPageToRow=function(e){var t=this;return new Promise(function(o,i){var n=t.table.rowManager.getDisplayRows(t.displayIndex-1),s=n.indexOf(e);if(s>-1){var a=!0===t.size?1:Math.ceil((s+1)/t.size);t.setPage(a).then(function(){o()}).catch(function(){i()})}else console.warn("Pagination Error - Requested row is not visible"),i()})},V.prototype.setPageSize=function(e){!0!==e&&(e=parseInt(e)),e>0&&(this.size=e),this.pageSizeSelect&&this.generatePageSizeSelectList(),this.table.options.persistence&&this.table.modExists("persistence",!0)&&this.table.modules.persistence.config.page&&this.table.modules.persistence.save("page")},V.prototype._setPageButtons=function(){for(var e=this,t=Math.floor((this.count-1)/2),o=Math.ceil((this.count-1)/2),i=this.max-this.page+t+10&&s<=e.max&&e.pagesElement.appendChild(e._generatePageButton(s));this.footerRedraw()},V.prototype._generatePageButton=function(e){var t=this,o=document.createElement("button");return o.classList.add("tabulator-page"),e==t.page&&o.classList.add("active"),o.setAttribute("type","button"),o.setAttribute("role","button"),t.table.modules.localize.bind("pagination|page_title",function(t){o.setAttribute("aria-label",t+" "+e),o.setAttribute("title",t+" "+e)}),o.setAttribute("data-page",e),o.textContent=e,o.addEventListener("click",function(o){t.setPage(e).then(function(){}).catch(function(){})}),o},V.prototype.previousPage=function(){var e=this;return new Promise(function(t,o){e.page>1?(e.page--,e.trigger().then(function(){t()}).catch(function(){o()}),e.table.options.persistence&&e.table.modExists("persistence",!0)&&e.table.modules.persistence.config.page&&e.table.modules.persistence.save("page")):(console.warn("Pagination Error - Previous page would be less than page 1:",0),o())})},V.prototype.nextPage=function(){var e=this;return new Promise(function(t,o){e.pagen?i.splice(n,0,e):i.push(e))}),i},j.prototype._findColumn=function(e,t){var o=t.columns?"group":t.field?"field":"object";return e.find(function(e){switch(o){case"group":return e.title===t.title&&e.columns.length===t.columns.length;case"field":return e.field===t.field;case"object":return e===t}})},j.prototype.save=function(e){var t={};switch(e){case"columns":t=this.parseColumns(this.table.columnManager.getColumns());break;case"filter":t=this.table.modules.filter.getFilters();break;case"sort":t=this.validateSorters(this.table.modules.sort.getSort());break;case"group":t=this.getGroupConfig();break;case"page":t=this.getPageConfig()}this.writeFunc&&this.writeFunc(this.id,e,t)},j.prototype.validateSorters=function(e){return e.forEach(function(e){e.column=e.field,delete e.field}),e},j.prototype.getGroupConfig=function(){var e={} +;return this.config.group&&((!0===this.config.group||this.config.group.groupBy)&&(e.groupBy=this.table.options.groupBy),(!0===this.config.group||this.config.group.groupStartOpen)&&(e.groupStartOpen=this.table.options.groupStartOpen),(!0===this.config.group||this.config.group.groupHeader)&&(e.groupHeader=this.table.options.groupHeader)),e},j.prototype.getPageConfig=function(){var e={};return this.config.page&&((!0===this.config.page||this.config.page.size)&&(e.paginationSize=this.table.modules.page.getPageSize()),(!0===this.config.page||this.config.page.page)&&(e.paginationInitialPage=this.table.modules.page.getPage())),e},j.prototype.parseColumns=function(e){var t=this,o=[],i=["headerContextMenu","headerMenu","contextMenu","clickMenu"];return e.forEach(function(e){var n,s={},a=e.getDefinition();e.isGroup?(s.title=a.title,s.columns=t.parseColumns(e.getColumns())):(s.field=e.getField(),!0===t.config.columns||void 0==t.config.columns?(n=Object.keys(a),n.push("width")):n=t.config.columns,n.forEach(function(t){switch(t){case"width":s.width=e.getWidth();break;case"visible":s.visible=e.visible;break;default:"function"!=typeof a[t]&&-1===i.indexOf(t)&&(s[t]=a[t])}})),o.push(s)}),o},j.prototype.readers={local:function(e,t){var o=localStorage.getItem(e+"-"+t);return!!o&&JSON.parse(o)},cookie:function(e,t){var o,i,n=document.cookie,s=e+"-"+t,a=n.indexOf(s+"=");return a>-1&&(n=n.substr(a),o=n.indexOf(";"),o>-1&&(n=n.substr(0,o)),i=n.replace(s+"=","")),!!i&&JSON.parse(i)}},j.prototype.writers={local:function(e,t,o){localStorage.setItem(e+"-"+t,JSON.stringify(o))},cookie:function(e,t,o){var i=new Date;i.setDate(i.getDate()+1e4),document.cookie=e+"-"+t+"="+JSON.stringify(o)+"; expires="+i.toUTCString()}},h.prototype.registerModule("persistence",j);var W=function(e){this.table=e,this.element=!1,this.manualBlock=!1};W.prototype.initialize=function(){window.addEventListener("beforeprint",this.replaceTable.bind(this)),window.addEventListener("afterprint",this.cleanup.bind(this))},W.prototype.replaceTable=function(){this.manualBlock||(this.element=document.createElement("div"),this.element.classList.add("tabulator-print-table"),this.element.appendChild(this.table.modules.export.genereateTable(this.table.options.printConfig,this.table.options.printStyled,this.table.options.printRowRange,"print")),this.table.element.style.display="none",this.table.element.parentNode.insertBefore(this.element,this.table.element))},W.prototype.cleanup=function(){document.body.classList.remove("tabulator-print-fullscreen-hide"),this.element&&this.element.parentNode&&(this.element.parentNode.removeChild(this.element),this.table.element.style.display="")},W.prototype.printFullscreen=function(e,t,o){var i,n,s=window.scrollX,a=window.scrollY,r=document.createElement("div"),l=document.createElement("div"),c=this.table.modules.export.genereateTable(void 0!==o?o:this.table.options.printConfig,void 0!==t?t:this.table.options.printStyled,e,"print");this.manualBlock=!0,this.element=document.createElement("div"),this.element.classList.add("tabulator-print-fullscreen"),this.table.options.printHeader&&(r.classList.add("tabulator-print-header"),i="function"==typeof this.table.options.printHeader?this.table.options.printHeader.call(this.table):this.table.options.printHeader,"string"==typeof i?r.innerHTML=i:r.appendChild(i),this.element.appendChild(r)),this.element.appendChild(c),this.table.options.printFooter&&(l.classList.add("tabulator-print-footer"),n="function"==typeof this.table.options.printFooter?this.table.options.printFooter.call(this.table):this.table.options.printFooter,"string"==typeof n?l.innerHTML=n:l.appendChild(n),this.element.appendChild(l)),document.body.classList.add("tabulator-print-fullscreen-hide"),document.body.appendChild(this.element),this.table.options.printFormatter&&this.table.options.printFormatter(this.element,c),window.print(),this.cleanup(),window.scrollTo(s,a),this.manualBlock=!1},h.prototype.registerModule("print",W);var G=function(e){this.table=e,this.data=!1,this.blocked=!1,this.origFuncs={},this.currentVersion=0};G.prototype.watchData=function(e){var t,o=this;this.currentVersion++,t=this.currentVersion,o.unwatchData(),o.data=e,o.origFuncs.push=e.push,Object.defineProperty(o.data,"push",{enumerable:!1,configurable:!0,value:function(){var i=Array.from(arguments);return o.blocked||t!==o.currentVersion||i.forEach(function(e){o.table.rowManager.addRowActual(e,!1)}),o.origFuncs.push.apply(e,arguments)}}),o.origFuncs.unshift=e.unshift,Object.defineProperty(o.data,"unshift",{enumerable:!1,configurable:!0,value:function(){var i=Array.from(arguments);return o.blocked||t!==o.currentVersion||i.forEach(function(e){o.table.rowManager.addRowActual(e,!0)}),o.origFuncs.unshift.apply(e,arguments)}}),o.origFuncs.shift=e.shift,Object.defineProperty(o.data,"shift",{enumerable:!1,configurable:!0,value:function(){var i;return o.blocked||t!==o.currentVersion||o.data.length&&(i=o.table.rowManager.getRowFromDataObject(o.data[0]))&&i.deleteActual(),o.origFuncs.shift.call(e)}}),o.origFuncs.pop=e.pop,Object.defineProperty(o.data,"pop",{enumerable:!1,configurable:!0,value:function(){var i;return o.blocked||t!==o.currentVersion||o.data.length&&(i=o.table.rowManager.getRowFromDataObject(o.data[o.data.length-1]))&&i.deleteActual(),o.origFuncs.pop.call(e)}}),o.origFuncs.splice=e.splice,Object.defineProperty(o.data,"splice",{enumerable:!1,configurable:!0,value:function(){var i,n=Array.from(arguments),s=n[0]<0?e.length+n[0]:n[0],a=n[1],r=!!n[2]&&n.slice(2);if(!o.blocked&&t===o.currentVersion){if(r&&(i=!!e[s]&&o.table.rowManager.getRowFromDataObject(e[s]),i?r.forEach(function(e){o.table.rowManager.addRowActual(e,!0,i,!0)}):(r=r.slice().reverse(),r.forEach(function(e){o.table.rowManager.addRowActual(e,!0,!1,!0)}))),0!==a){var l=e.slice(s,void 0===n[1]?n[1]:s+a);l.forEach(function(e,t){var i=o.table.rowManager.getRowFromDataObject(e);i&&i.deleteActual(t!==l.length-1)})}(r||0!==a)&&o.table.rowManager.reRenderInPosition()}return o.origFuncs.splice.apply(e,arguments)}})},G.prototype.unwatchData=function(){if(!1!==this.data)for(var e in this.origFuncs)Object.defineProperty(this.data,e,{enumerable:!0,configurable:!0,writable:!0,value:this.origFuncs.key})},G.prototype.watchRow=function(e){var t=e.getData();this.blocked=!0;for(var o in t)this.watchKey(e,t,o);this.table.options.dataTree&&this.watchTreeChildren(e),this.blocked=!1},G.prototype.watchTreeChildren=function(e){function t(){o.table.modules.dataTree.initializeRow(e),o.table.modules.dataTree.layoutRow(e),o.table.rowManager.refreshActiveData("tree",!1,!0)}var o=this,i=e.getData()[this.table.options.dataTreeChildField],n={};i&&(n.push=i.push,Object.defineProperty(i,"push",{enumerable:!1,configurable:!0,value:function(){var e=n.push.apply(i,arguments);return t(),e}}),n.unshift=i.unshift,Object.defineProperty(i,"unshift",{enumerable:!1,configurable:!0,value:function(){var e=n.unshift.apply(i,arguments);return t(),e}}),n.shift=i.shift,Object.defineProperty(i,"shift",{enumerable:!1,configurable:!0,value:function(){var e=n.shift.call(i);return t(),e}}),n.pop=i.pop,Object.defineProperty(i,"pop",{enumerable:!1,configurable:!0,value:function(){var e=n.pop.call(i);return t(),e}}),n.splice=i.splice,Object.defineProperty(i,"splice",{enumerable:!1,configurable:!0,value:function(){var e=n.splice.apply(i,arguments);return t(),e}}))},G.prototype.watchKey=function(e,t,o){var i=this,n=Object.getOwnPropertyDescriptor(t,o),s=t[o],a=this.currentVersion;Object.defineProperty(t,o,{set:function(t){if(s=t,!i.blocked&&a===i.currentVersion){var r={};r[o]=t,e.updateData(r)}n.set&&n.set(t)},get:function(){return n.get&&n.get(),s}})},G.prototype.unwatchRow=function(e){var t=e.getData();for(var o in t)Object.defineProperty(t,o,{value:t[o]})},G.prototype.block=function(){this.blocked=!0},G.prototype.unblock=function(){this.blocked=!1},h.prototype.registerModule("reactiveData",G);var U=function(e){this.table=e,this.startColumn=!1,this.startX=!1,this.startWidth=!1,this.handle=null,this.prevHandle=null};U.prototype.initializeColumn=function(e,t,o){var i=this,n=!1,s=this.table.options.resizableColumns;if("header"===e&&(n="textarea"==t.definition.formatter||t.definition.variableHeight,t.modules.resize={variableHeight:n}),!0===s||s==e){var a=document.createElement("div");a.className="tabulator-col-resize-handle";var r=document.createElement("div");r.className="tabulator-col-resize-handle prev",a.addEventListener("click",function(e){e.stopPropagation()});var l=function(e){var o=t.getLastColumn();o&&i._checkResizability(o)&&(i.startColumn=t,i._mouseDown(e,o,a))};a.addEventListener("mousedown",l),a.addEventListener("touchstart",l,{passive:!0}),a.addEventListener("dblclick",function(e){var o=t.getLastColumn();o&&i._checkResizability(o)&&(e.stopPropagation(),o.reinitializeWidth(!0))}),r.addEventListener("click",function(e){e.stopPropagation()});var c=function(e){var o,n,s;(o=t.getFirstColumn())&&(n=i.table.columnManager.findColumnIndex(o),(s=n>0&&i.table.columnManager.getColumnByIndex(n-1))&&i._checkResizability(s)&&(i.startColumn=t,i._mouseDown(e,s,r)))};r.addEventListener("mousedown",c),r.addEventListener("touchstart",c,{passive:!0}),r.addEventListener("dblclick",function(e){var o,n,s;(o=t.getFirstColumn())&&(n=i.table.columnManager.findColumnIndex(o),(s=n>0&&i.table.columnManager.getColumnByIndex(n-1))&&i._checkResizability(s)&&(e.stopPropagation(),s.reinitializeWidth(!0)))}),o.appendChild(a),o.appendChild(r)}},U.prototype._checkResizability=function(e){return void 0!==e.definition.resizable?e.definition.resizable:this.table.options.resizableColumns},U.prototype._mouseDown=function(e,t,o){function i(e){s.table.rtl?t.setWidth(s.startWidth-((void 0===e.screenX?e.touches[0].screenX:e.screenX)-s.startX)):t.setWidth(s.startWidth+((void 0===e.screenX?e.touches[0].screenX:e.screenX)-s.startX)),s.table.options.virtualDomHoz&&s.table.vdomHoz.reinitialize(!0),!s.table.browserSlow&&t.modules.resize&&t.modules.resize.variableHeight&&t.checkCellHeights()}function n(e){s.startColumn.modules.edit&&(s.startColumn.modules.edit.blocked=!1),s.table.browserSlow&&t.modules.resize&&t.modules.resize.variableHeight&&t.checkCellHeights(),document.body.removeEventListener("mouseup",n),document.body.removeEventListener("mousemove",i),o.removeEventListener("touchmove",i),o.removeEventListener("touchend",n),s.table.element.classList.remove("tabulator-block-select"),s.table.options.persistence&&s.table.modExists("persistence",!0)&&s.table.modules.persistence.config.columns&&s.table.modules.persistence.save("columns"),s.table.options.columnResized.call(s.table,t.getComponent())}var s=this;s.table.element.classList.add("tabulator-block-select"),e.stopPropagation(),s.startColumn.modules.edit&&(s.startColumn.modules.edit.blocked=!0),s.startX=void 0===e.screenX?e.touches[0].screenX:e.screenX,s.startWidth=t.getWidth(),document.body.addEventListener("mousemove",i),document.body.addEventListener("mouseup",n),o.addEventListener("touchmove",i,{passive:!0}),o.addEventListener("touchend",n)},h.prototype.registerModule("resizeColumns",U);var X=function(e){this.table=e,this.startColumn=!1,this.startY=!1,this.startHeight=!1,this.handle=null,this.prevHandle=null};X.prototype.initializeRow=function(e){var t=this,o=e.getElement(),i=document.createElement("div");i.className="tabulator-row-resize-handle";var n=document.createElement("div");n.className="tabulator-row-resize-handle prev",i.addEventListener("click",function(e){e.stopPropagation()});var s=function(o){t.startRow=e,t._mouseDown(o,e,i)};i.addEventListener("mousedown",s),i.addEventListener("touchstart",s,{passive:!0}),n.addEventListener("click",function(e){e.stopPropagation()});var a=function(o){var i=t.table.rowManager.prevDisplayRow(e);i&&(t.startRow=i,t._mouseDown(o,i,n))};n.addEventListener("mousedown",a),n.addEventListener("touchstart",a,{passive:!0}),o.appendChild(i),o.appendChild(n)},X.prototype._mouseDown=function(e,t,o){function i(e){t.setHeight(s.startHeight+((void 0===e.screenY?e.touches[0].screenY:e.screenY)-s.startY))}function n(e){document.body.removeEventListener("mouseup",i),document.body.removeEventListener("mousemove",i),o.removeEventListener("touchmove",i),o.removeEventListener("touchend",n),s.table.element.classList.remove("tabulator-block-select"),s.table.options.rowResized.call(this.table,t.getComponent())}var s=this;s.table.element.classList.add("tabulator-block-select"),e.stopPropagation(),s.startY=void 0===e.screenY?e.touches[0].screenY:e.screenY,s.startHeight=t.getHeight(),document.body.addEventListener("mousemove",i),document.body.addEventListener("mouseup",n),o.addEventListener("touchmove",i,{passive:!0}),o.addEventListener("touchend",n)},h.prototype.registerModule("resizeRows",X);var Y=function(e){this.table=e,this.binding=!1,this.observer=!1,this.containerObserver=!1,this.tableHeight=0,this.tableWidth=0,this.containerHeight=0,this.containerWidth=0,this.autoResize=!1};Y.prototype.initialize=function(e){var t,o=this,i=this.table;this.tableHeight=i.element.clientHeight,this.tableWidth=i.element.clientWidth,i.element.parentNode&&(this.containerHeight=i.element.parentNode.clientHeight,this.containerWidth=i.element.parentNode.clientWidth),"undefined"!=typeof ResizeObserver&&"virtual"===i.rowManager.getRenderMode()?(this.autoResize=!0,this.observer=new ResizeObserver(function(e){if(!i.browserMobile||i.browserMobile&&!i.modules.edit.currentCell){var t=Math.floor(e[0].contentRect.height),n=Math.floor(e[0].contentRect.width);o.tableHeight==t&&o.tableWidth==n||(o.tableHeight=t,o.tableWidth=n,i.element.parentNode&&(o.containerHeight=i.element.parentNode.clientHeight,o.containerWidth=i.element.parentNode.clientWidth),i.options.virtualDomHoz&&i.vdomHoz.reinitialize(!0),i.redraw())}}),this.observer.observe(i.element),t=window.getComputedStyle(i.element),this.table.element.parentNode&&!this.table.rowManager.fixedHeight&&(t.getPropertyValue("max-height")||t.getPropertyValue("min-height"))&&(this.containerObserver=new ResizeObserver(function(e){if(!i.browserMobile||i.browserMobile&&!i.modules.edit.currentCell){var t=Math.floor(e[0].contentRect.height),n=Math.floor(e[0].contentRect.width);o.containerHeight==t&&o.containerWidth==n||(o.containerHeight=t,o.containerWidth=n,o.tableHeight=i.element.clientHeight,o.tableWidth=i.element.clientWidth),i.options.virtualDomHoz&&i.vdomHoz.reinitialize(!0),i.redraw()}}),this.containerObserver.observe(this.table.element.parentNode))):(this.binding=function(){(!i.browserMobile||i.browserMobile&&!i.modules.edit.currentCell)&&(i.options.virtualDomHoz&&i.vdomHoz.reinitialize(!0),i.redraw())},window.addEventListener("resize",this.binding))},Y.prototype.clearBindings=function(e){this.binding&&window.removeEventListener("resize",this.binding),this.observer&&this.observer.unobserve(this.table.element),this.containerObserver&&this.containerObserver.unobserve(this.table.element.parentNode)},h.prototype.registerModule("resizeTable",Y);var q=function(e){this.table=e,this.columns=[],this.hiddenColumns=[],this.mode="",this.index=0,this.collapseFormatter=[],this.collapseStartOpen=!0,this.collapseHandleColumn=!1};q.prototype.initialize=function(){var e=this,t=[];this.mode=this.table.options.responsiveLayout,this.collapseFormatter=this.table.options.responsiveLayoutCollapseFormatter||this.formatCollapsedData,this.collapseStartOpen=this.table.options.responsiveLayoutCollapseStartOpen,this.hiddenColumns=[],this.table.columnManager.columnsByIndex.forEach(function(o,i){o.modules.responsive&&o.modules.responsive.order&&o.modules.responsive.visible&&(o.modules.responsive.index=i,t.push(o),o.visible||"collapse"!==e.mode||e.hiddenColumns.push(o))}),t=t.reverse(),t=t.sort(function(e,t){return t.modules.responsive.order-e.modules.responsive.order||t.modules.responsive.index-e.modules.responsive.index}),this.columns=t,"collapse"===this.mode&&this.generateCollapsedContent();for(var o=this.table.columnManager.columnsByIndex,i=Array.isArray(o),n=0,o=i?o:o[Symbol.iterator]();;){var s;if(i){if(n>=o.length)break;s=o[n++]}else{if(n=o.next(),n.done)break;s=n.value}var a=s;if("responsiveCollapse"==a.definition.formatter){this.collapseHandleColumn=a;break}}this.collapseHandleColumn&&(this.hiddenColumns.length?this.collapseHandleColumn.show():this.collapseHandleColumn.hide())},q.prototype.initializeColumn=function(e){var t=e.getDefinition();e.modules.responsive={order:void 0===t.responsive?1:t.responsive,visible:!1!==t.visible}},q.prototype.initializeRow=function(e){var t;"calc"!==e.type&&(t=document.createElement("div"),t.classList.add("tabulator-responsive-collapse"),e.modules.responsiveLayout={element:t,open:this.collapseStartOpen},this.collapseStartOpen||(t.style.display="none"))},q.prototype.layoutRow=function(e){var t=e.getElement();e.modules.responsiveLayout&&(t.appendChild(e.modules.responsiveLayout.element),this.generateCollapsedRowContent(e))},q.prototype.updateColumnVisibility=function(e,t){e.modules.responsive&&(e.modules.responsive.visible=t,this.initialize())},q.prototype.hideColumn=function(e){var t=this.hiddenColumns.length;e.hide(!1,!0),"collapse"===this.mode&&(this.hiddenColumns.unshift(e),this.generateCollapsedContent(),this.collapseHandleColumn&&!t&&this.collapseHandleColumn.show())},q.prototype.showColumn=function(e){var t;e.show(!1,!0),e.setWidth(e.getWidth()),"collapse"===this.mode&&(t=this.hiddenColumns.indexOf(e),t>-1&&this.hiddenColumns.splice(t,1),this.generateCollapsedContent(),this.collapseHandleColumn&&!this.hiddenColumns.length&&this.collapseHandleColumn.hide())},q.prototype.update=function(){for(var e=this,t=!0;t;){var o="fitColumns"==e.table.modules.layout.getMode()?e.table.columnManager.getFlexBaseWidth():e.table.columnManager.getWidth(),i=(e.table.options.headerVisible?e.table.columnManager.element.clientWidth:e.table.element.clientWidth)-o;if(i<0){var n=e.columns[e.index];n?(e.hideColumn(n),e.index++):t=!1}else{var s=e.columns[e.index-1];s&&i>0&&i>=s.getWidth()?(e.showColumn(s),e.index--):t=!1}e.table.rowManager.activeRowsCount||e.table.rowManager.renderEmptyScroll()}},q.prototype.generateCollapsedContent=function(){var e=this;this.table.rowManager.getDisplayRows().forEach(function(t){e.generateCollapsedRowContent(t)})},q.prototype.generateCollapsedRowContent=function(e){var t,o;if(e.modules.responsiveLayout){for(t=e.modules.responsiveLayout.element;t.firstChild;)t.removeChild(t.firstChild);o=this.collapseFormatter(this.generateCollapsedRowData(e)),o&&t.appendChild(o)}},q.prototype.generateCollapsedRowData=function(e){var t,o=this,i=e.getData(),n=[];return this.hiddenColumns.forEach(function(s){var a=s.getFieldValue(i);s.definition.title&&s.field&&(s.modules.format&&o.table.options.responsiveLayoutCollapseUseFormatters?(t={value:!1,data:{},getValue:function(){return a},getData:function(){return i},getElement:function(){return document.createElement("div")},getRow:function(){return e.getComponent()},getColumn:function(){return s.getComponent()}},n.push({title:s.definition.title,value:s.modules.format.formatter.call(o.table.modules.format,t,s.modules.format.params)})):n.push({title:s.definition.title,value:a}))}),n},q.prototype.formatCollapsedData=function(e){var t=document.createElement("table"),o="";return e.forEach(function(e){var t=document.createElement("div");e.value instanceof Node&&(t.appendChild(e.value),e.value=t.innerHTML),o+=""+e.title+""+e.value+""}),t.innerHTML=o,Object.keys(e).length?t:""},h.prototype.registerModule("responsiveLayout",q);var K=function(e){this.table=e,this.selecting=!1,this.lastClickedRow=!1,this.selectPrev=[],this.selectedRows=[],this.headerCheckboxElement=null};K.prototype.clearSelectionData=function(e){this.selecting=!1,this.lastClickedRow=!1,this.selectPrev=[],this.selectedRows=[],e||this._rowSelectionChanged()},K.prototype.initializeRow=function(e){var t=this,o=e.getElement(),i=function e(){setTimeout(function(){t.selecting=!1},50),document.body.removeEventListener("mouseup",e)};e.modules.select={selected:!1},t.table.options.selectableCheck.call(this.table,e.getComponent())?(o.classList.add("tabulator-selectable"),o.classList.remove("tabulator-unselectable"),t.table.options.selectable&&"highlight"!=t.table.options.selectable&&("click"===t.table.options.selectableRangeMode?o.addEventListener("click",function(o){if(o.shiftKey){t.table._clearSelection(),t.lastClickedRow=t.lastClickedRow||e;var i=t.table.rowManager.getDisplayRowIndex(t.lastClickedRow),n=t.table.rowManager.getDisplayRowIndex(e),s=i<=n?i:n,a=i>=n?i:n,r=t.table.rowManager.getDisplayRows().slice(0),l=r.splice(s,a-s+1);o.ctrlKey||o.metaKey?(l.forEach(function(o){o!==t.lastClickedRow&&(!0===t.table.options.selectable||t.isRowSelected(e)?t.toggleRow(o):t.selectedRows.lengtht.table.options.selectable&&(l=l.slice(0,t.table.options.selectable)),t.selectRows(l)),t.table._clearSelection()}else o.ctrlKey||o.metaKey?(t.toggleRow(e),t.lastClickedRow=e):(t.deselectRows(void 0,!0),t.selectRows(e),t.lastClickedRow=e)}):(o.addEventListener("click",function(o){t.table.modExists("edit")&&t.table.modules.edit.getCurrentCell()||t.table._clearSelection(),t.selecting||t.toggleRow(e)}),o.addEventListener("mousedown",function(o){if(o.shiftKey)return t.table._clearSelection(),t.selecting=!0,t.selectPrev=[],document.body.addEventListener("mouseup",i),document.body.addEventListener("keyup",i),t.toggleRow(e),!1}),o.addEventListener("mouseenter",function(o){t.selecting&&(t.table._clearSelection(),t.toggleRow(e),t.selectPrev[1]==e&&t.toggleRow(t.selectPrev[0]))}),o.addEventListener("mouseout",function(o){t.selecting&&(t.table._clearSelection(),t.selectPrev.unshift(e))})))):(o.classList.add("tabulator-unselectable"),o.classList.remove("tabulator-selectable"))},K.prototype.toggleRow=function(e){this.table.options.selectableCheck.call(this.table,e.getComponent())&&(e.modules.select&&e.modules.select.selected?this._deselectRow(e):this._selectRow(e))},K.prototype.selectRows=function(e){var t,o=this;switch(void 0===e?"undefined":_typeof(e)){case"undefined":this.table.rowManager.rows.forEach(function(e){o._selectRow(e,!0,!0)}),this._rowSelectionChanged();break;case"string":t=this.table.rowManager.findRow(e),t?this._selectRow(t,!0,!0):this.table.rowManager.getRows(e).forEach(function(e){o._selectRow(e,!0,!0)}),this._rowSelectionChanged();break;default:Array.isArray(e)?(e.forEach(function(e){o._selectRow(e,!0,!0)}),this._rowSelectionChanged()):this._selectRow(e,!1,!0)}},K.prototype._selectRow=function(e,t,o){if(!isNaN(this.table.options.selectable)&&!0!==this.table.options.selectable&&!o&&this.selectedRows.length>=this.table.options.selectable){if(!this.table.options.selectableRollingSelection)return!1;this._deselectRow(this.selectedRows[0])}var i=this.table.rowManager.findRow(e);i?-1==this.selectedRows.indexOf(i)&&(i.modules.select||(i.modules.select={}),i.modules.select.selected=!0,i.modules.select.checkboxEl&&(i.modules.select.checkboxEl.checked=!0),i.getElement().classList.add("tabulator-selected"),this.selectedRows.push(i),this.table.options.dataTreeSelectPropagate&&this.childRowSelection(i,!0),t||this.table.options.rowSelected.call(this.table,i.getComponent()),this._rowSelectionChanged(t)):t||console.warn("Selection Error - No such row found, ignoring selection:"+e)},K.prototype.isRowSelected=function(e){return-1!==this.selectedRows.indexOf(e)},K.prototype.deselectRows=function(e,t){var o,i=this;if(void 0===e){o=i.selectedRows.length;for(var n=0;n-1&&(n.modules.select||(n.modules.select={}),n.modules.select.selected=!1,n.modules.select.checkboxEl&&(n.modules.select.checkboxEl.checked=!1),n.getElement().classList.remove("tabulator-selected"),i.selectedRows.splice(o,1),this.table.options.dataTreeSelectPropagate&&this.childRowSelection(n,!1),t||i.table.options.rowDeselected.call(this.table,n.getComponent()),i._rowSelectionChanged(t)):t||console.warn("Deselection Error - No such row found, ignoring selection:"+e)},K.prototype.getSelectedData=function(){var e=[];return this.selectedRows.forEach(function(t){e.push(t.getData())}),e},K.prototype.getSelectedRows=function(){var e=[];return this.selectedRows.forEach(function(t){e.push(t.getComponent())}),e},K.prototype._rowSelectionChanged=function(e){this.headerCheckboxElement&&(0===this.selectedRows.length?(this.headerCheckboxElement.checked=!1,this.headerCheckboxElement.indeterminate=!1):this.table.rowManager.rows.length===this.selectedRows.length?(this.headerCheckboxElement.checked=!0,this.headerCheckboxElement.indeterminate=!1):(this.headerCheckboxElement.indeterminate=!0,this.headerCheckboxElement.checked=!1)),e||this.table.options.rowSelectionChanged.call(this.table,this.getSelectedData(),this.getSelectedRows())},K.prototype.registerRowSelectCheckbox=function(e,t){e._row.modules.select||(e._row.modules.select={}),e._row.modules.select.checkboxEl=t},K.prototype.registerHeaderSelectCheckbox=function(e){this.headerCheckboxElement=e},K.prototype.childRowSelection=function(e,t){var o=this.table.modules.dataTree.getChildren(e);if(t)for(var i=o,n=Array.isArray(i),s=0,i=n?i:i[Symbol.iterator]();;){var a;if(n){if(s>=i.length)break;a=i[s++]}else{if(s=i.next(),s.done)break;a=s.value}var r=a;this._selectRow(r,!0)}else for(var l=o,c=Array.isArray(l),u=0,l=c?l:l[Symbol.iterator]();;){var d;if(c){if(u>=l.length)break;d=l[u++]}else{if(u=l.next(),u.done)break;d=u.value}var h=d;this._deselectRow(h,!0)}},h.prototype.registerModule("selectRow",K);var J=function(e){this.table=e,this.sortList=[],this.changed=!1};J.prototype.initializeColumn=function(e,t){var o,i,n=this,s=!1;switch(_typeof(e.definition.sorter)){case"string":n.sorters[e.definition.sorter]?s=n.sorters[e.definition.sorter]:console.warn("Sort Error - No such sorter found: ",e.definition.sorter);break;case"function":s=e.definition.sorter}e.modules.sort={sorter:s,dir:"none",params:e.definition.sorterParams||{},startingDir:e.definition.headerSortStartingDir||"asc",tristate:void 0!==e.definition.headerSortTristate?e.definition.headerSortTristate:this.table.options.headerSortTristate},(void 0===e.definition.headerSort?!1!==this.table.options.headerSort:!1!==e.definition.headerSort)&&(o=e.getElement(),o.classList.add("tabulator-sortable"),i=document.createElement("div"),i.classList.add("tabulator-col-sorter"),"object"==_typeof(this.table.options.headerSortElement)?i.appendChild(this.table.options.headerSortElement):i.innerHTML=this.table.options.headerSortElement,t.appendChild(i),e.modules.sort.element=i,o.addEventListener("click",function(t){var o="",i=[],s=!1;if(e.modules.sort){if(e.modules.sort.tristate)o="none"==e.modules.sort.dir?e.modules.sort.startingDir:e.modules.sort.dir==e.modules.sort.startingDir?"asc"==e.modules.sort.dir?"desc":"asc":"none";else switch(e.modules.sort.dir){case"asc":o="desc";break;case"desc":o="asc";break;default:o=e.modules.sort.startingDir}n.table.options.columnHeaderSortMulti&&(t.shiftKey||t.ctrlKey)?(i=n.getSort(),s=i.findIndex(function(t){return t.field===e.getField()}),s>-1?(i[s].dir=o,s!=i.length-1&&(s=i.splice(s,1)[0],"none"!=o&&i.push(s))):"none"!=o&&i.push({column:e,dir:o}),n.setSort(i)):"none"==o?n.clear():n.setSort(e,o),n.table.rowManager.sorterRefresh(!n.sortList.length)}}))},J.prototype.hasChanged=function(){var e=this.changed;return this.changed=!1,e},J.prototype.getSort=function(){var e=this,t=[];return e.sortList.forEach(function(e){e.column&&t.push({column:e.column.getComponent(),field:e.column.getField(),dir:e.dir})}),t},J.prototype.setSort=function(e,t){var o=this,i=[];Array.isArray(e)||(e=[{column:e,dir:t}]),e.forEach(function(e){var t;t=o.table.columnManager.findColumn(e.column),t?(e.column=t,i.push(e),o.changed=!0):console.warn("Sort Warning - Sort field does not exist and is being ignored: ",e.column)}),o.sortList=i,this.table.options.persistence&&this.table.modExists("persistence",!0)&&this.table.modules.persistence.config.sort&&this.table.modules.persistence.save("sort")},J.prototype.clear=function(){this.setSort([])},J.prototype.findSorter=function(e){var t,o=this.table.rowManager.activeRows[0],i="string";if(o&&(o=o.getData(),e.getField()))switch(t=e.getFieldValue(o),void 0===t?"undefined":_typeof(t)){case"undefined":i="string";break;case"boolean":i="boolean";break;default:isNaN(t)||""===t?t.match(/((^[0-9]+[a-z]+)|(^[a-z]+[0-9]+))+$/i)&&(i="alphanum"):i="number"}return this.sorters[i]},J.prototype.sort=function(e){var t=this,o=this.table.options.sortOrderReverse?t.sortList.slice().reverse():t.sortList,i=[],n=[];t.table.options.dataSorting&&t.table.options.dataSorting.call(t.table,t.getSort()),t.clearColumnHeaders(),t.table.options.ajaxSorting?o.forEach(function(e,o){t.setColumnHeader(e.column,e.dir)}):(o.forEach(function(e,o){var n=e.column.modules.sort;e.column&&n&&(n.sorter||(n.sorter=t.findSorter(e.column)),e.params="function"==typeof n.params?n.params(e.column.getComponent(),e.dir):n.params,i.push(e)),t.setColumnHeader(e.column,e.dir)}),i.length&&t._sortItems(e,i)),t.table.options.dataSorted&&(e.forEach(function(e){n.push(e.getComponent())}),t.table.options.dataSorted.call(t.table,t.getSort(),n))},J.prototype.clearColumnHeaders=function(){this.table.columnManager.getRealColumns().forEach(function(e){e.modules.sort&&(e.modules.sort.dir="none",e.getElement().setAttribute("aria-sort","none"))})},J.prototype.setColumnHeader=function(e,t){e.modules.sort.dir=t,e.getElement().setAttribute("aria-sort",t)},J.prototype._sortItems=function(e,t){var o=this,i=t.length-1;e.sort(function(e,n){for(var s,a=i;a>=0;a--){var r=t[a];if(0!==(s=o._sortRow(e,n,r.column,r.dir,r.params)))break}return s})},J.prototype._sortRow=function(e,t,o,i,n){var s,a,r="asc"==i?e:t,l="asc"==i?t:e;return e=o.getFieldValue(r.getData()),t=o.getFieldValue(l.getData()),e=void 0!==e?e:"",t=void 0!==t?t:"",s=r.getComponent(),a=l.getComponent(),o.modules.sort.sorter.call(this,e,t,s,a,o.getComponent(),i,n)},J.prototype.sorters={number:function(e,t,o,i,n,s,a){var r=a.alignEmptyValues,l=a.decimalSeparator||".",c=a.thousandSeparator||",",u=0;if(e=parseFloat(String(e).split(c).join("").split(l).join(".")),t=parseFloat(String(t).split(c).join("").split(l).join(".")),isNaN(e))u=isNaN(t)?0:-1;else{if(!isNaN(t))return e-t;u=1}return("top"===r&&"desc"===s||"bottom"===r&&"asc"===s)&&(u*=-1),u},string:function(e,t,o,i,n,s,a){var r,l=a.alignEmptyValues,c=0;if(e){if(t){switch(_typeof(a.locale)){case"boolean":a.locale&&(r=this.table.modules.localize.getLocale());break;case"string":r=a.locale}return String(e).toLowerCase().localeCompare(String(t).toLowerCase(),r)}c=1}else c=t?-1:0;return("top"===l&&"desc"===s||"bottom"===l&&"asc"===s)&&(c*=-1),c},date:function(e,t,o,i,n,s,a){return a.format||(a.format="DD/MM/YYYY"),this.sorters.datetime.call(this,e,t,o,i,n,s,a)},time:function(e,t,o,i,n,s,a){return a.format||(a.format="HH:mm"),this.sorters.datetime.call(this,e,t,o,i,n,s,a)},datetime:function(e,t,o,i,n,s,a){var r=a.format||"DD/MM/YYYY HH:mm:ss",l=a.alignEmptyValues,c=0;if("undefined"!=typeof moment){if(e=moment(e,r),t=moment(t,r),e.isValid()){if(t.isValid())return e-t;c=1}else c=t.isValid()?-1:0;return("top"===l&&"desc"===s||"bottom"===l&&"asc"===s)&&(c*=-1),c}console.error("Sort Error - 'datetime' sorter is dependant on moment.js")},boolean:function(e,t,o,i,n,s,a){return(!0===e||"true"===e||"True"===e||1===e?1:0)-(!0===t||"true"===t||"True"===t||1===t?1:0)},array:function(e,t,o,i,n,s,a){function r(e){switch(u){case"length":return e.length;case"sum":return e.reduce(function(e,t){return e+t});case"max":return Math.max.apply(null,e);case"min":return Math.min.apply(null,e);case"avg":return e.reduce(function(e,t){return e+t})/e.length}} +var l=0,c=0,u=a.type||"length",d=a.alignEmptyValues,h=0;if(Array.isArray(e)){if(Array.isArray(t))return l=e?r(e):0,c=t?r(t):0,l-c;d=1}else d=Array.isArray(t)?-1:0;return("top"===d&&"desc"===s||"bottom"===d&&"asc"===s)&&(h*=-1),h},exists:function(e,t,o,i,n,s,a){return(void 0===e?0:1)-(void 0===t?0:1)},alphanum:function(e,t,o,i,n,s,a){var r,l,c,u,d,h=0,p=/(\d+)|(\D+)/g,m=/\d/,f=a.alignEmptyValues,g=0;if(e||0===e){if(t||0===t){if(isFinite(e)&&isFinite(t))return e-t;if(r=String(e).toLowerCase(),l=String(t).toLowerCase(),r===l)return 0;if(!m.test(r)||!m.test(l))return r>l?1:-1;for(r=r.match(p),l=l.match(p),d=r.length>l.length?l.length:r.length;hu?1:-1;return r.length>l.length}g=1}else g=t||0===t?-1:0;return("top"===f&&"desc"===s||"bottom"===f&&"asc"===s)&&(g*=-1),g}},h.prototype.registerModule("sort",J);var $=function(e){this.table=e,this.invalidCells=[]};return $.prototype.initializeColumn=function(e){var t,o=this,i=[];e.definition.validator&&(Array.isArray(e.definition.validator)?e.definition.validator.forEach(function(e){(t=o._extractValidator(e))&&i.push(t)}):(t=this._extractValidator(e.definition.validator))&&i.push(t),e.modules.validate=!!i.length&&i)},$.prototype._extractValidator=function(e){var t,o,i;switch(void 0===e?"undefined":_typeof(e)){case"string":return i=e.indexOf(":"),i>-1?(t=e.substring(0,i),o=e.substring(i+1)):t=e,this._buildValidator(t,o);case"function":return this._buildValidator(e);case"object":return this._buildValidator(e.type,e.parameters)}},$.prototype._buildValidator=function(e,t){var o="function"==typeof e?e:this.validators[e];return o?{type:"function"==typeof e?"function":e,func:o,params:t}:(console.warn("Validator Setup Error - No matching validator found:",e),!1)},$.prototype.validate=function(e,t,o){var i=this,n=[],s=this.invalidCells.indexOf(t);return e&&e.forEach(function(e){e.func.call(i,t.getComponent(),o,e.params)||n.push({type:e.type,parameters:e.params})}),n=!n.length||n,t.modules.validate||(t.modules.validate={}),!0===n?(t.modules.validate.invalid=!1,t.getElement().classList.remove("tabulator-validation-fail"),s>-1&&this.invalidCells.splice(s,1)):(t.modules.validate.invalid=!0,"manual"!==this.table.options.validationMode&&t.getElement().classList.add("tabulator-validation-fail"),-1==s&&this.invalidCells.push(t)),n},$.prototype.getInvalidCells=function(){var e=[];return this.invalidCells.forEach(function(t){e.push(t.getComponent())}),e},$.prototype.clearValidation=function(e){var t;e.modules.validate&&e.modules.validate.invalid&&(e.getElement().classList.remove("tabulator-validation-fail"),e.modules.validate.invalid=!1,(t=this.invalidCells.indexOf(e))>-1&&this.invalidCells.splice(t,1))},$.prototype.validators={integer:function(e,t,o){return""===t||null===t||void 0===t||"number"==typeof(t=Number(t))&&isFinite(t)&&Math.floor(t)===t},float:function(e,t,o){return""===t||null===t||void 0===t||"number"==typeof(t=Number(t))&&isFinite(t)&&t%1!=0},numeric:function(e,t,o){return""===t||null===t||void 0===t||!isNaN(t)},string:function(e,t,o){return""===t||null===t||void 0===t||isNaN(t)},max:function(e,t,o){return""===t||null===t||void 0===t||parseFloat(t)<=o},min:function(e,t,o){return""===t||null===t||void 0===t||parseFloat(t)>=o},starts:function(e,t,o){return""===t||null===t||void 0===t||String(t).toLowerCase().startsWith(String(o).toLowerCase())},ends:function(e,t,o){return""===t||null===t||void 0===t||String(t).toLowerCase().endsWith(String(o).toLowerCase())},minLength:function(e,t,o){return""===t||null===t||void 0===t||String(t).length>=o},maxLength:function(e,t,o){return""===t||null===t||void 0===t||String(t).length<=o},in:function(e,t,o){return""===t||null===t||void 0===t||("string"==typeof o&&(o=o.split("|")),""===t||o.indexOf(t)>-1)},regex:function(e,t,o){return""===t||null===t||void 0===t||new RegExp(o).test(t)},unique:function(e,t,o){if(""===t||null===t||void 0===t)return!0;var i=!0,n=e.getData(),s=e.getColumn()._getSelf();return this.table.rowManager.rows.forEach(function(e){var o=e.getData();o!==n&&t==s.getFieldValue(o)&&(i=!1)}),i},required:function(e,t,o){return""!==t&&null!==t&&void 0!==t}},h.prototype.registerModule("validate",$),h}); \ No newline at end of file diff --git a/website/js/vendor/tabulator/js/tabulator_core.js b/website/js/vendor/tabulator/js/tabulator_core.js new file mode 100644 index 0000000..63ce7bc --- /dev/null +++ b/website/js/vendor/tabulator/js/tabulator_core.js @@ -0,0 +1,9636 @@ +/* Tabulator v4.8.3 (c) Oliver Folkerd */ + +'use strict'; + +// https://tc39.github.io/ecma262/#sec-array.prototype.findIndex + +var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; + +if (!Array.prototype.findIndex) { + + Object.defineProperty(Array.prototype, 'findIndex', { + + value: function value(predicate) { + + // 1. Let O be ? ToObject(this value). + + if (this == null) { + + throw new TypeError('"this" is null or not defined'); + } + + var o = Object(this); + + // 2. Let len be ? ToLength(? Get(O, "length")). + + var len = o.length >>> 0; + + // 3. If IsCallable(predicate) is false, throw a TypeError exception. + + if (typeof predicate !== 'function') { + + throw new TypeError('predicate must be a function'); + } + + // 4. If thisArg was supplied, let T be thisArg; else let T be undefined. + + var thisArg = arguments[1]; + + // 5. Let k be 0. + + var k = 0; + + // 6. Repeat, while k < len + + while (k < len) { + + // a. Let Pk be ! ToString(k). + + // b. Let kValue be ? Get(O, Pk). + + // c. Let testResult be ToBoolean(? Call(predicate, T, « kValue, k, O »)). + + // d. If testResult is true, return k. + + var kValue = o[k]; + + if (predicate.call(thisArg, kValue, k, o)) { + + return k; + } + + // e. Increase k by 1. + + k++; + } + + // 7. Return -1. + + return -1; + } + + }); +} + +// https://tc39.github.io/ecma262/#sec-array.prototype.find + +if (!Array.prototype.find) { + + Object.defineProperty(Array.prototype, 'find', { + + value: function value(predicate) { + + // 1. Let O be ? ToObject(this value). + + if (this == null) { + + throw new TypeError('"this" is null or not defined'); + } + + var o = Object(this); + + // 2. Let len be ? ToLength(? Get(O, "length")). + + var len = o.length >>> 0; + + // 3. If IsCallable(predicate) is false, throw a TypeError exception. + + if (typeof predicate !== 'function') { + + throw new TypeError('predicate must be a function'); + } + + // 4. If thisArg was supplied, let T be thisArg; else let T be undefined. + + var thisArg = arguments[1]; + + // 5. Let k be 0. + + var k = 0; + + // 6. Repeat, while k < len + + while (k < len) { + + // a. Let Pk be ! ToString(k). + + // b. Let kValue be ? Get(O, Pk). + + // c. Let testResult be ToBoolean(? Call(predicate, T, « kValue, k, O »)). + + // d. If testResult is true, return kValue. + + var kValue = o[k]; + + if (predicate.call(thisArg, kValue, k, o)) { + + return kValue; + } + + // e. Increase k by 1. + + k++; + } + + // 7. Return undefined. + + return undefined; + } + + }); +} + +// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/includes#Polyfill + +if (!String.prototype.includes) { + + String.prototype.includes = function (search, start) { + + 'use strict'; + + if (search instanceof RegExp) { + + throw TypeError('first argument must not be a RegExp'); + } + + if (start === undefined) { + start = 0; + } + + return this.indexOf(search, start) !== -1; + }; +} + +// https://tc39.github.io/ecma262/#sec-array.prototype.includes + +if (!Array.prototype.includes) { + + Object.defineProperty(Array.prototype, 'includes', { + + value: function value(searchElement, fromIndex) { + + if (this == null) { + + throw new TypeError('"this" is null or not defined'); + } + + // 1. Let O be ? ToObject(this value). + + var o = Object(this); + + // 2. Let len be ? ToLength(? Get(O, "length")). + + var len = o.length >>> 0; + + // 3. If len is 0, return false. + + if (len === 0) { + + return false; + } + + // 4. Let n be ? ToInteger(fromIndex). + + // (If fromIndex is undefined, this step produces the value 0.) + + var n = fromIndex | 0; + + // 5. If n ≥ 0, then + + // a. Let k be n. + + // 6. Else n < 0, + + // a. Let k be len + n. + + // b. If k < 0, let k be 0. + + var k = Math.max(n >= 0 ? n : len - Math.abs(n), 0); + + function sameValueZero(x, y) { + + return x === y || typeof x === 'number' && typeof y === 'number' && isNaN(x) && isNaN(y); + } + + // 7. Repeat, while k < len + + while (k < len) { + + // a. Let elementK be the result of ? Get(O, ! ToString(k)). + + // b. If SameValueZero(searchElement, elementK) is true, return true. + + if (sameValueZero(o[k], searchElement)) { + + return true; + } + + // c. Increase k by 1. + + k++; + } + + // 8. Return false + + return false; + } + + }); +} + +// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/assign#Polyfill + +if (typeof Object.assign !== 'function') { + + // Must be writable: true, enumerable: false, configurable: true + + Object.defineProperty(Object, "assign", { + + value: function assign(target, varArgs) { + // .length of function is 2 + + 'use strict'; + + if (target === null || target === undefined) { + + throw new TypeError('Cannot convert undefined or null to object'); + } + + var to = Object(target); + + for (var index = 1; index < arguments.length; index++) { + + var nextSource = arguments[index]; + + if (nextSource !== null && nextSource !== undefined) { + + for (var nextKey in nextSource) { + + // Avoid bugs when hasOwnProperty is shadowed + + if (Object.prototype.hasOwnProperty.call(nextSource, nextKey)) { + + to[nextKey] = nextSource[nextKey]; + } + } + } + } + + return to; + }, + + writable: true, + + configurable: true + + }); +} + +var ColumnManager = function ColumnManager(table) { + + this.table = table; //hold parent table + + this.blockHozScrollEvent = false; + + this.headersElement = this.createHeadersElement(); + + this.element = this.createHeaderElement(); //containing element + + this.rowManager = null; //hold row manager object + + this.columns = []; // column definition object + + this.columnsByIndex = []; //columns by index + + this.columnsByField = {}; //columns by field + + this.scrollLeft = 0; + + this.element.insertBefore(this.headersElement, this.element.firstChild); +}; + +////////////// Setup Functions ///////////////// + + +ColumnManager.prototype.createHeadersElement = function () { + + var el = document.createElement("div"); + + el.classList.add("tabulator-headers"); + + return el; +}; + +ColumnManager.prototype.createHeaderElement = function () { + + var el = document.createElement("div"); + + el.classList.add("tabulator-header"); + + if (!this.table.options.headerVisible) { + + el.classList.add("tabulator-header-hidden"); + } + + return el; +}; + +ColumnManager.prototype.initialize = function () { + + var self = this; + + //scroll body along with header + + // self.element.addEventListener("scroll", function(e){ + + // if(!self.blockHozScrollEvent){ + + // self.table.rowManager.scrollHorizontal(self.element.scrollLeft); + + // } + + // }); +}; + +//link to row manager + +ColumnManager.prototype.setRowManager = function (manager) { + + this.rowManager = manager; +}; + +//return containing element + +ColumnManager.prototype.getElement = function () { + + return this.element; +}; + +//return header containing element + +ColumnManager.prototype.getHeadersElement = function () { + + return this.headersElement; +}; + +// ColumnManager.prototype.tempScrollBlock = function(){ + +// clearTimeout(this.blockHozScrollEvent); + +// this.blockHozScrollEvent = setTimeout(() => {this.blockHozScrollEvent = false;}, 50); + +// } + + +//scroll horizontally to match table body + +ColumnManager.prototype.scrollHorizontal = function (left) { + + var hozAdjust = 0, + scrollWidth = this.element.scrollWidth - this.table.element.clientWidth; + + // this.tempScrollBlock(); + + this.element.scrollLeft = left; + + //adjust for vertical scrollbar moving table when present + + if (left > scrollWidth) { + + hozAdjust = left - scrollWidth; + + this.element.style.marginLeft = -hozAdjust + "px"; + } else { + + this.element.style.marginLeft = 0; + } + + //keep frozen columns fixed in position + + //this._calcFrozenColumnsPos(hozAdjust + 3); + + + this.scrollLeft = left; + + if (this.table.modExists("frozenColumns")) { + + this.table.modules.frozenColumns.scrollHorizontal(); + } +}; + +///////////// Column Setup Functions ///////////// + + +ColumnManager.prototype.generateColumnsFromRowData = function (data) { + + var cols = [], + definitions = this.table.options.autoColumnsDefinitions, + row, + sorter; + + if (data && data.length) { + + row = data[0]; + + for (var key in row) { + + var col = { + + field: key, + + title: key + + }; + + var value = row[key]; + + switch (typeof value === 'undefined' ? 'undefined' : _typeof(value)) { + + case "undefined": + + sorter = "string"; + + break; + + case "boolean": + + sorter = "boolean"; + + break; + + case "object": + + if (Array.isArray(value)) { + + sorter = "array"; + } else { + + sorter = "string"; + } + + break; + + default: + + if (!isNaN(value) && value !== "") { + + sorter = "number"; + } else { + + if (value.match(/((^[0-9]+[a-z]+)|(^[a-z]+[0-9]+))+$/i)) { + + sorter = "alphanum"; + } else { + + sorter = "string"; + } + } + + break; + + } + + col.sorter = sorter; + + cols.push(col); + } + + if (definitions) { + + switch (typeof definitions === 'undefined' ? 'undefined' : _typeof(definitions)) { + + case "function": + + this.table.options.columns = definitions.call(this.table, cols); + + break; + + case "object": + + if (Array.isArray(definitions)) { + + cols.forEach(function (col) { + + var match = definitions.find(function (def) { + + return def.field === col.field; + }); + + if (match) { + + Object.assign(col, match); + } + }); + } else { + + cols.forEach(function (col) { + + if (definitions[col.field]) { + + Object.assign(col, definitions[col.field]); + } + }); + } + + this.table.options.columns = cols; + + break; + + } + } else { + + this.table.options.columns = cols; + } + + this.setColumns(this.table.options.columns); + } +}; + +ColumnManager.prototype.setColumns = function (cols, row) { + + var self = this; + + while (self.headersElement.firstChild) { + self.headersElement.removeChild(self.headersElement.firstChild); + }self.columns = []; + + self.columnsByIndex = []; + + self.columnsByField = {}; + + //reset frozen columns + + if (self.table.modExists("frozenColumns")) { + + self.table.modules.frozenColumns.reset(); + } + + cols.forEach(function (def, i) { + + self._addColumn(def); + }); + + self._reIndexColumns(); + + if (self.table.options.responsiveLayout && self.table.modExists("responsiveLayout", true)) { + + self.table.modules.responsiveLayout.initialize(); + } + + if (this.table.options.virtualDomHoz) { + + this.table.vdomHoz.reinitialize(false, true); + } + + self.redraw(true); +}; + +ColumnManager.prototype._addColumn = function (definition, before, nextToColumn) { + + var column = new Column(definition, this), + colEl = column.getElement(), + index = nextToColumn ? this.findColumnIndex(nextToColumn) : nextToColumn; + + if (nextToColumn && index > -1) { + + var parentIndex = this.columns.indexOf(nextToColumn.getTopColumn()); + + var nextEl = nextToColumn.getElement(); + + if (before) { + + this.columns.splice(parentIndex, 0, column); + + nextEl.parentNode.insertBefore(colEl, nextEl); + } else { + + this.columns.splice(parentIndex + 1, 0, column); + + nextEl.parentNode.insertBefore(colEl, nextEl.nextSibling); + } + } else { + + if (before) { + + this.columns.unshift(column); + + this.headersElement.insertBefore(column.getElement(), this.headersElement.firstChild); + } else { + + this.columns.push(column); + + this.headersElement.appendChild(column.getElement()); + } + + column.columnRendered(); + } + + return column; +}; + +ColumnManager.prototype.registerColumnField = function (col) { + + if (col.definition.field) { + + this.columnsByField[col.definition.field] = col; + } +}; + +ColumnManager.prototype.registerColumnPosition = function (col) { + + this.columnsByIndex.push(col); +}; + +ColumnManager.prototype._reIndexColumns = function () { + + this.columnsByIndex = []; + + this.columns.forEach(function (column) { + + column.reRegisterPosition(); + }); +}; + +//ensure column headers take up the correct amount of space in column groups + +ColumnManager.prototype._verticalAlignHeaders = function () { + + var self = this, + minHeight = 0; + + self.columns.forEach(function (column) { + + var height; + + column.clearVerticalAlign(); + + height = column.getHeight(); + + if (height > minHeight) { + + minHeight = height; + } + }); + + self.columns.forEach(function (column) { + + column.verticalAlign(self.table.options.columnHeaderVertAlign, minHeight); + }); + + self.rowManager.adjustTableSize(); +}; + +//////////////// Column Details ///////////////// + + +ColumnManager.prototype.findColumn = function (subject) { + + var self = this; + + if ((typeof subject === 'undefined' ? 'undefined' : _typeof(subject)) == "object") { + + if (subject instanceof Column) { + + //subject is column element + + return subject; + } else if (subject instanceof ColumnComponent) { + + //subject is public column component + + return subject._getSelf() || false; + } else if (typeof HTMLElement !== "undefined" && subject instanceof HTMLElement) { + + //subject is a HTML element of the column header + + var match = self.columns.find(function (column) { + + return column.element === subject; + }); + + return match || false; + } + } else { + + //subject should be treated as the field name of the column + + return this.columnsByField[subject] || false; + } + + //catch all for any other type of input + + + return false; +}; + +ColumnManager.prototype.getColumnByField = function (field) { + + return this.columnsByField[field]; +}; + +ColumnManager.prototype.getColumnsByFieldRoot = function (root) { + var _this = this; + + var matches = []; + + Object.keys(this.columnsByField).forEach(function (field) { + + var fieldRoot = field.split(".")[0]; + + if (fieldRoot === root) { + + matches.push(_this.columnsByField[field]); + } + }); + + return matches; +}; + +ColumnManager.prototype.getColumnByIndex = function (index) { + + return this.columnsByIndex[index]; +}; + +ColumnManager.prototype.getFirstVisibileColumn = function (index) { + + var index = this.columnsByIndex.findIndex(function (col) { + + return col.visible; + }); + + return index > -1 ? this.columnsByIndex[index] : false; +}; + +ColumnManager.prototype.getColumns = function () { + + return this.columns; +}; + +ColumnManager.prototype.findColumnIndex = function (column) { + + return this.columnsByIndex.findIndex(function (col) { + + return column === col; + }); +}; + +//return all columns that are not groups + +ColumnManager.prototype.getRealColumns = function () { + + return this.columnsByIndex; +}; + +//travers across columns and call action + +ColumnManager.prototype.traverse = function (callback) { + + var self = this; + + self.columnsByIndex.forEach(function (column, i) { + + callback(column, i); + }); +}; + +//get defintions of actual columns + +ColumnManager.prototype.getDefinitions = function (active) { + + var self = this, + output = []; + + self.columnsByIndex.forEach(function (column) { + + if (!active || active && column.visible) { + + output.push(column.getDefinition()); + } + }); + + return output; +}; + +//get full nested definition tree + +ColumnManager.prototype.getDefinitionTree = function () { + + var self = this, + output = []; + + self.columns.forEach(function (column) { + + output.push(column.getDefinition(true)); + }); + + return output; +}; + +ColumnManager.prototype.getComponents = function (structured) { + + var self = this, + output = [], + columns = structured ? self.columns : self.columnsByIndex; + + columns.forEach(function (column) { + + output.push(column.getComponent()); + }); + + return output; +}; + +ColumnManager.prototype.getWidth = function () { + + var width = 0; + + this.columnsByIndex.forEach(function (column) { + + if (column.visible) { + + width += column.getWidth(); + } + }); + + return width; +}; + +ColumnManager.prototype.moveColumn = function (from, to, after) { + + this.moveColumnActual(from, to, after); + + if (this.table.options.responsiveLayout && this.table.modExists("responsiveLayout", true)) { + + this.table.modules.responsiveLayout.initialize(); + } + + if (this.table.modExists("columnCalcs")) { + + this.table.modules.columnCalcs.recalc(this.table.rowManager.activeRows); + } + + to.element.parentNode.insertBefore(from.element, to.element); + + if (after) { + + to.element.parentNode.insertBefore(to.element, from.element); + } + + this._verticalAlignHeaders(); + + this.table.rowManager.reinitialize(); +}; + +ColumnManager.prototype.moveColumnActual = function (from, to, after) { + + if (from.parent.isGroup) { + + this._moveColumnInArray(from.parent.columns, from, to, after); + } else { + + this._moveColumnInArray(this.columns, from, to, after); + } + + this._moveColumnInArray(this.columnsByIndex, from, to, after, true); + + if (this.table.options.responsiveLayout && this.table.modExists("responsiveLayout", true)) { + + this.table.modules.responsiveLayout.initialize(); + } + + if (this.table.options.virtualDomHoz) { + + this.table.vdomHoz.reinitialize(true); + } + + if (this.table.options.columnMoved) { + + this.table.options.columnMoved.call(this.table, from.getComponent(), this.table.columnManager.getComponents()); + } + + if (this.table.options.persistence && this.table.modExists("persistence", true) && this.table.modules.persistence.config.columns) { + + this.table.modules.persistence.save("columns"); + } +}; + +ColumnManager.prototype._moveColumnInArray = function (columns, from, to, after, updateRows) { + var _this2 = this; + + var fromIndex = columns.indexOf(from), + toIndex, + rows = []; + + if (fromIndex > -1) { + + columns.splice(fromIndex, 1); + + toIndex = columns.indexOf(to); + + if (toIndex > -1) { + + if (after) { + + toIndex = toIndex + 1; + } + } else { + + toIndex = fromIndex; + } + + columns.splice(toIndex, 0, from); + + if (updateRows) { + + if (this.table.options.dataTree && this.table.modExists("dataTree", true)) { + + this.table.rowManager.rows.forEach(function (row) { + + rows = rows.concat(_this2.table.modules.dataTree.getTreeChildren(row, false, true)); + }); + } + + rows = rows.concat(this.table.rowManager.rows); + + rows.forEach(function (row) { + + if (row.cells.length) { + + var cell = row.cells.splice(fromIndex, 1)[0]; + + row.cells.splice(toIndex, 0, cell); + } + }); + } + } +}; + +ColumnManager.prototype.scrollToColumn = function (column, position, ifVisible) { + var _this3 = this; + + var left = 0, + offset = 0, + adjust = 0, + colEl = column.getElement(); + + return new Promise(function (resolve, reject) { + + if (typeof position === "undefined") { + + position = _this3.table.options.scrollToColumnPosition; + } + + if (typeof ifVisible === "undefined") { + + ifVisible = _this3.table.options.scrollToColumnIfVisible; + } + + if (column.visible) { + + //align to correct position + + switch (position) { + + case "middle": + + case "center": + + adjust = -_this3.element.clientWidth / 2; + + break; + + case "right": + + adjust = colEl.clientWidth - _this3.headersElement.clientWidth; + + break; + + } + + //check column visibility + + if (!ifVisible) { + + offset = colEl.offsetLeft; + + if (offset > 0 && offset + colEl.offsetWidth < _this3.element.clientWidth) { + + return false; + } + } + + //calculate scroll position + + left = colEl.offsetLeft + adjust; + + left = Math.max(Math.min(left, _this3.table.rowManager.element.scrollWidth - _this3.table.rowManager.element.clientWidth), 0); + + _this3.table.rowManager.scrollHorizontal(left); + + _this3.scrollHorizontal(left); + + resolve(); + } else { + + console.warn("Scroll Error - Column not visible"); + + reject("Scroll Error - Column not visible"); + } + }); +}; + +//////////////// Cell Management ///////////////// + + +ColumnManager.prototype.generateCells = function (row) { + + var self = this; + + var cells = []; + + self.columnsByIndex.forEach(function (column) { + + cells.push(column.generateCell(row)); + }); + + return cells; +}; + +//////////////// Column Management ///////////////// + + +ColumnManager.prototype.getFlexBaseWidth = function () { + + var self = this, + totalWidth = self.table.element.clientWidth, + //table element width + + fixedWidth = 0; + + //adjust for vertical scrollbar if present + + if (self.rowManager.element.scrollHeight > self.rowManager.element.clientHeight) { + + totalWidth -= self.rowManager.element.offsetWidth - self.rowManager.element.clientWidth; + } + + this.columnsByIndex.forEach(function (column) { + + var width, minWidth, colWidth; + + if (column.visible) { + + width = column.definition.width || 0; + + minWidth = typeof column.minWidth == "undefined" ? self.table.options.columnMinWidth : parseInt(column.minWidth); + + if (typeof width == "string") { + + if (width.indexOf("%") > -1) { + + colWidth = totalWidth / 100 * parseInt(width); + } else { + + colWidth = parseInt(width); + } + } else { + + colWidth = width; + } + + fixedWidth += colWidth > minWidth ? colWidth : minWidth; + } + }); + + return fixedWidth; +}; + +ColumnManager.prototype.addColumn = function (definition, before, nextToColumn) { + var _this4 = this; + + return new Promise(function (resolve, reject) { + + var column = _this4._addColumn(definition, before, nextToColumn); + + _this4._reIndexColumns(); + + if (_this4.table.options.responsiveLayout && _this4.table.modExists("responsiveLayout", true)) { + + _this4.table.modules.responsiveLayout.initialize(); + } + + if (_this4.table.modExists("columnCalcs")) { + + _this4.table.modules.columnCalcs.recalc(_this4.table.rowManager.activeRows); + } + + _this4.redraw(); + + if (_this4.table.modules.layout.getMode() != "fitColumns") { + + column.reinitializeWidth(); + } + + _this4._verticalAlignHeaders(); + + _this4.table.rowManager.reinitialize(); + + if (_this4.table.options.virtualDomHoz) { + + _this4.table.vdomHoz.reinitialize(); + } + + resolve(column); + }); +}; + +//remove column from system + +ColumnManager.prototype.deregisterColumn = function (column) { + + var field = column.getField(), + index; + + //remove from field list + + if (field) { + + delete this.columnsByField[field]; + } + + //remove from index list + + index = this.columnsByIndex.indexOf(column); + + if (index > -1) { + + this.columnsByIndex.splice(index, 1); + } + + //remove from column list + + index = this.columns.indexOf(column); + + if (index > -1) { + + this.columns.splice(index, 1); + } + + if (this.table.options.responsiveLayout && this.table.modExists("responsiveLayout", true)) { + + this.table.modules.responsiveLayout.initialize(); + } + + this._verticalAlignHeaders(); + + this.redraw(); +}; + +//redraw columns + +ColumnManager.prototype.redraw = function (force) { + + if (force) { + + if (Tabulator.prototype.helpers.elVisible(this.element)) { + + this._verticalAlignHeaders(); + } + + this.table.rowManager.resetScroll(); + + this.table.rowManager.reinitialize(); + } + + if (["fitColumns", "fitDataStretch"].indexOf(this.table.modules.layout.getMode()) > -1) { + + this.table.modules.layout.layout(); + } else { + + if (force) { + + this.table.modules.layout.layout(); + } else { + + if (this.table.options.responsiveLayout && this.table.modExists("responsiveLayout", true)) { + + this.table.modules.responsiveLayout.update(); + } + } + } + + if (this.table.modExists("frozenColumns")) { + + this.table.modules.frozenColumns.layout(); + } + + if (this.table.modExists("columnCalcs")) { + + this.table.modules.columnCalcs.recalc(this.table.rowManager.activeRows); + } + + if (force) { + + if (this.table.options.persistence && this.table.modExists("persistence", true) && this.table.modules.persistence.config.columns) { + + this.table.modules.persistence.save("columns"); + } + + if (this.table.modExists("columnCalcs")) { + + this.table.modules.columnCalcs.redraw(); + } + } + + this.table.footerManager.redraw(); +}; + +//public column object +var ColumnComponent = function ColumnComponent(column) { + this._column = column; + this.type = "ColumnComponent"; +}; + +ColumnComponent.prototype.getElement = function () { + return this._column.getElement(); +}; + +ColumnComponent.prototype.getDefinition = function () { + return this._column.getDefinition(); +}; + +ColumnComponent.prototype.getField = function () { + return this._column.getField(); +}; + +ColumnComponent.prototype.getCells = function () { + var cells = []; + + this._column.cells.forEach(function (cell) { + cells.push(cell.getComponent()); + }); + + return cells; +}; + +ColumnComponent.prototype.getVisibility = function () { + console.warn("getVisibility function is deprecated, you should now use the isVisible function"); + return this._column.visible; +}; + +ColumnComponent.prototype.isVisible = function () { + return this._column.visible; +}; + +ColumnComponent.prototype.show = function () { + if (this._column.isGroup) { + this._column.columns.forEach(function (column) { + column.show(); + }); + } else { + this._column.show(); + } +}; + +ColumnComponent.prototype.hide = function () { + if (this._column.isGroup) { + this._column.columns.forEach(function (column) { + column.hide(); + }); + } else { + this._column.hide(); + } +}; + +ColumnComponent.prototype.toggle = function () { + if (this._column.visible) { + this.hide(); + } else { + this.show(); + } +}; + +ColumnComponent.prototype.delete = function () { + return this._column.delete(); +}; + +ColumnComponent.prototype.getSubColumns = function () { + var output = []; + + if (this._column.columns.length) { + this._column.columns.forEach(function (column) { + output.push(column.getComponent()); + }); + } + + return output; +}; + +ColumnComponent.prototype.getParentColumn = function () { + return this._column.parent instanceof Column ? this._column.parent.getComponent() : false; +}; + +ColumnComponent.prototype._getSelf = function () { + return this._column; +}; + +ColumnComponent.prototype.scrollTo = function () { + return this._column.table.columnManager.scrollToColumn(this._column); +}; + +ColumnComponent.prototype.getTable = function () { + return this._column.table; +}; + +ColumnComponent.prototype.headerFilterFocus = function () { + if (this._column.table.modExists("filter", true)) { + this._column.table.modules.filter.setHeaderFilterFocus(this._column); + } +}; + +ColumnComponent.prototype.reloadHeaderFilter = function () { + if (this._column.table.modExists("filter", true)) { + this._column.table.modules.filter.reloadHeaderFilter(this._column); + } +}; + +ColumnComponent.prototype.getHeaderFilterValue = function () { + if (this._column.table.modExists("filter", true)) { + return this._column.table.modules.filter.getHeaderFilterValue(this._column); + } +}; + +ColumnComponent.prototype.setHeaderFilterValue = function (value) { + if (this._column.table.modExists("filter", true)) { + this._column.table.modules.filter.setHeaderFilterValue(this._column, value); + } +}; + +ColumnComponent.prototype.move = function (to, after) { + var toColumn = this._column.table.columnManager.findColumn(to); + + if (toColumn) { + this._column.table.columnManager.moveColumn(this._column, toColumn, after); + } else { + console.warn("Move Error - No matching column found:", toColumn); + } +}; + +ColumnComponent.prototype.getNextColumn = function () { + var nextCol = this._column.nextColumn(); + + return nextCol ? nextCol.getComponent() : false; +}; + +ColumnComponent.prototype.getPrevColumn = function () { + var prevCol = this._column.prevColumn(); + + return prevCol ? prevCol.getComponent() : false; +}; + +ColumnComponent.prototype.updateDefinition = function (updates) { + return this._column.updateDefinition(updates); +}; + +ColumnComponent.prototype.getWidth = function () { + return this._column.getWidth(); +}; + +ColumnComponent.prototype.setWidth = function (width) { + var result; + + if (width === true) { + result = this._column.reinitializeWidth(true); + } else { + result = this._column.setWidth(width); + } + + if (this._column.table.options.virtualDomHoz) { + this._column.table.vdomHoz.reinitialize(true); + } + + return result; +}; + +ColumnComponent.prototype.validate = function () { + return this._column.validate(); +}; + +var Column = function Column(def, parent) { + var self = this; + + this.table = parent.table; + this.definition = def; //column definition + this.parent = parent; //hold parent object + this.type = "column"; //type of element + this.columns = []; //child columns + this.cells = []; //cells bound to this column + this.element = this.createElement(); //column header element + this.contentElement = false; + this.titleHolderElement = false; + this.titleElement = false; + this.groupElement = this.createGroupElement(); //column group holder element + this.isGroup = false; + this.tooltip = false; //hold column tooltip + this.hozAlign = ""; //horizontal text alignment + this.vertAlign = ""; //vert text alignment + + //multi dimensional filed handling + this.field = ""; + this.fieldStructure = ""; + this.getFieldValue = ""; + this.setFieldValue = ""; + + this.titleFormatterRendered = false; + + this.setField(this.definition.field); + + if (this.table.options.invalidOptionWarnings) { + this.checkDefinition(); + } + + this.modules = {}; //hold module variables; + + this.cellEvents = { + cellClick: false, + cellDblClick: false, + cellContext: false, + cellTap: false, + cellDblTap: false, + cellTapHold: false, + cellMouseEnter: false, + cellMouseLeave: false, + cellMouseOver: false, + cellMouseOut: false, + cellMouseMove: false + }; + + this.width = null; //column width + this.widthStyled = ""; //column width prestyled to improve render efficiency + this.minWidth = null; //column minimum width + this.minWidthStyled = ""; //column minimum prestyled to improve render efficiency + this.widthFixed = false; //user has specified a width for this column + + this.visible = true; //default visible state + + this.component = null; + + this._mapDepricatedFunctionality(); + + //initialize column + if (def.columns) { + + this.isGroup = true; + + def.columns.forEach(function (def, i) { + var newCol = new Column(def, self); + self.attachColumn(newCol); + }); + + self.checkColumnVisibility(); + } else { + parent.registerColumnField(this); + } + + if (def.rowHandle && this.table.options.movableRows !== false && this.table.modExists("moveRow")) { + this.table.modules.moveRow.setHandle(true); + } + + this._buildHeader(); + + this.bindModuleColumns(); +}; + +Column.prototype.createElement = function () { + var el = document.createElement("div"); + + el.classList.add("tabulator-col"); + el.setAttribute("role", "columnheader"); + el.setAttribute("aria-sort", "none"); + + return el; +}; + +Column.prototype.createGroupElement = function () { + var el = document.createElement("div"); + + el.classList.add("tabulator-col-group-cols"); + + return el; +}; + +Column.prototype.checkDefinition = function () { + var _this5 = this; + + Object.keys(this.definition).forEach(function (key) { + if (_this5.defaultOptionList.indexOf(key) === -1) { + console.warn("Invalid column definition option in '" + (_this5.field || _this5.definition.title) + "' column:", key); + } + }); +}; + +Column.prototype.setField = function (field) { + this.field = field; + this.fieldStructure = field ? this.table.options.nestedFieldSeparator ? field.split(this.table.options.nestedFieldSeparator) : [field] : []; + this.getFieldValue = this.fieldStructure.length > 1 ? this._getNestedData : this._getFlatData; + this.setFieldValue = this.fieldStructure.length > 1 ? this._setNestedData : this._setFlatData; +}; + +//register column position with column manager +Column.prototype.registerColumnPosition = function (column) { + this.parent.registerColumnPosition(column); +}; + +//register column position with column manager +Column.prototype.registerColumnField = function (column) { + this.parent.registerColumnField(column); +}; + +//trigger position registration +Column.prototype.reRegisterPosition = function () { + if (this.isGroup) { + this.columns.forEach(function (column) { + column.reRegisterPosition(); + }); + } else { + this.registerColumnPosition(this); + } +}; + +Column.prototype._mapDepricatedFunctionality = function () { + if (typeof this.definition.hideInHtml !== "undefined") { + this.definition.htmlOutput = !this.definition.hideInHtml; + console.warn("hideInHtml column definition property is deprecated, you should now use htmlOutput"); + } + + if (typeof this.definition.align !== "undefined") { + this.definition.hozAlign = this.definition.align; + console.warn("align column definition property is deprecated, you should now use hozAlign"); + } + + if (typeof this.definition.downloadTitle !== "undefined") { + this.definition.titleDownload = this.definition.downloadTitle; + console.warn("downloadTitle definition property is deprecated, you should now use titleDownload"); + } +}; + +Column.prototype.setTooltip = function () { + var self = this, + def = self.definition; + + //set header tooltips + var tooltip = def.headerTooltip || def.tooltip === false ? def.headerTooltip : self.table.options.tooltipsHeader; + + if (tooltip) { + if (tooltip === true) { + if (def.field) { + self.table.modules.localize.bind("columns|" + def.field, function (value) { + self.element.setAttribute("title", value || def.title); + }); + } else { + self.element.setAttribute("title", def.title); + } + } else { + if (typeof tooltip == "function") { + tooltip = tooltip(self.getComponent()); + + if (tooltip === false) { + tooltip = ""; + } + } + + self.element.setAttribute("title", tooltip); + } + } else { + self.element.setAttribute("title", ""); + } +}; + +//build header element +Column.prototype._buildHeader = function () { + var self = this, + def = self.definition; + + while (self.element.firstChild) { + self.element.removeChild(self.element.firstChild); + }if (def.headerVertical) { + self.element.classList.add("tabulator-col-vertical"); + + if (def.headerVertical === "flip") { + self.element.classList.add("tabulator-col-vertical-flip"); + } + } + + self.contentElement = self._bindEvents(); + + self.contentElement = self._buildColumnHeaderContent(); + + self.element.appendChild(self.contentElement); + + if (self.isGroup) { + self._buildGroupHeader(); + } else { + self._buildColumnHeader(); + } + + self.setTooltip(); + + //set resizable handles + if (self.table.options.resizableColumns && self.table.modExists("resizeColumns")) { + self.table.modules.resizeColumns.initializeColumn("header", self, self.element); + } + + //set resizable handles + if (def.headerFilter && self.table.modExists("filter") && self.table.modExists("edit")) { + if (typeof def.headerFilterPlaceholder !== "undefined" && def.field) { + self.table.modules.localize.setHeaderFilterColumnPlaceholder(def.field, def.headerFilterPlaceholder); + } + + self.table.modules.filter.initializeColumn(self); + } + + //set resizable handles + if (self.table.modExists("frozenColumns")) { + self.table.modules.frozenColumns.initializeColumn(self); + } + + //set movable column + if (self.table.options.movableColumns && !self.isGroup && self.table.modExists("moveColumn")) { + self.table.modules.moveColumn.initializeColumn(self); + } + + //set calcs column + if ((def.topCalc || def.bottomCalc) && self.table.modExists("columnCalcs")) { + self.table.modules.columnCalcs.initializeColumn(self); + } + + //handle persistence + if (self.table.modExists("persistence") && self.table.modules.persistence.config.columns) { + self.table.modules.persistence.initializeColumn(self); + } + + //update header tooltip on mouse enter + self.element.addEventListener("mouseenter", function (e) { + self.setTooltip(); + }); +}; + +Column.prototype._bindEvents = function () { + + var self = this, + def = self.definition, + dblTap, + tapHold, + tap; + + //setup header click event bindings + if (typeof def.headerClick == "function") { + self.element.addEventListener("click", function (e) { + def.headerClick(e, self.getComponent()); + }); + } + + if (typeof def.headerDblClick == "function") { + self.element.addEventListener("dblclick", function (e) { + def.headerDblClick(e, self.getComponent()); + }); + } + + if (typeof def.headerContext == "function") { + self.element.addEventListener("contextmenu", function (e) { + def.headerContext(e, self.getComponent()); + }); + } + + //setup header tap event bindings + if (typeof def.headerTap == "function") { + tap = false; + + self.element.addEventListener("touchstart", function (e) { + tap = true; + }, { passive: true }); + + self.element.addEventListener("touchend", function (e) { + if (tap) { + def.headerTap(e, self.getComponent()); + } + + tap = false; + }); + } + + if (typeof def.headerDblTap == "function") { + dblTap = null; + + self.element.addEventListener("touchend", function (e) { + + if (dblTap) { + clearTimeout(dblTap); + dblTap = null; + + def.headerDblTap(e, self.getComponent()); + } else { + + dblTap = setTimeout(function () { + clearTimeout(dblTap); + dblTap = null; + }, 300); + } + }); + } + + if (typeof def.headerTapHold == "function") { + tapHold = null; + + self.element.addEventListener("touchstart", function (e) { + clearTimeout(tapHold); + + tapHold = setTimeout(function () { + clearTimeout(tapHold); + tapHold = null; + tap = false; + def.headerTapHold(e, self.getComponent()); + }, 1000); + }, { passive: true }); + + self.element.addEventListener("touchend", function (e) { + clearTimeout(tapHold); + tapHold = null; + }); + } + + //store column cell click event bindings + if (typeof def.cellClick == "function") { + self.cellEvents.cellClick = def.cellClick; + } + + if (typeof def.cellDblClick == "function") { + self.cellEvents.cellDblClick = def.cellDblClick; + } + + if (typeof def.cellContext == "function") { + self.cellEvents.cellContext = def.cellContext; + } + + //store column mouse event bindings + if (typeof def.cellMouseEnter == "function") { + self.cellEvents.cellMouseEnter = def.cellMouseEnter; + } + + if (typeof def.cellMouseLeave == "function") { + self.cellEvents.cellMouseLeave = def.cellMouseLeave; + } + + if (typeof def.cellMouseOver == "function") { + self.cellEvents.cellMouseOver = def.cellMouseOver; + } + + if (typeof def.cellMouseOut == "function") { + self.cellEvents.cellMouseOut = def.cellMouseOut; + } + + if (typeof def.cellMouseMove == "function") { + self.cellEvents.cellMouseMove = def.cellMouseMove; + } + + //setup column cell tap event bindings + if (typeof def.cellTap == "function") { + self.cellEvents.cellTap = def.cellTap; + } + + if (typeof def.cellDblTap == "function") { + self.cellEvents.cellDblTap = def.cellDblTap; + } + + if (typeof def.cellTapHold == "function") { + self.cellEvents.cellTapHold = def.cellTapHold; + } + + //setup column cell edit callbacks + if (typeof def.cellEdited == "function") { + self.cellEvents.cellEdited = def.cellEdited; + } + + if (typeof def.cellEditing == "function") { + self.cellEvents.cellEditing = def.cellEditing; + } + + if (typeof def.cellEditCancelled == "function") { + self.cellEvents.cellEditCancelled = def.cellEditCancelled; + } +}; + +//build header element for header +Column.prototype._buildColumnHeader = function () { + var _this6 = this; + + var def = this.definition, + table = this.table, + sortable; + + //set column sorter + if (table.modExists("sort")) { + table.modules.sort.initializeColumn(this, this.titleHolderElement); + } + + //set column header context menu + if ((def.headerContextMenu || def.headerClickMenu || def.headerMenu) && table.modExists("menu")) { + table.modules.menu.initializeColumnHeader(this); + } + + //set column formatter + if (table.modExists("format")) { + table.modules.format.initializeColumn(this); + } + + //set column editor + if (typeof def.editor != "undefined" && table.modExists("edit")) { + table.modules.edit.initializeColumn(this); + } + + //set colum validator + if (typeof def.validator != "undefined" && table.modExists("validate")) { + table.modules.validate.initializeColumn(this); + } + + //set column mutator + if (table.modExists("mutator")) { + table.modules.mutator.initializeColumn(this); + } + + //set column accessor + if (table.modExists("accessor")) { + table.modules.accessor.initializeColumn(this); + } + + //set respoviveLayout + if (_typeof(table.options.responsiveLayout) && table.modExists("responsiveLayout")) { + table.modules.responsiveLayout.initializeColumn(this); + } + + //set column visibility + if (typeof def.visible != "undefined") { + if (def.visible) { + this.show(true); + } else { + this.hide(true); + } + } + + //asign additional css classes to column header + if (def.cssClass) { + var classeNames = def.cssClass.split(" "); + classeNames.forEach(function (className) { + _this6.element.classList.add(className); + }); + } + + if (def.field) { + this.element.setAttribute("tabulator-field", def.field); + } + + //set min width if present + this.setMinWidth(typeof def.minWidth == "undefined" ? this.table.options.columnMinWidth : parseInt(def.minWidth)); + + this.reinitializeWidth(); + + //set tooltip if present + this.tooltip = this.definition.tooltip || this.definition.tooltip === false ? this.definition.tooltip : this.table.options.tooltips; + + //set orizontal text alignment + this.hozAlign = typeof this.definition.hozAlign == "undefined" ? this.table.options.cellHozAlign : this.definition.hozAlign; + this.vertAlign = typeof this.definition.vertAlign == "undefined" ? this.table.options.cellVertAlign : this.definition.vertAlign; + + this.titleElement.style.textAlign = this.definition.headerHozAlign || this.table.options.headerHozAlign; +}; + +Column.prototype._buildColumnHeaderContent = function () { + var def = this.definition, + table = this.table; + + var contentElement = document.createElement("div"); + contentElement.classList.add("tabulator-col-content"); + + this.titleHolderElement = document.createElement("div"); + this.titleHolderElement.classList.add("tabulator-col-title-holder"); + + contentElement.appendChild(this.titleHolderElement); + + this.titleElement = this._buildColumnHeaderTitle(); + + this.titleHolderElement.appendChild(this.titleElement); + + return contentElement; +}; + +//build title element of column +Column.prototype._buildColumnHeaderTitle = function () { + var self = this, + def = self.definition, + table = self.table, + title; + + var titleHolderElement = document.createElement("div"); + titleHolderElement.classList.add("tabulator-col-title"); + + if (def.editableTitle) { + var titleElement = document.createElement("input"); + titleElement.classList.add("tabulator-title-editor"); + + titleElement.addEventListener("click", function (e) { + e.stopPropagation(); + titleElement.focus(); + }); + + titleElement.addEventListener("change", function () { + def.title = titleElement.value; + table.options.columnTitleChanged.call(self.table, self.getComponent()); + }); + + titleHolderElement.appendChild(titleElement); + + if (def.field) { + table.modules.localize.bind("columns|" + def.field, function (text) { + titleElement.value = text || def.title || " "; + }); + } else { + titleElement.value = def.title || " "; + } + } else { + if (def.field) { + table.modules.localize.bind("columns|" + def.field, function (text) { + self._formatColumnHeaderTitle(titleHolderElement, text || def.title || " "); + }); + } else { + self._formatColumnHeaderTitle(titleHolderElement, def.title || " "); + } + } + + return titleHolderElement; +}; + +Column.prototype._formatColumnHeaderTitle = function (el, title) { + var _this7 = this; + + var formatter, contents, params, mockCell, onRendered; + + if (this.definition.titleFormatter && this.table.modExists("format")) { + + formatter = this.table.modules.format.getFormatter(this.definition.titleFormatter); + + onRendered = function onRendered(callback) { + _this7.titleFormatterRendered = callback; + }; + + mockCell = { + getValue: function getValue() { + return title; + }, + getElement: function getElement() { + return el; + } + }; + + params = this.definition.titleFormatterParams || {}; + + params = typeof params === "function" ? params() : params; + + contents = formatter.call(this.table.modules.format, mockCell, params, onRendered); + + switch (typeof contents === 'undefined' ? 'undefined' : _typeof(contents)) { + case "object": + if (contents instanceof Node) { + el.appendChild(contents); + } else { + el.innerHTML = ""; + console.warn("Format Error - Title formatter has returned a type of object, the only valid formatter object return is an instance of Node, the formatter returned:", contents); + } + break; + case "undefined": + case "null": + el.innerHTML = ""; + break; + default: + el.innerHTML = contents; + } + } else { + el.innerHTML = title; + } +}; + +//build header element for column group +Column.prototype._buildGroupHeader = function () { + var _this8 = this; + + this.element.classList.add("tabulator-col-group"); + this.element.setAttribute("role", "columngroup"); + this.element.setAttribute("aria-title", this.definition.title); + + //asign additional css classes to column header + if (this.definition.cssClass) { + var classeNames = this.definition.cssClass.split(" "); + classeNames.forEach(function (className) { + _this8.element.classList.add(className); + }); + } + + //set column header context menu + if ((this.definition.headerContextMenu || this.definition.headerMenu) && this.table.modExists("menu")) { + this.table.modules.menu.initializeColumnHeader(this); + } + + this.element.appendChild(this.groupElement); +}; + +//flat field lookup +Column.prototype._getFlatData = function (data) { + return data[this.field]; +}; + +//nested field lookup +Column.prototype._getNestedData = function (data) { + var dataObj = data, + structure = this.fieldStructure, + length = structure.length, + output; + + for (var i = 0; i < length; i++) { + + dataObj = dataObj[structure[i]]; + + output = dataObj; + + if (!dataObj) { + break; + } + } + + return output; +}; + +//flat field set +Column.prototype._setFlatData = function (data, value) { + if (this.field) { + data[this.field] = value; + } +}; + +//nested field set +Column.prototype._setNestedData = function (data, value) { + var dataObj = data, + structure = this.fieldStructure, + length = structure.length; + + for (var i = 0; i < length; i++) { + + if (i == length - 1) { + dataObj[structure[i]] = value; + } else { + if (!dataObj[structure[i]]) { + if (typeof value !== "undefined") { + dataObj[structure[i]] = {}; + } else { + break; + } + } + + dataObj = dataObj[structure[i]]; + } + } +}; + +//attach column to this group +Column.prototype.attachColumn = function (column) { + var self = this; + + if (self.groupElement) { + self.columns.push(column); + self.groupElement.appendChild(column.getElement()); + } else { + console.warn("Column Warning - Column being attached to another column instead of column group"); + } +}; + +//vertically align header in column +Column.prototype.verticalAlign = function (alignment, height) { + + //calculate height of column header and group holder element + var parentHeight = this.parent.isGroup ? this.parent.getGroupElement().clientHeight : height || this.parent.getHeadersElement().clientHeight; + // var parentHeight = this.parent.isGroup ? this.parent.getGroupElement().clientHeight : this.parent.getHeadersElement().clientHeight; + + this.element.style.height = parentHeight + "px"; + + if (this.isGroup) { + this.groupElement.style.minHeight = parentHeight - this.contentElement.offsetHeight + "px"; + } + + //vertically align cell contents + if (!this.isGroup && alignment !== "top") { + if (alignment === "bottom") { + this.element.style.paddingTop = this.element.clientHeight - this.contentElement.offsetHeight + "px"; + } else { + this.element.style.paddingTop = (this.element.clientHeight - this.contentElement.offsetHeight) / 2 + "px"; + } + } + + this.columns.forEach(function (column) { + column.verticalAlign(alignment); + }); +}; + +//clear vertical alignmenet +Column.prototype.clearVerticalAlign = function () { + this.element.style.paddingTop = ""; + this.element.style.height = ""; + this.element.style.minHeight = ""; + this.groupElement.style.minHeight = ""; + + this.columns.forEach(function (column) { + column.clearVerticalAlign(); + }); +}; + +Column.prototype.bindModuleColumns = function () { + //check if rownum formatter is being used on a column + if (this.definition.formatter == "rownum") { + this.table.rowManager.rowNumColumn = this; + } +}; + +//// Retreive Column Information //// + +//return column header element +Column.prototype.getElement = function () { + return this.element; +}; + +//return colunm group element +Column.prototype.getGroupElement = function () { + return this.groupElement; +}; + +//return field name +Column.prototype.getField = function () { + return this.field; +}; + +//return the first column in a group +Column.prototype.getFirstColumn = function () { + if (!this.isGroup) { + return this; + } else { + if (this.columns.length) { + return this.columns[0].getFirstColumn(); + } else { + return false; + } + } +}; + +//return the last column in a group +Column.prototype.getLastColumn = function () { + if (!this.isGroup) { + return this; + } else { + if (this.columns.length) { + return this.columns[this.columns.length - 1].getLastColumn(); + } else { + return false; + } + } +}; + +//return all columns in a group +Column.prototype.getColumns = function () { + return this.columns; +}; + +//return all columns in a group +Column.prototype.getCells = function () { + return this.cells; +}; + +//retreive the top column in a group of columns +Column.prototype.getTopColumn = function () { + if (this.parent.isGroup) { + return this.parent.getTopColumn(); + } else { + return this; + } +}; + +//return column definition object +Column.prototype.getDefinition = function (updateBranches) { + var colDefs = []; + + if (this.isGroup && updateBranches) { + this.columns.forEach(function (column) { + colDefs.push(column.getDefinition(true)); + }); + + this.definition.columns = colDefs; + } + + return this.definition; +}; + +//////////////////// Actions //////////////////// + +Column.prototype.checkColumnVisibility = function () { + var visible = false; + + this.columns.forEach(function (column) { + if (column.visible) { + visible = true; + } + }); + + if (visible) { + this.show(); + this.parent.table.options.columnVisibilityChanged.call(this.table, this.getComponent(), false); + } else { + this.hide(); + } +}; + +//show column +Column.prototype.show = function (silent, responsiveToggle) { + if (!this.visible) { + this.visible = true; + + this.element.style.display = ""; + + if (this.parent.isGroup) { + this.parent.checkColumnVisibility(); + } + + this.cells.forEach(function (cell) { + cell.show(); + }); + + if (!this.isGroup && this.width === null) { + this.reinitializeWidth(); + } + + this.table.columnManager._verticalAlignHeaders(); + + if (this.table.options.persistence && this.table.modExists("persistence", true) && this.table.modules.persistence.config.columns) { + this.table.modules.persistence.save("columns"); + } + + if (!responsiveToggle && this.table.options.responsiveLayout && this.table.modExists("responsiveLayout", true)) { + this.table.modules.responsiveLayout.updateColumnVisibility(this, this.visible); + } + + if (!silent) { + this.table.options.columnVisibilityChanged.call(this.table, this.getComponent(), true); + } + + if (this.parent.isGroup) { + this.parent.matchChildWidths(); + } + } +}; + +//hide column +Column.prototype.hide = function (silent, responsiveToggle) { + if (this.visible) { + this.visible = false; + + this.element.style.display = "none"; + + this.table.columnManager._verticalAlignHeaders(); + + if (this.parent.isGroup) { + this.parent.checkColumnVisibility(); + } + + this.cells.forEach(function (cell) { + cell.hide(); + }); + + if (this.table.options.persistence && this.table.modExists("persistence", true) && this.table.modules.persistence.config.columns) { + this.table.modules.persistence.save("columns"); + } + + if (!responsiveToggle && this.table.options.responsiveLayout && this.table.modExists("responsiveLayout", true)) { + this.table.modules.responsiveLayout.updateColumnVisibility(this, this.visible); + } + + if (!silent) { + this.table.options.columnVisibilityChanged.call(this.table, this.getComponent(), false); + } + + if (this.parent.isGroup) { + this.parent.matchChildWidths(); + } + } +}; + +Column.prototype.matchChildWidths = function () { + var childWidth = 0; + + if (this.contentElement && this.columns.length) { + this.columns.forEach(function (column) { + if (column.visible) { + childWidth += column.getWidth(); + } + }); + + this.contentElement.style.maxWidth = childWidth - 1 + "px"; + + if (this.parent.isGroup) { + this.parent.matchChildWidths(); + } + } +}; + +Column.prototype.setWidth = function (width) { + this.widthFixed = true; + this.setWidthActual(width); +}; + +Column.prototype.setWidthActual = function (width) { + if (isNaN(width)) { + width = Math.floor(this.table.element.clientWidth / 100 * parseInt(width)); + } + + width = Math.max(this.minWidth, width); + + this.width = width; + this.widthStyled = width ? width + "px" : ""; + + this.element.style.width = this.widthStyled; + + if (!this.isGroup) { + this.cells.forEach(function (cell) { + cell.setWidth(); + }); + } + + if (this.parent.isGroup) { + this.parent.matchChildWidths(); + } + + //set resizable handles + if (this.table.modExists("frozenColumns")) { + this.table.modules.frozenColumns.layout(); + } +}; + +Column.prototype.checkCellHeights = function () { + var rows = []; + + this.cells.forEach(function (cell) { + if (cell.row.heightInitialized) { + if (cell.row.getElement().offsetParent !== null) { + rows.push(cell.row); + cell.row.clearCellHeight(); + } else { + cell.row.heightInitialized = false; + } + } + }); + + rows.forEach(function (row) { + row.calcHeight(); + }); + + rows.forEach(function (row) { + row.setCellHeight(); + }); +}; + +Column.prototype.getWidth = function () { + var width = 0; + + if (this.isGroup) { + this.columns.forEach(function (column) { + if (column.visible) { + width += column.getWidth(); + } + }); + } else { + width = this.width; + } + + return width; +}; + +Column.prototype.getHeight = function () { + return this.element.offsetHeight; +}; + +Column.prototype.setMinWidth = function (minWidth) { + this.minWidth = minWidth; + this.minWidthStyled = minWidth ? minWidth + "px" : ""; + + this.element.style.minWidth = this.minWidthStyled; + + this.cells.forEach(function (cell) { + cell.setMinWidth(); + }); +}; + +Column.prototype.delete = function () { + var _this9 = this; + + return new Promise(function (resolve, reject) { + + if (_this9.isGroup) { + _this9.columns.forEach(function (column) { + column.delete(); + }); + } + + //cancel edit if column is currently being edited + if (_this9.table.modExists("edit")) { + if (_this9.table.modules.edit.currentCell.column === _this9) { + _this9.table.modules.edit.cancelEdit(); + } + } + + var cellCount = _this9.cells.length; + + for (var i = 0; i < cellCount; i++) { + _this9.cells[0].delete(); + } + + if (_this9.element.parentNode) { + _this9.element.parentNode.removeChild(_this9.element); + } + + _this9.element = false; + _this9.contentElement = false; + _this9.titleElement = false; + _this9.groupElement = false; + + _this9.table.columnManager.deregisterColumn(_this9); + + if (_this9.table.options.virtualDomHoz) { + _this9.table.vdomHoz.reinitialize(true); + } + + resolve(); + }); +}; + +Column.prototype.columnRendered = function () { + if (this.titleFormatterRendered) { + this.titleFormatterRendered(); + } +}; + +Column.prototype.validate = function () { + var invalid = []; + + this.cells.forEach(function (cell) { + if (!cell.validate()) { + invalid.push(cell.getComponent()); + } + }); + + return invalid.length ? invalid : true; +}; + +//////////////// Cell Management ///////////////// + +//generate cell for this column +Column.prototype.generateCell = function (row) { + var self = this; + + var cell = new Cell(self, row); + + this.cells.push(cell); + + return cell; +}; + +Column.prototype.nextColumn = function () { + var index = this.table.columnManager.findColumnIndex(this); + return index > -1 ? this._nextVisibleColumn(index + 1) : false; +}; + +Column.prototype._nextVisibleColumn = function (index) { + var column = this.table.columnManager.getColumnByIndex(index); + return !column || column.visible ? column : this._nextVisibleColumn(index + 1); +}; + +Column.prototype.prevColumn = function () { + var index = this.table.columnManager.findColumnIndex(this); + return index > -1 ? this._prevVisibleColumn(index - 1) : false; +}; + +Column.prototype._prevVisibleColumn = function (index) { + var column = this.table.columnManager.getColumnByIndex(index); + return !column || column.visible ? column : this._prevVisibleColumn(index - 1); +}; + +Column.prototype.reinitializeWidth = function (force) { + this.widthFixed = false; + + //set width if present + if (typeof this.definition.width !== "undefined" && !force) { + this.setWidth(this.definition.width); + } + + //hide header filters to prevent them altering column width + if (this.table.modExists("filter")) { + this.table.modules.filter.hideHeaderFilterElements(); + } + + this.fitToData(); + + //show header filters again after layout is complete + if (this.table.modExists("filter")) { + this.table.modules.filter.showHeaderFilterElements(); + } +}; + +//set column width to maximum cell width +Column.prototype.fitToData = function () { + var self = this; + + if (!this.widthFixed) { + this.element.style.width = ""; + + self.cells.forEach(function (cell) { + cell.clearWidth(); + }); + } + + var maxWidth = this.element.offsetWidth; + + if (!self.width || !this.widthFixed) { + self.cells.forEach(function (cell) { + var width = cell.getWidth(); + + if (width > maxWidth) { + maxWidth = width; + } + }); + + if (maxWidth) { + self.setWidthActual(maxWidth + 1); + } + } +}; + +Column.prototype.updateDefinition = function (updates) { + var _this10 = this; + + return new Promise(function (resolve, reject) { + var definition; + + if (!_this10.isGroup) { + definition = Object.assign({}, _this10.getDefinition()); + definition = Object.assign(definition, updates); + + _this10.table.columnManager.addColumn(definition, false, _this10).then(function (column) { + + if (definition.field == _this10.field) { + _this10.field = false; //cleair field name to prevent deletion of duplicate column from arrays + } + + _this10.delete().then(function () { + resolve(column.getComponent()); + }).catch(function (err) { + reject(err); + }); + }).catch(function (err) { + reject(err); + }); + } else { + console.warn("Column Update Error - The updateDefinition function is only available on columns, not column groups"); + reject("Column Update Error - The updateDefinition function is only available on columns, not column groups"); + } + }); +}; + +Column.prototype.deleteCell = function (cell) { + var index = this.cells.indexOf(cell); + + if (index > -1) { + this.cells.splice(index, 1); + } +}; + +Column.prototype.defaultOptionList = ["title", "field", "columns", "visible", "align", "hozAlign", "vertAlign", "width", "minWidth", "widthGrow", "widthShrink", "resizable", "frozen", "responsive", "tooltip", "cssClass", "rowHandle", "hideInHtml", "print", "htmlOutput", "sorter", "sorterParams", "formatter", "formatterParams", "variableHeight", "editable", "editor", "editorParams", "validator", "mutator", "mutatorParams", "mutatorData", "mutatorDataParams", "mutatorEdit", "mutatorEditParams", "mutatorClipboard", "mutatorClipboardParams", "accessor", "accessorParams", "accessorData", "accessorDataParams", "accessorDownload", "accessorDownloadParams", "accessorClipboard", "accessorClipboardParams", "accessorPrint", "accessorPrintParams", "accessorHtmlOutput", "accessorHtmlOutputParams", "clipboard", "download", "downloadTitle", "topCalc", "topCalcParams", "topCalcFormatter", "topCalcFormatterParams", "bottomCalc", "bottomCalcParams", "bottomCalcFormatter", "bottomCalcFormatterParams", "cellClick", "cellDblClick", "cellContext", "cellTap", "cellDblTap", "cellTapHold", "cellMouseEnter", "cellMouseLeave", "cellMouseOver", "cellMouseOut", "cellMouseMove", "cellEditing", "cellEdited", "cellEditCancelled", "headerSort", "headerSortStartingDir", "headerSortTristate", "headerClick", "headerDblClick", "headerContext", "headerTap", "headerDblTap", "headerTapHold", "headerTooltip", "headerVertical", "headerHozAlign", "editableTitle", "titleFormatter", "titleFormatterParams", "headerFilter", "headerFilterPlaceholder", "headerFilterParams", "headerFilterEmptyCheck", "headerFilterFunc", "headerFilterFuncParams", "headerFilterLiveFilter", "print", "headerContextMenu", "headerMenu", "contextMenu", +// "headerClickMenu", +"clickMenu", "formatterPrint", "formatterPrintParams", "formatterClipboard", "formatterClipboardParams", "formatterHtmlOutput", "formatterHtmlOutputParams", "titlePrint", "titleClipboard", "titleHtmlOutput", "titleDownload"]; + +//////////////// Event Bindings ///////////////// + +//////////////// Object Generation ///////////////// +Column.prototype.getComponent = function () { + if (!this.component) { + this.component = new ColumnComponent(this); + } + + return this.component; +}; + +var RowManager = function RowManager(table) { + + this.table = table; + this.element = this.createHolderElement(); //containing element + this.tableElement = this.createTableElement(); //table element + this.heightFixer = this.createTableElement(); //table element + this.columnManager = null; //hold column manager object + this.height = 0; //hold height of table element + + this.firstRender = false; //handle first render + this.renderMode = "virtual"; //current rendering mode + this.fixedHeight = false; //current rendering mode + + this.rows = []; //hold row data objects + this.activeRows = []; //rows currently available to on display in the table + this.activeRowsCount = 0; //count of active rows + + this.displayRows = []; //rows currently on display in the table + this.displayRowsCount = 0; //count of display rows + + this.scrollTop = 0; + this.scrollLeft = 0; + + this.vDomRowHeight = 20; //approximation of row heights for padding + + this.vDomTop = 0; //hold position for first rendered row in the virtual DOM + this.vDomBottom = 0; //hold possition for last rendered row in the virtual DOM + + this.vDomScrollPosTop = 0; //last scroll position of the vDom top; + this.vDomScrollPosBottom = 0; //last scroll position of the vDom bottom; + + this.vDomTopPad = 0; //hold value of padding for top of virtual DOM + this.vDomBottomPad = 0; //hold value of padding for bottom of virtual DOM + + this.vDomMaxRenderChain = 90; //the maximum number of dom elements that can be rendered in 1 go + + this.vDomWindowBuffer = 0; //window row buffer before removing elements, to smooth scrolling + + this.vDomWindowMinTotalRows = 20; //minimum number of rows to be generated in virtual dom (prevent buffering issues on tables with tall rows) + this.vDomWindowMinMarginRows = 5; //minimum number of rows to be generated in virtual dom margin + + this.vDomTopNewRows = []; //rows to normalize after appending to optimize render speed + this.vDomBottomNewRows = []; //rows to normalize after appending to optimize render speed + + this.rowNumColumn = false; //hold column component for row number column + + this.redrawBlock = false; //prevent redraws to allow multiple data manipulations becore continuing + this.redrawBlockRestoreConfig = false; //store latest redraw function calls for when redraw is needed + this.redrawBlockRederInPosition = false; //store latest redraw function calls for when redraw is needed +}; + +//////////////// Setup Functions ///////////////// + +RowManager.prototype.createHolderElement = function () { + var el = document.createElement("div"); + + el.classList.add("tabulator-tableHolder"); + el.setAttribute("tabindex", 0); + + return el; +}; + +RowManager.prototype.createTableElement = function () { + var el = document.createElement("div"); + + el.classList.add("tabulator-table"); + + return el; +}; + +//return containing element +RowManager.prototype.getElement = function () { + return this.element; +}; + +//return table element +RowManager.prototype.getTableElement = function () { + return this.tableElement; +}; + +//return position of row in table +RowManager.prototype.getRowPosition = function (row, active) { + if (active) { + return this.activeRows.indexOf(row); + } else { + return this.rows.indexOf(row); + } +}; + +//link to column manager +RowManager.prototype.setColumnManager = function (manager) { + this.columnManager = manager; +}; + +RowManager.prototype.initialize = function () { + var self = this; + + self.setRenderMode(); + + //initialize manager + self.element.appendChild(self.tableElement); + + self.firstRender = true; + + //scroll header along with table body + self.element.addEventListener("scroll", function () { + var left = self.element.scrollLeft; + + //handle horizontal scrolling + if (self.scrollLeft != left) { + self.columnManager.scrollHorizontal(left); + + if (self.table.options.groupBy) { + self.table.modules.groupRows.scrollHeaders(left); + } + + if (self.table.modExists("columnCalcs")) { + self.table.modules.columnCalcs.scrollHorizontal(left); + } + + self.table.options.scrollHorizontal(left); + } + + self.scrollLeft = left; + }); + + //handle virtual dom scrolling + if (this.renderMode === "virtual") { + + self.element.addEventListener("scroll", function () { + var top = self.element.scrollTop; + var dir = self.scrollTop > top; + + //handle verical scrolling + if (self.scrollTop != top) { + self.scrollTop = top; + self.scrollVertical(dir); + + if (self.table.options.ajaxProgressiveLoad == "scroll") { + self.table.modules.ajax.nextPage(self.element.scrollHeight - self.element.clientHeight - top); + } + + self.table.options.scrollVertical(top); + } else { + self.scrollTop = top; + } + }); + } +}; + +////////////////// Row Manipulation ////////////////// + +RowManager.prototype.findRow = function (subject) { + var self = this; + + if ((typeof subject === 'undefined' ? 'undefined' : _typeof(subject)) == "object") { + + if (subject instanceof Row) { + //subject is row element + return subject; + } else if (subject instanceof RowComponent) { + //subject is public row component + return subject._getSelf() || false; + } else if (typeof HTMLElement !== "undefined" && subject instanceof HTMLElement) { + //subject is a HTML element of the row + var match = self.rows.find(function (row) { + return row.element === subject; + }); + + return match || false; + } + } else if (typeof subject == "undefined" || subject === null) { + return false; + } else { + //subject should be treated as the index of the row + var _match = self.rows.find(function (row) { + return row.data[self.table.options.index] == subject; + }); + + return _match || false; + } + + //catch all for any other type of input + + return false; +}; + +RowManager.prototype.getRowFromDataObject = function (data) { + var match = this.rows.find(function (row) { + return row.data === data; + }); + + return match || false; +}; + +RowManager.prototype.getRowFromPosition = function (position, active) { + if (active) { + return this.activeRows[position]; + } else { + return this.rows[position]; + } +}; + +RowManager.prototype.scrollToRow = function (row, position, ifVisible) { + var _this11 = this; + + var rowIndex = this.getDisplayRows().indexOf(row), + rowEl = row.getElement(), + rowTop, + offset = 0; + + return new Promise(function (resolve, reject) { + if (rowIndex > -1) { + + if (typeof position === "undefined") { + position = _this11.table.options.scrollToRowPosition; + } + + if (typeof ifVisible === "undefined") { + ifVisible = _this11.table.options.scrollToRowIfVisible; + } + + if (position === "nearest") { + switch (_this11.renderMode) { + case "classic": + rowTop = Tabulator.prototype.helpers.elOffset(rowEl).top; + position = Math.abs(_this11.element.scrollTop - rowTop) > Math.abs(_this11.element.scrollTop + _this11.element.clientHeight - rowTop) ? "bottom" : "top"; + break; + case "virtual": + position = Math.abs(_this11.vDomTop - rowIndex) > Math.abs(_this11.vDomBottom - rowIndex) ? "bottom" : "top"; + break; + } + } + + //check row visibility + if (!ifVisible) { + if (Tabulator.prototype.helpers.elVisible(rowEl)) { + offset = Tabulator.prototype.helpers.elOffset(rowEl).top - Tabulator.prototype.helpers.elOffset(_this11.element).top; + + if (offset > 0 && offset < _this11.element.clientHeight - rowEl.offsetHeight) { + return false; + } + } + } + + //scroll to row + switch (_this11.renderMode) { + case "classic": + _this11.element.scrollTop = Tabulator.prototype.helpers.elOffset(rowEl).top - Tabulator.prototype.helpers.elOffset(_this11.element).top + _this11.element.scrollTop; + break; + case "virtual": + _this11._virtualRenderFill(rowIndex, true); + break; + } + + //align to correct position + switch (position) { + case "middle": + case "center": + + if (_this11.element.scrollHeight - _this11.element.scrollTop == _this11.element.clientHeight) { + _this11.element.scrollTop = _this11.element.scrollTop + (rowEl.offsetTop - _this11.element.scrollTop) - (_this11.element.scrollHeight - rowEl.offsetTop) / 2; + } else { + _this11.element.scrollTop = _this11.element.scrollTop - _this11.element.clientHeight / 2; + } + + break; + + case "bottom": + + if (_this11.element.scrollHeight - _this11.element.scrollTop == _this11.element.clientHeight) { + _this11.element.scrollTop = _this11.element.scrollTop - (_this11.element.scrollHeight - rowEl.offsetTop) + rowEl.offsetHeight; + } else { + _this11.element.scrollTop = _this11.element.scrollTop - _this11.element.clientHeight + rowEl.offsetHeight; + } + + break; + } + + resolve(); + } else { + console.warn("Scroll Error - Row not visible"); + reject("Scroll Error - Row not visible"); + } + }); +}; + +////////////////// Data Handling ////////////////// + +RowManager.prototype.setData = function (data, renderInPosition, columnsChanged) { + var _this12 = this; + + var self = this; + + return new Promise(function (resolve, reject) { + if (renderInPosition && _this12.getDisplayRows().length) { + if (self.table.options.pagination) { + self._setDataActual(data, true); + } else { + _this12.reRenderInPosition(function () { + self._setDataActual(data); + }); + } + } else { + if (_this12.table.options.autoColumns && columnsChanged) { + _this12.table.columnManager.generateColumnsFromRowData(data); + } + _this12.resetScroll(); + + _this12._setDataActual(data); + } + + resolve(); + }); +}; + +RowManager.prototype._setDataActual = function (data, renderInPosition) { + var self = this; + + self.table.options.dataLoading.call(this.table, data); + + this._wipeElements(); + + if (this.table.options.history && this.table.modExists("history")) { + this.table.modules.history.clear(); + } + + if (Array.isArray(data)) { + + if (this.table.modExists("selectRow")) { + this.table.modules.selectRow.clearSelectionData(); + } + + if (this.table.options.reactiveData && this.table.modExists("reactiveData", true)) { + this.table.modules.reactiveData.watchData(data); + } + + data.forEach(function (def, i) { + if (def && (typeof def === 'undefined' ? 'undefined' : _typeof(def)) === "object") { + var row = new Row(def, self); + self.rows.push(row); + } else { + console.warn("Data Loading Warning - Invalid row data detected and ignored, expecting object but received:", def); + } + }); + + self.refreshActiveData(false, false, renderInPosition); + + self.table.options.dataLoaded.call(this.table, data); + } else { + console.error("Data Loading Error - Unable to process data due to invalid data type \nExpecting: array \nReceived: ", typeof data === 'undefined' ? 'undefined' : _typeof(data), "\nData: ", data); + } +}; + +RowManager.prototype._wipeElements = function () { + this.rows.forEach(function (row) { + row.wipe(); + }); + + if (this.table.options.groupBy && this.table.modExists("groupRows")) { + this.table.modules.groupRows.wipe(); + } + + this.rows = []; + this.activeRows = []; + this.activeRowsCount = 0; + this.displayRows = []; + this.displayRowsCount = 0; + + this.adjustTableSize(); +}; + +RowManager.prototype.deleteRow = function (row, blockRedraw) { + var allIndex = this.rows.indexOf(row), + activeIndex = this.activeRows.indexOf(row); + + if (activeIndex > -1) { + this.activeRows.splice(activeIndex, 1); + } + + if (allIndex > -1) { + this.rows.splice(allIndex, 1); + } + + this.setActiveRows(this.activeRows); + + this.displayRowIterator(function (rows) { + var displayIndex = rows.indexOf(row); + + if (displayIndex > -1) { + rows.splice(displayIndex, 1); + } + }); + + if (!blockRedraw) { + this.reRenderInPosition(); + } + + this.regenerateRowNumbers(); + + this.table.options.rowDeleted.call(this.table, row.getComponent()); + + if (this.table.options.dataChanged) { + this.table.options.dataChanged.call(this.table, this.getData()); + } + + if (this.table.options.groupBy && this.table.modExists("groupRows")) { + this.table.modules.groupRows.updateGroupRows(true); + } else if (this.table.options.pagination && this.table.modExists("page")) { + this.refreshActiveData(false, false, true); + } else { + if (this.table.options.pagination && this.table.modExists("page")) { + this.refreshActiveData("page"); + } + } +}; + +RowManager.prototype.addRow = function (data, pos, index, blockRedraw) { + + var row = this.addRowActual(data, pos, index, blockRedraw); + + if (this.table.options.history && this.table.modExists("history")) { + this.table.modules.history.action("rowAdd", row, { data: data, pos: pos, index: index }); + } + + return row; +}; + +//add multiple rows +RowManager.prototype.addRows = function (data, pos, index) { + var _this13 = this; + + var self = this, + length = 0, + rows = []; + + return new Promise(function (resolve, reject) { + pos = _this13.findAddRowPos(pos); + + if (!Array.isArray(data)) { + data = [data]; + } + + length = data.length - 1; + + if (typeof index == "undefined" && pos || typeof index !== "undefined" && !pos) { + data.reverse(); + } + + data.forEach(function (item, i) { + var row = self.addRow(item, pos, index, true); + rows.push(row); + }); + + if (_this13.table.options.groupBy && _this13.table.modExists("groupRows")) { + _this13.table.modules.groupRows.updateGroupRows(true); + } else if (_this13.table.options.pagination && _this13.table.modExists("page")) { + _this13.refreshActiveData(false, false, true); + } else { + _this13.reRenderInPosition(); + } + + //recalc column calculations if present + if (_this13.table.modExists("columnCalcs")) { + _this13.table.modules.columnCalcs.recalc(_this13.table.rowManager.activeRows); + } + + _this13.regenerateRowNumbers(); + resolve(rows); + }); +}; + +RowManager.prototype.findAddRowPos = function (pos) { + if (typeof pos === "undefined") { + pos = this.table.options.addRowPos; + } + + if (pos === "pos") { + pos = true; + } + + if (pos === "bottom") { + pos = false; + } + + return pos; +}; + +RowManager.prototype.addRowActual = function (data, pos, index, blockRedraw) { + var row = data instanceof Row ? data : new Row(data || {}, this), + top = this.findAddRowPos(pos), + allIndex = -1, + activeIndex, + dispRows; + + if (!index && this.table.options.pagination && this.table.options.paginationAddRow == "page") { + dispRows = this.getDisplayRows(); + + if (top) { + if (dispRows.length) { + index = dispRows[0]; + } else { + if (this.activeRows.length) { + index = this.activeRows[this.activeRows.length - 1]; + top = false; + } + } + } else { + if (dispRows.length) { + index = dispRows[dispRows.length - 1]; + top = dispRows.length < this.table.modules.page.getPageSize() ? false : true; + } + } + } + + if (typeof index !== "undefined") { + index = this.findRow(index); + } + + if (this.table.options.groupBy && this.table.modExists("groupRows")) { + this.table.modules.groupRows.assignRowToGroup(row); + + var groupRows = row.getGroup().rows; + + if (groupRows.length > 1) { + + if (!index || index && groupRows.indexOf(index) == -1) { + if (top) { + if (groupRows[0] !== row) { + index = groupRows[0]; + this._moveRowInArray(row.getGroup().rows, row, index, !top); + } + } else { + if (groupRows[groupRows.length - 1] !== row) { + index = groupRows[groupRows.length - 1]; + this._moveRowInArray(row.getGroup().rows, row, index, !top); + } + } + } else { + this._moveRowInArray(row.getGroup().rows, row, index, !top); + } + } + } + + if (index) { + allIndex = this.rows.indexOf(index); + } + + if (index && allIndex > -1) { + activeIndex = this.activeRows.indexOf(index); + + this.displayRowIterator(function (rows) { + var displayIndex = rows.indexOf(index); + + if (displayIndex > -1) { + rows.splice(top ? displayIndex : displayIndex + 1, 0, row); + } + }); + + if (activeIndex > -1) { + this.activeRows.splice(top ? activeIndex : activeIndex + 1, 0, row); + } + + this.rows.splice(top ? allIndex : allIndex + 1, 0, row); + } else { + + if (top) { + + this.displayRowIterator(function (rows) { + rows.unshift(row); + }); + + this.activeRows.unshift(row); + this.rows.unshift(row); + } else { + this.displayRowIterator(function (rows) { + rows.push(row); + }); + + this.activeRows.push(row); + this.rows.push(row); + } + } + + this.setActiveRows(this.activeRows); + + this.table.options.rowAdded.call(this.table, row.getComponent()); + + if (this.table.options.dataChanged) { + this.table.options.dataChanged.call(this.table, this.getData()); + } + + if (!blockRedraw) { + this.reRenderInPosition(); + } + + return row; +}; + +RowManager.prototype.moveRow = function (from, to, after) { + if (this.table.options.history && this.table.modExists("history")) { + this.table.modules.history.action("rowMove", from, { posFrom: this.getRowPosition(from), posTo: this.getRowPosition(to), to: to, after: after }); + } + + this.moveRowActual(from, to, after); + + this.regenerateRowNumbers(); + + this.table.options.rowMoved.call(this.table, from.getComponent()); +}; + +RowManager.prototype.moveRowActual = function (from, to, after) { + var _this14 = this; + + this._moveRowInArray(this.rows, from, to, after); + this._moveRowInArray(this.activeRows, from, to, after); + + this.displayRowIterator(function (rows) { + _this14._moveRowInArray(rows, from, to, after); + }); + + if (this.table.options.groupBy && this.table.modExists("groupRows")) { + + if (!after && to instanceof Group) { + to = this.table.rowManager.prevDisplayRow(from) || to; + } + + var toGroup = to.getGroup(); + var fromGroup = from.getGroup(); + + if (toGroup === fromGroup) { + this._moveRowInArray(toGroup.rows, from, to, after); + } else { + if (fromGroup) { + fromGroup.removeRow(from); + } + + toGroup.insertRow(from, to, after); + } + } +}; + +RowManager.prototype._moveRowInArray = function (rows, from, to, after) { + var fromIndex, toIndex, start, end; + + if (from !== to) { + + fromIndex = rows.indexOf(from); + + if (fromIndex > -1) { + + rows.splice(fromIndex, 1); + + toIndex = rows.indexOf(to); + + if (toIndex > -1) { + + if (after) { + rows.splice(toIndex + 1, 0, from); + } else { + rows.splice(toIndex, 0, from); + } + } else { + rows.splice(fromIndex, 0, from); + } + } + + //restyle rows + if (rows === this.getDisplayRows()) { + + start = fromIndex < toIndex ? fromIndex : toIndex; + end = toIndex > fromIndex ? toIndex : fromIndex + 1; + + for (var i = start; i <= end; i++) { + if (rows[i]) { + this.styleRow(rows[i], i); + } + } + } + } +}; + +RowManager.prototype.clearData = function () { + this.setData([]); +}; + +RowManager.prototype.getRowIndex = function (row) { + return this.findRowIndex(row, this.rows); +}; + +RowManager.prototype.getDisplayRowIndex = function (row) { + var index = this.getDisplayRows().indexOf(row); + return index > -1 ? index : false; +}; + +RowManager.prototype.nextDisplayRow = function (row, rowOnly) { + var index = this.getDisplayRowIndex(row), + nextRow = false; + + if (index !== false && index < this.displayRowsCount - 1) { + nextRow = this.getDisplayRows()[index + 1]; + } + + if (nextRow && (!(nextRow instanceof Row) || nextRow.type != "row")) { + return this.nextDisplayRow(nextRow, rowOnly); + } + + return nextRow; +}; + +RowManager.prototype.prevDisplayRow = function (row, rowOnly) { + var index = this.getDisplayRowIndex(row), + prevRow = false; + + if (index) { + prevRow = this.getDisplayRows()[index - 1]; + } + + if (rowOnly && prevRow && (!(prevRow instanceof Row) || prevRow.type != "row")) { + return this.prevDisplayRow(prevRow, rowOnly); + } + + return prevRow; +}; + +RowManager.prototype.findRowIndex = function (row, list) { + var rowIndex; + + row = this.findRow(row); + + if (row) { + rowIndex = list.indexOf(row); + + if (rowIndex > -1) { + return rowIndex; + } + } + + return false; +}; + +RowManager.prototype.getData = function (active, transform) { + var output = [], + rows = this.getRows(active); + + rows.forEach(function (row) { + if (row.type == "row") { + output.push(row.getData(transform || "data")); + } + }); + + return output; +}; + +RowManager.prototype.getComponents = function (active) { + var output = [], + rows = this.getRows(active); + + rows.forEach(function (row) { + output.push(row.getComponent()); + }); + + return output; +}; + +RowManager.prototype.getDataCount = function (active) { + var rows = this.getRows(active); + + return rows.length; +}; + +RowManager.prototype._genRemoteRequest = function () { + var _this15 = this; + + var table = this.table, + options = table.options, + params = {}; + + if (table.modExists("page")) { + //set sort data if defined + if (options.ajaxSorting) { + var sorters = this.table.modules.sort.getSort(); + + sorters.forEach(function (item) { + delete item.column; + }); + + params[this.table.modules.page.paginationDataSentNames.sorters] = sorters; + } + + //set filter data if defined + if (options.ajaxFiltering) { + var filters = this.table.modules.filter.getFilters(true, true); + + params[this.table.modules.page.paginationDataSentNames.filters] = filters; + } + + this.table.modules.ajax.setParams(params, true); + } + + table.modules.ajax.sendRequest().then(function (data) { + _this15._setDataActual(data, true); + }).catch(function (e) {}); +}; + +//choose the path to refresh data after a filter update +RowManager.prototype.filterRefresh = function () { + var table = this.table, + options = table.options, + left = this.scrollLeft; + + if (options.ajaxFiltering) { + if (options.pagination == "remote" && table.modExists("page")) { + table.modules.page.reset(true); + table.modules.page.setPage(1).then(function () {}).catch(function () {}); + } else if (options.ajaxProgressiveLoad) { + table.modules.ajax.loadData().then(function () {}).catch(function () {}); + } else { + //assume data is url, make ajax call to url to get data + this._genRemoteRequest(); + } + } else { + this.refreshActiveData("filter"); + } + + this.scrollHorizontal(left); +}; + +//choose the path to refresh data after a sorter update +RowManager.prototype.sorterRefresh = function (loadOrignalData) { + var table = this.table, + options = this.table.options, + left = this.scrollLeft; + + if (options.ajaxSorting) { + if ((options.pagination == "remote" || options.progressiveLoad) && table.modExists("page")) { + table.modules.page.reset(true); + table.modules.page.setPage(1).then(function () {}).catch(function () {}); + } else if (options.ajaxProgressiveLoad) { + table.modules.ajax.loadData().then(function () {}).catch(function () {}); + } else { + //assume data is url, make ajax call to url to get data + this._genRemoteRequest(); + } + } else { + this.refreshActiveData(loadOrignalData ? "filter" : "sort"); + } + + this.scrollHorizontal(left); +}; + +RowManager.prototype.scrollHorizontal = function (left) { + this.scrollLeft = left; + this.element.scrollLeft = left; + + if (this.table.options.groupBy) { + this.table.modules.groupRows.scrollHeaders(left); + } + + if (this.table.modExists("columnCalcs")) { + this.table.modules.columnCalcs.scrollHorizontal(left); + } +}; + +//set active data set +RowManager.prototype.refreshActiveData = function (stage, skipStage, renderInPosition) { + var self = this, + table = this.table, + cascadeOrder = ["all", "filter", "sort", "display", "freeze", "group", "tree", "page"], + displayIndex; + + if (this.redrawBlock) { + + if (!this.redrawBlockRestoreConfig || cascadeOrder.indexOf(stage) < cascadeOrder.indexOf(this.redrawBlockRestoreConfig.stage)) { + this.redrawBlockRestoreConfig = { + stage: stage, + skipStage: skipStage, + renderInPosition: renderInPosition + }; + } + + return; + } else { + + if (self.table.modExists("edit")) { + self.table.modules.edit.cancelEdit(); + } + + if (!stage) { + stage = "all"; + } + + if (table.options.selectable && !table.options.selectablePersistence && table.modExists("selectRow")) { + table.modules.selectRow.deselectRows(); + } + + //cascade through data refresh stages + switch (stage) { + case "all": + + case "filter": + if (!skipStage) { + if (table.modExists("filter")) { + self.setActiveRows(table.modules.filter.filter(self.rows)); + } else { + self.setActiveRows(self.rows.slice(0)); + } + } else { + skipStage = false; + } + + case "sort": + if (!skipStage) { + if (table.modExists("sort")) { + table.modules.sort.sort(this.activeRows); + } + } else { + skipStage = false; + } + + //regenerate row numbers for row number formatter if in use + this.regenerateRowNumbers(); + + //generic stage to allow for pipeline trigger after the data manipulation stage + case "display": + this.resetDisplayRows(); + + case "freeze": + if (!skipStage) { + if (this.table.modExists("frozenRows")) { + if (table.modules.frozenRows.isFrozen()) { + if (!table.modules.frozenRows.getDisplayIndex()) { + table.modules.frozenRows.setDisplayIndex(this.getNextDisplayIndex()); + } + + displayIndex = table.modules.frozenRows.getDisplayIndex(); + + displayIndex = self.setDisplayRows(table.modules.frozenRows.getRows(this.getDisplayRows(displayIndex - 1)), displayIndex); + + if (displayIndex !== true) { + table.modules.frozenRows.setDisplayIndex(displayIndex); + } + } + } + } else { + skipStage = false; + } + + case "group": + if (!skipStage) { + if (table.options.groupBy && table.modExists("groupRows")) { + + if (!table.modules.groupRows.getDisplayIndex()) { + table.modules.groupRows.setDisplayIndex(this.getNextDisplayIndex()); + } + + displayIndex = table.modules.groupRows.getDisplayIndex(); + + displayIndex = self.setDisplayRows(table.modules.groupRows.getRows(this.getDisplayRows(displayIndex - 1)), displayIndex); + + if (displayIndex !== true) { + table.modules.groupRows.setDisplayIndex(displayIndex); + } + } + } else { + skipStage = false; + } + + case "tree": + + if (!skipStage) { + if (table.options.dataTree && table.modExists("dataTree")) { + if (!table.modules.dataTree.getDisplayIndex()) { + table.modules.dataTree.setDisplayIndex(this.getNextDisplayIndex()); + } + + displayIndex = table.modules.dataTree.getDisplayIndex(); + + displayIndex = self.setDisplayRows(table.modules.dataTree.getRows(this.getDisplayRows(displayIndex - 1)), displayIndex); + + if (displayIndex !== true) { + table.modules.dataTree.setDisplayIndex(displayIndex); + } + } + } else { + skipStage = false; + } + + if (table.options.pagination && table.modExists("page") && !renderInPosition) { + if (table.modules.page.getMode() == "local") { + table.modules.page.reset(); + } + } + + case "page": + if (!skipStage) { + if (table.options.pagination && table.modExists("page")) { + + if (!table.modules.page.getDisplayIndex()) { + table.modules.page.setDisplayIndex(this.getNextDisplayIndex()); + } + + displayIndex = table.modules.page.getDisplayIndex(); + + if (table.modules.page.getMode() == "local") { + table.modules.page.setMaxRows(this.getDisplayRows(displayIndex - 1).length); + } + + displayIndex = self.setDisplayRows(table.modules.page.getRows(this.getDisplayRows(displayIndex - 1)), displayIndex); + + if (displayIndex !== true) { + table.modules.page.setDisplayIndex(displayIndex); + } + } + } else { + skipStage = false; + } + } + + if (Tabulator.prototype.helpers.elVisible(self.element)) { + if (renderInPosition) { + self.reRenderInPosition(); + } else { + + if (stage === "all" && this.table.options.virtualDomHoz) { + this.table.vdomHoz.dataChange(); + } + + self.renderTable(); + + if (table.options.layoutColumnsOnNewData) { + self.table.columnManager.redraw(true); + } + } + } + + if (table.modExists("columnCalcs")) { + table.modules.columnCalcs.recalc(this.activeRows); + } + } +}; + +//regenerate row numbers for row number formatter if in use +RowManager.prototype.regenerateRowNumbers = function () { + var _this16 = this; + + if (this.rowNumColumn) { + this.activeRows.forEach(function (row) { + var cell = row.getCell(_this16.rowNumColumn); + + if (cell) { + cell._generateContents(); + } + }); + } +}; + +RowManager.prototype.setActiveRows = function (activeRows) { + this.activeRows = activeRows; + this.activeRowsCount = this.activeRows.length; +}; + +//reset display rows array +RowManager.prototype.resetDisplayRows = function () { + this.displayRows = []; + + this.displayRows.push(this.activeRows.slice(0)); + + this.displayRowsCount = this.displayRows[0].length; + + if (this.table.modExists("frozenRows")) { + this.table.modules.frozenRows.setDisplayIndex(0); + } + + if (this.table.options.groupBy && this.table.modExists("groupRows")) { + this.table.modules.groupRows.setDisplayIndex(0); + } + + if (this.table.options.pagination && this.table.modExists("page")) { + this.table.modules.page.setDisplayIndex(0); + } +}; + +RowManager.prototype.getNextDisplayIndex = function () { + return this.displayRows.length; +}; + +//set display row pipeline data +RowManager.prototype.setDisplayRows = function (displayRows, index) { + + var output = true; + + if (index && typeof this.displayRows[index] != "undefined") { + this.displayRows[index] = displayRows; + output = true; + } else { + this.displayRows.push(displayRows); + output = index = this.displayRows.length - 1; + } + + if (index == this.displayRows.length - 1) { + this.displayRowsCount = this.displayRows[this.displayRows.length - 1].length; + } + + return output; +}; + +RowManager.prototype.getDisplayRows = function (index) { + if (typeof index == "undefined") { + return this.displayRows.length ? this.displayRows[this.displayRows.length - 1] : []; + } else { + return this.displayRows[index] || []; + } +}; + +RowManager.prototype.getVisibleRows = function (viewable) { + var topEdge = this.element.scrollTop, + bottomEdge = this.element.clientHeight + topEdge, + topFound = false, + topRow = 0, + bottomRow = 0, + rows = this.getDisplayRows(); + + if (viewable) { + + this.getDisplayRows(); + for (var i = this.vDomTop; i <= this.vDomBottom; i++) { + if (rows[i]) { + if (!topFound) { + if (topEdge - rows[i].getElement().offsetTop >= 0) { + topRow = i; + } else { + topFound = true; + + if (bottomEdge - rows[i].getElement().offsetTop >= 0) { + bottomRow = i; + } else { + break; + } + } + } else { + if (bottomEdge - rows[i].getElement().offsetTop >= 0) { + bottomRow = i; + } else { + break; + } + } + } + } + } else { + topRow = this.vDomTop; + bottomRow = this.vDomBottom; + } + + return rows.slice(topRow, bottomRow + 1); +}; + +//repeat action accross display rows +RowManager.prototype.displayRowIterator = function (callback) { + this.displayRows.forEach(callback); + + this.displayRowsCount = this.displayRows[this.displayRows.length - 1].length; +}; + +//return only actual rows (not group headers etc) +RowManager.prototype.getRows = function (active) { + var rows; + + switch (active) { + case "active": + rows = this.activeRows; + break; + + case "display": + rows = this.table.rowManager.getDisplayRows(); + break; + + case "visible": + rows = this.getVisibleRows(true); + break; + + case "selected": + rows = this.table.modules.selectRow.selectedRows; + break; + + default: + rows = this.rows; + } + + return rows; +}; + +///////////////// Table Rendering ///////////////// + +//trigger rerender of table in current position +RowManager.prototype.reRenderInPosition = function (callback) { + if (this.getRenderMode() == "virtual") { + + if (this.redrawBlock) { + if (callback) { + callback(); + } else { + this.redrawBlockRederInPosition = true; + } + } else { + var scrollTop = this.element.scrollTop; + var topRow = false; + var topOffset = false; + + var left = this.scrollLeft; + + var rows = this.getDisplayRows(); + + for (var i = this.vDomTop; i <= this.vDomBottom; i++) { + + if (rows[i]) { + var diff = scrollTop - rows[i].getElement().offsetTop; + + if (topOffset === false || Math.abs(diff) < topOffset) { + topOffset = diff; + topRow = i; + } else { + break; + } + } + } + + if (callback) { + callback(); + } + + this._virtualRenderFill(topRow === false ? this.displayRowsCount - 1 : topRow, true, topOffset || 0); + + this.scrollHorizontal(left); + } + } else { + this.renderTable(); + + if (callback) { + callback(); + } + } +}; + +RowManager.prototype.setRenderMode = function () { + + if (this.table.options.virtualDom) { + + this.renderMode = "virtual"; + + if (this.table.element.clientHeight || this.table.options.height) { + this.fixedHeight = true; + } else { + this.fixedHeight = false; + } + } else { + this.renderMode = "classic"; + } +}; + +RowManager.prototype.getRenderMode = function () { + return this.renderMode; +}; + +RowManager.prototype.renderTable = function () { + + this.table.options.renderStarted.call(this.table); + + this.element.scrollTop = 0; + + switch (this.renderMode) { + case "classic": + this._simpleRender(); + break; + + case "virtual": + this._virtualRenderFill(); + break; + } + + if (this.firstRender) { + if (this.displayRowsCount) { + this.firstRender = false; + this.table.modules.layout.layout(); + } else { + this.renderEmptyScroll(); + } + } + + if (this.table.modExists("frozenColumns")) { + this.table.modules.frozenColumns.layout(); + } + + if (!this.displayRowsCount) { + if (this.table.options.placeholder) { + + this.table.options.placeholder.setAttribute("tabulator-render-mode", this.renderMode); + + this.getElement().appendChild(this.table.options.placeholder); + this.table.options.placeholder.style.width = this.table.columnManager.getWidth() + "px"; + } + } + + this.table.options.renderComplete.call(this.table); +}; + +//simple render on heightless table +RowManager.prototype._simpleRender = function () { + this._clearVirtualDom(); + + if (this.displayRowsCount) { + this.checkClassicModeGroupHeaderWidth(); + } else { + this.renderEmptyScroll(); + } +}; + +RowManager.prototype.checkClassicModeGroupHeaderWidth = function () { + var self = this, + element = this.tableElement, + onlyGroupHeaders = true; + + self.getDisplayRows().forEach(function (row, index) { + self.styleRow(row, index); + element.appendChild(row.getElement()); + row.initialize(true); + + if (row.type !== "group") { + onlyGroupHeaders = false; + } + }); + + if (onlyGroupHeaders) { + element.style.minWidth = self.table.columnManager.getWidth() + "px"; + } else { + element.style.minWidth = ""; + } +}; + +//show scrollbars on empty table div +RowManager.prototype.renderEmptyScroll = function () { + if (this.table.options.placeholder) { + this.tableElement.style.display = "none"; + } else { + this.tableElement.style.minWidth = this.table.columnManager.getWidth() + "px"; + // this.tableElement.style.minHeight = "1px"; + // this.tableElement.style.visibility = "hidden"; + } +}; + +RowManager.prototype._clearVirtualDom = function () { + var element = this.tableElement; + + if (this.table.options.placeholder && this.table.options.placeholder.parentNode) { + this.table.options.placeholder.parentNode.removeChild(this.table.options.placeholder); + } + + // element.children.detach(); + while (element.firstChild) { + element.removeChild(element.firstChild); + }element.style.paddingTop = ""; + element.style.paddingBottom = ""; + element.style.minWidth = ""; + element.style.minHeight = ""; + element.style.display = ""; + element.style.visibility = ""; + + this.scrollTop = 0; + this.scrollLeft = 0; + this.vDomTop = 0; + this.vDomBottom = 0; + this.vDomTopPad = 0; + this.vDomBottomPad = 0; +}; + +RowManager.prototype.styleRow = function (row, index) { + var rowEl = row.getElement(); + + if (index % 2) { + rowEl.classList.add("tabulator-row-even"); + rowEl.classList.remove("tabulator-row-odd"); + } else { + rowEl.classList.add("tabulator-row-odd"); + rowEl.classList.remove("tabulator-row-even"); + } +}; + +//full virtual render +RowManager.prototype._virtualRenderFill = function (position, forceMove, offset) { + var self = this, + element = self.tableElement, + holder = self.element, + topPad = 0, + rowsHeight = 0, + topPadHeight = 0, + i = 0, + onlyGroupHeaders = true, + rows = self.getDisplayRows(); + + position = position || 0; + + offset = offset || 0; + + if (!position) { + self._clearVirtualDom(); + } else { + while (element.firstChild) { + element.removeChild(element.firstChild); + } //check if position is too close to bottom of table + var heightOccupied = (self.displayRowsCount - position + 1) * self.vDomRowHeight; + + if (heightOccupied < self.height) { + position -= Math.ceil((self.height - heightOccupied) / self.vDomRowHeight); + + if (position < 0) { + position = 0; + } + } + + //calculate initial pad + topPad = Math.min(Math.max(Math.floor(self.vDomWindowBuffer / self.vDomRowHeight), self.vDomWindowMinMarginRows), position); + position -= topPad; + } + + if (self.displayRowsCount && Tabulator.prototype.helpers.elVisible(self.element)) { + + self.vDomTop = position; + + self.vDomBottom = position - 1; + + while ((rowsHeight <= self.height + self.vDomWindowBuffer || i < self.vDomWindowMinTotalRows) && self.vDomBottom < self.displayRowsCount - 1) { + var index = self.vDomBottom + 1, + row = rows[index], + rowHeight = 0; + + self.styleRow(row, index); + + element.appendChild(row.getElement()); + + row.initialize(); + + if (!row.heightInitialized) { + row.normalizeHeight(true); + } + + // if(!row.initialized){ + // row.initialize(true); + // }else{ + // if(!row.heightInitialized){ + // row.normalizeHeight(true); + // } + // } + + rowHeight = row.getHeight(); + + if (i < topPad) { + topPadHeight += rowHeight; + } else { + rowsHeight += rowHeight; + } + + if (rowHeight > this.vDomWindowBuffer) { + this.vDomWindowBuffer = rowHeight * 2; + } + + if (row.type !== "group") { + onlyGroupHeaders = false; + } + + self.vDomBottom++; + i++; + } + + if (!position) { + this.vDomTopPad = 0; + //adjust rowheight to match average of rendered elements + self.vDomRowHeight = Math.floor((rowsHeight + topPadHeight) / i); + self.vDomBottomPad = self.vDomRowHeight * (self.displayRowsCount - self.vDomBottom - 1); + + self.vDomScrollHeight = topPadHeight + rowsHeight + self.vDomBottomPad - self.height; + } else { + self.vDomTopPad = !forceMove ? self.scrollTop - topPadHeight : self.vDomRowHeight * this.vDomTop + offset; + self.vDomBottomPad = self.vDomBottom == self.displayRowsCount - 1 ? 0 : Math.max(self.vDomScrollHeight - self.vDomTopPad - rowsHeight - topPadHeight, 0); + } + + element.style.paddingTop = self.vDomTopPad + "px"; + element.style.paddingBottom = self.vDomBottomPad + "px"; + + if (forceMove) { + this.scrollTop = self.vDomTopPad + topPadHeight + offset - (this.element.scrollWidth > this.element.clientWidth ? this.element.offsetHeight - this.element.clientHeight : 0); + } + + this.scrollTop = Math.min(this.scrollTop, this.element.scrollHeight - this.height); + + //adjust for horizontal scrollbar if present (and not at top of table) + if (this.element.scrollWidth > this.element.offsetWidth && forceMove) { + this.scrollTop += this.element.offsetHeight - this.element.clientHeight; + } + + this.vDomScrollPosTop = this.scrollTop; + this.vDomScrollPosBottom = this.scrollTop; + + holder.scrollTop = this.scrollTop; + + element.style.minWidth = onlyGroupHeaders ? self.table.columnManager.getWidth() + "px" : ""; + + if (self.table.options.groupBy) { + if (self.table.modules.layout.getMode() != "fitDataFill" && self.displayRowsCount == self.table.modules.groupRows.countGroups()) { + self.tableElement.style.minWidth = self.table.columnManager.getWidth(); + } + } + } else { + this.renderEmptyScroll(); + } + + if (!this.fixedHeight) { + this.adjustTableSize(); + } +}; + +//handle vertical scrolling +RowManager.prototype.scrollVertical = function (dir) { + var topDiff = this.scrollTop - this.vDomScrollPosTop; + var bottomDiff = this.scrollTop - this.vDomScrollPosBottom; + var margin = this.vDomWindowBuffer * 2; + + if (-topDiff > margin || bottomDiff > margin) { + //if big scroll redraw table; + var left = this.scrollLeft; + this._virtualRenderFill(Math.floor(this.element.scrollTop / this.element.scrollHeight * this.displayRowsCount)); + this.scrollHorizontal(left); + } else { + + if (dir) { + //scrolling up + if (topDiff < 0) { + + this._addTopRow(-topDiff); + } + + if (bottomDiff < 0) { + + //hide bottom row if needed + if (this.vDomScrollHeight - this.scrollTop > this.vDomWindowBuffer) { + this._removeBottomRow(-bottomDiff); + } else { + this.vDomScrollPosBottom = this.scrollTop; + } + } + } else { + //scrolling down + if (topDiff >= 0) { + + //hide top row if needed + if (this.scrollTop > this.vDomWindowBuffer) { + + this._removeTopRow(topDiff); + } else { + this.vDomScrollPosTop = this.scrollTop; + } + } + + if (bottomDiff >= 0) { + + this._addBottomRow(bottomDiff); + } + } + } +}; + +RowManager.prototype._addTopRow = function (topDiff) { + var i = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0; + + var table = this.tableElement, + rows = this.getDisplayRows(); + + if (this.vDomTop) { + var index = this.vDomTop - 1, + topRow = rows[index], + topRowHeight = topRow.getHeight() || this.vDomRowHeight; + + //hide top row if needed + if (topDiff >= topRowHeight) { + this.styleRow(topRow, index); + table.insertBefore(topRow.getElement(), table.firstChild); + if (!topRow.initialized || !topRow.heightInitialized) { + this.vDomTopNewRows.push(topRow); + + if (!topRow.heightInitialized) { + topRow.clearCellHeight(); + } + } + topRow.initialize(); + + this.vDomTopPad -= topRowHeight; + + if (this.vDomTopPad < 0) { + this.vDomTopPad = index * this.vDomRowHeight; + } + + if (!index) { + this.vDomTopPad = 0; + } + + table.style.paddingTop = this.vDomTopPad + "px"; + this.vDomScrollPosTop -= topRowHeight; + this.vDomTop--; + } + + topDiff = -(this.scrollTop - this.vDomScrollPosTop); + + if (topRow.getHeight() > this.vDomWindowBuffer) { + this.vDomWindowBuffer = topRow.getHeight() * 2; + } + + if (i < this.vDomMaxRenderChain && this.vDomTop && topDiff >= (rows[this.vDomTop - 1].getHeight() || this.vDomRowHeight)) { + this._addTopRow(topDiff, i + 1); + } else { + this._quickNormalizeRowHeight(this.vDomTopNewRows); + } + } +}; + +RowManager.prototype._removeTopRow = function (topDiff) { + var table = this.tableElement, + topRow = this.getDisplayRows()[this.vDomTop], + topRowHeight = topRow.getHeight() || this.vDomRowHeight; + + if (topDiff >= topRowHeight) { + + var rowEl = topRow.getElement(); + rowEl.parentNode.removeChild(rowEl); + + this.vDomTopPad += topRowHeight; + table.style.paddingTop = this.vDomTopPad + "px"; + this.vDomScrollPosTop += this.vDomTop ? topRowHeight : topRowHeight + this.vDomWindowBuffer; + this.vDomTop++; + + topDiff = this.scrollTop - this.vDomScrollPosTop; + + this._removeTopRow(topDiff); + } +}; + +RowManager.prototype._addBottomRow = function (bottomDiff) { + var i = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0; + + var table = this.tableElement, + rows = this.getDisplayRows(); + + if (this.vDomBottom < this.displayRowsCount - 1) { + var index = this.vDomBottom + 1, + bottomRow = rows[index], + bottomRowHeight = bottomRow.getHeight() || this.vDomRowHeight; + + //hide bottom row if needed + if (bottomDiff >= bottomRowHeight) { + this.styleRow(bottomRow, index); + table.appendChild(bottomRow.getElement()); + + if (!bottomRow.initialized || !bottomRow.heightInitialized) { + this.vDomBottomNewRows.push(bottomRow); + + if (!bottomRow.heightInitialized) { + bottomRow.clearCellHeight(); + } + } + + bottomRow.initialize(); + + this.vDomBottomPad -= bottomRowHeight; + + if (this.vDomBottomPad < 0 || index == this.displayRowsCount - 1) { + this.vDomBottomPad = 0; + } + + table.style.paddingBottom = this.vDomBottomPad + "px"; + this.vDomScrollPosBottom += bottomRowHeight; + this.vDomBottom++; + } + + bottomDiff = this.scrollTop - this.vDomScrollPosBottom; + + if (bottomRow.getHeight() > this.vDomWindowBuffer) { + this.vDomWindowBuffer = bottomRow.getHeight() * 2; + } + + if (i < this.vDomMaxRenderChain && this.vDomBottom < this.displayRowsCount - 1 && bottomDiff >= (rows[this.vDomBottom + 1].getHeight() || this.vDomRowHeight)) { + this._addBottomRow(bottomDiff, i + 1); + } else { + this._quickNormalizeRowHeight(this.vDomBottomNewRows); + } + } +}; + +RowManager.prototype._removeBottomRow = function (bottomDiff) { + var table = this.tableElement, + bottomRow = this.getDisplayRows()[this.vDomBottom], + bottomRowHeight = bottomRow.getHeight() || this.vDomRowHeight; + + if (bottomDiff >= bottomRowHeight) { + + var rowEl = bottomRow.getElement(); + + if (rowEl.parentNode) { + rowEl.parentNode.removeChild(rowEl); + } + + this.vDomBottomPad += bottomRowHeight; + + if (this.vDomBottomPad < 0) { + this.vDomBottomPad = 0; + } + + table.style.paddingBottom = this.vDomBottomPad + "px"; + this.vDomScrollPosBottom -= bottomRowHeight; + this.vDomBottom--; + + bottomDiff = -(this.scrollTop - this.vDomScrollPosBottom); + + this._removeBottomRow(bottomDiff); + } +}; + +RowManager.prototype._quickNormalizeRowHeight = function (rows) { + rows.forEach(function (row) { + row.calcHeight(); + }); + + rows.forEach(function (row) { + row.setCellHeight(); + }); + + rows.length = 0; +}; + +//normalize height of active rows +RowManager.prototype.normalizeHeight = function () { + this.activeRows.forEach(function (row) { + row.normalizeHeight(); + }); +}; + +//adjust the height of the table holder to fit in the Tabulator element +RowManager.prototype.adjustTableSize = function () { + var initialHeight = this.element.clientHeight, + modExists; + + if (this.renderMode === "virtual") { + var otherHeight = Math.floor(this.columnManager.getElement().offsetHeight + (this.table.footerManager && !this.table.footerManager.external ? this.table.footerManager.getElement().offsetHeight : 0)); + + if (this.fixedHeight) { + this.element.style.minHeight = "calc(100% - " + otherHeight + "px)"; + this.element.style.height = "calc(100% - " + otherHeight + "px)"; + this.element.style.maxHeight = "calc(100% - " + otherHeight + "px)"; + } else { + this.element.style.height = ""; + this.element.style.height = Math.floor(this.table.element.clientHeight) - otherHeight + "px"; + this.element.scrollTop = this.scrollTop; + } + + this.height = this.element.clientHeight; + this.vDomWindowBuffer = this.table.options.virtualDomBuffer || this.height; + + //check if the table has changed size when dealing with variable height tables + if (!this.fixedHeight && Math.floor(initialHeight) != Math.floor(this.element.clientHeight)) { + modExists = this.table.modExists("resizeTable"); + + if (modExists && !this.table.modules.resizeTable.autoResize || !modExists) { + this.redraw(); + } + } + } +}; + +//renitialize all rows +RowManager.prototype.reinitialize = function () { + this.rows.forEach(function (row) { + row.reinitialize(true); + }); +}; + +//prevent table from being redrawn +RowManager.prototype.blockRedraw = function () { + this.redrawBlock = true; + this.redrawBlockRestoreConfig = false; +}; + +//restore table redrawing +RowManager.prototype.restoreRedraw = function () { + this.redrawBlock = false; + + if (this.redrawBlockRestoreConfig) { + this.refreshActiveData(this.redrawBlockRestoreConfig.stage, this.redrawBlockRestoreConfig.skipStage, this.redrawBlockRestoreConfig.renderInPosition); + + this.redrawBlockRestoreConfig = false; + } else { + if (this.redrawBlockRederInPosition) { + this.reRenderInPosition(); + } + } + + this.redrawBlockRederInPosition = false; +}; + +//redraw table +RowManager.prototype.redraw = function (force) { + var pos = 0, + left = this.scrollLeft; + + this.adjustTableSize(); + + this.table.tableWidth = this.table.element.clientWidth; + + if (!force) { + if (this.renderMode == "classic") { + + if (this.table.options.groupBy) { + this.refreshActiveData("group", false, false); + } else { + this._simpleRender(); + } + } else { + this.reRenderInPosition(); + this.scrollHorizontal(left); + } + + if (!this.displayRowsCount) { + if (this.table.options.placeholder) { + this.getElement().appendChild(this.table.options.placeholder); + } + } + } else { + this.renderTable(); + } +}; + +RowManager.prototype.resetScroll = function () { + this.element.scrollLeft = 0; + this.element.scrollTop = 0; + + if (this.table.browser === "ie") { + var event = document.createEvent("Event"); + event.initEvent("scroll", false, true); + this.element.dispatchEvent(event); + } else { + this.element.dispatchEvent(new Event('scroll')); + } +}; + +var VDomHoz = function VDomHoz(table) { + this.table = table; + + this.element = this.table.rowManager.tableElement; + this.holderEl = this.table.rowManager.element; + + this.leftCol = 0; + this.rightCol = 0; + this.scrollLeft = 0; + + this.vDomScrollPosLeft = 0; + this.vDomScrollPosRight = 0; + + this.vDomPadLeft = 0; + this.vDomPadRight = 0; + + this.fitDataColAvg = 0; + + this.window = 200; //pixel margin to make column visible before it is shown on screen + + this.initialized = false; + + this.columns = []; + + if (this.compatabilityCheck()) { + this.initialize(); + } +}; + +VDomHoz.prototype.compatabilityCheck = function () { + var options = this.table.options, + frozen = false, + ok = true; + + if (options.layout == "fitDataTable") { + console.warn("Horizontal Vitrual DOM is not compatible with fitDataTable layout mode"); + ok = false; + } + + if (options.responsiveLayout) { + console.warn("Horizontal Vitrual DOM is not compatible with responsive columns"); + ok = false; + } + + if (this.table.rtl) { + console.warn("Horizontal Vitrual DOM is not currently compatible with RTL text direction"); + ok = false; + } + + // if(options.rowFormatter){ + // console.warn("Horizontal Vitrual DOM is not compatible with row formatters"); + // ok = false; + // } + + if (options.columns) { + frozen = options.columns.find(function (col) { + return col.frozen; + }); + + if (frozen) { + console.warn("Horizontal Vitrual DOM is not compatible with frozen columns"); + ok = false; + } + } + + if (!ok) { + options.virtualDomHoz = false; + } + + return ok; +}; + +VDomHoz.prototype.initialize = function () { + var _this17 = this; + + this.holderEl.addEventListener("scroll", function () { + var left = _this17.holderEl.scrollLeft; + + if (_this17.scrollLeft != left) { + _this17.scrollLeft = left; + _this17.scroll(left - (_this17.vDomScrollPosLeft + _this17.window)); + } + }); +}; + +VDomHoz.prototype.deinitialize = function () { + this.initialized = false; +}; + +VDomHoz.prototype.clear = function () { + this.columns = []; + + this.leftCol = -1; + this.rightCol = 0; + + this.vDomScrollPosLeft = 0; + this.vDomScrollPosRight = 0; + this.vDomPadLeft = 0; + this.vDomPadRight = 0; +}; + +VDomHoz.prototype.dataChange = function () { + var change = false, + collsWidth = 0, + colEnd = 0, + group, + row, + rowEl; + + if (this.table.options.layout === "fitData") { + this.table.columnManager.columnsByIndex.forEach(function (column) { + if (!column.definition.width && column.visible) { + change = true; + } + }); + + if (change) { + if (change && this.table.rowManager.getDisplayRows().length) { + // this.table.vdomHoz.deinitialize(); + + this.vDomScrollPosRight = this.scrollLeft + this.holderEl.clientWidth + this.window; + + if (this.table.options.groupBy) { + group = this.table.modules.groupRows.getGroups(false)[0]; + + row = group.getRows(false)[0]; + } else { + row = this.table.rowManager.getDisplayRows()[0]; + } + + if (row) { + + rowEl = row.getElement(); + + row.generateCells(); + + this.element.appendChild(rowEl); + + for (var colEnd = 0; colEnd < row.cells.length; colEnd++) { + var cell = row.cells[colEnd]; + rowEl.appendChild(cell.getElement()); + + cell.column.reinitializeWidth(); + + collsWidth += cell.column.getWidth(); + + if (collsWidth > this.vDomScrollPosRight) { + break; + } + } + + rowEl.parentNode.removeChild(rowEl); + + this.fitDataColAvg = Math.floor(collsWidth / (colEnd + 1)); + + for (colEnd; colEnd < this.table.columnManager.columnsByIndex.length; colEnd++) { + this.table.columnManager.columnsByIndex[colEnd].setWidth(this.fitDataColAvg); + } + + this.reinitialize(false, true); + } + } + } + } else { + if (this.table.options.layout === "fitColumns") { + this.table.modules.layout.layout(); + this.table.vdomHoz.reinitialize(false, true); + } + } +}; + +VDomHoz.prototype.fitDataLayoutOverride = function () { + for (var i = this.leftCol; i <= this.rightCol; i++) { + this.columns[i].reinitializeWidth(); + } +}; + +VDomHoz.prototype.reinitialize = function (update, blockRedraw) { + var _this18 = this; + + var old = { + cols: this.columns, + leftCol: this.leftCol, + rightCol: this.rightCol + }; + + if (update && !this.initialized) { + return; + } + + this.clear(); + + this.scrollLeft = this.holderEl.scrollLeft; + + this.vDomScrollPosLeft = this.scrollLeft - this.window; + this.vDomScrollPosRight = this.scrollLeft + this.holderEl.clientWidth + this.window; + + var colPos = 0; + + this.table.columnManager.columnsByIndex.forEach(function (column) { + var config = {}; + + if (column.visible) { + var width = column.getWidth(); + + config.leftPos = colPos; + config.rightPos = colPos + width; + + if (colPos + width > _this18.vDomScrollPosLeft && colPos < _this18.vDomScrollPosRight) { + //column is visible + + if (_this18.leftCol == -1) { + _this18.leftCol = _this18.columns.length; + _this18.vDomPadLeft = colPos; + } + + _this18.rightCol = _this18.columns.length; + } else { + // column is hidden + if (_this18.leftCol !== -1) { + _this18.vDomPadRight += width; + } + } + + _this18.columns.push(column); + + column.modules.vdomHoz = config; + + colPos += width; + } + }); + + this.element.style.paddingLeft = this.vDomPadLeft + "px"; + this.element.style.paddingRight = this.vDomPadRight + "px"; + + this.initialized = true; + + if (!blockRedraw) { + if (!update || this.reinitChanged(old)) { + this.renitializeRows(); + } + } + + this.holderEl.scrollLeft = this.scrollLeft; +}; + +VDomHoz.prototype.reinitChanged = function (old) { + var _this19 = this; + + var match = true; + + if (old.cols.length !== this.columns.length || old.leftCol !== this.leftCol || old.rightCol !== this.rightCol) { + return true; + } + + old.cols.forEach(function (col, i) { + if (col !== _this19.columns[i]) { + match = false; + } + }); + + return !match; +}; + +VDomHoz.prototype.renitializeRows = function () { + var _this20 = this; + + var rows = this.table.rowManager.getVisibleRows(); + rows.forEach(function (row) { + _this20.reinitializeRow(row, true); + }); +}; + +VDomHoz.prototype.scroll = function (diff) { + this.vDomScrollPosLeft += diff; + this.vDomScrollPosRight += diff; + + if (diff > this.holderEl.clientWidth * .8) { + this.reinitialize(); + } else { + if (diff > 0) { + //scroll right + this.addColRight(); + this.removeColLeft(); + } else { + //scroll left + this.addColLeft(); + this.removeColRight(); + } + } +}; + +VDomHoz.prototype.colPositionAdjust = function (start, end, diff) { + for (var i = start; i < end; i++) { + var column = this.columns[i]; + + column.modules.vdomHoz.leftPos -= diff; + column.modules.vdomHoz.rightPos -= diff; + } +}; + +VDomHoz.prototype.addColRight = function () { + var column = this.columns[this.rightCol + 1], + rows, + oldWidth, + widthDiff; + + if (column && column.modules.vdomHoz.leftPos <= this.vDomScrollPosRight) { + + rows = this.table.rowManager.getVisibleRows(); + + rows.forEach(function (row) { + if (row.type !== "group") { + var cell = row.getCell(column); + row.getElement().appendChild(cell.getElement()); + cell.cellRendered(); + } + }); + + if (this.fitDataColAvg) { + + oldWidth = column.getWidth(); + + if (oldWidth === this.fitDataColAvg) { + column.reinitializeWidth(); + + widthDiff = oldWidth - column.getWidth(); + + if (widthDiff) { + column.modules.vdomHoz.rightPos -= widthDiff; + this.colPositionAdjust(this.rightCol + 1, this.columns.length, widthDiff); + } + } + } + + this.rightCol++; + + if (this.rightCol >= this.columns.length - 1) { + this.vDomPadRight = 0; + } else { + this.vDomPadRight -= column.getWidth(); + } + + this.element.style.paddingRight = this.vDomPadRight + "px"; + + this.addColRight(); + } +}; + +VDomHoz.prototype.addColLeft = function () { + var column = this.columns[this.leftCol - 1], + rows; + + if (column && column.modules.vdomHoz.rightPos >= this.vDomScrollPosLeft) { + var rows = this.table.rowManager.getVisibleRows(); + + rows.forEach(function (row) { + if (row.type !== "group") { + var cell = row.getCell(column); + row.getElement().prepend(cell.getElement()); + cell.cellRendered(); + } + }); + + if (!this.leftCol) { + this.vDomPadLeft = 0; + } else { + this.vDomPadLeft -= column.getWidth(); + } + + this.element.style.paddingLeft = this.vDomPadLeft + "px"; + + this.leftCol--; + + this.addColLeft(); + } +}; + +VDomHoz.prototype.removeColRight = function (column) { + var column = this.columns[this.rightCol], + rows; + + if (column && column.modules.vdomHoz.leftPos > this.vDomScrollPosRight) { + rows = this.table.rowManager.getVisibleRows(); + + column.modules.vdomHoz.visible = false; + + rows.forEach(function (row) { + if (row.type !== "group") { + var cell = row.getCell(column); + row.getElement().removeChild(cell.getElement()); + } + }); + + this.vDomPadRight += column.getWidth(); + this.element.style.paddingRight = this.vDomPadRight + "px"; + + this.rightCol--; + + this.removeColRight(); + } +}; + +VDomHoz.prototype.removeColLeft = function () { + var column = this.columns[this.leftCol], + rows; + + if (column && column.modules.vdomHoz.rightPos < this.vDomScrollPosLeft) { + + rows = this.table.rowManager.getVisibleRows(); + + rows.forEach(function (row) { + if (row.type !== "group") { + var cell = row.getCell(column); + row.getElement().removeChild(cell.getElement()); + } + }); + + this.vDomPadLeft += column.getWidth(); + this.element.style.paddingLeft = this.vDomPadLeft + "px"; + + this.leftCol++; + + this.removeColLeft(); + } +}; + +VDomHoz.prototype.initializeRow = function (row) { + if (row.type !== "group") { + row.modules.vdomHoz = { + leftCol: this.leftCol, + rightCol: this.rightCol + }; + + for (var i = this.leftCol; i <= this.rightCol; i++) { + var column = this.columns[i]; + + if (column.visible) { + var cell = row.getCell(column); + + row.element.appendChild(cell.getElement()); + cell.cellRendered(); + } + } + } +}; + +VDomHoz.prototype.reinitializeRow = function (row, force) { + if (row.type !== "group") { + if (force || !row.modules.vdomHoz || row.modules.vdomHoz.leftCol !== this.leftCol || row.modules.vdomHoz.rightCol !== this.rightCol) { + while (row.element.firstChild) { + row.element.removeChild(row.element.firstChild); + }this.initializeRow(row); + } + } +}; +//public row object +var RowComponent = function RowComponent(row) { + this._row = row; +}; + +RowComponent.prototype.getData = function (transform) { + return this._row.getData(transform); +}; + +RowComponent.prototype.getElement = function () { + return this._row.getElement(); +}; + +RowComponent.prototype.getCells = function () { + var cells = []; + + this._row.getCells().forEach(function (cell) { + cells.push(cell.getComponent()); + }); + + return cells; +}; + +RowComponent.prototype.getCell = function (column) { + var cell = this._row.getCell(column); + return cell ? cell.getComponent() : false; +}; + +RowComponent.prototype.getIndex = function () { + return this._row.getData("data")[this._row.table.options.index]; +}; + +RowComponent.prototype.getPosition = function (active) { + return this._row.table.rowManager.getRowPosition(this._row, active); +}; + +RowComponent.prototype.delete = function () { + return this._row.delete(); +}; + +RowComponent.prototype.scrollTo = function () { + return this._row.table.rowManager.scrollToRow(this._row); +}; + +RowComponent.prototype.pageTo = function () { + if (this._row.table.modExists("page", true)) { + return this._row.table.modules.page.setPageToRow(this._row); + } +}; + +RowComponent.prototype.move = function (to, after) { + this._row.moveToRow(to, after); +}; + +RowComponent.prototype.update = function (data) { + return this._row.updateData(data); +}; + +RowComponent.prototype.normalizeHeight = function () { + this._row.normalizeHeight(true); +}; + +RowComponent.prototype.select = function () { + this._row.table.modules.selectRow.selectRows(this._row); +}; + +RowComponent.prototype.deselect = function () { + this._row.table.modules.selectRow.deselectRows(this._row); +}; + +RowComponent.prototype.toggleSelect = function () { + this._row.table.modules.selectRow.toggleRow(this._row); +}; + +RowComponent.prototype.isSelected = function () { + return this._row.table.modules.selectRow.isRowSelected(this._row); +}; + +RowComponent.prototype._getSelf = function () { + return this._row; +}; + +RowComponent.prototype.validate = function () { + return this._row.validate(); +}; + +RowComponent.prototype.freeze = function () { + if (this._row.table.modExists("frozenRows", true)) { + this._row.table.modules.frozenRows.freezeRow(this._row); + } +}; + +RowComponent.prototype.unfreeze = function () { + if (this._row.table.modExists("frozenRows", true)) { + this._row.table.modules.frozenRows.unfreezeRow(this._row); + } +}; + +RowComponent.prototype.isFrozen = function () { + if (this._row.table.modExists("frozenRows", true)) { + var index = this._row.table.modules.frozenRows.rows.indexOf(this._row); + return index > -1; + } + + return false; +}; + +RowComponent.prototype.treeCollapse = function () { + if (this._row.table.modExists("dataTree", true)) { + this._row.table.modules.dataTree.collapseRow(this._row); + } +}; + +RowComponent.prototype.treeExpand = function () { + if (this._row.table.modExists("dataTree", true)) { + this._row.table.modules.dataTree.expandRow(this._row); + } +}; + +RowComponent.prototype.treeToggle = function () { + if (this._row.table.modExists("dataTree", true)) { + this._row.table.modules.dataTree.toggleRow(this._row); + } +}; + +RowComponent.prototype.getTreeParent = function () { + if (this._row.table.modExists("dataTree", true)) { + return this._row.table.modules.dataTree.getTreeParent(this._row); + } + + return false; +}; + +RowComponent.prototype.getTreeChildren = function () { + if (this._row.table.modExists("dataTree", true)) { + return this._row.table.modules.dataTree.getTreeChildren(this._row, true); + } + + return false; +}; + +RowComponent.prototype.addTreeChild = function (data, pos, index) { + if (this._row.table.modExists("dataTree", true)) { + return this._row.table.modules.dataTree.addTreeChildRow(this._row, data, pos, index); + } + + return false; +}; + +RowComponent.prototype.reformat = function () { + return this._row.reinitialize(); +}; + +RowComponent.prototype.getGroup = function () { + return this._row.getGroup().getComponent(); +}; + +RowComponent.prototype.getTable = function () { + return this._row.table; +}; + +RowComponent.prototype.getNextRow = function () { + var row = this._row.nextRow(); + return row ? row.getComponent() : row; +}; + +RowComponent.prototype.getPrevRow = function () { + var row = this._row.prevRow(); + return row ? row.getComponent() : row; +}; + +var Row = function Row(data, parent) { + var type = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : "row"; + + this.table = parent.table; + this.parent = parent; + this.data = {}; + this.type = type; //type of element + this.element = this.createElement(); + this.modules = {}; //hold module variables; + this.cells = []; + this.height = 0; //hold element height + this.heightStyled = ""; //hold element height prestyled to improve render efficiency + this.manualHeight = false; //user has manually set row height + this.outerHeight = 0; //holde lements outer height + this.initialized = false; //element has been rendered + this.heightInitialized = false; //element has resized cells to fit + + this.component = null; + + this.setData(data); + this.generateElement(); +}; + +Row.prototype.createElement = function () { + var el = document.createElement("div"); + + el.classList.add("tabulator-row"); + el.setAttribute("role", "row"); + + return el; +}; + +Row.prototype.getElement = function () { + return this.element; +}; + +Row.prototype.detachElement = function () { + if (this.element && this.element.parentNode) { + this.element.parentNode.removeChild(this.element); + } +}; + +Row.prototype.generateElement = function () { + var self = this, + dblTap, + tapHold, + tap; + + //set row selection characteristics + if (self.table.options.selectable !== false && self.table.modExists("selectRow")) { + self.table.modules.selectRow.initializeRow(this); + } + + //setup movable rows + if (self.table.options.movableRows !== false && self.table.modExists("moveRow")) { + self.table.modules.moveRow.initializeRow(this); + } + + //setup data tree + if (self.table.options.dataTree !== false && self.table.modExists("dataTree")) { + self.table.modules.dataTree.initializeRow(this); + } + + //setup column colapse container + if (self.table.options.responsiveLayout === "collapse" && self.table.modExists("responsiveLayout")) { + self.table.modules.responsiveLayout.initializeRow(this); + } + + //set column menu + if ((self.table.options.rowContextMenu || self.table.options.rowClickMenu) && this.table.modExists("menu")) { + self.table.modules.menu.initializeRow(this); + } + + //handle row click events + if (self.table.options.rowClick) { + self.element.addEventListener("click", function (e) { + self.table.options.rowClick(e, self.getComponent()); + }); + } + + if (self.table.options.rowDblClick) { + self.element.addEventListener("dblclick", function (e) { + self.table.options.rowDblClick(e, self.getComponent()); + }); + } + + if (self.table.options.rowContext) { + self.element.addEventListener("contextmenu", function (e) { + self.table.options.rowContext(e, self.getComponent()); + }); + } + + //handle mouse events + if (self.table.options.rowMouseEnter) { + self.element.addEventListener("mouseenter", function (e) { + self.table.options.rowMouseEnter(e, self.getComponent()); + }); + } + + if (self.table.options.rowMouseLeave) { + self.element.addEventListener("mouseleave", function (e) { + self.table.options.rowMouseLeave(e, self.getComponent()); + }); + } + + if (self.table.options.rowMouseOver) { + self.element.addEventListener("mouseover", function (e) { + self.table.options.rowMouseOver(e, self.getComponent()); + }); + } + + if (self.table.options.rowMouseOut) { + self.element.addEventListener("mouseout", function (e) { + self.table.options.rowMouseOut(e, self.getComponent()); + }); + } + + if (self.table.options.rowMouseMove) { + self.element.addEventListener("mousemove", function (e) { + self.table.options.rowMouseMove(e, self.getComponent()); + }); + } + + if (self.table.options.rowTap) { + + tap = false; + + self.element.addEventListener("touchstart", function (e) { + tap = true; + }, { passive: true }); + + self.element.addEventListener("touchend", function (e) { + if (tap) { + self.table.options.rowTap(e, self.getComponent()); + } + + tap = false; + }); + } + + if (self.table.options.rowDblTap) { + + dblTap = null; + + self.element.addEventListener("touchend", function (e) { + + if (dblTap) { + clearTimeout(dblTap); + dblTap = null; + + self.table.options.rowDblTap(e, self.getComponent()); + } else { + + dblTap = setTimeout(function () { + clearTimeout(dblTap); + dblTap = null; + }, 300); + } + }); + } + + if (self.table.options.rowTapHold) { + + tapHold = null; + + self.element.addEventListener("touchstart", function (e) { + clearTimeout(tapHold); + + tapHold = setTimeout(function () { + clearTimeout(tapHold); + tapHold = null; + tap = false; + self.table.options.rowTapHold(e, self.getComponent()); + }, 1000); + }, { passive: true }); + + self.element.addEventListener("touchend", function (e) { + clearTimeout(tapHold); + tapHold = null; + }); + } +}; + +Row.prototype.generateCells = function () { + this.cells = this.table.columnManager.generateCells(this); +}; + +//functions to setup on first render +Row.prototype.initialize = function (force) { + var _this21 = this; + + if (!this.initialized || force) { + + this.deleteCells(); + + while (this.element.firstChild) { + this.element.removeChild(this.element.firstChild); + } //handle frozen cells + if (this.table.modExists("frozenColumns")) { + this.table.modules.frozenColumns.layoutRow(this); + } + + this.generateCells(); + + if (this.table.options.virtualDomHoz && this.table.vdomHoz.initialized) { + this.table.vdomHoz.initializeRow(this); + } else { + this.cells.forEach(function (cell) { + _this21.element.appendChild(cell.getElement()); + cell.cellRendered(); + }); + } + + if (force) { + this.normalizeHeight(); + } + + //setup movable rows + if (this.table.options.dataTree && this.table.modExists("dataTree")) { + this.table.modules.dataTree.layoutRow(this); + } + + //setup column colapse container + if (this.table.options.responsiveLayout === "collapse" && this.table.modExists("responsiveLayout")) { + this.table.modules.responsiveLayout.layoutRow(this); + } + + if (this.table.options.rowFormatter) { + this.table.options.rowFormatter(this.getComponent()); + } + + //set resizable handles + if (this.table.options.resizableRows && this.table.modExists("resizeRows")) { + this.table.modules.resizeRows.initializeRow(this); + } + + this.initialized = true; + } else { + if (this.table.options.virtualDomHoz) { + this.table.vdomHoz.reinitializeRow(this); + } + } +}; + +Row.prototype.reinitializeHeight = function () { + this.heightInitialized = false; + + if (this.element.offsetParent !== null) { + this.normalizeHeight(true); + } +}; + +Row.prototype.reinitialize = function (children) { + this.initialized = false; + this.heightInitialized = false; + + if (!this.manualHeight) { + this.height = 0; + this.heightStyled = ""; + } + + if (this.element.offsetParent !== null) { + this.initialize(true); + } + + if (this.table.options.dataTree && this.table.modExists("dataTree", true)) { + this.table.modules.dataTree.getTreeChildren(this, false, true).forEach(function (child) { + child.reinitialize(true); + }); + } +}; + +//get heights when doing bulk row style calcs in virtual DOM +Row.prototype.calcHeight = function (force) { + + var maxHeight = 0, + minHeight = this.table.options.resizableRows ? this.element.clientHeight : 0; + + this.cells.forEach(function (cell) { + var height = cell.getHeight(); + if (height > maxHeight) { + maxHeight = height; + } + }); + + if (force) { + this.height = Math.max(maxHeight, minHeight); + } else { + this.height = this.manualHeight ? this.height : Math.max(maxHeight, minHeight); + } + + this.heightStyled = this.height ? this.height + "px" : ""; + this.outerHeight = this.element.offsetHeight; +}; + +//set of cells +Row.prototype.setCellHeight = function () { + this.cells.forEach(function (cell) { + cell.setHeight(); + }); + + this.heightInitialized = true; +}; + +Row.prototype.clearCellHeight = function () { + this.cells.forEach(function (cell) { + cell.clearHeight(); + }); +}; + +//normalize the height of elements in the row +Row.prototype.normalizeHeight = function (force) { + + if (force) { + this.clearCellHeight(); + } + + this.calcHeight(force); + + this.setCellHeight(); +}; + +// Row.prototype.setHeight = function(height){ +// this.height = height; + +// this.setCellHeight(); +// }; + +//set height of rows +Row.prototype.setHeight = function (height, force) { + if (this.height != height || force) { + + this.manualHeight = true; + + this.height = height; + this.heightStyled = height ? height + "px" : ""; + + this.setCellHeight(); + + // this.outerHeight = this.element.outerHeight(); + this.outerHeight = this.element.offsetHeight; + } +}; + +//return rows outer height +Row.prototype.getHeight = function () { + return this.outerHeight; +}; + +//return rows outer Width +Row.prototype.getWidth = function () { + return this.element.offsetWidth; +}; + +//////////////// Cell Management ///////////////// + +Row.prototype.deleteCell = function (cell) { + var index = this.cells.indexOf(cell); + + if (index > -1) { + this.cells.splice(index, 1); + } +}; + +//////////////// Data Management ///////////////// + +Row.prototype.setData = function (data) { + if (this.table.modExists("mutator")) { + data = this.table.modules.mutator.transformRow(data, "data"); + } + + this.data = data; + + if (this.table.options.reactiveData && this.table.modExists("reactiveData", true)) { + this.table.modules.reactiveData.watchRow(this); + } +}; + +//update the rows data +Row.prototype.updateData = function (updatedData) { + var _this22 = this; + + var visible = Tabulator.prototype.helpers.elVisible(this.element), + tempData = {}, + newRowData; + + return new Promise(function (resolve, reject) { + + if (typeof updatedData === "string") { + updatedData = JSON.parse(updatedData); + } + + if (_this22.table.options.reactiveData && _this22.table.modExists("reactiveData", true)) { + _this22.table.modules.reactiveData.block(); + } + + //mutate incomming data if needed + if (_this22.table.modExists("mutator")) { + + tempData = Object.assign(tempData, _this22.data); + tempData = Object.assign(tempData, updatedData); + + newRowData = _this22.table.modules.mutator.transformRow(tempData, "data", updatedData); + } else { + newRowData = updatedData; + } + + //set data + for (var attrname in newRowData) { + _this22.data[attrname] = newRowData[attrname]; + } + + if (_this22.table.options.reactiveData && _this22.table.modExists("reactiveData", true)) { + _this22.table.modules.reactiveData.unblock(); + } + + //update affected cells only + for (var attrname in updatedData) { + + var columns = _this22.table.columnManager.getColumnsByFieldRoot(attrname); + + columns.forEach(function (column) { + var cell = _this22.getCell(column.getField()); + + if (cell) { + var value = column.getFieldValue(newRowData); + if (cell.getValue() != value) { + cell.setValueProcessData(value); + + if (visible) { + cell.cellRendered(); + } + } + } + }); + } + + if (_this22.table.options.groupUpdateOnCellEdit && _this22.table.options.groupBy && _this22.table.modExists("groupRows")) { + _this22.table.modules.groupRows.reassignRowToGroup(_this22.row); + } + + //Partial reinitialization if visible + if (visible) { + _this22.normalizeHeight(true); + + if (_this22.table.options.rowFormatter) { + _this22.table.options.rowFormatter(_this22.getComponent()); + } + } else { + _this22.initialized = false; + _this22.height = 0; + _this22.heightStyled = ""; + } + + if (_this22.table.options.dataTree !== false && _this22.table.modExists("dataTree") && _this22.table.modules.dataTree.redrawNeeded(updatedData)) { + _this22.table.modules.dataTree.initializeRow(_this22); + + if (visible) { + _this22.table.modules.dataTree.layoutRow(_this22); + _this22.table.rowManager.refreshActiveData("tree", false, true); + } + } + + //this.reinitialize(); + + _this22.table.options.rowUpdated.call(_this22.table, _this22.getComponent()); + + if (_this22.table.options.dataChanged) { + _this22.table.options.dataChanged.call(_this22.table, _this22.table.rowManager.getData()); + } + + resolve(); + }); +}; + +Row.prototype.getData = function (transform) { + if (transform) { + if (this.table.modExists("accessor")) { + return this.table.modules.accessor.transformRow(this, transform); + } + } + + return this.data; +}; + +Row.prototype.getCell = function (column) { + var match = false; + + column = this.table.columnManager.findColumn(column); + + match = this.cells.find(function (cell) { + return cell.column === column; + }); + + return match; +}; + +Row.prototype.getCellIndex = function (findCell) { + return this.cells.findIndex(function (cell) { + return cell === findCell; + }); +}; + +Row.prototype.findNextEditableCell = function (index) { + var nextCell = false; + + if (index < this.cells.length - 1) { + for (var i = index + 1; i < this.cells.length; i++) { + var cell = this.cells[i]; + + if (cell.column.modules.edit && Tabulator.prototype.helpers.elVisible(cell.getElement())) { + var allowEdit = true; + + if (typeof cell.column.modules.edit.check == "function") { + allowEdit = cell.column.modules.edit.check(cell.getComponent()); + } + + if (allowEdit) { + nextCell = cell; + break; + } + } + } + } + + return nextCell; +}; + +Row.prototype.findPrevEditableCell = function (index) { + var prevCell = false; + + if (index > 0) { + for (var i = index - 1; i >= 0; i--) { + var cell = this.cells[i], + allowEdit = true; + + if (cell.column.modules.edit && Tabulator.prototype.helpers.elVisible(cell.getElement())) { + if (typeof cell.column.modules.edit.check == "function") { + allowEdit = cell.column.modules.edit.check(cell.getComponent()); + } + + if (allowEdit) { + prevCell = cell; + break; + } + } + } + } + + return prevCell; +}; + +Row.prototype.getCells = function () { + return this.cells; +}; + +Row.prototype.nextRow = function () { + var row = this.table.rowManager.nextDisplayRow(this, true); + return row || false; +}; + +Row.prototype.prevRow = function () { + var row = this.table.rowManager.prevDisplayRow(this, true); + return row || false; +}; + +Row.prototype.moveToRow = function (to, before) { + var toRow = this.table.rowManager.findRow(to); + + if (toRow) { + this.table.rowManager.moveRowActual(this, toRow, !before); + this.table.rowManager.refreshActiveData("display", false, true); + } else { + console.warn("Move Error - No matching row found:", to); + } +}; + +Row.prototype.validate = function () { + var invalid = []; + + this.cells.forEach(function (cell) { + if (!cell.validate()) { + invalid.push(cell.getComponent()); + } + }); + + return invalid.length ? invalid : true; +}; + +///////////////////// Actions ///////////////////// + +Row.prototype.delete = function () { + var _this23 = this; + + return new Promise(function (resolve, reject) { + var index, rows; + + if (_this23.table.options.history && _this23.table.modExists("history")) { + + if (_this23.table.options.groupBy && _this23.table.modExists("groupRows")) { + rows = _this23.getGroup().rows; + index = rows.indexOf(_this23); + + if (index) { + index = rows[index - 1]; + } + } else { + index = _this23.table.rowManager.getRowIndex(_this23); + + if (index) { + index = _this23.table.rowManager.rows[index - 1]; + } + } + + _this23.table.modules.history.action("rowDelete", _this23, { data: _this23.getData(), pos: !index, index: index }); + } + + _this23.deleteActual(); + + resolve(); + }); +}; + +Row.prototype.deleteActual = function (blockRedraw) { + var index = this.table.rowManager.getRowIndex(this); + + this.detatchModules(); + + // if(this.table.options.dataTree && this.table.modExists("dataTree")){ + // this.table.modules.dataTree.collapseRow(this, true); + // } + + //remove any reactive data watchers from row object + if (this.table.options.reactiveData && this.table.modExists("reactiveData", true)) {} + // this.table.modules.reactiveData.unwatchRow(this); + + + //remove from group + if (this.modules.group) { + this.modules.group.removeRow(this); + } + + this.table.rowManager.deleteRow(this, blockRedraw); + + this.deleteCells(); + + this.initialized = false; + this.heightInitialized = false; + this.element = false; + + if (this.table.options.dataTree && this.table.modExists("dataTree", true)) { + this.table.modules.dataTree.rowDelete(this); + } + + //recalc column calculations if present + if (this.table.modExists("columnCalcs")) { + if (this.table.options.groupBy && this.table.modExists("groupRows")) { + this.table.modules.columnCalcs.recalcRowGroup(this); + } else { + this.table.modules.columnCalcs.recalc(this.table.rowManager.activeRows); + } + } +}; + +Row.prototype.detatchModules = function () { + //deselect row if it is selected + if (this.table.modExists("selectRow")) { + this.table.modules.selectRow._deselectRow(this, true); + } + + //cancel edit if row is currently being edited + if (this.table.modExists("edit")) { + if (this.table.modules.edit.currentCell.row === this) { + this.table.modules.edit.cancelEdit(); + } + } + + if (this.table.modExists("frozenRows")) { + this.table.modules.frozenRows.detachRow(this); + } +}; + +Row.prototype.deleteCells = function () { + var cellCount = this.cells.length; + + for (var i = 0; i < cellCount; i++) { + this.cells[0].delete(); + } +}; + +Row.prototype.wipe = function () { + this.detatchModules(); + this.deleteCells(); + + while (this.element.firstChild) { + this.element.removeChild(this.element.firstChild); + }this.element = false; + this.modules = {}; + + if (this.element.parentNode) { + this.element.parentNode.removeChild(this.element); + } +}; + +Row.prototype.getGroup = function () { + return this.modules.group || false; +}; + +//////////////// Object Generation ///////////////// +Row.prototype.getComponent = function () { + if (!this.component) { + this.component = new RowComponent(this); + } + + return this.component; +}; + +//public row object +var CellComponent = function CellComponent(cell) { + this._cell = cell; +}; + +CellComponent.prototype.getValue = function () { + return this._cell.getValue(); +}; + +CellComponent.prototype.getOldValue = function () { + return this._cell.getOldValue(); +}; + +CellComponent.prototype.getInitialValue = function () { + return this._cell.initialValue; +}; + +CellComponent.prototype.getElement = function () { + return this._cell.getElement(); +}; + +CellComponent.prototype.getRow = function () { + return this._cell.row.getComponent(); +}; + +CellComponent.prototype.getData = function () { + return this._cell.row.getData(); +}; + +CellComponent.prototype.getField = function () { + return this._cell.column.getField(); +}; + +CellComponent.prototype.getColumn = function () { + return this._cell.column.getComponent(); +}; + +CellComponent.prototype.setValue = function (value, mutate) { + if (typeof mutate == "undefined") { + mutate = true; + } + + this._cell.setValue(value, mutate); +}; + +CellComponent.prototype.restoreOldValue = function () { + this._cell.setValueActual(this._cell.getOldValue()); +}; + +CellComponent.prototype.restoreInitialValue = function () { + this._cell.setValueActual(this._cell.initialValue); +}; + +CellComponent.prototype.edit = function (force) { + return this._cell.edit(force); +}; + +CellComponent.prototype.cancelEdit = function () { + this._cell.cancelEdit(); +}; + +CellComponent.prototype.isEdited = function () { + return !!this._cell.modules.edit && this._cell.modules.edit.edited; +}; + +CellComponent.prototype.clearEdited = function () { + if (self.table.modExists("edit", true)) { + this._cell.table.modules.edit.clearEdited(this._cell); + } +}; + +CellComponent.prototype.isValid = function () { + return this._cell.modules.validate ? !this._cell.modules.validate.invalid : true; +}; + +CellComponent.prototype.validate = function () { + return this._cell.validate(); +}; + +CellComponent.prototype.clearValidation = function () { + if (this._cell.table.modExists("validate", true)) { + this._cell.table.modules.validate.clearValidation(this._cell); + } +}; + +CellComponent.prototype.nav = function () { + return this._cell.nav(); +}; + +CellComponent.prototype.checkHeight = function () { + this._cell.checkHeight(); +}; + +CellComponent.prototype.getTable = function () { + return this._cell.table; +}; + +CellComponent.prototype._getSelf = function () { + return this._cell; +}; + +var Cell = function Cell(column, row) { + + this.table = column.table; + this.column = column; + this.row = row; + this.element = null; + this.value = null; + this.initialValue; + this.oldValue = null; + this.modules = {}; + + this.height = null; + this.width = null; + this.minWidth = null; + + this.component = null; + + this.loaded = false; //track if the cell has been added to the DOM yet + + this.build(); +}; + +//////////////// Setup Functions ///////////////// + +//generate element +Cell.prototype.build = function () { + this.generateElement(); + + this.setWidth(); + + this._configureCell(); + + this.setValueActual(this.column.getFieldValue(this.row.data)); + + this.initialValue = this.value; +}; + +Cell.prototype.generateElement = function () { + this.element = document.createElement('div'); + this.element.className = "tabulator-cell"; + this.element.setAttribute("role", "gridcell"); + this.element = this.element; +}; + +Cell.prototype._configureCell = function () { + var self = this, + cellEvents = self.column.cellEvents, + element = self.element, + field = this.column.getField(), + vertAligns = { + top: "flex-start", + bottom: "flex-end", + middle: "center" + }, + hozAligns = { + left: "flex-start", + right: "flex-end", + center: "center" + }; + + //set text alignment + element.style.textAlign = self.column.hozAlign; + + if (self.column.vertAlign) { + element.style.display = "inline-flex"; + + element.style.alignItems = vertAligns[self.column.vertAlign] || ""; + + if (self.column.hozAlign) { + element.style.justifyContent = hozAligns[self.column.hozAlign] || ""; + } + } + + if (field) { + element.setAttribute("tabulator-field", field); + } + + //add class to cell if needed + if (self.column.definition.cssClass) { + var classNames = self.column.definition.cssClass.split(" "); + classNames.forEach(function (className) { + element.classList.add(className); + }); + } + + //update tooltip on mouse enter + if (this.table.options.tooltipGenerationMode === "hover") { + element.addEventListener("mouseenter", function (e) { + self._generateTooltip(); + }); + } + + self._bindClickEvents(cellEvents); + + self._bindTouchEvents(cellEvents); + + self._bindMouseEvents(cellEvents); + + if (self.column.modules.edit) { + self.table.modules.edit.bindEditor(self); + } + + if (self.column.definition.rowHandle && self.table.options.movableRows !== false && self.table.modExists("moveRow")) { + self.table.modules.moveRow.initializeCell(self); + } + + //hide cell if not visible + if (!self.column.visible) { + self.hide(); + } +}; + +Cell.prototype._bindClickEvents = function (cellEvents) { + var self = this, + element = self.element; + + //set event bindings + if (cellEvents.cellClick || self.table.options.cellClick) { + element.addEventListener("click", function (e) { + var component = self.getComponent(); + + if (cellEvents.cellClick) { + cellEvents.cellClick.call(self.table, e, component); + } + + if (self.table.options.cellClick) { + self.table.options.cellClick.call(self.table, e, component); + } + }); + } + + if (cellEvents.cellDblClick || this.table.options.cellDblClick) { + element.addEventListener("dblclick", function (e) { + var component = self.getComponent(); + + if (cellEvents.cellDblClick) { + cellEvents.cellDblClick.call(self.table, e, component); + } + + if (self.table.options.cellDblClick) { + self.table.options.cellDblClick.call(self.table, e, component); + } + }); + } else { + element.addEventListener("dblclick", function (e) { + + if (self.table.modExists("edit")) { + if (self.table.modules.edit.currentCell === self) { + return; //prevent instant selection of editor content + } + } + + e.preventDefault(); + + try { + if (document.selection) { + // IE + var range = document.body.createTextRange(); + range.moveToElementText(self.element); + range.select(); + } else if (window.getSelection) { + var range = document.createRange(); + range.selectNode(self.element); + window.getSelection().removeAllRanges(); + window.getSelection().addRange(range); + } + } catch (e) {} + }); + } + + if (cellEvents.cellContext || this.table.options.cellContext) { + element.addEventListener("contextmenu", function (e) { + var component = self.getComponent(); + + if (cellEvents.cellContext) { + cellEvents.cellContext.call(self.table, e, component); + } + + if (self.table.options.cellContext) { + self.table.options.cellContext.call(self.table, e, component); + } + }); + } +}; + +Cell.prototype._bindMouseEvents = function (cellEvents) { + var self = this, + element = self.element; + + if (cellEvents.cellMouseEnter || self.table.options.cellMouseEnter) { + element.addEventListener("mouseenter", function (e) { + var component = self.getComponent(); + + if (cellEvents.cellMouseEnter) { + cellEvents.cellMouseEnter.call(self.table, e, component); + } + + if (self.table.options.cellMouseEnter) { + self.table.options.cellMouseEnter.call(self.table, e, component); + } + }); + } + + if (cellEvents.cellMouseLeave || self.table.options.cellMouseLeave) { + element.addEventListener("mouseleave", function (e) { + var component = self.getComponent(); + + if (cellEvents.cellMouseLeave) { + cellEvents.cellMouseLeave.call(self.table, e, component); + } + + if (self.table.options.cellMouseLeave) { + self.table.options.cellMouseLeave.call(self.table, e, component); + } + }); + } + + if (cellEvents.cellMouseOver || self.table.options.cellMouseOver) { + element.addEventListener("mouseover", function (e) { + var component = self.getComponent(); + + if (cellEvents.cellMouseOver) { + cellEvents.cellMouseOver.call(self.table, e, component); + } + + if (self.table.options.cellMouseOver) { + self.table.options.cellMouseOver.call(self.table, e, component); + } + }); + } + + if (cellEvents.cellMouseOut || self.table.options.cellMouseOut) { + element.addEventListener("mouseout", function (e) { + var component = self.getComponent(); + + if (cellEvents.cellMouseOut) { + cellEvents.cellMouseOut.call(self.table, e, component); + } + + if (self.table.options.cellMouseOut) { + self.table.options.cellMouseOut.call(self.table, e, component); + } + }); + } + + if (cellEvents.cellMouseMove || self.table.options.cellMouseMove) { + element.addEventListener("mousemove", function (e) { + var component = self.getComponent(); + + if (cellEvents.cellMouseMove) { + cellEvents.cellMouseMove.call(self.table, e, component); + } + + if (self.table.options.cellMouseMove) { + self.table.options.cellMouseMove.call(self.table, e, component); + } + }); + } +}; + +Cell.prototype._bindTouchEvents = function (cellEvents) { + var self = this, + element = self.element, + dblTap, + tapHold, + tap; + + if (cellEvents.cellTap || this.table.options.cellTap) { + tap = false; + + element.addEventListener("touchstart", function (e) { + tap = true; + }, { passive: true }); + + element.addEventListener("touchend", function (e) { + if (tap) { + var component = self.getComponent(); + + if (cellEvents.cellTap) { + cellEvents.cellTap.call(self.table, e, component); + } + + if (self.table.options.cellTap) { + self.table.options.cellTap.call(self.table, e, component); + } + } + + tap = false; + }); + } + + if (cellEvents.cellDblTap || this.table.options.cellDblTap) { + dblTap = null; + + element.addEventListener("touchend", function (e) { + + if (dblTap) { + clearTimeout(dblTap); + dblTap = null; + + var component = self.getComponent(); + + if (cellEvents.cellDblTap) { + cellEvents.cellDblTap.call(self.table, e, component); + } + + if (self.table.options.cellDblTap) { + self.table.options.cellDblTap.call(self.table, e, component); + } + } else { + + dblTap = setTimeout(function () { + clearTimeout(dblTap); + dblTap = null; + }, 300); + } + }); + } + + if (cellEvents.cellTapHold || this.table.options.cellTapHold) { + tapHold = null; + + element.addEventListener("touchstart", function (e) { + clearTimeout(tapHold); + + tapHold = setTimeout(function () { + clearTimeout(tapHold); + tapHold = null; + tap = false; + var component = self.getComponent(); + + if (cellEvents.cellTapHold) { + cellEvents.cellTapHold.call(self.table, e, component); + } + + if (self.table.options.cellTapHold) { + self.table.options.cellTapHold.call(self.table, e, component); + } + }, 1000); + }, { passive: true }); + + element.addEventListener("touchend", function (e) { + clearTimeout(tapHold); + tapHold = null; + }); + } +}; + +//generate cell contents +Cell.prototype._generateContents = function () { + var val; + + if (this.table.modExists("format")) { + val = this.table.modules.format.formatValue(this); + } else { + val = this.element.innerHTML = this.value; + } + + switch (typeof val === 'undefined' ? 'undefined' : _typeof(val)) { + case "object": + if (val instanceof Node) { + + //clear previous cell contents + while (this.element.firstChild) { + this.element.removeChild(this.element.firstChild); + }this.element.appendChild(val); + } else { + this.element.innerHTML = ""; + + if (val != null) { + console.warn("Format Error - Formatter has returned a type of object, the only valid formatter object return is an instance of Node, the formatter returned:", val); + } + } + break; + case "undefined": + case "null": + this.element.innerHTML = ""; + break; + default: + this.element.innerHTML = val; + } +}; + +Cell.prototype.cellRendered = function () { + if (this.table.modExists("format") && this.table.modules.format.cellRendered) { + this.table.modules.format.cellRendered(this); + } +}; + +//generate tooltip text +Cell.prototype._generateTooltip = function () { + var tooltip = this.column.tooltip; + + if (tooltip) { + if (tooltip === true) { + tooltip = this.value; + } else if (typeof tooltip == "function") { + tooltip = tooltip(this.getComponent()); + + if (tooltip === false) { + tooltip = ""; + } + } + + if (typeof tooltip === "undefined") { + tooltip = ""; + } + + this.element.setAttribute("title", tooltip); + } else { + this.element.setAttribute("title", ""); + } +}; + +//////////////////// Getters //////////////////// +Cell.prototype.getElement = function () { + if (!this.loaded) { + this.loaded = true; + this.layoutElement(); + } + + return this.element; +}; + +Cell.prototype.getValue = function () { + return this.value; +}; + +Cell.prototype.getOldValue = function () { + return this.oldValue; +}; + +//////////////////// Actions //////////////////// + +Cell.prototype.setValue = function (value, mutate) { + + var changed = this.setValueProcessData(value, mutate), + component; + + if (changed) { + if (this.table.options.history && this.table.modExists("history")) { + this.table.modules.history.action("cellEdit", this, { oldValue: this.oldValue, newValue: this.value }); + } + + component = this.getComponent(); + + if (this.column.cellEvents.cellEdited) { + this.column.cellEvents.cellEdited.call(this.table, component); + } + + if (this.table.options.groupUpdateOnCellEdit && this.table.options.groupBy && this.table.modExists("groupRows")) { + this.table.modules.groupRows.reassignRowToGroup(this.row); + } + + this.cellRendered(); + + this.table.options.cellEdited.call(this.table, component); + + if (this.table.options.dataChanged) { + this.table.options.dataChanged.call(this.table, this.table.rowManager.getData()); + } + } +}; + +Cell.prototype.setValueProcessData = function (value, mutate) { + var changed = false; + + if (this.value != value) { + + changed = true; + + if (mutate) { + if (this.column.modules.mutate) { + value = this.table.modules.mutator.transformCell(this, value); + } + } + } + + this.setValueActual(value); + + if (changed && this.table.modExists("columnCalcs")) { + if (this.column.definition.topCalc || this.column.definition.bottomCalc) { + if (this.table.options.groupBy && this.table.modExists("groupRows")) { + + if (this.table.options.columnCalcs == "table" || this.table.options.columnCalcs == "both") { + this.table.modules.columnCalcs.recalc(this.table.rowManager.activeRows); + } + + if (this.table.options.columnCalcs != "table") { + this.table.modules.columnCalcs.recalcRowGroup(this.row); + } + } else { + this.table.modules.columnCalcs.recalc(this.table.rowManager.activeRows); + } + } + } + + return changed; +}; + +Cell.prototype.setValueActual = function (value) { + this.oldValue = this.value; + + this.value = value; + + if (this.table.options.reactiveData && this.table.modExists("reactiveData")) { + this.table.modules.reactiveData.block(); + } + + this.column.setFieldValue(this.row.data, value); + + if (this.table.options.reactiveData && this.table.modExists("reactiveData")) { + this.table.modules.reactiveData.unblock(); + } + + if (this.loaded) { + this.layoutElement(); + } +}; + +Cell.prototype.layoutElement = function () { + this._generateContents(); + this._generateTooltip(); + + //set resizable handles + if (this.table.options.resizableColumns && this.table.modExists("resizeColumns") && this.row.type === "row") { + this.table.modules.resizeColumns.initializeColumn("cell", this.column, this.element); + } + + if ((this.column.definition.contextMenu || this.column.definition.clickMenu) && this.table.modExists("menu")) { + this.table.modules.menu.initializeCell(this); + } + + //handle frozen cells + if (this.table.modExists("frozenColumns")) { + this.table.modules.frozenColumns.layoutElement(this.element, this.column); + } +}; + +Cell.prototype.setWidth = function () { + this.width = this.column.width; + this.element.style.width = this.column.widthStyled; +}; + +Cell.prototype.clearWidth = function () { + this.width = ""; + this.element.style.width = ""; +}; + +Cell.prototype.getWidth = function () { + return this.width || this.element.offsetWidth; +}; + +Cell.prototype.setMinWidth = function () { + this.minWidth = this.column.minWidth; + this.element.style.minWidth = this.column.minWidthStyled; +}; + +Cell.prototype.checkHeight = function () { + // var height = this.element.css("height"); + this.row.reinitializeHeight(); +}; + +Cell.prototype.clearHeight = function () { + this.element.style.height = ""; + this.height = null; +}; + +Cell.prototype.setHeight = function () { + this.height = this.row.height; + this.element.style.height = this.row.heightStyled; +}; + +Cell.prototype.getHeight = function () { + return this.height || this.element.offsetHeight; +}; + +Cell.prototype.show = function () { + this.element.style.display = this.column.vertAlign ? "inline-flex" : ""; +}; + +Cell.prototype.hide = function () { + this.element.style.display = "none"; +}; + +Cell.prototype.edit = function (force) { + if (this.table.modExists("edit", true)) { + return this.table.modules.edit.editCell(this, force); + } +}; + +Cell.prototype.cancelEdit = function () { + if (this.table.modExists("edit", true)) { + var editing = this.table.modules.edit.getCurrentCell(); + + if (editing && editing._getSelf() === this) { + this.table.modules.edit.cancelEdit(); + } else { + console.warn("Cancel Editor Error - This cell is not currently being edited "); + } + } +}; + +Cell.prototype.validate = function () { + if (this.column.modules.validate && this.table.modExists("validate", true)) { + var valid = this.table.modules.validate.validate(this.column.modules.validate, this, this.getValue()); + + return valid === true; + } else { + return true; + } +}; + +Cell.prototype.delete = function () { + if (!this.table.rowManager.redrawBlock && this.element.parentNode) { + this.element.parentNode.removeChild(this.element); + } + + if (this.modules.validate && this.modules.validate.invalid) { + this.table.modules.validate.clearValidation(this); + } + + if (this.modules.edit && this.modules.edit.edited) { + this.table.modules.edit.clearEdited(this); + } + + if (this.table.options.history) { + this.table.modules.history.clearComponentHistory(this); + } + + this.element = false; + this.column.deleteCell(this); + this.row.deleteCell(this); + this.calcs = {}; +}; + +//////////////// Navigation ///////////////// + +Cell.prototype.nav = function () { + + var self = this, + nextCell = false, + index = this.row.getCellIndex(this); + + return { + next: function next() { + var nextCell = this.right(), + nextRow; + + if (!nextCell) { + nextRow = self.table.rowManager.nextDisplayRow(self.row, true); + + if (nextRow) { + nextCell = nextRow.findNextEditableCell(-1); + + if (nextCell) { + nextCell.edit(); + return true; + } + } + } else { + return true; + } + + return false; + }, + prev: function prev() { + var nextCell = this.left(), + prevRow; + + if (!nextCell) { + prevRow = self.table.rowManager.prevDisplayRow(self.row, true); + + if (prevRow) { + nextCell = prevRow.findPrevEditableCell(prevRow.cells.length); + + if (nextCell) { + nextCell.edit(); + return true; + } + } + } else { + return true; + } + + return false; + }, + left: function left() { + + nextCell = self.row.findPrevEditableCell(index); + + if (nextCell) { + nextCell.edit(); + return true; + } else { + return false; + } + }, + right: function right() { + nextCell = self.row.findNextEditableCell(index); + + if (nextCell) { + nextCell.edit(); + return true; + } else { + return false; + } + }, + up: function up() { + var nextRow = self.table.rowManager.prevDisplayRow(self.row, true); + + if (nextRow) { + nextRow.cells[index].edit(); + } + }, + down: function down() { + var nextRow = self.table.rowManager.nextDisplayRow(self.row, true); + + if (nextRow) { + nextRow.cells[index].edit(); + } + } + + }; +}; + +Cell.prototype.getIndex = function () { + this.row.getCellIndex(this); +}; + +//////////////// Object Generation ///////////////// +Cell.prototype.getComponent = function () { + + if (!this.component) { + this.component = new CellComponent(this); + } + + return this.component; +}; +var FooterManager = function FooterManager(table) { + this.table = table; + this.active = false; + this.element = this.createElement(); //containing element + this.external = false; + this.links = []; + + this._initialize(); +}; + +FooterManager.prototype.createElement = function () { + var el = document.createElement("div"); + + el.classList.add("tabulator-footer"); + + return el; +}; + +FooterManager.prototype._initialize = function (element) { + if (this.table.options.footerElement) { + + switch (_typeof(this.table.options.footerElement)) { + case "string": + + if (this.table.options.footerElement[0] === "<") { + this.element.innerHTML = this.table.options.footerElement; + } else { + this.external = true; + this.element = document.querySelector(this.table.options.footerElement); + } + break; + default: + this.element = this.table.options.footerElement; + break; + } + } +}; + +FooterManager.prototype.getElement = function () { + return this.element; +}; + +FooterManager.prototype.append = function (element, parent) { + this.activate(parent); + + this.element.appendChild(element); + this.table.rowManager.adjustTableSize(); +}; + +FooterManager.prototype.prepend = function (element, parent) { + this.activate(parent); + + this.element.insertBefore(element, this.element.firstChild); + this.table.rowManager.adjustTableSize(); +}; + +FooterManager.prototype.remove = function (element) { + element.parentNode.removeChild(element); + this.deactivate(); +}; + +FooterManager.prototype.deactivate = function (force) { + if (!this.element.firstChild || force) { + if (!this.external) { + this.element.parentNode.removeChild(this.element); + } + this.active = false; + } + + // this.table.rowManager.adjustTableSize(); +}; + +FooterManager.prototype.activate = function (parent) { + if (!this.active) { + this.active = true; + if (!this.external) { + this.table.element.appendChild(this.getElement()); + this.table.element.style.display = ''; + } + } + + if (parent) { + this.links.push(parent); + } +}; + +FooterManager.prototype.redraw = function () { + this.links.forEach(function (link) { + link.footerRedraw(); + }); +}; + +var Tabulator = function Tabulator(element, options) { + + this.options = {}; + + this.columnManager = null; // hold Column Manager + this.rowManager = null; //hold Row Manager + this.footerManager = null; //holder Footer Manager + this.vdomHoz = null; //holder horizontal virtual dom + + + this.browser = ""; //hold current browser type + this.browserSlow = false; //handle reduced functionality for slower browsers + this.browserMobile = false; //check if running on moble, prevent resize cancelling edit on keyboard appearence + this.rtl = false; //check if the table is in RTL mode + + this.modules = {}; //hold all modules bound to this table + + if (this.initializeElement(element)) { + this.initializeOptions(options || {}); + this._create(); + } + + Tabulator.prototype.comms.register(this); //register table for inderdevice communication +}; + +//default setup options +Tabulator.prototype.defaultOptions = { + + height: false, //height of tabulator + minHeight: false, //minimum height of tabulator + maxHeight: false, //maximum height of tabulator + + layout: "fitData", ///layout type "fitColumns" | "fitData" + layoutColumnsOnNewData: false, //update column widths on setData + + columnMinWidth: 40, //minimum global width for a column + columnHeaderVertAlign: "top", //vertical alignment of column headers + columnVertAlign: false, // DEPRECATED - Left to allow warning + + resizableColumns: true, //resizable columns + resizableRows: false, //resizable rows + autoResize: true, //auto resize table + + columns: [], //store for colum header info + + cellHozAlign: "", //horizontal align columns + cellVertAlign: "", //vertical align columns + headerHozAlign: "", //horizontal header alignment + + + data: [], //default starting data + + autoColumns: false, //build columns from data row structure + autoColumnsDefinitions: false, + + reactiveData: false, //enable data reactivity + + nestedFieldSeparator: ".", //seperatpr for nested data + + tooltips: false, //Tool tip value + tooltipsHeader: false, //Tool tip for headers + tooltipGenerationMode: "load", //when to generate tooltips + + initialSort: false, //initial sorting criteria + initialFilter: false, //initial filtering criteria + initialHeaderFilter: false, //initial header filtering criteria + + columnHeaderSortMulti: true, //multiple or single column sorting + + sortOrderReverse: false, //reverse internal sort ordering + + headerSort: true, //set default global header sort + headerSortTristate: false, //set default tristate header sorting + headerSortElement: "
", //header sort element + + footerElement: false, //hold footer element + + index: "id", //filed for row index + + textDirection: "auto", + + keybindings: [], //array for keybindings + + tabEndNewRow: false, //create new row when tab to end of table + + invalidOptionWarnings: true, //allow toggling of invalid option warnings + + clipboard: false, //enable clipboard + clipboardCopyStyled: true, //formatted table data + clipboardCopyConfig: false, //clipboard config + clipboardCopyFormatter: false, //DEPRICATED - REMOVE in 5.0 + clipboardCopyRowRange: "active", //restrict clipboard to visible rows only + clipboardPasteParser: "table", //convert pasted clipboard data to rows + clipboardPasteAction: "insert", //how to insert pasted data into the table + + clipboardCopied: function clipboardCopied() {}, //data has been copied to the clipboard + clipboardPasted: function clipboardPasted() {}, //data has been pasted into the table + clipboardPasteError: function clipboardPasteError() {}, //data has not successfully been pasted into the table + + downloadDataFormatter: false, //function to manipulate table data before it is downloaded + downloadReady: function downloadReady(data, blob) { + return blob; + }, //function to manipulate download data + downloadComplete: false, //function to manipulate download data + downloadConfig: {}, //download config + downloadRowRange: "active", //restrict download to active rows only + + dataTree: false, //enable data tree + dataTreeFilter: true, //filter child rows + dataTreeSort: true, //sort child rows + dataTreeElementColumn: false, + dataTreeBranchElement: true, //show data tree branch element + dataTreeChildIndent: 9, //data tree child indent in px + dataTreeChildField: "_children", //data tre column field to look for child rows + dataTreeCollapseElement: false, //data tree row collapse element + dataTreeExpandElement: false, //data tree row expand element + dataTreeStartExpanded: false, + dataTreeRowExpanded: function dataTreeRowExpanded() {}, //row has been expanded + dataTreeRowCollapsed: function dataTreeRowCollapsed() {}, //row has been collapsed + dataTreeChildColumnCalcs: false, //include visible data tree rows in column calculations + dataTreeSelectPropagate: false, //seleccting a parent row selects its children + + printAsHtml: false, //enable print as html + printFormatter: false, //printing page formatter + printHeader: false, //page header contents + printFooter: false, //page footer contents + printCopyStyle: true, //DEPRICATED - REMOVE in 5.0 + printStyled: true, //enable print as html styling + printVisibleRows: true, //DEPRICATED - REMOVE in 5.0 + printRowRange: "visible", //restrict print to visible rows only + printConfig: {}, //print config options + + addRowPos: "bottom", //position to insert blank rows, top|bottom + + selectable: "highlight", //highlight rows on hover + selectableRangeMode: "drag", //highlight rows on hover + selectableRollingSelection: true, //roll selection once maximum number of selectable rows is reached + selectablePersistence: true, // maintain selection when table view is updated + selectableCheck: function selectableCheck(data, row) { + return true; + }, //check wheather row is selectable + + headerFilterLiveFilterDelay: 300, //delay before updating column after user types in header filter + headerFilterPlaceholder: false, //placeholder text to display in header filters + + headerVisible: true, //hide header + + history: false, //enable edit history + + locale: false, //current system language + langs: {}, + + virtualDom: true, //enable DOM virtualization + virtualDomBuffer: 0, // set virtual DOM buffer size + virtualDomHoz: false, //enable horizontal DOM virtualization + + persistentLayout: false, //DEPRICATED - REMOVE in 5.0 + persistentSort: false, //DEPRICATED - REMOVE in 5.0 + persistentFilter: false, //DEPRICATED - REMOVE in 5.0 + persistenceID: "", //key for persistent storage + persistenceMode: true, //mode for storing persistence information + persistenceReaderFunc: false, //function for handling persistence data reading + persistenceWriterFunc: false, //function for handling persistence data writing + + persistence: false, + + responsiveLayout: false, //responsive layout flags + responsiveLayoutCollapseStartOpen: true, //start showing collapsed data + responsiveLayoutCollapseUseFormatters: true, //responsive layout collapse formatter + responsiveLayoutCollapseFormatter: false, //responsive layout collapse formatter + + pagination: false, //set pagination type + paginationSize: false, //set number of rows to a page + paginationInitialPage: 1, //initail page to show on load + paginationButtonCount: 5, // set count of page button + paginationSizeSelector: false, //add pagination size selector element + paginationElement: false, //element to hold pagination numbers + paginationDataSent: {}, //pagination data sent to the server + paginationDataReceived: {}, //pagination data received from the server + paginationAddRow: "page", //add rows on table or page + + ajaxURL: false, //url for ajax loading + ajaxURLGenerator: false, + ajaxParams: {}, //params for ajax loading + ajaxConfig: "get", //ajax request type + ajaxContentType: "form", //ajax request type + ajaxRequestFunc: false, //promise function + ajaxLoader: true, //show loader + ajaxLoaderLoading: false, //loader element + ajaxLoaderError: false, //loader element + ajaxFiltering: false, + ajaxSorting: false, + ajaxProgressiveLoad: false, //progressive loading + ajaxProgressiveLoadDelay: 0, //delay between requests + ajaxProgressiveLoadScrollMargin: 0, //margin before scroll begins + + groupBy: false, //enable table grouping and set field to group by + groupStartOpen: true, //starting state of group + groupValues: false, + groupUpdateOnCellEdit: false, + + groupHeader: false, //header generation function + groupHeaderPrint: null, + groupHeaderClipboard: null, + groupHeaderHtmlOutput: null, + groupHeaderDownload: null, + + htmlOutputConfig: false, //html outypu config + + movableColumns: false, //enable movable columns + + movableRows: false, //enable movable rows + movableRowsConnectedTables: false, //tables for movable rows to be connected to + movableRowsConnectedElements: false, //other elements for movable rows to be connected to + movableRowsSender: false, + movableRowsReceiver: "insert", + movableRowsSendingStart: function movableRowsSendingStart() {}, + movableRowsSent: function movableRowsSent() {}, + movableRowsSentFailed: function movableRowsSentFailed() {}, + movableRowsSendingStop: function movableRowsSendingStop() {}, + movableRowsReceivingStart: function movableRowsReceivingStart() {}, + movableRowsReceived: function movableRowsReceived() {}, + movableRowsReceivedFailed: function movableRowsReceivedFailed() {}, + movableRowsReceivingStop: function movableRowsReceivingStop() {}, + movableRowsElementDrop: function movableRowsElementDrop() {}, + + scrollToRowPosition: "top", + scrollToRowIfVisible: true, + + scrollToColumnPosition: "left", + scrollToColumnIfVisible: true, + + rowFormatter: false, + rowFormatterPrint: null, + rowFormatterClipboard: null, + rowFormatterHtmlOutput: null, + + placeholder: false, + + //table building callbacks + tableBuilding: function tableBuilding() {}, + tableBuilt: function tableBuilt() {}, + + //render callbacks + renderStarted: function renderStarted() {}, + renderComplete: function renderComplete() {}, + + //row callbacks + rowClick: false, + rowDblClick: false, + rowContext: false, + rowTap: false, + rowDblTap: false, + rowTapHold: false, + rowMouseEnter: false, + rowMouseLeave: false, + rowMouseOver: false, + rowMouseOut: false, + rowMouseMove: false, + rowContextMenu: false, + rowClickMenu: false, + rowAdded: function rowAdded() {}, + rowDeleted: function rowDeleted() {}, + rowMoved: function rowMoved() {}, + rowUpdated: function rowUpdated() {}, + rowSelectionChanged: function rowSelectionChanged() {}, + rowSelected: function rowSelected() {}, + rowDeselected: function rowDeselected() {}, + rowResized: function rowResized() {}, + + //cell callbacks + //row callbacks + cellClick: false, + cellDblClick: false, + cellContext: false, + cellTap: false, + cellDblTap: false, + cellTapHold: false, + cellMouseEnter: false, + cellMouseLeave: false, + cellMouseOver: false, + cellMouseOut: false, + cellMouseMove: false, + cellEditing: function cellEditing() {}, + cellEdited: function cellEdited() {}, + cellEditCancelled: function cellEditCancelled() {}, + + //column callbacks + columnMoved: false, + columnResized: function columnResized() {}, + columnTitleChanged: function columnTitleChanged() {}, + columnVisibilityChanged: function columnVisibilityChanged() {}, + + //HTML iport callbacks + htmlImporting: function htmlImporting() {}, + htmlImported: function htmlImported() {}, + + //data callbacks + dataLoading: function dataLoading() {}, + dataLoaded: function dataLoaded() {}, + dataEdited: false, //DEPRECATED + dataChanged: false, + + //ajax callbacks + ajaxRequesting: function ajaxRequesting() {}, + ajaxResponse: false, + ajaxError: function ajaxError() {}, + + //filtering callbacks + dataFiltering: false, + dataFiltered: false, + + //sorting callbacks + dataSorting: function dataSorting() {}, + dataSorted: function dataSorted() {}, + + //grouping callbacks + groupToggleElement: "arrow", + groupClosedShowCalcs: false, + dataGrouping: function dataGrouping() {}, + dataGrouped: false, + groupVisibilityChanged: function groupVisibilityChanged() {}, + groupClick: false, + groupDblClick: false, + groupContext: false, + groupContextMenu: false, + groupClickMenu: false, + groupTap: false, + groupDblTap: false, + groupTapHold: false, + + columnCalcs: true, + + //pagination callbacks + pageLoaded: function pageLoaded() {}, + + //localization callbacks + localized: function localized() {}, + + //validation callbacks + validationMode: "blocking", + validationFailed: function validationFailed() {}, + + //history callbacks + historyUndo: function historyUndo() {}, + historyRedo: function historyRedo() {}, + + //scroll callbacks + scrollHorizontal: function scrollHorizontal() {}, + scrollVertical: function scrollVertical() {} +}; + +Tabulator.prototype.initializeOptions = function (options) { + + //warn user if option is not available + if (options.invalidOptionWarnings !== false) { + for (var key in options) { + if (typeof this.defaultOptions[key] === "undefined") { + console.warn("Invalid table constructor option:", key); + } + } + } + + //assign options to table + for (var key in this.defaultOptions) { + if (key in options) { + this.options[key] = options[key]; + } else { + if (Array.isArray(this.defaultOptions[key])) { + this.options[key] = Object.assign([], this.defaultOptions[key]); + } else if (_typeof(this.defaultOptions[key]) === "object" && this.defaultOptions[key] !== null) { + this.options[key] = Object.assign({}, this.defaultOptions[key]); + } else { + this.options[key] = this.defaultOptions[key]; + } + } + } +}; + +Tabulator.prototype.initializeElement = function (element) { + + if (typeof HTMLElement !== "undefined" && element instanceof HTMLElement) { + this.element = element; + return true; + } else if (typeof element === "string") { + this.element = document.querySelector(element); + + if (this.element) { + return true; + } else { + console.error("Tabulator Creation Error - no element found matching selector: ", element); + return false; + } + } else { + console.error("Tabulator Creation Error - Invalid element provided:", element); + return false; + } +}; + +Tabulator.prototype.rtlCheck = function () { + var style = window.getComputedStyle(this.element); + + switch (this.options.textDirection) { + case "auto": + if (style.direction !== "rtl") { + break; + }; + + case "rtl": + this.element.classList.add("tabulator-rtl"); + this.rtl = true; + break; + + case "ltr": + this.element.classList.add("tabulator-ltr"); + + default: + this.rtl = false; + } +}; + +//convert depricated functionality to new functions +Tabulator.prototype._mapDepricatedFunctionality = function () { + + //map depricated persistance setup options + if (this.options.persistentLayout || this.options.persistentSort || this.options.persistentFilter) { + if (!this.options.persistence) { + this.options.persistence = {}; + } + } + + if (this.options.dataEdited) { + console.warn("DEPRECATION WARNING - dataEdited option has been deprecated, please use the dataChanged option instead"); + this.options.dataChanged = this.options.dataEdited; + } + + if (this.options.downloadDataFormatter) { + console.warn("DEPRECATION WARNING - downloadDataFormatter option has been deprecated"); + } + + if (typeof this.options.clipboardCopyHeader !== "undefined") { + this.options.columnHeaders = this.options.clipboardCopyHeader; + console.warn("DEPRECATION WARNING - clipboardCopyHeader option has been deprecated, please use the columnHeaders property on the clipboardCopyConfig option"); + } + + if (this.options.printVisibleRows !== true) { + console.warn("printVisibleRows option is deprecated, you should now use the printRowRange option"); + + this.options.persistence.printRowRange = "active"; + } + + if (this.options.printCopyStyle !== true) { + console.warn("printCopyStyle option is deprecated, you should now use the printStyled option"); + + this.options.persistence.printStyled = this.options.printCopyStyle; + } + + if (this.options.persistentLayout) { + console.warn("persistentLayout option is deprecated, you should now use the persistence option"); + + if (this.options.persistence !== true && typeof this.options.persistence.columns === "undefined") { + this.options.persistence.columns = true; + } + } + + if (this.options.persistentSort) { + console.warn("persistentSort option is deprecated, you should now use the persistence option"); + + if (this.options.persistence !== true && typeof this.options.persistence.sort === "undefined") { + this.options.persistence.sort = true; + } + } + + if (this.options.persistentFilter) { + console.warn("persistentFilter option is deprecated, you should now use the persistence option"); + + if (this.options.persistence !== true && typeof this.options.persistence.filter === "undefined") { + this.options.persistence.filter = true; + } + } + + if (this.options.columnVertAlign) { + console.warn("columnVertAlign option is deprecated, you should now use the columnHeaderVertAlign option"); + + this.options.columnHeaderVertAlign = this.options.columnVertAlign; + } +}; + +Tabulator.prototype._clearSelection = function () { + + this.element.classList.add("tabulator-block-select"); + + if (window.getSelection) { + if (window.getSelection().empty) { + // Chrome + window.getSelection().empty(); + } else if (window.getSelection().removeAllRanges) { + // Firefox + window.getSelection().removeAllRanges(); + } + } else if (document.selection) { + // IE? + document.selection.empty(); + } + + this.element.classList.remove("tabulator-block-select"); +}; + +//concreate table +Tabulator.prototype._create = function () { + this._clearObjectPointers(); + + this._mapDepricatedFunctionality(); + + this.bindModules(); + + this.rtlCheck(); + + if (this.element.tagName === "TABLE") { + if (this.modExists("htmlTableImport", true)) { + this.modules.htmlTableImport.parseTable(); + } + } + + this.columnManager = new ColumnManager(this); + this.rowManager = new RowManager(this); + this.footerManager = new FooterManager(this); + + this.columnManager.setRowManager(this.rowManager); + this.rowManager.setColumnManager(this.columnManager); + + if (this.options.virtualDomHoz) { + this.vdomHoz = new VDomHoz(this); + } + + this._buildElement(); + + this._loadInitialData(); +}; + +//clear pointers to objects in default config object +Tabulator.prototype._clearObjectPointers = function () { + this.options.columns = this.options.columns.slice(0); + + if (!this.options.reactiveData) { + this.options.data = this.options.data.slice(0); + } +}; + +//build tabulator element +Tabulator.prototype._buildElement = function () { + var _this24 = this; + + var element = this.element, + mod = this.modules, + options = this.options; + + options.tableBuilding.call(this); + + element.classList.add("tabulator"); + element.setAttribute("role", "grid"); + + //empty element + while (element.firstChild) { + element.removeChild(element.firstChild); + } //set table height + if (options.height) { + options.height = isNaN(options.height) ? options.height : options.height + "px"; + element.style.height = options.height; + } + + //set table min height + if (options.minHeight !== false) { + options.minHeight = isNaN(options.minHeight) ? options.minHeight : options.minHeight + "px"; + element.style.minHeight = options.minHeight; + } + + //set table maxHeight + if (options.maxHeight !== false) { + options.maxHeight = isNaN(options.maxHeight) ? options.maxHeight : options.maxHeight + "px"; + element.style.maxHeight = options.maxHeight; + } + + this.columnManager.initialize(); + this.rowManager.initialize(); + + this._detectBrowser(); + + if (this.modExists("layout", true)) { + mod.layout.initialize(options.layout); + } + + //set localization + + mod.localize.initialize(); + + if (options.headerFilterPlaceholder !== false) { + mod.localize.setHeaderFilterPlaceholder(options.headerFilterPlaceholder); + } + + for (var locale in options.langs) { + mod.localize.installLang(locale, options.langs[locale]); + } + + mod.localize.setLocale(options.locale); + + //configure placeholder element + if (typeof options.placeholder == "string") { + + var el = document.createElement("div"); + el.classList.add("tabulator-placeholder"); + + var span = document.createElement("span"); + span.innerHTML = options.placeholder; + + el.appendChild(span); + + options.placeholder = el; + } + + //build table elements + element.appendChild(this.columnManager.getElement()); + element.appendChild(this.rowManager.getElement()); + + if (options.footerElement) { + this.footerManager.activate(); + } + + if (options.persistence && this.modExists("persistence", true)) { + mod.persistence.initialize(); + } + + if (options.persistence && this.modExists("persistence", true) && mod.persistence.config.columns) { + options.columns = mod.persistence.load("columns", options.columns); + } + + if (options.movableRows && this.modExists("moveRow")) { + mod.moveRow.initialize(); + } + + if (options.autoColumns && this.options.data) { + this.columnManager.generateColumnsFromRowData(this.options.data); + } + + if (this.modExists("columnCalcs")) { + mod.columnCalcs.initialize(); + } + + this.columnManager.setColumns(options.columns); + + if (options.dataTree && this.modExists("dataTree", true)) { + mod.dataTree.initialize(); + } + + if (this.modExists("frozenRows")) { + this.modules.frozenRows.initialize(); + } + + if ((options.persistence && this.modExists("persistence", true) && mod.persistence.config.sort || options.initialSort) && this.modExists("sort", true)) { + var sorters = []; + + if (options.persistence && this.modExists("persistence", true) && mod.persistence.config.sort) { + sorters = mod.persistence.load("sort"); + + if (sorters === false && options.initialSort) { + sorters = options.initialSort; + } + } else if (options.initialSort) { + sorters = options.initialSort; + } + + mod.sort.setSort(sorters); + } + + if ((options.persistence && this.modExists("persistence", true) && mod.persistence.config.filter || options.initialFilter) && this.modExists("filter", true)) { + var filters = []; + + if (options.persistence && this.modExists("persistence", true) && mod.persistence.config.filter) { + filters = mod.persistence.load("filter"); + + if (filters === false && options.initialFilter) { + filters = options.initialFilter; + } + } else if (options.initialFilter) { + filters = options.initialFilter; + } + + mod.filter.setFilter(filters); + } + + if (options.initialHeaderFilter && this.modExists("filter", true)) { + options.initialHeaderFilter.forEach(function (item) { + + var column = _this24.columnManager.findColumn(item.field); + + if (column) { + mod.filter.setHeaderFilterValue(column, item.value); + } else { + console.warn("Column Filter Error - No matching column found:", item.field); + return false; + } + }); + } + + if (this.modExists("ajax")) { + mod.ajax.initialize(); + } + + if (options.pagination && this.modExists("page", true)) { + mod.page.initialize(); + } + + if (options.groupBy && this.modExists("groupRows", true)) { + mod.groupRows.initialize(); + } + + if (this.modExists("keybindings")) { + mod.keybindings.initialize(); + } + + if (this.modExists("selectRow")) { + mod.selectRow.clearSelectionData(true); + } + + if (options.autoResize && this.modExists("resizeTable")) { + mod.resizeTable.initialize(); + } + + if (this.modExists("clipboard")) { + mod.clipboard.initialize(); + } + + if (options.printAsHtml && this.modExists("print")) { + mod.print.initialize(); + } + + options.tableBuilt.call(this); +}; + +Tabulator.prototype._loadInitialData = function () { + var self = this; + + if (self.options.pagination && self.modExists("page")) { + self.modules.page.reset(true, true); + + if (self.options.pagination == "local") { + if (self.options.data.length) { + self.rowManager.setData(self.options.data, false, true); + } else { + if ((self.options.ajaxURL || self.options.ajaxURLGenerator) && self.modExists("ajax")) { + self.modules.ajax.loadData(false, true).then(function () {}).catch(function () { + if (self.options.paginationInitialPage) { + self.modules.page.setPage(self.options.paginationInitialPage); + } + }); + + return; + } else { + self.rowManager.setData(self.options.data, false, true); + } + } + + if (self.options.paginationInitialPage) { + self.modules.page.setPage(self.options.paginationInitialPage); + } + } else { + if (self.options.ajaxURL) { + self.modules.page.setPage(self.options.paginationInitialPage).then(function () {}).catch(function () {}); + } else { + self.rowManager.setData([], false, true); + } + } + } else { + if (self.options.data.length) { + self.rowManager.setData(self.options.data); + } else { + if ((self.options.ajaxURL || self.options.ajaxURLGenerator) && self.modExists("ajax")) { + self.modules.ajax.loadData(false, true).then(function () {}).catch(function () {}); + } else { + self.rowManager.setData(self.options.data, false, true); + } + } + } +}; + +//deconstructor +Tabulator.prototype.destroy = function () { + var element = this.element; + + Tabulator.prototype.comms.deregister(this); //deregister table from inderdevice communication + + if (this.options.reactiveData && this.modExists("reactiveData", true)) { + this.modules.reactiveData.unwatchData(); + } + + //clear row data + this.rowManager.rows.forEach(function (row) { + row.wipe(); + }); + + this.rowManager.rows = []; + this.rowManager.activeRows = []; + this.rowManager.displayRows = []; + + //clear event bindings + if (this.options.autoResize && this.modExists("resizeTable")) { + this.modules.resizeTable.clearBindings(); + } + + if (this.modExists("keybindings")) { + this.modules.keybindings.clearBindings(); + } + + //clear DOM + while (element.firstChild) { + element.removeChild(element.firstChild); + }element.classList.remove("tabulator"); +}; + +Tabulator.prototype._detectBrowser = function () { + var ua = navigator.userAgent || navigator.vendor || window.opera; + + if (ua.indexOf("Trident") > -1) { + this.browser = "ie"; + this.browserSlow = true; + } else if (ua.indexOf("Edge") > -1) { + this.browser = "edge"; + this.browserSlow = true; + } else if (ua.indexOf("Firefox") > -1) { + this.browser = "firefox"; + this.browserSlow = false; + } else { + this.browser = "other"; + this.browserSlow = false; + } + + this.browserMobile = /(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino|android|ipad|playbook|silk/i.test(ua) || /1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(ua.substr(0, 4)); +}; + +////////////////// Data Handling ////////////////// + +//block table redrawing +Tabulator.prototype.blockRedraw = function () { + return this.rowManager.blockRedraw(); +}; + +//restore table redrawing +Tabulator.prototype.restoreRedraw = function () { + return this.rowManager.restoreRedraw(); +}; + +//local data from local file +Tabulator.prototype.setDataFromLocalFile = function (extensions) { + var _this25 = this; + + return new Promise(function (resolve, reject) { + var input = document.createElement("input"); + input.type = "file"; + input.accept = extensions || ".json,application/json"; + + input.addEventListener("change", function (e) { + var file = input.files[0], + reader = new FileReader(), + data; + + reader.readAsText(file); + + reader.onload = function (e) { + + try { + data = JSON.parse(reader.result); + } catch (e) { + console.warn("File Load Error - File contents is invalid JSON", e); + reject(e); + return; + } + + _this25.setData(data).then(function (data) { + resolve(data); + }).catch(function (err) { + resolve(err); + }); + }; + + reader.onerror = function (e) { + console.warn("File Load Error - Unable to read file"); + reject(); + }; + }); + + input.click(); + }); +}; + +//load data +Tabulator.prototype.setData = function (data, params, config) { + if (this.modExists("ajax")) { + this.modules.ajax.blockActiveRequest(); + } + + return this._setData(data, params, config, false, true); +}; + +Tabulator.prototype._setData = function (data, params, config, inPosition, columnsChanged) { + var self = this; + + if (typeof data === "string") { + if (data.indexOf("{") == 0 || data.indexOf("[") == 0) { + //data is a json encoded string + return self.rowManager.setData(JSON.parse(data), inPosition, columnsChanged); + } else { + + if (self.modExists("ajax", true)) { + if (params) { + self.modules.ajax.setParams(params); + } + + if (config) { + self.modules.ajax.setConfig(config); + } + + self.modules.ajax.setUrl(data); + + if (self.options.pagination == "remote" && self.modExists("page", true)) { + self.modules.page.reset(true, true); + return self.modules.page.setPage(1); + } else { + //assume data is url, make ajax call to url to get data + return self.modules.ajax.loadData(inPosition, columnsChanged); + } + } + } + } else { + if (data) { + //asume data is already an object + return self.rowManager.setData(data, inPosition, columnsChanged); + } else { + + //no data provided, check if ajaxURL is present; + if (self.modExists("ajax") && (self.modules.ajax.getUrl || self.options.ajaxURLGenerator)) { + + if (self.options.pagination == "remote" && self.modExists("page", true)) { + self.modules.page.reset(true, true); + return self.modules.page.setPage(1); + } else { + return self.modules.ajax.loadData(inPosition, columnsChanged); + } + } else { + //empty data + return self.rowManager.setData([], inPosition, columnsChanged); + } + } + } +}; + +//clear data +Tabulator.prototype.clearData = function () { + if (this.modExists("ajax")) { + this.modules.ajax.blockActiveRequest(); + } + + this.rowManager.clearData(); +}; + +//get table data array +Tabulator.prototype.getData = function (active) { + + if (active === true) { + console.warn("passing a boolean to the getData function is deprecated, you should now pass the string 'active'"); + active = "active"; + } + + return this.rowManager.getData(active); +}; + +//get table data array count +Tabulator.prototype.getDataCount = function (active) { + + if (active === true) { + console.warn("passing a boolean to the getDataCount function is deprecated, you should now pass the string 'active'"); + active = "active"; + } + + return this.rowManager.getDataCount(active); +}; + +//search for specific row components +Tabulator.prototype.searchRows = function (field, type, value) { + if (this.modExists("filter", true)) { + return this.modules.filter.search("rows", field, type, value); + } +}; + +//search for specific data +Tabulator.prototype.searchData = function (field, type, value) { + if (this.modExists("filter", true)) { + return this.modules.filter.search("data", field, type, value); + } +}; + +//get table html +Tabulator.prototype.getHtml = function (visible, style, config) { + if (this.modExists("export", true)) { + return this.modules.export.getHtml(visible, style, config); + } +}; + +//get print html +Tabulator.prototype.print = function (visible, style, config) { + if (this.modExists("print", true)) { + return this.modules.print.printFullscreen(visible, style, config); + } +}; + +//retrieve Ajax URL +Tabulator.prototype.getAjaxUrl = function () { + if (this.modExists("ajax", true)) { + return this.modules.ajax.getUrl(); + } +}; + +//replace data, keeping table in position with same sort +Tabulator.prototype.replaceData = function (data, params, config) { + if (this.modExists("ajax")) { + this.modules.ajax.blockActiveRequest(); + } + + return this._setData(data, params, config, true); +}; + +//update table data +Tabulator.prototype.updateData = function (data) { + var _this26 = this; + + var self = this; + var responses = 0; + + return new Promise(function (resolve, reject) { + if (_this26.modExists("ajax")) { + _this26.modules.ajax.blockActiveRequest(); + } + + if (typeof data === "string") { + data = JSON.parse(data); + } + + if (data) { + data.forEach(function (item) { + var row = self.rowManager.findRow(item[self.options.index]); + + if (row) { + responses++; + + row.updateData(item).then(function () { + responses--; + + if (!responses) { + resolve(); + } + }); + } + }); + } else { + console.warn("Update Error - No data provided"); + reject("Update Error - No data provided"); + } + }); +}; + +Tabulator.prototype.addData = function (data, pos, index) { + var _this27 = this; + + return new Promise(function (resolve, reject) { + if (_this27.modExists("ajax")) { + _this27.modules.ajax.blockActiveRequest(); + } + + if (typeof data === "string") { + data = JSON.parse(data); + } + + if (data) { + _this27.rowManager.addRows(data, pos, index).then(function (rows) { + var output = []; + + rows.forEach(function (row) { + output.push(row.getComponent()); + }); + + resolve(output); + }); + } else { + console.warn("Update Error - No data provided"); + reject("Update Error - No data provided"); + } + }); +}; + +//update table data +Tabulator.prototype.updateOrAddData = function (data) { + var _this28 = this; + + var self = this, + rows = [], + responses = 0; + + return new Promise(function (resolve, reject) { + if (_this28.modExists("ajax")) { + _this28.modules.ajax.blockActiveRequest(); + } + + if (typeof data === "string") { + data = JSON.parse(data); + } + + if (data) { + data.forEach(function (item) { + var row = self.rowManager.findRow(item[self.options.index]); + + responses++; + + if (row) { + row.updateData(item).then(function () { + responses--; + rows.push(row.getComponent()); + + if (!responses) { + resolve(rows); + } + }); + } else { + self.rowManager.addRows(item).then(function (newRows) { + responses--; + rows.push(newRows[0].getComponent()); + + if (!responses) { + resolve(rows); + } + }); + } + }); + } else { + console.warn("Update Error - No data provided"); + reject("Update Error - No data provided"); + } + }); +}; + +//get row object +Tabulator.prototype.getRow = function (index) { + var row = this.rowManager.findRow(index); + + if (row) { + return row.getComponent(); + } else { + console.warn("Find Error - No matching row found:", index); + return false; + } +}; + +//get row object +Tabulator.prototype.getRowFromPosition = function (position, active) { + var row = this.rowManager.getRowFromPosition(position, active); + + if (row) { + return row.getComponent(); + } else { + console.warn("Find Error - No matching row found:", position); + return false; + } +}; + +//delete row from table +Tabulator.prototype.deleteRow = function (index) { + var _this29 = this; + + return new Promise(function (resolve, reject) { + var self = _this29, + count = 0, + successCount = 0, + foundRows = []; + + function doneCheck() { + count++; + + if (count == index.length) { + if (successCount) { + self.rowManager.reRenderInPosition(); + resolve(); + } + } + } + + if (!Array.isArray(index)) { + index = [index]; + } + + //find matching rows + index.forEach(function (item) { + var row = _this29.rowManager.findRow(item, true); + + if (row) { + foundRows.push(row); + } else { + console.warn("Delete Error - No matching row found:", item); + reject("Delete Error - No matching row found"); + doneCheck(); + } + }); + + //sort rows into correct order to ensure smooth delete from table + foundRows.sort(function (a, b) { + return _this29.rowManager.rows.indexOf(a) > _this29.rowManager.rows.indexOf(b) ? 1 : -1; + }); + + foundRows.forEach(function (row) { + row.delete().then(function () { + successCount++; + doneCheck(); + }).catch(function (err) { + doneCheck(); + reject(err); + }); + }); + }); +}; + +//add row to table +Tabulator.prototype.addRow = function (data, pos, index) { + var _this30 = this; + + return new Promise(function (resolve, reject) { + if (typeof data === "string") { + data = JSON.parse(data); + } + + _this30.rowManager.addRows(data, pos, index).then(function (rows) { + //recalc column calculations if present + if (_this30.modExists("columnCalcs")) { + _this30.modules.columnCalcs.recalc(_this30.rowManager.activeRows); + } + + resolve(rows[0].getComponent()); + }); + }); +}; + +//update a row if it exitsts otherwise create it +Tabulator.prototype.updateOrAddRow = function (index, data) { + var _this31 = this; + + return new Promise(function (resolve, reject) { + var row = _this31.rowManager.findRow(index); + + if (typeof data === "string") { + data = JSON.parse(data); + } + + if (row) { + row.updateData(data).then(function () { + //recalc column calculations if present + if (_this31.modExists("columnCalcs")) { + _this31.modules.columnCalcs.recalc(_this31.rowManager.activeRows); + } + + resolve(row.getComponent()); + }).catch(function (err) { + reject(err); + }); + } else { + row = _this31.rowManager.addRows(data).then(function (rows) { + //recalc column calculations if present + if (_this31.modExists("columnCalcs")) { + _this31.modules.columnCalcs.recalc(_this31.rowManager.activeRows); + } + + resolve(rows[0].getComponent()); + }).catch(function (err) { + reject(err); + }); + } + }); +}; + +//update row data +Tabulator.prototype.updateRow = function (index, data) { + var _this32 = this; + + return new Promise(function (resolve, reject) { + var row = _this32.rowManager.findRow(index); + + if (typeof data === "string") { + data = JSON.parse(data); + } + + if (row) { + row.updateData(data).then(function () { + resolve(row.getComponent()); + }).catch(function (err) { + reject(err); + }); + } else { + console.warn("Update Error - No matching row found:", index); + reject("Update Error - No matching row found"); + } + }); +}; + +//scroll to row in DOM +Tabulator.prototype.scrollToRow = function (index, position, ifVisible) { + var _this33 = this; + + return new Promise(function (resolve, reject) { + var row = _this33.rowManager.findRow(index); + + if (row) { + _this33.rowManager.scrollToRow(row, position, ifVisible).then(function () { + resolve(); + }).catch(function (err) { + reject(err); + }); + } else { + console.warn("Scroll Error - No matching row found:", index); + reject("Scroll Error - No matching row found"); + } + }); +}; + +Tabulator.prototype.moveRow = function (from, to, after) { + var fromRow = this.rowManager.findRow(from); + + if (fromRow) { + fromRow.moveToRow(to, after); + } else { + console.warn("Move Error - No matching row found:", from); + } +}; + +Tabulator.prototype.getRows = function (active) { + + if (active === true) { + console.warn("passing a boolean to the getRows function is deprecated, you should now pass the string 'active'"); + active = "active"; + } + + return this.rowManager.getComponents(active); +}; + +//get position of row in table +Tabulator.prototype.getRowPosition = function (index, active) { + var row = this.rowManager.findRow(index); + + if (row) { + return this.rowManager.getRowPosition(row, active); + } else { + console.warn("Position Error - No matching row found:", index); + return false; + } +}; + +//copy table data to clipboard +Tabulator.prototype.copyToClipboard = function (selector) { + if (this.modExists("clipboard", true)) { + this.modules.clipboard.copy(selector); + } +}; + +/////////////// Column Functions /////////////// + +Tabulator.prototype.setColumns = function (definition) { + this.columnManager.setColumns(definition); +}; + +Tabulator.prototype.getColumns = function (structured) { + return this.columnManager.getComponents(structured); +}; + +Tabulator.prototype.getColumn = function (field) { + var col = this.columnManager.findColumn(field); + + if (col) { + return col.getComponent(); + } else { + console.warn("Find Error - No matching column found:", field); + return false; + } +}; + +Tabulator.prototype.getColumnDefinitions = function () { + return this.columnManager.getDefinitionTree(); +}; + +Tabulator.prototype.getColumnLayout = function () { + if (this.modExists("persistence", true)) { + return this.modules.persistence.parseColumns(this.columnManager.getColumns()); + } +}; + +Tabulator.prototype.setColumnLayout = function (layout) { + if (this.modExists("persistence", true)) { + this.columnManager.setColumns(this.modules.persistence.mergeDefinition(this.options.columns, layout)); + return true; + } + return false; +}; + +Tabulator.prototype.showColumn = function (field) { + var column = this.columnManager.findColumn(field); + + if (column) { + column.show(); + + if (this.options.responsiveLayout && this.modExists("responsiveLayout", true)) { + this.modules.responsiveLayout.update(); + } + } else { + console.warn("Column Show Error - No matching column found:", field); + return false; + } +}; + +Tabulator.prototype.hideColumn = function (field) { + var column = this.columnManager.findColumn(field); + + if (column) { + column.hide(); + + if (this.options.responsiveLayout && this.modExists("responsiveLayout", true)) { + this.modules.responsiveLayout.update(); + } + } else { + console.warn("Column Hide Error - No matching column found:", field); + return false; + } +}; + +Tabulator.prototype.toggleColumn = function (field) { + var column = this.columnManager.findColumn(field); + + if (column) { + if (column.visible) { + column.hide(); + } else { + column.show(); + } + } else { + console.warn("Column Visibility Toggle Error - No matching column found:", field); + return false; + } +}; + +Tabulator.prototype.addColumn = function (definition, before, field) { + var _this34 = this; + + return new Promise(function (resolve, reject) { + var column = _this34.columnManager.findColumn(field); + + _this34.columnManager.addColumn(definition, before, column).then(function (column) { + resolve(column.getComponent()); + }).catch(function (err) { + reject(err); + }); + }); +}; + +Tabulator.prototype.deleteColumn = function (field) { + var _this35 = this; + + return new Promise(function (resolve, reject) { + var column = _this35.columnManager.findColumn(field); + + if (column) { + column.delete().then(function () { + resolve(); + }).catch(function (err) { + reject(err); + }); + } else { + console.warn("Column Delete Error - No matching column found:", field); + reject(); + } + }); +}; + +Tabulator.prototype.updateColumnDefinition = function (field, definition) { + var _this36 = this; + + return new Promise(function (resolve, reject) { + var column = _this36.columnManager.findColumn(field); + + if (column) { + column.updateDefinition(definition).then(function (col) { + resolve(col); + }).catch(function (err) { + reject(err); + }); + } else { + console.warn("Column Update Error - No matching column found:", field); + reject(); + } + }); +}; + +Tabulator.prototype.moveColumn = function (from, to, after) { + var fromColumn = this.columnManager.findColumn(from); + var toColumn = this.columnManager.findColumn(to); + + if (fromColumn) { + if (toColumn) { + this.columnManager.moveColumn(fromColumn, toColumn, after); + } else { + console.warn("Move Error - No matching column found:", toColumn); + } + } else { + console.warn("Move Error - No matching column found:", from); + } +}; + +//scroll to column in DOM +Tabulator.prototype.scrollToColumn = function (field, position, ifVisible) { + var _this37 = this; + + return new Promise(function (resolve, reject) { + var column = _this37.columnManager.findColumn(field); + + if (column) { + _this37.columnManager.scrollToColumn(column, position, ifVisible).then(function () { + resolve(); + }).catch(function (err) { + reject(err); + }); + } else { + console.warn("Scroll Error - No matching column found:", field); + reject("Scroll Error - No matching column found"); + } + }); +}; + +//////////// Localization Functions //////////// +Tabulator.prototype.setLocale = function (locale) { + this.modules.localize.setLocale(locale); +}; + +Tabulator.prototype.getLocale = function () { + return this.modules.localize.getLocale(); +}; + +Tabulator.prototype.getLang = function (locale) { + return this.modules.localize.getLang(locale); +}; + +//////////// General Public Functions //////////// + +//redraw list without updating data +Tabulator.prototype.redraw = function (force) { + this.columnManager.redraw(force); + this.rowManager.redraw(force); +}; + +Tabulator.prototype.setHeight = function (height) { + + if (this.rowManager.renderMode !== "classic") { + this.options.height = isNaN(height) ? height : height + "px"; + this.element.style.height = this.options.height; + this.rowManager.setRenderMode(); + this.rowManager.redraw(); + } else { + console.warn("setHeight function is not available in classic render mode"); + } +}; + +///////////////////// Sorting //////////////////// + +//trigger sort +Tabulator.prototype.setSort = function (sortList, dir) { + if (this.modExists("sort", true)) { + this.modules.sort.setSort(sortList, dir); + this.rowManager.sorterRefresh(); + } +}; + +Tabulator.prototype.getSorters = function () { + if (this.modExists("sort", true)) { + return this.modules.sort.getSort(); + } +}; + +Tabulator.prototype.clearSort = function () { + if (this.modExists("sort", true)) { + this.modules.sort.clear(); + this.rowManager.sorterRefresh(); + } +}; + +///////////////////// Filtering //////////////////// + +//set standard filters +Tabulator.prototype.setFilter = function (field, type, value, params) { + if (this.modExists("filter", true)) { + this.modules.filter.setFilter(field, type, value, params); + this.rowManager.filterRefresh(); + } +}; + +//add filter to array +Tabulator.prototype.addFilter = function (field, type, value, params) { + if (this.modExists("filter", true)) { + this.modules.filter.addFilter(field, type, value, params); + this.rowManager.filterRefresh(); + } +}; + +//get all filters +Tabulator.prototype.getFilters = function (all) { + if (this.modExists("filter", true)) { + return this.modules.filter.getFilters(all); + } +}; + +Tabulator.prototype.setHeaderFilterFocus = function (field) { + if (this.modExists("filter", true)) { + var column = this.columnManager.findColumn(field); + + if (column) { + this.modules.filter.setHeaderFilterFocus(column); + } else { + console.warn("Column Filter Focus Error - No matching column found:", field); + return false; + } + } +}; + +Tabulator.prototype.getHeaderFilterValue = function (field) { + if (this.modExists("filter", true)) { + var column = this.columnManager.findColumn(field); + + if (column) { + return this.modules.filter.getHeaderFilterValue(column); + } else { + console.warn("Column Filter Error - No matching column found:", field); + } + } +}; + +Tabulator.prototype.setHeaderFilterValue = function (field, value) { + if (this.modExists("filter", true)) { + var column = this.columnManager.findColumn(field); + + if (column) { + this.modules.filter.setHeaderFilterValue(column, value); + } else { + console.warn("Column Filter Error - No matching column found:", field); + return false; + } + } +}; + +Tabulator.prototype.getHeaderFilters = function () { + if (this.modExists("filter", true)) { + return this.modules.filter.getHeaderFilters(); + } +}; + +//remove filter from array +Tabulator.prototype.removeFilter = function (field, type, value) { + if (this.modExists("filter", true)) { + this.modules.filter.removeFilter(field, type, value); + this.rowManager.filterRefresh(); + } +}; + +//clear filters +Tabulator.prototype.clearFilter = function (all) { + if (this.modExists("filter", true)) { + this.modules.filter.clearFilter(all); + this.rowManager.filterRefresh(); + } +}; + +//clear header filters +Tabulator.prototype.clearHeaderFilter = function () { + if (this.modExists("filter", true)) { + this.modules.filter.clearHeaderFilter(); + this.rowManager.filterRefresh(); + } +}; + +///////////////////// select //////////////////// +Tabulator.prototype.selectRow = function (rows) { + if (this.modExists("selectRow", true)) { + if (rows === true) { + console.warn("passing a boolean to the selectRowselectRow function is deprecated, you should now pass the string 'active'"); + rows = "active"; + } + this.modules.selectRow.selectRows(rows); + } +}; + +Tabulator.prototype.deselectRow = function (rows) { + if (this.modExists("selectRow", true)) { + this.modules.selectRow.deselectRows(rows); + } +}; + +Tabulator.prototype.toggleSelectRow = function (row) { + if (this.modExists("selectRow", true)) { + this.modules.selectRow.toggleRow(row); + } +}; + +Tabulator.prototype.getSelectedRows = function () { + if (this.modExists("selectRow", true)) { + return this.modules.selectRow.getSelectedRows(); + } +}; + +Tabulator.prototype.getSelectedData = function () { + if (this.modExists("selectRow", true)) { + return this.modules.selectRow.getSelectedData(); + } +}; + +///////////////////// validation //////////////////// +Tabulator.prototype.getInvalidCells = function () { + if (this.modExists("validate", true)) { + return this.modules.validate.getInvalidCells(); + } +}; + +Tabulator.prototype.clearCellValidation = function (cells) { + var _this38 = this; + + if (this.modExists("validate", true)) { + + if (!cells) { + cells = this.modules.validate.getInvalidCells(); + } + + if (!Array.isArray(cells)) { + cells = [cells]; + } + + cells.forEach(function (cell) { + _this38.modules.validate.clearValidation(cell._getSelf()); + }); + } +}; + +Tabulator.prototype.validate = function (cells) { + var output = []; + + //clear row data + this.rowManager.rows.forEach(function (row) { + var valid = row.validate(); + + if (valid !== true) { + output = output.concat(valid); + } + }); + + return output.length ? output : true; +}; + +//////////// Pagination Functions //////////// + +Tabulator.prototype.setMaxPage = function (max) { + if (this.options.pagination && this.modExists("page")) { + this.modules.page.setMaxPage(max); + } else { + return false; + } +}; + +Tabulator.prototype.setPage = function (page) { + if (this.options.pagination && this.modExists("page")) { + return this.modules.page.setPage(page); + } else { + return new Promise(function (resolve, reject) { + reject(); + }); + } +}; + +Tabulator.prototype.setPageToRow = function (row) { + var _this39 = this; + + return new Promise(function (resolve, reject) { + if (_this39.options.pagination && _this39.modExists("page")) { + row = _this39.rowManager.findRow(row); + + if (row) { + _this39.modules.page.setPageToRow(row).then(function () { + resolve(); + }).catch(function () { + reject(); + }); + } else { + reject(); + } + } else { + reject(); + } + }); +}; + +Tabulator.prototype.setPageSize = function (size) { + if (this.options.pagination && this.modExists("page")) { + this.modules.page.setPageSize(size); + this.modules.page.setPage(1).then(function () {}).catch(function () {}); + } else { + return false; + } +}; + +Tabulator.prototype.getPageSize = function () { + if (this.options.pagination && this.modExists("page", true)) { + return this.modules.page.getPageSize(); + } +}; + +Tabulator.prototype.previousPage = function () { + if (this.options.pagination && this.modExists("page")) { + this.modules.page.previousPage(); + } else { + return false; + } +}; + +Tabulator.prototype.nextPage = function () { + if (this.options.pagination && this.modExists("page")) { + this.modules.page.nextPage(); + } else { + return false; + } +}; + +Tabulator.prototype.getPage = function () { + if (this.options.pagination && this.modExists("page")) { + return this.modules.page.getPage(); + } else { + return false; + } +}; + +Tabulator.prototype.getPageMax = function () { + if (this.options.pagination && this.modExists("page")) { + return this.modules.page.getPageMax(); + } else { + return false; + } +}; + +///////////////// Grouping Functions /////////////// + +Tabulator.prototype.setGroupBy = function (groups) { + if (this.modExists("groupRows", true)) { + this.options.groupBy = groups; + this.modules.groupRows.initialize(); + this.rowManager.refreshActiveData("display"); + + if (this.options.persistence && this.modExists("persistence", true) && this.modules.persistence.config.group) { + this.modules.persistence.save("group"); + } + } else { + return false; + } +}; + +Tabulator.prototype.setGroupValues = function (groupValues) { + if (this.modExists("groupRows", true)) { + this.options.groupValues = groupValues; + this.modules.groupRows.initialize(); + this.rowManager.refreshActiveData("display"); + + if (this.options.persistence && this.modExists("persistence", true) && this.modules.persistence.config.group) { + this.modules.persistence.save("group"); + } + } else { + return false; + } +}; + +Tabulator.prototype.setGroupStartOpen = function (values) { + if (this.modExists("groupRows", true)) { + this.options.groupStartOpen = values; + this.modules.groupRows.initialize(); + if (this.options.groupBy) { + this.rowManager.refreshActiveData("group"); + + if (this.options.persistence && this.modExists("persistence", true) && this.modules.persistence.config.group) { + this.modules.persistence.save("group"); + } + } else { + console.warn("Grouping Update - cant refresh view, no groups have been set"); + } + } else { + return false; + } +}; + +Tabulator.prototype.setGroupHeader = function (values) { + if (this.modExists("groupRows", true)) { + this.options.groupHeader = values; + this.modules.groupRows.initialize(); + if (this.options.groupBy) { + this.rowManager.refreshActiveData("group"); + + if (this.options.persistence && this.modExists("persistence", true) && this.modules.persistence.config.group) { + this.modules.persistence.save("group"); + } + } else { + console.warn("Grouping Update - cant refresh view, no groups have been set"); + } + } else { + return false; + } +}; + +Tabulator.prototype.getGroups = function (values) { + if (this.modExists("groupRows", true)) { + return this.modules.groupRows.getGroups(true); + } else { + return false; + } +}; + +// get grouped table data in the same format as getData() +Tabulator.prototype.getGroupedData = function () { + if (this.modExists("groupRows", true)) { + return this.options.groupBy ? this.modules.groupRows.getGroupedData() : this.getData(); + } +}; + +Tabulator.prototype.getEditedCells = function () { + if (this.modExists("edit", true)) { + return this.modules.edit.getEditedCells(); + } +}; + +Tabulator.prototype.clearCellEdited = function (cells) { + var _this40 = this; + + if (this.modExists("edit", true)) { + + if (!cells) { + cells = this.modules.edit.getEditedCells(); + } + + if (!Array.isArray(cells)) { + cells = [cells]; + } + + cells.forEach(function (cell) { + _this40.modules.edit.clearEdited(cell._getSelf()); + }); + } +}; + +///////////////// Column Calculation Functions /////////////// +Tabulator.prototype.getCalcResults = function () { + if (this.modExists("columnCalcs", true)) { + return this.modules.columnCalcs.getResults(); + } else { + return false; + } +}; + +Tabulator.prototype.recalc = function () { + if (this.modExists("columnCalcs", true)) { + this.modules.columnCalcs.recalcAll(this.rowManager.activeRows); + } +}; + +/////////////// Navigation Management ////////////// + +Tabulator.prototype.navigatePrev = function () { + var cell = false; + + if (this.modExists("edit", true)) { + cell = this.modules.edit.currentCell; + + if (cell) { + return cell.nav().prev(); + } + } + + return false; +}; + +Tabulator.prototype.navigateNext = function () { + var cell = false; + + if (this.modExists("edit", true)) { + cell = this.modules.edit.currentCell; + + if (cell) { + return cell.nav().next(); + } + } + + return false; +}; + +Tabulator.prototype.navigateLeft = function () { + var cell = false; + + if (this.modExists("edit", true)) { + cell = this.modules.edit.currentCell; + + if (cell) { + e.preventDefault(); + return cell.nav().left(); + } + } + + return false; +}; + +Tabulator.prototype.navigateRight = function () { + var cell = false; + + if (this.modExists("edit", true)) { + cell = this.modules.edit.currentCell; + + if (cell) { + e.preventDefault(); + return cell.nav().right(); + } + } + + return false; +}; + +Tabulator.prototype.navigateUp = function () { + var cell = false; + + if (this.modExists("edit", true)) { + cell = this.modules.edit.currentCell; + + if (cell) { + e.preventDefault(); + return cell.nav().up(); + } + } + + return false; +}; + +Tabulator.prototype.navigateDown = function () { + var cell = false; + + if (this.modExists("edit", true)) { + cell = this.modules.edit.currentCell; + + if (cell) { + e.preventDefault(); + return cell.nav().down(); + } + } + + return false; +}; + +/////////////// History Management ////////////// +Tabulator.prototype.undo = function () { + if (this.options.history && this.modExists("history", true)) { + return this.modules.history.undo(); + } else { + return false; + } +}; + +Tabulator.prototype.redo = function () { + if (this.options.history && this.modExists("history", true)) { + return this.modules.history.redo(); + } else { + return false; + } +}; + +Tabulator.prototype.getHistoryUndoSize = function () { + if (this.options.history && this.modExists("history", true)) { + return this.modules.history.getHistoryUndoSize(); + } else { + return false; + } +}; + +Tabulator.prototype.getHistoryRedoSize = function () { + if (this.options.history && this.modExists("history", true)) { + return this.modules.history.getHistoryRedoSize(); + } else { + return false; + } +}; + +/////////////// Download Management ////////////// + +Tabulator.prototype.download = function (type, filename, options, active) { + if (this.modExists("download", true)) { + this.modules.download.download(type, filename, options, active); + } +}; + +Tabulator.prototype.downloadToTab = function (type, filename, options, active) { + if (this.modExists("download", true)) { + this.modules.download.download(type, filename, options, active, true); + } +}; + +/////////// Inter Table Communications /////////// + +Tabulator.prototype.tableComms = function (table, module, action, data) { + this.modules.comms.receive(table, module, action, data); +}; + +////////////// Extension Management ////////////// + +//object to hold module +Tabulator.prototype.moduleBindings = {}; + +//extend module +Tabulator.prototype.extendModule = function (name, property, values) { + + if (Tabulator.prototype.moduleBindings[name]) { + var source = Tabulator.prototype.moduleBindings[name].prototype[property]; + + if (source) { + if ((typeof values === 'undefined' ? 'undefined' : _typeof(values)) == "object") { + for (var key in values) { + source[key] = values[key]; + } + } else { + console.warn("Module Error - Invalid value type, it must be an object"); + } + } else { + console.warn("Module Error - property does not exist:", property); + } + } else { + console.warn("Module Error - module does not exist:", name); + } +}; + +//add module to tabulator +Tabulator.prototype.registerModule = function (name, module) { + var self = this; + Tabulator.prototype.moduleBindings[name] = module; +}; + +//ensure that module are bound to instantiated function +Tabulator.prototype.bindModules = function () { + this.modules = {}; + + for (var name in Tabulator.prototype.moduleBindings) { + this.modules[name] = new Tabulator.prototype.moduleBindings[name](this); + } +}; + +//Check for module +Tabulator.prototype.modExists = function (plugin, required) { + if (this.modules[plugin]) { + return true; + } else { + if (required) { + console.error("Tabulator Module Not Installed: " + plugin); + } + return false; + } +}; + +Tabulator.prototype.helpers = { + + elVisible: function elVisible(el) { + return !(el.offsetWidth <= 0 && el.offsetHeight <= 0); + }, + + elOffset: function elOffset(el) { + var box = el.getBoundingClientRect(); + + return { + top: box.top + window.pageYOffset - document.documentElement.clientTop, + left: box.left + window.pageXOffset - document.documentElement.clientLeft + }; + }, + + deepClone: function deepClone(obj) { + var clone = Object.assign(Array.isArray(obj) ? [] : {}, obj); + + for (var i in obj) { + if (obj[i] != null && _typeof(obj[i]) === "object") { + if (obj[i] instanceof Date) { + clone[i] = new Date(obj[i]); + } else { + clone[i] = this.deepClone(obj[i]); + } + } + } + return clone; + } +}; + +Tabulator.prototype.comms = { + tables: [], + register: function register(table) { + Tabulator.prototype.comms.tables.push(table); + }, + deregister: function deregister(table) { + var index = Tabulator.prototype.comms.tables.indexOf(table); + + if (index > -1) { + Tabulator.prototype.comms.tables.splice(index, 1); + } + }, + lookupTable: function lookupTable(query, silent) { + var results = [], + matches, + match; + + if (typeof query === "string") { + matches = document.querySelectorAll(query); + + if (matches.length) { + for (var i = 0; i < matches.length; i++) { + match = Tabulator.prototype.comms.matchElement(matches[i]); + + if (match) { + results.push(match); + } + } + } + } else if (typeof HTMLElement !== "undefined" && query instanceof HTMLElement || query instanceof Tabulator) { + match = Tabulator.prototype.comms.matchElement(query); + + if (match) { + results.push(match); + } + } else if (Array.isArray(query)) { + query.forEach(function (item) { + results = results.concat(Tabulator.prototype.comms.lookupTable(item)); + }); + } else { + if (!silent) { + console.warn("Table Connection Error - Invalid Selector", query); + } + } + + return results; + }, + matchElement: function matchElement(element) { + return Tabulator.prototype.comms.tables.find(function (table) { + return element instanceof Tabulator ? table === element : table.element === element; + }); + } +}; + +Tabulator.prototype.findTable = function (query) { + var results = Tabulator.prototype.comms.lookupTable(query, true); + return Array.isArray(results) && !results.length ? false : results; +}; + +var Layout = function Layout(table) { + + this.table = table; + + this.mode = null; +}; + +//initialize layout system + +Layout.prototype.initialize = function (layout) { + + if (this.modes[layout]) { + + this.mode = layout; + } else { + + console.warn("Layout Error - invalid mode set, defaulting to 'fitData' : " + layout); + + this.mode = 'fitData'; + } + + this.table.element.setAttribute("tabulator-layout", this.mode); +}; + +Layout.prototype.getMode = function () { + + return this.mode; +}; + +//trigger table layout + +Layout.prototype.layout = function () { + + this.modes[this.mode].call(this, this.table.columnManager.columnsByIndex); +}; + +//layout render functions + +Layout.prototype.modes = { + + //resize columns to fit data they contain + + "fitData": function fitData(columns) { + + if (this.table.options.virtualDomHoz) { + + this.table.vdomHoz.fitDataLayoutOverride(); + } else { + + columns.forEach(function (column) { + + column.reinitializeWidth(); + }); + } + + if (this.table.options.responsiveLayout && this.table.modExists("responsiveLayout", true)) { + + this.table.modules.responsiveLayout.update(); + } + }, + + //resize columns to fit data they contain and stretch row to fill table + + "fitDataFill": function fitDataFill(columns) { + + columns.forEach(function (column) { + + column.reinitializeWidth(); + }); + + if (this.table.options.responsiveLayout && this.table.modExists("responsiveLayout", true)) { + + this.table.modules.responsiveLayout.update(); + } + }, + + //resize columns to fit data they contain + + "fitDataTable": function fitDataTable(columns) { + + columns.forEach(function (column) { + + column.reinitializeWidth(); + }); + + if (this.table.options.responsiveLayout && this.table.modExists("responsiveLayout", true)) { + + this.table.modules.responsiveLayout.update(); + } + }, + + //resize columns to fit data the contain and stretch last column to fill table + + "fitDataStretch": function fitDataStretch(columns) { + var _this41 = this; + + var colsWidth = 0, + tableWidth = this.table.rowManager.element.clientWidth, + gap = 0, + lastCol = false; + + columns.forEach(function (column, i) { + + if (!column.widthFixed) { + + column.reinitializeWidth(); + } + + if (_this41.table.options.responsiveLayout ? column.modules.responsive.visible : column.visible) { + + lastCol = column; + } + + if (column.visible) { + + colsWidth += column.getWidth(); + } + }); + + if (lastCol) { + + gap = tableWidth - colsWidth + lastCol.getWidth(); + + if (this.table.options.responsiveLayout && this.table.modExists("responsiveLayout", true)) { + + lastCol.setWidth(0); + + this.table.modules.responsiveLayout.update(); + } + + if (gap > 0) { + + lastCol.setWidth(gap); + } else { + + lastCol.reinitializeWidth(); + } + } else { + + if (this.table.options.responsiveLayout && this.table.modExists("responsiveLayout", true)) { + + this.table.modules.responsiveLayout.update(); + } + } + }, + + //resize columns to fit + + "fitColumns": function fitColumns(columns) { + + var self = this; + + var totalWidth = self.table.element.clientWidth; //table element width + + var fixedWidth = 0; //total width of columns with a defined width + + var flexWidth = 0; //total width available to flexible columns + + var flexGrowUnits = 0; //total number of widthGrow blocks accross all columns + + var flexColWidth = 0; //desired width of flexible columns + + var flexColumns = []; //array of flexible width columns + + var fixedShrinkColumns = []; //array of fixed width columns that can shrink + + var flexShrinkUnits = 0; //total number of widthShrink blocks accross all columns + + var overflowWidth = 0; //horizontal overflow width + + var gapFill = 0; //number of pixels to be added to final column to close and half pixel gaps + + + function calcWidth(width) { + + var colWidth; + + if (typeof width == "string") { + + if (width.indexOf("%") > -1) { + + colWidth = totalWidth / 100 * parseInt(width); + } else { + + colWidth = parseInt(width); + } + } else { + + colWidth = width; + } + + return colWidth; + } + + //ensure columns resize to take up the correct amount of space + + function scaleColumns(columns, freeSpace, colWidth, shrinkCols) { + + var oversizeCols = [], + oversizeSpace = 0, + remainingSpace = 0, + nextColWidth = 0, + gap = 0, + changeUnits = 0, + undersizeCols = []; + + function calcGrow(col) { + + return colWidth * (col.column.definition.widthGrow || 1); + } + + function calcShrink(col) { + + return calcWidth(col.width) - colWidth * (col.column.definition.widthShrink || 0); + } + + columns.forEach(function (col, i) { + + var width = shrinkCols ? calcShrink(col) : calcGrow(col); + + if (col.column.minWidth >= width) { + + oversizeCols.push(col); + } else { + + undersizeCols.push(col); + + changeUnits += shrinkCols ? col.column.definition.widthShrink || 1 : col.column.definition.widthGrow || 1; + } + }); + + if (oversizeCols.length) { + + oversizeCols.forEach(function (col) { + + oversizeSpace += shrinkCols ? col.width - col.column.minWidth : col.column.minWidth; + + col.width = col.column.minWidth; + }); + + remainingSpace = freeSpace - oversizeSpace; + + nextColWidth = changeUnits ? Math.floor(remainingSpace / changeUnits) : remainingSpace; + + gap = remainingSpace - nextColWidth * changeUnits; + + gap += scaleColumns(undersizeCols, remainingSpace, nextColWidth, shrinkCols); + } else { + + gap = changeUnits ? freeSpace - Math.floor(freeSpace / changeUnits) * changeUnits : freeSpace; + + undersizeCols.forEach(function (column) { + + column.width = shrinkCols ? calcShrink(column) : calcGrow(column); + }); + } + + return gap; + } + + if (this.table.options.responsiveLayout && this.table.modExists("responsiveLayout", true)) { + + this.table.modules.responsiveLayout.update(); + } + + //adjust for vertical scrollbar if present + + if (this.table.rowManager.element.scrollHeight > this.table.rowManager.element.clientHeight) { + + totalWidth -= this.table.rowManager.element.offsetWidth - this.table.rowManager.element.clientWidth; + } + + columns.forEach(function (column) { + + var width, minWidth, colWidth; + + if (column.visible) { + + width = column.definition.width; + + minWidth = parseInt(column.minWidth); + + if (width) { + + colWidth = calcWidth(width); + + fixedWidth += colWidth > minWidth ? colWidth : minWidth; + + if (column.definition.widthShrink) { + + fixedShrinkColumns.push({ + + column: column, + + width: colWidth > minWidth ? colWidth : minWidth + + }); + + flexShrinkUnits += column.definition.widthShrink; + } + } else { + + flexColumns.push({ + + column: column, + + width: 0 + + }); + + flexGrowUnits += column.definition.widthGrow || 1; + } + } + }); + + //calculate available space + + flexWidth = totalWidth - fixedWidth; + + //calculate correct column size + + flexColWidth = Math.floor(flexWidth / flexGrowUnits); + + //generate column widths + + var gapFill = scaleColumns(flexColumns, flexWidth, flexColWidth, false); + + //increase width of last column to account for rounding errors + + if (flexColumns.length && gapFill > 0) { + + flexColumns[flexColumns.length - 1].width += +gapFill; + } + + //caculate space for columns to be shrunk into + + flexColumns.forEach(function (col) { + + flexWidth -= col.width; + }); + + overflowWidth = Math.abs(gapFill) + flexWidth; + + //shrink oversize columns if there is no available space + + if (overflowWidth > 0 && flexShrinkUnits) { + + gapFill = scaleColumns(fixedShrinkColumns, overflowWidth, Math.floor(overflowWidth / flexShrinkUnits), true); + } + + //decrease width of last column to account for rounding errors + + if (fixedShrinkColumns.length) { + + fixedShrinkColumns[fixedShrinkColumns.length - 1].width -= gapFill; + } + + flexColumns.forEach(function (col) { + + col.column.setWidth(col.width); + }); + + fixedShrinkColumns.forEach(function (col) { + + col.column.setWidth(col.width); + }); + } + +}; + +Tabulator.prototype.registerModule("layout", Layout); +var Localize = function Localize(table) { + this.table = table; //hold Tabulator object + this.locale = "default"; //current locale + this.lang = false; //current language + this.bindings = {}; //update events to call when locale is changed + this.langList = {}; +}; + +Localize.prototype.initialize = function () { + this.langList = Tabulator.prototype.helpers.deepClone(this.langs); +}; + +//set header placehoder +Localize.prototype.setHeaderFilterPlaceholder = function (placeholder) { + this.langList.default.headerFilters.default = placeholder; +}; + +//set header filter placeholder by column +Localize.prototype.setHeaderFilterColumnPlaceholder = function (column, placeholder) { + this.langList.default.headerFilters.columns[column] = placeholder; + + if (this.lang && !this.lang.headerFilters.columns[column]) { + this.lang.headerFilters.columns[column] = placeholder; + } +}; + +//setup a lang description object +Localize.prototype.installLang = function (locale, lang) { + if (this.langList[locale]) { + this._setLangProp(this.langList[locale], lang); + } else { + this.langList[locale] = lang; + } +}; + +Localize.prototype._setLangProp = function (lang, values) { + for (var key in values) { + if (lang[key] && _typeof(lang[key]) == "object") { + this._setLangProp(lang[key], values[key]); + } else { + lang[key] = values[key]; + } + } +}; + +//set current locale +Localize.prototype.setLocale = function (desiredLocale) { + var self = this; + + desiredLocale = desiredLocale || "default"; + + //fill in any matching languge values + function traverseLang(trans, path) { + for (var prop in trans) { + if (_typeof(trans[prop]) == "object") { + if (!path[prop]) { + path[prop] = {}; + } + traverseLang(trans[prop], path[prop]); + } else { + path[prop] = trans[prop]; + } + } + } + + //determing correct locale to load + if (desiredLocale === true && navigator.language) { + //get local from system + desiredLocale = navigator.language.toLowerCase(); + } + + if (desiredLocale) { + + //if locale is not set, check for matching top level locale else use default + if (!self.langList[desiredLocale]) { + var prefix = desiredLocale.split("-")[0]; + + if (self.langList[prefix]) { + console.warn("Localization Error - Exact matching locale not found, using closest match: ", desiredLocale, prefix); + desiredLocale = prefix; + } else { + console.warn("Localization Error - Matching locale not found, using default: ", desiredLocale); + desiredLocale = "default"; + } + } + } + + self.locale = desiredLocale; + + //load default lang template + self.lang = Tabulator.prototype.helpers.deepClone(self.langList.default || {}); + + if (desiredLocale != "default") { + traverseLang(self.langList[desiredLocale], self.lang); + } + + self.table.options.localized.call(self.table, self.locale, self.lang); + + self._executeBindings(); +}; + +//get current locale +Localize.prototype.getLocale = function (locale) { + return self.locale; +}; + +//get lang object for given local or current if none provided +Localize.prototype.getLang = function (locale) { + return locale ? this.langList[locale] : this.lang; +}; + +//get text for current locale +Localize.prototype.getText = function (path, value) { + var path = value ? path + "|" + value : path, + pathArray = path.split("|"), + text = this._getLangElement(pathArray, this.locale); + + // if(text === false){ + // console.warn("Localization Error - Matching localized text not found for given path: ", path); + // } + + return text || ""; +}; + +//traverse langs object and find localized copy +Localize.prototype._getLangElement = function (path, locale) { + var self = this; + var root = self.lang; + + path.forEach(function (level) { + var rootPath; + + if (root) { + rootPath = root[level]; + + if (typeof rootPath != "undefined") { + root = rootPath; + } else { + root = false; + } + } + }); + + return root; +}; + +//set update binding +Localize.prototype.bind = function (path, callback) { + if (!this.bindings[path]) { + this.bindings[path] = []; + } + + this.bindings[path].push(callback); + + callback(this.getText(path), this.lang); +}; + +//itterate through bindings and trigger updates +Localize.prototype._executeBindings = function () { + var self = this; + + var _loop = function _loop(path) { + self.bindings[path].forEach(function (binding) { + binding(self.getText(path), self.lang); + }); + }; + + for (var path in self.bindings) { + _loop(path); + } +}; + +//Localized text listings +Localize.prototype.langs = { + "default": { //hold default locale text + "groups": { + "item": "item", + "items": "items" + }, + "columns": {}, + "ajax": { + "loading": "Loading", + "error": "Error" + }, + "pagination": { + "page_size": "Page Size", + "page_title": "Show Page", + "first": "First", + "first_title": "First Page", + "last": "Last", + "last_title": "Last Page", + "prev": "Prev", + "prev_title": "Prev Page", + "next": "Next", + "next_title": "Next Page", + "all": "All" + }, + "headerFilters": { + "default": "filter column...", + "columns": {} + } + } +}; + +Tabulator.prototype.registerModule("localize", Localize); +var Comms = function Comms(table) { + this.table = table; +}; + +Comms.prototype.getConnections = function (selectors) { + var self = this, + connections = [], + connection; + + connection = Tabulator.prototype.comms.lookupTable(selectors); + + connection.forEach(function (con) { + if (self.table !== con) { + connections.push(con); + } + }); + + return connections; +}; + +Comms.prototype.send = function (selectors, module, action, data) { + var self = this, + connections = this.getConnections(selectors); + + connections.forEach(function (connection) { + connection.tableComms(self.table.element, module, action, data); + }); + + if (!connections.length && selectors) { + console.warn("Table Connection Error - No tables matching selector found", selectors); + } +}; + +Comms.prototype.receive = function (table, module, action, data) { + if (this.table.modExists(module)) { + return this.table.modules[module].commsReceived(table, action, data); + } else { + console.warn("Inter-table Comms Error - no such module:", module); + } +}; + +Tabulator.prototype.registerModule("comms", Comms); \ No newline at end of file diff --git a/website/js/vendor/tabulator/js/tabulator_core.min.js b/website/js/vendor/tabulator/js/tabulator_core.min.js new file mode 100644 index 0000000..87986ad --- /dev/null +++ b/website/js/vendor/tabulator/js/tabulator_core.min.js @@ -0,0 +1,6 @@ +/* Tabulator v4.8.3 (c) Oliver Folkerd */ +"use strict";var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t};Array.prototype.findIndex||Object.defineProperty(Array.prototype,"findIndex",{value:function(t){if(null==this)throw new TypeError('"this" is null or not defined');var e=Object(this),o=e.length>>>0;if("function"!=typeof t)throw new TypeError("predicate must be a function");for(var i=arguments[1],n=0;n>>0;if("function"!=typeof t)throw new TypeError("predicate must be a function");for(var i=arguments[1],n=0;n>>0;if(0===i)return!1;for(var n=0|e,l=Math.max(n>=0?n:i-Math.abs(n),0);lo?(e=t-o,this.element.style.marginLeft=-e+"px"):this.element.style.marginLeft=0,this.scrollLeft=t,this.table.modExists("frozenColumns")&&this.table.modules.frozenColumns.scrollHorizontal()},ColumnManager.prototype.generateColumnsFromRowData=function(t){var e,o,i=[],n=this.table.options.autoColumnsDefinitions;if(t&&t.length){e=t[0];for(var l in e){var s={field:l,title:l},a=e[l];switch(void 0===a?"undefined":_typeof(a)){case"undefined":o="string";break;case"boolean":o="boolean";break;case"object":o=Array.isArray(a)?"array":"string";break;default:o=isNaN(a)||""===a?a.match(/((^[0-9]+[a-z]+)|(^[a-z]+[0-9]+))+$/i)?"alphanum":"string":"number"}s.sorter=o,i.push(s)}if(n)switch(void 0===n?"undefined":_typeof(n)){case"function":this.table.options.columns=n.call(this.table,i);break;case"object":Array.isArray(n)?i.forEach(function(t){var e=n.find(function(e){return e.field===t.field});e&&Object.assign(t,e)}):i.forEach(function(t){n[t.field]&&Object.assign(t,n[t.field])}),this.table.options.columns=i}else this.table.options.columns=i;this.setColumns(this.table.options.columns)}},ColumnManager.prototype.setColumns=function(t,e){for(var o=this;o.headersElement.firstChild;)o.headersElement.removeChild(o.headersElement.firstChild);o.columns=[],o.columnsByIndex=[],o.columnsByField={},o.table.modExists("frozenColumns")&&o.table.modules.frozenColumns.reset(),t.forEach(function(t,e){o._addColumn(t)}),o._reIndexColumns(),o.table.options.responsiveLayout&&o.table.modExists("responsiveLayout",!0)&&o.table.modules.responsiveLayout.initialize(),this.table.options.virtualDomHoz&&this.table.vdomHoz.reinitialize(!1,!0),o.redraw(!0)},ColumnManager.prototype._addColumn=function(t,e,o){var i=new Column(t,this),n=i.getElement(),l=o?this.findColumnIndex(o):o;if(o&&l>-1){var s=this.columns.indexOf(o.getTopColumn()),a=o.getElement();e?(this.columns.splice(s,0,i),a.parentNode.insertBefore(n,a)):(this.columns.splice(s+1,0,i),a.parentNode.insertBefore(n,a.nextSibling))}else e?(this.columns.unshift(i),this.headersElement.insertBefore(i.getElement(),this.headersElement.firstChild)):(this.columns.push(i),this.headersElement.appendChild(i.getElement())),i.columnRendered();return i},ColumnManager.prototype.registerColumnField=function(t){t.definition.field&&(this.columnsByField[t.definition.field]=t)},ColumnManager.prototype.registerColumnPosition=function(t){this.columnsByIndex.push(t)},ColumnManager.prototype._reIndexColumns=function(){this.columnsByIndex=[],this.columns.forEach(function(t){t.reRegisterPosition()})},ColumnManager.prototype._verticalAlignHeaders=function(){var t=this,e=0;t.columns.forEach(function(t){var o;t.clearVerticalAlign(),(o=t.getHeight())>e&&(e=o)}),t.columns.forEach(function(o){o.verticalAlign(t.table.options.columnHeaderVertAlign,e)}),t.rowManager.adjustTableSize()},ColumnManager.prototype.findColumn=function(t){var e=this;if("object"!=(void 0===t?"undefined":_typeof(t)))return this.columnsByField[t]||!1;if(t instanceof Column)return t;if(t instanceof ColumnComponent)return t._getSelf()||!1;if("undefined"!=typeof HTMLElement&&t instanceof HTMLElement){return e.columns.find(function(e){return e.element===t})||!1}return!1},ColumnManager.prototype.getColumnByField=function(t){return this.columnsByField[t]},ColumnManager.prototype.getColumnsByFieldRoot=function(t){var e=this,o=[];return Object.keys(this.columnsByField).forEach(function(i){i.split(".")[0]===t&&o.push(e.columnsByField[i])}),o},ColumnManager.prototype.getColumnByIndex=function(t){return this.columnsByIndex[t]},ColumnManager.prototype.getFirstVisibileColumn=function(t){var t=this.columnsByIndex.findIndex(function(t){return t.visible});return t>-1&&this.columnsByIndex[t]},ColumnManager.prototype.getColumns=function(){return this.columns},ColumnManager.prototype.findColumnIndex=function(t){return this.columnsByIndex.findIndex(function(e){return t===e})},ColumnManager.prototype.getRealColumns=function(){return this.columnsByIndex},ColumnManager.prototype.traverse=function(t){this.columnsByIndex.forEach(function(e,o){t(e,o)})},ColumnManager.prototype.getDefinitions=function(t){var e=this,o=[];return e.columnsByIndex.forEach(function(e){(!t||t&&e.visible)&&o.push(e.getDefinition())}),o},ColumnManager.prototype.getDefinitionTree=function(){var t=this,e=[];return t.columns.forEach(function(t){e.push(t.getDefinition(!0))}),e},ColumnManager.prototype.getComponents=function(t){var e=this,o=[];return(t?e.columns:e.columnsByIndex).forEach(function(t){o.push(t.getComponent())}),o},ColumnManager.prototype.getWidth=function(){var t=0;return this.columnsByIndex.forEach(function(e){e.visible&&(t+=e.getWidth())}),t},ColumnManager.prototype.moveColumn=function(t,e,o){this.moveColumnActual(t,e,o),this.table.options.responsiveLayout&&this.table.modExists("responsiveLayout",!0)&&this.table.modules.responsiveLayout.initialize(),this.table.modExists("columnCalcs")&&this.table.modules.columnCalcs.recalc(this.table.rowManager.activeRows),e.element.parentNode.insertBefore(t.element,e.element),o&&e.element.parentNode.insertBefore(e.element,t.element),this._verticalAlignHeaders(),this.table.rowManager.reinitialize()},ColumnManager.prototype.moveColumnActual=function(t,e,o){t.parent.isGroup?this._moveColumnInArray(t.parent.columns,t,e,o):this._moveColumnInArray(this.columns,t,e,o),this._moveColumnInArray(this.columnsByIndex,t,e,o,!0),this.table.options.responsiveLayout&&this.table.modExists("responsiveLayout",!0)&&this.table.modules.responsiveLayout.initialize(),this.table.options.virtualDomHoz&&this.table.vdomHoz.reinitialize(!0),this.table.options.columnMoved&&this.table.options.columnMoved.call(this.table,t.getComponent(),this.table.columnManager.getComponents()),this.table.options.persistence&&this.table.modExists("persistence",!0)&&this.table.modules.persistence.config.columns&&this.table.modules.persistence.save("columns")},ColumnManager.prototype._moveColumnInArray=function(t,e,o,i,n){var l,s=this,a=t.indexOf(e),r=[];a>-1&&(t.splice(a,1),l=t.indexOf(o),l>-1?i&&(l+=1):l=a,t.splice(l,0,e),n&&(this.table.options.dataTree&&this.table.modExists("dataTree",!0)&&this.table.rowManager.rows.forEach(function(t){r=r.concat(s.table.modules.dataTree.getTreeChildren(t,!1,!0))}),r=r.concat(this.table.rowManager.rows),r.forEach(function(t){if(t.cells.length){var e=t.cells.splice(a,1)[0];t.cells.splice(l,0,e)}})))},ColumnManager.prototype.scrollToColumn=function(t,e,o){var i=this,n=0,l=0,s=0,a=t.getElement();return new Promise(function(r,u){if(void 0===e&&(e=i.table.options.scrollToColumnPosition),void 0===o&&(o=i.table.options.scrollToColumnIfVisible),t.visible){switch(e){case"middle":case"center":s=-i.element.clientWidth/2;break;case"right":s=a.clientWidth-i.headersElement.clientWidth}if(!o&&(l=a.offsetLeft)>0&&l+a.offsetWidtht.rowManager.element.clientHeight&&(e-=t.rowManager.element.offsetWidth-t.rowManager.element.clientWidth),this.columnsByIndex.forEach(function(i){var n,l,s;i.visible&&(n=i.definition.width||0,l=void 0===i.minWidth?t.table.options.columnMinWidth:parseInt(i.minWidth),s="string"==typeof n?n.indexOf("%")>-1?e/100*parseInt(n):parseInt(n):n,o+=s>l?s:l)}),o},ColumnManager.prototype.addColumn=function(t,e,o){var i=this;return new Promise(function(n,l){var s=i._addColumn(t,e,o);i._reIndexColumns(),i.table.options.responsiveLayout&&i.table.modExists("responsiveLayout",!0)&&i.table.modules.responsiveLayout.initialize(),i.table.modExists("columnCalcs")&&i.table.modules.columnCalcs.recalc(i.table.rowManager.activeRows),i.redraw(),"fitColumns"!=i.table.modules.layout.getMode()&&s.reinitializeWidth(),i._verticalAlignHeaders(),i.table.rowManager.reinitialize(),i.table.options.virtualDomHoz&&i.table.vdomHoz.reinitialize(),n(s)})},ColumnManager.prototype.deregisterColumn=function(t){var e,o=t.getField();o&&delete this.columnsByField[o],e=this.columnsByIndex.indexOf(t),e>-1&&this.columnsByIndex.splice(e,1),e=this.columns.indexOf(t),e>-1&&this.columns.splice(e,1),this.table.options.responsiveLayout&&this.table.modExists("responsiveLayout",!0)&&this.table.modules.responsiveLayout.initialize(),this._verticalAlignHeaders(),this.redraw()},ColumnManager.prototype.redraw=function(t){t&&(Tabulator.prototype.helpers.elVisible(this.element)&&this._verticalAlignHeaders(),this.table.rowManager.resetScroll(),this.table.rowManager.reinitialize()),["fitColumns","fitDataStretch"].indexOf(this.table.modules.layout.getMode())>-1?this.table.modules.layout.layout():t?this.table.modules.layout.layout():this.table.options.responsiveLayout&&this.table.modExists("responsiveLayout",!0)&&this.table.modules.responsiveLayout.update(),this.table.modExists("frozenColumns")&&this.table.modules.frozenColumns.layout(),this.table.modExists("columnCalcs")&&this.table.modules.columnCalcs.recalc(this.table.rowManager.activeRows),t&&(this.table.options.persistence&&this.table.modExists("persistence",!0)&&this.table.modules.persistence.config.columns&&this.table.modules.persistence.save("columns"),this.table.modExists("columnCalcs")&&this.table.modules.columnCalcs.redraw()),this.table.footerManager.redraw()};var ColumnComponent=function(t){this._column=t,this.type="ColumnComponent"};ColumnComponent.prototype.getElement=function(){return this._column.getElement()},ColumnComponent.prototype.getDefinition=function(){return this._column.getDefinition()},ColumnComponent.prototype.getField=function(){return this._column.getField()},ColumnComponent.prototype.getCells=function(){var t=[];return this._column.cells.forEach(function(e){t.push(e.getComponent())}),t},ColumnComponent.prototype.getVisibility=function(){return console.warn("getVisibility function is deprecated, you should now use the isVisible function"),this._column.visible},ColumnComponent.prototype.isVisible=function(){return this._column.visible},ColumnComponent.prototype.show=function(){this._column.isGroup?this._column.columns.forEach(function(t){t.show()}):this._column.show()},ColumnComponent.prototype.hide=function(){this._column.isGroup?this._column.columns.forEach(function(t){t.hide()}):this._column.hide()},ColumnComponent.prototype.toggle=function(){this._column.visible?this.hide():this.show()},ColumnComponent.prototype.delete=function(){return this._column.delete()},ColumnComponent.prototype.getSubColumns=function(){var t=[];return this._column.columns.length&&this._column.columns.forEach(function(e){t.push(e.getComponent())}),t},ColumnComponent.prototype.getParentColumn=function(){return this._column.parent instanceof Column&&this._column.parent.getComponent()},ColumnComponent.prototype._getSelf=function(){return this._column},ColumnComponent.prototype.scrollTo=function(){return this._column.table.columnManager.scrollToColumn(this._column)},ColumnComponent.prototype.getTable=function(){return this._column.table},ColumnComponent.prototype.headerFilterFocus=function(){this._column.table.modExists("filter",!0)&&this._column.table.modules.filter.setHeaderFilterFocus(this._column)},ColumnComponent.prototype.reloadHeaderFilter=function(){this._column.table.modExists("filter",!0)&&this._column.table.modules.filter.reloadHeaderFilter(this._column)},ColumnComponent.prototype.getHeaderFilterValue=function(){if(this._column.table.modExists("filter",!0))return this._column.table.modules.filter.getHeaderFilterValue(this._column)},ColumnComponent.prototype.setHeaderFilterValue=function(t){this._column.table.modExists("filter",!0)&&this._column.table.modules.filter.setHeaderFilterValue(this._column,t)},ColumnComponent.prototype.move=function(t,e){var o=this._column.table.columnManager.findColumn(t);o?this._column.table.columnManager.moveColumn(this._column,o,e):console.warn("Move Error - No matching column found:",o)},ColumnComponent.prototype.getNextColumn=function(){var t=this._column.nextColumn();return!!t&&t.getComponent()},ColumnComponent.prototype.getPrevColumn=function(){var t=this._column.prevColumn();return!!t&&t.getComponent()},ColumnComponent.prototype.updateDefinition=function(t){return this._column.updateDefinition(t)},ColumnComponent.prototype.getWidth=function(){return this._column.getWidth()},ColumnComponent.prototype.setWidth=function(t){var e;return e=!0===t?this._column.reinitializeWidth(!0):this._column.setWidth(t),this._column.table.options.virtualDomHoz&&this._column.table.vdomHoz.reinitialize(!0),e},ColumnComponent.prototype.validate=function(){return this._column.validate()};var Column=function t(e,o){var i=this;this.table=o.table,this.definition=e,this.parent=o,this.type="column",this.columns=[],this.cells=[],this.element=this.createElement(),this.contentElement=!1,this.titleHolderElement=!1,this.titleElement=!1,this.groupElement=this.createGroupElement(),this.isGroup=!1,this.tooltip=!1,this.hozAlign="",this.vertAlign="",this.field="",this.fieldStructure="",this.getFieldValue="",this.setFieldValue="",this.titleFormatterRendered=!1,this.setField(this.definition.field),this.table.options.invalidOptionWarnings&&this.checkDefinition(),this.modules={},this.cellEvents={cellClick:!1,cellDblClick:!1,cellContext:!1,cellTap:!1,cellDblTap:!1,cellTapHold:!1,cellMouseEnter:!1,cellMouseLeave:!1,cellMouseOver:!1,cellMouseOut:!1,cellMouseMove:!1},this.width=null,this.widthStyled="",this.minWidth=null,this.minWidthStyled="",this.widthFixed=!1,this.visible=!0,this.component=null,this._mapDepricatedFunctionality(),e.columns?(this.isGroup=!0,e.columns.forEach(function(e,o){var n=new t(e,i);i.attachColumn(n)}),i.checkColumnVisibility()):o.registerColumnField(this),e.rowHandle&&!1!==this.table.options.movableRows&&this.table.modExists("moveRow")&&this.table.modules.moveRow.setHandle(!0),this._buildHeader(),this.bindModuleColumns()};Column.prototype.createElement=function(){var t=document.createElement("div");return t.classList.add("tabulator-col"),t.setAttribute("role","columnheader"),t.setAttribute("aria-sort","none"),t},Column.prototype.createGroupElement=function(){var t=document.createElement("div");return t.classList.add("tabulator-col-group-cols"),t},Column.prototype.checkDefinition=function(){var t=this;Object.keys(this.definition).forEach(function(e){-1===t.defaultOptionList.indexOf(e)&&console.warn("Invalid column definition option in '"+(t.field||t.definition.title)+"' column:",e)})},Column.prototype.setField=function(t){this.field=t,this.fieldStructure=t?this.table.options.nestedFieldSeparator?t.split(this.table.options.nestedFieldSeparator):[t]:[],this.getFieldValue=this.fieldStructure.length>1?this._getNestedData:this._getFlatData,this.setFieldValue=this.fieldStructure.length>1?this._setNestedData:this._setFlatData},Column.prototype.registerColumnPosition=function(t){this.parent.registerColumnPosition(t)},Column.prototype.registerColumnField=function(t){this.parent.registerColumnField(t)},Column.prototype.reRegisterPosition=function(){this.isGroup?this.columns.forEach(function(t){t.reRegisterPosition()}):this.registerColumnPosition(this)},Column.prototype._mapDepricatedFunctionality=function(){void 0!==this.definition.hideInHtml&&(this.definition.htmlOutput=!this.definition.hideInHtml,console.warn("hideInHtml column definition property is deprecated, you should now use htmlOutput")),void 0!==this.definition.align&&(this.definition.hozAlign=this.definition.align,console.warn("align column definition property is deprecated, you should now use hozAlign")),void 0!==this.definition.downloadTitle&&(this.definition.titleDownload=this.definition.downloadTitle,console.warn("downloadTitle definition property is deprecated, you should now use titleDownload"))},Column.prototype.setTooltip=function(){var t=this,e=t.definition,o=e.headerTooltip||!1===e.tooltip?e.headerTooltip:t.table.options.tooltipsHeader;o?!0===o?e.field?t.table.modules.localize.bind("columns|"+e.field,function(o){t.element.setAttribute("title",o||e.title)}):t.element.setAttribute("title",e.title):("function"==typeof o&&!1===(o=o(t.getComponent()))&&(o=""),t.element.setAttribute("title",o)):t.element.setAttribute("title","")},Column.prototype._buildHeader=function(){for(var t=this,e=t.definition;t.element.firstChild;)t.element.removeChild(t.element.firstChild);e.headerVertical&&(t.element.classList.add("tabulator-col-vertical"),"flip"===e.headerVertical&&t.element.classList.add("tabulator-col-vertical-flip")),t.contentElement=t._bindEvents(),t.contentElement=t._buildColumnHeaderContent(),t.element.appendChild(t.contentElement),t.isGroup?t._buildGroupHeader():t._buildColumnHeader(),t.setTooltip(),t.table.options.resizableColumns&&t.table.modExists("resizeColumns")&&t.table.modules.resizeColumns.initializeColumn("header",t,t.element),e.headerFilter&&t.table.modExists("filter")&&t.table.modExists("edit")&&(void 0!==e.headerFilterPlaceholder&&e.field&&t.table.modules.localize.setHeaderFilterColumnPlaceholder(e.field,e.headerFilterPlaceholder),t.table.modules.filter.initializeColumn(t)),t.table.modExists("frozenColumns")&&t.table.modules.frozenColumns.initializeColumn(t),t.table.options.movableColumns&&!t.isGroup&&t.table.modExists("moveColumn")&&t.table.modules.moveColumn.initializeColumn(t),(e.topCalc||e.bottomCalc)&&t.table.modExists("columnCalcs")&&t.table.modules.columnCalcs.initializeColumn(t),t.table.modExists("persistence")&&t.table.modules.persistence.config.columns&&t.table.modules.persistence.initializeColumn(t),t.element.addEventListener("mouseenter",function(e){t.setTooltip()})},Column.prototype._bindEvents=function(){var t,e,o,i=this,n=i.definition;"function"==typeof n.headerClick&&i.element.addEventListener("click",function(t){n.headerClick(t,i.getComponent())}),"function"==typeof n.headerDblClick&&i.element.addEventListener("dblclick",function(t){n.headerDblClick(t,i.getComponent())}),"function"==typeof n.headerContext&&i.element.addEventListener("contextmenu",function(t){n.headerContext(t,i.getComponent())}),"function"==typeof n.headerTap&&(o=!1,i.element.addEventListener("touchstart",function(t){o=!0},{passive:!0}),i.element.addEventListener("touchend",function(t){o&&n.headerTap(t,i.getComponent()),o=!1})),"function"==typeof n.headerDblTap&&(t=null,i.element.addEventListener("touchend",function(e){t?(clearTimeout(t),t=null,n.headerDblTap(e,i.getComponent())):t=setTimeout(function(){clearTimeout(t),t=null},300)})),"function"==typeof n.headerTapHold&&(e=null,i.element.addEventListener("touchstart",function(t){clearTimeout(e),e=setTimeout(function(){clearTimeout(e),e=null,o=!1,n.headerTapHold(t,i.getComponent())},1e3)},{passive:!0}),i.element.addEventListener("touchend",function(t){clearTimeout(e),e=null})),"function"==typeof n.cellClick&&(i.cellEvents.cellClick=n.cellClick),"function"==typeof n.cellDblClick&&(i.cellEvents.cellDblClick=n.cellDblClick),"function"==typeof n.cellContext&&(i.cellEvents.cellContext=n.cellContext),"function"==typeof n.cellMouseEnter&&(i.cellEvents.cellMouseEnter=n.cellMouseEnter),"function"==typeof n.cellMouseLeave&&(i.cellEvents.cellMouseLeave=n.cellMouseLeave),"function"==typeof n.cellMouseOver&&(i.cellEvents.cellMouseOver=n.cellMouseOver),"function"==typeof n.cellMouseOut&&(i.cellEvents.cellMouseOut=n.cellMouseOut),"function"==typeof n.cellMouseMove&&(i.cellEvents.cellMouseMove=n.cellMouseMove),"function"==typeof n.cellTap&&(i.cellEvents.cellTap=n.cellTap),"function"==typeof n.cellDblTap&&(i.cellEvents.cellDblTap=n.cellDblTap),"function"==typeof n.cellTapHold&&(i.cellEvents.cellTapHold=n.cellTapHold),"function"==typeof n.cellEdited&&(i.cellEvents.cellEdited=n.cellEdited),"function"==typeof n.cellEditing&&(i.cellEvents.cellEditing=n.cellEditing),"function"==typeof n.cellEditCancelled&&(i.cellEvents.cellEditCancelled=n.cellEditCancelled)},Column.prototype._buildColumnHeader=function(){var t=this,e=this.definition,o=this.table;if(o.modExists("sort")&&o.modules.sort.initializeColumn(this,this.titleHolderElement),(e.headerContextMenu||e.headerClickMenu||e.headerMenu)&&o.modExists("menu")&&o.modules.menu.initializeColumnHeader(this),o.modExists("format")&&o.modules.format.initializeColumn(this),void 0!==e.editor&&o.modExists("edit")&&o.modules.edit.initializeColumn(this),void 0!==e.validator&&o.modExists("validate")&&o.modules.validate.initializeColumn(this),o.modExists("mutator")&&o.modules.mutator.initializeColumn(this),o.modExists("accessor")&&o.modules.accessor.initializeColumn(this),_typeof(o.options.responsiveLayout)&&o.modExists("responsiveLayout")&&o.modules.responsiveLayout.initializeColumn(this),void 0!==e.visible&&(e.visible?this.show(!0):this.hide(!0)),e.cssClass){e.cssClass.split(" ").forEach(function(e){t.element.classList.add(e)})}e.field&&this.element.setAttribute("tabulator-field",e.field),this.setMinWidth(void 0===e.minWidth?this.table.options.columnMinWidth:parseInt(e.minWidth)),this.reinitializeWidth(),this.tooltip=this.definition.tooltip||!1===this.definition.tooltip?this.definition.tooltip:this.table.options.tooltips,this.hozAlign=void 0===this.definition.hozAlign?this.table.options.cellHozAlign:this.definition.hozAlign,this.vertAlign=void 0===this.definition.vertAlign?this.table.options.cellVertAlign:this.definition.vertAlign,this.titleElement.style.textAlign=this.definition.headerHozAlign||this.table.options.headerHozAlign},Column.prototype._buildColumnHeaderContent=function(){var t=(this.definition,this.table,document.createElement("div"));return t.classList.add("tabulator-col-content"),this.titleHolderElement=document.createElement("div"),this.titleHolderElement.classList.add("tabulator-col-title-holder"),t.appendChild(this.titleHolderElement),this.titleElement=this._buildColumnHeaderTitle(),this.titleHolderElement.appendChild(this.titleElement),t},Column.prototype._buildColumnHeaderTitle=function(){var t=this,e=t.definition,o=t.table,i=document.createElement("div");if(i.classList.add("tabulator-col-title"),e.editableTitle){var n=document.createElement("input");n.classList.add("tabulator-title-editor"),n.addEventListener("click",function(t){t.stopPropagation(),n.focus()}),n.addEventListener("change",function(){e.title=n.value,o.options.columnTitleChanged.call(t.table,t.getComponent())}),i.appendChild(n),e.field?o.modules.localize.bind("columns|"+e.field,function(t){n.value=t||e.title||" "}):n.value=e.title||" "}else e.field?o.modules.localize.bind("columns|"+e.field,function(o){t._formatColumnHeaderTitle(i,o||e.title||" ")}):t._formatColumnHeaderTitle(i,e.title||" ");return i},Column.prototype._formatColumnHeaderTitle=function(t,e){var o,i,n,l,s,a=this;if(this.definition.titleFormatter&&this.table.modExists("format"))switch(o=this.table.modules.format.getFormatter(this.definition.titleFormatter),s=function(t){a.titleFormatterRendered=t},l={getValue:function(){return e},getElement:function(){return t}},n=this.definition.titleFormatterParams||{},n="function"==typeof n?n():n,i=o.call(this.table.modules.format,l,n,s),void 0===i?"undefined":_typeof(i)){case"object":i instanceof Node?t.appendChild(i):(t.innerHTML="",console.warn("Format Error - Title formatter has returned a type of object, the only valid formatter object return is an instance of Node, the formatter returned:",i));break;case"undefined":case"null":t.innerHTML="";break;default:t.innerHTML=i}else t.innerHTML=e},Column.prototype._buildGroupHeader=function(){var t=this;if(this.element.classList.add("tabulator-col-group"),this.element.setAttribute("role","columngroup"),this.element.setAttribute("aria-title",this.definition.title),this.definition.cssClass){this.definition.cssClass.split(" ").forEach(function(e){t.element.classList.add(e)})}(this.definition.headerContextMenu||this.definition.headerMenu)&&this.table.modExists("menu")&&this.table.modules.menu.initializeColumnHeader(this),this.element.appendChild(this.groupElement)},Column.prototype._getFlatData=function(t){return t[this.field]},Column.prototype._getNestedData=function(t){for(var e,o=t,i=this.fieldStructure,n=i.length,l=0;l-1&&this._nextVisibleColumn(t+1)},Column.prototype._nextVisibleColumn=function(t){var e=this.table.columnManager.getColumnByIndex(t);return!e||e.visible?e:this._nextVisibleColumn(t+1)},Column.prototype.prevColumn=function(){var t=this.table.columnManager.findColumnIndex(this);return t>-1&&this._prevVisibleColumn(t-1)},Column.prototype._prevVisibleColumn=function(t){var e=this.table.columnManager.getColumnByIndex(t);return!e||e.visible?e:this._prevVisibleColumn(t-1)},Column.prototype.reinitializeWidth=function(t){this.widthFixed=!1,void 0===this.definition.width||t||this.setWidth(this.definition.width),this.table.modExists("filter")&&this.table.modules.filter.hideHeaderFilterElements(),this.fitToData(),this.table.modExists("filter")&&this.table.modules.filter.showHeaderFilterElements()},Column.prototype.fitToData=function(){var t=this;this.widthFixed||(this.element.style.width="",t.cells.forEach(function(t){t.clearWidth()}));var e=this.element.offsetWidth;t.width&&this.widthFixed||(t.cells.forEach(function(t){var o=t.getWidth();o>e&&(e=o)}),e&&t.setWidthActual(e+1))},Column.prototype.updateDefinition=function(t){var e=this;return new Promise(function(o,i){var n;e.isGroup?(console.warn("Column Update Error - The updateDefinition function is only available on columns, not column groups"),i("Column Update Error - The updateDefinition function is only available on columns, not column groups")):(n=Object.assign({},e.getDefinition()),n=Object.assign(n,t),e.table.columnManager.addColumn(n,!1,e).then(function(t){n.field==e.field&&(e.field=!1),e.delete().then(function(){o(t.getComponent())}).catch(function(t){i(t)})}).catch(function(t){i(t)}))})},Column.prototype.deleteCell=function(t){var e=this.cells.indexOf(t);e>-1&&this.cells.splice(e,1)},Column.prototype.defaultOptionList=["title","field","columns","visible","align","hozAlign","vertAlign","width","minWidth","widthGrow","widthShrink","resizable","frozen","responsive","tooltip","cssClass","rowHandle","hideInHtml","print","htmlOutput","sorter","sorterParams","formatter","formatterParams","variableHeight","editable","editor","editorParams","validator","mutator","mutatorParams","mutatorData","mutatorDataParams","mutatorEdit","mutatorEditParams","mutatorClipboard","mutatorClipboardParams","accessor","accessorParams","accessorData","accessorDataParams","accessorDownload","accessorDownloadParams","accessorClipboard","accessorClipboardParams","accessorPrint","accessorPrintParams","accessorHtmlOutput","accessorHtmlOutputParams","clipboard","download","downloadTitle","topCalc","topCalcParams","topCalcFormatter","topCalcFormatterParams","bottomCalc","bottomCalcParams","bottomCalcFormatter","bottomCalcFormatterParams","cellClick","cellDblClick","cellContext","cellTap","cellDblTap","cellTapHold","cellMouseEnter","cellMouseLeave","cellMouseOver","cellMouseOut","cellMouseMove","cellEditing","cellEdited","cellEditCancelled","headerSort","headerSortStartingDir","headerSortTristate","headerClick","headerDblClick","headerContext","headerTap","headerDblTap","headerTapHold","headerTooltip","headerVertical","headerHozAlign","editableTitle","titleFormatter","titleFormatterParams","headerFilter","headerFilterPlaceholder","headerFilterParams","headerFilterEmptyCheck","headerFilterFunc","headerFilterFuncParams","headerFilterLiveFilter","print","headerContextMenu","headerMenu","contextMenu","clickMenu","formatterPrint","formatterPrintParams","formatterClipboard","formatterClipboardParams","formatterHtmlOutput","formatterHtmlOutputParams","titlePrint","titleClipboard","titleHtmlOutput","titleDownload"],Column.prototype.getComponent=function(){return this.component||(this.component=new ColumnComponent(this)),this.component};var RowManager=function(t){this.table=t,this.element=this.createHolderElement(),this.tableElement=this.createTableElement(),this.heightFixer=this.createTableElement(),this.columnManager=null,this.height=0,this.firstRender=!1,this.renderMode="virtual",this.fixedHeight=!1,this.rows=[],this.activeRows=[],this.activeRowsCount=0,this.displayRows=[],this.displayRowsCount=0,this.scrollTop=0,this.scrollLeft=0,this.vDomRowHeight=20,this.vDomTop=0,this.vDomBottom=0,this.vDomScrollPosTop=0,this.vDomScrollPosBottom=0,this.vDomTopPad=0,this.vDomBottomPad=0,this.vDomMaxRenderChain=90,this.vDomWindowBuffer=0,this.vDomWindowMinTotalRows=20,this.vDomWindowMinMarginRows=5,this.vDomTopNewRows=[],this.vDomBottomNewRows=[],this.rowNumColumn=!1,this.redrawBlock=!1,this.redrawBlockRestoreConfig=!1,this.redrawBlockRederInPosition=!1};RowManager.prototype.createHolderElement=function(){var t=document.createElement("div");return t.classList.add("tabulator-tableHolder"),t.setAttribute("tabindex",0),t},RowManager.prototype.createTableElement=function(){var t=document.createElement("div");return t.classList.add("tabulator-table"),t},RowManager.prototype.getElement=function(){return this.element},RowManager.prototype.getTableElement=function(){return this.tableElement},RowManager.prototype.getRowPosition=function(t,e){return e?this.activeRows.indexOf(t):this.rows.indexOf(t)},RowManager.prototype.setColumnManager=function(t){this.columnManager=t},RowManager.prototype.initialize=function(){var t=this;t.setRenderMode(),t.element.appendChild(t.tableElement),t.firstRender=!0,t.element.addEventListener("scroll",function(){var e=t.element.scrollLeft;t.scrollLeft!=e&&(t.columnManager.scrollHorizontal(e),t.table.options.groupBy&&t.table.modules.groupRows.scrollHeaders(e),t.table.modExists("columnCalcs")&&t.table.modules.columnCalcs.scrollHorizontal(e),t.table.options.scrollHorizontal(e)),t.scrollLeft=e}),"virtual"===this.renderMode&&t.element.addEventListener("scroll",function(){var e=t.element.scrollTop,o=t.scrollTop>e;t.scrollTop!=e?(t.scrollTop=e,t.scrollVertical(o),"scroll"==t.table.options.ajaxProgressiveLoad&&t.table.modules.ajax.nextPage(t.element.scrollHeight-t.element.clientHeight-e),t.table.options.scrollVertical(e)):t.scrollTop=e})},RowManager.prototype.findRow=function(t){var e=this;if("object"!=(void 0===t?"undefined":_typeof(t))){if(void 0===t||null===t)return!1;return e.rows.find(function(o){return o.data[e.table.options.index]==t})||!1}if(t instanceof Row)return t;if(t instanceof RowComponent)return t._getSelf()||!1;if("undefined"!=typeof HTMLElement&&t instanceof HTMLElement){return e.rows.find(function(e){return e.element===t})||!1}return!1},RowManager.prototype.getRowFromDataObject=function(t){return this.rows.find(function(e){return e.data===t})||!1},RowManager.prototype.getRowFromPosition=function(t,e){return e?this.activeRows[t]:this.rows[t]},RowManager.prototype.scrollToRow=function(t,e,o){var i,n=this,l=this.getDisplayRows().indexOf(t),s=t.getElement(),a=0;return new Promise(function(t,r){if(l>-1){if(void 0===e&&(e=n.table.options.scrollToRowPosition),void 0===o&&(o=n.table.options.scrollToRowIfVisible),"nearest"===e)switch(n.renderMode){case"classic":i=Tabulator.prototype.helpers.elOffset(s).top,e=Math.abs(n.element.scrollTop-i)>Math.abs(n.element.scrollTop+n.element.clientHeight-i)?"bottom":"top";break;case"virtual":e=Math.abs(n.vDomTop-l)>Math.abs(n.vDomBottom-l)?"bottom":"top"}if(!o&&Tabulator.prototype.helpers.elVisible(s)&&(a=Tabulator.prototype.helpers.elOffset(s).top-Tabulator.prototype.helpers.elOffset(n.element).top)>0&&a-1&&this.activeRows.splice(i,1),o>-1&&this.rows.splice(o,1),this.setActiveRows(this.activeRows),this.displayRowIterator(function(e){var o=e.indexOf(t);o>-1&&e.splice(o,1)}),e||this.reRenderInPosition(),this.regenerateRowNumbers(),this.table.options.rowDeleted.call(this.table,t.getComponent()),this.table.options.dataChanged&&this.table.options.dataChanged.call(this.table,this.getData()),this.table.options.groupBy&&this.table.modExists("groupRows")?this.table.modules.groupRows.updateGroupRows(!0):this.table.options.pagination&&this.table.modExists("page")?this.refreshActiveData(!1,!1,!0):this.table.options.pagination&&this.table.modExists("page")&&this.refreshActiveData("page")},RowManager.prototype.addRow=function(t,e,o,i){var n=this.addRowActual(t,e,o,i);return this.table.options.history&&this.table.modExists("history")&&this.table.modules.history.action("rowAdd",n,{data:t,pos:e,index:o}),n},RowManager.prototype.addRows=function(t,e,o){var i=this,n=this,l=0,s=[];return new Promise(function(a,r){e=i.findAddRowPos(e),Array.isArray(t)||(t=[t]),l=t.length-1,(void 0===o&&e||void 0!==o&&!e)&&t.reverse(),t.forEach(function(t,i){var l=n.addRow(t,e,o,!0);s.push(l)}),i.table.options.groupBy&&i.table.modExists("groupRows")?i.table.modules.groupRows.updateGroupRows(!0):i.table.options.pagination&&i.table.modExists("page")?i.refreshActiveData(!1,!1,!0):i.reRenderInPosition(),i.table.modExists("columnCalcs")&&i.table.modules.columnCalcs.recalc(i.table.rowManager.activeRows),i.regenerateRowNumbers(),a(s)})},RowManager.prototype.findAddRowPos=function(t){return void 0===t&&(t=this.table.options.addRowPos),"pos"===t&&(t=!0),"bottom"===t&&(t=!1),t},RowManager.prototype.addRowActual=function(t,e,o,i){var n,l,s=t instanceof Row?t:new Row(t||{},this),a=this.findAddRowPos(e),r=-1;if(!o&&this.table.options.pagination&&"page"==this.table.options.paginationAddRow&&(l=this.getDisplayRows(),a?l.length?o=l[0]:this.activeRows.length&&(o=this.activeRows[this.activeRows.length-1],a=!1):l.length&&(o=l[l.length-1],a=!(l.length1&&(!o||o&&-1==u.indexOf(o)?a?u[0]!==s&&(o=u[0],this._moveRowInArray(s.getGroup().rows,s,o,!a)):u[u.length-1]!==s&&(o=u[u.length-1],this._moveRowInArray(s.getGroup().rows,s,o,!a)):this._moveRowInArray(s.getGroup().rows,s,o,!a))}return o&&(r=this.rows.indexOf(o)),o&&r>-1?(n=this.activeRows.indexOf(o),this.displayRowIterator(function(t){var e=t.indexOf(o);e>-1&&t.splice(a?e:e+1,0,s)}),n>-1&&this.activeRows.splice(a?n:n+1,0,s),this.rows.splice(a?r:r+1,0,s)):a?(this.displayRowIterator(function(t){t.unshift(s)}),this.activeRows.unshift(s),this.rows.unshift(s)):(this.displayRowIterator(function(t){t.push(s)}),this.activeRows.push(s),this.rows.push(s)),this.setActiveRows(this.activeRows),this.table.options.rowAdded.call(this.table,s.getComponent()),this.table.options.dataChanged&&this.table.options.dataChanged.call(this.table,this.getData()),i||this.reRenderInPosition(),s},RowManager.prototype.moveRow=function(t,e,o){this.table.options.history&&this.table.modExists("history")&&this.table.modules.history.action("rowMove",t,{posFrom:this.getRowPosition(t),posTo:this.getRowPosition(e),to:e,after:o}),this.moveRowActual(t,e,o),this.regenerateRowNumbers(),this.table.options.rowMoved.call(this.table,t.getComponent())},RowManager.prototype.moveRowActual=function(t,e,o){var i=this;if(this._moveRowInArray(this.rows,t,e,o),this._moveRowInArray(this.activeRows,t,e,o),this.displayRowIterator(function(n){i._moveRowInArray(n,t,e,o)}),this.table.options.groupBy&&this.table.modExists("groupRows")){!o&&e instanceof Group&&(e=this.table.rowManager.prevDisplayRow(t)||e);var n=e.getGroup(),l=t.getGroup();n===l?this._moveRowInArray(n.rows,t,e,o):(l&&l.removeRow(t),n.insertRow(t,e,o))}},RowManager.prototype._moveRowInArray=function(t,e,o,i){var n,l,s,a;if(e!==o&&(n=t.indexOf(e),n>-1&&(t.splice(n,1),l=t.indexOf(o),l>-1?i?t.splice(l+1,0,e):t.splice(l,0,e):t.splice(n,0,e)),t===this.getDisplayRows())){s=nn?l:n+1;for(var r=s;r<=a;r++)t[r]&&this.styleRow(t[r],r)}},RowManager.prototype.clearData=function(){this.setData([])},RowManager.prototype.getRowIndex=function(t){return this.findRowIndex(t,this.rows)},RowManager.prototype.getDisplayRowIndex=function(t){var e=this.getDisplayRows().indexOf(t);return e>-1&&e},RowManager.prototype.nextDisplayRow=function(t,e){var o=this.getDisplayRowIndex(t),i=!1;return!1!==o&&o-1)&&o},RowManager.prototype.getData=function(t,e){var o=[];return this.getRows(t).forEach(function(t){"row"==t.type&&o.push(t.getData(e||"data"))}),o},RowManager.prototype.getComponents=function(t){var e=[];return this.getRows(t).forEach(function(t){e.push(t.getComponent())}),e},RowManager.prototype.getDataCount=function(t){return this.getRows(t).length},RowManager.prototype._genRemoteRequest=function(){var t=this,e=this.table,o=e.options,i={};if(e.modExists("page")){if(o.ajaxSorting){var n=this.table.modules.sort.getSort();n.forEach(function(t){delete t.column}),i[this.table.modules.page.paginationDataSentNames.sorters]=n}if(o.ajaxFiltering){var l=this.table.modules.filter.getFilters(!0,!0);i[this.table.modules.page.paginationDataSentNames.filters]=l}this.table.modules.ajax.setParams(i,!0)}e.modules.ajax.sendRequest().then(function(e){t._setDataActual(e,!0)}).catch(function(t){})},RowManager.prototype.filterRefresh=function(){var t=this.table,e=t.options,o=this.scrollLeft;e.ajaxFiltering?"remote"==e.pagination&&t.modExists("page")?(t.modules.page.reset(!0),t.modules.page.setPage(1).then(function(){}).catch(function(){})):e.ajaxProgressiveLoad?t.modules.ajax.loadData().then(function(){}).catch(function(){}):this._genRemoteRequest():this.refreshActiveData("filter"),this.scrollHorizontal(o)},RowManager.prototype.sorterRefresh=function(t){var e=this.table,o=this.table.options,i=this.scrollLeft;o.ajaxSorting?("remote"==o.pagination||o.progressiveLoad)&&e.modExists("page")?(e.modules.page.reset(!0),e.modules.page.setPage(1).then(function(){}).catch(function(){})):o.ajaxProgressiveLoad?e.modules.ajax.loadData().then(function(){}).catch(function(){}):this._genRemoteRequest():this.refreshActiveData(t?"filter":"sort"),this.scrollHorizontal(i)},RowManager.prototype.scrollHorizontal=function(t){this.scrollLeft=t,this.element.scrollLeft=t,this.table.options.groupBy&&this.table.modules.groupRows.scrollHeaders(t),this.table.modExists("columnCalcs")&&this.table.modules.columnCalcs.scrollHorizontal(t)},RowManager.prototype.refreshActiveData=function(t,e,o){var i,n=this,l=this.table,s=["all","filter","sort","display","freeze","group","tree","page"];if(this.redrawBlock)return void((!this.redrawBlockRestoreConfig||s.indexOf(t)=0))break;l=a}else if(e-s[a].getElement().offsetTop>=0)n=a;else{if(i=!0,!(o-s[a].getElement().offsetTop>=0))break;l=a}}else n=this.vDomTop,l=this.vDomBottom;return s.slice(n,l+1)},RowManager.prototype.displayRowIterator=function(t){this.displayRows.forEach(t),this.displayRowsCount=this.displayRows[this.displayRows.length-1].length},RowManager.prototype.getRows=function(t){var e;switch(t){case"active":e=this.activeRows;break;case"display":e=this.table.rowManager.getDisplayRows();break;case"visible":e=this.getVisibleRows(!0);break;case"selected":e=this.table.modules.selectRow.selectedRows;break;default:e=this.rows}return e},RowManager.prototype.reRenderInPosition=function(t){if("virtual"==this.getRenderMode())if(this.redrawBlock)t?t():this.redrawBlockRederInPosition=!0;else{for(var e=this.element.scrollTop,o=!1,i=!1,n=this.scrollLeft,l=this.getDisplayRows(),s=this.vDomTop;s<=this.vDomBottom;s++)if(l[s]){var a=e-l[s].getElement().offsetTop;if(!(!1===i||Math.abs(a)this.vDomWindowBuffer&&(this.vDomWindowBuffer=2*f),"group"!==m.type&&(h=!1),i.vDomBottom++,u++}t?(i.vDomTopPad=e?i.vDomRowHeight*this.vDomTop+o:i.scrollTop-r,i.vDomBottomPad=i.vDomBottom==i.displayRowsCount-1?0:Math.max(i.vDomScrollHeight-i.vDomTopPad-a-r,0)):(this.vDomTopPad=0,i.vDomRowHeight=Math.floor((a+r)/u),i.vDomBottomPad=i.vDomRowHeight*(i.displayRowsCount-i.vDomBottom-1),i.vDomScrollHeight=r+a+i.vDomBottomPad-i.height),n.style.paddingTop=i.vDomTopPad+"px",n.style.paddingBottom=i.vDomBottomPad+"px",e&&(this.scrollTop=i.vDomTopPad+r+o-(this.element.scrollWidth>this.element.clientWidth?this.element.offsetHeight-this.element.clientHeight:0)),this.scrollTop=Math.min(this.scrollTop,this.element.scrollHeight-this.height),this.element.scrollWidth>this.element.offsetWidth&&e&&(this.scrollTop+=this.element.offsetHeight-this.element.clientHeight),this.vDomScrollPosTop=this.scrollTop,this.vDomScrollPosBottom=this.scrollTop,l.scrollTop=this.scrollTop,n.style.minWidth=h?i.table.columnManager.getWidth()+"px":"",i.table.options.groupBy&&"fitDataFill"!=i.table.modules.layout.getMode()&&i.displayRowsCount==i.table.modules.groupRows.countGroups()&&(i.tableElement.style.minWidth=i.table.columnManager.getWidth())}else this.renderEmptyScroll();this.fixedHeight||this.adjustTableSize()},RowManager.prototype.scrollVertical=function(t){var e=this.scrollTop-this.vDomScrollPosTop,o=this.scrollTop-this.vDomScrollPosBottom,i=2*this.vDomWindowBuffer;if(-e>i||o>i){var n=this.scrollLeft;this._virtualRenderFill(Math.floor(this.element.scrollTop/this.element.scrollHeight*this.displayRowsCount)),this.scrollHorizontal(n)}else t?(e<0&&this._addTopRow(-e),o<0&&(this.vDomScrollHeight-this.scrollTop>this.vDomWindowBuffer?this._removeBottomRow(-o):this.vDomScrollPosBottom=this.scrollTop)):(e>=0&&(this.scrollTop>this.vDomWindowBuffer?this._removeTopRow(e):this.vDomScrollPosTop=this.scrollTop),o>=0&&this._addBottomRow(o))},RowManager.prototype._addTopRow=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,o=this.tableElement,i=this.getDisplayRows();if(this.vDomTop){var n=this.vDomTop-1,l=i[n],s=l.getHeight()||this.vDomRowHeight;t>=s&&(this.styleRow(l,n),o.insertBefore(l.getElement(),o.firstChild),l.initialized&&l.heightInitialized||(this.vDomTopNewRows.push(l),l.heightInitialized||l.clearCellHeight()),l.initialize(),this.vDomTopPad-=s,this.vDomTopPad<0&&(this.vDomTopPad=n*this.vDomRowHeight),n||(this.vDomTopPad=0),o.style.paddingTop=this.vDomTopPad+"px",this.vDomScrollPosTop-=s,this.vDomTop--),t=-(this.scrollTop-this.vDomScrollPosTop),l.getHeight()>this.vDomWindowBuffer&&(this.vDomWindowBuffer=2*l.getHeight()),e=(i[this.vDomTop-1].getHeight()||this.vDomRowHeight)?this._addTopRow(t,e+1):this._quickNormalizeRowHeight(this.vDomTopNewRows)}},RowManager.prototype._removeTopRow=function(t){var e=this.tableElement,o=this.getDisplayRows()[this.vDomTop],i=o.getHeight()||this.vDomRowHeight;if(t>=i){var n=o.getElement();n.parentNode.removeChild(n),this.vDomTopPad+=i,e.style.paddingTop=this.vDomTopPad+"px",this.vDomScrollPosTop+=this.vDomTop?i:i+this.vDomWindowBuffer,this.vDomTop++,t=this.scrollTop-this.vDomScrollPosTop,this._removeTopRow(t)}},RowManager.prototype._addBottomRow=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,o=this.tableElement,i=this.getDisplayRows();if(this.vDomBottom=s&&(this.styleRow(l,n),o.appendChild(l.getElement()),l.initialized&&l.heightInitialized||(this.vDomBottomNewRows.push(l),l.heightInitialized||l.clearCellHeight()),l.initialize(),this.vDomBottomPad-=s,(this.vDomBottomPad<0||n==this.displayRowsCount-1)&&(this.vDomBottomPad=0),o.style.paddingBottom=this.vDomBottomPad+"px",this.vDomScrollPosBottom+=s,this.vDomBottom++),t=this.scrollTop-this.vDomScrollPosBottom,l.getHeight()>this.vDomWindowBuffer&&(this.vDomWindowBuffer=2*l.getHeight()),e=(i[this.vDomBottom+1].getHeight()||this.vDomRowHeight)?this._addBottomRow(t,e+1):this._quickNormalizeRowHeight(this.vDomBottomNewRows)}},RowManager.prototype._removeBottomRow=function(t){var e=this.tableElement,o=this.getDisplayRows()[this.vDomBottom],i=o.getHeight()||this.vDomRowHeight;if(t>=i){var n=o.getElement();n.parentNode&&n.parentNode.removeChild(n),this.vDomBottomPad+=i,this.vDomBottomPad<0&&(this.vDomBottomPad=0),e.style.paddingBottom=this.vDomBottomPad+"px",this.vDomScrollPosBottom-=i,this.vDomBottom--,t=-(this.scrollTop-this.vDomScrollPosBottom),this._removeBottomRow(t) +}},RowManager.prototype._quickNormalizeRowHeight=function(t){t.forEach(function(t){t.calcHeight()}),t.forEach(function(t){t.setCellHeight()}),t.length=0},RowManager.prototype.normalizeHeight=function(){this.activeRows.forEach(function(t){t.normalizeHeight()})},RowManager.prototype.adjustTableSize=function(){var t,e=this.element.clientHeight;if("virtual"===this.renderMode){var o=Math.floor(this.columnManager.getElement().offsetHeight+(this.table.footerManager&&!this.table.footerManager.external?this.table.footerManager.getElement().offsetHeight:0));this.fixedHeight?(this.element.style.minHeight="calc(100% - "+o+"px)",this.element.style.height="calc(100% - "+o+"px)",this.element.style.maxHeight="calc(100% - "+o+"px)"):(this.element.style.height="",this.element.style.height=Math.floor(this.table.element.clientHeight)-o+"px",this.element.scrollTop=this.scrollTop),this.height=this.element.clientHeight,this.vDomWindowBuffer=this.table.options.virtualDomBuffer||this.height,this.fixedHeight||Math.floor(e)==Math.floor(this.element.clientHeight)||((t=this.table.modExists("resizeTable"))&&!this.table.modules.resizeTable.autoResize||!t)&&this.redraw()}},RowManager.prototype.reinitialize=function(){this.rows.forEach(function(t){t.reinitialize(!0)})},RowManager.prototype.blockRedraw=function(){this.redrawBlock=!0,this.redrawBlockRestoreConfig=!1},RowManager.prototype.restoreRedraw=function(){this.redrawBlock=!1,this.redrawBlockRestoreConfig?(this.refreshActiveData(this.redrawBlockRestoreConfig.stage,this.redrawBlockRestoreConfig.skipStage,this.redrawBlockRestoreConfig.renderInPosition),this.redrawBlockRestoreConfig=!1):this.redrawBlockRederInPosition&&this.reRenderInPosition(),this.redrawBlockRederInPosition=!1},RowManager.prototype.redraw=function(t){var e=this.scrollLeft;this.adjustTableSize(),this.table.tableWidth=this.table.element.clientWidth,t?this.renderTable():("classic"==this.renderMode?this.table.options.groupBy?this.refreshActiveData("group",!1,!1):this._simpleRender():(this.reRenderInPosition(),this.scrollHorizontal(e)),this.displayRowsCount||this.table.options.placeholder&&this.getElement().appendChild(this.table.options.placeholder))},RowManager.prototype.resetScroll=function(){if(this.element.scrollLeft=0,this.element.scrollTop=0,"ie"===this.table.browser){var t=document.createEvent("Event");t.initEvent("scroll",!1,!0),this.element.dispatchEvent(t)}else this.element.dispatchEvent(new Event("scroll"))};var VDomHoz=function(t){this.table=t,this.element=this.table.rowManager.tableElement,this.holderEl=this.table.rowManager.element,this.leftCol=0,this.rightCol=0,this.scrollLeft=0,this.vDomScrollPosLeft=0,this.vDomScrollPosRight=0,this.vDomPadLeft=0,this.vDomPadRight=0,this.fitDataColAvg=0,this.window=200,this.initialized=!1,this.columns=[],this.compatabilityCheck()&&this.initialize()};VDomHoz.prototype.compatabilityCheck=function(){var t=this.table.options,e=!0;return"fitDataTable"==t.layout&&(console.warn("Horizontal Vitrual DOM is not compatible with fitDataTable layout mode"),e=!1),t.responsiveLayout&&(console.warn("Horizontal Vitrual DOM is not compatible with responsive columns"),e=!1),this.table.rtl&&(console.warn("Horizontal Vitrual DOM is not currently compatible with RTL text direction"),e=!1),t.columns&&t.columns.find(function(t){return t.frozen})&&(console.warn("Horizontal Vitrual DOM is not compatible with frozen columns"),e=!1),e||(t.virtualDomHoz=!1),e},VDomHoz.prototype.initialize=function(){var t=this;this.holderEl.addEventListener("scroll",function(){var e=t.holderEl.scrollLeft;t.scrollLeft!=e&&(t.scrollLeft=e,t.scroll(e-(t.vDomScrollPosLeft+t.window)))})},VDomHoz.prototype.deinitialize=function(){this.initialized=!1},VDomHoz.prototype.clear=function(){this.columns=[],this.leftCol=-1,this.rightCol=0,this.vDomScrollPosLeft=0,this.vDomScrollPosRight=0,this.vDomPadLeft=0,this.vDomPadRight=0},VDomHoz.prototype.dataChange=function(){var t,e,o,i=!1,n=0,l=0;if("fitData"===this.table.options.layout){if(this.table.columnManager.columnsByIndex.forEach(function(t){!t.definition.width&&t.visible&&(i=!0)}),i&&i&&this.table.rowManager.getDisplayRows().length&&(this.vDomScrollPosRight=this.scrollLeft+this.holderEl.clientWidth+this.window,this.table.options.groupBy?(t=this.table.modules.groupRows.getGroups(!1)[0],e=t.getRows(!1)[0]):e=this.table.rowManager.getDisplayRows()[0],e)){o=e.getElement(),e.generateCells(),this.element.appendChild(o);for(var l=0;lthis.vDomScrollPosRight)break}for(o.parentNode.removeChild(o),this.fitDataColAvg=Math.floor(n/(l+1)),l;lo.vDomScrollPosLeft&&n.8*this.holderEl.clientWidth?this.reinitialize():t>0?(this.addColRight(),this.removeColLeft()):(this.addColLeft(),this.removeColRight())},VDomHoz.prototype.colPositionAdjust=function(t,e,o){for(var i=t;i=this.columns.length-1?this.vDomPadRight=0:this.vDomPadRight-=i.getWidth(),this.element.style.paddingRight=this.vDomPadRight+"px",this.addColRight())},VDomHoz.prototype.addColLeft=function(){var t=this.columns[this.leftCol-1];if(t&&t.modules.vdomHoz.rightPos>=this.vDomScrollPosLeft){this.table.rowManager.getVisibleRows().forEach(function(e){if("group"!==e.type){var o=e.getCell(t);e.getElement().prepend(o.getElement()),o.cellRendered()}}),this.leftCol?this.vDomPadLeft-=t.getWidth():this.vDomPadLeft=0,this.element.style.paddingLeft=this.vDomPadLeft+"px",this.leftCol--,this.addColLeft()}},VDomHoz.prototype.removeColRight=function(t){var e,t=this.columns[this.rightCol];t&&t.modules.vdomHoz.leftPos>this.vDomScrollPosRight&&(e=this.table.rowManager.getVisibleRows(),t.modules.vdomHoz.visible=!1,e.forEach(function(e){if("group"!==e.type){var o=e.getCell(t);e.getElement().removeChild(o.getElement())}}),this.vDomPadRight+=t.getWidth(),this.element.style.paddingRight=this.vDomPadRight+"px",this.rightCol--,this.removeColRight())},VDomHoz.prototype.removeColLeft=function(){var t,e=this.columns[this.leftCol];e&&e.modules.vdomHoz.rightPos-1}return!1},RowComponent.prototype.treeCollapse=function(){this._row.table.modExists("dataTree",!0)&&this._row.table.modules.dataTree.collapseRow(this._row)},RowComponent.prototype.treeExpand=function(){this._row.table.modExists("dataTree",!0)&&this._row.table.modules.dataTree.expandRow(this._row)},RowComponent.prototype.treeToggle=function(){this._row.table.modExists("dataTree",!0)&&this._row.table.modules.dataTree.toggleRow(this._row)},RowComponent.prototype.getTreeParent=function(){return!!this._row.table.modExists("dataTree",!0)&&this._row.table.modules.dataTree.getTreeParent(this._row)},RowComponent.prototype.getTreeChildren=function(){return!!this._row.table.modExists("dataTree",!0)&&this._row.table.modules.dataTree.getTreeChildren(this._row,!0)},RowComponent.prototype.addTreeChild=function(t,e,o){return!!this._row.table.modExists("dataTree",!0)&&this._row.table.modules.dataTree.addTreeChildRow(this._row,t,e,o)},RowComponent.prototype.reformat=function(){return this._row.reinitialize()},RowComponent.prototype.getGroup=function(){return this._row.getGroup().getComponent()},RowComponent.prototype.getTable=function(){return this._row.table},RowComponent.prototype.getNextRow=function(){var t=this._row.nextRow();return t?t.getComponent():t},RowComponent.prototype.getPrevRow=function(){var t=this._row.prevRow();return t?t.getComponent():t};var Row=function(t,e){var o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"row";this.table=e.table,this.parent=e,this.data={},this.type=o,this.element=this.createElement(),this.modules={},this.cells=[],this.height=0,this.heightStyled="",this.manualHeight=!1,this.outerHeight=0,this.initialized=!1,this.heightInitialized=!1,this.component=null,this.setData(t),this.generateElement()};Row.prototype.createElement=function(){var t=document.createElement("div");return t.classList.add("tabulator-row"),t.setAttribute("role","row"),t},Row.prototype.getElement=function(){return this.element},Row.prototype.detachElement=function(){this.element&&this.element.parentNode&&this.element.parentNode.removeChild(this.element)},Row.prototype.generateElement=function(){var t,e,o,i=this;!1!==i.table.options.selectable&&i.table.modExists("selectRow")&&i.table.modules.selectRow.initializeRow(this),!1!==i.table.options.movableRows&&i.table.modExists("moveRow")&&i.table.modules.moveRow.initializeRow(this),!1!==i.table.options.dataTree&&i.table.modExists("dataTree")&&i.table.modules.dataTree.initializeRow(this),"collapse"===i.table.options.responsiveLayout&&i.table.modExists("responsiveLayout")&&i.table.modules.responsiveLayout.initializeRow(this),(i.table.options.rowContextMenu||i.table.options.rowClickMenu)&&this.table.modExists("menu")&&i.table.modules.menu.initializeRow(this),i.table.options.rowClick&&i.element.addEventListener("click",function(t){i.table.options.rowClick(t,i.getComponent())}),i.table.options.rowDblClick&&i.element.addEventListener("dblclick",function(t){i.table.options.rowDblClick(t,i.getComponent())}),i.table.options.rowContext&&i.element.addEventListener("contextmenu",function(t){i.table.options.rowContext(t,i.getComponent())}),i.table.options.rowMouseEnter&&i.element.addEventListener("mouseenter",function(t){i.table.options.rowMouseEnter(t,i.getComponent())}),i.table.options.rowMouseLeave&&i.element.addEventListener("mouseleave",function(t){i.table.options.rowMouseLeave(t,i.getComponent())}),i.table.options.rowMouseOver&&i.element.addEventListener("mouseover",function(t){i.table.options.rowMouseOver(t,i.getComponent())}),i.table.options.rowMouseOut&&i.element.addEventListener("mouseout",function(t){i.table.options.rowMouseOut(t,i.getComponent())}),i.table.options.rowMouseMove&&i.element.addEventListener("mousemove",function(t){i.table.options.rowMouseMove(t,i.getComponent())}),i.table.options.rowTap&&(o=!1,i.element.addEventListener("touchstart",function(t){o=!0},{passive:!0}),i.element.addEventListener("touchend",function(t){o&&i.table.options.rowTap(t,i.getComponent()),o=!1})),i.table.options.rowDblTap&&(t=null,i.element.addEventListener("touchend",function(e){t?(clearTimeout(t),t=null,i.table.options.rowDblTap(e,i.getComponent())):t=setTimeout(function(){clearTimeout(t),t=null},300)})),i.table.options.rowTapHold&&(e=null,i.element.addEventListener("touchstart",function(t){clearTimeout(e),e=setTimeout(function(){clearTimeout(e),e=null,o=!1,i.table.options.rowTapHold(t,i.getComponent())},1e3)},{passive:!0}),i.element.addEventListener("touchend",function(t){clearTimeout(e),e=null}))},Row.prototype.generateCells=function(){this.cells=this.table.columnManager.generateCells(this)},Row.prototype.initialize=function(t){var e=this;if(!this.initialized||t){for(this.deleteCells();this.element.firstChild;)this.element.removeChild(this.element.firstChild);this.table.modExists("frozenColumns")&&this.table.modules.frozenColumns.layoutRow(this),this.generateCells(),this.table.options.virtualDomHoz&&this.table.vdomHoz.initialized?this.table.vdomHoz.initializeRow(this):this.cells.forEach(function(t){e.element.appendChild(t.getElement()),t.cellRendered()}),t&&this.normalizeHeight(),this.table.options.dataTree&&this.table.modExists("dataTree")&&this.table.modules.dataTree.layoutRow(this),"collapse"===this.table.options.responsiveLayout&&this.table.modExists("responsiveLayout")&&this.table.modules.responsiveLayout.layoutRow(this),this.table.options.rowFormatter&&this.table.options.rowFormatter(this.getComponent()),this.table.options.resizableRows&&this.table.modExists("resizeRows")&&this.table.modules.resizeRows.initializeRow(this),this.initialized=!0}else this.table.options.virtualDomHoz&&this.table.vdomHoz.reinitializeRow(this)},Row.prototype.reinitializeHeight=function(){this.heightInitialized=!1,null!==this.element.offsetParent&&this.normalizeHeight(!0)},Row.prototype.reinitialize=function(t){this.initialized=!1,this.heightInitialized=!1,this.manualHeight||(this.height=0,this.heightStyled=""),null!==this.element.offsetParent&&this.initialize(!0),this.table.options.dataTree&&this.table.modExists("dataTree",!0)&&this.table.modules.dataTree.getTreeChildren(this,!1,!0).forEach(function(t){t.reinitialize(!0)})},Row.prototype.calcHeight=function(t){var e=0,o=this.table.options.resizableRows?this.element.clientHeight:0;this.cells.forEach(function(t){var o=t.getHeight();o>e&&(e=o)}),this.height=t?Math.max(e,o):this.manualHeight?this.height:Math.max(e,o),this.heightStyled=this.height?this.height+"px":"",this.outerHeight=this.element.offsetHeight},Row.prototype.setCellHeight=function(){this.cells.forEach(function(t){t.setHeight()}),this.heightInitialized=!0},Row.prototype.clearCellHeight=function(){this.cells.forEach(function(t){t.clearHeight()})},Row.prototype.normalizeHeight=function(t){t&&this.clearCellHeight(),this.calcHeight(t),this.setCellHeight()},Row.prototype.setHeight=function(t,e){(this.height!=t||e)&&(this.manualHeight=!0,this.height=t,this.heightStyled=t?t+"px":"",this.setCellHeight(),this.outerHeight=this.element.offsetHeight)},Row.prototype.getHeight=function(){return this.outerHeight},Row.prototype.getWidth=function(){return this.element.offsetWidth},Row.prototype.deleteCell=function(t){var e=this.cells.indexOf(t);e>-1&&this.cells.splice(e,1)},Row.prototype.setData=function(t){this.table.modExists("mutator")&&(t=this.table.modules.mutator.transformRow(t,"data")),this.data=t,this.table.options.reactiveData&&this.table.modExists("reactiveData",!0)&&this.table.modules.reactiveData.watchRow(this)},Row.prototype.updateData=function(t){var e,o=this,i=Tabulator.prototype.helpers.elVisible(this.element),n={};return new Promise(function(l,s){"string"==typeof t&&(t=JSON.parse(t)),o.table.options.reactiveData&&o.table.modExists("reactiveData",!0)&&o.table.modules.reactiveData.block(),o.table.modExists("mutator")?(n=Object.assign(n,o.data),n=Object.assign(n,t),e=o.table.modules.mutator.transformRow(n,"data",t)):e=t;for(var a in e)o.data[a]=e[a];o.table.options.reactiveData&&o.table.modExists("reactiveData",!0)&&o.table.modules.reactiveData.unblock();for(var a in t){o.table.columnManager.getColumnsByFieldRoot(a).forEach(function(t){var n=o.getCell(t.getField());if(n){var l=t.getFieldValue(e);n.getValue()!=l&&(n.setValueProcessData(l),i&&n.cellRendered())}})}o.table.options.groupUpdateOnCellEdit&&o.table.options.groupBy&&o.table.modExists("groupRows")&&o.table.modules.groupRows.reassignRowToGroup(o.row),i?(o.normalizeHeight(!0),o.table.options.rowFormatter&&o.table.options.rowFormatter(o.getComponent())):(o.initialized=!1,o.height=0,o.heightStyled=""),!1!==o.table.options.dataTree&&o.table.modExists("dataTree")&&o.table.modules.dataTree.redrawNeeded(t)&&(o.table.modules.dataTree.initializeRow(o),i&&(o.table.modules.dataTree.layoutRow(o),o.table.rowManager.refreshActiveData("tree",!1,!0))),o.table.options.rowUpdated.call(o.table,o.getComponent()),o.table.options.dataChanged&&o.table.options.dataChanged.call(o.table,o.table.rowManager.getData()),l()})},Row.prototype.getData=function(t){return t&&this.table.modExists("accessor")?this.table.modules.accessor.transformRow(this,t):this.data},Row.prototype.getCell=function(t){return t=this.table.columnManager.findColumn(t),this.cells.find(function(e){return e.column===t})},Row.prototype.getCellIndex=function(t){return this.cells.findIndex(function(e){return e===t})},Row.prototype.findNextEditableCell=function(t){var e=!1;if(t0)for(var o=t-1;o>=0;o--){var i=this.cells[o],n=!0;if(i.column.modules.edit&&Tabulator.prototype.helpers.elVisible(i.getElement())&&("function"==typeof i.column.modules.edit.check&&(n=i.column.modules.edit.check(i.getComponent())),n)){e=i;break}}return e},Row.prototype.getCells=function(){return this.cells},Row.prototype.nextRow=function(){return this.table.rowManager.nextDisplayRow(this,!0)||!1},Row.prototype.prevRow=function(){return this.table.rowManager.prevDisplayRow(this,!0)||!1},Row.prototype.moveToRow=function(t,e){var o=this.table.rowManager.findRow(t);o?(this.table.rowManager.moveRowActual(this,o,!e),this.table.rowManager.refreshActiveData("display",!1,!0)):console.warn("Move Error - No matching row found:",t)},Row.prototype.validate=function(){var t=[];return this.cells.forEach(function(e){e.validate()||t.push(e.getComponent())}),!t.length||t},Row.prototype.delete=function(){var t=this;return new Promise(function(e,o){var i,n;t.table.options.history&&t.table.modExists("history")&&(t.table.options.groupBy&&t.table.modExists("groupRows")?(n=t.getGroup().rows,(i=n.indexOf(t))&&(i=n[i-1])):(i=t.table.rowManager.getRowIndex(t))&&(i=t.table.rowManager.rows[i-1]),t.table.modules.history.action("rowDelete",t,{data:t.getData(),pos:!i,index:i})),t.deleteActual(),e()})},Row.prototype.deleteActual=function(t){this.table.rowManager.getRowIndex(this);this.detatchModules(),this.table.options.reactiveData&&this.table.modExists("reactiveData",!0),this.modules.group&&this.modules.group.removeRow(this),this.table.rowManager.deleteRow(this,t),this.deleteCells(),this.initialized=!1,this.heightInitialized=!1,this.element=!1,this.table.options.dataTree&&this.table.modExists("dataTree",!0)&&this.table.modules.dataTree.rowDelete(this),this.table.modExists("columnCalcs")&&(this.table.options.groupBy&&this.table.modExists("groupRows")?this.table.modules.columnCalcs.recalcRowGroup(this):this.table.modules.columnCalcs.recalc(this.table.rowManager.activeRows))},Row.prototype.detatchModules=function(){this.table.modExists("selectRow")&&this.table.modules.selectRow._deselectRow(this,!0),this.table.modExists("edit")&&this.table.modules.edit.currentCell.row===this&&this.table.modules.edit.cancelEdit(),this.table.modExists("frozenRows")&&this.table.modules.frozenRows.detachRow(this)},Row.prototype.deleteCells=function(){for(var t=this.cells.length,e=0;e",footerElement:!1,index:"id",textDirection:"auto",keybindings:[],tabEndNewRow:!1,invalidOptionWarnings:!0,clipboard:!1,clipboardCopyStyled:!0,clipboardCopyConfig:!1,clipboardCopyFormatter:!1,clipboardCopyRowRange:"active",clipboardPasteParser:"table",clipboardPasteAction:"insert",clipboardCopied:function(){},clipboardPasted:function(){},clipboardPasteError:function(){},downloadDataFormatter:!1,downloadReady:function(t,e){return e},downloadComplete:!1,downloadConfig:{},downloadRowRange:"active",dataTree:!1,dataTreeFilter:!0,dataTreeSort:!0,dataTreeElementColumn:!1,dataTreeBranchElement:!0,dataTreeChildIndent:9,dataTreeChildField:"_children",dataTreeCollapseElement:!1,dataTreeExpandElement:!1,dataTreeStartExpanded:!1,dataTreeRowExpanded:function(){},dataTreeRowCollapsed:function(){},dataTreeChildColumnCalcs:!1,dataTreeSelectPropagate:!1,printAsHtml:!1,printFormatter:!1,printHeader:!1,printFooter:!1,printCopyStyle:!0,printStyled:!0,printVisibleRows:!0,printRowRange:"visible",printConfig:{},addRowPos:"bottom",selectable:"highlight",selectableRangeMode:"drag",selectableRollingSelection:!0,selectablePersistence:!0,selectableCheck:function(t,e){return!0},headerFilterLiveFilterDelay:300,headerFilterPlaceholder:!1,headerVisible:!0,history:!1,locale:!1,langs:{},virtualDom:!0,virtualDomBuffer:0,virtualDomHoz:!1,persistentLayout:!1,persistentSort:!1,persistentFilter:!1,persistenceID:"",persistenceMode:!0,persistenceReaderFunc:!1,persistenceWriterFunc:!1,persistence:!1,responsiveLayout:!1,responsiveLayoutCollapseStartOpen:!0,responsiveLayoutCollapseUseFormatters:!0,responsiveLayoutCollapseFormatter:!1,pagination:!1,paginationSize:!1,paginationInitialPage:1,paginationButtonCount:5,paginationSizeSelector:!1,paginationElement:!1,paginationDataSent:{},paginationDataReceived:{},paginationAddRow:"page",ajaxURL:!1,ajaxURLGenerator:!1,ajaxParams:{},ajaxConfig:"get",ajaxContentType:"form",ajaxRequestFunc:!1,ajaxLoader:!0,ajaxLoaderLoading:!1,ajaxLoaderError:!1,ajaxFiltering:!1,ajaxSorting:!1,ajaxProgressiveLoad:!1,ajaxProgressiveLoadDelay:0,ajaxProgressiveLoadScrollMargin:0,groupBy:!1,groupStartOpen:!0,groupValues:!1,groupUpdateOnCellEdit:!1,groupHeader:!1,groupHeaderPrint:null,groupHeaderClipboard:null,groupHeaderHtmlOutput:null,groupHeaderDownload:null,htmlOutputConfig:!1,movableColumns:!1,movableRows:!1,movableRowsConnectedTables:!1,movableRowsConnectedElements:!1,movableRowsSender:!1,movableRowsReceiver:"insert",movableRowsSendingStart:function(){},movableRowsSent:function(){},movableRowsSentFailed:function(){},movableRowsSendingStop:function(){},movableRowsReceivingStart:function(){},movableRowsReceived:function(){},movableRowsReceivedFailed:function(){},movableRowsReceivingStop:function(){},movableRowsElementDrop:function(){},scrollToRowPosition:"top",scrollToRowIfVisible:!0,scrollToColumnPosition:"left",scrollToColumnIfVisible:!0,rowFormatter:!1,rowFormatterPrint:null,rowFormatterClipboard:null,rowFormatterHtmlOutput:null,placeholder:!1,tableBuilding:function(){},tableBuilt:function(){},renderStarted:function(){},renderComplete:function(){},rowClick:!1,rowDblClick:!1,rowContext:!1,rowTap:!1,rowDblTap:!1,rowTapHold:!1,rowMouseEnter:!1,rowMouseLeave:!1,rowMouseOver:!1,rowMouseOut:!1,rowMouseMove:!1,rowContextMenu:!1,rowClickMenu:!1,rowAdded:function(){},rowDeleted:function(){},rowMoved:function(){},rowUpdated:function(){},rowSelectionChanged:function(){},rowSelected:function(){},rowDeselected:function(){},rowResized:function(){},cellClick:!1,cellDblClick:!1,cellContext:!1,cellTap:!1,cellDblTap:!1,cellTapHold:!1,cellMouseEnter:!1,cellMouseLeave:!1,cellMouseOver:!1,cellMouseOut:!1,cellMouseMove:!1,cellEditing:function(){},cellEdited:function(){},cellEditCancelled:function(){},columnMoved:!1,columnResized:function(){},columnTitleChanged:function(){},columnVisibilityChanged:function(){},htmlImporting:function(){},htmlImported:function(){},dataLoading:function(){},dataLoaded:function(){},dataEdited:!1,dataChanged:!1,ajaxRequesting:function(){},ajaxResponse:!1,ajaxError:function(){},dataFiltering:!1,dataFiltered:!1,dataSorting:function(){},dataSorted:function(){},groupToggleElement:"arrow",groupClosedShowCalcs:!1,dataGrouping:function(){},dataGrouped:!1,groupVisibilityChanged:function(){},groupClick:!1,groupDblClick:!1,groupContext:!1,groupContextMenu:!1,groupClickMenu:!1,groupTap:!1,groupDblTap:!1,groupTapHold:!1,columnCalcs:!0,pageLoaded:function(){},localized:function(){},validationMode:"blocking",validationFailed:function(){},historyUndo:function(){},historyRedo:function(){},scrollHorizontal:function(){},scrollVertical:function(){}},Tabulator.prototype.initializeOptions=function(t){if(!1!==t.invalidOptionWarnings)for(var e in t)void 0===this.defaultOptions[e]&&console.warn("Invalid table constructor option:",e);for(var e in this.defaultOptions)e in t?this.options[e]=t[e]:Array.isArray(this.defaultOptions[e])?this.options[e]=Object.assign([],this.defaultOptions[e]):"object"===_typeof(this.defaultOptions[e])&&null!==this.defaultOptions[e]?this.options[e]=Object.assign({},this.defaultOptions[e]):this.options[e]=this.defaultOptions[e]},Tabulator.prototype.initializeElement=function(t){return"undefined"!=typeof HTMLElement&&t instanceof HTMLElement?(this.element=t,!0):"string"==typeof t?(this.element=document.querySelector(t),!!this.element||(console.error("Tabulator Creation Error - no element found matching selector: ",t),!1)):(console.error("Tabulator Creation Error - Invalid element provided:",t),!1)},Tabulator.prototype.rtlCheck=function(){var t=window.getComputedStyle(this.element);switch(this.options.textDirection){case"auto":if("rtl"!==t.direction)break;case"rtl":this.element.classList.add("tabulator-rtl"),this.rtl=!0;break;case"ltr":this.element.classList.add("tabulator-ltr");default:this.rtl=!1}},Tabulator.prototype._mapDepricatedFunctionality=function(){(this.options.persistentLayout||this.options.persistentSort||this.options.persistentFilter)&&(this.options.persistence||(this.options.persistence={})),this.options.dataEdited&&(console.warn("DEPRECATION WARNING - dataEdited option has been deprecated, please use the dataChanged option instead"),this.options.dataChanged=this.options.dataEdited),this.options.downloadDataFormatter&&console.warn("DEPRECATION WARNING - downloadDataFormatter option has been deprecated"),void 0!==this.options.clipboardCopyHeader&&(this.options.columnHeaders=this.options.clipboardCopyHeader,console.warn("DEPRECATION WARNING - clipboardCopyHeader option has been deprecated, please use the columnHeaders property on the clipboardCopyConfig option")),!0!==this.options.printVisibleRows&&(console.warn("printVisibleRows option is deprecated, you should now use the printRowRange option"),this.options.persistence.printRowRange="active"),!0!==this.options.printCopyStyle&&(console.warn("printCopyStyle option is deprecated, you should now use the printStyled option"),this.options.persistence.printStyled=this.options.printCopyStyle),this.options.persistentLayout&&(console.warn("persistentLayout option is deprecated, you should now use the persistence option"),!0!==this.options.persistence&&void 0===this.options.persistence.columns&&(this.options.persistence.columns=!0)),this.options.persistentSort&&(console.warn("persistentSort option is deprecated, you should now use the persistence option"),!0!==this.options.persistence&&void 0===this.options.persistence.sort&&(this.options.persistence.sort=!0)),this.options.persistentFilter&&(console.warn("persistentFilter option is deprecated, you should now use the persistence option"),!0!==this.options.persistence&&void 0===this.options.persistence.filter&&(this.options.persistence.filter=!0)),this.options.columnVertAlign&&(console.warn("columnVertAlign option is deprecated, you should now use the columnHeaderVertAlign option"),this.options.columnHeaderVertAlign=this.options.columnVertAlign)},Tabulator.prototype._clearSelection=function(){this.element.classList.add("tabulator-block-select"),window.getSelection?window.getSelection().empty?window.getSelection().empty():window.getSelection().removeAllRanges&&window.getSelection().removeAllRanges():document.selection&&document.selection.empty(),this.element.classList.remove("tabulator-block-select")},Tabulator.prototype._create=function(){this._clearObjectPointers(),this._mapDepricatedFunctionality(),this.bindModules(),this.rtlCheck(),"TABLE"===this.element.tagName&&this.modExists("htmlTableImport",!0)&&this.modules.htmlTableImport.parseTable(),this.columnManager=new ColumnManager(this),this.rowManager=new RowManager(this),this.footerManager=new FooterManager(this),this.columnManager.setRowManager(this.rowManager),this.rowManager.setColumnManager(this.columnManager),this.options.virtualDomHoz&&(this.vdomHoz=new VDomHoz(this)),this._buildElement(),this._loadInitialData()},Tabulator.prototype._clearObjectPointers=function(){this.options.columns=this.options.columns.slice(0),this.options.reactiveData||(this.options.data=this.options.data.slice(0))},Tabulator.prototype._buildElement=function(){var t=this,e=this.element,o=this.modules,i=this.options;for(i.tableBuilding.call(this),e.classList.add("tabulator"),e.setAttribute("role","grid");e.firstChild;)e.removeChild(e.firstChild);i.height&&(i.height=isNaN(i.height)?i.height:i.height+"px",e.style.height=i.height),!1!==i.minHeight&&(i.minHeight=isNaN(i.minHeight)?i.minHeight:i.minHeight+"px",e.style.minHeight=i.minHeight),!1!==i.maxHeight&&(i.maxHeight=isNaN(i.maxHeight)?i.maxHeight:i.maxHeight+"px",e.style.maxHeight=i.maxHeight),this.columnManager.initialize(),this.rowManager.initialize(),this._detectBrowser(),this.modExists("layout",!0)&&o.layout.initialize(i.layout),o.localize.initialize(),!1!==i.headerFilterPlaceholder&&o.localize.setHeaderFilterPlaceholder(i.headerFilterPlaceholder);for(var n in i.langs)o.localize.installLang(n,i.langs[n]);if(o.localize.setLocale(i.locale),"string"==typeof i.placeholder){var l=document.createElement("div");l.classList.add("tabulator-placeholder");var s=document.createElement("span");s.innerHTML=i.placeholder,l.appendChild(s),i.placeholder=l}if(e.appendChild(this.columnManager.getElement()),e.appendChild(this.rowManager.getElement()),i.footerElement&&this.footerManager.activate(),i.persistence&&this.modExists("persistence",!0)&&o.persistence.initialize(),i.persistence&&this.modExists("persistence",!0)&&o.persistence.config.columns&&(i.columns=o.persistence.load("columns",i.columns)),i.movableRows&&this.modExists("moveRow")&&o.moveRow.initialize(),i.autoColumns&&this.options.data&&this.columnManager.generateColumnsFromRowData(this.options.data),this.modExists("columnCalcs")&&o.columnCalcs.initialize(),this.columnManager.setColumns(i.columns),i.dataTree&&this.modExists("dataTree",!0)&&o.dataTree.initialize(),this.modExists("frozenRows")&&this.modules.frozenRows.initialize(),(i.persistence&&this.modExists("persistence",!0)&&o.persistence.config.sort||i.initialSort)&&this.modExists("sort",!0)){var a=[];i.persistence&&this.modExists("persistence",!0)&&o.persistence.config.sort?!1===(a=o.persistence.load("sort"))&&i.initialSort&&(a=i.initialSort):i.initialSort&&(a=i.initialSort),o.sort.setSort(a)}if((i.persistence&&this.modExists("persistence",!0)&&o.persistence.config.filter||i.initialFilter)&&this.modExists("filter",!0)){var r=[];i.persistence&&this.modExists("persistence",!0)&&o.persistence.config.filter?!1===(r=o.persistence.load("filter"))&&i.initialFilter&&(r=i.initialFilter):i.initialFilter&&(r=i.initialFilter),o.filter.setFilter(r)}i.initialHeaderFilter&&this.modExists("filter",!0)&&i.initialHeaderFilter.forEach(function(e){var i=t.columnManager.findColumn(e.field);if(!i)return console.warn("Column Filter Error - No matching column found:",e.field),!1;o.filter.setHeaderFilterValue(i,e.value)}),this.modExists("ajax")&&o.ajax.initialize(),i.pagination&&this.modExists("page",!0)&&o.page.initialize(),i.groupBy&&this.modExists("groupRows",!0)&&o.groupRows.initialize(),this.modExists("keybindings")&&o.keybindings.initialize(),this.modExists("selectRow")&&o.selectRow.clearSelectionData(!0),i.autoResize&&this.modExists("resizeTable")&&o.resizeTable.initialize(),this.modExists("clipboard")&&o.clipboard.initialize(),i.printAsHtml&&this.modExists("print")&&o.print.initialize(),i.tableBuilt.call(this)},Tabulator.prototype._loadInitialData=function(){var t=this;if(t.options.pagination&&t.modExists("page"))if(t.modules.page.reset(!0,!0),"local"==t.options.pagination){if(t.options.data.length)t.rowManager.setData(t.options.data,!1,!0);else{if((t.options.ajaxURL||t.options.ajaxURLGenerator)&&t.modExists("ajax"))return void t.modules.ajax.loadData(!1,!0).then(function(){}).catch(function(){t.options.paginationInitialPage&&t.modules.page.setPage(t.options.paginationInitialPage)});t.rowManager.setData(t.options.data,!1,!0)}t.options.paginationInitialPage&&t.modules.page.setPage(t.options.paginationInitialPage)}else t.options.ajaxURL?t.modules.page.setPage(t.options.paginationInitialPage).then(function(){}).catch(function(){}):t.rowManager.setData([],!1,!0);else t.options.data.length?t.rowManager.setData(t.options.data):(t.options.ajaxURL||t.options.ajaxURLGenerator)&&t.modExists("ajax")?t.modules.ajax.loadData(!1,!0).then(function(){}).catch(function(){}):t.rowManager.setData(t.options.data,!1,!0)},Tabulator.prototype.destroy=function(){var t=this.element;for(Tabulator.prototype.comms.deregister(this),this.options.reactiveData&&this.modExists("reactiveData",!0)&&this.modules.reactiveData.unwatchData(),this.rowManager.rows.forEach(function(t){t.wipe()}),this.rowManager.rows=[],this.rowManager.activeRows=[],this.rowManager.displayRows=[],this.options.autoResize&&this.modExists("resizeTable")&&this.modules.resizeTable.clearBindings(),this.modExists("keybindings")&&this.modules.keybindings.clearBindings();t.firstChild;)t.removeChild(t.firstChild);t.classList.remove("tabulator")},Tabulator.prototype._detectBrowser=function(){var t=navigator.userAgent||navigator.vendor||window.opera;t.indexOf("Trident")>-1?(this.browser="ie",this.browserSlow=!0):t.indexOf("Edge")>-1?(this.browser="edge",this.browserSlow=!0):t.indexOf("Firefox")>-1?(this.browser="firefox",this.browserSlow=!1):(this.browser="other",this.browserSlow=!1),this.browserMobile=/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino|android|ipad|playbook|silk/i.test(t)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(t.substr(0,4))},Tabulator.prototype.blockRedraw=function(){return this.rowManager.blockRedraw()},Tabulator.prototype.restoreRedraw=function(){return this.rowManager.restoreRedraw()},Tabulator.prototype.setDataFromLocalFile=function(t){var e=this;return new Promise(function(o,i){var n=document.createElement("input");n.type="file",n.accept=t||".json,application/json",n.addEventListener("change",function(t){var l,s=n.files[0],a=new FileReader;a.readAsText(s),a.onload=function(t){try{l=JSON.parse(a.result)}catch(t){return console.warn("File Load Error - File contents is invalid JSON",t),void i(t)}e.setData(l).then(function(t){o(t)}).catch(function(t){o(t)})},a.onerror=function(t){console.warn("File Load Error - Unable to read file"),i()}}),n.click()})},Tabulator.prototype.setData=function(t,e,o){return this.modExists("ajax")&&this.modules.ajax.blockActiveRequest(),this._setData(t,e,o,!1,!0)},Tabulator.prototype._setData=function(t,e,o,i,n){var l=this;return"string"!=typeof t?t?l.rowManager.setData(t,i,n):l.modExists("ajax")&&(l.modules.ajax.getUrl||l.options.ajaxURLGenerator)?"remote"==l.options.pagination&&l.modExists("page",!0)?(l.modules.page.reset(!0,!0),l.modules.page.setPage(1)):l.modules.ajax.loadData(i,n):l.rowManager.setData([],i,n):0==t.indexOf("{")||0==t.indexOf("[")?l.rowManager.setData(JSON.parse(t),i,n):l.modExists("ajax",!0)?(e&&l.modules.ajax.setParams(e),o&&l.modules.ajax.setConfig(o),l.modules.ajax.setUrl(t),"remote"==l.options.pagination&&l.modExists("page",!0)?(l.modules.page.reset(!0,!0),l.modules.page.setPage(1)):l.modules.ajax.loadData(i,n)):void 0},Tabulator.prototype.clearData=function(){this.modExists("ajax")&&this.modules.ajax.blockActiveRequest(),this.rowManager.clearData()},Tabulator.prototype.getData=function(t){return!0===t&&(console.warn("passing a boolean to the getData function is deprecated, you should now pass the string 'active'"),t="active"),this.rowManager.getData(t)},Tabulator.prototype.getDataCount=function(t){return!0===t&&(console.warn("passing a boolean to the getDataCount function is deprecated, you should now pass the string 'active'"),t="active"),this.rowManager.getDataCount(t)},Tabulator.prototype.searchRows=function(t,e,o){if(this.modExists("filter",!0))return this.modules.filter.search("rows",t,e,o)},Tabulator.prototype.searchData=function(t,e,o){if(this.modExists("filter",!0))return this.modules.filter.search("data",t,e,o)},Tabulator.prototype.getHtml=function(t,e,o){if(this.modExists("export",!0))return this.modules.export.getHtml(t,e,o)},Tabulator.prototype.print=function(t,e,o){if(this.modExists("print",!0))return this.modules.print.printFullscreen(t,e,o)},Tabulator.prototype.getAjaxUrl=function(){if(this.modExists("ajax",!0))return this.modules.ajax.getUrl()},Tabulator.prototype.replaceData=function(t,e,o){return this.modExists("ajax")&&this.modules.ajax.blockActiveRequest(),this._setData(t,e,o,!0)},Tabulator.prototype.updateData=function(t){var e=this,o=this,i=0;return new Promise(function(n,l){e.modExists("ajax")&&e.modules.ajax.blockActiveRequest(),"string"==typeof t&&(t=JSON.parse(t)),t?t.forEach(function(t){var e=o.rowManager.findRow(t[o.options.index]);e&&(i++,e.updateData(t).then(function(){--i||n()}))}):(console.warn("Update Error - No data provided"),l("Update Error - No data provided"))})},Tabulator.prototype.addData=function(t,e,o){var i=this;return new Promise(function(n,l){i.modExists("ajax")&&i.modules.ajax.blockActiveRequest(),"string"==typeof t&&(t=JSON.parse(t)),t?i.rowManager.addRows(t,e,o).then(function(t){var e=[];t.forEach(function(t){e.push(t.getComponent())}),n(e)}):(console.warn("Update Error - No data provided"),l("Update Error - No data provided"))})},Tabulator.prototype.updateOrAddData=function(t){var e=this,o=this,i=[],n=0;return new Promise(function(l,s){e.modExists("ajax")&&e.modules.ajax.blockActiveRequest(),"string"==typeof t&&(t=JSON.parse(t)),t?t.forEach(function(t){var e=o.rowManager.findRow(t[o.options.index]);n++,e?e.updateData(t).then(function(){n--,i.push(e.getComponent()),n||l(i)}):o.rowManager.addRows(t).then(function(t){n--,i.push(t[0].getComponent()),n||l(i)})}):(console.warn("Update Error - No data provided"),s("Update Error - No data provided"))})},Tabulator.prototype.getRow=function(t){var e=this.rowManager.findRow(t);return e?e.getComponent():(console.warn("Find Error - No matching row found:",t),!1)},Tabulator.prototype.getRowFromPosition=function(t,e){var o=this.rowManager.getRowFromPosition(t,e);return o?o.getComponent():(console.warn("Find Error - No matching row found:",t),!1)},Tabulator.prototype.deleteRow=function(t){var e=this;return new Promise(function(o,i){function n(){++s==t.length&&a&&(l.rowManager.reRenderInPosition(),o())}var l=e,s=0,a=0,r=[];Array.isArray(t)||(t=[t]),t.forEach(function(t){var o=e.rowManager.findRow(t,!0);o?r.push(o):(console.warn("Delete Error - No matching row found:",t),i("Delete Error - No matching row found"),n())}),r.sort(function(t,o){return e.rowManager.rows.indexOf(t)>e.rowManager.rows.indexOf(o)?1:-1}),r.forEach(function(t){t.delete().then(function(){a++,n()}).catch(function(t){n(),i(t)})})})},Tabulator.prototype.addRow=function(t,e,o){var i=this;return new Promise(function(n,l){"string"==typeof t&&(t=JSON.parse(t)),i.rowManager.addRows(t,e,o).then(function(t){i.modExists("columnCalcs")&&i.modules.columnCalcs.recalc(i.rowManager.activeRows),n(t[0].getComponent())})})},Tabulator.prototype.updateOrAddRow=function(t,e){var o=this;return new Promise(function(i,n){var l=o.rowManager.findRow(t);"string"==typeof e&&(e=JSON.parse(e)),l?l.updateData(e).then(function(){o.modExists("columnCalcs")&&o.modules.columnCalcs.recalc(o.rowManager.activeRows),i(l.getComponent())}).catch(function(t){n(t)}):l=o.rowManager.addRows(e).then(function(t){o.modExists("columnCalcs")&&o.modules.columnCalcs.recalc(o.rowManager.activeRows),i(t[0].getComponent())}).catch(function(t){n(t)})})},Tabulator.prototype.updateRow=function(t,e){var o=this;return new Promise(function(i,n){var l=o.rowManager.findRow(t);"string"==typeof e&&(e=JSON.parse(e)),l?l.updateData(e).then(function(){i(l.getComponent())}).catch(function(t){n(t)}):(console.warn("Update Error - No matching row found:",t),n("Update Error - No matching row found"))})},Tabulator.prototype.scrollToRow=function(t,e,o){var i=this;return new Promise(function(n,l){var s=i.rowManager.findRow(t);s?i.rowManager.scrollToRow(s,e,o).then(function(){n()}).catch(function(t){l(t)}):(console.warn("Scroll Error - No matching row found:",t),l("Scroll Error - No matching row found"))})},Tabulator.prototype.moveRow=function(t,e,o){var i=this.rowManager.findRow(t);i?i.moveToRow(e,o):console.warn("Move Error - No matching row found:",t)},Tabulator.prototype.getRows=function(t){return!0===t&&(console.warn("passing a boolean to the getRows function is deprecated, you should now pass the string 'active'"),t="active"),this.rowManager.getComponents(t)},Tabulator.prototype.getRowPosition=function(t,e){var o=this.rowManager.findRow(t);return o?this.rowManager.getRowPosition(o,e):(console.warn("Position Error - No matching row found:",t),!1)},Tabulator.prototype.copyToClipboard=function(t){this.modExists("clipboard",!0)&&this.modules.clipboard.copy(t)},Tabulator.prototype.setColumns=function(t){this.columnManager.setColumns(t)},Tabulator.prototype.getColumns=function(t){return this.columnManager.getComponents(t)},Tabulator.prototype.getColumn=function(t){var e=this.columnManager.findColumn(t);return e?e.getComponent():(console.warn("Find Error - No matching column found:",t),!1)}, +Tabulator.prototype.getColumnDefinitions=function(){return this.columnManager.getDefinitionTree()},Tabulator.prototype.getColumnLayout=function(){if(this.modExists("persistence",!0))return this.modules.persistence.parseColumns(this.columnManager.getColumns())},Tabulator.prototype.setColumnLayout=function(t){return!!this.modExists("persistence",!0)&&(this.columnManager.setColumns(this.modules.persistence.mergeDefinition(this.options.columns,t)),!0)},Tabulator.prototype.showColumn=function(t){var e=this.columnManager.findColumn(t);if(!e)return console.warn("Column Show Error - No matching column found:",t),!1;e.show(),this.options.responsiveLayout&&this.modExists("responsiveLayout",!0)&&this.modules.responsiveLayout.update()},Tabulator.prototype.hideColumn=function(t){var e=this.columnManager.findColumn(t);if(!e)return console.warn("Column Hide Error - No matching column found:",t),!1;e.hide(),this.options.responsiveLayout&&this.modExists("responsiveLayout",!0)&&this.modules.responsiveLayout.update()},Tabulator.prototype.toggleColumn=function(t){var e=this.columnManager.findColumn(t);if(!e)return console.warn("Column Visibility Toggle Error - No matching column found:",t),!1;e.visible?e.hide():e.show()},Tabulator.prototype.addColumn=function(t,e,o){var i=this;return new Promise(function(n,l){var s=i.columnManager.findColumn(o);i.columnManager.addColumn(t,e,s).then(function(t){n(t.getComponent())}).catch(function(t){l(t)})})},Tabulator.prototype.deleteColumn=function(t){var e=this;return new Promise(function(o,i){var n=e.columnManager.findColumn(t);n?n.delete().then(function(){o()}).catch(function(t){i(t)}):(console.warn("Column Delete Error - No matching column found:",t),i())})},Tabulator.prototype.updateColumnDefinition=function(t,e){var o=this;return new Promise(function(i,n){var l=o.columnManager.findColumn(t);l?l.updateDefinition(e).then(function(t){i(t)}).catch(function(t){n(t)}):(console.warn("Column Update Error - No matching column found:",t),n())})},Tabulator.prototype.moveColumn=function(t,e,o){var i=this.columnManager.findColumn(t),n=this.columnManager.findColumn(e);i?n?this.columnManager.moveColumn(i,n,o):console.warn("Move Error - No matching column found:",n):console.warn("Move Error - No matching column found:",t)},Tabulator.prototype.scrollToColumn=function(t,e,o){var i=this;return new Promise(function(n,l){var s=i.columnManager.findColumn(t);s?i.columnManager.scrollToColumn(s,e,o).then(function(){n()}).catch(function(t){l(t)}):(console.warn("Scroll Error - No matching column found:",t),l("Scroll Error - No matching column found"))})},Tabulator.prototype.setLocale=function(t){this.modules.localize.setLocale(t)},Tabulator.prototype.getLocale=function(){return this.modules.localize.getLocale()},Tabulator.prototype.getLang=function(t){return this.modules.localize.getLang(t)},Tabulator.prototype.redraw=function(t){this.columnManager.redraw(t),this.rowManager.redraw(t)},Tabulator.prototype.setHeight=function(t){"classic"!==this.rowManager.renderMode?(this.options.height=isNaN(t)?t:t+"px",this.element.style.height=this.options.height,this.rowManager.setRenderMode(),this.rowManager.redraw()):console.warn("setHeight function is not available in classic render mode")},Tabulator.prototype.setSort=function(t,e){this.modExists("sort",!0)&&(this.modules.sort.setSort(t,e),this.rowManager.sorterRefresh())},Tabulator.prototype.getSorters=function(){if(this.modExists("sort",!0))return this.modules.sort.getSort()},Tabulator.prototype.clearSort=function(){this.modExists("sort",!0)&&(this.modules.sort.clear(),this.rowManager.sorterRefresh())},Tabulator.prototype.setFilter=function(t,e,o,i){this.modExists("filter",!0)&&(this.modules.filter.setFilter(t,e,o,i),this.rowManager.filterRefresh())},Tabulator.prototype.addFilter=function(t,e,o,i){this.modExists("filter",!0)&&(this.modules.filter.addFilter(t,e,o,i),this.rowManager.filterRefresh())},Tabulator.prototype.getFilters=function(t){if(this.modExists("filter",!0))return this.modules.filter.getFilters(t)},Tabulator.prototype.setHeaderFilterFocus=function(t){if(this.modExists("filter",!0)){var e=this.columnManager.findColumn(t);if(!e)return console.warn("Column Filter Focus Error - No matching column found:",t),!1;this.modules.filter.setHeaderFilterFocus(e)}},Tabulator.prototype.getHeaderFilterValue=function(t){if(this.modExists("filter",!0)){var e=this.columnManager.findColumn(t);if(e)return this.modules.filter.getHeaderFilterValue(e);console.warn("Column Filter Error - No matching column found:",t)}},Tabulator.prototype.setHeaderFilterValue=function(t,e){if(this.modExists("filter",!0)){var o=this.columnManager.findColumn(t);if(!o)return console.warn("Column Filter Error - No matching column found:",t),!1;this.modules.filter.setHeaderFilterValue(o,e)}},Tabulator.prototype.getHeaderFilters=function(){if(this.modExists("filter",!0))return this.modules.filter.getHeaderFilters()},Tabulator.prototype.removeFilter=function(t,e,o){this.modExists("filter",!0)&&(this.modules.filter.removeFilter(t,e,o),this.rowManager.filterRefresh())},Tabulator.prototype.clearFilter=function(t){this.modExists("filter",!0)&&(this.modules.filter.clearFilter(t),this.rowManager.filterRefresh())},Tabulator.prototype.clearHeaderFilter=function(){this.modExists("filter",!0)&&(this.modules.filter.clearHeaderFilter(),this.rowManager.filterRefresh())},Tabulator.prototype.selectRow=function(t){this.modExists("selectRow",!0)&&(!0===t&&(console.warn("passing a boolean to the selectRowselectRow function is deprecated, you should now pass the string 'active'"),t="active"),this.modules.selectRow.selectRows(t))},Tabulator.prototype.deselectRow=function(t){this.modExists("selectRow",!0)&&this.modules.selectRow.deselectRows(t)},Tabulator.prototype.toggleSelectRow=function(t){this.modExists("selectRow",!0)&&this.modules.selectRow.toggleRow(t)},Tabulator.prototype.getSelectedRows=function(){if(this.modExists("selectRow",!0))return this.modules.selectRow.getSelectedRows()},Tabulator.prototype.getSelectedData=function(){if(this.modExists("selectRow",!0))return this.modules.selectRow.getSelectedData()},Tabulator.prototype.getInvalidCells=function(){if(this.modExists("validate",!0))return this.modules.validate.getInvalidCells()},Tabulator.prototype.clearCellValidation=function(t){var e=this;this.modExists("validate",!0)&&(t||(t=this.modules.validate.getInvalidCells()),Array.isArray(t)||(t=[t]),t.forEach(function(t){e.modules.validate.clearValidation(t._getSelf())}))},Tabulator.prototype.validate=function(t){var e=[];return this.rowManager.rows.forEach(function(t){var o=t.validate();!0!==o&&(e=e.concat(o))}),!e.length||e},Tabulator.prototype.setMaxPage=function(t){if(!this.options.pagination||!this.modExists("page"))return!1;this.modules.page.setMaxPage(t)},Tabulator.prototype.setPage=function(t){return this.options.pagination&&this.modExists("page")?this.modules.page.setPage(t):new Promise(function(t,e){e()})},Tabulator.prototype.setPageToRow=function(t){var e=this;return new Promise(function(o,i){e.options.pagination&&e.modExists("page")?(t=e.rowManager.findRow(t),t?e.modules.page.setPageToRow(t).then(function(){o()}).catch(function(){i()}):i()):i()})},Tabulator.prototype.setPageSize=function(t){if(!this.options.pagination||!this.modExists("page"))return!1;this.modules.page.setPageSize(t),this.modules.page.setPage(1).then(function(){}).catch(function(){})},Tabulator.prototype.getPageSize=function(){if(this.options.pagination&&this.modExists("page",!0))return this.modules.page.getPageSize()},Tabulator.prototype.previousPage=function(){if(!this.options.pagination||!this.modExists("page"))return!1;this.modules.page.previousPage()},Tabulator.prototype.nextPage=function(){if(!this.options.pagination||!this.modExists("page"))return!1;this.modules.page.nextPage()},Tabulator.prototype.getPage=function(){return!(!this.options.pagination||!this.modExists("page"))&&this.modules.page.getPage()},Tabulator.prototype.getPageMax=function(){return!(!this.options.pagination||!this.modExists("page"))&&this.modules.page.getPageMax()},Tabulator.prototype.setGroupBy=function(t){if(!this.modExists("groupRows",!0))return!1;this.options.groupBy=t,this.modules.groupRows.initialize(),this.rowManager.refreshActiveData("display"),this.options.persistence&&this.modExists("persistence",!0)&&this.modules.persistence.config.group&&this.modules.persistence.save("group")},Tabulator.prototype.setGroupValues=function(t){if(!this.modExists("groupRows",!0))return!1;this.options.groupValues=t,this.modules.groupRows.initialize(),this.rowManager.refreshActiveData("display"),this.options.persistence&&this.modExists("persistence",!0)&&this.modules.persistence.config.group&&this.modules.persistence.save("group")},Tabulator.prototype.setGroupStartOpen=function(t){if(!this.modExists("groupRows",!0))return!1;this.options.groupStartOpen=t,this.modules.groupRows.initialize(),this.options.groupBy?(this.rowManager.refreshActiveData("group"),this.options.persistence&&this.modExists("persistence",!0)&&this.modules.persistence.config.group&&this.modules.persistence.save("group")):console.warn("Grouping Update - cant refresh view, no groups have been set")},Tabulator.prototype.setGroupHeader=function(t){if(!this.modExists("groupRows",!0))return!1;this.options.groupHeader=t,this.modules.groupRows.initialize(),this.options.groupBy?(this.rowManager.refreshActiveData("group"),this.options.persistence&&this.modExists("persistence",!0)&&this.modules.persistence.config.group&&this.modules.persistence.save("group")):console.warn("Grouping Update - cant refresh view, no groups have been set")},Tabulator.prototype.getGroups=function(t){return!!this.modExists("groupRows",!0)&&this.modules.groupRows.getGroups(!0)},Tabulator.prototype.getGroupedData=function(){if(this.modExists("groupRows",!0))return this.options.groupBy?this.modules.groupRows.getGroupedData():this.getData()},Tabulator.prototype.getEditedCells=function(){if(this.modExists("edit",!0))return this.modules.edit.getEditedCells()},Tabulator.prototype.clearCellEdited=function(t){var e=this;this.modExists("edit",!0)&&(t||(t=this.modules.edit.getEditedCells()),Array.isArray(t)||(t=[t]),t.forEach(function(t){e.modules.edit.clearEdited(t._getSelf())}))},Tabulator.prototype.getCalcResults=function(){return!!this.modExists("columnCalcs",!0)&&this.modules.columnCalcs.getResults()},Tabulator.prototype.recalc=function(){this.modExists("columnCalcs",!0)&&this.modules.columnCalcs.recalcAll(this.rowManager.activeRows)},Tabulator.prototype.navigatePrev=function(){var t=!1;return!(!this.modExists("edit",!0)||!(t=this.modules.edit.currentCell))&&t.nav().prev()},Tabulator.prototype.navigateNext=function(){var t=!1;return!(!this.modExists("edit",!0)||!(t=this.modules.edit.currentCell))&&t.nav().next()},Tabulator.prototype.navigateLeft=function(){var t=!1;return!(!this.modExists("edit",!0)||!(t=this.modules.edit.currentCell))&&(e.preventDefault(),t.nav().left())},Tabulator.prototype.navigateRight=function(){var t=!1;return!(!this.modExists("edit",!0)||!(t=this.modules.edit.currentCell))&&(e.preventDefault(),t.nav().right())},Tabulator.prototype.navigateUp=function(){var t=!1;return!(!this.modExists("edit",!0)||!(t=this.modules.edit.currentCell))&&(e.preventDefault(),t.nav().up())},Tabulator.prototype.navigateDown=function(){var t=!1;return!(!this.modExists("edit",!0)||!(t=this.modules.edit.currentCell))&&(e.preventDefault(),t.nav().down())},Tabulator.prototype.undo=function(){return!(!this.options.history||!this.modExists("history",!0))&&this.modules.history.undo()},Tabulator.prototype.redo=function(){return!(!this.options.history||!this.modExists("history",!0))&&this.modules.history.redo()},Tabulator.prototype.getHistoryUndoSize=function(){return!(!this.options.history||!this.modExists("history",!0))&&this.modules.history.getHistoryUndoSize()},Tabulator.prototype.getHistoryRedoSize=function(){return!(!this.options.history||!this.modExists("history",!0))&&this.modules.history.getHistoryRedoSize()},Tabulator.prototype.download=function(t,e,o,i){this.modExists("download",!0)&&this.modules.download.download(t,e,o,i)},Tabulator.prototype.downloadToTab=function(t,e,o,i){this.modExists("download",!0)&&this.modules.download.download(t,e,o,i,!0)},Tabulator.prototype.tableComms=function(t,e,o,i){this.modules.comms.receive(t,e,o,i)},Tabulator.prototype.moduleBindings={},Tabulator.prototype.extendModule=function(t,e,o){if(Tabulator.prototype.moduleBindings[t]){var i=Tabulator.prototype.moduleBindings[t].prototype[e];if(i)if("object"==(void 0===o?"undefined":_typeof(o)))for(var n in o)i[n]=o[n];else console.warn("Module Error - Invalid value type, it must be an object");else console.warn("Module Error - property does not exist:",e)}else console.warn("Module Error - module does not exist:",t)},Tabulator.prototype.registerModule=function(t,e){Tabulator.prototype.moduleBindings[t]=e},Tabulator.prototype.bindModules=function(){this.modules={};for(var t in Tabulator.prototype.moduleBindings)this.modules[t]=new Tabulator.prototype.moduleBindings[t](this)},Tabulator.prototype.modExists=function(t,e){return!!this.modules[t]||(e&&console.error("Tabulator Module Not Installed: "+t),!1)},Tabulator.prototype.helpers={elVisible:function(t){return!(t.offsetWidth<=0&&t.offsetHeight<=0)},elOffset:function(t){var e=t.getBoundingClientRect();return{top:e.top+window.pageYOffset-document.documentElement.clientTop,left:e.left+window.pageXOffset-document.documentElement.clientLeft}},deepClone:function(t){var e=Object.assign(Array.isArray(t)?[]:{},t);for(var o in t)null!=t[o]&&"object"===_typeof(t[o])&&(t[o]instanceof Date?e[o]=new Date(t[o]):e[o]=this.deepClone(t[o]));return e}},Tabulator.prototype.comms={tables:[],register:function(t){Tabulator.prototype.comms.tables.push(t)},deregister:function(t){var e=Tabulator.prototype.comms.tables.indexOf(t);e>-1&&Tabulator.prototype.comms.tables.splice(e,1)},lookupTable:function(t,e){var o,i,n=[];if("string"==typeof t){if(o=document.querySelectorAll(t),o.length)for(var l=0;l0?l.setWidth(n):l.reinitializeWidth()):this.table.options.responsiveLayout&&this.table.modExists("responsiveLayout",!0)&&this.table.modules.responsiveLayout.update()},fitColumns:function(t){function e(t){return"string"==typeof t?t.indexOf("%")>-1?n/100*parseInt(t):parseInt(t):t}function o(t,i,n,l){function s(t){return n*(t.column.definition.widthGrow||1)}function a(t){return e(t.width)-n*(t.column.definition.widthShrink||0)}var r=[],u=0,h=0,c=0,d=0,p=0,m=[];return t.forEach(function(t,e){var o=l?a(t):s(t);t.column.minWidth>=o?r.push(t):(m.push(t),p+=l?t.column.definition.widthShrink||1:t.column.definition.widthGrow||1)}),r.length?(r.forEach(function(t){u+=l?t.width-t.column.minWidth:t.column.minWidth,t.width=t.column.minWidth}),h=i-u,c=p?Math.floor(h/p):h,d=h-c*p,d+=o(m,h,c,l)):(d=p?i-Math.floor(i/p)*p:i,m.forEach(function(t){t.width=l?a(t):s(t)})),d}var i=this,n=i.table.element.clientWidth,l=0,s=0,a=0,r=0,u=[],h=[],c=0,d=0,p=0;this.table.options.responsiveLayout&&this.table.modExists("responsiveLayout",!0)&&this.table.modules.responsiveLayout.update(),this.table.rowManager.element.scrollHeight>this.table.rowManager.element.clientHeight&&(n-=this.table.rowManager.element.offsetWidth-this.table.rowManager.element.clientWidth),t.forEach(function(t){var o,i,n;t.visible&&(o=t.definition.width,i=parseInt(t.minWidth),o?(n=e(o),l+=n>i?n:i,t.definition.widthShrink&&(h.push({column:t,width:n>i?n:i}),c+=t.definition.widthShrink)):(u.push({column:t,width:0}),a+=t.definition.widthGrow||1))}),s=n-l,r=Math.floor(s/a);var p=o(u,s,r,!1);u.length&&p>0&&(u[u.length-1].width+=+p),u.forEach(function(t){s-=t.width}),d=Math.abs(p)+s,d>0&&c&&(p=o(h,d,Math.floor(d/c),!0)),h.length&&(h[h.length-1].width-=p),u.forEach(function(t){t.column.setWidth(t.width)}),h.forEach(function(t){t.column.setWidth(t.width)})}},Tabulator.prototype.registerModule("layout",Layout);var Localize=function(t){this.table=t,this.locale="default",this.lang=!1,this.bindings={},this.langList={}};Localize.prototype.initialize=function(){this.langList=Tabulator.prototype.helpers.deepClone(this.langs)},Localize.prototype.setHeaderFilterPlaceholder=function(t){this.langList.default.headerFilters.default=t},Localize.prototype.setHeaderFilterColumnPlaceholder=function(t,e){this.langList.default.headerFilters.columns[t]=e,this.lang&&!this.lang.headerFilters.columns[t]&&(this.lang.headerFilters.columns[t]=e)},Localize.prototype.installLang=function(t,e){this.langList[t]?this._setLangProp(this.langList[t],e):this.langList[t]=e},Localize.prototype._setLangProp=function(t,e){for(var o in e)t[o]&&"object"==_typeof(t[o])?this._setLangProp(t[o],e[o]):t[o]=e[o]},Localize.prototype.setLocale=function(t){function e(t,o){for(var i in t)"object"==_typeof(t[i])?(o[i]||(o[i]={}),e(t[i],o[i])):o[i]=t[i]}var o=this;if(t=t||"default",!0===t&&navigator.language&&(t=navigator.language.toLowerCase()),t&&!o.langList[t]){var i=t.split("-")[0];o.langList[i]?(console.warn("Localization Error - Exact matching locale not found, using closest match: ",t,i),t=i):(console.warn("Localization Error - Matching locale not found, using default: ",t),t="default")}o.locale=t,o.lang=Tabulator.prototype.helpers.deepClone(o.langList.default||{}),"default"!=t&&e(o.langList[t],o.lang),o.table.options.localized.call(o.table,o.locale,o.lang),o._executeBindings()},Localize.prototype.getLocale=function(t){return self.locale},Localize.prototype.getLang=function(t){return t?this.langList[t]:this.lang},Localize.prototype.getText=function(t,e){var t=e?t+"|"+e:t,o=t.split("|");return this._getLangElement(o,this.locale)||""},Localize.prototype._getLangElement=function(t,e){var o=this,i=o.lang;return t.forEach(function(t){var e;i&&(e=i[t],i=void 0!==e&&e)}),i},Localize.prototype.bind=function(t,e){this.bindings[t]||(this.bindings[t]=[]),this.bindings[t].push(e),e(this.getText(t),this.lang)},Localize.prototype._executeBindings=function(){var t=this;for(var e in t.bindings)!function(e){t.bindings[e].forEach(function(o){o(t.getText(e),t.lang)})}(e)},Localize.prototype.langs={default:{groups:{item:"item",items:"items"},columns:{},ajax:{loading:"Loading",error:"Error"},pagination:{page_size:"Page Size",page_title:"Show Page",first:"First",first_title:"First Page",last:"Last",last_title:"Last Page",prev:"Prev",prev_title:"Prev Page",next:"Next",next_title:"Next Page",all:"All"},headerFilters:{default:"filter column...",columns:{}}}},Tabulator.prototype.registerModule("localize",Localize);var Comms=function(t){this.table=t};Comms.prototype.getConnections=function(t){var e,o=this,i=[];return e=Tabulator.prototype.comms.lookupTable(t),e.forEach(function(t){o.table!==t&&i.push(t)}),i},Comms.prototype.send=function(t,e,o,i){var n=this,l=this.getConnections(t);l.forEach(function(t){t.tableComms(n.table.element,e,o,i)}),!l.length&&t&&console.warn("Table Connection Error - No tables matching selector found",t)},Comms.prototype.receive=function(t,e,o,i){if(this.table.modExists(e))return this.table.modules[e].commsReceived(t,o,i);console.warn("Inter-table Comms Error - no such module:",e)},Tabulator.prototype.registerModule("comms",Comms); \ No newline at end of file diff --git a/website/js/vendor/tinymce/changelog.txt b/website/js/vendor/tinymce/changelog.txt new file mode 100644 index 0000000..aa08a58 --- /dev/null +++ b/website/js/vendor/tinymce/changelog.txt @@ -0,0 +1,1479 @@ +Version 5.1.5 (2019-12-19) + Fixed the UI not working with hybrid devices that accept both touch and mouse events #TNY-4521 + Fixed the `charmap` dialog initially focusing the first tab of the dialog instead of the search input field #TINY-4342 + Fixed an exception being raised when inserting content if the caret was directly before or after a `contenteditable="false"` element #TINY-4528 + Fixed a bug with pasting image URLs when paste as text is enabled #TINY-4523 +Version 5.1.4 (2019-12-11) + Fixed dialog contents disappearing when clicking a checkbox for right-to-left languages #TINY-4518 + Fixed the `legacyoutput` plugin registering legacy formats after editior initialization, causing legacy content to be stripped on the initial load #TINY-4447 + Fixed search and replace not cycling through results when searching using special characters #TINY-4506 + Fixed the `visualchars` plugin converting HTML-like text to DOM elements in certain cases #TINY-4507 + Fixed an issue with the `paste` plugin not sanitizing content in some cases #TINY-4510 + Fixed HTML comments incorrectly being parsed in certain cases #TINY-4511 +Version 5.1.3 (2019-12-04) + Fixed sticky toolbar not undocking when fullscreen mode is activated #TINY-4390 + Fixed the "Current Window" target not applying when updating links using the link dialog #TINY-4063 + Fixed disabled menu items not highlighting when focused #TINY-4339 + Fixed touch events passing through dialog collection items to the content underneath on Android devices #TINY-4431 + Fixed keyboard navigation of the Help dialog's Keyboard Navigation tab #TINY-4391 + Fixed search and replace dialog disappearing when finding offscreen matches on iOS devices #TINY-4350 + Fixed performance issues where sticky toolbar was jumping while scrolling on slower browsers #TINY-4475 +Version 5.1.2 (2019-11-19) + Fixed desktop touch devices using `mobile` configuration overrides #TINY-4345 + Fixed unable to disable the new scrolling toolbar feature #TINY-4345 + Fixed touch events passing through any pop-up items to the content underneath on Android devices #TINY-4367 + Fixed the table selector handles throwing JavaScript exceptions for non-table selections #TINY-4338 + Fixed `cut` operations not removing selected content on Android devices when the `paste` plugin is enabled #TINY-4362 + Fixed inline toolbar not constrained to the window width by default #TINY-4314 + Fixed context toolbar split button chevrons pointing right when they should be pointing down #TINY-4257 + Fixed unable to access the dialog footer in tabbed dialogs on small screens #TINY-4360 + Fixed mobile table selectors were hard to select with touch by increasing the size #TINY-4366 + Fixed mobile table selectors moving when moving outside the editor #TINY-4366 + Fixed inline toolbars collapsing when using sliding toolbars #TINY-4389 + Fixed block textpatterns not treating NBSPs as spaces #TINY-4378 + Fixed backspace not merging blocks when the last element in the preceding block was a `contenteditable="false"` element #TINY-4235 + Fixed toolbar buttons that only contain text labels overlapping on mobile devices #TINY-4395 + Fixed quickbars quickimage picker not working on mobile #TINY-4377 + Fixed fullscreen not resizing in an iOS WKWebView component #TINY-4413 +Version 5.1.1 (2019-10-28) + Fixed font formats containing spaces being wrapped in `"` entities instead of single quotes #TINY-4275 + Fixed alert and confirm dialogs losing focus when clicked #TINY-4248 + Fixed clicking outside a modal dialog focusing on the document body #TINY-4249 + Fixed the context toolbar not hiding when scrolled out of view #TINY-4265 +Version 5.1.0 (2019-10-17) + Added touch selector handles for table selections on touch devices #TINY-4097 + Added border width field to Table Cell dialog #TINY-4028 + Added touch event listener to media plugin to make embeds playable #TINY-4093 + Added oxide styling options to notifications and tweaked the default variables #TINY-4153 + Added additional padding to split button chevrons on touch devices, to make them easier to interact with #TINY-4223 + Added new platform detection functions to `Env` and deprecated older detection properties #TINY-4184 + Added `inputMode` config field to specify inputmode attribute of `input` dialog components #TINY-4062 + Added new `inputMode` property to relevant plugins/dialogs #TINY-4102 + Added new `toolbar_sticky` setting to allow the iframe menubar/toolbar to stick to the top of the window when scrolling #TINY-3982 + Changed default setting for `toolbar_drawer` to `floating` #TINY-3634 + Changed mobile phones to use the `silver` theme by default #TINY-3634 + Changed some editor settings to default to `false` on touch devices: + - `menubar`(phones only) #TINY-4077 + - `table_grid` #TINY-4075 + - `resize` #TINY-4157 + - `object_resizing` #TINY-4157 + Changed toolbars and context toolbars to sidescroll on mobile #TINY-3894 #TINY-4107 + Changed context menus to render as horizontal menus on touch devices #TINY-4107 + Changed the editor to use the `VisualViewport` API of the browser where possible #TINY-4078 + Changed visualblocks toolbar button icon and renamed `paragraph` icon to `visualchars` #TINY-4074 + Changed Oxide default for `@toolbar-button-chevron-color` to follow toolbar button icon color #TINY-4153 + Changed the `urlinput` dialog component to use the `url` type attribute #TINY-4102 + Fixed Safari desktop visual viewport fires resize on fullscreen breaking the restore function #TINY-3976 + Fixed scroll issues on mobile devices #TINY-3976 + Fixed context toolbar unable to refresh position on iOS12 #TINY-4107 + Fixed ctrl+left click not opening links on readonly mode and the preview dialog #TINY-4138 + Fixed Slider UI component not firing `onChange` event on touch devices #TINY-4092 + Fixed notifications overlapping instead of stacking #TINY-3478 + Fixed inline dialogs positioning incorrectly when the page is scrolled #TINY-4018 + Fixed inline dialogs and menus not repositioning when resizing #TINY-3227 + Fixed inline toolbar incorrectly stretching to the full width when a width value was provided #TINY-4066 + Fixed menu chevrons color to follow the menu text color #TINY-4153 + Fixed table menu selection grid from staying black when using dark skins, now follows border color #TINY-4153 + Fixed Oxide using the wrong text color variable for menubar button focused state #TINY-4146 + Fixed the autoresize plugin not keeping the selection in view when resizing #TINY-4094 + Fixed textpattern plugin throwing exceptions when using `forced_root_block: false` #TINY-4172 + Fixed missing CSS fill styles for toolbar button icon active state #TINY-4147 + Fixed an issue where the editor selection could end up inside a short ended element (such as `br`) #TINY-3999 + Fixed browser selection being lost in inline mode when opening split dropdowns #TINY-4197 + Fixed backspace throwing an exception when using `forced_root_block: false` #TINY-4099 + Fixed floating toolbar drawer expanding outside the bounds of the editor #TINY-3941 + Fixed the autocompleter not activating immediately after a `br` or `contenteditable=false` element #TINY-4194 + Fixed an issue where the autocompleter would incorrectly close on IE 11 in certain edge cases #TINY-4205 +Version 5.0.16 (2019-09-24) + Added new `referrer_policy` setting to add the `referrerpolicy` attribute when loading scripts or stylesheets #TINY-3978 + Added a slight background color to dialog tab links when focused to aid keyboard navigation #TINY-3877 + Fixed media poster value not updating on change #TINY-4013 + Fixed openlink was not registered as a toolbar button #TINY-4024 + Fixed failing to initialize if a script tag was used inside a SVG #TINY-4087 + Fixed double top border showing on toolbar without menubar when toolbar_drawer is enabled #TINY-4118 + Fixed unable to drag inline dialogs to the bottom of the screen when scrolled #TINY-4154 + Fixed notifications appearing on top of the toolbar when scrolled in inline mode #TINY-4159 + Fixed notifications displaying incorrectly on IE 11 #TINY-4169 +Version 5.0.15 (2019-09-02) + Added a dark `content_css` skin to go with the dark UI skin #TINY-3743 + Changed the enabled state on toolbar buttons so they don't get the hover effect #TINY-3974 + Fixed missing CSS active state on toolbar buttons #TINY-3966 + Fixed `onChange` callback not firing for the colorinput dialog component #TINY-3968 + Fixed context toolbars not showing in fullscreen mode #TINY-4023 +Version 5.0.14 (2019-08-19) + Added an API to reload the autocompleter menu with additional fetch metadata #MENTIONS-17 + Fixed missing toolbar button border styling options #TINY-3965 + Fixed image upload progress notification closing before the upload is complete #TINY-3963 + Fixed inline dialogs not closing on escape when no dialog component is in focus #TINY-3936 + Fixed plugins not being filtered when defaulting to mobile on phones #TINY-3537 + Fixed toolbar more drawer showing the content behind it when transitioning between opened and closed states #TINY-3878 + Fixed focus not returning to the dialog after pressing the "Replace all" button in the search and replace dialog #TINY-3961 + Removed Oxide variable `@menubar-select-disabled-border-color` and replaced it with `@menubar-select-disabled-border` #TINY-3965 +Version 5.0.13 (2019-08-06) + Changed modal dialogs to prevent dragging by default and added new `draggable_modal` setting to restore dragging #TINY-3873 + Changed the nonbreaking plugin to insert nbsp characters wrapped in spans to aid in filtering. This can be disabled using the `nonbreaking_wrap` setting #TINY-3647 + Changed backspace behaviour in lists to outdent nested list items when the cursor is at the start of the list item #TINY-3651 + Fixed sidebar growing beyond editor bounds in IE 11 #TINY-3937 + Fixed issue with being unable to keyboard navigate disabled toolbar buttons #TINY-3350 + Fixed issues with backspace and delete in nested contenteditable true and false elements #TINY-3868 + Fixed issue with losing keyboard navigation in dialogs due to disabled buttons #TINY-3914 + Fixed `MouseEvent.mozPressure is deprecated` warning in Firefox #TINY-3919 + Fixed `default_link_target` not being respected when `target_list` is disabled #TINY-3757 + Fixed mobile plugin filter to only apply to the mobile theme, rather than all mobile platforms #TINY-3405 + Fixed focus switching to another editor during mode changes #TINY-3852 + Fixed an exception being thrown when clicking on an uninitialized inline editor #TINY-3925 + Fixed unable to keyboard navigate to dialog menu buttons #TINY-3933 + Fixed dialogs being able to be dragged outside the window viewport #TINY-3787 + Fixed inline dialogs appearing above modal dialogs #TINY-3932 +Version 5.0.12 (2019-07-18) + Added ability to utilize UI dialog panels inside other panels #TINY-3305 + Added help dialog tab explaining keyboard navigation of the editor #TINY-3603 + Changed the "Find and Replace" design to an inline dialog #TINY-3054 + Fixed issue where autolink spacebar event was not being fired on Edge #TINY-3891 + Fixed table selection missing the background color #TINY-3892 + Fixed removing shortcuts not working for function keys #TINY-3871 + Fixed non-descriptive UI component type names #TINY-3349 + Fixed UI registry components rendering as the wrong type when manually specifying a different type #TINY-3385 + Fixed an issue where dialog checkbox, input, selectbox, textarea and urlinput components couldn't be disabled #TINY-3708 + Fixed the context toolbar not using viable screen space in inline/distraction free mode #TINY-3717 + Fixed the context toolbar overlapping the toolbar in various conditions #TINY-3205 + Fixed IE11 edge case where items were being inserted into the wrong location #TINY-3884 +Version 5.0.11 (2019-07-04) + Fixed packaging errors caused by a rollup treeshaking bug (https://github.com/rollup/rollup/issues/2970) #TINY-3866 + Fixed the customeditor component not able to get data from the dialog api #TINY-3866 + Fixed collection component tooltips not being translated #TINY-3855 +Version 5.0.10 (2019-07-02) + Added support for all HTML color formats in `color_map` setting #TINY-3837 + Changed backspace key handling to outdent content in appropriate circumstances #TINY-3685 + Changed default palette for forecolor and backcolor to include some lighter colors suitable for highlights #TINY-2865 + Changed the search and replace plugin to cycle through results #TINY-3800 + Fixed inconsistent types causing some properties to be unable to be used in dialog components #TINY-3778 + Fixed an issue in the Oxide skin where dialog content like outlines and shadows were clipped because of overflow hidden #TINY-3566 + Fixed the search and replace plugin not resetting state when changing the search query #TINY-3800 + Fixed backspace in lists not creating an undo level #TINY-3814 + Fixed the editor to cancel loading in quirks mode where the UI is not supported #TINY-3391 + Fixed applying fonts not working when the name contained spaces and numbers #TINY-3801 + Fixed so that initial content is retained when initializing on list items #TINY-3796 + Fixed inefficient font name and font size current value lookup during rendering #TINY-3813 + Fixed mobile font copied into the wrong folder for the oxide-dark skin #TINY-3816 + Fixed an issue where resizing the width of tables would produce inaccurate results #TINY-3827 + Fixed a memory leak in the Silver theme #TINY-3797 + Fixed alert and confirm dialogs using incorrect markup causing inconsistent padding #TINY-3835 + Fixed an issue in the Table plugin with `table_responsive_width` not enforcing units when resizing #TINY-3790 + Fixed leading, trailing and sequential spaces being lost when pasting plain text #TINY-3726 + Fixed exception being thrown when creating relative URIs #TINY-3851 + Fixed focus is no longer set to the editor content during mode changes unless the editor already had focus #TINY-3852 +Version 5.0.9 (2019-06-26) + Fixed print plugin not working in Firefox #TINY-3834 +Version 5.0.8 (2019-06-18) + Added back support for multiple toolbars #TINY-2195 + Added support for .m4a files to the media plugin #TINY-3750 + Added new base_url and suffix editor init options #TINY-3681 + Fixed incorrect padding for select boxes with visible values #TINY-3780 + Fixed selection incorrectly changing when programmatically setting selection on contenteditable false elements #TINY-3766 + Fixed sidebar background being transparent #TINY-3727 + Fixed the build to remove duplicate iife wrappers #TINY-3689 + Fixed bogus autocompleter span appearing in content when the autocompleter menu is shown #TINY-3752 + Fixed toolbar font size select not working with legacyoutput plugin #TINY-2921 + Fixed the legacyoutput plugin incorrectly aligning images #TINY-3660 + Fixed remove color not working when using the legacyoutput plugin #TINY-3756 + Fixed the font size menu applying incorrect sizes when using the legacyoutput plugin #TINY-3773 + Fixed scrollIntoView not working when the parent window was out of view #TINY-3663 + Fixed the print plugin printing from the wrong window in IE11 #TINY-3762 + Fixed content CSS loaded over CORS not loading in the preview plugin with content_css_cors enabled #TINY-3769 + Fixed the link plugin missing the default "None" option for link list #TINY-3738 + Fixed small dot visible with menubar and toolbar disabled in inline mode #TINY-3623 + Fixed space key properly inserts a nbsp before/after block elements #TINY-3745 + Fixed native context menu not showing with images in IE11 #TINY-3392 + Fixed inconsistent browser context menu image selection #TINY-3789 +Version 5.0.7 (2019-06-05) + Added new toolbar button and menu item for inserting tables via dialog #TINY-3636 + Added new API for adding/removing/changing tabs in the Help dialog #TINY-3535 + Added highlighting of matched text in autocompleter items #TINY-3687 + Added the ability for autocompleters to work with matches that include spaces #TINY-3704 + Added new `imagetools_fetch_image` callback to allow custom implementations for cors loading of images #TINY-3658 + Added `'http'` and `https` options to `link_assume_external_targets` to prepend `http://` or `https://` prefixes when URL does not contain a protocol prefix. Patch contributed by francoisfreitag. #GH-4335 + Changed annotations navigation to work the same as inline boundaries #TINY-3396 + Changed tabpanel API by adding a `name` field and changing relevant methods to use it #TINY-3535 + Fixed text color not updating all color buttons when choosing a color #TINY-3602 + Fixed the autocompleter not working with fragmented text #TINY-3459 + Fixed the autosave plugin no longer overwrites window.onbeforeunload #TINY-3688 + Fixed infinite loop in the paste plugin when IE11 takes a long time to process paste events. Patch contributed by lRawd. #GH-4987 + Fixed image handle locations when using `fixed_toolbar_container`. Patch contributed by t00. #GH-4966 + Fixed the autoresize plugin not firing `ResizeEditor` events #TINY-3587 + Fixed editor in fullscreen mode not extending to the bottom of the screen #TINY-3701 + Fixed list removal when pressing backspace after the start of the list item #TINY-3697 + Fixed autocomplete not triggering from compositionend events #TINY-3711 + Fixed `file_picker_callback` could not set the caption field on the insert image dialog #TINY-3172 + Fixed the autocompleter menu showing up after a selection had been made #TINY-3718 + Fixed an exception being thrown when a file or number input has focus during initialization. Patch contributed by t00 #GH-2194 +Version 5.0.6 (2019-05-22) + Added `icons_url` editor settings to enable icon packs to be loaded from a custom url #TINY-3585 + Added `image_uploadtab` editor setting to control the visibility of the upload tab in the image dialog #TINY-3606 + Added new api endpoints to the wordcount plugin and improved character count logic #TINY-3578 + Changed plugin, language and icon loading errors to log in the console instead of a notification #TINY-3585 + Fixed the textpattern plugin not working with fragmented text #TINY-3089 + Fixed various toolbar drawer accessibility issues and added an animation #TINY-3554 + Fixed issues with selection and ui components when toggling readonly mode #TINY-3592 + Fixed so readonly mode works with inline editors #TINY-3592 + Fixed docked inline toolbar positioning when scrolled #TINY-3621 + Fixed initial value not being set on bespoke select in quickbars and toolbar drawer #TINY-3591 + Fixed so that nbsp entities aren't trimmed in white-space: pre-line elements #TINY-3642 + Fixed `mceInsertLink` command inserting spaces instead of url encoded characters #GH-4990 + Fixed text content floating on top of dialogs in IE11 #TINY-3640 +Version 5.0.5 (2019-05-09) + Added menu items to match the forecolor/backcolor toolbar buttons #TINY-2878 + Added default directionality based on the configured language #TINY-2621 + Added styles, icons and tests for rtl mode #TINY-2621 + Fixed autoresize not working with floating elements or when media elements finished loading #TINY-3545 + Fixed incorrect vertical caret positioning in IE 11 #TINY-3188 + Fixed submenu anchoring hiding overflowed content #TINY-3564 + Removed unused and hidden validation icons to avoid displaying phantom tooltips #TINY-2329 +Version 5.0.4 (2019-04-23) + Added back URL dialog functionality, which is now available via `editor.windowManager.openUrl()` #TINY-3382 + Added the missing throbber functionality when calling `editor.setProgressState(true)` #TINY-3453 + Added function to reset the editor content and undo/dirty state via `editor.resetContent()` #TINY-3435 + Added the ability to set menu buttons as active #TINY-3274 + Added `editor.mode` API, featuring a custom editor mode API #TINY-3406 + Added better styling to floating toolbar drawer #TINY-3479 + Added the new premium plugins to the Help dialog plugins tab #TINY-3496 + Added the linkchecker context menu items to the default configuration #TINY-3543 + Fixed image context menu items showing on placeholder images #TINY-3280 + Fixed dialog labels and text color contrast within notifications/alert banners to satisfy WCAG 4.5:1 contrast ratio for accessibility #TINY-3351 + Fixed selectbox and colorpicker items not being translated #TINY-3546 + Fixed toolbar drawer sliding mode to correctly focus the editor when tabbing via keyboard navigation #TINY-3533 + Fixed positioning of the styleselect menu in iOS while using the mobile theme #TINY-3505 + Fixed the menubutton `onSetup` callback to be correctly executed when rendering the menu buttons #TINY-3547 + Fixed `default_link_target` setting to be correctly utilized when creating a link #TINY-3508 + Fixed colorpicker floating marginally outside its container #TINY-3026 + Fixed disabled menu items displaying as active when hovered #TINY-3027 + Removed redundant mobile wrapper #TINY-3480 +Version 5.0.3 (2019-03-19) + Changed empty nested-menu items within the style formats menu to be disabled or hidden if the value of `style_formats_autohide` is `true` #TINY-3310 + Changed the entire phrase 'Powered by Tiny' in the status bar to be a link instead of just the word 'Tiny' #TINY-3366 + Changed `formatselect`, `styleselect` and `align` menus to use the `mceToggleFormat` command internally #TINY-3428 + Fixed toolbar keyboard navigation to work as expected when `toolbar_drawer` is configured #TINY-3432 + Fixed text direction buttons to display the correct pressed state in selections that have no explicit `dir` property #TINY-3138 + Fixed the mobile editor to clean up properly when removed #TINY-3445 + Fixed quickbar toolbars to add an empty box to the screen when it is set to `false` #TINY-3439 + Fixed an issue where pressing the **Delete/Backspace** key at the edge of tables was creating incorrect selections #TINY-3371 + Fixed an issue where dialog collection items (emoticon and special character dialogs) couldn't be selected with touch devices #TINY-3444 + Fixed a type error introduced in TinyMCE version 5.0.2 when calling `editor.getContent()` with nested bookmarks #TINY-3400 + Fixed an issue that prevented default icons from being overridden #TINY-3449 + Fixed an issue where **Home/End** keys wouldn't move the caret correctly before or after `contenteditable=false` inline elements #TINY-2995 + Fixed styles to be preserved in IE 11 when editing via the `fullpage` plugin #TINY-3464 + Fixed the `link` plugin context toolbar missing the open link button #TINY-3461 + Fixed inconsistent dialog component spacing #TINY-3436 +Version 5.0.2 (2019-03-05) + Added presentation and document presets to `htmlpanel` dialog component #TINY-2694 + Added missing fixed_toolbar_container setting has been reimplemented in the Silver theme #TINY-2712 + Added a new toolbar setting `toolbar_drawer` that moves toolbar groups which overflow the editor width into either a `sliding` or `floating` toolbar section #TINY-2874 + Updated the build process to include package lock files in the dev distribution archive #TINY-2870 + Fixed inline dialogs did not have aria attributes #TINY-2694 + Fixed default icons are now available in the UI registry, allowing use outside of toolbar buttons #TINY-3307 + Fixed a memory leak related to select toolbar items #TINY-2874 + Fixed a memory leak due to format changed listeners that were never unbound #TINY-3191 + Fixed an issue where content may have been lost when using permanent bookmarks #TINY-3400 + Fixed the quicklink toolbar button not rendering in the quickbars plugin #TINY-3125 + Fixed an issue where menus were generating invalid HTML in some cases #TINY-3323 + Fixed an issue that could cause the mobile theme to show a blank white screen when the editor was inside an `overflow:hidden` element #TINY-3407 + Fixed mobile theme using a transparent background and not taking up the full width on iOS #TINY-3414 + Fixed the template plugin dialog missing the description field #TINY-3337 + Fixed input dialog components using an invalid default type attribute #TINY-3424 + Fixed an issue where backspace/delete keys after/before pagebreak elements wouldn't move the caret #TINY-3097 + Fixed an issue in the table plugin where menu items and toolbar buttons weren't showing correctly based on the selection #TINY-3423 + Fixed inconsistent button focus styles in Firefox #TINY-3377 + Fixed the resize icon floating left when all status bar elements were disabled #TINY-3340 + Fixed the resize handle to not show in fullscreen mode #TINY-3404 +Version 5.0.1 (2019-02-21) + Removed paste as text notification banner and paste_plaintext_inform setting #POW-102 + Fixed an issue where adding links to images would replace the image with text #TINY-3356 + Fixed an issue where the inline editor could use fractional pixels for positioning #TINY-3202 + Fixed an issue where uploading non-image files in the Image Plugin upload tab threw an error. #TINY-3244 + Added H1-H6 toggle button registration to the silver theme #TINY-3070 + Fixed an issue in the media plugin that was causing the source url and height/width to be lost in certain circumstances #TINY-2858 + Fixed an issue with the Context Toolbar not being removed when clicking outside of the editor #TINY-2804 + Fixed an issue where clicking 'Remove link' wouldn't remove the link in certain circumstances #TINY-3199 + Added code sample toolbar button will now toggle on when the cursor is in a code section #TINY-3040 + Fixed an issue where the media plugin would fail when parsing dialog data #TINY-3218 + Fixed an issue where retrieving the selected content as text didn't create newlines #TINY-3197 + Fixed incorrect keyboard shortcuts in the Help dialog for Windows #TINY-3292 + Fixed an issue where JSON serialization could produce invalid JSON #TINY-3281 + Fixed production CSS including references to source maps #TINY-3920 + Fixed development CSS was not included in the development zip #TINY-3920 + Fixed the autocompleter matches predicate not matching on the start of words by default #TINY-3306 + Added new settings to the emoticons plugin to allow additional emoticons to be added #TINY-3088 + Fixed an issue where the page could be scrolled with modal dialogs open #TINY-2252 + Fixed an issue where autocomplete menus would show an icon margin when no items had icons #TINY-3329 + Fixed an issue in the quickbars plugin where images incorrectly showed the text selection toolbar #TINY-3338 + Fixed an issue that caused the inline editor to fail to render when the target element already had focus #TINY-3353 +Version 5.0.0 (2019-02-04) + Full documentation for the version 5 features and changes is available at https://www.tiny.cloud/docs/release-notes/ + + Changes since RC2: + Fixed an issue where tab panel heights weren't sizing properly on smaller screens and weren't updating on resize #TINY-3242 + Added links and registered names with * to denote premium plugins in Plugins tab of Help dialog #TINY-3223 + Changed Tiny 5 mobile skin to look more uniform with desktop #TINY-2650 + Fixed image tools not having any padding between the label and slider #TINY-3220 + Blacklisted table, th and td as inline editor target #TINY-717 + Fixed context toolbar toggle buttons not showing the correct state #TINY-3022 + Fixed missing separators in the spellchecker context menu between the suggestions and actions #TINY-3217 + Fixed notification icon positioning in alert banners #TINY-2196 + Fixed a typo in the word count plugin name #TINY-3062 + Fixed charmap and emoticons dialogs not having a primary button #TINY-3233 + Fixed an issue where resizing wouldn't work correctly depending on the box-sizing model #TINY-3278 +Version 5.0.0-rc-2 (2019-01-22) + Fixed the link dialog such that it will now retain class attributes when updating links #TINY-2825 + Added screen reader accessibility for sidebar and statusbar #TINY-2699 + Updated Emoticons and Charmap dialogs to be screen reader accessible #TINY-2693 + Fixed "Find and replace" not showing in the "Edit" menu by default #TINY-3061 + Updated the textpattern plugin to properly support nested patterns and to allow running a command with a value for a pattern with a start and an end #TINY-2991 + Removed unnecessary 'flex' and unused 'colspan' properties from the new dialog APIs #TINY-2973 + Changed checkboxes to use a boolean for its state, instead of a string #TINY-2848 + Fixed dropdown buttons missing the 'type' attribute, which could cause forms to be incorrectly submitted #TINY-2826 + Fixed emoticon and charmap search not returning expected results in certain cases #TINY-3084 + Changed formatting menus so they are registered and made the align toolbar button use an icon instead of text #TINY-2880 + Fixed blank rel_list values throwing an exception in the link plugin #TINY-3149 +Version 5.0.0-rc-1 (2019-01-08) + Updated the font select dropdown logic to try to detect the system font stack and show "System Font" as the font name #TINY-2710 + Fixed readonly mode not fully disabling editing content #TINY-2287 + Updated the autocompleter to only show when it has matched items #TINY-2350 + Added editor settings functionality to specify title attributes for toolbar groups #TINY-2690 + Added icons instead of button text to improve Search and Replace dialog footer appearance #TINY-2654 + Added `tox-dialog__table` instead of `mce-table-striped` class to enhance Help dialog appearance #TINY-2360 + Added title attribute to iframes so, screen readers can announce iframe labels #TINY-2692 + Updated SizeInput labels to "Height" and "Width" instead of Dimensions #TINY-2833 + Fixed accessibility issues with the font select, font size, style select and format select toolbar dropdowns #TINY-2713 + Fixed accessibility issues with split dropdowns #TINY-2697 + Added a wordcount menu item, that defaults to appearing in the tools menu #TINY-2877 + Fixed the legacyoutput plugin to be compatible with TinyMCE 5.0 #TINY-2301 + Updated the build process to minify and generate ASCII only output for the emoticons database #TINY-2744 + Fixed icons not showing correctly in the autocompleter popup #TINY-3029 + Fixed an issue where preview wouldn't show anything in Edge under certain circumstances #TINY-3035 + Fixed the height being incorrectly calculated for the autoresize plugin #TINY-2807 +Version 5.0.0-beta-1 (2018-11-30) + Changed the name of the "inlite" plugin to "quickbars" #TINY-2831 + Fixed an inline mode issue where the save plugin upon saving can cause content loss #TINY-2659 + Changed the background color icon to highlight background icon #TINY-2258 + Added a new `addNestedMenuItem()` UI registry function and changed all nested menu items to use the new registry functions #TINY-2230 + Changed Help dialog to be accessible to screen readers #TINY-2687 + Changed the color swatch to save selected custom colors to local storage for use across sessions #TINY-2722 + Added title attribute to color swatch colors #TINY-2669 + Added anchorbar component to anchor inline toolbar dialogs to instead of the toolbar #TINY-2040 + Added support for toolbar and toolbar array config options to be squashed into a single toolbar and not create multiple toolbars #TINY-2195 + Added error handling for when forced_root_block config option is set to true #TINY-2261 + Added functionality for the removed_menuitems config option #TINY-2184 + Fixed an issue in IE 11 where calling selection.getContent() would return an empty string when the editor didn't have focus #TINY-2325 + Added the ability to use a string to reference menu items in menu buttons and submenu items #TINY-2253 + Removed compat3x plugin #TINY-2815 + Changed `WindowManager` API - methods `getParams`, `setParams` and `getWindows`, and the legacy `windows` property, have been removed. `alert` and `confirm` dialogs are no longer tracked in the window list. #TINY-2603 +Version 5.0.0-preview-4 (2018-11-12) + Fixed distraction free plugin #AP-470 + Removed the tox-custom-editor class that was added to the wrapping element of codemirror #TINY-2211 + Fixed contents of the input field being selected on focus instead of just recieving an outline highlight #AP-464 + Added width and height placeholder text to image and media dialog dimensions input #AP-296 + Fixed styling issues with dialogs and menus in IE 11 #AP-456 + Fixed custom style format control not honoring custom formats #AP-393 + Fixed context menu not appearing when clicking an image with a caption #AP-382 + Fixed directionality of UI when using an RTL language #AP-423 + Fixed page responsiveness with multiple inline editors #AP-430 + Added the ability to keyboard navigate through menus, toolbars, sidebar and the status bar sequentially #AP-381 + Fixed empty toolbar groups appearing through invalid configuration of the `toolbar` property #AP-450 + Fixed text not being retained when updating links through the link dialog #AP-293 + Added translation capability back to the editor's UI #AP-282 + Fixed edit image context menu, context toolbar and toolbar items being incorrectly enabled when selecting invalid images #AP-323 + Fixed emoji type ahead being shown when typing URLs #AP-366 + Fixed toolbar configuration properties incorrectly expecting string arrays instead of strings #AP-342 + Changed the editor resize handle so that it should be disabled when the autoresize plugin is turned on #AP-424 + Fixed the block formatting toolbar item not showing a "Formatting" title when there is no selection #AP-321 + Fixed clicking disabled toolbar buttons hiding the toolbar in inline mode #AP-380 + Fixed `EditorResize` event not being fired upon editor resize #AP-327 + Fixed tables losing styles when updating through the dialog #AP-368 + Fixed context toolbar positioning to be more consistent near the edges of the editor #AP-318 + Added `label` component type for dialogs to group components under a label + Fixed table of contents plugin now works with v5 toolbar APIs correctly #AP-347 + Fixed the `link_context_toolbar` configuration not disabling the context toolbar #AP-458 + Fixed the link context toolbar showing incorrect relative links #AP-435 + Fixed the alignment of the icon in alert banner dialog components #TINY-2220 + Changed UI text for microcopy improvements #TINY-2281 + Fixed the visual blocks and visual char menu options not displaying their toggled state #TINY-2238 + Fixed the editor not displaying as fullscreen when toggled #TINY-2237 +Version 5.0.0-preview-3 (2018-10-18) + Changed editor layout to use modern CSS properties over manually calculating dimensions #AP-324 + Changed `autoresize_min_height` and `autoresize_max_height` configurations to `min_height` and `max_height` #AP-324 + Fixed bugs with editor width jumping when resizing and the iframe not resizing to smaller than 150px in height #AP-324 + Fixed mobile theme bug that prevented the editor from loading #AP-404 + Fixed long toolbar groups extending outside of the editor instead of wrapping + Changed `Whole word` label in Search and Replace dialog to `Find whole words only` #AP-387 + Fixed dialog titles so they are now proper case #AP-384 + Fixed color picker default to be #000000 instead of #ff00ff #AP-216 + Fixed "match case" option on the Find and Replace dialog is no longer selected by default #AP-298 + Fixed vertical alignment of toolbar icons #DES-134 + Fixed toolbar icons not appearing on IE11 #DES-133 +Version 5.0.0-preview-2 (2018-10-10) + Changed configuration of color options has been simplified to `color_map`, `color_cols`, and `custom_colors` #AP-328 + Added swatch is now shown for colorinput fields, instead of the colorpicker directly #AP-328 + Removed `colorpicker` plugin, it is now in the theme #AP-328 + Removed `textcolor` plugin, it is now in the theme #AP-328 + Fixed styleselect not updating the displayed item as the cursor moved #AP-388 + Changed `height` configuration to apply to the editor frame (including menubar, toolbar, status bar) instead of the content area #AP-324 + Added fontformats and fontsizes menu items #AP-390 + Fixed preview iframe not expanding to the dialog size #AP-252 + Fixed 'meta' shortcuts not translated into platform-specific text #AP-270 + Fixed tabbed dialogs (Charmap and Emoticons) shrinking when no search results returned + Fixed a bug where alert banner icons were not retrieved from icon pack. #AP-330 + Fixed component styles to flex so they fill large dialogs. #AP-252 + Fixed editor flashing unstyled during load (still in progress). #AP-349 +Version 5.0.0-preview-1 (2018-10-01) + Developer preview 1 + Initial list of features and changes is available at https://tiny.cloud/docs-preview/release-notes/new-features/ +Version 4.9.3 (2019-01-31) + Added a visualchars_default_state setting to the Visualchars Plugin. Patch contributed by mat3e. + Fixed a bug where scrolling on a page with more than one editor would cause a ResizeWindow event to fire. #TINY-3247 + Fixed a bug where if a plugin threw an error during initialisation the whole editor would fail to load. #TINY-3243 + Fixed a bug where getContent would include bogus elements when valid_elements setting was set up in a specific way. #TINY-3213 + Fixed a bug where only a few function key names could be used when creating keyboard shortcuts. #TINY-3146 + Fixed a bug where it wasn't possible to enter spaces into an editor after pressing shift+enter. #TINY-3099 + Fixed a bug where no caret would be rendered after backspacing to a contenteditable false element. #TINY-2998 + Fixed a bug where deletion to/from indented lists would leave list fragments in the editor. #TINY-2981 +Version 4.9.2 (2018-12-17) + Fixed a bug with pressing the space key on IE 11 would result in nbsp characters being inserted between words at the end of a block. #TINY-2996 + Fixed a bug where character composition using quote and space on US International keyboards would produce a space instead of a quote. #TINY-2999 + Fixed a bug where remove format wouldn't remove the inner most inline element in some situations. #TINY-2982 + Fixed a bug where outdenting an list item would affect attributes on other list items within the same list. #TINY-2971 + Fixed a bug where the DomParser filters wouldn't be applied for elements created when parsing invalid html. #TINY-2978 + Fixed a bug where setProgressState wouldn't automatically close floating ui elements like menus. #TINY-2896 + Fixed a bug where it wasn't possible to navigate out of a figcaption element using the arrow keys. #TINY-2894 + Fixed a bug where enter key before an image inside a link would remove the image. #TINY-2780 +Version 4.9.1 (2018-12-04) + Added functionality to insert html to the replacement feature of the Textpattern Plugin. #TINY-2839 + Fixed a bug where `editor.selection.getContent({format: 'text'})` didn't work as expected in IE11 on an unfocused editor. #TINY-2862 + Fixed a bug in the Textpattern Plugin where the editor would get an incorrect selection after inserting a text pattern on Safari. #TINY-2838 + Fixed a bug where the space bar didn't work correctly in editors with the forced_root_block setting set to false. #TINY-2816 +Version 4.9.0 (2018-11-27) + Added a replace feature to the Textpattern Plugin. #TINY-1908 + Added functionality to the Lists Plugin that improves the indentation logic. #TINY-1790 + Fixed a bug where it wasn't possible to delete/backspace when the caret was between a contentEditable=false element and a BR. #TINY-2372 + Fixed a bug where copying table cells without a text selection would fail to copy anything. #TINY-1789 + Implemented missing `autosave_restore_when_empty` functionality in the Autosave Plugin. Patch contributed by gzzo. #GH-4447 + Reduced insertion of unnecessary nonbreaking spaces in the editor. #TINY-1879 +Version 4.8.5 (2018-10-30) + Added a content_css_cors setting to the editor that adds the crossorigin="anonymous" attribute to link tags added by the StyleSheetLoader. #TINY-1909 + Fixed a bug where trying to remove formatting with a collapsed selection range would throw an exception. #GH-4636 + Fixed a bug in the image plugin that caused updating figures to split contenteditable elements. #GH-4563 + Fixed a bug that was causing incorrect viewport calculations for fixed position UI elements. #TINY-1897 + Fixed a bug where inline formatting would cause the delete key to do nothing. #TINY-1900 +Version 4.8.4 (2018-10-23) + Added support for the HTML5 `main` element. #TINY-1877 + Changed the keyboard shortcut to move focus to contextual toolbars to Ctrl+F9. #TINY-1812 + Fixed a bug where content css could not be loaded from another domain. #TINY-1891 + Fixed a bug on FireFox where the cursor would get stuck between two contenteditable false inline elements located inside of the same block element divided by a BR. #TINY-1878 + Fixed a bug with the insertContent method where nonbreaking spaces would be inserted incorrectly. #TINY-1868 + Fixed a bug where the toolbar of the inline editor would not be visible in some scenarios. #TINY-1862 + Fixed a bug where removing the editor while more than one notification was open would throw an error. #TINY-1845 + Fixed a bug where the menubutton would be rendered on top of the menu if the viewport didn't have enough height. #TINY-1678 + Fixed a bug with the annotations api where annotating collapsed selections caused problems. #TBS-2449 + Fixed a bug where wbr elements were being transformed into whitespace when using the Paste Plugin's paste as text setting. #GH-4638 + Fixed a bug where the Search and Replace didn't replace spaces correctly. #GH-4632 + Fixed a bug with sublist items not persisting selection. #GH-4628 + Fixed a bug with mceInsertRawHTML command not working as expected. #GH-4625 +Version 4.8.3 (2018-09-13) + Fixed a bug where the Wordcount Plugin didn't correctly count words within tables on IE11. #TINY-1770 + Fixed a bug where it wasn't possible to move the caret out of a table on IE11 and Firefox. #TINY-1682 + Fixed a bug where merging empty blocks didn't work as expected, sometimes causing content to be deleted. #TINY-1781 + Fixed a bug where the Textcolor Plugin didn't show the correct current color. #TINY-1810 + Fixed a bug where clear formatting with a collapsed selection would sometimes clear formatting from more content than expected. #TINY-1813 #TINY-1821 + Fixed a bug with the Table Plugin where it wasn't possible to keyboard navigate to the caption. #TINY-1818 +Version 4.8.2 (2018-08-09) + Moved annotator from "experimental" to "annotator" object on editor. #TBS-2398 + Improved the multiclick normalization across browsers. #TINY-1788 + Fixed a bug where running getSelectedBlocks with a collapsed selection between block elements would produce incorrect results. #TINY-1787 + Fixed a bug where the ScriptLoaders loadScript method would not work as expected in FireFox when loaded on the same page as a ShadowDOM polyfill. #TINY-1786 + Removed reference to ShadowDOM event.path as Blink based browsers now support event.composedPath. #TINY-1785 + Fixed a bug where a reference to localStorage would throw an "access denied" error in IE11 with strict security settings. #TINY-1782 + Fixed a bug where pasting using the toolbar button on an inline editor in IE11 would cause a looping behaviour. #TINY-1768 +Version 4.8.1 (2018-07-26) + Fixed a bug where the content of inline editors was being cleaned on every call of `editor.save()`. #TINY-1783 + Fixed a bug where the arrow of the Inlite Theme toolbar was being rendered incorrectly in RTL mode. #TINY-1776 + Fixed a bug with the Paste Plugin where pasting after inline contenteditable false elements moved the caret to the end of the line. #TINY-1758 +Version 4.8.0 (2018-06-27) + Added new "experimental" object in editor, with initial Annotator API. #TBS-2374 + Fixed a bug where deleting paragraphs inside of table cells would delete the whole table cell. #TINY-1759 + Fixed a bug in the Table Plugin where removing row height set on the row properties dialog did not update the table. #TINY-1730 + Fixed a bug with the font select toolbar item didn't update correctly. #TINY-1683 + Fixed a bug where all bogus elements would not be deleted when removing an inline editor. #TINY-1669 +Version 4.7.13 (2018-05-16) + Fixed a bug where Edge 17 wouldn't be able to select images or tables. #TINY-1679 + Fixed issue where whitespace wasn't preserved when the editor was initialized on pre elements. #TINY-1649 + Fixed a bug with the fontselect dropdowns throwing an error if the editor was hidden in Firefox. #TINY-1664 + Fixed a bug where it wasn't possible to merge table cells on IE 11. #TINY-1671 + Fixed a bug where textcolor wasn't applying properly on IE 11 in some situations. #TINY-1663 + Fixed a bug where the justifyfull command state wasn't working correctly. #TINY-1677 + Fixed a bug where the styles wasn't updated correctly when resizing some tables. #TINY-1668 + Added missing code menu item from the default menu config. #TINY-1648 + Added new align button for combining the separate align buttons into a menu button. #TINY-1652 +Version 4.7.12 (2018-05-03) + Added an option to filter out image svg data urls. + Added support for html5 details and summary elements. + Changed so the mce-abs-layout-item css rule targets html instead of body. Patch contributed by nazar-pc. + Fixed a bug where the "read" step on the mobile theme was still present on android mobile browsers. + Fixed a bug where all images in the editor document would reload on any editor change. + Fixed a bug with the Table Plugin where ObjectResized event wasn't being triggered on column resize. + Fixed so the selection is set to the first suitable caret position after editor.setContent called. + Fixed so links with xlink:href attributes are filtered correctly to prevent XSS. + Fixed a bug on IE11 where pasting content into an inline editor initialized on a heading element would create new editable elements. + Fixed a bug where readonly mode would not work as expected when the editor contained contentEditable=true elements. + Fixed a bug where the Link Plugin would throw an error when used together with the webcomponents polyfill. Patch contributed by 4esnog. + Fixed a bug where the "Powered by TinyMCE" branding link would break on XHTML pages. Patch contributed by tistre. + Fixed a bug where the same id would be used in the blobcache for all pasted images. Patch contributed by thorn0. +Version 4.7.11 (2018-04-11) + Added a new imagetools_credentials_hosts option to the Imagetools Plugin. + Fixed a bug where toggling a list containing empty LIs would throw an error. Patch contributed by bradleyke. + Fixed a bug where applying block styles to a text with the caret at the end of the paragraph would select all text in the paragraph. + Fixed a bug where toggling on the Spellchecker Plugin would trigger isDirty on the editor. + Fixed a bug where it was possible to enter content into selection bookmark spans. + Fixed a bug where if a non paragraph block was configured in forced_root_block the editor.getContent method would return incorrect values with an empty editor. + Fixed a bug where dropdown menu panels stayed open and fixed in position when dragging dialog windows. + Fixed a bug where it wasn't possible to extend table cells with the space button in Safari. + Fixed a bug where the setupeditor event would thrown an error when using the Compat3x Plugin. + Fixed a bug where an error was thrown in FontInfo when called on a detached element. +Version 4.7.10 (2018-04-03) + Removed the "read" step from the mobile theme. + Added normalization of triple clicks across browsers in the editor. + Added a `hasFocus` method to the editor that checks if the editor has focus. + Added correct icon to the Nonbreaking Plugin menu item. + Fixed so the `getContent`/`setContent` methods work even if the editor is not initialized. + Fixed a bug with the Media Plugin where query strings were being stripped from youtube links. + Fixed a bug where image styles were changed/removed when opening and closing the Image Plugin dialog. + Fixed a bug in the Table Plugin where some table cell styles were not correctly added to the content html. + Fixed a bug in the Spellchecker Plugin where it wasn't possible to change the spellchecker language. + Fixed so the the unlink action in the Link Plugin has a menu item and can be added to the contextmenu. + Fixed a bug where it wasn't possible to keyboard navigate to the start of an inline element on a new line within the same block element. + Fixed a bug with the Text Color Plugin where if used with an inline editor located at the bottom of the screen the colorpicker could appear off screen. + Fixed a bug with the UndoManager where undo levels were being added for nbzwsp characters. + Fixed a bug with the Table Plugin where the caret would sometimes be lost when keyboard navigating up through a table. + Fixed a bug where FontInfo.getFontFamily would throw an error when called on a removed editor. + Fixed a bug in Firefox where undo levels were not being added correctly for some specific operations. + Fixed a bug where initializing an inline editor inside of a table would make the whole table resizeable. + Fixed a bug where the fake cursor that appears next to tables on Firefox was positioned incorrectly when switching to fullscreen. + Fixed a bug where zwsp's weren't trimmed from the output from `editor.getContent({ format: 'text' })`. + Fixed a bug where the fontsizeselect/fontselect toolbar items showed the body info rather than the first possible caret position info on init. + Fixed a bug where it wasn't possible to select all content if the editor only contained an inline boundary element. + Fixed a bug where `content_css` urls with query strings wasn't working. + Fixed a bug in the Table Plugin where some table row styles were removed when changing other styles in the row properties dialog. +Version 4.7.9 (2018-02-27) + Fixed a bug where the editor target element didn't get the correct style when removing the editor. +Version 4.7.8 (2018-02-26) + Fixed an issue with the Help Plugin where the menuitem name wasn't lowercase. + Fixed an issue on MacOS where text and bold text did not have the same line-height in the autocomplete dropdown in the Link Plugin dialog. + Fixed a bug where the "paste as text" option in the Paste Plugin didn't work. + Fixed a bug where dialog list boxes didn't get positioned correctly in documents with scroll. + Fixed a bug where the Inlite Theme didn't use the Table Plugin api to insert correct tables. + Fixed a bug where the Inlite Theme panel didn't hide on blur in a correct way. + Fixed a bug where placing the cursor before a table in Firefox would scroll to the bottom of the table. + Fixed a bug where selecting partial text in table cells with rowspans and deleting would produce faulty tables. + Fixed a bug where the Preview Plugin didn't work on Safari due to sandbox security. + Fixed a bug where table cell selection using the keyboard threw an error. + Fixed so the font size and font family doesn't toggle the text but only sets the selected format on the selected text. + Fixed so the built-in spellchecking on Chrome and Safari creates an undo level when replacing words. +Version 4.7.7 (2018-02-19) + Added a border style selector to the advanced tab of the Image Plugin. + Added better controls for default table inserted by the Table Plugin. + Added new `table_responsive_width` option to the Table Plugin that controls whether to use pixel or percentage widths. + Fixed a bug where the Link Plugin text didn't update when a URL was pasted using the context menu. + Fixed a bug with the Spellchecker Plugin where using "Add to dictionary" in the context menu threw an error. + Fixed a bug in the Media Plugin where the preview node for iframes got default width and height attributes that interfered with width/height styles. + Fixed a bug where backslashes were being added to some font family names in Firefox in the fontselect toolbar item. + Fixed a bug where errors would be thrown when trying to remove an editor that had not yet been fully initialized. + Fixed a bug where the Imagetools Plugin didn't update the images atomically. + Fixed a bug where the Fullscreen Plugin was throwing errors when being used on an inline editor. + Fixed a bug where drop down menus weren't positioned correctly in inline editors on scroll. + Fixed a bug with a semicolon missing at the end of the bundled javascript files. + Fixed a bug in the Table Plugin with cursor navigation inside of tables where the cursor would sometimes jump into an incorrect table cells. + Fixed a bug where indenting a table that is a list item using the "Increase indent" button would create a nested table. + Fixed a bug where text nodes containing only whitespace were being wrapped by paragraph elements. + Fixed a bug where whitespace was being inserted after br tags inside of paragraph tags. + Fixed a bug where converting an indented paragraph to a list item would cause the list item to have extra padding. + Fixed a bug where Copy/Paste in an editor with a lot of content would cause the editor to scroll to the top of the content in IE11. + Fixed a bug with a memory leak in the DragHelper. Path contributed by ben-mckernan. + Fixed a bug where the advanced tab in the Media Plugin was being shown even if it didn't contain anything. Patch contributed by gabrieeel. + Fixed an outdated eventname in the EventUtils. Patch contributed by nazar-pc. + Fixed an issue where the Json.parse function would throw an error when being used on a page with strict CSP settings. + Fixed so you can place the curser before and after table elements within the editor in Firefox and Edge/IE. +Version 4.7.6 (2018-01-29) + Fixed a bug in the jquery integration where it threw an error saying that "global is not defined". + Fixed a bug where deleting a table cell whose previous sibling was set to contenteditable false would create a corrupted table. + Fixed a bug where highlighting text in an unfocused editor did not work correctly in IE11/Edge. + Fixed a bug where the table resize handles were not being repositioned when activating the Fullscreen Plugin. + Fixed a bug where the Imagetools Plugin dialog didn't honor editor RTL settings. + Fixed a bug where block elements weren't being merged correctly if you deleted from after a contenteditable false element to the beginning of another block element. + Fixed a bug where TinyMCE didn't work with module loaders like webpack. +Version 4.7.5 (2018-01-22) + Fixed bug with the Codesample Plugin where it wasn't possible to edit codesamples when the editor was in inline mode. + Fixed bug where focusing on the status bar broke the keyboard navigation functionality. + Fixed bug where an error would be thrown on Edge by the Table Plugin when pasting using the PowerPaste Plugin. + Fixed bug in the Table Plugin where selecting row border style from the dropdown menu in advanced row properties would throw an error. + Fixed bug with icons being rendered incorrectly on Chrome on Mac OS. + Fixed bug in the Textcolor Plugin where the font color and background color buttons wouldn't trigger an ExecCommand event. + Fixed bug in the Link Plugin where the url field wasn't forced LTR. + Fixed bug where the Nonbreaking Plugin incorrectly inserted spaces into tables. + Fixed bug with the inline theme where the toolbar wasn't repositioned on window resize. +Version 4.7.4 (2017-12-05) + Fixed bug in the Nonbreaking Plugin where the nonbreaking_force_tab setting was being ignored. + Fixed bug in the Table Plugin where changing row height incorrectly converted column widths to pixels. + Fixed bug in the Table Plugin on Edge and IE11 where resizing the last column after resizing the table would cause invalid column heights. + Fixed bug in the Table Plugin where keyboard navigation was not normalized between browsers. + Fixed bug in the Table Plugin where the colorpicker button would show even without defining the colorpicker_callback. + Fixed bug in the Table Plugin where it wasn't possible to set the cell background color. + Fixed bug where Firefox would throw an error when intialising an editor on an element that is hidden or not yet added to the DOM. + Fixed bug where Firefox would throw an error when intialising an editor inside of a hidden iframe. +Version 4.7.3 (2017-11-23) + Added functionality to open the Codesample Plugin dialog when double clicking on a codesample. Patch contributed by dakuzen. + Fixed bug where undo/redo didn't work correctly with some formats and caret positions. + Fixed bug where the color picker didn't show up in Table Plugin dialogs. + Fixed bug where it wasn't possible to change the width of a table through the Table Plugin dialog. + Fixed bug where the Charmap Plugin couldn't insert some special characters. + Fixed bug where editing a newly inserted link would not actually edit the link but insert a new link next to it. + Fixed bug where deleting all content in a table cell made it impossible to place the caret into it. + Fixed bug where the vertical alignment field in the Table Plugin cell properties dialog didn't do anything. + Fixed bug where an image with a caption showed two sets of resize handles in IE11. + Fixed bug where pressing the enter button inside of an h1 with contenteditable set to true would sometimes produce a p tag. + Fixed bug with backspace not working as expected before a noneditable element. + Fixed bug where operating on tables with invalid rowspans would cause an error to be thrown. + Fixed so a real base64 representation of the image is available on the blobInfo that the images_upload_handler gets called with. + Fixed so the image upload tab is available when the images_upload_handler is defined (and not only when the images_upload_url is defined). +Version 4.7.2 (2017-11-07) + Added newly rewritten Table Plugin. + Added support for attributes with colon in valid_elements and addValidElements. + Added support for dailymotion short url in the Media Plugin. Patch contributed by maat8. + Added support for converting to half pt when converting font size from px to pt. Patch contributed by danny6514. + Added support for location hash to the Autosave plugin to make it work better with SPAs using hash routing. + Added support for merging table cells when pasting a table into another table. + Changed so the language packs are only loaded once. Patch contributed by 0xor1. + Simplified the css for inline boundaries selection by switching to an attribute selector. + Fixed bug where an error would be thrown on editor initialization if the window.getSelection() returned null. + Fixed bug where holding down control or alt keys made the keyboard navigation inside an inline boundary not work as expected. + Fixed bug where applying formats in IE11 produced extra, empty paragraphs in the editor. + Fixed bug where the Word Count Plugin didn't count some mathematical operators correctly. + Fixed bug where removing an inline editor removed the element that the editor had been initialized on. + Fixed bug where setting the selection to the end of an editable container caused some formatting problems. + Fixed bug where an error would be thrown sometimes when an editor was removed because of the selection bookmark was being stored asynchronously. + Fixed a bug where an editor initialized on an empty list did not contain any valid cursor positions. + Fixed a bug with the Context Menu Plugin and webkit browsers on Mac where right-clicking inside a table would produce an incorrect selection. + Fixed bug where the Image Plugin constrain proportions setting wasn't working as expected. + Fixed bug where deleting the last character in a span with decorations produced an incorrect element when typing. + Fixed bug where focusing on inline editors made the toolbar flicker when moving between elements quickly. + Fixed bug where the selection would be stored incorrectly in inline editors when the mouseup event was fired outside the editor body. + Fixed bug where toggling bold at the end of an inline boundary would toggle off the whole word. + Fixed bug where setting the skin to false would not stop the loading of some skin css files. + Fixed bug in mobile theme where pinch-to-zoom would break after exiting the editor. + Fixed bug where sublists of a fully selected list would not be switched correctly when changing list style. + Fixed bug where inserting media by source would break the UndoManager. + Fixed bug where inserting some content into the editor with a specific selection would replace some content incorrectly. + Fixed bug where selecting all content with ctrl+a in IE11 caused problems with untoggling some formatting. + Fixed bug where the Search and Replace Plugin left some marker spans in the editor when undoing and redoing after replacing some content. + Fixed bug where the editor would not get a scrollbar when using the Fullscreen and Autoresize plugins together. + Fixed bug where the font selector would stop working correctly after selecting fonts three times. + Fixed so pressing the enter key inside of an inline boundary inserts a br after the inline boundary element. + Fixed a bug where it wasn't possible to use tab navigation inside of a table that was inside of a list. + Fixed bug where end_container_on_empty_block would incorrectly remove elements. + Fixed bug where content_styles weren't added to the Preview Plugin iframe. + Fixed so the beforeSetContent/beforeGetContent events are preventable. + Fixed bug where changing height value in Table Plugin advanced tab didn't do anything. + Fixed bug where it wasn't possible to remove formatting from content in beginning of table cell. +Version 4.7.1 (2017-10-09) + Fixed bug where theme set to false on an inline editor produced an extra div element after the target element. + Fixed bug where the editor drag icon was misaligned with the branding set to false. + Fixed bug where doubled menu items were not being removed as expected with the removed_menuitems setting. + Fixed bug where the Table of contents plugin threw an error when initialized. + Fixed bug where it wasn't possible to add inline formats to text selected right to left. + Fixed bug where the paste from plain text mode did not work as expected. + Fixed so the style previews do not set color and background color when selected. + Fixed bug where the Autolink plugin didn't work as expected with some formats applied on an empty editor. + Fixed bug where the Textpattern plugin were throwing errors on some patterns. + Fixed bug where the Save plugin saved all editors instead of only the active editor. Patch contributed by dannoe. +Version 4.7.0 (2017-10-03) + Added new mobile ui that is specifically designed for mobile devices. + Updated the default skin to be more modern and white since white is preferred by most implementations. + Restructured the default menus to be more similar to common office suites like Google Docs. + Fixed so theme can be set to false on both inline and iframe editor modes. + Fixed bug where inline editor would add/remove the visualblocks css multiple times. + Fixed bug where selection wouldn't be properly restored when editor lost focus and commands where invoked. + Fixed bug where toc plugin would generate id:s for headers even though a toc wasn't inserted into the content. + Fixed bug where is wasn't possible to drag/drop contents within the editor if paste_data_images where set to true. + Fixed bug where getParam and close in WindowManager would get the first opened window instead of the last opened window. + Fixed bug where delete would delete between cells inside a table in Firefox. +Version 4.6.7 (2017-09-18) + Fixed bug where paste wasn't working in IOS. + Fixed bug where the Word Count Plugin didn't count some mathematical operators correctly. + Fixed bug where inserting a list in a table caused the cell to expand in height. + Fixed bug where pressing enter in a list located inside of a table deleted list items instead of inserting new list item. + Fixed bug where copy and pasting table cells produced inconsistent results. + Fixed bug where initializing an editor with an ID of 'length' would throw an exception. + Fixed bug where it was possible to split a non merged table cell. + Fixed bug where copy and pasting a list with a very specific selection into another list would produce a nested list. + Fixed bug where copy and pasting ordered lists sometimes produced unordered lists. + Fixed bug where padded elements inside other elements would be treated as empty. + Added some missing translations to Image, Link and Help plugins. + Fixed so you can resize images inside a figure element. + Fixed bug where an inline TinyMCE editor initialized on a table did not set selection on load in Chrome. + Fixed the positioning of the inlite toolbar when the target element wasn't big enough to fit the toolbar. +Version 4.6.6 (2017-08-30) + Fixed so that notifications wrap long text content instead of bleeding outside the notification element. + Fixed so the content_style css is added after the skin and custom stylesheets. + Fixed bug where it wasn't possible to remove a table with the Cut button. + Fixed bug where the center format wasn't getting the same font size as the other formats in the format preview. + Fixed bug where the wordcount plugin wasn't counting hyphenated words correctly. + Fixed bug where all content pasted into the editor was added to the end of the editor. + Fixed bug where enter keydown on list item selection only deleted content and didn't create a new line. + Fixed bug where destroying the editor while the content css was still loading caused error notifications on Firefox. + Fixed bug where undoing cut operation in IE11 left some unwanted html in the editor content. + Fixed bug where enter keydown would throw an error in IE11. + Fixed bug where duplicate instances of an editor were added to the editors array when using the createEditor API. + Fixed bug where the formatter applied formats on the wrong content when spellchecker was activated. + Fixed bug where switching formats would reset font size on child nodes. + Fixed bug where the table caption element weren't always the first descendant to the table tag. + Fixed bug where pasting some content into the editor on chrome some newlines were removed. + Fixed bug where it wasn't possible to remove a list if a list item was a table element. + Fixed bug where copy/pasting partial selections of tables wouldn't produce a proper table. + Fixed bug where the searchreplace plugin could not find consecutive spaces. + Fixed bug where background color wasn't applied correctly on some partially selected contents. +Version 4.6.5 (2017-08-02) + Added new inline_boundaries_selector that allows you to specify the elements that should have boundaries. + Added new local upload feature this allows the user to upload images directly from the image dialog. + Added a new api for providing meta data for plugins. It will show up in the help dialog if it's provided. + Fixed so that the notifications created by the notification manager are more screen reader accessible. + Fixed bug where changing the list format on multiple selected lists didn't change all of the lists. + Fixed bug where the nonbreaking plugin would insert multiple undo levels when pressing the tab key. + Fixed bug where delete/backspace wouldn't render a caret when all editor contents where deleted. + Fixed bug where delete/backspace wouldn't render a caret if the deleted element was a single contentEditable false element. + Fixed bug where the wordcount plugin wouldn't count words correctly if word where typed after applying a style format. + Fixed bug where the wordcount plugin would count mathematical formulas as multiple words for example 1+1=2. + Fixed bug where formatting of triple clicked blocks on Chrome/Safari would result in styles being added outside the visual selection. + Fixed bug where paste would add the contents to the end of the editor area when inline mode was used. + Fixed bug where toggling off bold formatting on text entered in a new paragraph would add an extra line break. + Fixed bug where autolink plugin would only produce a link on every other consecutive link on Firefox. + Fixed bug where it wasn't possible to select all contents if the content only had one pre element. + Fixed bug where sizzle would produce lagging behavior on some sites due to repaints caused by feature detection. + Fixed bug where toggling off inline formats wouldn't include the space on selected contents with leading or trailing spaces. + Fixed bug where the cut operation in UI wouldn't work in Chrome. + Fixed bug where some legacy editor initialization logic would throw exceptions about editor settings not being defined. + Fixed bug where it wasn't possible to apply text color to links if they where part of a non collapsed selection. + Fixed bug where an exception would be thrown if the user selected a video element and then moved the focus outside the editor. + Fixed bug where list operations didn't work if there where block elements inside the list items. + Fixed bug where applying block formats to lists wrapped in block elements would apply to all elements in that wrapped block. +Version 4.6.4 (2017-06-13) + Fixed bug where the editor would move the caret when clicking on the scrollbar next to a content editable false block. + Fixed bug where the text color select dropdowns wasn't placed correctly when they didn't fit the width of the screen. + Fixed bug where the default editor line height wasn't working for mixed font size contents. + Fixed bug where the content css files for inline editors were loaded multiple times for multiple editor instances. + Fixed bug where the initial value of the font size/font family dropdowns wasn't displayed. + Fixed bug where the I18n api was not supporting arrays as the translation replacement values. + Fixed bug where chrome would display "The given range isn't in document." errors for invalid ranges passed to setRng. + Fixed bug where the compat3x plugin wasn't working since the global tinymce references wasn't resolved correctly. + Fixed bug where the preview plugin wasn't encoding the base url passed into the iframe contents producing a xss bug. + Fixed bug where the dom parser/serializer wasn't handling some special elements like noframes, title and xmp. + Fixed bug where the dom parser/serializer wasn't handling cdata sections with comments inside. + Fixed bug where the editor would scroll to the top of the editable area if a dialog was closed in inline mode. + Fixed bug where the link dialog would not display the right rel value if rel_list was configured. + Fixed bug where the context menu would select images on some platforms but not others. + Fixed bug where the filenames of images were not retained on dragged and drop into the editor from the desktop. + Fixed bug where the paste plugin would misrepresent newlines when pasting plain text and having forced_root_block configured. + Fixed so that the error messages for the imagetools plugin is more human readable. + Fixed so the internal validate setting for the parser/serializer can't be set from editor initialization settings. +Version 4.6.3 (2017-05-30) + Fixed bug where the arrow keys didn't work correctly when navigating on nested inline boundary elements. + Fixed bug where delete/backspace didn't work correctly on nested inline boundary elements. + Fixed bug where image editing didn't work on subsequent edits of the same image. + Fixed bug where charmap descriptions wouldn't properly wrap if they exceeded the width of the box. + Fixed bug where the default image upload handler only accepted 200 as a valid http status code. + Fixed so rel on target=_blank links gets forced with only noopener instead of both noopener and noreferrer. +Version 4.6.2 (2017-05-23) + Fixed bug where the SaxParser would run out of memory on very large documents. + Fixed bug with formatting like font size wasn't applied to del elements. + Fixed bug where various api calls would be throwing exceptions if they where invoked on a removed editor instance. + Fixed bug where the branding position would be incorrect if the editor was inside a hidden tab and then later showed. + Fixed bug where the color levels feature in the imagetools dialog wasn't working properly. + Fixed bug where imagetools dialog wouldn't pre-load images from CORS domains, before trying to prepare them for editing. + Fixed bug where the tab key would move the caret to the next table cell if being pressed inside a list inside a table. + Fixed bug where the cut/copy operations would loose parent context like the current format etc. + Fixed bug with format preview not working on invalid elements excluded by valid_elements. + Fixed bug where blocks would be merged in incorrect order on backspace/delete. + Fixed bug where zero length text nodes would cause issues with the undo logic if there where iframes present. + Fixed bug where the font size/family select lists would throw errors if the first node was a comment. + Fixed bug with csp having to allow local script evaluation since it was used to detect global scope. + Fixed bug where CSP required a relaxed option for javascript: URLs in unsupported legacy browsers. + Fixed bug where a fake caret would be rendered for td with the contenteditable=false. + Fixed bug where typing would be blocked on IE 11 when within a nested contenteditable=true/false structure. +Version 4.6.1 (2017-05-10) + Added configuration option to list plugin to disable tab indentation. + Fixed bug where format change on very specific content could cause the selection to change. + Fixed bug where TinyMCE could not be lazyloaded through jquery integration. + Fixed bug where entities in style attributes weren't decoded correctly on paste in webkit. + Fixed bug where fontsize_formats option had been renamed incorrectly. + Fixed bug with broken backspace/delete behaviour between contenteditable=false blocks. + Fixed bug where it wasn't possible to backspace to the previous line with the inline boundaries functionality turned on. + Fixed bug where is wasn't possible to move caret left and right around a linked image with the inline boundaries functionality turned on. + Fixed bug where pressing enter after/before hr element threw exception. Patch contributed bradleyke. + Fixed so the CSS in the visualblocks plugin doesn't overwrite background color. Patch contributed by Christian Rank. + Fixed bug where multibyte characters weren't encoded correctly. Patch contributed by James Tarkenton. + Fixed bug where shift-click to select within contenteditable=true fields wasn't working. +Version 4.6.0 (2017-05-04) + Dropped support for IE 8-10 due to market share and lack of support from Microsoft. See tinymce docs for details. + Added an inline boundary caret position feature that makes it easier to type at the beginning/end of links/code elements. + Added a help plugin that adds a button and a dialog showing the editor shortcuts and loaded plugins. + Added an inline_boundaries option that allows you to disable the inline boundary feature if it's not desired. + Added a new ScrollIntoView event that allows you to override the default scroll to element behavior. + Added role and aria- attributes as valid elements in the default valid elements config. + Added new internal flag for PastePreProcess/PastePostProcess this is useful to know if the paste was coming from an external source. + Added new ignore function to UndoManager this works similar to transact except that it doesn't add an undo level by default. + Fixed so that urls gets retained for images when being edited. This url is then passed on to the upload handler. + Fixed so that the editors would be initialized on readyState interactive instead of complete. + Fixed so that the init event of the editor gets fired once all contentCSS files have been properly loaded. + Fixed so that width/height of the editor gets taken from the textarea element if it's explicitly specified in styles. + Fixed so that keep_styles set to false no longer clones class/style from the previous paragraph on enter. + Fixed so that the default line-height is 1.2em to avoid zwnbsp characters from producing text rendering glitches on Windows. + Fixed so that loading errors of content css gets presented by a notification message. + Fixed so figure image elements can be linked when selected this wraps the figure image in a anchor element. + Fixed bug where it wasn't possible to copy/paste rows with colspans by using the table copy/paste feature. + Fixed bug where the protect setting wasn't properly applied to header/footer parts when using the fullpage plugin. + Fixed bug where custom formats that specified upper case element names where not applied correctly. + Fixed bug where some screen readers weren't reading buttons due to an aria specific fix for IE 8. + Fixed bug where cut wasn't working correctly on iOS due to it's clipboard API not working correctly. + Fixed bug where Edge would paste div elements instead of paragraphs when pasting plain text. + Fixed bug where the textpattern plugin wasn't dealing with trailing punctuations correctly. + Fixed bug where image editing would some times change the image format from jpg to png. + Fixed bug where some UI elements could be inserted into the toolbar even if they where not registered. + Fixed bug where it was possible to click the TD instead of the character in the character map and that caused an exception. + Fixed bug where the font size/font family dropdowns would sometimes show an incorrect value due to css not being loaded in time. + Fixed bug with the media plugin inserting undefined instead of retaining size when media_dimensions was set to false. + Fixed bug with deleting images when forced_root_blocks where set to false. + Fixed bug where input focus wasn't properly handled on nested content editable elements. + Fixed bug where Chrome/Firefox would throw an exception when selecting images due to recent change of setBaseAndExtent support. + Fixed bug where malformed blobs would throw exceptions now they are simply ignored. + Fixed bug where backspace/delete wouldn't work properly in some cases where all contents was selected in WebKit. + Fixed bug with Angular producing errors since it was expecting events objects to be patched with their custom properties. + Fixed bug where the formatter would apply formatting to spellchecker errors now all bogus elements are excluded. + Fixed bug with backspace/delete inside table caption elements wouldn't behave properly on IE 11. + Fixed bug where typing after a contenteditable false inline element could move the caret to the end of that element. + Fixed bug where backspace before/after contenteditable false blocks wouldn't properly remove the right element. + Fixed bug where backspace before/after contenteditable false inline elements wouldn't properly empty the current block element. + Fixed bug where vertical caret navigation with a custom line-height would sometimes match incorrect positions. + Fixed bug with paste on Edge where character encoding wasn't handled properly due to a browser bug. + Fixed bug with paste on Edge where extra fragment data was inserted into the contents when pasting. + Fixed bug with pasting contents when having a whole block element selected on WebKit could cause WebKit spans to appear. + Fixed bug where the visualchars plugin wasn't working correctly showing invisible nbsp characters. + Fixed bug where browsers would hang if you tried to load some malformed html contents. + Fixed bug where the init call promise wouldn't resolve if the specified selector didn't find any matching elements. + Fixed bug where the Schema isValidChild function was case sensitive. +Version 4.5.3 (2017-02-01) + Added keyboard navigation for menu buttons when the menu is in focus. + Added api to the list plugin for setting custom classes/attributes on lists. + Added validation for the anchor plugin input field according to W3C id naming specifications. + Fixed bug where media placeholders were removed after resize with the forced_root_block setting set to false. + Fixed bug where deleting selections with similar sibling nodes sometimes deleted the whole document. + Fixed bug with inlite theme where several toolbars would appear scrolling when more than one instance of the editor was in use. + Fixed bug where the editor would throw error with the fontselect plugin on hidden editor instances in Firefox. + Fixed bug where the background color would not stretch to the font size. + Fixed bug where font size would be removed when changing background color. + Fixed bug where the undomanager trimmed away whitespace between nodes on undo/redo. + Fixed bug where media_dimensions=false in media plugin caused the editor to throw an error. + Fixed bug where IE was producing font/u elements within links on paste. + Fixed bug where some button tooltips were broken when compat3x was in use. + Fixed bug where backspace/delete/typeover would remove the caption element. + Fixed bug where powerspell failed to function when compat3x was enabled. + Fixed bug where it wasn't possible to apply sub/sup on text with large font size. + Fixed bug where pre tags with spaces weren't treated as content. + Fixed bug where Meta+A would select the entire document instead of all contents in nested ce=true elements. +Version 4.5.2 (2017-01-04) + Added missing keyboard shortcut description for the underline menu item in the format menu. + Fixed bug where external blob urls wasn't properly handled by editor upload logic. Patch contributed by David Oviedo. + Fixed bug where urls wasn't treated as a single word by the wordcount plugin. + Fixed bug where nbsp characters wasn't treated as word delimiters by the wordcount plugin. + Fixed bug where editor instance wasn't properly passed to the format preview logic. Patch contributed by NullQuery. + Fixed bug where the fake caret wasn't hidden when you moved selection to a cE=false element. + Fixed bug where it wasn't possible to edit existing code sample blocks. + Fixed bug where it wasn't possible to delete editor contents if the selection included an empty block. + Fixed bug where the formatter wasn't expanding words on some international characters. Patch contributed by Martin Larochelle. + Fixed bug where the open link feature wasn't working correctly on IE 11. + Fixed bug where enter before/after a cE=false block wouldn't properly padd the paragraph with an br element. + Fixed so font size and font family select boxes always displays a value by using the runtime style as a fallback. + Fixed so missing plugins will be logged to console as warnings rather than halting the initialization of the editor. + Fixed so splitbuttons become normal buttons in advlist plugin if styles are empty. Patch contributed by René Schleusner. + Fixed so you can multi insert rows/cols by selecting table cells and using insert rows/columns. +Version 4.5.1 (2016-12-07) + Fixed bug where the lists plugin wouldn't initialize without the advlist plugins if served from cdn. + Fixed bug where selectors with "*" would cause the style format preview to throw an error. + Fixed bug with toggling lists off on lists with empty list items would throw an error. + Fixed bug where editing images would produce non existing blob uris. + Fixed bug where the offscreen toc selection would be treated as the real toc element. + Fixed bug where the aria level attribute for element path would have an incorrect start index. + Fixed bug where the offscreen selection of cE=false that where very wide would be shown onscreen. Patch contributed by Steven Bufton. + Fixed so the default_link_target gets applied to links created by the autolink plugin. + Fixed so that the name attribute gets removed by the anchor plugin if editing anchors. +Version 4.5.0 (2016-11-23) + Added new toc plugin allows you to insert table of contents based on editor headings. + Added new auto complete menu to all url fields. Adds history, link to anchors etc. + Added new sidebar api that allows you to add custom sidebar panels and buttons to toggle these. + Added new insert menu button that allows you to have multiple insert functions under the same menu button. + Added new open link feature to ctrl+click, alt+enter and context menu. + Added new media_embed_handler option to allow the media plugin to be populated with custom embeds. + Added new support for editing transparent images using the image tools dialog. + Added new images_reuse_filename option to allow filenames of images to be retained for upload. + Added new security feature where links with target="_blank" will by default get rel="noopener noreferrer". + Added new allow_unsafe_link_target to allow you to opt-out of the target="_blank" security feature. + Added new style_formats_autohide option to automatically hide styles based on context. + Added new codesample_content_css option to specify where the code sample prism css is loaded from. + Added new support for Japanese/Chinese word count following the unicode standards on this. + Added new fragmented undo levels this dramatically reduces flicker on contents with iframes. + Added new live previews for complex elements like table or lists. + Fixed bug where it wasn't possible to properly tab between controls in a dialog with a disabled form item control. + Fixed bug where firefox would generate a rectangle on elements produced after/before a cE=false elements. + Fixed bug with advlist plugin not switching list element format properly in some edge cases. + Fixed bug where col/rowspans wasn't correctly computed by the table plugin in some cases. + Fixed bug where the table plugin would thrown an error if object_resizing was disabled. + Fixed bug where some invalid markup would cause issues when running in XHTML mode. Patch contributed by Charles Bourasseau. + Fixed bug where the fullscreen class wouldn't be removed properly when closing dialogs. + Fixed bug where the PastePlainTextToggle event wasn't fired by the paste plugin when the state changed. + Fixed bug where table the row type wasn't properly updated in table row dialog. Patch contributed by Matthias Balmer. + Fixed bug where select all and cut wouldn't place caret focus back to the editor in WebKit. Patch contributed by Daniel Jalkut. + Fixed bug where applying cell/row properties to multiple cells/rows would reset other unchanged properties. + Fixed bug where some elements in the schema would have redundant/incorrect children. + Fixed bug where selector and target options would cause issues if used together. + Fixed bug where drag/drop of images from desktop on chrome would thrown an error. + Fixed bug where cut on WebKit/Blink wouldn't add an undo level. + Fixed bug where IE 11 would scroll to the cE=false elements when they where selected. + Fixed bug where keys like F5 wouldn't work when a cE=false element was selected. + Fixed bug where the undo manager wouldn't stop the typing state when commands where executed. + Fixed bug where unlink on wrapped links wouldn't work properly. + Fixed bug with drag/drop of images on WebKit where the image would be deleted form the source editor. + Fixed bug where the visual characters mode would be disabled when contents was extracted from the editor. + Fixed bug where some browsers would toggle of formats applied to the caret when clicking in the editor toolbar. + Fixed bug where the custom theme function wasn't working correctly. + Fixed bug where image option for custom buttons required you to have icon specified as well. + Fixed bug where the context menu and contextual toolbars would be visible at the same time and sometimes overlapping. + Fixed bug where the noneditable plugin would double wrap elements when using the noneditable_regexp option. + Fixed bug where tables would get padding instead of margin when you used the indent button. + Fixed bug where the charmap plugin wouldn't properly insert non breaking spaces. + Fixed bug where the color previews in color input boxes wasn't properly updated. + Fixed bug where the list items of previous lists wasn't merged in the right order. + Fixed bug where it wasn't possible to drag/drop inline-block cE=false elements on IE 11. + Fixed bug where some table cell merges would produce incorrect rowspan/colspan. + Fixed so the font size of the editor defaults to 14px instead of 11px this can be overridden by custom css. + Fixed so wordcount is debounced to reduce cpu hogging on larger texts. + Fixed so tinymce global gets properly exported as a module when used with some module bundlers. + Fixed so it's possible to specify what css properties you want to preview on specific formats. + Fixed so anchors are contentEditable=false while within the editor. + Fixed so selected contents gets wrapped in a inline code element by the codesample plugin. + Fixed so conditional comments gets properly stripped independent of case. Patch contributed by Georgii Dolzhykov. + Fixed so some escaped css sequences gets properly handled. Patch contributed by Georgii Dolzhykov. + Fixed so notifications with the same message doesn't get displayed at the same time. + Fixed so F10 can be used as an alternative key to focus to the toolbar. + Fixed various api documentation issues and typos. + Removed layer plugin since it wasn't really ported from 3.x and there doesn't seem to be much use for it. + Removed moxieplayer.swf from the media plugin since it wasn't used by the media plugin. + Removed format state from the advlist plugin to be more consistent with common word processors. +Version 4.4.3 (2016-09-01) + Fixed bug where copy would produce an exception on Chrome. + Fixed bug where deleting lists on IE 11 would merge in correct text nodes. + Fixed bug where deleting partial lists with indentation wouldn't cause proper normalization. +Version 4.4.2 (2016-08-25) + Added new importcss_exclusive option to disable unique selectors per group. + Added new group specific selector_converter option to importcss plugin. + Added new codesample_languages option to apply custom languages to codesample plugin. + Added new codesample_dialog_width/codesample_dialog_height options. + Fixed bug where fullscreen button had an incorrect keyboard shortcut. + Fixed bug where backspace/delete wouldn't work correctly from a block to a cE=false element. + Fixed bug where smartpaste wasn't detecting links with special characters in them like tilde. + Fixed bug where the editor wouldn't get proper focus if you clicked on a cE=false element. + Fixed bug where it wasn't possible to copy/paste table rows that had merged cells. + Fixed bug where merging cells could some times produce invalid col/rowspan attibute values. + Fixed bug where getBody would sometimes thrown an exception now it just returns null if the iframe is clobbered. + Fixed bug where drag/drop of cE=false element wasn't properly constrained to viewport. + Fixed bug where contextmenu on Mac would collapse any selection to a caret. + Fixed bug where rtl mode wasn't rendered properly when loading a language pack with the rtl flag. + Fixed bug where Kamer word bounderies would be stripped from contents. + Fixed bug where lists would sometimes render two dots or numbers on the same line. + Fixed bug where the skin_url wasn't used by the inlite theme. + Fixed so data attributes are ignored when comparing formats in the formatter. + Fixed so it's possible to disable inline toolbars in the inlite theme. + Fixed so template dialog gets resized if it doesn't fit the window viewport. +Version 4.4.1 (2016-07-26) + Added smart_paste option to paste plugin to allow disabling the paste behavior if needed. + Fixed bug where png urls wasn't properly detected by the smart paste logic. + Fixed bug where the element path wasn't working properly when multiple editor instances where used. + Fixed bug with creating lists out of multiple paragraphs would just create one list item instead of multiple. + Fixed bug where scroll position wasn't properly handled by the inlite theme to place the toolbar properly. + Fixed bug where multiple instances of the editor using the inlite theme didn't render the toolbar properly. + Fixed bug where the shortcut label for fullscreen mode didn't match the actual shortcut key. + Fixed bug where it wasn't possible to select cE=false blocks using touch devices on for example iOS. + Fixed bug where it was possible to select the child image within a cE=false on IE 11. + Fixed so inserts of html containing lists doesn't merge with any existing lists unless it's a paste operation. +Version 4.4.0 (2016-06-30) + Added new inlite theme this is a more lightweight inline UI. + Added smarter paste logic that auto detects urls in the clipboard and inserts images/links based on that. + Added a better image resize algorithm for better image quality in the imagetools plugin. + Fixed bug where it wasn't possible to drag/dropping cE=false elements on FF. + Fixed bug where backspace/delete before/after a cE=false block would produce a new paragraph. + Fixed bug where list style type css property wasn't preserved when indenting lists. + Fixed bug where merging of lists where done even if the list style type was different. + Fixed bug where the image_dataimg_filter function wasn't used when pasting images. + Fixed bug where nested editable within a non editable element would cause scroll on focus in Chrome. + Fixed so invalid targets for inline mode is blocked on initialization. We only support elements that can have children. +Version 4.3.13 (2016-06-08) + Added characters with a diacritical mark to charmap plugin. Patch contributed by Dominik Schilling. + Added better error handling if the image proxy service would produce errors. + Fixed issue with pasting list items into list items would produce nested list rather than a merged list. + Fixed bug where table selection could get stuck in selection mode for inline editors. + Fixed bug where it was possible to place the caret inside the resize grid elements. + Fixed bug where it wasn't possible to place in elements horizontally adjacent cE=false blocks. + Fixed bug where multiple notifications wouldn't be properly placed on screen. + Fixed bug where multiple editor instance of the same id could be produces in some specific integrations. +Version 4.3.12 (2016-05-10) + Fixed bug where focus calls couldn't be made inside the editors PostRender event handler. + Fixed bug where some translations wouldn't work as expected due to a bug in editor.translate. + Fixed bug where the node change event could fire with a node out side the root of the editor. + Fixed bug where Chrome wouldn't properly present the keyboard paste clipboard details when paste was clicked. + Fixed bug where merged cells in tables couldn't be selected from right to left. + Fixed bug where insert row wouldn't properly update a merged cells rowspan property. + Fixed bug where the color input boxes preview field wasn't properly set on initialization. + Fixed bug where IME composition inside table cells wouldn't work as expected on IE 11. + Fixed so all shadow dom support is under and experimental flag due to flaky browser support. +Version 4.3.11 (2016-04-25) + Fixed bug where it wasn't possible to insert empty blocks though the API unless they where padded. + Fixed bug where you couldn't type the Euro character on Windows. + Fixed bug where backspace/delete from a cE=false element to a text block didn't work properly. + Fixed bug where the text color default grid would render incorrectly. + Fixed bug where the codesample plugin wouldn't load the css in the editor for multiple editors. + Fixed so the codesample plugin textarea gets focused by default. +Version 4.3.10 (2016-04-12) + Fixed bug where the key "y" on WebKit couldn't be entered due to conflict with keycode for F10 on keypress. +Version 4.3.9 (2016-04-12) + Added support for focusing the contextual toolbars using keyboard. + Added keyboard support for slider UI controls. You can no increase/decrease using arrow keys. + Added url pattern matching for Dailymotion to media plugin. Patch contributed by Bertrand Darbon. + Added body_class to template plugin preview. Patch contributed by Milen Petrinski. + Added options to better override textcolor pickers with custom colors. Patch contributed by Xavier Boubert. + Added visual arrows to inline contextual toolbars so that they point to the element being active. + Fixed so toolbars for tables or other larger elements get better positioned below the scrollable viewport. + Fixed bug where it was possible to click links inside cE=false blocks. + Fixed bug where event targets wasn't properly handled in Safari Technical Preview. + Fixed bug where drag/drop text in FF 45 would make the editor caret invisible. + Fixed bug where the remove state wasn't properly set on editor instances when detected as clobbered. + Fixed bug where offscreen selection of some cE=false elements would render onscreen. Patch contributed by Steven Bufton + Fixed bug where enter would clone styles out side the root on editors inside a span. Patch contributed by ChristophKaser. + Fixed bug where drag/drop of images into the editor didn't work correctly in FF. + Fixed so the first item in panels for the imagetools dialog gets proper keyboard focus. + Changed the Meta+Shift+F shortcut to Ctrl+Shift+F since Czech, Slovak, Polish languages used the first one for input. +Version 4.3.8 (2016-03-15) + Fixed bug where inserting HR at the end of a block element would produce an extra empty block. + Fixed bug where links would be clickable when readonly mode was enabled. + Fixed bug where the formatter would normalize to the wrong node on very specific content. + Fixed bug where some nested list items couldn't be indented properly. + Fixed bug where links where clickable in the preview dialog. + Fixed so the alt attribute doesn't get padded with an empty value by default. + Fixed so nested alignment works more correctly. You will now alter the alignment to the closest block parent. +Version 4.3.7 (2016-03-02) + Fixed bug where incorrect icons would be rendered for imagetools edit and color levels. + Fixed bug where navigation using arrow keys inside a SelectBox didn't move up/down. + Fixed bug where the visualblocks plugin would render borders round internal UI elements. +Version 4.3.6 (2016-03-01) + Added new paste_remember_plaintext_info option to allow a global disable of the plain text mode notification. + Added new PastePlainTextToggle event that fires when plain text mode toggles on/off. + Fixed bug where it wasn't possible to select media elements since the drag logic would snap it to mouse cursor. + Fixed bug where it was hard to place the caret inside nested cE=true elements when the outer cE=false element was focused. + Fixed bug where editors wouldn't properly initialize if both selector and mode where used. + Fixed bug where IME input inside table cells would switch the IME off. + Fixed bug where selection inside the first table cell would cause the whole table cell to get selected. + Fixed bug where error handling of images being uploaded wouldn't properly handle faulty statuses. + Fixed bug where inserting contents before a HR would cause an exception to be thrown. + Fixed bug where copy/paste of Excel data would be inserted as an image. + Fixed caret position issues with copy/paste of inline block cE=false elements. + Fixed issues with various menu item focus bugs in Chrome. Where the focused menu bar item wasn't properly blurred. + Fixed so the notifications have a solid background since it would be hard to read if there where text under it. + Fixed so notifications gets animated similar to the ones used by dialogs. + Fixed so larger images that gets pasted is handled better. + Fixed so the window close button is more uniform on various platform and also increased it's hit area. +Version 4.3.5 (2016-02-11) + Npm version bump due to package not being fully updated. +Version 4.3.4 (2016-02-11) + Added new OpenWindow/CloseWindow events that gets fired when windows open/close. + Added new NewCell/NewRow events that gets fired when table cells/rows are created. + Added new Promise return value to tinymce.init makes it easier to handle initialization. + Removed the jQuery version the jQuery plugin is now moved into the main package. + Removed jscs from build process since eslint can now handle code style checking. + Fixed various bugs with drag/drop of contentEditable:false elements. + Fixed bug where deleting of very specific nested list items would result in an odd list. + Fixed bug where lists would get merged with adjacent lists outside the editable inline root. + Fixed bug where MS Edge would crash when closing a dialog then clicking a menu item. + Fixed bug where table cell selection would add undo levels. + Fixed bug where table cell selection wasn't removed when inline editor where removed. + Fixed bug where table cell selection wouldn't work properly on nested tables. + Fixed bug where table merge menu would be available when merging between thead and tbody. + Fixed bug where table row/column resize wouldn't get properly removed when the editor was removed. + Fixed bug where Chrome would scroll to the editor if there where a empty hash value in document url. + Fixed bug where the cache suffix wouldn't work correctly with the importcss plugin. + Fixed bug where selection wouldn't work properly on MS Edge on Windows Phone 10. + Fixed so adjacent pre blocks gets joined into one pre block since that seems like the user intent. + Fixed so events gets properly dispatched in shadow dom. Patch provided by Nazar Mokrynskyi. +Version 4.3.3 (2016-01-14) + Added new table_resize_bars configuration setting. This setting allows you to disable the table resize bars. + Added new beforeInitialize event to tinymce.util.XHR lets you modify XHR properties before open. Patch contributed by Brent Clintel. + Added new autolink_pattern setting to autolink plugin. Enables you to override the default autolink formats. Patch contributed by Ben Tiedt. + Added new charmap option that lets you override the default charmap of the charmap plugin. + Added new charmap_append option that lets you add new characters to the default charmap of the charmap plugin. + Added new insertCustomChar event that gets fired when a character is inserted by the charmap plugin. + Fixed bug where table cells started with a superfluous   in IE10+. + Fixed bug where table plugin would retain all BR tags when cells were merged. + Fixed bug where media plugin would strip underscores from youtube urls. + Fixed bug where IME input would fail on IE 11 if you typed within a table. + Fixed bug where double click selection of a word would remove the space before the word on insert contents. + Fixed bug where table plugin would produce exceptions when hovering tables with invalid structure. + Fixed bug where fullscreen wouldn't scroll back to it's original position when untoggled. + Fixed so the template plugins templates setting can be a function that gets a callback that can provide templates. +Version 4.3.2 (2015-12-14) + Fixed bug where the resize bars for table cells were not affected by the object_resizing property. + Fixed bug where the contextual table toolbar would appear incorrectly if TinyMCE was initialized inline inside a table. + Fixed bug where resizing table cells did not fire a node change event or add an undo level. + Fixed bug where double click selection of text on IE 11 wouldn't work properly. + Fixed bug where codesample plugin would incorrectly produce br elements inside code elements. + Fixed bug where media plugin would strip dashes from youtube urls. + Fixed bug where it was possible to move the caret into the table resize bars. + Fixed bug where drag/drop into a cE=false element was possible on IE. +Version 4.3.1 (2015-11-30) + Fixed so it's possible to disable the table inline toolbar by setting it to false or an empty string. + Fixed bug where it wasn't possible to resize some tables using the drag handles. + Fixed bug where unique id:s would clash for multiple editor instances and cE=false selections. + Fixed bug where the same plugin could be initialized multiple times. + Fixed bug where the table inline toolbars would be displayed at the same time as the image toolbars. + Fixed bug where the table selection rect wouldn't be removed when selecting another control element. +Version 4.3.0 (2015-11-23) + Added new table column/row resize support. Makes it a lot more easy to resize the columns/rows in a table. + Added new table inline toolbar. Makes it easier to for example add new rows or columns to a table. + Added new notification API. Lets you display floating notifications to the end user. + Added new codesample plugin that lets you insert syntax highlighted pre elements into the editor. + Added new image_caption to images. Lets you create images with captions using a HTML5 figure/figcaption elements. + Added new live previews of embeded videos. Lets you play the video right inside the editor. + Added new setDirty method and "dirty" event to the editor. Makes it easier to track the dirty state change. + Added new setMode method to Editor instances that lets you dynamically switch between design/readonly. + Added new core support for contentEditable=false elements within the editor overrides the browsers broken behavior. + Rewrote the noneditable plugin to use the new contentEditable false core logic. + Fixed so the dirty state doesn't set to false automatically when the undo index is set to 0. + Fixed the Selection.placeCaretAt so it works better on IE when the coordinate is between paragraphs. + Fixed bug where data-mce-bogus="all" element contents where counted by the word count plugin. + Fixed bug where contentEditable=false elements would be indented by the indent buttons. + Fixed bug where images within contentEditable=false would be selected in WebKit on mouse click. + Fixed bug in DOMUntils split method where the replacement parameter wouldn't work on specific cases. + Fixed bug where the importcss plugin would import classes from the skin content css file. + Fixed so all button variants have a wrapping span for it's text to make it easier to skin. + Fixed so it's easier to exit pre block using the arrow keys. + Fixed bug where listboxes with fix widths didn't render correctly. +Version 4.2.8 (2015-11-13) + Fixed bug where it was possible to delete tables as the inline root element if all columns where selected. + Fixed bug where the UI buttons active state wasn't properly updated due to recent refactoring of that logic. +Version 4.2.7 (2015-10-27) + Fixed bug where backspace/delete would remove all formats on the last paragraph character in WebKit/Blink. + Fixed bug where backspace within a inline format element with a bogus caret container would move the caret. + Fixed bug where backspace/delete on selected table cells wouldn't add an undo level. + Fixed bug where script tags embedded within the editor could sometimes get a mce- prefix prepended to them + Fixed bug where validate: false option could produce an error to be thrown from the Serialization step. + Fixed bug where inline editing of a table as the root element could let the user delete that table. + Fixed bug where inline editing of a table as the root element wouldn't properly handle enter key. + Fixed bug where inline editing of a table as the root element would normalize the selection incorrectly. + Fixed bug where inline editing of a list as the root element could let the user delete that list. + Fixed bug where inline editing of a list as the root element could let the user split that list. + Fixed bug where resize handles would be rendered on editable root elements such as table. +Version 4.2.6 (2015-09-28) + Added capability to set request headers when using XHRs. + Added capability to upload local images automatically default delay is set to 30 seconds after editing images. + Added commands ids mceEditImage, mceAchor and mceMedia to be avaiable from execCommand. + Added Edge browser to saucelabs grunt task. Patch contributed by John-David Dalton. + Fixed bug where blob uris not produced by tinymce would produce HTML invalid markup. + Fixed bug where selection of contents of a nearly empty editor in Edge would sometimes fail. + Fixed bug where color styles woudln't be retained on copy/paste in Blink/Webkit. + Fixed bug where the table plugin would throw an error when inserting rows after a child table. + Fixed bug where the template plugin wouldn't handle functions as variable replacements. + Fixed bug where undo/redo sometimes wouldn't work properly when applying formatting collapsed ranges. + Fixed bug where shift+delete wouldn't do a cut operation on Blink/WebKit. + Fixed bug where cut action wouldn't properly store the before selection bookmark for the undo level. + Fixed bug where backspace in side an empty list element on IE would loose editor focus. + Fixed bug where the save plugin wouldn't enable the buttons when a change occurred. + Fixed bug where Edge wouldn't initialize the editor if a document.domain was specified. + Fixed bug where enter key before nested images would sometimes not properly expand the previous block. + Fixed bug where the inline toolbars wouldn't get properly hidden when blurring the editor instance. + Fixed bug where Edge would paste Chinese characters on some Windows 10 installations. + Fixed bug where IME would loose focus on IE 11 due to the double trailing br bug fix. + Fixed bug where the proxy url in imagetools was incorrect. Patch contributed by Wong Ho Wang. +Version 4.2.5 (2015-08-31) + Added fullscreen capability to embedded youtube and vimeo videos. + Fixed bug where the uploadImages call didn't work on IE 10. + Fixed bug where image place holders would be uploaded by uploadImages call. + Fixed bug where images marked with bogus would be uploaded by the uploadImages call. + Fixed bug where multiple calls to uploadImages would result in decreased performance. + Fixed bug where pagebreaks were editable to imagetools patch contributed by Rasmus Wallin. + Fixed bug where the element path could cause too much recursion exception. + Fixed bug for domains containing ".min". Patch contributed by Loïc Février. + Fixed so validation of external links to accept a number after www. Patch contributed by Victor Carvalho. + Fixed so the charmap is exposed though execCommand. Patch contributed by Matthew Will. + Fixed so that the image uploads are concurrent for improved performance. + Fixed various grammar problems in inline documentation. Patches provided by nikolas. +Version 4.2.4 (2015-08-17) + Added picture as a valid element to the HTML 5 schema. Patch contributed by Adam Taylor. + Fixed bug where contents would be duplicated on drag/drop within the same editor. + Fixed bug where floating/alignment of images on Edge wouldn't work properly. + Fixed bug where it wasn't possible to drag images on IE 11. + Fixed bug where image selection on Edge would sometimes fail. + Fixed bug where contextual toolbars icons wasn't rendered properly when using the toolbar_items_size. + Fixed bug where searchreplace dialog doesn't get prefilled with the selected text. + Fixed bug where fragmented matches wouldn't get properly replaced by the searchreplace plugin. + Fixed bug where enter key wouldn't place the caret if was after a trailing space within an inline element. + Fixed bug where the autolink plugin could produce multiple links for the same text on Gecko. + Fixed bug where EditorUpload could sometimes throw an exception if the blob wasn't found. + Fixed xss issues with media plugin not properly filtering out some script attributes. +Version 4.2.3 (2015-07-30) + Fixed bug where image selection wasn't possible on Edge due to incompatible setBaseAndExtend API. + Fixed bug where image blobs urls where not properly destroyed by the imagetools plugin. + Fixed bug where keyboard shortcuts wasn't working correctly on IE 8. + Fixed skin issue where the borders of panels where not visible on IE 8. +Version 4.2.2 (2015-07-22) + Fixed bug where float panels were not being hidden on inline editor blur when fixed_toolbar_container config option was in use. + Fixed bug where combobox states wasn't properly updated if contents where updated without keyboard. + Fixed bug where pasting into textbox or combobox would move the caret to the end of text. + Fixed bug where removal of bogus span elements before block elements would remove whitespace between nodes. + Fixed bug where repositioning of inline toolbars where async and producing errors if the editor was removed from DOM to early. Patch by iseulde. + Fixed bug where element path wasn't working correctly. Patch contributed by iseulde. + Fixed bug where menus wasn't rendered correctly when custom images where added to a menu. Patch contributed by Naim Hammadi. +Version 4.2.1 (2015-06-29) + Fixed bug where back/forward buttons in the browser would render blob images as broken images. + Fixed bug where Firefox would throw regexp to big error when replacing huge base64 chunks. + Fixed bug rendering issues with resize and context toolbars not being placed properly until next animation frame. + Fixed bug where the rendering of the image while cropping would some times not be centered correctly. + Fixed bug where listbox items with submenus would me selected as active. + Fixed bug where context menu where throwing an error when rendering. + Fixed bug where resize both option wasn't working due to resent addClass API change. Patch contributed by Jogai. + Fixed bug where a hideAll call for container rendered inline toolbars would throw an error. + Fixed bug where onclick event handler on combobox could cause issues if element.id was a function by some polluting libraries. + Fixed bug where listboxes wouldn't get proper selected sub menu item when using link_list or image_list. + Fixed so the UI controls are as wide as 4.1.x to avoid wrapping controls in toolbars. + Fixed so the imagetools dialog is adaptive for smaller screen sizes. +Version 4.2.0 (2015-06-25) + Added new flat default skin to make the UI more modern. + Added new imagetools plugin, lets you crop/resize and apply filters to images. + Added new contextual toolbars support to the API lets you add floating toolbars for specific CSS selectors. + Added new promise feature fill as tinymce.util.Promise. + Added new built in image upload feature lets you upload any base64 encoded image within the editor as files. + Fixed bug where resize handles would appear in the right position in the wrong editor when switching between resizable content in different inline editors. + Fixed bug where tables would not be inserted in inline mode due to previous float panel fix. + Fixed bug where floating panels would remain open when focus was lost on inline editors. + Fixed bug where cut command on Chrome would thrown a browser security exception. + Fixed bug where IE 11 sometimes would report an incorrect size for images in the image dialog. + Fixed bug where it wasn't possible to remove inline formatting at the end of block elements. + Fixed bug where it wasn't possible to delete table cell contents when cell selection was vertical. + Fixed bug where table cell wasn't emptied from block elements if delete/backspace where pressed in empty cell. + Fixed bug where cmd+shift+arrow didn't work correctly on Firefox mac when selecting to start/end of line. + Fixed bug where removal of bogus elements would sometimes remove whitespace between nodes. + Fixed bug where the resize handles wasn't updated when the main window was resized. + Fixed so script elements gets removed by default to prevent possible XSS issues in default config implementations. + Fixed so the UI doesn't need manual reflows when using non native layout managers. + Fixed so base64 encoded images doesn't slow down the editor on modern browsers while editing. + Fixed so all UI elements uses touch events to improve mobile device support. + Removed the touch click quirks patch for iOS since it did more harm than good. + Removed the non proportional resize handles since. Unproportional resize can still be done by holding the shift key. +Version 4.1.10 (2015-05-05) + Fixed bug where plugins loaded with compat3x would sometimes throw errors when loading using the jQuery version. + Fixed bug where extra empty paragraphs would get deleted in WebKit/Blink due to recent Quriks fix. + Fixed bug where the editor wouldn't work properly on IE 12 due to some required browser sniffing. + Fixed bug where formatting shortcut keys where interfering with Mac OS X screenshot keys. + Fixed bug where the caret wouldn't move to the next/previous line boundary on Cmd+Left/Right on Gecko. + Fixed bug where it wasn't possible to remove formats from very specific nested contents. + Fixed bug where undo levels wasn't produced when typing letters using the shift or alt+ctrl modifiers. + Fixed bug where the dirty state wasn't properly updated when typing using the shift or alt+ctrl modifiers. + Fixed bug where an error would be thrown if an autofocused editor was destroyed quickly after its initialization. Patch provided by thorn0. + Fixed issue with dirty state not being properly updated on redo operation. + Fixed issue with entity decoder not handling incorrectly written numeric entities. + Fixed issue where some PI element values wouldn't be properly encoded. +Version 4.1.9 (2015-03-10) + Fixed bug where indentation wouldn't work properly for non list elements. + Fixed bug with image plugin not pulling the image dimensions out correctly if a custom document_base_url was used. + Fixed bug where ctrl+alt+[1-9] would conflict with the AltGr+[1-9] on Windows. New shortcuts is ctrl+shift+[1-9]. + Fixed bug with removing formatting on nodes in inline mode would sometimes include nodes outside the editor body. + Fixed bug where extra nbsp:s would be inserted when you replaced a word surrounded by spaces using insertContent. + Fixed bug with pasting from Google Docs would produce extra strong elements and line feeds. +Version 4.1.8 (2015-03-05) + Added new html5 sizes attribute to img elements used together with srcset. + Added new elementpath option that makes it possible to disable the element path but keep the statusbar. + Added new option table_style_by_css for the table plugin to set table styling with css rather than table attributes. + Added new link_assume_external_targets option to prompt the user to prepend http:// prefix if the supplied link does not contain a protocol prefix. + Added new image_prepend_url option to allow a custom base path/url to be added to images. + Added new table_appearance_options option to make it possible to disable some options. + Added new image_title option to make it possible to alter the title of the image, disabled by default. + Fixed bug where selection starting from out side of the body wouldn't produce a proper selection range on IE 11. + Fixed bug where pressing enter twice before a table moves the cursor in the table and causes a javascript error. + Fixed bug where advanced image styles were not respected. + Fixed bug where the less common Shift+Delete didn't produce a proper cut operation on WebKit browsers. + Fixed bug where image/media size constrain logic would produce NaN when handling non number values. + Fixed bug where internal classes where removed by the removeformat command. + Fixed bug with creating links table cell contents with a specific selection would throw a exceptions on WebKit/Blink. + Fixed bug where valid_classes option didn't work as expected according to docs. Patch provided by thorn0. + Fixed bug where jQuery plugin would patch the internal methods multiple times. Patch provided by Drew Martin. + Fixed bug where backspace key wouldn't delete the current selection of newly formatted content. + Fixed bug where type over of inline formatting elements wouldn't properly keep the format on WebKit/Blink. + Fixed bug where selection needed to be properly normalized on modern IE versions. + Fixed bug where Command+Backspace didn't properly delete the whole line of text but the previous word. + Fixed bug where UI active states wheren't properly updated on IE if you placed caret within the current range. + Fixed bug where delete/backspace on WebKit/Blink would remove span elements created by the user. + Fixed bug where delete/backspace would produce incorrect results when deleting between two text blocks with br elements. + Fixed bug where captions where removed when pasting from MS Office. + Fixed bug where lists plugin wouldn't properly remove fully selected nested lists. + Fixed bug where the ttf font used for icons would throw an warning message on Gecko on Mac OS X. + Fixed a bug where applying a color to text did not update the undo/redo history. + Fixed so shy entities gets displayed when using the visualchars plugin. + Fixed so removeformat removes ins/del by default since these might be used for strikethough. + Fixed so multiple language packs can be loaded and added to the global I18n data structure. + Fixed so transparent color selection gets treated as a normal color selection. Patch contributed by Alexander Hofbauer. + Fixed so it's possible to disable autoresize_overflow_padding, autoresize_bottom_margin options by setting them to false. + Fixed so the charmap plugin shows the description of the character in the dialog. Patch contributed by Jelle Hissink. + Removed address from the default list of block formats since it tends to be missused. + Fixed so the pre block format is called preformatted to make it more verbose. + Fixed so it's possible to context scope translation strings this isn't needed most of the time. + Fixed so the max length of the width/height input fields of the media dialog is 5 instead of 3. + Fixed so drag/dropped contents gets properly processed by paste plugin since it's basically a paste. Patch contributed by Greg Fairbanks. + Fixed so shortcut keys for headers is ctrl+alt+[1-9] instead of ctrl+[1-9] since these are for switching tabs in the browsers. + Fixed so "u" doesn't get converted into a span element by the legacy input filter. Since this is now a valid HTML5 element. + Fixed font families in order to provide appropriate web-safe fonts. +Version 4.1.7 (2014-11-27) + Added HTML5 schema support for srcset, source and picture. Patch contributed by mattheu. + Added new cache_suffix setting to enable cache busting by producing unique urls. + Added new paste_convert_word_fake_lists option to enable users to disable the fake lists convert logic. + Fixed so advlist style changes adds undo levels for each change. + Fixed bug where WebKit would sometimes produce an exception when the autolink plugin where looking for URLs. + Fixed bug where IE 7 wouldn't be rendered properly due to aggressive css compression. + Fixed bug where DomQuery wouldn't accept window as constructor element. + Fixed bug where the color picker in 3.x dialogs wouldn't work properly. Patch contributed by Callidior. + Fixed bug where the image plugin wouldn't respect the document_base_url. + Fixed bug where the jQuery plugin would fail to append to elements named array prototype names. +Version 4.1.6 (2014-10-08) + Fixed bug with clicking on the scrollbar of the iframe would cause a JS error to be thrown. + Fixed bug where null would produce an exception if you passed it to selection.setRng. + Fixed bug where Ctrl/Cmd+Tab would indent the current list item if you switched tabs in the browser. + Fixed bug where pasting empty cells from Excel would result in a broken table. + Fixed bug where it wasn't possible to switch back to default list style type. + Fixed issue where the select all quirk fix would fire for other modifiers than Ctrl/Cmd combinations. + Replaced jake with grunt since it is more mainstream and has better plugin support. +Version 4.1.5 (2014-09-09) + Fixed bug where sometimes the resize rectangles wouldn't properly render on images on WebKit/Blink. + Fixed bug in list plugin where delete/backspace would merge empty LI elements in lists incorrectly. + Fixed bug where empty list elements would result in empty LI elements without it's parent container. + Fixed bug where backspace in empty caret formatted element could produce an type error exception of Gecko. + Fixed bug where lists pasted from word with a custom start index above 9 wouldn't be properly handled. + Fixed bug where tabfocus plugin would tab out of the editor instance even if the default action was prevented. + Fixed bug where tabfocus wouldn't tab properly to other adjacent editor instances. + Fixed bug where the DOMUtils setStyles wouldn't properly removed or update the data-mce-style attribute. + Fixed bug where dialog select boxes would be placed incorrectly if document.body wasn't statically positioned. + Fixed bug where pasting would sometimes scroll to the top of page if the user was using the autoresize plugin. + Fixed bug where caret wouldn't be properly rendered by Chrome when clicking on the iframes documentElement. + Fixed so custom images for menubutton/splitbutton can be provided. Patch contributed by Naim Hammadi. + Fixed so the default action of windows closing can be prevented by blocking the default action of the close event. + Fixed so nodeChange and focus of the editor isn't automatically performed when opening sub dialogs. +Version 4.1.4 (2014-08-21) + Added new media_filter_html option to media plugin that blocks any conditional comments, scripts etc within a video element. + Added new content_security_policy option allows you to set custom policy for iframe contents. Patch contributed by Francois Chagnon. + Fixed bug where activate/deactivate events wasn't firing properly when switching between editors. + Fixed bug where placing the caret on iOS was difficult due to a WebKit bug with touch events. + Fixed bug where the resize helper wouldn't render properly on older IE versions. + Fixed bug where resizing images inside tables on older IE versions would sometimes fail depending mouse position. + Fixed bug where editor.insertContent would produce an exception when inserting select/option elements. + Fixed bug where extra empty paragraphs would be produced if block elements where inserted inside span elements. + Fixed bug where the spellchecker menu item wouldn't be properly checked if spell checking was started before it was rendered. + Fixed bug where the DomQuery filter function wouldn't remove non elements from collection. + Fixed bug where document with custom document.domain wouldn't properly render the editor. + Fixed bug where IE 8 would throw exception when trying to enter invalid color values into colorboxes. + Fixed bug where undo manager could incorrectly add an extra undo level when custom resize handles was removed. + Fixed bug where it wouldn't be possible to alter cell properties properly on table cells on IE 8. + Fixed so the color picker button in table dialog isn't shown unless you include the colorpicker plugin or add your own custom color picker. + Fixed so activate/deactivate events fire when windowManager opens a window since. + Fixed so the table advtab options isn't separated by an underscore to normalize naming with image_advtab option. + Fixed so the table cell dialog has proper padding when the advanced tab in disabled. +Version 4.1.3 (2014-07-29) + Added event binding logic to tinymce.util.XHR making it possible to override headers and settings before any request is made. + Fixed bug where drag events wasn't fireing properly on older IE versions since the event handlers where bound to document. + Fixed bug where drag/dropping contents within the editor on IE would force the contents into plain text mode even if it was internal content. + Fixed bug where IE 7 wouldn't open menus properly due to a resize bug in the browser auto closing them immediately. + Fixed bug where the DOMUtils getPos logic wouldn't produce a valid coordinate inside the body if the body was positioned non static. + Fixed bug where the element path and format state wasn't properly updated if you had the wordcount plugin enabled. + Fixed bug where a comment at the beginning of source would produce an exception in the formatter logic. + Fixed bug where setAttrib/getAttrib on null would throw exception together with any hooked attributes like style. + Fixed bug where table sizes wasn't properly retained when copy/pasting on WebKit/Blink. + Fixed bug where WebKit/Blink would produce colors in RGB format instead of the forced HEX format when deleting contents. + Fixed bug where the width attribute wasn't updated on tables if you changed the size inside the table dialog. + Fixed bug where control selection wasn't properly handled when the caret was placed directly after an image. + Fixed bug where selecting the contents of table cells using the selection.select method wouldn't place the caret properly. + Fixed bug where the selection state for images wasn't removed when placing the caret right after an image on WebKit/Blink. + Fixed bug where all events wasn't properly unbound when and editor instance was removed or destroyed by some external innerHTML call. + Fixed bug where it wasn't possible or very hard to select images on iOS when the onscreen keyboard was visible. + Fixed so auto_focus can take a boolean argument this will auto focus the last initialized editor might be useful for single inits. + Fixed so word auto detect lists logic works better for faked lists that doesn't have specific markup. + Fixed so nodeChange gets fired on mouseup as it used to before 4.1.1 we optimized that event to fire less often. + Removed the finish menu item from spellchecker menu since it's redundant you can stop spellchecking by toggling menu item or button. +Version 4.1.2 (2014-07-15) + Added offset/grep to DomQuery class works basically the same as it's jQuery equivalent. + Fixed bug where backspace/delete or setContent with an empty string would remove header data when using the fullpage plugin. + Fixed bug where tinymce.remove with a selector not matching any editors would remove all editors. + Fixed bug where resizing of the editor didn't work since the theme was calling setStyles instead of setStyle. + Fixed bug where IE 7 would fail to append html fragments to iframe document when using DomQuery. + Fixed bug where the getStyle DOMUtils method would produce an exception if it was called with null as it's element. + Fixed bug where the paste plugin would remove the element if the none of the paste_webkit_styles rules matched the current style. + Fixed bug where contextmenu table items wouldn't work properly on IE since it would some times fire an incorrect selection change. + Fixed bug where the padding/border values wasn't used in the size calculation for the body size when using autoresize. Patch contributed by Matt Whelan. + Fixed bug where conditional word comments wouldn't be properly removed when pasting plain text. + Fixed bug where resizing would sometime fail on IE 11 when the mouseup occurred inside the resizable element. + Fixed so the iframe gets initialized without any inline event handlers for better CSP support. Patch contributed by Matt Whelan. + Fixed so the tinymce.dom.Sizzle is the latest version of sizzle this resolves the document context bug. +Version 4.1.1 (2014-07-08) + Fixed bug where pasting plain text on some WebKit versions would result in an empty line. + Fixed bug where resizing images inside tables on IE 11 wouldn't work properly. + Fixed bug where IE 11 would sometimes throw "Invalid argument" exception when editor contents was set to an empty string. + Fixed bug where document.activeElement would throw exceptions on IE 9 when that element was hidden or removed from dom. + Fixed bug where WebKit/Blink sometimes produced br elements with the Apple-interchange-newline class. + Fixed bug where table cell selection wasn't properly removed when copy/pasting table cells. + Fixed bug where pasting nested list items from Word wouldn't produce proper semantic nested lists. + Fixed bug where right clicking using the contextmenu plugin on WebKit/Blink on Mac OS X would select the target current word or line. + Fixed bug where it wasn't possible to alter table cell properties on IE 8 using the context menu. + Fixed bug where the resize helper wouldn't be correctly positioned on older IE versions. + Fixed bug where fullpage plugin would produce an error if you didn't specify a doctype encoding. + Fixed bug where anchor plugin would get the name/id of the current element even if it wasn't anchor element. + Fixed bug where visual aids for tables wouldn't be properly disabled when changing the border size. + Fixed bug where some control selection events wasn't properly fired on older IE versions. + Fixed bug where table cell selection on older IE versions would prevent resizing of images. + Fixed bug with paste_data_images paste option not working properly on modern IE versions. + Fixed bug where custom elements with underscores in the name wasn't properly parsed/serialized. + Fixed bug where applying inline formats to nested list elements would produce an incorrect formatting result. + Fixed so it's possible to hide items from elements path by using preventDefault/stopPropagation. + Fixed so inline mode toolbar gets rendered right aligned if the editable element positioned to the documents right edge. + Fixed so empty inline elements inside empty block elements doesn't get removed if configured to be kept intact. + Fixed so DomQuery parentsUntil/prevUntil/nextUntil supports selectors/elements/filters etc. + Fixed so legacyoutput plugin overrides fontselect and fontsizeselect controls and handles font elements properly. +Version 4.1.0 (2014-06-18) + Added new file_picker_callback option to replace the old file_browser_callback the latter will still work though. + Added new custom colors to textcolor plugin will be displayed if a color picker is provided also shows the latest colors. + Added new color_picker_callback option to enable you to add custom color pickers to the editor. + Added new advanced tabs to table/cell/row dialogs to enable you to select colors for border/background. + Added new colorpicker plugin that lets you select colors from a hsv color picker. + Added new tinymce.util.Color class to handle color parsing and converting. + Added new colorpicker UI widget element lets you add a hsv color picker to any form/window. + Added new textpattern plugin that allows you to use markdown like text patterns to format contents. + Added new resize helper element that shows the current width & height while resizing. + Added new "once" method to Editor and EventDispatcher enables since callback execution events. + Added new jQuery like class under tinymce.dom.DomQuery it's exposed on editor instances (editor.$) and globally under (tinymce.$). + Fixed so the default resize method for images are proportional shift/ctrl can be used to make an unproportional size. + Fixed bug where the image_dimensions option of the image plugin would cause exceptions when it tried to update the size. + Fixed bug where table cell dialog class field wasn't properly updated when editing an a table cell with an existing class. + Fixed bug where Safari on Mac would produce webkit-fake-url for pasted images so these are now removed. + Fixed bug where the nodeChange event would get fired before the selection was changed when clicking inside the current selection range. + Fixed bug where valid_classes option would cause exception when it removed internal prefixed classes like mce-item-. + Fixed bug where backspace would cause navigation in IE 8 on an inline element and after a caret formatting was applied. + Fixed so placeholder images produced by the media plugin gets selected when inserted/edited. + Fixed so it's possible to drag in images when the paste_data_images option is enabled. Might be useful for mail clients. + Fixed so images doesn't get a width/height applied if the image_dimensions option is set to false useful for responsive contents. + Fixed so it's possible to pass in an optional arguments object for the nodeChanged function to be passed to all nodechange event listeners. + Fixed bug where media plugin embed code didn't update correctly. diff --git a/website/js/vendor/tinymce/js/tinymce/jquery.tinymce.min.js b/website/js/vendor/tinymce/js/tinymce/jquery.tinymce.min.js new file mode 100644 index 0000000..5a6ef56 --- /dev/null +++ b/website/js/vendor/tinymce/js/tinymce/jquery.tinymce.min.js @@ -0,0 +1,91 @@ +/** + * Copyright (c) Tiny Technologies, Inc. All rights reserved. + * Licensed under the LGPL or a commercial license. + * For LGPL see License.txt in the project root for license information. + * For commercial licenses see https://www.tiny.cloud/ + */ +/** + * Jquery integration plugin. + * + * @class tinymce.core.JqueryIntegration + * @private + */ +!function(){var f,c,u,p,d,s=[];d="undefined"!=typeof global?global:window,p=d.jQuery;function v(){ +// Reference to tinymce needs to be lazily evaluated since tinymce +// might be loaded through the compressor or other means +return d.tinymce}p.fn.tinymce=function(o){var e,t,i,l=this,r=""; +// No match then just ignore the call +if(!l.length)return l; +// Get editor instance +if(!o)return v()?v().get(l[0].id):null;l.css("visibility","hidden");function n(){var a=[],c=0; +// Apply patches to the jQuery object, only once +u||(m(),u=!0), +// Create an editor instance for each matched node +l.each(function(e,t){var n,i=t.id,r=o.oninit; +// Generate unique id for target element if needed +i||(t.id=i=v().DOM.uniqueId()), +// Only init the editor once +v().get(i)||( +// Create editor instance and render it +n=v().createEditor(i,o),a.push(n),n.on("init",function(){var e,t=r;l.css("visibility",""), +// Run this if the oninit setting is defined +// this logic will fire the oninit callback ones each +// matched editor instance is initialized +r&&++c==a.length&&("string"==typeof t&&(e=-1===t.indexOf(".")?null:v().resolve(t.replace(/\.\w+$/,"")),t=v().resolve(t)), +// Call the oninit function with the object +t.apply(e||v(),a))}))}), +// Render the editor instances in a separate loop since we +// need to have the full editors array used in the onInit calls +p.each(a,function(e,t){t.render()})} +// Load TinyMCE on demand, if we need to +if(d.tinymce||c||!(e=o.script_url)) +// Delay the init call until tinymce is loaded +1===c?s.push(n):n();else{c=1,t=e.substring(0,e.lastIndexOf("/")), +// Check if it's a dev/src version they want to load then +// make sure that all plugins, themes etc are loaded in source mode as well +-1!=e.indexOf(".min")&&(r=".min"), +// Setup tinyMCEPreInit object this will later be used by the TinyMCE +// core script to locate other resources like CSS files, dialogs etc +// You can also predefined a tinyMCEPreInit object and then it will use that instead +d.tinymce=d.tinyMCEPreInit||{base:t,suffix:r}, +// url contains gzip then we assume it's a compressor +-1!=e.indexOf("gzip")&&(i=o.language||"en",e=e+(/\?/.test(e)?"&":"?")+"js=true&core=true&suffix="+escape(r)+"&themes="+escape(o.theme||"modern")+"&plugins="+escape(o.plugins||"")+"&languages="+(i||""), +// Check if compressor script is already loaded otherwise setup a basic one +d.tinyMCE_GZ||(d.tinyMCE_GZ={start:function(){function n(e){v().ScriptLoader.markDone(v().baseURI.toAbsolute(e))} +// Add core languages +n("langs/"+i+".js"), +// Add themes with languages +n("themes/"+o.theme+"/theme"+r+".js"),n("themes/"+o.theme+"/langs/"+i+".js"), +// Add plugins with languages +p.each(o.plugins.split(","),function(e,t){t&&(n("plugins/"+t+"/plugin"+r+".js"),n("plugins/"+t+"/langs/"+i+".js"))})},end:function(){}}));var a=document.createElement("script");a.type="text/javascript",a.onload=a.onreadystatechange=function(e){e=e||window.event,2===c||"load"!=e.type&&!/complete|loaded/.test(a.readyState)||(v().dom.Event.domLoaded=1,c=2, +// Execute callback after mainscript has been loaded and before the initialization occurs +o.script_loaded&&o.script_loaded(),n(),p.each(s,function(e,t){t()}))},a.src=e,document.body.appendChild(a)}return l}, +// Add :tinymce pseudo selector this will select elements that has been converted into editor instances +// it's now possible to use things like $('*:tinymce') to get all TinyMCE bound elements. +p.extend(p.expr[":"],{tinymce:function(e){var t;return!!(e.id&&"tinymce"in d&&(t=v().get(e.id))&&t.editorManager===v())}}); +// This function patches internal jQuery functions so that if +// you for example remove an div element containing an editor it's +// automatically destroyed by the TinyMCE API +var m=function(){function r(e){ +// If the function is remove +"remove"===e&&this.each(function(e,t){var n=u(t);n&&n.remove()}),this.find("span.mceEditor,div.mceEditor").each(function(e,t){var n=v().get(t.id.replace(/_parent$/,""));n&&n.remove()})}function o(i){var e,t=this; +// Handle set value +/*jshint eqnull:true */if(null!=i)r.call(t), +// Saves the contents before get/set value of textarea/div +t.each(function(e,t){var n;(n=v().get(t.id))&&n.setContent(i)});else if(0])*>/g,""):n.getContent({save:!0}):a.apply(p(t),r)}),i}}), +// Makes it possible to use $('#id').append("content"); to append contents to the TinyMCE editor iframe +p.each(["append","prepend"],function(e,t){var n=s[t]=p.fn[t],r="prepend"===t;p.fn[t]=function(i){var e=this;return l(e)?i!==f?("string"==typeof i&&e.filter(":tinymce").each(function(e,t){var n=u(t);n&&n.setContent(r?i+n.getContent():n.getContent()+i)}),n.apply(e.not(":tinymce"),arguments),e):void 0:n.apply(e,arguments)}}), +// Makes sure that the editor instance gets properly destroyed when the parent element is removed +p.each(["remove","replaceWith","replaceAll","empty"],function(e,t){var n=s[t]=p.fn[t];p.fn[t]=function(){return r.call(this,t),n.apply(this,arguments)}}),s.attr=p.fn.attr, +// Makes sure that $('#tinymce_id').attr('value') gets the editors current HTML contents +p.fn.attr=function(e,t){var n=this,i=arguments;if(!e||"value"!==e||!l(n))return s.attr.apply(n,i);if(t!==f)return o.call(n.filter(":tinymce"),t),s.attr.apply(n.not(":tinymce"),i),n;// return original set for chaining +var r=n[0],a=u(r);return a?a.getContent({save:!0}):s.attr.apply(p(r),i)}}}(); \ No newline at end of file diff --git a/website/js/vendor/tinymce/js/tinymce/langs/de.js b/website/js/vendor/tinymce/js/tinymce/langs/de.js new file mode 100644 index 0000000..f7a5b00 --- /dev/null +++ b/website/js/vendor/tinymce/js/tinymce/langs/de.js @@ -0,0 +1,389 @@ +tinymce.addI18n('de',{ +"Redo": "Wiederholen", +"Undo": "R\u00fcckg\u00e4ngig machen", +"Cut": "Ausschneiden", +"Copy": "Kopieren", +"Paste": "Einf\u00fcgen", +"Select all": "Alles ausw\u00e4hlen", +"New document": "Neues Dokument", +"Ok": "Ok", +"Cancel": "Abbrechen", +"Visual aids": "Visuelle Hilfen", +"Bold": "Fett", +"Italic": "Kursiv", +"Underline": "Unterstrichen", +"Strikethrough": "Durchgestrichen", +"Superscript": "Hochgestellt", +"Subscript": "Tiefgestellt", +"Clear formatting": "Formatierung entfernen", +"Align left": "Linksb\u00fcndig ausrichten", +"Align center": "Zentrieren", +"Align right": "Rechtsb\u00fcndig ausrichten", +"Justify": "Blocksatz", +"Bullet list": "Aufz\u00e4hlung", +"Numbered list": "Nummerierte Liste", +"Decrease indent": "Einzug verkleinern", +"Increase indent": "Einzug vergr\u00f6\u00dfern", +"Close": "Schlie\u00dfen", +"Formats": "Formate", +"Your browser doesn't support direct access to the clipboard. Please use the Ctrl+X\/C\/V keyboard shortcuts instead.": "Ihr Browser unterst\u00fctzt leider keinen direkten Zugriff auf die Zwischenablage. Bitte benutzen Sie die Tastenkombinationen Strg+X\/C\/V.", +"Headers": "\u00dcberschriften", +"Header 1": "\u00dcberschrift 1", +"Header 2": "\u00dcberschrift 2", +"Header 3": "\u00dcberschrift 3", +"Header 4": "\u00dcberschrift 4", +"Header 5": "\u00dcberschrift 5", +"Header 6": "\u00dcberschrift 6", +"Headings": "\u00dcberschriften", +"Heading 1": "Kopfzeile 1", +"Heading 2": "Kopfzeile 2", +"Heading 3": "Kopfzeile 3", +"Heading 4": "Kopfzeile 4", +"Heading 5": "Kopfzeile 5", +"Heading 6": "Kopfzeile 6", +"Preformatted": "Vorformatiert", +"Div": "Div", +"Pre": "Pre", +"Code": "Code", +"Paragraph": "Absatz", +"Blockquote": "Blockquote", +"Inline": "Zeichenformate", +"Blocks": "Bl\u00f6cke", +"Paste is now in plain text mode. Contents will now be pasted as plain text until you toggle this option off.": "Einf\u00fcgen ist nun im einfachen Textmodus. Inhalte werden ab jetzt als unformatierter Text eingef\u00fcgt, bis Sie diese Einstellung wieder ausschalten!", +"Fonts": "Schriftarten", +"Font Sizes": "Schriftgr\u00f6\u00dfe", +"Class": "Klasse", +"Browse for an image": "Bild...", +"OR": "ODER", +"Drop an image here": "Bild hier ablegen", +"Upload": "Hochladen", +"Block": "Blocksatz", +"Align": "Ausrichten", +"Default": "Standard", +"Circle": "Kreis", +"Disc": "Punkt", +"Square": "Quadrat", +"Lower Alpha": "Kleinbuchstaben", +"Lower Greek": "Griechische Kleinbuchstaben", +"Lower Roman": "R\u00f6mische Zahlen (Kleinbuchstaben)", +"Upper Alpha": "Gro\u00dfbuchstaben", +"Upper Roman": "R\u00f6mische Zahlen (Gro\u00dfbuchstaben)", +"Anchor...": "Textmarke", +"Name": "Name", +"Id": "Kennung", +"Id should start with a letter, followed only by letters, numbers, dashes, dots, colons or underscores.": "Die Kennung sollte mit einem Buchstaben anfangen. Nachfolgend nur Buchstaben, Zahlen, Striche (Minus), Punkte, Kommas und Unterstriche.", +"You have unsaved changes are you sure you want to navigate away?": "Die \u00c4nderungen wurden noch nicht gespeichert, sind Sie sicher, dass Sie diese Seite verlassen wollen?", +"Restore last draft": "Letzten Entwurf wiederherstellen", +"Special characters...": "Sonderzeichen...", +"Source code": "Quelltext", +"Insert\/Edit code sample": "Codebeispiel einf\u00fcgen\/bearbeiten", +"Language": "Sprache", +"Code sample...": "Codebeispiel...", +"Color Picker": "Farbwahl", +"R": "R", +"G": "G", +"B": "B", +"Left to right": "Von links nach rechts", +"Right to left": "Von rechts nach links", +"Emoticons...": "Emoticons...", +"Metadata and Document Properties": "Dokument-Eigenschaften und -Metadaten", +"Title": "Titel", +"Keywords": "Sch\u00fcsselw\u00f6rter", +"Description": "Beschreibung", +"Robots": "Robots", +"Author": "Verfasser", +"Encoding": "Zeichenkodierung", +"Fullscreen": "Vollbild", +"Action": "Aktion", +"Shortcut": "Shortcut", +"Help": "Hilfe", +"Address": "Adresse", +"Focus to menubar": "Fokus auf Men\u00fcleiste", +"Focus to toolbar": "Fokus auf Werkzeugleiste", +"Focus to element path": "Fokus auf Elementpfad", +"Focus to contextual toolbar": "Fokus auf kontextbezogene Werkzeugleiste", +"Insert link (if link plugin activated)": "Link einf\u00fcgen (wenn Link-Plugin aktiviert ist)", +"Save (if save plugin activated)": "Speichern (wenn Save-Plugin aktiviert ist)", +"Find (if searchreplace plugin activated)": "Suchen einf\u00fcgen (wenn Suchen\/Ersetzen-Plugin aktiviert ist)", +"Plugins installed ({0}):": "installierte Plugins ({0}):", +"Premium plugins:": "Premium Plugins:", +"Learn more...": "Erfahren Sie mehr dazu...", +"You are using {0}": "Sie verwenden {0}", +"Plugins": "Plugins", +"Handy Shortcuts": "Praktische Tastenkombinationen", +"Horizontal line": "Horizontale Linie", +"Insert\/edit image": "Bild einf\u00fcgen\/bearbeiten", +"Image description": "Bildbeschreibung", +"Source": "Quelle", +"Dimensions": "Abmessungen", +"Constrain proportions": "Seitenverh\u00e4ltnis beibehalten", +"General": "Allgemein", +"Advanced": "Erweitert", +"Style": "Stil", +"Vertical space": "Vertikaler Abstand", +"Horizontal space": "Horizontaler Abstand", +"Border": "Rahmen", +"Insert image": "Bild einf\u00fcgen", +"Image...": "Bild...", +"Image list": "Bildliste", +"Rotate counterclockwise": "Gegen den Uhrzeigersinn drehen", +"Rotate clockwise": "Im Uhrzeigersinn drehen", +"Flip vertically": "Vertikal spiegeln", +"Flip horizontally": "Horizontal spiegeln", +"Edit image": "Bild bearbeiten", +"Image options": "Bildeigenschaften", +"Zoom in": "Ansicht vergr\u00f6\u00dfern", +"Zoom out": "Ansicht verkleinern", +"Crop": "Bescheiden", +"Resize": "Skalieren", +"Orientation": "Ausrichtung", +"Brightness": "Helligkeit", +"Sharpen": "Sch\u00e4rfen", +"Contrast": "Kontrast", +"Color levels": "Farbwerte", +"Gamma": "Gamma", +"Invert": "Invertieren", +"Apply": "Anwenden", +"Back": "Zur\u00fcck", +"Insert date\/time": "Datum\/Uhrzeit einf\u00fcgen ", +"Date\/time": "Datum\/Uhrzeit", +"Insert\/Edit Link": "Link einf\u00fcgen\/bearbeiten", +"Insert\/edit link": "Link einf\u00fcgen\/bearbeiten", +"Text to display": "Anzuzeigender Text", +"Url": "URL", +"Open link in...": "Link \u00f6ffnen in...", +"Current window": "Aktuelles Fenster", +"None": "Keine", +"New window": "Neues Fenster", +"Remove link": "Link entfernen", +"Anchors": "Textmarken", +"Link...": "Link...", +"Paste or type a link": "Link einf\u00fcgen oder eintippen", +"The URL you entered seems to be an email address. Do you want to add the required mailto: prefix?": "Diese Adresse scheint eine E-Mail-Adresse zu sein. M\u00f6chten Sie das dazu ben\u00f6tigte \"mailto:\" voranstellen?", +"The URL you entered seems to be an external link. Do you want to add the required http:\/\/ prefix?": "Diese Adresse scheint ein externer Link zu sein. M\u00f6chten Sie das dazu ben\u00f6tigte \"http:\/\/\" voranstellen?", +"Link list": "Linkliste", +"Insert video": "Video einf\u00fcgen", +"Insert\/edit video": "Video einf\u00fcgen\/bearbeiten", +"Insert\/edit media": "Medien einf\u00fcgen\/bearbeiten", +"Alternative source": "Alternative Quelle", +"Alternative source URL": "URL der alternativen Quelle", +"Media poster (Image URL)": "Medienposter (Bild-URL)", +"Paste your embed code below:": "F\u00fcgen Sie Ihren Einbettungscode hier ein:", +"Embed": "Einbetten", +"Media...": "Medien...", +"Nonbreaking space": "Gesch\u00fctztes Leerzeichen", +"Page break": "Seitenumbruch", +"Paste as text": "Als Text einf\u00fcgen", +"Preview": "Vorschau", +"Print...": "Drucken...", +"Save": "Speichern", +"Find": "Suchen", +"Replace with": "Ersetzen durch", +"Replace": "Ersetzen", +"Replace all": "Alles ersetzen", +"Previous": "Vorherige", +"Next": "Weiter", +"Find and replace...": "Suchen und ersetzen...", +"Could not find the specified string.": "Die Zeichenfolge wurde nicht gefunden.", +"Match case": "Gro\u00df-\/Kleinschreibung beachten", +"Find whole words only": "Nur ganze W\u00f6rter suchen", +"Spell check": "Rechschreibpr\u00fcfung", +"Ignore": "Ignorieren", +"Ignore all": "Alles Ignorieren", +"Finish": "Ende", +"Add to Dictionary": "Zum W\u00f6rterbuch hinzuf\u00fcgen", +"Insert table": "Tabelle einf\u00fcgen", +"Table properties": "Tabelleneigenschaften", +"Delete table": "Tabelle l\u00f6schen", +"Cell": "Zelle", +"Row": "Zeile", +"Column": "Spalte", +"Cell properties": "Zelleneigenschaften", +"Merge cells": "Zellen verbinden", +"Split cell": "Zelle aufteilen", +"Insert row before": "Neue Zeile davor einf\u00fcgen ", +"Insert row after": "Neue Zeile danach einf\u00fcgen", +"Delete row": "Zeile l\u00f6schen", +"Row properties": "Zeileneigenschaften", +"Cut row": "Zeile ausschneiden", +"Copy row": "Zeile kopieren", +"Paste row before": "Zeile davor einf\u00fcgen", +"Paste row after": "Zeile danach einf\u00fcgen", +"Insert column before": "Neue Spalte davor einf\u00fcgen", +"Insert column after": "Neue Spalte danach einf\u00fcgen", +"Delete column": "Spalte l\u00f6schen", +"Cols": "Spalten", +"Rows": "Zeilen", +"Width": "Breite", +"Height": "H\u00f6he", +"Cell spacing": "Zellenabstand", +"Cell padding": "Zelleninnenabstand", +"Show caption": "Beschriftung anzeigen", +"Left": "Linksb\u00fcndig", +"Center": "Zentriert", +"Right": "Rechtsb\u00fcndig", +"Cell type": "Zellentyp", +"Scope": "G\u00fcltigkeitsbereich", +"Alignment": "Ausrichtung", +"H Align": "Horizontale Ausrichtung", +"V Align": "Vertikale Ausrichtung", +"Top": "Oben", +"Middle": "Mitte", +"Bottom": "Unten", +"Header cell": "Kopfzelle", +"Row group": "Zeilengruppe", +"Column group": "Spaltengruppe", +"Row type": "Zeilentyp", +"Header": "Kopfzeile", +"Body": "Inhalt", +"Footer": "Fu\u00dfzeile", +"Border color": "Rahmenfarbe", +"Insert template...": "Vorlage einf\u00fcgen...", +"Templates": "Vorlagen", +"Template": "Vorlage", +"Text color": "Textfarbe", +"Background color": "Hintergrundfarbe", +"Custom...": "Benutzerdefiniert...", +"Custom color": "Benutzerdefinierte Farbe", +"No color": "Keine Farbe", +"Remove color": "Farbauswahl aufheben", +"Table of Contents": "Inhaltsverzeichnis", +"Show blocks": "Bl\u00f6cke anzeigen", +"Show invisible characters": "Unsichtbare Zeichen anzeigen", +"Word count": "Anzahl der W\u00f6rter", +"Words: {0}": "W\u00f6rter: {0}", +"{0} words": "{0} W\u00f6rter", +"File": "Datei", +"Edit": "Bearbeiten", +"Insert": "Einf\u00fcgen", +"View": "Ansicht", +"Format": "Format", +"Table": "Tabelle", +"Tools": "Werkzeuge", +"Powered by {0}": "Betrieben von {0}", +"Rich Text Area. Press ALT-F9 for menu. Press ALT-F10 for toolbar. Press ALT-0 for help": "Rich-Text- Area. Dr\u00fccken Sie ALT-F9 f\u00fcr das Men\u00fc. Dr\u00fccken Sie ALT-F10 f\u00fcr Symbolleiste. Dr\u00fccken Sie ALT-0 f\u00fcr Hilfe", +"Image title": "Bildtitel", +"Border width": "Rahmenbreite", +"Border style": "Rahmenstil", +"Error": "Fehler", +"Warn": "Warnung", +"Valid": "G\u00fcltig", +"To open the popup, press Shift+Enter": "Dr\u00fccken Sie Umschalt+Eingabe, um das Popup-Fenster zu \u00f6ffnen.", +"Rich Text Area. Press ALT-0 for help.": "Rich-Text-Bereich. Dr\u00fccken Sie Alt+0 f\u00fcr Hilfe.", +"System Font": "Betriebssystemschriftart", +"Failed to upload image: {0}": "Bild konnte nicht hochgeladen werden: {0}", +"Failed to load plugin: {0} from url {1}": "Plugin konnte nicht geladen werden: {0} von URL {1}", +"Failed to load plugin url: {0}": "Plugin-URL konnte nicht geladen werden: {0}", +"Failed to initialize plugin: {0}": "Plugin konnte nicht initialisiert werden: {0}", +"example": "Beispiel", +"Search": "Suchen", +"All": "Alles", +"Currency": "W\u00e4hrung", +"Text": "Text", +"Quotations": "Anf\u00fchrungszeichen", +"Mathematical": "Mathematisch", +"Extended Latin": "Erweitertes Latein", +"Symbols": "Symbole", +"Arrows": "Pfeile", +"User Defined": "Benutzerdefiniert", +"dollar sign": "Dollarzeichen", +"currency sign": "W\u00e4hrungssymbol", +"euro-currency sign": "Eurozeichen", +"colon sign": "Doppelpunkt", +"cruzeiro sign": "Cruzeirozeichen", +"french franc sign": "Franczeichen", +"lira sign": "Lirezeichen", +"mill sign": "Millzeichen", +"naira sign": "Nairazeichen", +"peseta sign": "Pesetazeichen", +"rupee sign": "Rupiezeichen", +"won sign": "Wonzeichen", +"new sheqel sign": "Schekelzeichen", +"dong sign": "Dongzeichen", +"kip sign": "Kipzeichen", +"tugrik sign": "Tugrikzeichen", +"drachma sign": "Drachmezeichen", +"german penny symbol": "Pfennigzeichen", +"peso sign": "Pesozeichen", +"guarani sign": "Guaranizeichen", +"austral sign": "Australzeichen", +"hryvnia sign": "Hrywnjazeichen", +"cedi sign": "Cedizeichen", +"livre tournois sign": "Livrezeichen", +"spesmilo sign": "Spesmilozeichen", +"tenge sign": "Tengezeichen", +"indian rupee sign": "Indisches Rupiezeichen", +"turkish lira sign": "T\u00fcrkisches Lirazeichen", +"nordic mark sign": "Zeichen nordische Mark", +"manat sign": "Manatzeichen", +"ruble sign": "Rubelzeichen", +"yen character": "Yenzeichen", +"yuan character": "Yuanzeichen", +"yuan character, in hong kong and taiwan": "Yuanzeichen in Hongkong und Taiwan", +"yen\/yuan character variant one": "Yen-\/Yuanzeichen Variante 1", +"Loading emoticons...": "Emoticons werden geladen...", +"Could not load emoticons": "Emoticons konnten nicht geladen werden", +"People": "Menschen", +"Animals and Nature": "Tiere und Natur", +"Food and Drink": "Essen und Trinken", +"Activity": "Aktivit\u00e4t", +"Travel and Places": "Reisen und Orte", +"Objects": "Objekte", +"Flags": "Flaggen", +"Characters": "Zeichen", +"Characters (no spaces)": "Zeichen (ohne Leerzeichen)", +"Error: Form submit field collision.": "Fehler: Kollision der Formularbest\u00e4tigungsfelder.", +"Error: No form element found.": "Fehler: Kein Formularelement gefunden.", +"Update": "Aktualisieren", +"Color swatch": "Farbpalette", +"Turquoise": "T\u00fcrkis", +"Green": "Gr\u00fcn", +"Blue": "Blau", +"Purple": "Violett", +"Navy Blue": "Marineblau", +"Dark Turquoise": "Dunkelt\u00fcrkis", +"Dark Green": "Dunkelgr\u00fcn", +"Medium Blue": "Mittleres Blau", +"Medium Purple": "Mittelviolett", +"Midnight Blue": "Mitternachtsblau", +"Yellow": "Gelb", +"Orange": "Orange", +"Red": "Rot", +"Light Gray": "Hellgrau", +"Gray": "Grau", +"Dark Yellow": "Dunkelgelb", +"Dark Orange": "Dunkelorange", +"Dark Red": "Dunkelrot", +"Medium Gray": "Mittelgrau", +"Dark Gray": "Dunkelgrau", +"Black": "Schwarz", +"White": "Wei\u00df", +"Switch to or from fullscreen mode": "Vollbildmodus umschalten", +"Open help dialog": "Hilfe-Dialog \u00f6ffnen", +"history": "Historie", +"styles": "Stile", +"formatting": "Formatierung", +"alignment": "Ausrichtung", +"indentation": "Einr\u00fcckungen", +"permanent pen": "Textmarker", +"comments": "Anmerkungen", +"Anchor": "Textmarke", +"Special character": "Sonderzeichen", +"Code sample": "Codebeispiel", +"Color": "Farbe", +"Emoticons": "Emoticons", +"Document properties": "Dokumenteigenschaften", +"Image": "Bild", +"Insert link": "Link einf\u00fcgen", +"Target": "Ziel", +"Link": "Link", +"Poster": "Poster", +"Media": "Medium", +"Print": "Drucken", +"Prev": "Zur\u00fcck", +"Find and replace": "Suchen und ersetzen", +"Whole words": "Nur ganze W\u00f6rter", +"Spellcheck": "Rechtschreibpr\u00fcfung", +"Caption": "Beschriftung", +"Insert template": "Vorlage einf\u00fcgen " +}); \ No newline at end of file diff --git a/website/js/vendor/tinymce/js/tinymce/langs/fr_FR.js b/website/js/vendor/tinymce/js/tinymce/langs/fr_FR.js new file mode 100644 index 0000000..2d074f8 --- /dev/null +++ b/website/js/vendor/tinymce/js/tinymce/langs/fr_FR.js @@ -0,0 +1,389 @@ +tinymce.addI18n('fr_FR',{ +"Redo": "R\u00e9tablir", +"Undo": "Annuler", +"Cut": "Couper", +"Copy": "Copier", +"Paste": "Coller", +"Select all": "S\u00e9lectionner tout", +"New document": "Nouveau document", +"Ok": "OK", +"Cancel": "Annuler", +"Visual aids": "Aides visuelles", +"Bold": "Gras", +"Italic": "Italique", +"Underline": "Soulign\u00e9", +"Strikethrough": "Barr\u00e9", +"Superscript": "Exposant", +"Subscript": "Indice", +"Clear formatting": "Effacer la mise en forme", +"Align left": "Aligner \u00e0 gauche", +"Align center": "Centrer", +"Align right": "Aligner \u00e0 droite", +"Justify": "Justifier", +"Bullet list": "Liste \u00e0 puces", +"Numbered list": "Liste num\u00e9rot\u00e9e", +"Decrease indent": "R\u00e9duire le retrait", +"Increase indent": "Augmenter le retrait", +"Close": "Fermer", +"Formats": "Formats", +"Your browser doesn't support direct access to the clipboard. Please use the Ctrl+X\/C\/V keyboard shortcuts instead.": "Votre navigateur ne supporte pas l\u2019acc\u00e8s direct au presse-papiers. Merci d'utiliser les raccourcis clavier Ctrl+X\/C\/V.", +"Headers": "En-t\u00eates", +"Header 1": "En-t\u00eate 1", +"Header 2": "En-t\u00eate 2", +"Header 3": "En-t\u00eate 3", +"Header 4": "En-t\u00eate 4", +"Header 5": "En-t\u00eate 5", +"Header 6": "En-t\u00eate 6", +"Headings": "Titres", +"Heading 1": "Titre\u00a01", +"Heading 2": "Titre\u00a02", +"Heading 3": "Titre\u00a03", +"Heading 4": "Titre\u00a04", +"Heading 5": "Titre\u00a05", +"Heading 6": "Titre\u00a06", +"Preformatted": "Pr\u00e9format\u00e9", +"Div": "Div", +"Pre": "Pre", +"Code": "Code", +"Paragraph": "Paragraphe", +"Blockquote": "Blockquote", +"Inline": "En ligne", +"Blocks": "Blocs", +"Paste is now in plain text mode. Contents will now be pasted as plain text until you toggle this option off.": "Le presse-papiers est maintenant en mode \"texte plein\". Les contenus seront coll\u00e9s sans retenir les formatages jusqu'\u00e0 ce que vous d\u00e9sactiviez cette option.", +"Fonts": "Polices", +"Font Sizes": "Tailles de police", +"Class": "Classe", +"Browse for an image": "Rechercher une image", +"OR": "OU", +"Drop an image here": "D\u00e9poser une image ici", +"Upload": "T\u00e9l\u00e9charger", +"Block": "Bloc", +"Align": "Aligner", +"Default": "Par d\u00e9faut", +"Circle": "Cercle", +"Disc": "Disque", +"Square": "Carr\u00e9", +"Lower Alpha": "Alpha minuscule", +"Lower Greek": "Grec minuscule", +"Lower Roman": "Romain minuscule", +"Upper Alpha": "Alpha majuscule", +"Upper Roman": "Romain majuscule", +"Anchor...": "Ancre...", +"Name": "Nom", +"Id": "Id", +"Id should start with a letter, followed only by letters, numbers, dashes, dots, colons or underscores.": "L'Id doit commencer par une lettre suivi par des lettres, nombres, tirets, points, deux-points ou underscores", +"You have unsaved changes are you sure you want to navigate away?": "Vous avez des modifications non enregistr\u00e9es, \u00eates-vous s\u00fbr de quitter la page?", +"Restore last draft": "Restaurer le dernier brouillon", +"Special characters...": "Caract\u00e8res sp\u00e9ciaux...", +"Source code": "Code source", +"Insert\/Edit code sample": "Ins\u00e9rer \/ modifier une exemple de code", +"Language": "Langue", +"Code sample...": "Exemple de code...", +"Color Picker": "S\u00e9lecteur de couleurs", +"R": "R", +"G": "V", +"B": "B", +"Left to right": "Gauche \u00e0 droite", +"Right to left": "Droite \u00e0 gauche", +"Emoticons...": "\u00c9motic\u00f4nes...", +"Metadata and Document Properties": "M\u00e9tadonn\u00e9es et propri\u00e9t\u00e9s du document", +"Title": "Titre", +"Keywords": "Mots-cl\u00e9s", +"Description": "Description", +"Robots": "Robots", +"Author": "Auteur", +"Encoding": "Encodage", +"Fullscreen": "Plein \u00e9cran", +"Action": "Action", +"Shortcut": "Raccourci", +"Help": "Aide", +"Address": "Adresse", +"Focus to menubar": "Cibler la barre de menu", +"Focus to toolbar": "Cibler la barre d'outils", +"Focus to element path": "Cibler le chemin vers l'\u00e9l\u00e9ment", +"Focus to contextual toolbar": "Cibler la barre d'outils contextuelle", +"Insert link (if link plugin activated)": "Ins\u00e9rer un lien (si le module link est activ\u00e9)", +"Save (if save plugin activated)": "Enregistrer (si le module save est activ\u00e9)", +"Find (if searchreplace plugin activated)": "Rechercher (si le module searchreplace est activ\u00e9)", +"Plugins installed ({0}):": "Modules install\u00e9s ({0}) : ", +"Premium plugins:": "Modules premium :", +"Learn more...": "En savoir plus...", +"You are using {0}": "Vous utilisez {0}", +"Plugins": "Plugins", +"Handy Shortcuts": "Raccourcis utiles", +"Horizontal line": "Ligne horizontale", +"Insert\/edit image": "Ins\u00e9rer\/modifier une image", +"Image description": "Description de l'image", +"Source": "Source", +"Dimensions": "Dimensions", +"Constrain proportions": "Conserver les proportions", +"General": "G\u00e9n\u00e9ral", +"Advanced": "Avanc\u00e9", +"Style": "Style", +"Vertical space": "Espacement vertical", +"Horizontal space": "Espacement horizontal", +"Border": "Bordure", +"Insert image": "Ins\u00e9rer une image", +"Image...": "Image...", +"Image list": "Liste d'images", +"Rotate counterclockwise": "Rotation anti-horaire", +"Rotate clockwise": "Rotation horaire", +"Flip vertically": "Retournement vertical", +"Flip horizontally": "Retournement horizontal", +"Edit image": "Modifier l'image", +"Image options": "Options de l'image", +"Zoom in": "Zoomer", +"Zoom out": "D\u00e9zoomer", +"Crop": "Rogner", +"Resize": "Redimensionner", +"Orientation": "Orientation", +"Brightness": "Luminosit\u00e9", +"Sharpen": "Affiner", +"Contrast": "Contraste", +"Color levels": "Niveaux de couleur", +"Gamma": "Gamma", +"Invert": "Inverser", +"Apply": "Appliquer", +"Back": "Retour", +"Insert date\/time": "Ins\u00e9rer date\/heure", +"Date\/time": "Date\/heure", +"Insert\/Edit Link": "Ins\u00e9rer\/Modifier lien", +"Insert\/edit link": "Ins\u00e9rer\/modifier un lien", +"Text to display": "Texte \u00e0 afficher", +"Url": "Url", +"Open link in...": "Ouvrir le lien dans...", +"Current window": "Fen\u00eatre active", +"None": "n\/a", +"New window": "Nouvelle fen\u00eatre", +"Remove link": "Enlever le lien", +"Anchors": "Ancres", +"Link...": "Lien...", +"Paste or type a link": "Coller ou taper un lien", +"The URL you entered seems to be an email address. Do you want to add the required mailto: prefix?": "L'URL que vous avez entr\u00e9e semble \u00eatre une adresse e-mail. Voulez-vous ajouter le pr\u00e9fixe mailto: n\u00e9cessaire?", +"The URL you entered seems to be an external link. Do you want to add the required http:\/\/ prefix?": "L'URL que vous avez entr\u00e9e semble \u00eatre un lien externe. Voulez-vous ajouter le pr\u00e9fixe http:\/\/ n\u00e9cessaire?", +"Link list": "Liste de liens", +"Insert video": "Ins\u00e9rer une vid\u00e9o", +"Insert\/edit video": "Ins\u00e9rer\/modifier une vid\u00e9o", +"Insert\/edit media": "Ins\u00e9rer\/modifier un m\u00e9dia", +"Alternative source": "Source alternative", +"Alternative source URL": "URL de la source alternative", +"Media poster (Image URL)": "Affiche de m\u00e9dia (URL de l'image)", +"Paste your embed code below:": "Collez votre code d'int\u00e9gration ci-dessous :", +"Embed": "Int\u00e9grer", +"Media...": "M\u00e9dia...", +"Nonbreaking space": "Espace ins\u00e9cable", +"Page break": "Saut de page", +"Paste as text": "Coller comme texte", +"Preview": "Pr\u00e9visualiser", +"Print...": "Imprimer...", +"Save": "Enregistrer", +"Find": "Chercher", +"Replace with": "Remplacer par", +"Replace": "Remplacer", +"Replace all": "Tout remplacer", +"Previous": "Pr\u00e9c\u00e9dente", +"Next": "Suiv", +"Find and replace...": "Trouver et remplacer...", +"Could not find the specified string.": "Impossible de trouver la cha\u00eene sp\u00e9cifi\u00e9e.", +"Match case": "Respecter la casse", +"Find whole words only": "Mot entier", +"Spell check": "V\u00e9rification de l'orthographe", +"Ignore": "Ignorer", +"Ignore all": "Tout ignorer", +"Finish": "Finie", +"Add to Dictionary": "Ajouter au dictionnaire", +"Insert table": "Ins\u00e9rer un tableau", +"Table properties": "Propri\u00e9t\u00e9s du tableau", +"Delete table": "Supprimer le tableau", +"Cell": "Cellule", +"Row": "Ligne", +"Column": "Colonne", +"Cell properties": "Propri\u00e9t\u00e9s de la cellule", +"Merge cells": "Fusionner les cellules", +"Split cell": "Diviser la cellule", +"Insert row before": "Ins\u00e9rer une ligne avant", +"Insert row after": "Ins\u00e9rer une ligne apr\u00e8s", +"Delete row": "Effacer la ligne", +"Row properties": "Propri\u00e9t\u00e9s de la ligne", +"Cut row": "Couper la ligne", +"Copy row": "Copier la ligne", +"Paste row before": "Coller la ligne avant", +"Paste row after": "Coller la ligne apr\u00e8s", +"Insert column before": "Ins\u00e9rer une colonne avant", +"Insert column after": "Ins\u00e9rer une colonne apr\u00e8s", +"Delete column": "Effacer la colonne", +"Cols": "Colonnes", +"Rows": "Lignes", +"Width": "Largeur", +"Height": "Hauteur", +"Cell spacing": "Espacement inter-cellulles", +"Cell padding": "Espacement interne cellule", +"Show caption": "Afficher le sous-titrage", +"Left": "Gauche", +"Center": "Centr\u00e9", +"Right": "Droite", +"Cell type": "Type de cellule", +"Scope": "Etendue", +"Alignment": "Alignement", +"H Align": "Alignement H", +"V Align": "Alignement V", +"Top": "Haut", +"Middle": "Milieu", +"Bottom": "Bas", +"Header cell": "Cellule d'en-t\u00eate", +"Row group": "Groupe de lignes", +"Column group": "Groupe de colonnes", +"Row type": "Type de ligne", +"Header": "En-t\u00eate", +"Body": "Corps", +"Footer": "Pied", +"Border color": "Couleur de la bordure", +"Insert template...": "Ins\u00e9rer un mod\u00e8le...", +"Templates": "Th\u00e8mes", +"Template": "Mod\u00e8le", +"Text color": "Couleur du texte", +"Background color": "Couleur d'arri\u00e8re-plan", +"Custom...": "Personnalis\u00e9...", +"Custom color": "Couleur personnalis\u00e9e", +"No color": "Aucune couleur", +"Remove color": "Supprimer la couleur", +"Table of Contents": "Table des mati\u00e8res", +"Show blocks": "Afficher les blocs", +"Show invisible characters": "Afficher les caract\u00e8res invisibles", +"Word count": "Nombre de mots", +"Words: {0}": "Mots : {0}", +"{0} words": "{0} mots", +"File": "Fichier", +"Edit": "Editer", +"Insert": "Ins\u00e9rer", +"View": "Voir", +"Format": "Format", +"Table": "Tableau", +"Tools": "Outils", +"Powered by {0}": "Propuls\u00e9 par {0}", +"Rich Text Area. Press ALT-F9 for menu. Press ALT-F10 for toolbar. Press ALT-0 for help": "Zone Texte Riche. Appuyer sur ALT-F9 pour le menu. Appuyer sur ALT-F10 pour la barre d'outils. Appuyer sur ALT-0 pour de l'aide.", +"Image title": "Titre d'image", +"Border width": "\u00c9paisseur de la bordure", +"Border style": "Style de la bordure", +"Error": "Erreur", +"Warn": "Avertir", +"Valid": "Valide", +"To open the popup, press Shift+Enter": "Pour ouvrir la popup, appuyez sur Maj+Entr\u00e9e", +"Rich Text Area. Press ALT-0 for help.": "Zone de texte riche. Appuyez sur ALT-0 pour l'aide.", +"System Font": "Police syst\u00e8me", +"Failed to upload image: {0}": "\u00c9chec d'envoi de l'image\u00a0: {0}", +"Failed to load plugin: {0} from url {1}": "\u00c9chec de chargement du plug-in\u00a0: {0} \u00e0 partir de l\u2019URL {1} ", +"Failed to load plugin url: {0}": "\u00c9chec de chargement de l'URL du plug-in\u00a0: {0}", +"Failed to initialize plugin: {0}": "\u00c9chec d'initialisation du plug-in\u00a0: {0}", +"example": "exemple", +"Search": "Rechercher", +"All": "Tout", +"Currency": "Devise", +"Text": "Texte", +"Quotations": "Citations", +"Mathematical": "Op\u00e9rateurs math\u00e9matiques", +"Extended Latin": "Latin \u00e9tendu", +"Symbols": "Symboles", +"Arrows": "Fl\u00e8ches", +"User Defined": "D\u00e9fini par l'utilisateur", +"dollar sign": "Symbole dollar", +"currency sign": "Symbole devise", +"euro-currency sign": "Symbole euro", +"colon sign": "Symbole col\u00f3n", +"cruzeiro sign": "Symbole cruzeiro", +"french franc sign": "Symbole franc fran\u00e7ais", +"lira sign": "Symbole lire", +"mill sign": "Symbole milli\u00e8me", +"naira sign": "Symbole naira", +"peseta sign": "Symbole peseta", +"rupee sign": "Symbole roupie", +"won sign": "Symbole won", +"new sheqel sign": "Symbole nouveau ch\u00e9kel", +"dong sign": "Symbole dong", +"kip sign": "Symbole kip", +"tugrik sign": "Symbole tougrik", +"drachma sign": "Symbole drachme", +"german penny symbol": "Symbole pfennig", +"peso sign": "Symbole peso", +"guarani sign": "Symbole guarani", +"austral sign": "Symbole austral", +"hryvnia sign": "Symbole hryvnia", +"cedi sign": "Symbole cedi", +"livre tournois sign": "Symbole livre tournois", +"spesmilo sign": "Symbole spesmilo", +"tenge sign": "Symbole tenge", +"indian rupee sign": "Symbole roupie indienne", +"turkish lira sign": "Symbole lire turque", +"nordic mark sign": "Symbole du mark nordique", +"manat sign": "Symbole manat", +"ruble sign": "Symbole rouble", +"yen character": "Sinogramme Yen", +"yuan character": "Sinogramme Yuan", +"yuan character, in hong kong and taiwan": "Sinogramme Yuan, Hong Kong et Taiwan", +"yen\/yuan character variant one": "Sinogramme Yen\/Yuan, premi\u00e8re variante", +"Loading emoticons...": "Chargement des \u00e9motic\u00f4nes en cours...", +"Could not load emoticons": "\u00c9chec de chargement des \u00e9motic\u00f4nes", +"People": "Personnes", +"Animals and Nature": "Animaux & nature", +"Food and Drink": "Nourriture & boissons", +"Activity": "Activit\u00e9", +"Travel and Places": "Voyages & lieux", +"Objects": "Objets", +"Flags": "Drapeaux", +"Characters": "Caract\u00e8res", +"Characters (no spaces)": "Caract\u00e8res (espaces non compris)", +"Error: Form submit field collision.": "Erreur : conflit de champs lors de la soumission du formulaire", +"Error: No form element found.": "Erreur : aucun \u00e9l\u00e9ment de formulaire trouv\u00e9.", +"Update": "Mettre \u00e0 jour", +"Color swatch": "\u00c9chantillon de couleurs", +"Turquoise": "Turquoise", +"Green": "Vert", +"Blue": "Bleu", +"Purple": "Violet", +"Navy Blue": "Bleu marine", +"Dark Turquoise": "Turquoise fonc\u00e9", +"Dark Green": "Vert fonc\u00e9", +"Medium Blue": "Bleu moyen", +"Medium Purple": "Violet moyen", +"Midnight Blue": "Bleu de minuit", +"Yellow": "Jaune", +"Orange": "Orange", +"Red": "Rouge", +"Light Gray": "Gris clair", +"Gray": "Gris", +"Dark Yellow": "Jaune fonc\u00e9", +"Dark Orange": "Orange fonc\u00e9", +"Dark Red": "Rouge fonc\u00e9", +"Medium Gray": "Gris moyen", +"Dark Gray": "Gris fonc\u00e9", +"Black": "Noir", +"White": "Blanc", +"Switch to or from fullscreen mode": "Passer en ou quitter le mode plein \u00e9cran", +"Open help dialog": "Ouvrir la bo\u00eete de dialogue d'aide", +"history": "historique", +"styles": "styles", +"formatting": "mise en forme", +"alignment": "alignement", +"indentation": "retrait", +"permanent pen": "feutre ind\u00e9l\u00e9bile", +"comments": "commentaires", +"Anchor": "Ancre", +"Special character": "Caract\u00e8res sp\u00e9ciaux", +"Code sample": "Extrait de code", +"Color": "Couleur", +"Emoticons": "Emotic\u00f4nes", +"Document properties": "Propri\u00e9t\u00e9 du document", +"Image": "Image", +"Insert link": "Ins\u00e9rer un lien", +"Target": "Cible", +"Link": "Lien", +"Poster": "Publier", +"Media": "M\u00e9dia", +"Print": "Imprimer", +"Prev": "Pr\u00e9c ", +"Find and replace": "Trouver et remplacer", +"Whole words": "Mots entiers", +"Spellcheck": "V\u00e9rification orthographique", +"Caption": "Titre", +"Insert template": "Ajouter un th\u00e8me" +}); \ No newline at end of file diff --git a/website/js/vendor/tinymce/js/tinymce/langs/readme.md b/website/js/vendor/tinymce/js/tinymce/langs/readme.md new file mode 100644 index 0000000..a52bf03 --- /dev/null +++ b/website/js/vendor/tinymce/js/tinymce/langs/readme.md @@ -0,0 +1,3 @@ +This is where language files should be placed. + +Please DO NOT translate these directly use this service: https://www.transifex.com/projects/p/tinymce/ diff --git a/website/js/vendor/tinymce/js/tinymce/license.txt b/website/js/vendor/tinymce/js/tinymce/license.txt new file mode 100644 index 0000000..b17fc90 --- /dev/null +++ b/website/js/vendor/tinymce/js/tinymce/license.txt @@ -0,0 +1,504 @@ + GNU LESSER GENERAL PUBLIC LICENSE + Version 2.1, February 1999 + + Copyright (C) 1991, 1999 Free Software Foundation, Inc. + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + +[This is the first released version of the Lesser GPL. It also counts + as the successor of the GNU Library Public License, version 2, hence + the version number 2.1.] + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +Licenses are intended to guarantee your freedom to share and change +free software--to make sure the software is free for all its users. + + This license, the Lesser General Public License, applies to some +specially designated software packages--typically libraries--of the +Free Software Foundation and other authors who decide to use it. You +can use it too, but we suggest you first think carefully about whether +this license or the ordinary General Public License is the better +strategy to use in any particular case, based on the explanations below. + + When we speak of free software, we are referring to freedom of use, +not price. Our General Public Licenses are designed to make sure that +you have the freedom to distribute copies of free software (and charge +for this service if you wish); that you receive source code or can get +it if you want it; that you can change the software and use pieces of +it in new free programs; and that you are informed that you can do +these things. + + To protect your rights, we need to make restrictions that forbid +distributors to deny you these rights or to ask you to surrender these +rights. These restrictions translate to certain responsibilities for +you if you distribute copies of the library or if you modify it. + + For example, if you distribute copies of the library, whether gratis +or for a fee, you must give the recipients all the rights that we gave +you. You must make sure that they, too, receive or can get the source +code. If you link other code with the library, you must provide +complete object files to the recipients, so that they can relink them +with the library after making changes to the library and recompiling +it. And you must show them these terms so they know their rights. + + We protect your rights with a two-step method: (1) we copyright the +library, and (2) we offer you this license, which gives you legal +permission to copy, distribute and/or modify the library. + + To protect each distributor, we want to make it very clear that +there is no warranty for the free library. Also, if the library is +modified by someone else and passed on, the recipients should know +that what they have is not the original version, so that the original +author's reputation will not be affected by problems that might be +introduced by others. + + Finally, software patents pose a constant threat to the existence of +any free program. We wish to make sure that a company cannot +effectively restrict the users of a free program by obtaining a +restrictive license from a patent holder. Therefore, we insist that +any patent license obtained for a version of the library must be +consistent with the full freedom of use specified in this license. + + Most GNU software, including some libraries, is covered by the +ordinary GNU General Public License. This license, the GNU Lesser +General Public License, applies to certain designated libraries, and +is quite different from the ordinary General Public License. We use +this license for certain libraries in order to permit linking those +libraries into non-free programs. + + When a program is linked with a library, whether statically or using +a shared library, the combination of the two is legally speaking a +combined work, a derivative of the original library. The ordinary +General Public License therefore permits such linking only if the +entire combination fits its criteria of freedom. The Lesser General +Public License permits more lax criteria for linking other code with +the library. + + We call this license the "Lesser" General Public License because it +does Less to protect the user's freedom than the ordinary General +Public License. It also provides other free software developers Less +of an advantage over competing non-free programs. These disadvantages +are the reason we use the ordinary General Public License for many +libraries. However, the Lesser license provides advantages in certain +special circumstances. + + For example, on rare occasions, there may be a special need to +encourage the widest possible use of a certain library, so that it becomes +a de-facto standard. To achieve this, non-free programs must be +allowed to use the library. A more frequent case is that a free +library does the same job as widely used non-free libraries. In this +case, there is little to gain by limiting the free library to free +software only, so we use the Lesser General Public License. + + In other cases, permission to use a particular library in non-free +programs enables a greater number of people to use a large body of +free software. For example, permission to use the GNU C Library in +non-free programs enables many more people to use the whole GNU +operating system, as well as its variant, the GNU/Linux operating +system. + + Although the Lesser General Public License is Less protective of the +users' freedom, it does ensure that the user of a program that is +linked with the Library has the freedom and the wherewithal to run +that program using a modified version of the Library. + + The precise terms and conditions for copying, distribution and +modification follow. Pay close attention to the difference between a +"work based on the library" and a "work that uses the library". The +former contains code derived from the library, whereas the latter must +be combined with the library in order to run. + + GNU LESSER GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License Agreement applies to any software library or other +program which contains a notice placed by the copyright holder or +other authorized party saying it may be distributed under the terms of +this Lesser General Public License (also called "this License"). +Each licensee is addressed as "you". + + A "library" means a collection of software functions and/or data +prepared so as to be conveniently linked with application programs +(which use some of those functions and data) to form executables. + + The "Library", below, refers to any such software library or work +which has been distributed under these terms. A "work based on the +Library" means either the Library or any derivative work under +copyright law: that is to say, a work containing the Library or a +portion of it, either verbatim or with modifications and/or translated +straightforwardly into another language. (Hereinafter, translation is +included without limitation in the term "modification".) + + "Source code" for a work means the preferred form of the work for +making modifications to it. For a library, complete source code means +all the source code for all modules it contains, plus any associated +interface definition files, plus the scripts used to control compilation +and installation of the library. + + Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running a program using the Library is not restricted, and output from +such a program is covered only if its contents constitute a work based +on the Library (independent of the use of the Library in a tool for +writing it). Whether that is true depends on what the Library does +and what the program that uses the Library does. + + 1. You may copy and distribute verbatim copies of the Library's +complete source code as you receive it, in any medium, provided that +you conspicuously and appropriately publish on each copy an +appropriate copyright notice and disclaimer of warranty; keep intact +all the notices that refer to this License and to the absence of any +warranty; and distribute a copy of this License along with the +Library. + + You may charge a fee for the physical act of transferring a copy, +and you may at your option offer warranty protection in exchange for a +fee. + + 2. You may modify your copy or copies of the Library or any portion +of it, thus forming a work based on the Library, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) The modified work must itself be a software library. + + b) You must cause the files modified to carry prominent notices + stating that you changed the files and the date of any change. + + c) You must cause the whole of the work to be licensed at no + charge to all third parties under the terms of this License. + + d) If a facility in the modified Library refers to a function or a + table of data to be supplied by an application program that uses + the facility, other than as an argument passed when the facility + is invoked, then you must make a good faith effort to ensure that, + in the event an application does not supply such function or + table, the facility still operates, and performs whatever part of + its purpose remains meaningful. + + (For example, a function in a library to compute square roots has + a purpose that is entirely well-defined independent of the + application. Therefore, Subsection 2d requires that any + application-supplied function or table used by this function must + be optional: if the application does not supply it, the square + root function must still compute square roots.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Library, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Library, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote +it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Library. + +In addition, mere aggregation of another work not based on the Library +with the Library (or with a work based on the Library) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may opt to apply the terms of the ordinary GNU General Public +License instead of this License to a given copy of the Library. To do +this, you must alter all the notices that refer to this License, so +that they refer to the ordinary GNU General Public License, version 2, +instead of to this License. (If a newer version than version 2 of the +ordinary GNU General Public License has appeared, then you can specify +that version instead if you wish.) Do not make any other change in +these notices. + + Once this change is made in a given copy, it is irreversible for +that copy, so the ordinary GNU General Public License applies to all +subsequent copies and derivative works made from that copy. + + This option is useful when you wish to copy part of the code of +the Library into a program that is not a library. + + 4. You may copy and distribute the Library (or a portion or +derivative of it, under Section 2) in object code or executable form +under the terms of Sections 1 and 2 above provided that you accompany +it with the complete corresponding machine-readable source code, which +must be distributed under the terms of Sections 1 and 2 above on a +medium customarily used for software interchange. + + If distribution of object code is made by offering access to copy +from a designated place, then offering equivalent access to copy the +source code from the same place satisfies the requirement to +distribute the source code, even though third parties are not +compelled to copy the source along with the object code. + + 5. A program that contains no derivative of any portion of the +Library, but is designed to work with the Library by being compiled or +linked with it, is called a "work that uses the Library". Such a +work, in isolation, is not a derivative work of the Library, and +therefore falls outside the scope of this License. + + However, linking a "work that uses the Library" with the Library +creates an executable that is a derivative of the Library (because it +contains portions of the Library), rather than a "work that uses the +library". The executable is therefore covered by this License. +Section 6 states terms for distribution of such executables. + + When a "work that uses the Library" uses material from a header file +that is part of the Library, the object code for the work may be a +derivative work of the Library even though the source code is not. +Whether this is true is especially significant if the work can be +linked without the Library, or if the work is itself a library. The +threshold for this to be true is not precisely defined by law. + + If such an object file uses only numerical parameters, data +structure layouts and accessors, and small macros and small inline +functions (ten lines or less in length), then the use of the object +file is unrestricted, regardless of whether it is legally a derivative +work. (Executables containing this object code plus portions of the +Library will still fall under Section 6.) + + Otherwise, if the work is a derivative of the Library, you may +distribute the object code for the work under the terms of Section 6. +Any executables containing that work also fall under Section 6, +whether or not they are linked directly with the Library itself. + + 6. As an exception to the Sections above, you may also combine or +link a "work that uses the Library" with the Library to produce a +work containing portions of the Library, and distribute that work +under terms of your choice, provided that the terms permit +modification of the work for the customer's own use and reverse +engineering for debugging such modifications. + + You must give prominent notice with each copy of the work that the +Library is used in it and that the Library and its use are covered by +this License. You must supply a copy of this License. If the work +during execution displays copyright notices, you must include the +copyright notice for the Library among them, as well as a reference +directing the user to the copy of this License. Also, you must do one +of these things: + + a) Accompany the work with the complete corresponding + machine-readable source code for the Library including whatever + changes were used in the work (which must be distributed under + Sections 1 and 2 above); and, if the work is an executable linked + with the Library, with the complete machine-readable "work that + uses the Library", as object code and/or source code, so that the + user can modify the Library and then relink to produce a modified + executable containing the modified Library. (It is understood + that the user who changes the contents of definitions files in the + Library will not necessarily be able to recompile the application + to use the modified definitions.) + + b) Use a suitable shared library mechanism for linking with the + Library. A suitable mechanism is one that (1) uses at run time a + copy of the library already present on the user's computer system, + rather than copying library functions into the executable, and (2) + will operate properly with a modified version of the library, if + the user installs one, as long as the modified version is + interface-compatible with the version that the work was made with. + + c) Accompany the work with a written offer, valid for at + least three years, to give the same user the materials + specified in Subsection 6a, above, for a charge no more + than the cost of performing this distribution. + + d) If distribution of the work is made by offering access to copy + from a designated place, offer equivalent access to copy the above + specified materials from the same place. + + e) Verify that the user has already received a copy of these + materials or that you have already sent this user a copy. + + For an executable, the required form of the "work that uses the +Library" must include any data and utility programs needed for +reproducing the executable from it. However, as a special exception, +the materials to be distributed need not include anything that is +normally distributed (in either source or binary form) with the major +components (compiler, kernel, and so on) of the operating system on +which the executable runs, unless that component itself accompanies +the executable. + + It may happen that this requirement contradicts the license +restrictions of other proprietary libraries that do not normally +accompany the operating system. Such a contradiction means you cannot +use both them and the Library together in an executable that you +distribute. + + 7. You may place library facilities that are a work based on the +Library side-by-side in a single library together with other library +facilities not covered by this License, and distribute such a combined +library, provided that the separate distribution of the work based on +the Library and of the other library facilities is otherwise +permitted, and provided that you do these two things: + + a) Accompany the combined library with a copy of the same work + based on the Library, uncombined with any other library + facilities. This must be distributed under the terms of the + Sections above. + + b) Give prominent notice with the combined library of the fact + that part of it is a work based on the Library, and explaining + where to find the accompanying uncombined form of the same work. + + 8. You may not copy, modify, sublicense, link with, or distribute +the Library except as expressly provided under this License. Any +attempt otherwise to copy, modify, sublicense, link with, or +distribute the Library is void, and will automatically terminate your +rights under this License. However, parties who have received copies, +or rights, from you under this License will not have their licenses +terminated so long as such parties remain in full compliance. + + 9. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Library or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Library (or any work based on the +Library), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Library or works based on it. + + 10. Each time you redistribute the Library (or any work based on the +Library), the recipient automatically receives a license from the +original licensor to copy, distribute, link with or modify the Library +subject to these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties with +this License. + + 11. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Library at all. For example, if a patent +license would not permit royalty-free redistribution of the Library by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Library. + +If any portion of this section is held invalid or unenforceable under any +particular circumstance, the balance of the section is intended to apply, +and the section as a whole is intended to apply in other circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 12. If the distribution and/or use of the Library is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Library under this License may add +an explicit geographical distribution limitation excluding those countries, +so that distribution is permitted only in or among countries not thus +excluded. In such case, this License incorporates the limitation as if +written in the body of this License. + + 13. The Free Software Foundation may publish revised and/or new +versions of the Lesser General Public License from time to time. +Such new versions will be similar in spirit to the present version, +but may differ in detail to address new problems or concerns. + +Each version is given a distinguishing version number. If the Library +specifies a version number of this License which applies to it and +"any later version", you have the option of following the terms and +conditions either of that version or of any later version published by +the Free Software Foundation. If the Library does not specify a +license version number, you may choose any version ever published by +the Free Software Foundation. + + 14. If you wish to incorporate parts of the Library into other free +programs whose distribution conditions are incompatible with these, +write to the author to ask for permission. For software which is +copyrighted by the Free Software Foundation, write to the Free +Software Foundation; we sometimes make exceptions for this. Our +decision will be guided by the two goals of preserving the free status +of all derivatives of our free software and of promoting the sharing +and reuse of software generally. + + NO WARRANTY + + 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO +WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. +EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR +OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY +KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE +LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME +THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN +WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY +AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU +FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR +CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE +LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING +RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A +FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF +SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Libraries + + If you develop a new library, and you want it to be of the greatest +possible use to the public, we recommend making it free software that +everyone can redistribute and change. You can do so by permitting +redistribution under these terms (or, alternatively, under the terms of the +ordinary General Public License). + + To apply these terms, attach the following notices to the library. It is +safest to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least the +"copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +Also add information on how to contact you by electronic and paper mail. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the library, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the + library `Frob' (a library for tweaking knobs) written by James Random Hacker. + + , 1 April 1990 + Ty Coon, President of Vice + +That's all there is to it! + + diff --git a/website/js/vendor/tinymce/js/tinymce/plugins/advlist/plugin.min.js b/website/js/vendor/tinymce/js/tinymce/plugins/advlist/plugin.min.js new file mode 100644 index 0000000..f11035d --- /dev/null +++ b/website/js/vendor/tinymce/js/tinymce/plugins/advlist/plugin.min.js @@ -0,0 +1,9 @@ +/** + * Copyright (c) Tiny Technologies, Inc. All rights reserved. + * Licensed under the LGPL or a commercial license. + * For LGPL see License.txt in the project root for license information. + * For commercial licenses see https://www.tiny.cloud/ + * + * Version: 5.1.5 (2019-12-19) + */ +!function(){"use strict";function n(){}function o(n){return function(){return n}}function t(){return d}var e,r=tinymce.util.Tools.resolve("tinymce.PluginManager"),u=tinymce.util.Tools.resolve("tinymce.util.Tools"),l=function(n,t,e){var r="UL"===t?"InsertUnorderedList":"InsertOrderedList";n.execCommand(r,!1,!1===e?null:{"list-style-type":e})},i=function(e){e.addCommand("ApplyUnorderedListStyle",function(n,t){l(e,"UL",t["list-style-type"])}),e.addCommand("ApplyOrderedListStyle",function(n,t){l(e,"OL",t["list-style-type"])})},c=function(n){var t=n.getParam("advlist_number_styles","default,lower-alpha,lower-greek,lower-roman,upper-alpha,upper-roman");return t?t.split(/[ ,]/):[]},s=function(n){var t=n.getParam("advlist_bullet_styles","default,circle,square");return t?t.split(/[ ,]/):[]},f=o(!1),a=o(!0),d=(e={fold:function(n,t){return n()},is:f,isSome:f,isNone:a,getOr:m,getOrThunk:p,getOrDie:function(n){throw new Error(n||"error: getOrDie called on none.")},getOrNull:o(null),getOrUndefined:o(undefined),or:m,orThunk:p,map:t,each:n,bind:t,exists:f,forall:a,filter:t,equals:g,equals_:g,toArray:function(){return[]},toString:o("none()")},Object.freeze&&Object.freeze(e),e);function g(n){return n.isNone()}function p(n){return n()}function m(n){return n}function y(n,t,e){var r=function(n,t){for(var e=0;ey(e)&&(i=o+g);var l=z(e);if(l&&l]*>((\xa0| |[ \t]|]*>)+?|)|
$","i").test(e)}function i(t){var e=parseInt(v.getItem(o(t)+"time"),10)||0;return!((new Date).getTime()-e>function(t){return r(t.settings.autosave_retention,"20m")}(t))||(g(t,!1),!1)}function u(t){var e=o(t);!a(t)&&t.isDirty()&&(v.setItem(e+"draft",t.getContent({format:"raw",no_events:!0})),v.setItem(e+"time",(new Date).getTime().toString()),function(t){t.fire("StoreDraft")}(t))}function s(t){var e=o(t);i(t)&&(t.setContent(v.getItem(e+"draft"),{format:"raw"}),function(t){t.fire("RestoreDraft")}(t))}function c(t,e){var n=function(t){return r(t.settings.autosave_interval,"30s")}(t);e.get()||(m.setInterval(function(){t.removed||u(t)},n),e.set(!0))}function f(t){t.undoManager.transact(function(){s(t),g(t)}),t.focus()}var l=function(t){function e(){return n}var n=t;return{get:e,set:function(t){n=t},clone:function(){return l(e())}}},t=tinymce.util.Tools.resolve("tinymce.PluginManager"),m=tinymce.util.Tools.resolve("tinymce.util.Delay"),v=tinymce.util.Tools.resolve("tinymce.util.LocalStorage"),d=tinymce.util.Tools.resolve("tinymce.util.Tools"),g=function(t,e){var n=o(t);v.removeItem(n+"draft"),v.removeItem(n+"time"),!1!==e&&function(t){t.fire("RemoveDraft")}(t)};function y(r){for(var o=[],t=1;t(.*?)<\/a>/gi,"[url=$1]$2[/url]"),o(/(.*?)<\/font>/gi,"[code][color=$1]$2[/color][/code]"),o(/(.*?)<\/font>/gi,"[quote][color=$1]$2[/color][/quote]"),o(/(.*?)<\/font>/gi,"[code][color=$1]$2[/color][/code]"),o(/(.*?)<\/font>/gi,"[quote][color=$1]$2[/color][/quote]"),o(/(.*?)<\/span>/gi,"[color=$1]$2[/color]"),o(/(.*?)<\/font>/gi,"[color=$1]$2[/color]"),o(/(.*?)<\/span>/gi,"[size=$1]$2[/size]"),o(/(.*?)<\/font>/gi,"$1"),o(//gi,"[img]$1[/img]"),o(/(.*?)<\/span>/gi,"[code]$1[/code]"),o(/(.*?)<\/span>/gi,"[quote]$1[/quote]"),o(/(.*?)<\/strong>/gi,"[code][b]$1[/b][/code]"),o(/(.*?)<\/strong>/gi,"[quote][b]$1[/b][/quote]"),o(/(.*?)<\/em>/gi,"[code][i]$1[/i][/code]"),o(/(.*?)<\/em>/gi,"[quote][i]$1[/i][/quote]"),o(/(.*?)<\/u>/gi,"[code][u]$1[/u][/code]"),o(/(.*?)<\/u>/gi,"[quote][u]$1[/u][/quote]"),o(/<\/(strong|b)>/gi,"[/b]"),o(/<(strong|b)>/gi,"[b]"),o(/<\/(em|i)>/gi,"[/i]"),o(/<(em|i)>/gi,"[i]"),o(/<\/u>/gi,"[/u]"),o(/(.*?)<\/span>/gi,"[u]$1[/u]"),o(//gi,"[u]"),o(/]*>/gi,"[quote]"),o(/<\/blockquote>/gi,"[/quote]"),o(/
/gi,"\n"),o(//gi,"\n"),o(/
/gi,"\n"),o(/

/gi,""),o(/<\/p>/gi,"\n"),o(/ |\u00a0/gi," "),o(/"/gi,'"'),o(/</gi,"<"),o(/>/gi,">"),o(/&/gi,"&"),t},i=function(t){t=e.trim(t);function o(o,e){t=t.replace(o,e)}return o(/\n/gi,"
"),o(/\[b\]/gi,""),o(/\[\/b\]/gi,""),o(/\[i\]/gi,""),o(/\[\/i\]/gi,""),o(/\[u\]/gi,""),o(/\[\/u\]/gi,""),o(/\[url=([^\]]+)\](.*?)\[\/url\]/gi,'$2'),o(/\[url\](.*?)\[\/url\]/gi,'$1'),o(/\[img\](.*?)\[\/img\]/gi,''),o(/\[color=(.*?)\](.*?)\[\/color\]/gi,'$2'),o(/\[code\](.*?)\[\/code\]/gi,'$1 '),o(/\[quote.*?\](.*?)\[\/quote\]/gi,'$1 '),t};!function n(){o.add("bbcode",function(o){o.on("BeforeSetContent",function(o){o.content=i(o.content)}),o.on("PostProcess",function(o){o.set&&(o.content=i(o.content)),o.get&&(o.content=t(o.content))})})}()}(); \ No newline at end of file diff --git a/website/js/vendor/tinymce/js/tinymce/plugins/charmap/plugin.min.js b/website/js/vendor/tinymce/js/tinymce/plugins/charmap/plugin.min.js new file mode 100644 index 0000000..b1623c9 --- /dev/null +++ b/website/js/vendor/tinymce/js/tinymce/plugins/charmap/plugin.min.js @@ -0,0 +1,9 @@ +/** + * Copyright (c) Tiny Technologies, Inc. All rights reserved. + * Licensed under the LGPL or a commercial license. + * For LGPL see License.txt in the project root for license information. + * For commercial licenses see https://www.tiny.cloud/ + * + * Version: 5.1.5 (2019-12-19) + */ +!function(c){"use strict";function n(){}function i(n){return function(){return n}}function e(){return m}var r,t=tinymce.util.Tools.resolve("tinymce.PluginManager"),a=function(n,e){return n.fire("insertCustomChar",{chr:e})},u=function(n,e){var r=a(n,e).chr;n.execCommand("mceInsertContent",!1,r)},o=tinymce.util.Tools.resolve("tinymce.util.Tools"),s=function(n){return n.settings.charmap},l=function(n){return n.settings.charmap_append},f=i(!1),g=i(!0),m=(r={fold:function(n,e){return n()},is:f,isSome:f,isNone:g,getOr:p,getOrThunk:d,getOrDie:function(n){throw new Error(n||"error: getOrDie called on none.")},getOrNull:i(null),getOrUndefined:i(undefined),or:p,orThunk:d,map:e,each:n,bind:e,exists:f,forall:g,filter:e,equals:h,equals_:h,toArray:function(){return[]},toString:i("none()")},Object.freeze&&Object.freeze(r),r);function h(n){return n.isNone()}function d(n){return n()}function p(n){return n}function y(e){return function(n){return function(n){if(null===n)return"null";var e=typeof n;return"object"==e&&(Array.prototype.isPrototypeOf(n)||n.constructor&&"Array"===n.constructor.name)?"array":"object"==e&&(String.prototype.isPrototypeOf(n)||n.constructor&&"String"===n.constructor.name)?"string":e}(n)===e}}function w(n,e){for(var r=n.length,t=new Array(r),a=0;ae.length)break e;if(!(h instanceof a)){u.lastIndex=0;var m=u.exec(h);if(m){g&&(d=m[1].length);var b=m.index-1+d,y=b+(m=m[0].slice(d)).length,v=h.slice(0,b+1),k=h.slice(y+1),w=[f,1];v&&w.push(v);var x=new a(o,c?S.tokenize(m,c):m,p);w.push(x),k&&w.push(k),Array.prototype.splice.apply(r,w)}}}}}return r},hooks:{all:{},add:function(e,t){var n=S.hooks.all;n[e]=n[e]||[],n[e].push(t)},run:function(e,t){var n=S.hooks.all[e];if(n&&n.length)for(var a=0,r=void 0;r=n[a++];)r(t)}}},s=S.Token=function(e,t,n){this.type=e,this.content=t,this.alias=n};if(s.stringify=function(t,n,e){if("string"==typeof t)return t;if("Array"===S.util.type(t))return t.map(function(e){return s.stringify(e,n,t)}).join("");var a={type:t.type,content:s.stringify(t.content,n,e),tag:"span",classes:["token",t.type],attributes:{},language:n,parent:e};if("comment"===a.type&&(a.attributes.spellcheck="true"),t.alias){var r="Array"===S.util.type(t.alias)?t.alias:[t.alias];Array.prototype.push.apply(a.classes,r)}S.hooks.run("wrap",a);var i="";for(var o in a.attributes)i+=(i?" ":"")+o+'="'+(a.attributes[o]||"")+'"';return"<"+a.tag+' class="'+a.classes.join(" ")+'" '+i+">"+a.content+""},!g.document)return g.addEventListener&&g.addEventListener("message",function(e){var t=JSON.parse(e.data),n=t.language,a=t.code,r=t.immediateClose;g.postMessage(S.highlight(a,S.languages[n],n)),r&&g.close()},!1),g.Prism}();void 0!==n&&(n.Prism=i),i.languages.markup={comment://,prolog:/<\?[\w\W]+?\?>/,doctype://,cdata://i,tag:{pattern:/<\/?[^\s>\/=.]+(?:\s+[^\s>\/=]+(?:=(?:("|')(?:\\\1|\\?(?!\1)[\w\W])*\1|[^\s'">=]+))?)*\s*\/?>/i,inside:{tag:{pattern:/^<\/?[^\s>\/]+/i,inside:{punctuation:/^<\/?/,namespace:/^[^\s>\/:]+:/}},"attr-value":{pattern:/=(?:('|")[\w\W]*?(\1)|[^\s>]+)/i,inside:{punctuation:/[=>"']/}},punctuation:/\/?>/,"attr-name":{pattern:/[^\s>\/]+/,inside:{namespace:/^[^\s>\/:]+:/}}}},entity:/&#?[\da-z]{1,8};/i},i.hooks.add("wrap",function(e){"entity"===e.type&&(e.attributes.title=e.content.replace(/&/,"&"))}),i.languages.xml=i.languages.markup,i.languages.html=i.languages.markup,i.languages.mathml=i.languages.markup,i.languages.svg=i.languages.markup,i.languages.css={comment:/\/\*[\w\W]*?\*\//,atrule:{pattern:/@[\w-]+?.*?(;|(?=\s*\{))/i,inside:{rule:/@[\w-]+/}},url:/url\((?:(["'])(\\(?:\r\n|[\w\W])|(?!\1)[^\\\r\n])*\1|.*?)\)/i,selector:/[^\{\}\s][^\{\};]*?(?=\s*\{)/,string:/("|')(\\(?:\r\n|[\w\W])|(?!\1)[^\\\r\n])*\1/,property:/(\b|\B)[\w-]+(?=\s*:)/i,important:/\B!important\b/i,"function":/[-a-z0-9]+(?=\()/i,punctuation:/[(){};:]/},i.languages.css.atrule.inside.rest=i.util.clone(i.languages.css),i.languages.markup&&(i.languages.insertBefore("markup","tag",{style:{pattern:/[\w\W]*?<\/style>/i,inside:{tag:{pattern:/|<\/style>/i,inside:i.languages.markup.tag.inside},rest:i.languages.css},alias:"language-css"}}),i.languages.insertBefore("inside","attr-value",{"style-attr":{pattern:/\s*style=("|').*?\1/i,inside:{"attr-name":{pattern:/^\s*style/i,inside:i.languages.markup.tag.inside},punctuation:/^\s*=\s*['"]|['"]\s*$/,"attr-value":{pattern:/.+/i,inside:i.languages.css}},alias:"language-css"}},i.languages.markup.tag)),i.languages.clike={comment:[{pattern:/(^|[^\\])\/\*[\w\W]*?\*\//,lookbehind:!0},{pattern:/(^|[^\\:])\/\/.*/,lookbehind:!0}],string:/(["'])(\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,"class-name":{pattern:/((?:\b(?:class|interface|extends|implements|trait|instanceof|new)\s+)|(?:catch\s+\())[a-z0-9_\.\\]+/i,lookbehind:!0,inside:{punctuation:/(\.|\\)/}},keyword:/\b(if|else|while|do|for|return|in|instanceof|function|new|try|throw|catch|finally|null|break|continue)\b/,"boolean":/\b(true|false)\b/,"function":/[a-z0-9_]+(?=\()/i,number:/\b-?(?:0x[\da-f]+|\d*\.?\d+(?:e[+-]?\d+)?)\b/i,operator:/--?|\+\+?|!=?=?|<=?|>=?|==?=?|&&?|\|\|?|\?|\*|\/|~|\^|%/,punctuation:/[{}[\];(),.:]/},i.languages.javascript=i.languages.extend("clike",{keyword:/\b(as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|false|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|true|try|typeof|var|void|while|with|yield)\b/,number:/\b-?(0x[\dA-Fa-f]+|0b[01]+|0o[0-7]+|\d*\.?\d+([Ee][+-]?\d+)?|NaN|Infinity)\b/,"function":/[_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*(?=\()/i}),i.languages.insertBefore("javascript","keyword",{regex:{pattern:/(^|[^/])\/(?!\/)(\[.+?]|\\.|[^/\\\r\n])+\/[gimyu]{0,5}(?=\s*($|[\r\n,.;})]))/,lookbehind:!0}}),i.languages.insertBefore("javascript","class-name",{"template-string":{pattern:/`(?:\\`|\\?[^`])*`/,inside:{interpolation:{pattern:/\$\{[^}]+\}/,inside:{"interpolation-punctuation":{pattern:/^\$\{|\}$/,alias:"punctuation"},rest:i.languages.javascript}},string:/[\s\S]+/}}}),i.languages.markup&&i.languages.insertBefore("markup","tag",{script:{pattern:/[\w\W]*?<\/script>/i,inside:{tag:{pattern:/|<\/script>/i,inside:i.languages.markup.tag.inside},rest:i.languages.javascript},alias:"language-javascript"}}),i.languages.js=i.languages.javascript,i.languages.c=i.languages.extend("clike",{keyword:/\b(asm|typeof|inline|auto|break|case|char|const|continue|default|do|double|else|enum|extern|float|for|goto|if|int|long|register|return|short|signed|sizeof|static|struct|switch|typedef|union|unsigned|void|volatile|while)\b/,operator:/\-[>-]?|\+\+?|!=?|<>?=?|==?|&&?|\|?\||[~^%?*\/]/,number:/\b-?(?:0x[\da-f]+|\d*\.?\d+(?:e[+-]?\d+)?)[ful]*\b/i}),i.languages.insertBefore("c","string",{macro:{pattern:/(^\s*)#\s*[a-z]+([^\r\n\\]|\\.|\\(?:\r\n?|\n))*/im,lookbehind:!0,alias:"property",inside:{string:{pattern:/(#\s*include\s*)(<.+?>|("|')(\\?.)+?\3)/,lookbehind:!0}}}}),delete i.languages.c["class-name"],delete i.languages.c["boolean"],i.languages.csharp=i.languages.extend("clike",{keyword:/\b(abstract|as|async|await|base|bool|break|byte|case|catch|char|checked|class|const|continue|decimal|default|delegate|do|double|else|enum|event|explicit|extern|false|finally|fixed|float|for|foreach|goto|if|implicit|in|int|interface|internal|is|lock|long|namespace|new|null|object|operator|out|override|params|private|protected|public|readonly|ref|return|sbyte|sealed|short|sizeof|stackalloc|static|string|struct|switch|this|throw|true|try|typeof|uint|ulong|unchecked|unsafe|ushort|using|virtual|void|volatile|while|add|alias|ascending|async|await|descending|dynamic|from|get|global|group|into|join|let|orderby|partial|remove|select|set|value|var|where|yield)\b/,string:[/@("|')(\1\1|\\\1|\\?(?!\1)[\s\S])*\1/,/("|')(\\?.)*?\1/],number:/\b-?(0x[\da-f]+|\d*\.?\d+)\b/i}),i.languages.insertBefore("csharp","keyword",{preprocessor:{pattern:/(^\s*)#.*/m,lookbehind:!0}}),i.languages.cpp=i.languages.extend("c",{keyword:/\b(alignas|alignof|asm|auto|bool|break|case|catch|char|char16_t|char32_t|class|compl|const|constexpr|const_cast|continue|decltype|default|delete|do|double|dynamic_cast|else|enum|explicit|export|extern|float|for|friend|goto|if|inline|int|long|mutable|namespace|new|noexcept|nullptr|operator|private|protected|public|register|reinterpret_cast|return|short|signed|sizeof|static|static_assert|static_cast|struct|switch|template|this|thread_local|throw|try|typedef|typeid|typename|union|unsigned|using|virtual|void|volatile|wchar_t|while)\b/,"boolean":/\b(true|false)\b/,operator:/[-+]{1,2}|!=?|<{1,2}=?|>{1,2}=?|\->|:{1,2}|={1,2}|\^|~|%|&{1,2}|\|?\||\?|\*|\/|\b(and|and_eq|bitand|bitor|not|not_eq|or|or_eq|xor|xor_eq)\b/}),i.languages.insertBefore("cpp","keyword",{"class-name":{pattern:/(class\s+)[a-z0-9_]+/i,lookbehind:!0}}),i.languages.java=i.languages.extend("clike",{keyword:/\b(abstract|continue|for|new|switch|assert|default|goto|package|synchronized|boolean|do|if|private|this|break|double|implements|protected|throw|byte|else|import|public|throws|case|enum|instanceof|return|transient|catch|extends|int|short|try|char|final|interface|static|void|class|finally|long|strictfp|volatile|const|float|native|super|while)\b/,number:/\b0b[01]+\b|\b0x[\da-f]*\.?[\da-fp\-]+\b|\b\d*\.?\d+(?:e[+-]?\d+)?[df]?\b/i,operator:{pattern:/(^|[^.])(?:\+[+=]?|-[-=]?|!=?|<>?>?=?|==?|&[&=]?|\|[|=]?|\*=?|\/=?|%=?|\^=?|[?:~])/m,lookbehind:!0}}),i.languages.php=i.languages.extend("clike",{keyword:/\b(and|or|xor|array|as|break|case|cfunction|class|const|continue|declare|default|die|do|else|elseif|enddeclare|endfor|endforeach|endif|endswitch|endwhile|extends|for|foreach|function|include|include_once|global|if|new|return|static|switch|use|require|require_once|var|while|abstract|interface|public|implements|private|protected|parent|throw|null|echo|print|trait|namespace|final|yield|goto|instanceof|finally|try|catch)\b/i,constant:/\b[A-Z0-9_]{2,}\b/,comment:{pattern:/(^|[^\\])(?:\/\*[\w\W]*?\*\/|\/\/.*)/,lookbehind:!0}}),i.languages.insertBefore("php","class-name",{"shell-comment":{pattern:/(^|[^\\])#.*/,lookbehind:!0,alias:"comment"}}),i.languages.insertBefore("php","keyword",{delimiter:/\?>|<\?(?:php)?/i,variable:/\$\w+\b/i,"package":{pattern:/(\\|namespace\s+|use\s+)[\w\\]+/,lookbehind:!0,inside:{punctuation:/\\/}}}),i.languages.insertBefore("php","operator",{property:{pattern:/(->)[\w]+/,lookbehind:!0}}),i.languages.markup&&(i.hooks.add("before-highlight",function(t){"php"===t.language&&(t.tokenStack=[],t.backupCode=t.code,t.code=t.code.replace(/(?:<\?php|<\?)[\w\W]*?(?:\?>)/gi,function(e){return t.tokenStack.push(e),"{{{PHP"+t.tokenStack.length+"}}}"}))}),i.hooks.add("before-insert",function(e){"php"===e.language&&(e.code=e.backupCode,delete e.backupCode)}),i.hooks.add("after-highlight",function(e){if("php"===e.language){for(var t=0,n=void 0;n=e.tokenStack[t];t++)e.highlightedCode=e.highlightedCode.replace("{{{PHP"+(t+1)+"}}}",i.highlight(n,e.grammar,"php").replace(/\$/g,"$$$$"));e.element.innerHTML=e.highlightedCode}}),i.hooks.add("wrap",function(e){"php"===e.language&&"markup"===e.type&&(e.content=e.content.replace(/(\{\{\{PHP[0-9]+\}\}\})/g,'$1'))}),i.languages.insertBefore("php","comment",{markup:{pattern:/<[^?]\/?(.*?)>/,inside:i.languages.markup},php:/\{\{\{PHP[0-9]+\}\}\}/})),i.languages.python={comment:{pattern:/(^|[^\\])#.*/,lookbehind:!0},string:/"""[\s\S]+?"""|'''[\s\S]+?'''|("|')(?:\\?.)*?\1/,"function":{pattern:/((?:^|\s)def[ \t]+)[a-zA-Z_][a-zA-Z0-9_]*(?=\()/g,lookbehind:!0},"class-name":{pattern:/(\bclass\s+)[a-z0-9_]+/i,lookbehind:!0},keyword:/\b(?:as|assert|async|await|break|class|continue|def|del|elif|else|except|exec|finally|for|from|global|if|import|in|is|lambda|pass|print|raise|return|try|while|with|yield)\b/,"boolean":/\b(?:True|False)\b/,number:/\b-?(?:0[bo])?(?:(?:\d|0x[\da-f])[\da-f]*\.?\d*|\.\d+)(?:e[+-]?\d+)?j?\b/i,operator:/[-+%=]=?|!=|\*\*?=?|\/\/?=?|<[<=>]?|>[=>]?|[&|^~]|\b(?:or|and|not)\b/,punctuation:/[{}[\];(),.:]/},function(e){e.languages.ruby=e.languages.extend("clike",{comment:/#(?!\{[^\r\n]*?\}).*/,keyword:/\b(alias|and|BEGIN|begin|break|case|class|def|define_method|defined|do|each|else|elsif|END|end|ensure|false|for|if|in|module|new|next|nil|not|or|raise|redo|require|rescue|retry|return|self|super|then|throw|true|undef|unless|until|when|while|yield)\b/});var t={pattern:/#\{[^}]+\}/,inside:{delimiter:{pattern:/^#\{|\}$/,alias:"tag"},rest:e.util.clone(e.languages.ruby)}};e.languages.insertBefore("ruby","keyword",{regex:[{pattern:/%r([^a-zA-Z0-9\s\{\(\[<])(?:[^\\]|\\[\s\S])*?\1[gim]{0,3}/,inside:{interpolation:t}},{pattern:/%r\((?:[^()\\]|\\[\s\S])*\)[gim]{0,3}/,inside:{interpolation:t}},{pattern:/%r\{(?:[^#{}\\]|#(?:\{[^}]+\})?|\\[\s\S])*\}[gim]{0,3}/,inside:{interpolation:t}},{pattern:/%r\[(?:[^\[\]\\]|\\[\s\S])*\][gim]{0,3}/,inside:{interpolation:t}},{pattern:/%r<(?:[^<>\\]|\\[\s\S])*>[gim]{0,3}/,inside:{interpolation:t}},{pattern:/(^|[^/])\/(?!\/)(\[.+?]|\\.|[^/\r\n])+\/[gim]{0,3}(?=\s*($|[\r\n,.;})]))/,lookbehind:!0}],variable:/[@$]+[a-zA-Z_][a-zA-Z_0-9]*(?:[?!]|\b)/,symbol:/:[a-zA-Z_][a-zA-Z_0-9]*(?:[?!]|\b)/}),e.languages.insertBefore("ruby","number",{builtin:/\b(Array|Bignum|Binding|Class|Continuation|Dir|Exception|FalseClass|File|Stat|File|Fixnum|Fload|Hash|Integer|IO|MatchData|Method|Module|NilClass|Numeric|Object|Proc|Range|Regexp|String|Struct|TMS|Symbol|ThreadGroup|Thread|Time|TrueClass)\b/,constant:/\b[A-Z][a-zA-Z_0-9]*(?:[?!]|\b)/}),e.languages.ruby.string=[{pattern:/%[qQiIwWxs]?([^a-zA-Z0-9\s\{\(\[<])(?:[^\\]|\\[\s\S])*?\1/,inside:{interpolation:t}},{pattern:/%[qQiIwWxs]?\((?:[^()\\]|\\[\s\S])*\)/,inside:{interpolation:t}},{pattern:/%[qQiIwWxs]?\{(?:[^#{}\\]|#(?:\{[^}]+\})?|\\[\s\S])*\}/,inside:{interpolation:t}},{pattern:/%[qQiIwWxs]?\[(?:[^\[\]\\]|\\[\s\S])*\]/,inside:{interpolation:t}},{pattern:/%[qQiIwWxs]?<(?:[^<>\\]|\\[\s\S])*>/,inside:{interpolation:t}},{pattern:/("|')(#\{[^}]+\}|\\(?:\r?\n|\r)|\\?.)*?\1/,inside:{interpolation:t}}]}(i);function a(){}function o(e){return function(){return e}}function s(){return f}var l,u={isCodeSample:function B(e){return e&&"PRE"===e.nodeName&&-1!==e.className.indexOf("language-")},trimArg:function M(n){return function(e,t){return n(t)}}},d=o(!1),p=o(!0),f=(l={fold:function(e,t){return e()},is:d,isSome:d,isNone:p,getOr:b,getOrThunk:m,getOrDie:function(e){throw new Error(e||"error: getOrDie called on none.")},getOrNull:o(null),getOrUndefined:o(undefined),or:b,orThunk:m,map:s,each:a,bind:s,exists:d,forall:p,filter:s,equals:h,equals_:h,toArray:function(){return[]},toString:o("none()")},Object.freeze&&Object.freeze(l),l);function h(e){return e.isNone()}function m(e){return e()}function b(e){return e}function y(e){var t=e.selection?e.selection.getNode():null;return u.isCodeSample(t)?w.some(t):w.none()}var v,k=function(n){function e(){return r}function t(e){return e(n)}var a=o(n),r={fold:function(e,t){return t(n)},is:function(e){return n===e},isSome:p,isNone:d,getOr:a,getOrThunk:a,getOrDie:a,getOrNull:a,getOrUndefined:a,or:e,orThunk:e,map:function(e){return k(e(n))},each:function(e){e(n)},bind:t,exists:t,forall:t,filter:function(e){return e(n)?r:f},toArray:function(){return[n]},toString:function(){return"some("+n+")"},equals:function(e){return e.is(n)},equals_:function(e,t){return e.fold(d,function(e){return t(n,e)})}};return r},w={some:k,none:s,from:function(e){return null===e||e===undefined?f:k(e)}},x=y,S=function(t,n,a){t.undoManager.transact(function(){var e=y(t);return a=r.DOM.encode(a),e.fold(function(){t.insertContent('

'+a+"
"),t.selection.select(t.$("#__new").removeAttr("id")[0])},function(e){t.dom.setAttrib(e,"class","language-"+n),e.innerHTML=a,i.highlightElement(e),t.selection.select(e)})})},A=function(e){return y(e).fold(function(){return""},function(e){return e.textContent})},C=function(e){return e.settings.codesample_languages},_=function(e){var t=C(e);return t||[{text:"HTML/XML",value:"markup"},{text:"JavaScript",value:"javascript"},{text:"CSS",value:"css"},{text:"PHP",value:"php"},{text:"Ruby",value:"ruby"},{text:"Python",value:"python"},{text:"Java",value:"java"},{text:"C",value:"c"},{text:"C#",value:"csharp"},{text:"C++",value:"cpp"}]},N=function(e,n){return x(e).fold(function(){return n},function(e){var t=e.className.match(/language-(\w+)/);return t?t[1]:n})},O=(v="function",function(e){return function(e){if(null===e)return"null";var t=typeof e;return"object"==t&&(Array.prototype.isPrototypeOf(e)||e.constructor&&"Array"===e.constructor.name)?"array":"object"==t&&(String.prototype.isPrototypeOf(e)||e.constructor&&"String"===e.constructor.name)?"string":t}(e)===v}),z=Array.prototype.slice,P=(O(Array.from)&&Array.from,function(n){var e=_(n),t=function(e){return 0===e.length?w.none():w.some(e[0])}(e).fold(function(){return""},function(e){return e.value}),a=N(n,t),r=A(n);n.windowManager.open({title:"Insert/Edit Code Sample",size:"large",body:{type:"panel",items:[{type:"selectbox",name:"language",label:"Language",items:e},{type:"textarea",name:"code",label:"Code view"}]},buttons:[{type:"cancel",name:"cancel",text:"Cancel"},{type:"submit",name:"save",text:"Save",primary:!0}],initialData:{language:a,code:r},onSubmit:function(e){var t=e.getData();S(n,t.language,t.code),e.close()}})}),W=function(t){t.addCommand("codesample",function(){var e=t.selection.getNode();t.selection.isCollapsed()||u.isCodeSample(e)?P(t):t.formatter.toggle("code")})},j=function(n){var r=n.$;n.on("PreProcess",function(e){r("pre[contenteditable=false]",e.node).filter(u.trimArg(u.isCodeSample)).each(function(e,t){var n=r(t),a=t.textContent;n.attr("class",r.trim(n.attr("class"))),n.removeAttr("contentEditable"),n.empty().append(r("").each(function(){this.textContent=a}))})}),n.on("SetContent",function(){var e=r("pre").filter(u.trimArg(u.isCodeSample)).filter(function(e,t){return"false"!==t.contentEditable});e.length&&n.undoManager.transact(function(){e.each(function(e,t){r(t).find("br").each(function(e,t){t.parentNode.replaceChild(n.getDoc().createTextNode("\n"),t)}),t.contentEditable="false",t.innerHTML=n.dom.encode(t.textContent),i.highlightElement(t),t.className=r.trim(t.className)})})})},T=function(n){n.ui.registry.addToggleButton("codesample",{icon:"code-sample",tooltip:"Insert/edit code sample",onAction:function(){return P(n)},onSetup:function(e){function t(){e.setActive(function(e){var t=e.selection.getStart();return e.dom.is(t,"pre.language-markup")}(n))}return n.on("NodeChange",t),function(){return n.off("NodeChange",t)}}}),n.ui.registry.addMenuItem("codesample",{text:"Code sample...",icon:"code-sample",onAction:function(){return P(n)}})};!function F(){e.add("codesample",function(t){j(t),T(t),W(t),t.on("dblclick",function(e){u.isCodeSample(e.target)&&P(t)})})}()}(window); \ No newline at end of file diff --git a/website/js/vendor/tinymce/js/tinymce/plugins/colorpicker/plugin.min.js b/website/js/vendor/tinymce/js/tinymce/plugins/colorpicker/plugin.min.js new file mode 100644 index 0000000..51e2463 --- /dev/null +++ b/website/js/vendor/tinymce/js/tinymce/plugins/colorpicker/plugin.min.js @@ -0,0 +1,9 @@ +/** + * Copyright (c) Tiny Technologies, Inc. All rights reserved. + * Licensed under the LGPL or a commercial license. + * For LGPL see License.txt in the project root for license information. + * For commercial licenses see https://www.tiny.cloud/ + * + * Version: 5.1.5 (2019-12-19) + */ +!function(o){"use strict";var i=tinymce.util.Tools.resolve("tinymce.PluginManager");!function n(){i.add("colorpicker",function(){o.console.warn("Color picker plugin is now built in to the core editor, please remove it from your editor configuration")})}()}(window); \ No newline at end of file diff --git a/website/js/vendor/tinymce/js/tinymce/plugins/contextmenu/plugin.min.js b/website/js/vendor/tinymce/js/tinymce/plugins/contextmenu/plugin.min.js new file mode 100644 index 0000000..b9a9522 --- /dev/null +++ b/website/js/vendor/tinymce/js/tinymce/plugins/contextmenu/plugin.min.js @@ -0,0 +1,9 @@ +/** + * Copyright (c) Tiny Technologies, Inc. All rights reserved. + * Licensed under the LGPL or a commercial license. + * For LGPL see License.txt in the project root for license information. + * For commercial licenses see https://www.tiny.cloud/ + * + * Version: 5.1.5 (2019-12-19) + */ +!function(n){"use strict";var o=tinymce.util.Tools.resolve("tinymce.PluginManager");!function e(){o.add("contextmenu",function(){n.console.warn("Context menu plugin is now built in to the core editor, please remove it from your editor configuration")})}()}(window); \ No newline at end of file diff --git a/website/js/vendor/tinymce/js/tinymce/plugins/directionality/plugin.min.js b/website/js/vendor/tinymce/js/tinymce/plugins/directionality/plugin.min.js new file mode 100644 index 0000000..0105327 --- /dev/null +++ b/website/js/vendor/tinymce/js/tinymce/plugins/directionality/plugin.min.js @@ -0,0 +1,9 @@ +/** + * Copyright (c) Tiny Technologies, Inc. All rights reserved. + * Licensed under the LGPL or a commercial license. + * For LGPL see License.txt in the project root for license information. + * For commercial licenses see https://www.tiny.cloud/ + * + * Version: 5.1.5 (2019-12-19) + */ +!function(i){"use strict";function n(){}function u(n){return function(){return n}}function t(){return a}var e,r=tinymce.util.Tools.resolve("tinymce.PluginManager"),c=tinymce.util.Tools.resolve("tinymce.util.Tools"),o=function(n,t){var e,r=n.dom,o=n.selection.getSelectedBlocks();o.length&&(e=r.getAttrib(o[0],"dir"),c.each(o,function(n){r.getParent(n.parentNode,'*[dir="'+t+'"]',r.getRoot())||r.setAttrib(n,"dir",e!==t?t:null)}),n.nodeChanged())},d=function(n){n.addCommand("mceDirectionLTR",function(){o(n,"ltr")}),n.addCommand("mceDirectionRTL",function(){o(n,"rtl")})},f=u(!1),l=u(!0),a=(e={fold:function(n,t){return n()},is:f,isSome:f,isNone:l,getOr:s,getOrThunk:N,getOrDie:function(n){throw new Error(n||"error: getOrDie called on none.")},getOrNull:u(null),getOrUndefined:u(undefined),or:s,orThunk:N,map:t,each:n,bind:t,exists:f,forall:l,filter:t,equals:m,equals_:m,toArray:function(){return[]},toString:u("none()")},Object.freeze&&Object.freeze(e),e);function m(n){return n.isNone()}function N(n){return n()}function s(n){return n}function g(n,t){var e=n.dom(),r=i.window.getComputedStyle(e).getPropertyValue(t),o=""!==r||function(n){var t=A(n)?n.dom().parentNode:n.dom();return t!==undefined&&null!==t&&t.ownerDocument.body.contains(t)}(n)?r:w(e,t);return null===o?undefined:o}function T(t,r){return function(e){function n(n){var t=p.fromDom(n.element);e.setActive(function(n){return"rtl"===g(n,"direction")?"rtl":"ltr"}(t)===r)}return t.on("NodeChange",n),function(){return t.off("NodeChange",n)}}}var E,O,y=function(e){function n(){return o}function t(n){return n(e)}var r=u(e),o={fold:function(n,t){return t(e)},is:function(n){return e===n},isSome:l,isNone:f,getOr:r,getOrThunk:r,getOrDie:r,getOrNull:r,getOrUndefined:r,or:n,orThunk:n,map:function(n){return y(n(e))},each:function(n){n(e)},bind:t,exists:t,forall:t,filter:function(n){return n(e)?o:a},toArray:function(){return[e]},toString:function(){return"some("+e+")"},equals:function(n){return n.is(e)},equals_:function(n,t){return n.fold(f,function(n){return t(e,n)})}};return o},D=function(n){return null===n||n===undefined?a:y(n)},h=function(n){if(null===n||n===undefined)throw new Error("Node cannot be null or undefined");return{dom:u(n)}},p={fromHtml:function(n,t){var e=(t||i.document).createElement("div");if(e.innerHTML=n,!e.hasChildNodes()||1Could not load emoticons

"}]},buttons:[{type:"cancel",text:"Close",primary:!0}],initialData:{pattern:"",results:[]}}),a.focus(M),a.unblock()}))},R=function(n,t){function e(){return U(n,t)}n.ui.registry.addButton("emoticons",{tooltip:"Emoticons",icon:"emoji",onAction:e}),n.ui.registry.addMenuItem("emoticons",{text:"Emoticons...",icon:"emoji",onAction:e})};!function B(){r.add("emoticons",function(n,t){var e=E(n,t),r=F(n),o=h(n,e,r);R(n,o),function(r,o){r.ui.registry.addAutocompleter("emoticons",{ch:":",columns:"auto",minChars:2,fetch:function(t,e){return o.waitForLoad().then(function(){var n=o.listAll();return d(n,t,A.some(e))})},onAction:function(n,t,e){r.selection.setRng(t),r.insertContent(e),n.hide()}})}(n,o)})}()}(window); \ No newline at end of file diff --git a/website/js/vendor/tinymce/js/tinymce/plugins/fullpage/plugin.min.js b/website/js/vendor/tinymce/js/tinymce/plugins/fullpage/plugin.min.js new file mode 100644 index 0000000..2e5e160 --- /dev/null +++ b/website/js/vendor/tinymce/js/tinymce/plugins/fullpage/plugin.min.js @@ -0,0 +1,9 @@ +/** + * Copyright (c) Tiny Technologies, Inc. All rights reserved. + * Licensed under the LGPL or a commercial license. + * For LGPL see License.txt in the project root for license information. + * For commercial licenses see https://www.tiny.cloud/ + * + * Version: 5.1.5 (2019-12-19) + */ +!function(m){"use strict";function f(t){return e({validate:!1,root_name:"#document"}).parse(t)}function g(t){return t.replace(/<\/?[A-Z]+/g,function(t){return t.toLowerCase()})}var o,i=function(t){function e(){return n}var n=t;return{get:e,set:function(t){n=t},clone:function(){return i(e())}}},t=tinymce.util.Tools.resolve("tinymce.PluginManager"),p=tinymce.util.Tools.resolve("tinymce.util.Tools"),e=tinymce.util.Tools.resolve("tinymce.html.DomParser"),h=tinymce.util.Tools.resolve("tinymce.html.Node"),y=tinymce.util.Tools.resolve("tinymce.html.Serializer"),v=function(t){return t.getParam("fullpage_hide_in_source_view")},r=function(t){return t.getParam("fullpage_default_xml_pi")},a=function(t){return t.getParam("fullpage_default_encoding")},c=function(t){return t.getParam("fullpage_default_font_family")},u=function(t){return t.getParam("fullpage_default_font_size")},s=function(t){return t.getParam("fullpage_default_text_color")},d=function(t){return t.getParam("fullpage_default_title")},_=function(t){return t.getParam("fullpage_default_doctype","")},b=f,n=function(t,e){var n,i,l=f(e),r={};function o(t,e){return t.attr(e)||""}return r.fontface=c(t),r.fontsize=u(t),7===(n=l.firstChild).type&&(r.xml_pi=!0,(i=/encoding="([^"]+)"/.exec(n.value))&&(r.docencoding=i[1])),(n=l.getAll("#doctype")[0])&&(r.doctype=""),(n=l.getAll("title")[0])&&n.firstChild&&(r.title=n.firstChild.value),p.each(l.getAll("meta"),function(t){var e,n=t.attr("name"),i=t.attr("http-equiv");n?r[n.toLowerCase()]=t.attr("content"):"Content-Type"===i&&(e=/charset\s*=\s*(.*)\s*/gi.exec(t.attr("content")))&&(r.docencoding=e[1])}),(n=l.getAll("html")[0])&&(r.langcode=o(n,"lang")||o(n,"xml:lang")),r.stylesheets=[],p.each(l.getAll("link"),function(t){"stylesheet"===t.attr("rel")&&r.stylesheets.push(t.attr("href"))}),(n=l.getAll("body")[0])&&(r.langdir=o(n,"dir"),r.style=o(n,"style"),r.visited_color=o(n,"vlink"),r.link_color=o(n,"link"),r.active_color=o(n,"alink")),r},x=function(t,r,e){var o,n,i,a,l,c=t.dom;function u(t,e,n){t.attr(e,n||undefined)}function s(t){n.firstChild?n.insert(t,n.firstChild):n.append(t)}o=f(e),(n=o.getAll("head")[0])||(a=o.getAll("html")[0],n=new h("head",1),a.firstChild?a.insert(n,a.firstChild,!0):a.append(n)),a=o.firstChild,r.xml_pi?(l='version="1.0"',r.docencoding&&(l+=' encoding="'+r.docencoding+'"'),7!==a.type&&(a=new h("xml",7),o.insert(a,o.firstChild,!0)),a.value=l):a&&7===a.type&&a.remove(),a=o.getAll("#doctype")[0],r.doctype?(a||(a=new h("#doctype",10),r.xml_pi?o.insert(a,o.firstChild):s(a)),a.value=r.doctype.substring(9,r.doctype.length-1)):a&&a.remove(),a=null,p.each(o.getAll("meta"),function(t){"Content-Type"===t.attr("http-equiv")&&(a=t)}),r.docencoding?(a||((a=new h("meta",1)).attr("http-equiv","Content-Type"),a.shortEnded=!0,s(a)),a.attr("content","text/html; charset="+r.docencoding)):a&&a.remove(),a=o.getAll("title")[0],r.title?(a?a.empty():s(a=new h("title",1)),a.append(new h("#text",3)).value=r.title):a&&a.remove(),p.each("keywords,description,author,copyright,robots".split(","),function(t){var e,n,i=o.getAll("meta"),l=r[t];for(e=0;e"))},C=Object.prototype.hasOwnProperty,k=(o=function(t,e){return e},function(){for(var t=new Array(arguments.length),e=0;e/g,function(t,e){return unescape(e)})},T=p.each,O=function(t){var e,n="",i="";if(r(t)){var l=a(t);n+='\n'}return n+=_(t),n+="\n\n\n",(e=d(t))&&(n+=""+e+"\n"),(e=a(t))&&(n+='\n'),(e=c(t))&&(i+="font-family: "+e+";"),(e=u(t))&&(i+="font-size: "+e+";"),(e=s(t))&&(i+="color: "+e+";"),n+="\n\n"},D=function(e,n,i){e.on("BeforeSetContent",function(t){!function(t,e,n,i){var l,r,o,a,c="",u=t.dom;if(!(i.selection||(o=A(t.settings.protect,i.content),"raw"===i.format&&e.get()||i.source_view&&v(t)))){0!==o.length||i.source_view||(o=p.trim(e.get())+"\n"+p.trim(o)+"\n"+p.trim(n.get())),-1!==(l=(o=o.replace(/<(\/?)BODY/gi,"<$1body")).indexOf("",l),e.set(g(o.substring(0,l+1))),-1===(r=o.indexOf("\n")),a=b(e.get()),T(a.getAll("style"),function(t){t.firstChild&&(c+=t.firstChild.value)});var s=a.getAll("body")[0];s&&u.setAttribs(t.getBody(),{style:s.attr("style")||"",dir:s.attr("dir")||"",vLink:s.attr("vlink")||"",link:s.attr("link")||"",aLink:s.attr("alink")||""}),u.remove("fullpage_styles");var d=t.getDoc().getElementsByTagName("head")[0];if(c)u.add(d,"style",{id:"fullpage_styles"}).appendChild(m.document.createTextNode(c));var f={};p.each(d.getElementsByTagName("link"),function(t){"stylesheet"===t.rel&&t.getAttribute("data-mce-fullpage")&&(f[t.href]=t)}),p.each(a.getAll("link"),function(t){var e=t.attr("href");if(!e)return!0;f[e]||"stylesheet"!==t.attr("rel")||u.add(d,"link",{rel:"stylesheet",text:"text/css",href:e,"data-mce-fullpage":"1"}),delete f[e]}),p.each(f,function(t){t.parentNode.removeChild(t)})}}(e,n,i,t)}),e.on("GetContent",function(t){!function(t,e,n,i){i.selection||i.source_view&&v(t)||(i.content=P(p.trim(e)+"\n"+p.trim(i.content)+"\n"+p.trim(n)))}(e,n.get(),i.get(),t)})},E=function(t){t.ui.registry.addButton("fullpage",{tooltip:"Metadata and document properties",icon:"document-properties",onAction:function(){t.execCommand("mceFullPageProperties")}}),t.ui.registry.addMenuItem("fullpage",{text:"Metadata and document properties",icon:"document-properties",onAction:function(){t.execCommand("mceFullPageProperties")}})};!function z(){t.add("fullpage",function(t){var e=i(""),n=i("");w(t,e),E(t),D(t,e,n)})}()}(window); \ No newline at end of file diff --git a/website/js/vendor/tinymce/js/tinymce/plugins/fullscreen/plugin.min.js b/website/js/vendor/tinymce/js/tinymce/plugins/fullscreen/plugin.min.js new file mode 100644 index 0000000..c03217e --- /dev/null +++ b/website/js/vendor/tinymce/js/tinymce/plugins/fullscreen/plugin.min.js @@ -0,0 +1,9 @@ +/** + * Copyright (c) Tiny Technologies, Inc. All rights reserved. + * Licensed under the LGPL or a commercial license. + * For LGPL see License.txt in the project root for license information. + * For commercial licenses see https://www.tiny.cloud/ + * + * Version: 5.1.5 (2019-12-19) + */ +!function(l){"use strict";function e(){}function m(e){return function(){return e}}function n(){return s}var r,t=function(e){function n(){return r}var r=e;return{get:n,set:function(e){r=e},clone:function(){return t(n())}}},o=tinymce.util.Tools.resolve("tinymce.PluginManager"),i=function(e){return{isFullscreen:function(){return null!==e.get()}}},c=m(!1),u=m(!0),s=(r={fold:function(e,n){return e()},is:c,isSome:c,isNone:u,getOr:d,getOrThunk:a,getOrDie:function(e){throw new Error(e||"error: getOrDie called on none.")},getOrNull:m(null),getOrUndefined:m(undefined),or:d,orThunk:a,map:n,each:e,bind:n,exists:c,forall:u,filter:n,equals:f,equals_:f,toArray:function(){return[]},toString:m("none()")},Object.freeze&&Object.freeze(r),r);function f(e){return e.isNone()}function a(e){return e()}function d(e){return e}function h(n){return function(e){return function(e){if(null===e)return"null";var n=typeof e;return"object"==n&&(Array.prototype.isPrototypeOf(e)||e.constructor&&"Array"===e.constructor.name)?"array":"object"==n&&(String.prototype.isPrototypeOf(e)||e.constructor&&"String"===e.constructor.name)?"string":n}(e)===n}}function v(e,n){for(var r=e.length,t=new Array(r),o=0;o${name}');return{name:"plugins",title:"Plugins",items:[{type:"htmlpanel",presets:"document",html:[(n=e,null==n?"":'
'+function(t){var e=function(e){var t=F(e.plugins);return e.settings.forced_plugins===undefined?t:function(e,t){for(var n=[],o=0,a=e.length;o"+r(t,e)+""}),o=n.length,a=n.join("");return"

"+U.translate(["Plugins installed ({0}):",o])+"

    "+a+"
"}(n)+"
"),(t=y(["Accessibility Checker","Advanced Code Editor","Advanced Tables","Case Change","Checklist","Tiny Comments","Tiny Drive","Enhanced Media Embed","Format Painter","Link Checker","Mentions","MoxieManager","Page Embed","Permanent Pen","PowerPaste","Spell Checker Pro"],function(e){return"
  • "+U.translate(e)+"
  • "}).join(""),'

    '+U.translate("Premium plugins:")+"

    ")].join("")}]}},N=tinymce.util.Tools.resolve("tinymce.EditorManager"),L=function(){var e,t,n='TinyMCE '+(e=N.majorVersion,t=N.minorVersion,0===e.indexOf("@")?"X.X.X":e+"."+t)+"";return{name:"versions",title:"Version",items:[{type:"htmlpanel",html:"

    "+U.translate(["You are using {0}",n])+"

    ",presets:"document"}]}},B=function(){return{name:"keyboardnav",title:"Keyboard Navigation",items:[{type:"htmlpanel",presets:"document",html:"

    Editor UI keyboard navigation

    \n\n

    Activating keyboard navigation

    \n\n

    The sections of the outer UI of the editor - the menubar, toolbar, sidebar and footer - are all keyboard navigable. As such, there are multiple ways to activate keyboard navigation:

    \n
      \n
    • Focus the menubar: Alt + F9 (Windows) or ⌥F9 (MacOS)
    • \n
    • Focus the toolbar: Alt + F10 (Windows) or ⌥F10 (MacOS)
    • \n
    • Focus the footer: Alt + F11 (Windows) or ⌥F11 (MacOS)
    • \n
    \n\n

    Focusing the menubar or toolbar will start keyboard navigation at the first item in the menubar or toolbar, which will be highlighted with a gray background. Focusing the footer will start keyboard navigation at the first item in the element path, which will be highlighted with an underline.

    \n\n

    Moving between UI sections

    \n\n

    When keyboard navigation is active, pressing tab will move the focus to the next major section of the UI, where applicable. These sections are:

    \n
      \n
    • the menubar
    • \n
    • each group of the toolbar
    • \n
    • the sidebar
    • \n
    • the element path in the footer
    • \n
    • the wordcount toggle button in the footer
    • \n
    • the branding link in the footer
    • \n
    \n\n

    Pressing shift + tab will move backwards through the same sections, except when moving from the footer to the toolbar. Focusing the element path then pressing shift + tab will move focus to the first toolbar group, not the last.

    \n\n

    Moving within UI sections

    \n\n

    Keyboard navigation within UI sections can usually be achieved using the left and right arrow keys. This includes:

    \n
      \n
    • moving between menus in the menubar
    • \n
    • moving between buttons in a toolbar group
    • \n
    • moving between items in the element path
    • \n
    \n\n

    In all these UI sections, keyboard navigation will cycle within the section. For example, focusing the last button in a toolbar group then pressing right arrow will move focus to the first item in the same toolbar group.

    \n\n

    Executing buttons

    \n\n

    To execute a button, navigate the selection to the desired button and hit space or enter.

    \n\n

    Opening, navigating and closing menus

    \n\n

    When focusing a menubar button or a toolbar button with a menu, pressing space, enter or down arrow will open the menu. When the menu opens the first item will be selected. To move up or down the menu, press the up or down arrow key respectively. This is the same for submenus, which can also be opened and closed using the left and right arrow keys.

    \n\n

    To close any active menu, hit the escape key. When a menu is closed the selection will be restored to its previous selection. This also works for closing submenus.

    \n\n

    Context toolbars and menus

    \n\n

    To focus an open context toolbar such as the table context toolbar, press Ctrl + F9 (Windows) or ⌃F9 (MacOS).

    \n\n

    Context toolbar navigation is the same as toolbar navigation, and context menu navigation is the same as standard menu navigation.

    \n\n

    Dialog navigation

    \n\n

    There are two types of dialog UIs in TinyMCE: tabbed dialogs and non-tabbed dialogs.

    \n\n

    When a non-tabbed dialog is opened, the first interactive component in the dialog will be focused. Users can navigate between interactive components by pressing tab. This includes any footer buttons. Navigation will cycle back to the first dialog component if tab is pressed while focusing the last component in the dialog. Pressing shift + tab will navigate backwards.

    \n\n

    When a tabbed dialog is opened, the first button in the tab menu is focused. Pressing tab will navigate to the first interactive component in that tab, and will cycle through the tab\u2019s components, the footer buttons, then back to the tab button. To switch to another tab, focus the tab button for the current tab, then use the arrow keys to cycle through the tab buttons.

    "}]}};!function z(){t.add("help",function(e){var t=a({}),n=function(n){return{addTab:function(e){var t=n.get();t[e.name]=e,n.set(t)}}}(t),o=A(e,t);return s(e,o),i(e,o),e.shortcuts.add("Alt+0","Open help dialog","mceHelp"),n})}()}(); \ No newline at end of file diff --git a/website/js/vendor/tinymce/js/tinymce/plugins/hr/plugin.min.js b/website/js/vendor/tinymce/js/tinymce/plugins/hr/plugin.min.js new file mode 100644 index 0000000..9024d43 --- /dev/null +++ b/website/js/vendor/tinymce/js/tinymce/plugins/hr/plugin.min.js @@ -0,0 +1,9 @@ +/** + * Copyright (c) Tiny Technologies, Inc. All rights reserved. + * Licensed under the LGPL or a commercial license. + * For LGPL see License.txt in the project root for license information. + * For commercial licenses see https://www.tiny.cloud/ + * + * Version: 5.1.5 (2019-12-19) + */ +!function(){"use strict";var n=tinymce.util.Tools.resolve("tinymce.PluginManager"),o=function(n){n.addCommand("InsertHorizontalRule",function(){n.execCommand("mceInsertContent",!1,"
    ")})},t=function(n){n.ui.registry.addButton("hr",{icon:"horizontal-rule",tooltip:"Horizontal line",onAction:function(){return n.execCommand("InsertHorizontalRule")}}),n.ui.registry.addMenuItem("hr",{icon:"horizontal-rule",text:"Horizontal line",onAction:function(){return n.execCommand("InsertHorizontalRule")}})};!function e(){n.add("hr",function(n){o(n),t(n)})}()}(); \ No newline at end of file diff --git a/website/js/vendor/tinymce/js/tinymce/plugins/image/plugin.min.js b/website/js/vendor/tinymce/js/tinymce/plugins/image/plugin.min.js new file mode 100644 index 0000000..bced264 --- /dev/null +++ b/website/js/vendor/tinymce/js/tinymce/plugins/image/plugin.min.js @@ -0,0 +1,9 @@ +/** + * Copyright (c) Tiny Technologies, Inc. All rights reserved. + * Licensed under the LGPL or a commercial license. + * For LGPL see License.txt in the project root for license information. + * For commercial licenses see https://www.tiny.cloud/ + * + * Version: 5.1.5 (2019-12-19) + */ +!function(s){"use strict";function o(){}function a(t){return function(){return t}}function t(t){return t}function e(){return l}var n,r=tinymce.util.Tools.resolve("tinymce.PluginManager"),u=a(!1),c=a(!0),l=(n={fold:function(t,e){return t()},is:u,isSome:u,isNone:c,getOr:d,getOrThunk:f,getOrDie:function(t){throw new Error(t||"error: getOrDie called on none.")},getOrNull:a(null),getOrUndefined:a(undefined),or:d,orThunk:f,map:e,each:o,bind:e,exists:u,forall:c,filter:e,equals:i,equals_:i,toArray:function(){return[]},toString:a("none()")},Object.freeze&&Object.freeze(n),n);function i(t){return t.isNone()}function f(t){return t()}function d(t){return t}function m(e){return function(t){return function(t){if(null===t)return"null";var e=typeof t;return"object"==e&&(Array.prototype.isPrototypeOf(t)||t.constructor&&"Array"===t.constructor.name)?"array":"object"==e&&(String.prototype.isPrototypeOf(t)||t.constructor&&"String"===t.constructor.name)?"string":e}(t)===e}}function v(t){for(var e=[],n=0,r=t.length;n'+n+"")}else e.insertContent(i(e,t))},g=i,y=function(e){e.addCommand("mceInsertDate",function(){p(e,t(e))}),e.addCommand("mceInsertTime",function(){p(e,o(e))})},M=tinymce.util.Tools.resolve("tinymce.util.Tools"),S=function(e){function t(){return n}var n=e;return{get:t,set:function(e){n=e},clone:function(){return S(t())}}},v=function(n){var t=u(n),r=S(c(n));n.ui.registry.addSplitButton("insertdatetime",{icon:"insert-time",tooltip:"Insert date/time",select:function(e){return e===r.get()},fetch:function(e){e(M.map(t,function(e){return{type:"choiceitem",text:g(n,e),value:e}}))},onAction:function(){for(var e=[],t=0;t]+>[^<]+<\/a>$/.test(n)||-1===n.indexOf("href=")))},fn=R,ln=function(n,t){return function(n){return n.replace(/\uFEFF/g,"")}(t?t.innerText||t.textContent:n.getContent({format:"text"}))},sn=L,dn=F,mn={sanitize:function(n){return K(q)(n)},sanitizeWith:K,createUi:function(t,e){return function(n){return{name:t,type:"selectbox",label:e,items:n}}},getValue:q},hn=function(n){function t(){return e}var e=n;return{get:t,set:function(n){e=n},clone:function(){return hn(t())}}},pn=function(n,r){function e(n,t){var e=function(n,t){return"link"===t?n.catalogs.link:"anchor"===t?n.catalogs.anchor:J.none()}(r,t.name).getOr([]);return B(o.get(),t.name,e,n)}var o=hn(n.text);return{onChange:function(n,t){return"url"===t.name?function(n){if(o.get().length<=0){var t=n.url.meta.text!==undefined?n.url.meta.text:n.url.value;return J.some({text:t})}return J.none()}(n()):E(["anchor","link"],t.name)?e(n(),t):("text"===t.name&&o.set(n().text),J.none())}}},gn={},vn={exports:gn};V=undefined,W=gn,H=vn,$=undefined,function(n){"object"==typeof W&&void 0!==H?H.exports=n():"function"==typeof V&&V.amd?V([],n):("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).EphoxContactWrapper=n()}(function(){return function l(i,u,c){function a(t,n){if(!u[t]){if(!i[t]){var e="function"==typeof $&&$;if(!n&&e)return e(t,!0);if(f)return f(t,!0);var r=new Error("Cannot find module '"+t+"'");throw r.code="MODULE_NOT_FOUND",r}var o=u[t]={exports:{}};i[t][0].call(o.exports,function(n){return a(i[t][1][n]||n)},o,o.exports,l,i,u,c)}return u[t].exports}for(var f="function"==typeof $&&$,n=0;ne.length?ne(t,e,n):ee(t,e,n)},[]);return S(n).map(function(e){return e.list})}(e.contentDocument,n).toArray()}function de(e){var n=g(Jn.getSelectedListItems(e),bn.fromDom);return A(N(n,t(re)),N(function(e){var n=Xe.call(e,0);return n.reverse(),n}(n),t(re)),function(e,n){return{start:e,end:n}})}function le(t,e,r){var n=function(e,n){var t=Ge(!1);return g(e,function(e){return{sourceList:e,entries:tt(0,n,t,e)}})}(e,de(t));p(n,function(e){!function(e,n){p(v(e,ie),function(e){return function(e,n){switch(e){case"Indent":n.depth++;break;case"Outdent":n.depth--;break;case"Flatten":n.depth=0}}(n,e)})}(e.entries,r);var n=function(n,e){return y(function(e,n){if(0===e.length)return[];for(var t=n(e[0]),r=[],o=[],i=0,u=e.length;i=e.childNodes.length?t.data.length:0}:t.previousSibling&&Mn(t.previousSibling)?{container:t.previousSibling,offset:t.previousSibling.data.length}:t.nextSibling&&Mn(t.nextSibling)?{container:t.nextSibling,offset:0}:{container:e,offset:n}}function ve(e,n){var t=g(Jn.getSelectedListRoots(e),bn.fromDom),r=g(Jn.getSelectedDlItems(e),bn.fromDom),o=!1;if(t.length||r.length){var i=e.selection.getBookmark();le(e,t,n),ge(e,n,r),e.selection.moveToBookmark(i),e.selection.setRng(ut(e.selection.getRng())),e.nodeChanged(),o=!0}return o}function he(e){return ve(e,"Indent")}function Ne(e){return ve(e,"Outdent")}function ye(e){return ve(e,"Flatten")}function Se(e){return/\btox\-/.test(e.className)}function Oe(e){switch(e){case"UL":return"ToggleUlList";case"OL":return"ToggleOlList";case"DL":return"ToggleDLList"}}function Ce(t,e){Pn.each(e,function(e,n){t.setAttribute(n,e)})}function be(e,n,t){!function(e,n,t){var r=t["list-style-type"]?t["list-style-type"]:null;e.setStyle(n,"list-style-type",r)}(e,n,t),function(e,n,t){Ce(n,t["list-attributes"]),Pn.each(e.select("li",n),function(e){Ce(e,t["list-item-attributes"])})}(e,n,t)}function Le(e,n,t,r){var o,i;for(o=n[t?"startContainer":"endContainer"],i=n[t?"startOffset":"endOffset"],1===o.nodeType&&(o=o.childNodes[Math.min(i,o.childNodes.length-1)]||o),!t&&qn(o.nextSibling)&&(o=o.nextSibling);o.parentNode!==r;){if(Vn(e,o))return o;if(/^(TD|TH)$/.test(o.parentNode.nodeName))return o;o=o.parentNode}return o}function Te(r,o,i){void 0===i&&(i={});var e,n=r.selection.getRng(!0),u="LI",t=Jn.getClosestListRootElm(r,r.selection.getStart(!0)),s=r.dom;"false"!==s.getContentEditable(r.selection.getNode())&&("DL"===(o=o.toUpperCase())&&(u="DT"),e=ct(n),Pn.each(function(t,e,r){for(var o,i=[],u=t.dom,n=Le(t,e,!0,r),s=Le(t,e,!1,r),a=[],c=n;c&&(a.push(c),c!==s);c=c.nextSibling);return Pn.each(a,function(e){if(Vn(t,e))return i.push(e),void(o=null);if(u.isBlock(e)||qn(e))return qn(e)&&u.remove(e),void(o=null);var n=e.nextSibling;st.isBookmarkNode(e)&&(Vn(t,n)||!n&&e.parentNode===r)?o=null:(o||(o=u.create("p"),e.parentNode.insertBefore(o,e),i.push(o)),o.appendChild(e))}),i}(r,n,t),function(e){var n,t;(t=e.previousSibling)&&Un(t)&&t.nodeName===o&&function(e,n,t){var r=e.getStyle(n,"list-style-type"),o=t?t["list-style-type"]:"";return r===(o=null===o?"":o)}(s,t,i)?(n=t,e=s.rename(e,u),t.appendChild(e)):(n=s.create(o),e.parentNode.insertBefore(n,e),n.appendChild(e),e=s.rename(e,u)),function(t,r,e){Pn.each(e,function(e){var n;return t.setStyle(r,((n={})[e]="",n))})}(s,e,["margin","margin-right","margin-bottom","margin-left","margin-top","padding","padding-right","padding-bottom","padding-left","padding-top"]),be(s,n,i),dt(r.dom,n)}),r.selection.setRng(ft(e)))}function De(e,n,t){return function(e,n){return e&&n&&Un(e)&&e.nodeName===n.nodeName}(n,t)&&function(e,n,t){return e.getStyle(n,"list-style-type",!0)===e.getStyle(t,"list-style-type",!0)}(e,n,t)&&function(e,n){return e.className===n.className}(n,t)}function Ee(n,e,t,r,o){if(e.nodeName!==r||lt(o)){var i=ct(n.selection.getRng(!0));Pn.each([e].concat(t),function(e){!function(e,n,t,r){if(n.nodeName!==t){var o=e.dom.rename(n,t);be(e.dom,o,r),j(e,Oe(t),o)}else be(e.dom,n,r),j(e,Oe(t),n)}(n,e,r,o)}),n.selection.setRng(ft(i))}else ye(n)}function we(e,n){var t,r=n.parentNode;"LI"===r.nodeName&&r.firstChild===n&&((t=r.previousSibling)&&"LI"===t.nodeName?(t.appendChild(n),Xn(e,r)&>.remove(r)):gt.setStyle(r,"listStyleType","none")),Un(r)&&(t=r.previousSibling)&&"LI"===t.nodeName&&t.appendChild(n)}function ke(e,n,t,r){var o=n.startContainer,i=n.startOffset;if(Mn(o)&&(t?i"}(n):"application/x-shockwave-flash"===n.source1mime?function(e){var t='';return e.poster&&(t+=''),t+=""}(n):-1!==n.source1mime.indexOf("audio")?function(e,t){return t?t(e):'"}(n,o):"script"===n.type?function(e){return' + diff --git a/website/tmpl/pages/gallery.html.mustache b/website/tmpl/pages/gallery.html.mustache new file mode 100644 index 0000000..35ee171 --- /dev/null +++ b/website/tmpl/pages/gallery.html.mustache @@ -0,0 +1,72 @@ +
    +
    +
    retour
    +
    + Gname{{ galleriename }}
    + Gallerie + +
    +
    +
    +
    + + + +
    \ No newline at end of file diff --git a/website/tmpl/pages/home.html.mustache b/website/tmpl/pages/home.html.mustache index 6eb0aa3..9796a85 100644 --- a/website/tmpl/pages/home.html.mustache +++ b/website/tmpl/pages/home.html.mustache @@ -1,40 +1,94 @@ -
    -
    -
    la féderation vous invite:
    -
    -
    - -
    +
    +
    + logo oldbell +
    Marc de Barbir
    Haircuts & Shaves
    For Men
    +
    -
    -
    -
    prochaines événements:
    -
    -
    -
    -
    DD.MM.YYYY
    -
    - Championnnat -
    +
    +
    +
    +
    +
    + Nos Produits +
    +
    +
    -
    -
    DD.MM.YYYY
    -
    - Championnnat -
    +
    +
    +
    -
    -
    DD.MM.YYYY
    -
    - Championnnat -
    +
    +
    +
    -
    -
    DD.MM.YYYY
    -
    - Championnnat -
    +
    +
    + +
    +
    + + + +
    + +
    +
    + + +
    +
    + + +
    +
    + + +
    +
    +
    +
    +
      +
    • Events
    • +
    • Event 1
    • +
    • Event 2
    • +
    +
    +
    +
      +
    • Presse
    • +
    • Press 1
    • +
    • Press 2
    • +
    +
    +
    +
    + diff --git a/website/tmpl/pages/rendezvous.html.mustache b/website/tmpl/pages/rendezvous.html.mustache new file mode 100644 index 0000000..dc9b5a6 --- /dev/null +++ b/website/tmpl/pages/rendezvous.html.mustache @@ -0,0 +1,66 @@ +
    +
    +
    retour
    +
    + Rendez-vous +
    +
    +
    + +
    +
    +
    +
    Choix du Produit / Service
    +
    +
    + +
    +
    +
    + + +
    +
    diff --git a/website/tmpl/pages/shop.html.mustache b/website/tmpl/pages/shop.html.mustache index c8f80b9..57d2d01 100644 --- a/website/tmpl/pages/shop.html.mustache +++ b/website/tmpl/pages/shop.html.mustache @@ -1,535 +1,6 @@ - -
    -
    -
    -
    Résultats (Jounée X)
    -
    -
    -
    -
    division nationale
    -
    - - - - - - - - - - - - - - -
    Team homeTeam visiteurRésultat
    Team 1Team 200 - 00
    Team 1Team 200 - 00
    Team 1Team 200 - 00
    Team 1Team 200 - 00
    Team 1Team 200 - 00
    Team 1Team 200 - 00
    Team 1Team 200 - 00
    Team 1Team 200 - 00
    -
    -
    division d'honneur
    -
    - - - - - - - - - - - - - - -
    Team homeTeam visiteurRésultat
    Team 1Team 200 - 00
    Team 1Team 200 - 00
    Team 1Team 200 - 00
    Team 1Team 200 - 00
    Team 1Team 200 - 00
    Team 1Team 200 - 00
    Team 1Team 200 - 00
    Team 1Team 200 - 00
    -
    -
    division 1
    -
    - - - - - - - - - - - - - - -
    Team homeTeam visiteurRésultat
    Team 1Team 200 - 00
    Team 1Team 200 - 00
    Team 1Team 200 - 00
    Team 1Team 200 - 00
    Team 1Team 200 - 00
    Team 1Team 200 - 00
    Team 1Team 200 - 00
    Team 1Team 200 - 00
    -
    -
    -
    -
    -
    Classement
    -
    -
    -
    -
    division nationale
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    PLTEAMGESPGEWGLVRLSCOREDIFSETSDIFPKT
    1 Team name0000000000 - 000000000 - 000000000 - 000
    1 Team name0000000000 - 000000000 - 000000000 - 000
    1 Team name0000000000 - 000000000 - 000000000 - 000
    1 Team name0000000000 - 000000000 - 000000000 - 000
    1 Team name0000000000 - 000000000 - 000000000 - 000
    1 Team name0000000000 - 000000000 - 000000000 - 000
    1 Team name0000000000 - 000000000 - 000000000 - 000
    1 Team name0000000000 - 000000000 - 000000000 - 000
    1 Team name0000000000 - 000000000 - 000000000 - 000
    -
    -
    division nationale
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    PLTEAMGESPGEWGLVRLSCOREDIFSETSDIFPKT
    1 Team name0000000000 - 000000000 - 000000000 - 000
    1 Team name0000000000 - 000000000 - 000000000 - 000
    1 Team name0000000000 - 000000000 - 000000000 - 000
    1 Team name0000000000 - 000000000 - 000000000 - 000
    1 Team name0000000000 - 000000000 - 000000000 - 000
    1 Team name0000000000 - 000000000 - 000000000 - 000
    1 Team name0000000000 - 000000000 - 000000000 - 000
    1 Team name0000000000 - 000000000 - 000000000 - 000
    1 Team name0000000000 - 000000000 - 000000000 - 000
    -
    -
    division nationale
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    PLTEAMGESPGEWGLVRLSCOREDIFSETSDIFPKT
    1 Team name0000000000 - 000000000 - 000000000 - 000
    1 Team name0000000000 - 000000000 - 000000000 - 000
    1 Team name0000000000 - 000000000 - 000000000 - 000
    1 Team name0000000000 - 000000000 - 000000000 - 000
    1 Team name0000000000 - 000000000 - 000000000 - 000
    1 Team name0000000000 - 000000000 - 000000000 - 000
    1 Team name0000000000 - 000000000 - 000000000 - 000
    1 Team name0000000000 - 000000000 - 000000000 - 000
    1 Team name0000000000 - 000000000 - 000000000 - 000
    -
    -
    -
    -
    - -
    -
    - -
    -
    - -
    -
    - -
    -
    - -
    -
    - -
    -
    - -
    -
    - -
    -
    - -
    -
    +
    +
    SHOP
    +
    - +
    \ No newline at end of file